summaryrefslogtreecommitdiffstats
path: root/src/glsl/glsl_parser_extras.h
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2015-06-01 10:55:47 +1000
committerDave Airlie <[email protected]>2015-07-23 17:25:35 +1000
commit65ac360823ee12ac2d1f3bb6758d352fcd0d9210 (patch)
treede2edd21bf0689d01de91985add95b77663a1955 /src/glsl/glsl_parser_extras.h
parent884df9ef834d6b77226d0dfd778c5317365a2394 (diff)
glsl: add ast/parser support for subroutine parsing storage (v3.2)
This is the guts of the GLSL parser and AST support for shader subroutines. The code creates a subroutine type in the parser, and uses that there to validate the identifiers. The parser also distinguishes between subroutine types/function prototypes /uniforms and subroutine defintions for functions. Then in the AST conversion it recreates the types, and stores the subroutine definition info or subroutine info into the ir_function along with a side lookup table in the parser state. It also converts subroutine calls into the enhanced ir_call. v2: move to handling method calls in function handling not in field selection. v3: merge Chris's previous parser patches in here, to make it clearer what's changed in one place. v3.1: add more documentation, drop unused include v3.2: drop is_subroutine_def Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser_extras.h')
-rw-r--r--src/glsl/glsl_parser_extras.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 564820183f5..b65d53db641 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -589,6 +589,25 @@ struct _mesa_glsl_parse_state {
unsigned atomic_counter_offsets[MAX_COMBINED_ATOMIC_BUFFERS];
bool allow_extension_directive_midshader;
+
+ /**
+ * Known subroutine type declarations.
+ */
+ int num_subroutine_types;
+ ir_function **subroutine_types;
+
+ /**
+ * Functions that are associated with
+ * subroutine types.
+ */
+ int num_subroutines;
+ ir_function **subroutines;
+
+ /**
+ * field selection temporary parser storage -
+ * did the parser just parse a dot.
+ */
+ bool is_field;
};
# define YYLLOC_DEFAULT(Current, Rhs, N) \