glsl: Add a new glsl_type::sampler_coordinate_components() function.
[mesa.git] / src / glsl / glsl_types.h
index 647867a23f19172a8a1ef3a752190a2ee7f680ea..9f61eee78783cd00fdab5ef7236a4b5536cc820e 100644 (file)
@@ -498,6 +498,18 @@ struct glsl_type {
       return is_array() ? length : -1;
    }
 
+   /**
+    * Return the number of coordinate components needed for this sampler type.
+    *
+    * This is based purely on the sampler's dimensionality.  For example, this
+    * returns 1 for sampler1D, and 3 for sampler2DArray.
+    *
+    * Note that this is often different than actual coordinate type used in
+    * 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;
+
 private:
    /**
     * ralloc context for all glsl_type allocations