summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-03-27 04:27:59 -0700
committerZack Rusin <[email protected]>2013-04-03 10:16:25 -0700
commitf313b0c8502868dab2a87237af295a34ec0dea26 (patch)
treebc09f64a2a7eaad3c9b2576a159b68f8a41a9a49 /src/gallium/auxiliary/gallivm
parentac114c682413065a5b8baa678733555e94e43120 (diff)
gallivm: cleanup the gs interface
Instead of void pointers use a base interface. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h25
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c31
2 files changed, 27 insertions, 29 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index fe4444edb1a..5764847acb5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -365,20 +365,23 @@ struct lp_build_tgsi_context
struct lp_build_tgsi_gs_iface
{
- LLVMValueRef input;
- void (*emit_vertex)(struct lp_build_tgsi_context * bld_base,
+ LLVMValueRef (*fetch_input)(const struct lp_build_tgsi_gs_iface *gs_iface,
+ struct lp_build_tgsi_context * bld_base,
+ LLVMValueRef vertex_index,
+ 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,
LLVMValueRef (*outputs)[4],
- LLVMValueRef emitted_vertices_vec,
- void *user_data);
- void (*end_primitive)(struct lp_build_tgsi_context * bld_base,
+ LLVMValueRef emitted_vertices_vec);
+ void (*end_primitive)(const struct lp_build_tgsi_gs_iface *gs_iface,
+ struct lp_build_tgsi_context * bld_base,
LLVMValueRef verts_per_prim_vec,
- LLVMValueRef emitted_prims_vec,
- void *user_data);
- void (*gs_epilogue)(struct lp_build_tgsi_context * bld_base,
+ LLVMValueRef emitted_prims_vec);
+ void (*gs_epilogue)(const struct lp_build_tgsi_gs_iface *gs_iface,
+ struct lp_build_tgsi_context * bld_base,
LLVMValueRef total_emitted_vertices_vec,
- LLVMValueRef emitted_prims_vec,
- void *user_data);
- void *user_data;
+ LLVMValueRef emitted_prims_vec);
};
struct lp_build_tgsi_soa_context
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index facfc824de2..54f3fd9f8f8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -805,11 +805,9 @@ emit_fetch_gs_input(
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
- //struct lp_build_context *uint_bld = &bld_base->uint_bld;
LLVMValueRef attrib_index = NULL;
LLVMValueRef vertex_index = NULL;
LLVMValueRef swizzle_index = lp_build_const_int32(gallivm, swizzle);
- LLVMValueRef indices[3];
LLVMValueRef res;
if (reg->Register.Indirect) {
@@ -830,12 +828,10 @@ emit_fetch_gs_input(
vertex_index = lp_build_const_int32(gallivm, reg->Dimension.Index);
}
- indices[0] = vertex_index;
- indices[1] = attrib_index;
- indices[2] = swizzle_index;
- res = LLVMBuildGEP(builder, bld->gs_iface->input, indices, 3, "");
- res = LLVMBuildLoad(builder, res, "");
+ res = bld->gs_iface->fetch_input(bld->gs_iface, bld_base,
+ vertex_index, attrib_index,
+ swizzle_index);
assert(res);
@@ -2200,9 +2196,9 @@ emit_vertex(
if (bld->gs_iface->emit_vertex) {
LLVMValueRef masked_ones = mask_to_one_vec(bld_base);
gather_outputs(bld);
- bld->gs_iface->emit_vertex(&bld->bld_base, bld->outputs,
- bld->total_emitted_vertices_vec,
- bld->gs_iface->user_data);
+ bld->gs_iface->emit_vertex(bld->gs_iface, &bld->bld_base,
+ bld->outputs,
+ bld->total_emitted_vertices_vec);
bld->emitted_vertices_vec =
LLVMBuildAdd(builder, bld->emitted_vertices_vec, masked_ones, "");
bld->total_emitted_vertices_vec =
@@ -2223,10 +2219,9 @@ end_primitive(
if (bld->gs_iface->end_primitive) {
LLVMValueRef masked_ones = mask_to_one_vec(bld_base);
- bld->gs_iface->end_primitive(&bld->bld_base,
- bld->emitted_vertices_vec,
- bld->emitted_prims_vec,
- bld->gs_iface->user_data);
+ bld->gs_iface->end_primitive(bld->gs_iface, &bld->bld_base,
+ bld->emitted_vertices_vec,
+ bld->emitted_prims_vec);
bld->emitted_prims_vec =
LLVMBuildAdd(builder, bld->emitted_prims_vec, masked_ones, "");
bld->emitted_vertices_vec = bld_base->uint_bld.zero;
@@ -2544,10 +2539,10 @@ static void emit_epilogue(struct lp_build_tgsi_context * bld_base)
bld->pending_end_primitive = FALSE;
}
- bld->gs_iface->gs_epilogue(&bld->bld_base,
- bld->total_emitted_vertices_vec,
- bld->emitted_prims_vec,
- bld->gs_iface->user_data);
+ bld->gs_iface->gs_epilogue(bld->gs_iface,
+ &bld->bld_base,
+ bld->total_emitted_vertices_vec,
+ bld->emitted_prims_vec);
} else {
gather_outputs(bld);
}