# Debugging with Streamline ImGUI
> **NOTE 1:**
> This document applies to non-production, development builds only. `sl.imgui` won't load in production builds.
> Additionally, you will need to turn off any checks for signed libraries when loading Streamline libraries in order to be able to load the non-production libraries.
## What SL ImGUI Does
At a high level, the `sl.imgui` plugin uses [`imgui`](https://github.com/ocornut/imgui) to show certain metrics/information about specific SL plugins that can be useful for validating and debugging your app integration.
The `sl.imgui` plugin is a wrapper around `imgui`. On plugin load, `sl.imgui` creates its own context and exposes functions for other plugins to:
 * Build their UI
 * Render their UI (via callbacks, or directly by calling the `sl::imgui::render()` function)
## Using SL ImGUI to debug existing plugins
### Summary
When running a non-`Production` build of SL, you should see the `imgui` pop-ups on the app screen.
*Note 1: plugin may **NOT** load their UI if they are not engaged/turned on from the app-side.*
*Note 2: you can toggle the `imgui` pop-ups with `Ctrl + Shift + Home` hotkey. Hotkey mappings can change in the future. In general, refer to the hotkey shortcuts at the bottom of the screen, or next to the UI control, for ground-truth hotkeys.*
Plugin | Debug information | Reference Image
---|---|---
Overall Streamline  |  - Bottom of screen: `imgui` debug menu keyboard shortcuts and warnings 
  - Right side of screen: `imgui` debug menu (Each plugin that builds a UI will have its UI show up here) 
 *Note: some apps won't let the mouse interact with the `imgui` menus. For those apps, it's best to change the controls to be hotkey-controllable* | 
`sl.interposer` | - SDK build dateOverall UI
`sl.common` | - System (OS, driver, GPU, etc.)`sl.interposer` UI
`sl.reflex` | - Mode/FPS cap`sl.common` UI
`sl.dlss` | - Version`sl.reflex` UI
`sl.dlss_g` | - Version`sl.dlss` UI
`sl.nis` | - Mode`sl.dlss_g` UI
`reflex-sync` | - **Ignore, NVIDIA Internal Only** |`sl.nis` UI
### ImGUI Buffer Visualizer For certain plugins, debugging some GPU buffers can be done through `sl.imgui`. **For now, only `sl.dlss_g` supports this feature.** #### Debugging buffers for `sl.dlssg` *Note: debug hotkey mappings can change in the future. In general, refer to the hotkey shortcuts at the bottom of the screen, or next to the UI control, for ground-truth hotkeys.* 1. Turn on `dlssg` from the app-side, and verify that the `sl.imgui` pop-up shows that `dlssg` is **On** 2. Use the visualizer: * *Turn on visualizer*: `Ctrl + Shift + Insert` * *Cycle views*: `Ctrl + Shift + End`. * *Turn off visualizer*: `Ctrl + Shift + Insert` In addition to the `sl.dlssg` input buffers (e.g. depth, motion vectors, etc.), the visualizer should help you view the debug buffers: Buffer | What it means | Correctness Interpretation | Reference Image ---|---|---|--- Alignment | Visualizes the alignment of depth, motion vectors, and color buffers using a Sobel filter | - Image should be mostly blue (color data)`reflex-sync` UI
Dynamic Objects | Visualizes pixels that have non-zero motion vector values. This excludes motion caused by camera movement | - Only (parts) of dynamic objects should be colored red (not due to camera movement!) 
## Adding SL ImGUI to new plugins
The `sl.common` plugin's usage of `sl.imgui` is an easy to follow example on how to add `sl.common` UI and render it. Implementing something similar is advised.
```
#ifndef SL_PRODUCTION
// 1. Check for UI and register our callback
imgui::ImGUI* ui{};
param::getPointerParam(api::getContext()->parameters, param::imgui::kInterface, &ui);
if (ui)
{
    // 2. Define the UI building callback
    auto renderUI = [](imgui::ImGUI* ui, bool finalFrame)->void
    {
        // Use `ui` to build buttons/text/sliders/etc.
    };
    // 3. Register the callback so sl::imgui can render it
    ui->registerRenderCallbacks(renderUI, nullptr);
}
#endif
```