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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 12040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12051 const char* function_name, | 12051 const char* function_name, |
| 12052 GLenum target, | 12052 GLenum target, |
| 12053 TextureRef* source_texture_ref, | 12053 TextureRef* source_texture_ref, |
| 12054 TextureRef* dest_texture_ref, | 12054 TextureRef* dest_texture_ref, |
| 12055 GLenum dest_internal_format) { | 12055 GLenum dest_internal_format) { |
| 12056 if (!source_texture_ref || !dest_texture_ref) { | 12056 if (!source_texture_ref || !dest_texture_ref) { |
| 12057 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); | 12057 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); |
| 12058 return false; | 12058 return false; |
| 12059 } | 12059 } |
| 12060 | 12060 |
| 12061 if (GL_TEXTURE_2D != target) { | 12061 Texture* source_texture = source_texture_ref->texture(); |
| 12062 Texture* dest_texture = dest_texture_ref->texture(); | |
| 12063 if (GL_TEXTURE_2D != target && | |
| 12064 GL_TEXTURE_CUBE_MAP != GLES2Util::GLFaceToTarget(target) && | |
|
piman
2015/08/06 20:43:23
Did you mean || instead of && ?
if target == GL_T
dshwang
2015/08/10 08:04:18
Yes, thx for fixing mistake.
| |
| 12065 dest_texture->target() != target) { | |
|
piman
2015/08/06 20:43:23
did you mean dest_texture->target() != GLES2Util::
dshwang
2015/08/10 08:04:18
Yes. oops, double mistake. Done.
| |
| 12062 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, | 12066 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 12063 "invalid texture target"); | 12067 "invalid texture target"); |
| 12064 return false; | 12068 return false; |
| 12065 } | 12069 } |
| 12066 | 12070 |
| 12067 Texture* source_texture = source_texture_ref->texture(); | |
| 12068 Texture* dest_texture = dest_texture_ref->texture(); | |
| 12069 if (source_texture == dest_texture) { | 12071 if (source_texture == dest_texture) { |
| 12070 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 12072 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 12071 "source and destination textures are the same"); | 12073 "source and destination textures are the same"); |
| 12072 return false; | 12074 return false; |
| 12073 } | 12075 } |
| 12074 | 12076 |
| 12075 if (dest_texture->target() != GL_TEXTURE_2D || | 12077 if (source_texture->target() != GL_TEXTURE_2D && |
| 12076 (source_texture->target() != GL_TEXTURE_2D && | 12078 source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && |
| 12077 source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && | 12079 source_texture->target() != GL_TEXTURE_EXTERNAL_OES) { |
| 12078 source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) { | |
| 12079 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, | 12080 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 12080 "invalid texture target binding"); | 12081 "invalid texture target binding"); |
| 12081 return false; | 12082 return false; |
| 12082 } | 12083 } |
| 12083 | 12084 |
| 12084 GLenum source_type = 0; | 12085 GLenum source_type = 0; |
| 12085 GLenum source_internal_format = 0; | 12086 GLenum source_internal_format = 0; |
| 12086 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 12087 source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
| 12087 &source_internal_format); | 12088 &source_internal_format); |
| 12088 | 12089 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12240 copy_texture_CHROMIUM_->Initialize(this); | 12241 copy_texture_CHROMIUM_->Initialize(this); |
| 12241 RestoreCurrentFramebufferBindings(); | 12242 RestoreCurrentFramebufferBindings(); |
| 12242 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) | 12243 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) |
| 12243 return; | 12244 return; |
| 12244 } | 12245 } |
| 12245 | 12246 |
| 12246 GLenum dest_type_previous = dest_type; | 12247 GLenum dest_type_previous = dest_type; |
| 12247 GLenum dest_internal_format = internal_format; | 12248 GLenum dest_internal_format = internal_format; |
| 12248 int dest_width = 0; | 12249 int dest_width = 0; |
| 12249 int dest_height = 0; | 12250 int dest_height = 0; |
| 12250 bool dest_level_defined = dest_texture->GetLevelSize( | 12251 bool dest_level_defined = |
| 12251 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); | 12252 dest_texture->GetLevelSize(target, 0, &dest_width, &dest_height, nullptr); |
| 12252 | 12253 |
| 12253 if (dest_level_defined) { | 12254 if (dest_level_defined) { |
| 12254 dest_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type_previous, | 12255 dest_texture->GetLevelType(target, 0, &dest_type_previous, |
| 12255 &dest_internal_format); | 12256 &dest_internal_format); |
| 12256 } | 12257 } |
| 12257 | 12258 |
| 12259 GLenum binding_target = GLES2Util::GLFaceToTarget(target); | |
|
piman
2015/08/06 20:43:23
You can use dest_texture->target(), which saves a
dshwang
2015/08/10 08:04:17
Done.
| |
| 12260 | |
| 12258 // Resize the destination texture to the dimensions of the source texture. | 12261 // Resize the destination texture to the dimensions of the source texture. |
| 12259 if (!dest_level_defined || dest_width != source_width || | 12262 if (!dest_level_defined || dest_width != source_width || |
| 12260 dest_height != source_height || | 12263 dest_height != source_height || |
| 12261 dest_internal_format != internal_format || | 12264 dest_internal_format != internal_format || |
| 12262 dest_type_previous != dest_type) { | 12265 dest_type_previous != dest_type) { |
| 12263 // Ensure that the glTexImage2D succeeds. | 12266 // Ensure that the glTexImage2D succeeds. |
| 12264 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); | 12267 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); |
| 12265 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 12268 glBindTexture(binding_target, dest_texture->service_id()); |
| 12266 glTexImage2D(GL_TEXTURE_2D, 0, internal_format, source_width, source_height, | 12269 glTexImage2D(target, 0, internal_format, source_width, source_height, 0, |
| 12267 0, internal_format, dest_type, NULL); | 12270 internal_format, dest_type, NULL); |
| 12268 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); | 12271 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); |
| 12269 if (error != GL_NO_ERROR) { | 12272 if (error != GL_NO_ERROR) { |
| 12270 RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); | 12273 RestoreCurrentTextureBindings(&state_, binding_target); |
| 12271 return; | 12274 return; |
| 12272 } | 12275 } |
| 12273 | 12276 |
| 12274 texture_manager()->SetLevelInfo( | 12277 texture_manager()->SetLevelInfo( |
| 12275 dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, | 12278 dest_texture_ref, target, 0, internal_format, source_width, |
| 12276 source_height, 1, 0, internal_format, dest_type, | 12279 source_height, 1, 0, internal_format, dest_type, |
| 12277 gfx::Rect(source_width, source_height)); | 12280 gfx::Rect(source_width, source_height)); |
| 12278 } else { | 12281 } else { |
| 12279 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 12282 texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true); |
| 12280 true); | |
| 12281 } | 12283 } |
| 12282 | 12284 |
| 12283 ScopedModifyPixels modify(dest_texture_ref); | 12285 ScopedModifyPixels modify(dest_texture_ref); |
| 12284 | 12286 |
| 12285 // Try using GLImage::CopyTexSubImage when possible. | 12287 // Try using GLImage::CopyTexSubImage when possible. |
| 12286 bool unpack_premultiply_alpha_change = | 12288 bool unpack_premultiply_alpha_change = |
| 12287 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 12289 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 12288 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 12290 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| 12289 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 12291 glBindTexture(binding_target, dest_texture->service_id()); |
| 12290 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(0, 0), | 12292 if (image->CopyTexSubImage(target, gfx::Point(0, 0), |
| 12291 gfx::Rect(0, 0, source_width, source_height))) { | 12293 gfx::Rect(0, 0, source_width, source_height))) { |
| 12292 return; | 12294 return; |
| 12293 } | 12295 } |
| 12294 } | 12296 } |
| 12295 | 12297 |
| 12296 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); | 12298 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); |
| 12297 | 12299 |
| 12298 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 12300 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 12299 // before presenting. | 12301 // before presenting. |
| 12300 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { | 12302 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
| 12301 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | 12303 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| 12302 // instead of using kIdentityMatrix crbug.com/226218. | 12304 // instead of using kIdentityMatrix crbug.com/226218. |
| 12303 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 12305 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 12304 this, source_texture->target(), source_texture->service_id(), | 12306 this, source_texture->target(), source_texture->service_id(), target, |
| 12305 dest_texture->service_id(), source_width, source_height, | 12307 dest_texture->service_id(), source_width, source_height, |
| 12306 unpack_flip_y == GL_TRUE, | 12308 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| 12307 unpack_premultiply_alpha == GL_TRUE, | 12309 unpack_unmultiply_alpha == GL_TRUE, kIdentityMatrix); |
| 12308 unpack_unmultiply_alpha == GL_TRUE, | |
| 12309 kIdentityMatrix); | |
| 12310 } else { | 12310 } else { |
| 12311 copy_texture_CHROMIUM_->DoCopyTexture( | 12311 copy_texture_CHROMIUM_->DoCopyTexture( |
| 12312 this, source_texture->target(), source_texture->service_id(), | 12312 this, source_texture->target(), source_texture->service_id(), |
| 12313 source_internal_format, dest_texture->service_id(), internal_format, | 12313 source_internal_format, target, dest_texture->service_id(), |
| 12314 source_width, source_height, | 12314 internal_format, source_width, source_height, unpack_flip_y == GL_TRUE, |
| 12315 unpack_flip_y == GL_TRUE, | |
| 12316 unpack_premultiply_alpha == GL_TRUE, | 12315 unpack_premultiply_alpha == GL_TRUE, |
| 12317 unpack_unmultiply_alpha == GL_TRUE); | 12316 unpack_unmultiply_alpha == GL_TRUE); |
| 12318 } | 12317 } |
| 12319 | 12318 |
| 12320 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); | 12319 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); |
| 12321 } | 12320 } |
| 12322 | 12321 |
| 12323 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( | 12322 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| 12324 GLenum target, | 12323 GLenum target, |
| 12325 GLuint source_id, | 12324 GLuint source_id, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12375 &source_internal_format); | 12374 &source_internal_format); |
| 12376 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, | 12375 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
| 12377 width, height, 1, source_type)) { | 12376 width, height, 1, source_type)) { |
| 12378 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 12377 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
| 12379 "source texture bad dimensions."); | 12378 "source texture bad dimensions."); |
| 12380 return; | 12379 return; |
| 12381 } | 12380 } |
| 12382 | 12381 |
| 12383 GLenum dest_type = 0; | 12382 GLenum dest_type = 0; |
| 12384 GLenum dest_internal_format = 0; | 12383 GLenum dest_internal_format = 0; |
| 12385 bool dest_level_defined = dest_texture->GetLevelType( | 12384 bool dest_level_defined = |
| 12386 dest_texture->target(), 0, &dest_type, &dest_internal_format); | 12385 dest_texture->GetLevelType(target, 0, &dest_type, &dest_internal_format); |
| 12387 if (!dest_level_defined) { | 12386 if (!dest_level_defined) { |
| 12388 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", | 12387 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", |
| 12389 "destination texture is not defined"); | 12388 "destination texture is not defined"); |
| 12390 return; | 12389 return; |
| 12391 } | 12390 } |
| 12392 if (!dest_texture->ValidForTexture(dest_texture->target(), 0, xoffset, | 12391 if (!dest_texture->ValidForTexture(target, 0, xoffset, yoffset, 0, width, |
| 12393 yoffset, 0, width, height, 1, dest_type)) { | 12392 height, 1, dest_type)) { |
| 12394 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 12393 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
| 12395 "destination texture bad dimensions."); | 12394 "destination texture bad dimensions."); |
| 12396 return; | 12395 return; |
| 12397 } | 12396 } |
| 12398 | 12397 |
| 12399 if (!ValidateCopyTextureCHROMIUM("glCopySubTextureCHROMIUM", target, | 12398 if (!ValidateCopyTextureCHROMIUM("glCopySubTextureCHROMIUM", target, |
| 12400 source_texture_ref, dest_texture_ref, | 12399 source_texture_ref, dest_texture_ref, |
| 12401 dest_internal_format)) { | 12400 dest_internal_format)) { |
| 12402 return; | 12401 return; |
| 12403 } | 12402 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 12416 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopySubTextureCHROMIUM"); | 12415 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopySubTextureCHROMIUM"); |
| 12417 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); | 12416 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); |
| 12418 copy_texture_CHROMIUM_->Initialize(this); | 12417 copy_texture_CHROMIUM_->Initialize(this); |
| 12419 RestoreCurrentFramebufferBindings(); | 12418 RestoreCurrentFramebufferBindings(); |
| 12420 if (LOCAL_PEEK_GL_ERROR("glCopySubTextureCHROMIUM") != GL_NO_ERROR) | 12419 if (LOCAL_PEEK_GL_ERROR("glCopySubTextureCHROMIUM") != GL_NO_ERROR) |
| 12421 return; | 12420 return; |
| 12422 } | 12421 } |
| 12423 | 12422 |
| 12424 int dest_width = 0; | 12423 int dest_width = 0; |
| 12425 int dest_height = 0; | 12424 int dest_height = 0; |
| 12426 bool ok = dest_texture->GetLevelSize( | 12425 bool ok = |
| 12427 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); | 12426 dest_texture->GetLevelSize(target, 0, &dest_width, &dest_height, nullptr); |
| 12428 DCHECK(ok); | 12427 DCHECK(ok); |
| 12429 if (xoffset != 0 || yoffset != 0 || width != dest_width || | 12428 if (xoffset != 0 || yoffset != 0 || width != dest_width || |
| 12430 height != dest_height) { | 12429 height != dest_height) { |
| 12431 gfx::Rect cleared_rect; | 12430 gfx::Rect cleared_rect; |
| 12432 if (CombineAdjacentRects(dest_texture->GetLevelClearedRect(target, 0), | 12431 if (CombineAdjacentRects(dest_texture->GetLevelClearedRect(target, 0), |
| 12433 gfx::Rect(xoffset, yoffset, width, height), | 12432 gfx::Rect(xoffset, yoffset, width, height), |
| 12434 &cleared_rect)) { | 12433 &cleared_rect)) { |
| 12435 DCHECK_GE(cleared_rect.size().GetArea(), | 12434 DCHECK_GE(cleared_rect.size().GetArea(), |
| 12436 dest_texture->GetLevelClearedRect(target, 0).size().GetArea()); | 12435 dest_texture->GetLevelClearedRect(target, 0).size().GetArea()); |
| 12437 texture_manager()->SetLevelClearedRect(dest_texture_ref, target, 0, | 12436 texture_manager()->SetLevelClearedRect(dest_texture_ref, target, 0, |
| 12438 cleared_rect); | 12437 cleared_rect); |
| 12439 } else { | 12438 } else { |
| 12440 // Otherwise clear part of texture level that is not already cleared. | 12439 // Otherwise clear part of texture level that is not already cleared. |
| 12441 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, target, | 12440 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, target, |
| 12442 0)) { | 12441 0)) { |
| 12443 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM", | 12442 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM", |
| 12444 "destination texture dimensions too big"); | 12443 "destination texture dimensions too big"); |
| 12445 return; | 12444 return; |
| 12446 } | 12445 } |
| 12447 } | 12446 } |
| 12448 } else { | 12447 } else { |
| 12449 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 12448 texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true); |
| 12450 true); | |
| 12451 } | 12449 } |
| 12452 | 12450 |
| 12453 ScopedModifyPixels modify(dest_texture_ref); | 12451 ScopedModifyPixels modify(dest_texture_ref); |
| 12454 | 12452 |
| 12455 // Try using GLImage::CopyTexSubImage when possible. | 12453 // Try using GLImage::CopyTexSubImage when possible. |
| 12456 bool unpack_premultiply_alpha_change = | 12454 bool unpack_premultiply_alpha_change = |
| 12457 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 12455 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 12458 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 12456 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| 12459 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 12457 GLenum binding_target = GLES2Util::GLFaceToTarget(target); |
|
piman
2015/08/06 20:43:23
you can use dest_texture->target() to save a switc
dshwang
2015/08/10 08:04:18
Done.
| |
| 12460 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), | 12458 glBindTexture(binding_target, dest_texture->service_id()); |
| 12459 if (image->CopyTexSubImage(target, gfx::Point(xoffset, yoffset), | |
| 12461 gfx::Rect(x, y, width, height))) { | 12460 gfx::Rect(x, y, width, height))) { |
| 12462 return; | 12461 return; |
| 12463 } | 12462 } |
| 12464 } | 12463 } |
| 12465 | 12464 |
| 12466 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); | 12465 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); |
| 12467 | 12466 |
| 12468 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. | 12467 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. |
| 12469 // crbug.com/226218. | 12468 // crbug.com/226218. |
| 12470 copy_texture_CHROMIUM_->DoCopySubTexture( | 12469 copy_texture_CHROMIUM_->DoCopySubTexture( |
| 12471 this, source_texture->target(), source_texture->service_id(), | 12470 this, source_texture->target(), source_texture->service_id(), |
| 12472 source_internal_format, dest_texture->service_id(), dest_internal_format, | 12471 source_internal_format, target, dest_texture->service_id(), |
| 12473 xoffset, yoffset, x, y, width, height, dest_width, dest_height, | 12472 dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, |
| 12474 source_width, source_height, | 12473 dest_height, source_width, source_height, unpack_flip_y == GL_TRUE, |
| 12475 unpack_flip_y == GL_TRUE, | 12474 unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE); |
| 12476 unpack_premultiply_alpha == GL_TRUE, | |
| 12477 unpack_unmultiply_alpha == GL_TRUE); | |
| 12478 | 12475 |
| 12479 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); | 12476 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); |
| 12480 } | 12477 } |
| 12481 | 12478 |
| 12482 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, | 12479 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, |
| 12483 GLuint source_id, | 12480 GLuint source_id, |
| 12484 GLuint dest_id) { | 12481 GLuint dest_id) { |
| 12485 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); | 12482 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); |
| 12486 | 12483 |
| 12487 TextureRef* source_texture_ref = GetTexture(source_id); | 12484 TextureRef* source_texture_ref = GetTexture(source_id); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12636 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 12633 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 12637 gfx::Rect(source_width, source_height)); | 12634 gfx::Rect(source_width, source_height)); |
| 12638 | 12635 |
| 12639 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 12636 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 12640 // before presenting. | 12637 // before presenting. |
| 12641 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { | 12638 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
| 12642 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | 12639 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| 12643 // instead of using kIdentityMatrix crbug.com/226218. | 12640 // instead of using kIdentityMatrix crbug.com/226218. |
| 12644 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 12641 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 12645 this, source_texture->target(), source_texture->service_id(), | 12642 this, source_texture->target(), source_texture->service_id(), |
| 12646 dest_texture->service_id(), source_width, source_height, | 12643 GL_TEXTURE_2D, dest_texture->service_id(), source_width, source_height, |
| 12647 false, false, false, kIdentityMatrix); | 12644 false, false, false, kIdentityMatrix); |
| 12648 } else { | 12645 } else { |
| 12649 copy_texture_CHROMIUM_->DoCopyTexture( | 12646 copy_texture_CHROMIUM_->DoCopyTexture( |
| 12650 this, source_texture->target(), source_texture->service_id(), | 12647 this, source_texture->target(), source_texture->service_id(), |
| 12651 source_internal_format, dest_texture->service_id(), GL_RGBA, | 12648 source_internal_format, GL_TEXTURE_2D, dest_texture->service_id(), |
| 12652 source_width, source_height, false, false, false); | 12649 GL_RGBA, source_width, source_height, false, false, false); |
| 12653 } | 12650 } |
| 12654 | 12651 |
| 12655 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); | 12652 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); |
| 12656 } | 12653 } |
| 12657 | 12654 |
| 12658 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { | 12655 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { |
| 12659 switch (internalformat) { | 12656 switch (internalformat) { |
| 12660 case GL_R8: | 12657 case GL_R8: |
| 12661 return GL_UNSIGNED_BYTE; | 12658 return GL_UNSIGNED_BYTE; |
| 12662 case GL_R8_SNORM: | 12659 case GL_R8_SNORM: |
| (...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14405 return error::kNoError; | 14402 return error::kNoError; |
| 14406 } | 14403 } |
| 14407 | 14404 |
| 14408 // Include the auto-generated part of this file. We split this because it means | 14405 // Include the auto-generated part of this file. We split this because it means |
| 14409 // we can easily edit the non-auto generated parts right here in this file | 14406 // we can easily edit the non-auto generated parts right here in this file |
| 14410 // instead of having to edit some template or the code generator. | 14407 // instead of having to edit some template or the code generator. |
| 14411 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 14408 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 14412 | 14409 |
| 14413 } // namespace gles2 | 14410 } // namespace gles2 |
| 14414 } // namespace gpu | 14411 } // namespace gpu |
| OLD | NEW |