xe-gpu-trace-viewer is a debugging tool that allows you to capture and inspect individual frames or sequences of frames rendered by Xenia. This enables rapid iteration on graphical issues without needing to restart the full emulator.
Overview
The trace viewer workflow separates frame capture (during emulation) from frame analysis (in the trace viewer). This allows you to:- Capture specific frames that exhibit rendering issues
- Inspect GPU commands and draw calls
- Analyze render states and resources
- Iterate on fixes without re-running the game
Workflow
The basic trace viewer workflow consists of the following steps:Capture the frame in game
Press F4 during gameplay to capture a single frame, or use
--trace_gpu_stream to capture a sequence of frames.Configure trace viewer
Add the captured trace file path to the
xe-gpu-trace-viewer debugging command line in Visual Studio.Analyze the frame
Explore the GPU commands, draw calls, textures, and render states to identify issues.
Capturing Frames
Setting Up Capture
Before capturing frames, you must specify a path prefix for trace files:Single Frame Capture
To capture a single frame while Xenia is running:- Run Xenia with the
--trace_gpu_prefixflag - Navigate to the scene with the graphical issue
- Press F4 to capture the next frame
VdSwap call (the presentation of the frame). The trace file is immediately available for viewing.
Example:
traces/frame_a3c2f1.trace.
Capturing Frame Sequences
For issues that involve multiple frames or animation problems, you can capture a stream of frames:--trace_gpu_stream enabled, Xenia will write all rendered frames to a trace file, allowing you to seek through them in the trace viewer.
Using the Trace Viewer
Loading Trace Files
In Visual Studio, configure the debugging command line arguments forxe-gpu-trace-viewer:
Inspecting Frames
Once loaded, the trace viewer provides tools to:- View draw calls - Step through each GPU command in the frame
- Inspect resources - Examine textures, buffers, and render targets
- Analyze state - Review GPU state at each draw call
- Debug shaders - See which shaders are used for each draw
Development Iteration
The trace viewer significantly speeds up graphics debugging:- No game restart needed - Once you have a trace file, you don’t need to restart the game to test fixes
- Faster iteration - Only rebuild and relaunch the lightweight trace viewer, not the full emulator
- Reproducible testing - The same captured frame is used for every test, ensuring consistency
Typical Debug Session
Command Line Options
Capture Options
--trace_gpu_prefix=<path>- Prefix for trace file paths (required for capture)--trace_gpu_stream- Capture all frames continuously (creates large files)
Viewer Options
The trace viewer accepts a trace file path as its primary argument:Related Tools
- Shader Compiler - Translate and disassemble shaders found in traces
- Shader Playground - Interactive shader development and testing
Tips
- Capture at the right moment - Press F4 right when you see the graphical glitch
- Use descriptive prefixes - Name your trace files based on the issue:
--trace_gpu_prefix=traces/water_rendering_ - Keep traces small - Avoid
--trace_gpu_streamunless you specifically need multi-frame analysis - Organize your traces - Create separate directories for different issues or games
