3 * Copyright © 2009 Intel Corporation
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
30 #include "glsl_parser_extras.h"
32 struct _mesa_glsl_parse_state
;
37 * \defgroup AST Abstract syntax tree node definitions
39 * An abstract syntax tree is generated by the parser. This is a fairly
40 * direct representation of the gramma derivation for the source program.
41 * No symantic checking is done during the generation of the AST. Only
42 * syntactic checking is done. Symantic checking is performed by a later
43 * stage that converts the AST to a more generic intermediate representation.
48 * Base class of all abstract syntax tree nodes
52 DECLARE_RALLOC_CXX_OPERATORS(ast_node
);
55 * Print an AST node in something approximating the original GLSL code
57 virtual void print(void) const;
60 * Convert the AST node to the high-level intermediate representation
62 virtual ir_rvalue
*hir(exec_list
*instructions
,
63 struct _mesa_glsl_parse_state
*state
);
65 virtual bool has_sequence_subexpression() const;
68 * Retrieve the source location of an AST node
70 * This function is primarily used to get the source position of an AST node
71 * into a form that can be passed to \c _mesa_glsl_error.
73 * \sa _mesa_glsl_error, ast_node::set_location
75 struct YYLTYPE
get_location(void) const
79 locp
.source
= this->location
.source
;
80 locp
.first_line
= this->location
.first_line
;
81 locp
.first_column
= this->location
.first_column
;
82 locp
.last_line
= this->location
.last_line
;
83 locp
.last_column
= this->location
.last_column
;
89 * Set the source location of an AST node from a parser location
91 * \sa ast_node::get_location
93 void set_location(const struct YYLTYPE
&locp
)
95 this->location
.source
= locp
.source
;
96 this->location
.first_line
= locp
.first_line
;
97 this->location
.first_column
= locp
.first_column
;
98 this->location
.last_line
= locp
.last_line
;
99 this->location
.last_column
= locp
.last_column
;
103 * Set the source location range of an AST node using two location nodes
105 * \sa ast_node::set_location
107 void set_location_range(const struct YYLTYPE
&begin
, const struct YYLTYPE
&end
)
109 this->location
.source
= begin
.source
;
110 this->location
.first_line
= begin
.first_line
;
111 this->location
.last_line
= end
.last_line
;
112 this->location
.first_column
= begin
.first_column
;
113 this->location
.last_column
= end
.last_column
;
117 * Source location of the AST node.
120 unsigned source
; /**< GLSL source number. */
121 unsigned first_line
; /**< First line number within the source string. */
122 unsigned first_column
; /**< First column in the first line. */
123 unsigned last_line
; /**< Last line number within the source string. */
124 unsigned last_column
; /**< Last column in the last line. */
131 * The only constructor is protected so that only derived class objects can
139 * Operators for AST expression nodes.
143 ast_plus
, /**< Unary + operator. */
186 ast_unsized_array_dim
,
202 * Representation of any sort of expression.
204 class ast_expression
: public ast_node
{
206 ast_expression(int oper
, ast_expression
*,
207 ast_expression
*, ast_expression
*);
209 ast_expression(const char *identifier
) :
212 subexpressions
[0] = NULL
;
213 subexpressions
[1] = NULL
;
214 subexpressions
[2] = NULL
;
215 primary_expression
.identifier
= identifier
;
216 this->non_lvalue_description
= NULL
;
219 static const char *operator_string(enum ast_operators op
);
221 virtual ir_rvalue
*hir(exec_list
*instructions
,
222 struct _mesa_glsl_parse_state
*state
);
224 virtual void hir_no_rvalue(exec_list
*instructions
,
225 struct _mesa_glsl_parse_state
*state
);
227 virtual bool has_sequence_subexpression() const;
229 ir_rvalue
*do_hir(exec_list
*instructions
,
230 struct _mesa_glsl_parse_state
*state
,
233 virtual void print(void) const;
235 enum ast_operators oper
;
237 ast_expression
*subexpressions
[3];
240 const char *identifier
;
242 float float_constant
;
243 unsigned uint_constant
;
245 double double_constant
;
246 } primary_expression
;
250 * List of expressions for an \c ast_sequence or parameters for an
251 * \c ast_function_call
253 exec_list expressions
;
256 * For things that can't be l-values, this describes what it is.
258 * This text is used by the code that generates IR for assignments to
259 * detect and emit useful messages for assignments to some things that
260 * can't be l-values. For example, pre- or post-incerement expressions.
263 * This pointer may be \c NULL.
265 const char *non_lvalue_description
;
268 class ast_expression_bin
: public ast_expression
{
270 ast_expression_bin(int oper
, ast_expression
*, ast_expression
*);
272 virtual void print(void) const;
276 * Subclass of expressions for function calls
278 class ast_function_expression
: public ast_expression
{
280 ast_function_expression(ast_expression
*callee
)
281 : ast_expression(ast_function_call
, callee
,
288 ast_function_expression(class ast_type_specifier
*type
)
289 : ast_expression(ast_function_call
, (ast_expression
*) type
,
296 bool is_constructor() const
301 virtual ir_rvalue
*hir(exec_list
*instructions
,
302 struct _mesa_glsl_parse_state
*state
);
304 virtual void hir_no_rvalue(exec_list
*instructions
,
305 struct _mesa_glsl_parse_state
*state
);
307 virtual bool has_sequence_subexpression() const;
311 * Is this function call actually a constructor?
315 handle_method(exec_list
*instructions
,
316 struct _mesa_glsl_parse_state
*state
);
319 class ast_subroutine_list
: public ast_node
322 virtual void print(void) const;
323 exec_list declarations
;
326 class ast_array_specifier
: public ast_node
{
328 ast_array_specifier(const struct YYLTYPE
&locp
, ast_expression
*dim
)
331 array_dimensions
.push_tail(&dim
->link
);
334 void add_dimension(ast_expression
*dim
)
336 array_dimensions
.push_tail(&dim
->link
);
339 bool is_single_dimension() const
341 return this->array_dimensions
.tail_pred
->prev
!= NULL
&&
342 this->array_dimensions
.tail_pred
->prev
->is_head_sentinel();
345 virtual void print(void) const;
347 /* This list contains objects of type ast_node containing the
348 * array dimensions in outermost-to-innermost order.
350 exec_list array_dimensions
;
353 class ast_layout_expression
: public ast_node
{
355 ast_layout_expression(const struct YYLTYPE
&locp
, ast_expression
*expr
)
358 layout_const_expressions
.push_tail(&expr
->link
);
361 bool process_qualifier_constant(struct _mesa_glsl_parse_state
*state
,
362 const char *qual_indentifier
,
363 unsigned *value
, bool can_be_zero
);
365 void merge_qualifier(ast_layout_expression
*l_expr
)
367 layout_const_expressions
.append_list(&l_expr
->layout_const_expressions
);
370 exec_list layout_const_expressions
;
374 * C-style aggregate initialization class
376 * Represents C-style initializers of vectors, matrices, arrays, and
377 * structures. E.g., vec3 pos = {1.0, 0.0, -1.0} is equivalent to
378 * vec3 pos = vec3(1.0, 0.0, -1.0).
380 * Specified in GLSL 4.20 and GL_ARB_shading_language_420pack.
382 * \sa _mesa_ast_set_aggregate_type
384 class ast_aggregate_initializer
: public ast_expression
{
386 ast_aggregate_initializer()
387 : ast_expression(ast_aggregate
, NULL
, NULL
, NULL
),
388 constructor_type(NULL
)
394 * glsl_type of the aggregate, which is inferred from the LHS of whatever
395 * the aggregate is being used to initialize. This can't be inferred at
396 * parse time (since the parser deals with ast_type_specifiers, not
397 * glsl_types), so the parser leaves it NULL. However, the ast-to-hir
398 * conversion code makes sure to fill it in with the appropriate type
399 * before hir() is called.
401 const glsl_type
*constructor_type
;
403 virtual ir_rvalue
*hir(exec_list
*instructions
,
404 struct _mesa_glsl_parse_state
*state
);
406 virtual void hir_no_rvalue(exec_list
*instructions
,
407 struct _mesa_glsl_parse_state
*state
);
411 * Number of possible operators for an ast_expression
413 * This is done as a define instead of as an additional value in the enum so
414 * that the compiler won't generate spurious messages like "warning:
415 * enumeration value ‘ast_num_operators’ not handled in switch"
417 #define AST_NUM_OPERATORS (ast_sequence + 1)
420 class ast_compound_statement
: public ast_node
{
422 ast_compound_statement(int new_scope
, ast_node
*statements
);
423 virtual void print(void) const;
425 virtual ir_rvalue
*hir(exec_list
*instructions
,
426 struct _mesa_glsl_parse_state
*state
);
429 exec_list statements
;
432 class ast_declaration
: public ast_node
{
434 ast_declaration(const char *identifier
,
435 ast_array_specifier
*array_specifier
,
436 ast_expression
*initializer
);
437 virtual void print(void) const;
439 const char *identifier
;
441 ast_array_specifier
*array_specifier
;
443 ast_expression
*initializer
;
448 ast_precision_none
= 0, /**< Absence of precision qualifier. */
450 ast_precision_medium
,
454 struct ast_type_qualifier
{
455 DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier
);
459 unsigned invariant
:1;
462 unsigned attribute
:1;
471 unsigned shared_storage
:1;
474 unsigned noperspective
:1;
476 /** \name Layout qualifiers for GL_ARB_fragment_coord_conventions */
478 unsigned origin_upper_left
:1;
479 unsigned pixel_center_integer
:1;
483 * Flag set if GL_ARB_explicit_attrib_location "location" layout
486 unsigned explicit_location
:1;
488 * Flag set if GL_ARB_explicit_attrib_location "index" layout
491 unsigned explicit_index
:1;
494 * Flag set if GL_ARB_shading_language_420pack "binding" layout
497 unsigned explicit_binding
:1;
500 * Flag set if GL_ARB_shader_atomic counter "offset" layout
503 unsigned explicit_offset
:1;
505 /** \name Layout qualifiers for GL_AMD_conservative_depth */
507 unsigned depth_any
:1;
508 unsigned depth_greater
:1;
509 unsigned depth_less
:1;
510 unsigned depth_unchanged
:1;
513 /** \name Layout qualifiers for GL_ARB_uniform_buffer_object */
519 unsigned column_major
:1;
520 unsigned row_major
:1;
523 /** \name Layout qualifiers for GLSL 1.50 geometry shaders */
525 unsigned prim_type
:1;
526 unsigned max_vertices
:1;
530 * local_size_{x,y,z} flags for compute shaders. Bit 0 represents
531 * local_size_x, and so on.
533 unsigned local_size
:3;
535 /** \name Layout and memory qualifiers for ARB_shader_image_load_store. */
537 unsigned early_fragment_tests
:1;
538 unsigned explicit_image_format
:1;
540 unsigned _volatile
:1;
541 unsigned restrict_flag
:1;
542 unsigned read_only
:1; /**< "readonly" qualifier. */
543 unsigned write_only
:1; /**< "writeonly" qualifier. */
546 /** \name Layout qualifiers for GL_ARB_gpu_shader5 */
548 unsigned invocations
:1;
549 unsigned stream
:1; /**< Has stream value assigned */
550 unsigned explicit_stream
:1; /**< stream value assigned explicitly by shader code */
553 /** \name Layout qualifiers for GL_ARB_tessellation_shader */
555 /* tess eval input layout */
556 /* gs prim_type reused for primitive mode */
557 unsigned vertex_spacing
:1;
559 unsigned point_mode
:1;
560 /* tess control output layout */
564 /** \name Qualifiers for GL_ARB_shader_subroutine */
566 unsigned subroutine
:1; /**< Is this marked 'subroutine' */
567 unsigned subroutine_def
:1; /**< Is this marked 'subroutine' with a list of types */
570 /** \brief Set of flags, accessed by name. */
573 /** \brief Set of flags, accessed as a bitmask. */
577 /** Precision of the type (highp/medium/lowp). */
578 unsigned precision
:2;
580 /** Geometry shader invocations for GL_ARB_gpu_shader5. */
581 ast_layout_expression
*invocations
;
584 * Location specified via GL_ARB_explicit_attrib_location layout
587 * This field is only valid if \c explicit_location is set.
589 ast_expression
*location
;
591 * Index specified via GL_ARB_explicit_attrib_location layout
594 * This field is only valid if \c explicit_index is set.
596 ast_expression
*index
;
598 /** Maximum output vertices in GLSL 1.50 geometry shaders. */
599 ast_layout_expression
*max_vertices
;
601 /** Stream in GLSL 1.50 geometry shaders. */
602 ast_expression
*stream
;
605 * Input or output primitive type in GLSL 1.50 geometry shaders
606 * and tessellation shaders.
611 * Binding specified via GL_ARB_shading_language_420pack's "binding" keyword.
614 * This field is only valid if \c explicit_binding is set.
616 ast_expression
*binding
;
619 * Offset specified via GL_ARB_shader_atomic_counter's "offset"
623 * This field is only valid if \c explicit_offset is set.
625 ast_expression
*offset
;
628 * Local size specified via GL_ARB_compute_shader's "local_size_{x,y,z}"
629 * layout qualifier. Element i of this array is only valid if
630 * flags.q.local_size & (1 << i) is set.
632 ast_layout_expression
*local_size
[3];
634 /** Tessellation evaluation shader: vertex spacing (equal, fractional even/odd) */
635 GLenum vertex_spacing
;
637 /** Tessellation evaluation shader: vertex ordering (CW or CCW) */
640 /** Tessellation evaluation shader: point mode */
643 /** Tessellation control shader: number of output vertices */
644 ast_layout_expression
*vertices
;
647 * Image format specified with an ARB_shader_image_load_store
651 * This field is only valid if \c explicit_image_format is set.
656 * Base type of the data read from or written to this image. Only
657 * the following enumerants are allowed: GLSL_TYPE_UINT,
658 * GLSL_TYPE_INT, GLSL_TYPE_FLOAT.
661 * This field is only valid if \c explicit_image_format is set.
663 glsl_base_type image_base_type
;
665 /** Flag to know if this represents a default value for a qualifier */
666 bool is_default_qualifier
;
669 * Return true if and only if an interpolation qualifier is present.
671 bool has_interpolation() const;
674 * Return whether a layout qualifier is present.
676 bool has_layout() const;
679 * Return whether a storage qualifier is present.
681 bool has_storage() const;
684 * Return whether an auxiliary storage qualifier is present.
686 bool has_auxiliary_storage() const;
689 * \brief Return string representation of interpolation qualifier.
691 * If an interpolation qualifier is present, then return that qualifier's
692 * string representation. Otherwise, return null. For example, if the
693 * noperspective bit is set, then this returns "noperspective".
695 * If multiple interpolation qualifiers are somehow present, then the
696 * returned string is undefined but not null.
698 const char *interpolation_string() const;
700 bool merge_qualifier(YYLTYPE
*loc
,
701 _mesa_glsl_parse_state
*state
,
702 ast_type_qualifier q
);
704 bool merge_out_qualifier(YYLTYPE
*loc
,
705 _mesa_glsl_parse_state
*state
,
706 ast_type_qualifier q
,
709 bool merge_in_qualifier(YYLTYPE
*loc
,
710 _mesa_glsl_parse_state
*state
,
711 ast_type_qualifier q
,
714 ast_subroutine_list
*subroutine_list
;
717 class ast_declarator_list
;
719 class ast_struct_specifier
: public ast_node
{
721 ast_struct_specifier(const char *identifier
,
722 ast_declarator_list
*declarator_list
);
723 virtual void print(void) const;
725 virtual ir_rvalue
*hir(exec_list
*instructions
,
726 struct _mesa_glsl_parse_state
*state
);
729 /* List of ast_declarator_list * */
730 exec_list declarations
;
736 class ast_type_specifier
: public ast_node
{
738 /** Construct a type specifier from a type name */
739 ast_type_specifier(const char *name
)
740 : type_name(name
), structure(NULL
), array_specifier(NULL
),
741 default_precision(ast_precision_none
)
746 /** Construct a type specifier from a structure definition */
747 ast_type_specifier(ast_struct_specifier
*s
)
748 : type_name(s
->name
), structure(s
), array_specifier(NULL
),
749 default_precision(ast_precision_none
)
754 const struct glsl_type
*glsl_type(const char **name
,
755 struct _mesa_glsl_parse_state
*state
)
758 virtual void print(void) const;
760 ir_rvalue
*hir(exec_list
*, struct _mesa_glsl_parse_state
*);
762 const char *type_name
;
763 ast_struct_specifier
*structure
;
765 ast_array_specifier
*array_specifier
;
767 /** For precision statements, this is the given precision; otherwise none. */
768 unsigned default_precision
:2;
772 class ast_fully_specified_type
: public ast_node
{
774 virtual void print(void) const;
775 bool has_qualifiers(_mesa_glsl_parse_state
*state
) const;
777 ast_fully_specified_type() : qualifier(), specifier(NULL
)
781 const struct glsl_type
*glsl_type(const char **name
,
782 struct _mesa_glsl_parse_state
*state
)
785 ast_type_qualifier qualifier
;
786 ast_type_specifier
*specifier
;
790 class ast_declarator_list
: public ast_node
{
792 ast_declarator_list(ast_fully_specified_type
*);
793 virtual void print(void) const;
795 virtual ir_rvalue
*hir(exec_list
*instructions
,
796 struct _mesa_glsl_parse_state
*state
);
798 ast_fully_specified_type
*type
;
799 /** List of 'ast_declaration *' */
800 exec_list declarations
;
803 * Flags for redeclarations. In these cases, no type is specified, to
804 * `type` is allowed to be NULL. In all other cases, this would be an error.
806 int invariant
; /** < `invariant` redeclaration */
807 int precise
; /** < `precise` redeclaration */
811 class ast_parameter_declarator
: public ast_node
{
813 ast_parameter_declarator() :
816 array_specifier(NULL
),
817 formal_parameter(false),
823 virtual void print(void) const;
825 virtual ir_rvalue
*hir(exec_list
*instructions
,
826 struct _mesa_glsl_parse_state
*state
);
828 ast_fully_specified_type
*type
;
829 const char *identifier
;
830 ast_array_specifier
*array_specifier
;
832 static void parameters_to_hir(exec_list
*ast_parameters
,
833 bool formal
, exec_list
*ir_parameters
,
834 struct _mesa_glsl_parse_state
*state
);
837 /** Is this parameter declaration part of a formal parameter list? */
838 bool formal_parameter
;
841 * Is this parameter 'void' type?
843 * This field is set by \c ::hir.
849 class ast_function
: public ast_node
{
853 virtual void print(void) const;
855 virtual ir_rvalue
*hir(exec_list
*instructions
,
856 struct _mesa_glsl_parse_state
*state
);
858 ast_fully_specified_type
*return_type
;
859 const char *identifier
;
861 exec_list parameters
;
865 * Is this prototype part of the function definition?
867 * Used by ast_function_definition::hir to process the parameters, etc.
875 * Function signature corresponding to this function prototype instance
877 * Used by ast_function_definition::hir to process the parameters, etc.
882 class ir_function_signature
*signature
;
884 friend class ast_function_definition
;
888 class ast_expression_statement
: public ast_node
{
890 ast_expression_statement(ast_expression
*);
891 virtual void print(void) const;
893 virtual ir_rvalue
*hir(exec_list
*instructions
,
894 struct _mesa_glsl_parse_state
*state
);
896 ast_expression
*expression
;
900 class ast_case_label
: public ast_node
{
902 ast_case_label(ast_expression
*test_value
);
903 virtual void print(void) const;
905 virtual ir_rvalue
*hir(exec_list
*instructions
,
906 struct _mesa_glsl_parse_state
*state
);
909 * An test value of NULL means 'default'.
911 ast_expression
*test_value
;
915 class ast_case_label_list
: public ast_node
{
917 ast_case_label_list(void);
918 virtual void print(void) const;
920 virtual ir_rvalue
*hir(exec_list
*instructions
,
921 struct _mesa_glsl_parse_state
*state
);
924 * A list of case labels.
930 class ast_case_statement
: public ast_node
{
932 ast_case_statement(ast_case_label_list
*labels
);
933 virtual void print(void) const;
935 virtual ir_rvalue
*hir(exec_list
*instructions
,
936 struct _mesa_glsl_parse_state
*state
);
938 ast_case_label_list
*labels
;
941 * A list of statements.
947 class ast_case_statement_list
: public ast_node
{
949 ast_case_statement_list(void);
950 virtual void print(void) const;
952 virtual ir_rvalue
*hir(exec_list
*instructions
,
953 struct _mesa_glsl_parse_state
*state
);
962 class ast_switch_body
: public ast_node
{
964 ast_switch_body(ast_case_statement_list
*stmts
);
965 virtual void print(void) const;
967 virtual ir_rvalue
*hir(exec_list
*instructions
,
968 struct _mesa_glsl_parse_state
*state
);
970 ast_case_statement_list
*stmts
;
974 class ast_selection_statement
: public ast_node
{
976 ast_selection_statement(ast_expression
*condition
,
977 ast_node
*then_statement
,
978 ast_node
*else_statement
);
979 virtual void print(void) const;
981 virtual ir_rvalue
*hir(exec_list
*instructions
,
982 struct _mesa_glsl_parse_state
*state
);
984 ast_expression
*condition
;
985 ast_node
*then_statement
;
986 ast_node
*else_statement
;
990 class ast_switch_statement
: public ast_node
{
992 ast_switch_statement(ast_expression
*test_expression
,
994 virtual void print(void) const;
996 virtual ir_rvalue
*hir(exec_list
*instructions
,
997 struct _mesa_glsl_parse_state
*state
);
999 ast_expression
*test_expression
;
1003 void test_to_hir(exec_list
*, struct _mesa_glsl_parse_state
*);
1006 class ast_iteration_statement
: public ast_node
{
1008 ast_iteration_statement(int mode
, ast_node
*init
, ast_node
*condition
,
1009 ast_expression
*rest_expression
, ast_node
*body
);
1011 virtual void print(void) const;
1013 virtual ir_rvalue
*hir(exec_list
*, struct _mesa_glsl_parse_state
*);
1015 enum ast_iteration_modes
{
1022 ast_node
*init_statement
;
1023 ast_node
*condition
;
1024 ast_expression
*rest_expression
;
1029 * Generate IR from the condition of a loop
1031 * This is factored out of ::hir because some loops have the condition
1032 * test at the top (for and while), and others have it at the end (do-while).
1034 void condition_to_hir(exec_list
*, struct _mesa_glsl_parse_state
*);
1038 class ast_jump_statement
: public ast_node
{
1040 ast_jump_statement(int mode
, ast_expression
*return_value
);
1041 virtual void print(void) const;
1043 virtual ir_rvalue
*hir(exec_list
*instructions
,
1044 struct _mesa_glsl_parse_state
*state
);
1046 enum ast_jump_modes
{
1053 ast_expression
*opt_return_value
;
1057 class ast_function_definition
: public ast_node
{
1059 ast_function_definition() : prototype(NULL
), body(NULL
)
1063 virtual void print(void) const;
1065 virtual ir_rvalue
*hir(exec_list
*instructions
,
1066 struct _mesa_glsl_parse_state
*state
);
1068 ast_function
*prototype
;
1069 ast_compound_statement
*body
;
1072 class ast_interface_block
: public ast_node
{
1074 ast_interface_block(ast_type_qualifier layout
,
1075 const char *instance_name
,
1076 ast_array_specifier
*array_specifier
)
1077 : layout(layout
), block_name(NULL
), instance_name(instance_name
),
1078 array_specifier(array_specifier
)
1082 virtual ir_rvalue
*hir(exec_list
*instructions
,
1083 struct _mesa_glsl_parse_state
*state
);
1085 ast_type_qualifier layout
;
1086 const char *block_name
;
1089 * Declared name of the block instance, if specified.
1091 * If the block does not have an instance name, this field will be
1094 const char *instance_name
;
1096 /** List of ast_declarator_list * */
1097 exec_list declarations
;
1100 * Declared array size of the block instance
1102 * If the block is not declared as an array or if the block instance array
1103 * is unsized, this field will be \c NULL.
1105 ast_array_specifier
*array_specifier
;
1110 * AST node representing a declaration of the output layout for tessellation
1113 class ast_tcs_output_layout
: public ast_node
1116 ast_tcs_output_layout(const struct YYLTYPE
&locp
)
1121 virtual ir_rvalue
*hir(exec_list
*instructions
,
1122 struct _mesa_glsl_parse_state
*state
);
1127 * AST node representing a declaration of the input layout for geometry
1130 class ast_gs_input_layout
: public ast_node
1133 ast_gs_input_layout(const struct YYLTYPE
&locp
, GLenum prim_type
)
1134 : prim_type(prim_type
)
1139 virtual ir_rvalue
*hir(exec_list
*instructions
,
1140 struct _mesa_glsl_parse_state
*state
);
1143 const GLenum prim_type
;
1148 * AST node representing a decalaration of the input layout for compute
1151 class ast_cs_input_layout
: public ast_node
1154 ast_cs_input_layout(const struct YYLTYPE
&locp
,
1155 ast_layout_expression
**local_size
)
1157 for (int i
= 0; i
< 3; i
++) {
1158 this->local_size
[i
] = local_size
[i
];
1163 virtual ir_rvalue
*hir(exec_list
*instructions
,
1164 struct _mesa_glsl_parse_state
*state
);
1167 ast_layout_expression
*local_size
[3];
1173 _mesa_ast_to_hir(exec_list
*instructions
, struct _mesa_glsl_parse_state
*state
);
1176 _mesa_ast_field_selection_to_hir(const ast_expression
*expr
,
1177 exec_list
*instructions
,
1178 struct _mesa_glsl_parse_state
*state
);
1181 _mesa_ast_array_index_to_hir(void *mem_ctx
,
1182 struct _mesa_glsl_parse_state
*state
,
1183 ir_rvalue
*array
, ir_rvalue
*idx
,
1184 YYLTYPE
&loc
, YYLTYPE
&idx_loc
);
1187 _mesa_ast_set_aggregate_type(const glsl_type
*type
,
1188 ast_expression
*expr
);
1191 emit_function(_mesa_glsl_parse_state
*state
, ir_function
*f
);
1194 check_builtin_array_max_size(const char *name
, unsigned size
,
1195 YYLTYPE loc
, struct _mesa_glsl_parse_state
*state
);
1197 extern void _mesa_ast_process_interface_block(YYLTYPE
*locp
,
1198 _mesa_glsl_parse_state
*state
,
1199 ast_interface_block
*const block
,
1200 const struct ast_type_qualifier q
);