Re: [Mesa-dev] [PATCH 4/5] radv/gfx10: do not enable NGG if a pipeline uses XFB

2019-07-23 Thread Samuel Pitoiset


On 7/23/19 9:31 PM, Bas Nieuwenhuizen wrote:

On Tue, Jul 23, 2019 at 3:21 PM Samuel Pitoiset
 wrote:

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

Signed-off-by: Samuel Pitoiset 
---
  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;

transform feedback can only happen on the last stage before PS right?
Can we first determine what the last shader is and only then check for
xfb? That way we don't have to scan 3 shaders.

Yes. Pushed with this slightly improved.

+
+   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

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

Re: [Mesa-dev] [PATCH 4/5] radv/gfx10: do not enable NGG if a pipeline uses XFB

2019-07-23 Thread Bas Nieuwenhuizen
On Tue, Jul 23, 2019 at 3:21 PM Samuel Pitoiset
 wrote:
>
> NGG GS for streamout requires a bunch of work, so enable it with
> the legacy path only for now.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  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;

transform feedback can only happen on the last stage before PS right?
Can we first determine what the last shader is and only then check for
xfb? That way we don't have to scan 3 shaders.
> +
> +   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
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 4/5] radv/gfx10: do not enable NGG if a pipeline uses XFB

2019-07-23 Thread Samuel Pitoiset
NGG GS for streamout requires a bunch of work, so enable it with
the legacy path only for now.

Signed-off-by: Samuel Pitoiset 
---
 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