gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 548 forks source link

dx12: nearest mipmap lods #2102

Open msiglreith opened 6 years ago

msiglreith commented 6 years ago

min and max lods need to be adjusted by 0.5 (added) to pass the nearest mipmap lod CTS tests (dEQP-VK.texture.mipmap.cubemap.max_lod.nearest_nearest, etc).

Would be nice to get some more details about this than just adding some 'random' magic values.

msiglreith commented 6 years ago

Vulkan spec: image level parameter = ceil(d + 0.5) - 1 or floor(d + 0.5) for mipmap nearest, where d = base_level + lod parameter dx12 might just floor(?) even though it would be surprising..

msiglreith commented 6 years ago

probably worth testing it on multiple GPUs and drivers

fkaa commented 6 years ago

@msiglreith i get the following results on dEQP-VK.texture.mipmap.cubemap.max_lod.nearest_nearest:

Normal Min/MaxLOD += 0.5

Driver version: 18.3.4 GPU: Radeon (TM) RX 470 Graphics

fkaa commented 6 years ago

This seems to suggest rounding for mipmap selection unless I'm understanding it wrong:

[...] The texture filter to be used between mipmap levels is nearest-point mipmap filtering. The rasterizer uses the color from the texel of the nearest mipmap texture.