renderer_vulkan: Misc fixes (#6974)
* vk_platform: Check if library was loaded * pica_to_vk: Dont crash on unknow blend equation
This commit is contained in:
parent
ee3eab5054
commit
30fcdc5474
@ -16,7 +16,7 @@ public:
|
||||
~DynamicLibrary();
|
||||
|
||||
/// Returns true if the library is loaded, otherwise false.
|
||||
[[nodiscard]] bool IsLoaded() {
|
||||
[[nodiscard]] bool IsLoaded() const noexcept {
|
||||
return handle != nullptr;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,12 @@ inline vk::BlendOp BlendEquation(Pica::FramebufferRegs::BlendEquation equation)
|
||||
}};
|
||||
|
||||
const auto index = static_cast<std::size_t>(equation);
|
||||
ASSERT_MSG(index < blend_equation_table.size(), "Unknown blend equation {}", index);
|
||||
if (index >= blend_equation_table.size()) {
|
||||
LOG_CRITICAL(Render_Vulkan, "Unknown blend equation {}", index);
|
||||
|
||||
// This return value is hwtested, not just a stub
|
||||
return vk::BlendOp::eAdd;
|
||||
}
|
||||
return blend_equation_table[index];
|
||||
}
|
||||
|
||||
|
@ -277,6 +277,10 @@ vk::InstanceCreateFlags GetInstanceFlags() {
|
||||
vk::UniqueInstance CreateInstance(const Common::DynamicLibrary& library,
|
||||
Frontend::WindowSystemType window_type, bool enable_validation,
|
||||
bool dump_command_buffers) {
|
||||
if (!library.IsLoaded()) {
|
||||
throw std::runtime_error("Failed to load Vulkan driver library");
|
||||
}
|
||||
|
||||
const auto vkGetInstanceProcAddr =
|
||||
library.GetSymbol<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||
if (!vkGetInstanceProcAddr) {
|
||||
|
Loading…
Reference in New Issue
Block a user