Index: cc/output/renderer_pixeltest.cc |
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc |
index 475d4a220334f9cbf263d6ccce23d21ca8454b68..4caf43f66edcb3a0a5162d9dae73feed8cb9b431 100644 |
--- a/cc/output/renderer_pixeltest.cc |
+++ b/cc/output/renderer_pixeltest.cc |
@@ -18,6 +18,7 @@ |
#include "cc/test/fake_raster_source.h" |
#include "cc/test/fake_recording_source.h" |
#include "cc/test/pixel_test.h" |
+#include "cc/test/test_in_process_context_provider.h" |
#include "components/viz/service/display/gl_renderer.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
#include "media/base/video_frame.h" |
@@ -300,11 +301,22 @@ void CreateTestYUVVideoDrawQuad_FromVideoFrame( |
bits_per_channel = 10; |
} |
+ viz::ResourceFormat yuv_highbit_resource_format = |
+ resource_provider->YuvResourceFormat(bits_per_channel); |
+ |
+ float multitplier = 1.0; |
+ int shift = 16 - bits_per_channel; |
+ |
+ if (yuv_highbit_resource_format != viz::R16_EXT) |
+ bits_per_channel = 8; |
+ else |
+ multitplier = (1 << shift) + 1.0 / (1 << (bits_per_channel - shift)); |
+ |
yuv_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, |
needs_blending, ya_tex_coord_rect, uv_tex_coord_rect, |
ya_tex_size, uv_tex_size, y_resource, u_resource, v_resource, |
- a_resource, color_space, video_color_space, 0.0f, 1.0f, |
- bits_per_channel); |
+ a_resource, color_space, video_color_space, 0.0f, |
+ multitplier, bits_per_channel); |
} |
void CreateTestY16TextureDrawQuad_FromVideoFrame( |
@@ -1297,9 +1309,35 @@ class VideoGLRendererPixelTest : public GLRendererPixelTest { |
std::unique_ptr<VideoResourceUpdater> video_resource_updater_; |
}; |
+enum class HighbitTexture { |
+ Y8, |
+ R16_EXT, |
+}; |
+ |
class VideoGLRendererPixelHiLoTest |
: public VideoGLRendererPixelTest, |
- public ::testing::WithParamInterface<bool> {}; |
+ public ::testing::WithParamInterface< |
+ ::testing::tuple<bool, HighbitTexture>> { |
+ public: |
+ void SetSupportHighbitTexture(HighbitTexture texture) { |
+ TestInProcessContextProvider* context_provider = |
+ GetTestInProcessContextProvider(); |
+ switch (texture) { |
+ case HighbitTexture::Y8: |
+ break; |
+ case HighbitTexture::R16_EXT: |
+ context_provider->SetSupportTextureNorm16(true); |
+ video_resource_updater_->UseR16ForTesting(true); |
+ break; |
+ } |
+ } |
+ |
+ private: |
+ TestInProcessContextProvider* GetTestInProcessContextProvider() { |
+ return static_cast<TestInProcessContextProvider*>( |
+ output_surface_->context_provider()); |
+ } |
+}; |
TEST_P(VideoGLRendererPixelHiLoTest, SimpleYUVRect) { |
gfx::Rect rect(this->device_viewport_size_); |
@@ -1310,7 +1348,10 @@ TEST_P(VideoGLRendererPixelHiLoTest, SimpleYUVRect) { |
SharedQuadState* shared_state = |
CreateTestSharedQuadState(gfx::Transform(), rect, pass.get()); |
- bool highbit = GetParam(); |
+ const bool highbit = testing::get<0>(GetParam()); |
+ const HighbitTexture format = testing::get<1>(GetParam()); |
+ SetSupportHighbitTexture(format); |
+ |
CreateTestYUVVideoDrawQuad_Striped( |
shared_state, media::PIXEL_FORMAT_YV12, false, highbit, |
gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f), pass.get(), |
@@ -1336,7 +1377,10 @@ TEST_P(VideoGLRendererPixelHiLoTest, ClippedYUVRect) { |
SharedQuadState* shared_state = |
CreateTestSharedQuadState(gfx::Transform(), viewport, pass.get()); |
- bool highbit = GetParam(); |
+ const bool highbit = testing::get<0>(GetParam()); |
+ const HighbitTexture format = testing::get<1>(GetParam()); |
+ SetSupportHighbitTexture(format); |
+ |
CreateTestYUVVideoDrawQuad_Striped( |
shared_state, media::PIXEL_FORMAT_YV12, false, highbit, |
gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f), pass.get(), |
@@ -1399,7 +1443,12 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVRectBlack) { |
} |
// First argument (test case prefix) is intentionally left empty. |
-INSTANTIATE_TEST_CASE_P(, VideoGLRendererPixelHiLoTest, ::testing::Bool()); |
+INSTANTIATE_TEST_CASE_P( |
+ , |
+ VideoGLRendererPixelHiLoTest, |
+ testing::Combine(testing::Bool(), |
+ testing::Values(HighbitTexture::Y8, |
+ HighbitTexture::R16_EXT))); |
TEST_F(VideoGLRendererPixelTest, SimpleYUVJRect) { |
gfx::Rect rect(this->device_viewport_size_); |