gallium,nir: Excessively flagging ST_NEW_SAMPLERS/samplers_used?
Some shader programs don't use samplers (i.e. nir_tex_instr_need_sampler()
returns false on all texture instructions). Regardless, we:
- Flag new samplers in
prog->affected_states
whenever a texture is used (seest_set_prog_affected_state_flags()
). - Set bits in
prog->info.samplers_used
whenever a sampler is found (nir_visitor::visit(ir_texture *ir)
adds one to all texture instructions andgl_nir_lower_samplers_as_deref()
sets the bitfield).
Instead, it seems like we should be setting samplers_used
only if nir_tex_instr_need_sampler()
ever returns true. Then we should flag new samplers if samplers_used
is not empty. Is this correct?
For a little context, I ran into this while implementing !19827 (e60544b1). Iris currently uploads a default/blank surface state object when running into this.