On Sat, Aug 25, 2018 at 5:25 PM Kenneth Graunke <kenn...@whitecape.org> wrote:
> On Saturday, August 25, 2018 6:05:57 AM PDT Jason Ekstrand wrote: > > On Fri, Aug 24, 2018 at 8:24 PM Kenneth Graunke <kenn...@whitecape.org> > > wrote: > > > > > This is needed for nir_gather_info to actually count the textures, > > > since it operates solely on variables. > > > --- > > > src/mesa/program/prog_to_nir.c | 15 +++++++++++++-- > > > 1 file changed, 13 insertions(+), 2 deletions(-) > > > > > > diff --git a/src/mesa/program/prog_to_nir.c > > > b/src/mesa/program/prog_to_nir.c > > > index 14e57b6c6a1..1f0607542e8 100644 > > > --- a/src/mesa/program/prog_to_nir.c > > > +++ b/src/mesa/program/prog_to_nir.c > > > @@ -52,6 +52,7 @@ struct ptn_compile { > > > nir_variable *parameters; > > > nir_variable *input_vars[VARYING_SLOT_MAX]; > > > nir_variable *output_vars[VARYING_SLOT_MAX]; > > > + nir_variable *sampler_vars[32]; /* matches number of bits in > > > TexSrcUnit */ > > > nir_register **output_regs; > > > nir_register **temp_regs; > > > > > > @@ -484,9 +485,10 @@ ptn_kil(nir_builder *b, nir_ssa_def **src) > > > } > > > > > > static void > > > -ptn_tex(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src, > > > +ptn_tex(struct ptn_compile *c, nir_alu_dest dest, nir_ssa_def **src, > > > struct prog_instruction *prog_inst) > > > { > > > + nir_builder *b = &c->build; > > > nir_tex_instr *instr; > > > nir_texop op; > > > unsigned num_srcs; > > > @@ -568,6 +570,15 @@ ptn_tex(nir_builder *b, nir_alu_dest dest, > > > nir_ssa_def **src, > > > unreachable("can't reach"); > > > } > > > > > > + if (!c->sampler_vars[prog_inst->TexSrcUnit]) { > > > + const struct glsl_type *type = > > > + glsl_sampler_type(instr->sampler_dim, false, false, > > > GLSL_TYPE_FLOAT); > > > + nir_variable *var = > > > + nir_variable_create(b->shader, nir_var_uniform, type, > "sampler"); > > > + var->data.binding = prog_inst->TexSrcUnit; > > > + c->sampler_vars[prog_inst->TexSrcUnit] = var; > > > > > > > Can samplers be indirected? If so, we probably want an array of samplers > > instead 32 distinct samplers. > > That would be a frill. This is ARB_fragment_program. You get an > integer constant for your texture unit number. :) > Ok. In that case, this and patch 1 are Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net> I'll let someone who knows about the implications for other drivers review patch 3 --Jason
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev