I'm playing around with nvidia's unroll loops directive, but haven't seen a way to turn it on selectively.
Lets say I have this...
void testUnroll()
{
#pragma optionNV(unroll all)
for (...)
...
}
void testNoUnroll()
{
for (...)
...
}
Here, I'm assuming both loops end up being unrolled. To stop this I think the solution will involve resetting the directive after the block I want affected, for example:
#pragma optionNV(unroll all)
for (...)
...
#pragma optionNV(unroll default) //??
However I don't know the keyword to reset the unroll behaviour to the initial/default setting. How can this be done? If anyone could also point to some official docs for nvidia's compiler directives that'd be even better.
Currently, it seems only the last #pragma optionNV(unroll *)
directive found in the program is used (eg throw one in the last line and it overrides everything above it).
According to this post on the NVidia forums, having no keyword afterwards will set it to default behavior:
I'm not sure if it works on GLSL, but you can maybe try:
If anyone tries this, let us know if it works!