mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-05-06 19:01:45 +03:00
Add Auto Graphics API option, add AMD driver workaround. (#358)
* Add Auto Graphics API option, add AMD driver workaround. * Remove unused line.
This commit is contained in:
parent
f6d820faae
commit
0441845f2a
7 changed files with 39 additions and 8 deletions
|
@ -3433,6 +3433,13 @@ namespace plume {
|
||||||
capabilities.uma = uma;
|
capabilities.uma = uma;
|
||||||
description.name = deviceName;
|
description.name = deviceName;
|
||||||
description.dedicatedVideoMemory = adapterDesc.DedicatedVideoMemory;
|
description.dedicatedVideoMemory = adapterDesc.DedicatedVideoMemory;
|
||||||
|
description.vendor = RenderDeviceVendor(adapterDesc.VendorId);
|
||||||
|
|
||||||
|
LARGE_INTEGER adapterVersion = {};
|
||||||
|
res = adapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &adapterVersion);
|
||||||
|
if (SUCCEEDED(res)) {
|
||||||
|
description.driverVersion = adapterVersion.QuadPart;
|
||||||
|
}
|
||||||
|
|
||||||
if (preferUserChoice) {
|
if (preferUserChoice) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -73,6 +73,13 @@ namespace plume {
|
||||||
|
|
||||||
// Enums.
|
// Enums.
|
||||||
|
|
||||||
|
enum class RenderDeviceVendor {
|
||||||
|
UNKNOWN = 0x0,
|
||||||
|
AMD = 0x1002,
|
||||||
|
NVIDIA = 0x10DE,
|
||||||
|
INTEL = 0x8086
|
||||||
|
};
|
||||||
|
|
||||||
enum class RenderFormat {
|
enum class RenderFormat {
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
R32G32B32A32_TYPELESS,
|
R32G32B32A32_TYPELESS,
|
||||||
|
@ -1770,7 +1777,8 @@ namespace plume {
|
||||||
struct RenderDeviceDescription {
|
struct RenderDeviceDescription {
|
||||||
std::string name = "Unknown";
|
std::string name = "Unknown";
|
||||||
RenderDeviceType type = RenderDeviceType::UNKNOWN;
|
RenderDeviceType type = RenderDeviceType::UNKNOWN;
|
||||||
uint32_t driverVersion = 0;
|
RenderDeviceVendor vendor = RenderDeviceVendor::UNKNOWN;
|
||||||
|
uint64_t driverVersion = 0;
|
||||||
uint64_t dedicatedVideoMemory = 0;
|
uint64_t dedicatedVideoMemory = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3604,6 +3604,7 @@ namespace plume {
|
||||||
description.name = deviceName;
|
description.name = deviceName;
|
||||||
description.type = toDeviceType(deviceProperties.deviceType);
|
description.type = toDeviceType(deviceProperties.deviceType);
|
||||||
description.driverVersion = deviceProperties.driverVersion;
|
description.driverVersion = deviceProperties.driverVersion;
|
||||||
|
description.vendor = RenderDeviceVendor(deviceProperties.vendorID);
|
||||||
currentDeviceTypeScore = deviceTypeScore;
|
currentDeviceTypeScore = deviceTypeScore;
|
||||||
|
|
||||||
if (preferUserChoice) {
|
if (preferUserChoice) {
|
||||||
|
|
|
@ -1675,7 +1675,26 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver)
|
||||||
g_device = g_interface->createDevice(Config::GraphicsDevice);
|
g_device = g_interface->createDevice(Config::GraphicsDevice);
|
||||||
if (g_device != nullptr)
|
if (g_device != nullptr)
|
||||||
{
|
{
|
||||||
|
const RenderDeviceDescription &deviceDescription = g_device->getDescription();
|
||||||
|
|
||||||
#ifdef UNLEASHED_RECOMP_D3D12
|
#ifdef UNLEASHED_RECOMP_D3D12
|
||||||
|
if (interfaceFunction == CreateD3D12Interface)
|
||||||
|
{
|
||||||
|
if (deviceDescription.vendor == RenderDeviceVendor::AMD)
|
||||||
|
{
|
||||||
|
// AMD Drivers before this version have a known issue where MSAA resolve targets will fail to work correctly.
|
||||||
|
// If no specific graphics API was selected, we silently destroy this one and move to the next option as it'll
|
||||||
|
// just work incorrectly otherwise and result in visual glitches and 3D rendering not working in general.
|
||||||
|
constexpr uint64_t MinimumAMDDriverVersion = 0x1F00005DC2005CULL; // 31.0.24002.92
|
||||||
|
if ((Config::GraphicsAPI == EGraphicsAPI::Auto) && (deviceDescription.driverVersion < MinimumAMDDriverVersion))
|
||||||
|
{
|
||||||
|
g_device.reset();
|
||||||
|
g_interface.reset();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_vulkan = (interfaceFunction == CreateVulkanInterfaceWrapper);
|
g_vulkan = (interfaceFunction == CreateVulkanInterfaceWrapper);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -302,6 +302,7 @@ CONFIG_DEFINE_ENUM_TEMPLATE(EVoiceLanguage)
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EGraphicsAPI)
|
CONFIG_DEFINE_ENUM_TEMPLATE(EGraphicsAPI)
|
||||||
{
|
{
|
||||||
|
{ "Auto", EGraphicsAPI::Auto },
|
||||||
#ifdef UNLEASHED_RECOMP_D3D12
|
#ifdef UNLEASHED_RECOMP_D3D12
|
||||||
{ "D3D12", EGraphicsAPI::D3D12 },
|
{ "D3D12", EGraphicsAPI::D3D12 },
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,6 +62,7 @@ enum class EChannelConfiguration : uint32_t
|
||||||
|
|
||||||
enum class EGraphicsAPI : uint32_t
|
enum class EGraphicsAPI : uint32_t
|
||||||
{
|
{
|
||||||
|
Auto,
|
||||||
#ifdef UNLEASHED_RECOMP_D3D12
|
#ifdef UNLEASHED_RECOMP_D3D12
|
||||||
D3D12,
|
D3D12,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,13 +47,7 @@ CONFIG_DEFINE_LOCALISED("Audio", bool, MusicAttenuation, false);
|
||||||
CONFIG_DEFINE_LOCALISED("Audio", bool, BattleTheme, true);
|
CONFIG_DEFINE_LOCALISED("Audio", bool, BattleTheme, true);
|
||||||
|
|
||||||
CONFIG_DEFINE("Video", std::string, GraphicsDevice, "");
|
CONFIG_DEFINE("Video", std::string, GraphicsDevice, "");
|
||||||
|
CONFIG_DEFINE_ENUM("Video", EGraphicsAPI, GraphicsAPI, EGraphicsAPI::Auto);
|
||||||
#ifdef UNLEASHED_RECOMP_D3D12
|
|
||||||
CONFIG_DEFINE_ENUM("Video", EGraphicsAPI, GraphicsAPI, EGraphicsAPI::D3D12);
|
|
||||||
#else
|
|
||||||
CONFIG_DEFINE_ENUM("Video", EGraphicsAPI, GraphicsAPI, EGraphicsAPI::Vulkan);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CONFIG_DEFINE("Video", int32_t, WindowX, WINDOWPOS_CENTRED);
|
CONFIG_DEFINE("Video", int32_t, WindowX, WINDOWPOS_CENTRED);
|
||||||
CONFIG_DEFINE("Video", int32_t, WindowY, WINDOWPOS_CENTRED);
|
CONFIG_DEFINE("Video", int32_t, WindowY, WINDOWPOS_CENTRED);
|
||||||
CONFIG_DEFINE_LOCALISED("Video", int32_t, WindowSize, -1);
|
CONFIG_DEFINE_LOCALISED("Video", int32_t, WindowSize, -1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue