From: "Zebediah Figura (she/her)" Subject: Re: [PATCH vkd3d] vkd3d-shader/hlsl: Support casts between all numeric types on constant folding. Message-Id: <343deeb5-a16d-9e21-b829-7def22e28a30@codeweavers.com> Date: Thu, 30 Dec 2021 12:15:34 -0600 In-Reply-To: <658b9e98-ef2e-d928-8bb0-5da1664b92fc@codeweavers.com> References: <20211229145154.123397-1-fcasas@codeweavers.com> <658b9e98-ef2e-d928-8bb0-5da1664b92fc@codeweavers.com> On 12/30/21 12:06, Zebediah Figura (she/her) wrote: >> @@ -670,48 +670,32 @@ static bool fold_constants(struct hlsl_ctx *ctx, >> struct hlsl_ir_node *instr, voi >>       arg1 = hlsl_ir_constant(expr->operands[0].node); >>       if (expr->operands[1].node) >>           arg2 = hlsl_ir_constant(expr->operands[1].node); >> -    dimx = instr->data_type->dimx; >>       if (!(res = hlsl_alloc(ctx, sizeof(*res)))) >>           return false; >>       init_node(&res->node, HLSL_IR_CONSTANT, instr->data_type, >> instr->loc); >> +    if (expr->op == HLSL_OP1_CAST && instr->data_type->base_type <= >> HLSL_TYPE_LAST_SCALAR) > > Frankly we may want to consider swapping the "switch" block order then. > Especially considering that we might want to add other operations that > aren't typed. > FWIW, this should be a separate patch, and can be deferred until later anyway.