Mesa (main): radv: make sure to load the Primitive ID for VS+GS as NGG

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 06:58:12 UTC 2021


Module: Mesa
Branch: main
Commit: 07d2c152bcb58ceb1626b15d664afd77ecbc4af4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=07d2c152bcb58ceb1626b15d664afd77ecbc4af4

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Sep 30 13:24:55 2021 +0200

radv: make sure to load the Primitive ID for VS+GS as NGG

When the VS doesn't export the Primitive ID but the FS needs it.

Fixes dEQP-VK.pipeline.framebuffer_attachment.no_attachments*.

Fixes: 7ad69e2f7ee ("radv: stop loading invocation ID for NGG vertex shaders")
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/13116>

---

 src/amd/vulkan/radv_shader.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 7d9e83a4bc0..a7c5a81c66d 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -1303,7 +1303,8 @@ radv_postprocess_config(const struct radv_device *device, const struct ac_shader
          stage == MESA_SHADER_TESS_EVAL && info->tes.primitive_mode >= 4; /* GL_TRIANGLES */
       if (info->uses_invocation_id) {
          gs_vgpr_comp_cnt = 3; /* VGPR3 contains InvocationID. */
-      } else if (info->uses_prim_id) {
+      } else if (info->uses_prim_id || (es_stage == MESA_SHADER_VERTEX &&
+                                        info->vs.outinfo.export_prim_id)) {
          gs_vgpr_comp_cnt = 2; /* VGPR2 contains PrimitiveID. */
       } else if (info->gs.vertices_in >= 3 || tes_triangles || nggc) {
          gs_vgpr_comp_cnt = 1; /* VGPR1 contains offsets 2, 3 */



More information about the mesa-commit mailing list