summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2013-08-07 20:51:52 +0200
committerRoland Scheidegger <[email protected]>2013-08-08 18:55:58 +0200
commit6ce54a81b2de723b71bd684b05b82989b94fb119 (patch)
tree5ffbac4426e71bbfbd34978db9be264eeb948e0d
parentaa84f1ad5537f5b0232eb681147cb3a3882323b8 (diff)
gallivm: honor d3d10 floating point rules for shadow comparisons
d3d10 specifies ordered comparisons for everything but not_equal which is unordered (http://msdn.microsoft.com/en-us/library/windows/desktop/cc308050.aspx). OpenGL probably doesn't care. Reviewed-by: Zack Rusin <[email protected]>
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 337b6f73fd1..4305c49c482 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1484,12 +1484,26 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
* should be converted to the depth format (quantization!) and comparison
* then done in texture format.
*/
+
/* result = (p FUNC texel) ? 1 : 0 */
- res = lp_build_cmp(texel_bld, bld->static_sampler_state->compare_func,
- p, texel[chan]);
+ /*
+ * honor d3d10 floating point rules here, which state that comparisons
+ * are ordered except NOT_EQUAL which is unordered.
+ */
+ if (bld->static_sampler_state->compare_func != PIPE_FUNC_NOTEQUAL) {
+ res = lp_build_cmp_ordered(texel_bld, bld->static_sampler_state->compare_func,
+ p, texel[chan]);
+ }
+ else {
+ res = lp_build_cmp(texel_bld, bld->static_sampler_state->compare_func,
+ p, texel[chan]);
+ }
res = lp_build_select(texel_bld, res, texel_bld->one, texel_bld->zero);
- /* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */
+ /*
+ * returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE.
+ * This should be ok because sampler swizzle is applied on top of it.
+ */
texel[0] =
texel[1] =
texel[2] = res;