summaryrefslogtreecommitdiff
path: root/src/amd/vulkan/radv_shader_info.c
diff options
context:
space:
mode:
authorRhys Perry <pendingchaos02@gmail.com>2021-04-16 11:55:59 +0100
committerMarge Bot <eric+marge@anholt.net>2021-10-13 05:13:10 +0000
commit80841196b2dc921db38d9f3403e67d57749bc1d8 (patch)
tree4a93a5171fec8198ae0b7f04a5116fc7e616f3d8 /src/amd/vulkan/radv_shader_info.c
parent2b8d88ed919ea1990d7ad8354a31030a37f94c7a (diff)
radv: implement dynamic vertex input state using vertex shader prologs
This doesn't actually use the functionality or implement prolog compilation yet. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11717>
Diffstat (limited to 'src/amd/vulkan/radv_shader_info.c')
-rw-r--r--src/amd/vulkan/radv_shader_info.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c
index 10069a4cc42..40042e3b4fe 100644
--- a/src/amd/vulkan/radv_shader_info.c
+++ b/src/amd/vulkan/radv_shader_info.c
@@ -608,12 +608,23 @@ radv_nir_shader_info_pass(struct radv_device *device, const struct nir_shader *n
}
if (nir->info.stage == MESA_SHADER_VERTEX) {
+ if (pipeline_key->vs.dynamic_input_state && nir->info.inputs_read) {
+ info->vs.has_prolog = true;
+ info->vs.dynamic_inputs = true;
+ }
+
/* Use per-attribute vertex descriptors to prevent faults and
* for correct bounds checking.
*/
- info->vs.use_per_attribute_vb_descs = device->robust_buffer_access;
+ info->vs.use_per_attribute_vb_descs = device->robust_buffer_access || info->vs.dynamic_inputs;
}
+ /* We have to ensure consistent input register assignments between the main shader and the
+ * prolog. */
+ info->vs.needs_instance_id |= info->vs.has_prolog;
+ info->vs.needs_base_instance |= info->vs.has_prolog;
+ info->vs.needs_draw_id |= info->vs.has_prolog;
+
nir_foreach_shader_in_variable (variable, nir)
gather_info_input_decl(nir, variable, pipeline_key, info);