Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Rauch <Rauch.Christian@gmx.de>2022-08-15 15:58:04 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-08-15 17:10:29 +0300
commita296b8f694d1a93d40da78312758580f69b43be7 (patch)
treefd5791d3227411c905c7c728f2d97fe19e28156f /intern/opensubdiv
parent90be364ca9b86f6dac78925166ba3ea567fc950d (diff)
GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as dynamically open EGL and GLX libraries without linking to them. This will make it possible to build with Wayland, EGL, GLVND support while still running on systems that only have X11, GLX and libGL. It also paves the way for headless rendering through EGL. libepoxy is a new library dependency, and is included in the precompiled libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed. Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton and Sergey Sharybin. Ref T76428 Differential Revision: https://developer.blender.org/D15291
Diffstat (limited to 'intern/opensubdiv')
-rw-r--r--intern/opensubdiv/CMakeLists.txt3
-rw-r--r--intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc20
2 files changed, 18 insertions, 5 deletions
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index 14cc6a70cd5..058e29ea71c 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -29,7 +29,7 @@ if(WITH_OPENSUBDIV)
list(APPEND INC_SYS
${OPENSUBDIV_INCLUDE_DIRS}
- ${GLEW_INCLUDE_PATH}
+ ${Epoxy_INCLUDE_DIRS}
)
list(APPEND SRC
@@ -88,7 +88,6 @@ if(WITH_OPENSUBDIV)
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
add_definitions(${GL_DEFINITIONS})
- add_definitions(-DOSD_USES_GLEW)
if(WIN32)
add_definitions(-DNOMINMAX)
diff --git a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc
index c2ab2a522d2..148770b0d39 100644
--- a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc
+++ b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc
@@ -22,9 +22,23 @@
// language governing permissions and limitations under the Apache License.
//
-#include "gl_compute_evaluator.h"
+#include <epoxy/gl.h>
+
+/* There are few aspects here:
+ * - macOS is strict about including both gl.h and gl3.h
+ * - libepoxy only pretends to be a replacement for gl.h
+ * - OpenSubdiv internally uses `OpenGL/gl3.h` on macOS
+ *
+ * In order to silence the warning pretend that gl3 has been included, fully relying on symbols
+ * from the epoxy.
+ *
+ * This works differently from how OpenSubdiv internally will use `OpenGL/gl3.h` without epoxy.
+ * Sounds fragile, but so far things seems to work. */
+#if defined(__APPLE__)
+# define __gl3_h_
+#endif
-#include <GL/glew.h>
+#include "gl_compute_evaluator.h"
#include <opensubdiv/far/error.h>
#include <opensubdiv/far/patchDescriptor.h>
@@ -57,7 +71,7 @@ template<class T> GLuint createSSBO(std::vector<T> const &src)
GLuint devicePtr = 0;
#if defined(GL_ARB_direct_state_access)
- if (GLEW_ARB_direct_state_access) {
+ if (epoxy_has_gl_extension("GL_ARB_direct_state_access")) {
glCreateBuffers(1, &devicePtr);
glNamedBufferData(devicePtr, src.size() * sizeof(T), &src.at(0), GL_STATIC_DRAW);
}