mojoshader.c
changeset 451 43175917011f
parent 450 6a9faf398c1d
child 452 c339e8b83bbe
--- a/mojoshader.c	Tue Aug 26 05:54:49 2008 -0400
+++ b/mojoshader.c	Sat Sep 06 09:12:20 2008 -0400
@@ -4830,7 +4830,13 @@
 
 static void emit_ARB1_TEXKILL(Context *ctx)
 {
-    // !!! FIXME: d3d kills on xyz, arb1 kills on xyzw. Fix the swizzle!
+    // d3d kills on xyz, arb1 kills on xyzw. Fix the swizzle.
+    //  We just map the x component to w. If it's negative, the fragment
+    //  would discard anyhow, otherwise, it'll pass through okay. This saves
+    //  us a temp register.
+    const int origswiz = ctx->source_args[0].swizzle;
+    ctx->source_args[0].swizzle = (origswiz & 0x3F) | ((origswiz & 0x3) << 6);
+    ctx->source_args[0].swizzle_w = ctx->source_args[0].swizzle_x;
     const char *src0 = make_ARB1_srcarg_string(ctx, 0);
     output_line(ctx, "KIL %s;", src0);
 } // emit_ARB1_TEXKILL