vkd3d-shader/d3dbc: Remove the "hlsl_" prefix from external functions.

They no longer rely on HLSL IR.

Also, rename them from "_from_semantic" to "from_semantic_name".
This commit is contained in:
Francisco Casas 2024-10-04 15:22:42 -03:00 committed by Henri Verbeet
parent 0ab5e1cb03
commit 3601397703
Notes: Henri Verbeet 2024-10-16 21:46:52 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1152
4 changed files with 15 additions and 14 deletions

View File

@ -1395,7 +1395,7 @@ int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t c
return VKD3D_OK; 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 semantic_index, bool output, enum vkd3d_shader_register_type *type, unsigned int *reg)
{ {
unsigned int i; unsigned int i;
@ -1463,7 +1463,7 @@ bool hlsl_sm1_register_from_semantic(const struct vkd3d_shader_version *version,
return false; 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) uint32_t semantic_index, enum vkd3d_decl_usage *usage, uint32_t *usage_idx)
{ {
static const struct static const struct
@ -2289,7 +2289,7 @@ static void d3dbc_write_semantic_dcl(struct d3dbc_compiler *d3dbc,
uint32_t token, usage_idx; uint32_t token, usage_idx;
bool ret; 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, &reg.type, &reg.reg)) element->semantic_index, output, &reg.type, &reg.reg))
{ {
usage = 0; usage = 0;
@ -2297,7 +2297,7 @@ static void d3dbc_write_semantic_dcl(struct d3dbc_compiler *d3dbc,
} }
else 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); VKD3D_ASSERT(ret);
reg.type = output ? VKD3DSPR_OUTPUT : VKD3DSPR_INPUT; reg.type = output ? VKD3DSPR_OUTPUT : VKD3DSPR_INPUT;
reg.reg = element->register_index; reg.reg = element->register_index;

View File

@ -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_CLASS hlsl_sm1_class(const struct hlsl_type *type);
D3DXPARAMETER_TYPE hlsl_sm1_base_type(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); void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer);
int d3dbc_compile(struct vsir_program *program, uint64_t config_flags, int d3dbc_compile(struct vsir_program *program, uint64_t config_flags,

View File

@ -5199,9 +5199,9 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
version.major = ctx->profile->major_version; version.major = ctx->profile->major_version;
version.minor = ctx->profile->minor_version; version.minor = ctx->profile->minor_version;
version.type = ctx->profile->type; 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, &reg); var->semantic.name, var->semantic.index, output, &type, &reg);
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, hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC,
"Invalid semantic '%s'.", var->semantic.name); "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++]; 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, &register_index)) var->semantic.name, var->semantic.index, output, &type, &register_index))
{ {
enum vkd3d_decl_usage usage; 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; 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); VKD3D_ASSERT(ret);
/* With the exception of vertex POSITION output, none of these are /* With the exception of vertex POSITION output, none of these are
* system values. Pixel POSITION input is not equivalent to * 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; type = VKD3DSPR_TEMP;
register_index = 0; 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, &register_index)) deref->var->semantic.index, true, &type, &register_index))
{ {
VKD3D_ASSERT(reg.allocated); 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.major = ctx->profile->major_version;
version.minor = ctx->profile->minor_version; version.minor = ctx->profile->minor_version;
version.type = ctx->profile->type; 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, &register_index)) deref->var->semantic.index, false, &type, &register_index))
{ {
writemask = (1 << deref->var->data_type->dimx) - 1; writemask = (1 << deref->var->data_type->dimx) - 1;

View File

@ -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) \ #define vkd3d_shader_trace_text(text, size) \
vkd3d_shader_trace_text_(text, size, __FUNCTION__) 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, 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); 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, int dxil_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,