radv: Use nir_gather_xfb_info

Instead of gathering XFB info over and over again every time we even
want to know if the shader uses XFB, gather it once when we compile the
shader and refer to the copy in the NIR.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16750>
This commit is contained in:
Jason Ekstrand
2022-05-27 12:30:02 -05:00
committed by Marge Bot
parent c8e191e369
commit 7003ff2e3a
3 changed files with 10 additions and 21 deletions

View File

@@ -27,7 +27,6 @@
#include "nir/nir.h"
#include "nir/nir_builder.h"
#include "nir/nir_xfb_info.h"
#include "spirv/nir_spirv.h"
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
@@ -2809,20 +2808,6 @@ get_vs_output_info(const struct radv_graphics_pipeline *pipeline)
return &pipeline->base.shaders[MESA_SHADER_VERTEX]->info.vs.outinfo;
}
static bool
radv_nir_stage_uses_xfb(const nir_shader *nir)
{
/* Mesh shaders don't support XFB. */
if (nir->info.stage == MESA_SHADER_MESH)
return false;
nir_xfb_info *xfb = nir_shader_get_xfb_info(nir, NULL);
bool uses_xfb = !!xfb;
ralloc_free(xfb);
return uses_xfb;
}
static bool
radv_lower_viewport_to_zero(nir_shader *nir)
{
@@ -3091,7 +3076,7 @@ radv_link_shaders(struct radv_pipeline *pipeline,
if (!optimize_conservatively) {
bool uses_xfb = last_vgt_api_stage != -1 &&
radv_nir_stage_uses_xfb(stages[last_vgt_api_stage].nir);
stages[last_vgt_api_stage].nir->xfb_info;
for (unsigned i = 0; i < shader_count; ++i) {
shader_info *info = &ordered_shaders[i]->info;
@@ -3559,7 +3544,7 @@ radv_fill_shader_info_ngg(struct radv_pipeline *pipeline,
}
bool uses_xfb = stages[last_xfb_stage].nir &&
radv_nir_stage_uses_xfb(stages[last_xfb_stage].nir);
stages[last_xfb_stage].nir->xfb_info;
if (!device->physical_device->use_ngg_streamout && uses_xfb) {
/* GFX11+ requires NGG. */