Vulkan: Provide utilities to put markers and labels where needed in the GPUmodule #106098
|
@ -76,7 +76,6 @@ namespace blender {
|
|||
tools.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool init_vk_callbacks(VKContext* ctx, PFN_vkGetInstanceProcAddr instload)
|
||||
{
|
||||
CLOG_ENSURE(&LOG);
|
||||
|
@ -87,7 +86,6 @@ namespace blender {
|
|||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
void destroy_vk_callbacks(VKContext* ctx)
|
||||
{
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
|
@ -95,7 +93,6 @@ namespace blender {
|
|||
vulkan_dynamic_debug_functions(ctx, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void object_vk_label(blender::gpu::VKContext* ctx, VkObjectType objType, uint64_t obj, const char* name)
|
||||
{
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
|
@ -108,6 +105,60 @@ namespace blender {
|
|||
tools.vkSetDebugUtilsObjectNameEXT_r(ctx->device_get(), &info);
|
||||
}
|
||||
}
|
||||
void pushMarker(blender::gpu::VKContext *ctx, VkCommandBuffer cmd, const char *name)
|
||||
{
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
if (tools.enabled) {
|
||||
VkDebugUtilsLabelEXT info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||
info.pLabelName = name;
|
||||
tools.vkCmdBeginDebugUtilsLabelEXT_r(cmd, &info);
|
||||
}
|
||||
}
|
||||
void setMarker(blender::gpu::VKContext *ctx, VkCommandBuffer cmd, const char *name)
|
||||
{
|
||||
vnapdv marked this conversation as resolved
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
if (tools.enabled) {
|
||||
VkDebugUtilsLabelEXT info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||
info.pLabelName = name;
|
||||
tools.vkCmdInsertDebugUtilsLabelEXT_r(cmd, &info);
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
`/home/jeroen/blender-git/blender/source/blender/gpu/vulkan/vk_debug.cc:125:26: warning: variable ‘tools’ set but not used [-Wunused-but-set-variable]`
|
||||
}
|
||||
}
|
||||
void popMarker(blender::gpu::VKContext *ctx, VkCommandBuffer cmd)
|
||||
{
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
Jeroen Bakker
commented
`obj` isn't very useful. would use `object_handle`
|
||||
if (tools.enabled) {
|
||||
Jeroen Bakker
commented
`objType` -> `vk_object_type`
|
||||
tools.vkCmdEndDebugUtilsLabelEXT_r(cmd);
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
Add empty line between each function. Add empty line between each function.
|
||||
}
|
||||
}
|
||||
void pushMarker(blender::gpu::VKContext *ctx, VkQueue q, const char *name)
|
||||
{
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
if (tools.enabled) {
|
||||
VkDebugUtilsLabelEXT info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||
info.pLabelName = name;
|
||||
tools.vkQueueBeginDebugUtilsLabelEXT_r(q, &info);
|
||||
}
|
||||
}
|
||||
void setMarker(blender::gpu::VKContext *ctx, VkQueue q, const char *name)
|
||||
Jeroen Bakker
commented
Also check the other functions. `cmd` -> `vk_command_buffer`. No need to confuse readers with incorrect abbreviations.
Also check the other functions.
|
||||
{
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
if (tools.enabled) {
|
||||
VkDebugUtilsLabelEXT info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||
info.pLabelName = name;
|
||||
tools.vkQueueInsertDebugUtilsLabelEXT_r(q, &info);
|
||||
}
|
||||
}
|
||||
void popMarker(blender::gpu::VKContext *ctx, VkQueue q)
|
||||
{
|
||||
VKDebuggingTools tools = ctx->debuggingtools_get();
|
||||
if (tools.enabled) {
|
||||
tools.vkQueueEndDebugUtilsLabelEXT_r(q);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,12 +44,12 @@ namespace blender {
|
|||
object_vk_label(ctx, to_vk_object_type(obj), (uint64_t)obj, label);
|
||||
};
|
||||
void object_vk_label(VKContext* ctx, VkObjectType objType, uint64_t obj, const char* name);
|
||||
void pushMarker(VkCommandBuffer cmd, const char* name);
|
||||
void setMarker(VkCommandBuffer cmd, const char* name);
|
||||
void popMarker(VkCommandBuffer cmd);
|
||||
void pushMarker(VkQueue q, const char* name);
|
||||
void setMarker(VkQueue q, const char* name);
|
||||
void popMarker(VkQueue q);
|
||||
void pushMarker(VKContext *ctx, VkCommandBuffer cmd, const char *name);
|
||||
void setMarker(VKContext *ctx, VkCommandBuffer cmd, const char *name);
|
||||
void popMarker(VKContext *ctx, VkCommandBuffer cmd);
|
||||
void pushMarker(VKContext *ctx, VkQueue q, const char *name);
|
||||
void setMarker(VKContext *ctx, VkQueue q, const char *name);
|
||||
void popMarker(VKContext *ctx, VkQueue q);
|
||||
vnapdv marked this conversation as resolved
Outdated
Jeroen Bakker
commented
`push_marker` / `pop_marker` / `set_marker`
Jeroen Bakker
commented
Also update the definitions to match the parameter names of the implementation. Also update the definitions to match the parameter names of the implementation.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
use
context
when referring toVKContext
(be consistent with other areas of the code-base)When referring to instances of the Vulkan API it is used. Eg VkCommandBuffer parameters should be named
vk_command_buffer
VKCommandBuffer (internal class) should be referred to ascommand_buffer
.Abbreviations like
q
should not be used, just call them what they arequeue
.etc