#include "gallivm/lp_bld_type.h"
#include "gallivm/lp_bld_swizzle.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
struct pipe_resource;
struct pipe_sampler_view;
enum lp_sampler_op_type {
LP_SAMPLER_OP_TEXTURE,
LP_SAMPLER_OP_FETCH,
- LP_SAMPLER_OP_GATHER
+ LP_SAMPLER_OP_GATHER,
+ LP_SAMPLER_OP_LODQ
};
unsigned sampler_index;
unsigned sample_key;
LLVMValueRef context_ptr;
+ LLVMValueRef thread_data_ptr;
const LLVMValueRef *coords;
const LLVMValueRef *offsets;
LLVMValueRef lod;
LLVMValueRef *texel;
};
-
+struct lp_sampler_size_query_params
+{
+ struct lp_type int_type;
+ unsigned texture_unit;
+ unsigned target;
+ LLVMValueRef context_ptr;
+ boolean is_sviewinfo;
+ enum lp_sampler_lod_property lod_property;
+ LLVMValueRef explicit_lod;
+ LLVMValueRef *sizes_out;
+};
/**
* Texture static state.
*
unsigned normalized_coords:1;
unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */
unsigned lod_bias_non_zero:1;
+ unsigned max_lod_pos:1;
unsigned apply_min_lod:1; /**< min_lod > 0 ? */
unsigned apply_max_lod:1; /**< max_lod < last_level ? */
unsigned seamless_cube_map:1;
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);
};
/** number of lod values (valid are 1, length/4, length) */
unsigned num_lods;
+ boolean no_quad_lod;
+ boolean no_brilinear;
+ boolean no_rho_approx;
+
/** regular scalar float type */
struct lp_type float_type;
struct lp_build_context float_bld;
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) {
void
lp_build_lod_selector(struct lp_build_sample_context *bld,
+ boolean is_lodq,
unsigned texture_index,
unsigned sampler_index,
LLVMValueRef s,
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
unsigned mip_filter,
+ LLVMValueRef *out_lod,
LLVMValueRef *out_lod_ipart,
LLVMValueRef *out_lod_fpart,
LLVMValueRef *out_lod_positive);
lp_build_size_query_soa(struct gallivm_state *gallivm,
const struct lp_static_texture_state *static_state,
struct lp_sampler_dynamic_state *dynamic_state,
- struct lp_type int_type,
- unsigned texture_unit,
- unsigned target,
- LLVMValueRef context_ptr,
- boolean is_sviewinfo,
- enum lp_sampler_lod_property lod_property,
- LLVMValueRef explicit_lod,
- LLVMValueRef *sizes_out);
+ const struct lp_sampler_size_query_params *params);
void
lp_build_sample_nop(struct gallivm_state *gallivm,
LLVMValueRef level,
boolean lod_scalar);
+#ifdef __cplusplus
+}
+#endif
#endif /* LP_BLD_SAMPLE_H */