Skip to content
  • Kenneth Graunke's avatar
    nir: Make gl_nir_lower_samplers use gl_nir_lower_samplers_as_deref · f003859f
    Kenneth Graunke authored
    
    
    These days, we have two sampler lowering passes.  The newer one,
    gl_nir_lower_samplers_as_deref, is used by radeonsi.  It rewrites
    variables to drop structures out of sampler deref chains, to make
    life simpler.  It then sets var->data.binding for non-bindless
    sampler and image variables based on the GL uniform storage's
    opaque index values.
    
    The older one converts sampler deref chains (nir_tex_src_texture_deref)
    to a numerical offset (nir_tex_src_texture_offset).  It also stores the
    constant-valued portion of that number in tex->texture_index, making
    life really simple for drivers that don't support indirects.  It too
    pokes at GL uniform storage's opaque index values.
    
    Logically, we can do the first pass (simplify derefs, set bindings)
    then the second (turn derefs to offsets, set texture_index).  This
    patch does exactly that, eliminating some redundancy (only one pass
    has to poke at GL uniform storage), and gaining proper var->data.binding
    values for drivers using the full lowering.
    
    Reviewed-by: default avatarIan Romanick <ian.d.romanick@intel.com>
    Acked-by: default avatarJason Ekstrand <jason@jlekstrand.net>
    f003859f