Skip to main content
The Shader Playground is a GUI tool for interactive shader development, providing real-time assembly, disassembly, validation, and translation of Xbox 360 shader microcode.

Overview

Built as a standalone Windows application, the Shader Playground provides a visual interface for working with Xbox 360 shaders. It integrates with the XNA Game Studio D3D compiler and xe-gpu-shader-compiler to provide comprehensive shader analysis. Shader Playground Screenshot

Features

Real-Time Shader Translation

The Shader Playground provides multiple views of your shader code:
  • Input Panel (Left) - Enter shader microcode source
  • Disassembly Panel (Center) - View optimized D3D compiler output
  • Translation Panel (Right) - See translated shader in target format

Automatic Validation

The tool automatically validates shader translation accuracy:
  1. XNA Game Studio D3D compiler translates microcode to binary
  2. D3D compiler disassembles the binary to show optimized form
  3. xe-gpu-shader-compiler disassembles the same microcode
  4. The disassembly is passed through D3D compiler
  5. If the outputs don’t match, the panel turns red, indicating broken disassembly
This validation ensures that Xenia’s shader translation is accurate and matches Microsoft’s reference implementation.

Format Support

The Shader Playground supports translation to multiple output formats, allowing you to verify shader translation for different graphics backends.

Setup

Prerequisites

The Shader Playground requires XNA Game Studio 3.1 to be installed (not just the redistributable).
1

Download XNA Game Studio 3.1

Download from Microsoft’s website.
2

Extract and install

The installer may not be compatible with modern Visual Studio versions. Open XNAGS31_setup.exe with 7-Zip and run the included redists.msi directly.
3

Verify installation

Confirm that this file exists:
C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v3.1\References\Windows\x86\Microsoft.Xna.Framework.dll
4

Configure build platform

XNA is only compatible with 32-bit x86 .NET. Ensure Visual Studio is set to target x86 (not Any CPU).

Building

The Shader Playground is built separately from the main Xenia project:
1

Navigate to the directory

cd tools/shader-playground/
2

Open the solution

Open shader-playground.sln in Visual Studio.
3

Set platform to x86

In the build configuration, ensure the platform is set to x86, not Any CPU.
4

Build the project

Build the solution. The executable will be created in the output directory.

Usage

Basic Workflow

1

Launch Shader Playground

Run the built executable from tools/shader-playground/bin/.
2

Enter shader microcode

Type or paste Xbox 360 shader microcode into the left panel.
3

Review disassembly

The center panel shows the D3D compiler’s optimized disassembly.
4

Verify translation

The right panel displays the translated shader. If the validation fails, the panel will turn red.
5

Debug discrepancies

Use the comparison between panels to identify translation issues.

Integration with xe-gpu-shader-compiler

For the Shader Playground to provide full functionality:
  1. Build xe-gpu-shader-compiler from the main Xenia project
  2. Ensure the executable is in your PATH or the same directory as Shader Playground
  3. The tool will automatically invoke the compiler for disassembly validation

Working with Dumped Shaders

You can use the Shader Playground with shaders extracted from games:
1

Dump shaders from Xenia

Run Xenia with --dump_shaders=path/ to export shader microcode.
2

Locate the shader binary

Find the .bin.vs or .bin.fs file for the shader you want to analyze.
3

Convert to text format

Use xe-gpu-shader-compiler to disassemble to microcode text:
xe-gpu-shader-compiler --shader_input=shader.bin.vs --shader_output=shader.txt --shader_output_type=ucode
4

Load into Shader Playground

Open the disassembled text in the Shader Playground’s input panel.

Validation Indicators

Green/Normal Panel

When the translation panel appears normal (no red highlight), the shader translation is working correctly. The output from Xenia’s disassembler matches the D3D compiler’s reference output.

Red Panel Warning

When the panel turns red, there is a mismatch between:
  • The D3D compiler’s original output
  • The D3D compiler’s output when processing Xenia’s disassembly
This indicates that xe-gpu-shader-compiler is producing incorrect disassembly, which may lead to rendering bugs.

Use Cases

Shader Development

  • Test shader translation changes in real-time
  • Validate that disassembly matches expected output
  • Experiment with microcode without running the full emulator

Debugging Rendering Issues

  • Load problematic shaders from trace captures
  • Identify where shader translation diverges from D3D reference
  • Iterate on fixes with immediate visual feedback

Learning Xbox 360 Shader Format

  • See how microcode maps to assembly
  • Understand shader optimization
  • Compare input and output representations

Technical Details

Architecture

The Shader Playground integrates multiple components:
  • XNA Game Studio D3D Compiler - Microsoft’s reference compiler for validation
  • xe-gpu-shader-compiler - Xenia’s shader translation tool
  • Windows Forms GUI - Interactive editor interface

Supported Shader Types

  • Vertex Shaders (.vs) - Transform and lighting operations
  • Fragment/Pixel Shaders (.fs) - Per-pixel color calculations

Platform Limitations

  • Windows only - Requires XNA Game Studio 3.1
  • 32-bit x86 - Not compatible with 64-bit or ARM builds
  • Legacy .NET Framework - Uses older .NET version due to XNA dependency

Troubleshooting

”XNA Framework not found”

Ensure XNA Game Studio 3.1 is installed correctly. Check that Microsoft.Xna.Framework.dll exists at:
C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v3.1\References\Windows\x86\Microsoft.Xna.Framework.dll

“Platform target mismatch”

Verify that the project is set to build for x86, not Any CPU or x64.

Shader compiler not found

Make sure xe-gpu-shader-compiler.exe is built and accessible. Place it in the same directory as the Shader Playground executable or add it to your system PATH.

Build docs developers (and LLMs) love