Corrected state_IF() to handle IF PRED format.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 10 Dec 2008 05:30:38 -0500
changeset 496 a5418917b49c
parent 495 93ede2fba3c6
child 497 5b2465d40b57
Corrected state_IF() to handle IF PRED format.
mojoshader.c
--- a/mojoshader.c	Wed Dec 10 05:21:32 2008 -0500
+++ b/mojoshader.c	Wed Dec 10 05:30:38 2008 -0500
@@ -6160,8 +6160,11 @@
 
 static void state_IF(Context *ctx)
 {
-    if (ctx->source_args[0].regtype != REG_TYPE_CONSTBOOL)
-        fail(ctx, "IF src0 must be CONSTBOOL");
+    const RegisterType regtype = ctx->source_args[0].regtype;
+    if ((regtype != REG_TYPE_PREDICATE) && (regtype != REG_TYPE_CONSTBOOL))
+        fail(ctx, "IF src0 must be CONSTBOOL or PREDICATE");
+    else if (!replicate_swizzle(ctx->source_args[0].swizzle))
+        fail(ctx, "IF src0 must have replicate swizzle");
     // !!! FIXME: track if nesting depth.
 } // state_IF