Updated to make debug layers guarded by macro
This commit is contained in:
parent
4c3b18d560
commit
2e9ffd9444
5 changed files with 29 additions and 10 deletions
|
|
@ -7,6 +7,7 @@
|
|||
namespace kp {
|
||||
|
||||
#if DEBUG
|
||||
#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS
|
||||
static VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
debugMessageCallback(VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objectType,
|
||||
|
|
@ -21,6 +22,7 @@ debugMessageCallback(VkDebugReportFlagsEXT flags,
|
|||
return VK_FALSE;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Manager::Manager()
|
||||
: Manager(0)
|
||||
|
|
@ -73,11 +75,13 @@ Manager::~Manager()
|
|||
}
|
||||
|
||||
#if DEBUG
|
||||
#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS
|
||||
if (this->mDebugReportCallback) {
|
||||
this->mInstance->destroyDebugReportCallbackEXT(
|
||||
this->mDebugReportCallback, nullptr, this->mDebugDispatcher);
|
||||
SPDLOG_DEBUG("Kompute Manager Destroyed Debug Report Callback");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (this->mFreeInstance) {
|
||||
|
|
@ -133,6 +137,7 @@ Manager::createInstance()
|
|||
}
|
||||
|
||||
#if DEBUG
|
||||
#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS
|
||||
SPDLOG_DEBUG("Kompute Manager adding debug validation layers");
|
||||
// We'll identify the layers that are supported
|
||||
std::vector<const char*> validLayerNames;
|
||||
|
|
@ -160,6 +165,7 @@ Manager::createInstance()
|
|||
(uint32_t)validLayerNames.size();
|
||||
computeInstanceCreateInfo.ppEnabledLayerNames = validLayerNames.data();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
this->mInstance = std::make_shared<vk::Instance>();
|
||||
|
|
@ -168,6 +174,7 @@ Manager::createInstance()
|
|||
SPDLOG_DEBUG("Kompute Manager Instance Created");
|
||||
|
||||
#if DEBUG
|
||||
#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS
|
||||
SPDLOG_DEBUG("Kompute Manager adding debug callbacks");
|
||||
if (validLayerNames.size() > 0) {
|
||||
vk::DebugReportFlagsEXT debugFlags =
|
||||
|
|
@ -184,6 +191,7 @@ Manager::createInstance()
|
|||
debugCreateInfo, nullptr, this->mDebugDispatcher);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1,20 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
#include <android/log.h>
|
||||
#include <android_native_app_glue.h>
|
||||
#endif
|
||||
|
||||
//#define VK_NO_PROTOTYPES 1
|
||||
//#undef VK_NO_PROTOTYPES
|
||||
#undef DEBUG
|
||||
#ifndef RELEASE
|
||||
#define RELEASE 1
|
||||
#endif
|
||||
//#undef DEBUG
|
||||
//#ifndef RELEASE
|
||||
//#define RELEASE 1
|
||||
//#endif
|
||||
//#define USE_DEBUG_EXTENTIONS
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#include <android/log.h>
|
||||
#include <android_native_app_glue.h>
|
||||
#include <kompute_vulkan_wrapper.hpp>
|
||||
|
||||
// VK_NO_PROTOTYPES required before vulkan import but after wrapper.hpp
|
||||
#undef VK_NO_PROTOTYPES
|
||||
#define DVULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
// SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import
|
||||
|
|
|
|||
|
|
@ -154,8 +154,10 @@ class Manager
|
|||
mManagedSequences;
|
||||
|
||||
#if DEBUG
|
||||
#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS
|
||||
vk::DebugReportCallbackEXT mDebugReportCallback;
|
||||
vk::DispatchLoaderDynamic mDebugDispatcher;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Create functions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue