mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Write SM4 casts to float.
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: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cb4970e9ca
commit
9d54153271
@ -981,6 +981,43 @@ static void write_sm4_expr(struct hlsl_ctx *ctx,
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
case HLSL_OP1_CAST:
|
||||
{
|
||||
const struct hlsl_type *src_type = arg1->data_type;
|
||||
|
||||
/* Narrowing casts need to be lowered. */
|
||||
if (src_type->dimx != expr->node.data_type->dimx)
|
||||
hlsl_fixme(ctx, expr->node.loc, "Narrowing cast.\n");
|
||||
|
||||
switch (src_type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_HALF:
|
||||
case HLSL_TYPE_FLOAT:
|
||||
write_sm4_unary_op(buffer, VKD3D_SM4_OP_MOV, &expr->node, arg1, 0);
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_INT:
|
||||
write_sm4_unary_op(buffer, VKD3D_SM4_OP_ITOF, &expr->node, arg1, 0);
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_UINT:
|
||||
write_sm4_unary_op(buffer, VKD3D_SM4_OP_UTOF, &expr->node, arg1, 0);
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_BOOL:
|
||||
hlsl_fixme(ctx, expr->node.loc, "Casts from bool to float are not implemented.\n");
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_DOUBLE:
|
||||
hlsl_fixme(ctx, expr->node.loc, "Casts from double to float are not implemented.\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case HLSL_OP1_NEG:
|
||||
write_sm4_unary_op(buffer, VKD3D_SM4_OP_MOV, &expr->node, arg1, VKD3D_SM4_REGISTER_MODIFIER_NEGATE);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user