vulkan: fix some validation warnings

This commit is contained in:
niki
2022-08-30 20:28:18 +02:00
parent ec5a3a50f9
commit e409770be1
2 changed files with 14 additions and 1 deletions
+13 -1
View File
@@ -1079,6 +1079,9 @@ static void findOptionalDeviceExtensions(VkPhysicalDevice physicalDevice, Option
if (strcmp(extension.extensionName, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME) == 0) {
optionalDeviceFeatures.extendedDynamicState = true;
}
if (strcmp(extension.extensionName, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) {
optionalDeviceFeatures.physicalDeviceProperties2 = true;
}
}
}
@@ -1100,6 +1103,10 @@ void Graphics::createLogicalDevice() {
findOptionalDeviceExtensions(physicalDevice, optionalDeviceFeatures);
if (optionalDeviceFeatures.extendedDynamicState && !optionalDeviceFeatures.physicalDeviceProperties2) {
optionalDeviceFeatures.extendedDynamicState = false;
}
VkPhysicalDeviceFeatures deviceFeatures{};
deviceFeatures.samplerAnisotropy = VK_TRUE;
deviceFeatures.fillModeNonSolid = VK_TRUE;
@@ -1113,6 +1120,7 @@ void Graphics::createLogicalDevice() {
std::vector<const char*> enabledExtensions(deviceExtensions.begin(), deviceExtensions.end());
if (optionalDeviceFeatures.extendedDynamicState) {
enabledExtensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
enabledExtensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
}
@@ -1546,7 +1554,11 @@ VkRenderPass Graphics::createRenderPass(RenderPassConfiguration configuration) {
VkAttachmentDescription colorDescription{};
colorDescription.format = colorFormat;
colorDescription.samples = configuration.staticData.msaaSamples;
colorDescription.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
if (configuration.staticData.initialColorImageLayout != VK_IMAGE_LAYOUT_UNDEFINED) {
colorDescription.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
} else {
colorDescription.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
}
colorDescription.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
colorDescription.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
colorDescription.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+1
View File
@@ -80,6 +80,7 @@ struct FramebufferConfigurationHasher {
};
struct OptionalDeviceFeatures {
bool physicalDeviceProperties2 = false;
bool extendedDynamicState = false;
};