From ab98d7f8f5d00acbfd9d89aeb1fab5204c2c87b0 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 29 May 2016 13:31:18 -0400 Subject: [PATCH] parse_preshader merge fixes --- mojoshader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mojoshader.c b/mojoshader.c index 049737c9..b1f16a30 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -10898,7 +10898,7 @@ static void parse_preshader(Context *ctx, const uint32 *tokens, uint32 tokcount) { case 1: // literal from CLIT block. { - if ((item + inst->element_count) >= preshader->literal_count) + if (item > preshader->literal_count) { fail(ctx, "Bogus preshader literal index."); break; @@ -10916,7 +10916,7 @@ static void parse_preshader(Context *ctx, const uint32 *tokens, uint32 tokcount) const uint32 base = sym->register_index * 4; const uint32 count = sym->register_count * 4; assert(sym->register_set==MOJOSHADER_SYMREGSET_FLOAT4); - if ( (base <= item) && ((base + count) >= (item + inst->element_count)) ) + if ( (base <= item) && ((base + count) > item) ) break; } // for if (i == ctabdata.symbol_count) @@ -10955,7 +10955,7 @@ static void parse_preshader(Context *ctx, const uint32 *tokens, uint32 tokcount) { const uint32 base = output_map[(i*2)] * 4; const uint32 count = output_map[(i*2)+1] * 4; - if ( (base <= item) && ((base + count) >= (item + inst->element_count)) ) + if ( (base <= item) && ((base + count) > item) ) break; } // for @@ -10972,7 +10972,7 @@ static void parse_preshader(Context *ctx, const uint32 *tokens, uint32 tokcount) { operand->type = MOJOSHADER_PRESHADEROPERAND_TEMP; if (item >= preshader->temp_count) - preshader->temp_count = item + inst->element_count; + preshader->temp_count = item + 1; break; } // case } // switch