vkd3d-shader/tpf: Implement semantics for hull shaders.

This commit is contained in:
Shaun Ren 2024-10-15 16:33:21 -04:00 committed by Henri Verbeet
parent beb342ed5f
commit cbed70c60f
Notes: Henri Verbeet 2024-10-16 21:47:54 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1187

View File

@ -3018,6 +3018,9 @@ bool sm4_register_from_semantic_name(const struct vkd3d_shader_version *version,
{"sv_primitiveid", false, VKD3D_SHADER_TYPE_GEOMETRY, VKD3DSPR_PRIMID, false}, {"sv_primitiveid", false, VKD3D_SHADER_TYPE_GEOMETRY, VKD3DSPR_PRIMID, false},
{"sv_outputcontrolpointid", false, VKD3D_SHADER_TYPE_HULL, VKD3DSPR_OUTPOINTID, false},
{"sv_primitiveid", false, VKD3D_SHADER_TYPE_HULL, VKD3DSPR_PRIMID, false},
/* Put sv_target in this table, instead of letting it fall through to /* Put sv_target in this table, instead of letting it fall through to
* default varying allocation, so that the register index matches the * default varying allocation, so that the register index matches the
* usage index. */ * usage index. */
@ -3071,6 +3074,12 @@ bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *s
{"sv_position", true, VKD3D_SHADER_TYPE_GEOMETRY, VKD3D_SHADER_SV_POSITION}, {"sv_position", true, VKD3D_SHADER_TYPE_GEOMETRY, VKD3D_SHADER_SV_POSITION},
{"sv_primitiveid", true, VKD3D_SHADER_TYPE_GEOMETRY, VKD3D_SHADER_SV_PRIMITIVE_ID}, {"sv_primitiveid", true, VKD3D_SHADER_TYPE_GEOMETRY, VKD3D_SHADER_SV_PRIMITIVE_ID},
{"sv_outputcontrolpointid", false, VKD3D_SHADER_TYPE_HULL, ~0u},
{"sv_position", false, VKD3D_SHADER_TYPE_HULL, ~0u},
{"sv_primitiveid", false, VKD3D_SHADER_TYPE_HULL, ~0u},
{"sv_position", true, VKD3D_SHADER_TYPE_HULL, VKD3D_SHADER_SV_POSITION},
{"position", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_POSITION}, {"position", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_POSITION},
{"sv_position", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_POSITION}, {"sv_position", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_POSITION},
{"sv_primitiveid", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_PRIMITIVE_ID}, {"sv_primitiveid", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_PRIMITIVE_ID},
@ -4135,7 +4144,10 @@ static void sm4_register_from_deref(const struct tpf_compiler *tpf, struct vkd3d
reg->idx_count = 1; reg->idx_count = 1;
} }
reg->dimension = VSIR_DIMENSION_VEC4; if (shader_sm4_is_scalar_register(reg))
reg->dimension = VSIR_DIMENSION_SCALAR;
else
reg->dimension = VSIR_DIMENSION_VEC4;
*writemask = ((1u << data_type->dimx) - 1) << (offset % 4); *writemask = ((1u << data_type->dimx) - 1) << (offset % 4);
} }
else else
@ -4164,7 +4176,7 @@ static void sm4_register_from_deref(const struct tpf_compiler *tpf, struct vkd3d
reg->idx_count = 1; reg->idx_count = 1;
} }
if (reg->type == VKD3DSPR_DEPTHOUT) if (shader_sm4_is_scalar_register(reg))
reg->dimension = VSIR_DIMENSION_SCALAR; reg->dimension = VSIR_DIMENSION_SCALAR;
else else
reg->dimension = VSIR_DIMENSION_VEC4; reg->dimension = VSIR_DIMENSION_VEC4;
@ -4742,7 +4754,7 @@ static void write_sm4_dcl_semantic(const struct tpf_compiler *tpf, const struct
instr.dsts[0].write_mask = var->regs[HLSL_REGSET_NUMERIC].writemask; instr.dsts[0].write_mask = var->regs[HLSL_REGSET_NUMERIC].writemask;
} }
if (instr.dsts[0].reg.type == VKD3DSPR_DEPTHOUT) if (shader_sm4_is_scalar_register(&instr.dsts[0].reg))
instr.dsts[0].reg.dimension = VSIR_DIMENSION_SCALAR; instr.dsts[0].reg.dimension = VSIR_DIMENSION_SCALAR;
sm4_sysval_semantic_from_semantic_name(&semantic, version, sm4_sysval_semantic_from_semantic_name(&semantic, version,