From c9e757c61e6db2189615510c1583109911082761 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 9 Mar 2023 08:53:43 -0500 Subject: [PATCH] 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 Part-of: --- 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 0fd0930..219b224 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 10599a4..d6b211d 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)) -- 2.7.4