[Mesa-dev] [PATCH 10/12] nir: Add lowering support for unpacking opcodes.

Jason Ekstrand jason at jlekstrand.net
Thu Jan 28 10:35:44 PST 2016


On Jan 28, 2016 09:25, "Matt Turner" <mattst88 at gmail.com> wrote:
>
> On Thu, Jan 28, 2016 at 12:38 AM, Iago Toral <itoral at igalia.com> wrote:
> > On Mon, 2016-01-25 at 15:18 -0800, Matt Turner wrote:
> >> ---
> >>  src/glsl/nir/nir.h                |  4 ++++
> >>  src/glsl/nir/nir_opt_algebraic.py | 28 ++++++++++++++++++++++++++++
> >>  2 files changed, 32 insertions(+)
> >>
> >> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> >> index bbd5b1a..3b90b51 100644
> >> --- a/src/glsl/nir/nir.h
> >> +++ b/src/glsl/nir/nir.h
> >> @@ -1474,6 +1474,10 @@ typedef struct nir_shader_compiler_options {
> >>     bool lower_pack_unorm_4x8;
> >>     bool lower_pack_snorm_4x8;
> >>     bool lower_unpack_half_2x16;
> >> +   bool lower_unpack_unorm_2x16;
> >> +   bool lower_unpack_snorm_2x16;
> >> +   bool lower_unpack_unorm_4x8;
> >> +   bool lower_unpack_snorm_4x8;
> >>
> >>     bool lower_extract_byte;
> >>     bool lower_extract_word;
> >> diff --git a/src/glsl/nir/nir_opt_algebraic.py
b/src/glsl/nir/nir_opt_algebraic.py
> >> index 56b0f5e..a0d6c07 100644
> >> --- a/src/glsl/nir/nir_opt_algebraic.py
> >> +++ b/src/glsl/nir/nir_opt_algebraic.py
> >> @@ -278,6 +278,34 @@ optimizations = [
> >>       ('pack_uvec4_to_uint',
> >>          ('f2i', ('fround_even', ('fmul', ('fmin', 1.0, ('fmax', -1.0,
'v')), 127.0)))),
> >>       'options->lower_pack_snorm_4x8'),
> >> +
> >> +    (('unpack_unorm_2x16', 'v'),
> >> +     ('fdiv', ('u2f', ('vec4', ('extract_uword', 'v', 0),
> >> +                               ('extract_uword', 'v', 1), 0, 0)),
> >> +              65535.0),
> >> +     'options->lower_unpack_unorm_2x16'),
> >
> > This should return a vec2 not a vec4, right?
>
> Yes (and I believe it does)
>
> Is the vec4(..., ..., 0, 0) the cause of concern? The zeros are
> unused, and I'm not sure how to generate a plain vec2 here -- NIR only
> has a vec4 operation.

No, it also has 2 and 3. Are those not working for some reason?
_______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20160128/30c983c3/attachment-0001.html>


More information about the mesa-dev mailing list