Skip to content

i965,anv: Fix fractional viewport coordinates handling

On gen8+ fractional translation of viewport moved it by a whole integer. The behaviour in this case isn't defined anywhere but some apps like Wine may depend on viewport's width and height being ceiled.


There is a similar bug filed for Nvidia driver . I wasn't able to find the exact specification for such case but e.g. Wine expects coordinates not to be shifted (see wined3d_caps_gl_ctx_test_viewport_subpixel_bits function in Wine).

The closest line in specs is in the specification of ARB_viewport_array extension:

Direct3D 11 specifies that rasterization along the one-pixel edges of fractional viewports to be undefined. If implementations want defined behavior with fractional viewports, they can program a slightly wider viewport and scissor away the pixels along the edge of the expanded viewport.

Viewport's width and height are already ceiled on radeon driver (e50e1f86) and i965 behaves the same before gen8.

This patch was moved from the mailing lists. It passes CI

Edited by Jordan Justen

Merge request reports