Vulkan: Provide utilities to put markers and labels where needed in the GPUmodule #106098
|
@ -16,6 +16,7 @@
|
|||
#include "vk_mem_alloc.h"
|
||||
|
||||
#include "gpu_texture_private.hh"
|
||||
#include <typeinfo>
|
||||
|
||||
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; \
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -34,16 +34,19 @@ namespace blender {
|
|||
}VKDebuggingTools;
|
||||
bool init_vk_callbacks(VKContext* ctx, PFN_vkGetInstanceProcAddr instload);
|
||||
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)) {
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue