radv: Add helper for determining per-attribute vertex buffer descriptors.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28172>
This commit is contained in:
Timur Kristóf
2024-03-26 19:20:07 +01:00
committed by Marge Bot
parent e04f66ae33
commit 5156d3097b

View File

@@ -34,6 +34,14 @@ mark_sampler_desc(const nir_variable *var, struct radv_shader_info *info)
info->desc_set_used_mask |= (1u << var->data.descriptor_set);
}
static bool
radv_use_per_attribute_vb_descs(const nir_shader *nir,
const struct radv_graphics_state_key *gfx_state,
const struct radv_shader_stage_key *stage_key)
{
return stage_key->vertex_robustness1 || (gfx_state->vs.has_prolog && nir->info.inputs_read);
}
static void
gather_load_vs_input_info(const nir_shader *nir, const nir_intrinsic_instr *intrin, struct radv_shader_info *info,
const struct radv_graphics_state_key *gfx_state,
@@ -535,7 +543,7 @@ gather_shader_info_vs(struct radv_device *device, const nir_shader *nir,
}
/* Use per-attribute vertex descriptors to prevent faults and for correct bounds checking. */
info->vs.use_per_attribute_vb_descs = stage_key->vertex_robustness1 || info->vs.dynamic_inputs;
info->vs.use_per_attribute_vb_descs = radv_use_per_attribute_vb_descs(nir, gfx_state, stage_key);
/* We have to ensure consistent input register assignments between the main shader and the
* prolog.