For clarity.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v4: No change.
libs/vkd3d-shader/hlsl.c | 3 +++ libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl_codegen.c | 15 ++------------- 3 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 0b8c660c..bc593f82 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1664,6 +1664,9 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct hlsl_profile_info * if (!(ctx->globals_buffer = hlsl_new_buffer(ctx, HLSL_BUFFER_CONSTANT, hlsl_strdup(ctx, "$Globals"), NULL, ctx->location))) return false; + if (!(ctx->params_buffer = hlsl_new_buffer(ctx, HLSL_BUFFER_CONSTANT, + hlsl_strdup(ctx, "$Params"), NULL, ctx->location))) + return false; ctx->cur_buffer = ctx->globals_buffer;
return true; diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index b62e7818..e0045acf 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -456,7 +456,7 @@ struct hlsl_ctx struct list extern_vars;
struct list buffers; - struct hlsl_buffer *cur_buffer, *globals_buffer; + struct hlsl_buffer *cur_buffer, *globals_buffer, *params_buffer; struct list types; struct rb_tree functions; const struct hlsl_ir_function_decl *cur_function; diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 6336ddfc..778d9dff 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -1142,27 +1142,16 @@ static void calculate_buffer_offset(struct hlsl_ir_var *var)
static void allocate_buffers(struct hlsl_ctx *ctx) { - struct hlsl_buffer *buffer, *params_buffer; + struct hlsl_buffer *buffer; struct hlsl_ir_var *var; uint32_t index = 0;
- if (!(params_buffer = hlsl_new_buffer(ctx, HLSL_BUFFER_CONSTANT, - hlsl_strdup(ctx, "$Params"), NULL, ctx->location))) - return; - - /* The $Globals and $Params buffers should be allocated first, before all - * explicit buffers. */ - list_remove(¶ms_buffer->entry); - list_add_head(&ctx->buffers, ¶ms_buffer->entry); - list_remove(&ctx->globals_buffer->entry); - list_add_head(&ctx->buffers, &ctx->globals_buffer->entry); - LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) { if (var->is_uniform) { if (var->is_param) - var->buffer = params_buffer; + var->buffer = ctx->params_buffer;
calculate_buffer_offset(var); }