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_nequal().
This commit is contained in:
parent
d565caafb5
commit
855bb71f6d
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
@ -257,12 +257,12 @@ static bool fold_mul(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool fold_nequal(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
|
static bool fold_nequal(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type,
|
||||||
struct hlsl_ir_constant *src1, struct hlsl_ir_constant *src2)
|
const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2)
|
||||||
{
|
{
|
||||||
unsigned int k;
|
unsigned int k;
|
||||||
|
|
||||||
assert(dst->node.data_type->base_type == HLSL_TYPE_BOOL);
|
assert(dst_type->base_type == HLSL_TYPE_BOOL);
|
||||||
assert(src1->node.data_type->base_type == src2->node.data_type->base_type);
|
assert(src1->node.data_type->base_type == src2->node.data_type->base_type);
|
||||||
|
|
||||||
for (k = 0; k < 4; ++k)
|
for (k = 0; k < 4; ++k)
|
||||||
@ -271,24 +271,24 @@ static bool fold_nequal(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
|
|||||||
{
|
{
|
||||||
case HLSL_TYPE_FLOAT:
|
case HLSL_TYPE_FLOAT:
|
||||||
case HLSL_TYPE_HALF:
|
case HLSL_TYPE_HALF:
|
||||||
dst->value.u[k].u = src1->value.u[k].f != src2->value.u[k].f;
|
dst->u[k].u = src1->value.u[k].f != src2->value.u[k].f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HLSL_TYPE_DOUBLE:
|
case HLSL_TYPE_DOUBLE:
|
||||||
dst->value.u[k].u = src1->value.u[k].d != src2->value.u[k].d;
|
dst->u[k].u = src1->value.u[k].d != src2->value.u[k].d;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HLSL_TYPE_INT:
|
case HLSL_TYPE_INT:
|
||||||
case HLSL_TYPE_UINT:
|
case HLSL_TYPE_UINT:
|
||||||
case HLSL_TYPE_BOOL:
|
case HLSL_TYPE_BOOL:
|
||||||
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
vkd3d_unreachable();
|
vkd3d_unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
dst->value.u[k].u *= ~0u;
|
dst->u[k].u *= ~0u;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HLSL_OP2_NEQUAL:
|
case HLSL_OP2_NEQUAL:
|
||||||
success = fold_nequal(ctx, res, arg1, arg2);
|
success = fold_nequal(ctx, &res->value, instr->data_type, arg1, arg2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HLSL_OP2_DIV:
|
case HLSL_OP2_DIV:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user