vkd3d-shader: Set the program block count to the maximum for any function.

The block count is intended to be used for allocation of block info.
This commit is contained in:
Conor McCarthy
2024-05-24 15:30:44 +10:00
committed by Henri Verbeet
parent a5a8a4cc99
commit 2d508a2fa6
Notes: Henri Verbeet 2025-10-03 00:55:37 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1763
4 changed files with 8 additions and 5 deletions

View File

@@ -8653,7 +8653,7 @@ static enum vkd3d_result sm6_function_emit_blocks(const struct sm6_function *fun
struct vkd3d_shader_instruction *ins;
unsigned int i, j;
program->block_count = function->block_count;
program->block_count = max(program->block_count, function->block_count);
for (i = 0; i < function->block_count; ++i)
{

View File

@@ -5378,8 +5378,8 @@ static enum vkd3d_result vsir_cfg_init(struct vsir_cfg *cfg, struct vsir_program
{
struct vsir_block *current_block = NULL;
struct vkd3d_shader_instruction *ins;
size_t i, defined_block_count = 0;
enum vkd3d_result ret;
size_t i;
memset(cfg, 0, sizeof(*cfg));
cfg->message_context = message_context;
@@ -5421,6 +5421,7 @@ static enum vkd3d_result vsir_cfg_init(struct vsir_cfg *cfg, struct vsir_program
vsir_program_iterator_next(&current_block->begin);
if (!cfg->entry)
cfg->entry = current_block;
++defined_block_count;
break;
}
@@ -5447,6 +5448,8 @@ static enum vkd3d_result vsir_cfg_init(struct vsir_cfg *cfg, struct vsir_program
}
cfg->function_end = *it;
/* program->block_count is the max in any function. Set the count for this function. */
cfg->block_count = defined_block_count;
for (i = 0; i < cfg->block_count; ++i)
{

View File

@@ -1598,7 +1598,7 @@ struct vsir_program
unsigned int input_control_point_count, output_control_point_count;
struct vsir_thread_group_size thread_group_size;
unsigned int flat_constant_count[3];
unsigned int block_count;
unsigned int block_count; /* maximum block count in any function */
unsigned int temp_count;
unsigned int ssa_count;
enum vsir_global_flags global_flags;