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

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

Issue 1413833006: Reland of "webgl: optimize webgl.texSubImage2D(video) path." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fold glCopySubTextureCHROMIUM bug fix into this CL Created 5 years, 1 month 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 13185 matching lines...) Expand 10 before | Expand all | Expand 10 after
13196 return; 13196 return;
13197 } 13197 }
13198 } else { 13198 } else {
13199 if (!source_texture->GetLevelSize(source_texture->target(), 0, 13199 if (!source_texture->GetLevelSize(source_texture->target(), 0,
13200 &source_width, &source_height, nullptr)) { 13200 &source_width, &source_height, nullptr)) {
13201 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 13201 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13202 "source texture has no level 0"); 13202 "source texture has no level 0");
13203 return; 13203 return;
13204 } 13204 }
13205 13205
13206 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13207 width, height, 1)) {
13208 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13209 "source texture bad dimensions.");
13210 return;
13211 }
13212
dshwang 2015/10/29 09:18:09 As kbr reviewed, I fold https://codereview.chromiu
piman 2015/10/30 00:16:30 Can you explain? It seems that we would want to ma
dshwang 2015/10/30 11:06:28 That's good concern. Currently GLES2DecoderImpl ca
13206 // Check that this type of texture is allowed. 13213 // Check that this type of texture is allowed.
13207 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, 13214 if (!texture_manager()->ValidForTarget(source_texture->target(), 0,
13208 source_width, source_height, 1)) { 13215 source_width, source_height, 1)) {
13209 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 13216 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13210 "source texture bad dimensions"); 13217 "source texture bad dimensions");
13211 return; 13218 return;
13212 } 13219 }
13213 } 13220 }
13214 13221
13215 GLenum source_type = 0; 13222 GLenum source_type = 0;
13216 GLenum source_internal_format = 0; 13223 GLenum source_internal_format = 0;
13217 source_texture->GetLevelType(source_texture->target(), 0, &source_type, 13224 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
13218 &source_internal_format); 13225 &source_internal_format);
13219 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13220 width, height, 1)) {
13221 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13222 "source texture bad dimensions.");
13223 return;
13224 }
13225 13226
13226 GLenum dest_type = 0; 13227 GLenum dest_type = 0;
13227 GLenum dest_internal_format = 0; 13228 GLenum dest_internal_format = 0;
13228 bool dest_level_defined = dest_texture->GetLevelType( 13229 bool dest_level_defined = dest_texture->GetLevelType(
13229 dest_texture->target(), 0, &dest_type, &dest_internal_format); 13230 dest_texture->target(), 0, &dest_type, &dest_internal_format);
13230 if (!dest_level_defined) { 13231 if (!dest_level_defined) {
13231 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", 13232 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM",
13232 "destination texture is not defined"); 13233 "destination texture is not defined");
13233 return; 13234 return;
13234 } 13235 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
13518 return; 13519 return;
13519 } 13520 }
13520 } else { 13521 } else {
13521 if (!source_texture->GetLevelSize(source_texture->target(), 0, 13522 if (!source_texture->GetLevelSize(source_texture->target(), 0,
13522 &source_width, &source_height, nullptr)) { 13523 &source_width, &source_height, nullptr)) {
13523 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", 13524 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13524 "source texture has no level 0"); 13525 "source texture has no level 0");
13525 return; 13526 return;
13526 } 13527 }
13527 13528
13529 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13530 width, height, 1)) {
13531 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13532 "source texture bad dimensions.");
13533 return;
13534 }
13535
13528 // Check that this type of texture is allowed. 13536 // Check that this type of texture is allowed.
13529 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, 13537 if (!texture_manager()->ValidForTarget(source_texture->target(), 0,
13530 source_width, source_height, 1)) { 13538 source_width, source_height, 1)) {
13531 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", 13539 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13532 "source texture bad dimensions"); 13540 "source texture bad dimensions");
13533 return; 13541 return;
13534 } 13542 }
13535 } 13543 }
13536 13544
13537 GLenum source_type = 0; 13545 GLenum source_type = 0;
13538 GLenum source_internal_format = 0; 13546 GLenum source_internal_format = 0;
13539 source_texture->GetLevelType(source_texture->target(), 0, &source_type, 13547 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
13540 &source_internal_format); 13548 &source_internal_format);
13541 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13542 width, height, 1)) {
13543 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13544 "source texture bad dimensions.");
13545 return;
13546 }
13547 13549
13548 GLenum dest_type = 0; 13550 GLenum dest_type = 0;
13549 GLenum dest_internal_format = 0; 13551 GLenum dest_internal_format = 0;
13550 bool dest_level_defined = dest_texture->GetLevelType( 13552 bool dest_level_defined = dest_texture->GetLevelType(
13551 dest_texture->target(), 0, &dest_type, &dest_internal_format); 13553 dest_texture->target(), 0, &dest_type, &dest_internal_format);
13552 if (!dest_level_defined) { 13554 if (!dest_level_defined) {
13553 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 13555 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
13554 "glCompressedCopySubTextureCHROMIUM", 13556 "glCompressedCopySubTextureCHROMIUM",
13555 "destination texture is not defined"); 13557 "destination texture is not defined");
13556 return; 13558 return;
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
15442 return error::kNoError; 15444 return error::kNoError;
15443 } 15445 }
15444 15446
15445 // Include the auto-generated part of this file. We split this because it means 15447 // Include the auto-generated part of this file. We split this because it means
15446 // we can easily edit the non-auto generated parts right here in this file 15448 // we can easily edit the non-auto generated parts right here in this file
15447 // instead of having to edit some template or the code generator. 15449 // instead of having to edit some template or the code generator.
15448 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15450 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15449 15451
15450 } // namespace gles2 15452 } // namespace gles2
15451 } // namespace gpu 15453 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698