aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c35
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h28
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c16
3 files changed, 41 insertions, 38 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 0416e002cd7..25b0f0f07b5 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -67,14 +67,14 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *var);
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;
}
@@ -1462,8 +1462,8 @@ clipmask_booli8(struct gallivm_state *gallivm,
}
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,
@@ -1471,15 +1471,15 @@ draw_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface,
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;
@@ -1518,8 +1518,8 @@ draw_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface,
}
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)
{
@@ -1527,7 +1527,7 @@ draw_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base,
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];
@@ -1552,10 +1552,12 @@ draw_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base,
}
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;
@@ -1565,7 +1567,7 @@ draw_gs_llvm_end_primitive(const struct lp_build_tgsi_gs_iface *gs_base,
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, "");
@@ -1581,8 +1583,7 @@ draw_gs_llvm_end_primitive(const struct lp_build_tgsi_gs_iface *gs_base,
}
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)
{
@@ -2508,7 +2509,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
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;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 9d6dfaa390c..940a4c49a50 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -66,8 +66,7 @@ struct tgsi_shader_info;
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,
@@ -247,7 +246,7 @@ struct lp_build_tgsi_params {
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;
@@ -435,25 +434,26 @@ struct lp_build_tgsi_context
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);
};
@@ -465,7 +465,7 @@ struct lp_build_tgsi_soa_context
/* 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;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 9bfe41b9062..8066d59ee67 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1581,7 +1581,7 @@ emit_fetch_gs_input(
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,
@@ -1592,7 +1592,7 @@ emit_fetch_gs_input(
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,
@@ -3984,7 +3984,7 @@ emit_vertex(
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,
@@ -4016,7 +4016,8 @@ end_primitive_masked(struct lp_build_tgsi_context * bld_base,
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);
@@ -4026,9 +4027,11 @@ end_primitive_masked(struct lp_build_tgsi_context * bld_base,
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,
@@ -4371,7 +4374,6 @@ static void emit_epilogue(struct lp_build_tgsi_context * bld_base)
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 {