[vlc-devel] [PATCH v2 10/29] opengl: move GL_ASSERT_NOERROR macro to header

Romain Vimont rom1v at videolabs.io
Thu Feb 6 14:17:39 CET 2020


The macro will be used from several files.
---
 modules/video_output/opengl/gl_common.h   | 27 +++++++++++++++++++++++
 modules/video_output/opengl/vout_helper.c | 27 -----------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/modules/video_output/opengl/gl_common.h b/modules/video_output/opengl/gl_common.h
index f5f7f54a9f..303ef73131 100644
--- a/modules/video_output/opengl/gl_common.h
+++ b/modules/video_output/opengl/gl_common.h
@@ -97,6 +97,33 @@
 # define APIENTRY
 #endif
 
+/* FIXME: GL_ASSERT_NOERROR disabled for now because:
+ * Proper GL error handling need to be implemented
+ * glClear(GL_COLOR_BUFFER_BIT) throws a GL_INVALID_FRAMEBUFFER_OPERATION on macOS
+ * assert fails on vout_display_opengl_Delete on iOS
+ */
+#if 0
+# define HAVE_GL_ASSERT_NOERROR
+#endif
+
+#ifdef HAVE_GL_ASSERT_NOERROR
+# define GL_ASSERT_NOERROR() do { \
+    GLenum glError = vgl->vt.GetError(); \
+    switch (glError) \
+    { \
+        case GL_NO_ERROR: break; \
+        case GL_INVALID_ENUM: assert(!"GL_INVALID_ENUM"); \
+        case GL_INVALID_VALUE: assert(!"GL_INVALID_VALUE"); \
+        case GL_INVALID_OPERATION: assert(!"GL_INVALID_OPERATION"); \
+        case GL_INVALID_FRAMEBUFFER_OPERATION: assert(!"GL_INVALID_FRAMEBUFFER_OPERATION"); \
+        case GL_OUT_OF_MEMORY: assert(!"GL_OUT_OF_MEMORY"); \
+        default: assert(!"GL_UNKNOWN_ERROR"); \
+    } \
+} while(0)
+#else
+# define GL_ASSERT_NOERROR()
+#endif
+
 /* Core OpenGL/OpenGLES functions: the following functions pointers typedefs
  * are not defined. */
 #if !defined(_WIN32) /* Already defined on Win32 */
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 666314a28f..688717e78b 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -44,33 +44,6 @@
 
 #define SPHERE_RADIUS 1.f
 
-/* FIXME: GL_ASSERT_NOERROR disabled for now because:
- * Proper GL error handling need to be implemented
- * glClear(GL_COLOR_BUFFER_BIT) throws a GL_INVALID_FRAMEBUFFER_OPERATION on macOS
- * assert fails on vout_display_opengl_Delete on iOS
- */
-#if 0
-# define HAVE_GL_ASSERT_NOERROR
-#endif
-
-#ifdef HAVE_GL_ASSERT_NOERROR
-# define GL_ASSERT_NOERROR() do { \
-    GLenum glError = vgl->vt.GetError(); \
-    switch (glError) \
-    { \
-        case GL_NO_ERROR: break; \
-        case GL_INVALID_ENUM: assert(!"GL_INVALID_ENUM"); \
-        case GL_INVALID_VALUE: assert(!"GL_INVALID_VALUE"); \
-        case GL_INVALID_OPERATION: assert(!"GL_INVALID_OPERATION"); \
-        case GL_INVALID_FRAMEBUFFER_OPERATION: assert(!"GL_INVALID_FRAMEBUFFER_OPERATION"); \
-        case GL_OUT_OF_MEMORY: assert(!"GL_OUT_OF_MEMORY"); \
-        default: assert(!"GL_UNKNOWN_ERROR"); \
-    } \
-} while(0)
-#else
-# define GL_ASSERT_NOERROR()
-#endif
-
 typedef struct {
     GLuint   texture;
     GLsizei  width;
-- 
2.25.0



More information about the vlc-devel mailing list