vkd3d-shader: Set xxxx swizzle for scalar registers.

Mainly for vOutputControlPointID.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-02-20 13:42:49 +01:00 committed by Alexandre Julliard
parent 3fbbc68160
commit 7b84adec32

View File

@ -1511,6 +1511,25 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr
return true; return true;
} }
static bool shader_sm4_is_scalar_register(const struct vkd3d_shader_register *reg)
{
switch (reg->type)
{
case VKD3DSPR_COVERAGE:
case VKD3DSPR_DEPTHOUT:
case VKD3DSPR_DEPTHOUTGE:
case VKD3DSPR_DEPTHOUTLE:
case VKD3DSPR_GSINSTID:
case VKD3DSPR_LOCALTHREADINDEX:
case VKD3DSPR_OUTPOINTID:
case VKD3DSPR_PRIMID:
case VKD3DSPR_SAMPLEMASK:
return true;
default:
return false;
}
}
static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD **ptr, const DWORD *end, static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
enum vkd3d_data_type data_type, struct vkd3d_shader_src_param *src_param) enum vkd3d_data_type data_type, struct vkd3d_shader_src_param *src_param)
{ {
@ -1541,6 +1560,9 @@ static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD *
switch (swizzle_type) switch (swizzle_type)
{ {
case VKD3D_SM4_SWIZZLE_NONE: case VKD3D_SM4_SWIZZLE_NONE:
if (shader_sm4_is_scalar_register(&src_param->reg))
src_param->swizzle = VKD3D_SWIZZLE(VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_X);
else
src_param->swizzle = VKD3D_NO_SWIZZLE; src_param->swizzle = VKD3D_NO_SWIZZLE;
break; break;
@ -1562,25 +1584,6 @@ static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD *
return true; return true;
} }
static bool shader_sm4_is_scalar_register(const struct vkd3d_shader_register *reg)
{
switch (reg->type)
{
case VKD3DSPR_COVERAGE:
case VKD3DSPR_DEPTHOUT:
case VKD3DSPR_DEPTHOUTGE:
case VKD3DSPR_DEPTHOUTLE:
case VKD3DSPR_GSINSTID:
case VKD3DSPR_LOCALTHREADINDEX:
case VKD3DSPR_OUTPOINTID:
case VKD3DSPR_PRIMID:
case VKD3DSPR_SAMPLEMASK:
return true;
default:
return false;
}
}
static bool shader_sm4_read_dst_param(struct vkd3d_sm4_data *priv, const DWORD **ptr, const DWORD *end, static bool shader_sm4_read_dst_param(struct vkd3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
enum vkd3d_data_type data_type, struct vkd3d_shader_dst_param *dst_param) enum vkd3d_data_type data_type, struct vkd3d_shader_dst_param *dst_param)
{ {