From 9425aef623572771b8469a895329a60453126c4c Mon Sep 17 00:00:00 2001 From: "H. Verbeet" Date: Mon, 15 Jan 2007 19:32:20 +0100 Subject: [PATCH] wined3d: Rewrite pshader_glsl_dp2add() to properly take the write mask into account. --- dlls/wined3d/glsl_shader.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 348fc77c06a..60f74c08d13 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1817,19 +1817,20 @@ void pshader_glsl_texkill(SHADER_OPCODE_ARG* arg) { /** Process the WINED3DSIO_DP2ADD instruction in GLSL. * dst = dot2(src0, src1) + src2 */ void pshader_glsl_dp2add(SHADER_OPCODE_ARG* arg) { + char src0_str[100], src1_str[100], src2_str[100]; + char src0_reg[50], src1_reg[50], src2_reg[50]; + char src0_mask[6], src1_mask[6], src2_mask[6]; + DWORD write_mask; + size_t mask_size; - char tmpLine[256]; - char dst_str[100], src0_str[100], src1_str[100], src2_str[100]; - char dst_reg[50], src0_reg[50], src1_reg[50], src2_reg[50]; - char dst_mask[6], src0_mask[6], src1_mask[6], src2_mask[6]; - - shader_glsl_add_dst_param(arg, arg->dst, 0, dst_reg, dst_mask, dst_str); - shader_glsl_add_src_param_old(arg, arg->src[0], arg->src_addr[0], src0_reg, src0_mask, src0_str); - shader_glsl_add_src_param_old(arg, arg->src[1], arg->src_addr[1], src1_reg, src1_mask, src1_str); - shader_glsl_add_src_param_old(arg, arg->src[2], arg->src_addr[2], src2_reg, src2_mask, src2_str); - shader_glsl_add_dst_old(arg->dst, dst_reg, dst_mask, tmpLine); - shader_addline(arg->buffer, "%sdot(vec2(%s), vec2(%s)) + %s)%s;\n", - tmpLine, src0_str, src1_str, src2_str, dst_mask); + write_mask = shader_glsl_append_dst(arg->buffer, arg); + mask_size = shader_glsl_get_write_mask_size(write_mask); + + shader_glsl_add_src_param(arg, arg->src[0], arg->src_addr[0], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, src0_reg, src0_mask, src0_str); + shader_glsl_add_src_param(arg, arg->src[1], arg->src_addr[1], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, src1_reg, src1_mask, src1_str); + shader_glsl_add_src_param(arg, arg->src[2], arg->src_addr[2], WINED3DSP_WRITEMASK_0, src2_reg, src2_mask, src2_str); + + shader_addline(arg->buffer, "dot(%s, %s) + %s);\n", src0_str, src1_str, src2_str); } void pshader_glsl_input_pack(