- Home /
Can a StructuredBuffer be used with a SurfaceShader?
Hi, I'm getting wierd error messages when I try to use a StructuredBuffer in a SurfaceShader. The editor complains that he can't find the other properites in the shader and gives me a syntax error on the line of the StructuredBuffer's declaration. I tried different #pragmas like target 4.0 or only_renderers d3d11 but none work. The StructuredBuffer works fine when I write normal vertex and fragment shaders, but I'm a little reluctant to write the lightning by myself if it could be possible to use a comfortable SurfaceShader ;)
Answer by cician · Jul 14, 2014 at 05:25 PM
Try wrapping D3d11 specific code in #ifdef SHADER_API_D3D11 ... #endif. Target should be 5.0, which is implicit with only_renderers d3d11.
Thank you. Just found it too: http://forum.unity3d.com/threads/structuredbuffer-with-surface-shader.173000/