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

Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Mar  9 08:53:43 2023 -0500

lavapipe: fix dynamic depth clamping

on pipeline bind with dynamic state, depth_clip_near needs to either be set by
* applying the dynamic state
* using the pipeline state

the previous code always used the pipeline state

fixes:
dEQP-VK.pipeline.*.extended_dynamic_state.between_pipelines.depth_clamp_enable

Fixes: 650880105e6 ("vulkan,lavapipe: Use a tri-state enum for depth clip 
enable")

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21814>

---

 src/gallium/frontends/lavapipe/ci/lvp-fails.txt | 2 --
 src/gallium/frontends/lavapipe/lvp_execute.c    | 7 +++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/ci/lvp-fails.txt 
b/src/gallium/frontends/lavapipe/ci/lvp-fails.txt
index 0fd09309dcf..219b224a79c 100644
--- a/src/gallium/frontends/lavapipe/ci/lvp-fails.txt
+++ b/src/gallium/frontends/lavapipe/ci/lvp-fails.txt
@@ -9,5 +9,3 @@ 
dEQP-VK.conditional_rendering.conditional_ignore.clear_condition_host_memory_exp
 
dEQP-VK.conditional_rendering.conditional_ignore.clear_condition_host_memory_secondary_buffer_inherited_expect_noop_inverted,Fail
 
dEQP-VK.conditional_rendering.conditional_ignore.clear_condition_local_memory_expect_noop,Fail
 
dEQP-VK.conditional_rendering.conditional_ignore.clear_condition_local_memory_secondary_buffer_inherited_expect_noop_inverted,Fail
-dEQP-VK.pipeline.fast_linked_library.extended_dynamic_state.cmd_buffer_start.depth_clamp_enable,Fail
-dEQP-VK.pipeline.pipeline_library.extended_dynamic_state.cmd_buffer_start.depth_clamp_enable,Fail
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c 
b/src/gallium/frontends/lavapipe/lvp_execute.c
index 10599a4c7b0..d6b211d168f 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -747,10 +747,13 @@ static void handle_graphics_pipeline(struct 
vk_cmd_queue_entry *cmd,
       if (BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_RS_DEPTH_CLIP_ENABLE)) {
          state->depth_clamp_sets_clip = false;
       } else {
-         state->rs_state.depth_clip_near = state->rs_state.depth_clip_far =
-            vk_rasterization_state_depth_clip_enable(ps->rs);
          state->depth_clamp_sets_clip =
             ps->rs->depth_clip_enable == VK_MESA_DEPTH_CLIP_ENABLE_NOT_CLAMP;
+         if (state->depth_clamp_sets_clip)
+            state->rs_state.depth_clip_near = state->rs_state.depth_clip_far = 
!state->rs_state.depth_clamp;
+         else
+            state->rs_state.depth_clip_near = state->rs_state.depth_clip_far =
+               vk_rasterization_state_depth_clip_enable(ps->rs);
       }
 
       if (!BITSET_TEST(ps->dynamic, 
MESA_VK_DYNAMIC_RS_RASTERIZER_DISCARD_ENABLE))

Reply via email to