From 8207743308ccd03d686a637a965ec2bbe88ac8d8 Mon Sep 17 00:00:00 2001 From: Mid <> Date: Mon, 1 Dec 2025 23:55:17 +0200 Subject: [PATCH] Assign textures in depth-only pass (fixed state desync bug) --- src/k3.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/k3.c b/src/k3.c index 07635bb..18a1ced 100644 --- a/src/k3.c +++ b/src/k3.c @@ -1749,6 +1749,7 @@ void k3PassDepthOnly(mat4 projection, mat4 cam, int clear, int cull) { setup_core_projection(glslp, projection); + bind_mat_textures(mat, 0); setup_glsl_mat_uniforms(glslp, mat, 0); setup_glsl_model_uniforms(glslp, modelmat); @@ -1783,6 +1784,15 @@ void k3PassDepthOnly(mat4 projection, mat4 cam, int clear, int cull) { glLoadMatrixf((float*) modelview); } + if(!k3IsCore) { + if(mat->passes[0].alphatest) { + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, 0.9f); + } else { + glDisable(GL_ALPHA_TEST); + } + } + glBindBufferARB(GL_ARRAY_BUFFER_ARB, mdl->vstore->gl); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mdl->estore->gl);