mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Store static initialization instructions in a block.
This commit is contained in:
parent
5dee6561c2
commit
99314b6340
Notes:
Alexandre Julliard
2023-06-12 23:10:20 +02:00
Approved-by: Zebediah Figura (@zfigura) 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/228
@ -3236,7 +3236,7 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const char *source_name,
|
|||||||
|
|
||||||
rb_init(&ctx->functions, compare_function_rb);
|
rb_init(&ctx->functions, compare_function_rb);
|
||||||
|
|
||||||
list_init(&ctx->static_initializers);
|
hlsl_block_init(&ctx->static_initializers);
|
||||||
list_init(&ctx->extern_vars);
|
list_init(&ctx->extern_vars);
|
||||||
|
|
||||||
list_init(&ctx->buffers);
|
list_init(&ctx->buffers);
|
||||||
|
@ -796,9 +796,8 @@ struct hlsl_ctx
|
|||||||
struct hlsl_type *Void;
|
struct hlsl_type *Void;
|
||||||
} builtin_types;
|
} builtin_types;
|
||||||
|
|
||||||
/* List of the instruction nodes for initializing static variables; linked by the
|
/* List of the instruction nodes for initializing static variables. */
|
||||||
* hlsl_ir_node.entry fields. */
|
struct hlsl_block static_initializers;
|
||||||
struct list static_initializers;
|
|
||||||
|
|
||||||
/* Dynamic array of constant values that appear in the shader, associated to the 'c' registers.
|
/* Dynamic array of constant values that appear in the shader, associated to the 'c' registers.
|
||||||
* Only used for SM1 profiles. */
|
* Only used for SM1 profiles. */
|
||||||
|
@ -2159,7 +2159,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (modifiers & HLSL_STORAGE_STATIC)
|
if (modifiers & HLSL_STORAGE_STATIC)
|
||||||
list_move_tail(&ctx->static_initializers, v->initializer.instrs);
|
list_move_tail(&ctx->static_initializers.instrs, v->initializer.instrs);
|
||||||
else
|
else
|
||||||
list_move_tail(statements_list, v->initializer.instrs);
|
list_move_tail(statements_list, v->initializer.instrs);
|
||||||
vkd3d_free(v->initializer.args);
|
vkd3d_free(v->initializer.args);
|
||||||
@ -2182,9 +2182,9 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
|||||||
vkd3d_free(v);
|
vkd3d_free(v);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
list_add_tail(&ctx->static_initializers, &zero->entry);
|
hlsl_block_add_instr(&ctx->static_initializers, zero);
|
||||||
|
|
||||||
if (!(cast = add_cast(ctx, &ctx->static_initializers, zero, var->data_type, &var->loc)))
|
if (!(cast = add_cast(ctx, &ctx->static_initializers.instrs, zero, var->data_type, &var->loc)))
|
||||||
{
|
{
|
||||||
vkd3d_free(v);
|
vkd3d_free(v);
|
||||||
continue;
|
continue;
|
||||||
@ -2195,7 +2195,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
|||||||
vkd3d_free(v);
|
vkd3d_free(v);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
list_add_tail(&ctx->static_initializers, &store->entry);
|
hlsl_block_add_instr(&ctx->static_initializers, store);
|
||||||
}
|
}
|
||||||
vkd3d_free(v);
|
vkd3d_free(v);
|
||||||
}
|
}
|
||||||
|
@ -3977,7 +3977,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool progress;
|
bool progress;
|
||||||
|
|
||||||
list_move_head(&body->instrs, &ctx->static_initializers);
|
list_move_head(&body->instrs, &ctx->static_initializers.instrs);
|
||||||
|
|
||||||
memset(&recursive_call_ctx, 0, sizeof(recursive_call_ctx));
|
memset(&recursive_call_ctx, 0, sizeof(recursive_call_ctx));
|
||||||
hlsl_transform_ir(ctx, find_recursive_calls, body, &recursive_call_ctx);
|
hlsl_transform_ir(ctx, find_recursive_calls, body, &recursive_call_ctx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user