Skip to content

Commit abdc803

Browse files
committed
sdlgpu: Clear binding state when a bound shader is deleted
1 parent f2b7399 commit abdc803

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mojoshader_sdlgpu.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,11 @@ void MOJOSHADER_sdlDeleteShader(
714714
shader->refcount--;
715715
else
716716
{
717+
if (shader == ctx->bound_vshader_data)
718+
ctx->bound_vshader_data = NULL;
719+
else if (shader == ctx->bound_pshader_data)
720+
ctx->bound_pshader_data = NULL;
721+
717722
// See if this was bound as an unlinked program anywhere...
718723
if (ctx->linker_cache)
719724
{
@@ -770,7 +775,6 @@ void MOJOSHADER_sdlBindShaders(
770775
MOJOSHADER_sdlShaderData *vshader,
771776
MOJOSHADER_sdlShaderData *pshader
772777
) {
773-
MOJOSHADER_sdlProgram *program = NULL;
774778
ctx->bound_vshader_data = vshader;
775779
ctx->bound_pshader_data = pshader;
776780
} // MOJOSHADER_sdlBindShaders

0 commit comments

Comments
 (0)