-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@include file
in different blocks errors out as Detected @include file cycle
#55
Comments
Hmm, yeah, I can confirm. The bug must be somehere around here: Lines 475 to 481 in a8a758f
I haven't written the file-include code though and need to investigate what's going on there (or if you find anything I'd be thankful for a PR). |
Before going deep, file cycle here means |
Yeah, or even more complex things like a.glsl including b.glsl, b.glsl including c.glsl, and c.glsl including a.glsl, basically anything that would result in an infinite loop when resolving the includes. |
Got it; it could be a linked list but not circular. I think the current check checks for > 1 inclusion of a file in a TU but it has to be made in a block i.e. once for I just built |
The backtrace
shows the current implementation does the loading (and preprocessing) per-file; this needs to be changed to per-block for checking and allowing same file inclusion per-block. |
I found a side-stepping solution to this issue @block util
@include util.glsl
@end
@vs vs
@include_block util
// use methods from util.glsl
@end
@fs fs
@include_block util
// use methods from util.glsl
@end Basically, include required file once inside a separate block. A block needing some functions from the included file -- e.g. This workaround seems sufficient for me, if this is fix enough please go ahead and close this @floooh. |
@include file
in different blocks errors out as Detected @include file cycle
Yep, I was coming back to suggest the block workaround, but you already found it :) I'll keep the bug open in case I get around a "proper" fix. |
I've a
util.glsl
from which I use some functions inpnt.glsl
:this leads to
OTOH skipping an include leads to
Moving the
@include
outside both blocks doesn't solve the issue either.The text was updated successfully, but these errors were encountered: