Enable VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT only if the SDK supports it.

This commit is contained in:
Krzysztof Kondrak 2020-05-05 17:30:38 +02:00 committed by Yamagi
parent 7eb075198e
commit 7784b197ca
2 changed files with 19 additions and 1 deletions

View file

@ -1645,6 +1645,25 @@ qboolean QVk_Init(SDL_Window *window)
.ppEnabledExtensionNames = (const char* const*)wantedExtensions .ppEnabledExtensionNames = (const char* const*)wantedExtensions
}; };
// introduced in SDK 1.1.121
#if VK_HEADER_VERSION > 114
VkValidationFeatureEnableEXT validationFeaturesEnable[] = { VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT };
VkValidationFeaturesEXT validationFeatures = {
.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT,
.pNext = NULL,
.enabledValidationFeatureCount = sizeof(validationFeaturesEnable) / sizeof(validationFeaturesEnable[0]),
.pEnabledValidationFeatures = validationFeaturesEnable,
.disabledValidationFeatureCount = 0,
.pDisabledValidationFeatures = NULL
};
if (vk_validation->value > 1)
{
createInfo.pNext = &validationFeatures;
}
#endif
// introduced in SDK 1.1.106
#if VK_HEADER_VERSION > 101 #if VK_HEADER_VERSION > 101
const char *validationLayers[] = { "VK_LAYER_KHRONOS_validation" }; const char *validationLayers[] = { "VK_LAYER_KHRONOS_validation" };
#else #else

View file

@ -53,7 +53,6 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsCallback(VkDebugUtilsMessageSeve
break; break;
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
R_Printf(PRINT_ALL, "VK_WARNING: %s %s\n", callbackData->pMessage, msgToString(msgType)); R_Printf(PRINT_ALL, "VK_WARNING: %s %s\n", callbackData->pMessage, msgToString(msgType));
assert(!"Vulkan warning occured!");
break; break;
default: default:
R_Printf(PRINT_ALL, "VK_ERROR: %s %s\n", callbackData->pMessage, msgToString(msgType)); R_Printf(PRINT_ALL, "VK_ERROR: %s %s\n", callbackData->pMessage, msgToString(msgType));