So, my question is pretty much what the title says: in the Compute Shaders in Unity, what is the correct way of having constant/uniform/global variables?
Compute shader do not accept the definition ‘uniform’ and in the official documentation (Unity - Manual: Built-in macros), there is only a sparse mention of the format:
CBUFFER_START(MyRarelyUpdatedVariables)
float4 _SomeGlobalValue;
CBUFFER_END
However, that gives me the error "unrecognized identifier “CBUFFER_STAR’”. What is exactly the correct way of having variables that are passed by C# and behave as global constant variables in the Compute Shader?
PS: I did find a past question about that in the forum, but it didn’t get any answers: CBuffer and Compute shader. - Unity Engine - Unity Discussions