Skip to content

Source Generator library to help reduce boilerplate when developing using the Veldrid graphics library.

License

Notifications You must be signed in to change notification settings

csinkers/VeldridGen

Repository files navigation

VeldridGen

VeldridGen is an experimental library focused on using .NET Source Generators to improve the development experience when using Veldrid.

Partial classes defining the inputs/outputs of shaders, the layout of resource sets, the layout of uniform buffers etc can be written in a concise form and the corresponding Veldrid descriptor structs, convenience properties, GLSL header file etc will be auto-generated. This should allow changes to be made in only one place rather than manually ensuring that the GLSL definitions match up with the struct layouts and descriptors etc.

As an example, the classes in CommonResources.cs and SpriteShader.cs provide a minimal description of the shaders and resources required for a sprite batcher. The results of code generation can be seen here, which allows the renderer class to be simple and straightforward: SpriteRenderer.cs.

Note that compiling the solution will result in a small portion of the generated code being run automatically: Example.TestApp is run as a post-build event to populate the .h.vert and .h.frag shader headers.

About

Source Generator library to help reduce boilerplate when developing using the Veldrid graphics library.

Topics

Resources

License

Stars

Watchers

Forks