Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 13060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13071 const char* function_name, | 13071 const char* function_name, |
| 13072 GLenum target, | 13072 GLenum target, |
| 13073 TextureRef* source_texture_ref, | 13073 TextureRef* source_texture_ref, |
| 13074 TextureRef* dest_texture_ref, | 13074 TextureRef* dest_texture_ref, |
| 13075 GLenum dest_internal_format) { | 13075 GLenum dest_internal_format) { |
| 13076 if (!source_texture_ref || !dest_texture_ref) { | 13076 if (!source_texture_ref || !dest_texture_ref) { |
| 13077 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); | 13077 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); |
| 13078 return false; | 13078 return false; |
| 13079 } | 13079 } |
| 13080 | 13080 |
| 13081 if (GL_TEXTURE_2D != target) { | 13081 if (GL_TEXTURE_2D != target && GL_TEXTURE_RECTANGLE_ARB != target) { |
| 13082 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, | 13082 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 13083 "invalid texture target"); | 13083 "invalid texture target"); |
| 13084 return false; | 13084 return false; |
| 13085 } | 13085 } |
| 13086 | 13086 |
| 13087 Texture* source_texture = source_texture_ref->texture(); | 13087 Texture* source_texture = source_texture_ref->texture(); |
| 13088 Texture* dest_texture = dest_texture_ref->texture(); | 13088 Texture* dest_texture = dest_texture_ref->texture(); |
| 13089 if (source_texture == dest_texture) { | 13089 if (source_texture == dest_texture) { |
| 13090 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 13090 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 13091 "source and destination textures are the same"); | 13091 "source and destination textures are the same"); |
| 13092 return false; | 13092 return false; |
| 13093 } | 13093 } |
| 13094 | 13094 |
| 13095 if (dest_texture->target() != GL_TEXTURE_2D || | 13095 if ((dest_texture->target() != GL_TEXTURE_2D && |
| 13096 dest_texture->target() != GL_TEXTURE_RECTANGLE_ARB) || | |
| 13096 (source_texture->target() != GL_TEXTURE_2D && | 13097 (source_texture->target() != GL_TEXTURE_2D && |
| 13097 source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && | 13098 source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && |
| 13098 source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) { | 13099 source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) { |
| 13099 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, | 13100 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 13100 "invalid texture target binding"); | 13101 "invalid texture target binding"); |
| 13101 return false; | 13102 return false; |
| 13102 } | 13103 } |
| 13103 | 13104 |
| 13104 GLenum source_type = 0; | 13105 GLenum source_type = 0; |
| 13105 GLenum source_internal_format = 0; | 13106 GLenum source_internal_format = 0; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13269 RestoreCurrentFramebufferBindings(); | 13270 RestoreCurrentFramebufferBindings(); |
| 13270 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) | 13271 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) |
| 13271 return; | 13272 return; |
| 13272 } | 13273 } |
| 13273 | 13274 |
| 13274 GLenum dest_type_previous = dest_type; | 13275 GLenum dest_type_previous = dest_type; |
| 13275 GLenum dest_internal_format = internal_format; | 13276 GLenum dest_internal_format = internal_format; |
| 13276 int dest_width = 0; | 13277 int dest_width = 0; |
| 13277 int dest_height = 0; | 13278 int dest_height = 0; |
| 13278 bool dest_level_defined = dest_texture->GetLevelSize( | 13279 bool dest_level_defined = dest_texture->GetLevelSize( |
| 13279 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); | 13280 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
| |
| 13280 | 13281 |
| 13281 if (dest_level_defined) { | 13282 if (dest_level_defined) { |
| 13282 dest_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type_previous, | 13283 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.
| |
| 13283 &dest_internal_format); | 13284 &dest_internal_format); |
| 13284 } | 13285 } |
| 13285 | 13286 |
| 13286 // Resize the destination texture to the dimensions of the source texture. | 13287 // Resize the destination texture to the dimensions of the source texture. |
| 13287 if (!dest_level_defined || dest_width != source_width || | 13288 if (!dest_level_defined || dest_width != source_width || |
| 13288 dest_height != source_height || | 13289 dest_height != source_height || |
| 13289 dest_internal_format != internal_format || | 13290 dest_internal_format != internal_format || |
| 13290 dest_type_previous != dest_type) { | 13291 dest_type_previous != dest_type) { |
| 13291 // Ensure that the glTexImage2D succeeds. | 13292 // Ensure that the glTexImage2D succeeds. |
| 13292 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); | 13293 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); |
| 13293 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 13294 glBindTexture(target, dest_texture->service_id()); |
| 13294 glTexImage2D(GL_TEXTURE_2D, 0, internal_format, source_width, source_height, | 13295 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.
| |
| 13295 0, internal_format, dest_type, NULL); | 13296 0, internal_format, dest_type, NULL); |
| 13296 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); | 13297 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); |
| 13297 if (error != GL_NO_ERROR) { | 13298 if (error != GL_NO_ERROR) { |
| 13298 RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); | 13299 RestoreCurrentTextureBindings(&state_, target); |
| 13299 return; | 13300 return; |
| 13300 } | 13301 } |
| 13301 | 13302 |
| 13302 texture_manager()->SetLevelInfo( | 13303 texture_manager()->SetLevelInfo( |
| 13303 dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, | 13304 dest_texture_ref, target, 0, internal_format, source_width, |
| 13304 source_height, 1, 0, internal_format, dest_type, | 13305 source_height, 1, 0, internal_format, dest_type, |
| 13305 gfx::Rect(source_width, source_height)); | 13306 gfx::Rect(source_width, source_height)); |
| 13306 } else { | 13307 } else { |
| 13307 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13308 texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, |
| 13308 true); | 13309 true); |
| 13309 } | 13310 } |
| 13310 | 13311 |
| 13311 // Try using GLImage::CopyTexImage when possible. | 13312 // Try using GLImage::CopyTexImage when possible. |
| 13312 bool unpack_premultiply_alpha_change = | 13313 bool unpack_premultiply_alpha_change = |
| 13313 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 13314 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 13314 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 13315 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| 13315 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 13316 glBindTexture(target, dest_texture->service_id()); |
| 13316 if (image->CopyTexImage(GL_TEXTURE_2D)) | 13317 if (image->CopyTexImage(target)) |
| 13317 return; | 13318 return; |
| 13318 } | 13319 } |
| 13319 | 13320 |
| 13320 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); | 13321 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); |
| 13321 | 13322 |
| 13322 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 13323 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 13323 // before presenting. | 13324 // before presenting. |
| 13324 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { | 13325 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
| 13325 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | 13326 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| 13326 // instead of using kIdentityMatrix crbug.com/226218. | 13327 // instead of using kIdentityMatrix crbug.com/226218. |
| 13327 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 13328 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 13328 this, source_texture->target(), source_texture->service_id(), | 13329 this, source_texture->target(), source_texture->service_id(), |
| 13329 dest_texture->service_id(), source_width, source_height, | 13330 target, dest_texture->service_id(), source_width, |
| 13330 unpack_flip_y == GL_TRUE, | 13331 source_height, unpack_flip_y == GL_TRUE, |
| 13331 unpack_premultiply_alpha == GL_TRUE, | 13332 unpack_premultiply_alpha == GL_TRUE, |
| 13332 unpack_unmultiply_alpha == GL_TRUE, | 13333 unpack_unmultiply_alpha == GL_TRUE, |
| 13333 kIdentityMatrix); | 13334 kIdentityMatrix); |
| 13334 } else { | 13335 } else { |
| 13335 copy_texture_CHROMIUM_->DoCopyTexture( | 13336 copy_texture_CHROMIUM_->DoCopyTexture( |
| 13336 this, source_texture->target(), source_texture->service_id(), | 13337 this, source_texture->target(), source_texture->service_id(), |
| 13337 source_internal_format, dest_texture->service_id(), internal_format, | 13338 source_internal_format, target, dest_texture->service_id(), |
| 13338 source_width, source_height, | 13339 internal_format, source_width, source_height, unpack_flip_y == GL_TRUE, |
| 13339 unpack_flip_y == GL_TRUE, | |
| 13340 unpack_premultiply_alpha == GL_TRUE, | 13340 unpack_premultiply_alpha == GL_TRUE, |
| 13341 unpack_unmultiply_alpha == GL_TRUE); | 13341 unpack_unmultiply_alpha == GL_TRUE); |
| 13342 } | 13342 } |
| 13343 } | 13343 } |
| 13344 | 13344 |
| 13345 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( | 13345 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| 13346 GLenum target, | 13346 GLenum target, |
| 13347 GLuint source_id, | 13347 GLuint source_id, |
| 13348 GLuint dest_id, | 13348 GLuint dest_id, |
| 13349 GLint xoffset, | 13349 GLint xoffset, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13446 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); | 13446 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); |
| 13447 copy_texture_CHROMIUM_->Initialize(this); | 13447 copy_texture_CHROMIUM_->Initialize(this); |
| 13448 RestoreCurrentFramebufferBindings(); | 13448 RestoreCurrentFramebufferBindings(); |
| 13449 if (LOCAL_PEEK_GL_ERROR("glCopySubTextureCHROMIUM") != GL_NO_ERROR) | 13449 if (LOCAL_PEEK_GL_ERROR("glCopySubTextureCHROMIUM") != GL_NO_ERROR) |
| 13450 return; | 13450 return; |
| 13451 } | 13451 } |
| 13452 | 13452 |
| 13453 int dest_width = 0; | 13453 int dest_width = 0; |
| 13454 int dest_height = 0; | 13454 int dest_height = 0; |
| 13455 bool ok = dest_texture->GetLevelSize( | 13455 bool ok = dest_texture->GetLevelSize( |
| 13456 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); | 13456 target, 0, &dest_width, &dest_height, nullptr); |
| 13457 DCHECK(ok); | 13457 DCHECK(ok); |
| 13458 if (xoffset != 0 || yoffset != 0 || width != dest_width || | 13458 if (xoffset != 0 || yoffset != 0 || width != dest_width || |
| 13459 height != dest_height) { | 13459 height != dest_height) { |
| 13460 gfx::Rect cleared_rect; | 13460 gfx::Rect cleared_rect; |
| 13461 if (TextureManager::CombineAdjacentRects( | 13461 if (TextureManager::CombineAdjacentRects( |
| 13462 dest_texture->GetLevelClearedRect(target, 0), | 13462 dest_texture->GetLevelClearedRect(target, 0), |
| 13463 gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) { | 13463 gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) { |
| 13464 DCHECK_GE(cleared_rect.size().GetArea(), | 13464 DCHECK_GE(cleared_rect.size().GetArea(), |
| 13465 dest_texture->GetLevelClearedRect(target, 0).size().GetArea()); | 13465 dest_texture->GetLevelClearedRect(target, 0).size().GetArea()); |
| 13466 texture_manager()->SetLevelClearedRect(dest_texture_ref, target, 0, | 13466 texture_manager()->SetLevelClearedRect(dest_texture_ref, target, 0, |
| 13467 cleared_rect); | 13467 cleared_rect); |
| 13468 } else { | 13468 } else { |
| 13469 // Otherwise clear part of texture level that is not already cleared. | 13469 // Otherwise clear part of texture level that is not already cleared. |
| 13470 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, target, | 13470 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, target, |
| 13471 0)) { | 13471 0)) { |
| 13472 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM", | 13472 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM", |
| 13473 "destination texture dimensions too big"); | 13473 "destination texture dimensions too big"); |
| 13474 return; | 13474 return; |
| 13475 } | 13475 } |
| 13476 } | 13476 } |
| 13477 } else { | 13477 } else { |
| 13478 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13478 texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true); |
| 13479 true); | |
| 13480 } | 13479 } |
| 13481 | 13480 |
| 13482 // Try using GLImage::CopyTexSubImage when possible. | 13481 // Try using GLImage::CopyTexSubImage when possible. |
| 13483 bool unpack_premultiply_alpha_change = | 13482 bool unpack_premultiply_alpha_change = |
| 13484 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 13483 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 13485 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 13484 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| 13486 ScopedTextureBinder binder( | 13485 ScopedTextureBinder binder( |
| 13487 &state_, dest_texture->service_id(), GL_TEXTURE_2D); | 13486 &state_, dest_texture->service_id(), target); |
| 13488 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), | 13487 if (image->CopyTexSubImage(target, gfx::Point(xoffset, yoffset), |
| 13489 gfx::Rect(x, y, width, height))) { | 13488 gfx::Rect(x, y, width, height))) { |
| 13490 return; | 13489 return; |
| 13491 } | 13490 } |
| 13492 } | 13491 } |
| 13493 | 13492 |
| 13494 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); | 13493 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); |
| 13495 | 13494 |
| 13496 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. | 13495 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. |
| 13497 // crbug.com/226218. | 13496 // crbug.com/226218. |
| 13498 copy_texture_CHROMIUM_->DoCopySubTexture( | 13497 copy_texture_CHROMIUM_->DoCopySubTexture( |
| 13499 this, source_texture->target(), source_texture->service_id(), | 13498 this, source_texture->target(), source_texture->service_id(), |
| 13500 source_internal_format, dest_texture->service_id(), dest_internal_format, | 13499 source_internal_format, dest_texture->target(), |
| 13501 xoffset, yoffset, x, y, width, height, dest_width, dest_height, | 13500 dest_texture->service_id(), dest_internal_format, xoffset, yoffset, x, y, |
| 13501 width, height, dest_width, dest_height, | |
| 13502 source_width, source_height, | 13502 source_width, source_height, |
| 13503 unpack_flip_y == GL_TRUE, | 13503 unpack_flip_y == GL_TRUE, |
| 13504 unpack_premultiply_alpha == GL_TRUE, | 13504 unpack_premultiply_alpha == GL_TRUE, |
| 13505 unpack_unmultiply_alpha == GL_TRUE); | 13505 unpack_unmultiply_alpha == GL_TRUE); |
| 13506 } | 13506 } |
| 13507 | 13507 |
| 13508 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, | 13508 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, |
| 13509 GLuint source_id, | 13509 GLuint source_id, |
| 13510 GLuint dest_id) { | 13510 GLuint dest_id) { |
| 13511 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); | 13511 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13665 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 13665 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 13666 gfx::Rect(source_width, source_height)); | 13666 gfx::Rect(source_width, source_height)); |
| 13667 | 13667 |
| 13668 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 13668 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 13669 // before presenting. | 13669 // before presenting. |
| 13670 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { | 13670 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
| 13671 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | 13671 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| 13672 // instead of using kIdentityMatrix crbug.com/226218. | 13672 // instead of using kIdentityMatrix crbug.com/226218. |
| 13673 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 13673 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 13674 this, source_texture->target(), source_texture->service_id(), | 13674 this, source_texture->target(), source_texture->service_id(), |
| 13675 dest_texture->service_id(), source_width, source_height, | 13675 dest_texture->target(), dest_texture->service_id(), source_width, |
| 13676 false, false, false, kIdentityMatrix); | 13676 source_height, false, false, false, kIdentityMatrix); |
| 13677 } else { | 13677 } else { |
| 13678 copy_texture_CHROMIUM_->DoCopyTexture( | 13678 copy_texture_CHROMIUM_->DoCopyTexture( |
| 13679 this, source_texture->target(), source_texture->service_id(), | 13679 this, source_texture->target(), source_texture->service_id(), |
| 13680 source_internal_format, dest_texture->service_id(), GL_RGBA, | 13680 source_internal_format, dest_texture->target(), |
| 13681 source_width, source_height, false, false, false); | 13681 dest_texture->service_id(), GL_RGBA, source_width, source_height, false, |
| 13682 false, false); | |
| 13682 } | 13683 } |
| 13683 } | 13684 } |
| 13684 | 13685 |
| 13685 void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, | 13686 void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, |
| 13686 GLuint source_id, | 13687 GLuint source_id, |
| 13687 GLuint dest_id, | 13688 GLuint dest_id, |
| 13688 GLint xoffset, | 13689 GLint xoffset, |
| 13689 GLint yoffset, | 13690 GLint yoffset, |
| 13690 GLint x, | 13691 GLint x, |
| 13691 GLint y, | 13692 GLint y, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13861 | 13862 |
| 13862 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); | 13863 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); |
| 13863 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dest_width, dest_height, 0, GL_RGBA, | 13864 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dest_width, dest_height, 0, GL_RGBA, |
| 13864 GL_UNSIGNED_BYTE, NULL); | 13865 GL_UNSIGNED_BYTE, NULL); |
| 13865 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedCopySubTextureCHROMIUM"); | 13866 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedCopySubTextureCHROMIUM"); |
| 13866 if (error != GL_NO_ERROR) | 13867 if (error != GL_NO_ERROR) |
| 13867 return; | 13868 return; |
| 13868 | 13869 |
| 13869 copy_texture_CHROMIUM_->DoCopyTexture( | 13870 copy_texture_CHROMIUM_->DoCopyTexture( |
| 13870 this, dest_texture->target(), dest_texture->service_id(), | 13871 this, dest_texture->target(), dest_texture->service_id(), |
| 13871 dest_internal_format, tmp_service_id, GL_RGBA, | 13872 dest_internal_format, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, |
| 13872 dest_width, dest_height, false, false, false); | 13873 dest_width, dest_height, false, false, false); |
| 13873 | 13874 |
| 13874 // Redefine destination texture to use RGBA. | 13875 // Redefine destination texture to use RGBA. |
| 13875 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 13876 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); |
| 13876 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); | 13877 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); |
| 13877 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dest_width, dest_height, 0, GL_RGBA, | 13878 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dest_width, dest_height, 0, GL_RGBA, |
| 13878 GL_UNSIGNED_BYTE, NULL); | 13879 GL_UNSIGNED_BYTE, NULL); |
| 13879 error = LOCAL_PEEK_GL_ERROR("glCompressedCopySubTextureCHROMIUM"); | 13880 error = LOCAL_PEEK_GL_ERROR("glCompressedCopySubTextureCHROMIUM"); |
| 13880 if (error != GL_NO_ERROR) | 13881 if (error != GL_NO_ERROR) |
| 13881 return; | 13882 return; |
| 13882 | 13883 |
| 13883 texture_manager()->SetLevelInfo( | 13884 texture_manager()->SetLevelInfo( |
| 13884 dest_texture_ref, GL_TEXTURE_2D, 0, GL_RGBA, dest_width, dest_height, | 13885 dest_texture_ref, GL_TEXTURE_2D, 0, GL_RGBA, dest_width, dest_height, |
| 13885 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(dest_width, dest_height)); | 13886 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(dest_width, dest_height)); |
| 13886 | 13887 |
| 13887 copy_texture_CHROMIUM_->DoCopyTexture( | 13888 copy_texture_CHROMIUM_->DoCopyTexture( |
| 13888 this, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, | 13889 this, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, GL_TEXTURE_2D, |
| 13889 dest_texture->service_id(), GL_RGBA, | 13890 dest_texture->service_id(), GL_RGBA, |
| 13890 dest_width, dest_height, false, false, false); | 13891 dest_width, dest_height, false, false, false); |
| 13891 | 13892 |
| 13892 glDeleteTextures(1, &tmp_service_id); | 13893 glDeleteTextures(1, &tmp_service_id); |
| 13893 } | 13894 } |
| 13894 | 13895 |
| 13895 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. | 13896 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. |
| 13896 // crbug.com/226218. | 13897 // crbug.com/226218. |
| 13897 copy_texture_CHROMIUM_->DoCopySubTexture( | 13898 copy_texture_CHROMIUM_->DoCopySubTexture( |
| 13898 this, source_texture->target(), source_texture->service_id(), | 13899 this, source_texture->target(), source_texture->service_id(), |
| 13899 source_internal_format, dest_texture->service_id(), GL_RGBA, | 13900 source_internal_format, dest_texture->target(), |
| 13900 xoffset, yoffset, x, y, width, height, dest_width, dest_height, | 13901 dest_texture->service_id(), GL_RGBA, xoffset, yoffset, x, y, width, |
| 13901 source_width, source_height, false, false, false); | 13902 height, dest_width, dest_height, source_width, source_height, false, |
| 13903 false, false); | |
| 13902 } | 13904 } |
| 13903 | 13905 |
| 13904 void GLES2DecoderImpl::DoTexStorage2DEXT( | 13906 void GLES2DecoderImpl::DoTexStorage2DEXT( |
| 13905 GLenum target, | 13907 GLenum target, |
| 13906 GLint levels, | 13908 GLint levels, |
| 13907 GLenum internal_format, | 13909 GLenum internal_format, |
| 13908 GLsizei width, | 13910 GLsizei width, |
| 13909 GLsizei height) { | 13911 GLsizei height) { |
| 13910 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT", | 13912 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT", |
| 13911 "width", width, "height", height); | 13913 "width", width, "height", height); |
| (...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15786 } | 15788 } |
| 15787 | 15789 |
| 15788 // Include the auto-generated part of this file. We split this because it means | 15790 // Include the auto-generated part of this file. We split this because it means |
| 15789 // we can easily edit the non-auto generated parts right here in this file | 15791 // we can easily edit the non-auto generated parts right here in this file |
| 15790 // instead of having to edit some template or the code generator. | 15792 // instead of having to edit some template or the code generator. |
| 15791 #include "base/macros.h" | 15793 #include "base/macros.h" |
| 15792 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15794 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15793 | 15795 |
| 15794 } // namespace gles2 | 15796 } // namespace gles2 |
| 15795 } // namespace gpu | 15797 } // namespace gpu |
| OLD | NEW |