Inspecting GLSL Intermediate Render Targets in RenderDoc
RenderDoc is a standalone graphics debugging tool that enables developers to capture, isolate, and inspect intermediate render targets generated across complex GLSL rendering pipelines. In modern OpenGL and Vulkan development, complex visual effects rely on multi-pass rendering—such as deferred shading, shadow mapping, and post-processing—where intermediate images are written to Framebuffer Objects (FBOs). RenderDoc provides real-time visibility into these offscreen textures, allowing engineers to verify intermediate shader calculations, diagnose graphical artifacts, and ensure pipeline state correctness without modifying application source code.
Capturing Offscreen Framebuffer States
When executing rendering passes in GLSL, intermediate data is typically bound to texture attachments via FBOs. RenderDoc intercepts graphics API commands at runtime. By triggering a frame capture, it records the exact execution sequence of draw calls, compute dispatches, and bound framebuffer states. Developers can use the Event Browser to step through individual draw calls to observe the exact moment an intermediate target is cleared, drawn to, or used as an input texture for subsequent passes.
Detailed Inspection via the Texture Viewer
Once a frame is captured, RenderDoc’s Texture Viewer exposes all active and inactive render targets associated with the GLSL pipeline:
- Format and Dimension Verification: Displays
underlying formats (e.g.,
GL_RGBA16F,GL_DEPTH24_STENCIL8) and resolutions, ensuring that intermediate buffers match expected pipeline specifications. - Pixel Value Probing: Allows picking specific pixel coordinates to view raw numeric outputs (floating-point, integer, or normalized) written by GLSL fragment shaders.
- Dynamic Range and Channel Masking: Provides controls to isolate individual color channels (R, G, B, A) and adjust exposure/gamma ranges, which is essential for diagnosing high-dynamic-range (HDR) buffers or packed data like normal maps and depth values.
- Depth/Stencil Analysis: Visualizes depth and stencil attachments with configurable depth range remapping to expose precision issues or z-fighting.
Tracking Dependencies Across Multi-Pass Pipelines
Intermediate targets frequently serve as input samplers for
downstream GLSL shaders. For example, a G-buffer pass writes normals,
albedo, and depth to multiple render targets (MRT), which a lighting
shader subsequently samples. RenderDoc visualizes these resource
dependencies through its Resource Inspector and Pipeline State viewer.
Engineers can inspect the state of a texture when it transitions from an
output render target to a sampled texture bound to a GLSL
uniform sampler2D, ensuring synchronization, layout
transitions, and sampler filtering settings are correct.
Shader Debugging and Output Verification
Beyond passive inspection, RenderDoc allows developers to debug GLSL fragment shaders directly from the target pixel of an intermediate buffer. By right-clicking a pixel within an intermediate render target, developers can launch a step-by-step shader debugging session. This reconstructs the execution of the GLSL code for that specific fragment, mapping uniforms, vertex inputs, and intermediate calculations directly to the final color written to the buffer. This capability eliminates the need for manual debugging techniques, such as rendering raw values directly to the screen.