mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Simplify the validation interface code, bugfixes
This commit is contained in:
parent
1793b65ec1
commit
6532c345c8
@ -36,6 +36,8 @@
|
||||
#define new DBG_NEW
|
||||
#endif
|
||||
|
||||
VulkanLogOptions g_LogOptions;
|
||||
|
||||
static const char *validationLayers[] = {
|
||||
"VK_LAYER_KHRONOS_validation",
|
||||
/*
|
||||
@ -661,12 +663,18 @@ VkResult VulkanContext::CreateDevice() {
|
||||
return res;
|
||||
}
|
||||
|
||||
VkResult VulkanContext::InitDebugUtilsCallback(int bits, VulkanLogOptions *logOptions) {
|
||||
VkResult VulkanContext::InitDebugUtilsCallback() {
|
||||
// We're intentionally skipping VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT and
|
||||
// VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT, just too spammy.
|
||||
int bits = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT
|
||||
| VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
|
||||
| VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
|
||||
|
||||
VkDebugUtilsMessengerCreateInfoEXT callback1{VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT};
|
||||
callback1.messageSeverity = bits;
|
||||
callback1.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
|
||||
callback1.pfnUserCallback = &VulkanDebugUtilsCallback;
|
||||
callback1.pUserData = (void *)logOptions;
|
||||
callback1.pUserData = (void *)&g_LogOptions;
|
||||
VkDebugUtilsMessengerEXT messenger;
|
||||
VkResult res = vkCreateDebugUtilsMessengerEXT(instance_, &callback1, nullptr, &messenger);
|
||||
if (res != VK_SUCCESS) {
|
||||
@ -680,15 +688,14 @@ VkResult VulkanContext::InitDebugUtilsCallback(int bits, VulkanLogOptions *logOp
|
||||
}
|
||||
|
||||
void VulkanContext::DestroyDebugUtilsCallback() {
|
||||
if (!extensionsLookup_.EXT_debug_utils)
|
||||
return;
|
||||
while (utils_callbacks.size() > 0) {
|
||||
vkDestroyDebugUtilsMessengerEXT(instance_, utils_callbacks.back(), nullptr);
|
||||
utils_callbacks.pop_back();
|
||||
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,7 +170,7 @@ public:
|
||||
|
||||
bool MemoryTypeFromProperties(uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex);
|
||||
|
||||
VkResult InitDebugUtilsCallback(int bits, VulkanLogOptions *logOptions);
|
||||
VkResult InitDebugUtilsCallback();
|
||||
void DestroyDebugUtilsCallback();
|
||||
|
||||
VkPhysicalDevice GetPhysicalDevice(int n) const {
|
||||
@ -369,3 +369,5 @@ std::string FormatDriverVersion(const VkPhysicalDeviceProperties &props);
|
||||
|
||||
// Simple heuristic.
|
||||
bool IsHashMaliDriverVersion(const VkPhysicalDeviceProperties &props);
|
||||
|
||||
extern VulkanLogOptions g_LogOptions;
|
||||
|
@ -114,7 +114,6 @@ void SDLVulkanGraphicsContext::Shutdown() {
|
||||
vulkan_->WaitUntilQueueIdle();
|
||||
vulkan_->DestroyObjects();
|
||||
vulkan_->DestroyDevice();
|
||||
vulkan_->DestroyDebugMsgCallback();
|
||||
vulkan_->DestroyInstance();
|
||||
delete vulkan_;
|
||||
vulkan_ = nullptr;
|
||||
|
@ -71,8 +71,6 @@ static const bool g_validate_ = false;
|
||||
|
||||
static VulkanContext *g_Vulkan;
|
||||
|
||||
static VulkanLogOptions g_LogOptions;
|
||||
|
||||
static uint32_t FlagsFromConfig() {
|
||||
uint32_t flags = 0;
|
||||
flags = g_Config.bVSync ? VULKAN_FLAG_PRESENT_FIFO : VULKAN_FLAG_PRESENT_MAILBOX;
|
||||
@ -130,12 +128,7 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
|
||||
return false;
|
||||
}
|
||||
if (g_validate_) {
|
||||
int bits = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT
|
||||
| VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
|
||||
| VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
|
||||
// We're intentionally skipping VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT and
|
||||
// VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT, just too spammy.
|
||||
g_Vulkan->InitDebugUtilsCallback(bits, &g_LogOptions);
|
||||
g_Vulkan->InitDebugUtilsCallback();
|
||||
}
|
||||
g_Vulkan->InitSurface(WINDOWSYSTEM_WIN32, (void *)hInst, (void *)hWnd);
|
||||
if (!g_Vulkan->InitObjects()) {
|
||||
|
@ -142,8 +142,6 @@ void AndroidVulkanContext::Shutdown() {
|
||||
ILOG("Calling NativeShutdownGraphics");
|
||||
g_Vulkan->DestroyDevice();
|
||||
g_Vulkan->DestroyDebugUtilsCallback();
|
||||
g_Vulkan->DestroyDebugMsgCallback();
|
||||
|
||||
g_Vulkan->DestroyInstance();
|
||||
// We keep the g_Vulkan context around to avoid invalidating a ton of pointers around the app.
|
||||
finalize_glslang();
|
||||
|
Loading…
Reference in New Issue
Block a user