<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 3, 2018 at 6:21 AM, Karol Herbst <span dir="ltr"><<a href="mailto:kherbst@redhat.com" target="_blank">kherbst@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>><br>
---<br>
 src/compiler/glsl/glsl_to_nir.<wbr>cpp | 17 +++++++++++++++--<br>
 src/compiler/nir/nir.h            |  1 +<br>
 src/compiler/nir/nir_print.c      |  3 +++<br>
 3 files changed, 19 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/glsl_to_<wbr>nir.cpp b/src/compiler/glsl/glsl_to_<wbr>nir.cpp<br>
index dbb58d82e8f..8e2d96a2361 100644<br>
--- a/src/compiler/glsl/glsl_to_<wbr>nir.cpp<br>
+++ b/src/compiler/glsl/glsl_to_<wbr>nir.cpp<br>
@@ -1971,6 +1971,8 @@ nir_visitor::visit(ir_texture *ir)<br>
 {<br>
    unsigned num_srcs;<br>
    nir_texop op;<br>
+   bool bindless = ir->sampler->variable_<wbr>referenced()->contains_<wbr>bindless();<br>
+<br>
    switch (ir->op) {<br>
    case ir_tex:<br>
       op = nir_texop_tex;<br>
@@ -2044,6 +2046,8 @@ nir_visitor::visit(ir_texture *ir)<br>
       num_srcs++;<br>
    if (ir->offset != NULL)<br>
       num_srcs++;<br>
+   if (bindless)<br>
+      num_srcs=+;<br>
<br>
    nir_tex_instr *instr = nir_tex_instr_create(this-><wbr>shader, num_srcs);<br>
<br>
@@ -2069,10 +2073,19 @@ nir_visitor::visit(ir_texture *ir)<br>
       unreachable("not reached");<br>
    }<br>
<br>
-   instr->texture = evaluate_deref(&instr->instr, ir->sampler);<br>
-<br>
    unsigned src_number = 0;<br>
<br>
+   /* for bindless we use the handle src */<br>
+   if (bindless) {<br>
+      instr->texture = NULL;<br>
+      instr->src[src_number].src =<br>
+         nir_src_for_ssa(evaluate_<wbr>rvalue(ir->sampler));<br>
+      instr->src[src_number].src_<wbr>type = nir_tex_src_handle;<br>
+      src_number++;<br>
+   } else {<br>
+      instr->texture = evaluate_deref(&instr->instr, ir->sampler);<br>
+   }<br>
+<br>
    if (ir->coordinate != NULL) {<br>
       instr->coord_components = ir->coordinate->type->vector_<wbr>elements;<br>
       instr->src[src_number].src =<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index f33049d7134..e4d626d263e 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -1218,6 +1218,7 @@ typedef enum {<br>
    nir_tex_src_texture_offset, /* < dynamically uniform indirect offset */<br>
    nir_tex_src_sampler_offset, /* < dynamically uniform indirect offset */<br>
    nir_tex_src_plane,          /* < selects plane for planar textures */<br>
+   nir_tex_src_handle,         /* < handle for bindless samples */<br></blockquote><div><br></div><div>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.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    nir_num_tex_src_types<br>
 } nir_tex_src_type;<br>
<br>
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c<br>
index 21f13097651..c9431555f2f 100644<br>
--- a/src/compiler/nir/nir_print.c<br>
+++ b/src/compiler/nir/nir_print.c<br>
@@ -778,6 +778,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)<br>
       case nir_tex_src_plane:<br>
          fprintf(fp, "(plane)");<br>
          break;<br>
+      case nir_tex_src_handle:<br>
+         fprintf(fp, "(handle)");<br>
+         break;<br>
<br>
       default:<br>
          unreachable("Invalid texture source type");<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>