Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1275773003: gpu: support GL_TEXTURE_CUBE_MAP destination target to Copy(Sub)TextureCHROMIUM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Choose correct and expensive way Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12180 matching lines...) Expand 10 before | Expand all | Expand 10 after
12191 const char* function_name, 12191 const char* function_name,
12192 GLenum target, 12192 GLenum target,
12193 TextureRef* source_texture_ref, 12193 TextureRef* source_texture_ref,
12194 TextureRef* dest_texture_ref, 12194 TextureRef* dest_texture_ref,
12195 GLenum dest_internal_format) { 12195 GLenum dest_internal_format) {
12196 if (!source_texture_ref || !dest_texture_ref) { 12196 if (!source_texture_ref || !dest_texture_ref) {
12197 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); 12197 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id");
12198 return false; 12198 return false;
12199 } 12199 }
12200 12200
12201 if (GL_TEXTURE_2D != target) {
12202 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name,
12203 "invalid texture target");
12204 return false;
12205 }
12206
12207 Texture* source_texture = source_texture_ref->texture(); 12201 Texture* source_texture = source_texture_ref->texture();
12208 Texture* dest_texture = dest_texture_ref->texture(); 12202 Texture* dest_texture = dest_texture_ref->texture();
12209 if (source_texture == dest_texture) { 12203 if (source_texture == dest_texture) {
12210 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, 12204 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
12211 "source and destination textures are the same"); 12205 "source and destination textures are the same");
12212 return false; 12206 return false;
12213 } 12207 }
12214 12208
12215 if (dest_texture->target() != GL_TEXTURE_2D || 12209 GLenum binding_target = GLES2Util::GLTextureTargetToBindingTarget(target);
12216 (source_texture->target() != GL_TEXTURE_2D && 12210 if (dest_texture->target() != binding_target ||
12217 source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && 12211 (GL_TEXTURE_2D != binding_target &&
12218 source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) { 12212 GL_TEXTURE_CUBE_MAP != binding_target)) {
12213 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name,
12214 "invalid texture target");
12215 return false;
12216 }
12217
12218 if (source_texture->target() != GL_TEXTURE_2D &&
12219 source_texture->target() != GL_TEXTURE_RECTANGLE_ARB &&
12220 source_texture->target() != GL_TEXTURE_EXTERNAL_OES) {
12219 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, 12221 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name,
12220 "invalid texture target binding"); 12222 "invalid texture target binding");
12221 return false; 12223 return false;
12222 } 12224 }
12223 12225
12224 GLenum source_type = 0; 12226 GLenum source_type = 0;
12225 GLenum source_internal_format = 0; 12227 GLenum source_internal_format = 0;
12226 source_texture->GetLevelType(source_texture->target(), 0, &source_type, 12228 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
12227 &source_internal_format); 12229 &source_internal_format);
12228 12230
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
12380 copy_texture_CHROMIUM_->Initialize(this); 12382 copy_texture_CHROMIUM_->Initialize(this);
12381 RestoreCurrentFramebufferBindings(); 12383 RestoreCurrentFramebufferBindings();
12382 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) 12384 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR)
12383 return; 12385 return;
12384 } 12386 }
12385 12387
12386 GLenum dest_type_previous = dest_type; 12388 GLenum dest_type_previous = dest_type;
12387 GLenum dest_internal_format = internal_format; 12389 GLenum dest_internal_format = internal_format;
12388 int dest_width = 0; 12390 int dest_width = 0;
12389 int dest_height = 0; 12391 int dest_height = 0;
12390 bool dest_level_defined = dest_texture->GetLevelSize( 12392 bool dest_level_defined =
12391 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); 12393 dest_texture->GetLevelSize(target, 0, &dest_width, &dest_height, nullptr);
12392 12394
12393 if (dest_level_defined) { 12395 if (dest_level_defined) {
12394 dest_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type_previous, 12396 dest_texture->GetLevelType(target, 0, &dest_type_previous,
12395 &dest_internal_format); 12397 &dest_internal_format);
12396 } 12398 }
12397 12399
12398 // Resize the destination texture to the dimensions of the source texture. 12400 // Resize the destination texture to the dimensions of the source texture.
12399 if (!dest_level_defined || dest_width != source_width || 12401 if (!dest_level_defined || dest_width != source_width ||
12400 dest_height != source_height || 12402 dest_height != source_height ||
12401 dest_internal_format != internal_format || 12403 dest_internal_format != internal_format ||
12402 dest_type_previous != dest_type) { 12404 dest_type_previous != dest_type) {
12403 // Ensure that the glTexImage2D succeeds. 12405 // Ensure that the glTexImage2D succeeds.
12404 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); 12406 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM");
12405 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); 12407 glBindTexture(dest_texture->target(), dest_texture->service_id());
12406 glTexImage2D(GL_TEXTURE_2D, 0, internal_format, source_width, source_height, 12408 glTexImage2D(target, 0, internal_format, source_width, source_height, 0,
12407 0, internal_format, dest_type, NULL); 12409 internal_format, dest_type, NULL);
12408 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); 12410 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM");
12409 if (error != GL_NO_ERROR) { 12411 if (error != GL_NO_ERROR) {
12410 RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); 12412 RestoreCurrentTextureBindings(&state_, dest_texture->target());
12411 return; 12413 return;
12412 } 12414 }
12413 12415
12414 texture_manager()->SetLevelInfo( 12416 texture_manager()->SetLevelInfo(
12415 dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, 12417 dest_texture_ref, target, 0, internal_format, source_width,
12416 source_height, 1, 0, internal_format, dest_type, 12418 source_height, 1, 0, internal_format, dest_type,
12417 gfx::Rect(source_width, source_height)); 12419 gfx::Rect(source_width, source_height));
12418 } else { 12420 } else {
12419 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, 12421 texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true);
12420 true);
12421 } 12422 }
12422 12423
12423 ScopedModifyPixels modify(dest_texture_ref); 12424 ScopedModifyPixels modify(dest_texture_ref);
12424 12425
12425 // Try using GLImage::CopyTexSubImage when possible. 12426 // Try using GLImage::CopyTexSubImage when possible.
12426 bool unpack_premultiply_alpha_change = 12427 bool unpack_premultiply_alpha_change =
12427 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; 12428 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0;
12428 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { 12429 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) {
12429 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); 12430 glBindTexture(dest_texture->target(), dest_texture->service_id());
12430 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(0, 0), 12431 if (image->CopyTexSubImage(target, gfx::Point(0, 0),
12431 gfx::Rect(0, 0, source_width, source_height))) { 12432 gfx::Rect(0, 0, source_width, source_height))) {
12432 return; 12433 return;
12433 } 12434 }
12434 } 12435 }
12435 12436
12436 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); 12437 DoWillUseTexImageIfNeeded(source_texture, source_texture->target());
12437 12438
12438 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix 12439 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
12439 // before presenting. 12440 // before presenting.
12440 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { 12441 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) {
12441 // TODO(hkuang): get the StreamTexture transform matrix in GPU process 12442 // TODO(hkuang): get the StreamTexture transform matrix in GPU process
12442 // instead of using kIdentityMatrix crbug.com/226218. 12443 // instead of using kIdentityMatrix crbug.com/226218.
12443 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( 12444 copy_texture_CHROMIUM_->DoCopyTextureWithTransform(
12444 this, source_texture->target(), source_texture->service_id(), 12445 this, source_texture->target(), source_texture->service_id(), target,
12445 dest_texture->service_id(), source_width, source_height, 12446 dest_texture->service_id(), internal_format, dest_type, source_width,
12446 unpack_flip_y == GL_TRUE, 12447 source_height, unpack_flip_y == GL_TRUE,
12447 unpack_premultiply_alpha == GL_TRUE, 12448 unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE,
12448 unpack_unmultiply_alpha == GL_TRUE, 12449 dest_texture->cube_complete(), kIdentityMatrix);
12449 kIdentityMatrix);
12450 } else { 12450 } else {
12451 copy_texture_CHROMIUM_->DoCopyTexture( 12451 copy_texture_CHROMIUM_->DoCopyTexture(
12452 this, source_texture->target(), source_texture->service_id(), 12452 this, source_texture->target(), source_texture->service_id(),
12453 source_internal_format, dest_texture->service_id(), internal_format, 12453 source_internal_format, target, dest_texture->service_id(),
12454 source_width, source_height, 12454 internal_format, dest_type, source_width, source_height,
12455 unpack_flip_y == GL_TRUE, 12455 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
12456 unpack_premultiply_alpha == GL_TRUE, 12456 unpack_unmultiply_alpha == GL_TRUE, dest_texture->cube_complete());
12457 unpack_unmultiply_alpha == GL_TRUE);
12458 } 12457 }
12459 12458
12460 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); 12459 DoDidUseTexImageIfNeeded(source_texture, source_texture->target());
12461 } 12460 }
12462 12461
12463 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( 12462 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM(
12464 GLenum target, 12463 GLenum target,
12465 GLuint source_id, 12464 GLuint source_id,
12466 GLuint dest_id, 12465 GLuint dest_id,
12467 GLint xoffset, 12466 GLint xoffset,
12468 GLint yoffset, 12467 GLint yoffset,
12469 GLint x, 12468 GLint x,
12470 GLint y, 12469 GLint y,
12471 GLsizei width, 12470 GLsizei width,
12472 GLsizei height, 12471 GLsizei height,
12473 GLboolean unpack_flip_y, 12472 GLboolean unpack_flip_y,
12474 GLboolean unpack_premultiply_alpha, 12473 GLboolean unpack_premultiply_alpha,
12475 GLboolean unpack_unmultiply_alpha) { 12474 GLboolean unpack_unmultiply_alpha) {
12476 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); 12475 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM");
12477 12476
12478 TextureRef* source_texture_ref = GetTexture(source_id); 12477 TextureRef* source_texture_ref = GetTexture(source_id);
12479 TextureRef* dest_texture_ref = GetTexture(dest_id); 12478 TextureRef* dest_texture_ref = GetTexture(dest_id);
12480 Texture* source_texture = source_texture_ref->texture(); 12479 Texture* source_texture = source_texture_ref->texture();
12481 Texture* dest_texture = dest_texture_ref->texture(); 12480 Texture* dest_texture = dest_texture_ref->texture();
12481 GLenum source_type = 0;
12482 GLenum source_internal_format = 0;
12483 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
12484 &source_internal_format);
12482 int source_width = 0; 12485 int source_width = 0;
12483 int source_height = 0; 12486 int source_height = 0;
12484 gfx::GLImage* image = 12487 gfx::GLImage* image =
12485 source_texture->GetLevelImage(source_texture->target(), 0); 12488 source_texture->GetLevelImage(source_texture->target(), 0);
12486 if (image) { 12489 if (image) {
12487 gfx::Size size = image->GetSize(); 12490 gfx::Size size = image->GetSize();
12488 source_width = size.width(); 12491 source_width = size.width();
12489 source_height = size.height(); 12492 source_height = size.height();
12490 if (source_width <= 0 || source_height <= 0) { 12493 if (source_width <= 0 || source_height <= 0) {
12491 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 12494 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
12492 "invalid image size"); 12495 "invalid image size");
12493 return; 12496 return;
12494 } 12497 }
12495 } else { 12498 } else {
12496 if (!source_texture->GetLevelSize(source_texture->target(), 0, 12499 if (!source_texture->GetLevelSize(source_texture->target(), 0,
12497 &source_width, &source_height, nullptr)) { 12500 &source_width, &source_height, nullptr)) {
12498 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 12501 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
12499 "source texture has no level 0"); 12502 "source texture has no level 0");
12500 return; 12503 return;
12501 } 12504 }
12502 12505
12506 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
12507 width, height, 1, source_type)) {
12508 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
12509 "source texture bad dimensions.");
12510 return;
12511 }
12512
12503 // Check that this type of texture is allowed. 12513 // Check that this type of texture is allowed.
12504 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, 12514 if (!texture_manager()->ValidForTarget(source_texture->target(), 0,
12505 source_width, source_height, 1)) { 12515 source_width, source_height, 1)) {
12506 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 12516 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
12507 "source texture bad dimensions"); 12517 "source texture bad dimensions");
12508 return; 12518 return;
12509 } 12519 }
12510 } 12520 }
12511 12521
12512 GLenum source_type = 0;
12513 GLenum source_internal_format = 0;
12514 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
12515 &source_internal_format);
12516 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
12517 width, height, 1, source_type)) {
12518 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
12519 "source texture bad dimensions.");
12520 return;
12521 }
12522
12523 GLenum dest_type = 0; 12522 GLenum dest_type = 0;
12524 GLenum dest_internal_format = 0; 12523 GLenum dest_internal_format = 0;
12525 bool dest_level_defined = dest_texture->GetLevelType( 12524 bool dest_level_defined =
12526 dest_texture->target(), 0, &dest_type, &dest_internal_format); 12525 dest_texture->GetLevelType(target, 0, &dest_type, &dest_internal_format);
12527 if (!dest_level_defined) { 12526 if (!dest_level_defined) {
12528 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", 12527 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM",
12529 "destination texture is not defined"); 12528 "destination texture is not defined");
12530 return; 12529 return;
12531 } 12530 }
12532 if (!dest_texture->ValidForTexture(dest_texture->target(), 0, xoffset, 12531 if (!dest_texture->ValidForTexture(target, 0, xoffset, yoffset, 0, width,
12533 yoffset, 0, width, height, 1, dest_type)) { 12532 height, 1, dest_type)) {
12534 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 12533 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
12535 "destination texture bad dimensions."); 12534 "destination texture bad dimensions.");
12536 return; 12535 return;
12537 } 12536 }
12538 12537
12539 if (!ValidateCopyTextureCHROMIUM("glCopySubTextureCHROMIUM", target, 12538 if (!ValidateCopyTextureCHROMIUM("glCopySubTextureCHROMIUM", target,
12540 source_texture_ref, dest_texture_ref, 12539 source_texture_ref, dest_texture_ref,
12541 dest_internal_format)) { 12540 dest_internal_format)) {
12542 return; 12541 return;
12543 } 12542 }
(...skipping 12 matching lines...) Expand all
12556 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopySubTextureCHROMIUM"); 12555 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopySubTextureCHROMIUM");
12557 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); 12556 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager());
12558 copy_texture_CHROMIUM_->Initialize(this); 12557 copy_texture_CHROMIUM_->Initialize(this);
12559 RestoreCurrentFramebufferBindings(); 12558 RestoreCurrentFramebufferBindings();
12560 if (LOCAL_PEEK_GL_ERROR("glCopySubTextureCHROMIUM") != GL_NO_ERROR) 12559 if (LOCAL_PEEK_GL_ERROR("glCopySubTextureCHROMIUM") != GL_NO_ERROR)
12561 return; 12560 return;
12562 } 12561 }
12563 12562
12564 int dest_width = 0; 12563 int dest_width = 0;
12565 int dest_height = 0; 12564 int dest_height = 0;
12566 bool ok = dest_texture->GetLevelSize( 12565 bool ok =
12567 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); 12566 dest_texture->GetLevelSize(target, 0, &dest_width, &dest_height, nullptr);
12568 DCHECK(ok); 12567 DCHECK(ok);
12569 if (xoffset != 0 || yoffset != 0 || width != dest_width || 12568 if (xoffset != 0 || yoffset != 0 || width != dest_width ||
12570 height != dest_height) { 12569 height != dest_height) {
12571 gfx::Rect cleared_rect; 12570 gfx::Rect cleared_rect;
12572 if (CombineAdjacentRects(dest_texture->GetLevelClearedRect(target, 0), 12571 if (CombineAdjacentRects(dest_texture->GetLevelClearedRect(target, 0),
12573 gfx::Rect(xoffset, yoffset, width, height), 12572 gfx::Rect(xoffset, yoffset, width, height),
12574 &cleared_rect)) { 12573 &cleared_rect)) {
12575 DCHECK_GE(cleared_rect.size().GetArea(), 12574 DCHECK_GE(cleared_rect.size().GetArea(),
12576 dest_texture->GetLevelClearedRect(target, 0).size().GetArea()); 12575 dest_texture->GetLevelClearedRect(target, 0).size().GetArea());
12577 texture_manager()->SetLevelClearedRect(dest_texture_ref, target, 0, 12576 texture_manager()->SetLevelClearedRect(dest_texture_ref, target, 0,
12578 cleared_rect); 12577 cleared_rect);
12579 } else { 12578 } else {
12580 // Otherwise clear part of texture level that is not already cleared. 12579 // Otherwise clear part of texture level that is not already cleared.
12581 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, target, 12580 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, target,
12582 0)) { 12581 0)) {
12583 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM", 12582 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM",
12584 "destination texture dimensions too big"); 12583 "destination texture dimensions too big");
12585 return; 12584 return;
12586 } 12585 }
12587 } 12586 }
12588 } else { 12587 } else {
12589 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, 12588 texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true);
12590 true);
12591 } 12589 }
12592 12590
12593 ScopedModifyPixels modify(dest_texture_ref); 12591 ScopedModifyPixels modify(dest_texture_ref);
12594 12592
12595 // Try using GLImage::CopyTexSubImage when possible. 12593 // Try using GLImage::CopyTexSubImage when possible.
12596 bool unpack_premultiply_alpha_change = 12594 bool unpack_premultiply_alpha_change =
12597 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; 12595 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0;
12598 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { 12596 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) {
12599 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); 12597 glBindTexture(dest_texture->target(), dest_texture->service_id());
12600 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), 12598 if (image->CopyTexSubImage(target, gfx::Point(xoffset, yoffset),
12601 gfx::Rect(x, y, width, height))) { 12599 gfx::Rect(x, y, width, height))) {
12602 return; 12600 return;
12603 } 12601 }
12604 } 12602 }
12605 12603
12606 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); 12604 DoWillUseTexImageIfNeeded(source_texture, source_texture->target());
12607 12605
12608 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. 12606 // TODO(hkuang): get the StreamTexture transform matrix in GPU process.
12609 // crbug.com/226218. 12607 // crbug.com/226218.
12610 copy_texture_CHROMIUM_->DoCopySubTexture( 12608 copy_texture_CHROMIUM_->DoCopySubTexture(
12611 this, source_texture->target(), source_texture->service_id(), 12609 this, source_texture->target(), source_texture->service_id(),
12612 source_internal_format, dest_texture->service_id(), dest_internal_format, 12610 source_internal_format, target, dest_texture->service_id(),
12613 xoffset, yoffset, x, y, width, height, dest_width, dest_height, 12611 dest_internal_format, dest_type, xoffset, yoffset, x, y, width, height,
12614 source_width, source_height, 12612 dest_width, dest_height, source_width, source_height,
12615 unpack_flip_y == GL_TRUE, 12613 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
12616 unpack_premultiply_alpha == GL_TRUE, 12614 unpack_unmultiply_alpha == GL_TRUE, dest_texture->cube_complete());
12617 unpack_unmultiply_alpha == GL_TRUE);
12618 12615
12619 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); 12616 DoDidUseTexImageIfNeeded(source_texture, source_texture->target());
12620 } 12617 }
12621 12618
12622 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, 12619 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target,
12623 GLuint source_id, 12620 GLuint source_id,
12624 GLuint dest_id) { 12621 GLuint dest_id) {
12625 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); 12622 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM");
12626 12623
12627 TextureRef* source_texture_ref = GetTexture(source_id); 12624 TextureRef* source_texture_ref = GetTexture(source_id);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
12776 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 12773 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
12777 gfx::Rect(source_width, source_height)); 12774 gfx::Rect(source_width, source_height));
12778 12775
12779 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix 12776 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
12780 // before presenting. 12777 // before presenting.
12781 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { 12778 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) {
12782 // TODO(hkuang): get the StreamTexture transform matrix in GPU process 12779 // TODO(hkuang): get the StreamTexture transform matrix in GPU process
12783 // instead of using kIdentityMatrix crbug.com/226218. 12780 // instead of using kIdentityMatrix crbug.com/226218.
12784 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( 12781 copy_texture_CHROMIUM_->DoCopyTextureWithTransform(
12785 this, source_texture->target(), source_texture->service_id(), 12782 this, source_texture->target(), source_texture->service_id(),
12786 dest_texture->service_id(), source_width, source_height, 12783 GL_TEXTURE_2D, dest_texture->service_id(), GL_RGBA, GL_UNSIGNED_BYTE,
12787 false, false, false, kIdentityMatrix); 12784 source_width, source_height, false, false, false,
12785 dest_texture->cube_complete(), kIdentityMatrix);
12788 } else { 12786 } else {
12789 copy_texture_CHROMIUM_->DoCopyTexture( 12787 copy_texture_CHROMIUM_->DoCopyTexture(
12790 this, source_texture->target(), source_texture->service_id(), 12788 this, source_texture->target(), source_texture->service_id(),
12791 source_internal_format, dest_texture->service_id(), GL_RGBA, 12789 source_internal_format, GL_TEXTURE_2D, dest_texture->service_id(),
12792 source_width, source_height, false, false, false); 12790 GL_RGBA, GL_UNSIGNED_BYTE, source_width, source_height, false, false,
12791 false, dest_texture->cube_complete());
12793 } 12792 }
12794 12793
12795 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); 12794 DoDidUseTexImageIfNeeded(source_texture, source_texture->target());
12796 } 12795 }
12797 12796
12798 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { 12797 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) {
12799 switch (internalformat) { 12798 switch (internalformat) {
12800 case GL_R8: 12799 case GL_R8:
12801 return GL_UNSIGNED_BYTE; 12800 return GL_UNSIGNED_BYTE;
12802 case GL_R8_SNORM: 12801 case GL_R8_SNORM:
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
14545 return error::kNoError; 14544 return error::kNoError;
14546 } 14545 }
14547 14546
14548 // Include the auto-generated part of this file. We split this because it means 14547 // Include the auto-generated part of this file. We split this because it means
14549 // we can easily edit the non-auto generated parts right here in this file 14548 // we can easily edit the non-auto generated parts right here in this file
14550 // instead of having to edit some template or the code generator. 14549 // instead of having to edit some template or the code generator.
14551 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 14550 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
14552 14551
14553 } // namespace gles2 14552 } // namespace gles2
14554 } // namespace gpu 14553 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698