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

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: Add TODO comments 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
« no previous file with comments | « content/renderer/media/webmediaplayer_ms.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13163 matching lines...) Expand 10 before | Expand all | Expand 10 after
13174 if (image) { 13174 if (image) {
13175 gfx::Size size = image->GetSize(); 13175 gfx::Size size = image->GetSize();
13176 source_width = size.width(); 13176 source_width = size.width();
13177 source_height = size.height(); 13177 source_height = size.height();
13178 if (source_width <= 0 || source_height <= 0) { 13178 if (source_width <= 0 || source_height <= 0) {
13179 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 13179 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13180 "invalid image size"); 13180 "invalid image size");
13181 return; 13181 return;
13182 } 13182 }
13183 } else { 13183 } else {
13184 // TODO(dshwang): make GetLevelSize, ValidForTexture and ValidForTarget
13185 // correct for GLImage also. crbug.com/549531
13184 if (!source_texture->GetLevelSize(source_texture->target(), 0, 13186 if (!source_texture->GetLevelSize(source_texture->target(), 0,
13185 &source_width, &source_height, nullptr)) { 13187 &source_width, &source_height, nullptr)) {
13186 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 13188 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13187 "source texture has no level 0"); 13189 "source texture has no level 0");
13188 return; 13190 return;
13189 } 13191 }
13190 13192
13193 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13194 width, height, 1)) {
13195 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13196 "source texture bad dimensions.");
13197 return;
13198 }
13199
13191 // Check that this type of texture is allowed. 13200 // Check that this type of texture is allowed.
13192 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, 13201 if (!texture_manager()->ValidForTarget(source_texture->target(), 0,
13193 source_width, source_height, 1)) { 13202 source_width, source_height, 1)) {
13194 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", 13203 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13195 "source texture bad dimensions"); 13204 "source texture bad dimensions");
13196 return; 13205 return;
13197 } 13206 }
13198 } 13207 }
13199 13208
13200 GLenum source_type = 0; 13209 GLenum source_type = 0;
13201 GLenum source_internal_format = 0; 13210 GLenum source_internal_format = 0;
13202 source_texture->GetLevelType(source_texture->target(), 0, &source_type, 13211 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
13203 &source_internal_format); 13212 &source_internal_format);
13204 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13205 width, height, 1)) {
13206 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13207 "source texture bad dimensions.");
13208 return;
13209 }
13210 13213
13211 GLenum dest_type = 0; 13214 GLenum dest_type = 0;
13212 GLenum dest_internal_format = 0; 13215 GLenum dest_internal_format = 0;
13213 bool dest_level_defined = dest_texture->GetLevelType( 13216 bool dest_level_defined = dest_texture->GetLevelType(
13214 dest_texture->target(), 0, &dest_type, &dest_internal_format); 13217 dest_texture->target(), 0, &dest_type, &dest_internal_format);
13215 if (!dest_level_defined) { 13218 if (!dest_level_defined) {
13216 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", 13219 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM",
13217 "destination texture is not defined"); 13220 "destination texture is not defined");
13218 return; 13221 return;
13219 } 13222 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
13503 return; 13506 return;
13504 } 13507 }
13505 } else { 13508 } else {
13506 if (!source_texture->GetLevelSize(source_texture->target(), 0, 13509 if (!source_texture->GetLevelSize(source_texture->target(), 0,
13507 &source_width, &source_height, nullptr)) { 13510 &source_width, &source_height, nullptr)) {
13508 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", 13511 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13509 "source texture has no level 0"); 13512 "source texture has no level 0");
13510 return; 13513 return;
13511 } 13514 }
13512 13515
13516 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13517 width, height, 1)) {
13518 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13519 "source texture bad dimensions.");
13520 return;
13521 }
13522
13513 // Check that this type of texture is allowed. 13523 // Check that this type of texture is allowed.
13514 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, 13524 if (!texture_manager()->ValidForTarget(source_texture->target(), 0,
13515 source_width, source_height, 1)) { 13525 source_width, source_height, 1)) {
13516 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", 13526 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13517 "source texture bad dimensions"); 13527 "source texture bad dimensions");
13518 return; 13528 return;
13519 } 13529 }
13520 } 13530 }
13521 13531
13522 GLenum source_type = 0; 13532 GLenum source_type = 0;
13523 GLenum source_internal_format = 0; 13533 GLenum source_internal_format = 0;
13524 source_texture->GetLevelType(source_texture->target(), 0, &source_type, 13534 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
13525 &source_internal_format); 13535 &source_internal_format);
13526 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0,
13527 width, height, 1)) {
13528 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13529 "source texture bad dimensions.");
13530 return;
13531 }
13532 13536
13533 GLenum dest_type = 0; 13537 GLenum dest_type = 0;
13534 GLenum dest_internal_format = 0; 13538 GLenum dest_internal_format = 0;
13535 bool dest_level_defined = dest_texture->GetLevelType( 13539 bool dest_level_defined = dest_texture->GetLevelType(
13536 dest_texture->target(), 0, &dest_type, &dest_internal_format); 13540 dest_texture->target(), 0, &dest_type, &dest_internal_format);
13537 if (!dest_level_defined) { 13541 if (!dest_level_defined) {
13538 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 13542 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
13539 "glCompressedCopySubTextureCHROMIUM", 13543 "glCompressedCopySubTextureCHROMIUM",
13540 "destination texture is not defined"); 13544 "destination texture is not defined");
13541 return; 13545 return;
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
15427 return error::kNoError; 15431 return error::kNoError;
15428 } 15432 }
15429 15433
15430 // Include the auto-generated part of this file. We split this because it means 15434 // Include the auto-generated part of this file. We split this because it means
15431 // we can easily edit the non-auto generated parts right here in this file 15435 // we can easily edit the non-auto generated parts right here in this file
15432 // instead of having to edit some template or the code generator. 15436 // instead of having to edit some template or the code generator.
15433 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15437 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15434 15438
15435 } // namespace gles2 15439 } // namespace gles2
15436 } // namespace gpu 15440 } // namespace gpu
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_ms.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698