Interrupt / delve-framework

Delve is a framework for writing Games in Zig and Lua. For those who value being cross platform and keeping things simple.
MIT License
209 stars 11 forks source link

Material system: rework to use Sokol's yaml output for shader generation #31

Open Interrupt opened 4 months ago

Interrupt commented 4 months ago

The current Material system is bulky to work with because the uniform buffer locations can change depending on the shader's content, and it doesn't support modding well as right now it requires the shaders to be generated as Zig code.

The author of Sokol said about this problem:

_I think the best option for that use case is to use the bareyaml output in sokol-shdc. The resulting YAML reflection file should be easy enough to parse without a full yaml parser at hand, and the shader-blobs themselves can be runtime-loaded.

Interrupt commented 2 months ago

Work done for this issue so far: https://github.com/Interrupt/delve-framework/pull/43 https://github.com/Interrupt/delve-framework/pull/44

It is not currently possible to do shader uniform binding in a block by name, because Sokol does not currently expose the offset of a uniform inside a uniform block yet, more reflection will need to be added on their end to support that, so I may open PRs for the Sokol and Sokol-tools projects that would expose that information.