From 79d1b4db56d3bdcef4330319a8030189417c718f Mon Sep 17 00:00:00 2001 From: Gary Hsu Date: Tue, 21 Sep 2021 18:13:49 -0700 Subject: [PATCH] Fix bug when sampler min/mag is anisotropic but mip is point (#2609) --- src/renderer_d3d11.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 6d2635b09..e936d64ae 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2976,11 +2976,12 @@ namespace bgfx { namespace d3d11 const uint32_t index = (_flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; _flags &= BGFX_SAMPLER_BITS_MASK; - // Force both min+max anisotropic, can't be set individually. - _flags |= 0 != (_flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC) ) - ? BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC - : 0 - ; + // Force min+mag anisotropic (can't be set individually) and remove mip (not supported). + if (0 != (_flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC))) + { + _flags |= BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC; + _flags &= ~BGFX_SAMPLER_MIP_MASK; + } uint32_t hash; ID3D11SamplerState* sampler; @@ -3041,7 +3042,7 @@ namespace bgfx { namespace d3d11 sd.MinLOD = 0; sd.MaxLOD = D3D11_FLOAT32_MAX; - m_device->CreateSamplerState(&sd, &sampler); + DX_CHECK(m_device->CreateSamplerState(&sd, &sampler)); DX_CHECK_REFCOUNT(sampler, 1); m_samplerStateCache.add(hash, sampler);