diff --git a/src/nouveau/vulkan/nvk_cmd_draw.c b/src/nouveau/vulkan/nvk_cmd_draw.c index a7259992ff0..7e41da89bf6 100644 --- a/src/nouveau/vulkan/nvk_cmd_draw.c +++ b/src/nouveau/vulkan/nvk_cmd_draw.c @@ -926,18 +926,25 @@ nvk_flush_vp_state(struct nvk_cmd_buffer *cmd) /* Nothing to do for MESA_VK_DYNAMIC_VP_VIEWPORT_COUNT */ - if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORTS)) { + if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORTS) || + BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE)) { for (uint32_t i = 0; i < dyn->vp.viewport_count; i++) { const VkViewport *vp = &dyn->vp.viewports[i]; P_MTHD(p, NV9097, SET_VIEWPORT_SCALE_X(i)); P_NV9097_SET_VIEWPORT_SCALE_X(p, i, fui(0.5f * vp->width)); P_NV9097_SET_VIEWPORT_SCALE_Y(p, i, fui(0.5f * vp->height)); - P_NV9097_SET_VIEWPORT_SCALE_Z(p, i, fui(vp->maxDepth - vp->minDepth)); + if (dyn->vp.depth_clip_negative_one_to_one) + P_NV9097_SET_VIEWPORT_SCALE_Z(p, i, fui(0.5f * (vp->maxDepth - vp->minDepth))); + else + P_NV9097_SET_VIEWPORT_SCALE_Z(p, i, fui(vp->maxDepth - vp->minDepth)); P_NV9097_SET_VIEWPORT_OFFSET_X(p, i, fui(vp->x + 0.5f * vp->width)); P_NV9097_SET_VIEWPORT_OFFSET_Y(p, i, fui(vp->y + 0.5f * vp->height)); - P_NV9097_SET_VIEWPORT_OFFSET_Z(p, i, fui(vp->minDepth)); + if (dyn->vp.depth_clip_negative_one_to_one) + P_NV9097_SET_VIEWPORT_OFFSET_Z(p, i, fui(0.5f * (vp->minDepth + vp->maxDepth))); + else + P_NV9097_SET_VIEWPORT_OFFSET_Z(p, i, fui(vp->minDepth)); float xmin = vp->x; float xmax = vp->x + vp->width; diff --git a/src/nouveau/vulkan/nvk_physical_device.c b/src/nouveau/vulkan/nvk_physical_device.c index bf1bbeab6ff..a3a663e3a67 100644 --- a/src/nouveau/vulkan/nvk_physical_device.c +++ b/src/nouveau/vulkan/nvk_physical_device.c @@ -374,6 +374,7 @@ nvk_get_device_extensions(const struct nv_device_info *info, .EXT_border_color_swizzle = true, .EXT_buffer_device_address = true, .EXT_custom_border_color = true, + .EXT_depth_clip_control = true, .EXT_descriptor_indexing = true, .EXT_extended_dynamic_state = true, .EXT_extended_dynamic_state2 = true, @@ -525,6 +526,9 @@ nvk_get_device_features(const struct nv_device_info *info, .customBorderColors = true, .customBorderColorWithoutFormat = true, + /* VK_EXT_depth_clip_control */ + .depthClipControl = true, + /* VK_EXT_extended_dynamic_state */ .extendedDynamicState = true,