Chromium Code Reviews| 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 4ab92b2592b4710bfc57987a1a62c32b405e907b..9bd4edafd9b233ed03b0e18890c1aa81ecbddef2 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -13078,7 +13078,7 @@ bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUM( |
| return false; |
| } |
| - if (GL_TEXTURE_2D != target) { |
| + if (GL_TEXTURE_2D != target && GL_TEXTURE_RECTANGLE_ARB != target) { |
| LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| "invalid texture target"); |
| return false; |
| @@ -13092,7 +13092,8 @@ bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUM( |
| return false; |
| } |
| - if (dest_texture->target() != GL_TEXTURE_2D || |
| + if ((dest_texture->target() != GL_TEXTURE_2D && |
| + dest_texture->target() != GL_TEXTURE_RECTANGLE_ARB) || |
| (source_texture->target() != GL_TEXTURE_2D && |
| source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && |
| source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) { |
| @@ -13276,10 +13277,10 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| int dest_width = 0; |
| int dest_height = 0; |
| bool dest_level_defined = dest_texture->GetLevelSize( |
| - GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); |
| + target, 0, &dest_width, &dest_height, nullptr); |
|
Ken Russell (switch to Gerrit)
2015/12/31 02:11:58
Is the intent of this CL to allow copying between
erikchen
2016/01/04 21:47:11
This CL allows copying from TEXTURE_2D/TEXTURE_REC
|
| if (dest_level_defined) { |
| - dest_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type_previous, |
| + dest_texture->GetLevelType(target, 0, &dest_type_previous, |
|
Ken Russell (switch to Gerrit)
2015/12/31 02:11:58
Same here; seems this should reference the destina
erikchen
2016/01/04 21:47:11
yup, fixed.
|
| &dest_internal_format); |
| } |
| @@ -13290,21 +13291,21 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| dest_type_previous != dest_type) { |
| // Ensure that the glTexImage2D succeeds. |
| LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); |
| - glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); |
| - glTexImage2D(GL_TEXTURE_2D, 0, internal_format, source_width, source_height, |
| + glBindTexture(target, dest_texture->service_id()); |
| + glTexImage2D(target, 0, internal_format, source_width, source_height, |
|
Ken Russell (switch to Gerrit)
2015/12/31 02:11:58
These two calls seem to me like they should be usi
erikchen
2016/01/04 21:47:11
yup, fixed.
|
| 0, internal_format, dest_type, NULL); |
| GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); |
| if (error != GL_NO_ERROR) { |
| - RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); |
| + RestoreCurrentTextureBindings(&state_, target); |
| return; |
| } |
| texture_manager()->SetLevelInfo( |
| - dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, |
| + dest_texture_ref, target, 0, internal_format, source_width, |
| source_height, 1, 0, internal_format, dest_type, |
| gfx::Rect(source_width, source_height)); |
| } else { |
| - texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
| + texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, |
| true); |
| } |
| @@ -13312,8 +13313,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| bool unpack_premultiply_alpha_change = |
| (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| - glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); |
| - if (image->CopyTexImage(GL_TEXTURE_2D)) |
| + glBindTexture(target, dest_texture->service_id()); |
| + if (image->CopyTexImage(target)) |
| return; |
| } |
| @@ -13326,17 +13327,16 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| // instead of using kIdentityMatrix crbug.com/226218. |
| copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| this, source_texture->target(), source_texture->service_id(), |
| - dest_texture->service_id(), source_width, source_height, |
| - unpack_flip_y == GL_TRUE, |
| + target, dest_texture->service_id(), source_width, |
| + source_height, unpack_flip_y == GL_TRUE, |
| unpack_premultiply_alpha == GL_TRUE, |
| unpack_unmultiply_alpha == GL_TRUE, |
| kIdentityMatrix); |
| } else { |
| copy_texture_CHROMIUM_->DoCopyTexture( |
| this, source_texture->target(), source_texture->service_id(), |
| - source_internal_format, dest_texture->service_id(), internal_format, |
| - source_width, source_height, |
| - unpack_flip_y == GL_TRUE, |
| + source_internal_format, target, dest_texture->service_id(), |
| + internal_format, source_width, source_height, unpack_flip_y == GL_TRUE, |
| unpack_premultiply_alpha == GL_TRUE, |
| unpack_unmultiply_alpha == GL_TRUE); |
| } |
| @@ -13453,7 +13453,7 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| int dest_width = 0; |
| int dest_height = 0; |
| bool ok = dest_texture->GetLevelSize( |
| - GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); |
| + target, 0, &dest_width, &dest_height, nullptr); |
| DCHECK(ok); |
| if (xoffset != 0 || yoffset != 0 || width != dest_width || |
| height != dest_height) { |
| @@ -13475,8 +13475,7 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| } |
| } |
| } else { |
| - texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
| - true); |
| + texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true); |
| } |
| // Try using GLImage::CopyTexSubImage when possible. |
| @@ -13484,8 +13483,8 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| ScopedTextureBinder binder( |
| - &state_, dest_texture->service_id(), GL_TEXTURE_2D); |
| - if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), |
| + &state_, dest_texture->service_id(), target); |
| + if (image->CopyTexSubImage(target, gfx::Point(xoffset, yoffset), |
| gfx::Rect(x, y, width, height))) { |
| return; |
| } |
| @@ -13497,8 +13496,9 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| // crbug.com/226218. |
| copy_texture_CHROMIUM_->DoCopySubTexture( |
| this, source_texture->target(), source_texture->service_id(), |
| - source_internal_format, dest_texture->service_id(), dest_internal_format, |
| - xoffset, yoffset, x, y, width, height, dest_width, dest_height, |
| + source_internal_format, dest_texture->target(), |
| + dest_texture->service_id(), dest_internal_format, xoffset, yoffset, x, y, |
| + width, height, dest_width, dest_height, |
| source_width, source_height, |
| unpack_flip_y == GL_TRUE, |
| unpack_premultiply_alpha == GL_TRUE, |
| @@ -13672,13 +13672,14 @@ void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, |
| // instead of using kIdentityMatrix crbug.com/226218. |
| copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| this, source_texture->target(), source_texture->service_id(), |
| - dest_texture->service_id(), source_width, source_height, |
| - false, false, false, kIdentityMatrix); |
| + dest_texture->target(), dest_texture->service_id(), source_width, |
| + source_height, false, false, false, kIdentityMatrix); |
| } else { |
| copy_texture_CHROMIUM_->DoCopyTexture( |
| this, source_texture->target(), source_texture->service_id(), |
| - source_internal_format, dest_texture->service_id(), GL_RGBA, |
| - source_width, source_height, false, false, false); |
| + source_internal_format, dest_texture->target(), |
| + dest_texture->service_id(), GL_RGBA, source_width, source_height, false, |
| + false, false); |
| } |
| } |
| @@ -13868,7 +13869,7 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, |
| copy_texture_CHROMIUM_->DoCopyTexture( |
| this, dest_texture->target(), dest_texture->service_id(), |
| - dest_internal_format, tmp_service_id, GL_RGBA, |
| + dest_internal_format, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, |
| dest_width, dest_height, false, false, false); |
| // Redefine destination texture to use RGBA. |
| @@ -13885,7 +13886,7 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, |
| 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(dest_width, dest_height)); |
| copy_texture_CHROMIUM_->DoCopyTexture( |
| - this, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, |
| + this, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, GL_TEXTURE_2D, |
| dest_texture->service_id(), GL_RGBA, |
| dest_width, dest_height, false, false, false); |
| @@ -13896,9 +13897,10 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, |
| // crbug.com/226218. |
| copy_texture_CHROMIUM_->DoCopySubTexture( |
| this, source_texture->target(), source_texture->service_id(), |
| - source_internal_format, dest_texture->service_id(), GL_RGBA, |
| - xoffset, yoffset, x, y, width, height, dest_width, dest_height, |
| - source_width, source_height, false, false, false); |
| + source_internal_format, dest_texture->target(), |
| + dest_texture->service_id(), GL_RGBA, xoffset, yoffset, x, y, width, |
| + height, dest_width, dest_height, source_width, source_height, false, |
| + false, false); |
| } |
| void GLES2DecoderImpl::DoTexStorage2DEXT( |