Open TristanCacqueray opened 4 years ago
Yeah, that code is updating the push constant. I'd recommend looking up the appropriate section in any vulkan tutorial as the C commands will map 1-1 with the functions in this library.
I do think that some utilities to go from haskell records to the following would be an excellent fit for the utils library in this repo.
https://vulkan-tutorial.com/Uniform_buffers/Descriptor_layout_and_buffer, this page and the next one deal with using UBOs to pass data to shaders. Perhaps another valuable addition to this repo would be going through a page like that and making note of where the haskell code and c++ differ non-trivially. It should be a small diff
with
functionsAlso: if you use a UBO instead of push constants you should check out the VulkanMemoryAllocator library which makes allocating buffers a lot easier.
Updating UBOs is really just poke
ing things at correct offsets/alignment. The big deal is setting up all the necessary preparations and wrapping your head over what exactly happens when.
You can inspect my playground for buffer code and descriptor setup, but I expect it to be overwhelming until you plow through the tutorial mentioned. Or you may cheat and try not become confused by reading my haskell rendition of it :sweat_smile:
linear instead of glm
Btw, linear
matrices appear to be in wrong order (row vs column major) and have to be transposed. I made a library to deal with projections and preparing tons of mat4
as fast as possible.
That is amazing, thank you for the details and tutorial links. That seems like valuable information for users of this library, perhaps it would be good enough to add those reference to the README, at least to help user like me who only know OpenGL.
Would it be possible to add some documentations and/or a function to update an uniform value? If I understand correctly the code in
resize/Main.hs
, the Julia shader Frame uniform is updated using:I'm looking for replacing opengl (example here), and I am not sure what is the vulkan equivalent of
Graphics.GL.Core31.glUniform2f
.Thank you!