u_threaded: clear non-async debug callback correctly

The following sequence:

   glEnable(GL_DEBUG_OUTPUT_KHR);
   glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR);
   glDebugMessageCallbackKHR(my_callback, NULL);

Will cause the 2nd call to be ignored - but since the callback
function used by _mesa_update_debug_callback is always the
same (_debug_message), this means we'll keep using it, causing
"my_callback" to be called from driver-internal threads.

So instead of skipping the 2nd call, make sure we pass the
information to the driver.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5206
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16300>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2022-05-03 15:34:38 +02:00
committed by Marge Bot
parent 3fe3dbea69
commit 535bb0bda4

View File

@@ -2774,15 +2774,16 @@ tc_set_debug_callback(struct pipe_context *_pipe,
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
/* Drop all synchronous debug callbacks. Drivers are expected to be OK
* with this. shader-db will use an environment variable to disable
* the threaded context.
*/
if (cb && cb->debug_message && !cb->async)
return;
tc_sync(tc);
pipe->set_debug_callback(pipe, cb);
if (cb && !cb->async)
pipe->set_debug_callback(pipe, NULL);
else
pipe->set_debug_callback(pipe, cb);
}
static void