* 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
// 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
*/
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*);
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 {}
};
#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,
GrGLInterface::GrGLInterface() {
fStandard = kNone_GrGLStandard;
-
-#if GR_GL_PER_GL_FUNC_CALLBACK
- fCallback = GrGLDefaultInterfaceCallback;
- fCallbackData = 0;
-#endif
}
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;
}
#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 { \
// 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)
// 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)