vkd3d-shader/tpf: Emit constant values inline.

This commit is contained in:
Giovanni Mascellani 2023-05-26 14:24:07 +02:00 committed by Alexandre Julliard
parent a7de09d418
commit a471c5567a
Notes: Alexandre Julliard 2023-05-29 22:32:48 +02:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/215

View File

@ -3540,6 +3540,14 @@ static void sm4_src_from_node(struct sm4_src_register *src,
{ {
unsigned int writemask; unsigned int writemask;
if (instr->type == HLSL_IR_CONSTANT)
{
struct hlsl_ir_constant *constant = hlsl_ir_constant(instr);
sm4_src_from_constant_value(src, &constant->value, instr->data_type->dimx, map_writemask);
return;
}
sm4_register_from_node(&src->reg, &writemask, &src->swizzle_type, instr); sm4_register_from_node(&src->reg, &writemask, &src->swizzle_type, instr);
if (src->swizzle_type == VKD3D_SM4_SWIZZLE_VEC4) if (src->swizzle_type == VKD3D_SM4_SWIZZLE_VEC4)
src->swizzle = hlsl_map_swizzle(hlsl_swizzle_from_writemask(writemask), map_writemask); src->swizzle = hlsl_map_swizzle(hlsl_swizzle_from_writemask(writemask), map_writemask);