mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Allow copy propagation to be stopped early.
This commit is contained in:
parent
3cb9e8dc3b
commit
7bee33f948
Notes:
Henri Verbeet
2024-12-12 17:48:02 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1053
@ -1361,6 +1361,8 @@ struct copy_propagation_state
|
|||||||
{
|
{
|
||||||
struct rb_tree *scope_var_defs;
|
struct rb_tree *scope_var_defs;
|
||||||
size_t scope_count, scopes_capacity;
|
size_t scope_count, scopes_capacity;
|
||||||
|
struct hlsl_ir_node *stop;
|
||||||
|
bool stopped;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int copy_propagation_var_def_compare(const void *key, const struct rb_entry *entry)
|
static int copy_propagation_var_def_compare(const void *key, const struct rb_entry *entry)
|
||||||
@ -1926,10 +1928,14 @@ static bool copy_propagation_process_if(struct hlsl_ctx *ctx, struct hlsl_ir_if
|
|||||||
|
|
||||||
copy_propagation_push_scope(state, ctx);
|
copy_propagation_push_scope(state, ctx);
|
||||||
progress |= copy_propagation_transform_block(ctx, &iff->then_block, state);
|
progress |= copy_propagation_transform_block(ctx, &iff->then_block, state);
|
||||||
|
if (state->stopped)
|
||||||
|
return progress;
|
||||||
copy_propagation_pop_scope(state);
|
copy_propagation_pop_scope(state);
|
||||||
|
|
||||||
copy_propagation_push_scope(state, ctx);
|
copy_propagation_push_scope(state, ctx);
|
||||||
progress |= copy_propagation_transform_block(ctx, &iff->else_block, state);
|
progress |= copy_propagation_transform_block(ctx, &iff->else_block, state);
|
||||||
|
if (state->stopped)
|
||||||
|
return progress;
|
||||||
copy_propagation_pop_scope(state);
|
copy_propagation_pop_scope(state);
|
||||||
|
|
||||||
/* Ideally we'd invalidate the outer state looking at what was
|
/* Ideally we'd invalidate the outer state looking at what was
|
||||||
@ -1951,6 +1957,8 @@ static bool copy_propagation_process_loop(struct hlsl_ctx *ctx, struct hlsl_ir_l
|
|||||||
|
|
||||||
copy_propagation_push_scope(state, ctx);
|
copy_propagation_push_scope(state, ctx);
|
||||||
progress |= copy_propagation_transform_block(ctx, &loop->body, state);
|
progress |= copy_propagation_transform_block(ctx, &loop->body, state);
|
||||||
|
if (state->stopped)
|
||||||
|
return progress;
|
||||||
copy_propagation_pop_scope(state);
|
copy_propagation_pop_scope(state);
|
||||||
|
|
||||||
return progress;
|
return progress;
|
||||||
@ -1966,6 +1974,8 @@ static bool copy_propagation_process_switch(struct hlsl_ctx *ctx, struct hlsl_ir
|
|||||||
{
|
{
|
||||||
copy_propagation_push_scope(state, ctx);
|
copy_propagation_push_scope(state, ctx);
|
||||||
progress |= copy_propagation_transform_block(ctx, &c->body, state);
|
progress |= copy_propagation_transform_block(ctx, &c->body, state);
|
||||||
|
if (state->stopped)
|
||||||
|
return progress;
|
||||||
copy_propagation_pop_scope(state);
|
copy_propagation_pop_scope(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1985,6 +1995,12 @@ static bool copy_propagation_transform_block(struct hlsl_ctx *ctx, struct hlsl_b
|
|||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(instr, next, &block->instrs, struct hlsl_ir_node, entry)
|
LIST_FOR_EACH_ENTRY_SAFE(instr, next, &block->instrs, struct hlsl_ir_node, entry)
|
||||||
{
|
{
|
||||||
|
if (instr == state->stop)
|
||||||
|
{
|
||||||
|
state->stopped = true;
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
switch (instr->type)
|
switch (instr->type)
|
||||||
{
|
{
|
||||||
case HLSL_IR_LOAD:
|
case HLSL_IR_LOAD:
|
||||||
@ -2022,6 +2038,9 @@ static bool copy_propagation_transform_block(struct hlsl_ctx *ctx, struct hlsl_b
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state->stopped)
|
||||||
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
return progress;
|
return progress;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user