vkd3d-shader/hlsl: Run more constant passes on static expressions eval.

This commit is contained in:
Francisco Casas 2024-04-26 12:15:52 -04:00 committed by Alexandre Julliard
parent 4f60c7167e
commit 0d252f894a
Notes: Alexandre Julliard 2024-05-15 23:03:23 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/839

View File

@ -1293,7 +1293,7 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
struct hlsl_ir_node *node;
struct hlsl_block expr;
unsigned int ret = 0;
bool progress;
struct hlsl_src src;
LIST_FOR_EACH_ENTRY(node, &block->instrs, struct hlsl_ir_node, entry)
{
@ -1330,13 +1330,12 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
return 0;
}
do
{
progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, &expr, NULL);
progress |= hlsl_copy_propagation_execute(ctx, &expr);
} while (progress);
/* Wrap the node into a src to allow the reference to survive the multiple const passes. */
hlsl_src_from_node(&src, node_from_block(&expr));
hlsl_run_const_passes(ctx, &expr);
node = src.node;
hlsl_src_remove(&src);
node = node_from_block(&expr);
if (node->type == HLSL_IR_CONSTANT)
{
constant = hlsl_ir_constant(node);