diff --git a/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp b/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp index 515d4331..32aac2a8 100644 --- a/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp +++ b/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp @@ -3324,6 +3324,14 @@ namespace plume { 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. bool preferOverNothing = (adapter == nullptr) || (d3d == nullptr); bool preferVideoMemory = adapterDesc.DedicatedVideoMemory > description.dedicatedVideoMemory; @@ -3346,6 +3354,7 @@ namespace plume { capabilities.sampleLocations = samplePositionsOption; capabilities.triangleFan = triangleFanSupportOption; capabilities.dynamicDepthBias = dynamicDepthBiasOption; + capabilities.uma = uma; description.name = Utf16ToUtf8(adapterDesc.Description); description.dedicatedVideoMemory = adapterDesc.DedicatedVideoMemory; diff --git a/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h b/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h index 124daeff..7352e863 100644 --- a/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h +++ b/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h @@ -1789,6 +1789,9 @@ namespace plume { // Draw. bool triangleFan = false; bool dynamicDepthBias = false; + + // UMA. + bool uma = false; }; struct RenderInterfaceCapabilities { diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index c9c58040..fbce3364 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -1499,7 +1499,8 @@ static void ApplyLowEndDefaults() ApplyLowEndDefault(Config::TransparencyAntiAliasing, false, changed); ApplyLowEndDefault(Config::GITextureFiltering, EGITextureFiltering::Bilinear, changed); - if (changed) { + if (changed) + { Config::Save(); } } @@ -1550,6 +1551,8 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) { return false; } + + g_capabilities = g_device->getCapabilities(); LoadEmbeddedResources(); @@ -1557,14 +1560,14 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) RenderDeviceDescription deviceDescription = g_device->getDescription(); bool lowEndType = deviceDescription.type != RenderDeviceType::UNKNOWN && deviceDescription.type != RenderDeviceType::DISCRETE; 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. + // Checking for UMA on D3D12 seems to be a reliable way to detect integrated GPUs. ApplyLowEndDefaults(); } - g_capabilities = g_device->getCapabilities(); - g_queue = g_device->createCommandQueue(RenderCommandListType::DIRECT); for (auto& commandList : g_commandLists)