Commit 8e250aed authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

Update BGRA_1010102 usage for Mac

This CL follows up on the previous by updating the uses of BGRA_1010102
(which used to be BRGX_1010102) in resource_format_utils.cc and
gl_image_io_surface.mm, basically allowing for its correct usage now
that the gymnastics of pretending that the alpha format is opaque.

Of note here is the CGLTexImageIOSurface2D we use for these types:
https://github.com/phracker/MacOSX-SDKs/blob/HEAD/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/CGLIOSurface.h#L102

TEST=display and gl_unittests passing and
http://crosvideo.appspot.com/?codec=vp9.2_30&loop=true&mute=true
reproducing correctly on Mac.

TBR=kbr@ for gpu/command_buffer/service/feature_info.cc (comment fix)

Bug: 949260
Change-Id: I8a422192a27833846482d14a1106d7d662ab9bb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072780
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747097}
parent 7c474dc8
...@@ -40,6 +40,7 @@ SkColorType ResourceFormatToClosestSkColorType(bool gpu_compositing, ...@@ -40,6 +40,7 @@ SkColorType ResourceFormatToClosestSkColorType(bool gpu_compositing,
case ETC1: case ETC1:
return kRGB_888x_SkColorType; return kRGB_888x_SkColorType;
case RGBA_1010102: case RGBA_1010102:
return kBGRA_1010102_SkColorType;
case BGRA_1010102: case BGRA_1010102:
return kRGBA_1010102_SkColorType; return kRGBA_1010102_SkColorType;
...@@ -147,7 +148,7 @@ unsigned int GLDataType(ResourceFormat format) { ...@@ -147,7 +148,7 @@ unsigned int GLDataType(ResourceFormat format) {
GL_UNSIGNED_BYTE, // RGBX_8888 GL_UNSIGNED_BYTE, // RGBX_8888
GL_ZERO, // BGRX_8888 GL_ZERO, // BGRX_8888
GL_UNSIGNED_INT_2_10_10_10_REV_EXT, // RGBA_1010102 GL_UNSIGNED_INT_2_10_10_10_REV_EXT, // RGBA_1010102
GL_ZERO, // BGRA_1010102 GL_UNSIGNED_INT_2_10_10_10_REV_EXT, // BGRA_1010102
GL_ZERO, // YVU_420 GL_ZERO, // YVU_420
GL_ZERO, // YUV_420_BIPLANAR GL_ZERO, // YUV_420_BIPLANAR
GL_ZERO, // P010 GL_ZERO, // P010
...@@ -177,7 +178,7 @@ unsigned int GLDataFormat(ResourceFormat format) { ...@@ -177,7 +178,7 @@ unsigned int GLDataFormat(ResourceFormat format) {
GL_RGB, // RGBX_8888 GL_RGB, // RGBX_8888
GL_ZERO, // BGRX_8888 GL_ZERO, // BGRX_8888
GL_RGBA, // RGBA_1010102 GL_RGBA, // RGBA_1010102
GL_ZERO, // BGRA_1010102 GL_RGBA, // BGRA_1010102
GL_ZERO, // YVU_420 GL_ZERO, // YVU_420
GL_ZERO, // YUV_420_BIPLANAR GL_ZERO, // YUV_420_BIPLANAR
GL_ZERO, // P010 GL_ZERO, // P010
......
...@@ -1189,7 +1189,7 @@ void FeatureInfo::InitializeFeatures() { ...@@ -1189,7 +1189,7 @@ void FeatureInfo::InitializeFeatures() {
} }
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// Mac can create GLImages out of XR30 IOSurfaces only after High Sierra. // Mac can create GLImages out of AR30 IOSurfaces only after High Sierra.
feature_flags_.chromium_image_ar30 = base::mac::IsAtLeastOS10_13(); feature_flags_.chromium_image_ar30 = base::mac::IsAtLeastOS10_13();
#elif !defined(OS_WIN) #elif !defined(OS_WIN)
// TODO(mcasas): connect in Windows, https://crbug.com/803451 // TODO(mcasas): connect in Windows, https://crbug.com/803451
......
...@@ -69,14 +69,10 @@ GLenum TextureFormat(gfx::BufferFormat format) { ...@@ -69,14 +69,10 @@ GLenum TextureFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::BGRX_8888: // See https://crbug.com/595948. case gfx::BufferFormat::BGRX_8888: // See https://crbug.com/595948.
case gfx::BufferFormat::RGBA_8888: case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::RGBA_F16: case gfx::BufferFormat::RGBA_F16:
case gfx::BufferFormat::BGRA_1010102:
return GL_RGBA; return GL_RGBA;
case gfx::BufferFormat::YUV_420_BIPLANAR: case gfx::BufferFormat::YUV_420_BIPLANAR:
return GL_RGB_YCBCR_420V_CHROMIUM; return GL_RGB_YCBCR_420V_CHROMIUM;
case gfx::BufferFormat::BGRA_1010102:
// Technically we should use GL_RGB but CGLTexImageIOSurface2D() (and
// OpenGL ES 3.0, for the case) support only GL_RGBA (the hardware ignores
// the alpha channel anyway), see https://crbug.com/797347.
return GL_RGBA;
case gfx::BufferFormat::BGR_565: case gfx::BufferFormat::BGR_565:
case gfx::BufferFormat::RGBA_4444: case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::RGBX_8888: case gfx::BufferFormat::RGBX_8888:
......
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