diff options
author | Roland Scheidegger <[email protected]> | 2013-04-04 23:20:49 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-04-04 23:22:10 +0200 |
commit | 9eef86bb55108bfe2537d90e7efb41a30bf8547a (patch) | |
tree | b10bbcd549f21b08a7dd71a0cb0926bf91f9896c /src/gallium/auxiliary/gallivm | |
parent | b6e9b54d066d29d250c4502e0005b317589dd8b3 (diff) |
gallivm: some minor cube map cleanup
The ar_ge_as_at variable was just very very confusing since the condition
was actually the other way around (as_at_ge_ar). So change the condition
(and the selects depending on it) to match the variable name.
And also change the chosen major axis in case the coord values are the
same. OpenGL doesn't care one bit which one is chosen in this case but
it looks like dx10 would require z chosen over y, and y chosen over x
(previously did x chosen over y, y chosen over z). Since it's all the
same effort just honor dx10's wishes. (Though actually, for some prefered
orderings, we could save one (or two with derivatives) selects since the
tnewx and tnewz (and the corresponding dmax values) are the same.)
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index fe29d258c9d..7f44c4e64a2 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -1403,12 +1403,17 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, signr = LLVMBuildAnd(builder, ri, signmask, ""); /* - * major face determination: select x if x >= y else select y - * select previous result if y >= max(x,y) else select z + * major face determination: select x if x > y else select y + * select z if z >= max(x,y) else select previous result + * if some axis are the same we chose z over y, y over x - the + * dx10 spec seems to ask for it while OpenGL doesn't care (if we + * wouldn't care could save a select or two if using different + * compares and doing at_g_as_ar last since tnewx and tnewz are the + * same). */ - as_ge_at = lp_build_cmp(coord_bld, PIPE_FUNC_GEQUAL, as, at); + as_ge_at = lp_build_cmp(coord_bld, PIPE_FUNC_GREATER, as, at); maxasat = lp_build_max(coord_bld, as, at); - ar_ge_as_at = lp_build_cmp(coord_bld, PIPE_FUNC_GEQUAL, maxasat, ar); + ar_ge_as_at = lp_build_cmp(coord_bld, PIPE_FUNC_GEQUAL, ar, maxasat); /* * compute all possible new s/t coords @@ -1449,13 +1454,13 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, dmaxtnew = lp_build_select(coord_bld, as_ge_at, dmax[1], dmax[2]); } - *face_s = lp_build_select(cint_bld, ar_ge_as_at, *face_s, snewz); - *face_t = lp_build_select(cint_bld, ar_ge_as_at, *face_t, tnewz); - ma = lp_build_select(coord_bld, ar_ge_as_at, ma, r); - *face = lp_build_select(cint_bld, ar_ge_as_at, *face, facez); + *face_s = lp_build_select(cint_bld, ar_ge_as_at, snewz, *face_s); + *face_t = lp_build_select(cint_bld, ar_ge_as_at, tnewz, *face_t); + ma = lp_build_select(coord_bld, ar_ge_as_at, r, ma); + *face = lp_build_select(cint_bld, ar_ge_as_at, facez, *face); if (need_derivs) { - dmaxsnew = lp_build_select(coord_bld, ar_ge_as_at, dmaxsnew, dmax[0]); - dmaxtnew = lp_build_select(coord_bld, ar_ge_as_at, dmaxtnew, dmax[1]); + dmaxsnew = lp_build_select(coord_bld, ar_ge_as_at, dmax[0], dmaxsnew); + dmaxtnew = lp_build_select(coord_bld, ar_ge_as_at, dmax[1], dmaxtnew); } *face_s = LLVMBuildBitCast(builder, *face_s, |