NGG GS for streamout requires a bunch of work, so enable it with
the legacy path only for now.

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
 src/amd/vulkan/radv_pipeline.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index a7ff0e2d139..0903e5abf37 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -33,6 +33,7 @@
 #include "radv_shader.h"
 #include "nir/nir.h"
 #include "nir/nir_builder.h"
+#include "nir/nir_xfb_info.h"
 #include "spirv/nir_spirv.h"
 #include "vk_util.h"
 
@@ -2269,6 +2270,16 @@ radv_generate_graphics_pipeline_key(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 void
 radv_fill_shader_keys(struct radv_device *device,
                      struct radv_shader_variant_key *keys,
@@ -2321,6 +2332,23 @@ radv_fill_shader_keys(struct radv_device *device,
                         */
                        keys[MESA_SHADER_TESS_EVAL].vs_common_out.as_ngg = 
false;
                }
+
+               /* TODO: Implement streamout support for NGG. */
+               bool uses_xfb = false;
+               if ((nir[MESA_SHADER_VERTEX] &&
+                    radv_nir_stage_uses_xfb(nir[MESA_SHADER_VERTEX])) ||
+                   (nir[MESA_SHADER_TESS_EVAL] &&
+                    radv_nir_stage_uses_xfb(nir[MESA_SHADER_TESS_EVAL])) ||
+                   (nir[MESA_SHADER_GEOMETRY] &&
+                    radv_nir_stage_uses_xfb(nir[MESA_SHADER_GEOMETRY])))
+                       uses_xfb = true;
+
+               if (uses_xfb) {
+                       if (nir[MESA_SHADER_TESS_CTRL])
+                               
keys[MESA_SHADER_TESS_EVAL].vs_common_out.as_ngg = false;
+                       else
+                               keys[MESA_SHADER_VERTEX].vs_common_out.as_ngg = 
false;
+               }
        }
 
        for(int i = 0; i < MESA_SHADER_STAGES; ++i)
-- 
2.22.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to