Module: Mesa
Branch: master
Commit: f96f016c2280bb7df1c67f251abeac866ff3997e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f96f016c2280bb7df1c67f251abeac866ff3997e

Author: Dave Airlie <[email protected]>
Date:   Wed Apr  7 13:18:29 2021 +1000

llvmpipe: when depth clamp is disable clamp to 0.0/1.0

When depth clamp is disabled the viewport values aren't meaningful,
however the value is about to be converted to a unorm so needs
to still be clamped to 0/1.

This might not be the best place for this, maybe it should be in
the write swizzled code.

Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10068>

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index e091f98a37e..b90a13f83e7 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1132,12 +1132,19 @@ generate_fs_loop(struct gallivm_state *gallivm,
             z = interp->pos[2];
          }
       }
+
       /*
        * Clamp according to ARB_depth_clamp semantics.
        */
       if (key->depth_clamp) {
          z = lp_build_depth_clamp(gallivm, builder, type, context_ptr,
                                   thread_data_ptr, z);
+      } else {
+         struct lp_build_context f32_bld;
+         lp_build_context_init(&f32_bld, gallivm, type);
+         z = lp_build_clamp(&f32_bld, z,
+                            lp_build_const_vec(gallivm, type, 0.0),
+                            lp_build_const_vec(gallivm, type, 1.0));
       }
 
       if (s_out != -1 && outputs[s_out][1]) {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to