summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-03-18 11:31:38 -0600
committerBrian Paul <brianp@vmware.com>2010-03-18 11:31:38 -0600
commit521c61ff017ab15b829abbe9a98b179136a36009 (patch)
tree9e1d207b35b732e69d67933c16e586aea0f83677 /src/gallium/auxiliary
parentecf85c7d750478e433e640897bb25a18069f14de (diff)
gallivm/llvmpipe: simplify front/back stencil ref value handling
Instead of passing an array, just pass two scalar values.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_depth.c41
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_depth.h2
2 files changed, 7 insertions, 36 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
index 49de5c94a3..c253764e60 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
@@ -363,32 +363,6 @@ lp_depth_type(const struct util_format_description *format_desc,
}
-/** Get front/back-face stencil ref value */
-static LLVMValueRef
-lp_build_get_stencil_ref(struct lp_build_context *bld,
- struct lp_type type, LLVMValueRef stencil_refs_ptr,
- unsigned face_index)
-{
- LLVMValueRef indexes[2], ptr, ref, ref_vec;
-
- assert(face_index < 2);
-
- /* load [face_index] element of the array */
- indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
- indexes[1] = LLVMConstInt(LLVMInt32Type(), face_index, 0);
- ptr = LLVMBuildGEP(bld->builder, stencil_refs_ptr, indexes, 2, "");
- ref = LLVMBuildLoad(bld->builder, ptr, "");
-
- /* convert int8 value to i32 */
- ref = LLVMBuildZExt(bld->builder, ref, LLVMIntType(type.width), "");
-
- /* make scalar into vector */
- ref_vec = lp_build_broadcast_scalar(bld, ref);
-
- return ref_vec;
-}
-
-
/**
* Generate code for performing depth and/or stencil tests.
* We operate on a vector of values (typically a 2x2 quad).
@@ -406,13 +380,12 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
struct lp_type type,
const struct util_format_description *format_desc,
struct lp_build_mask_context *mask,
- LLVMValueRef stencil_refs_ptr,
+ LLVMValueRef stencil_refs[2],
LLVMValueRef z_src,
LLVMValueRef zs_dst_ptr)
{
struct lp_build_context bld;
unsigned z_swizzle, s_swizzle;
- LLVMValueRef stencil_refs[2];
LLVMValueRef zs_dst, z_dst = NULL;
LLVMValueRef stencil_vals = NULL;
LLVMValueRef z_bitmask = NULL, s_bitmask = NULL;
@@ -502,19 +475,17 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
lp_build_name(z_dst, "zsbuf.z");
-
+ /*
printf("build depth %d stencil %d\n",
depth->enabled,
stencil[0].enabled);
-
+ */
if (stencil[0].enabled) {
- /* Incoming stencil_refs is ptr to int8[2]. Get/convert to int32[4]. */
- stencil_refs[0] = lp_build_get_stencil_ref(&bld, type, stencil_refs_ptr, 0);
+ /* convert scalar stencil refs into vectors */
+ stencil_refs[0] = lp_build_broadcast_scalar(&bld, stencil_refs[0]);
+ stencil_refs[1] = lp_build_broadcast_scalar(&bld, stencil_refs[1]);
- if (stencil[1].enabled)
- stencil_refs[1] =
- lp_build_get_stencil_ref(&bld, type, stencil_refs_ptr, 1);
s_pass_mask = lp_build_stencil_test(&bld, stencil,
stencil_refs, stencil_vals, face);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.h b/src/gallium/auxiliary/gallivm/lp_bld_depth.h
index eedc1e419b..5708ced983 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.h
@@ -57,7 +57,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
struct lp_type type,
const struct util_format_description *format_desc,
struct lp_build_mask_context *mask,
- LLVMValueRef stencil_refs,
+ LLVMValueRef stencil_refs[2],
LLVMValueRef zs_src,
LLVMValueRef zs_dst_ptr);