Moved some DCL stuff from parse_args() to state() implementation. trunk
authorRyan C. Gordon <icculus@icculus.org>
Fri, 04 Apr 2008 08:53:43 -0400
branchtrunk
changeset 91 3ae89caee681
parent 90 c4ef90fd0a56
child 92 bc1bb138e855
Moved some DCL stuff from parse_args() to state() implementation.
mojoshader.c
--- a/mojoshader.c	Fri Apr 04 08:51:31 2008 -0400
+++ b/mojoshader.c	Fri Apr 04 08:53:43 2008 -0400
@@ -2678,8 +2678,6 @@
     if ((token & reserved_mask) != 0)
         return fail(ctx, "reserved bits in DCL dword aren't zero");
 
-    set_defined_register(ctx, regtype, regnum);
-
     return 3;
 } // parse_args_DCL
 
@@ -2798,6 +2796,13 @@
         set_defined_register(ctx, regtype, regnum);
 } // state_DEFB
 
+static void state_DCL(Context *ctx)
+{
+    const RegisterType regtype = ctx->dest_args[0].regtype;
+    const int regnum = ctx->dest_args[0].regnum;
+    set_defined_register(ctx, regtype, regnum);
+} // state_DCL
+
 static void state_FRC(Context *ctx)
 {
     if (!shader_version_atleast(ctx, 2, 0))
@@ -3037,7 +3042,7 @@
     INSTRUCTION_STATE(RET, 0, NULL, MOJOSHADER_TYPE_ANY),
     INSTRUCTION_STATE(ENDLOOP, 0, NULL, MOJOSHADER_TYPE_ANY),
     INSTRUCTION_STATE(LABEL, 1, S, MOJOSHADER_TYPE_ANY),
-    INSTRUCTION(DCL, 2, DCL, MOJOSHADER_TYPE_ANY),
+    INSTRUCTION_STATE(DCL, 2, DCL, MOJOSHADER_TYPE_ANY),
     INSTRUCTION(POW, 3, DSS, MOJOSHADER_TYPE_ANY),
     INSTRUCTION(CRS, 3, DSS, MOJOSHADER_TYPE_ANY),
     INSTRUCTION(SGN, 4, DSSS, MOJOSHADER_TYPE_ANY),