lavapipe: fix dynamic depth clamping
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 9 Mar 2023 13:53:43 +0000 (08:53 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 14 Mar 2023 06:16:31 +0000 (06:16 +0000)
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 <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21814>

src/gallium/frontends/lavapipe/ci/lvp-fails.txt
src/gallium/frontends/lavapipe/lvp_execute.c

index 0fd0930..219b224 100644 (file)
@@ -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
index 10599a4..d6b211d 100644 (file)
@@ -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))