Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index 34ae829ddb1f2b2389e480c85d6bf920f8682970..1c618c2dac9b30ead8996a2ec85fbdcaa75f1e15 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -13181,6 +13181,8 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
return; |
} |
} else { |
+ // TODO(dshwang): make GetLevelSize, ValidForTexture and ValidForTarget |
+ // correct for GLImage also. crbug.com/549531 |
if (!source_texture->GetLevelSize(source_texture->target(), 0, |
&source_width, &source_height, nullptr)) { |
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
@@ -13188,6 +13190,13 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
return; |
} |
+ if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
+ width, height, 1)) { |
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
+ "source texture bad dimensions."); |
+ return; |
+ } |
+ |
// Check that this type of texture is allowed. |
if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
source_width, source_height, 1)) { |
@@ -13201,12 +13210,6 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
GLenum source_internal_format = 0; |
source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
&source_internal_format); |
- if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
- width, height, 1)) { |
- LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
- "source texture bad dimensions."); |
- return; |
- } |
GLenum dest_type = 0; |
GLenum dest_internal_format = 0; |
@@ -13510,6 +13513,13 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, |
return; |
} |
+ if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
+ width, height, 1)) { |
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
+ "source texture bad dimensions."); |
+ return; |
+ } |
+ |
// Check that this type of texture is allowed. |
if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
source_width, source_height, 1)) { |
@@ -13523,12 +13533,6 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, |
GLenum source_internal_format = 0; |
source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
&source_internal_format); |
- if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
- width, height, 1)) { |
- LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
- "source texture bad dimensions."); |
- return; |
- } |
GLenum dest_type = 0; |
GLenum dest_internal_format = 0; |