summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorsenorblanco@google.com <senorblanco@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 21:16:29 +0000
committersenorblanco@google.com <senorblanco@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 21:16:29 +0000
commitc60939a4fc1a23caa5777937912e69decbf5266f (patch)
tree03c1e3fa4d4dbceda76193e0716c2d8a3666e903 /chrome/renderer
parent0b38a1ea9eb68a5b695b22b288e134557f433db1 (diff)
downloadchromium_src-c60939a4fc1a23caa5777937912e69decbf5266f.zip
chromium_src-c60939a4fc1a23caa5777937912e69decbf5266f.tar.gz
chromium_src-c60939a4fc1a23caa5777937912e69decbf5266f.tar.bz2
Add support for BGRA pixel format to the command buffer implementation of WebGraphicsContext3D. This will not be called until the WebKit-side change lands.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3170005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc21
-rw-r--r--chrome/renderer/webgraphicscontext3d_command_buffer_impl.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
index 6d2ada2..d8ac59f 100644
--- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
+++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
@@ -10,6 +10,7 @@
#include <algorithm>
+#include "base/string_tokenizer.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "chrome/common/chrome_switches.h"
@@ -207,6 +208,26 @@ void WebGraphicsContext3DCommandBufferImpl::synthesizeGLError(
}
}
+static bool supports_extension(const char *ext_name) {
+ const char* extensions = (const char *) glGetString(GL_EXTENSIONS);
+ CStringTokenizer t(extensions, extensions + strlen(extensions), " ");
+ while (t.GetNext()) {
+ if (t.token() == ext_name) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool WebGraphicsContext3DCommandBufferImpl::supportsBGRA() {
+ static bool is_supported =
+ supports_extension("GL_EXT_texture_format_BGRA8888");
+ // TODO(senorblanco): Also check for GL_EXT_read_format_bgra. It's
+ // actually supported by the command buffer, it's just not reported in
+ // the extensions string.
+ return is_supported;
+}
+
// Helper macros to reduce the amount of code.
#define DELEGATE_TO_GL(name, glname) \
diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
index c8c99ed..99e6448 100644
--- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
+++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
@@ -336,6 +336,7 @@ class WebGraphicsContext3DCommandBufferImpl
virtual void deleteTexture(unsigned);
virtual void synthesizeGLError(unsigned long error);
+ virtual bool supportsBGRA();
private:
// The GGL context we use for OpenGL rendering.