nir: Use writemasked store_vars in glsl_to_nir.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 30 Nov 2015 07:23:44 +0000 (23:23 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 22 Dec 2015 23:57:59 +0000 (15:57 -0800)
commit0daf51e130f89d1e83fa897ef8df9229829f5b18
tree62639d8529d9d83d6187871f6afb55f9a9d6c509
parent7d539080c1a491aff9fb3e90c25df89884477aa8
nir: Use writemasked store_vars in glsl_to_nir.

Instead of performing the read-modify-write cycle in glsl->nir, we can
simply emit a partial writemask.  For locals, nir_lower_vars_to_ssa will
do the equivalent read-modify-write cycle for us, so we continue to get
the same SSA values we had before.

Because glsl_to_nir calls nir_lower_outputs_to_temporaries, all outputs
are shadowed with temporary values, and written out as whole vectors at
the end of the shader.  So, most consumers will still not see partial
writemasks.

However, nir_lower_outputs_to_temporaries bails for tessellation control
shader outputs.  So those remain actual variables, and stores to those
variables now get a writemask.  nir_lower_io passes that through.  This
means that TCS outputs should actually work now.

This is a functional change for tessellation control shaders.

v2: Relax the nir_validate assert to allow partial writemasks.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/glsl/nir/glsl_to_nir.cpp
src/glsl/nir/nir_validate.c