Regarding https://mastodon.gamedev.place/@gob/112450371375832518, the best system for shader code I've used was at Media Molecule on Dreams:

- Any C++ file could embed a PSSL shader with macro begin/end, gets automatically compiled as part of the build process.
- PSSL and C++ shared headers of structs/defines/enums so always in sync.
- Lots of systems supported compiling as both C++ and PSSL (e.g. the whole maths lib, which used clang ext_vector for shader-like syntax/swizzles in C++ too)

...

Hugo Devillers (@[email protected])

All shading languages suck. Moreover, they’re an outdated concept and they’re failing us. https://xol.io/blah/death-to-shading-languages/

Gamedev Mastodon

- Also *no bindings*, all shader resources were passed using shared structs, that directly embedded buffer/texture descriptors or pointers to other structs. Easy to describe and easy to change.
- And had great hot reload support for iteration/debugging, press a key in VS to recompile the shaders in that file and instantly replace in live game.

...

Anyhow, best system I've used. Super easy to add new shaders, share code between CPU and GPU, and iterate live.

Likely only practical due to having fixed platforms (PS4/Pro) and compilers (clang and psslc), and shaders being code not content, but is the benchmark I judge shader pipelines against. :)

@sjb3d Sharing files between C++ and HLSL is great, but I prefer to #include them so that the contents of the shader can be edited at runtime without changing the C++ files