unsigned gs_vertex_streams;
};
-struct lp_build_nir_aos_context
-{
- struct lp_build_nir_context bld_base;
-
- /* Builder for integer masks and indices */
- struct lp_build_context int_bld;
-
- /*
- * AoS swizzle used:
- * - swizzles[0] = red index
- * - swizzles[1] = green index
- * - swizzles[2] = blue index
- * - swizzles[3] = alpha index
- */
- unsigned char swizzles[4];
- unsigned char inv_swizzles[4];
-
- LLVMValueRef consts_ptr;
- const LLVMValueRef *inputs;
- LLVMValueRef *outputs;
-
- const struct lp_build_sampler_aos *sampler;
-};
-
bool
lp_build_nir_llvm(struct lp_build_nir_context *bld_base,
}
-static inline struct lp_build_nir_aos_context *
-lp_nir_aos_context(struct lp_build_nir_context *bld_base)
-{
- return (struct lp_build_nir_aos_context *) bld_base;
-}
-
-
LLVMValueRef
lp_nir_aos_conv_const(struct gallivm_state *gallivm,
LLVMValueRef constval, int nc);
+
#endif
#include "util/u_math.h"
+struct lp_build_nir_aos_context
+{
+ struct lp_build_nir_context bld_base;
+
+ /* Builder for integer masks and indices */
+ struct lp_build_context int_bld;
+
+ /*
+ * AoS swizzle used:
+ * - swizzles[0] = red index
+ * - swizzles[1] = green index
+ * - swizzles[2] = blue index
+ * - swizzles[3] = alpha index
+ */
+ unsigned char swizzles[4];
+ unsigned char inv_swizzles[4];
+
+ LLVMValueRef consts_ptr;
+ const LLVMValueRef *inputs;
+ LLVMValueRef *outputs;
+
+ const struct lp_build_sampler_aos *sampler;
+};
+
+
+static inline struct lp_build_nir_aos_context *
+lp_nir_aos_context(struct lp_build_nir_context *bld_base)
+{
+ return (struct lp_build_nir_aos_context *) bld_base;
+}
+
+
static LLVMValueRef
swizzle_aos(struct lp_build_nir_context *bld_base,
LLVMValueRef a,
init_var_slots(struct lp_build_nir_context *bld_base,
nir_variable *var)
{
- struct lp_build_nir_aos_context *bld =
- (struct lp_build_nir_aos_context *)bld_base;
+ struct lp_build_nir_aos_context *bld = lp_nir_aos_context(bld_base);
if (!bld->outputs)
return;
LLVMValueRef indir_index,
LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
- struct lp_build_nir_aos_context *bld =
- (struct lp_build_nir_aos_context *)bld_base;
+ struct lp_build_nir_aos_context *bld = lp_nir_aos_context(bld_base);
unsigned location = var->data.driver_location;
if (deref_mode == nir_var_shader_in) {
LLVMValueRef indir_index,
LLVMValueRef vals)
{
- struct lp_build_nir_aos_context *bld =
- (struct lp_build_nir_aos_context *)bld_base;
+ struct lp_build_nir_aos_context *bld = lp_nir_aos_context(bld_base);
struct gallivm_state *gallivm = bld_base->base.gallivm;
unsigned location = var->data.driver_location;
LLVMValueRef offset,
LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
- struct lp_build_nir_aos_context *bld =
- (struct lp_build_nir_aos_context *)bld_base;
+ struct lp_build_nir_aos_context *bld = lp_nir_aos_context(bld_base);
LLVMBuilderRef builder = bld_base->base.gallivm->builder;
struct gallivm_state *gallivm = bld_base->base.gallivm;
struct lp_type type = bld_base->base.type;
emit_tex(struct lp_build_nir_context *bld_base,
struct lp_sampler_params *params)
{
- struct lp_build_nir_aos_context *bld =
- (struct lp_build_nir_aos_context *)bld_base;
+ struct lp_build_nir_aos_context *bld = lp_nir_aos_context(bld_base);
static const struct lp_derivatives derivs = { 0 };
params->type = bld_base->base.type;
params->texel[0] = bld->sampler->emit_fetch_texel(bld->sampler,