Only apply stencil flag if selected format has a stencil part

Refs #947
This commit is contained in:
Sascha Willems 2022-05-14 11:44:57 +02:00
parent 8c376121c3
commit 570ba6da47
3 changed files with 19 additions and 3 deletions

View file

@ -196,7 +196,10 @@ public:
depthStencilView.format = depthFormat;
depthStencilView.flags = 0;
depthStencilView.subresourceRange = {};
depthStencilView.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
depthStencilView.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
if (vks::tools::formatHasStencil(depthFormat)) {
depthStencilView.subresourceRange.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
}
depthStencilView.subresourceRange.baseMipLevel = 0;
depthStencilView.subresourceRange.levelCount = 1;
depthStencilView.subresourceRange.baseArrayLayer = 0;