Henri Verbeet : wined3d: Don't bother with glGetError() if we have ARB_DEBUG_OUTPUT.

Alexandre Julliard julliard at winehq.org
Tue Jun 21 11:13:48 CDT 2016


Module: wine
Branch: master
Commit: a1bc5b8c975799ee1d4281cdd83279cc196db79c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a1bc5b8c975799ee1d4281cdd83279cc196db79c

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Jun 21 10:32:43 2016 +0200

wined3d: Don't bother with glGetError() if we have ARB_DEBUG_OUTPUT.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context.c         | 19 +++++++++++++++++++
 dlls/wined3d/drawprim.c        |  1 +
 dlls/wined3d/wined3d_private.h | 17 ++++++-----------
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 04265d0..ae82a82 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1550,6 +1550,25 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
     }
 }
 
+void wined3d_check_gl_call(const struct wined3d_gl_info *gl_info,
+        const char *file, unsigned int line, const char *name)
+{
+    GLint err;
+
+    if (gl_info->supported[ARB_DEBUG_OUTPUT] || (err = gl_info->gl_ops.gl.p_glGetError()) == GL_NO_ERROR)
+    {
+        TRACE("%s call ok %s / %u.\n", name, file, line);
+        return;
+    }
+
+    do
+    {
+        ERR(">>>>>>> %s (%#x) from %s @ %s / %u.\n",
+                debug_glerror(err), err, name, file,line);
+        err = gl_info->gl_ops.gl.p_glGetError();
+    } while (err != GL_NO_ERROR);
+}
+
 static BOOL context_debug_output_enabled(const struct wined3d_gl_info *gl_info)
 {
     return gl_info->supported[ARB_DEBUG_OUTPUT]
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 2b58def..5a9e084 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -31,6 +31,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw);
 WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
+WINE_DECLARE_DEBUG_CHANNEL(d3d);
 
 #include <stdio.h>
 #include <math.h>
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 04dd160..f6f6bb3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1130,22 +1130,17 @@ static inline void wined3d_color_from_d3dcolor(struct wined3d_color *wined3d_col
 
 #define HIGHEST_TRANSFORMSTATE WINED3D_TS_WORLD_MATRIX(255) /* Highest value in wined3d_transform_state. */
 
+void wined3d_check_gl_call(const struct wined3d_gl_info *gl_info,
+        const char *file, unsigned int line, const char *name) DECLSPEC_HIDDEN;
+
 /* Checking of API calls */
 /* --------------------- */
 #ifndef WINE_NO_DEBUG_MSGS
 #define checkGLcall(A)                                              \
 do {                                                                \
-    GLint err;                                                      \
-    if (!__WINE_IS_DEBUG_ON(_ERR, __wine_dbch___default)) break;    \
-    err = gl_info->gl_ops.gl.p_glGetError();                        \
-    if (err == GL_NO_ERROR) {                                       \
-       TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__);        \
-                                                                    \
-    } else do {                                                     \
-        ERR(">>>>>>>>>>>>>>>>> %s (%#x) from %s @ %s / %d\n",       \
-            debug_glerror(err), err, A, __FILE__, __LINE__);        \
-       err = gl_info->gl_ops.gl.p_glGetError();                     \
-    } while (err != GL_NO_ERROR);                                   \
+    if (__WINE_IS_DEBUG_ON(_ERR, &__wine_dbch_d3d)                  \
+            && !gl_info->supported[ARB_DEBUG_OUTPUT])               \
+        wined3d_check_gl_call(gl_info, __FILE__, __LINE__, A);      \
 } while(0)
 #else
 #define checkGLcall(A) do {} while(0)




More information about the wine-cvs mailing list