Common.h 1.4 KB

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