KhronosGroup / KhronosGroup/Vulkan-Docs

Copying between different image aspects

Open
#2,079 5 comments 2 reactions 0 assignees View on GitHub
Feature Request
Dominant language
JavaScript
Stars
3.3k
Forks
549
Avg merge
5d 5h
Merged PRs (30d)
2

Description

Hello,

When copying images, it would be really useful to allow copying between different image aspects, namely copying from a color image to depth or stencil planes of a depthbuffer. This is something that is supported by DirectX 12, and in Vulkan there is no good substitute currently, especially for stencil because stencil can not be exported on a per pixel level on many GPUs.

The use case is that depth or stencil color texture is created in a compute pipeline with appropriate formats (eg. R32_FLOAT for depth, R8_UINT for stencil). Then the depth and stencil color textures would be copied to the corresponding planes of a D32S8 format depth buffer. Example:

```cpp
VkImageCopy copy = {};
copy.dstSubresource.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
copy.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
// ...
vkCmdCopyImage(
commandbuffer,
src_resource, // source image in VK_FORMAT_R8_UINT
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
dst_resource, // destination image in VK_FORMAT_D32_SFLOAT_S8_UINT
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1,
©
);
```

Apologies if this is not an appropriate issue.

Best regards,
Janos

Contributor guide

Open the contributing guide

Research direction

Start with the VkImageCopy structure and vkCmdCopyImage entry point described in the issue, then review the Vulkan image-aspect rules relevant to color, depth, and stencil planes. Compare the requested behavior with the stated DirectX 12 support and Vulkan limitations. Done means reaching and documenting a specification decision for cross-aspect copies, including the cited depth and stencil cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.