vc4: Fix sin(0.0) and cos(0.0) accuracy to fix SDL rendering rotation.
authorEric Anholt <eric@anholt.net>
Fri, 21 Sep 2018 21:11:12 +0000 (14:11 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 22 Sep 2018 00:16:43 +0000 (17:16 -0700)
commit10d5d2d527dea11f4afe300eebeaba077f169af0
tree5fa4fa921aeb02dc4e7b903eea96bc4539dd6e6f
parenta0baedb6387aea78ffb0eb654cb837421e15d9fe
vc4: Fix sin(0.0) and cos(0.0) accuracy to fix SDL rendering rotation.

SDL has some shaders that compute sin(angle) and cos(angle) for a rotation
matrix in the VS, and angle is usually 0.0.  Our previous implementation
had quite a bit of error around 0.0, causing single-pixel rotations at
typical window sizes.  SDL2 has changed as of August 28th (commit
12156:e5a666405750) to not need sin/cos in the VS, but we should still fix
this for existing implementations or similar patterns that other programs
may have.

glsl-cos goes from 32 instructions to 36, but 9 uniforms to 7.
glsl-sin goes from 32 instructions to 34, but 8 uniforms to 7.

This seems like a fine impact to have for the bugfix.

Cc: 18.1 18.2 <mesa-stable@lists.freedesktop.org>
Fixes: https://github.com/anholt/mesa/issues/110
src/gallium/drivers/vc4/vc4_program.c