Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / shader / slang / slang_typeinfo.h
index ad5aa3e195e7e6a2b878ad01c20dd75163e170b9..e6fecd350af05b2766ea5d302b15bf7f8fddede7 100644 (file)
@@ -25,8 +25,8 @@
 #ifndef SLANG_TYPEINFO_H
 #define SLANG_TYPEINFO_H 1
 
-#include "imports.h"
-#include "mtypes.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
 #include "slang_log.h"
 #include "slang_utility.h"
 #include "slang_vartable.h"
@@ -34,6 +34,9 @@
 
 struct slang_operation_;
 
+struct slang_name_space_;
+
+
 
 /**
  * Holds complete information about vector swizzle - the <swizzle>
@@ -47,45 +50,45 @@ typedef struct slang_swizzle_
    GLuint swizzle[4];
 } slang_swizzle;
 
-typedef struct slang_name_space_
-{
-   struct slang_function_scope_ *funcs;
-   struct slang_struct_scope_ *structs;
-   struct slang_variable_scope_ *vars;
-} slang_name_space;
+extern GLboolean
+_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz);
 
 
-typedef struct slang_assemble_ctx_
+typedef enum slang_type_variant_
 {
-   slang_atom_pool *atoms;
-   slang_name_space space;
-   struct gl_program *program;
-   slang_var_table *vartable;
-   slang_info_log *log;
-   struct slang_label_ *curFuncEndLabel;
-   struct slang_ir_node_ *CurLoop;
-   struct slang_function_ *CurFunction;
-   GLuint numSamplers;
-} slang_assemble_ctx;
-
-
-extern struct slang_function_ *
-_slang_locate_function(const struct slang_function_scope_ *funcs,
-                       slang_atom name, struct slang_operation_ *params,
-                       GLuint num_params,
-                       const slang_name_space *space,
-                       slang_atom_pool *atoms, slang_info_log *log);
+   SLANG_VARIANT,    /* the default */
+   SLANG_INVARIANT   /* indicates the "invariant" keyword */
+} slang_type_variant;
 
 
-extern GLboolean
-_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz);
+typedef enum slang_type_centroid_
+{
+   SLANG_CENTER,    /* the default */
+   SLANG_CENTROID   /* indicates the "centroid" keyword */
+} slang_type_centroid;
 
-extern GLboolean
-_slang_is_swizzle_mask(const slang_swizzle *swz, GLuint rows);
 
-extern GLvoid
-_slang_multiply_swizzles(slang_swizzle *, const slang_swizzle *,
-                         const slang_swizzle *);
+typedef enum slang_type_qualifier_
+{
+   SLANG_QUAL_NONE,
+   SLANG_QUAL_CONST,
+   SLANG_QUAL_ATTRIBUTE,
+   SLANG_QUAL_VARYING,
+   SLANG_QUAL_UNIFORM,
+   SLANG_QUAL_OUT,
+   SLANG_QUAL_INOUT,
+   SLANG_QUAL_FIXEDOUTPUT,      /* internal */
+   SLANG_QUAL_FIXEDINPUT        /* internal */
+} slang_type_qualifier;
+
+
+typedef enum slang_type_precision_
+{
+   SLANG_PREC_DEFAULT,
+   SLANG_PREC_LOW,
+   SLANG_PREC_MEDIUM,
+   SLANG_PREC_HIGH
+} slang_type_precision;
 
 
 /**
@@ -128,14 +131,21 @@ typedef enum slang_type_specifier_type_
 } slang_type_specifier_type;
 
 
+extern slang_type_specifier_type
+slang_type_specifier_type_from_string(const char *);
+
+extern const char *
+slang_type_specifier_type_to_string(slang_type_specifier_type);
+
+
 /**
  * Describes more sophisticated types, like structs and arrays.
  */
 typedef struct slang_type_specifier_
 {
    slang_type_specifier_type type;
-   struct slang_struct_ *_struct;         /**< used if type == spec_struct */
-   struct slang_type_specifier_ *_array;  /**< used if type == spec_array */
+   struct slang_struct_ *_struct;         /**< if type == SLANG_SPEC_STRUCT */
+   struct slang_type_specifier_ *_array;  /**< if type == SLANG_SPEC_ARRAY */
 } slang_type_specifier;
 
 
@@ -145,6 +155,12 @@ slang_type_specifier_ctr(slang_type_specifier *);
 extern GLvoid
 slang_type_specifier_dtr(slang_type_specifier *);
 
+extern slang_type_specifier *
+slang_type_specifier_new(slang_type_specifier_type type,
+                         struct slang_struct_ *_struct,
+                         struct slang_type_specifier_ *_array);
+
+
 extern GLboolean
 slang_type_specifier_copy(slang_type_specifier *, const slang_type_specifier *);
 
@@ -153,6 +169,33 @@ slang_type_specifier_equal(const slang_type_specifier *,
                            const slang_type_specifier *);
 
 
+extern GLboolean
+slang_type_specifier_compatible(const slang_type_specifier * x,
+                                const slang_type_specifier * y);
+
+
+typedef struct slang_fully_specified_type_
+{
+   slang_type_qualifier qualifier;
+   slang_type_specifier specifier;
+   slang_type_precision precision;
+   slang_type_variant variant;
+   slang_type_centroid centroid;
+   GLint array_len;           /**< -1 if not an array type */
+} slang_fully_specified_type;
+
+extern int
+slang_fully_specified_type_construct(slang_fully_specified_type *);
+
+extern void
+slang_fully_specified_type_destruct(slang_fully_specified_type *);
+
+extern int
+slang_fully_specified_type_copy(slang_fully_specified_type *,
+                               const slang_fully_specified_type *);
+
+
+
 typedef struct slang_typeinfo_
 {
    GLboolean can_be_referenced;
@@ -169,19 +212,9 @@ extern GLvoid
 slang_typeinfo_destruct(slang_typeinfo *);
 
 
-/**
- * Retrieves type information about an operation.
- * Returns GL_TRUE on success.
- * Returns GL_FALSE otherwise.
- */
-extern GLboolean
-_slang_typeof_operation(const slang_assemble_ctx *,
-                        struct slang_operation_ *,
-                        slang_typeinfo *);
-
 extern GLboolean
-_slang_typeof_operation_(struct slang_operation_ *,
-                         const slang_name_space *,
+_slang_typeof_operation(struct slang_operation_ *,
+                         const struct slang_name_space_ *,
                          slang_typeinfo *, slang_atom_pool *,
                          slang_info_log *log);
 
@@ -191,6 +224,9 @@ _slang_type_is_matrix(slang_type_specifier_type);
 extern GLboolean
 _slang_type_is_vector(slang_type_specifier_type);
 
+extern GLboolean
+_slang_type_is_float_vec_mat(slang_type_specifier_type);
+
 extern slang_type_specifier_type
 _slang_type_base(slang_type_specifier_type);