aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar abarth <abarth@chromium.org>2016-03-28 11:34:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-28 11:34:27 -0700
commit7fb19bc229ba4e7482ff7c0fd24bd2fcb0093b8b (patch)
tree0cd7e056a7d1748178d46d551e08af60d17f9030 /src/gpu/gl
parentdf801aac5f57c64eb7f081288a299fa3c92cee0d (diff)
Add GLFW support for GrGLCreateNativeInterface
This file lets us use Skia's GPU backend with GLFW. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1827153003 CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot Review URL: https://codereview.chromium.org/1827153003
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp b/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp
new file mode 100644
index 0000000000..e2f6e668cd
--- /dev/null
+++ b/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016 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"
+#include "gl/GrGLAssembleInterface.h"
+#include "gl/GrGLUtil.h"
+
+#include <GLFW/glfw3.h>
+
+static GrGLFuncPtr glfw_get(void* ctx, const char name[]) {
+ SkASSERT(nullptr == ctx);
+ SkASSERT(glfwGetCurrentContext());
+ return glfwGetProcAddress(name);
+}
+
+const GrGLInterface* GrGLCreateNativeInterface() {
+ if (nullptr == glfwGetCurrentContext()) {
+ return nullptr;
+ }
+
+ return GrGLAssembleInterface(nullptr, glfw_get);
+}