permafrost-engine icon indicating copy to clipboard operation
permafrost-engine copied to clipboard

Assertion `SDL_ThreadID() == g_render_thread_id' failed.

Open vinhig opened this issue 2 years ago • 1 comments

Platform

Latest arch linux

Steps to reproduce rm -r deps/SDL2 git clone --depth 1 https://github.com/libsdl-org/SDL/ deps/SDL2 (related to #29) make deps -j16 make pf -j16 make run

Expected behavior Game should run correctly

Actual behavior Splash image with some armed dudes shows up, then the game crashes with

pf: src/render/gl_shader.c:670: _Bool R_GL_Shader_InitAll(const char *): Assertion `SDL_ThreadID() == g_render_thread_id' failed.

Some investigation

At gl_shader.c:670, g_render_thread_id equals 0 and SDL_ThreadID() equals 139936868296256.

vinhig avatar Feb 08 '22 15:02 vinhig

the render thread run before set g_render_thread_id = SDL_GetThreadID(s_render_thread); in the main thread. So for temp fix you can set g_render_thread_id in the render thread.

static int render(void *data)
{
+    g_render_thread_id = SDL_ThreadID();

    struct render_sync_state *rstate = data;
    SDL_Window *window = rstate->arg->in_window; /* cache window ptr */

ylme avatar May 14 '22 04:05 ylme

Fixed in the latest build. Thanks for the diagnosis @ylme

eduard-permyakov avatar Nov 02 '23 12:11 eduard-permyakov