Skip to content
  • Eduardo Lima Mitev's avatar
    freedreno/ir3: Add a NIR pass to select tex instructions eligible for pre-fetch · 2a0d45ae
    Eduardo Lima Mitev authored and Rob Clark's avatar Rob Clark committed
    
    
    The pass should run once at the end of shader compilation, for a4xx
    onwards. It iterates texture sampling instructions and mark those
    eligibile for pre-dispatch by changing the tex op from 'tex' to
    'tex_prefetch'. An instruction is eligibile if:
    
    * The coordinate is a vector where all its components come from a
      shader input.
    * The order of the components match exactly that of the input (no
      swizzles).
    * The instruction is in the 'main' function, and in the outer
      most-block.
    
    The first two restrictions were arrived to empirically, so more
    testing could tighten or loosen it.
    
    The 3rd restriction is there to allow moving the instructions
    eligible for pre-dispatch to the beginning of the shader, so
    that we don't block the registers holding the result for too
    long.
    
    Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
    Reviewed-by: default avatarKristian H. Kristensen <hoegsberg@google.com>
    2a0d45ae