More informative Error message on Vulkan driver crash

The message might not be the only reason, but at least it might help someone like me, who had no idea what he was looking at.
This commit is contained in:
Megamouse 2021-01-29 00:14:53 +01:00
parent be26810cd7
commit 9feb92df1b
3 changed files with 9 additions and 4 deletions

View File

@ -229,6 +229,7 @@ namespace vk
// Render Device - The actual usable device
void render_device::create(vk::physical_device& pdev, u32 graphics_queue_idx)
{
std::string message_on_error;
float queue_priorities[1] = { 0.f };
pgpu = &pdev;
@ -287,6 +288,7 @@ namespace vk
// TODO: Slow fallback to emulate this
// Just warn and let the driver decide whether to crash or not
rsx_log.fatal("Your GPU driver does not support some required MSAA features. Expect problems.");
message_on_error += "Your GPU driver does not support some required MSAA features.\nTry updating your GPU driver or disable Anti-Aliasing in the settings.";
}
enabled_features.sampleRateShading = VK_TRUE;
@ -356,7 +358,7 @@ namespace vk
rsx_log.notice("GPU/driver lacks support for float16 data types. All float16_t arithmetic will be emulated with float32_t.");
}
CHECK_RESULT(vkCreateDevice(*pgpu, &device, nullptr, &dev));
CHECK_RESULT_EX(vkCreateDevice(*pgpu, &device, nullptr, &dev), message_on_error);
// Import optional function endpoints
if (pgpu->conditional_render_support)

View File

@ -3,7 +3,7 @@
namespace vk
{
void die_with_error(VkResult error_code,
void die_with_error(VkResult error_code, std::string message,
const char* file,
const char* func,
u32 line,
@ -99,7 +99,8 @@ namespace vk
{
default:
case 0:
fmt::throw_exception("Assertion Failed! Vulkan API call failed with unrecoverable error: %s%s", error_message, src_loc{line, col, file, func});
if (!message.empty()) message += "\n\n";
fmt::throw_exception("%sAssertion Failed! Vulkan API call failed with unrecoverable error: %s%s", message, error_message, src_loc{line, col, file, func});
case 1:
rsx_log.error("Vulkan API call has failed with an error but will continue: %s%s", error_message, src_loc{line, col, file, func});
break;

View File

@ -1,12 +1,14 @@
#pragma once
#include "../VulkanAPI.h"
#include <string>
namespace vk
{
#define CHECK_RESULT(expr) { VkResult _res = (expr); if (_res != VK_SUCCESS) vk::die_with_error(_res); }
#define CHECK_RESULT_EX(expr, msg) { VkResult _res = (expr); if (_res != VK_SUCCESS) vk::die_with_error(_res, msg); }
void die_with_error(VkResult error_code,
void die_with_error(VkResult error_code, std::string message = {},
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(),
u32 line = __builtin_LINE(),