radv: do not unconditionally disable NGG streamout lowering in NIR
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 26 Oct 2022 13:10:57 +0000 (13:10 +0000)
committerMarge Bot <emma+marge@anholt.net>
Mon, 31 Oct 2022 13:48:39 +0000 (13:48 +0000)
This is still always disabled because use_ngg_streamout is FALSE
but it will be turned on at some point.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19317>

src/amd/vulkan/radv_shader.c

index ac58fe3..4991703 100644 (file)
@@ -1331,7 +1331,7 @@ radv_consider_culling(const struct radv_physical_device *pdevice, struct nir_sha
 }
 
 static void
-setup_ngg_lds_layout(nir_shader *nir, struct radv_shader_info *info,
+setup_ngg_lds_layout(struct radv_device *device, nir_shader *nir, struct radv_shader_info *info,
                      unsigned max_vtx_in)
 {
    unsigned scratch_lds_base = 0;
@@ -1346,7 +1346,7 @@ setup_ngg_lds_layout(nir_shader *nir, struct radv_shader_info *info,
       unsigned pervertex_lds_bytes =
          ac_ngg_nogs_get_pervertex_lds_size(stage,
                                             nir->num_outputs,
-                                            false, /* streamout */
+                                            device->physical_device->use_ngg_streamout,
                                             info->outinfo.export_prim_id,
                                             false, /* user edge flag */
                                             info->has_ngg_culling,
@@ -1370,7 +1370,7 @@ setup_ngg_lds_layout(nir_shader *nir, struct radv_shader_info *info,
       ac_ngg_get_scratch_lds_size(stage,
                                   info->workgroup_size,
                                   info->wave_size,
-                                  false, /* streamout */
+                                  device->physical_device->use_ngg_streamout,
                                   info->has_ngg_culling);
 
    /* Get total LDS usage. */
@@ -1428,7 +1428,7 @@ void radv_lower_ngg(struct radv_device *device, struct radv_pipeline_stage *ngg_
    /* Invocations that process an input vertex */
    unsigned max_vtx_in = MIN2(256, ngg_info->hw_max_esverts);
 
-   setup_ngg_lds_layout(nir, &ngg_stage->info, max_vtx_in);
+   setup_ngg_lds_layout(device, nir, &ngg_stage->info, max_vtx_in);
 
    ac_nir_lower_ngg_options options = {0};
    options.family = device->physical_device->rad_info.family;
@@ -1436,7 +1436,7 @@ void radv_lower_ngg(struct radv_device *device, struct radv_pipeline_stage *ngg_
    options.max_workgroup_size = info->workgroup_size;
    options.wave_size = info->wave_size;
    options.can_cull = nir->info.stage != MESA_SHADER_GEOMETRY && info->has_ngg_culling;
-   options.disable_streamout = true;
+   options.disable_streamout = !device->physical_device->use_ngg_streamout;
 
    if (nir->info.stage == MESA_SHADER_VERTEX ||
        nir->info.stage == MESA_SHADER_TESS_EVAL) {