Mesa (main): mesa: make struct in gl_program a union and remove FIXME
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 06:19:53 UTC 2021
Module: Mesa
Branch: main
Commit: ca16c271fa7b016714899c7dd92e0e7dd95c08e2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca16c271fa7b016714899c7dd92e0e7dd95c08e2
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Sat Dec 4 23:23:07 2021 +1100
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 9d99dc4bc1fd but also moves a
read of IsPositionInvariant inside an arb asm only code block
for safety.
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14059>
---
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
More information about the mesa-commit
mailing list