Comments (6)
Yeah I considered doing that but wasn't sure how important this is given that large portions are generated - that is, I wasn't sure if I should really be using preprocessor for something that's automatically generated. Definitely easier to set breakpoints without using X-macros but not sure how important that is either.
from volk.
Oh, right... One issue with this request is the conditional availability of many functions. generator.py currently has to insert checks like this:
#if (defined(VK_KHR_device_group) && defined(VK_KHR_swapchain)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1))
extern PFN_vkAcquireNextImage2KHR vkAcquireNextImage2KHR;
#endif /* (defined(VK_KHR_device_group) && defined(VK_KHR_swapchain)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) */
This might be possible to express inside an X-Macro with something like
#if (defined(VK_KHR_device_group) && defined(VK_KHR_swapchain)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1))
#define VOLK_XMACRO_GROUP_17(X) X(vkAcquireNextImage2KHR)
#else
#define VOLK_XMACRO_GROUP_17(X)
#endif
and then have the actual X-Macro refer to these but at this point this becomes more unwieldy than the current solution.
from volk.
I was thinking of this kind of X-Macro, where you can keep all your check in one place.
// volk_device.h
#if defined(VK_VERSION_1_0)
DEFINE_VKDEVICE(AllocateCommandBuffers)
DEFINE_VKDEVICE(AllocateDescriptorSets)
DEFINE_VKDEVICE(AllocateMemory)
DEFINE_VKDEVICE(BeginCommandBuffer)
DEFINE_VKDEVICE(BindBufferMemory)
/* ... */
#if (defined(VK_KHR_device_group) && defined(VK_KHR_surface)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1))
DEFINE_VKDEVICE(GetDeviceGroupPresentCapabilitiesKHR)
DEFINE_VKDEVICE(GetDeviceGroupSurfacePresentModesKHR)
#endif /* (defined(VK_KHR_device_group) && defined(VK_KHR_surface)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) */
#if (defined(VK_KHR_device_group) && defined(VK_KHR_swapchain)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1))
DEFINE_VKDEVICE(AcquireNextImage2KHR)
#endif /* (defined(VK_KHR_device_group) && defined(VK_KHR_swapchain)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) */
// volk.h
struct VolkDeviceTable
{
/* VOLK_GENERATE_DEVICE_TABLE */
#define DEFINE_VKDEVICE(name) PFN_vk##name vk##name,
#include "volk_device.h"
#undef DEFINE_VKDEVICE
/* ... */
}
/* VOLK_GENERATE_PROTOTYPES_H */
#define DEFINE_VKDEVICE(name) extern PFN_vk##name vk##name;
#include "volk_device.h"
#undef DEFINE_VKDEVICE
/* ... */
// volk.c
static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, const char*))
{
/* VOLK_GENERATE_LOAD_DEVICE */
#define DEFINE_VKDEVICE(name) vk##name = (PFN_vk##name) load(context, "vk" #name);
#include "volk_device.h"
#undef DEFINE_VKDEVICE
}
from volk.
I see. That would work but it would require 3 extra headers. I'll experiment with this a bit but not sure yet this is a good idea.
from volk.
I've added a branch xmacro: https://github.com/zeux/volk/tree/xmacro that implements the suggested technique. Overall I like this a lot and am leaning towards merging this (if anybody has thoughts on this, please comment).
One thing I still haven't done is a thorough look at navigation/autocomplete behavior across different IDEs. I'd like to be able to maintain that. So far it seems that in VS2017 autocomplete still works fine; there's a regression with navigation usability where before you could F12 to vkCmdDraw and then F12 to PFN_vkCmdDraw to see the list of arguments, which now doesn't work since first F12 takes you to the volkgen_device.h - but I plan to fix this by adding function signatures to the generated files. Still need to see how the behavior changes in other IDEs/editors.
from volk.
I didn't really find a way to work around issues with Intellisense; additionally, trying to generate function signatures was met with significant issues wrt compatibility with multiple versions of Vulkan SDK - because of Vulkan 1.1 and various EXT->KHR promotions, it's non-trivial to generate a correct function signature with correct types that work for any version. So I decided to shelve this for now.
from volk.
Related Issues (20)
- Missing extension name definitions? HOT 3
- volk + GLFW = (identifier glfwCreateWindowSurface not found) HOT 4
- Warnings from Volk with higher warnings enabled HOT 1
- mold linker symbol mismatch warning HOT 7
- add InstanceTable? HOT 3
- Compile error with MinGW cross-compiler HOT 2
- Access violation in volkInitialize HOT 2
- Device Table Overflow HOT 2
- question on unloading the dll HOT 4
- Should I be calling `volkFinalize()`? HOT 2
- Tagging for versions since 1.3.270 HOT 1
- Question about adding as submodule HOT 1
- dlopen fails to find Vulkan libraries on macOS HOT 6
- Library naming conflict HOT 2
- 1.3.275.0: missing checking VulkanHeaders and volk.c installation HOT 22
- CMake: Should we install volk.c by default? HOT 2
- volkLoadDevice(device) erases some function pointers HOT 3
- Why is volk.c so big? HOT 5
- does volk work with asan? HOT 2
- Tags for versions >1.3.283.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from volk.