From 3d6801eeee6b036de9f8d09e2ae8fa99df5a397c Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Mon, 11 Dec 2017 10:06:31 -0500 Subject: Add GrGLMakeNativeInterface factory that returns sk_sp. Removes the concept of a configurable "default" interface and makes the default always be the "native" interface. Also removes unused functions: GrGLInterfaceAddTestDebugMarker and GrGLInterface::NewClone. Keeps around legacy GrGLCreateNativeInterface() until clients can be weened. Change-Id: I4a3bdafa8cf8c68ed13318393abd55686b045ccb Reviewed-on: https://skia-review.googlesource.com/83000 Reviewed-by: Robert Phillips Commit-Queue: Brian Salomon --- include/gpu/GrTypes.h | 2 +- include/gpu/gl/GrGLAssembleInterface.h | 7 +++--- include/gpu/gl/GrGLInterface.h | 45 +++++++++------------------------- 3 files changed, 15 insertions(+), 39 deletions(-) (limited to 'include') diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index 08eb2daa98..3081543aac 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -197,7 +197,7 @@ enum GrBackend { /** * Backend-specific 3D context handle - * OpenGL: const GrGLInterface*. If null will use the result of GrGLCreateNativeInterface(). + * OpenGL: const GrGLInterface*. If null will use the result of GrGLMakeNativeInterface(). * Vulkan: GrVkBackendContext*. * Mock: const GrMockOptions* or null for default constructed GrMockContextOptions. */ diff --git a/include/gpu/gl/GrGLAssembleInterface.h b/include/gpu/gl/GrGLAssembleInterface.h index b9881a99b4..db44ce738f 100644 --- a/include/gpu/gl/GrGLAssembleInterface.h +++ b/include/gpu/gl/GrGLAssembleInterface.h @@ -9,22 +9,21 @@ typedef GrGLFuncPtr (*GrGLGetProc)(void* ctx, const char name[]); - /** * Generic function for creating a GrGLInterface for an either OpenGL or GLES. It calls * get() to get each function address. ctx is a generic ptr passed to and interpreted by get(). */ -SK_API const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get); +SK_API sk_sp GrGLAssembleInterface(void* ctx, GrGLGetProc get); /** * Generic function for creating a GrGLInterface for an OpenGL (but not GLES) context. It calls * get() to get each function address. ctx is a generic ptr passed to and interpreted by get(). */ -SK_API const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get); +SK_API sk_sp GrGLAssembleGLInterface(void* ctx, GrGLGetProc get); /** * Generic function for creating a GrGLInterface for an OpenGL ES (but not Open GL) context. It * calls get() to get each function address. ctx is a generic ptr passed to and interpreted by * get(). */ -SK_API const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get); +SK_API sk_sp GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get); diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h index e752c2d6e8..e6451ece3b 100644 --- a/include/gpu/gl/GrGLInterface.h +++ b/include/gpu/gl/GrGLInterface.h @@ -14,40 +14,26 @@ //////////////////////////////////////////////////////////////////////////////// +typedef void(*GrGLFuncPtr)(); +struct GrGLInterface; + + /** * Rather than depend on platform-specific GL headers and libraries, we require * the client to provide a struct of GL function pointers. This struct can be * specified per-GrContext as a parameter to GrContext::MakeGL. If NULL is - * passed to MakeGL then a "default" GL interface is created. If the default is + * passed to MakeGL then a "native" GL interface is created. If the native is * also NULL GrContext creation will fail. * - * The default interface is returned by GrGLDefaultInterface. This function's - * implementation is platform-specific. Several have been provided, along with - * an implementation that simply returns NULL. - * - * By defining GR_GL_PER_GL_CALL_IFACE_CALLBACK to 1 the client can specify a - * callback function that will be called prior to each GL function call. See - * comments in GrGLConfig.h - */ - -typedef void(*GrGLFuncPtr)(); - -struct GrGLInterface; - -const GrGLInterface* GrGLDefaultInterface(); - -/** - * Creates a GrGLInterface for a "native" GL context (e.g. WGL on windows, - * GLX on linux, AGL on Mac). The interface is only valid for the GL context - * that is current when the interface is created. + * The default interface is returned by GrGLMakeNativeInterface. This function's + * implementation is platform-specific. Several have been provided + * (for GLX, WGL, EGL, etc), along with an implementation that simply returns + * NULL. */ +SK_API sk_sp GrGLMakeNativeInterface(); +// Deprecated alternative to GrGLMakeNativeInterface(). SK_API const GrGLInterface* GrGLCreateNativeInterface(); -#if GR_GL_PER_GL_FUNC_CALLBACK -typedef void (*GrGLInterfaceCallbackProc)(const GrGLInterface*); -typedef intptr_t GrGLInterfaceCallbackData; -#endif - /** * Creates a null GrGLInterface that doesn't draw anything. Used for measuring * CPU overhead. TODO: We would like to move this to tools/gpu/gl/null but currently @@ -55,13 +41,6 @@ typedef intptr_t GrGLInterfaceCallbackData; */ const SK_API GrGLInterface* GrGLCreateNullInterface(bool enableNVPR = false); -/** Function that returns a new interface identical to "interface" but with support for - test version of GL_EXT_debug_marker. */ -const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface*, - GrGLInsertEventMarkerProc insertEventMarkerFn, - GrGLPushGroupMarkerProc pushGroupMarkerFn, - GrGLPopGroupMarkerProc popGroupMarkerFn); - /** * GrContext uses the following interface to make all calls into OpenGL. When a * GrContext is created it is given a GrGLInterface. The interface's function @@ -80,8 +59,6 @@ private: public: GrGLInterface(); - static GrGLInterface* NewClone(const GrGLInterface*); - // Validates that the GrGLInterface supports its advertised standard. This means the necessary // function pointers have been initialized for both the GL version and any advertised // extensions. -- cgit v1.2.3