Skip to content

Don't ask D3D12 for anisotropic filtering with point mipmapping - #36

Merged
ivan-ushakov merged 1 commit into
crossplatformfrom
fix/d3d12-anisotropic-sampler-filter
Aug 8, 2026
Merged

Don't ask D3D12 for anisotropic filtering with point mipmapping#36
ivan-ushakov merged 1 commit into
crossplatformfrom
fix/d3d12-anisotropic-sampler-filter

Conversation

@ivan-ushakov

Copy link
Copy Markdown
Collaborator

No description provided.

Windows 10 users crashed at FT::Font::size() with a null this. The font was the
last thing to go wrong, not the first: the whole GPU device was already dead.

SDLWaterRenderer reuses one SDL_GPUSamplerCreateInfo for both its samplers. The
second switches mipmap_mode to NEAREST for a render target with no mip chain,
but enable_anisotropy is still set from the first. Vulkan and Metal carry the
filters and anisotropy as independent fields and take that happily. D3D12 packs
them into one enum, and SDLToD3D12_Filter builds it arithmetically:
MIN_MAG_LINEAR_MIP_POINT (0x14) | ANISOTROPIC (0x40) = 0x54, which is not a
D3D12_FILTER. Only 0x55 and its comparison form are.

CreateSampler returns void, so the runtime cannot refuse it by return code. It
removes the device instead, and every texture and pipeline after that fails with
DXGI_ERROR_INVALID_CALL: the water and minimap pipelines, then the glyph atlas,
whose failure surfaced two subsystems away as a null FT::Font that nothing
checks. Windows 11 hid all of it -- its newer D3D12Core.dll sanitises the bit
pattern, most likely to the D3D12_FILTER_ANISOTROPIC this now asks for outright.

Dropping the line is behaviour-preserving: with one mip level there is nothing
for POINT and LINEAR to differ over, and max_lod already pins sampling to it.
Swept the other nine sampler sites; anisotropy is either off or already paired
with linear mipmapping. The rule is written up in Build-PORTING.md beside the
vertex-semantic trap, which is the same shape of problem.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ivan-ushakov
ivan-ushakov merged commit 663571e into crossplatform Aug 8, 2026
4 checks passed
@ivan-ushakov
ivan-ushakov deleted the fix/d3d12-anisotropic-sampler-filter branch August 8, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant