Commit 694a2237 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

gl_renderer: Support GL_RGB10_A2_EXT in DCHECK()s and for copying

While experimenting with SDR-HDR on Chromebooks with DCHECK()s on,
I noticed I hit a few of them unnecessarily. This CL adds the RGB10
format where needed.

Bug: 958166
Change-Id: Ifc3cbd4c6a6a4ee23b9430f3ee4ac75ac7c65a3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315253Reviewed-by: default avatarccameron <ccameron@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791286}
parent 6956efc3
...@@ -628,8 +628,10 @@ static SkColorType GlFormatToSkFormat(GrGLenum format) { ...@@ -628,8 +628,10 @@ static SkColorType GlFormatToSkFormat(GrGLenum format) {
return kRGBA_8888_SkColorType; return kRGBA_8888_SkColorType;
case GL_BGRA_EXT: case GL_BGRA_EXT:
return kBGRA_8888_SkColorType; return kBGRA_8888_SkColorType;
case GL_RGB10_A2_EXT:
return kRGBA_1010102_SkColorType;
default: default:
NOTREACHED(); NOTREACHED() << std::hex << std::showbase << format;
return kN32_SkColorType; return kN32_SkColorType;
} }
} }
...@@ -642,6 +644,8 @@ static GrGLenum SkFormatToGlFormat(SkColorType format) { ...@@ -642,6 +644,8 @@ static GrGLenum SkFormatToGlFormat(SkColorType format) {
return GL_RGBA8_OES; return GL_RGBA8_OES;
case kBGRA_8888_SkColorType: case kBGRA_8888_SkColorType:
return GL_BGRA8_EXT; return GL_BGRA8_EXT;
case kRGBA_1010102_SkColorType:
return GL_RGB10_A2_EXT;
default: default:
NOTREACHED(); NOTREACHED();
return GL_RGBA8_OES; return GL_RGBA8_OES;
...@@ -864,8 +868,9 @@ GLenum GLRenderer::GetFramebufferCopyTextureFormat() { ...@@ -864,8 +868,9 @@ GLenum GLRenderer::GetFramebufferCopyTextureFormat() {
(output_surface_->context_provider() (output_surface_->context_provider()
->ContextCapabilities() ->ContextCapabilities()
.texture_format_bgra8888 && .texture_format_bgra8888 &&
format == GL_BGRA_EXT)) format == GL_BGRA_EXT) ||
<< format; format == GL_RGB10_A2_EXT)
<< std::hex << std::showbase << format;
return format; return format;
} }
...@@ -939,7 +944,8 @@ uint32_t GLRenderer::GetBackdropTexture(const gfx::Rect& window_rect, ...@@ -939,7 +944,8 @@ uint32_t GLRenderer::GetBackdropTexture(const gfx::Rect& window_rect,
// CopyTexImage2D requires inernalformat channels to be a subset of // CopyTexImage2D requires inernalformat channels to be a subset of
// the channels of the source texture internalformat. // the channels of the source texture internalformat.
DCHECK(*internal_format == GL_RGB || *internal_format == GL_RGBA || DCHECK(*internal_format == GL_RGB || *internal_format == GL_RGBA ||
*internal_format == GL_BGRA_EXT); *internal_format == GL_BGRA_EXT ||
*internal_format == GL_RGB10_A2_EXT);
if (*internal_format == GL_BGRA_EXT) if (*internal_format == GL_BGRA_EXT)
*internal_format = GL_RGBA; *internal_format = GL_RGBA;
gl_->CopyTexImage2D(GL_TEXTURE_2D, 0, *internal_format, window_rect.x(), gl_->CopyTexImage2D(GL_TEXTURE_2D, 0, *internal_format, window_rect.x(),
......
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