freedreno/ir3: split out legalize pass
[mesa.git] / src / glsl / ir_uniform.h
index 13faab7c0a14d460b839ef07946ec0d1b84a7541..21b5d05c11a03c5d7882552fbda462bb4c6b5415 100644 (file)
 
 #include "program/prog_parameter.h"  /* For union gl_constant_value. */
 
+/**
+ * Used by GL_ARB_explicit_uniform_location extension code in the linker
+ * and glUniform* functions to identify inactive explicit uniform locations.
+ */
+#define INACTIVE_UNIFORM_EXPLICIT_LOCATION ((gl_uniform_storage *) -1)
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-enum gl_uniform_driver_format {
+enum PACKED gl_uniform_driver_format {
    uniform_native = 0,          /**< Store data in the native format. */
    uniform_int_float,           /**< Store integer data as floats. */
-   uniform_bool_float,          /**< Store boolean data as floats. */
-
-   /**
-    * Store boolean data as integer using 1 for \c true.
-    */
-   uniform_bool_int_0_1,
-
-   /**
-    * Store boolean data as integer using ~0 for \c true.
-    */
-   uniform_bool_int_0_not0
 };
 
 struct gl_uniform_driver_storage {
@@ -66,11 +60,8 @@ struct gl_uniform_driver_storage {
 
    /**
     * Base format of the stored data.
-    *
-    * This field must have a value from \c GLSL_TYPE_UINT through \c
-    * GLSL_TYPE_SAMPLER.
     */
-   uint8_t format;
+   enum gl_uniform_driver_format format;
 
    /**
     * Pointer to the base of the data.
@@ -78,6 +69,26 @@ struct gl_uniform_driver_storage {
    void *data;
 };
 
+struct gl_opaque_uniform_index {
+   /**
+    * Base opaque uniform index
+    *
+    * If \c gl_uniform_storage::base_type is an opaque type, this
+    * represents its uniform index.  If \c
+    * gl_uniform_storage::array_elements is not zero, the array will
+    * use opaque uniform indices \c index through \c index + \c
+    * gl_uniform_storage::array_elements - 1, inclusive.
+    *
+    * Note that the index may be different in each shader stage.
+    */
+   uint8_t index;
+
+   /**
+    * Whether this opaque uniform is used in this shader stage.
+    */
+   bool active;
+};
+
 struct gl_uniform_storage {
    char *name;
    /** Type of this uniform data stored.
@@ -99,24 +110,9 @@ struct gl_uniform_storage {
     */
    bool initialized;
 
-   struct {
-      /**
-       * Base sampler index
-       *
-       * If \c ::base_type is \c GLSL_TYPE_SAMPLER, this represents the index
-       * of this sampler.  If \c ::array_elements is not zero, the array will
-       * use sampler indices \c ::sampler through \c ::sampler +
-       * \c ::array_elements - 1, inclusive.
-       *
-       * Note that the index may be different in each shader stage.
-       */
-      uint8_t index;
-
-      /**
-       * Whether this sampler is used in this shader stage.
-       */
-      bool active;
-   } sampler[MESA_SHADER_TYPES];
+   struct gl_opaque_uniform_index sampler[MESA_SHADER_STAGES];
+
+   struct gl_opaque_uniform_index image[MESA_SHADER_STAGES];
 
    /**
     * Storage used by the driver for the uniform
@@ -173,6 +169,18 @@ struct gl_uniform_storage {
     * an atomic counter.
     */
    int atomic_buffer_index;
+
+   /**
+    * The 'base location' for this uniform in the uniform remap table. For
+    * arrays this is the first element in the array.
+    */
+   unsigned remap_location;
+
+   /**
+    * This is a compiler-generated uniform that should not be advertised
+    * via the API.
+    */
+   bool hidden;
 };
 
 #ifdef __cplusplus