Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More informative Error message on Vulkan driver crash #9674

Merged
merged 2 commits into from
Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rpcs3/Emu/RSX/VK/vkutils/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions rpcs3/Emu/RSX/VK/vkutils/shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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});
kd-11 marked this conversation as resolved.
Show resolved Hide resolved
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;
Expand Down
4 changes: 3 additions & 1 deletion rpcs3/Emu/RSX/VK/vkutils/shared.h
Original file line number Diff line number Diff line change
@@ -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 = {},
kd-11 marked this conversation as resolved.
Show resolved Hide resolved
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(),
u32 line = __builtin_LINE(),
Expand Down