diff options
author | marha <marha@users.sourceforge.net> | 2010-03-07 16:00:29 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-03-07 16:00:29 +0000 |
commit | b40894093babb10f3cd155f11ff2d6c710372395 (patch) | |
tree | e6e94e5aa39ca9d5a653af567145e4b5dda25d61 /mesalib/src/mesa/shader/program_parse_extra.c | |
parent | d27419efcdaaccb40e0f10c549a6b732a2f29e81 (diff) | |
parent | 14b1cb8d5a27ec9716d3f790fce95f0469e35605 (diff) | |
download | vcxsrv-b40894093babb10f3cd155f11ff2d6c710372395.tar.gz vcxsrv-b40894093babb10f3cd155f11ff2d6c710372395.tar.bz2 vcxsrv-b40894093babb10f3cd155f11ff2d6c710372395.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/shader/program_parse_extra.c')
-rw-r--r-- | mesalib/src/mesa/shader/program_parse_extra.c | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/mesalib/src/mesa/shader/program_parse_extra.c b/mesalib/src/mesa/shader/program_parse_extra.c index 8e4be606f..0656c5eaa 100644 --- a/mesalib/src/mesa/shader/program_parse_extra.c +++ b/mesalib/src/mesa/shader/program_parse_extra.c @@ -34,6 +34,121 @@ */ int +_mesa_parse_instruction_suffix(const struct asm_parser_state *state, + const char *suffix, + struct prog_instruction *inst) +{ + inst->CondUpdate = 0; + inst->CondDst = 0; + inst->SaturateMode = SATURATE_OFF; + inst->Precision = FLOAT32; + + + /* The first possible suffix element is the precision specifier from + * NV_fragment_program_option. + */ + if (state->option.NV_fragment) { + switch (suffix[0]) { + case 'H': + inst->Precision = FLOAT16; + suffix++; + break; + case 'R': + inst->Precision = FLOAT32; + suffix++; + break; + case 'X': + inst->Precision = FIXED12; + suffix++; + break; + default: + break; + } + } + + /* The next possible suffix element is the condition code modifier selection + * from NV_fragment_program_option. + */ + if (state->option.NV_fragment) { + if (suffix[0] == 'C') { + inst->CondUpdate = 1; + suffix++; + } + } + + + /* The final possible suffix element is the saturation selector from + * ARB_fragment_program. + */ + if (state->mode == ARB_fragment) { + if (strcmp(suffix, "_SAT") == 0) { + inst->SaturateMode = SATURATE_ZERO_ONE; + suffix += 4; + } + } + + + /* It is an error for all of the suffix string not to be consumed. + */ + return suffix[0] == '\0'; +} + + +int +_mesa_parse_cc(const char *s) +{ + int cond = 0; + + switch (s[0]) { + case 'E': + if (s[1] == 'Q') { + cond = COND_EQ; + } + break; + + case 'F': + if (s[1] == 'L') { + cond = COND_FL; + } + break; + + case 'G': + if (s[1] == 'E') { + cond = COND_GE; + } else if (s[1] == 'T') { + cond = COND_GT; + } + break; + + case 'L': + if (s[1] == 'E') { + cond = COND_LE; + } else if (s[1] == 'T') { + cond = COND_LT; + } + break; + + case 'N': + if (s[1] == 'E') { + cond = COND_NE; + } + break; + + case 'T': + if (s[1] == 'R') { + cond = COND_TR; + } + break; + + default: + break; + } + + return ((cond == 0) || (s[2] != '\0')) ? 0 : cond; +} + + +int _mesa_ARBvp_parse_option(struct asm_parser_state *state, const char *option) { if (strcmp(option, "ARB_position_invariant") == 0) { @@ -102,6 +217,17 @@ _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option) return 1; } } + } else if (strncmp(option, "NV_fragment_program", 19) == 0) { + option += 19; + + /* Other NV_fragment_program strings may be supported later. + */ + if (option[0] == '\0') { + if (state->ctx->Extensions.NV_fragment_program_option) { + state->option.NV_fragment = 1; + return 1; + } + } } else if (strncmp(option, "MESA_", 5) == 0) { option += 5; |