2020-08-06 18:18:34 +08:00
|
|
|
/*
|
|
|
|
* Vulkan examples debug wrapper
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de
|
|
|
|
*
|
|
|
|
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vulkan/vulkan.h"
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string>
|
|
|
|
#include <cstring>
|
|
|
|
#include <fstream>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <vector>
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
#ifdef __ANDROID__
|
|
|
|
#include "vulkanandroid.h"
|
|
|
|
#endif
|
|
|
|
|
2021-09-08 10:54:22 +08:00
|
|
|
namespace vkDebug {
|
|
|
|
// Default validation layers
|
|
|
|
extern int validationLayerCount;
|
|
|
|
extern const char *validationLayerNames[];
|
2020-08-06 18:18:34 +08:00
|
|
|
|
2021-09-08 10:54:22 +08:00
|
|
|
// Default debug callback
|
|
|
|
VkBool32 messageCallback(
|
|
|
|
VkDebugReportFlagsEXT flags,
|
|
|
|
VkDebugReportObjectTypeEXT objType,
|
|
|
|
uint64_t srcObject,
|
|
|
|
size_t location,
|
|
|
|
int32_t msgCode,
|
|
|
|
const char* pLayerPrefix,
|
|
|
|
const char* pMsg,
|
|
|
|
void* pUserData);
|
2020-08-06 18:18:34 +08:00
|
|
|
|
2021-09-08 10:54:22 +08:00
|
|
|
// Load debug function pointers and set debug callback
|
|
|
|
// if callBack is NULL, default message callback will be used
|
|
|
|
void setupDebugging(
|
|
|
|
VkInstance instance,
|
|
|
|
VkDebugReportFlagsEXT flags,
|
|
|
|
VkDebugReportCallbackEXT callBack);
|
|
|
|
// Clear debug callback
|
|
|
|
void freeDebugCallback(VkInstance instance);
|
2020-08-06 18:18:34 +08:00
|
|
|
}
|