[Mesa-dev] [PATCH v2 1/3] nir/split_var_copies: handle IMAGE and SAMPLER for bindless vars
Jason Ekstrand
jason at jlekstrand.net
Tue Apr 10 17:41:14 UTC 2018
On Tue, Apr 10, 2018 at 10:20 AM, Karol Herbst <kherbst at redhat.com> wrote:
> On Tue, Apr 10, 2018 at 6:01 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > On Tue, Apr 10, 2018 at 8:35 AM, Karol Herbst <kherbst at redhat.com>
> wrote:
> >>
> >> On Tue, Apr 10, 2018 at 5:12 PM, Jason Ekstrand <jason at jlekstrand.net>
> >> wrote:
> >> > I still don't see anything to make nir_validate not fail out on you if
> >> > it
> >> > sees a read or a write to/from an IMAGE or SAMPLER.
> >> >
> >>
> >> what kind of glsl code are you talking about here? I wrote some tests
> >> and things just seem to work out. I wasn't able to hit any other
> >> issues.
> >
> >
> > Were they tests where GLSL was able to copy propagate such that NIR never
> > saw a write to the image/sampler variable?
> >
>
> Well the trivial one is where you directly consume the uniform.
>
You could probably do something like this
sampler2D s;
for (int i = 0; i < uniform_one; i++)
s = some_sampler;
texture(s, coords);
> >>
> >> > On Tue, Apr 10, 2018 at 8:05 AM, Karol Herbst <kherbst at redhat.com>
> >> > wrote:
> >> >>
> >> >> v2: fix assertion for bindless to non bindless assignments
> >> >>
> >> >> Signed-off-by: Karol Herbst <kherbst at redhat.com>
> >> >> ---
> >> >> src/compiler/nir/nir_split_var_copies.c | 8 +++++++-
> >> >> 1 file changed, 7 insertions(+), 1 deletion(-)
> >> >>
> >> >> diff --git a/src/compiler/nir/nir_split_var_copies.c
> >> >> b/src/compiler/nir/nir_split_var_copies.c
> >> >> index bc3ceedbdb8..e592754d770 100644
> >> >> --- a/src/compiler/nir/nir_split_var_copies.c
> >> >> +++ b/src/compiler/nir/nir_split_var_copies.c
> >> >> @@ -222,8 +222,9 @@ split_var_copies_block(nir_block *block, struct
> >> >> split_var_copies_state *state)
> >> >> nir_deref_var *src_head = intrinsic->variables[1];
> >> >> nir_deref *dest_tail = nir_deref_tail(&dest_head->deref);
> >> >> nir_deref *src_tail = nir_deref_tail(&src_head->deref);
> >> >> + enum glsl_base_type base_type =
> >> >> glsl_get_base_type(src_tail->type);
> >> >>
> >> >> - switch (glsl_get_base_type(src_tail->type)) {
> >> >> + switch (base_type) {
> >> >> case GLSL_TYPE_ARRAY:
> >> >> case GLSL_TYPE_STRUCT:
> >> >> split_var_copy_instr(intrinsic, dest_head, src_head,
> >> >> @@ -241,6 +242,11 @@ split_var_copies_block(nir_block *block, struct
> >> >> split_var_copies_state *state)
> >> >> ralloc_steal(state->dead_ctx, instr);
> >> >> }
> >> >> break;
> >> >> + /* for bindless those are uint64 */
> >> >> + case GLSL_TYPE_IMAGE:
> >> >> + case GLSL_TYPE_SAMPLER:
> >> >> + assert(src_head->var->data.bindless ||
> >> >> + glsl_get_base_type(src_head->var->type) ==
> base_type);
> >> >> case GLSL_TYPE_INT:
> >> >> case GLSL_TYPE_UINT:
> >> >> case GLSL_TYPE_INT16:
> >> >> --
> >> >> 2.14.3
> >> >>
> >> >
> >> >
> >> > _______________________________________________
> >> > mesa-dev mailing list
> >> > mesa-dev at lists.freedesktop.org
> >> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180410/ef0d5bf3/attachment.html>
More information about the mesa-dev
mailing list