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

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

Powered by Google App Engine
This is Rietveld 408576698