Commit 39bb84ca authored by Brian Salomon's avatar Brian Salomon Committed by Commit Bot

GpuImageDecodeCache can support both unorm16 or float16

The decoder can choose either if both are available.

Bug: skia:10632
Change-Id: Ia089845f7b16354fe20d34762ee41aa24c0a5f3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405440
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806400}
parent 3df92fa5
...@@ -992,7 +992,8 @@ GpuImageDecodeCache::GpuImageDecodeCache( ...@@ -992,7 +992,8 @@ GpuImageDecodeCache::GpuImageDecodeCache(
if (caps.texture_norm16) { if (caps.texture_norm16) {
yuva_supported_data_types_.enableDataType( yuva_supported_data_types_.enableDataType(
SkYUVAPixmapInfo::DataType::kUnorm16, 1); SkYUVAPixmapInfo::DataType::kUnorm16, 1);
} else if (caps.texture_half_float_linear) { }
if (caps.texture_half_float_linear) {
yuva_supported_data_types_.enableDataType( yuva_supported_data_types_.enableDataType(
SkYUVAPixmapInfo::DataType::kFloat16, 1); SkYUVAPixmapInfo::DataType::kFloat16, 1);
} }
......
...@@ -3096,7 +3096,7 @@ TEST_P(GpuImageDecodeCacheTest, HighBitDepthYUVDecoding) { ...@@ -3096,7 +3096,7 @@ TEST_P(GpuImageDecodeCacheTest, HighBitDepthYUVDecoding) {
const auto hdr_cs = gfx::ColorSpace::CreateHDR10(/*sdr_white_level=*/200.0f); const auto hdr_cs = gfx::ColorSpace::CreateHDR10(/*sdr_white_level=*/200.0f);
// Ensure that when R16 is supported, it's used and preferred over half-float. // Test that decoding to R16 works when supported.
{ {
auto r16_caps = original_caps; auto r16_caps = original_caps;
r16_caps.texture_norm16 = true; r16_caps.texture_norm16 = true;
...@@ -3135,7 +3135,7 @@ TEST_P(GpuImageDecodeCacheTest, HighBitDepthYUVDecoding) { ...@@ -3135,7 +3135,7 @@ TEST_P(GpuImageDecodeCacheTest, HighBitDepthYUVDecoding) {
SkYUVAPixmapInfo::DataType::kUnorm16, hdr_cs); SkYUVAPixmapInfo::DataType::kUnorm16, hdr_cs);
} }
// Verify that half-float is used when R16 is not available. // Test that decoding to half-float works when supported.
{ {
auto f16_caps = original_caps; auto f16_caps = original_caps;
f16_caps.texture_norm16 = false; f16_caps.texture_norm16 = false;
...@@ -3192,6 +3192,17 @@ TEST_P(GpuImageDecodeCacheTest, HighBitDepthYUVDecoding) { ...@@ -3192,6 +3192,17 @@ TEST_P(GpuImageDecodeCacheTest, HighBitDepthYUVDecoding) {
yuv_format_ = YUVSubsampling::k444; yuv_format_ = YUVSubsampling::k444;
decode_and_check_plane_sizes(no_yuv16_cache.get(), false); decode_and_check_plane_sizes(no_yuv16_cache.get(), false);
yuv_data_type_ = SkYUVAPixmapInfo::DataType::kFloat16;
yuv_format_ = YUVSubsampling::k420;
decode_and_check_plane_sizes(no_yuv16_cache.get(), false);
yuv_format_ = YUVSubsampling::k422;
decode_and_check_plane_sizes(no_yuv16_cache.get(), false);
yuv_format_ = YUVSubsampling::k444;
decode_and_check_plane_sizes(no_yuv16_cache.get(), false);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment