---
 src/gallium/drivers/radeonsi/si_shader_nir.c | 28 +++++++++++++++-----
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c 
b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 04e9e217306..ba7c0b31bd2 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -437,16 +437,30 @@ void si_nir_scan_shader(const struct nir_shader *nir,
                 * variable->data.driver_location.
                 */
                if (nir->info.stage == MESA_SHADER_VERTEX) {
-                       /* TODO: gather the actual input useage and remove 
this. */
-                       info->input_usage_mask[i] = TGSI_WRITEMASK_XYZW;
+                       for (unsigned j = 0; j < attrib_count; j++, i++) {
 
-                       if (glsl_type_is_dual_slot(variable->type)) {
-                               num_inputs += 2;
+                               unsigned num_components;
+                               unsigned component;
+                               get_num_of_component_info(variable, 0, 
&num_components, &component);
+
+                               info->input_usage_mask[i + j] |= 
get_component_usagemask(component, num_components);
+
+                               if 
(glsl_type_is_dual_slot(glsl_without_array(variable->type))) {
+                                       get_num_of_component_info(variable, 1, 
&num_components, &component);
+                                       info->input_usage_mask[i + j + 1] |= 
get_component_usagemask(component, num_components);
+                               }
+
+                               if (processed_inputs & ((uint64_t)1 << i))
+                                       continue;
+
+                               processed_inputs |= ((uint64_t)1 << i);
+
+                               if 
(glsl_type_is_dual_slot(glsl_without_array(variable->type)))
+                                       num_inputs++;
 
-                               /* TODO: gather the actual input useage and 
remove this. */
-                               info->input_usage_mask[i+1] = 
TGSI_WRITEMASK_XYZW;
-                       } else
                                num_inputs++;
+                       }
+
                        continue;
                }
 
-- 
2.20.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to