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

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

Issue 1955723002: Improve detail of some texture-related errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try again. Created 4 years, 7 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 | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | 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/texture_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 } 2147 }
2148 if (!validators->pixel_type.IsValid(type)) { 2148 if (!validators->pixel_type.IsValid(type)) {
2149 ERRORSTATE_SET_GL_ERROR_INVALID_ENUM( 2149 ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(
2150 error_state, function_name, type, "type"); 2150 error_state, function_name, type, "type");
2151 return false; 2151 return false;
2152 } 2152 }
2153 // For TexSubImage calls, internal_format isn't part of the parameters. 2153 // For TexSubImage calls, internal_format isn't part of the parameters.
2154 // So the validation is not necessary for TexSubImage. 2154 // So the validation is not necessary for TexSubImage.
2155 if (tex_image_call && 2155 if (tex_image_call &&
2156 !validators->texture_internal_format.IsValid(internal_format)) { 2156 !validators->texture_internal_format.IsValid(internal_format)) {
2157 ERRORSTATE_SET_GL_ERROR( 2157 std::string msg = base::StringPrintf("invalid internal_format 0x%x",
2158 error_state, GL_INVALID_VALUE, function_name, 2158 internal_format);
2159 "invalid internal_format"); 2159 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_VALUE, function_name,
2160 msg.c_str());
2160 return false; 2161 return false;
2161 } 2162 }
2162 if (!g_format_type_validator.Get().IsValid(internal_format, format, type)) { 2163 if (!g_format_type_validator.Get().IsValid(internal_format, format, type)) {
2163 ERRORSTATE_SET_GL_ERROR( 2164 std::string msg = base::StringPrintf(
2164 error_state, GL_INVALID_OPERATION, function_name, 2165 "invalid internalformat/format/type combination 0x%x/0x%x/0x%x",
2165 "invalid internalformat/format/type combination"); 2166 internal_format, format, type);
2167 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_OPERATION, function_name,
2168 msg.c_str());
2166 return false; 2169 return false;
2167 } 2170 }
2168 if (!feature_info_->IsES3Enabled()) { 2171 if (!feature_info_->IsES3Enabled()) {
2169 uint32_t channels = GLES2Util::GetChannelsForFormat(format); 2172 uint32_t channels = GLES2Util::GetChannelsForFormat(format);
2170 if ((channels & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0 && level) { 2173 if ((channels & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0 && level) {
2171 ERRORSTATE_SET_GL_ERROR( 2174 ERRORSTATE_SET_GL_ERROR(
2172 error_state, GL_INVALID_OPERATION, function_name, 2175 error_state, GL_INVALID_OPERATION, function_name,
2173 (std::string("invalid format ") + GLES2Util::GetStringEnum(format) + 2176 (std::string("invalid format ") + GLES2Util::GetStringEnum(format) +
2174 " for level != 0").c_str()); 2177 " for level != 0").c_str());
2175 return false; 2178 return false;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 if (!local_texture_ref) { 2444 if (!local_texture_ref) {
2442 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_OPERATION, function_name, 2445 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_OPERATION, function_name,
2443 "unknown texture for target"); 2446 "unknown texture for target");
2444 return false; 2447 return false;
2445 } 2448 }
2446 Texture* texture = local_texture_ref->texture(); 2449 Texture* texture = local_texture_ref->texture();
2447 GLenum current_type = 0; 2450 GLenum current_type = 0;
2448 GLenum internal_format = 0; 2451 GLenum internal_format = 0;
2449 if (!texture->GetLevelType(args.target, args.level, &current_type, 2452 if (!texture->GetLevelType(args.target, args.level, &current_type,
2450 &internal_format)) { 2453 &internal_format)) {
2454 std::string msg = base::StringPrintf(
2455 "level %d does not exist", args.level);
2451 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_OPERATION, function_name, 2456 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_OPERATION, function_name,
2452 "level does not exist."); 2457 msg.c_str());
2453 return false; 2458 return false;
2454 } 2459 }
2455 if (!ValidateTextureParameters(error_state, function_name, false, args.format, 2460 if (!ValidateTextureParameters(error_state, function_name, false, args.format,
2456 args.type, internal_format, args.level)) { 2461 args.type, internal_format, args.level)) {
2457 return false; 2462 return false;
2458 } 2463 }
2459 if (args.type != current_type && !feature_info_->IsES3Enabled()) { 2464 if (args.type != current_type && !feature_info_->IsES3Enabled()) {
2460 // It isn't explicitly required in the ES2 spec, but some drivers generate 2465 // It isn't explicitly required in the ES2 spec, but some drivers generate
2461 // an error. It is better to be consistent across drivers. 2466 // an error. It is better to be consistent across drivers.
2462 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_OPERATION, function_name, 2467 ERRORSTATE_SET_GL_ERROR(error_state, GL_INVALID_OPERATION, function_name,
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 uint32_t TextureManager::GetServiceIdGeneration() const { 3197 uint32_t TextureManager::GetServiceIdGeneration() const {
3193 return current_service_id_generation_; 3198 return current_service_id_generation_;
3194 } 3199 }
3195 3200
3196 void TextureManager::IncrementServiceIdGeneration() { 3201 void TextureManager::IncrementServiceIdGeneration() {
3197 current_service_id_generation_++; 3202 current_service_id_generation_++;
3198 } 3203 }
3199 3204
3200 } // namespace gles2 3205 } // namespace gles2
3201 } // namespace gpu 3206 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698