mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 15:40:11 +01:00
st/glsl: fix broken vertex attrib mapping
Here we move the nir_get_single_slot_attribs_mask() call that sets the
inputs_read mask after NIR optimisations have finished and after
st_nir_assign_vs_in_locations() has been called.
Besides fixing a bug where the mappings would be missaligned if
further NIR optimisations resulted in less inputs being read, it
also allows us to drop an additional nir gather info call.
Fixes: 0909a57b63 ("radeonsi/nir: Set vs_inputs_dual_locations and let NIR do the remap")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6240
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17326>
This commit is contained in:
parent
5d4425ca1c
commit
4e797ac530
1 changed files with 11 additions and 28 deletions
|
|
@ -85,19 +85,6 @@ st_nir_fixup_varying_slots(struct st_context *st, nir_shader *shader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
st_shader_gather_info(nir_shader *nir, struct gl_program *prog)
|
|
||||||
{
|
|
||||||
nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
|
|
||||||
|
|
||||||
/* Copy the info we just generated back into the gl_program */
|
|
||||||
const char *prog_name = prog->info.name;
|
|
||||||
const char *prog_label = prog->info.label;
|
|
||||||
prog->info = nir->info;
|
|
||||||
prog->info.name = prog_name;
|
|
||||||
prog->info.label = prog_label;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* input location assignment for VS inputs must be handled specially, so
|
/* input location assignment for VS inputs must be handled specially, so
|
||||||
* that it is aligned w/ st's vbo state.
|
* that it is aligned w/ st's vbo state.
|
||||||
* (This isn't the case with, for ex, FS inputs, which only need to agree
|
* (This isn't the case with, for ex, FS inputs, which only need to agree
|
||||||
|
|
@ -797,17 +784,6 @@ st_link_nir(struct gl_context *ctx,
|
||||||
if (!st->screen->get_param(st->screen, PIPE_CAP_CULL_DISTANCE_NOCOMBINE))
|
if (!st->screen->get_param(st->screen, PIPE_CAP_CULL_DISTANCE_NOCOMBINE))
|
||||||
NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
|
NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
|
||||||
|
|
||||||
st_shader_gather_info(nir, shader->Program);
|
|
||||||
if (shader->Stage == MESA_SHADER_VERTEX) {
|
|
||||||
/* NIR expands dual-slot inputs out to two locations. We need to
|
|
||||||
* compact things back down GL-style single-slot inputs to avoid
|
|
||||||
* confusing the state tracker.
|
|
||||||
*/
|
|
||||||
shader->Program->info.inputs_read =
|
|
||||||
nir_get_single_slot_attribs_mask(nir->info.inputs_read,
|
|
||||||
shader->Program->DualSlotInputs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i >= 1) {
|
if (i >= 1) {
|
||||||
struct gl_program *prev_shader = linked_shader[i - 1]->Program;
|
struct gl_program *prev_shader = linked_shader[i - 1]->Program;
|
||||||
|
|
||||||
|
|
@ -881,12 +857,19 @@ st_link_nir(struct gl_context *ctx,
|
||||||
prog->info.num_ssbos = old_info.num_ssbos;
|
prog->info.num_ssbos = old_info.num_ssbos;
|
||||||
prog->info.num_ubos = old_info.num_ubos;
|
prog->info.num_ubos = old_info.num_ubos;
|
||||||
prog->info.num_abos = old_info.num_abos;
|
prog->info.num_abos = old_info.num_abos;
|
||||||
if (prog->info.stage == MESA_SHADER_VERTEX)
|
|
||||||
prog->info.inputs_read = old_info.inputs_read;
|
if (prog->info.stage == MESA_SHADER_VERTEX) {
|
||||||
|
/* NIR expands dual-slot inputs out to two locations. We need to
|
||||||
|
* compact things back down GL-style single-slot inputs to avoid
|
||||||
|
* confusing the state tracker.
|
||||||
|
*/
|
||||||
|
prog->info.inputs_read =
|
||||||
|
nir_get_single_slot_attribs_mask(prog->nir->info.inputs_read,
|
||||||
|
prog->DualSlotInputs);
|
||||||
|
|
||||||
/* Initialize st_vertex_program members. */
|
/* Initialize st_vertex_program members. */
|
||||||
if (shader->Stage == MESA_SHADER_VERTEX)
|
|
||||||
st_prepare_vertex_program(prog);
|
st_prepare_vertex_program(prog);
|
||||||
|
}
|
||||||
|
|
||||||
/* Get pipe_stream_output_info. */
|
/* Get pipe_stream_output_info. */
|
||||||
if (shader->Stage == MESA_SHADER_VERTEX ||
|
if (shader->Stage == MESA_SHADER_VERTEX ||
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue