mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Move the responsibility to register the debugutils callback to the VulkanContext. We only use one anyway.
This commit is contained in:
parent
6532c345c8
commit
fbc4fa5bca
4 changed files with 15 additions and 19 deletions
|
@ -247,6 +247,11 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
|
|||
vkGetPhysicalDeviceProperties(physical_devices_[i], &physicalDeviceProperties_[i].properties);
|
||||
}
|
||||
}
|
||||
|
||||
if (extensionsLookup_.EXT_debug_utils) {
|
||||
InitDebugUtilsCallback();
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -255,6 +260,13 @@ VulkanContext::~VulkanContext() {
|
|||
}
|
||||
|
||||
void VulkanContext::DestroyInstance() {
|
||||
if (extensionsLookup_.EXT_debug_utils) {
|
||||
while (utils_callbacks.size() > 0) {
|
||||
vkDestroyDebugUtilsMessengerEXT(instance_, utils_callbacks.back(), nullptr);
|
||||
utils_callbacks.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
vkDestroyInstance(instance_, nullptr);
|
||||
VulkanFree();
|
||||
instance_ = VK_NULL_HANDLE;
|
||||
|
@ -687,15 +699,6 @@ VkResult VulkanContext::InitDebugUtilsCallback() {
|
|||
return res;
|
||||
}
|
||||
|
||||
void VulkanContext::DestroyDebugUtilsCallback() {
|
||||
if (extensionsLookup_.EXT_debug_utils) {
|
||||
while (utils_callbacks.size() > 0) {
|
||||
vkDestroyDebugUtilsMessengerEXT(instance_, utils_callbacks.back(), nullptr);
|
||||
utils_callbacks.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VkResult VulkanContext::InitSurface(WindowSystem winsys, void *data1, void *data2) {
|
||||
winsys_ = winsys;
|
||||
winsysData1_ = data1;
|
||||
|
|
|
@ -170,9 +170,6 @@ public:
|
|||
|
||||
bool MemoryTypeFromProperties(uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex);
|
||||
|
||||
VkResult InitDebugUtilsCallback();
|
||||
void DestroyDebugUtilsCallback();
|
||||
|
||||
VkPhysicalDevice GetPhysicalDevice(int n) const {
|
||||
return physical_devices_[n];
|
||||
}
|
||||
|
@ -276,6 +273,8 @@ public:
|
|||
void GetImageMemoryRequirements(VkImage image, VkMemoryRequirements *mem_reqs, bool *dedicatedAllocation);
|
||||
|
||||
private:
|
||||
VkResult InitDebugUtilsCallback();
|
||||
|
||||
// A layer can expose extensions, keep track of those extensions here.
|
||||
struct LayerProperties {
|
||||
VkLayerProperties properties;
|
||||
|
|
|
@ -127,9 +127,7 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
|
|||
g_Vulkan = nullptr;
|
||||
return false;
|
||||
}
|
||||
if (g_validate_) {
|
||||
g_Vulkan->InitDebugUtilsCallback();
|
||||
}
|
||||
|
||||
g_Vulkan->InitSurface(WINDOWSYSTEM_WIN32, (void *)hInst, (void *)hWnd);
|
||||
if (!g_Vulkan->InitObjects()) {
|
||||
*error_message = g_Vulkan->InitError();
|
||||
|
@ -164,7 +162,6 @@ void WindowsVulkanContext::Shutdown() {
|
|||
g_Vulkan->WaitUntilQueueIdle();
|
||||
g_Vulkan->DestroyObjects();
|
||||
g_Vulkan->DestroyDevice();
|
||||
g_Vulkan->DestroyDebugUtilsCallback();
|
||||
g_Vulkan->DestroyInstance();
|
||||
|
||||
delete g_Vulkan;
|
||||
|
|
|
@ -120,8 +120,6 @@ bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredB
|
|||
if (!success) {
|
||||
g_Vulkan->DestroyObjects();
|
||||
g_Vulkan->DestroyDevice();
|
||||
g_Vulkan->DestroyDebugUtilsCallback();
|
||||
|
||||
g_Vulkan->DestroyInstance();
|
||||
}
|
||||
return success;
|
||||
|
@ -141,7 +139,6 @@ void AndroidVulkanContext::ShutdownFromRenderThread() {
|
|||
void AndroidVulkanContext::Shutdown() {
|
||||
ILOG("Calling NativeShutdownGraphics");
|
||||
g_Vulkan->DestroyDevice();
|
||||
g_Vulkan->DestroyDebugUtilsCallback();
|
||||
g_Vulkan->DestroyInstance();
|
||||
// We keep the g_Vulkan context around to avoid invalidating a ton of pointers around the app.
|
||||
finalize_glslang();
|
||||
|
|
Loading…
Add table
Reference in a new issue