r_validation CVar to take in account only when positive.

This commit is contained in:
David Carlier 2022-12-13 21:51:44 +00:00
parent 39738797a1
commit 3907262678
5 changed files with 17 additions and 17 deletions

View file

@ -1749,7 +1749,7 @@ qboolean QVk_Init(void)
} }
// add space for validation layer // add space for validation layer
if (r_validation->value) if (r_validation->value > 0)
extCount++; extCount++;
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) && defined(__APPLE__) #if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) && defined(__APPLE__)
@ -1766,7 +1766,7 @@ qboolean QVk_Init(void)
} }
// restore extensions count // restore extensions count
if (r_validation->value) if (r_validation->value > 0)
{ {
extCount++; extCount++;
wantedExtensions[extCount - 1] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME; wantedExtensions[extCount - 1] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
@ -1855,7 +1855,7 @@ qboolean QVk_Init(void)
const char *validationLayers[] = { "VK_LAYER_LUNARG_standard_validation" }; const char *validationLayers[] = { "VK_LAYER_LUNARG_standard_validation" };
#endif #endif
if (r_validation->value) if (r_validation->value > 0)
{ {
createInfo.enabledLayerCount = sizeof(validationLayers) / sizeof(validationLayers[0]); createInfo.enabledLayerCount = sizeof(validationLayers) / sizeof(validationLayers[0]);
createInfo.ppEnabledLayerNames = validationLayers; createInfo.ppEnabledLayerNames = validationLayers;
@ -1867,7 +1867,7 @@ qboolean QVk_Init(void)
VkResult res = vkCreateInstance(&createInfo, NULL, &vk_instance); VkResult res = vkCreateInstance(&createInfo, NULL, &vk_instance);
if (res == VK_ERROR_LAYER_NOT_PRESENT && r_validation->value) { if (res == VK_ERROR_LAYER_NOT_PRESENT && r_validation->value > 0) {
// we give a "last try" if the validation layer fails // we give a "last try" if the validation layer fails
// before falling back to a GL renderer // before falling back to a GL renderer
createInfo.enabledLayerCount = 0; createInfo.enabledLayerCount = 0;
@ -1889,7 +1889,7 @@ qboolean QVk_Init(void)
volkLoadInstance(vk_instance); volkLoadInstance(vk_instance);
R_Printf(PRINT_ALL, "...created Vulkan instance\n"); R_Printf(PRINT_ALL, "...created Vulkan instance\n");
if (r_validation->value) if (r_validation->value > 0)
{ {
// initialize function pointers // initialize function pointers
qvkCreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkCreateDebugUtilsMessengerEXT"); qvkCreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkCreateDebugUtilsMessengerEXT");
@ -1911,7 +1911,7 @@ qboolean QVk_Init(void)
qvkInsertDebugUtilsLabelEXT = NULL; qvkInsertDebugUtilsLabelEXT = NULL;
} }
if (r_validation->value) if (r_validation->value > 0)
QVk_CreateValidationLayers(); QVk_CreateValidationLayers();
if (!Vkimp_CreateSurface(vk_window)) if (!Vkimp_CreateSurface(vk_window))
@ -1927,7 +1927,7 @@ qboolean QVk_Init(void)
} }
QVk_DebugSetObjectName((uintptr_t)vk_device.physical, VK_OBJECT_TYPE_PHYSICAL_DEVICE, va("Physical Device: %s", vk_config.vendor_name)); QVk_DebugSetObjectName((uintptr_t)vk_device.physical, VK_OBJECT_TYPE_PHYSICAL_DEVICE, va("Physical Device: %s", vk_config.vendor_name));
if (r_validation->value) if (r_validation->value > 0)
vulkan_memory_types_show(); vulkan_memory_types_show();
// setup swapchain // setup swapchain

View file

@ -259,7 +259,7 @@ static VkResult createLogicalDevice()
const char *validationLayers[] = { "VK_LAYER_LUNARG_standard_validation" }; const char *validationLayers[] = { "VK_LAYER_LUNARG_standard_validation" };
#endif #endif
if (r_validation->value) if (r_validation->value > 0)
{ {
deviceCreateInfo.enabledLayerCount = sizeof(validationLayers)/sizeof(validationLayers[0]); deviceCreateInfo.enabledLayerCount = sizeof(validationLayers)/sizeof(validationLayers[0]);
deviceCreateInfo.ppEnabledLayerNames = validationLayers; deviceCreateInfo.ppEnabledLayerNames = validationLayers;

View file

@ -1150,7 +1150,7 @@ Vk_LoadPic(const char *name, byte *pic, int width, int realwidth,
// update count of loaded images // update count of loaded images
img_loaded ++; img_loaded ++;
if (r_validation->value) if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s: Load %s[%d]\n", __func__, image->name, img_loaded); R_Printf(PRINT_ALL, "%s: Load %s[%d]\n", __func__, image->name, img_loaded);
} }
@ -1501,7 +1501,7 @@ image_t *Vk_FindImage (char *name, imagetype_t type)
// //
image = Vk_LoadImage(name, namewe, ext, type); image = Vk_LoadImage(name, namewe, ext, type);
if (!image && r_validation->value) if (!image && r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s: can't load %s\n", __func__, name); R_Printf(PRINT_ALL, "%s: can't load %s\n", __func__, name);
} }
@ -1578,7 +1578,7 @@ void Vk_FreeUnusedImages (void)
if (image->type == it_pic) if (image->type == it_pic)
continue; // don't free pics continue; // don't free pics
if (r_validation->value) if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s: Unload %s[%d]\n", __func__, image->name, img_loaded); R_Printf(PRINT_ALL, "%s: Unload %s[%d]\n", __func__, image->name, img_loaded);
} }
@ -1710,7 +1710,7 @@ void Vk_ShutdownImages (void)
if (!image->registration_sequence) if (!image->registration_sequence)
continue; // free image_t slot continue; // free image_t slot
if (r_validation->value) if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s: Unload %s[%d]\n", __func__, image->name, img_loaded); R_Printf(PRINT_ALL, "%s: Unload %s[%d]\n", __func__, image->name, img_loaded);
} }

