mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
radeonsi: assert that IO bases don't have holes & the same base isn't used twice
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38802>
This commit is contained in:
parent
affaf36685
commit
d06616063c
1 changed files with 29 additions and 0 deletions
|
|
@ -133,6 +133,11 @@ static void scan_io_usage(const nir_shader *nir, struct si_shader_info *info,
|
|||
for (unsigned i = 0; i < num_slots; i++) {
|
||||
unsigned loc = driver_location + i;
|
||||
|
||||
/* No 2 inputs can use the same driver location. */
|
||||
assert((info->input_semantic[loc] == semantic + i ||
|
||||
info->input_semantic[loc] == NUM_TOTAL_VARYING_SLOTS) &&
|
||||
"nir_recompute_io_bases wasn't called");
|
||||
|
||||
info->input_semantic[loc] = semantic + i;
|
||||
|
||||
if (mask)
|
||||
|
|
@ -164,6 +169,11 @@ static void scan_io_usage(const nir_shader *nir, struct si_shader_info *info,
|
|||
}
|
||||
}
|
||||
|
||||
/* No 2 outputs can use the same driver location. */
|
||||
assert((info->output_semantic[loc] == slot_semantic ||
|
||||
info->output_semantic[loc] == NUM_TOTAL_VARYING_SLOTS) &&
|
||||
"nir_recompute_io_bases wasn't called");
|
||||
|
||||
info->output_semantic[loc] = slot_semantic;
|
||||
|
||||
if (!is_output_load && mask) {
|
||||
|
|
@ -501,6 +511,14 @@ void si_nir_scan_shader(struct si_screen *sscreen, struct nir_shader *nir,
|
|||
}
|
||||
}
|
||||
|
||||
/* Initialize all IO slots to an invalid value. We use this to prevent 2 different
|
||||
* inputs/outputs from using the same IO slot.
|
||||
*/
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(info->input_semantic); i++)
|
||||
info->input_semantic[i] = NUM_TOTAL_VARYING_SLOTS;
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(info->output_semantic); i++)
|
||||
info->output_semantic[i] = NUM_TOTAL_VARYING_SLOTS;
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
info->color_interpolate[0] = nir->info.fs.color0_interp;
|
||||
info->color_interpolate[1] = nir->info.fs.color1_interp;
|
||||
|
|
@ -676,6 +694,17 @@ void si_nir_scan_shader(struct si_screen *sscreen, struct nir_shader *nir,
|
|||
nir->info.clip_distance_array_size ||
|
||||
nir->info.cull_distance_array_size;
|
||||
|
||||
/* There should be no holes in slots except VS inputs. */
|
||||
if (nir->info.stage != MESA_SHADER_VERTEX) {
|
||||
for (unsigned i = 0; i < info->num_inputs; i++)
|
||||
assert(info->input_semantic[i] != NUM_TOTAL_VARYING_SLOTS &&
|
||||
"nir_recompute_io_bases wasn't called");
|
||||
}
|
||||
for (unsigned i = 0; i < info->num_outputs; i++) {
|
||||
assert(info->output_semantic[i] != NUM_TOTAL_VARYING_SLOTS &&
|
||||
"nir_recompute_io_bases wasn't called");
|
||||
}
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
for (unsigned i = 0; i < info->num_inputs; i++) {
|
||||
unsigned semantic = info->input_semantic[i];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue