summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/gles2_cmd_decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/service/gles2_cmd_decoder.cc')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc48
1 files changed, 35 insertions, 13 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 418ca3a..0a7f822 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -10055,6 +10055,11 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
return;
}
+ GLenum source_type = 0;
+ GLenum source_internal_format = 0;
+ source_texture->GetLevelType(
+ source_texture->target(), 0, &source_type, &source_internal_format);
+
GLenum dest_type_previous = dest_type;
GLenum dest_internal_format = internal_format;
bool dest_level_defined = dest_texture->GetLevelSize(
@@ -10065,6 +10070,20 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
&dest_internal_format);
}
+ // The destination format should be GL_ALPHA, GL_RGB, GL_RGBA, GL_LUMINANCE,
+ // or GL_LUMINANCE_ALPHA.
+ bool valid_dest_format = dest_internal_format >= GL_ALPHA &&
+ dest_internal_format <= GL_LUMINANCE_ALPHA;
+ // The source format can be GL_BGRA_EXT.
+ bool valid_source_format = (source_internal_format >= GL_ALPHA &&
+ source_internal_format <= GL_LUMINANCE_ALPHA) ||
+ source_internal_format == GL_BGRA_EXT;
+ if (!valid_source_format || !valid_dest_format) {
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "invalid internal format");
+ return;
+ }
+
// Resize the destination texture to the dimensions of the source texture.
if (!dest_level_defined || dest_width != source_width ||
dest_height != source_height ||
@@ -10105,25 +10124,28 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
copy_texture_CHROMIUM_->DoCopyTextureWithTransform(
this,
source_texture->target(),
- dest_texture->target(),
source_texture->service_id(),
- dest_texture->service_id(), level,
- source_width, source_height,
+ dest_texture->service_id(),
+ level,
+ source_width,
+ source_height,
unpack_flip_y_,
unpack_premultiply_alpha_,
unpack_unpremultiply_alpha_,
default_matrix);
} else {
- copy_texture_CHROMIUM_->DoCopyTexture(
- this,
- source_texture->target(),
- dest_texture->target(),
- source_texture->service_id(),
- dest_texture->service_id(), level,
- source_width, source_height,
- unpack_flip_y_,
- unpack_premultiply_alpha_,
- unpack_unpremultiply_alpha_);
+ copy_texture_CHROMIUM_->DoCopyTexture(this,
+ source_texture->target(),
+ source_texture->service_id(),
+ source_internal_format,
+ dest_texture->service_id(),
+ level,
+ internal_format,
+ source_width,
+ source_height,
+ unpack_flip_y_,
+ unpack_premultiply_alpha_,
+ unpack_unpremultiply_alpha_);
}
DoDidUseTexImageIfNeeded(source_texture, source_texture->target());