Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
You can mix and match "xyzw" and "rgba" writemasks, even in vertex sh…
…aders.
  • Loading branch information
icculus committed Feb 28, 2009
1 parent 461f9fc commit 86a3040
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions mojoshader_assembler.c
Expand Up @@ -614,18 +614,10 @@ static int parse_destination_token(Context *ctx)
memcpy(tokenbytes, ctx->token, ((tokenlen < 4) ? tokenlen : 4));
char *ptr = tokenbytes;

info->writemask0 = info->writemask1 = info->writemask2 = info->writemask3 = 0;
if (*ptr == 'x') { info->writemask0 = 1; ptr++; }
if (*ptr == 'y') { info->writemask1 = 1; ptr++; }
if (*ptr == 'z') { info->writemask2 = 1; ptr++; }
if (*ptr == 'w') { info->writemask3 = 1; ptr++; }
if ((ptr == ctx->token) && (shader_is_pixel(ctx)))
{
if (*ptr == 'r') { info->writemask0 = 1; ptr++; }
if (*ptr == 'g') { info->writemask1 = 1; ptr++; }
if (*ptr == 'b') { info->writemask2 = 1; ptr++; }
if (*ptr == 'a') { info->writemask3 = 1; ptr++; }
} // if
if ((*ptr == 'r') || (*ptr == 'x')) { info->writemask0 = 1; ptr++; }
if ((*ptr == 'g') || (*ptr == 'y')) { info->writemask1 = 1; ptr++; }
if ((*ptr == 'b') || (*ptr == 'z')) { info->writemask2 = 1; ptr++; }
if ((*ptr == 'a') || (*ptr == 'w')) { info->writemask3 = 1; ptr++; }

if (*ptr != '\0')
invalid_writemask = 1;
Expand Down

0 comments on commit 86a3040

Please sign in to comment.