mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-19 07:51:03 +00:00
Always compilein validation code
This commit is contained in:
parent
dc77a19d9f
commit
ca29093f64
4 changed files with 76 additions and 57 deletions
|
@ -1659,6 +1659,8 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
}
|
||||
R_Printf(PRINT_ALL, "...created Vulkan instance\n");
|
||||
|
||||
if (vk_validation->value)
|
||||
{
|
||||
// initialize function pointers
|
||||
qvkCreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkCreateDebugUtilsMessengerEXT");
|
||||
qvkDestroyDebugUtilsMessengerEXT = (PFN_vkDestroyDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkDestroyDebugUtilsMessengerEXT");
|
||||
|
@ -1667,6 +1669,17 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
qvkCmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)vkGetInstanceProcAddr(vk_instance, "vkCmdBeginDebugUtilsLabelEXT");
|
||||
qvkCmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)vkGetInstanceProcAddr(vk_instance, "vkCmdEndDebugUtilsLabelEXT");
|
||||
qvkInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT)vkGetInstanceProcAddr(vk_instance, "vkCmdInsertDebugUtilsLabelEXT");
|
||||
}
|
||||
else
|
||||
{
|
||||
qvkCreateDebugUtilsMessengerEXT = NULL;
|
||||
qvkDestroyDebugUtilsMessengerEXT = NULL;
|
||||
qvkSetDebugUtilsObjectNameEXT = NULL;
|
||||
qvkSetDebugUtilsObjectTagEXT = NULL;
|
||||
qvkCmdBeginDebugUtilsLabelEXT = NULL;
|
||||
qvkCmdEndDebugUtilsLabelEXT = NULL;
|
||||
qvkInsertDebugUtilsLabelEXT = NULL;
|
||||
}
|
||||
|
||||
if (vk_validation->value)
|
||||
QVk_CreateValidationLayers();
|
||||
|
@ -2021,7 +2034,6 @@ void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
|
|||
}
|
||||
};
|
||||
|
||||
#if defined(_DEBUG)
|
||||
if (rpType == RP_WORLD) {
|
||||
QVk_DebugLabelBegin(&vk_commandbuffers[vk_activeBufferIdx], "Draw World", 0.f, 1.f, 0.f);
|
||||
}
|
||||
|
@ -2033,7 +2045,6 @@ void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
|
|||
QVk_DebugLabelEnd(&vk_commandbuffers[vk_activeBufferIdx]);
|
||||
QVk_DebugLabelBegin(&vk_commandbuffers[vk_activeBufferIdx], "Draw View Warp", 1.f, 0.f, .5f);
|
||||
}
|
||||
#endif
|
||||
|
||||
vkCmdBeginRenderPass(vk_commandbuffers[vk_activeBufferIdx], &renderBeginInfo[rpType], VK_SUBPASS_CONTENTS_INLINE);
|
||||
}
|
||||
|
|
|
@ -286,7 +286,8 @@ qboolean QVk_CreateDevice(int preferredDeviceIdx)
|
|||
// debug label related functions
|
||||
void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objName)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
if (qvkSetDebugUtilsObjectNameEXT)
|
||||
{
|
||||
VkDebugUtilsObjectNameInfoEXT oNameInf = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
|
@ -296,13 +297,14 @@ void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objN
|
|||
};
|
||||
|
||||
qvkSetDebugUtilsObjectNameEXT(vk_device.logical, &oNameInf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName,
|
||||
size_t tagSize, const void *tagData)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
if (qvkSetDebugUtilsObjectTagEXT)
|
||||
{
|
||||
VkDebugUtilsObjectTagInfoEXT oTagInf = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
|
@ -314,12 +316,13 @@ void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName,
|
|||
};
|
||||
|
||||
qvkSetDebugUtilsObjectTagEXT(vk_device.logical, &oTagInf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugLabelBegin(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
if (qvkCmdBeginDebugUtilsLabelEXT)
|
||||
{
|
||||
VkDebugUtilsLabelEXT labelInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||
.pNext = NULL,
|
||||
|
@ -328,19 +331,21 @@ void QVk_DebugLabelBegin(const VkCommandBuffer *cmdBuffer, const char *labelName
|
|||
};
|
||||
|
||||
qvkCmdBeginDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugLabelEnd(const VkCommandBuffer *cmdBuffer)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
if (qvkCmdEndDebugUtilsLabelEXT)
|
||||
{
|
||||
qvkCmdEndDebugUtilsLabelEXT(*cmdBuffer);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugLabelInsert(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
if (qvkInsertDebugUtilsLabelEXT)
|
||||
{
|
||||
VkDebugUtilsLabelEXT labelInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||
.pNext = NULL,
|
||||
|
@ -349,5 +354,5 @@ void QVk_DebugLabelInsert(const VkCommandBuffer *cmdBuffer, const char *labelNam
|
|||
};
|
||||
|
||||
qvkInsertDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1060,7 +1060,7 @@ R_Register( void )
|
|||
r_vsync = ri.Cvar_Get("r_vsync", "0", CVAR_ARCHIVE);
|
||||
|
||||
vk_overbrightbits = ri.Cvar_Get("vk_overbrightbits", "1.0", CVAR_ARCHIVE);
|
||||
vk_validation = ri.Cvar_Get("vk_validation", "0", 0);
|
||||
vk_validation = ri.Cvar_Get("vk_validation", "0", CVAR_ARCHIVE);
|
||||
vk_bitdepth = ri.Cvar_Get("vk_bitdepth", "0", 0);
|
||||
vk_picmip = ri.Cvar_Get("vk_picmip", "0", 0);
|
||||
vk_skymip = ri.Cvar_Get("vk_skymip", "0", 0);
|
||||
|
|
|
@ -83,13 +83,16 @@ void QVk_CreateValidationLayers()
|
|||
VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
|
||||
}
|
||||
|
||||
if (qvkCreateDebugUtilsMessengerEXT)
|
||||
{
|
||||
VK_VERIFY(qvkCreateDebugUtilsMessengerEXT(vk_instance, &callbackInfo, NULL, &validationMessenger));
|
||||
R_Printf(PRINT_ALL, "...Vulkan validation layers enabled\n");
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DestroyValidationLayers()
|
||||
{
|
||||
if( validationMessenger != VK_NULL_HANDLE )
|
||||
if( validationMessenger != VK_NULL_HANDLE && qvkDestroyDebugUtilsMessengerEXT)
|
||||
{
|
||||
qvkDestroyDebugUtilsMessengerEXT( vk_instance, validationMessenger, NULL );
|
||||
validationMessenger = VK_NULL_HANDLE;
|
||||
|
|
Loading…
Reference in a new issue