3
0
Fork 0
forked from suyu/suyu

vulkan_device: Enable robust buffers

This commit is contained in:
ReinUsesLisp 2021-01-16 20:39:06 -03:00
parent 1a987054c5
commit 40ed0cb920

View file

@ -379,7 +379,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
robustness2 = { robustness2 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT, .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT,
.pNext = nullptr, .pNext = nullptr,
.robustBufferAccess2 = false, .robustBufferAccess2 = true,
.robustImageAccess2 = true, .robustImageAccess2 = true,
.nullDescriptor = true, .nullDescriptor = true,
}; };
@ -570,6 +570,7 @@ void Device::CheckSuitability() const {
const VkPhysicalDeviceFeatures features{physical.GetFeatures()}; const VkPhysicalDeviceFeatures features{physical.GetFeatures()};
const std::array feature_report{ const std::array feature_report{
std::make_pair(features.vertexPipelineStoresAndAtomics, "vertexPipelineStoresAndAtomics"), std::make_pair(features.vertexPipelineStoresAndAtomics, "vertexPipelineStoresAndAtomics"),
std::make_pair(features.robustBufferAccess, "robustBufferAccess"),
std::make_pair(features.imageCubeArray, "imageCubeArray"), std::make_pair(features.imageCubeArray, "imageCubeArray"),
std::make_pair(features.independentBlend, "independentBlend"), std::make_pair(features.independentBlend, "independentBlend"),
std::make_pair(features.depthClamp, "depthClamp"), std::make_pair(features.depthClamp, "depthClamp"),
@ -738,7 +739,8 @@ std::vector<const char*> Device::LoadExtensions() {
robustness2.pNext = nullptr; robustness2.pNext = nullptr;
features.pNext = &robustness2; features.pNext = &robustness2;
physical.GetFeatures2KHR(features); physical.GetFeatures2KHR(features);
if (robustness2.nullDescriptor && robustness2.robustImageAccess2) { if (robustness2.nullDescriptor && robustness2.robustBufferAccess2 &&
robustness2.robustImageAccess2) {
extensions.push_back(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME); extensions.push_back(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
ext_robustness2 = true; ext_robustness2 = true;
} }