From 1968a87b9381fbb21728374113a04fa3774693e4 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 22 Apr 2008 06:07:36 -0400 Subject: [PATCH] Don't increase instruction count for DEFx and DCL opcodes. We're still not a perfect match with the Microsoft disassembler estimates. --HG-- branch : trunk --- mojoshader.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mojoshader.c b/mojoshader.c index 667c37f5..79d24c0f 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -3524,6 +3524,9 @@ static void state_DEF(Context *ctx) { const RegisterType regtype = ctx->dest_arg.regtype; const int regnum = ctx->dest_arg.regnum; + + ctx->instruction_count--; // these don't increase your instruction count. + switch (regtype) { case REG_TYPE_CONST: @@ -3542,6 +3545,9 @@ static void state_DEFI(Context *ctx) { const RegisterType regtype = ctx->dest_arg.regtype; const int regnum = ctx->dest_arg.regnum; + + ctx->instruction_count--; // these don't increase your instruction count. + if (regtype != REG_TYPE_CONSTINT) fail(ctx, "DEFI token using invalid register"); else @@ -3552,6 +3558,9 @@ static void state_DEFB(Context *ctx) { const RegisterType regtype = ctx->dest_arg.regtype; const int regnum = ctx->dest_arg.regnum; + + ctx->instruction_count--; // these don't increase your instruction count. + if (regtype != REG_TYPE_CONSTBOOL) fail(ctx, "DEFB token using invalid register"); else @@ -3564,6 +3573,8 @@ static void state_DCL(Context *ctx) const RegisterType regtype = arg->regtype; const int regnum = arg->regnum; + ctx->instruction_count--; // these don't increase your instruction count. + // parse_args_DCL() does a lot of state checking before we get here. // !!! FIXME: fail if DCL opcode comes after real instructions.