Commit af825d04 authored by Alexis Hetu's avatar Alexis Hetu Committed by Commit Bot

Viz unittest YUV fix

When an OpenGL implementation exposes the GL_OES_texture_half_float_linear
extension, the YUV format can be set to L16F. Since OSMesa doesn't
expose this extension, the test currently doesn't fail in this case, but
it fails when ran with SwiftShader. This fixes the issue.

Bug: chromium:848035
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I076ee00ba187f6d89cc51de41f15f0872d4d728c
Reviewed-on: https://chromium-review.googlesource.com/1080030Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarFredrik Hubinette <hubbe@chromium.org>
Commit-Queue: Alexis Hétu <sugoi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563060}
parent 9ffad511
......@@ -29,6 +29,7 @@
#include "gpu/command_buffer/client/gles2_interface.h"
#include "media/base/video_frame.h"
#include "media/renderers/video_resource_updater.h"
#include "media/video/half_float_maker.h"
#include "third_party/skia/include/core/SkColorPriv.h"
#include "third_party/skia/include/core/SkColorSpaceXform.h"
#include "third_party/skia/include/core/SkMatrix.h"
......@@ -446,18 +447,25 @@ void CreateTestYUVVideoDrawQuad_FromVideoFrame(
ResourceFormat yuv_highbit_resource_format =
video_resource_updater->YuvResourceFormat(bits_per_channel);
float multiplier = 1.0;
float offset = 0.0f;
float multiplier = 1.0f;
if (yuv_highbit_resource_format == R16_EXT)
if (yuv_highbit_resource_format == R16_EXT) {
multiplier = 65535.0f / ((1 << bits_per_channel) - 1);
else
} else if (yuv_highbit_resource_format == LUMINANCE_F16) {
std::unique_ptr<media::HalfFloatMaker> half_float_maker =
media::HalfFloatMaker::NewHalfFloatMaker(bits_per_channel);
offset = half_float_maker->Offset();
multiplier = half_float_maker->Multiplier();
} else {
bits_per_channel = 8;
}
yuv_quad->SetNew(shared_state, rect, visible_rect, needs_blending,
ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size,
uv_tex_size, mapped_resource_y, mapped_resource_u,
mapped_resource_v, mapped_resource_a, video_color_space,
0.0f, multiplier, bits_per_channel);
offset, multiplier, bits_per_channel);
}
void CreateTestY16TextureDrawQuad_FromVideoFrame(
......
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