[Mesa-dev] Mesa (master): gallium: Add tgsi_to_nir to get a nir_shader for a TGSI shader.

Jose Fonseca jfonseca at vmware.com
Wed Apr 1 12:15:47 PDT 2015


On 01/04/15 19:49, Brian Paul wrote:
> On 04/01/2015 12:02 PM, Eric Anholt wrote:
>> Module: Mesa
>> Branch: master
>> Commit: 783ad697d25e754ab719ab6c715969c35dbe867b
>> URL:
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__cgit.freedesktop.org_mesa_mesa_commit_-3Fid-3D783ad697d25e754ab719ab6c715969c35dbe867b&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=a-09zLFxtZs6ixn-alr13iDBorBkDSkqkMg6vkd_pck&s=saYPnwqarUJ3EYKew21KmGPcWAUJEnLemc79_M8o9Rs&e=
>>
>>
>> Author: Eric Anholt <eric at anholt.net>
>> Date:   Wed Oct 29 14:32:16 2014 -0700
>>
>> gallium: Add tgsi_to_nir to get a nir_shader for a TGSI shader.
>>
>> This will be used by the VC4 driver for doing device-independent
>> optimization, and hopefully eventually replacing its whole IR.  It also
>> may be useful to other drivers for the same reason.
>>
>> v2: Add all of the instructions I was relying on tgsi_lowering to remove,
>>      and more.
>> v3: Rebase on SSA rework of the builder.
>> v4: Use the NIR ineg operation instead of doing a src modifier.
>> v5: Don't use ineg for fnegs.  (infer_src_type on MOV doesn't do what I
>>      expect, again).
>> v6: Fix handling of multi-channel KILL_IF sources.
>> v7: Make ttn_get_f() return a swizzle of a scalar load_const, rather than
>>      a vector load_const.  CSE doesn't recognize that srcs out of those
>>      channels are actually all the same.
>> v8: Rebase on nir_builder auto-sizing, make the scalar arguments to
>>      non-ALU instructions actually be scalars.
>> v9: Add support for if/loop instructions, additional texture targets, and
>>      untested support for indirect addressing on temps.
>> v10: Rebase on master, drop bad comment about control flow and just
>> choose
>>       the X channel, use int comparison opcodes in LIT for now, drop
>> unused
>>       pipe_context argument..
>> v11: Fix translation of LRP (previously missed because I mis-translated
>>       back out), use nir_builder init helpers.
>> v12: Rebase on master, adding explicit include of mtypes.h to get
>>       INTERP_QUALIFIER_*
>> v13: Rebase on variables being in lists instead of hash tables, drop use
>>       of mtypes.h in favor of util/pipeline.h.  Use Ken's nir_builder
>>       swizzle and fmov/imov_alu helpers, drop "struct" in front of
>>       nir_builder, use nir_builder directly as the function arg in a
>> lot of
>>       cases, drop redundant members of ttn_compile that are also in
>>       nir_builder, drop some half-baked malloc failure handling.
>> v14: The indirect uniform src0 should be scalar, not vector (noticed as
>>       odd by robclark, confirmed by cwabbott).  Apply Ken's review to
>>       initialize s->num_uniforms and friends, skip ttn_channel for dot
>>       products, and use the simpler discard_if intrinsic.
>>
>> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org> (v13)
>> Acked-by: Rob Clark <robclark at freedesktop.org>
>
> For some reason, the scons build is not working after this commit on
> Windows and some of our Linux machines.  But it does build on my
> personal Linux machine:
>
> The error is:
>
> scons: done reading SConscript files.
> scons: Building targets ...
>    Compiling src/gallium/auxiliary/nir/tgsi_to_nir.c ...
> In file included from src/gallium/auxiliary/nir/tgsi_to_nir.c:26:0:
> src/glsl/nir/nir.h:39:25: fatal error: nir_opcodes.h: No such file or
> directory
>   #include "nir_opcodes.h"
>                           ^
> compilation terminated.
>
> I've added '#/src/glsl/nir' to the CPPPATH in
> src/gallium/auxiliary/SConscript but it's still not working.
>
> I'll keep digging.
>
> -Brian
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=73M_2s9FwyA9Li4hjEQQ80TMm8RPS2-ghqQOae6XdYI&s=BLARMZQAMWag3Ol-4NScFWy2w3i_nD7lBbdWSxI54cs&e=
>


Sorry I only noticed this email now. I've actually just pushed a couple 
of trivial changes that fix the build.

In the medium/long term we should look building NIR on SCons regardless. 
  It only needs to be built with MSVC 2013 U4 which supports C99, hence 
there should be no major hick up.

Jose


More information about the mesa-dev mailing list