martty/vuk

Adding structs to VkRenderPassCreateInfo::pNext

Opened this issue · 8 comments

Hello, I'm currently using this library to help with the vulkan work in a OpenXR renderer, I'd like to be able to use this vulkan extension, but requires that I pass extra info into the VkRenderPassCreateInfo::pNext. Is this possible with vuk, right now?

martty commented

Hi, very sorry, I must've read this and put off replying, then completely forgot.

Currently this is not possible - but it could be added if this is still something you are interested in.

This is something I'm interested in, if you're busy I don't mind adding it myself and contributing if you can give some info on where to start

martty commented

Could you describe how do you intend to use this?

While it would be easy to pass the pNext so that it ends up on the renderpass, if you need guaranteed subpass layout then it will require more thought.

Reading the extension, it seems I only need the structure to exist on the pNext chain, this causes the renderpass to be executed twice with some variables changed in the shaders. So access to the pNext (or someway to add to the chain) is all I need.

This is an example implementation, I was basing this off of, maybe I'm missing something but pretty sure no

martty commented

Hi,
I made a branch that lets you begin renderpasses yourself:
https://github.com/martty/vuk/tree/manual_rps

I modified example 2 to showcase how you would do it, but I am not sure how to test properly, so I didn't fill the extension struct with proper values.

Please let me know if this works for you, or if you need any help!

Sorry for the delay, I tested the PR really quick, and will hopefully test more next week. The changes seem to work (although I'm fighting with some other VR application things preventing much more testing being done). Is it necessary to manually start the Render Pass for something like this, I'm not too familiar with vulkan extensions nor the inner workings of vuk, but would it be possible to have a .next like option to a render graph's add_pass or another function that accumulates a list of structs, then have vuk build the chain of .next's when it's time to start the pass?

martty commented

No worries, take your time.

The reason I implemented it this way is because I am unsure the amount of flexibility you need here - vuk should let you dip to calling Vulkan whenever you need to, and in this case it was not possible.

It might be possible to have something like you describe, but it would be tricky to make it both generic and easy to use I think - I'd rather integrate some specific functionality when it turns out to be useful.

It's been a while, but I did manage to test it, and nope. Turns out it changes more than I assumed. Normally in VR you create two sets of swapchain+images (one for each eye), with this extension you're only supposed to need one, however the images need to be an array of images (one for each eye). I'm not sure if this might push the scope of this library, but for now I'm not in need of major performance improvements, so I'm okay with my current approach without the extension.