Skip to content
  • Emma Anholt's avatar
    vc4: Fix sin(0.0) and cos(0.0) accuracy to fix SDL rendering rotation. · 10d5d2d5
    Emma Anholt authored
    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
    10d5d2d5