From df2ae56de8a99729bf37673fd6fe952a2289e324 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 22 Dec 2023 14:25:44 +0100 Subject: [PATCH] vkd3d-shader/d3dbc: Override the write mask when the destination is not vec4. --- libs/vkd3d-shader/d3dbc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 67f9e280..8fec1e63 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -482,9 +482,23 @@ static void shader_sm1_parse_dst_param(uint32_t param, const struct vkd3d_shader dst->reg.dimension = VSIR_DIMENSION_SCALAR; else dst->reg.dimension = VSIR_DIMENSION_VEC4; - dst->write_mask = (param & VKD3D_SM1_WRITEMASK_MASK) >> VKD3D_SM1_WRITEMASK_SHIFT; dst->modifiers = (param & VKD3D_SM1_DST_MODIFIER_MASK) >> VKD3D_SM1_DST_MODIFIER_SHIFT; dst->shift = (param & VKD3D_SM1_DSTSHIFT_MASK) >> VKD3D_SM1_DSTSHIFT_SHIFT; + + switch (dst->reg.dimension) + { + case VSIR_DIMENSION_SCALAR: + dst->write_mask = VKD3DSP_WRITEMASK_0; + break; + + case VSIR_DIMENSION_VEC4: + dst->write_mask = (param & VKD3D_SM1_WRITEMASK_MASK) >> VKD3D_SM1_WRITEMASK_SHIFT; + break; + + default: + dst->write_mask = 0; + break; + } } static struct signature_element *find_signature_element(const struct shader_signature *signature,