[PATCH v2 0/2] MR505: vkd3d-shader/dxil: Fix two small issues.
-- v2: vkd3d-shader/dxil: Pre-allocate instruction space for globals in sm6_parser_globals_init(). vkd3d-shader/dxil: Count global variables in dxil_block_compute_module_decl_count(). https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/505
From: Conor McCarthy <cmccarthy(a)codeweavers.com> --- libs/vkd3d-shader/dxil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 602056e25..f02a56e4f 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -1237,7 +1237,7 @@ static size_t dxil_block_compute_module_decl_count(const struct dxil_block *bloc size_t i, count; for (i = 0, count = 0; i < block->record_count; ++i) - count += block->records[i]->code == MODULE_CODE_FUNCTION; + count += block->records[i]->code == MODULE_CODE_FUNCTION || block->records[i]->code == MODULE_CODE_GLOBALVAR; return count; } -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/505
From: Conor McCarthy <cmccarthy(a)codeweavers.com> 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 f02a56e4f..1073201a0 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; -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/505
This merge request was approved by Henri Verbeet. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/505
participants (3)
-
Conor McCarthy -
Conor McCarthy (@cmccarthy) -
Henri Verbeet (@hverbeet)