> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/dolphin-emu/dolphin/llms.txt
> Use this file to discover all available pages before exploring further.

# Video backends

> Graphics rendering architecture supporting Vulkan, Direct3D, OpenGL, Metal, and Software rendering

Dolphin translates GameCube/Wii graphics commands to modern graphics APIs through multiple video backends.

## Available Backends

**Location**: `Source/Core/VideoBackends/`

<CardGroup cols={2}>
  <Card title="Vulkan" icon="v">
    Cross-platform, best performance

    **Platforms**: Windows, Linux, Android
  </Card>

  <Card title="Direct3D 12" icon="windows">
    Modern Windows API

    **Platforms**: Windows 10+
  </Card>

  <Card title="Direct3D 11" icon="windows">
    Legacy Windows support

    **Platforms**: Windows 7+
  </Card>

  <Card title="OpenGL" icon="globe">
    Wide compatibility

    **Platforms**: Windows, Linux, macOS
  </Card>

  <Card title="Metal" icon="apple">
    Apple native API

    **Platforms**: macOS 11+, iOS
  </Card>

  <Card title="Software" icon="microchip">
    CPU-based reference renderer

    **Platforms**: All (debugging only)
  </Card>
</CardGroup>

## Backend Selection

Choose backend in configuration:

```ini theme={null}
[Core]
GFXBackend = Vulkan  # or D3D12, D3D11, OGL, Metal, Software, Null
```

Command line:

```bash theme={null}
dolphin-emu --video_backend=Vulkan --exec=game.iso
```

## Graphics Pipeline

All backends implement the same pipeline:

<Steps>
  <Step title="Command Processing">
    Read graphics FIFO from GPU memory

    **Location**: `VideoCommon/CommandProcessor.cpp`

    * Process draw commands from CPU
    * Parse vertex data and state changes
    * Handle display lists
  </Step>

  <Step title="Geometry Processing">
    Transform and setup vertices

    **Location**: `VideoCommon/VertexManagerBase.cpp`

    * Run vertex shaders (XF emulation)
    * Apply projection matrices
    * Clip and cull primitives
  </Step>

  <Step title="Texture Decoding">
    Convert GC/Wii texture formats

    **Location**: `VideoCommon/TextureCacheBase.cpp`

    * Decode native formats (RGBA8, RGB565, I4, IA8, etc.)
    * Hash textures for cache lookup
    * Apply arbitrary mipmaps
  </Step>

  <Step title="Shader Generation">
    Generate pixel shaders for TEV

    **Location**: `VideoCommon/PixelShaderGen.cpp`

    * Emulate Texture Environment (TEV) unit
    * Combine up to 16 stages
    * Output GLSL/HLSL/MSL shader code
  </Step>

  <Step title="Rasterization">
    Draw to render target

    * Execute shaders via backend API
    * Apply blending and Z-testing
    * Output to EFB (Embedded FrameBuffer)
  </Step>

  <Step title="Post-Processing">
    Apply enhancements and effects

    * Resolve MSAA
    * Apply post-process shaders
    * Copy EFB to XFB or texture
  </Step>
</Steps>

## Vulkan Backend

**Location**: `VideoBackends/Vulkan/`

Recommended backend with best features:

### Features

* Async shader compilation (minimal stutter)
* Pipeline caching (fast startup)
* Optimal descriptor management
* Efficient multithreading
* Exclusive fullscreen

### Requirements

* Vulkan 1.1+ drivers
* VK\_EXT\_memory\_budget for VRAM tracking
* VK\_KHR\_push\_descriptor for performance

### Pipeline State

Vulkan backend caches pipeline state objects:

```cpp theme={null}
// Simplified pipeline creation
VkPipelineCache pipeline_cache;
VkPipeline CreatePipeline(const RasterizationState& rs,
                          const DepthState& ds,
                          const BlendingState& bs,
                          VkPipelineLayout layout,
                          VkShaderModule vs,
                          VkShaderModule ps);
```

Pipelines are pre-compiled and cached to disk.

## Direct3D 12 Backend

**Location**: `VideoBackends/D3D12/`

Modern Windows backend:

### Features

* Explicit multithreading
* GPU timeline synchronization
* Descriptor heap management
* Root signature optimization

### Requirements

* Windows 10 version 1903+
* D3D12 feature level 11\_0+
* DirectX 12 capable GPU

## Direct3D 11 Backend

**Location**: `VideoBackends/D3D/`

Legacy Windows support:

### Features

* Broad hardware compatibility
* Mature and stable
* Good performance on older GPUs

### Limitations

* Single-threaded API
* Potential shader stutter
* No async compilation

## OpenGL Backend

**Location**: `VideoBackends/OGL/`

