radv: Use TRUNC_COORD on samplers
authorJoshua Ashton <joshua@froggi.es>
Tue, 25 Feb 2020 19:24:15 +0000 (19:24 +0000)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Apr 2020 09:57:08 +0000 (09:57 +0000)
commit58f25098a0dc4f4976dadacdc4e7a9db42ec0c50
treec5a358e7e7ea7cc8f3be3187428d081e4dffb3f0
parent7086b38c81ebe2f0520461c1bc1a7b92863cf871
radv: Use TRUNC_COORD on samplers

The default behaviour (0) is: "round-nearest-even to n.6 and drop fraction when point sampling" whereas the Vulkan spec simply wants us to floor it (1) "truncate when point sampling".

See 15.6.1 in the Vulkan spec.
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#textures-normalized-operations

The Direct3D spec also mandates this (https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm#7.18.7%20Point%20Sample%20Addressing)

This fixes some point-sampling texture precision issues in some Direct3D 9 titles such as Guild Wars 2 and htoL#NiQ: The Firefly Diary that are not present on other vendors.

Fixes dEQP-VK.pipeline.sampler.exact_sampling.*

https://github.com/Joshua-Ashton/d9vk/issues/450
https://github.com/doitsujin/dxvk/issues/1433

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3951>
src/amd/vulkan/radv_device.c