Skip to content

Commit

Permalink
Added VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT support.
Browse files Browse the repository at this point in the history
  • Loading branch information
kondrak committed Apr 27, 2020
1 parent 7d13abe commit a4f8c3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The following commands are available when using the Vulkan renderer:

| Command | Action |
|-------------------------|:--------------------------------------------------------|
| `vk_validation` | Toggle validation layers:<br>`0` - disabled (default in Release)<br> `1` - only errors and warnings<br>`2` - full validation (default in Debug) |
| `vk_validation` | Toggle validation layers:<br>`0` - disabled (default in Release)<br> `1` - only errors and warnings<br>`2` - full validation (default in Debug)<br>`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:<br>`-1` - prefer first DISCRETE_GPU (default)<br>`0..n` - use device #n (full list of devices is returned by `vk_strings` command) |
Expand Down
13 changes: 13 additions & 0 deletions ref_vk/vk_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit a4f8c3c

Please sign in to comment.