VulkanObject.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #include <AnKi/Gr/Vulkan/Common.h>
  7. namespace anki
  8. {
  9. /// @addtogroup vulkan
  10. /// @{
  11. /// Halper class that extends the XXXImpl objects.
  12. template<typename TBaseClass, typename TImplClass>
  13. class VulkanObject
  14. {
  15. public:
  16. VkDevice getDevice() const;
  17. GrManagerImpl& getGrManagerImpl();
  18. const GrManagerImpl& getGrManagerImpl() const;
  19. };
  20. // Do this trick to avoid including heavy headers
  21. #define ANKI_INSTANTIATE_GR_OBJECT(type_) \
  22. template<> \
  23. VkDevice VulkanObject<type_, type_##Impl>::getDevice() const; \
  24. template<> \
  25. GrManagerImpl& VulkanObject<type_, type_##Impl>::getGrManagerImpl(); \
  26. template<> \
  27. const GrManagerImpl& VulkanObject<type_, type_##Impl>::getGrManagerImpl() const;
  28. #define ANKI_INSTANTIATE_GR_OBJECT_DELIMITER()
  29. #include <AnKi/Gr/Utils/InstantiationMacros.h>
  30. #undef ANKI_INSTANTIATE_GR_OBJECT_DELIMITER
  31. #undef ANKI_INSTANTIATE_GR_OBJECT
  32. /// @}
  33. } // end namespace anki