mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/tpf: Make hlsl_sm4_register_from_semantic() independent of HLSL IR.
This commit is contained in:
parent
a243862b8c
commit
7eee877dd4
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
@ -1629,9 +1629,6 @@ int d3dbc_compile(struct vsir_program *program, uint64_t config_flags,
|
|||||||
const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *ctab,
|
const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *ctab,
|
||||||
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
||||||
|
|
||||||
bool hlsl_sm4_register_from_semantic(const struct vkd3d_shader_version *version,
|
|
||||||
const struct hlsl_semantic *semantic, bool output, enum vkd3d_shader_register_type *type, bool *has_idx);
|
|
||||||
|
|
||||||
int tpf_compile(struct vsir_program *program, uint64_t config_flags,
|
int tpf_compile(struct vsir_program *program, uint64_t config_flags,
|
||||||
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context,
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context,
|
||||||
struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func);
|
struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func);
|
||||||
|
@ -5225,7 +5225,7 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((builtin = hlsl_sm4_register_from_semantic(&version, &var->semantic, output, &type, &has_idx)))
|
if ((builtin = sm4_register_from_semantic_name(&version, var->semantic.name, output, &type, &has_idx)))
|
||||||
reg = has_idx ? var->semantic.index : 0;
|
reg = has_idx ? var->semantic.index : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6306,7 +6306,7 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx,
|
|||||||
if (sysval == ~0u)
|
if (sysval == ~0u)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (hlsl_sm4_register_from_semantic(&program->shader_version, &var->semantic, output, &type, &has_idx))
|
if (sm4_register_from_semantic_name(&program->shader_version, var->semantic.name, output, &type, &has_idx))
|
||||||
{
|
{
|
||||||
register_index = has_idx ? var->semantic.index : ~0u;
|
register_index = has_idx ? var->semantic.index : ~0u;
|
||||||
}
|
}
|
||||||
|
@ -2997,8 +2997,8 @@ static bool type_is_integer(const struct hlsl_type *type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hlsl_sm4_register_from_semantic(const struct vkd3d_shader_version *version,
|
bool sm4_register_from_semantic_name(const struct vkd3d_shader_version *version,
|
||||||
const struct hlsl_semantic *semantic, bool output, enum vkd3d_shader_register_type *type, bool *has_idx)
|
const char *semantic_name, bool output, enum vkd3d_shader_register_type *type, bool *has_idx)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -3030,7 +3030,7 @@ bool hlsl_sm4_register_from_semantic(const struct vkd3d_shader_version *version,
|
|||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(register_table); ++i)
|
for (i = 0; i < ARRAY_SIZE(register_table); ++i)
|
||||||
{
|
{
|
||||||
if (!ascii_strcasecmp(semantic->name, register_table[i].semantic)
|
if (!ascii_strcasecmp(semantic_name, register_table[i].semantic)
|
||||||
&& output == register_table[i].output
|
&& output == register_table[i].output
|
||||||
&& version->type == register_table[i].shader_type)
|
&& version->type == register_table[i].shader_type)
|
||||||
{
|
{
|
||||||
@ -4125,7 +4125,7 @@ static void sm4_register_from_deref(const struct tpf_compiler *tpf, struct vkd3d
|
|||||||
{
|
{
|
||||||
bool has_idx;
|
bool has_idx;
|
||||||
|
|
||||||
if (hlsl_sm4_register_from_semantic(version, &var->semantic, false, ®->type, &has_idx))
|
if (sm4_register_from_semantic_name(version, var->semantic.name, false, ®->type, &has_idx))
|
||||||
{
|
{
|
||||||
unsigned int offset = hlsl_offset_from_deref_safe(ctx, deref);
|
unsigned int offset = hlsl_offset_from_deref_safe(ctx, deref);
|
||||||
|
|
||||||
@ -4154,7 +4154,7 @@ static void sm4_register_from_deref(const struct tpf_compiler *tpf, struct vkd3d
|
|||||||
{
|
{
|
||||||
bool has_idx;
|
bool has_idx;
|
||||||
|
|
||||||
if (hlsl_sm4_register_from_semantic(version, &var->semantic, true, ®->type, &has_idx))
|
if (sm4_register_from_semantic_name(version, var->semantic.name, true, ®->type, &has_idx))
|
||||||
{
|
{
|
||||||
unsigned int offset = hlsl_offset_from_deref_safe(ctx, deref);
|
unsigned int offset = hlsl_offset_from_deref_safe(ctx, deref);
|
||||||
|
|
||||||
@ -4721,7 +4721,7 @@ static void write_sm4_dcl_semantic(const struct tpf_compiler *tpf, const struct
|
|||||||
.dst_count = 1,
|
.dst_count = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hlsl_sm4_register_from_semantic(version, &var->semantic, output, &instr.dsts[0].reg.type, &has_idx))
|
if (sm4_register_from_semantic_name(version, var->semantic.name, output, &instr.dsts[0].reg.type, &has_idx))
|
||||||
{
|
{
|
||||||
if (has_idx)
|
if (has_idx)
|
||||||
{
|
{
|
||||||
|
@ -1606,6 +1606,8 @@ bool sm1_register_from_semantic_name(const struct vkd3d_shader_version *version,
|
|||||||
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);
|
||||||
bool sm1_usage_from_semantic_name(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);
|
||||||
|
bool sm4_register_from_semantic_name(const struct vkd3d_shader_version *version,
|
||||||
|
const char *semantic_name, bool output, enum vkd3d_shader_register_type *type, bool *has_idx);
|
||||||
bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *sysval_semantic,
|
bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *sysval_semantic,
|
||||||
const struct vkd3d_shader_version *version,
|
const struct vkd3d_shader_version *version,
|
||||||
bool semantic_compat_mapping, const char *semantic_name, bool output);
|
bool semantic_compat_mapping, const char *semantic_name, bool output);
|
||||||
|
Loading…
Reference in New Issue
Block a user