X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fglsl_types.h;h=92578ff47ac13bd06e9ab4bb0da3c6701fcfa0c3;hb=6305caea521fb2c7f82100db490f03d279185c43;hp=6b38e0999ccd746635889705916589037b1922a0;hpb=8a2508ee0726b349318c1e05122edbe5a545480a;p=mesa.git diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 6b38e0999cc..92578ff47ac 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -81,7 +81,7 @@ enum glsl_interface_packing { #ifdef __cplusplus #include "GL/gl.h" -#include "ralloc.h" +#include "util/ralloc.h" struct glsl_type { GLenum gl_type; @@ -180,7 +180,7 @@ struct glsl_type { /**@}*/ /** - * For numeric and boolean derrived types returns the basic scalar type + * For numeric and boolean derived types returns the basic scalar type * * If the type is a numeric or boolean scalar, vector, or matrix type, * this function gets the scalar type of the individual components. For @@ -255,6 +255,12 @@ struct glsl_type { */ unsigned component_slots() const; + /** + * Calculate the number of unique values from glGetUniformLocation for the + * elements of the type. + */ + unsigned uniform_locations() const; + /** * Calculate the number of attribute slots required to hold this type * @@ -314,7 +320,8 @@ struct glsl_type { * integers. * \endverbatim */ - bool can_implicitly_convert_to(const glsl_type *desired) const; + bool can_implicitly_convert_to(const glsl_type *desired, + _mesa_glsl_parse_state *state) const; /** * Query whether or not a type is a scalar (non-vector and non-matrix). @@ -403,6 +410,20 @@ struct glsl_type { */ gl_texture_index sampler_index() const; + /** + * Query whether or not type is an image, or for struct and array + * types, contains an image. + */ + bool contains_image() const; + + /** + * Query whether or not a type is an image + */ + bool is_image() const + { + return base_type == GLSL_TYPE_IMAGE; + } + /** * Query whether or not a type is an array */ @@ -443,6 +464,18 @@ struct glsl_type { return base_type == GLSL_TYPE_ERROR; } + /** + * Get the type stripped of any arrays + * + * \return + * Pointer to the type of elements of the first non-array type for array + * types, or pointer to itself for non-array types. + */ + const glsl_type *without_array() const + { + return this->is_array() ? this->fields.array : this; + } + /** * Return the amount of atomic counter storage required for a type. */ @@ -533,7 +566,8 @@ struct glsl_type { } /** - * Return the number of coordinate components needed for this sampler type. + * Return the number of coordinate components needed for this + * sampler or image type. * * This is based purely on the sampler's dimensionality. For example, this * returns 1 for sampler1D, and 3 for sampler2DArray. @@ -542,7 +576,7 @@ struct glsl_type { * a texturing built-in function, since those pack additional values (such * as the shadow comparitor or projector) into the coordinate type. */ - int sampler_coordinate_components() const; + int coordinate_components() const; /** * Compare a record type against another record type. @@ -649,6 +683,12 @@ struct glsl_struct_field { * in ir_variable::sample). 0 otherwise. */ unsigned sample:1; + + /** + * For interface blocks, it has a value if this variable uses multiple vertex + * streams (as in ir_variable::stream). -1 otherwise. + */ + int stream; }; static inline unsigned int