summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-12-09 16:00:55 -0700
committerBrian Paul <[email protected]>2015-12-09 16:06:35 -0700
commite1815bcc47a65cfad65d3017d7e9b49a1b7d0cdb (patch)
tree8f4b7035a2bd4f7928745ad17eca7cd9a49a77b7 /src/mesa/main
parentde5bb7fe78ce03a8ab4dda2a1c8ec2eedd978094 (diff)
mesa: fix ID usage for buffer warnings
We need a different ID pointer for each call site. Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/bufferobj.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 6bc1b5ea9d1..e0639c87ef4 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -60,16 +60,16 @@
/**
* Helper to warn of possible performance issues, such as frequently
- * updating a buffer created with GL_STATIC_DRAW.
+ * updating a buffer created with GL_STATIC_DRAW. Called via the macro
+ * below.
*/
static void
-buffer_usage_warning(struct gl_context *ctx, const char *fmt, ...)
+buffer_usage_warning(struct gl_context *ctx, GLuint *id, const char *fmt, ...)
{
va_list args;
- GLuint msg_id = 0;
va_start(args, fmt);
- _mesa_gl_vdebug(ctx, &msg_id,
+ _mesa_gl_vdebug(ctx, id,
MESA_DEBUG_SOURCE_API,
MESA_DEBUG_TYPE_PERFORMANCE,
MESA_DEBUG_SEVERITY_MEDIUM,
@@ -77,6 +77,12 @@ buffer_usage_warning(struct gl_context *ctx, const char *fmt, ...)
va_end(args);
}
+#define BUFFER_USAGE_WARNING(CTX, FMT, ...) \
+ do { \
+ static GLuint id = 0; \
+ buffer_usage_warning(CTX, &id, FMT, ##__VA_ARGS__); \
+ } while (0)
+
/**
* Used as a placeholder for buffer objects between glGenBuffers() and
@@ -1713,7 +1719,7 @@ _mesa_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
/* If the application declared the buffer as static draw/copy or stream
* draw, it should not be frequently modified with glBufferSubData.
*/
- buffer_usage_warning(ctx,
+ BUFFER_USAGE_WARNING(ctx,
"using %s(buffer %u, offset %u, size %u) to "
"update a %s buffer",
func, bufObj->Name, offset, size,
@@ -2432,7 +2438,7 @@ _mesa_map_buffer_range(struct gl_context *ctx,
if ((bufObj->Usage == GL_STATIC_DRAW ||
bufObj->Usage == GL_STATIC_COPY) &&
bufObj->NumMapBufferWriteCalls >= BUFFER_WARNING_CALL_COUNT) {
- buffer_usage_warning(ctx,
+ BUFFER_USAGE_WARNING(ctx,
"using %s(buffer %u, offset %u, length %u) to "
"update a %s buffer",
func, bufObj->Name, offset, length,