mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Store the internal name counter in struct hlsl_ctx.
This is minutely more efficient than using a global variable and atomic instructions.
This commit is contained in:
committed by
Alexandre Julliard
parent
f22e52f358
commit
d396c4ce27
Notes:
Alexandre Julliard
2023-08-30 23:19:43 +02:00
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/310
@@ -1060,11 +1060,10 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *tem
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
struct hlsl_ir_var *var;
|
||||
static LONG counter;
|
||||
|
||||
if (!(string = hlsl_get_string_buffer(ctx)))
|
||||
return NULL;
|
||||
vkd3d_string_buffer_printf(string, "<%s-%u>", template, InterlockedIncrement(&counter));
|
||||
vkd3d_string_buffer_printf(string, "<%s-%u>", template, ctx->internal_name_counter++);
|
||||
var = hlsl_new_synthetic_var_named(ctx, string->buffer, type, loc, true);
|
||||
hlsl_release_string_buffer(ctx, string);
|
||||
return var;
|
||||
|
Reference in New Issue
Block a user