Writing to Z buffer in fragment shader broken

I’m trying to write to a fragments Z position, however I get tons of errors. I have no problem restricting myself to GLSL if that solves the problem.

Shader error in 'Shader': D3D shader assembly failed with: (68): error X2022: scalar registers cannot be masked
(157): error X2022: scalar registers cannot be masked

I output depth with frag(out half4 depth : DEPTH) and am just testing it with 1.

Possible fix here: http://forum.unity3d.com/threads/66153-Writing-depth-value-in-fragment-program

  • Change compiled code
  • Add exclusion of flash