chrismile / sgl

Simple Graphics Library (using OpenGL and SDL)
Other
16 stars 5 forks source link

Automatic creation of descriptors? #3

Closed ib00 closed 2 years ago

ib00 commented 2 years ago

Beginner's question:

Is there a way to automatically create all descriptor sets and layouts from a precompiled SPIRV shader?

I am finding this one of the most annoying parts of Vulkan -- tedious setup of descriptors.

chrismile commented 2 years ago

sgl at the moment uses SPIRV-Reflect to get different information about the interface of GLSL shaders to make things easier.

Here's an example of how this functionality can be used from the perspective of a user: https://github.com/chrismile/LineVis/blob/vulkan/src/Renderers/HullRasterPass.cpp The shader for this is here: https://github.com/chrismile/LineVis/blob/vulkan/Data/Shaders/Renderers/MeshHull.glsl

Another example using more than one vertex attribute per binding can be found here: https://github.com/chrismile/sgl/blob/master/src/Graphics/Vulkan/Render/Passes/BlitRenderPass.cpp