zeux/volk

Add Macro in volk.h for custom vulkan.h (etc.) location

dajofrey opened this issue · 4 comments

Hi there,

first of all thanks a lot for your work!

Just a quick thought: How about we add a macro in volk.h which allows devs to define paths to vulkan.h, vulkan_core.h, etc.? This would mean that the target system wouldn't have to supply header files and we wouldn't need to install header files to a place which is visible via environment variable. Which is good because we wouldn't clutter the target system with unnecessary header files if it turns out at runtime that vulkan won't be used.

I have something like this in mind:

#ifdef CUSTOM_VULKAN_H_PATH
#include CUSTOM_VULKAN_H_PATH
#endif
#ifndef CUSTOM_VULKAN_H_PATH
#include <vulkan/vulkan.h>
#endif

Best regards!

zeux commented

The intent for supporting this was that if vulkan.h is already included from the custom location, volk won't attempt to include it (see VULKAN_H_ check). So you can use volk as follows:

#include <custom location/vulkan.h>
#include "path/to/volk.h"

This isn't sufficient for compiling volk.c however, unless you compile it as part of another file by including it - so yeah maybe something like VOLK_VULKAN_H_PATH could be a good idea!

Ok awesome!
So we need a total of 4 new macros (3 for windows).
I will give it a shot.

zeux commented

Maybe it's fine to just do this for vulkan.h? The Windows includes are just an optimization; with a custom vulkan.h presumably it's not necessary. So if the macro is defined we'll just include it without the platform handling.

Ah ok, yeah that's better!