home/ atoms/ glsl-bisect-to-known-good-body

Debug a GLSL compile error by reading its line number, then bisecting back to a known-good body

glslViewer reports compile/link errors as ERROR: 0:<line>: <token> : <reason>. The debug procedure is: read the line number and offending token, jump to that line, and fix. When the message is unclear or the fix does not take, bisect — comment out the suspect expression and reduce the shader back to a known-good body, then reintroduce parts until the error reappears. Because glslViewer holds the last good frame, you are never left with a blank window while iterating.

Examples

A no matching operator at 0:14 points to line 14; if unclear, comment the line’s expression down to a plain gl_FragColor = vec4(st, 0.0, 1.0); and rebuild upward.

Assessment

Describe the two-step procedure for locating a GLSL compile error and the bisection fallback when the line number alone is not enough.

“Read the **line number** and token in the message, jump there, fix. If unclear, bisect: comment out the suspect expression back to a known-good body.”
context/ · L5-debug/glsl.md · chunk 1