Common.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright (C) 2009-2023, 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. #include <AnKi/Util/String.h>
  7. #include <AnKi/Scene/Forward.h>
  8. #include <AnKi/Core/GpuMemoryPools.h>
  9. #include <AnKi/Shaders/Include/GpuSceneTypes.h>
  10. #include <functional>
  11. namespace anki {
  12. // Forward
  13. class ResourceManager;
  14. class Input;
  15. class UiManager;
  16. class GpuSceneMicroPatcher;
  17. class ScriptManager;
  18. class GrManager;
  19. class PhysicsWorld;
  20. /// @addtogroup scene
  21. /// @{
  22. #define ANKI_SCENE_LOGI(...) ANKI_LOG("SCEN", kNormal, __VA_ARGS__)
  23. #define ANKI_SCENE_LOGE(...) ANKI_LOG("SCEN", kError, __VA_ARGS__)
  24. #define ANKI_SCENE_LOGW(...) ANKI_LOG("SCEN", kWarning, __VA_ARGS__)
  25. #define ANKI_SCENE_LOGF(...) ANKI_LOG("SCEN", kFatal, __VA_ARGS__)
  26. class SceneMemoryPool : public HeapMemoryPool, public MakeSingleton<SceneMemoryPool>
  27. {
  28. template<typename>
  29. friend class MakeSingleton;
  30. private:
  31. SceneMemoryPool(AllocAlignedCallback allocCb, void* allocCbUserData)
  32. : HeapMemoryPool(allocCb, allocCbUserData, "SceneMemPool")
  33. {
  34. }
  35. ~SceneMemoryPool() = default;
  36. };
  37. ANKI_DEFINE_SUBMODULE_UTIL_CONTAINERS(Scene, SceneMemoryPool)
  38. #define ANKI_SCENE_ASSERT(expression) \
  39. std::invoke([&]() -> Bool { \
  40. const Bool ok = (expression); \
  41. if(!ok) [[unlikely]] \
  42. { \
  43. ANKI_SCENE_LOGE("Expression failed: " #expression); \
  44. } \
  45. return ok; \
  46. })
  47. /// @}
  48. } // end namespace anki