From 010b07b2df1bd20bcd2bd64aeea93f31c65abde6 Mon Sep 17 00:00:00 2001 From: driver1998 Date: Sat, 4 May 2019 06:12:01 +0800 Subject: [PATCH] Fix a crash on DirextX 11 with Feature Level <= 9_3 hardware Mobile usually uses 9_3 or lower hardware. The same issue happens on x64 as well, so it might be a universal one, not limited to ARM or UWP. --- GPU/D3D11/TextureCacheD3D11.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index d943b91d79..cb593d7873 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -85,16 +85,16 @@ ID3D11SamplerState *SamplerCacheD3D11::GetOrCreateSampler(ID3D11Device *device, samp.Filter = D3D11_FILTER_ANISOTROPIC; else samp.Filter = filters[filterKey]; -#if PPSSPP_PLATFORM(UWP) && PPSSPP_ARCH(ARM) - // For some reason, can't set MaxLOD on mobile. - samp.MaxLOD = FLT_MAX; - samp.MinLOD = -FLT_MAX; - samp.MipLODBias = 0.0f; -#else - samp.MaxLOD = key.maxLevel / 256.0f; - samp.MinLOD = key.minLevel / 256.0f; - samp.MipLODBias = key.lodBias / 256.0f; -#endif + // Can't set MaxLOD on Feature Level <= 9_3. + if (device->GetFeatureLevel() <= D3D_FEATURE_LEVEL_9_3) { + samp.MaxLOD = FLT_MAX; + samp.MinLOD = -FLT_MAX; + samp.MipLODBias = 0.0f; + } else { + samp.MaxLOD = key.maxLevel / 256.0f; + samp.MinLOD = key.minLevel / 256.0f; + samp.MipLODBias = key.lodBias / 256.0f; + } samp.ComparisonFunc = D3D11_COMPARISON_NEVER; for (int i = 0; i < 4; i++) { samp.BorderColor[i] = 1.0f;