On Tue, Apr 3, 2018 at 6:21 AM, Karol Herbst <kher...@redhat.com> wrote:
> Signed-off-by: Karol Herbst <kher...@redhat.com> > --- > src/compiler/glsl/glsl_to_nir.cpp | 17 +++++++++++++++-- > src/compiler/nir/nir.h | 1 + > src/compiler/nir/nir_print.c | 3 +++ > 3 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/src/compiler/glsl/glsl_to_nir.cpp > b/src/compiler/glsl/glsl_to_nir.cpp > index dbb58d82e8f..8e2d96a2361 100644 > --- a/src/compiler/glsl/glsl_to_nir.cpp > +++ b/src/compiler/glsl/glsl_to_nir.cpp > @@ -1971,6 +1971,8 @@ nir_visitor::visit(ir_texture *ir) > { > unsigned num_srcs; > nir_texop op; > + bool bindless = ir->sampler->variable_referenced()->contains_ > bindless(); > + > switch (ir->op) { > case ir_tex: > op = nir_texop_tex; > @@ -2044,6 +2046,8 @@ nir_visitor::visit(ir_texture *ir) > num_srcs++; > if (ir->offset != NULL) > num_srcs++; > + if (bindless) > + num_srcs=+; > > nir_tex_instr *instr = nir_tex_instr_create(this->shader, num_srcs); > > @@ -2069,10 +2073,19 @@ nir_visitor::visit(ir_texture *ir) > unreachable("not reached"); > } > > - instr->texture = evaluate_deref(&instr->instr, ir->sampler); > - > unsigned src_number = 0; > > + /* for bindless we use the handle src */ > + if (bindless) { > + instr->texture = NULL; > + instr->src[src_number].src = > + nir_src_for_ssa(evaluate_rvalue(ir->sampler)); > + instr->src[src_number].src_type = nir_tex_src_handle; > + src_number++; > + } else { > + instr->texture = evaluate_deref(&instr->instr, ir->sampler); > + } > + > if (ir->coordinate != NULL) { > instr->coord_components = ir->coordinate->type->vector_elements; > instr->src[src_number].src = > diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h > index f33049d7134..e4d626d263e 100644 > --- a/src/compiler/nir/nir.h > +++ b/src/compiler/nir/nir.h > @@ -1218,6 +1218,7 @@ typedef enum { > nir_tex_src_texture_offset, /* < dynamically uniform indirect offset */ > nir_tex_src_sampler_offset, /* < dynamically uniform indirect offset */ > nir_tex_src_plane, /* < selects plane for planar textures */ > + nir_tex_src_handle, /* < handle for bindless samples */ > Do we want to have separate texture and sampler handles? We don't care for GL but I kind-of think we will for Vulkan. > nir_num_tex_src_types > } nir_tex_src_type; > > diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c > index 21f13097651..c9431555f2f 100644 > --- a/src/compiler/nir/nir_print.c > +++ b/src/compiler/nir/nir_print.c > @@ -778,6 +778,9 @@ print_tex_instr(nir_tex_instr *instr, print_state > *state) > case nir_tex_src_plane: > fprintf(fp, "(plane)"); > break; > + case nir_tex_src_handle: > + fprintf(fp, "(handle)"); > + break; > > default: > unreachable("Invalid texture source type"); > -- > 2.14.3 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev