grovesNL / glow

GL on Whatever: a set of bindings to run GL anywhere and avoid target-specific code
Apache License 2.0
1.21k stars 130 forks source link

`raw_debug_message_callback` might be called from multiple threads at once #289

Closed Imberflur closed 4 months ago

Imberflur commented 7 months ago

Right now it creates a mutable reference to the user data which requires exclusivity.

But https://www.khronos.org/opengl/wiki/Debug_Output#Getting_messages notes:

The callback can be called synchronously or asynchronously. This is controlled by the glEnable flag GL_DEBUG_OUTPUT_SYNCHRONOUS. If this flag is enabled, then OpenGL guarantees that your callback will be called: ... ... If the flag is disabled, then none of these are guaranteed. So if you want asynchronous debug output (for performance reasons), you must take into account the following possibilities: ... Multiple instances of the same callback function may be called at the same time, obviously from different threads.