Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Corrected parsing of result modifiers for my stupid tokenizer.
  • Loading branch information
icculus committed Dec 12, 2008
1 parent 19c6e81 commit a52b6a8
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions mojoshader_assembler.c
Expand Up @@ -625,18 +625,34 @@ static int parse_destination_token(Context *ctx, DestArgInfo *info)
return fail(ctx, "Expected modifier or whitespace");
else if (nexttoken(ctx, 0, 0, 0, 0) == FAIL)
return FAIL;
else if (strcasecmp(ctx->token, "x2") == 0)
set_result_shift(ctx, info, 0x1);
else if (strcasecmp(ctx->token, "x4") == 0)
set_result_shift(ctx, info, 0x2);
else if (strcasecmp(ctx->token, "x8") == 0)
set_result_shift(ctx, info, 0x3);
else if (strcasecmp(ctx->token, "d8") == 0)
set_result_shift(ctx, info, 0xD);
else if (strcasecmp(ctx->token, "d4") == 0)
set_result_shift(ctx, info, 0xE);
else if (strcasecmp(ctx->token, "d2") == 0)
set_result_shift(ctx, info, 0xF);
// !!! FIXME: this can be cleaned up when tokenizer is fixed.
else if (strcasecmp(ctx->token, "x") == 0)
{
if (nexttoken(ctx, 0, 0, 0, 0) == FAIL)
return FAIL;
else if (strcmp(ctx->token, "2") == 0)
set_result_shift(ctx, info, 0x1);
else if (strcmp(ctx->token, "4") == 0)
set_result_shift(ctx, info, 0x2);
else if (strcmp(ctx->token, "8") == 0)
set_result_shift(ctx, info, 0x3);
else
return fail(ctx, "Expected modifier");
} // else if
// !!! FIXME: this can be cleaned up when tokenizer is fixed.
else if (strcasecmp(ctx->token, "d") == 0)
{
if (nexttoken(ctx, 0, 0, 0, 0) == FAIL)
return FAIL;
else if (strcmp(ctx->token, "8") == 0)
set_result_shift(ctx, info, 0xD);
else if (strcmp(ctx->token, "4") == 0)
set_result_shift(ctx, info, 0xE);
else if (strcmp(ctx->token, "2") == 0)
set_result_shift(ctx, info, 0xF);
else
return fail(ctx, "Expected modifier");
} // else if
else if (strcasecmp(ctx->token, "sat") == 0)
info->result_mod |= MOD_SATURATE;
else if (strcasecmp(ctx->token, "pp") == 0)
Expand Down

0 comments on commit a52b6a8

Please sign in to comment.