From 81722c5d7e8e93d837510b9e6e5d014ec64cf4b3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 10 Sep 2009 15:04:24 -0700 Subject: NV fp parser: Add support for condition codes Conditional write masks and the condition-code based KIL instruction are all supported. The specific behavior of KIL in the following shader may or may not match the behavior of other implementations: !!ARBfp1.0 TEMP GT; MOVC GT, fragment.texcoord[0]; KIL GT.x; END Should be it interpreted as 'KIL srcReg' or as 'KIL ccTest'? The current parser will interpret it as 'KIL srcReg'. --- src/mesa/shader/program_parse_extra.c | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'src/mesa/shader/program_parse_extra.c') diff --git a/src/mesa/shader/program_parse_extra.c b/src/mesa/shader/program_parse_extra.c index cb7b7a5fb2..0656c5eaa8 100644 --- a/src/mesa/shader/program_parse_extra.c +++ b/src/mesa/shader/program_parse_extra.c @@ -94,6 +94,60 @@ _mesa_parse_instruction_suffix(const struct asm_parser_state *state, } +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) { -- cgit v1.2.3