Cg Compiler Error

My problem is not directly related to ShaderLab but I hope this is the right forum anyway.

In my current project I have to mess around with zBuffer in fragment shaders. Now, whenever i write values to “out float depth : DEPTH”, I get an “error X2022: scalar registers cannot be masked”. According to THIS, the error is known since 2008 (!) but still occuring. Of course, I can correct that directly in the assembler code, but as my shader is evolving and for every tiny bit I add, I have to go through an annoying manual patching process. In fact I have written a patcher script, but have to do the code copying and script invoking all by hand.

My question is now: do I have a chance to add my patcher (or something similar) to the compiling process of Unity, s.th. it will be invoked automatically, whenever my shaders are compiled? This would save a lot of wasted time and keep development fluently…

bump

No idea from the experts? :face_with_spiral_eyes:

Yeah, that bug in Cg still exists. We’ll try to work around it by postprocessing shaders generated by Cg (probably for Unity 4.2). Until then, you’ll have to do it by hand…