zeux/volk

unresolved external for the vkCmdTraceRaysKHR function on windows when VK_ENABLE_BETA_EXTENSIONS is defined

Closed this issue · 3 comments

When defining VK_ENABLE_BETA_EXTENSIONS and including volk.h, we get unresolved externals function error for vkCmdTraceRaysKHR. I believe volk.c needs to define VK_ENABLE_BETA_EXTENSIONS before including the volk.h header in case users of the lib decide to define it.

zeux commented

Are you building volk using CMake?

no, so i guess that answers that :)

zeux commented

I should have been more specific I guess :)

If you're building volk as part of your project, I'd recommend setting VK_ENABLE_BETA_EXTENSIONS on the entire project.
If you're building volk as a separate static library, through CMake or otherwise, you should add the define there - with CMake it's possible using VOLK_STATIC_DEFINES variable.

The reason why it's incorrect to just define this in volk.c is that it would introduce new fields into VolkDeviceTable interface, so for people who use that interface and don't use beta extensions there's going to be issues because the layout of the struct will be inconsistent.

So the defines need to be set consistently between the header and the implementation, and the best way to do that is to set them externally.