+ case VKD3DSIH_BRANCH: + { + const struct vkd3d_shader_branch *branch = &ins->declaration.branch; + if (ins->src_count) + { + shader_dump_instruction_flags(compiler, ins); + vkd3d_string_buffer_printf(buffer, " "); + shader_dump_src_param(compiler, ins->src); + vkd3d_string_buffer_printf(buffer, " ? %sl%u%s : %sl%u%s", compiler->colours.reg, branch->true_id, + compiler->colours.reset, compiler->colours.reg, branch->false_id, compiler->colours.reset); + } + else + { + vkd3d_string_buffer_printf(buffer, " %sl%u%s", compiler->colours.reg, branch->true_id, + compiler->colours.reset); + } + if (branch->merge_block_id) + vkd3d_string_buffer_printf(buffer, ", merge %sl%u%s", compiler->colours.reg, branch->merge_block_id, + compiler->colours.reset); + if (branch->continue_block_id) + vkd3d_string_buffer_printf(buffer, ", continue %sl%u%s", compiler->colours.reg, + branch->continue_block_id, compiler->colours.reset); + break; + }
It seems a bit unfortunate to use ins->declaration for instructions that aren't declarations; in part because it's currently somewhat of an open question whether we want to keep declarations as part of the main instruction array, or if it's perhaps better to store them separately. At first sight it doesn't look like either BRANCH or SWITCH_MONOLITHIC need anything that can't be expressed as regular instruction parameters and some flags?