diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-02 23:10:32 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-02 23:10:32 +0000 |
commit | 876f6fee7025b66f758b5fd50c2c89b5df748e19 (patch) | |
tree | b063ce5ecc756fa3be29a330da4cc8f7008356fc /app | |
parent | edd2f227a16ca579fb34a8da3da0b8fad67b0a1b (diff) | |
download | chromium_src-876f6fee7025b66f758b5fd50c2c89b5df748e19.zip chromium_src-876f6fee7025b66f758b5fd50c2c89b5df748e19.tar.gz chromium_src-876f6fee7025b66f758b5fd50c2c89b5df748e19.tar.bz2 |
GPU command decoder uses depth24_stencil8_oes extension if available.
This is now the only depth / stencil format supported by ANGLE. Other GLES2 implementations will only use it if the extension is supported.
Also changed all usage of GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2 to a runtime check since we no longer know at compile time whether the backend will be GL ot GLES2.
TEST=try, GPU unit tests locally, WebGL locally, Pepper 3D locally
BUG=none
Review URL: http://codereview.chromium.org/3046035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/gfx/gl/gl_context.cc | 16 | ||||
-rw-r--r-- | app/gfx/gl/gl_context.h | 4 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_stub.h | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/app/gfx/gl/gl_context.cc b/app/gfx/gl/gl_context.cc index d9b81f3..1d79072 100644 --- a/app/gfx/gl/gl_context.cc +++ b/app/gfx/gl/gl_context.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> + #include "app/gfx/gl/gl_context.h" #include "app/gfx/gl/gl_bindings.h" #include "app/gfx/gl/gl_implementation.h" @@ -9,6 +11,19 @@ namespace gfx { +bool GLContext::HasExtension(const char* name) { + DCHECK(IsCurrent()); + + std::string extensions(reinterpret_cast<const char*>( + glGetString(GL_EXTENSIONS))); + extensions += " "; + + std::string delimited_name(name); + delimited_name += " "; + + return extensions.find(delimited_name) != std::string::npos; +} + bool GLContext::InitializeCommon() { if (!MakeCurrent()) return false; @@ -19,4 +34,5 @@ bool GLContext::InitializeCommon() { return true; } + } // namespace gfx diff --git a/app/gfx/gl/gl_context.h b/app/gfx/gl/gl_context.h index e14e7460..656a0d3 100644 --- a/app/gfx/gl/gl_context.h +++ b/app/gfx/gl/gl_context.h @@ -41,6 +41,10 @@ class GLContext { // Get the underlying platform specific GL context "handle". virtual void* GetHandle() = 0; + // Returns whether the current context supports the named extension. The + // context must be current. + virtual bool HasExtension(const char* name); + static bool InitializeOneOff(); #if !defined(OS_MACOSX) diff --git a/app/gfx/gl/gl_context_stub.h b/app/gfx/gl/gl_context_stub.h index 222bf7b..b5189ae 100644 --- a/app/gfx/gl/gl_context_stub.h +++ b/app/gfx/gl/gl_context_stub.h @@ -23,6 +23,7 @@ class StubGLContext : public gfx::GLContext { virtual void SwapBuffers() {} virtual gfx::Size GetSize() { return size_; } virtual void* GetHandle() { return NULL; } + virtual bool HasExtension(const char* name) { return false; } void SetSize(const gfx::Size& size) { size_ = size; } |