xe-gpu-shader-compiler is a standalone shader compiler that enables quick shader translation testing. It accepts binary microcode shaders and outputs either disassembled microcode or translated shader source code.
Overview
This tool is designed for testing shader translation without running the full emulator. It’s particularly useful when used in conjunction with the Shader Playground for interactive development.Usage
The shader compiler accepts binary microcode files and can produce various output formats:Parameters
--shader_input: Path to the input binary shader file- Use
.bin.vsextension for vertex shaders - Use
.bin.fsextension for fragment shaders
- Use
--shader_output: Path where the translated output will be written--shader_output_type: Output format typeucode- Disassembled microcodespirvtext- SPIR-V text representation
Input Files
The compiler expects binary microcode shader files as input. These can be obtained through:- Shader dumps from the emulator - Use the
--dump_shaders=path/flag when running Xenia to export shaders - Manual shader compilation - Create your own microcode files
- Extracted game shaders - From Xbox 360 game files
Shader Dumps
When you run Xenia with shader dumping enabled:xe-gpu-shader-compiler.
Output Formats
Microcode Disassembly
Using--shader_output_type=ucode produces human-readable disassembled shader microcode:
SPIR-V Text
Using--shader_output_type=spirvtext generates SPIR-V assembly:
Workflow
A typical shader debugging workflow:Identify problematic shader
Locate the shader file that corresponds to the visual issue you’re investigating.
Disassemble the shader
Use
xe-gpu-shader-compiler with --shader_output_type=ucode to examine the microcode.Analyze and debug
Review the disassembled output to understand the shader’s operations and identify issues.
Related Tools
- Shader Playground - GUI for interactive shader development
- Trace Viewer - Frame capture and analysis tool
Technical Details
The shader compiler processes Xbox 360 GPU microcode, which is based on AMD’s R5xx architecture (the Xenos chip). The translation must account for:- Xbox 360-specific instruction sets
- Register allocation differences
- Texture sampling conventions
- Vertex/fragment shader variations
