diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 44b1714b..9ac85de6 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -1395,7 +1395,7 @@ int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t c return VKD3D_OK; } -bool hlsl_sm1_register_from_semantic(const struct vkd3d_shader_version *version, const char *semantic_name, +bool sm1_register_from_semantic_name(const struct vkd3d_shader_version *version, const char *semantic_name, unsigned int semantic_index, bool output, enum vkd3d_shader_register_type *type, unsigned int *reg) { unsigned int i; @@ -1463,7 +1463,7 @@ bool hlsl_sm1_register_from_semantic(const struct vkd3d_shader_version *version, return false; } -bool hlsl_sm1_usage_from_semantic(const char *semantic_name, +bool sm1_usage_from_semantic_name(const char *semantic_name, uint32_t semantic_index, enum vkd3d_decl_usage *usage, uint32_t *usage_idx) { static const struct @@ -2289,7 +2289,7 @@ static void d3dbc_write_semantic_dcl(struct d3dbc_compiler *d3dbc, uint32_t token, usage_idx; bool ret; - if (hlsl_sm1_register_from_semantic(version, element->semantic_name, + if (sm1_register_from_semantic_name(version, element->semantic_name, element->semantic_index, output, ®.type, ®.reg)) { usage = 0; @@ -2297,7 +2297,7 @@ static void d3dbc_write_semantic_dcl(struct d3dbc_compiler *d3dbc, } else { - ret = hlsl_sm1_usage_from_semantic(element->semantic_name, element->semantic_index, &usage, &usage_idx); + ret = sm1_usage_from_semantic_name(element->semantic_name, element->semantic_index, &usage, &usage_idx); VKD3D_ASSERT(ret); reg.type = output ? VKD3DSPR_OUTPUT : VKD3DSPR_INPUT; reg.reg = element->register_index; diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 28175098..75ac7a4c 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1623,10 +1623,6 @@ bool hlsl_transform_ir(struct hlsl_ctx *ctx, bool (*func)(struct hlsl_ctx *ctx, D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type); D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type); -bool hlsl_sm1_register_from_semantic(const struct vkd3d_shader_version *version, const char *semantic_name, - unsigned int semantic_index, bool output, enum vkd3d_shader_register_type *type, unsigned int *reg); -bool hlsl_sm1_usage_from_semantic(const char *semantic_name, - uint32_t semantic_index, enum vkd3d_decl_usage *usage, uint32_t *usage_idx); void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer); int d3dbc_compile(struct vsir_program *program, uint64_t config_flags, diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 4a411c5b..a98c8adb 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -5199,9 +5199,9 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var version.major = ctx->profile->major_version; version.minor = ctx->profile->minor_version; version.type = ctx->profile->type; - builtin = hlsl_sm1_register_from_semantic(&version, + builtin = sm1_register_from_semantic_name(&version, var->semantic.name, var->semantic.index, output, &type, ®); - if (!builtin && !hlsl_sm1_usage_from_semantic(var->semantic.name, var->semantic.index, &usage, &usage_idx)) + if (!builtin && !sm1_usage_from_semantic_name(var->semantic.name, var->semantic.index, &usage, &usage_idx)) { hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC, "Invalid semantic '%s'.", var->semantic.name); @@ -6301,7 +6301,7 @@ static void sm1_generate_vsir_signature_entry(struct hlsl_ctx *ctx, } element = &signature->elements[signature->element_count++]; - if (!hlsl_sm1_register_from_semantic(&program->shader_version, + if (!sm1_register_from_semantic_name(&program->shader_version, var->semantic.name, var->semantic.index, output, &type, ®ister_index)) { enum vkd3d_decl_usage usage; @@ -6310,7 +6310,7 @@ static void sm1_generate_vsir_signature_entry(struct hlsl_ctx *ctx, register_index = var->regs[HLSL_REGSET_NUMERIC].id; - ret = hlsl_sm1_usage_from_semantic(var->semantic.name, var->semantic.index, &usage, &usage_idx); + ret = sm1_usage_from_semantic_name(var->semantic.name, var->semantic.index, &usage, &usage_idx); VKD3D_ASSERT(ret); /* With the exception of vertex POSITION output, none of these are * system values. Pixel POSITION input is not equivalent to @@ -6922,7 +6922,7 @@ static void sm1_generate_vsir_init_dst_param_from_deref(struct hlsl_ctx *ctx, type = VKD3DSPR_TEMP; register_index = 0; } - else if (!hlsl_sm1_register_from_semantic(&version, deref->var->semantic.name, + else if (!sm1_register_from_semantic_name(&version, deref->var->semantic.name, deref->var->semantic.index, true, &type, ®ister_index)) { VKD3D_ASSERT(reg.allocated); @@ -6977,7 +6977,7 @@ static void sm1_generate_vsir_init_src_param_from_deref(struct hlsl_ctx *ctx, version.major = ctx->profile->major_version; version.minor = ctx->profile->minor_version; version.type = ctx->profile->type; - if (hlsl_sm1_register_from_semantic(&version, deref->var->semantic.name, + if (sm1_register_from_semantic_name(&version, deref->var->semantic.name, deref->var->semantic.index, false, &type, ®ister_index)) { writemask = (1 << deref->var->data_type->dimx) - 1; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 04d3a54e..9698bab4 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1602,6 +1602,11 @@ void vkd3d_shader_trace_text_(const char *text, size_t size, const char *functio #define vkd3d_shader_trace_text(text, size) \ vkd3d_shader_trace_text_(text, size, __FUNCTION__) +bool sm1_register_from_semantic_name(const struct vkd3d_shader_version *version, const char *semantic_name, + unsigned int semantic_index, bool output, enum vkd3d_shader_register_type *type, unsigned int *reg); +bool sm1_usage_from_semantic_name(const char *semantic_name, + uint32_t semantic_index, enum vkd3d_decl_usage *usage, uint32_t *usage_idx); + int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags, struct vkd3d_shader_message_context *message_context, struct vsir_program *program); int dxil_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,