vkd3d-shader/hlsl: Use hlsl_new_constant() in more places.

This commit is contained in:
Zebediah Figura 2022-09-26 19:13:29 -05:00 committed by Alexandre Julliard
parent f8da100052
commit b74a546034
Notes: Alexandre Julliard 2022-10-18 00:13:00 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/22

View File

@ -526,9 +526,8 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
if (expr->operands[1].node)
arg2 = hlsl_ir_constant(expr->operands[1].node);
if (!(res = hlsl_alloc(ctx, sizeof(*res))))
if (!(res = hlsl_new_constant(ctx, instr->data_type, &instr->loc)))
return false;
init_node(&res->node, HLSL_IR_CONSTANT, instr->data_type, instr->loc);
switch (expr->op)
{
@ -611,9 +610,8 @@ bool hlsl_fold_constant_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst
return false;
value = hlsl_ir_constant(swizzle->val.node);
if (!(res = hlsl_alloc(ctx, sizeof(*res))))
if (!(res = hlsl_new_constant(ctx, instr->data_type, &instr->loc)))
return false;
init_node(&res->node, HLSL_IR_CONSTANT, instr->data_type, instr->loc);
swizzle_bits = swizzle->swizzle;
for (i = 0; i < swizzle->node.data_type->dimx; ++i)