Fix bug when sampler min/mag is anisotropic but mip is point (#2609)

This commit is contained in:
Gary Hsu 2021-09-21 18:13:49 -07:00 committed by GitHub
parent 227ea05dee
commit 79d1b4db56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2976,11 +2976,12 @@ namespace bgfx { namespace d3d11
const uint32_t index = (_flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; const uint32_t index = (_flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT;
_flags &= BGFX_SAMPLER_BITS_MASK; _flags &= BGFX_SAMPLER_BITS_MASK;
// Force both min+max anisotropic, can't be set individually. // Force min+mag anisotropic (can't be set individually) and remove mip (not supported).
_flags |= 0 != (_flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC) ) if (0 != (_flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC)))
? BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC {
: 0 _flags |= BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC;
; _flags &= ~BGFX_SAMPLER_MIP_MASK;
}
uint32_t hash; uint32_t hash;
ID3D11SamplerState* sampler; ID3D11SamplerState* sampler;
@ -3041,7 +3042,7 @@ namespace bgfx { namespace d3d11
sd.MinLOD = 0; sd.MinLOD = 0;
sd.MaxLOD = D3D11_FLOAT32_MAX; sd.MaxLOD = D3D11_FLOAT32_MAX;
m_device->CreateSamplerState(&sd, &sampler); DX_CHECK(m_device->CreateSamplerState(&sd, &sampler));
DX_CHECK_REFCOUNT(sampler, 1); DX_CHECK_REFCOUNT(sampler, 1);
m_samplerStateCache.add(hash, sampler); m_samplerStateCache.add(hash, sampler);