anv: use urb_setup_attribs in SBE
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Wed, 11 Mar 2020 10:35:13 +0000 (10:35 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 1 Apr 2020 23:36:28 +0000 (23:36 +0000)
Avoid looping over all VARYING_SLOT_MAX urb_setup arrray entries.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2010>

src/intel/vulkan/genX_pipeline.c

index b02b9e96db5c5cdf689d3e73ed349e7e3054281d..59c66267be7beeb549857f3d5cfcfa6173f8e3e3 100644 (file)
@@ -358,11 +358,11 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline)
    /* Skip the VUE header and position slots by default */
    unsigned urb_entry_read_offset = 1;
    int max_source_attr = 0;
-   for (int attr = 0; attr < VARYING_SLOT_MAX; attr++) {
+   for (uint8_t idx = 0; idx < wm_prog_data->urb_setup_attribs_count; idx++) {
+      uint8_t attr = wm_prog_data->urb_setup_attribs[idx];
       int input_index = wm_prog_data->urb_setup[attr];
 
-      if (input_index < 0)
-         continue;
+      assert(0 <= input_index);
 
       /* gl_Viewport and gl_Layer are stored in the VUE header */
       if (attr == VARYING_SLOT_VIEWPORT || attr == VARYING_SLOT_LAYER) {