nir: add shader_info::prev_stage_has_xfb

We will use it to skip lowering mediump IO to 16 bits if the previous
shader has XFB and mediump XFB doesn't work.

Drivers can decide not to lower mediump IO to 16 bits if nir->xfb_info
!= NULL for the pre-rast stage and if nir->info.prev_stage_has_xfb is
true for the FS stage. That way, drivers can lower mediump to 16 bits
for all cases except XFB.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35315>
This commit is contained in:
Marek Olšák
2025-06-03 10:17:19 -04:00
committed by Marge Bot
parent ebbcec76b0
commit 6e9e9c9f0c
2 changed files with 11 additions and 1 deletions
+8 -1
View File
@@ -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);
}
+3
View File
@@ -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 */