From 0533036083afb5077d1430ed6466ecbb57260da4 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 5 Jan 2024 16:03:07 +0100 Subject: [PATCH 01/10] mesa/main: remove stale prototypes Fixes: 88b6e46ee3c ("mesa: remove unused image debug code") --- src/mesa/main/debug.h | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index 64aaf176086..f2a63d40c54 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -41,37 +41,8 @@ struct gl_context; struct gl_texture_image; -extern void _mesa_print_enable_flags( const char *msg, GLuint flags ); extern void _mesa_print_state( const char *msg, GLuint state ); extern void _mesa_print_info( struct gl_context *ctx ); extern void _mesa_init_debug( struct gl_context *ctx ); -extern void -_mesa_write_renderbuffer_image(const struct gl_renderbuffer *rb); - -extern void -_mesa_dump_texture(GLuint texture, GLuint writeImages); - -extern void -_mesa_dump_textures(GLuint writeImages); - -extern void -_mesa_dump_renderbuffers(GLboolean writeImages); - -extern void -_mesa_dump_color_buffer(const char *filename); - -extern void -_mesa_dump_depth_buffer(const char *filename); - -extern void -_mesa_dump_stencil_buffer(const char *filename); - -extern void -_mesa_dump_image(const char *filename, const void *image, GLuint w, GLuint h, - GLenum format, GLenum type); - -extern void -_mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img); - #endif From d7c9c5419791a9d0c2dd983e60ee1f6240c4028d Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 23 Apr 2026 10:34:17 +0200 Subject: [PATCH 02/10] mesa/main: remove incorrect debug-output This message was incorrect from the time it was introduced; the function can return other error messages. If that happened in reality or not was a bit more unsure, but that's not a good reason to make a blanket statement like this. In either case, we do track properly now, and we have for a long time. The other, similar message in this function is correct. Fixes: 916bc4491a2 ("mesa: Implement proper tracking logic for glGetGraphicsResetStatusARB") --- src/mesa/main/robustness.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mesa/main/robustness.c b/src/mesa/main/robustness.c index 2b998448f53..3a7e50098e2 100644 --- a/src/mesa/main/robustness.c +++ b/src/mesa/main/robustness.c @@ -140,10 +140,5 @@ _mesa_GetGraphicsResetStatusARB( void ) if (status != GL_NO_ERROR) _mesa_set_context_lost_dispatch(ctx); - if (!ctx->Driver.GetGraphicsResetStatus && (MESA_VERBOSE & VERBOSE_API)) - _mesa_debug(ctx, - "glGetGraphicsResetStatusARB always returns GL_NO_ERROR " - "because the driver doesn't track reset status.\n"); - return status; } From 25a7539b4753b83ebee2db917f9e4da515222ca1 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 23 Apr 2026 10:53:09 +0200 Subject: [PATCH 03/10] mesa/main: do not gate performance warning This warning effectively warns users about needless calls to glGetGraphicsResetStatusARB(), which is nice. But it's currently gated behind the undocumented VERBOSE_API flag, which also prints a whole lot of API-call tracing, making this useful message drown in the noise. So let's instead make this use the _mesa_per_debug macro, which will notify applications through the appropriate channels (GL_KHR_debug), making it more likely to be picked up by developers. --- src/mesa/main/robustness.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/robustness.c b/src/mesa/main/robustness.c index 3a7e50098e2..81745d4fc0a 100644 --- a/src/mesa/main/robustness.c +++ b/src/mesa/main/robustness.c @@ -124,11 +124,10 @@ _mesa_GetGraphicsResetStatusARB( void ) * events, and GetGraphicsResetStatusARB will always return NO_ERROR." */ if (ctx->Const.ResetStrategy == GL_NO_RESET_NOTIFICATION_ARB) { - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "glGetGraphicsResetStatusARB always returns GL_NO_ERROR " - "because reset notifictation was not requested at context " - "creation.\n"); + _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_LOW, + "glGetGraphicsResetStatusARB always returns GL_NO_ERROR " + "because reset notifictation was not requested at context " + "creation.\n"); return GL_NO_ERROR; } From 61b5986c58b4c912d9c682e40d787f0ceec16481 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 5 Jan 2024 16:12:57 +0100 Subject: [PATCH 04/10] mesa/main: remove low-value debug-output This isn't very useful as-is for a few reasons: 1. It only does something in debug-builds, which is not what most users (or application developers) is using. 2. It's undocumented. 3. Most of the information printed here is trivial to figure out with tools like glxinfo. 4. It's missing output for platforms like x86-64 and ARM... So let's just axe this, it's unlikely anyone uses it. --- src/mesa/main/context.c | 9 --------- src/mesa/main/debug.c | 30 ------------------------------ src/mesa/main/debug.h | 1 - 3 files changed, 40 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 60a90e06758..05ad6daeaa1 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1408,15 +1408,6 @@ handle_first_current(struct gl_context *ctx) || (_mesa_is_desktop_gl_compat(ctx) && !is_forward_compatible_context)); } - - /* We can use this to help debug user's problems. Tell them to set - * the MESA_INFO env variable before running their app. Then the - * first time each context is made current we'll print some useful - * information. - */ - if (os_get_option("MESA_INFO")) { - _mesa_print_info(ctx); - } } /** diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index e800b4264e7..7d07a7d19ab 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -87,36 +87,6 @@ _mesa_print_state( const char *msg, GLuint state ) -/** - * Print information about this Mesa version and build options. - */ -void _mesa_print_info( struct gl_context *ctx ) -{ - _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", - (char *) _mesa_GetString(GL_VERSION)); - _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", - (char *) _mesa_GetString(GL_RENDERER)); - _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", - (char *) _mesa_GetString(GL_VENDOR)); - - /* use ctx as GL_EXTENSIONS will not work on 3.0 or higher - * core contexts. - */ - _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", ctx->Extensions.String); - -#if DETECT_ARCH_X86 - _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); -#else - _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); -#endif -#if DETECT_ARCH_SPARC64 - _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); -#else - _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); -#endif -} - - /** * Set verbose logging flags. When these flags are set, GL API calls * in the various categories will be printed to stderr. diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index f2a63d40c54..95caaf40811 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -42,7 +42,6 @@ struct gl_context; struct gl_texture_image; extern void _mesa_print_state( const char *msg, GLuint state ); -extern void _mesa_print_info( struct gl_context *ctx ); extern void _mesa_init_debug( struct gl_context *ctx ); #endif From 7e06dc274f0ec927f445f11ee1c403090e04f594 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 23 Apr 2026 11:07:37 +0200 Subject: [PATCH 05/10] mesa/main: remove unused verbose-flags Most of these flags are no longer used, so let's remove them. --- src/mesa/main/debug.c | 6 ------ src/mesa/main/mtypes.h | 18 +++++------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 7d07a7d19ab..8e30d9f78b6 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -101,17 +101,11 @@ set_verbose_flags(const char *str) GLbitfield flag; }; static const struct option opts[] = { - { "varray", VERBOSE_VARRAY }, { "tex", VERBOSE_TEXTURE }, { "mat", VERBOSE_MATERIAL }, - { "pipe", VERBOSE_PIPELINE }, - { "driver", VERBOSE_DRIVER }, { "state", VERBOSE_STATE }, { "api", VERBOSE_API }, { "list", VERBOSE_DISPLAY_LIST }, - { "lighting", VERBOSE_LIGHTING }, - { "disassem", VERBOSE_DISASSEM }, - { "swap", VERBOSE_SWAPBUFFERS } }; GLuint i; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f0ee58059ca..2fca622a31d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3670,19 +3670,11 @@ extern int MESA_DEBUG_FLAGS; /** The MESA_VERBOSE var is a bitmask of these flags */ enum _verbose { - VERBOSE_VARRAY = 0x0001, - VERBOSE_TEXTURE = 0x0002, - VERBOSE_MATERIAL = 0x0004, - VERBOSE_PIPELINE = 0x0008, - VERBOSE_DRIVER = 0x0010, - VERBOSE_STATE = 0x0020, - VERBOSE_API = 0x0040, - VERBOSE_DISPLAY_LIST = 0x0100, - VERBOSE_LIGHTING = 0x0200, - VERBOSE_PRIMS = 0x0400, - VERBOSE_VERTS = 0x0800, - VERBOSE_DISASSEM = 0x1000, - VERBOSE_SWAPBUFFERS = 0x4000 + VERBOSE_TEXTURE = 0x0001, + VERBOSE_MATERIAL = 0x0002, + VERBOSE_STATE = 0x0004, + VERBOSE_API = 0x0008, + VERBOSE_DISPLAY_LIST = 0x0010, }; From 3956b8550730f03b568bd82fe1d5a8c49c7fbb6a Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 5 Jan 2024 16:22:59 +0100 Subject: [PATCH 06/10] mesa/main: remove VERBOSE_API This feature has been left to bitrot for a long time, and no longer works consistently. Here's a few examples of things I found: - Lots of newer GL commands never implement these - It's very inconsistent what level of details about the command is logged: some print arguments, some print details about arguments, some print return-values, some print the function name, some print a slightly incorrect function name. - Interactions with GL_KHR_no_error is entirely random; some no-error functions report, and some does not. Realistically, this mechanism hasn't worked for a long time, and nobody seems to care. If a user wants to trace what OpenGL calls are done, we have tools like apitrace that are better suited for this purpose anyway. Let's just rip it out. Since VERBOSE_TEXTURE is just a subset of VERBOSE_API, rip that out as well. --- src/mesa/main/attrib.c | 3 -- src/mesa/main/blend.c | 42 ----------------------- src/mesa/main/blit.c | 17 ---------- src/mesa/main/bufferobj.c | 41 +---------------------- src/mesa/main/buffers.c | 7 ---- src/mesa/main/clear.c | 4 --- src/mesa/main/compute.c | 13 -------- src/mesa/main/conservativeraster.c | 4 --- src/mesa/main/context.c | 3 -- src/mesa/main/copyimage.c | 20 ----------- src/mesa/main/debug.c | 2 -- src/mesa/main/depth.c | 13 -------- src/mesa/main/dlist.c | 13 -------- src/mesa/main/drawpix.c | 21 ------------ src/mesa/main/enable.c | 6 ---- src/mesa/main/externalobjects.c | 15 --------- src/mesa/main/fbobject.c | 46 ------------------------- src/mesa/main/feedback.c | 3 -- src/mesa/main/getstring.c | 9 ----- src/mesa/main/hint.c | 5 --- src/mesa/main/light.c | 11 ------ src/mesa/main/lines.c | 7 ---- src/mesa/main/matrix.c | 32 ------------------ src/mesa/main/mtypes.h | 8 ++--- src/mesa/main/performance_monitor.c | 6 ---- src/mesa/main/pipelineobj.c | 36 -------------------- src/mesa/main/polygon.c | 26 --------------- src/mesa/main/program_resource.c | 33 ------------------ src/mesa/main/queryobj.c | 31 ----------------- src/mesa/main/readpix.c | 7 ---- src/mesa/main/samplerobj.c | 4 --- src/mesa/main/scissor.c | 11 ------ src/mesa/main/shaderapi.c | 19 ----------- src/mesa/main/stencil.c | 27 --------------- src/mesa/main/texenv.c | 7 ---- src/mesa/main/texgetimage.c | 17 ---------- src/mesa/main/teximage.c | 52 ----------------------------- src/mesa/main/texobj.c | 34 ------------------- src/mesa/main/texstate.c | 8 ----- src/mesa/main/texstorage.c | 12 ------- src/mesa/main/textureview.c | 6 ---- src/mesa/main/varray.c | 6 ---- src/mesa/main/viewport.c | 47 -------------------------- 43 files changed, 4 insertions(+), 730 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index a0ffaf5b123..b2d49c4fb29 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -91,9 +91,6 @@ _mesa_PushAttrib(GLbitfield mask) GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask); - if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) { _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushAttrib"); return; diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index eee73d9ee67..a1804d27016 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -317,15 +317,6 @@ _mesa_BlendFuncSeparate( GLenum sfactorRGB, GLenum dfactorRGB, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n", - _mesa_enum_to_string(sfactorRGB), - _mesa_enum_to_string(dfactorRGB), - _mesa_enum_to_string(sfactorA), - _mesa_enum_to_string(dfactorA)); - - - if (skip_blend_state_update(ctx, sfactorRGB, dfactorRGB, sfactorA, dfactorA)) return; @@ -528,10 +519,6 @@ _mesa_BlendEquation( GLenum mode ) bool changed = false; enum pipe_advanced_blend_mode advanced_mode = advanced_blend_mode(ctx, mode); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBlendEquation(%s)\n", - _mesa_enum_to_string(mode)); - if (ctx->Color._BlendEquationPerBuffer) { /* Check all per-buffer states */ for (buf = 0; buf < numBuffers; buf++) { @@ -609,10 +596,6 @@ _mesa_BlendEquationiARB(GLuint buf, GLenum mode) GET_CURRENT_CONTEXT(ctx); enum pipe_advanced_blend_mode advanced_mode = advanced_blend_mode(ctx, mode); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBlendEquationi(%u, %s)\n", - buf, _mesa_enum_to_string(mode)); - if (buf >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glBlendEquationi(buffer=%u)", buf); @@ -705,11 +688,6 @@ _mesa_BlendEquationSeparate(GLenum modeRGB, GLenum modeA) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBlendEquationSeparateEXT(%s %s)\n", - _mesa_enum_to_string(modeRGB), - _mesa_enum_to_string(modeA)); - blend_equation_separate(ctx, modeRGB, modeA, false); } @@ -765,11 +743,6 @@ _mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBlendEquationSeparatei(%u, %s %s)\n", buf, - _mesa_enum_to_string(modeRGB), - _mesa_enum_to_string(modeA)); - if (buf >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glBlendEquationSeparatei(buffer=%u)", buf); @@ -834,10 +807,6 @@ _mesa_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glAlphaFunc(%s, %f)\n", - _mesa_enum_to_string(func), ref); - if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRefUnclamped == ref) return; /* no change */ @@ -936,9 +905,6 @@ _mesa_LogicOp( GLenum opcode ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glLogicOp(%s)\n", _mesa_enum_to_string(opcode)); - logic_op(ctx, opcode, false); } @@ -985,10 +951,6 @@ _mesa_ColorMask( GLboolean red, GLboolean green, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glColorMask(%d, %d, %d, %d)\n", - red, green, blue, alpha); - GLbitfield mask = (!!red) | ((!!green) << 1) | ((!!blue) << 2) | @@ -1014,10 +976,6 @@ _mesa_ColorMaski(GLuint buf, GLboolean red, GLboolean green, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glColorMaski %u %d %d %d %d\n", - buf, red, green, blue, alpha); - if (buf >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glColorMaski(buf=%u)", buf); return; diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c index e8833d39e37..37f9d862773 100644 --- a/src/mesa/main/blit.c +++ b/src/mesa/main/blit.c @@ -910,14 +910,6 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "glBlitFramebuffer(%d, %d, %d, %d, " - " %d, %d, %d, %d, 0x%x, %s)\n", - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, _mesa_enum_to_string(filter)); - blit_framebuffer_err(ctx, ctx->ReadBuffer, ctx->DrawBuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, @@ -1001,15 +993,6 @@ _mesa_BlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "glBlitNamedFramebuffer(%u %u %d, %d, %d, %d, " - " %d, %d, %d, %d, 0x%x, %s)\n", - readFramebuffer, drawFramebuffer, - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, _mesa_enum_to_string(filter)); - blit_named_framebuffer(ctx, readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 0e995508852..8bf81561a6b 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1527,11 +1527,6 @@ _mesa_BindBuffer(GLenum target, GLuint buffer) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glBindBuffer(%s, %u)\n", - _mesa_enum_to_string(target), buffer); - } - struct gl_buffer_object **bindTarget = get_buffer_target(ctx, target, false); if (!bindTarget) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target %s)", @@ -1995,12 +1990,8 @@ create_buffers(struct gl_context *ctx, GLsizei n, GLuint *buffers, bool dsa) static void create_buffers_err(struct gl_context *ctx, GLsizei n, GLuint *buffers, bool dsa) { - const char *func = dsa ? "glCreateBuffers" : "glGenBuffers"; - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%d)\n", func, n); - if (n < 0) { + const char *func = dsa ? "glCreateBuffers" : "glGenBuffers"; _mesa_error(ctx, GL_INVALID_VALUE, "%s(n %d < 0)", func, n); return; } @@ -2337,14 +2328,6 @@ buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj, { bool valid_usage; - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "%s(%s, %ld, %p, %s)\n", - func, - _mesa_enum_to_string(target), - (long int) size, data, - _mesa_enum_to_string(usage)); - } - if (!no_error) { if (size < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", func); @@ -4877,12 +4860,6 @@ bind_buffer_range(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glBindBufferRange(%s, %u, %u, %lu, %lu)\n", - _mesa_enum_to_string(target), index, buffer, - (unsigned long) offset, (unsigned long) size); - } - if (buffer == 0) { bufObj = NULL; } else { @@ -4970,11 +4947,6 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glBindBufferBase(%s, %u, %u)\n", - _mesa_enum_to_string(target), index, buffer); - } - if (buffer == 0) { bufObj = NULL; } else { @@ -5038,12 +5010,6 @@ _mesa_BindBuffersRange(GLenum target, GLuint first, GLsizei count, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glBindBuffersRange(%s, %u, %d, %p, %p, %p)\n", - _mesa_enum_to_string(target), first, count, - buffers, offsets, sizes); - } - switch (target) { case GL_TRANSFORM_FEEDBACK_BUFFER: bind_xfb_buffers(ctx, first, count, buffers, true, offsets, sizes, @@ -5074,11 +5040,6 @@ _mesa_BindBuffersBase(GLenum target, GLuint first, GLsizei count, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glBindBuffersBase(%s, %u, %d, %p)\n", - _mesa_enum_to_string(target), first, count, buffers); - } - switch (target) { case GL_TRANSFORM_FEEDBACK_BUFFER: bind_xfb_buffers(ctx, first, count, buffers, false, NULL, NULL, diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index a6c11300939..de95346df1b 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -291,10 +291,6 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "%s %s\n", caller, _mesa_enum_to_string(buffer)); - } - if (buffer == GL_NONE) { destMask = 0x0; } @@ -941,9 +937,6 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, FLUSH_VERTICES(ctx, 0, GL_PIXEL_MODE_BIT); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s %s\n", caller, _mesa_enum_to_string(buffer)); - if (buffer == GL_NONE) { /* This is legal--it means that no buffer should be bound for reading. */ srcBuffer = BUFFER_NONE; diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index bb604224c9d..0edb9021e48 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -238,10 +238,6 @@ void GLAPIENTRY _mesa_Clear(GLbitfield mask) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glClear 0x%x\n", mask); - clear(ctx, mask, false); } diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c index ccbe2e475ae..867768c641a 100644 --- a/src/mesa/main/compute.c +++ b/src/mesa/main/compute.c @@ -309,10 +309,6 @@ dispatch_compute(GLuint num_groups_x, GLuint num_groups_y, FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDispatchCompute(%d, %d, %d)\n", - num_groups_x, num_groups_y, num_groups_z); - info.grid[0] = num_groups_x; info.grid[1] = num_groups_y; info.grid[2] = num_groups_z; @@ -358,9 +354,6 @@ dispatch_compute_indirect(GLintptr indirect, bool no_error) FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDispatchComputeIndirect(%ld)\n", (long) indirect); - if (!no_error && !valid_dispatch_indirect(ctx, indirect)) return; @@ -402,12 +395,6 @@ dispatch_compute_group_size(GLuint num_groups_x, GLuint num_groups_y, GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "glDispatchComputeGroupSizeARB(%d, %d, %d, %d, %d, %d)\n", - num_groups_x, num_groups_y, num_groups_z, - group_size_x, group_size_y, group_size_z); - struct pipe_grid_info info = { 0 }; info.grid[0] = num_groups_x; info.grid[1] = num_groups_y; diff --git a/src/mesa/main/conservativeraster.c b/src/mesa/main/conservativeraster.c index bc1788a968d..55cd6c017bc 100644 --- a/src/mesa/main/conservativeraster.c +++ b/src/mesa/main/conservativeraster.c @@ -47,10 +47,6 @@ conservative_raster_parameter(GLenum pname, GLfloat param, return; } - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%s, %g)\n", - func, _mesa_enum_to_string(pname), param); - ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 05ad6daeaa1..9c0d7bd6a6e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1431,9 +1431,6 @@ _mesa_make_current( struct gl_context *newCtx, { GET_CURRENT_CONTEXT(curCtx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(newCtx, "_mesa_make_current()\n"); - /* Check that the context's and framebuffer's visuals are compatible. */ if (newCtx && drawBuffer && newCtx->WinSysDrawBuffer != drawBuffer) { diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c index d750c44675f..b564edaf9a6 100644 --- a/src/mesa/main/copyimage.c +++ b/src/mesa/main/copyimage.c @@ -633,16 +633,6 @@ _mesa_CopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLuint src_num_samples, dst_num_samples; int dstWidth, dstHeight, dstDepth; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCopyImageSubData(%u, %s, %d, %d, %d, %d, " - "%u, %s, %d, %d, %d, %d, " - "%d, %d, %d)\n", - srcName, _mesa_enum_to_string(srcTarget), srcLevel, - srcX, srcY, srcZ, - dstName, _mesa_enum_to_string(dstTarget), dstLevel, - dstX, dstY, dstZ, - srcWidth, srcHeight, srcDepth); - if (!ctx->Extensions.ARB_copy_image) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyImageSubData(extension not available)"); @@ -791,16 +781,6 @@ _mesa_CopyImageSubDataNV(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLuint src_bw, src_bh, dst_bw, dst_bh; GLuint src_num_samples, dst_num_samples; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCopyImageSubDataNV(%u, %s, %d, %d, %d, %d, " - "%u, %s, %d, %d, %d, %d, " - "%d, %d, %d)\n", - srcName, _mesa_enum_to_string(srcTarget), srcLevel, - srcX, srcY, srcZ, - dstName, _mesa_enum_to_string(dstTarget), dstLevel, - dstX, dstY, dstZ, - srcWidth, srcHeight, srcDepth); - if (!ctx->Extensions.NV_copy_image) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyImageSubDataNV(extension not available)"); diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 8e30d9f78b6..d15614e055b 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -101,10 +101,8 @@ set_verbose_flags(const char *str) GLbitfield flag; }; static const struct option opts[] = { - { "tex", VERBOSE_TEXTURE }, { "mat", VERBOSE_MATERIAL }, { "state", VERBOSE_STATE }, - { "api", VERBOSE_API }, { "list", VERBOSE_DISPLAY_LIST }, }; GLuint i; diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 2a926f4e290..e501097e6ca 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -46,9 +46,6 @@ _mesa_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glClearDepth(%f)\n", depth); - ctx->PopAttribState |= GL_DEPTH_BUFFER_BIT; ctx->Depth.Clear = CLAMP( depth, 0.0, 1.0 ); } @@ -103,10 +100,6 @@ void GLAPIENTRY _mesa_DepthFunc(GLenum func) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_enum_to_string(func)); - depth_func(ctx, func, false); } @@ -117,9 +110,6 @@ _mesa_DepthMask( GLboolean flag ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDepthMask %d\n", flag); - /* * GL_TRUE indicates depth buffer writing is enabled (default) * GL_FALSE indicates depth buffer writing is disabled @@ -143,9 +133,6 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDepthBounds(%f, %f)\n", zmin, zmax); - if (zmin > zmax) { _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > zmax)"); return; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index b47c8673920..fcae7ab7f2a 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -13170,10 +13170,6 @@ _mesa_NewList(GLuint name, GLenum mode) FLUSH_CURRENT(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glNewList %u %s\n", name, - _mesa_enum_to_string(mode)); - if (name == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glNewList"); return; @@ -13329,9 +13325,6 @@ _mesa_EndList(void) SAVE_FLUSH_VERTICES(ctx); FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glEndList\n"); - if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList() called inside glBegin/End"); @@ -13443,9 +13436,6 @@ _mesa_CallList(GLuint list) GET_CURRENT_CONTEXT(ctx); FLUSH_CURRENT(ctx, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCallList %d\n", list); - if (list == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)"); return; @@ -13487,9 +13477,6 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) GET_CURRENT_CONTEXT(ctx); GLboolean save_compile_flag; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCallLists %d\n", n); - if (type < GL_BYTE || type > GL_4_BYTES) { _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); return; diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index e9362829f70..bc32ed8780d 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -54,17 +54,6 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDrawPixels(%d, %d, %s, %s, %p) // to %s at %ld, %ld\n", - width, height, - _mesa_enum_to_string(format), - _mesa_enum_to_string(type), - pixels, - _mesa_enum_to_string(ctx->DrawBuffer->ColorDrawBuffer[0]), - lroundf(ctx->Current.RasterPos[0]), - lroundf(ctx->Current.RasterPos[1])); - - if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glDrawPixels(width or height < 0)" ); return; @@ -203,16 +192,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "glCopyPixels(%d, %d, %d, %d, %s) // from %s to %s at %ld, %ld\n", - srcx, srcy, width, height, - _mesa_enum_to_string(type), - _mesa_enum_to_string(ctx->ReadBuffer->ColorReadBuffer), - _mesa_enum_to_string(ctx->DrawBuffer->ColorDrawBuffer[0]), - lroundf(ctx->Current.RasterPos[0]), - lroundf(ctx->Current.RasterPos[1])); - if (width < 0 || height < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyPixels(width or height < 0)"); return; diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 088c06ecafd..f9343eaf5bd 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -483,12 +483,6 @@ _mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state) void _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) { - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s %s (newstate is %x)\n", - state ? "glEnable" : "glDisable", - _mesa_enum_to_string(cap), - ctx->NewState); - switch (cap) { case GL_ALPHA_TEST: if (!_mesa_is_desktop_gl_compat(ctx) && !_mesa_is_gles1(ctx)) diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c index f4f49df1a84..7fdd4e3bcb1 100644 --- a/src/mesa/main/externalobjects.c +++ b/src/mesa/main/externalobjects.c @@ -129,11 +129,6 @@ _mesa_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API)) { - _mesa_debug(ctx, "glDeleteMemoryObjectsEXT(%d, %p)\n", n, - memoryObjects); - } - if (!_mesa_has_EXT_memory_object(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteMemoryObjectsEXT(unsupported)"); @@ -188,9 +183,6 @@ _mesa_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects) const char *func = "glCreateMemoryObjectsEXT"; - if (MESA_VERBOSE & (VERBOSE_API)) - _mesa_debug(ctx, "%s(%d, %p)\n", func, n, memoryObjects); - if (!_mesa_has_EXT_memory_object(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); return; @@ -785,9 +777,6 @@ create_semaphores(GLsizei n, GLuint *semaphores, bool NV) const char *func = NV ? "glCreateSemaphoresNV" : "glGenSemaphoresEXT"; - if (MESA_VERBOSE & (VERBOSE_API)) - _mesa_debug(ctx, "%s(%d, %p)\n", func, n, semaphores); - if (NV ? !_mesa_has_NV_timeline_semaphore(ctx) : !_mesa_has_EXT_semaphore(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); return; @@ -831,10 +820,6 @@ _mesa_DeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores) const char *func = "glDeleteSemaphoresEXT"; - if (MESA_VERBOSE & (VERBOSE_API)) { - _mesa_debug(ctx, "%s(%d, %p)\n", func, n, semaphores); - } - if (!_mesa_has_EXT_semaphore(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); return; diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 5de8acbc37a..4f2ccc9f678 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2908,19 +2908,6 @@ renderbuffer_storage_named(GLuint renderbuffer, GLenum internalFormat, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - if (samples == NO_SAMPLES) - _mesa_debug(ctx, "%s(%u, %s, %d, %d)\n", - func, renderbuffer, - _mesa_enum_to_string(internalFormat), - width, height); - else - _mesa_debug(ctx, "%s(%u, %s, %d, %d, %d)\n", - func, renderbuffer, - _mesa_enum_to_string(internalFormat), - width, height, samples); - } - struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer); if (!rb || rb == &DummyRenderbuffer) { /* ID was reserved, but no real renderbuffer object made yet */ @@ -2945,21 +2932,6 @@ renderbuffer_storage_target(GLenum target, GLenum internalFormat, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - if (samples == NO_SAMPLES) - _mesa_debug(ctx, "%s(%s, %s, %d, %d)\n", - func, - _mesa_enum_to_string(target), - _mesa_enum_to_string(internalFormat), - width, height); - else - _mesa_debug(ctx, "%s(%s, %s, %d, %d, %d)\n", - func, - _mesa_enum_to_string(target), - _mesa_enum_to_string(internalFormat), - width, height, samples); - } - if (target != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func); return; @@ -3338,12 +3310,6 @@ bind_framebuffer(GLenum target, GLuint framebuffer) GLboolean bindReadBuf, bindDrawBuf; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "glBindFramebuffer(%s, %u)\n", - _mesa_enum_to_string(target), - framebuffer); - switch (target) { case GL_DRAW_FRAMEBUFFER_EXT: bindDrawBuf = GL_TRUE; @@ -3644,10 +3610,6 @@ _mesa_CheckFramebufferStatus(GLenum target) struct gl_framebuffer *fb; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCheckFramebufferStatus(%s)\n", - _mesa_enum_to_string(target)); - fb = get_framebuffer_target(ctx, target); if (!fb) { _mesa_error(ctx, GL_INVALID_ENUM, @@ -5836,14 +5798,6 @@ _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments, struct gl_framebuffer *fb; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - for (unsigned i = 0; i < numAttachments; i++) - _mesa_debug(ctx, - "glInvalidateFramebuffer(%s, %s)\n", - _mesa_enum_to_string(target), - _mesa_enum_to_string(attachments[i])); - } - fb = get_framebuffer_target(ctx, target); if (!fb) { _mesa_error(ctx, GL_INVALID_ENUM, diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 8d8d02206b2..1c94611de54 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -573,9 +573,6 @@ _mesa_RenderMode( GLenum mode ) GLint result; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glRenderMode %s\n", _mesa_enum_to_string(mode)); - FLUSH_VERTICES(ctx, _NEW_RENDERMODE | _NEW_FF_VERT_PROGRAM | _NEW_FF_FRAG_PROGRAM, 0); diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index f9b0d88ed6e..1fb121c7dc7 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -249,9 +249,6 @@ _get_vao_pointerv(GLenum pname, struct gl_vertex_array_object* vao, if (!params) return; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s %s\n", callerstr, _mesa_enum_to_string(pname)); - switch (pname) { case GL_VERTEX_ARRAY_POINTER: if (!_mesa_is_desktop_gl_compat(ctx) && !_mesa_is_gles1(ctx)) @@ -361,9 +358,6 @@ _mesa_GetPointerIndexedvEXT( GLenum pname, GLuint index, GLvoid **params ) if (!params) return; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s %s\n", "glGetPointerIndexedvEXT", _mesa_enum_to_string(pname)); - switch (pname) { case GL_TEXTURE_COORD_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(index)].Ptr; @@ -403,9 +397,6 @@ _mesa_GetError( void ) e = GL_NO_ERROR; } - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_enum_to_string(e)); - ctx->ErrorValue = (GLenum) GL_NO_ERROR; ctx->ErrorDebugCount = 0; return e; diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index b57742ea9a7..014106c7674 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -39,11 +39,6 @@ _mesa_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glHint %s %s\n", - _mesa_enum_to_string(target), - _mesa_enum_to_string(mode)); - if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); return; diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 3368681d08d..7ebf28014d3 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -41,9 +41,6 @@ _mesa_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glShadeModel %s\n", _mesa_enum_to_string(mode)); - if (ctx->Light.ShadeModel == mode) return; @@ -67,9 +64,6 @@ _mesa_ProvokingVertex(GLenum mode) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glProvokingVertexEXT 0x%x\n", mode); - if (ctx->Light.ProvokingVertex == mode) return; @@ -791,11 +785,6 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE | MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT); - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glColorMaterial %s %s\n", - _mesa_enum_to_string(face), - _mesa_enum_to_string(mode)); - bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial"); if (bitmask == 0) return; /* error was recorded */ diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index 54b6cc2da36..bff06e6def9 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -87,10 +87,6 @@ void GLAPIENTRY _mesa_LineWidth(GLfloat width) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glLineWidth %f\n", width); - line_width(ctx, width, false); } @@ -112,9 +108,6 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glLineStipple %d %u\n", factor, pattern); - factor = CLAMP( factor, 1, 256 ); if (ctx->Line.StippleFactor == factor && diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index f8782b57054..8e771f77f24 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -186,10 +186,6 @@ matrix_ortho(struct gl_matrix_stack* stack, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%f, %f, %f, %f, %f, %f)\n", caller, - left, right, bottom, top, nearval, farval); - if (left == right || bottom == top || nearval == farval) @@ -350,10 +346,6 @@ _mesa_PushMatrix( void ) GET_CURRENT_CONTEXT(ctx); struct gl_matrix_stack *stack = ctx->CurrentStack; - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glPushMatrix %s\n", - _mesa_enum_to_string(ctx->Transform.MatrixMode)); - push_matrix(ctx, stack, ctx->Transform.MatrixMode, "glPushMatrix"); } @@ -409,10 +401,6 @@ _mesa_PopMatrix( void ) GET_CURRENT_CONTEXT(ctx); struct gl_matrix_stack *stack = ctx->CurrentStack; - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glPopMatrix %s\n", - _mesa_enum_to_string(ctx->Transform.MatrixMode)); - if (!pop_matrix(ctx, stack)) { if (ctx->Transform.MatrixMode == GL_TEXTURE) { _mesa_error(ctx, GL_STACK_UNDERFLOW, @@ -475,9 +463,6 @@ _mesa_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glLoadIdentity()\n"); - _mesa_load_identity_matrix(ctx, ctx->CurrentStack); } @@ -513,14 +498,6 @@ matrix_load(struct gl_context *ctx, struct gl_matrix_stack *stack, const GLfloat *m, const char* caller) { if (!m) return; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "%s(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", - caller, - m[0], m[4], m[8], m[12], - m[1], m[5], m[9], m[13], - m[2], m[6], m[10], m[14], - m[3], m[7], m[11], m[15]); _mesa_load_matrix(ctx, stack, m); } @@ -575,15 +552,6 @@ matrix_mult(struct gl_matrix_stack *stack, const GLfloat *m, const char* caller) if (!m || (!ctx->GLThread.enabled && _mesa_matrix_is_identity(m))) return; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "%s(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", - caller, - m[0], m[4], m[8], m[12], - m[1], m[5], m[9], m[13], - m[2], m[6], m[10], m[14], - m[3], m[7], m[11], m[15]); - FLUSH_VERTICES(ctx, 0, 0); _math_matrix_mul_floats(stack->Top, m); stack->ChangedSincePush = true; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2fca622a31d..8d172b2523e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3670,11 +3670,9 @@ extern int MESA_DEBUG_FLAGS; /** The MESA_VERBOSE var is a bitmask of these flags */ enum _verbose { - VERBOSE_TEXTURE = 0x0001, - VERBOSE_MATERIAL = 0x0002, - VERBOSE_STATE = 0x0004, - VERBOSE_API = 0x0008, - VERBOSE_DISPLAY_LIST = 0x0010, + VERBOSE_MATERIAL = 0x0001, + VERBOSE_STATE = 0x0002, + VERBOSE_DISPLAY_LIST = 0x0004, }; diff --git a/src/mesa/main/performance_monitor.c b/src/mesa/main/performance_monitor.c index e1d0f88d336..84e69132d21 100644 --- a/src/mesa/main/performance_monitor.c +++ b/src/mesa/main/performance_monitor.c @@ -720,9 +720,6 @@ _mesa_GenPerfMonitorsAMD(GLsizei n, GLuint *monitors) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glGenPerfMonitorsAMD(%d)\n", n); - init_groups(ctx); if (n < 0) { @@ -756,9 +753,6 @@ _mesa_DeletePerfMonitorsAMD(GLsizei n, GLuint *monitors) GLint i; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDeletePerfMonitorsAMD(%d)\n", n); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeletePerfMonitorsAMD(n < 0)"); return; diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index e93d9fcd270..201cd7ab178 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -295,10 +295,6 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) struct gl_shader_program *shProg = NULL; GLbitfield any_valid_stages; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glUseProgramStages(%u, 0x%x, %u)\n", - pipeline, stages, program); - if (!pipe) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUseProgramStages(pipeline)"); return; @@ -435,10 +431,6 @@ void GLAPIENTRY _mesa_ActiveShaderProgram(GLuint pipeline, GLuint program) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glActiveShaderProgram(%u, %u)\n", pipeline, program); - active_shader_program(ctx, pipeline, program, false); } @@ -447,9 +439,6 @@ bind_program_pipeline(struct gl_context *ctx, GLuint pipeline, bool no_error) { struct gl_pipeline_object *newObj = NULL; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBindProgramPipeline(%u)\n", pipeline); - /* Rebinding the same pipeline object: no change. */ if (ctx->_Shader->Name == pipeline) @@ -563,9 +552,6 @@ _mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines) GET_CURRENT_CONTEXT(ctx); GLsizei i; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDeleteProgramPipelines(%d, %p)\n", n, pipelines); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteProgramPipelines(n<0)"); return; @@ -658,10 +644,6 @@ void GLAPIENTRY _mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glGenProgramPipelines(%d, %p)\n", n, pipelines); - create_program_pipelines_err(ctx, n, pipelines, false); } @@ -676,10 +658,6 @@ void GLAPIENTRY _mesa_CreateProgramPipelines(GLsizei n, GLuint *pipelines) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCreateProgramPipelines(%d, %p)\n", n, pipelines); - create_program_pipelines_err(ctx, n, pipelines, true); } @@ -695,9 +673,6 @@ _mesa_IsProgramPipeline(GLuint pipeline) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glIsProgramPipeline(%u)\n", pipeline); - struct gl_pipeline_object *obj = _mesa_lookup_pipeline_object(ctx, pipeline); if (obj == NULL) return GL_FALSE; @@ -714,10 +689,6 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) GET_CURRENT_CONTEXT(ctx); struct gl_pipeline_object *pipe = _mesa_lookup_pipeline_object(ctx, pipeline); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glGetProgramPipelineiv(%u, %d, %p)\n", - pipeline, pname, params); - /* Are geometry shaders available in this context? */ const bool has_gs = _mesa_has_geometry_shaders(ctx); @@ -1051,9 +1022,6 @@ _mesa_ValidateProgramPipeline(GLuint pipeline) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glValidateProgramPipeline(%u)\n", pipeline); - struct gl_pipeline_object *pipe = _mesa_lookup_pipeline_object(ctx, pipeline); if (!pipe) { @@ -1072,10 +1040,6 @@ _mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glGetProgramPipelineInfoLog(%u, %d, %p, %p)\n", - pipeline, bufSize, length, infoLog); - struct gl_pipeline_object *pipe = _mesa_lookup_pipeline_object(ctx, pipeline); if (!pipe) { diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index b4572c6e04b..9617867b9a1 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -86,10 +86,6 @@ void GLAPIENTRY _mesa_CullFace(GLenum mode) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCullFace %s\n", _mesa_enum_to_string(mode)); - cull_face(ctx, mode, false); } @@ -135,10 +131,6 @@ void GLAPIENTRY _mesa_FrontFace(GLenum mode) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glFrontFace %s\n", _mesa_enum_to_string(mode)); - front_face(ctx, mode, false); } @@ -162,11 +154,6 @@ polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error) ctx->Polygon.FrontMode == GL_FILL_RECTANGLE_NV || ctx->Polygon.BackMode == GL_FILL_RECTANGLE_NV; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glPolygonMode %s %s\n", - _mesa_enum_to_string(face), - _mesa_enum_to_string(mode)); - if (!no_error) { switch (mode) { case GL_POINT: @@ -256,9 +243,6 @@ _mesa_PolygonStipple(const GLubyte *pattern) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glPolygonStipple\n"); - FLUSH_VERTICES(ctx, 0, GL_POLYGON_STIPPLE_BIT); ST_SET_STATE(ctx->NewDriverState, ST_NEW_POLY_STIPPLE); @@ -284,9 +268,6 @@ _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glGetPolygonStipple\n"); - if (ctx->Pack.BufferObj) ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER; @@ -330,10 +311,6 @@ void GLAPIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); - _mesa_polygon_offset_clamp(ctx, factor, units, 0.0); } @@ -348,9 +325,6 @@ _mesa_PolygonOffsetClampEXT( GLfloat factor, GLfloat units, GLfloat clamp ) return; } - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glPolygonOffsetClamp %f %f %f\n", factor, units, clamp); - _mesa_polygon_offset_clamp(ctx, factor, units, clamp); } diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index 10aec2969b3..0f80ff87aef 100644 --- a/src/mesa/main/program_resource.c +++ b/src/mesa/main/program_resource.c @@ -95,12 +95,6 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glGetProgramInterfaceiv(%u, %s, %s, %p)\n", - program, _mesa_enum_to_string(programInterface), - _mesa_enum_to_string(pname), params); - } - struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramInterfaceiv"); @@ -152,11 +146,6 @@ _mesa_GetProgramResourceIndex(GLuint program, GLenum programInterface, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glGetProgramResourceIndex(%u, %s, %s)\n", - program, _mesa_enum_to_string(programInterface), name); - } - unsigned array_index = 0; struct gl_program_resource *res; struct gl_shader_program *shProg = @@ -227,12 +216,6 @@ _mesa_GetProgramResourceName(GLuint program, GLenum programInterface, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glGetProgramResourceName(%u, %s, %u, %d, %p, %p)\n", - program, _mesa_enum_to_string(programInterface), index, - bufSize, length, name); - } - struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramResourceName"); @@ -261,12 +244,6 @@ _mesa_GetProgramResourceiv(GLuint program, GLenum programInterface, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glGetProgramResourceiv(%u, %s, %u, %d, %p, %d, %p, %p)\n", - program, _mesa_enum_to_string(programInterface), index, - propCount, props, bufSize, length, params); - } - struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramResourceiv"); @@ -292,11 +269,6 @@ _mesa_GetProgramResourceLocation(GLuint program, GLenum programInterface, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glGetProgramResourceLocation(%u, %s, %s)\n", - program, _mesa_enum_to_string(programInterface), name); - } - struct gl_shader_program *shProg = lookup_linked_program(program, "glGetProgramResourceLocation"); @@ -353,11 +325,6 @@ _mesa_GetProgramResourceLocationIndex(GLuint program, GLenum programInterface, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) { - _mesa_debug(ctx, "glGetProgramResourceLocationIndex(%u, %s, %s)\n", - program, _mesa_enum_to_string(programInterface), name); - } - struct gl_shader_program *shProg = lookup_linked_program(program, "glGetProgramResourceLocationIndex"); diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 82aff2c1afd..0c1771423dc 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -613,9 +613,6 @@ create_queries(struct gl_context *ctx, GLenum target, GLsizei n, GLuint *ids, { const char *func = dsa ? "glGenQueries" : "glCreateQueries"; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%d)\n", func, n); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func); return; @@ -667,9 +664,6 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids) GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDeleteQueries(%d)\n", n); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)"); return; @@ -705,9 +699,6 @@ _mesa_IsQuery(GLuint id) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glIsQuery(%u)\n", id); - if (id == 0) return GL_FALSE; @@ -746,10 +737,6 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id) struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBeginQueryIndexed(%s, %u, %u)\n", - _mesa_enum_to_string(target), index, id); - if (!query_error_check_index(ctx, target, index)) return; @@ -852,10 +839,6 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index) struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glEndQueryIndexed(%s, %u)\n", - _mesa_enum_to_string(target), index); - if (!query_error_check_index(ctx, target, index)) return; @@ -909,10 +892,6 @@ _mesa_QueryCounter(GLuint id, GLenum target) struct gl_query_object *q; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glQueryCounter(%u, %s)\n", id, - _mesa_enum_to_string(target)); - /* error checking */ if (target != GL_TIMESTAMP) { _mesa_error(ctx, GL_INVALID_ENUM, "glQueryCounter(target)"); @@ -980,12 +959,6 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname, struct gl_query_object *q = NULL, **bindpt = NULL; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glGetQueryIndexediv(%s, %u, %s)\n", - _mesa_enum_to_string(target), - index, - _mesa_enum_to_string(pname)); - if (!query_error_check_index(ctx, target, index)) return; @@ -1136,10 +1109,6 @@ get_query_object(struct gl_context *ctx, const char *func, struct gl_query_object *q = NULL; uint64_t value; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%u, %s)\n", func, id, - _mesa_enum_to_string(pname)); - if (id) q = _mesa_lookup_query_object(ctx, id); diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index a26719a519b..8aa55aa3691 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -1055,13 +1055,6 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glReadPixels(%d, %d, %s, %s, %p)\n", - width, height, - _mesa_enum_to_string(format), - _mesa_enum_to_string(type), - pixels); - if (!no_error && (width < 0 || height < 0)) { _mesa_error( ctx, GL_INVALID_VALUE, "glReadPixels(width=%d height=%d)", width, height ); diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 87bab4a61b8..e69416a4cf1 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -202,10 +202,6 @@ static void create_samplers_err(struct gl_context *ctx, GLsizei count, GLuint *samplers, const char *caller) { - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%d)\n", caller, count); - if (count < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", caller); return; diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c index 6f10f56afc8..b5abb64573f 100644 --- a/src/mesa/main/scissor.c +++ b/src/mesa/main/scissor.c @@ -96,9 +96,6 @@ _mesa_Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); - if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); return; @@ -200,10 +197,6 @@ scissor_indexed_err(struct gl_context *ctx, GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height, const char *function) { - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%d, %d, %d, %d, %d)\n", - function, index, left, bottom, width, height); - if (index >= ctx->Const.MaxViewports) { _mesa_error(ctx, GL_INVALID_VALUE, "%s: index (%d) >= MaxViewports (%d)", @@ -260,10 +253,6 @@ _mesa_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box) struct gl_scissor_rect newval[MAX_WINDOW_RECTANGLES]; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glWindowRectanglesEXT(%s, %d, %p)\n", - _mesa_enum_to_string(mode), count, box); - if (mode != GL_INCLUSIVE_EXT && mode != GL_EXCLUSIVE_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glWindowRectanglesEXT(invalid mode 0x%x)", mode); diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index eabd22430b2..06b6a709ef1 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1656,8 +1656,6 @@ void GLAPIENTRY _mesa_CompileShader(GLuint shaderObj) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCompileShader %u\n", shaderObj); _mesa_compile_shader(ctx, _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader")); } @@ -1675,10 +1673,6 @@ GLuint GLAPIENTRY _mesa_CreateShader(GLenum type) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCreateShader %s\n", _mesa_enum_to_string(type)); - return create_shader_err(ctx, type, "glCreateShader"); } @@ -1703,8 +1697,6 @@ GLuint GLAPIENTRY _mesa_CreateProgram(void) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glCreateProgram\n"); return create_shader_program(ctx); } @@ -1720,11 +1712,6 @@ _mesa_CreateProgramObjectARB(void) void GLAPIENTRY _mesa_DeleteObjectARB(GLhandleARB obj) { - if (MESA_VERBOSE & VERBOSE_API) { - GET_CURRENT_CONTEXT(ctx); - _mesa_debug(ctx, "glDeleteObjectARB(%lu)\n", (unsigned long)obj); - } - if (obj) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0, 0); @@ -1950,9 +1937,6 @@ _mesa_LinkProgram(GLuint programObj) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glLinkProgram %u\n", programObj); - struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, programObj, "glLinkProgram"); link_program_error(ctx, shProg); @@ -2221,9 +2205,6 @@ use_program(GLuint program, bool no_error) GET_CURRENT_CONTEXT(ctx); struct gl_shader_program *shProg = NULL; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glUseProgram %u\n", program); - if (no_error) { if (program) { shProg = _mesa_lookup_shader_program(ctx, program); diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 4e2c64f1063..4929ee70541 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -111,9 +111,6 @@ _mesa_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glClearStencil(%d)\n", s); - ctx->PopAttribState |= GL_STENCIL_BUFFER_BIT; ctx->Stencil.Clear = (GLuint) s; } @@ -138,9 +135,6 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilFuncSeparateATI()\n"); - if (!validate_stencil_func(ctx, frontfunc)) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI(frontfunc)"); @@ -229,9 +223,6 @@ _mesa_StencilFunc(GLenum func, GLint ref, GLuint mask) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilFunc()\n"); - if (!validate_stencil_func(ctx, func)) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFunc(func)"); return; @@ -258,9 +249,6 @@ _mesa_StencilMask( GLuint mask ) GET_CURRENT_CONTEXT(ctx); const GLint face = ctx->Stencil.ActiveFace; - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilMask(0x%x)\n", mask); - if (face != 0) { /* Only modify the EXT_stencil_two_side back-face state. */ @@ -344,9 +332,6 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilOp()\n"); - if (!validate_stencil_op(ctx, fail)) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)"); return; @@ -372,9 +357,6 @@ _mesa_ActiveStencilFaceEXT(GLenum face) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glActiveStencilFaceEXT()\n"); - if (!ctx->Extensions.EXT_stencil_two_side) { _mesa_error(ctx, GL_INVALID_OPERATION, "glActiveStencilFaceEXT"); return; @@ -435,9 +417,6 @@ _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilOpSeparate()\n"); - if (!validate_stencil_op(ctx, sfail)) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)"); return; @@ -500,9 +479,6 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilFuncSeparate()\n"); - if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(face)"); return; @@ -547,9 +523,6 @@ _mesa_StencilMaskSeparate(GLenum face, GLuint mask) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilMaskSeparate()\n"); - if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilaMaskSeparate(face)"); return; diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index a42619af1f4..598b54394f8 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -493,13 +493,6 @@ _mesa_texenvfv_indexed( struct gl_context* ctx, GLuint texunit, GLenum target, _mesa_enum_to_string(target)); return; } - - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n", - _mesa_enum_to_string(target), - _mesa_enum_to_string(pname), - *param, - _mesa_enum_to_string((GLenum) iparam0)); } diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 308e827ac33..e8db51727ea 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1406,15 +1406,6 @@ get_texture_image(struct gl_context *ctx, return; } - if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { - _mesa_debug(ctx, "%s(tex %u) format = %s, w=%d, h=%d," - " dstFmt=0x%x, dstType=0x%x\n", - caller, texObj->Name, - _mesa_get_format_name(texImage->TexFormat), - texImage->Width, texImage->Height, - format, type); - } - if (target == GL_TEXTURE_CUBE_MAP) { /* Compute stride between cube faces */ imageStride = _mesa_image_image_stride(&ctx->Pack, width, height, @@ -1782,14 +1773,6 @@ get_compressed_texture_image(struct gl_context *ctx, if (_mesa_is_zero_size_texture(texImage)) return; - if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { - _mesa_debug(ctx, - "%s(tex %u) format = %s, w=%d, h=%d\n", - caller, texObj->Name, - _mesa_get_format_name(texImage->TexFormat), - texImage->Width, texImage->Height); - } - if (target == GL_TEXTURE_CUBE_MAP) { struct compressed_pixelstore store; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c49d5185de2..79f5998225a 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3118,25 +3118,6 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) { - if (compressed) - _mesa_debug(ctx, - "glCompressedTexImage%uD %s %d %s %d %d %d %d %p\n", - dims, - _mesa_enum_to_string(target), level, - _mesa_enum_to_string(internalFormat), - width, height, depth, border, pixels); - else - _mesa_debug(ctx, - "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n", - dims, - _mesa_enum_to_string(target), level, - _mesa_enum_to_string(internalFormat), - width, height, depth, border, - _mesa_enum_to_string(format), - _mesa_enum_to_string(type), pixels); - } - internalFormat = override_internal_format(internalFormat, width, height); if (!no_error && @@ -3853,14 +3834,6 @@ texsubimage_err(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, texImage = _mesa_select_tex_image(texObj, target, level); /* texsubimage_error_check ensures that texImage is not NULL */ - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTexSubImage%uD %s %d %d %d %d %d %d %d %s %s %p\n", - dims, - _mesa_enum_to_string(target), level, - xoffset, yoffset, zoffset, width, height, depth, - _mesa_enum_to_string(format), - _mesa_enum_to_string(type), pixels); - texture_sub_image(ctx, dims, texObj, texImage, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); @@ -3901,14 +3874,6 @@ texturesubimage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage; int i; - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, - "glTextureSubImage%uD %d %d %d %d %d %d %d %d %s %s %p\n", - dims, texture, level, - xoffset, yoffset, zoffset, width, height, depth, - _mesa_enum_to_string(format), - _mesa_enum_to_string(type), pixels); - /* Get the texture object by Name. */ if (!no_error) { if (!ext_dsa) { @@ -4464,11 +4429,6 @@ copy_texture_sub_image_err(struct gl_context *ctx, GLuint dims, { FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "%s %s %d %d %d %d %d %d %d %d\n", caller, - _mesa_enum_to_string(target), - level, xoffset, yoffset, zoffset, x, y, width, height); - _mesa_update_pixel(ctx); if (ctx->NewState & _NEW_BUFFERS) @@ -4520,13 +4480,6 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO FLUSH_VERTICES(ctx, 0, 0); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n", - dims, - _mesa_enum_to_string(target), level, - _mesa_enum_to_string(internalFormat), - x, y, width, height, border); - _mesa_update_pixel(ctx); if (ctx->NewState & _NEW_BUFFERS) @@ -7025,11 +6978,6 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, GLenum sample_count_error; bool dsa = strstr(func, "ture") ? true : false; - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) { - _mesa_debug(ctx, "%s(target=%s, samples=%d, internalformat=%s)\n", func, - _mesa_enum_to_string(target), samples, _mesa_enum_to_string(internalformat)); - } - if (!((ctx->Extensions.ARB_texture_multisample && _mesa_is_desktop_gl(ctx))) && !_mesa_is_gles31(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index e236c8e1e36..a3d20e34464 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1249,9 +1249,6 @@ static void create_textures_err(struct gl_context *ctx, GLenum target, GLsizei n, GLuint *textures, const char *caller) { - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "%s %d\n", caller, n); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", caller); return; @@ -1537,9 +1534,6 @@ _mesa_DeleteTextures(GLsizei n, const GLuint *textures) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glDeleteTextures %d\n", n); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteTextures(n < 0)"); return; @@ -1788,10 +1782,6 @@ _mesa_BindTexture(GLenum target, GLuint texName) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glBindTexture %s %d\n", - _mesa_enum_to_string(target), (GLint) texName); - bind_texture(ctx, target, texName, ctx->Texture.CurrentUnit, false, "glBindTexture"); } @@ -1810,10 +1800,6 @@ _mesa_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture) return; } - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glBindMultiTextureEXT %s %d\n", - _mesa_enum_to_string(texunit), (GLint) texture); - bind_texture(ctx, target, texture, unit, false, "glBindMultiTextureEXT"); } @@ -1889,10 +1875,6 @@ _mesa_BindTextureUnit(GLuint unit, GLuint texture) return; } - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glBindTextureUnit %s %d\n", - _mesa_enum_to_string(GL_TEXTURE0+unit), (GLint) texture); - bind_texture_unit(ctx, unit, texture, false); } @@ -2018,10 +2000,6 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, GET_CURRENT_CONTEXT(ctx); GLint i; - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glPrioritizeTextures %d\n", n); - - if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" ); return; @@ -2065,9 +2043,6 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, GLint i; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glAreTexturesResident %d\n", n); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)"); return GL_FALSE; @@ -2113,9 +2088,6 @@ _mesa_IsTexture( GLuint texture ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glIsTexture %d\n", texture); - if (!texture) return GL_FALSE; @@ -2179,9 +2151,6 @@ _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, struct gl_texture_image *image; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glInvalidateTexSubImage %d\n", texture); - t = invalidate_tex_image_error_check(ctx, texture, level, "glInvalidateTexSubImage"); @@ -2329,9 +2298,6 @@ _mesa_InvalidateTexImage(GLuint texture, GLint level) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glInvalidateTexImage(%d, %d)\n", texture, level); - invalidate_tex_image_error_check(ctx, texture, level, "glInvalidateTexImage"); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index b8746a2cac8..5bed9a99235 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -297,10 +297,6 @@ active_texture(GLenum texture, bool no_error) GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glActiveTexture %s\n", - _mesa_enum_to_string(texture)); - if (ctx->Texture.CurrentUnit == texUnit) return; @@ -358,10 +354,6 @@ _mesa_ClientActiveTexture(GLenum texture) GET_CURRENT_CONTEXT(ctx); GLuint texUnit = texture - GL_TEXTURE0; - if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glClientActiveTexture %s\n", - _mesa_enum_to_string(texture)); - if (ctx->Array.ActiveTexture == texUnit) return; diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 334ab1a96cd..3564e01e743 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -692,12 +692,6 @@ texstorage_error(GLuint dims, GLenum target, GLsizei levels, return; } - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "%s %s %d %s %d %d %d\n", caller, - _mesa_enum_to_string(target), levels, - _mesa_enum_to_string(internalformat), - width, height, depth); - /* Check the format to make sure it is sized. */ if (!_mesa_is_legal_tex_storage_format(ctx, internalformat)) { _mesa_error(ctx, GL_INVALID_ENUM, @@ -739,12 +733,6 @@ texturestorage_error(GLuint dims, GLuint texture, GLsizei levels, struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "%s %d %d %s %d %d %d\n", - caller, texture, levels, - _mesa_enum_to_string(internalformat), - width, height, depth); - /* Check the format to make sure it is sized. */ if (!_mesa_is_legal_tex_storage_format(ctx, internalformat)) { _mesa_error(ctx, GL_INVALID_ENUM, diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c index e682346748d..37d935af6c2 100644 --- a/src/mesa/main/textureview.c +++ b/src/mesa/main/textureview.c @@ -754,12 +754,6 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture, GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTextureView %d %s %d %s %d %d %d %d\n", - texture, _mesa_enum_to_string(target), origtexture, - _mesa_enum_to_string(internalformat), - minlevel, numlevels, minlayer, numlayers); - if (origtexture == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(origtexture = %u)", origtexture); diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 12b5d59d7c9..926a931679c 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -3003,9 +3003,6 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glLockArrays %d %d\n", first, count); - if (first < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(first)" ); return; @@ -3029,9 +3026,6 @@ _mesa_UnlockArraysEXT( void ) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glUnlockArrays\n"); - if (ctx->Array.LockCount == 0) { _mesa_error( ctx, GL_INVALID_OPERATION, "glUnlockArraysEXT(reexit)" ); return; diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index afb59047cba..5daecc87549 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -139,9 +139,6 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); - if (width < 0 || height < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glViewport(%d, %d, %d, %d)", x, y, width, height); @@ -205,9 +202,6 @@ _mesa_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v) struct gl_viewport_inputs *p = (struct gl_viewport_inputs *)v; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glViewportArrayv %d %d\n", first, count); - if ((first + count) > ctx->Const.MaxViewports) { _mesa_error(ctx, GL_INVALID_VALUE, "glViewportArrayv: first (%d) + count (%d) > MaxViewports " @@ -234,10 +228,6 @@ static void viewport_indexed_err(struct gl_context *ctx, GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h, const char *function) { - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "%s(%d, %f, %f, %f, %f)\n", - function, index, x, y, w, h); - if (index >= ctx->Const.MaxViewports) { _mesa_error(ctx, GL_INVALID_VALUE, "%s: index (%d) >= MaxViewports (%d)", @@ -324,9 +314,6 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval) unsigned i; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); - /* The GL_ARB_viewport_array spec says: * * "DepthRange sets the depth range for all viewports to the same @@ -381,9 +368,6 @@ _mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v) (struct gl_depthrange_inputs *) v; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDepthRangeArrayv %d %d\n", first, count); - if ((first + count) > ctx->Const.MaxViewports) { _mesa_error(ctx, GL_INVALID_VALUE, "glDepthRangev: first (%d) + count (%d) >= MaxViewports (%d)", @@ -400,9 +384,6 @@ _mesa_DepthRangeArrayfvOES(GLuint first, GLsizei count, const GLfloat *v) int i; GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDepthRangeArrayfv %d %d\n", first, count); - if ((first + count) > ctx->Const.MaxViewports) { _mesa_error(ctx, GL_INVALID_VALUE, "glDepthRangeArrayfv: first (%d) + count (%d) >= MaxViewports (%d)", @@ -437,10 +418,6 @@ _mesa_DepthRangeIndexed(GLuint index, GLclampd nearval, GLclampd farval) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDepthRangeIndexed(%d, %f, %f)\n", - index, nearval, farval); - if (index >= ctx->Const.MaxViewports) { _mesa_error(ctx, GL_INVALID_VALUE, "glDepthRangeIndexed: index (%d) >= MaxViewports (%d)", @@ -539,11 +516,6 @@ _mesa_ClipControl(GLenum origin, GLenum depth) { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glClipControl(%s, %s)\n", - _mesa_enum_to_string(origin), - _mesa_enum_to_string(depth)); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ARB_clip_control) { @@ -592,9 +564,6 @@ _mesa_get_viewport_xform(struct gl_context *ctx, unsigned i, static void subpixel_precision_bias(struct gl_context *ctx, GLuint xbits, GLuint ybits) { - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glSubpixelPrecisionBiasNV(%u, %u)\n", xbits, ybits); - FLUSH_VERTICES(ctx, 0, GL_VIEWPORT_BIT); ctx->SubpixelPrecisionBias[0] = xbits; @@ -607,10 +576,6 @@ void GLAPIENTRY _mesa_SubpixelPrecisionBiasNV_no_error(GLuint xbits, GLuint ybits) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glSubpixelPrecisionBiasNV(%u, %u)\n", xbits, ybits); - subpixel_precision_bias(ctx, xbits, ybits); } @@ -618,10 +583,6 @@ void GLAPIENTRY _mesa_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits) { GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glSubpixelPrecisionBiasNV(%u, %u)\n", xbits, ybits); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.NV_conservative_raster) { @@ -671,10 +632,6 @@ _mesa_ViewportSwizzleNV_no_error(GLuint index, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glViewportSwizzleNV(%x, %x, %x, %x)\n", - swizzlex, swizzley, swizzlez, swizzlew); - set_viewport_swizzle(ctx, index, swizzlex, swizzley, swizzlez, swizzlew); } @@ -692,10 +649,6 @@ _mesa_ViewportSwizzleNV(GLuint index, { GET_CURRENT_CONTEXT(ctx); - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glViewportSwizzleNV(%x, %x, %x, %x)\n", - swizzlex, swizzley, swizzlez, swizzlew); - if (!ctx->Extensions.NV_viewport_swizzle) { _mesa_error(ctx, GL_INVALID_OPERATION, "glViewportSwizzleNV not supported"); From 3d6913ef3af0f329a714f2c8599f8443f996073a Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 23 Apr 2026 11:20:14 +0200 Subject: [PATCH 07/10] mesa/main: remove mesa_print_display_list function This function isn't exported, so applications can't, in fact use it. So let's simplify the internals a bit here, remove the helper. --- src/mesa/main/dlist.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index fcae7ab7f2a..b530767e0a1 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -730,7 +730,8 @@ union int64_pair #define BLOCK_SIZE 256 -void mesa_print_display_list(GLuint list); +static void +print_list(struct gl_context *ctx, GLuint list, const char *fname); /** @@ -13410,7 +13411,7 @@ _mesa_EndList(void) ctx->ListState.CurrentList); if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) - mesa_print_display_list(ctx->ListState.CurrentList->Name); + print_list(ctx, ctx->ListState.CurrentList->Name, NULL); _mesa_HashUnlockMutex(&ctx->Shared->DisplayList); @@ -13442,7 +13443,7 @@ _mesa_CallList(GLuint list) } if (0) - mesa_print_display_list( list ); + print_list(ctx, list, NULL); /* Save the CompileFlag status, turn it off, execute the display list, * and restore the CompileFlag. This is needed for GL_COMPILE_AND_EXECUTE @@ -14057,19 +14058,6 @@ _mesa_glthread_should_execute_list(struct gl_context *ctx, } -/** - * Clients may call this function to help debug display list problems. - * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed, - * changed, or break in the future without notice. - */ -void -mesa_print_display_list(GLuint list) -{ - GET_CURRENT_CONTEXT(ctx); - print_list(ctx, list, NULL); -} - - /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ From 13950e1f5de3af5ef479b932545889545f565696 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 23 Apr 2026 11:29:30 +0200 Subject: [PATCH 08/10] mesa/main: remove low-value verbose-switch This toggles a single, low-value print. Let's drop it to simplify things a bit. --- src/mesa/main/debug.c | 1 - src/mesa/main/light.c | 3 --- src/mesa/main/mtypes.h | 5 ++--- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index d15614e055b..83733a1879f 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -101,7 +101,6 @@ set_verbose_flags(const char *str) GLbitfield flag; }; static const struct option opts[] = { - { "mat", VERBOSE_MATERIAL }, { "state", VERBOSE_STATE }, { "list", VERBOSE_DISPLAY_LIST }, }; diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 7ebf28014d3..ea040cc9401 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -663,9 +663,6 @@ _mesa_update_material( struct gl_context *ctx, GLuint bitmask ) { GLfloat (*mat)[4] = ctx->Light.Material.Attrib; - if (MESA_VERBOSE & VERBOSE_MATERIAL) - _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask); - if (!bitmask) return; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8d172b2523e..575603b6fcb 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3670,9 +3670,8 @@ extern int MESA_DEBUG_FLAGS; /** The MESA_VERBOSE var is a bitmask of these flags */ enum _verbose { - VERBOSE_MATERIAL = 0x0001, - VERBOSE_STATE = 0x0002, - VERBOSE_DISPLAY_LIST = 0x0004, + VERBOSE_STATE = 0x0001, + VERBOSE_DISPLAY_LIST = 0x0002, }; From 9d70d1b2b3a742d198aff945e28501f631431bf6 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Thu, 23 Apr 2026 16:28:05 +0200 Subject: [PATCH 09/10] mesa/main: Add trace dispatch plumbing for MESA_VERBOSE=api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reintroduce VERBOSE_API as a bit that will cause a parallel trace dispatch table to be installed at context create. The table itself is populated in a follow-up commit. This commit only wires the TLS-publish indirection via _mesa_set_dispatch(..). With Trace NULL (the common case), the helper is equivalent to a plain _mesa_glapi_set_dispatch — no behaviour change yet. Signed-off-by: Christian Gmeiner Assisted-by: Claude --- src/mesa/main/context.c | 21 +++++++++++++++++++-- src/mesa/main/context.h | 3 +++ src/mesa/main/debug.c | 1 + src/mesa/main/dlist.c | 4 ++-- src/mesa/main/glthread.c | 4 ++-- src/mesa/main/mtypes.h | 4 ++++ src/mesa/main/robustness.c | 2 +- src/mesa/vbo/vbo_exec_api.c | 4 ++-- 8 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 9c0d7bd6a6e..5df84fdd37e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -77,6 +77,7 @@ #include "util/glheader.h" +#include "util/u_thread.h" #include "accum.h" #include "arrayobj.h" @@ -860,7 +861,7 @@ _mesa_alloc_dispatch_tables(gl_api api, struct gl_dispatch *d, bool glthread) return false; } - d->Current = d->Exec = d->OutsideBeginEnd; + d->RealPublished = d->Current = d->Exec = d->OutsideBeginEnd; return true; } @@ -874,6 +875,22 @@ _mesa_free_dispatch_tables(struct gl_dispatch *d) free(d->ContextLost); } +void +_mesa_set_dispatch(struct gl_context *ctx, struct _glapi_table *t) +{ + /* On the glthread worker, the user-thread wrapper already logged the + * call; bypass Trace and don't touch RealPublished (main-thread state). + */ + if (ctx->GLThread.enabled && + u_thread_is_self(ctx->GLThread.queue.threads[0])) { + _mesa_glapi_set_dispatch(t); + return; + } + + ctx->Dispatch.RealPublished = t; + _mesa_glapi_set_dispatch(ctx->Dispatch.Trace ? ctx->Dispatch.Trace : t); +} + bool _mesa_initialize_dispatch_tables(struct gl_context *ctx) { @@ -1475,7 +1492,7 @@ _mesa_make_current( struct gl_context *newCtx, else { _mesa_glapi_set_context((void *) newCtx); assert(_mesa_get_current_context() == newCtx); - _mesa_glapi_set_dispatch(newCtx->GLApi); + _mesa_set_dispatch(newCtx, newCtx->GLApi); if (drawBuffer && readBuffer) { assert(_mesa_is_winsys_fbo(drawBuffer)); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index e845146b66b..f51533615a7 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -91,6 +91,9 @@ _mesa_alloc_dispatch_tables(gl_api api, struct gl_dispatch *d, bool glthread); extern bool _mesa_initialize_dispatch_tables(struct gl_context *ctx); +extern void +_mesa_set_dispatch(struct gl_context *ctx, struct _glapi_table *t); + extern struct _glapi_table * _mesa_new_nop_table(bool glthread); diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 83733a1879f..7df19b49928 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -103,6 +103,7 @@ set_verbose_flags(const char *str) static const struct option opts[] = { { "state", VERBOSE_STATE }, { "list", VERBOSE_DISPLAY_LIST }, + { "api", VERBOSE_API }, }; GLuint i; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index b530767e0a1..8886df0a564 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -13204,7 +13204,7 @@ _mesa_NewList(GLuint name, GLenum mode) vbo_save_NewList(ctx, name, mode); ctx->Dispatch.Current = ctx->Dispatch.Save; - _mesa_glapi_set_dispatch(ctx->Dispatch.Current); + _mesa_set_dispatch(ctx, ctx->Dispatch.Current); if (!ctx->GLThread.enabled) { ctx->GLApi = ctx->Dispatch.Current; } @@ -13423,7 +13423,7 @@ _mesa_EndList(void) ctx->CompileFlag = GL_FALSE; ctx->Dispatch.Current = ctx->Dispatch.Exec; - _mesa_glapi_set_dispatch(ctx->Dispatch.Current); + _mesa_set_dispatch(ctx, ctx->Dispatch.Current); if (!ctx->GLThread.enabled) { ctx->GLApi = ctx->Dispatch.Current; } diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index a03af6736e5..95d102c6d2e 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -303,7 +303,7 @@ void _mesa_glthread_enable(struct gl_context *ctx) /* Update the dispatch only if the dispatch is current. */ if (GET_DISPATCH() == ctx->Dispatch.Current) { - _mesa_glapi_set_dispatch(ctx->GLApi); + _mesa_set_dispatch(ctx, ctx->GLApi); } } @@ -323,7 +323,7 @@ void _mesa_glthread_disable(struct gl_context *ctx) /* Update the dispatch only if the dispatch is current. */ if (GET_DISPATCH() == ctx->MarshalExec) { - _mesa_glapi_set_dispatch(ctx->GLApi); + _mesa_set_dispatch(ctx, ctx->GLApi); } /* Unbind VBOs in all VAOs that glthread bound for non-VBO vertex uploads diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 575603b6fcb..4a4d4da0017 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3247,6 +3247,9 @@ struct gl_dispatch * - ContextLost */ struct _glapi_table *Current; + + struct _glapi_table *Trace; + struct _glapi_table *RealPublished; }; /** @@ -3672,6 +3675,7 @@ enum _verbose { VERBOSE_STATE = 0x0001, VERBOSE_DISPLAY_LIST = 0x0002, + VERBOSE_API = 0x0004, }; diff --git a/src/mesa/main/robustness.c b/src/mesa/main/robustness.c index 81745d4fc0a..01b3d7e8a6c 100644 --- a/src/mesa/main/robustness.c +++ b/src/mesa/main/robustness.c @@ -104,7 +104,7 @@ _mesa_set_context_lost_dispatch(struct gl_context *ctx) } ctx->Dispatch.Current = ctx->Dispatch.ContextLost; - _mesa_glapi_set_dispatch(ctx->Dispatch.Current); + _mesa_set_dispatch(ctx, ctx->Dispatch.Current); } /** diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index a5b6476be39..7791051ebe2 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -862,7 +862,7 @@ _mesa_Begin(GLenum mode) ctx->Dispatch.Current = ctx->Dispatch.Exec; } else if (ctx->GLApi == ctx->Dispatch.OutsideBeginEnd) { ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec; - _mesa_glapi_set_dispatch(ctx->GLApi); + _mesa_set_dispatch(ctx, ctx->GLApi); } else { assert(ctx->GLApi == ctx->Dispatch.Save); } @@ -925,7 +925,7 @@ _mesa_End(void) } else if (ctx->GLApi == ctx->Dispatch.BeginEnd || ctx->GLApi == ctx->Dispatch.HWSelectModeBeginEnd) { ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec; - _mesa_glapi_set_dispatch(ctx->GLApi); + _mesa_set_dispatch(ctx, ctx->GLApi); } if (exec->vtx.prim_count > 0) { From 46912a83e8bc966adb4cb07a105e9973c0ae5d8c Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Fri, 24 Apr 2026 09:14:28 +0200 Subject: [PATCH 10/10] mesa/main: Auto-generate MESA_VERBOSE=api trace dispatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds api_trace_c.py that emits from gl_and_es_API.xml a _mesa_trace_Foo wrapper per entrypoint plus _mesa_init_dispatch_trace(), called from _mesa_initialize_dispatch_tables() when MESA_VERBOSE & VERBOSE_API. Each wrapper logs one line via _mesa_debug() and forwards through ctx->Dispatch.RealPublished. Scalar arguments are printed type-aware: GLenum decoded via _mesa_enum_to_string, const GLchar * as a null-guarded string, GLbitfield as raw hex, numerics with a size-appropriate spec. Counted array parameters — fixed count="N", or count="counter" with optional count_scale (e.g. UniformMatrix4fv's value=count*16) — render their first MAX_TRACE_ARRAY=16 elements inline as "[v0, v1, ...]" via typed _mesa_trace_format_ helpers, with a "..., N of M]" suffix on truncation. Output pointers, opaque GLvoid * blobs, and parameters with no count info fall back to %p. No bitmask decoding or return-value capture — that's apitrace's job. Signed-off-by: Christian Gmeiner Generated-by: Claude --- src/mesa/glapi/glapi/gen/api_trace_c.py | 281 ++++++++++++++++++++++++ src/mesa/glapi/glapi/gen/meson.build | 9 + src/mesa/main/context.c | 4 + src/mesa/main/context.h | 3 + src/mesa/meson.build | 1 + 5 files changed, 298 insertions(+) create mode 100644 src/mesa/glapi/glapi/gen/api_trace_c.py diff --git a/src/mesa/glapi/glapi/gen/api_trace_c.py b/src/mesa/glapi/glapi/gen/api_trace_c.py new file mode 100644 index 00000000000..3c0e87445af --- /dev/null +++ b/src/mesa/glapi/glapi/gen/api_trace_c.py @@ -0,0 +1,281 @@ +# Copyright © 2026 Igalia S.L. +# SPDX-License-Identifier: MIT +# +# Generates api_trace.c: per-entrypoint wrappers that log GL calls to stderr +# and forward to the real dispatch. Installed at context create when +# MESA_VERBOSE=api is set. + +import gl_XML +import license +import sys + + +MAX_TRACE_ARRAY = 16 +TRACE_ARRAY_BUFSZ = 512 + + +header = """ +#include +#include + +#include "glapi/glapi/glapi.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/errors.h" +#include "dispatch.h" + +#define MAX_TRACE_ARRAY {max_array} +""" + + +# ``{p}`` is replaced with the parameter name. +TYPE_FORMAT = { + 'GLenum': ('%s', '_mesa_enum_to_string({p})'), + 'GLboolean': ('%s', '{p} ? "GL_TRUE" : "GL_FALSE"'), + 'GLbitfield': ('0x%x', '{p}'), + 'GLbyte': ('%d', '{p}'), + 'GLubyte': ('%u', '{p}'), + 'GLshort': ('%d', '{p}'), + 'GLushort': ('%u', '{p}'), + 'GLint': ('%d', '{p}'), + 'GLuint': ('%u', '{p}'), + 'GLint64': ('%" PRId64 "', '(int64_t){p}'), + 'GLuint64': ('%" PRIu64 "', '(uint64_t){p}'), + 'GLsizei': ('%d', '{p}'), + 'GLintptr': ('%" PRIdPTR "','(intptr_t){p}'), + 'GLsizeiptr': ('%" PRIdPTR "','(intptr_t){p}'), + 'GLfloat': ('%f', '{p}'), + 'GLclampf': ('%f', '{p}'), + 'GLdouble': ('%f', '{p}'), + 'GLclampd': ('%f', '{p}'), + 'GLfixed': ('%d', '{p}'), + 'GLclampx': ('%d', '{p}'), + 'GLhalfNV': ('0x%x', '{p}'), + 'GLvdpauSurfaceNV': ('%" PRIdPTR "', '(intptr_t){p}'), + 'GLsync': ('%p', '(void *){p}'), + 'GLhandleARB': ('%u', '{p}'), + 'GLDEBUGPROC': ('%p', '(void *){p}'), + 'GLDEBUGPROCARB': ('%p', '(void *){p}'), + 'GLDEBUGPROCAMD': ('%p', '(void *){p}'), + 'GLDEBUGPROCKHR': ('%p', '(void *){p}'), + 'GLVULKANPROCNV': ('%p', '(void *){p}'), +} + +TYPE_ALIASES = { + 'GLint64EXT': 'GLint64', + 'GLuint64EXT': 'GLuint64', + 'GLintptrARB': 'GLintptr', + 'GLsizeiptrARB': 'GLsizeiptr', + 'float': 'GLfloat', + 'int': 'GLint', +} + + +# Element types not listed here fall back to ``%p`` at the call site. The +# format snippet is a raw C-source fragment so 64-bit specs can break out to +# use the inttypes.h macros. +ARRAY_ELEM_PRINTF = { + 'GLfloat': ('"%f"', 'arr[i]'), + 'GLdouble': ('"%f"', 'arr[i]'), + 'GLclampf': ('"%f"', 'arr[i]'), + 'GLclampd': ('"%f"', 'arr[i]'), + 'GLbyte': ('"%d"', 'arr[i]'), + 'GLshort': ('"%d"', 'arr[i]'), + 'GLint': ('"%d"', 'arr[i]'), + 'GLsizei': ('"%d"', 'arr[i]'), + 'GLfixed': ('"%d"', 'arr[i]'), + 'GLubyte': ('"%u"', 'arr[i]'), + 'GLushort': ('"%u"', 'arr[i]'), + 'GLuint': ('"%u"', 'arr[i]'), + 'GLhalfNV': ('"0x%x"', 'arr[i]'), + 'GLint64': ('"%" PRId64', '(int64_t)arr[i]'), + 'GLuint64': ('"%" PRIu64', '(uint64_t)arr[i]'), + 'GLintptr': ('"%" PRIdPTR', '(intptr_t)arr[i]'), + 'GLsizeiptr': ('"%" PRIdPTR', '(intptr_t)arr[i]'), +} + + +def array_count_expr(p): + if p.counter: + scale = p.count_scale if p.count_scale else 1 + if scale == 1: + return '(size_t){0}'.format(p.counter) + return '(size_t){0} * {1}'.format(p.counter, scale) + if p.count and p.count >= 2: + return str(p.count) + return None + + +def classify_param(p): + """Return one of: + ('scalar', spec, expr) — printed inline + ('array', elem_type, count_expr, name) + ('opaque', spec, expr) — printed as %p / hex fallback + """ + opaque = ('opaque', '%p', '(void *){0}'.format(p.name)) + + if not p.is_pointer(): + ts = TYPE_ALIASES.get(p.type_string().strip(), p.type_string().strip()) + if ts in TYPE_FORMAT: + spec, expr = TYPE_FORMAT[ts] + return ('scalar', spec, expr.format(p=p.name)) + return ('scalar', '0x%x', p.name) + + base = p.get_base_type_string() + + if base in ('GLchar', 'GLcharARB'): + ts = p.type_string().lstrip() + if ts.startswith('const'): + return ('scalar', '%s', + '{p} ? (const char *){p} : "(null)"'.format(p=p.name)) + return opaque + + if p.is_output: + return opaque + + elem = TYPE_ALIASES.get(base, base) + count_expr = array_count_expr(p) + if elem in ARRAY_ELEM_PRINTF and count_expr is not None: + return ('array', elem, count_expr, p.name) + + return opaque + + +class PrintCode(gl_XML.gl_print_base): + def __init__(self): + super(PrintCode, self).__init__() + self.name = 'api_trace_c.py' + self.license = license.bsd_license_template % ( + 'Copyright (C) 2026 Christian Gmeiner', 'Christian Gmeiner') + + def printRealHeader(self): + print(header.format(max_array=MAX_TRACE_ARRAY)) + + def printRealFooter(self): + pass + + def print_array_helper(self, elem): + fmt, val = ARRAY_ELEM_PRINTF[elem] + print('static void') + print('_mesa_trace_format_{0}(char *buf, size_t buflen,'.format(elem)) + print(' const {0} *arr, size_t n)'.format(elem)) + print('{') + print(' if (!arr) {') + print(' snprintf(buf, buflen, "(null)");') + print(' return;') + print(' }') + print(' size_t shown = (n < MAX_TRACE_ARRAY) ? n : MAX_TRACE_ARRAY;') + print(' size_t pos = 0;') + print(' int w;') + print(' w = snprintf(buf + pos, buflen - pos, "[");') + print(' if (w < 0 || (size_t)w >= buflen - pos) return;') + print(' pos += w;') + print(' for (size_t i = 0; i < shown; i++) {') + print(' if (i > 0) {') + print(' w = snprintf(buf + pos, buflen - pos, ", ");') + print(' if (w < 0 || (size_t)w >= buflen - pos) return;') + print(' pos += w;') + print(' }') + print(' w = snprintf(buf + pos, buflen - pos, {fmt}, {val});' + .format(fmt=fmt, val=val)) + print(' if (w < 0 || (size_t)w >= buflen - pos) return;') + print(' pos += w;') + print(' }') + print(' if (n > MAX_TRACE_ARRAY)') + print(' snprintf(buf + pos, buflen - pos,' + ' ", ... %zu of %zu]", shown, n);') + print(' else') + print(' snprintf(buf + pos, buflen - pos, "]");') + print('}') + print('') + + def print_wrapper(self, f): + params = [p for p in f.parameters if not p.is_padding] + classified = [classify_param(p) for p in params] + + specs = [] + args = [] + prelude = [] + for p, c in zip(params, classified): + if c[0] == 'array': + _, elem, count_expr, name = c + buf_name = '{0}_buf'.format(name) + prelude.append('char {buf}[{sz}];' + .format(buf=buf_name, sz=TRACE_ARRAY_BUFSZ)) + prelude.append( + '_mesa_trace_format_{elem}({buf}, sizeof({buf}),' + ' {name}, {count});' + .format(elem=elem, buf=buf_name, + name=name, count=count_expr)) + specs.append('%s') + args.append(buf_name) + else: + _, spec, expr = c + specs.append(spec) + args.append(expr) + + ret = f.return_type + param_string = f.get_parameter_string() + called = f.get_called_parameter_string() + + print('static {rt} GLAPIENTRY'.format(rt=ret)) + print('_mesa_trace_{name}({ps})'.format(name=f.name, ps=param_string)) + print('{') + print(' GET_CURRENT_CONTEXT(ctx);') + for stmt in prelude: + print(' {0}'.format(stmt)) + if args: + fmt_body = 'gl{0}({1})\\n'.format(f.name, ', '.join(specs)) + print(' _mesa_debug(ctx, "{fmt}", {args});' + .format(fmt=fmt_body, args=', '.join(args))) + else: + print(' _mesa_debug(ctx, "gl{0}()\\n");'.format(f.name)) + call = 'CALL_{name}(ctx->Dispatch.RealPublished, ({ca}));'.format( + name=f.name, ca=called if called else '') + if ret != 'void': + print(' return {call}'.format(call=call)) + else: + print(' {call}'.format(call=call)) + print('}') + print('') + + def print_install(self, functions): + print('bool') + print('_mesa_init_dispatch_trace(struct gl_context *ctx)') + print('{') + print(' struct _glapi_table *table = _mesa_alloc_dispatch_table(false);') + print(' if (!table)') + print(' return false;') + print('') + for f in functions: + print(' SET_{name}(table, _mesa_trace_{name});'.format(name=f.name)) + print('') + print(' ctx->Dispatch.Trace = table;') + print(' return true;') + print('}') + + def printBody(self, api): + functions = list(api.functionIterateByOffset()) + + used_elem_types = set() + for f in functions: + for p in f.parameters: + if p.is_padding: + continue + c = classify_param(p) + if c[0] == 'array': + used_elem_types.add(c[1]) + + for elem in sorted(used_elem_types): + self.print_array_helper(elem) + + for f in functions: + self.print_wrapper(f) + self.print_install(functions) + + +if __name__ == '__main__': + file_name = sys.argv[1] + printer = PrintCode() + api = gl_XML.parse_GL_API(file_name) + printer.Print(api) diff --git a/src/mesa/glapi/glapi/gen/meson.build b/src/mesa/glapi/glapi/gen/meson.build index b8a107e4f7d..d11d6a06f12 100644 --- a/src/mesa/glapi/glapi/gen/meson.build +++ b/src/mesa/glapi/glapi/gen/meson.build @@ -111,6 +111,15 @@ main_unmarshal_table_c = custom_target( capture : true, ) +main_api_trace_c = custom_target( + 'api_trace.c', + input : ['api_trace_c.py', 'gl_and_es_API.xml'], + output : 'api_trace.c', + command : [prog_python, '@INPUT0@', '@INPUT1@'], + depend_files : glapi_xml_py_deps, + capture : true, +) + main_marshal_generated_c = [] foreach x : ['0', '1', '2', '3', '4', '5', '6', '7'] main_marshal_generated_c += custom_target( diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 5df84fdd37e..4d72dad74de 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -906,6 +906,10 @@ _mesa_initialize_dispatch_tables(struct gl_context *ctx) _mesa_init_dispatch_save_begin_end(ctx); } + if ((MESA_VERBOSE & VERBOSE_API) && + !_mesa_init_dispatch_trace(ctx)) + return false; + /* This binds the dispatch table to the context, but MakeCurrent will * bind it for the user. If glthread is enabled, it will override it. */ diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index f51533615a7..bc2a80bfead 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -91,6 +91,9 @@ _mesa_alloc_dispatch_tables(gl_api api, struct gl_dispatch *d, bool glthread); extern bool _mesa_initialize_dispatch_tables(struct gl_context *ctx); +extern bool +_mesa_init_dispatch_trace(struct gl_context *ctx); + extern void _mesa_set_dispatch(struct gl_context *ctx, struct _glapi_table *t); diff --git a/src/mesa/meson.build b/src/mesa/meson.build index 2b801082eac..21eabf00d42 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -417,6 +417,7 @@ files_libmesa += [ mesa_lex, program_parse_tab, main_api_exec_c, + main_api_trace_c, main_api_exec_decl_h, main_api_save_h, main_api_save_init_h,