mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/spirv: Emit an error if merge information is missing.
Instead of crashing.
This commit is contained in:
parent
e08c0cfc4f
commit
b97edee03d
Notes:
Alexandre Julliard
2024-01-29 22:50:16 +01: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/598
@ -7813,7 +7813,10 @@ static void spirv_compiler_emit_branch(struct spirv_compiler *compiler,
|
|||||||
if (instruction->src_count > 1)
|
if (instruction->src_count > 1)
|
||||||
{
|
{
|
||||||
/* Loop merge only. Must have a merge block and a continue block. */
|
/* Loop merge only. Must have a merge block and a continue block. */
|
||||||
spirv_compiler_emit_merge(compiler, src[1].reg.idx[0].offset, src[2].reg.idx[0].offset);
|
if (instruction->src_count == 3)
|
||||||
|
spirv_compiler_emit_merge(compiler, src[1].reg.idx[0].offset, src[2].reg.idx[0].offset);
|
||||||
|
else
|
||||||
|
ERR("Invalid branch with %u sources.\n", instruction->src_count);
|
||||||
}
|
}
|
||||||
vkd3d_spirv_build_op_branch(builder, spirv_compiler_get_label_id(compiler, src[0].reg.idx[0].offset));
|
vkd3d_spirv_build_op_branch(builder, spirv_compiler_get_label_id(compiler, src[0].reg.idx[0].offset));
|
||||||
return;
|
return;
|
||||||
@ -7830,8 +7833,11 @@ static void spirv_compiler_emit_branch(struct spirv_compiler *compiler,
|
|||||||
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
||||||
VKD3D_SHADER_CONDITIONAL_OP_NZ, src[0].reg.data_type, 1, condition_id);
|
VKD3D_SHADER_CONDITIONAL_OP_NZ, src[0].reg.data_type, 1, condition_id);
|
||||||
/* Emit the merge immediately before the branch instruction. */
|
/* Emit the merge immediately before the branch instruction. */
|
||||||
spirv_compiler_emit_merge(compiler, src[3].reg.idx[0].offset,
|
if (instruction->src_count >= 4)
|
||||||
(instruction->src_count > 4) ? src[4].reg.idx[0].offset : 0);
|
spirv_compiler_emit_merge(compiler, src[3].reg.idx[0].offset,
|
||||||
|
(instruction->src_count > 4) ? src[4].reg.idx[0].offset : 0);
|
||||||
|
else
|
||||||
|
ERR("Invalid branch with %u sources.\n", instruction->src_count);
|
||||||
vkd3d_spirv_build_op_branch_conditional(builder, condition_id,
|
vkd3d_spirv_build_op_branch_conditional(builder, condition_id,
|
||||||
spirv_compiler_get_label_id(compiler, src[1].reg.idx[0].offset),
|
spirv_compiler_get_label_id(compiler, src[1].reg.idx[0].offset),
|
||||||
spirv_compiler_get_label_id(compiler, src[2].reg.idx[0].offset));
|
spirv_compiler_get_label_id(compiler, src[2].reg.idx[0].offset));
|
||||||
|
Loading…
Reference in New Issue
Block a user