summaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2022-04-23 14:41:59 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2022-04-23 14:41:59 +0200
commit3f7e34a0fa4f55d322cddc2a9fd353aa2a3ad49f (patch)
tree9a5da235f9473a043b6b1d3b407e04e855a015cf /src
parent583dd02b4e87f267b1bb886dc2af44f86966ac60 (diff)
dev.stencilAspect code simplification
Diffstat (limited to 'src')
-rw-r--r--src/vkvg_device_internal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vkvg_device_internal.c b/src/vkvg_device_internal.c
index 828e01d..ef045f1 100644
--- a/src/vkvg_device_internal.c
+++ b/src/vkvg_device_internal.c
@@ -517,7 +517,6 @@ void _device_create_empty_texture (VkvgDevice dev, VkFormat format, VkImageTilin
vkh_cmd_end (dev->cmd);
_device_submit_cmd (dev, &dev->cmd, dev->fence);
}
-#define VKVG_SET_STENCIL_ASPECT dev->stencilAspectFlag = (dev->stencilFormat == VK_FORMAT_S8_UINT) ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
void _device_check_best_image_tiling (VkvgDevice dev, VkFormat format) {
VkFlags stencilFormats[] = { VK_FORMAT_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT };
VkFormatProperties phyStencilProps = { 0 }, phyImgProps = { 0 };
@@ -543,6 +542,7 @@ void _device_check_best_image_tiling (VkvgDevice dev, VkFormat format) {
LOG(VKVG_LOG_DEBUG, "vkvg create device failed: no suitable image format for png write\n");
dev->stencilFormat = VK_FORMAT_UNDEFINED;
+ dev->stencilAspectFlag = VK_IMAGE_ASPECT_STENCIL_BIT;
dev->supportedTiling = 0xff;
vkGetPhysicalDeviceFormatProperties(dev->phy, format, &phyImgProps);
@@ -553,7 +553,8 @@ void _device_check_best_image_tiling (VkvgDevice dev, VkFormat format) {
vkGetPhysicalDeviceFormatProperties(dev->phy, stencilFormats[i], &phyStencilProps);
if (phyStencilProps.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
dev->stencilFormat = stencilFormats[i];
- VKVG_SET_STENCIL_ASPECT
+ if (i > 0)
+ dev->stencilAspectFlag |= VK_IMAGE_ASPECT_DEPTH_BIT;
dev->supportedTiling = VK_IMAGE_TILING_OPTIMAL;
return;
}
@@ -565,7 +566,8 @@ void _device_check_best_image_tiling (VkvgDevice dev, VkFormat format) {
vkGetPhysicalDeviceFormatProperties(dev->phy, stencilFormats[i], &phyStencilProps);
if (phyStencilProps.linearTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
dev->stencilFormat = stencilFormats[i];
- VKVG_SET_STENCIL_ASPECT
+ if (i > 0)
+ dev->stencilAspectFlag |= VK_IMAGE_ASPECT_DEPTH_BIT;
dev->supportedTiling = VK_IMAGE_TILING_LINEAR;
return;
}