GLSL_TYPE_INTERFACE,
GLSL_TYPE_ARRAY,
GLSL_TYPE_VOID,
+ GLSL_TYPE_SUBROUTINE,
GLSL_TYPE_ERROR
};
static const glsl_type *get_function_instance(const struct glsl_type *return_type,
const glsl_function_param *parameters,
unsigned num_params);
+ /**
+ * Get the instance of an subroutine type
+ */
+ static const glsl_type *get_subroutine_instance(const char *subroutine_name);
/**
* Get the type resulting from a multiplication of \p type_a * \p type_b
/**
* Query if a type is unnamed/anonymous (named by the parser)
*/
+
+ bool is_subroutine() const
+ {
+ return base_type == GLSL_TYPE_SUBROUTINE;
+ }
+ bool contains_subroutine() const;
+
bool is_anonymous() const
{
return !strncmp(name, "#anon", 5);
/** Constructor for array types */
glsl_type(const glsl_type *array, unsigned length);
+ /** Constructor for subroutine types */
+ glsl_type(const char *name);
+
/** Hash table containing the known array types. */
static struct hash_table *array_types;
/** Hash table containing the known function types. */
static struct hash_table *function_types;
- static int record_key_compare(const void *a, const void *b);
+ /** Hash table containing the known subroutine types. */
+ static struct hash_table *subroutine_types;
+
+ static bool record_key_compare(const void *a, const void *b);
static unsigned record_key_hash(const void *key);
/**
*/
unsigned matrix_layout:2;
+ /**
+ * For interface blocks, 1 if this variable is a per-patch input or output
+ * (as in ir_variable::patch). 0 otherwise.
+ */
+ unsigned patch:1;
+
/**
* For interface blocks, it has a value if this variable uses multiple vertex
* streams (as in ir_variable::stream). -1 otherwise.
*/
int stream;
+
+#ifdef __cplusplus
+ glsl_struct_field(const struct glsl_type *_type, const char *_name)
+ : type(_type), name(_name), location(-1), interpolation(0), centroid(0),
+ sample(0), matrix_layout(GLSL_MATRIX_LAYOUT_INHERITED), patch(0),
+ stream(-1)
+ {
+ /* empty */
+ }
+
+ glsl_struct_field()
+ {
+ /* empty */
+ }
+#endif
};
struct glsl_function_param {