From 21936e8493ab91bd4d2745de15384002de013238 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 13 May 2020 11:21:12 +0200 Subject: [PATCH] v3dv: ignore dynamic updates of depth bounds state Depth bounds testing is not available in V3D 4.2 so we just ignore this piece of state and assert if any pipeline attempts to enable the feature. Part-of: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 10 ++++++++++ src/broadcom/vulkan/v3dv_device.c | 2 +- src/broadcom/vulkan/v3dv_meta_clear.c | 1 - src/broadcom/vulkan/v3dv_meta_copy.c | 1 - src/broadcom/vulkan/v3dv_pipeline.c | 13 +++++++++++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index e45ddc3..47f7700 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -3429,6 +3429,16 @@ v3dv_CmdSetDepthBias(VkCommandBuffer commandBuffer, } void +v3dv_CmdSetDepthBounds(VkCommandBuffer commandBuffer, + float minDepthBounds, + float maxDepthBounds) +{ + /* We do not support depth bounds testing so we just ingore this. We are + * already asserting that pipelines don't enable the feature anyway. + */ +} + +void v3dv_CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout _layout, diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 87750ad..9c010a3 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -552,7 +552,7 @@ v3dv_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, .depthClamp = false, .depthBiasClamp = false, .fillModeNonSolid = false, - .depthBounds = false, + .depthBounds = false, /* Only available since V3D 4.3.16.2 */ .wideLines = false, .largePoints = false, .alphaToOne = false, diff --git a/src/broadcom/vulkan/v3dv_meta_clear.c b/src/broadcom/vulkan/v3dv_meta_clear.c index e4d8c5c..d90bc06 100644 --- a/src/broadcom/vulkan/v3dv_meta_clear.c +++ b/src/broadcom/vulkan/v3dv_meta_clear.c @@ -229,7 +229,6 @@ create_pipeline(struct v3dv_device *device, VK_DYNAMIC_STATE_DEPTH_BIAS, #if 0 VK_DYNAMIC_STATE_LINE_WIDTH, - VK_DYNAMIC_STATE_DEPTH_BOUNDS, #endif }, }, diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index 346e7f0..07414ce 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -3049,7 +3049,6 @@ create_pipeline(struct v3dv_device *device, VK_DYNAMIC_STATE_DEPTH_BIAS, #if 0 VK_DYNAMIC_STATE_LINE_WIDTH, - VK_DYNAMIC_STATE_DEPTH_BOUNDS, #endif }, }, diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index bb015b3..f9c7036 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -1541,6 +1541,14 @@ v3dv_dynamic_state_mask(VkDynamicState state) return V3DV_DYNAMIC_BLEND_CONSTANTS; case VK_DYNAMIC_STATE_DEPTH_BIAS: return V3DV_DYNAMIC_DEPTH_BIAS; + + /* Depth bounds testing is not available in in V3D 4.2 so here we are just + * ignoring this dynamic state. We are already asserting at pipeline creation + * time that depth bounds testing is not enabled. + */ + case VK_DYNAMIC_STATE_DEPTH_BOUNDS: + return 0; + default: unreachable("Unhandled dynamic state"); } @@ -2313,6 +2321,11 @@ pipeline_init(struct v3dv_pipeline *pipeline, const VkPipelineColorBlendStateCreateInfo *cb_info = raster_enabled ? pCreateInfo->pColorBlendState : NULL; + /* 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(!ds_info || !ds_info->depthBoundsTestEnable); + pack_blend(pipeline, cb_info); pack_cfg_bits(pipeline, ds_info, rs_info); pack_stencil_cfg(pipeline, ds_info); -- 2.7.4