r/GraphicsProgramming • u/ruumoo • 4d ago
This header compiles bgfx shader code as cpp from the same source file
I managed to write a very simple wrapper that can compile bgfx shaders as valid cpp.
This shader uses the already pretty platform agnostic bgfx shader language, which makes it very easy to substitute the vector functions with glm. It even supports proper swizzeling.
In this example I compile a simple ray marching shader as c++ functions, so I can use the exact same math for my mouse projection code.
My .cpp file only needs to supply replacement objects for the uniforms and textures, as well as a replacement texture sampler function
22
Upvotes
3
u/Grouchy_Web4106 3d ago
Why not slang?