<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 4, 2018 at 3:18 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"><div class="HOEnZb"><div class="h5">On Wed, Apr 4, 2018 at 2:16 AM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> On Tue, Apr 3, 2018 at 6:21 AM, Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>> wrote:<br>
>><br>
>> 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<br>
>> 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 =<br>
>> 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>
>> */<br>
>> nir_tex_src_sampler_offset, /* < dynamically uniform indirect offset<br>
>> */<br>
>> nir_tex_src_plane, /* < selects plane for planar textures */<br>
>> + nir_tex_src_handle, /* < handle for bindless samples */<br>
><br>
><br>
> Do we want to have separate texture and sampler handles? We don't care for<br>
> GL but I kind-of think we will for Vulkan.<br>
><br>
<br>
</div></div>Don't know. Never looked into vulkan yet. I could rename it to<br>
sample_handle for now and we can add the texture handle later for<br>
vulkan?<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>Sure. Or we can just add both now and add nir_print support for both and then we have them. It's just an enum. It's not like it costs us much.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
>><br>
>> 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<br>
>> *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>
>> --<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>
><br>
><br>
</div></div></blockquote></div><br></div></div>