From 39072626785ad661923f97b8dd4bcb719b3adc7a Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 13 Dec 2022 21:51:44 +0000 Subject: [PATCH] r_validation CVar to take in account only when positive. --- src/vk/vk_common.c | 14 +++++++------- src/vk/vk_device.c | 2 +- src/vk/vk_image.c | 8 ++++---- src/vk/vk_model.c | 6 +++--- src/vk/vk_util.c | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/vk/vk_common.c b/src/vk/vk_common.c index a9ebbcf..871079c 100644 --- a/src/vk/vk_common.c +++ b/src/vk/vk_common.c @@ -1749,7 +1749,7 @@ qboolean QVk_Init(void) } // add space for validation layer - if (r_validation->value) + if (r_validation->value > 0) extCount++; #if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) && defined(__APPLE__) @@ -1766,7 +1766,7 @@ qboolean QVk_Init(void) } // restore extensions count - if (r_validation->value) + if (r_validation->value > 0) { extCount++; 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" }; #endif - if (r_validation->value) + if (r_validation->value > 0) { createInfo.enabledLayerCount = sizeof(validationLayers) / sizeof(validationLayers[0]); createInfo.ppEnabledLayerNames = validationLayers; @@ -1867,7 +1867,7 @@ qboolean QVk_Init(void) 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 // before falling back to a GL renderer createInfo.enabledLayerCount = 0; @@ -1889,7 +1889,7 @@ qboolean QVk_Init(void) volkLoadInstance(vk_instance); R_Printf(PRINT_ALL, "...created Vulkan instance\n"); - if (r_validation->value) + if (r_validation->value > 0) { // initialize function pointers qvkCreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkCreateDebugUtilsMessengerEXT"); @@ -1911,7 +1911,7 @@ qboolean QVk_Init(void) qvkInsertDebugUtilsLabelEXT = NULL; } - if (r_validation->value) + if (r_validation->value > 0) QVk_CreateValidationLayers(); 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)); - if (r_validation->value) + if (r_validation->value > 0) vulkan_memory_types_show(); // setup swapchain diff --git a/src/vk/vk_device.c b/src/vk/vk_device.c index 598eab4..8068ad7 100644 --- a/src/vk/vk_device.c +++ b/src/vk/vk_device.c @@ -259,7 +259,7 @@ static VkResult createLogicalDevice() const char *validationLayers[] = { "VK_LAYER_LUNARG_standard_validation" }; #endif - if (r_validation->value) + if (r_validation->value > 0) { deviceCreateInfo.enabledLayerCount = sizeof(validationLayers)/sizeof(validationLayers[0]); deviceCreateInfo.ppEnabledLayerNames = validationLayers; diff --git a/src/vk/vk_image.c b/src/vk/vk_image.c index 160c63a..ea0d2c6 100644 --- a/src/vk/vk_image.c +++ b/src/vk/vk_image.c @@ -1150,7 +1150,7 @@ Vk_LoadPic(const char *name, byte *pic, int width, int realwidth, // update count of loaded images 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); } @@ -1501,7 +1501,7 @@ image_t *Vk_FindImage (char *name, imagetype_t 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); } @@ -1578,7 +1578,7 @@ void Vk_FreeUnusedImages (void) if (image->type == it_pic) 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); } @@ -1710,7 +1710,7 @@ void Vk_ShutdownImages (void) if (!image->registration_sequence) 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); } diff --git a/src/vk/vk_model.c b/src/vk/vk_model.c index f78bcd9..ff798ff 100644 --- a/src/vk/vk_model.c +++ b/src/vk/vk_model.c @@ -148,7 +148,7 @@ static void Mod_Free (model_t *mod) return; } - if (r_validation->value) + if (r_validation->value > 0) { 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); } - if (r_validation->value) + if (r_validation->value > 0) { 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 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); } diff --git a/src/vk/vk_util.c b/src/vk/vk_util.c index 3b9cef9..0b435d4 100644 --- a/src/vk/vk_util.c +++ b/src/vk/vk_util.c @@ -467,7 +467,7 @@ memory_create_by_property(VkMemoryRequirements* mem_reqs, VkMemoryPropertyFlags host_visible; uint32_t memory_index; - if (r_validation->value) + if (r_validation->value > 0) { R_Printf(PRINT_ALL, "Asked about memory properties with:\n"); memory_type_print(mem_properties); @@ -487,7 +487,7 @@ memory_create_by_property(VkMemoryRequirements* mem_reqs, __func__, __LINE__); 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", __func__, __LINE__, memory_index);