Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is volk.c so big? #174

Closed
ewtoombs opened this issue Feb 21, 2024 · 5 comments
Closed

Why is volk.c so big? #174

ewtoombs opened this issue Feb 21, 2024 · 5 comments
Labels
question Further information is requested

Comments

@ewtoombs
Copy link

I was expecting to find just two lines:

#define VOLK_IMPLEMENTATION
#include <volk.h>

What is all of this other stuff in volk.c?

@zeux
Copy link
Owner

zeux commented Feb 21, 2024

It's the actual implementation? volk is not a header only library.

@ewtoombs
Copy link
Author

You can use volk in header-only fashion. Include volk.h wherever you want to use Vulkan functions. In exactly one source file, define VOLK_IMPLEMENTATION before including volk.h. Do not build volk.c at all in this case. This method of integrating volk makes it possible to set the platform defines mentioned above with arbitrary (preprocessor) logic in your code.

@zeux
Copy link
Owner

zeux commented Feb 21, 2024

Yes, and the way that works is by volk.h including volk.c, not the other way around. This is because volk is not a header-only library, and the recommended way to use volk is to compile volk.c - the header-only mode is "special" and only activated via the use of VOLK_IMPLEMENTATION macro.

@zeux zeux closed this as completed Feb 21, 2024
@zeux zeux added the question Further information is requested label Feb 21, 2024
@ewtoombs
Copy link
Author

Ohhh, so even if volk.h is being used header-only and volk.c is not being compiled on its own, it must still be in the same directory. This was not clear from the README.

It should be modified to read something like

You can use volk in header-only fashion. Include volk.h wherever you want to use Vulkan functions. In exactly one source file, define VOLK_IMPLEMENTATION before including volk.h. Do not build volk.c at all in this case. volk.c must still be in the same directory as volk.h. This method of integrating volk makes it possible to set the platform defines mentioned above with arbitrary (preprocessor) logic in your code.

@zeux
Copy link
Owner

zeux commented Feb 21, 2024

Yup - that's a good suggestion, thanks!

zeux added a commit that referenced this issue Feb 21, 2024
Add a note that volk.c is still required when VOLK_IMPLEMENTATION is used per #174
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants