summaryrefslogtreecommitdiff
path: root/src/mesa/shader/program_parse_extra.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-09-10 15:04:24 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-09-10 15:04:24 -0700
commit81722c5d7e8e93d837510b9e6e5d014ec64cf4b3 (patch)
tree354cdf68d823182ce0c313c13b58ac3964eb2db6 /src/mesa/shader/program_parse_extra.c
parentcdb719399438194c5e9d5bc1bae3458398fe4e54 (diff)
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'.
Diffstat (limited to 'src/mesa/shader/program_parse_extra.c')
-rw-r--r--src/mesa/shader/program_parse_extra.c54
1 files changed, 54 insertions, 0 deletions
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
@@ -95,6 +95,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)
{
if (strcmp(option, "ARB_position_invariant") == 0) {