aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/gl/GrGLAssembleInterface.cpp11
-rw-r--r--src/gpu/gl/GrGLDefaultInterface_native.cpp12
-rw-r--r--src/gpu/gl/GrGLDefaultInterface_none.cpp12
-rw-r--r--src/gpu/gl/GrGLGpu.cpp7
-rw-r--r--src/gpu/gl/GrGLInterface.cpp27
-rw-r--r--src/gpu/gl/GrGLMakeNativeInterface_none.cpp (renamed from src/gpu/gl/GrGLCreateNativeInterface_none.cpp)6
-rw-r--r--src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp (renamed from src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp)4
-rw-r--r--src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp (renamed from src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp)4
-rw-r--r--src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp (renamed from src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp)4
-rw-r--r--src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp (renamed from src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp)4
-rw-r--r--src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp (renamed from src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp)4
-rw-r--r--src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp (renamed from src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp)4
-rw-r--r--src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp (renamed from src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp)4
13 files changed, 35 insertions, 68 deletions
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index b7698f1473..c5e99015e0 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -15,7 +15,7 @@
#define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL ## F = (GrEGL ## F ## Proc) get(ctx, "egl" #F #S)
-const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get) {
+sk_sp<const GrGLInterface> GrGLAssembleInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
if (nullptr == GetString) {
return nullptr;
@@ -51,7 +51,7 @@ static void get_egl_query_and_display(GrEGLQueryStringProc* queryString, GrEGLDi
}
}
-const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
+sk_sp<const GrGLInterface> GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
GET_PROC_LOCAL(GetStringi);
GET_PROC_LOCAL(GetIntegerv);
@@ -78,7 +78,7 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
return nullptr;
}
- GrGLInterface* interface = new GrGLInterface();
+ sk_sp<GrGLInterface> interface(new GrGLInterface());
GrGLInterface::Functions* functions = &interface->fFunctions;
GET_PROC(ActiveTexture);
@@ -315,7 +315,6 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
}
} else {
// we must have FBOs
- delete interface;
return nullptr;
}
@@ -547,7 +546,7 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
return interface;
}
-const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
+sk_sp<const GrGLInterface> GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
if (nullptr == GetString) {
return nullptr;
@@ -571,7 +570,7 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
return nullptr;
}
- GrGLInterface* interface = new GrGLInterface;
+ sk_sp<GrGLInterface> interface(new GrGLInterface);
GrGLInterface::Functions* functions = &interface->fFunctions;
GET_PROC(ActiveTexture);
diff --git a/src/gpu/gl/GrGLDefaultInterface_native.cpp b/src/gpu/gl/GrGLDefaultInterface_native.cpp
deleted file mode 100644
index e695f15a17..0000000000
--- a/src/gpu/gl/GrGLDefaultInterface_native.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gl/GrGLInterface.h"
-
-const GrGLInterface* GrGLDefaultInterface() {
- return GrGLCreateNativeInterface();
-}
diff --git a/src/gpu/gl/GrGLDefaultInterface_none.cpp b/src/gpu/gl/GrGLDefaultInterface_none.cpp
deleted file mode 100644
index f9e52470bc..0000000000
--- a/src/gpu/gl/GrGLDefaultInterface_none.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gl/GrGLInterface.h"
-
-const GrGLInterface* GrGLDefaultInterface() {
- return nullptr;
-}
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index c11f598b7a..ddb80b4b62 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -184,7 +184,12 @@ sk_sp<GrGpu> GrGLGpu::Make(GrBackendContext backendContext, const GrContextOptio
sk_sp<GrGpu> GrGLGpu::Make(sk_sp<const GrGLInterface> interface, const GrContextOptions& options,
GrContext* context) {
if (!interface) {
- interface.reset(GrGLDefaultInterface());
+ interface = GrGLMakeNativeInterface();
+ // For clients that have written their own GrGLCreateNativeInterface and haven't yet updated
+ // to GrGLMakeNativeInterface.
+ if (!interface) {
+ interface = sk_ref_sp(GrGLCreateNativeInterface());
+ }
if (!interface) {
return nullptr;
}
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index 8ce8af7098..2e7924d786 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -12,37 +12,10 @@
#include <stdio.h>
-const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interface,
- GrGLInsertEventMarkerProc insertEventMarkerFn,
- GrGLPushGroupMarkerProc pushGroupMarkerFn,
- GrGLPopGroupMarkerProc popGroupMarkerFn) {
- GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
-
- if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) {
- newInterface->fExtensions.add("GL_EXT_debug_marker");
- }
-
- newInterface->fFunctions.fInsertEventMarker = insertEventMarkerFn;
- newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn;
- newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn;
-
- return newInterface;
-}
-
GrGLInterface::GrGLInterface() {
fStandard = kNone_GrGLStandard;
}
-GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
- SkASSERT(interface);
-
- GrGLInterface* clone = new GrGLInterface;
- clone->fStandard = interface->fStandard;
- clone->fExtensions = interface->fExtensions;
- clone->fFunctions = interface->fFunctions;
- return clone;
-}
-
#ifdef SK_DEBUG
static int kIsDebug = 1;
#else
diff --git a/src/gpu/gl/GrGLCreateNativeInterface_none.cpp b/src/gpu/gl/GrGLMakeNativeInterface_none.cpp
index 0a0f279f16..6d460c5efe 100644
--- a/src/gpu/gl/GrGLCreateNativeInterface_none.cpp
+++ b/src/gpu/gl/GrGLMakeNativeInterface_none.cpp
@@ -7,6 +7,6 @@
#include "gl/GrGLInterface.h"
-const GrGLInterface* GrGLCreateNativeInterface() {
- return nullptr;
-}
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() { return nullptr; }
+
+const GrGLInterface* GrGLCreateNativeInterface() { return nullptr; }
diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp
index 3b24964bb0..2630e87ba2 100644
--- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
+++ b/src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp
@@ -232,8 +232,10 @@ static GrGLFuncPtr android_get_gl_proc(void* ctx, const char name[]) {
return eglGetProcAddress(name);
}
-const GrGLInterface* GrGLCreateNativeInterface() {
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
return GrGLAssembleInterface(nullptr, android_get_gl_proc);
}
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
+
#endif//defined(SK_BUILD_FOR_ANDROID)
diff --git a/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp b/src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp
index 4f427820b1..3fbe037b1c 100644
--- a/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp
+++ b/src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp
@@ -24,6 +24,8 @@ static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) {
return ptr;
}
-const GrGLInterface* GrGLCreateNativeInterface() {
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
return GrGLAssembleInterface(nullptr, egl_get_gl_proc);
}
+
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
diff --git a/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp b/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp
index e2f6e668cd..3873510499 100644
--- a/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp
+++ b/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp
@@ -18,10 +18,12 @@ static GrGLFuncPtr glfw_get(void* ctx, const char name[]) {
return glfwGetProcAddress(name);
}
-const GrGLInterface* GrGLCreateNativeInterface() {
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
if (nullptr == glfwGetCurrentContext()) {
return nullptr;
}
return GrGLAssembleInterface(nullptr, glfw_get);
}
+
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
diff --git a/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp b/src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp
index 246a589372..4bbbe087a2 100644
--- a/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
+++ b/src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp
@@ -26,10 +26,12 @@ static GrGLFuncPtr glx_get(void* ctx, const char name[]) {
return glXGetProcAddress(reinterpret_cast<const GLubyte*>(name));
}
-const GrGLInterface* GrGLCreateNativeInterface() {
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
if (nullptr == glXGetCurrentContext()) {
return nullptr;
}
return GrGLAssembleInterface(nullptr, glx_get);
}
+
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
diff --git a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp b/src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp
index c7eb46b736..a0a6ac6615 100644
--- a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
+++ b/src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp
@@ -49,7 +49,9 @@ static GrGLFuncPtr ios_get_gl_proc(void* ctx, const char name[]) {
return getter->getProc(name);
}
-const GrGLInterface* GrGLCreateNativeInterface() {
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
GLProcGetter getter;
return GrGLAssembleGLESInterface(&getter, ios_get_gl_proc);
}
+
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp
index c843d0e8ca..7220b136c5 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp
@@ -53,9 +53,11 @@ static GrGLFuncPtr mac_get_gl_proc(void* ctx, const char name[]) {
return getter->getProc(name);
}
-const GrGLInterface* GrGLCreateNativeInterface() {
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
GLProcGetter getter;
return GrGLAssembleGLInterface(&getter, mac_get_gl_proc);
}
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
+
#endif//defined(SK_BUILD_FOR_MAC)
diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp
index 5f26fdde34..77db59a754 100644
--- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
+++ b/src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp
@@ -62,7 +62,7 @@ static GrGLFuncPtr win_get_gl_proc(void* ctx, const char name[]) {
* This implementation will only work if GR_GL_FUNCTION_TYPE is __stdcall.
* Otherwise, a springboard would be needed that hides the calling convention.
*/
-const GrGLInterface* GrGLCreateNativeInterface() {
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
if (nullptr == wglGetCurrentContext()) {
return nullptr;
}
@@ -87,4 +87,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
return nullptr;
}
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }
+
#endif//defined(SK_BUILD_FOR_WIN32)