[Mesa-dev] [PATCH 00/12] i965+nir: Do pack/unpack lowering in NIR

Matt Turner mattst88 at gmail.com
Mon Jan 25 15:18:00 PST 2016


This series adds NIR support for lowering pack/unpack opcodes and
switches i965 over to using that. The only place we still use the
GLSL IR lower_packing_builtins.cpp is for the half-precision functions
on Sandybridge.

As a result, I get to remove the ir_unop_unpack_half_2x16_split_x/y opcodes
from GLSL IR, since i965 was the only consumer. A follow-on project I plan to
do is to remove these opcodes from NIR as well and just emit the appropriate
code directly in i965/fs, because again it's the only consumer.

I add 6 new operations to NIR:

   extract_ibyte - extract byte from dword and sign extend
   extract_ubyte - extract byte from dword and zero extend
   extract_iword - extract word from dword and sign extend
   extract_uword - extract word from dword and zero extend
   pack_uvec4_to_uint - packs the low 8-bits of src0.xyzw into a uint
   pack_uvec2_to_uint - packs the low 16-bits of src0.xy into a uint

The last two opcodes are used in lowering the pack operations. They're mostly
useful because nir_opt_algebraic isn't capable of handling swizzles. I look
forward to getting rid of them.

I sent an RFC patch in December [1] that optimized some Unigine shaders with
extract_byte. Eric asked whether we should add new opcodes (extract_*) or use
bitfield_extract and recognize special cases in the driver backends. I've opted
to add new operations because of the simplicity of recognition with
nir_opt_algebraic.

I'm planning to rebase that optimization on this series and send it separately.

[1] http://lists.freedesktop.org/archives/mesa-dev/2015-December/102264.html



More information about the mesa-dev mailing list