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

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

Issue 14828011: Mark zero dimension textures as unrenderable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_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 <list> 10 #include <list>
(...skipping 5620 matching lines...) Expand 10 before | Expand all | Expand 10 after
5631 feature_info_); 5631 feature_info_);
5632 } 5632 }
5633 } 5633 }
5634 5634
5635 bool GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures() { 5635 bool GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures() {
5636 DCHECK(state_.current_program); 5636 DCHECK(state_.current_program);
5637 // Only check if there are some unrenderable textures. 5637 // Only check if there are some unrenderable textures.
5638 if (!texture_manager()->HaveUnrenderableTextures()) { 5638 if (!texture_manager()->HaveUnrenderableTextures()) {
5639 return false; 5639 return false;
5640 } 5640 }
5641 LOCAL_PERFORMANCE_WARNING("Some textures are unrenderable.");
5641 bool textures_set = false; 5642 bool textures_set = false;
5642 const Program::SamplerIndices& sampler_indices = 5643 const Program::SamplerIndices& sampler_indices =
5643 state_.current_program->sampler_indices(); 5644 state_.current_program->sampler_indices();
5644 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { 5645 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) {
5645 const Program::UniformInfo* uniform_info = 5646 const Program::UniformInfo* uniform_info =
5646 state_.current_program->GetUniformInfo(sampler_indices[ii]); 5647 state_.current_program->GetUniformInfo(sampler_indices[ii]);
5647 DCHECK(uniform_info); 5648 DCHECK(uniform_info);
5648 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { 5649 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) {
5649 GLuint texture_unit_index = uniform_info->texture_units[jj]; 5650 GLuint texture_unit_index = uniform_info->texture_units[jj];
5650 if (texture_unit_index < state_.texture_units.size()) { 5651 if (texture_unit_index < state_.texture_units.size()) {
(...skipping 3710 matching lines...) Expand 10 before | Expand all | Expand 10 after
9361 return error::kNoError; 9362 return error::kNoError;
9362 } 9363 }
9363 9364
9364 if (!stream_texture_manager_) 9365 if (!stream_texture_manager_)
9365 return error::kInvalidArguments; 9366 return error::kInvalidArguments;
9366 9367
9367 GLuint object_id = stream_texture_manager_->CreateStreamTexture( 9368 GLuint object_id = stream_texture_manager_->CreateStreamTexture(
9368 texture->service_id(), client_id); 9369 texture->service_id(), client_id);
9369 9370
9370 if (object_id) { 9371 if (object_id) {
9371 texture->SetStreamTexture(true); 9372 texture_manager()->SetStreamTexture(texture, true);
9372 } else { 9373 } else {
9373 LOCAL_SET_GL_ERROR( 9374 LOCAL_SET_GL_ERROR(
9374 GL_OUT_OF_MEMORY, 9375 GL_OUT_OF_MEMORY,
9375 "glCreateStreamTextureCHROMIUM", "failed to create platform texture."); 9376 "glCreateStreamTextureCHROMIUM", "failed to create platform texture.");
9376 } 9377 }
9377 9378
9378 *result = object_id; 9379 *result = object_id;
9379 return error::kNoError; 9380 return error::kNoError;
9380 } 9381 }
9381 9382
9382 error::Error GLES2DecoderImpl::HandleDestroyStreamTextureCHROMIUM( 9383 error::Error GLES2DecoderImpl::HandleDestroyStreamTextureCHROMIUM(
9383 uint32 immediate_data_size, 9384 uint32 immediate_data_size,
9384 const cmds::DestroyStreamTextureCHROMIUM& c) { 9385 const cmds::DestroyStreamTextureCHROMIUM& c) {
9385 GLuint client_id = c.texture; 9386 GLuint client_id = c.texture;
9386 Texture* texture = texture_manager()->GetTexture(client_id); 9387 Texture* texture = texture_manager()->GetTexture(client_id);
9387 if (texture && texture->IsStreamTexture()) { 9388 if (texture && texture->IsStreamTexture()) {
9388 if (!stream_texture_manager_) 9389 if (!stream_texture_manager_)
9389 return error::kInvalidArguments; 9390 return error::kInvalidArguments;
9390 9391
9391 stream_texture_manager_->DestroyStreamTexture(texture->service_id()); 9392 stream_texture_manager_->DestroyStreamTexture(texture->service_id());
9392 texture->SetStreamTexture(false); 9393 texture_manager()->SetStreamTexture(texture, false);
9393 } else { 9394 } else {
9394 LOCAL_SET_GL_ERROR( 9395 LOCAL_SET_GL_ERROR(
9395 GL_INVALID_VALUE, 9396 GL_INVALID_VALUE,
9396 "glDestroyStreamTextureCHROMIUM", "bad texture id."); 9397 "glDestroyStreamTextureCHROMIUM", "bad texture id.");
9397 } 9398 }
9398 9399
9399 return error::kNoError; 9400 return error::kNoError;
9400 } 9401 }
9401 9402
9402 #if defined(OS_MACOSX) 9403 #if defined(OS_MACOSX)
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
10340 return error::kNoError; 10341 return error::kNoError;
10341 } 10342 }
10342 10343
10343 // Include the auto-generated part of this file. We split this because it means 10344 // Include the auto-generated part of this file. We split this because it means
10344 // we can easily edit the non-auto generated parts right here in this file 10345 // we can easily edit the non-auto generated parts right here in this file
10345 // instead of having to edit some template or the code generator. 10346 // instead of having to edit some template or the code generator.
10346 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10347 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10347 10348
10348 } // namespace gles2 10349 } // namespace gles2
10349 } // namespace gpu 10350 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698