Vulkan: Provide utilities to put markers and labels where needed in the GPUmodule #106098

Merged
Jeroen Bakker merged 29 commits from :vk_debug_update into main 2023-04-21 12:32:52 +02:00
3 changed files with 11 additions and 8 deletions
Showing only changes of commit e76a52c66d - Show all commits

View File

@ -16,6 +16,7 @@
#include "vk_mem_alloc.h"
#include "gpu_texture_private.hh"
#include <typeinfo>
vnapdv marked this conversation as resolved Outdated

Add one line between imports of different categories. Put system includes on top.

Add one line between imports of different categories. Put system includes on top.
namespace blender::gpu {
@ -25,11 +26,11 @@ VkComponentMapping to_vk_component_mapping(const eGPUTextureFormat format);
VkImageViewType to_vk_image_view_type(const eGPUTextureType type);
VkImageType to_vk_image_type(const eGPUTextureType type);
#ifdef __cplusplus
template<typename T> VkObjectType to_vk_object_type(T vk_obj)
template<typename T> VkObjectType to_vk_object_type(T /*vk_obj*/)
{
const type_info &tid = typeid(T);
const std::type_info &tid = typeid(T);
#define VK_EQ_TYPEID(name, name2) \
if (tid == typeid(name##)) { \
if (tid == typeid(name)) { \
return VK_OBJECT_TYPE_##name2; \
}

View File

@ -79,7 +79,6 @@ namespace blender {
bool init_vk_callbacks(VKContext* ctx, PFN_vkGetInstanceProcAddr instload)
{
CLOG_ENSURE(&LOG);
VKDebuggingTools tools = ctx->debuggingtools_get();
if (instload ) {
vulkan_dynamic_debug_functions(ctx, instload);
return true;

View File

@ -34,16 +34,19 @@ namespace blender {
}VKDebuggingTools;
bool init_vk_callbacks(VKContext* ctx, PFN_vkGetInstanceProcAddr instload);
vnapdv marked this conversation as resolved Outdated

we should remove vk from the function names it is redundant in these cases

we should remove vk from the function names it is redundant in these cases
void destroy_vk_callbacks(VKContext* ctx);
void object_vk_label(VKContext* ctx, VkObjectType objType, uint64_t obj, const char* name);
template<typename T> void object_vk_label(VKContext* ctx, T obj, const char* name) {
if (!(G.debug & G_DEBUG_GPU)) {

obj -> object_handle

`obj` -> `object_handle`
return;
//return;
}
char label[64];
const size_t label_size = 64;
char label[label_size];
memset(label,0,label_size);
static int stats = 0;
SNPRINTF(label, "%s_%d", name, stats++);
object_vk_label(ctx, to_vk_object_type(obj), (uint64_t)obj, label);
object_vk_label(ctx, to_vk_object_type(obj), (uint64_t)obj, (const char*)label);
};
void object_vk_label(VKContext* ctx, VkObjectType objType, uint64_t obj, const char* name);
void pushMarker(VKContext *ctx, VkCommandBuffer cmd, const char *name);
void setMarker(VKContext *ctx, VkCommandBuffer cmd, const char *name);
void popMarker(VKContext *ctx, VkCommandBuffer cmd);
vnapdv marked this conversation as resolved Outdated

push_marker / pop_marker / set_marker

`push_marker` / `pop_marker` / `set_marker`

Also update the definitions to match the parameter names of the implementation.

Also update the definitions to match the parameter names of the implementation.