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,14 +1659,27 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
}
|
||||
R_Printf(PRINT_ALL, "...created Vulkan instance\n");
|
||||
|
||||
// initialize function pointers
|
||||
qvkCreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkCreateDebugUtilsMessengerEXT");
|
||||
qvkDestroyDebugUtilsMessengerEXT = (PFN_vkDestroyDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkDestroyDebugUtilsMessengerEXT");
|
||||
qvkSetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)vkGetInstanceProcAddr(vk_instance, "vkSetDebugUtilsObjectNameEXT");
|
||||
qvkSetDebugUtilsObjectTagEXT = (PFN_vkSetDebugUtilsObjectTagEXT)vkGetInstanceProcAddr(vk_instance, "vkSetDebugUtilsObjectTagEXT");
|
||||
qvkCmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)vkGetInstanceProcAddr(vk_instance, "vkCmdBeginDebugUtilsLabelEXT");
|
||||
qvkCmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)vkGetInstanceProcAddr(vk_instance, "vkCmdEndDebugUtilsLabelEXT");
|
||||
qvkInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT)vkGetInstanceProcAddr(vk_instance, "vkCmdInsertDebugUtilsLabelEXT");
|
||||
if (vk_validation->value)
|
||||
{
|
||||
// initialize function pointers
|
||||
qvkCreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkCreateDebugUtilsMessengerEXT");
|
||||
qvkDestroyDebugUtilsMessengerEXT = (PFN_vkDestroyDebugUtilsMessengerEXT)vkGetInstanceProcAddr(vk_instance, "vkDestroyDebugUtilsMessengerEXT");
|
||||
qvkSetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)vkGetInstanceProcAddr(vk_instance, "vkSetDebugUtilsObjectNameEXT");
|
||||
qvkSetDebugUtilsObjectTagEXT = (PFN_vkSetDebugUtilsObjectTagEXT)vkGetInstanceProcAddr(vk_instance, "vkSetDebugUtilsObjectTagEXT");
|
||||
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,68 +286,73 @@ qboolean QVk_CreateDevice(int preferredDeviceIdx)
|
|||
// debug label related functions
|
||||
void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objName)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
VkDebugUtilsObjectNameInfoEXT oNameInf = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
.objectType = objType,
|
||||
.objectHandle = obj,
|
||||
.pObjectName = objName
|
||||
};
|
||||
if (qvkSetDebugUtilsObjectNameEXT)
|
||||
{
|
||||
VkDebugUtilsObjectNameInfoEXT oNameInf = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
.objectType = objType,
|
||||
.objectHandle = obj,
|
||||
.pObjectName = objName
|
||||
};
|
||||
|
||||
qvkSetDebugUtilsObjectNameEXT(vk_device.logical, &oNameInf);
|
||||
#endif
|
||||
qvkSetDebugUtilsObjectNameEXT(vk_device.logical, &oNameInf);
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName,
|
||||
size_t tagSize, const void *tagData)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
VkDebugUtilsObjectTagInfoEXT oTagInf = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
.objectType = objType,
|
||||
.objectHandle = obj,
|
||||
.tagName = tagName,
|
||||
.tagSize = tagSize,
|
||||
.pTag = tagData
|
||||
};
|
||||
if (qvkSetDebugUtilsObjectTagEXT)
|
||||
{
|
||||
VkDebugUtilsObjectTagInfoEXT oTagInf = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
.objectType = objType,
|
||||
.objectHandle = obj,
|
||||
.tagName = tagName,
|
||||
.tagSize = tagSize,
|
||||
.pTag = tagData
|
||||
};
|
||||
|
||||
qvkSetDebugUtilsObjectTagEXT(vk_device.logical, &oTagInf);
|
||||
#endif
|
||||
qvkSetDebugUtilsObjectTagEXT(vk_device.logical, &oTagInf);
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugLabelBegin(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
VkDebugUtilsLabelEXT labelInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||
.pNext = NULL,
|
||||
.pLabelName = labelName,
|
||||
.color = { r, g, b, 1.f }
|
||||
};
|
||||
if (qvkCmdBeginDebugUtilsLabelEXT)
|
||||
{
|
||||
VkDebugUtilsLabelEXT labelInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||
.pNext = NULL,
|
||||
.pLabelName = labelName,
|
||||
.color = { r, g, b, 1.f }
|
||||
};
|
||||
|
||||
qvkCmdBeginDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
|
||||
#endif
|
||||
qvkCmdBeginDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugLabelEnd(const VkCommandBuffer *cmdBuffer)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
qvkCmdEndDebugUtilsLabelEXT(*cmdBuffer);
|
||||
#endif
|
||||
if (qvkCmdEndDebugUtilsLabelEXT)
|
||||
{
|
||||
qvkCmdEndDebugUtilsLabelEXT(*cmdBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
void QVk_DebugLabelInsert(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
VkDebugUtilsLabelEXT labelInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||
.pNext = NULL,
|
||||
.pLabelName = labelName,
|
||||
.color = { r, g, b, 1.f }
|
||||
};
|
||||
if (qvkInsertDebugUtilsLabelEXT)
|
||||
{
|
||||
VkDebugUtilsLabelEXT labelInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||
.pNext = NULL,
|
||||
.pLabelName = labelName,
|
||||
.color = { r, g, b, 1.f }
|
||||
};
|
||||
|
||||
qvkInsertDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
|
||||
#endif
|
||||
qvkInsertDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
VK_VERIFY(qvkCreateDebugUtilsMessengerEXT(vk_instance, &callbackInfo, NULL, &validationMessenger));
|
||||
R_Printf(PRINT_ALL, "...Vulkan validation layers enabled\n");
|
||||
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