Disclaimer: I'm not the author but I've taken part in some initial discussions and testing of this project.
Usually writing GPU shaders in GLSL is a bit of a pain because they are often compiled on the fly (the application passes them to the GPU driver). In production you would set up a specific toolchain to compile shaders ahead of time and catch compilation errors, but it's cumbersome for smaller projects.
The goal here is to instead use the C++ compiler to validate shaders, by writing them as C++ code (using additional keywords and helpers on top of C++ and template metaprogramming). If a shader is invalid, you'll get 'regular' compilation errors in your IDE. The corresponding GLSL code can be retrieved at runtime by the application to give to the driver.
As the author explains in the readme, it started more as a thought experiment and a way to push C++ templates to their limits than anything else, but I found this quite insightful.
1 comment
[ 4.4 ms ] story [ 9.1 ms ] threadUsually writing GPU shaders in GLSL is a bit of a pain because they are often compiled on the fly (the application passes them to the GPU driver). In production you would set up a specific toolchain to compile shaders ahead of time and catch compilation errors, but it's cumbersome for smaller projects.
The goal here is to instead use the C++ compiler to validate shaders, by writing them as C++ code (using additional keywords and helpers on top of C++ and template metaprogramming). If a shader is invalid, you'll get 'regular' compilation errors in your IDE. The corresponding GLSL code can be retrieved at runtime by the application to give to the driver.
As the author explains in the readme, it started more as a thought experiment and a way to push C++ templates to their limits than anything else, but I found this quite insightful.