Long story short, I have a shader which absolutely has to work with logical OR blending. I am bitpacking data in one shader, where pixels overlap, combining this data into an output RenderTexture, and then unpacking it in another shader.
This needs to be crossplatform. I want to support DX11/12 (where it works fine), OpenGL (standard, core, and ES), and ideally Vulkan and Metal.
Here's the thing.
Unity claims that it can only use logical OR blending in a specific subset of DX11. It actually seems to work fine on all versions of DX11.1+ and DX12. It does not, however, work on any other platform.
OpenGL lists support for logical OR blending in their spec. It seems that this should work with all versions of OpenGL above 2 (including ES, unless I missed something).
How, in Unity, can I have this shader crosscompile to GLSL, and enable this blend op? I assume it might be possible by P/Invoking the library for glEnable and related functions, but I'd like to know if there is a way to write on Cg shader and have this crosscompile properly. Metal/Vulkan isn't a dealbreaker, it would be nice to extend support, but I'm more than happy to settle for only supporting DX11+ and OpenGL 2+.