home/ atoms/ glsl-buffer-ifdef-guard

A glslViewer feedback buffer only fills if its render code is wrapped in the matching `#ifdef`

glslViewer’s u_buffer0 / u_doubleBuffer0 render targets only receive output if the code that writes them is wrapped in the matching preprocessor guard — #ifdef BUFFER_0 or #ifdef DOUBLE_BUFFER_0. Omitting the guard leaves the buffer empty/black, which looks like broken feedback even when the feedback math is correct. The guard is how glslViewer knows which pass a block of code belongs to in a multi-pass shader.

Examples

#ifdef DOUBLE_BUFFER_0 // code that renders into the feedback buffer #endif // without this wrapper the buffer stays black

Assessment

A GLSL feedback shader shows a black feedback buffer even though the accumulation math is correct. Identify the missing preprocessor guard and show where it goes.

“Buffer blocks need their `#ifdef`.** A `u_buffer0`/`u_doubleBuffer0` only fills if you wrap its render code in `#ifdef BUFFER_0` / `#ifdef DOUBLE_BUFFER_0`. Forgetting it = the buffer stays empty/black.”
context/ · L1-instruments/glsl/gotchas.md · chunk 1