Commit 90f6b880 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

gpu: support RGB10_A2 in copyTextureCHROMIUM

This CL extends the copyTextureCHROMIUM implementation to support
RGB10_A2 (see bug for the use case).

It also extends gl_copy_texture_CHROMIUM_unittest.cc appropriately,
and cleans it a tiny bit (const, removal of dead code, style).

For some reason, glCopy(Sub)TextureCHROMIUM() fails on Adreno 4xx,
this CL adds a workaround for it, see crbug.com/925986.

Bug: 922198, 925986
Change-Id: I8e4e95d766e89282cec1fc11e86c2c2fadc807fc
Reviewed-on: https://chromium-review.googlesource.com/c/1418330
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626896}
parent 3c14cda5
...@@ -903,6 +903,13 @@ CopyTextureMethod GetCopyTextureCHROMIUMMethod(const FeatureInfo* feature_info, ...@@ -903,6 +903,13 @@ CopyTextureMethod GetCopyTextureCHROMIUMMethod(const FeatureInfo* feature_info,
break; break;
} }
// Sometimes glCopyTexImage2D() fails if source is GL_RGB10_A2 and dest isn't.
if (feature_info->workarounds().disable_copy_tex_image_2d_rgb10_a2 &&
source_internal_format == GL_RGB10_A2 &&
dest_internal_format != GL_RGB10_A2) {
return CopyTextureMethod::DRAW_AND_COPY;
}
// CopyTexImage* should not allow internalformat of GL_BGRA_EXT and // CopyTexImage* should not allow internalformat of GL_BGRA_EXT and
// GL_BGRA8_EXT. https://crbug.com/663086. // GL_BGRA8_EXT. https://crbug.com/663086.
bool copy_tex_image_format_valid = bool copy_tex_image_format_valid =
...@@ -1018,7 +1025,8 @@ bool ValidateCopyTextureCHROMIUMInternalFormats(const FeatureInfo* feature_info, ...@@ -1018,7 +1025,8 @@ bool ValidateCopyTextureCHROMIUMInternalFormats(const FeatureInfo* feature_info,
source_internal_format == GL_BGRA8_EXT || source_internal_format == GL_BGRA8_EXT ||
source_internal_format == GL_RGB_YCBCR_420V_CHROMIUM || source_internal_format == GL_RGB_YCBCR_420V_CHROMIUM ||
source_internal_format == GL_RGB_YCBCR_422_CHROMIUM || source_internal_format == GL_RGB_YCBCR_422_CHROMIUM ||
source_internal_format == GL_R16_EXT; source_internal_format == GL_R16_EXT ||
source_internal_format == GL_RGB10_A2;
if (!valid_source_format) { if (!valid_source_format) {
*output_error_msg = "invalid source internal format " + *output_error_msg = "invalid source internal format " +
GLES2Util::GetStringEnum(source_internal_format); GLES2Util::GetStringEnum(source_internal_format);
......
...@@ -43,6 +43,7 @@ enum { ...@@ -43,6 +43,7 @@ enum {
S_FORMAT_RGB_YCBCR_420V_CHROMIUM, S_FORMAT_RGB_YCBCR_420V_CHROMIUM,
S_FORMAT_RGB_YCBCR_422_CHROMIUM, S_FORMAT_RGB_YCBCR_422_CHROMIUM,
S_FORMAT_COMPRESSED, S_FORMAT_COMPRESSED,
S_FORMAT_RGB10_A2,
NUM_S_FORMAT NUM_S_FORMAT
}; };
...@@ -185,8 +186,12 @@ ShaderId GetFragmentShaderId(bool premultiply_alpha, ...@@ -185,8 +186,12 @@ ShaderId GetFragmentShaderId(bool premultiply_alpha,
case GL_ETC1_RGB8_OES: case GL_ETC1_RGB8_OES:
sourceFormatIndex = S_FORMAT_COMPRESSED; sourceFormatIndex = S_FORMAT_COMPRESSED;
break; break;
case GL_RGB10_A2:
sourceFormatIndex = S_FORMAT_RGB10_A2;
break;
default: default:
NOTREACHED(); NOTREACHED() << "Invalid source format "
<< gl::GLEnums::GetStringEnum(source_format);
break; break;
} }
......
...@@ -3067,6 +3067,23 @@ ...@@ -3067,6 +3067,23 @@
"features": [ "features": [
"disable_direct_composition" "disable_direct_composition"
] ]
},
{
"id": 287,
"description": "glCopyTexImage2D on Adreno 4xx fails if source is GL_RGB10_A2 and destination is not.",
"cr_bugs": [925986],
"os": {
"type": "android",
"version": {
"op": ">=",
"value": "5.0.0"
}
},
"gl_vendor": "Qualcomm.*",
"gl_renderer": ".*4\\d\\d",
"features": [
"disable_copy_tex_image_2d_rgb10_a2"
]
} }
] ]
} }
...@@ -106,3 +106,4 @@ use_virtualized_gl_contexts ...@@ -106,3 +106,4 @@ use_virtualized_gl_contexts
validate_multisample_buffer_allocation validate_multisample_buffer_allocation
wake_up_gpu_before_drawing wake_up_gpu_before_drawing
use_copyteximage2d_instead_of_readpixels_on_multisampled_textures use_copyteximage2d_instead_of_readpixels_on_multisampled_textures
disable_copy_tex_image_2d_rgb10_a2
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