radv: Remove radv_streamout_info::num_outputs.

This field was never used for determining the number of outputs,
just for determining whether streamout was enabled, which makes
it unnecessary. We can use enabled_stream_buffers_mask for that.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34317>
This commit is contained in:
Timur Kristóf 2025-04-01 12:39:41 +02:00 committed by Marge Bot
parent ce2138d73a
commit e258492a8f
5 changed files with 7 additions and 10 deletions

View file

@ -3127,7 +3127,7 @@ radv_get_vgt_shader_key(const struct radv_device *device, struct radv_shader **s
if (last_vgt_shader->info.is_ngg) {
key.ngg = 1;
key.ngg_passthrough = last_vgt_shader->info.is_ngg_passthrough;
key.ngg_streamout = last_vgt_shader->info.so.num_outputs > 0;
key.ngg_streamout = !!last_vgt_shader->info.so.enabled_stream_buffers_mask;
}
if (shaders[MESA_SHADER_MESH]) {
key.mesh = 1;

View file

@ -2004,7 +2004,7 @@ radv_postprocess_binary_config(struct radv_device *device, struct radv_shader_bi
if (!pdev->use_ngg_streamout) {
config->rsrc2 |= S_00B12C_SO_BASE0_EN(!!info->so.strides[0]) | S_00B12C_SO_BASE1_EN(!!info->so.strides[1]) |
S_00B12C_SO_BASE2_EN(!!info->so.strides[2]) | S_00B12C_SO_BASE3_EN(!!info->so.strides[3]) |
S_00B12C_SO_EN(!!info->so.num_outputs);
S_00B12C_SO_EN(!!info->so.enabled_stream_buffers_mask);
}
config->rsrc1 = S_00B848_VGPRS((num_vgprs - 1) / (info->wave_size == 32 ? 8 : 4)) | S_00B848_DX10_CLAMP(dx10_clamp) |

View file

@ -111,7 +111,7 @@ declare_global_input_sgprs(const enum amd_gfx_level gfx_level, const struct radv
}
const bool needs_streamout_buffers =
info->so.num_outputs ||
info->so.enabled_stream_buffers_mask ||
(info->merged_shader_compiled_separately &&
((info->stage == MESA_SHADER_VERTEX && info->vs.as_es) ||
(info->stage == MESA_SHADER_TESS_EVAL && info->tes.as_es) || info->stage == MESA_SHADER_GEOMETRY));
@ -202,7 +202,7 @@ declare_streamout_sgprs(const struct radv_shader_info *info, struct radv_shader_
int i;
/* Streamout SGPRs. */
if (info->so.num_outputs) {
if (info->so.enabled_stream_buffers_mask) {
assert(stage == MESA_SHADER_VERTEX || stage == MESA_SHADER_TESS_EVAL);
ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.streamout_config);

View file

@ -372,8 +372,6 @@ gather_xfb_info(const nir_shader *nir, struct radv_shader_info *info)
return;
const nir_xfb_info *xfb = nir->xfb_info;
assert(xfb->output_count <= MAX_SO_OUTPUTS);
so->num_outputs = xfb->output_count;
u_foreach_bit(output_buffer, xfb->buffers_written) {
unsigned stream = xfb->buffer_to_stream[output_buffer];
@ -535,7 +533,7 @@ gather_shader_info_ngg_query(struct radv_device *device, struct radv_shader_info
const struct radv_physical_device *pdev = radv_device_physical(device);
info->gs.has_pipeline_stat_query = pdev->emulate_ngg_gs_query_pipeline_stat && info->stage == MESA_SHADER_GEOMETRY;
info->has_xfb_query = info->so.num_outputs > 0;
info->has_xfb_query = !!info->so.enabled_stream_buffers_mask;
info->has_prim_query = device->cache_key.primitives_generated_query || info->has_xfb_query;
}
@ -1443,7 +1441,7 @@ gfx10_get_ngg_scratch_lds_base(const struct radv_device *device, const struct ra
} else {
const bool uses_instanceid = es_info->vs.needs_instance_id;
const bool uses_primitive_id = es_info->uses_prim_id;
const bool streamout_enabled = es_info->so.num_outputs && pdev->use_ngg_streamout;
const bool streamout_enabled = es_info->so.enabled_stream_buffers_mask && pdev->use_ngg_streamout;
const uint32_t num_outputs =
es_info->stage == MESA_SHADER_VERTEX ? es_info->vs.num_outputs : es_info->tes.num_outputs;
unsigned pervertex_lds_bytes = ac_ngg_nogs_get_pervertex_lds_size(
@ -1527,7 +1525,7 @@ gfx10_get_ngg_info(const struct radv_device *device, struct radv_shader_info *es
/* LDS size for passing data from GS to ES. */
struct radv_streamout_info *so_info = &es_info->so;
if (so_info->num_outputs) {
if (so_info->enabled_stream_buffers_mask) {
/* Compute the same pervertex LDS size as the NGG streamout lowering pass which allocates
* space for all outputs.
* TODO: only alloc space for outputs that really need streamout.

View file

@ -53,7 +53,6 @@ struct radv_vs_output_info {
};
struct radv_streamout_info {
uint16_t num_outputs;
uint16_t strides[MAX_SO_BUFFERS];
uint32_t enabled_stream_buffers_mask;
};