vkd3d-shader/d3dbc: Return a vkd3d_decl_usage from hlsl_sm1_usage_from_semantic().

This commit is contained in:
Henri Verbeet 2024-08-08 14:33:26 +02:00
parent 1c01560321
commit 7a74e79f2d
Notes: Henri Verbeet 2024-09-04 11:48:01 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1029
3 changed files with 24 additions and 23 deletions

View File

@ -1423,32 +1423,32 @@ bool hlsl_sm1_register_from_semantic(const struct vkd3d_shader_version *version,
} }
bool hlsl_sm1_usage_from_semantic(const char *semantic_name, bool hlsl_sm1_usage_from_semantic(const char *semantic_name,
uint32_t semantic_index, D3DDECLUSAGE *usage, uint32_t *usage_idx) uint32_t semantic_index, enum vkd3d_decl_usage *usage, uint32_t *usage_idx)
{ {
static const struct static const struct
{ {
const char *name; const char *name;
D3DDECLUSAGE usage; enum vkd3d_decl_usage usage;
} }
semantics[] = semantics[] =
{ {
{"binormal", D3DDECLUSAGE_BINORMAL}, {"binormal", VKD3D_DECL_USAGE_BINORMAL},
{"blendindices", D3DDECLUSAGE_BLENDINDICES}, {"blendindices", VKD3D_DECL_USAGE_BLEND_INDICES},
{"blendweight", D3DDECLUSAGE_BLENDWEIGHT}, {"blendweight", VKD3D_DECL_USAGE_BLEND_WEIGHT},
{"color", D3DDECLUSAGE_COLOR}, {"color", VKD3D_DECL_USAGE_COLOR},
{"depth", D3DDECLUSAGE_DEPTH}, {"depth", VKD3D_DECL_USAGE_DEPTH},
{"fog", D3DDECLUSAGE_FOG}, {"fog", VKD3D_DECL_USAGE_FOG},
{"normal", D3DDECLUSAGE_NORMAL}, {"normal", VKD3D_DECL_USAGE_NORMAL},
{"position", D3DDECLUSAGE_POSITION}, {"position", VKD3D_DECL_USAGE_POSITION},
{"positiont", D3DDECLUSAGE_POSITIONT}, {"positiont", VKD3D_DECL_USAGE_POSITIONT},
{"psize", D3DDECLUSAGE_PSIZE}, {"psize", VKD3D_DECL_USAGE_PSIZE},
{"sample", D3DDECLUSAGE_SAMPLE}, {"sample", VKD3D_DECL_USAGE_SAMPLE},
{"sv_depth", D3DDECLUSAGE_DEPTH}, {"sv_depth", VKD3D_DECL_USAGE_DEPTH},
{"sv_position", D3DDECLUSAGE_POSITION}, {"sv_position", VKD3D_DECL_USAGE_POSITION},
{"sv_target", D3DDECLUSAGE_COLOR}, {"sv_target", VKD3D_DECL_USAGE_COLOR},
{"tangent", D3DDECLUSAGE_TANGENT}, {"tangent", VKD3D_DECL_USAGE_TANGENT},
{"tessfactor", D3DDECLUSAGE_TESSFACTOR}, {"tessfactor", VKD3D_DECL_USAGE_TESS_FACTOR},
{"texcoord", D3DDECLUSAGE_TEXCOORD}, {"texcoord", VKD3D_DECL_USAGE_TEXCOORD},
}; };
unsigned int i; unsigned int i;
@ -2203,8 +2203,8 @@ static void d3dbc_write_semantic_dcl(struct d3dbc_compiler *d3dbc,
const struct vkd3d_shader_version *version = &d3dbc->program->shader_version; const struct vkd3d_shader_version *version = &d3dbc->program->shader_version;
struct vkd3d_bytecode_buffer *buffer = &d3dbc->buffer; struct vkd3d_bytecode_buffer *buffer = &d3dbc->buffer;
struct sm1_dst_register reg = {0}; struct sm1_dst_register reg = {0};
enum vkd3d_decl_usage usage;
uint32_t token, usage_idx; uint32_t token, usage_idx;
D3DDECLUSAGE usage;
bool ret; bool ret;
if (hlsl_sm1_register_from_semantic(version, element->semantic_name, if (hlsl_sm1_register_from_semantic(version, element->semantic_name,

View File

@ -1528,7 +1528,7 @@ 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, 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); 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, bool hlsl_sm1_usage_from_semantic(const char *semantic_name,
uint32_t semantic_index, D3DDECLUSAGE *usage, uint32_t *usage_idx); 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

@ -5128,7 +5128,7 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
if (ctx->profile->major_version < 4) if (ctx->profile->major_version < 4)
{ {
struct vkd3d_shader_version version; struct vkd3d_shader_version version;
D3DDECLUSAGE usage; enum vkd3d_decl_usage usage;
uint32_t usage_idx; uint32_t usage_idx;
/* ps_1_* outputs are special and go in temp register 0. */ /* ps_1_* outputs are special and go in temp register 0. */
@ -5956,7 +5956,8 @@ static void sm1_generate_vsir_signature_entry(struct hlsl_ctx *ctx,
if (!hlsl_sm1_register_from_semantic(&program->shader_version, if (!hlsl_sm1_register_from_semantic(&program->shader_version,
var->semantic.name, var->semantic.index, output, &type, &register_index)) var->semantic.name, var->semantic.index, output, &type, &register_index))
{ {
unsigned int usage, usage_idx; enum vkd3d_decl_usage usage;
unsigned int usage_idx;
bool ret; bool ret;
register_index = var->regs[HLSL_REGSET_NUMERIC].id; register_index = var->regs[HLSL_REGSET_NUMERIC].id;