diff options
author | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 21:02:45 +0000 |
---|---|---|
committer | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 21:02:45 +0000 |
commit | 6f5fac9d1b4c8bfc924ed555f46c3e67a8a8f962 (patch) | |
tree | 867db68f1f7fa9c5e0f41910240e406286754e40 /ui/gl | |
parent | c9b218291fd46c0ceb4b1a3100b182ad26cbb1b8 (diff) | |
download | chromium_src-6f5fac9d1b4c8bfc924ed555f46c3e67a8a8f962.zip chromium_src-6f5fac9d1b4c8bfc924ed555f46c3e67a8a8f962.tar.gz chromium_src-6f5fac9d1b4c8bfc924ed555f46c3e67a8a8f962.tar.bz2 |
Aura: Fix partial swaps in the UI
Extensions were being cached per context group. Recently we started creating an offscreen context before any onscreen contexts, which meant that our onscreen specific extensions were never being reported. This CL keeps the cacheing for the context specific extensions and adds in the surface specific extensions.
TEST=use chrome://tracing to verify that HandlePostSubBuffer is being called in the GPU process on a CrOS device
BUG=none
Review URL: https://chromiumcodereview.appspot.com/10673002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144271 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl')
-rw-r--r-- | ui/gl/gl_context.cc | 16 | ||||
-rw-r--r-- | ui/gl/gl_surface.cc | 13 | ||||
-rw-r--r-- | ui/gl/gl_surface.h | 4 |
3 files changed, 17 insertions, 16 deletions
diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc index 8652e25..48ef5fb 100644 --- a/ui/gl/gl_context.cc +++ b/ui/gl/gl_context.cc @@ -37,20 +37,8 @@ GLContext::~GLContext() { std::string GLContext::GetExtensions() { DCHECK(IsCurrent(NULL)); - - std::string extensions; - if (GLSurface::GetCurrent()) { - extensions = GLSurface::GetCurrent()->GetExtensions(); - } - - const char* gl_ext = reinterpret_cast<const char*>( - glGetString(GL_EXTENSIONS)); - if (gl_ext) { - extensions += (!extensions.empty() && gl_ext[0]) ? " " : ""; - extensions += gl_ext; - } - - return extensions; + const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); + return std::string(ext ? ext : ""); } bool GLContext::HasExtension(const char* name) { diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc index e7efc12..b9040ec 100644 --- a/ui/gl/gl_surface.cc +++ b/ui/gl/gl_surface.cc @@ -75,8 +75,7 @@ bool GLSurface::InitializeOneOff() { GLSurface::GLSurface() {} -bool GLSurface::Initialize() -{ +bool GLSurface::Initialize() { return true; } @@ -92,6 +91,16 @@ std::string GLSurface::GetExtensions() { return std::string(""); } +bool GLSurface::HasExtension(const char* name) { + std::string extensions = GetExtensions(); + extensions += " "; + + std::string delimited_name(name); + delimited_name += " "; + + return extensions.find(delimited_name) != std::string::npos; +} + unsigned int GLSurface::GetBackingFrameBufferObject() { return 0; } diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h index a2483c4..5872ed0 100644 --- a/ui/gl/gl_surface.h +++ b/ui/gl/gl_surface.h @@ -6,6 +6,8 @@ #define UI_GL_GL_SURFACE_H_ #pragma once +#include <string> + #include "base/memory/ref_counted.h" #include "build/build_config.h" #include "ui/gfx/native_widget_types.h" @@ -58,6 +60,8 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { // The surface must be current. virtual std::string GetExtensions(); + bool HasExtension(const char* name); + // Returns the internal frame buffer object name if the surface is backed by // FBO. Otherwise returns 0. virtual unsigned int GetBackingFrameBufferObject(); |