From a4f8c3c17c0a07225cbb15ab0e4ea2a16f6e055e Mon Sep 17 00:00:00 2001 From: Krzysztof Kondrak Date: Tue, 28 Apr 2020 00:30:09 +0200 Subject: [PATCH] Added VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT support. --- README.md | 2 +- ref_vk/vk_common.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a6607b73..25b949c2 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ The following commands are available when using the Vulkan renderer: | Command | Action | |-------------------------|:--------------------------------------------------------| -| `vk_validation` | Toggle validation layers:
`0` - disabled (default in Release)
`1` - only errors and warnings
`2` - full validation (default in Debug) | +| `vk_validation` | Toggle validation layers:
`0` - disabled (default in Release)
`1` - only errors and warnings
`2` - full validation (default in Debug)
`3` - enables `VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT` | | `vk_strings` | Print some basic Vulkan/GPU information. | | `vk_mem` | Print dynamic vertex/index/uniform/triangle fan buffer memory usage statistics. | | `vk_device` | Specify index of the preferred Vulkan device on systems with multiple GPUs:
`-1` - prefer first DISCRETE_GPU (default)
`0..n` - use device #n (full list of devices is returned by `vk_strings` command) | diff --git a/ref_vk/vk_common.c b/ref_vk/vk_common.c index 9dc70ac0..83512adc 100644 --- a/ref_vk/vk_common.c +++ b/ref_vk/vk_common.c @@ -1574,6 +1574,16 @@ qboolean QVk_Init() } ri.Con_Printf(PRINT_ALL, "\n"); + 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 + }; + VkInstanceCreateInfo createInfo = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = NULL, @@ -1584,6 +1594,9 @@ qboolean QVk_Init() .ppEnabledExtensionNames = (const char* const*)wantedExtensions }; + if (vk_validation->value > 2) + createInfo.pNext = &validationFeatures; + #if VK_HEADER_VERSION > 101 const char *validationLayers[] = { "VK_LAYER_KHRONOS_validation" }; #else