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

Author: Marek Olšák <[email protected]>
Date:   Mon Mar 15 09:58:19 2021 -0400

mesa: fix parameter reservation size

Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9360>

---

 src/mesa/program/prog_parameter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/program/prog_parameter.c 
b/src/mesa/program/prog_parameter.c
index d78d9be3da2..7af2ace2037 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -283,7 +283,8 @@ _mesa_add_parameter(struct gl_program_parameter_list 
*paramList,
    else if (_mesa_gl_datatype_is_64bit(datatype))
       oldValNum = align(oldValNum, 2); /* pad start to 64-bit */
 
-   _mesa_reserve_parameter_storage(paramList, 1, DIV_ROUND_UP(padded_size, 4));
+   unsigned elements = (oldValNum - paramList->NumParameterValues) + 
padded_size;
+   _mesa_reserve_parameter_storage(paramList, 1, DIV_ROUND_UP(elements, 4));
 
    if (!paramList->Parameters ||
        !paramList->ParameterValues) {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to