Remove the GrGLInterface callback mechanism.
authorbsalomon <bsalomon@google.com>
Mon, 28 Mar 2016 19:25:09 +0000 (12:25 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 28 Mar 2016 19:25:09 +0000 (12:25 -0700)
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1836013002

Review URL: https://codereview.chromium.org/1836013002

include/gpu/gl/GrGLConfig.h
include/gpu/gl/GrGLConfig_chrome.h
include/gpu/gl/GrGLInterface.h
src/gpu/gl/GrGLInterface.cpp
src/gpu/gl/GrGLUtil.h

index c91537c..82963a7 100644 (file)
  * Chrome's cmd buffer will create a new allocation and memset the whole thing
  * to zero (for security reasons). Defaults to 1 (enabled).
  *
- * GR_GL_PER_GL_FUNC_CALLBACK: When set to 1 the GrGLInterface object provides
- * a function pointer that is called just before every gl function. The ptr must
- * be valid (i.e. there is no NULL check). However, by default the callback will
- * be set to a function that does nothing. The signature of the function is:
- *    void function(const GrGLInterface*)
- * It is not extern "C".
- * The GrGLInterface field fCallback specifies the function ptr and there is an
- * additional field fCallbackData of type intptr_t for client data.
- *
  * GR_GL_CHECK_ALLOC_WITH_GET_ERROR: If set to 1 this will then glTexImage,
  * glBufferData, glRenderbufferStorage, etc will be checked for errors. This
  * amounts to ensuring the error is GL_NO_ERROR, calling the allocating
     #define GR_GL_USE_BUFFER_DATA_NULL_HINT             1
 #endif
 
-#if !defined(GR_GL_PER_GL_FUNC_CALLBACK)
-    #define GR_GL_PER_GL_FUNC_CALLBACK                  0
-#endif
-
 #if !defined(GR_GL_CHECK_ALLOC_WITH_GET_ERROR)
     #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR            1
 #endif
index 041a46d..838e054 100644 (file)
@@ -15,9 +15,6 @@
 // with NULL.
 #define GR_GL_USE_BUFFER_DATA_NULL_HINT             0
 
-// chrome uses this to set the context on each GL call.
-#define GR_GL_PER_GL_FUNC_CALLBACK                  1
-
 // Check error is even more expensive in chrome (cmd buffer flush). The
 // compositor also doesn't check its allocations.
 #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR            0
index 1e2ac8f..cbf9b1a 100644 (file)
@@ -76,11 +76,6 @@ const SK_API GrGLInterface* GrGLCreateNullInterface();
  */
 const GrGLInterface* GrGLCreateDebugInterface();
 
-#if GR_GL_PER_GL_FUNC_CALLBACK
-typedef void (*GrGLInterfaceCallbackProc)(const GrGLInterface*);
-typedef intptr_t GrGLInterfaceCallbackData;
-#endif
-
 /** Function that returns a new interface identical to "interface" but without support for
     GL_NV_path_rendering. */
 const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface*);
@@ -492,12 +487,6 @@ public:
         GrGLFunction<GrEGLDestroyImageProc> fEGLDestroyImage;
     } fFunctions;
 
-    // Per-GL func callback
-#if GR_GL_PER_GL_FUNC_CALLBACK
-    GrGLInterfaceCallbackProc fCallback;
-    GrGLInterfaceCallbackData fCallbackData;
-#endif
-
     // This exists for internal testing.
     virtual void abandon() const {}
 };
index 32d85b6..7f741f9 100644 (file)
 
 #include <stdio.h>
 
-#if GR_GL_PER_GL_FUNC_CALLBACK
-namespace {
-void GrGLDefaultInterfaceCallback(const GrGLInterface*) {}
-}
-#endif
-
 const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interface,
                                                      GrGLInsertEventMarkerProc insertEventMarkerFn,
                                                      GrGLPushGroupMarkerProc pushGroupMarkerFn,
@@ -68,11 +62,6 @@ const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) {
 
 GrGLInterface::GrGLInterface() {
     fStandard = kNone_GrGLStandard;
-
-#if GR_GL_PER_GL_FUNC_CALLBACK
-    fCallback = GrGLDefaultInterfaceCallback;
-    fCallbackData = 0;
-#endif
 }
 
 GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
@@ -82,10 +71,6 @@ GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
     clone->fStandard = interface->fStandard;
     clone->fExtensions = interface->fExtensions;
     clone->fFunctions = interface->fFunctions;
-#if GR_GL_PER_GL_FUNC_CALLBACK
-    clone->fCallback = interface->fCallback;
-    clone->fCallbackData = interface->fCallbackData;
-#endif
     return clone;
 }
 
index 8a3021c..2f023f9 100644 (file)
@@ -172,13 +172,6 @@ void GrGLClearErr(const GrGLInterface* gl);
     #define GR_GL_LOG_CALLS_IMPL(X)
 #endif
 
-// internal macro that does the per-GL-call callback (if necessary)
-#if GR_GL_PER_GL_FUNC_CALLBACK
-    #define GR_GL_CALLBACK_IMPL(IFACE) (IFACE)->fCallback(IFACE)
-#else
-    #define GR_GL_CALLBACK_IMPL(IFACE)
-#endif
-
 // makes a GL call on the interface and does any error checking and logging
 #define GR_GL_CALL(IFACE, X)                                    \
     do {                                                        \
@@ -190,7 +183,6 @@ void GrGLClearErr(const GrGLInterface* gl);
 // the caller wants to do its own glGetError() call and examine the error value.
 #define GR_GL_CALL_NOERRCHECK(IFACE, X)                         \
     do {                                                        \
-        GR_GL_CALLBACK_IMPL(IFACE);                             \
         (IFACE)->fFunctions.f##X;                               \
         GR_GL_LOG_CALLS_IMPL(X);                                \
     } while (false)
@@ -205,7 +197,6 @@ void GrGLClearErr(const GrGLInterface* gl);
 // same as GR_GL_CALL_RET but always skips the error check.
 #define GR_GL_CALL_RET_NOERRCHECK(IFACE, RET, X)                \
     do {                                                        \
-        GR_GL_CALLBACK_IMPL(IFACE);                             \
         (RET) = (IFACE)->fFunctions.f##X;                       \
         GR_GL_LOG_CALLS_IMPL(X);                                \
     } while (false)