diff options
Diffstat (limited to 'chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc')
-rw-r--r-- | chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc b/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc index db701f92600..f7d6cc2a448 100644 --- a/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -8594,10 +8594,18 @@ void GLES2DecoderImpl::DoFramebufferTexture2DCommon( service_id = texture_ref->service_id(); } + bool valid_target = false; + if (texture_ref) { + valid_target = texture_manager()->ValidForTextureTarget( + texture_ref->texture(), level, 0, 0, 1); + } else { + valid_target = texture_manager()->ValidForTarget(textarget, level, 0, 0, 1); + } + if ((level > 0 && !feature_info_->IsWebGL2OrES3Context() && !(fbo_render_mipmap_explicitly_enabled_ && feature_info_->feature_flags().oes_fbo_render_mipmap)) || - !texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) { + !valid_target) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, name, "level out of range"); @@ -8669,8 +8677,8 @@ void GLES2DecoderImpl::DoFramebufferTextureLayer( "texture is neither TEXTURE_3D nor TEXTURE_2D_ARRAY"); return; } - if (!texture_manager()->ValidForTarget(texture_target, level, - 0, 0, layer)) { + if (!texture_manager()->ValidForTextureTarget(texture_ref->texture(), level, + 0, 0, layer)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, function_name, "invalid level or layer"); return; @@ -14722,11 +14730,6 @@ error::Error GLES2DecoderImpl::DoCompressedTexImage( LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "imageSize < 0"); return error::kNoError; } - if (!texture_manager()->ValidForTarget(target, level, width, height, depth) || - border != 0) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "dimensions out of range"); - return error::kNoError; - } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { @@ -14735,6 +14738,12 @@ error::Error GLES2DecoderImpl::DoCompressedTexImage( return error::kNoError; } Texture* texture = texture_ref->texture(); + if (!texture_manager()->ValidForTextureTarget(texture, level, width, height, + depth) || + border != 0) { + LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "dimensions out of range"); + return error::kNoError; + } if (texture->IsImmutable()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, "texture is immutable"); return error::kNoError; @@ -15104,10 +15113,6 @@ error::Error GLES2DecoderImpl::DoCompressedTexSubImage( LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "imageSize < 0"); return error::kNoError; } - if (!texture_manager()->ValidForTarget(target, level, width, height, depth)) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "dimensions out of range"); - return error::kNoError; - } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { @@ -15115,7 +15120,14 @@ error::Error GLES2DecoderImpl::DoCompressedTexSubImage( GL_INVALID_OPERATION, func_name, "no texture bound at target"); return error::kNoError; } + Texture* texture = texture_ref->texture(); + if (!texture_manager()->ValidForTextureTarget(texture, level, width, height, + depth)) { + LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "dimensions out of range"); + return error::kNoError; + } + GLenum type = 0; GLenum internal_format = 0; if (!texture->GetLevelType(target, level, &type, &internal_format)) { @@ -15240,7 +15252,8 @@ void GLES2DecoderImpl::DoCopyTexImage2D( GL_INVALID_OPERATION, func_name, "texture is immutable"); return; } - if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || + if (!texture_manager()->ValidForTextureTarget(texture, level, width, height, + 1) || border != 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, func_name, "dimensions out of range"); @@ -17813,8 +17826,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( } // Check that this type of texture is allowed. - if (!texture_manager()->ValidForTarget(source_target, source_level, - source_width, source_height, 1)) { + if (!texture_manager()->ValidForTextureTarget( + source_texture, source_level, source_width, source_height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "Bad dimensions"); return; } @@ -17981,8 +17994,8 @@ void GLES2DecoderImpl::CopySubTextureHelper(const char* function_name, } // Check that this type of texture is allowed. - if (!texture_manager()->ValidForTarget(source_target, source_level, - source_width, source_height, 1)) { + if (!texture_manager()->ValidForTextureTarget( + source_texture, source_level, source_width, source_height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture bad dimensions"); return; @@ -18222,11 +18235,20 @@ void GLES2DecoderImpl::TexStorageImpl(GLenum target, return; } } + TextureRef* texture_ref = + texture_manager()->GetTextureInfoForTarget(&state_, target); + if (!texture_ref) { + LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, + "unknown texture for target"); + return; + } + Texture* texture = texture_ref->texture(); // The glTexStorage entry points require width, height, and depth to be // at least 1, but the other texture entry points (those which use - // ValidForTarget) do not. So we have to add an extra check here. + // ValidForTextureTarget) do not. So we have to add an extra check here. bool is_invalid_texstorage_size = width < 1 || height < 1 || depth < 1; - if (!texture_manager()->ValidForTarget(target, 0, width, height, depth) || + if (!texture_manager()->ValidForTextureTarget(texture, 0, width, height, + depth) || is_invalid_texstorage_size) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, function_name, "dimensions out of range"); @@ -18239,14 +18261,6 @@ void GLES2DecoderImpl::TexStorageImpl(GLenum target, LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "too many levels"); return; } - TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( - &state_, target); - if (!texture_ref) { - LOCAL_SET_GL_ERROR( - GL_INVALID_OPERATION, function_name, "unknown texture for target"); - return; - } - Texture* texture = texture_ref->texture(); if (texture->IsAttachedToFramebuffer()) { framebuffer_state_.clear_state_dirty = true; } |