home/ atoms/ glsl-last-good-shader-on-error

glslViewer keeps the last successfully-compiled shader on screen when a save fails to compile

When glslViewer detects a save, it recompiles the .frag file. If compilation fails, the error with a line number is printed to the terminal but glslViewer does not swap in the broken shader — the previous frame continues rendering on screen. This means a bad save never blanks the window. Recovery is: read the line number in the error message, fix the problem, save again.

Examples

Saving a shader with a missing semicolon prints ERROR: 0:12: ... but the screen keeps showing the last good frame.

Assessment

Explain what happens on screen in glslViewer when you save a shader with a compile error, and state what information the error message gives you.

“On save, glslViewer recompiles the `.frag`. A compile/link error is printed to the terminal, typically with a **line number**: `ERROR: 0:<line>: '<token>' : <reason>`. glslViewer **does not swap in**”
context/ · L5-debug/glsl.md · chunk 1