mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Fold constant casts from int to uint.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
833bfa8812
commit
8ced37058d
@@ -724,6 +724,31 @@ static bool fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi
|
|||||||
{
|
{
|
||||||
switch (expr->op)
|
switch (expr->op)
|
||||||
{
|
{
|
||||||
|
case HLSL_OP1_CAST:
|
||||||
|
if (instr->data_type->dimx != arg1->node.data_type->dimx
|
||||||
|
|| instr->data_type->dimy != arg1->node.data_type->dimy)
|
||||||
|
{
|
||||||
|
FIXME("Cast from %s to %s.\n", debug_hlsl_type(ctx, arg1->node.data_type),
|
||||||
|
debug_hlsl_type(ctx, instr->data_type));
|
||||||
|
vkd3d_free(res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (arg1->node.data_type->base_type)
|
||||||
|
{
|
||||||
|
case HLSL_TYPE_INT:
|
||||||
|
for (i = 0; i < dimx; ++i)
|
||||||
|
res->value[i].i = arg1->value[i].u;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
FIXME("Cast from %s to %s.\n", debug_hlsl_type(ctx, arg1->node.data_type),
|
||||||
|
debug_hlsl_type(ctx, instr->data_type));
|
||||||
|
vkd3d_free(res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case HLSL_OP1_NEG:
|
case HLSL_OP1_NEG:
|
||||||
for (i = 0; i < instr->data_type->dimx; ++i)
|
for (i = 0; i < instr->data_type->dimx; ++i)
|
||||||
res->value[i].u = -arg1->value[i].u;
|
res->value[i].u = -arg1->value[i].u;
|
||||||
|
Reference in New Issue
Block a user