VulkanObject.h 1.1 KB

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