struct draw_gs_llvm_iface {
- struct lp_build_tgsi_gs_iface base;
+ struct lp_build_gs_iface base;
struct draw_gs_llvm_variant *variant;
LLVMValueRef input;
};
static inline const struct draw_gs_llvm_iface *
-draw_gs_llvm_iface(const struct lp_build_tgsi_gs_iface *iface)
+draw_gs_llvm_iface(const struct lp_build_gs_iface *iface)
{
return (const struct draw_gs_llvm_iface *)iface;
}
}
static LLVMValueRef
-draw_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+draw_gs_llvm_fetch_input(const struct lp_build_gs_iface *gs_iface,
+ struct lp_build_context * bld,
boolean is_vindex_indirect,
LLVMValueRef vertex_index,
boolean is_aindex_indirect,
LLVMValueRef swizzle_index)
{
const struct draw_gs_llvm_iface *gs = draw_gs_llvm_iface(gs_iface);
- struct gallivm_state *gallivm = bld_base->base.gallivm;
+ struct gallivm_state *gallivm = bld->gallivm;
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef indices[3];
LLVMValueRef res;
- struct lp_type type = bld_base->base.type;
+ struct lp_type type = bld->type;
if (is_vindex_indirect || is_aindex_indirect) {
int i;
- res = bld_base->base.zero;
+ res = bld->zero;
for (i = 0; i < type.length; ++i) {
LLVMValueRef idx = lp_build_const_int32(gallivm, i);
LLVMValueRef vert_chan_index = vertex_index;
}
static void
-draw_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+draw_gs_llvm_emit_vertex(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
LLVMValueRef (*outputs)[4],
LLVMValueRef emitted_vertices_vec)
{
struct draw_gs_llvm_variant *variant = gs_iface->variant;
struct gallivm_state *gallivm = variant->gallivm;
LLVMBuilderRef builder = gallivm->builder;
- struct lp_type gs_type = bld_base->base.type;
+ struct lp_type gs_type = bld->type;
LLVMValueRef clipmask = lp_build_const_int_vec(gallivm,
lp_int_type(gs_type), 0);
LLVMValueRef indices[LP_MAX_VECTOR_LENGTH];
}
static void
-draw_gs_llvm_end_primitive(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+draw_gs_llvm_end_primitive(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
+ LLVMValueRef total_emitted_vertices_vec_ptr,
LLVMValueRef verts_per_prim_vec,
- LLVMValueRef emitted_prims_vec)
+ LLVMValueRef emitted_prims_vec,
+ LLVMValueRef mask_vec)
{
const struct draw_gs_llvm_iface *gs_iface = draw_gs_llvm_iface(gs_base);
struct draw_gs_llvm_variant *variant = gs_iface->variant;
draw_gs_jit_prim_lengths(variant->gallivm, variant->context_ptr);
unsigned i;
- for (i = 0; i < bld_base->base.type.length; ++i) {
+ for (i = 0; i < bld->type.length; ++i) {
LLVMValueRef ind = lp_build_const_int32(gallivm, i);
LLVMValueRef prims_emitted =
LLVMBuildExtractElement(builder, emitted_prims_vec, ind, "");
}
static void
-draw_gs_llvm_epilogue(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+draw_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
LLVMValueRef total_emitted_vertices_vec,
LLVMValueRef emitted_prims_vec)
{
params.context_ptr = context_ptr;
params.sampler = sampler;
params.info = &llvm->draw->gs.geometry_shader->info;
- params.gs_iface = (const struct lp_build_tgsi_gs_iface *)&gs_iface;
+ params.gs_iface = (const struct lp_build_gs_iface *)&gs_iface;
params.ssbo_ptr = ssbos_ptr;
params.ssbo_sizes_ptr = num_ssbos_ptr;
params.image = image;
struct lp_build_mask_context;
struct gallivm_state;
struct lp_derivatives;
-struct lp_build_tgsi_gs_iface;
-struct lp_build_coro_suspend_info;
+struct lp_build_gs_iface;
enum lp_build_tex_modifier {
LP_BLD_TEX_MODIFIER_NONE = 0,
LLVMValueRef thread_data_ptr;
const struct lp_build_sampler_soa *sampler;
const struct tgsi_shader_info *info;
- const struct lp_build_tgsi_gs_iface *gs_iface;
+ const struct lp_build_gs_iface *gs_iface;
LLVMValueRef ssbo_ptr;
LLVMValueRef ssbo_sizes_ptr;
const struct lp_build_image_soa *image;
void (*emit_epilogue)(struct lp_build_tgsi_context*);
};
-struct lp_build_tgsi_gs_iface
+struct lp_build_gs_iface
{
- LLVMValueRef (*fetch_input)(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+ LLVMValueRef (*fetch_input)(const struct lp_build_gs_iface *gs_iface,
+ struct lp_build_context * bld,
boolean is_vindex_indirect,
LLVMValueRef vertex_index,
boolean is_aindex_indirect,
LLVMValueRef attrib_index,
LLVMValueRef swizzle_index);
- void (*emit_vertex)(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+ void (*emit_vertex)(const struct lp_build_gs_iface *gs_iface,
+ struct lp_build_context * bld,
LLVMValueRef (*outputs)[4],
LLVMValueRef emitted_vertices_vec);
- void (*end_primitive)(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+ void (*end_primitive)(const struct lp_build_gs_iface *gs_iface,
+ struct lp_build_context * bld,
+ LLVMValueRef total_emitted_vertices_vec,
LLVMValueRef verts_per_prim_vec,
- LLVMValueRef emitted_prims_vec);
- void (*gs_epilogue)(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+ LLVMValueRef emitted_prims_vec,
+ LLVMValueRef mask_vec);
+ void (*gs_epilogue)(const struct lp_build_gs_iface *gs_iface,
LLVMValueRef total_emitted_vertices_vec,
LLVMValueRef emitted_prims_vec);
};
/* Builder for scalar elements of shader's data type (float) */
struct lp_build_context elem_bld;
- const struct lp_build_tgsi_gs_iface *gs_iface;
+ const struct lp_build_gs_iface *gs_iface;
LLVMValueRef emitted_prims_vec_ptr;
LLVMValueRef total_emitted_vertices_vec_ptr;
LLVMValueRef emitted_vertices_vec_ptr;
vertex_index = lp_build_const_int32(gallivm, reg->Dimension.Index);
}
- res = bld->gs_iface->fetch_input(bld->gs_iface, bld_base,
+ res = bld->gs_iface->fetch_input(bld->gs_iface, &bld_base->base,
reg->Dimension.Indirect,
vertex_index,
reg->Register.Indirect,
if (tgsi_type_is_64bit(stype)) {
LLVMValueRef swizzle_index = lp_build_const_int32(gallivm, swizzle_in >> 16);
LLVMValueRef res2;
- res2 = bld->gs_iface->fetch_input(bld->gs_iface, bld_base,
+ res2 = bld->gs_iface->fetch_input(bld->gs_iface, &bld_base->base,
reg->Dimension.Indirect,
vertex_index,
reg->Register.Indirect,
mask = clamp_mask_to_max_output_vertices(bld, mask,
total_emitted_vertices_vec);
gather_outputs(bld);
- bld->gs_iface->emit_vertex(bld->gs_iface, &bld->bld_base,
+ bld->gs_iface->emit_vertex(bld->gs_iface, &bld->bld_base.base,
bld->outputs,
total_emitted_vertices_vec);
increment_vec_ptr_by_mask(bld_base, bld->emitted_vertices_vec_ptr,
LLVMBuildLoad(builder, bld->emitted_vertices_vec_ptr, "");
LLVMValueRef emitted_prims_vec =
LLVMBuildLoad(builder, bld->emitted_prims_vec_ptr, "");
-
+ LLVMValueRef total_emitted_vertices_vec =
+ LLVMBuildLoad(builder, bld->total_emitted_vertices_vec_ptr, "");
LLVMValueRef emitted_mask = lp_build_cmp(uint_bld, PIPE_FUNC_NOTEQUAL,
emitted_vertices_vec,
uint_bld->zero);
executes only on the paths that have unflushed vertices */
mask = LLVMBuildAnd(builder, mask, emitted_mask, "");
- bld->gs_iface->end_primitive(bld->gs_iface, &bld->bld_base,
+ bld->gs_iface->end_primitive(bld->gs_iface, &bld->bld_base.base,
+ total_emitted_vertices_vec,
emitted_vertices_vec,
- emitted_prims_vec);
+ emitted_prims_vec,
+ mask_vec(bld_base));
#if DUMP_GS_EMITS
lp_build_print_value(bld->bld_base.base.gallivm,
LLVMBuildLoad(builder, bld->emitted_prims_vec_ptr, "");
bld->gs_iface->gs_epilogue(bld->gs_iface,
- &bld->bld_base,
total_emitted_vertices_vec,
emitted_prims_vec);
} else {
PFN_GS_FUNC CompileGS(struct swr_context *ctx, swr_jit_gs_key &key);
LLVMValueRef
- swr_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+ swr_gs_llvm_fetch_input(const struct lp_build_gs_iface *gs_iface,
+ struct lp_build_context * bld,
boolean is_vindex_indirect,
LLVMValueRef vertex_index,
boolean is_aindex_indirect,
LLVMValueRef attrib_index,
LLVMValueRef swizzle_index);
void
- swr_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+ swr_gs_llvm_emit_vertex(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
LLVMValueRef (*outputs)[4],
LLVMValueRef emitted_vertices_vec);
void
- swr_gs_llvm_end_primitive(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+ swr_gs_llvm_end_primitive(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
+ LLVMValueRef total_emitted_vertices_vec_ptr,
LLVMValueRef verts_per_prim_vec,
- LLVMValueRef emitted_prims_vec);
+ LLVMValueRef emitted_prims_vec,
+ LLVMValueRef mask_vec);
void
- swr_gs_llvm_epilogue(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+ swr_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
LLVMValueRef total_emitted_vertices_vec,
LLVMValueRef emitted_prims_vec);
};
struct swr_gs_llvm_iface {
- struct lp_build_tgsi_gs_iface base;
+ struct lp_build_gs_iface base;
struct tgsi_shader_info *info;
BuilderSWR *pBuilder;
// trampoline functions so we can use the builder llvm construction methods
static LLVMValueRef
-swr_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+swr_gs_llvm_fetch_input(const struct lp_build_gs_iface *gs_iface,
+ struct lp_build_context * bld,
boolean is_vindex_indirect,
LLVMValueRef vertex_index,
boolean is_aindex_indirect,
{
swr_gs_llvm_iface *iface = (swr_gs_llvm_iface*)gs_iface;
- return iface->pBuilder->swr_gs_llvm_fetch_input(gs_iface, bld_base,
+ return iface->pBuilder->swr_gs_llvm_fetch_input(gs_iface, bld,
is_vindex_indirect,
vertex_index,
is_aindex_indirect,
}
static void
-swr_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+swr_gs_llvm_emit_vertex(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
LLVMValueRef (*outputs)[4],
LLVMValueRef emitted_vertices_vec)
{
swr_gs_llvm_iface *iface = (swr_gs_llvm_iface*)gs_base;
- iface->pBuilder->swr_gs_llvm_emit_vertex(gs_base, bld_base,
+ iface->pBuilder->swr_gs_llvm_emit_vertex(gs_base, bld,
outputs,
emitted_vertices_vec);
}
static void
-swr_gs_llvm_end_primitive(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+swr_gs_llvm_end_primitive(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
+ LLVMValueRef total_emitted_vertices_vec_ptr,
LLVMValueRef verts_per_prim_vec,
- LLVMValueRef emitted_prims_vec)
+ LLVMValueRef emitted_prims_vec,
+ LLVMValueRef mask_vec)
{
swr_gs_llvm_iface *iface = (swr_gs_llvm_iface*)gs_base;
- iface->pBuilder->swr_gs_llvm_end_primitive(gs_base, bld_base,
+ iface->pBuilder->swr_gs_llvm_end_primitive(gs_base, bld,
+ total_emitted_vertices_vec_ptr,
verts_per_prim_vec,
- emitted_prims_vec);
+ emitted_prims_vec,
+ mask_vec);
}
static void
-swr_gs_llvm_epilogue(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+swr_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
LLVMValueRef total_emitted_vertices_vec,
LLVMValueRef emitted_prims_vec)
{
swr_gs_llvm_iface *iface = (swr_gs_llvm_iface*)gs_base;
- iface->pBuilder->swr_gs_llvm_epilogue(gs_base, bld_base,
+ iface->pBuilder->swr_gs_llvm_epilogue(gs_base,
total_emitted_vertices_vec,
emitted_prims_vec);
}
LLVMValueRef
-BuilderSWR::swr_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface,
- struct lp_build_tgsi_context * bld_base,
+BuilderSWR::swr_gs_llvm_fetch_input(const struct lp_build_gs_iface *gs_iface,
+ struct lp_build_context * bld,
boolean is_vindex_indirect,
LLVMValueRef vertex_index,
boolean is_aindex_indirect,
if (is_vindex_indirect || is_aindex_indirect) {
int i;
- Value *res = unwrap(bld_base->base.zero);
- struct lp_type type = bld_base->base.type;
+ Value *res = unwrap(bld->zero);
+ struct lp_type type = bld->type;
for (i = 0; i < type.length; i++) {
Value *vert_chan_index = vert_index;
#define CONTROL_HEADER_SIZE (8*32)
void
-BuilderSWR::swr_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+BuilderSWR::swr_gs_llvm_emit_vertex(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
LLVMValueRef (*outputs)[4],
LLVMValueRef emitted_vertices_vec)
{
}
void
-BuilderSWR::swr_gs_llvm_end_primitive(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+BuilderSWR::swr_gs_llvm_end_primitive(const struct lp_build_gs_iface *gs_base,
+ struct lp_build_context * bld,
+ LLVMValueRef total_emitted_vertices_vec,
LLVMValueRef verts_per_prim_vec,
- LLVMValueRef emitted_prims_vec)
+ LLVMValueRef emitted_prims_vec,
+ LLVMValueRef mask_vec)
{
swr_gs_llvm_iface *iface = (swr_gs_llvm_iface*)gs_base;
ADD(MUL(unwrap(emitted_prims_vec), VIMMED1(vertsPerPrim)),
unwrap(verts_per_prim_vec));
- struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
- vCount = LOAD(unwrap(bld->total_emitted_vertices_vec_ptr));
-
- struct lp_exec_mask *exec_mask = &bld->exec_mask;
- Value *mask = unwrap(lp_build_mask_value(bld->mask));
- if (exec_mask->has_mask)
- mask = AND(mask, unwrap(exec_mask->exec_mask));
+ vCount = unwrap(total_emitted_vertices_vec);
+ Value *mask = unwrap(mask_vec);
Value *cmpMask = VMASK(ICMP_NE(unwrap(verts_per_prim_vec), VIMMED1(0)));
mask = AND(mask, cmpMask);
vMask1 = TRUNC(mask, VectorType::get(mInt1Ty, 8));
}
void
-BuilderSWR::swr_gs_llvm_epilogue(const struct lp_build_tgsi_gs_iface *gs_base,
- struct lp_build_tgsi_context * bld_base,
+BuilderSWR::swr_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
LLVMValueRef total_emitted_vertices_vec,
LLVMValueRef emitted_prims_vec)
{