Common.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/Config.h>
  7. #include <AnKi/Util/StdTypes.h>
  8. #include <AnKi/Util/MemoryPool.h>
  9. #include <AnKi/Util/DynamicArray.h>
  10. #include <AnKi/Util/ThreadJobManager.h>
  11. namespace anki {
  12. #define ANKI_CORE_LOGI(...) ANKI_LOG("CORE", kNormal, __VA_ARGS__)
  13. #define ANKI_CORE_LOGE(...) ANKI_LOG("CORE", kError, __VA_ARGS__)
  14. #define ANKI_CORE_LOGW(...) ANKI_LOG("CORE", kWarning, __VA_ARGS__)
  15. #define ANKI_CORE_LOGF(...) ANKI_LOG("CORE", kFatal, __VA_ARGS__)
  16. class CoreMemoryPool : public HeapMemoryPool, public MakeSingleton<CoreMemoryPool>
  17. {
  18. template<typename>
  19. friend class MakeSingleton;
  20. private:
  21. CoreMemoryPool(AllocAlignedCallback allocCb, void* allocCbUserData)
  22. : HeapMemoryPool(allocCb, allocCbUserData, "CoreMemPool")
  23. {
  24. }
  25. ~CoreMemoryPool() = default;
  26. };
  27. class CoreThreadJobManager : public ThreadJobManager, public MakeSingleton<CoreThreadJobManager>
  28. {
  29. template<typename>
  30. friend class MakeSingleton;
  31. public:
  32. CoreThreadJobManager(U32 threadCount, Bool pinToCores = false)
  33. : ThreadJobManager(threadCount, pinToCores)
  34. {
  35. }
  36. };
  37. class GlobalFrameIndex : public MakeSingleton<GlobalFrameIndex>
  38. {
  39. public:
  40. Timestamp m_value = 1;
  41. };
  42. ANKI_DEFINE_SUBMODULE_UTIL_CONTAINERS(Core, CoreMemoryPool)
  43. } // end namespace anki