Mesa (staging/21.3): radv: fix removing PSIZ when it's not emitted by the last VGT stage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 18 20:57:13 UTC 2021


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Fri Oct 15 14:52:13 2021 +0200

radv: fix removing PSIZ when it's not emitted by the last VGT stage

This dereferences a NULL pointer and crash many tests with 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/13378>
(cherry picked from commit 61be0bd34b34617e52211280878e71d9d1f174eb)

---

 .pick_status.json              | 2 +-
 src/amd/vulkan/radv_pipeline.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 166ea34f9ed..ccf28ae86dc 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -283,7 +283,7 @@
         "description": "radv: fix removing PSIZ when it's not emitted by the last VGT stage",
         "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 5cf991dd93d..44ae5d919ea 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -2390,10 +2390,11 @@ radv_link_shaders(struct radv_pipeline *pipeline,
              (info->stage == MESA_SHADER_TESS_EVAL && info->tess.point_mode) ||
              (info->stage == MESA_SHADER_GEOMETRY && info->gs.output_primitive == GL_POINTS));
 
-         if (!next_stage_needs_psiz && !topology_uses_psiz) {
-            /* Change PSIZ to a global variable which allows it to be DCE'd. */
-            nir_variable *psiz_var =
+         nir_variable *psiz_var =
                nir_find_variable_with_location(ordered_shaders[i], nir_var_shader_out, VARYING_SLOT_PSIZ);
+
+         if (!next_stage_needs_psiz && !topology_uses_psiz && psiz_var) {
+            /* Change PSIZ to a global variable which allows it to be DCE'd. */
             psiz_var->data.location = 0;
             psiz_var->data.mode = nir_var_shader_temp;
 



More information about the mesa-commit mailing list