wined3d: Fix D3DSIO_TEXKILL for GLSL

Jason Green jave27 at gmail.com
Fri Jul 7 09:13:42 CDT 2006


The sample I implemented this with only worked by chance.

This fix uses the destination register instead of the source0 register.
Also, it uses builtin GLSL functions instead of expanding it out to
multiple compares.
-------------- next part --------------
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index d7ec6a2..e7ba349 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1364,10 +1364,10 @@ void pshader_glsl_texbem(SHADER_OPCODE_A
  * If any of the first 3 components are < 0, discard this pixel */
 void pshader_glsl_texkill(SHADER_OPCODE_ARG* arg) {
 
-    char src0_str[100], src0_name[50], src0_mask[6];
+    char dst_str[100], dst_name[50], dst_mask[6];
 
-    shader_glsl_add_param(arg, arg->src[0], arg->src_addr[0], TRUE, src0_name, src0_mask, src0_str);
-    shader_addline(arg->buffer, "if (%s.x < 0.0 || %s.y < 0.0 || %s.z < 0.0) discard;\n", src0_name, src0_name, src0_name);
+    shader_glsl_add_param(arg, arg->dst, 0, FALSE, dst_name, dst_mask, dst_str);
+    shader_addline(arg->buffer, "if (any(lessThan(%s.xyz, vec3(0.0)))) discard;\n", dst_name);
 }
 
 /** Process the D3DSIO_DP2ADD instruction in GLSL.


More information about the wine-patches mailing list