Whoops, need to do register reference upkeep for dest and source args. trunk
authorRyan C. Gordon <icculus@icculus.org>
Thu, 03 Apr 2008 09:37:19 -0400
branchtrunk
changeset 75 1bbb06b40588
parent 74 935af85774dc
child 76 b0cf9ff37f05
Whoops, need to do register reference upkeep for dest and source args.
mojoshader.c
--- a/mojoshader.c	Thu Apr 03 09:33:55 2008 -0400
+++ b/mojoshader.c	Thu Apr 03 09:37:19 2008 -0400
@@ -2266,6 +2266,17 @@
      PROFILE_EMITTER_GLSL(op) \
 }
 
+static void register_reference_upkeep(Context *ctx, const RegisterType regtype)
+{
+    // !!! FIXME: make sure there were def/dcl for all referenced vars?
+    switch (regtype)
+    {
+        case REG_TYPE_ADDRESS: ctx->flags |= CTX_FLAGS_USED_ADDR_REG; break;
+        case REG_TYPE_PREDICATE: ctx->flags |= CTX_FLAGS_USED_PRED_REG; break;
+        default: break;  // don't care.
+    } // switch
+} // register_reference_upkeep
+
 
 static int parse_destination_token(Context *ctx, DestArgInfo *info)
 {
@@ -2343,6 +2354,7 @@
     if ((info->regtype < 0) || (info->regtype > REG_TYPE_MAX))
         return fail(ctx, "Register type is out of range");
 
+    register_reference_upkeep(ctx, info->regtype);
     return 1;
 } // parse_destination_token
 
@@ -2389,14 +2401,7 @@
     if ( ((SourceMod) info->src_mod) >= SRCMOD_TOTAL )
         return fail(ctx, "Unknown source modifier");
 
-    // !!! FIXME: make sure there were def/dcl for all referenced vars?
-    switch (info->regtype)
-    {
-        case REG_TYPE_ADDRESS: ctx->flags |= CTX_FLAGS_USED_ADDR_REG; break;
-        case REG_TYPE_PREDICATE: ctx->flags |= CTX_FLAGS_USED_PRED_REG; break;
-        default: break;  // don't care.
-    } // switch
-
+    register_reference_upkeep(ctx, info->regtype);
     return 1;
 } // parse_source_token