vkd3d-shader/hlsl: Skip transformation passes on error.

The primary motivation here is to avoid needing to worry about instructions
potentially pointing to the preallocated error instruction in the case of
allocation failure.

This doesn't cover all passes, but none of the other passes make assumptions
about instruction sources.
This commit is contained in:
Elizabeth Figura
2024-12-08 19:36:55 -06:00
committed by Henri Verbeet
parent 153b7c8460
commit ba868ed4a6
Notes: Henri Verbeet 2025-02-20 16:07:11 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Francisco Casas (@fcasas)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1370

View File

@ -717,6 +717,9 @@ bool hlsl_transform_ir(struct hlsl_ctx *ctx, bool (*func)(struct hlsl_ctx *ctx,
struct hlsl_ir_node *instr, *next;
bool progress = false;
if (ctx->result)
return false;
LIST_FOR_EACH_ENTRY_SAFE(instr, next, &block->instrs, struct hlsl_ir_node, entry)
{
if (instr->type == HLSL_IR_IF)
@ -2222,6 +2225,9 @@ bool hlsl_copy_propagation_execute(struct hlsl_ctx *ctx, struct hlsl_block *bloc
struct copy_propagation_state state;
bool progress;
if (ctx->result)
return false;
index_instructions(block, 1);
copy_propagation_state_init(&state, ctx);
@ -4958,6 +4964,9 @@ static void compute_liveness(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl
struct hlsl_scope *scope;
struct hlsl_ir_var *var;
if (ctx->result)
return;
index_instructions(&entry_func->body, 1);
LIST_FOR_EACH_ENTRY(scope, &ctx->scopes, struct hlsl_scope, entry)