mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Split handling blocks when emitting a structured program.
This commit is contained in:
parent
b4cfc24f67
commit
5e42f6779a
Notes:
Alexandre Julliard
2024-04-15 22:22:40 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Conor McCarthy (@cmccarthy) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/778
@ -4441,6 +4441,23 @@ static enum vkd3d_result vsir_cfg_optimize(struct vsir_cfg *cfg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum vkd3d_result vsir_cfg_structure_list_emit_block(struct vsir_cfg *cfg,
|
||||||
|
struct vsir_block *block)
|
||||||
|
{
|
||||||
|
struct vsir_cfg_emit_target *target = cfg->target;
|
||||||
|
|
||||||
|
if (!reserve_instructions(&target->instructions, &target->ins_capacity,
|
||||||
|
target->ins_count + (block->end - block->begin)))
|
||||||
|
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
memcpy(&target->instructions[target->ins_count], block->begin,
|
||||||
|
(char *)block->end - (char *)block->begin);
|
||||||
|
|
||||||
|
target->ins_count += block->end - block->begin;
|
||||||
|
|
||||||
|
return VKD3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static enum vkd3d_result vsir_cfg_structure_list_emit(struct vsir_cfg *cfg,
|
static enum vkd3d_result vsir_cfg_structure_list_emit(struct vsir_cfg *cfg,
|
||||||
struct vsir_cfg_structure_list *list, unsigned int loop_idx)
|
struct vsir_cfg_structure_list *list, unsigned int loop_idx)
|
||||||
{
|
{
|
||||||
@ -4456,17 +4473,9 @@ static enum vkd3d_result vsir_cfg_structure_list_emit(struct vsir_cfg *cfg,
|
|||||||
switch (structure->type)
|
switch (structure->type)
|
||||||
{
|
{
|
||||||
case STRUCTURE_TYPE_BLOCK:
|
case STRUCTURE_TYPE_BLOCK:
|
||||||
{
|
if ((ret = vsir_cfg_structure_list_emit_block(cfg, structure->u.block)) < 0)
|
||||||
struct vsir_block *block = structure->u.block;
|
return ret;
|
||||||
|
|
||||||
if (!reserve_instructions(&target->instructions, &target->ins_capacity, target->ins_count + (block->end - block->begin)))
|
|
||||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
memcpy(&target->instructions[target->ins_count], block->begin, (char *)block->end - (char *)block->begin);
|
|
||||||
|
|
||||||
target->ins_count += block->end - block->begin;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case STRUCTURE_TYPE_LOOP:
|
case STRUCTURE_TYPE_LOOP:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user