vkd3d-shader/hlsl: Write the else block only if it isn't empty.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Giovanni Mascellani 2021-11-16 19:54:58 +01:00 committed by Alexandre Julliard
parent dbd7e18364
commit 0f16b8ec78

View File

@ -1446,11 +1446,14 @@ static void write_sm4_if(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf
write_sm4_block(ctx, buffer, &iff->then_instrs);
instr.opcode = VKD3D_SM4_OP_ELSE;
instr.src_count = 0;
write_sm4_instruction(buffer, &instr);
if (!list_empty(&iff->else_instrs.instrs))
{
instr.opcode = VKD3D_SM4_OP_ELSE;
instr.src_count = 0;
write_sm4_instruction(buffer, &instr);
write_sm4_block(ctx, buffer, &iff->else_instrs);
write_sm4_block(ctx, buffer, &iff->else_instrs);
}
instr.opcode = VKD3D_SM4_OP_ENDIF;
write_sm4_instruction(buffer, &instr);