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>
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