From ca16c271fa7b016714899c7dd92e0e7dd95c08e2 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Sat, 4 Dec 2021 23:23:07 +1100 Subject: [PATCH] mesa: make struct in gl_program a union and remove FIXME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 9d99dc4bc1fd but also moves a read of IsPositionInvariant inside an arb asm only code block for safety. Reviewed-by: Adam Jackson Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/mtypes.h | 6 +----- src/mesa/state_tracker/st_program.c | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 6096bcb9328..c86bb603bec 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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 */ diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index b8b0c760d6c..45554b99a11 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -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