Add #line directive for glsl #insert
Shader code added with #insert will use lines 10000, 10001, 10002; 20000, 20001 etc, each inserted shader adding 10000, as suggested by @illwieckz in https://github.com/DaemonEngine/Daemon/pull/1124#issuecomment-2122679583.
I changed a bit how this works because #line 0 before #insert was making the line count wrong.
Now instead #line -1 is treated as a marker, where PrintShaderSource() will keep the correct line count with it.
I tested and the line numbering for the main file was off. After using 3 #inserts, the line numbers were too high by 3. For example the real line 48 was labeled as 51.
Just my personal taste and not a required change, but I would rather not have lines saying #LINE_MARKER_END and #LINE_MARKER_START. Showing the filename there could be useful though.
Just my personal taste and not a required change, but I would rather not have lines saying #LINE_MARKER_END and #LINE_MARKER_START.
To me it's useful because it stands out when looking at a shader source in a frame capture.
Showing the filename there could be useful though.
I like that idea. It would be useful to have these for vertex/fragment libs too.
Showing the filename there could be useful though.
I like that idea. It would be useful to have these for vertex/fragment libs too.
Hopefully we can nuke those and replace them with #insert
Hopefully we can nuke those and replace them with
#insert
I thought of that too, should be pretty easily doable. It would also allow dropping more of the forced vp/fp/cp suffixes.
I tested and the line numbering for the main file was off. After using 3
#inserts, the line numbers were too high by 3. For example the real line 48 was labeled as 51.
Fixed.
Just my personal taste and not a required change, but I would rather not have lines saying
#LINE_MARKER_ENDand#LINE_MARKER_START. Showing the filename there could be useful though.
This now shows the file name/path.
LGTM