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

Author: Samuel Pitoiset <[email protected]>
Date:   Tue Jul 23 15:12:42 2019 +0200

radv/gfx10: do not enable NGG if a pipeline uses XFB

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

Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>

---

 src/amd/vulkan/radv_pipeline.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 7446096b7ba..583b600dfdd 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,22 @@ 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. */
+               gl_shader_stage last_xfb_stage = MESA_SHADER_VERTEX;
+
+               for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; 
i++) {
+                       if (nir[i])
+                               last_xfb_stage = i;
+               }
+
+               if (nir[last_xfb_stage] &&
+                   radv_nir_stage_uses_xfb(nir[last_xfb_stage])) {
+                       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)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to