diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 22:07:29 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 22:07:29 +0000 |
commit | 262d7aa2659e6f90d8c63406c7ff88751720746b (patch) | |
tree | bbef310dc009de5da31d6a7736caffe7801c053c | |
parent | d083585002893abaa6172c361aa04306a0e4d396 (diff) | |
download | chromium_src-262d7aa2659e6f90d8c63406c7ff88751720746b.zip chromium_src-262d7aa2659e6f90d8c63406c7ff88751720746b.tar.gz chromium_src-262d7aa2659e6f90d8c63406c7ff88751720746b.tar.bz2 |
Fix zero length string bug and NPOT bug
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/5568004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68224 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | gpu/command_buffer/service/common_decoder.cc | 11 | ||||
-rw-r--r-- | gpu/command_buffer/service/common_decoder.h | 2 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 23 | ||||
-rw-r--r-- | gpu/command_buffer/service/texture_manager.cc | 3 |
4 files changed, 24 insertions, 15 deletions
diff --git a/gpu/command_buffer/service/common_decoder.cc b/gpu/command_buffer/service/common_decoder.cc index ce45422..a116d04 100644 --- a/gpu/command_buffer/service/common_decoder.cc +++ b/gpu/command_buffer/service/common_decoder.cc @@ -35,11 +35,16 @@ bool CommonDecoder::Bucket::SetData( return false; } -void CommonDecoder::Bucket::SetFromString(const std::string& str) { +void CommonDecoder::Bucket::SetFromString(const char* str) { // Strings are passed NULL terminated to distinguish between empty string // and no string. - SetSize(str.size() + 1); - SetData(str.c_str(), 0, str.size() + 1); + if (!str) { + SetSize(0); + } else { + size_t size = strlen(str) + 1; + SetSize(size); + SetData(str, 0, size); + } } bool CommonDecoder::Bucket::GetAsString(std::string* str) { diff --git a/gpu/command_buffer/service/common_decoder.h b/gpu/command_buffer/service/common_decoder.h index 7abc016..ea4e520 100644 --- a/gpu/command_buffer/service/common_decoder.h +++ b/gpu/command_buffer/service/common_decoder.h @@ -73,7 +73,7 @@ class CommonDecoder : public AsyncAPIInterface { // Sets the bucket data from a string. Strings are passed NULL terminated to // distinguish between empty string and no string. - void SetFromString(const std::string& str); + void SetFromString(const char* str); // Gets the bucket data as a string. Strings are passed NULL terminated to // distrinquish between empty string and no string. Returns False if there diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index d120744..6c468ca 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2373,11 +2373,12 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { // parent is later destroyed. GLuint service_id = offscreen_saved_color_texture_->id(); GLuint client_id; - CHECK(parent_->texture_manager()->GetClientId(service_id, &client_id)); + TextureManager* parent_texture_manager = parent_->texture_manager(); + CHECK(parent_texture_manager->GetClientId(service_id, &client_id)); TextureManager::TextureInfo* info = parent_->GetTextureInfo(client_id); DCHECK(info); - texture_manager()->SetLevelInfo( + parent_texture_manager->SetLevelInfo( feature_info_, info, GL_TEXTURE_2D, @@ -2389,22 +2390,22 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { 0, // border GL_RGBA, GL_UNSIGNED_BYTE); - texture_manager()->SetParameter( + parent_texture_manager->SetParameter( feature_info_, info, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - texture_manager()->SetParameter( + parent_texture_manager->SetParameter( feature_info_, info, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - texture_manager()->SetParameter( + parent_texture_manager->SetParameter( feature_info_, info, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - texture_manager()->SetParameter( + parent_texture_manager->SetParameter( feature_info_, info, GL_TEXTURE_WRAP_T, @@ -4325,7 +4326,7 @@ error::Error GLES2DecoderImpl::HandleGetShaderSource( bucket->SetSize(0); return error::kNoError; } - bucket->SetFromString(info->source()); + bucket->SetFromString(info->source().c_str()); return error::kNoError; } @@ -4339,7 +4340,7 @@ error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( if (!info) { return error::kNoError; } - bucket->SetFromString(info->log_info()); + bucket->SetFromString(info->log_info().c_str()); return error::kNoError; } @@ -4354,7 +4355,7 @@ error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( bucket->SetSize(0); return error::kNoError; } - bucket->SetFromString(info->log_info()); + bucket->SetFromString(info->log_info().c_str()); return error::kNoError; } @@ -5751,7 +5752,7 @@ error::Error GLES2DecoderImpl::HandleGetActiveUniform( result->size = uniform_info->size; result->type = uniform_info->type; Bucket* bucket = CreateBucket(name_bucket_id); - bucket->SetFromString(uniform_info->name); + bucket->SetFromString(uniform_info->name.c_str()); return error::kNoError; } @@ -5785,7 +5786,7 @@ error::Error GLES2DecoderImpl::HandleGetActiveAttrib( result->size = attrib_info->size; result->type = attrib_info->type; Bucket* bucket = CreateBucket(name_bucket_id); - bucket->SetFromString(attrib_info->name); + bucket->SetFromString(attrib_info->name.c_str()); return error::kNoError; } diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc index 250da70..025669e 100644 --- a/gpu/command_buffer/service/texture_manager.cc +++ b/gpu/command_buffer/service/texture_manager.cc @@ -299,6 +299,9 @@ void TextureManager::TextureInfo::Update(const FeatureInfo* feature_info) { max_level_set_ >= 0; cube_complete_ = (level_infos_.size() == 6) && (first_face.width == first_face.height); + if (first_face.width == 0 || first_face.height == 0) { + texture_complete_ = false; + } if (first_face.type == GL_FLOAT && !feature_info->feature_flags().enable_texture_float_linear && (min_filter_ != GL_NEAREST_MIPMAP_NEAREST || |