vkd3d-shader/hlsl: Rename hlsl_ir_var.modifiers to "storage_modifiers".

This commit is contained in:
Francisco Casas 2022-11-29 16:10:40 -03:00 committed by Alexandre Julliard
parent 23bd2d9ad8
commit 4dbbb8beb4
Notes: Alexandre Julliard 2023-01-11 22:39:24 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/50
5 changed files with 15 additions and 15 deletions

View File

@ -778,7 +778,7 @@ struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct
var->loc = loc; var->loc = loc;
if (semantic) if (semantic)
var->semantic = *semantic; var->semantic = *semantic;
var->modifiers = modifiers; var->storage_modifiers = modifiers;
if (reg_reservation) if (reg_reservation)
var->reg_reservation = *reg_reservation; var->reg_reservation = *reg_reservation;
return var; return var;
@ -1556,11 +1556,11 @@ static void dump_src(struct vkd3d_string_buffer *buffer, const struct hlsl_src *
static void dump_ir_var(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct hlsl_ir_var *var) static void dump_ir_var(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct hlsl_ir_var *var)
{ {
if (var->modifiers) if (var->storage_modifiers)
{ {
struct vkd3d_string_buffer *string; struct vkd3d_string_buffer *string;
if ((string = hlsl_modifiers_to_string(ctx, var->modifiers))) if ((string = hlsl_modifiers_to_string(ctx, var->storage_modifiers)))
vkd3d_string_buffer_printf(buffer, "%s ", string->buffer); vkd3d_string_buffer_printf(buffer, "%s ", string->buffer);
hlsl_release_string_buffer(ctx, string); hlsl_release_string_buffer(ctx, string);
} }

View File

@ -256,7 +256,7 @@ struct hlsl_ir_var
const char *name; const char *name;
struct hlsl_semantic semantic; struct hlsl_semantic semantic;
struct hlsl_buffer *buffer; struct hlsl_buffer *buffer;
unsigned int modifiers; unsigned int storage_modifiers;
struct hlsl_reg_reservation reg_reservation; struct hlsl_reg_reservation reg_reservation;
struct list scope_entry, param_entry, extern_entry; struct list scope_entry, param_entry, extern_entry;

View File

@ -2060,9 +2060,9 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
* variables also get put in the global scope, but shouldn't be * variables also get put in the global scope, but shouldn't be
* considered uniforms, and we have no way of telling otherwise. */ * considered uniforms, and we have no way of telling otherwise. */
if (!(modifiers & HLSL_STORAGE_STATIC)) if (!(modifiers & HLSL_STORAGE_STATIC))
var->modifiers |= HLSL_STORAGE_UNIFORM; var->storage_modifiers |= HLSL_STORAGE_UNIFORM;
if (ctx->profile->major_version < 5 && (var->modifiers & HLSL_STORAGE_UNIFORM) && if (ctx->profile->major_version < 5 && (var->storage_modifiers & HLSL_STORAGE_UNIFORM) &&
type_has_object_components(var->data_type, true)) type_has_object_components(var->data_type, true))
{ {
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
@ -2096,7 +2096,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
"Semantics are not allowed on local variables."); "Semantics are not allowed on local variables.");
} }
if ((var->modifiers & HLSL_STORAGE_STATIC) && type_has_numeric_components(var->data_type) if ((var->storage_modifiers & HLSL_STORAGE_STATIC) && type_has_numeric_components(var->data_type)
&& type_has_object_components(var->data_type, false)) && type_has_object_components(var->data_type, false))
{ {
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,

View File

@ -184,7 +184,7 @@ static void prepend_uniform_copy(struct hlsl_ctx *ctx, struct list *instrs, stru
* can write the uniform name into the shader reflection data. */ * can write the uniform name into the shader reflection data. */
if (!(uniform = hlsl_new_var(ctx, temp->name, temp->data_type, if (!(uniform = hlsl_new_var(ctx, temp->name, temp->data_type,
temp->loc, NULL, temp->modifiers, &temp->reg_reservation))) temp->loc, NULL, temp->storage_modifiers, &temp->reg_reservation)))
return; return;
list_add_before(&temp->scope_entry, &uniform->scope_entry); list_add_before(&temp->scope_entry, &uniform->scope_entry);
list_add_tail(&ctx->extern_vars, &uniform->extern_entry); list_add_tail(&ctx->extern_vars, &uniform->extern_entry);
@ -334,7 +334,7 @@ static void prepend_input_var_copy(struct hlsl_ctx *ctx, struct list *instrs, st
if (var->data_type->type == HLSL_CLASS_STRUCT) if (var->data_type->type == HLSL_CLASS_STRUCT)
prepend_input_struct_copy(ctx, instrs, load); prepend_input_struct_copy(ctx, instrs, load);
else if (var->semantic.name) else if (var->semantic.name)
prepend_input_copy(ctx, instrs, load, var->modifiers, &var->semantic); prepend_input_copy(ctx, instrs, load, var->storage_modifiers, &var->semantic);
} }
static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_load *rhs, static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_load *rhs,
@ -430,7 +430,7 @@ static void append_output_var_copy(struct hlsl_ctx *ctx, struct list *instrs, st
if (var->data_type->type == HLSL_CLASS_STRUCT) if (var->data_type->type == HLSL_CLASS_STRUCT)
append_output_struct_copy(ctx, instrs, load); append_output_struct_copy(ctx, instrs, load);
else if (var->semantic.name) else if (var->semantic.name)
append_output_copy(ctx, instrs, load, var->modifiers, &var->semantic); append_output_copy(ctx, instrs, load, var->storage_modifiers, &var->semantic);
} }
static bool transform_ir(struct hlsl_ctx *ctx, bool (*func)(struct hlsl_ctx *ctx, struct hlsl_ir_node *, void *), static bool transform_ir(struct hlsl_ctx *ctx, bool (*func)(struct hlsl_ctx *ctx, struct hlsl_ir_node *, void *),
@ -2610,13 +2610,13 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
LIST_FOR_EACH_ENTRY(var, &ctx->globals->vars, struct hlsl_ir_var, scope_entry) LIST_FOR_EACH_ENTRY(var, &ctx->globals->vars, struct hlsl_ir_var, scope_entry)
{ {
if (var->modifiers & HLSL_STORAGE_UNIFORM) if (var->storage_modifiers & HLSL_STORAGE_UNIFORM)
prepend_uniform_copy(ctx, &body->instrs, var); prepend_uniform_copy(ctx, &body->instrs, var);
} }
LIST_FOR_EACH_ENTRY(var, entry_func->parameters, struct hlsl_ir_var, param_entry) LIST_FOR_EACH_ENTRY(var, entry_func->parameters, struct hlsl_ir_var, param_entry)
{ {
if (var->data_type->type == HLSL_CLASS_OBJECT || (var->modifiers & HLSL_STORAGE_UNIFORM)) if (var->data_type->type == HLSL_CLASS_OBJECT || (var->storage_modifiers & HLSL_STORAGE_UNIFORM))
{ {
prepend_uniform_copy(ctx, &body->instrs, var); prepend_uniform_copy(ctx, &body->instrs, var);
} }
@ -2626,9 +2626,9 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC, hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC,
"Parameter \"%s\" is missing a semantic.", var->name); "Parameter \"%s\" is missing a semantic.", var->name);
if (var->modifiers & HLSL_STORAGE_IN) if (var->storage_modifiers & HLSL_STORAGE_IN)
prepend_input_var_copy(ctx, &body->instrs, var); prepend_input_var_copy(ctx, &body->instrs, var);
if (var->modifiers & HLSL_STORAGE_OUT) if (var->storage_modifiers & HLSL_STORAGE_OUT)
append_output_var_copy(ctx, &body->instrs, var); append_output_var_copy(ctx, &body->instrs, var);
} }
} }

View File

@ -1232,7 +1232,7 @@ static void write_sm4_dcl_semantic(struct hlsl_ctx *ctx, struct vkd3d_bytecode_b
{ {
enum vkd3d_shader_interpolation_mode mode = VKD3DSIM_LINEAR; enum vkd3d_shader_interpolation_mode mode = VKD3DSIM_LINEAR;
if ((var->modifiers & HLSL_STORAGE_NOINTERPOLATION) || type_is_integer(var->data_type)) if ((var->storage_modifiers & HLSL_STORAGE_NOINTERPOLATION) || type_is_integer(var->data_type))
mode = VKD3DSIM_CONSTANT; mode = VKD3DSIM_CONSTANT;
instr.opcode |= mode << VKD3D_SM4_INTERPOLATION_MODE_SHIFT; instr.opcode |= mode << VKD3D_SM4_INTERPOLATION_MODE_SHIFT;