[PATCH 3/4] wined3d: fix texm3x3spec coordinate mask bug

Roderick Colenbrander thunderbird2k at gmail.com
Wed Apr 28 07:29:21 CDT 2010


This patch fixes an issue in "King's Bounty: The Legend" for which a shader of the form:
'texture2D(sampler2D, tmp0.xyz)' was generated. The nvidia GLSL compiler wants to have tmp0.xyz.
---
 dlls/wined3d/glsl_shader.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 7648d15..0dda10a 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3285,6 +3285,7 @@ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins
     WINED3DSAMPLER_TEXTURE_TYPE stype = ins->ctx->reg_maps->sampler_type[reg];
     DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
     glsl_sample_function_t sample_function;
+    char coord_mask[6];
 
     shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param);
     shader_glsl_add_src_param(ins, &ins->src[1], src_mask, &src1_param);
@@ -3298,7 +3299,8 @@ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins
     shader_glsl_get_sample_function(gl_info, stype, 0, &sample_function);
 
     /* Sample the texture */
-    shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, NULL, NULL, "tmp0.xyz");
+    shader_glsl_write_mask_to_str(sample_function.coord_mask, coord_mask);
+    shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, NULL, NULL, "tmp0%s", coord_mask);
 
     current_state->current_row = 0;
 }
-- 
1.6.3.3




More information about the wine-patches mailing list