diff --git a/docs/features.txt b/docs/features.txt index d914f4b8081..d3884ec8051 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -524,7 +524,7 @@ Khronos extensions that are not part of any Vulkan version: VK_KHR_index_type_uint8 DONE (anv, nvk, pvr, radv, tu, v3dv) VK_KHR_line_rasterization DONE (anv, nvk, radv, tu, v3dv) VK_KHR_load_store_op_none DONE (anv, nvk, radv, tu, v3dv) - VK_KHR_maintenance5 DONE (anv, lvp, nvk, radv, tu) + VK_KHR_maintenance5 DONE (anv, lvp, nvk, radv, tu, vn) VK_KHR_maintenance6 DONE (anv, lvp, nvk, radv) VK_KHR_performance_query DONE (anv, radv/gfx10.3+, tu, v3dv) VK_KHR_pipeline_executable_properties DONE (anv, nvk, hasvk, radv, tu, v3dv) diff --git a/src/virtio/vulkan/vn_command_buffer.c b/src/virtio/vulkan/vn_command_buffer.c index 740d54735a1..993e3066df9 100644 --- a/src/virtio/vulkan/vn_command_buffer.c +++ b/src/virtio/vulkan/vn_command_buffer.c @@ -1190,6 +1190,17 @@ vn_CmdBindIndexBuffer(VkCommandBuffer commandBuffer, indexType); } +void +vn_CmdBindIndexBuffer2KHR(VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType) +{ + VN_CMD_ENQUEUE(vkCmdBindIndexBuffer2KHR, commandBuffer, buffer, offset, + size, indexType); +} + void vn_CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, diff --git a/src/virtio/vulkan/vn_image.c b/src/virtio/vulkan/vn_image.c index ebe472390e5..6584beaf38f 100644 --- a/src/virtio/vulkan/vn_image.c +++ b/src/virtio/vulkan/vn_image.c @@ -1144,3 +1144,59 @@ vn_GetDeviceImageSparseMemoryRequirements( dev->primary_ring, device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); } + +void +vn_GetDeviceImageSubresourceLayoutKHR(VkDevice device, + const VkDeviceImageSubresourceInfoKHR *pInfo, + VkSubresourceLayout2KHR *pLayout) +{ + struct vn_device *dev = vn_device_from_handle(device); + + /* TODO per-device cache */ + vn_call_vkGetDeviceImageSubresourceLayoutKHR( + dev->primary_ring, device, pInfo, pLayout); +} + +void +vn_GetImageSubresourceLayout2KHR(VkDevice device, + VkImage image, + const VkImageSubresource2KHR *pSubresource, + VkSubresourceLayout2KHR *pLayout) +{ + struct vn_device *dev = vn_device_from_handle(device); + struct vn_image *img = vn_image_from_handle(image); + + /* override aspect mask for wsi/ahb images with tiling modifier */ + VkImageSubresource2KHR local_subresource; + if ((img->wsi.is_wsi && img->wsi.tiling_override == + VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) || + img->deferred_info) { + VkImageAspectFlags aspect = pSubresource->imageSubresource.aspectMask; + switch (aspect) { + case VK_IMAGE_ASPECT_COLOR_BIT: + case VK_IMAGE_ASPECT_DEPTH_BIT: + case VK_IMAGE_ASPECT_STENCIL_BIT: + case VK_IMAGE_ASPECT_PLANE_0_BIT: + aspect = VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT; + break; + case VK_IMAGE_ASPECT_PLANE_1_BIT: + aspect = VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT; + break; + case VK_IMAGE_ASPECT_PLANE_2_BIT: + aspect = VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT; + break; + default: + break; + } + + /* only handle supported aspect override */ + if (aspect != pSubresource->imageSubresource.aspectMask) { + local_subresource = *pSubresource; + local_subresource.imageSubresource.aspectMask = aspect; + pSubresource = &local_subresource; + } + } + + vn_call_vkGetImageSubresourceLayout2KHR( + dev->primary_ring, device, image, pSubresource, pLayout); +} diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index 3391362a9a7..9c5ab0681f3 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -162,6 +162,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) /* KHR */ VkPhysicalDeviceFragmentShadingRateFeaturesKHR fragment_shading_rate; + VkPhysicalDeviceMaintenance5FeaturesKHR maintenance5; VkPhysicalDeviceShaderClockFeaturesKHR shader_clock; VkPhysicalDeviceShaderExpectAssumeFeaturesKHR expect_assume; @@ -269,6 +270,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) VN_ADD_PNEXT_EXT(feats2, FRAGMENT_SHADING_RATE_FEATURES_KHR, local_feats.fragment_shading_rate, exts->KHR_fragment_shading_rate); VN_ADD_PNEXT_EXT(feats2, SHADER_CLOCK_FEATURES_KHR, local_feats.shader_clock, exts->KHR_shader_clock); VN_ADD_PNEXT_EXT(feats2, SHADER_EXPECT_ASSUME_FEATURES_KHR, local_feats.expect_assume, exts->KHR_shader_expect_assume); + VN_ADD_PNEXT_EXT(feats2, MAINTENANCE_5_FEATURES_KHR, local_feats.maintenance5, exts->KHR_maintenance5); /* EXT */ VN_ADD_PNEXT_EXT(feats2, ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT, local_feats.attachment_feedback_loop_layout, exts->EXT_attachment_feedback_loop_layout); @@ -1090,6 +1092,7 @@ vn_physical_device_get_passthrough_extensions( /* KHR */ .KHR_fragment_shading_rate = true, + .KHR_maintenance5 = true, .KHR_pipeline_library = true, .KHR_push_descriptor = true, .KHR_shader_clock = true, diff --git a/src/virtio/vulkan/vn_render_pass.c b/src/virtio/vulkan/vn_render_pass.c index ce800b6b224..3110dba63e0 100644 --- a/src/virtio/vulkan/vn_render_pass.c +++ b/src/virtio/vulkan/vn_render_pass.c @@ -334,6 +334,18 @@ vn_GetRenderAreaGranularity(VkDevice device, *pGranularity = pass->granularity; } +void +vn_GetRenderingAreaGranularityKHR(VkDevice device, + const VkRenderingAreaInfoKHR *pRenderingAreaInfo, + VkExtent2D *pGranularity) +{ + struct vn_device *dev = vn_device_from_handle(device); + + /* TODO per-device cache */ + vn_call_vkGetRenderingAreaGranularityKHR(dev->primary_ring, device, + pRenderingAreaInfo, pGranularity); +} + /* framebuffer commands */ VkResult