I will post a shorter shader when I got some free times

Basically the only difference is an alpha test
Good shader
Code :
void atst(vec4 c)
{ }

Bad shader. AREF is an uniform.
Code :
void atst(vec4 c)
    float a = trunc(c.a * 255.0 + 0.01);
    if ((a-AREF - 0.5f) < 0.0f)
            discard;

In both case texture sampler are defined like that
Code :
layout(bindless_sampler, binding = 0) uniform sampler2D TextureSampler;
layout(bindless_sampler, binding = 1) uniform sampler2D PaletteSampler;