mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-28 05:11:37 +00:00
Check for UMA flag on D3D12 to detect integrated GPUs.
This commit is contained in:
parent
8888b2750a
commit
1b76b6ce35
3 changed files with 19 additions and 4 deletions
|
|
@ -3324,6 +3324,14 @@ namespace plume {
|
||||||
dynamicDepthBiasOption = d3d12Options16.DynamicDepthBiasSupported;
|
dynamicDepthBiasOption = d3d12Options16.DynamicDepthBiasSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the architecture has UMA.
|
||||||
|
bool uma = false;
|
||||||
|
D3D12_FEATURE_DATA_ARCHITECTURE1 architecture1 = {};
|
||||||
|
res = deviceOption->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE1, &architecture1, sizeof(architecture1));
|
||||||
|
if (SUCCEEDED(res)) {
|
||||||
|
uma = architecture1.UMA;
|
||||||
|
}
|
||||||
|
|
||||||
// Pick this adapter and device if it has better feature support than the current one.
|
// Pick this adapter and device if it has better feature support than the current one.
|
||||||
bool preferOverNothing = (adapter == nullptr) || (d3d == nullptr);
|
bool preferOverNothing = (adapter == nullptr) || (d3d == nullptr);
|
||||||
bool preferVideoMemory = adapterDesc.DedicatedVideoMemory > description.dedicatedVideoMemory;
|
bool preferVideoMemory = adapterDesc.DedicatedVideoMemory > description.dedicatedVideoMemory;
|
||||||
|
|
@ -3346,6 +3354,7 @@ namespace plume {
|
||||||
capabilities.sampleLocations = samplePositionsOption;
|
capabilities.sampleLocations = samplePositionsOption;
|
||||||
capabilities.triangleFan = triangleFanSupportOption;
|
capabilities.triangleFan = triangleFanSupportOption;
|
||||||
capabilities.dynamicDepthBias = dynamicDepthBiasOption;
|
capabilities.dynamicDepthBias = dynamicDepthBiasOption;
|
||||||
|
capabilities.uma = uma;
|
||||||
description.name = Utf16ToUtf8(adapterDesc.Description);
|
description.name = Utf16ToUtf8(adapterDesc.Description);
|
||||||
description.dedicatedVideoMemory = adapterDesc.DedicatedVideoMemory;
|
description.dedicatedVideoMemory = adapterDesc.DedicatedVideoMemory;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1789,6 +1789,9 @@ namespace plume {
|
||||||
// Draw.
|
// Draw.
|
||||||
bool triangleFan = false;
|
bool triangleFan = false;
|
||||||
bool dynamicDepthBias = false;
|
bool dynamicDepthBias = false;
|
||||||
|
|
||||||
|
// UMA.
|
||||||
|
bool uma = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RenderInterfaceCapabilities {
|
struct RenderInterfaceCapabilities {
|
||||||
|
|
|
||||||
|
|
@ -1499,7 +1499,8 @@ static void ApplyLowEndDefaults()
|
||||||
ApplyLowEndDefault(Config::TransparencyAntiAliasing, false, changed);
|
ApplyLowEndDefault(Config::TransparencyAntiAliasing, false, changed);
|
||||||
ApplyLowEndDefault(Config::GITextureFiltering, EGITextureFiltering::Bilinear, changed);
|
ApplyLowEndDefault(Config::GITextureFiltering, EGITextureFiltering::Bilinear, changed);
|
||||||
|
|
||||||
if (changed) {
|
if (changed)
|
||||||
|
{
|
||||||
Config::Save();
|
Config::Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1551,20 +1552,22 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_capabilities = g_device->getCapabilities();
|
||||||
|
|
||||||
LoadEmbeddedResources();
|
LoadEmbeddedResources();
|
||||||
|
|
||||||
constexpr uint64_t LowEndMemoryLimit = 2048ULL * 1024ULL * 1024ULL;
|
constexpr uint64_t LowEndMemoryLimit = 2048ULL * 1024ULL * 1024ULL;
|
||||||
RenderDeviceDescription deviceDescription = g_device->getDescription();
|
RenderDeviceDescription deviceDescription = g_device->getDescription();
|
||||||
bool lowEndType = deviceDescription.type != RenderDeviceType::UNKNOWN && deviceDescription.type != RenderDeviceType::DISCRETE;
|
bool lowEndType = deviceDescription.type != RenderDeviceType::UNKNOWN && deviceDescription.type != RenderDeviceType::DISCRETE;
|
||||||
bool lowEndMemory = deviceDescription.dedicatedVideoMemory < LowEndMemoryLimit;
|
bool lowEndMemory = deviceDescription.dedicatedVideoMemory < LowEndMemoryLimit;
|
||||||
if (lowEndType || lowEndMemory)
|
bool lowEndUMA = deviceDescription.type == RenderDeviceType::UNKNOWN && g_capabilities.uma;
|
||||||
|
if (lowEndType || lowEndMemory || lowEndUMA)
|
||||||
{
|
{
|
||||||
// Switch to low end defaults if a non-discrete GPU was detected or a low amount of VRAM was detected.
|
// Switch to low end defaults if a non-discrete GPU was detected or a low amount of VRAM was detected.
|
||||||
|
// Checking for UMA on D3D12 seems to be a reliable way to detect integrated GPUs.
|
||||||
ApplyLowEndDefaults();
|
ApplyLowEndDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_capabilities = g_device->getCapabilities();
|
|
||||||
|
|
||||||
g_queue = g_device->createCommandQueue(RenderCommandListType::DIRECT);
|
g_queue = g_device->createCommandQueue(RenderCommandListType::DIRECT);
|
||||||
|
|
||||||
for (auto& commandList : g_commandLists)
|
for (auto& commandList : g_commandLists)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue