Mesa (master): mesa: fix a second bug in merging light state parameters with unpacked uniforms

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 5 04:11:34 UTC 2021


Module: Mesa
Branch: master
Commit: a0314083be59e9c8cc6b467d77f5ba91436b63d6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0314083be59e9c8cc6b467d77f5ba91436b63d6

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Jan  1 14:01:25 2021 -0500

mesa: fix a second bug in merging light state parameters with unpacked uniforms

The memcpy size should be packed even if the allocated parameter size
is padded to 4 components.

Reviewed-by: Zoltán Böszörményi <zboszor at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8017>

---

 src/mesa/program/prog_statevars.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 1b00bacf5b7..52514361494 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -1389,8 +1389,14 @@ _mesa_optimize_state_parameters(struct gl_constants *consts,
                list->Parameters[first_param].StateIndexes[1] * /* light index */
                sizeof(struct gl_light_uniforms) / 4 +
                (list->Parameters[first_param].StateIndexes[2] - STATE_AMBIENT) * 4;
-            /* Set the size in floats. */
+
+            /* Set the real size in floats that we will upload (memcpy). */
             list->Parameters[first_param].StateIndexes[2] =
+               _mesa_program_state_value_size(list->Parameters[last_param].StateIndexes) +
+               list->Parameters[last_param].ValueOffset -
+               list->Parameters[first_param].ValueOffset;
+
+            /* Set the allocated size, which can be aligned to 4 components. */
             list->Parameters[first_param].Size =
                list->Parameters[last_param].Size +
                list->Parameters[last_param].ValueOffset -



More information about the mesa-commit mailing list