mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-21 10:50:23 +01:00
zink: only export necessary xfb outputs to ntv
the full-variable outputs can be skipped, leaving only the varyings which actually need explicit emission due to packed layouts or whatever Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9271>
This commit is contained in:
parent
1f42ff77df
commit
7ed57e60fc
3 changed files with 6 additions and 14 deletions
|
|
@ -1260,8 +1260,6 @@ emit_so_info(struct ntv_context *ctx, const struct zink_so_info *so_info)
|
|||
{
|
||||
unsigned output = 0;
|
||||
for (unsigned i = 0; i < so_info->so_info.num_outputs; i++) {
|
||||
if (so_info->skip[i])
|
||||
continue;
|
||||
struct pipe_stream_output so_output = so_info->so_info.output[i];
|
||||
unsigned slot = so_info->so_info_slots[i] << 2 | so_output.start_component;
|
||||
SpvId out_type = get_output_type(ctx, slot, so_output.num_components);
|
||||
|
|
@ -1309,8 +1307,6 @@ emit_so_outputs(struct ntv_context *ctx,
|
|||
const struct zink_so_info *so_info)
|
||||
{
|
||||
for (unsigned i = 0; i < so_info->so_info.num_outputs; i++) {
|
||||
if (so_info->skip[i])
|
||||
continue;
|
||||
uint32_t components[NIR_MAX_VEC_COMPONENTS];
|
||||
unsigned slot = so_info->so_info_slots[i];
|
||||
struct pipe_stream_output so_output = so_info->so_info.output[i];
|
||||
|
|
|
|||
|
|
@ -424,16 +424,16 @@ update_so_info(struct zink_shader *zs, const struct pipe_stream_output_info *so_
|
|||
for (unsigned i = 0; i < so_info->num_outputs; i++) {
|
||||
const struct pipe_stream_output *output = &so_info->output[i];
|
||||
unsigned slot = reverse_map[output->register_index];
|
||||
/* always set stride to be used during draw */
|
||||
zs->streamout.so_info.stride[output->output_buffer] = so_info->stride[output->output_buffer];
|
||||
if ((zs->nir->info.stage != MESA_SHADER_GEOMETRY || util_bitcount(zs->nir->info.gs.active_stream_mask) == 1) &&
|
||||
!output->start_component) {
|
||||
nir_variable *var = NULL;
|
||||
while (!var)
|
||||
var = nir_find_variable_with_location(zs->nir, nir_var_shader_out, slot--);
|
||||
slot++;
|
||||
if (inlined[slot]) {
|
||||
zs->streamout.skip[i] = true;
|
||||
if (inlined[slot])
|
||||
continue;
|
||||
}
|
||||
assert(var && var->data.location == slot);
|
||||
/* if this is the entire variable, try to blast it out during the initial declaration */
|
||||
if (glsl_get_components(var->type) == output->num_components) {
|
||||
|
|
@ -442,13 +442,13 @@ update_so_info(struct zink_shader *zs, const struct pipe_stream_output_info *so_
|
|||
var->data.xfb.stride = so_info->stride[output->output_buffer] * 4;
|
||||
var->data.offset = output->dst_offset * 4;
|
||||
var->data.stream = output->stream;
|
||||
zs->streamout.skip[i] = true;
|
||||
inlined[slot] = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
zs->streamout.so_info.output[zs->streamout.so_info.num_outputs] = *output;
|
||||
/* Map Gallium's condensed "slots" back to real VARYING_SLOT_* enums */
|
||||
zs->streamout.so_info_slots[i] = reverse_map[output->register_index];
|
||||
zs->streamout.so_info_slots[zs->streamout.so_info.num_outputs++] = reverse_map[output->register_index];
|
||||
}
|
||||
zs->streamout.have_xfb = true;
|
||||
}
|
||||
|
|
@ -691,11 +691,8 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir,
|
|||
}
|
||||
|
||||
ret->nir = nir;
|
||||
if (so_info && nir->info.outputs_written && nir->info.has_transform_feedback_varyings) {
|
||||
memcpy(&ret->streamout.so_info, so_info, sizeof(struct pipe_stream_output_info));
|
||||
if (so_info && nir->info.outputs_written && nir->info.has_transform_feedback_varyings)
|
||||
update_so_info(ret, so_info, nir->info.outputs_written, have_psiz);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ struct tgsi_token;
|
|||
struct zink_so_info {
|
||||
struct pipe_stream_output_info so_info;
|
||||
unsigned so_info_slots[PIPE_MAX_SO_OUTPUTS];
|
||||
bool skip[PIPE_MAX_SO_OUTPUTS];
|
||||
bool have_xfb;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue