So I have a shader which outputs to single-float texture. Code (csharp): //Fragment Shader float frag (v2f i) : SV_Target0 { // look output type here is float not float4 float2 uv = i.scrPos.xy / i.scrPos.z; float sceneDepth = tex2D(DepthTexture, uv); float4 mask = tex2D(MaskTexture, uv); float lDepth = i.scrPos.z; return (lDepth - sceneDepth) * mask.r; } It works fine. When I build my project, it works fine in the build too but I get this error. Code (csharp): Shader error in 'Depth/DepthDifference': SV_Target0 must be a four-component vector at line 44 (on d3d11_9x) Compiling Fragment program Is it a bug in the compiler or my fault? https://msdn.microsoft.com/en-us/li...tion_from_direct3d_9_to_direct3d_10_and_later states I can use simple float with SV_Target<N> semantic. And it works, so I think the error message should be fixed.
I realized SV_Target0 is dx11 semantic and fragment shader output can be plain float only for dx11. So Code (csharp): #pragma only_renderers d3d11 solved the problem. So it's not a bug