1// Copyright 2021-2023 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5# VK_EXT_image_2d_array_of_3d 6:toc: left 7:refpage: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/ 8:sectnums: 9 10This document proposes adding support for creating 2D views of 3D images. 11 12## Problem Statement 13 14Other graphics APIs, such as OpenGL, provide functionality for creating two dimensional views of three dimensional images for use in shaders. 15When performing similar operations in Vulkan, this functionality may be emulated in shaders, but many implementations are capable of handling it at the execution level to avoid needing more shader variants or uniform or push constant data. 16 17This proposal aims to provide this functionality. 18 19 20## Solution Space 21 22This functionality could alternatively be emulated with: 23 . Shader variants which each access the intended slice of the 3D image 24 . The use of either uniform or push constant data to dynamically access the intended slice of the 3D image 25 26Neither of these methods solves the more fundamental problem of having an API mismatch which complicates both transitioning from OpenGL to Vulkan and emulating OpenGL on Vulkan. 27 28## Proposal 29 30### API Features 31 32The following features are exposed by this extension: 33 34[source,c] 35---- 36typedef struct VkPhysicalDeviceImage2DViewOf3DFeaturesEXT { 37 VkStructureType sType; 38 void* pNext; 39 VkBool32 image2DViewOf3D; 40 VkBool32 sampler2DViewOf3D; 41} VkPhysicalDeviceImage2DViewOf3DFeaturesEXT; 42---- 43 44`image2DViewOf3D` is the core feature enabling this extension's functionality. 45`sampler2DViewOf3D` indicates that the driver supports 2D views of 3D textures. 46 47 48Using the `VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT` flag when creating a 3D image enables this functionality for that image. 49 50 51## Examples 52 53As an example, if an application creates a `VkImage` of type `VK_IMAGE_TYPE_3D` with two layers and wants to only access the zero-th layer in a shader, `VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT` can be used to create the image. A `VkImageView` is then created with `VK_IMAGE_VIEW_TYPE_2D`, and the shader can then access the image data using two-dimensional image operations. 54 55## Issues 56 57No known issues. 58