Mesa (staging/21.3): radv: do not remove PSIZ for streamout shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 19 20:59:46 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: edf6cb5fdd910e696bd8941a79127b2891242e13
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=edf6cb5fdd910e696bd8941a79127b2891242e13

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon Oct 18 17:30:46 2021 +0200

radv: do not remove PSIZ for streamout shaders

It might still be read later from the streamout buffer.

Fixes a regression with
ext_transform_feedback-builtin-varyings gl_PointSize and Zink.

Fixes: 92e1981a800 ("radv: Remove PSIZ output when it isn't needed.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13413>
(cherry picked from commit 19c91a120d49ec5233c271f351495e662795223d)

---

 .pick_status.json              |  2 +-
 src/amd/vulkan/radv_pipeline.c | 24 +++++++++++++-----------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 91c5950316c..28a75414998 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -310,7 +310,7 @@
         "description": "radv: do not remove PSIZ for streamout shaders",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "92e1981a8005c0ca7f48f38ddf8ff2b99ce95e7e"
     },
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 44ae5d919ea..c96fdd80f6a 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -2285,6 +2285,16 @@ get_vs_output_info(const struct radv_pipeline *pipeline)
       return &pipeline->shaders[MESA_SHADER_VERTEX]->info.vs.outinfo;
 }
 
+static bool
+radv_nir_stage_uses_xfb(const nir_shader *nir)
+{
+   nir_xfb_info *xfb = nir_gather_xfb_info(nir, NULL);
+   bool uses_xfb = !!xfb;
+
+   ralloc_free(xfb);
+   return uses_xfb;
+}
+
 static void
 radv_link_shaders(struct radv_pipeline *pipeline,
                   const struct radv_pipeline_key *pipeline_key,
@@ -2372,7 +2382,9 @@ radv_link_shaders(struct radv_pipeline *pipeline,
       }
    }
 
-   if (!optimize_conservatively) {
+   bool uses_xfb = pipeline->graphics.last_vgt_api_stage != -1 &&
+                   radv_nir_stage_uses_xfb(shaders[pipeline->graphics.last_vgt_api_stage]);
+   if (!uses_xfb && !optimize_conservatively) {
       /* Remove PSIZ from shaders when it's not needed.
        * This is typically produced by translation layers like Zink or D9VK.
        */
@@ -2703,16 +2715,6 @@ radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline,
    return key;
 }
 
-static bool
-radv_nir_stage_uses_xfb(const nir_shader *nir)
-{
-   nir_xfb_info *xfb = nir_gather_xfb_info(nir, NULL);
-   bool uses_xfb = !!xfb;
-
-   ralloc_free(xfb);
-   return uses_xfb;
-}
-
 static uint8_t
 radv_get_wave_size(struct radv_device *device, const VkPipelineShaderStageCreateInfo *pStage,
                    gl_shader_stage stage, const struct radv_shader_info *info)



More information about the mesa-commit mailing list