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:
Diffstat (limited to 'intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc')
-rw-r--r--intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc20
1 files changed, 17 insertions, 3 deletions
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);
}