diff options
author | José Fonseca <[email protected]> | 2013-04-17 18:03:11 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2013-05-17 20:22:50 +0100 |
commit | 5aaa4bafe04e601c2e42da76447f2b9297dc3a93 (patch) | |
tree | f2956e361ea5f2140cc222572e4bd7a239f8960e /src/gallium/auxiliary/gallivm | |
parent | e230d9debbd4c2e715f50059a02d502d90a626d7 (diff) |
gallivm: Add and use lp_build_lerp_3d.
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_arit.c | 20 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_arit.h | 15 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 51 |
3 files changed, 60 insertions, 26 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 524a8e79a75..8f8410c015b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1095,6 +1095,26 @@ lp_build_lerp_2d(struct lp_build_context *bld, } +LLVMValueRef +lp_build_lerp_3d(struct lp_build_context *bld, + LLVMValueRef x, + LLVMValueRef y, + LLVMValueRef z, + LLVMValueRef v000, + LLVMValueRef v001, + LLVMValueRef v010, + LLVMValueRef v011, + LLVMValueRef v100, + LLVMValueRef v101, + LLVMValueRef v110, + LLVMValueRef v111) +{ + LLVMValueRef v0 = lp_build_lerp_2d(bld, x, y, v000, v001, v010, v011); + LLVMValueRef v1 = lp_build_lerp_2d(bld, x, y, v100, v101, v110, v111); + return lp_build_lerp(bld, z, v0, v1); +} + + /** * Generate min(a, b) * Do checks for special cases. diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h index 60b9907e60f..45886d5fd99 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h @@ -106,6 +106,21 @@ lp_build_lerp_2d(struct lp_build_context *bld, LLVMValueRef v11); LLVMValueRef +lp_build_lerp_3d(struct lp_build_context *bld, + LLVMValueRef x, + LLVMValueRef y, + LLVMValueRef z, + LLVMValueRef v000, + LLVMValueRef v001, + LLVMValueRef v010, + LLVMValueRef v011, + LLVMValueRef v100, + LLVMValueRef v101, + LLVMValueRef v110, + LLVMValueRef v111); + + +LLVMValueRef lp_build_min(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 16d57189ed4..9eaca029fda 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -982,8 +982,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld, s_fpart_hi, neighbors_hi[0][0][0], neighbors_hi[0][0][1]); - } - else { + } else if (dims == 2) { /* 2-D lerp */ packed_lo = lp_build_lerp_2d(&h16, s_fpart_lo, t_fpart_lo, @@ -998,30 +997,30 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld, neighbors_hi[0][0][1], neighbors_hi[0][1][0], neighbors_hi[0][1][1]); - - if (dims >= 3) { - LLVMValueRef packed_lo2, packed_hi2; - - /* lerp in the second z slice */ - packed_lo2 = lp_build_lerp_2d(&h16, - s_fpart_lo, t_fpart_lo, - neighbors_lo[1][0][0], - neighbors_lo[1][0][1], - neighbors_lo[1][1][0], - neighbors_lo[1][1][1]); - - packed_hi2 = lp_build_lerp_2d(&h16, - s_fpart_hi, t_fpart_hi, - neighbors_hi[1][0][0], - neighbors_hi[1][0][1], - neighbors_hi[1][1][0], - neighbors_hi[1][1][1]); - /* interp between two z slices */ - packed_lo = lp_build_lerp(&h16, r_fpart_lo, - packed_lo, packed_lo2); - packed_hi = lp_build_lerp(&h16, r_fpart_hi, - packed_hi, packed_hi2); - } + } else { + /* 3-D lerp */ + assert(dims == 3); + packed_lo = lp_build_lerp_3d(&h16, + s_fpart_lo, t_fpart_lo, r_fpart_lo, + neighbors_lo[0][0][0], + neighbors_lo[0][0][1], + neighbors_lo[0][1][0], + neighbors_lo[0][1][1], + neighbors_lo[1][0][0], + neighbors_lo[1][0][1], + neighbors_lo[1][1][0], + neighbors_lo[1][1][1]); + + packed_hi = lp_build_lerp_3d(&h16, + s_fpart_hi, t_fpart_hi, r_fpart_hi, + neighbors_hi[0][0][0], + neighbors_hi[0][0][1], + neighbors_hi[0][1][0], + neighbors_hi[0][1][1], + neighbors_hi[1][0][0], + neighbors_hi[1][0][1], + neighbors_hi[1][1][0], + neighbors_hi[1][1][1]); } } |