#define LP_SAMPLER_LOD_CONTROL_MASK (3 << 4)
#define LP_SAMPLER_LOD_PROPERTY_SHIFT 6
#define LP_SAMPLER_LOD_PROPERTY_MASK (3 << 6)
+#define LP_SAMPLER_GATHER_COMP_SHIFT 8
+#define LP_SAMPLER_GATHER_COMP_MASK (3 << 8)
+#define LP_SAMPLER_FETCH_MS (1 << 10)
struct lp_sampler_params
{
struct lp_type type;
unsigned texture_index;
unsigned sampler_index;
+ LLVMValueRef texture_index_offset;
unsigned sample_key;
LLVMValueRef context_ptr;
LLVMValueRef thread_data_ptr;
const LLVMValueRef *coords;
const LLVMValueRef *offsets;
+ LLVMValueRef ms_index;
LLVMValueRef lod;
const struct lp_derivatives *derivs;
LLVMValueRef *texel;
{
struct lp_type int_type;
unsigned texture_unit;
+ LLVMValueRef texture_unit_offset;
unsigned target;
LLVMValueRef context_ptr;
boolean is_sviewinfo;
+ bool samples_only;
enum lp_sampler_lod_property lod_property;
LLVMValueRef explicit_lod;
LLVMValueRef *sizes_out;
{
struct lp_type type;
unsigned image_index;
+ LLVMValueRef image_index_offset;
unsigned img_op;
unsigned target;
LLVMAtomicRMWBinOp op;
LLVMValueRef context_ptr;
LLVMValueRef thread_data_ptr;
const LLVMValueRef *coords;
+ LLVMValueRef ms_index;
LLVMValueRef indata[4];
LLVMValueRef indata2[4];
LLVMValueRef *outdata;
(*width)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain the base texture height (returns int32) */
LLVMValueRef
(*height)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain the base texture depth (or array size) (returns int32) */
LLVMValueRef
(*depth)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain the first mipmap level (base level) (returns int32) */
LLVMValueRef
(*first_level)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain the number of mipmap levels minus one (returns int32) */
LLVMValueRef
(*last_level)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain stride in bytes between image rows/blocks (returns int32) */
LLVMValueRef
(*row_stride)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain stride in bytes between image slices (returns int32) */
LLVMValueRef
(*img_stride)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain pointer to base of texture */
LLVMValueRef
(*base_ptr)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/** Obtain pointer to array of mipmap offsets */
LLVMValueRef
(*mip_offsets)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
LLVMValueRef context_ptr,
- unsigned texture_unit);
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
+
+ /** Obtain number of samples (returns int32) */
+ LLVMValueRef
+ (*num_samples)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
+
+ /** Obtain multisample stride (returns int32) */
+ LLVMValueRef
+ (*sample_stride)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit, LLVMValueRef texture_unit_offset);
/* These are callbacks for sampler state */
/** number of lod values (valid are 1, length/4, length) */
unsigned num_lods;
+ unsigned gather_comp;
boolean no_quad_lod;
boolean no_brilinear;
boolean no_rho_approx;
+ boolean fetch_ms;
/** regular scalar float type */
struct lp_type float_type;
LLVMValueRef base_ptr;
LLVMValueRef mip_offsets;
LLVMValueRef cache;
+ LLVMValueRef sample_stride;
/** Integer vector with texture width, height, depth */
LLVMValueRef int_size;
LLVMValueRef context_ptr;
};
+/*
+ * Indirect texture access context
+ *
+ * This is used to store info across building
+ * and indirect texture switch statement.
+ */
+struct lp_build_sample_array_switch {
+ struct gallivm_state *gallivm;
+ struct lp_sampler_params params;
+ unsigned base, range;
+ LLVMValueRef switch_ref;
+ LLVMBasicBlockRef merge_ref;
+ LLVMValueRef phi;
+};
/**
void
lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
- struct lp_sampler_dynamic_state *dynamic_state,
- struct gallivm_state *gallivm,
- const struct lp_img_params *params);
+ struct lp_sampler_dynamic_state *dynamic_state,
+ struct gallivm_state *gallivm,
+ const struct lp_img_params *params,
+ LLVMValueRef outdata[4]);
+
+void
+lp_build_sample_array_init_soa(struct lp_build_sample_array_switch *switch_info,
+ struct gallivm_state *gallivm,
+ const struct lp_sampler_params *params,
+ LLVMValueRef idx,
+ unsigned base, unsigned range);
+
+void
+lp_build_sample_array_case_soa(struct lp_build_sample_array_switch *switch_info,
+ int idx,
+ const struct lp_static_texture_state *static_texture_state,
+ const struct lp_static_sampler_state *static_sampler_state,
+ struct lp_sampler_dynamic_state *dynamic_texture_state);
+void lp_build_sample_array_fini_soa(struct lp_build_sample_array_switch *switch_info);
#ifdef __cplusplus
}
#endif