From a10ee075ffaef5e753620278608c37af97351b31 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Sat, 5 Oct 2024 12:13:39 -0500 Subject: [PATCH] vkd3d-shader/ir: Force fog and point size to 1 component when normalizing I/O. --- libs/vkd3d-shader/ir.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 9b50a308..f926b0cc 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -1932,6 +1932,8 @@ static bool shader_dst_param_io_normalise(struct vkd3d_shader_dst_param *dst_par const struct shader_signature *signature; const struct signature_element *e; + write_mask = dst_param->write_mask; + switch (reg->type) { case VKD3DSPR_OUTPUT: @@ -1987,6 +1989,10 @@ static bool shader_dst_param_io_normalise(struct vkd3d_shader_dst_param *dst_par signature = normaliser->output_signature; reg->type = VKD3DSPR_OUTPUT; dcl_params = normaliser->output_dcl_params; + /* Fog and point size are scalar, but fxc/d3dcompiler emits a full + * write mask when writing to them. */ + if (reg->idx[0].offset > 0) + write_mask = VKD3DSP_WRITEMASK_0; break; default: @@ -1994,7 +2000,6 @@ static bool shader_dst_param_io_normalise(struct vkd3d_shader_dst_param *dst_par } id_idx = reg->idx_count - 1; - write_mask = dst_param->write_mask; if (!shader_signature_find_element_for_reg(signature, reg_idx, write_mask, &element_idx)) vkd3d_unreachable(); e = &signature->elements[element_idx];