Hi,

Another info about the 0.5 offset is the following comments in the r600 gallium driver:
                /* Gather4 should follow the same rules as bilinear filtering, but the hardware
                 * incorrectly forces nearest filtering if the texture format is integer.
                 * The only effect it has on Gather4, which always returns 4 texels for
                 * bilinear filtering, is that the final coordinates are off by 0.5 of
                 * the texel size.
                 *
                 * The workaround is to subtract 0.5 from the unnormalized coordinates,
                 * or (0.5 / size) from the normalized coordinates.
                 */
The driver implements the workaround.

r600's GATHER4 is likely to be the original instruction meant for FETCH4, as except for Cayman, the driver reorders the result to match the gl's version.

On 27/01/2019 00:55, Axel Davy wrote:
Hi,

I'm trying to implement FETCH4 as well for nine. Unfortunately, my windows test system died, thus I rely on your experiments.

I experimented with 3DMark06, disabling support for D24X8 texturing to force FETCH4.
I noticed a few things:
. FETCH4 is used for DF24 sampling. A small -0.0002 offset is added to the coordinates.
. For some calls it sets FETCH4 on DXT1 cube textures.
. The texturing support for D24X8 is fetched with usage=0x20002, ie with D3DUSAGE_QUERY_FILTER. I guess this checks PCF support.

My initial patch just let FETCH4 trigger gather4 for the red channel for any texture.
This seems to be wrong though as the game renders black and white as a result.

Clearly looking at how the shader is using the tex output, it was expecting the FETCH4 on the DXT1 cube texture to be a normal tex instruction. There may also be other weird usages I missed.

My understanding of the wine proposed patchset is that you shouldn't hit the same problem as you restrict FETCH4 support for only a small subset of textures.
That raises some other questions, though: Do FETCH4 on some non-FETCH4 texture do really nothing ? I mean, maybe just like for the FETCH4 formats, it's possible projection, lod, etc get ignored.

Axel

On 25/01/2019 19:24, Stefan Dösinger wrote:
Am 25.01.19 um 17:57 schrieb Stefan Dösinger:
Maybe I'll get around to installing Windows 10 on my new Mac with an AMD
Polaris GPU. That should give some clues how the behavior developed
since then.
I totally forgot that I had a desktop box with a Radeon RX 580 card
(Polaris I think) and Windows 10 under my desk. Attached are results
with your filtering settings and point filtering everywhere.

On a quick look it seems that it also has the 0.5 texel offset, but has
some precision issues with the colors it writes. You may have to
increase the allowed slop in the color comparisons. Maybe you can also
add or subtract one from the expected results and keep everything happy
with the current slop.