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

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

Issue 1472483002: Check texture ids are valid in CopyTextureCHROMIUM apis. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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 | « no previous file | gpu/command_buffer/tests/gl_compressed_copy_texture_CHROMIUM_unittest.cc » ('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 12821 matching lines...) Expand 10 before | Expand all | Expand 10 after
12832 GLuint dest_id, 12832 GLuint dest_id,
12833 GLenum internal_format, 12833 GLenum internal_format,
12834 GLenum dest_type, 12834 GLenum dest_type,
12835 GLboolean unpack_flip_y, 12835 GLboolean unpack_flip_y,
12836 GLboolean unpack_premultiply_alpha, 12836 GLboolean unpack_premultiply_alpha,
12837 GLboolean unpack_unmultiply_alpha) { 12837 GLboolean unpack_unmultiply_alpha) {
12838 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); 12838 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM");
12839 12839
12840 TextureRef* source_texture_ref = GetTexture(source_id); 12840 TextureRef* source_texture_ref = GetTexture(source_id);
12841 TextureRef* dest_texture_ref = GetTexture(dest_id); 12841 TextureRef* dest_texture_ref = GetTexture(dest_id);
12842
12843 if (!source_texture_ref || !dest_texture_ref) {
12844 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
12845 "unknown texture ids");
12846 return;
12847 }
12848
12842 Texture* source_texture = source_texture_ref->texture(); 12849 Texture* source_texture = source_texture_ref->texture();
12843 Texture* dest_texture = dest_texture_ref->texture(); 12850 Texture* dest_texture = dest_texture_ref->texture();
12844 int source_width = 0; 12851 int source_width = 0;
12845 int source_height = 0; 12852 int source_height = 0;
12846 gl::GLImage* image = 12853 gl::GLImage* image =
12847 source_texture->GetLevelImage(source_texture->target(), 0); 12854 source_texture->GetLevelImage(source_texture->target(), 0);
12848 if (image) { 12855 if (image) {
12849 gfx::Size size = image->GetSize(); 12856 gfx::Size size = image->GetSize();
12850 source_width = size.width(); 12857 source_width = size.width();
12851 source_height = size.height(); 12858 source_height = size.height();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
12990 GLint y, 12997 GLint y,
12991 GLsizei width, 12998 GLsizei width,
12992 GLsizei height, 12999 GLsizei height,
12993 GLboolean unpack_flip_y, 13000 GLboolean unpack_flip_y,
12994 GLboolean unpack_premultiply_alpha, 13001 GLboolean unpack_premultiply_alpha,
12995 GLboolean unpack_unmultiply_alpha) { 13002 GLboolean unpack_unmultiply_alpha) {
12996 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); 13003 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM");
12997 13004
12998 TextureRef* source_texture_ref = GetTexture(source_id); 13005 TextureRef* source_texture_ref = GetTexture(source_id);
12999 TextureRef* dest_texture_ref = GetTexture(dest_id); 13006 TextureRef* dest_texture_ref = GetTexture(dest_id);
13007
13008 if (!source_texture_ref || !dest_texture_ref) {
13009 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM",
13010 "unknown texture ids");
13011 return;
13012 }
13013
13000 Texture* source_texture = source_texture_ref->texture(); 13014 Texture* source_texture = source_texture_ref->texture();
13001 Texture* dest_texture = dest_texture_ref->texture(); 13015 Texture* dest_texture = dest_texture_ref->texture();
13002 int source_width = 0; 13016 int source_width = 0;
13003 int source_height = 0; 13017 int source_height = 0;
13004 gl::GLImage* image = 13018 gl::GLImage* image =
13005 source_texture->GetLevelImage(source_texture->target(), 0); 13019 source_texture->GetLevelImage(source_texture->target(), 0);
13006 if (image) { 13020 if (image) {
13007 gfx::Size size = image->GetSize(); 13021 gfx::Size size = image->GetSize();
13008 source_width = size.width(); 13022 source_width = size.width();
13009 source_height = size.height(); 13023 source_height = size.height();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
13136 unpack_unmultiply_alpha == GL_TRUE); 13150 unpack_unmultiply_alpha == GL_TRUE);
13137 } 13151 }
13138 13152
13139 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, 13153 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target,
13140 GLuint source_id, 13154 GLuint source_id,
13141 GLuint dest_id) { 13155 GLuint dest_id) {
13142 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); 13156 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM");
13143 13157
13144 TextureRef* source_texture_ref = GetTexture(source_id); 13158 TextureRef* source_texture_ref = GetTexture(source_id);
13145 TextureRef* dest_texture_ref = GetTexture(dest_id); 13159 TextureRef* dest_texture_ref = GetTexture(dest_id);
13160
13161 if (!source_texture_ref || !dest_texture_ref) {
13162 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopyTextureCHROMIUM",
13163 "unknown texture ids");
13164 return;
13165 }
13166
13146 Texture* source_texture = source_texture_ref->texture(); 13167 Texture* source_texture = source_texture_ref->texture();
13147 Texture* dest_texture = dest_texture_ref->texture(); 13168 Texture* dest_texture = dest_texture_ref->texture();
13148 int source_width = 0; 13169 int source_width = 0;
13149 int source_height = 0; 13170 int source_height = 0;
13150 gl::GLImage* image = 13171 gl::GLImage* image =
13151 source_texture->GetLevelImage(source_texture->target(), 0); 13172 source_texture->GetLevelImage(source_texture->target(), 0);
13152 if (image) { 13173 if (image) {
13153 gfx::Size size = image->GetSize(); 13174 gfx::Size size = image->GetSize();
13154 source_width = size.width(); 13175 source_width = size.width();
13155 source_height = size.height(); 13176 source_height = size.height();
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
13312 GLint xoffset, 13333 GLint xoffset,
13313 GLint yoffset, 13334 GLint yoffset,
13314 GLint x, 13335 GLint x,
13315 GLint y, 13336 GLint y,
13316 GLsizei width, 13337 GLsizei width,
13317 GLsizei height) { 13338 GLsizei height) {
13318 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM"); 13339 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM");
13319 13340
13320 TextureRef* source_texture_ref = GetTexture(source_id); 13341 TextureRef* source_texture_ref = GetTexture(source_id);
13321 TextureRef* dest_texture_ref = GetTexture(dest_id); 13342 TextureRef* dest_texture_ref = GetTexture(dest_id);
13343
13344 if (!source_texture_ref || !dest_texture_ref) {
13345 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
13346 "unknown texture ids");
13347 return;
13348 }
13349
13322 Texture* source_texture = source_texture_ref->texture(); 13350 Texture* source_texture = source_texture_ref->texture();
13323 Texture* dest_texture = dest_texture_ref->texture(); 13351 Texture* dest_texture = dest_texture_ref->texture();
13324 int source_width = 0; 13352 int source_width = 0;
13325 int source_height = 0; 13353 int source_height = 0;
13326 gl::GLImage* image = 13354 gl::GLImage* image =
13327 source_texture->GetLevelImage(source_texture->target(), 0); 13355 source_texture->GetLevelImage(source_texture->target(), 0);
13328 if (image) { 13356 if (image) {
13329 gfx::Size size = image->GetSize(); 13357 gfx::Size size = image->GetSize();
13330 source_width = size.width(); 13358 source_width = size.width();
13331 source_height = size.height(); 13359 source_height = size.height();
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after
15416 return error::kNoError; 15444 return error::kNoError;
15417 } 15445 }
15418 15446
15419 // 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
15420 // 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
15421 // instead of having to edit some template or the code generator. 15449 // instead of having to edit some template or the code generator.
15422 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15450 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15423 15451
15424 } // namespace gles2 15452 } // namespace gles2
15425 } // namespace gpu 15453 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_compressed_copy_texture_CHROMIUM_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698