mesa/st: add a gl_program struct flag to skip psiz exports for xfb

if this output did not exist in the original shader,
then it must not be exported in xfb

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
This commit is contained in:
Mike Blumenkrantz 2022-03-02 14:03:42 -05:00 committed by Marge Bot
parent 53cbba83eb
commit 597bd11b7b
3 changed files with 11 additions and 0 deletions

View file

@ -531,6 +531,9 @@ struct gl_program
/** Is this program written to on disk shader cache */
bool program_written_to_cache;
/** whether to skip VARYING_SLOT_PSIZ in st_translate_stream_output_info() */
bool skip_pointsize_xfb;
/** A bitfield indicating which vertex shader inputs consume two slots
*
* This is used for mapping from single-slot input locations in the GL API

View file

@ -304,6 +304,8 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog,
st->ctx->SoftFP64 = glsl_float64_funcs_to_nir(st->ctx, options);
}
prog->skip_pointsize_xfb = !(nir->info.outputs_written & VARYING_BIT_PSIZ);
/* ES has strict SSO validation rules for shader IO matching so we can't
* remove dead IO until the resource list has been built. Here we skip
* removing them until later. This will potentially make the IO lowering

View file

@ -472,6 +472,12 @@ st_translate_stream_output_info(struct gl_program *prog)
memset(output_mapping, 0, sizeof(output_mapping));
for (unsigned attr = 0; attr < VARYING_SLOT_MAX; attr++) {
/* this output was added by mesa/st and should not be tracked for xfb:
* drivers must check var->data.explicit_location to find the original output
* and only emit that one for xfb
*/
if (prog->skip_pointsize_xfb && attr == VARYING_SLOT_PSIZ)
continue;
if (prog->info.outputs_written & BITFIELD64_BIT(attr))
output_mapping[attr] = num_outputs++;
}