1

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>
Ethan McTague
  • 2,236
  • 3
  • 21
  • 53
  • For debuging stuff I develop/use this [GLSL debug prints](https://stackoverflow.com/a/44797902/2521214) they are very handy for debuging stuff I have no prior knowledge of like checking if values in texture did not clamp etc ... I debug my shader in GLSL IDE test app see [Best practices for coding , compiling, debugging and maintaining shader programs in opengl?](https://stackoverflow.com/a/51298623/2521214) and finaly for the really hard stuff I code and test the shader on CPU side as C++ code and when working port to GLSL ... – Spektre Dec 22 '18 at 09:36
  • Are you talking about multiple render targets (via FBO attachments, see e.g. [here](https://www.khronos.org/opengl/wiki/Fragment_Shader#Output_buffers)), or [Image Load/Store](https://www.khronos.org/opengl/wiki/Image_Load_Store), or similar techniques to produce N images with the partial state of your fragment shaders? – peppe Dec 22 '18 at 14:38

0 Answers0