diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 16191b81972..35c32db1853 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -1302,8 +1302,15 @@ preprocess_shader(const struct gl_constants *consts, unsigned next_stages = shader_program->data->linked_stages & ~BITFIELD_MASK(prog->info.stage + 1); - if (prev_stages) + if (prev_stages) { nir->info.prev_stage = util_last_bit(prev_stages) - 1; + + if (nir->info.stage == MESA_SHADER_FRAGMENT) { + nir->info.prev_stage_has_xfb = + shader_program->TransformFeedback.NumVarying > 0; + } + } + if (next_stages) nir->info.next_stage = u_bit_scan(&next_stages); } diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 4dfbb90373d..265b84718fe 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -58,6 +58,9 @@ typedef struct shader_info { /* If the shader is linked, this is the next shader, else MESA_SHADER_NONE. */ gl_shader_stage next_stage:8; + /* Whether the previous stage has XFB if the shader is linked (prev_stage != NONE). */ + bool prev_stage_has_xfb; + /* Number of textures used by this shader */ uint8_t num_textures; /* Number of uniform buffers used by this shader */