freedreno/ir3: array rework
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_sample.h
index b95ee6fb56fe360b2542a7b4145b4a30dbb10fc8..a6f0eff42f684c7f05218a0fea4327293e7dd694 100644 (file)
@@ -76,13 +76,21 @@ enum lp_sampler_lod_control {
 };
 
 
+enum lp_sampler_op_type {
+   LP_SAMPLER_OP_TEXTURE,
+   LP_SAMPLER_OP_FETCH,
+   LP_SAMPLER_OP_GATHER
+};
+
+
 #define LP_SAMPLER_SHADOW             (1 << 0)
 #define LP_SAMPLER_OFFSETS            (1 << 1)
-#define LP_SAMPLER_FETCH              (1 << 2)
-#define LP_SAMPLER_LOD_CONTROL_SHIFT        3
-#define LP_SAMPLER_LOD_CONTROL_MASK   (3 << 3)
-#define LP_SAMPLER_LOD_PROPERTY_SHIFT       5
-#define LP_SAMPLER_LOD_PROPERTY_MASK  (3 << 5)
+#define LP_SAMPLER_OP_TYPE_SHIFT            2
+#define LP_SAMPLER_OP_TYPE_MASK       (3 << 2)
+#define LP_SAMPLER_LOD_CONTROL_SHIFT        4
+#define LP_SAMPLER_LOD_CONTROL_MASK   (3 << 4)
+#define LP_SAMPLER_LOD_PROPERTY_SHIFT       6
+#define LP_SAMPLER_LOD_PROPERTY_MASK  (3 << 6)
 
 struct lp_sampler_params
 {
@@ -91,6 +99,7 @@ struct lp_sampler_params
    unsigned sampler_index;
    unsigned sample_key;
    LLVMValueRef context_ptr;
+   LLVMValueRef thread_data_ptr;
    const LLVMValueRef *coords;
    const LLVMValueRef *offsets;
    LLVMValueRef lod;
@@ -259,6 +268,17 @@ struct lp_sampler_dynamic_state
                    struct gallivm_state *gallivm,
                    LLVMValueRef context_ptr,
                    unsigned sampler_unit);
+
+   /** 
+    * Obtain texture cache (returns ptr to lp_build_format_cache).
+    *
+    * It's optional: no caching will be done if it's NULL.
+    */
+   LLVMValueRef
+   (*cache_ptr)(const struct lp_sampler_dynamic_state *state,
+                struct gallivm_state *gallivm,
+                LLVMValueRef thread_data_ptr,
+                unsigned unit);
 };
 
 
@@ -348,6 +368,7 @@ struct lp_build_sample_context
    LLVMValueRef img_stride_array;
    LLVMValueRef base_ptr;
    LLVMValueRef mip_offsets;
+   LLVMValueRef cache;
 
    /** Integer vector with texture width, height, depth */
    LLVMValueRef int_size;
@@ -363,7 +384,7 @@ struct lp_build_sample_context
  * We only support a few wrap modes in lp_build_sample_wrap_linear_int() at
  * this time.  Return whether the given mode is supported by that function.
  */
-static INLINE boolean
+static inline boolean
 lp_is_simple_wrap_mode(unsigned mode)
 {
    switch (mode) {
@@ -376,7 +397,7 @@ lp_is_simple_wrap_mode(unsigned mode)
 }
 
 
-static INLINE void
+static inline void
 apply_sampler_swizzle(struct lp_build_sample_context *bld,
                       LLVMValueRef *texel)
 {
@@ -394,7 +415,7 @@ apply_sampler_swizzle(struct lp_build_sample_context *bld,
  * not really dimension as such, this indicates the amount of
  * "normal" texture coords subject to minification, wrapping etc.
  */
-static INLINE unsigned
+static inline unsigned
 texture_dims(enum pipe_texture_target tex)
 {
    switch (tex) {
@@ -416,7 +437,7 @@ texture_dims(enum pipe_texture_target tex)
    }
 }
 
-static INLINE boolean
+static inline boolean
 has_layer_coord(enum pipe_texture_target tex)
 {
    switch (tex) {