Add line numbers to merged shader sources and improve the debugging experience
jellysquid3 opened this issue ยท 4 comments
Right now, we don't add #line
directives to the merged shader sources, which makes reading line numbers a lot harder. To make it easier to debug compilation errors, the following changes should be made:
- Each included shader file (and the prelude with
#version
and specialization constants) should be given a unique index. - In the merged source code,
#line <line number> <source file index>
declarations should be added, and the original#include
macro should be commented out (for debugging purposes). - The shader compilation log should include the merged source code.
Does "shader compilation log" mean that the entire shader source should be printed into the log?
I think so, yes. I'm not sure where else we could put it, and the error diagnostics aren't useful without it. But it might also completely flood the log file...
If you're only concerned about making the gl errors make sense, we could capture those and re-map the source ids to import names with some effort.