Route RTT texture updates through GL backend
This commit is contained in:
@@ -4342,6 +4342,8 @@ void updates_texture_2d_through_dispatch(pp::tests::Harness& h)
|
||||
const auto status = pp::renderer::gl::update_opengl_texture_2d(
|
||||
pp::renderer::gl::OpenGlTexture2DUpdate {
|
||||
.texture_id = 31U,
|
||||
.x = 3,
|
||||
.y = 4,
|
||||
.width = 2,
|
||||
.height = 2,
|
||||
.pixel_format = 0x1908U,
|
||||
@@ -4358,11 +4360,48 @@ void updates_texture_2d_through_dispatch(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, recorded_binding_calls[0].second == 31U);
|
||||
PP_EXPECT(h, recorded_texture_image_calls.size() == 1U);
|
||||
PP_EXPECT(h, recorded_texture_image_calls[0].sub_image);
|
||||
PP_EXPECT(h, recorded_texture_image_calls[0].x == 3);
|
||||
PP_EXPECT(h, recorded_texture_image_calls[0].y == 4);
|
||||
PP_EXPECT(h, recorded_texture_image_calls[0].width == 2);
|
||||
PP_EXPECT(h, recorded_texture_image_calls[0].height == 2);
|
||||
PP_EXPECT(h, recorded_texture_image_calls[0].data == pixels.data());
|
||||
}
|
||||
|
||||
void rejects_invalid_texture_2d_updates(pp::tests::Harness& h)
|
||||
{
|
||||
const std::array<std::uint8_t, 4> pixels { 9U, 8U, 7U, 6U };
|
||||
|
||||
const auto negative_offset = pp::renderer::gl::update_opengl_texture_2d(
|
||||
pp::renderer::gl::OpenGlTexture2DUpdate {
|
||||
.texture_id = 31U,
|
||||
.x = -1,
|
||||
.width = 2,
|
||||
.height = 2,
|
||||
.pixel_format = 0x1908U,
|
||||
.component_type = 0x1401U,
|
||||
.data = pixels.data(),
|
||||
},
|
||||
pp::renderer::gl::OpenGlTexture2DUpdateDispatch {
|
||||
.bind_texture = record_bind_texture,
|
||||
.tex_sub_image_2d = record_tex_sub_image_2d,
|
||||
});
|
||||
const auto missing_dispatch = pp::renderer::gl::update_opengl_texture_2d(
|
||||
pp::renderer::gl::OpenGlTexture2DUpdate {
|
||||
.texture_id = 31U,
|
||||
.width = 2,
|
||||
.height = 2,
|
||||
.pixel_format = 0x1908U,
|
||||
.component_type = 0x1401U,
|
||||
.data = pixels.data(),
|
||||
},
|
||||
pp::renderer::gl::OpenGlTexture2DUpdateDispatch {});
|
||||
|
||||
PP_EXPECT(h, !negative_offset.ok());
|
||||
PP_EXPECT(h, negative_offset.code == pp::foundation::StatusCode::invalid_argument);
|
||||
PP_EXPECT(h, !missing_dispatch.ok());
|
||||
PP_EXPECT(h, missing_dispatch.code == pp::foundation::StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
void copies_framebuffer_to_texture_2d_through_dispatch(pp::tests::Harness& h)
|
||||
{
|
||||
recorded_framebuffer_texture_copy_calls.clear();
|
||||
@@ -5464,6 +5503,7 @@ int main()
|
||||
harness.run("creates_reads_maps_and_deletes_pixel_buffers_through_dispatch", creates_reads_maps_and_deletes_pixel_buffers_through_dispatch);
|
||||
harness.run("rejects_invalid_pixel_buffer_dispatch", rejects_invalid_pixel_buffer_dispatch);
|
||||
harness.run("updates_texture_2d_through_dispatch", updates_texture_2d_through_dispatch);
|
||||
harness.run("rejects_invalid_texture_2d_updates", rejects_invalid_texture_2d_updates);
|
||||
harness.run("copies_framebuffer_to_texture_2d_through_dispatch", copies_framebuffer_to_texture_2d_through_dispatch);
|
||||
harness.run("copies_framebuffer_to_requested_texture_target", copies_framebuffer_to_requested_texture_target);
|
||||
harness.run("skips_zero_sized_framebuffer_to_texture_copies", skips_zero_sized_framebuffer_to_texture_copies);
|
||||
|
||||
Reference in New Issue
Block a user