Skip to content

Commit

Permalink
Enable the fault feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Jan 28, 2025
1 parent c923ed2 commit af6ec41
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions libraries/ZVulkan/include/zvulkan/vulkaninstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class VulkanDeviceFeatures
VkPhysicalDeviceAccelerationStructureFeaturesKHR AccelerationStructure = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR };
VkPhysicalDeviceRayQueryFeaturesKHR RayQuery = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR };
VkPhysicalDeviceDescriptorIndexingFeatures DescriptorIndexing = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT };
VkPhysicalDeviceFaultFeaturesEXT Fault = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT };
};

class VulkanDeviceProperties
Expand Down
1 change: 1 addition & 0 deletions libraries/ZVulkan/src/vulkanbuilders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,7 @@ std::vector<VulkanCompatibleDevice> VulkanDeviceBuilder::FindDevices(const std::
enabledFeatures.DescriptorIndexing.descriptorBindingSampledImageUpdateAfterBind = deviceFeatures.DescriptorIndexing.descriptorBindingSampledImageUpdateAfterBind;
enabledFeatures.DescriptorIndexing.descriptorBindingVariableDescriptorCount = deviceFeatures.DescriptorIndexing.descriptorBindingVariableDescriptorCount;
enabledFeatures.DescriptorIndexing.shaderSampledImageArrayNonUniformIndexing = deviceFeatures.DescriptorIndexing.shaderSampledImageArrayNonUniformIndexing;
enabledFeatures.Fault.deviceFault = deviceFeatures.Fault.deviceFault;

// Figure out which queue can present
if (surface)
Expand Down
7 changes: 6 additions & 1 deletion libraries/ZVulkan/src/vulkandevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ void VulkanDevice::CreateDevice()
*next = &EnabledFeatures.DescriptorIndexing;
next = &EnabledFeatures.DescriptorIndexing.pNext;
}
if (SupportsExtension(VK_EXT_DEVICE_FAULT_EXTENSION_NAME))
{
*next = &EnabledFeatures.Fault;
next = &EnabledFeatures.Fault.pNext;
}

VkResult result = vkCreateDevice(PhysicalDevice.Device, &deviceCreateInfo, nullptr, &device);
CheckVulkanError(result, "Could not create vulkan device");
Expand Down Expand Up @@ -174,7 +179,7 @@ void VulkanDevice::SetObjectName(const char* name, uint64_t handle, VkObjectType

VulkanDeviceFaultInfo VulkanDevice::GetDeviceFaultInfo()
{
if (!SupportsExtension(VK_EXT_DEVICE_FAULT_EXTENSION_NAME))
if (!SupportsExtension(VK_EXT_DEVICE_FAULT_EXTENSION_NAME) || !EnabledFeatures.Fault.deviceFault)
return {};

VkDeviceFaultCountsEXT counts = { VK_STRUCTURE_TYPE_DEVICE_FAULT_COUNTS_EXT };
Expand Down
6 changes: 6 additions & 0 deletions libraries/ZVulkan/src/vulkaninstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,19 @@ std::vector<VulkanPhysicalDevice> VulkanInstance::GetPhysicalDevices(VkInstance
*next = &dev.Features.DescriptorIndexing;
next = &dev.Features.DescriptorIndexing.pNext;
}
if (checkForExtension(VK_EXT_DEVICE_FAULT_EXTENSION_NAME))
{
*next = &dev.Features.Fault;
next = &dev.Features.Fault.pNext;
}

vkGetPhysicalDeviceFeatures2(dev.Device, &deviceFeatures2);
dev.Features.Features = deviceFeatures2.features;
dev.Features.BufferDeviceAddress.pNext = nullptr;
dev.Features.AccelerationStructure.pNext = nullptr;
dev.Features.RayQuery.pNext = nullptr;
dev.Features.DescriptorIndexing.pNext = nullptr;
dev.Features.Fault.pNext = nullptr;
}
else
{
Expand Down

0 comments on commit af6ec41

Please sign in to comment.