Module: vkd3d Branch: master Commit: 111818eabbb10aa9afe16ea8a4a6484e1a922d6f URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/111818eabbb10aa9afe16ea8a4a648...
Author: Conor McCarthy cmccarthy@codeweavers.com Date: Fri Dec 1 14:46:21 2023 +1000
vkd3d-shader/dxil: Pre-allocate instruction space for globals in sm6_parser_globals_init().
For simplicity, declaration handlers assume instruction allocation will not fail.
---
libs/vkd3d-shader/dxil.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index d129a411..48cce466 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -2877,8 +2877,8 @@ static const struct vkd3d_shader_immediate_constant_buffer *resolve_forward_init
static enum vkd3d_result sm6_parser_globals_init(struct sm6_parser *sm6) { + size_t i, count, base_value_idx = sm6->value_count; const struct dxil_block *block = &sm6->root_block; - size_t i, base_value_idx = sm6->value_count; struct vkd3d_shader_instruction *ins; const struct dxil_record *record; enum vkd3d_result ret; @@ -2887,6 +2887,10 @@ static enum vkd3d_result sm6_parser_globals_init(struct sm6_parser *sm6) sm6->p.location.line = block->id; sm6->p.location.column = 0;
+ for (i = 0, count = 0; i < block->record_count; ++i) + count += block->records[i]->code == MODULE_CODE_GLOBALVAR; + sm6_parser_require_space(sm6, count); + for (i = 0; i < block->record_count; ++i) { sm6->p.location.column = i;