Re: [Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation (v3)

2016-11-08 Thread Eric Anholt
Dave Airlie writes: > From: Dave Airlie > > This is ported from GLSL and converts > > if (cond) > discard; > > into > discard_if(cond); > > This removes a block, but also is needed by radv > to workaround a bug in the LLVM backend. > > v2: handle if (a) discard_if(b) (nha) > cleanup and dr

[Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation (v3)

2016-11-07 Thread Dave Airlie
From: Dave Airlie This is ported from GLSL and converts if (cond) discard; into discard_if(cond); This removes a block, but also is needed by radv to workaround a bug in the LLVM backend. v2: handle if (a) discard_if(b) (nha) cleanup and drop pointless loop (Matt) make sure there are

Re: [Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation

2016-11-03 Thread Dave Airlie
On 3 Nov. 2016 18:21, "Gustaw Smolarczyk" wrote: > > I am not really that much familiar with nir, so I apologize if what I write below is wrong. > > What if we had something like: > > a = 0; > if (x) { > discard_if(y); > a = 1; > } > > Then if (x && !y), we must not discard and both at the sam

Re: [Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation

2016-11-03 Thread Gustaw Smolarczyk
I am not really that much familiar with nir, so I apologize if what I write below is wrong. What if we had something like: a = 0; if (x) { discard_if(y); a = 1; } Then if (x && !y), we must not discard and both at the same time set a to 1. Your transformation would probably change it to: a

[Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation

2016-11-02 Thread Dave Airlie
From: Dave Airlie This is ported from GLSL and converts if (cond) discard; into discard_if(cond); This removes a block, but also is needed by radv to workaround a bug in the LLVM backend. v2: handle if (a) discard_if(b) (nha) cleanup and drop pointless loop (Matt) make sure there are

Re: [Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation

2016-11-02 Thread Matt Turner
On Tue, Nov 1, 2016 at 6:26 PM, Dave Airlie wrote: > From: Dave Airlie > > This is ported from GLSL and converts > > if (cond) > discard; > > into > discard_if(cond); > > This removes a block, but also is needed by radv > to workaround a bug in the LLVM backend. > > Signed-off-by: Dave Ai

Re: [Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation

2016-11-02 Thread Eric Anholt
Dave Airlie writes: > From: Dave Airlie > > This is ported from GLSL and converts > > if (cond) > discard; > > into > discard_if(cond); > > This removes a block, but also is needed by radv > to workaround a bug in the LLVM backend. I think this is missing "also make sure that after our if

Re: [Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation

2016-11-02 Thread Nicolai Hähnle
On 02.11.2016 02:26, Dave Airlie wrote: From: Dave Airlie This is ported from GLSL and converts if (cond) discard; into discard_if(cond); This removes a block, but also is needed by radv to workaround a bug in the LLVM backend. FYI, the GLSL pass also converts if (A) discard

[Mesa-dev] [PATCH 2/3] nir: add conditional discard optimisation

2016-11-01 Thread Dave Airlie
From: Dave Airlie This is ported from GLSL and converts if (cond) discard; into discard_if(cond); This removes a block, but also is needed by radv to workaround a bug in the LLVM backend. Signed-off-by: Dave Airlie --- src/compiler/Makefile.sources | 1 + src/compi