diff options
author | Brian Salomon <bsalomon@google.com> | 2017-12-11 10:06:31 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-11 17:54:38 +0000 |
commit | 3d6801eeee6b036de9f8d09e2ae8fa99df5a397c (patch) | |
tree | cbdcd23fe4924fbe25afae209d01bb6527244abf /include | |
parent | d67e5189802e89e74217244b36cc7263883d5dba (diff) |
Add GrGLMakeNativeInterface factory that returns sk_sp<const GrGLInterface>.
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 <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrTypes.h | 2 | ||||
-rw-r--r-- | include/gpu/gl/GrGLAssembleInterface.h | 7 | ||||
-rw-r--r-- | include/gpu/gl/GrGLInterface.h | 45 |
3 files changed, 15 insertions, 39 deletions
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<const GrGLInterface> 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<const GrGLInterface> 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<const GrGLInterface> 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<const GrGLInterface> 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. |