| 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 50ae103d860006ede0a77f697f8ff3afcba977a4..8f4a6241b2280edd029ac9e98909a8941abcac09 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -1191,8 +1191,7 @@ class GLES2DecoderImpl : public GLES2Decoder,
|
| void ClearUnclearedAttachments(GLenum target, Framebuffer* framebuffer);
|
|
|
| // overridden from GLES2Decoder
|
| - bool ClearLevel(unsigned service_id,
|
| - unsigned bind_target,
|
| + bool ClearLevel(Texture* texture,
|
| unsigned target,
|
| int level,
|
| unsigned internal_format,
|
| @@ -8410,8 +8409,7 @@ void GLES2DecoderImpl::DoBufferSubData(
|
| }
|
|
|
| bool GLES2DecoderImpl::ClearLevel(
|
| - unsigned service_id,
|
| - unsigned bind_target,
|
| + Texture* texture,
|
| unsigned target,
|
| int level,
|
| unsigned internal_format,
|
| @@ -8433,8 +8431,8 @@ bool GLES2DecoderImpl::ClearLevel(
|
| GLenum attachment = have_stencil ? GL_DEPTH_STENCIL_ATTACHMENT :
|
| GL_DEPTH_ATTACHMENT;
|
|
|
| - glFramebufferTexture2DEXT(
|
| - GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level);
|
| + glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, attachment, target,
|
| + texture->service_id(), level);
|
| // ANGLE promises a depth only attachment ok.
|
| if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) !=
|
| GL_FRAMEBUFFER_COMPLETE) {
|
| @@ -8493,12 +8491,13 @@ bool GLES2DecoderImpl::ClearLevel(
|
| // Assumes the size has already been checked.
|
| scoped_ptr<char[]> zero(new char[size]);
|
| memset(zero.get(), 0, size);
|
| - glBindTexture(bind_target, service_id);
|
| + glBindTexture(texture->target(), texture->service_id());
|
|
|
| + bool has_images = texture->HasImages();
|
| GLint y = 0;
|
| while (y < height) {
|
| GLint h = y + tile_height > height ? height - y : tile_height;
|
| - if (is_texture_immutable || h != height) {
|
| + if (is_texture_immutable || h != height || has_images) {
|
| glTexSubImage2D(target, level, 0, y, width, h, format, type, zero.get());
|
| } else {
|
| glTexImage2D(
|
| @@ -8507,9 +8506,10 @@ bool GLES2DecoderImpl::ClearLevel(
|
| }
|
| y += tile_height;
|
| }
|
| - TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
|
| - &state_, bind_target);
|
| - glBindTexture(bind_target, texture ? texture->service_id() : 0);
|
| + TextureRef* bound_texture =
|
| + texture_manager()->GetTextureInfoForTarget(&state_, texture->target());
|
| + glBindTexture(texture->target(),
|
| + bound_texture ? bound_texture->service_id() : 0);
|
| return true;
|
| }
|
|
|
| @@ -9170,10 +9170,8 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
|
| copyWidth != width ||
|
| copyHeight != height) {
|
| // some part was clipped so clear the texture.
|
| - if (!ClearLevel(
|
| - texture->service_id(), texture->target(),
|
| - target, level, internal_format, internal_format, GL_UNSIGNED_BYTE,
|
| - width, height, texture->IsImmutable())) {
|
| + if (!ClearLevel(texture, target, level, internal_format, internal_format,
|
| + GL_UNSIGNED_BYTE, width, height, texture->IsImmutable())) {
|
| LOCAL_SET_GL_ERROR(
|
| GL_OUT_OF_MEMORY, "glCopyTexImage2D", "dimensions too big");
|
| return;
|
| @@ -9446,7 +9444,8 @@ error::Error GLES2DecoderImpl::DoTexSubImage2D(
|
| }
|
|
|
| if (!texture_state_.texsubimage2d_faster_than_teximage2d &&
|
| - !texture->IsImmutable()) {
|
| + !texture->IsImmutable() &&
|
| + !texture->HasImages()) {
|
| ScopedTextureUploadTimer timer(&texture_state_);
|
| GLenum internal_format;
|
| GLenum tex_type;
|
|
|