nir: add rcp(w) lowering for gl_FragCoord
authorAndreas Baierl <ichgeh@imkreisrum.de>
Fri, 26 Apr 2019 13:01:43 +0000 (15:01 +0200)
committerQiang Yu <yuq825@gmail.com>
Mon, 29 Apr 2019 02:46:44 +0000 (02:46 +0000)
commitb82de2b4d702789620f84c70577aa3e106d6ae4f
tree59133cbb3891d8a87dadcb45dde3bcb6e28ada6f
parent7050eccd77f6f435ab4c8ab4a31706e42b53817b
nir: add rcp(w) lowering for gl_FragCoord

On some hardware (e.g. Mali400) the shader needs to apply some
transformations for correct gl_FragCoord handling. The lowering
actions look like the following in pseudocode:
   gl_FragCoord.xyz = gl_FragCoord_orig.xyz
   gl_FragCoord.w = 1.0 / gl_FragCoord_orig.w

Add this lowering as a nir pass in preparation for using it in the driver.

Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/compiler/Makefile.sources
src/compiler/nir/meson.build
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_fragcoord_wtrans.c [new file with mode: 0644]