mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Run more constant passes on static expressions eval.
This commit is contained in:
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
@ -1293,7 +1293,7 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str
|
|||||||
struct hlsl_ir_node *node;
|
struct hlsl_ir_node *node;
|
||||||
struct hlsl_block expr;
|
struct hlsl_block expr;
|
||||||
unsigned int ret = 0;
|
unsigned int ret = 0;
|
||||||
bool progress;
|
struct hlsl_src src;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(node, &block->instrs, struct hlsl_ir_node, entry)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
/* 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));
|
||||||
progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, &expr, NULL);
|
hlsl_run_const_passes(ctx, &expr);
|
||||||
progress |= hlsl_copy_propagation_execute(ctx, &expr);
|
node = src.node;
|
||||||
} while (progress);
|
hlsl_src_remove(&src);
|
||||||
|
|
||||||
node = node_from_block(&expr);
|
|
||||||
if (node->type == HLSL_IR_CONSTANT)
|
if (node->type == HLSL_IR_CONSTANT)
|
||||||
{
|
{
|
||||||
constant = hlsl_ir_constant(node);
|
constant = hlsl_ir_constant(node);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user