From a0314083be59e9c8cc6b467d77f5ba91436b63d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 1 Jan 2021 14:01:25 -0500 Subject: [PATCH] mesa: fix a second bug in merging light state parameters with unpacked uniforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- 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 -