Fix GLWindowContext_unix
This causes link issues if we try to build with skia_use_egl on linux
(which we do for fiddle).
Change-Id: I51b546bdddd1c37e12b87c3ba8a874a20986fec4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/858016
Commit-Queue: Kaylee Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index a43d45f..12b1b0a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -989,6 +989,7 @@
"src/gpu/ganesh/gl/egl/GrGLMakeNativeInterface_egl.cpp",
]
libs += [ "EGL" ]
+ public_defines += [ "SK_EGL" ]
}
} else if (skia_use_webgl) {
sources += [ "src/gpu/ganesh/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
@@ -998,6 +999,7 @@
"src/gpu/ganesh/gl/glx/GrGLMakeNativeInterface_glx.cpp",
]
libs += [ "GL" ]
+ public_defines += [ "SK_GLX" ]
} else if (is_mac) {
sources += [ "src/gpu/ganesh/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
} else if (is_ios) {
diff --git a/tools/window/unix/GLWindowContext_unix.cpp b/tools/window/unix/GLWindowContext_unix.cpp
index e2802d8..374f546 100644
--- a/tools/window/unix/GLWindowContext_unix.cpp
+++ b/tools/window/unix/GLWindowContext_unix.cpp
@@ -9,7 +9,10 @@
#include "include/gpu/gl/GrGLInterface.h"
#include "tools/window/GLWindowContext.h"
#include "tools/window/unix/WindowContextFactory_unix.h"
+
+#if defined(SK_GLX)
#include "include/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.h"
+#endif
#include <GL/gl.h>
@@ -60,6 +63,14 @@
using CreateContextAttribsFn = GLXContext(Display*, GLXFBConfig, GLXContext, Bool, const int*);
+static sk_sp<const GrGLInterface> make_interface() {
+#if defined(SK_GLX)
+ return GrGLInterfaces::MakeGLX();
+#else
+ return nullptr;
+#endif
+}
+
sk_sp<const GrGLInterface> GLWindowContext_xlib::onInitializeContext() {
SkASSERT(fDisplay);
SkASSERT(!fGLContext);
@@ -97,7 +108,7 @@
current = true;
// Look to see if RenderDoc is attached. If so, re-create the context with a
// core profile.
- interface = GrGLInterfaces::MakeGLX();
+ interface = make_interface();
if (interface && interface->fExtensions.has("GL_EXT_debug_tool")) {
interface.reset();
glXMakeCurrent(fDisplay, None, nullptr);
@@ -151,7 +162,7 @@
&border_width, &depth);
glViewport(0, 0, fWidth, fHeight);
- return interface ? interface : GrGLInterfaces::MakeGLX();
+ return interface ? interface : make_interface();
}
GLWindowContext_xlib::~GLWindowContext_xlib() {