X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fir.h;h=7b83c2836ee92e257dbfc703e1c060a39985d437;hb=e0c4a59dc6c415c2abf6e0c5e3aaf5aee781cdf1;hp=960cd8bab433a45378fe99ced85848bc1778e408;hpb=8e498050dc1a1285c2218fdf4ea506c1cdcd9dd8;p=mesa.git diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 960cd8bab43..7b83c2836ee 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -33,6 +33,7 @@ extern "C" { #include } +#include "glsl_types.h" #include "list.h" #include "ir_visitor.h" #include "ir_hierarchical_visitor.h" @@ -121,6 +122,7 @@ public: virtual class ir_if * as_if() { return NULL; } virtual class ir_swizzle * as_swizzle() { return NULL; } virtual class ir_constant * as_constant() { return NULL; } + virtual class ir_discard * as_discard() { return NULL; } /*@}*/ protected: @@ -143,6 +145,8 @@ public: return this; } + ir_rvalue *as_rvalue_to_saturate(); + virtual bool is_lvalue() { return false; @@ -221,6 +225,7 @@ enum ir_variable_mode { ir_var_in, ir_var_out, ir_var_inout, + ir_var_system_value, /**< Ex: front-face, instance-id, etc. */ ir_var_temporary /**< Temporary variable generated during compilation. */ }; @@ -290,6 +295,15 @@ public: unsigned centroid:1; unsigned invariant:1; + /** + * Has this variable been used for reading or writing? + * + * Several GLSL semantic checks require knowledge of whether or not a + * variable has been used. For example, it is an error to redeclare a + * variable as invariant after it has been used. + */ + unsigned used:1; + /** * Storage class of the variable. * @@ -372,6 +386,8 @@ public: virtual ir_function_signature *clone(void *mem_ctx, struct hash_table *ht) const; + ir_function_signature *clone_prototype(void *mem_ctx, + struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -824,6 +840,8 @@ enum ir_expression_operation { */ ir_last_binop = ir_binop_pow, + ir_quadop_vector, + /** * A sentinel marking the last of all operations. */ @@ -832,8 +850,24 @@ enum ir_expression_operation { class ir_expression : public ir_rvalue { public: + /** + * Constructor for unary operation expressions + */ + ir_expression(int op, const struct glsl_type *type, ir_rvalue *); + ir_expression(int op, ir_rvalue *); + + /** + * Constructor for binary operation expressions + */ ir_expression(int op, const struct glsl_type *type, ir_rvalue *, ir_rvalue *); + ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1); + + /** + * Constructor for quad operator expressions + */ + ir_expression(int op, const struct glsl_type *type, + ir_rvalue *, ir_rvalue *, ir_rvalue *, ir_rvalue *); virtual ir_expression *as_expression() { @@ -860,7 +894,8 @@ public: */ unsigned int get_num_operands() const { - return get_num_operands(operation); + return (this->operation == ir_quadop_vector) + ? this->type->vector_elements : get_num_operands(operation); } /** @@ -887,7 +922,7 @@ public: virtual ir_visitor_status accept(ir_hierarchical_visitor *); ir_expression_operation operation; - ir_rvalue *operands[2]; + ir_rvalue *operands[4]; }; @@ -1102,6 +1137,11 @@ public: virtual ir_visitor_status accept(ir_hierarchical_visitor *); + virtual ir_discard *as_discard() + { + return this; + } + ir_rvalue *condition; }; /*@}*/ @@ -1552,8 +1592,7 @@ _mesa_glsl_initialize_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state); extern void -_mesa_glsl_initialize_functions(exec_list *instructions, - struct _mesa_glsl_parse_state *state); +_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state); extern void _mesa_glsl_release_functions(void);