Skip to content

Commit

Permalink
Support additional VK_KHR_format_feature_flags2 format feature flags.
Browse files Browse the repository at this point in the history
- VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT
- VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT
- VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT
  • Loading branch information
billhollings committed Jan 6, 2024
1 parent d481226 commit 39efdd9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,9 @@
VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT |
VK_FORMAT_FEATURE_2_BLIT_SRC_BIT),
kMVKVkFormatFeatureFlagsTexFilter = (VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT),
kMVKVkFormatFeatureFlagsTexWrite = (VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT),
kMVKVkFormatFeatureFlagsTexWrite = (VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT |
VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT |
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT),
kMVKVkFormatFeatureFlagsTexAtomic = (VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT),
kMVKVkFormatFeatureFlagsTexColorAtt = (VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_2_BLIT_DST_BIT),
Expand Down Expand Up @@ -2106,6 +2108,10 @@
enableFormatFeatures(DSAtt, Tex, mtlPixFmtCaps, vkProps.optimalTilingFeatures);
enableFormatFeatures(Blend, Tex, mtlPixFmtCaps, vkProps.optimalTilingFeatures);

if (isDepthFormat(vkDesc.mtlPixelFormat) && mvkIsAnyFlagEnabled(vkProps.optimalTilingFeatures, VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT)) {
vkProps.optimalTilingFeatures |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT;
}

// We would really want to use the device's Metal features instead of duplicating
// the logic from MVKPhysicalDevice, but those may not have been initialized yet.
id<MTLDevice> mtlDev = _physicalDevice ? _physicalDevice->getMTLDevice() : nil;
Expand Down

0 comments on commit 39efdd9

Please sign in to comment.