-
I have a pretty hefty loop that the compiler is trying to unroll for me, and I'd like to tell it not to.
However adding either [[loop]] for (i = 0; i < MAX_STEPS; i += 1.0) {
How can I tell the compiler not to unroll the loop? Even setting |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Ah okay! It's just GLSL that was having issues - at least, on all windows-supported shader variants. It might be required that special handling for Metal is also needed, but I'm not on a Mac at the moment to test. #if BGFX_SHADER_LANGUAGE_GLSL
# pragma unroll 1
#else
[loop]
#endif
for (...) { Works great! |
Beta Was this translation helpful? Give feedback.
-
bgfx_shader.sh defines BRANCH, LOOP, and UNROLL that you can use: Line 15 in 9204a53 But they're no-ops on anything but HLSL. If you need that GLSL pragma you'll still need to roll your own (or send a pull request that adds it for GLSL 🤠) |
Beta Was this translation helpful? Give feedback.
Ah okay! It's just GLSL that was having issues - at least, on all windows-supported shader variants. It might be required that special handling for Metal is also needed, but I'm not on a Mac at the moment to test.
Works great!