mojoshader.c
branchtrunk
changeset 186 1658e8ce74ac
parent 185 ea719ad60d81
child 187 1c709f65cf1b
equal deleted inserted replaced
185:ea719ad60d81 186:1658e8ce74ac
  3522 
  3522 
  3523 static void state_DEF(Context *ctx)
  3523 static void state_DEF(Context *ctx)
  3524 {
  3524 {
  3525     const RegisterType regtype = ctx->dest_arg.regtype;
  3525     const RegisterType regtype = ctx->dest_arg.regtype;
  3526     const int regnum = ctx->dest_arg.regnum;
  3526     const int regnum = ctx->dest_arg.regnum;
       
  3527 
       
  3528     ctx->instruction_count--;  // these don't increase your instruction count.
       
  3529 
  3527     switch (regtype)
  3530     switch (regtype)
  3528     {
  3531     {
  3529         case REG_TYPE_CONST:
  3532         case REG_TYPE_CONST:
  3530         case REG_TYPE_CONST2:
  3533         case REG_TYPE_CONST2:
  3531         case REG_TYPE_CONST3:
  3534         case REG_TYPE_CONST3:
  3540 
  3543 
  3541 static void state_DEFI(Context *ctx)
  3544 static void state_DEFI(Context *ctx)
  3542 {
  3545 {
  3543     const RegisterType regtype = ctx->dest_arg.regtype;
  3546     const RegisterType regtype = ctx->dest_arg.regtype;
  3544     const int regnum = ctx->dest_arg.regnum;
  3547     const int regnum = ctx->dest_arg.regnum;
       
  3548 
       
  3549     ctx->instruction_count--;  // these don't increase your instruction count.
       
  3550 
  3545     if (regtype != REG_TYPE_CONSTINT)
  3551     if (regtype != REG_TYPE_CONSTINT)
  3546         fail(ctx, "DEFI token using invalid register");
  3552         fail(ctx, "DEFI token using invalid register");
  3547     else
  3553     else
  3548         set_defined_register(ctx, regtype, regnum);
  3554         set_defined_register(ctx, regtype, regnum);
  3549 } // state_DEFI
  3555 } // state_DEFI
  3550 
  3556 
  3551 static void state_DEFB(Context *ctx)
  3557 static void state_DEFB(Context *ctx)
  3552 {
  3558 {
  3553     const RegisterType regtype = ctx->dest_arg.regtype;
  3559     const RegisterType regtype = ctx->dest_arg.regtype;
  3554     const int regnum = ctx->dest_arg.regnum;
  3560     const int regnum = ctx->dest_arg.regnum;
       
  3561 
       
  3562     ctx->instruction_count--;  // these don't increase your instruction count.
       
  3563 
  3555     if (regtype != REG_TYPE_CONSTBOOL)
  3564     if (regtype != REG_TYPE_CONSTBOOL)
  3556         fail(ctx, "DEFB token using invalid register");
  3565         fail(ctx, "DEFB token using invalid register");
  3557     else
  3566     else
  3558         set_defined_register(ctx, regtype, regnum);
  3567         set_defined_register(ctx, regtype, regnum);
  3559 } // state_DEFB
  3568 } // state_DEFB
  3561 static void state_DCL(Context *ctx)
  3570 static void state_DCL(Context *ctx)
  3562 {
  3571 {
  3563     const DestArgInfo *arg = &ctx->dest_arg;
  3572     const DestArgInfo *arg = &ctx->dest_arg;
  3564     const RegisterType regtype = arg->regtype;
  3573     const RegisterType regtype = arg->regtype;
  3565     const int regnum = arg->regnum;
  3574     const int regnum = arg->regnum;
       
  3575 
       
  3576     ctx->instruction_count--;  // these don't increase your instruction count.
  3566 
  3577 
  3567     // parse_args_DCL() does a lot of state checking before we get here.
  3578     // parse_args_DCL() does a lot of state checking before we get here.
  3568 
  3579 
  3569     // !!! FIXME: fail if DCL opcode comes after real instructions.
  3580     // !!! FIXME: fail if DCL opcode comes after real instructions.
  3570 
  3581