I am writing a rendering system with OpenGL 4.6 and debugging it using NVIDIA's NSight. It has been frustrating to debug issues with my lighting, normal maps / textures, etc. My usual solution to this is to temporarily add in a FragColor = (whatever value I want to debug)
and then make the shader return prematurely, which is time-consuming and requires re-launching. However:
I have noticed that NSight stores 'revisions' of the final render after each draw call is made, and I believe it would be convenient to be able to save my own 'revision' states partway through a shader.
Is there some mechanism of this sort? e.g.:
// <Some GLSL stuff goes here e.g. light calculations>
// Save an intermediate preview with lighting and no textures, for debugging
FragColor = vec4(lightValue, 1.0);
saveIntermediateRevisionState(FragColor);
// <More GLSL stuff before we set the real, final FragColor>