Note the member index in struct deref, so we don't have to calculate it again.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 15 Mar 2011 01:39:41 -0700
changeset 1009 ba0ed22a4bac
parent 1008 9cbe3e4bfba5
child 1010 bbfed6061a2e
Note the member index in struct deref, so we don't have to calculate it again.
mojoshader.h
mojoshader_compiler.c
--- a/mojoshader.h	Tue Mar 15 01:38:05 2011 -0700
+++ b/mojoshader.h	Tue Mar 15 01:39:41 2011 -0700
@@ -1288,6 +1288,7 @@
     MOJOSHADER_astExpression *identifier;
     const char *member;
     int isswizzle;  /* Always 1 or 0. Never set by parseAst()! */
+    int member_index;  /* Never set by parseAst()! */
 } MOJOSHADER_astExpressionDerefStruct;
 
 typedef struct MOJOSHADER_astExpressionCallFunction
--- a/mojoshader_compiler.c	Tue Mar 15 01:38:05 2011 -0700
+++ b/mojoshader_compiler.c	Tue Mar 15 01:39:41 2011 -0700
@@ -677,6 +677,7 @@
     retval->identifier = identifier;
     retval->member = member;  // cached; don't copy string.
     retval->isswizzle = 0;  // may change during semantic analysis.
+    retval->member_index = 0;  // set during semantic analysis.
     return (MOJOSHADER_astExpression *) retval;
 } // new_deref_struct_expr
 
@@ -2659,6 +2660,7 @@
                 if (strcmp(mbrs[i].identifier, member) == 0)
                 {
                     ast->derefstruct.datatype = mbrs[i].datatype;
+                    ast->derefstruct.member_index = i;
                     break;
                 } // if
             } // for