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

Zebediah Figura (she/her) zfigura at codeweavers.com
Thu Dec 30 12:15:34 CST 2021


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.



More information about the wine-devel mailing list