From 9fa023f11107669540f0418feed7f9dc4984ff32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Sun, 24 Mar 2024 11:48:18 +0100 Subject: [PATCH] v3dv: DepthBoundsTestEnable is dynamic now Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 3 ++- src/broadcom/vulkan/v3dv_pipeline.c | 6 ------ src/broadcom/vulkan/v3dvx_cmd_buffer.c | 14 ++++++++++++++ src/broadcom/vulkan/v3dvx_pipeline.c | 3 --- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index fcf1e2618d2..8fac620edb5 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -3005,7 +3005,8 @@ v3dv_cmd_buffer_emit_pre_draw(struct v3dv_cmd_buffer *cmd_buffer, if (*dirty & (V3DV_CMD_DIRTY_PIPELINE) || BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_CULL_MODE) || - BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_FRONT_FACE)) { + BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_FRONT_FACE) || + BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_DS_DEPTH_BOUNDS_TEST_ENABLE)) { v3dv_X(device, cmd_buffer_emit_configuration_bits)(cmd_buffer); } diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 28e3c04a38a..ba46aae5974 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -2958,12 +2958,6 @@ pipeline_init(struct v3dv_pipeline *pipeline, if (depth_clip_control) pipeline->negative_one_to_one = depth_clip_control->negativeOneToOne; - /* V3D 4.2 doesn't support depth bounds testing so we don't advertise that - * feature and it shouldn't be used by any pipeline. - */ - assert(device->devinfo.ver >= 71 || - !ds_info || !ds_info->depthBoundsTestEnable); - enable_depth_bias(pipeline, rs_info); v3dv_X(device, pipeline_pack_state)(pipeline, cb_info, ds_info, diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c index 2b27ebf2c94..77e0af05ad9 100644 --- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c @@ -1965,10 +1965,24 @@ v3dX(cmd_buffer_emit_configuration_bits)(struct v3dv_cmd_buffer *cmd_buffer) /* Seems like the hardware is backwards regarding this setting... */ config.clockwise_primitives = dyn->rs.front_face == VK_FRONT_FACE_COUNTER_CLOCKWISE; } + + /* V3D 4.2 doesn't support depth bounds testing so we don't advertise that + * feature and it shouldn't be used by any pipeline. + */ + assert(cmd_buffer->device->devinfo.ver >= 71 || + !dyn->ds.depth.bounds_test.enable); +#if V3D_VERSION >= 71 + bool has_depth = + pipeline->rendering_info.depth_attachment_format != VK_FORMAT_UNDEFINED; + + config.depth_bounds_test_enable = + dyn->ds.depth.bounds_test.enable && has_depth; +#endif } BITSET_CLEAR(dyn->dirty, MESA_VK_DYNAMIC_RS_CULL_MODE); BITSET_CLEAR(dyn->dirty, MESA_VK_DYNAMIC_RS_FRONT_FACE); + BITSET_CLEAR(dyn->dirty, MESA_VK_DYNAMIC_DS_DEPTH_BOUNDS_TEST_ENABLE); } void diff --git a/src/broadcom/vulkan/v3dvx_pipeline.c b/src/broadcom/vulkan/v3dvx_pipeline.c index 9c72ced6f13..38e640deefc 100644 --- a/src/broadcom/vulkan/v3dvx_pipeline.c +++ b/src/broadcom/vulkan/v3dvx_pipeline.c @@ -246,9 +246,6 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline, } config.z_clamp_mode = z_clamp_enable; - - config.depth_bounds_test_enable = - ds_info && ds_info->depthBoundsTestEnable && has_depth; #endif }; }