kk: Expose VK_EXT_image_2d_view_of_3d

Add missing flag for the 2d_view_of_3d, no further changes needed.

Signed-off-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39702>
This commit is contained in:
Aitor Camacho 2026-02-05 06:26:05 +09:00 committed by Marge Bot
parent 65bb2cd51e
commit f0b038cb7f
4 changed files with 11 additions and 29 deletions

View file

@ -638,7 +638,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_graphics_pipeline_library DONE (anv, hk, lvp, nvk, panvk, radv, tu, vn)
VK_EXT_hdr_metadata DONE (anv, hk, lvp, nvk, panvk, radv, tu, vn)
VK_EXT_headless_surface DONE (anv, dzn, hasvk, hk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_EXT_image_2d_view_of_3d DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv, tu, vn)
VK_EXT_image_2d_view_of_3d DONE (anv, hasvk, hk, kk, lvp, nvk, panvk, pvr, radv, tu, vn)
VK_EXT_image_compression_control DONE (anv/gfx12-, radv)
VK_EXT_image_drm_format_modifier DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv/gfx9+, tu, v3dv, vn)
VK_EXT_image_sliced_view_of_3d DONE (anv, hk, lvp, nvk, radv/gfx10+, vn)

View file

@ -605,7 +605,8 @@ kk_CreateImage(VkDevice _device, const VkImageCreateInfo *pCreateInfo,
VkResult result;
if (wsi_common_is_swapchain_image(pCreateInfo))
return wsi_common_create_swapchain_image(&pdev->wsi_device, pCreateInfo, pImage);
return wsi_common_create_swapchain_image(&pdev->wsi_device, pCreateInfo,
pImage);
image = vk_zalloc2(&dev->vk.alloc, pAllocator, sizeof(*image), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@ -844,12 +845,11 @@ kk_image_plane_bind(struct kk_device *dev, struct kk_image *image,
/* Create auxiliary 2D array texture for 3D images so we can use 2D views of
* it */
if (plane->layout.type == MTL_TEXTURE_TYPE_3D &&
(image->vk.create_flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT)) {
(image->vk.create_flags &
(VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT |
VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT))) {
struct kk_image_layout array_layout = plane->layout;
array_layout.type = MTL_TEXTURE_TYPE_2D_ARRAY;
// TODO_KOSMICKRISP We need to make sure that this doesn't go over Metal's
// layer maximum which is 2048. Probably by limiting the dimensions and
// layers for 3D images
array_layout.layers = array_layout.layers * array_layout.depth_px;
array_layout.depth_px = 1u;
plane->mtl_handle_array = mtl_new_texture_with_descriptor(

View file

@ -17,29 +17,6 @@
#include "vk_image.h"
/* Because small images can end up with an array_stride_B that is less than
* the sparse block size (in bytes), we have to set SINGLE_MIPTAIL_BIT when
* advertising sparse properties to the client. This means that we get one
* single memory range for the miptail of the image. For large images with
* mipTailStartLod > 0, we have to deal with the array stride ourselves.
*
* We do this by returning NVK_MIP_TAIL_START_OFFSET as the image's
* imageMipTailOffset. We can then detect anything with that address as
* being part of the miptail and re-map it accordingly. The Vulkan spec
* explicitly allows for this.
*
* From the Vulkan 1.3.279 spec:
*
* "When VK_SPARSE_MEMORY_BIND_METADATA_BIT is present, the resourceOffset
* must have been derived explicitly from the imageMipTailOffset in the
* sparse resource properties returned for the metadata aspect. By
* manipulating the value returned for imageMipTailOffset, the
* resourceOffset does not have to correlate directly to a device virtual
* address offset, and may instead be whatever value makes it easiest for
* the implementation to derive the correct device virtual address."
*/
#define NVK_MIP_TAIL_START_OFFSET 0x6d74000000000000UL
struct kk_device_memory;
struct kk_physical_device;
struct kk_queue;

View file

@ -136,6 +136,7 @@ kk_get_device_extensions(const struct kk_instance *instance,
.EXT_calibrated_timestamps = true,
.EXT_external_memory_metal = true,
.EXT_image_2d_view_of_3d = true,
.EXT_load_store_op_none = true,
.EXT_mutable_descriptor_type = true,
.EXT_shader_atomic_float = true,
@ -296,6 +297,10 @@ kk_get_device_features(
.formatA4R4G4B4 = true,
.formatA4B4G4R4 = true,
/* EXT_image_2d_view_of_3d */
.image2DViewOf3D = true,
.sampler2DViewOf3D = true,
/* VK_EXT_shader_replicated_composites */
.shaderReplicatedComposites = true,