From 8296373e78d30cdddeec556481f22871183571b9 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 22 Aug 2025 10:49:13 +0200 Subject: [PATCH] radv: add radv_cmd_set_depth_clip_negative_one_to_one() Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 32464dfc37b..d8eff2a258a 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -110,6 +110,16 @@ radv_cmd_set_depth_clamp_range(struct radv_cmd_buffer *cmd_buffer, VkDepthClampM state->dirty_dynamic |= RADV_DYNAMIC_DEPTH_CLAMP_RANGE; } +ALWAYS_INLINE static void +radv_cmd_set_depth_clip_negative_one_to_one(struct radv_cmd_buffer *cmd_buffer, bool negative_one_to_one) +{ + struct radv_cmd_state *state = &cmd_buffer->state; + + state->dynamic.vk.vp.depth_clip_negative_one_to_one = negative_one_to_one; + + state->dirty_dynamic |= RADV_DYNAMIC_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE; +} + static void radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dynamic_state *src) { @@ -226,8 +236,6 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dy RADV_CMP_COPY(vk.ia.primitive_topology, RADV_DYNAMIC_PRIMITIVE_TOPOLOGY); RADV_CMP_COPY(vk.ia.primitive_restart_enable, RADV_DYNAMIC_PRIMITIVE_RESTART_ENABLE); - RADV_CMP_COPY(vk.vp.depth_clip_negative_one_to_one, RADV_DYNAMIC_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE); - if (copy_mask & RADV_DYNAMIC_LINE_WIDTH) { if (dest->vk.rs.line.width != src->vk.rs.line.width) { radv_cmd_set_line_width(cmd_buffer, src->vk.rs.line.width); @@ -254,6 +262,12 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dy } } + if (copy_mask & RADV_DYNAMIC_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE) { + if (dest->vk.vp.depth_clip_negative_one_to_one != src->vk.vp.depth_clip_negative_one_to_one) { + radv_cmd_set_depth_clip_negative_one_to_one(cmd_buffer, src->vk.vp.depth_clip_negative_one_to_one); + } + } + RADV_CMP_COPY(vk.rs.depth_bias.constant_factor, RADV_DYNAMIC_DEPTH_BIAS); RADV_CMP_COPY(vk.rs.depth_bias.clamp, RADV_DYNAMIC_DEPTH_BIAS); RADV_CMP_COPY(vk.rs.depth_bias.slope_factor, RADV_DYNAMIC_DEPTH_BIAS); @@ -8487,11 +8501,7 @@ VKAPI_ATTR void VKAPI_CALL radv_CmdSetDepthClipNegativeOneToOneEXT(VkCommandBuffer commandBuffer, VkBool32 negativeOneToOne) { VK_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer); - struct radv_cmd_state *state = &cmd_buffer->state; - - state->dynamic.vk.vp.depth_clip_negative_one_to_one = negativeOneToOne; - - state->dirty_dynamic |= RADV_DYNAMIC_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE; + radv_cmd_set_depth_clip_negative_one_to_one(cmd_buffer, negativeOneToOne); } VKAPI_ATTR void VKAPI_CALL