Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: ui/gl/gl_gl_api_implementation.cc

Issue 221433004: gpu: Bind dummy GL API when no context is current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix two gpu unittests Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_gl_api_implementation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_gl_api_implementation.cc
diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc
index f925f64ffa88af185c41ca880c09a484e094706d..42a937062ed4850eb3f09256d1c64076077da83b 100644
--- a/ui/gl/gl_gl_api_implementation.cc
+++ b/ui/gl/gl_gl_api_implementation.cc
@@ -22,6 +22,9 @@ namespace gfx {
static GLApi* g_gl;
// A GL Api that calls directly into the driver.
static RealGLApi* g_real_gl;
+// A GL Api that does nothing but warn about illegal GL calls without a context
+// current.
+static NoContextGLApi* g_no_context_gl;
// A GL Api that calls TRACE and then calls another GL api.
static TraceGLApi* g_trace_gl;
// GL version used when initializing dynamic bindings.
@@ -258,6 +261,7 @@ void InitializeStaticGLBindingsGL() {
if (!g_real_gl) {
g_real_gl = new RealGLApi();
g_trace_gl = new TraceGLApi(g_real_gl);
+ g_no_context_gl = new NoContextGLApi();
}
g_real_gl->Initialize(&g_driver_gl);
g_gl = g_real_gl;
@@ -280,6 +284,10 @@ void SetGLToRealGLApi() {
SetGLApi(g_gl);
}
+void SetGLApiToNoContext() {
+ SetGLApi(g_no_context_gl);
+}
+
void InitializeDynamicGLBindingsGL(GLContext* context) {
g_driver_gl.InitializeCustomDynamicBindings(context);
DCHECK(context && context->IsCurrent(NULL) && !g_version_info);
@@ -356,6 +364,12 @@ void RealGLApi::Initialize(DriverGL* driver) {
TraceGLApi::~TraceGLApi() {
}
+NoContextGLApi::NoContextGLApi() {
+}
+
+NoContextGLApi::~NoContextGLApi() {
+}
+
VirtualGLApi::VirtualGLApi()
: real_context_(NULL),
current_context_(NULL) {
« no previous file with comments | « ui/gl/gl_gl_api_implementation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698