mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_add().
This commit is contained in:
parent
7d9b24fe11
commit
623cd94997
Notes:
Alexandre Julliard
2023-05-23 23:13:26 +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/205
@ -185,10 +185,10 @@ static bool fold_neg(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool fold_add(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, struct hlsl_ir_constant *src1,
|
||||
struct hlsl_ir_constant *src2)
|
||||
static bool fold_add(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type,
|
||||
const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2)
|
||||
{
|
||||
enum hlsl_base_type type = dst->node.data_type->base_type;
|
||||
enum hlsl_base_type type = dst_type->base_type;
|
||||
unsigned int k;
|
||||
|
||||
assert(type == src1->node.data_type->base_type);
|
||||
@ -200,22 +200,22 @@ static bool fold_add(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, struct
|
||||
{
|
||||
case HLSL_TYPE_FLOAT:
|
||||
case HLSL_TYPE_HALF:
|
||||
dst->value.u[k].f = src1->value.u[k].f + src2->value.u[k].f;
|
||||
dst->u[k].f = src1->value.u[k].f + src2->value.u[k].f;
|
||||
break;
|
||||
|
||||
case HLSL_TYPE_DOUBLE:
|
||||
dst->value.u[k].d = src1->value.u[k].d + src2->value.u[k].d;
|
||||
dst->u[k].d = src1->value.u[k].d + src2->value.u[k].d;
|
||||
break;
|
||||
|
||||
/* Handling HLSL_TYPE_INT through the unsigned field to avoid
|
||||
* undefined behavior with signed integers in C. */
|
||||
case HLSL_TYPE_INT:
|
||||
case HLSL_TYPE_UINT:
|
||||
dst->value.u[k].u = src1->value.u[k].u + src2->value.u[k].u;
|
||||
dst->u[k].u = src1->value.u[k].u + src2->value.u[k].u;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Fold addition for type %s.\n", debug_hlsl_type(ctx, dst->node.data_type));
|
||||
FIXME("Fold addition for type %s.\n", debug_hlsl_type(ctx, dst_type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -588,7 +588,7 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
break;
|
||||
|
||||
case HLSL_OP2_ADD:
|
||||
success = fold_add(ctx, res, arg1, arg2);
|
||||
success = fold_add(ctx, &res->value, instr->data_type, arg1, arg2);
|
||||
break;
|
||||
|
||||
case HLSL_OP2_MUL:
|
||||
|
Loading…
x
Reference in New Issue
Block a user