diff options
Diffstat (limited to 'gpu/command_buffer/client')
5 files changed, 62 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index ab54997..01cb485 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -844,6 +844,17 @@ void GLES2ResizeCHROMIUM(GLuint width, GLuint height) { GPU_CLIENT_LOG("ResizeCHROMIUM" << "(" << width << ", " << height << ")"); gles2::GetGLContext()->ResizeCHROMIUM(width, height); } +const GLchar* GLES2GetRequestableExtensionsCHROMIUM() { + GPU_CLIENT_LOG("GetRequestableExtensionsCHROMIUM" << "(" << ")"); + const GLchar* result = + gles2::GetGLContext()->GetRequestableExtensionsCHROMIUM(); + GPU_CLIENT_LOG("return:" << result) + return result; +} +void GLES2RequestExtensionCHROMIUM(const char* extension) { + GPU_CLIENT_LOG("RequestExtensionCHROMIUM" << "(" << extension << ")"); + gles2::GetGLContext()->RequestExtensionCHROMIUM(extension); +} #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_C_LIB_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 1f2b87b..e69b7ee 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -1203,5 +1203,17 @@ c.Init(width, height); } + void GetRequestableExtensionsCHROMIUM(uint32 bucket_id) { + gles2::GetRequestableExtensionsCHROMIUM& c = + GetCmdSpace<gles2::GetRequestableExtensionsCHROMIUM>(); + c.Init(bucket_id); + } + + void RequestExtensionCHROMIUM(uint32 bucket_id) { + gles2::RequestExtensionCHROMIUM& c = + GetCmdSpace<gles2::RequestExtensionCHROMIUM>(); + c.Init(bucket_id); + } + #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_ diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 0debcd0..64bcbe2 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -1581,5 +1581,36 @@ void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { mapped_textures_.erase(it); } +const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() { + const char* result = NULL; + // Clear the bucket so if the command fails nothing will be in it. + helper_->SetBucketSize(kResultBucketId, 0); + helper_->GetRequestableExtensionsCHROMIUM(kResultBucketId); + std::string str; + if (GetBucketAsString(kResultBucketId, &str)) { + // The set of requestable extensions shrinks as we enable + // them. Because we don't know when the client will stop referring + // to a previous one it queries (see GetString) we need to cache + // the unique results. + std::set<std::string>::const_iterator sit = + requestable_extensions_set_.find(str); + if (sit != requestable_extensions_set_.end()) { + result = sit->c_str(); + } else { + std::pair<std::set<std::string>::const_iterator, bool> insert_result = + requestable_extensions_set_.insert(str); + GPU_DCHECK(insert_result.second); + result = insert_result.first->c_str(); + } + } + return reinterpret_cast<const GLchar*>(result); +} + +void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { + SetBucketAsCString(kResultBucketId, extension); + helper_->RequestExtensionCHROMIUM(kResultBucketId); + helper_->SetBucketSize(kResultBucketId, 0); +} + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 0b0e242..d56e32e 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -379,6 +379,10 @@ class GLES2Implementation { typedef std::map<uint32, std::set<std::string> > GLStringMap; GLStringMap gl_strings_; + // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't + // have an enum for this so handle it separately. + std::set<std::string> requestable_extensions_set_; + typedef std::map<const void*, MappedBuffer> MappedBufferMap; MappedBufferMap mapped_buffers_; diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 6bf924e..bb22143 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -888,5 +888,9 @@ void ResizeCHROMIUM(GLuint width, GLuint height) { helper_->ResizeCHROMIUM(width, height); } +const GLchar* GetRequestableExtensionsCHROMIUM(); + +void RequestExtensionCHROMIUM(const char* extension); + #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_ |