In Unity 4.6.3 release notes there is a mention about GL_EXT_shader_framebuffer_fetch support, but the hint for how to use it is kinda vague.
I’ve tried looking for this feature in @Arasp hlsl2glslfork on GitHub and was able to find where it is implemented, but still not sure how to properly use it in CG.
As far as I understand, the GLSL translator checks the frag function for a parameter with “inout” modifier and COLOR0-3 semantic and then assigns getFragData to it. Based on that, I’ve tried something like this in CG snippet:
fixed4 frag (v2f i, inout fixed4 fetchColor : COLOR1) : SV_Target
{
....
}
It compiled OK, but on device (iPad4) it just output nothing (as if it’s a completely transparent color). Even if I explicitly return like fixed4(0, 0, 0, 1) from frag — still nothing.
Maybe someone already used this feature, or have an idea what I may be doing wrong — I will really appreciate any help.