Mesa (master): anv/pipeline: allow more than 16 FS inputs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 1 23:45:46 UTC 2020


Module: Mesa
Branch: master
Commit: 191ced539a18e4738e7e6bce7612779dced1625a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=191ced539a18e4738e7e6bce7612779dced1625a

Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date:   Tue Mar 31 10:59:20 2020 +0000

anv/pipeline: allow more than 16 FS inputs

A fragment shader can have more than 16 inputs, so SBE emission should
deal with all of them.

This fixes dEQP-VK.pipeline.max_varyings.*

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

---

 src/intel/vulkan/genX_pipeline.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 59c66267be7..70d77b4cd64 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -355,8 +355,10 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline)
 #  define swiz sbe
 #endif
 
-   /* Skip the VUE header and position slots by default */
-   unsigned urb_entry_read_offset = 1;
+   int first_slot = brw_compute_first_urb_slot_required(wm_prog_data->inputs,
+                                                        fs_input_map);
+   assert(first_slot % 2 == 0);
+   unsigned urb_entry_read_offset = first_slot / 2;
    int max_source_attr = 0;
    for (uint8_t idx = 0; idx < wm_prog_data->urb_setup_attribs_count; idx++) {
       uint8_t attr = wm_prog_data->urb_setup_attribs[idx];
@@ -366,7 +368,6 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline)
 
       /* gl_Viewport and gl_Layer are stored in the VUE header */
       if (attr == VARYING_SLOT_VIEWPORT || attr == VARYING_SLOT_LAYER) {
-         urb_entry_read_offset = 0;
          continue;
       }
 
@@ -377,9 +378,6 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline)
 
       const int slot = fs_input_map->varying_to_slot[attr];
 
-      if (input_index >= 16)
-         continue;
-
       if (slot == -1) {
          /* This attribute does not exist in the VUE--that means that the
           * vertex shader did not write to it.  It could be that it's a
@@ -393,15 +391,24 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline)
          swiz.Attribute[input_index].ComponentOverrideY = true;
          swiz.Attribute[input_index].ComponentOverrideZ = true;
          swiz.Attribute[input_index].ComponentOverrideW = true;
-      } else {
-         /* We have to subtract two slots to accout for the URB entry output
-          * read offset in the VS and GS stages.
-          */
-         const int source_attr = slot - 2 * urb_entry_read_offset;
-         assert(source_attr >= 0 && source_attr < 32);
-         max_source_attr = MAX2(max_source_attr, source_attr);
-         swiz.Attribute[input_index].SourceAttribute = source_attr;
+         continue;
       }
+
+      /* We have to subtract two slots to accout for the URB entry output
+       * read offset in the VS and GS stages.
+       */
+      const int source_attr = slot - 2 * urb_entry_read_offset;
+      assert(source_attr >= 0 && source_attr < 32);
+      max_source_attr = MAX2(max_source_attr, source_attr);
+      /* The hardware can only do overrides on 16 overrides at a time, and the
+       * other up to 16 have to be lined up so that the input index = the
+       * output index. We'll need to do some tweaking to make sure that's the
+       * case.
+       */
+      if (input_index < 16)
+         swiz.Attribute[input_index].SourceAttribute = source_attr;
+      else
+         assert(source_attr == input_index);
    }
 
    sbe.VertexURBEntryReadOffset = urb_entry_read_offset;



More information about the mesa-commit mailing list