View file

@ -148,7 +148,7 @@ static void Mod_Free (model_t *mod)
return; return;
} }
if (r_validation->value) if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s: Unload %s[%d]\n", __func__, mod->name, mod_loaded); R_Printf(PRINT_ALL, "%s: Unload %s[%d]\n", __func__, mod->name, mod_loaded);
} }
@ -1078,7 +1078,7 @@ Mod_ForName (const char *name, model_t *parent_model, qboolean crash)
__func__, mod->name); __func__, mod->name);
} }
if (r_validation->value) if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s: Can't load %s\n", __func__, mod->name); R_Printf(PRINT_ALL, "%s: Can't load %s\n", __func__, mod->name);
} }
@ -1088,7 +1088,7 @@ Mod_ForName (const char *name, model_t *parent_model, qboolean crash)
// update count of loaded models // update count of loaded models
mod_loaded ++; mod_loaded ++;
if (r_validation->value) if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s: Load %s[%d]\n", __func__, mod->name, mod_loaded); R_Printf(PRINT_ALL, "%s: Load %s[%d]\n", __func__, mod->name, mod_loaded);
} }

View file

@ -467,7 +467,7 @@ memory_create_by_property(VkMemoryRequirements* mem_reqs,
VkMemoryPropertyFlags host_visible; VkMemoryPropertyFlags host_visible;
uint32_t memory_index; uint32_t memory_index;
if (r_validation->value) if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "Asked about memory properties with:\n"); R_Printf(PRINT_ALL, "Asked about memory properties with:\n");
memory_type_print(mem_properties); memory_type_print(mem_properties);
@ -487,7 +487,7 @@ memory_create_by_property(VkMemoryRequirements* mem_reqs,
__func__, __LINE__); __func__, __LINE__);
return VK_ERROR_OUT_OF_DEVICE_MEMORY; return VK_ERROR_OUT_OF_DEVICE_MEMORY;
} }
else if (r_validation->value) else if (r_validation->value > 0)
{ {
R_Printf(PRINT_ALL, "%s:%d: Selected %d memory properties with:\n", R_Printf(PRINT_ALL, "%s:%d: Selected %d memory properties with:\n",
__func__, __LINE__, memory_index); __func__, __LINE__, memory_index);