VulkanMemoryAllocator-Hpp icon indicating copy to clipboard operation
VulkanMemoryAllocator-Hpp copied to clipboard

Make c++20 module use vulkan_hpp module

Open qbojj opened this issue 2 years ago • 2 comments

Currently vk_mem_alloc.cppm includes vk_mem_alloc.hpp which in turn includes <vulkan/vulkan.hpp>, but it could import the vulkan_hpp module, as if you are using vma-hpp as module you are probably also using vulkan-hpp as a module.

qbojj avatar Oct 18 '23 10:10 qbojj

Not sure I got your idea. How could we import vulkan_hpp, instead of including <vulkan/vulkan.hpp> in vk_mem_alloc.hpp?

YaaZ avatar Feb 19 '24 01:02 YaaZ

IDK if it is legal, by You could try

#ifdef VMA_USE_VULKAN_MODULE
import vulkan_hpp;
#else
#include <...>
#endif

I have posted it as a possibility and hadn't thought if it even is possible.

EDIT: as stated in http://eel.is/c++draft/cpp#import-3:

If a pp-import is produced by source file inclusion (including by the rewrite produced when a #include directive names an importable header) while processing the group of a module-file, the program is ill-formed.

so imports in #included files are ill-formed

qbojj avatar Feb 20 '24 01:02 qbojj