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

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

Issue 1376633002: Disallow gl[Compressed]Tex[Sub]Image2D for GL_TEXTURE_RECTANGLE_ARB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests Created 5 years, 2 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.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 10072 matching lines...) Expand 10 before | Expand all | Expand 10 after
10083 GLsizei width, 10083 GLsizei width,
10084 GLsizei height, 10084 GLsizei height,
10085 GLint border, 10085 GLint border,
10086 GLsizei image_size, 10086 GLsizei image_size,
10087 const void* data) { 10087 const void* data) {
10088 if (!validators_->texture_target.IsValid(target)) { 10088 if (!validators_->texture_target.IsValid(target)) {
10089 LOCAL_SET_GL_ERROR_INVALID_ENUM( 10089 LOCAL_SET_GL_ERROR_INVALID_ENUM(
10090 "glCompressedTexImage2D", target, "target"); 10090 "glCompressedTexImage2D", target, "target");
10091 return error::kNoError; 10091 return error::kNoError;
10092 } 10092 }
10093 // TODO(ccameron): Add a separate texture from |texture_target| for
10094 // [Compressed]Tex[Sub]Image2D and related functions.
10095 // http://crbug.com/536854
10096 if (target == GL_TEXTURE_RECTANGLE_ARB) {
10097 LOCAL_SET_GL_ERROR_INVALID_ENUM(
10098 "glCompressedTexImage2D", target, "target");
10099 return error::kNoError;
10100 }
10093 if (!validators_->compressed_texture_format.IsValid( 10101 if (!validators_->compressed_texture_format.IsValid(
10094 internal_format)) { 10102 internal_format)) {
10095 LOCAL_SET_GL_ERROR_INVALID_ENUM( 10103 LOCAL_SET_GL_ERROR_INVALID_ENUM(
10096 "glCompressedTexImage2D", internal_format, "internal_format"); 10104 "glCompressedTexImage2D", internal_format, "internal_format");
10097 return error::kNoError; 10105 return error::kNoError;
10098 } 10106 }
10099 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || 10107 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) ||
10100 border != 0) { 10108 border != 0) {
10101 LOCAL_SET_GL_ERROR( 10109 LOCAL_SET_GL_ERROR(
10102 GL_INVALID_VALUE, 10110 GL_INVALID_VALUE,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
10229 GLsizei imageSize = data_size; 10237 GLsizei imageSize = data_size;
10230 const void* data = bucket->GetData(0, data_size); 10238 const void* data = bucket->GetData(0, data_size);
10231 if (!data) { 10239 if (!data) {
10232 return error::kInvalidArguments; 10240 return error::kInvalidArguments;
10233 } 10241 }
10234 if (!validators_->texture_target.IsValid(target)) { 10242 if (!validators_->texture_target.IsValid(target)) {
10235 LOCAL_SET_GL_ERROR( 10243 LOCAL_SET_GL_ERROR(
10236 GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target"); 10244 GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target");
10237 return error::kNoError; 10245 return error::kNoError;
10238 } 10246 }
10247 // TODO(ccameron): Add a separate texture from |texture_target| for
10248 // [Compressed]Tex[Sub]Image2D and related functions.
10249 // http://crbug.com/536854
10250 if (target == GL_TEXTURE_RECTANGLE_ARB) {
10251 LOCAL_SET_GL_ERROR(
10252 GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target");
10253 return error::kNoError;
10254 }
10239 if (!validators_->compressed_texture_format.IsValid(format)) { 10255 if (!validators_->compressed_texture_format.IsValid(format)) {
10240 LOCAL_SET_GL_ERROR_INVALID_ENUM( 10256 LOCAL_SET_GL_ERROR_INVALID_ENUM(
10241 "glCompressedTexSubImage2D", format, "format"); 10257 "glCompressedTexSubImage2D", format, "format");
10242 return error::kNoError; 10258 return error::kNoError;
10243 } 10259 }
10244 if (width < 0) { 10260 if (width < 0) {
10245 LOCAL_SET_GL_ERROR( 10261 LOCAL_SET_GL_ERROR(
10246 GL_INVALID_VALUE, "glCompressedTexSubImage2D", "width < 0"); 10262 GL_INVALID_VALUE, "glCompressedTexSubImage2D", "width < 0");
10247 return error::kNoError; 10263 return error::kNoError;
10248 } 10264 }
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
10982 GLsizei width, 10998 GLsizei width,
10983 GLsizei height, 10999 GLsizei height,
10984 GLenum format, 11000 GLenum format,
10985 GLenum type, 11001 GLenum type,
10986 const void * data) { 11002 const void * data) {
10987 (*error) = error::kNoError; 11003 (*error) = error::kNoError;
10988 if (!validators_->texture_target.IsValid(target)) { 11004 if (!validators_->texture_target.IsValid(target)) {
10989 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); 11005 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target");
10990 return false; 11006 return false;
10991 } 11007 }
11008 // TODO(ccameron): Add a separate texture from |texture_target| for
11009 // [Compressed]Tex[Sub]Image2D and related functions.
11010 // http://crbug.com/536854
11011 if (target == GL_TEXTURE_RECTANGLE_ARB) {
11012 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target");
11013 return false;
11014 }
10992 if (width < 0) { 11015 if (width < 0) {
10993 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "width < 0"); 11016 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "width < 0");
10994 return false; 11017 return false;
10995 } 11018 }
10996 if (height < 0) { 11019 if (height < 0) {
10997 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "height < 0"); 11020 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "height < 0");
10998 return false; 11021 return false;
10999 } 11022 }
11000 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( 11023 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
11001 &state_, target); 11024 &state_, target);
(...skipping 4041 matching lines...) Expand 10 before | Expand all | Expand 10 after
15043 return error::kNoError; 15066 return error::kNoError;
15044 } 15067 }
15045 15068
15046 // Include the auto-generated part of this file. We split this because it means 15069 // Include the auto-generated part of this file. We split this because it means
15047 // we can easily edit the non-auto generated parts right here in this file 15070 // we can easily edit the non-auto generated parts right here in this file
15048 // instead of having to edit some template or the code generator. 15071 // instead of having to edit some template or the code generator.
15049 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15072 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15050 15073
15051 } // namespace gles2 15074 } // namespace gles2
15052 } // namespace gpu 15075 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698