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