[PATCH vkd3d] vkd3d-shader/hlsl: Support casts between all numeric types on constant folding.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Jan 4 07:54:18 CST 2022


Hi,

On 29/12/21 15:51, Francisco Casas wrote:
>               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].f = arg1->value[i].i;
> -                            break;
> -
> -                        case HLSL_TYPE_UINT:
> -                            for (i = 0; i < dimx; ++i)
> -                                res->value[i].f = 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;
> -
>                   default:
>                       FIXME("Fold float op %#x.\n", expr->op);
>                       vkd3d_free(res);

Given that you are removing all the logic from the case HLSL_TYPE_FLOAT, 
you might as well remove the case block itself, I guess. Though I don't 
have strong opinions on that. Eventually we'll put some new code in it 
anyway.

Giovanni.



More information about the wine-devel mailing list