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>
This commit is contained in:
Andreas Baierl
2019-04-26 15:01:43 +02:00
committed by Qiang Yu
parent 7050eccd77
commit b82de2b4d7
4 changed files with 84 additions and 0 deletions

View File

@@ -123,6 +123,7 @@ files_libnir = files(
'nir_lower_constant_initializers.c',
'nir_lower_double_ops.c',
'nir_lower_drawpixels.c',
'nir_lower_fragcoord_wtrans.c',
'nir_lower_frexp.c',
'nir_lower_global_vars_to_local.c',
'nir_lower_gs_intrinsics.c',