mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-23 05:59:52 +00:00
renderer_vulkan: Use no more than target supported version. (#7439)
This commit is contained in:
parent
5e02be75a3
commit
aa6809e2a8
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <boost/container/static_vector.hpp>
|
#include <boost/container/static_vector.hpp>
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
@ -153,6 +154,12 @@ Instance::Instance(Core::TelemetrySession& telemetry, Frontend::EmuWindow& windo
|
|||||||
physical_device = physical_devices[physical_device_index];
|
physical_device = physical_devices[physical_device_index];
|
||||||
available_extensions = GetSupportedExtensions(physical_device);
|
available_extensions = GetSupportedExtensions(physical_device);
|
||||||
properties = physical_device.getProperties();
|
properties = physical_device.getProperties();
|
||||||
|
if (properties.apiVersion < TargetVulkanApiVersion) {
|
||||||
|
throw std::runtime_error(fmt::format(
|
||||||
|
"Vulkan {}.{} is required, but only {}.{} is supported by device!",
|
||||||
|
VK_VERSION_MAJOR(TargetVulkanApiVersion), VK_VERSION_MINOR(TargetVulkanApiVersion),
|
||||||
|
VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion)));
|
||||||
|
}
|
||||||
|
|
||||||
CollectTelemetryParameters(telemetry);
|
CollectTelemetryParameters(telemetry);
|
||||||
CreateDevice();
|
CreateDevice();
|
||||||
@ -629,7 +636,7 @@ void Instance::CreateAllocator() {
|
|||||||
.device = *device,
|
.device = *device,
|
||||||
.pVulkanFunctions = &functions,
|
.pVulkanFunctions = &functions,
|
||||||
.instance = *instance,
|
.instance = *instance,
|
||||||
.vulkanApiVersion = properties.apiVersion,
|
.vulkanApiVersion = TargetVulkanApiVersion,
|
||||||
};
|
};
|
||||||
|
|
||||||
const VkResult result = vmaCreateAllocator(&allocator_info, &allocator);
|
const VkResult result = vmaCreateAllocator(&allocator_info, &allocator);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <boost/container/static_vector.hpp>
|
#include <boost/container/static_vector.hpp>
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
@ -290,13 +291,14 @@ vk::UniqueInstance CreateInstance(const Common::DynamicLibrary& library,
|
|||||||
}
|
}
|
||||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||||
|
|
||||||
if (!VULKAN_HPP_DEFAULT_DISPATCHER.vkEnumerateInstanceVersion) {
|
const u32 available_version = VULKAN_HPP_DEFAULT_DISPATCHER.vkEnumerateInstanceVersion
|
||||||
throw std::runtime_error("Vulkan 1.0 is not supported, 1.1 is required!");
|
? vk::enumerateInstanceVersion()
|
||||||
}
|
: VK_API_VERSION_1_0;
|
||||||
|
if (available_version < TargetVulkanApiVersion) {
|
||||||
const u32 available_version = vk::enumerateInstanceVersion();
|
throw std::runtime_error(fmt::format(
|
||||||
if (available_version < VK_API_VERSION_1_1) {
|
"Vulkan {}.{} is required, but only {}.{} is supported by instance!",
|
||||||
throw std::runtime_error("Vulkan 1.0 is not supported, 1.1 is required!");
|
VK_VERSION_MAJOR(TargetVulkanApiVersion), VK_VERSION_MINOR(TargetVulkanApiVersion),
|
||||||
|
VK_VERSION_MAJOR(available_version), VK_VERSION_MINOR(available_version)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto extensions = GetInstanceExtensions(window_type, enable_validation);
|
const auto extensions = GetInstanceExtensions(window_type, enable_validation);
|
||||||
@ -306,7 +308,7 @@ vk::UniqueInstance CreateInstance(const Common::DynamicLibrary& library,
|
|||||||
.applicationVersion = VK_MAKE_VERSION(1, 0, 0),
|
.applicationVersion = VK_MAKE_VERSION(1, 0, 0),
|
||||||
.pEngineName = "Citra Vulkan",
|
.pEngineName = "Citra Vulkan",
|
||||||
.engineVersion = VK_MAKE_VERSION(1, 0, 0),
|
.engineVersion = VK_MAKE_VERSION(1, 0, 0),
|
||||||
.apiVersion = VK_API_VERSION_1_3,
|
.apiVersion = TargetVulkanApiVersion,
|
||||||
};
|
};
|
||||||
|
|
||||||
boost::container::static_vector<const char*, 2> layers;
|
boost::container::static_vector<const char*, 2> layers;
|
||||||
|
@ -19,6 +19,8 @@ enum class WindowSystemType : u8;
|
|||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
|
|
||||||
|
constexpr u32 TargetVulkanApiVersion = VK_API_VERSION_1_1;
|
||||||
|
|
||||||
using DebugCallback =
|
using DebugCallback =
|
||||||
std::variant<vk::UniqueDebugUtilsMessengerEXT, vk::UniqueDebugReportCallbackEXT>;
|
std::variant<vk::UniqueDebugUtilsMessengerEXT, vk::UniqueDebugReportCallbackEXT>;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user