};
+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
{
unsigned sampler_index;
unsigned sample_key;
LLVMValueRef context_ptr;
+ LLVMValueRef thread_data_ptr;
const LLVMValueRef *coords;
const LLVMValueRef *offsets;
LLVMValueRef lod;
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);
};
LLVMValueRef img_stride_array;
LLVMValueRef base_ptr;
LLVMValueRef mip_offsets;
+ LLVMValueRef cache;
/** Integer vector with texture width, height, depth */
LLVMValueRef int_size;
* 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) {
}
-static INLINE void
+static inline void
apply_sampler_swizzle(struct lp_build_sample_context *bld,
LLVMValueRef *texel)
{
* 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) {
}
}
-static INLINE boolean
+static inline boolean
has_layer_coord(enum pipe_texture_target tex)
{
switch (tex) {