-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Description
I've been formatting GLSL code similarly to our C++ code using the formatting functionality provided by this vscode extension: https://github.com/stef-levesque/vscode-shader
The reason the formatting is remarkably similar to our C++ code is that it actually just runs the C++ formatter over it (which in my case is set to the clang-format executable that ships with our clang SDK)! It saves a temp source file with a .cpp extension and tricks vscode into running the cpp formatter: https://github.com/stef-levesque/vscode-shader/blob/f1c804839f9f58a6749c9a840187c5527b76b053/src/extension.ts#L30
This has been giving me excellent results for both GLSL and HLSL, so perhaps we could just have format.sh run all shader files (.glsl, .hlsl, .vert, .frag, etc) through clang-format.