mesa: make struct in gl_program a union and remove FIXME

Now that the classic drivers that were mixing the use of these asm
and glsl shader fields are gone we can finally use a union here.

This basically reverts commit 9d99dc4bc1 but also moves a
read of IsPositionInvariant inside an arb asm only code block
for safety.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14059>
This commit is contained in:
Timothy Arceri 2021-12-04 23:23:07 +11:00 committed by Marge Bot
parent df6ff88fd0
commit ca16c271fa
2 changed files with 4 additions and 8 deletions

View File

@ -2187,11 +2187,7 @@ struct gl_program
/** Map from sampler unit to texture unit (set by glUniform1i()) */
GLubyte SamplerUnits[MAX_SAMPLERS];
/* FIXME: We should be able to make this struct a union. However some
* drivers (i915/fragment_programs, swrast/prog_execute) mix the use of
* these fields, we should fix this.
*/
struct {
union {
/** Fields used by GLSL programs */
struct {
/** Data shared by gl_program and gl_shader_program */

View File

@ -588,11 +588,11 @@ st_translate_vertex_program(struct st_context *st,
ubyte output_semantic_name[VARYING_SLOT_MAX] = {0};
ubyte output_semantic_index[VARYING_SLOT_MAX] = {0};
if (stp->Base.arb.IsPositionInvariant)
_mesa_insert_mvp_code(st->ctx, &stp->Base);
/* ARB_vp: */
if (!stp->glsl_to_tgsi) {
if (stp->Base.arb.IsPositionInvariant)
_mesa_insert_mvp_code(st->ctx, &stp->Base);
_mesa_remove_output_reads(&stp->Base, PROGRAM_OUTPUT);
/* This determines which states will be updated when the assembly