Skip to content
  • Emma Anholt's avatar
    freedreno+turnip: Upload large shader constants as a UBO. · 1f440533
    Emma Anholt authored
    Right now if the shader indirects on some large constant array, we see NIR
    load_consts (usually from the const file) of its contents into general
    registers, then indirection on the GPRs.  This often results in register
    allocation failures, as it's easy to go beyond the ~256 dwords of
    registers per invocation.
    
    By moving the large constants to a UBO, we can load an arbitrary number of
    them.  They also can be theoretically moved to the constant reg file (~2k
    dwords), though you're unlikely to hit this path without an indirect load
    on your large constant, and we don't yet let UBO indirect loads get moved
    to constant regs.
    
    This possibly won't work out right if we have 16-bit load_constants, but
    without other MRs in flight we won't see 16-bit temps to be lowered to
    this.
    
    This allows 2 kerbal-space-program shaders to compile that previously
    would fail, and fixes the new dEQP-VK and -GLES2 tests I wrote that
    dynamically index a 40-element temporary array of float/vec2/vec3/vec4
    with constant element initializers.
    
    Closes: mesa/mesa#2789
    Part-of: <mesa/mesa!5810>
    1f440533