0
\$\begingroup\$

The Unity Manual has a page on GPU instancing. One of the examples, titled "Adding instancing to vertex and fragment Shaders", causes the following errors to printed to the console when saved in a Shader file:

... unrecognized identifier 'UNITY_INSTANCING_BUFFER_START' at line ... (on d3d11)
... not enough actual parameters for macro 'UNITY_ACCESS_INSTANCED_PROP' at line ... (on d3d11)

This error message does not make any sense. The identifier is supposed to be created in the UnityInstancing.cginc file, if the render target is supported. This thing is, d3d11 is supported:

Line 211: #ifdef UNITY_INSTANCING_AOS
    #define UNITY_INSTANCING_BUFFER_START(buf)      
    ...
    #define UNITY_INSTANCING_BUFFER_END(arr)
    ...
#endif

Line 41: #if defined(SHADER_API_D3D11) || ...
    #define UNITY_INSTANCING_AOS
#endif

My question:

Why does Unity say that these operations are not supported on this platform?

\$\endgroup\$
1
  • \$\begingroup\$ This sounds like an issue to report to the Unity engine development & documentation teams. \$\endgroup\$
    – DMGregory
    Commented Sep 21, 2018 at 19:18

1 Answer 1

0
\$\begingroup\$

To solve this problem, I had a look at the copy of my (unaltered) UnityInstancing.cginc included with my own version of Unity. The UNITY_INSTANCING_BUFFER_START function does not exist in my copy, instead it is called UNITY_INSTANCING_CBUFFER_START. The UNITY_ACCESS_INSTANCED_PROP function also only takes one argument in my version.

To anybody who has similar problems with definitions not existing, I highly recommend looking at the file included with your version of unity. You may find, as I did, that the answer to your problem lies there!

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .