ShaderPropertySystem.cginc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // UNITY_SHADER_NO_UPGRADE
  2. #ifndef _VLB_SHADER_PROPERTY_SYSTEM_INCLUDED_
  3. #define _VLB_SHADER_PROPERTY_SYSTEM_INCLUDED_
  4. /// ****************************************
  5. /// PROPERTIES MACROS
  6. /// ****************************************
  7. #if VLB_INSTANCING_API_AVAILABLE && VLB_GPU_INSTANCING
  8. #if UNITY_VERSION < 201730 // https://unity3d.com/fr/unity/beta/unity2017.3.0b1
  9. // PRE UNITY 2017.3
  10. // for some reason, letting the default UNITY_MAX_INSTANCE_COUNT value generates the following error:
  11. // "Internal error communicating with the shader compiler process"
  12. #define UNITY_MAX_INSTANCE_COUNT 150
  13. #define VLB_DEFINE_PROP_START UNITY_INSTANCING_CBUFFER_START(Props)
  14. #define VLB_DEFINE_PROP_END UNITY_INSTANCING_CBUFFER_END
  15. #define VLB_GET_PROP(name) UNITY_ACCESS_INSTANCED_PROP(name)
  16. #else
  17. // POST UNITY 2017.3
  18. #define VLB_DEFINE_PROP_START UNITY_INSTANCING_BUFFER_START(Props)
  19. #define VLB_DEFINE_PROP_END UNITY_INSTANCING_BUFFER_END(Props)
  20. #define VLB_GET_PROP(name) UNITY_ACCESS_INSTANCED_PROP(Props, name)
  21. #endif
  22. #define VLB_DEFINE_PROP(type, name) UNITY_DEFINE_INSTANCED_PROP(type, name)
  23. #elif VLB_SRP_API && VLB_SRP_BATCHER
  24. #define VLB_DEFINE_PROP_START CBUFFER_START(UnityPerMaterial)
  25. #define VLB_DEFINE_PROP_END CBUFFER_END
  26. #define VLB_DEFINE_PROP(type, name) type name;
  27. #define VLB_GET_PROP(name) name
  28. #else
  29. #define VLB_DEFINE_PROP_START
  30. #define VLB_DEFINE_PROP_END
  31. #define VLB_DEFINE_PROP(type, name) uniform type name;
  32. #define VLB_GET_PROP(name) name
  33. #endif
  34. /// ****************************************
  35. #endif