From 6e634ad6902000363788cb0a4baad4e00e4389c5 Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Fri, 9 Feb 2024 12:02:13 +1000 Subject: [PATCH] vkd3d-shader: Raise the instruction parameter allocation size if necessary. Monolithic switch instructions have no definite case count limit. --- libs/vkd3d-shader/vkd3d_shader_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 1ef8d949..ebabf50e 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -2048,9 +2048,12 @@ void *shader_param_allocator_get(struct vkd3d_shader_param_allocator *allocator, if (count > allocator->count - allocator->index) { - struct vkd3d_shader_param_node *next = shader_param_allocator_node_create(allocator); + struct vkd3d_shader_param_node *next; - if (!next) + /* Monolithic switch has no definite parameter count limit. */ + allocator->count = max(allocator->count, count); + + if (!(next = shader_param_allocator_node_create(allocator))) return NULL; if (allocator->current) allocator->current->next = next;