Matteo Bruni : vkd3d-shader: Zero-initialize constant definitions.
Alexandre Julliard
julliard at winehq.org
Wed Jun 23 16:09:59 CDT 2021
Module: vkd3d
Branch: master
Commit: 06551db10aa8f9bd78f28758ea621a0ab0d64b1b
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=06551db10aa8f9bd78f28758ea621a0ab0d64b1b
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Mon Jun 21 23:37:06 2021 -0500
vkd3d-shader: Zero-initialize constant definitions.
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/hlsl_codegen.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 366b8bd..54c91bf 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -843,7 +843,12 @@ static void allocate_const_registers_recurse(struct hlsl_ctx *ctx, struct list *
if (!hlsl_array_reserve(ctx, (void **)&defs->values, &defs->size,
constant->reg.id + reg_size, sizeof(*defs->values)))
return;
- defs->count = max(defs->count, constant->reg.id + reg_size);
+ if (constant->reg.id + reg_size > defs->count)
+ {
+ memset(&defs->values[defs->count], 0,
+ sizeof(*defs->values) * (constant->reg.id + reg_size - defs->count));
+ defs->count = constant->reg.id + reg_size;
+ }
assert(type->type <= HLSL_CLASS_LAST_NUMERIC);
More information about the wine-cvs
mailing list