#40

d3d11: report a resolved MipLevels for an "all mips" shader resource view (Dark Souls III crash)

Openmeshoklvwants to merge intofrom

ID3D11ShaderResourceView::GetDesc returned MipLevels = 0xFFFFFFFF for a view created with MipLevels = (UINT)-1 ("all mips from MostDetailedMip on"). D3D11 reports the resolved count here. Wine's d3d11 does the same in normalize_srv_desc.

Effect in Dark Souls III (Steam): the game reads Texture2D.MipLevels back from such a view (PPFX::IGPUTexture, GPUInterfaceTexture.cpp). It sizes a per-mip array with that value: 0xFFFFFFFF × 8 + 8 bytes. The allocation returns NULL, and the game crashes with c0000005 at DarkSoulsIII.exe+0x176d65b (black screen).

Fix: resolve -1 to the texture's mip count minus MostDetailedMip for every texture SRV dimension, in ExtractEntireResourceViewDescription (the caller-desc branch).

Tested on an iPhone Air (iOS 27.2): Madeira with this d3d11.dll (arm64ec, built from 128b297 + this commit). DS3 now passes the crash point and renders at 60 fps. With the unpatched d3d11.dll, the same launch crashes at the same address every time. The unpatched build from this tree matches the farm d3d11.dll in size, imports and exports.

🤖 Generated with Claude Code