Vulkan: Enable the portability subset features MoltenVK has

We queried VkPhysicalDevicePortabilitySubsetFeaturesKHR but never enabled
it at device creation, so to the validation layers we were using image
view swizzles (and sampler LOD bias) without having them. Enable whatever
the device offers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-22 18:46:43 +02:00
1 parent db6cc41b9d
commit b46e386f12
1 file changed
+10
+10
View File
@@ -889,6 +889,13 @@ VkResult VulkanContext::CreateDevice(int physical_device, const std::vector<cons
deviceFeatures_.enabled.scalarBlockLayout.scalarBlockLayout = deviceFeatures_.available.scalarBlockLayout.scalarBlockLayout;
}
// What MoltenVK can do of what full Vulkan can (like image view swizzles). Using any of it needs it enabled.
deviceFeatures_.enabled.portabilitySubset = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR };
if (extensionsLookup_.KHR_portability_subset) {
deviceFeatures_.enabled.portabilitySubset = deviceFeatures_.available.portabilitySubset;
deviceFeatures_.enabled.portabilitySubset.pNext = nullptr;
}
// deviceFeatures_.enabled.multiview.multiviewGeometryShader = deviceFeatures_.available.multiview.multiviewGeometryShader;
VkPhysicalDeviceFeatures2 features2{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 };
@@ -920,6 +927,9 @@ VkResult VulkanContext::CreateDevice(int physical_device, const std::vector<cons
if (extensionsLookup_.KHR_present_mode_fifo_latest_ready) {
ChainStruct(features2, &deviceFeatures_.enabled.presentModeFifoProps);
}
if (extensionsLookup_.KHR_portability_subset) {
ChainStruct(features2, &deviceFeatures_.enabled.portabilitySubset);
}
} else {
device_info.pEnabledFeatures = &deviceFeatures_.enabled.standard;
}