summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-06 18:07:24 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-06 18:07:24 +0000
commitc2f8c84089f32aac6377c95da14d52153a165b39 (patch)
tree91e39d58e5b54b21d2f6070654a0e89208cd5236 /gpu/command_buffer/client
parent5ac981e18bcad738dbe3e34a59c5814a9f00ea08 (diff)
downloadchromium_src-c2f8c84089f32aac6377c95da14d52153a165b39.zip
chromium_src-c2f8c84089f32aac6377c95da14d52153a165b39.tar.gz
chromium_src-c2f8c84089f32aac6377c95da14d52153a165b39.tar.bz2
Exposed support for dynamically enabling extensions in command buffer
implementation via new glGetRequestableExtensionsCHROMIUM and glRequestExtensionCHROMIUM entry points. These entry points are needed in order to allow WebGL to both query the available extensions and enable them individually. Added these entry points to WebGraphicsContext3DCommandBufferImpl. A subsequent WebKit checkin under https://bugs.webkit.org/show_bug.cgi?id=40316 will utilize them and implement the OES_texture_float extension for WebGL. BUG=none TEST=none (ran with new oes-texture-float.html WebGL conformance test) Review URL: http://codereview.chromium.org/5626008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68352 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client')
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h11
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h12
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc31
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h4
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h4
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_