Common.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. //
  7. // Macros & functions C++
  8. //
  9. #if defined(__cplusplus)
  10. # include <AnKi/Math.h>
  11. # define ANKI_BEGIN_NAMESPACE namespace anki {
  12. # define ANKI_END_NAMESPACE }
  13. # define ANKI_SHADER_FUNC_INLINE inline
  14. # define ANKI_SHADER_INOUT(type_) type_&
  15. # define ANKI_SHADER_IN(type_) const type_&
  16. # define ANKI_SHADER_OUT(type_) type_&
  17. # define ANKI_SHADER_STATIC_ASSERT(cond_) static_assert(cond_, "See file")
  18. # define ANKI_SIZEOF(x) sizeof(x)
  19. ANKI_BEGIN_NAMESPACE
  20. template<typename T>
  21. inline F32 dot(const T& a, const T& b)
  22. {
  23. return a.dot(b);
  24. }
  25. using Address = U64;
  26. ANKI_END_NAMESPACE
  27. # define ANKI_CPP_CODE(x) x
  28. //
  29. // Macros & functions GLSL
  30. //
  31. #else
  32. # define x() x
  33. # define y() y
  34. # define z() z
  35. # define w() w
  36. # define xyz() xyz
  37. # define ANKI_BEGIN_NAMESPACE
  38. # define ANKI_END_NAMESPACE
  39. # define ANKI_SHADER_FUNC_INLINE
  40. # define ANKI_SHADER_INOUT(type_) inout type_
  41. # define ANKI_SHADER_IN(type_) in type_
  42. # define ANKI_SHADER_OUT(type_) out type_
  43. # define ANKI_SHADER_STATIC_ASSERT(cond_)
  44. # define ANKI_CPP_CODE(x)
  45. #endif
  46. //
  47. // Various
  48. //
  49. ANKI_BEGIN_NAMESPACE
  50. /// The renderer will group drawcalls into instances up to this number.
  51. const U32 MAX_INSTANCE_COUNT = 64u;
  52. const U32 MAX_LOD_COUNT = 3u;
  53. ANKI_END_NAMESPACE