Cross-platform fallback:

### Features

* Works on most systems
* Desktop OpenGL 3.3+ or OpenGL ES 3.0+
* DSA (Direct State Access) for efficiency

### Limitations

* Driver quality varies widely
* Potential stutter on driver pipeline compilation
* Limited async compilation support

<Warning>
  OpenGL driver quality varies significantly. Prefer Vulkan when available.
</Warning>

## Metal Backend

**Location**: `VideoBackends/Metal/`

Apple platforms:

### Features

* Native macOS/iOS performance
* Optimized for Apple Silicon
* MoltenVK-free implementation

### Requirements

* macOS 11.0 (Big Sur) or later
* Metal 2.3+ support

## Software Renderer

**Location**: `VideoBackends/Software/`

CPU-based reference implementation:

### Use Cases

* Debugging graphics issues
* Verifying hardware backend correctness
* Pixel-perfect accuracy testing

### Limitations

* Extremely slow (\< 10 FPS typically)
* No enhancements
* Single-threaded

```bash theme={null}
# Use software renderer
dolphin-emu --video_backend=Software --exec=game.iso
```

## Shared Video Code

**Location**: `Source/Core/VideoCommon/`

Shared across all backends:

| Component            | Purpose                      |
| -------------------- | ---------------------------- |
| `TextureCacheBase`   | Texture decoding and caching |
| `VertexManagerBase`  | Vertex buffer management     |
| `PixelShaderGen`     | Pixel shader generation      |
| `VertexShaderGen`    | Vertex shader generation     |
| `ShaderCache`        | Compiled shader storage      |
| `RenderBase`         | Abstract rendering interface |
| `FramebufferManager` | EFB/XFB management           |

## Texture Cache

Central texture management:

```cpp theme={null}
// Texture cache lookup
TCacheEntry* GetTexture(u32 address, u32 width, u32 height, 
                        TextureFormat format, u32 tlut_addr);
```

<Accordion title="Cache Strategy">
  * Hash-based lookup by memory address + format
  * LRU eviction when VRAM is full
  * Lazy invalidation on RAM writes
  * Supports arbitrary mipmaps
  * Handles EFB copies (render-to-texture)
</Accordion>

<Accordion title="Texture Formats">
  GameCube/Wii formats decoded to RGBA8:

  * **I4/I8**: Intensity (grayscale)
  * **IA4/IA8**: Intensity + Alpha
  * **RGB565/RGB5A3**: Color formats
  * **RGBA8**: Full color + alpha
  * **CMPR**: DXT1-like compression
  * **C4/C8/C14X2**: Palette-based (TLUT)
</Accordion>

## Shader Generation

Generate shaders for TEV (Texture Environment Unit):

```cpp theme={null}
// Generate pixel shader code
ShaderCode GeneratePixelShaderCode(const PixelShaderUid& uid);
```

TEV configuration determines shader:

* Up to 16 TEV stages
* Each stage: 2 color inputs, 1 alpha input
* Operations: add, sub, multiply, blend, compare
* Konstant colors and rasterized colors

Example TEV setup → generated shader:

```cpp theme={null}
// TEV: Stage0 = Tex0 * RasColor  
// Generated GLSL:
vec4 tex0 = texture(samp0, uv0);
vec4 ras = RasColor;
vec4 prev = tex0 * ras;
```

## Graphics Enhancements

Backends support quality improvements:

### Internal Resolution

Render at higher resolution than native (640x528):

* 1x (native), 2x, 3x, 4x, 5x, 6x, 7x, 8x
* Dramatically improves clarity
* GPU-intensive

### Anti-Aliasing

* **MSAA**: 2x, 4x, 8x multisample
* **SSAA**: 4x supersampling (highest quality, slowest)

### Anisotropic Filtering

* 1x (off), 2x, 4x, 8x, 16x
* Improves texture clarity at angles

### Post-Processing

Shader-based effects:

* Color correction
* Scanlines
* Edge smoothing (AA shaders)
* Custom shaders in `User/Shaders/`

## Performance Profiling

Built-in metrics:

```ini theme={null}
[General]
ShowSpeedPercent = True  # Show FPS and speed %

[GFX]  
ShowStatistics = True    # Show draw calls, textures
```

Key metrics:

* **Draw calls**: Primitives submitted to GPU
* **Shader compilations**: New shaders generated
* **Texture uploads**: New textures sent to VRAM
* **EFB peeks**: CPU reads from framebuffer (slow)

## See Also

* [Graphics Settings Guide](/user-guide/graphics-settings)
* [Graphics Mods](/advanced/graphics-mods)
* [Custom Pipelines](/advanced/custom-pipelines)
