# narutoua/gta5_fsr architecture

> Architecture diagram of the GitHub repository narutoua/gta5_fsr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/narutoua/gta5_fsr
- Repository: https://github.com/narutoua/gta5_fsr

## Overview

This is a Windows DLL mod that replaces GTA V’s DirectX 11 upscaler with FidelityFX Super Resolution 1.0. The main flow loads the original D3D11 implementation (or a configured proxy), intercepts device creation, initializes the super-resolution manager, then wraps the device and context. The context detects GTA’s post-processing draw and asks the manager to run the FSR pass. The README also documents scaling modes, FiveM compatibility, and proxy settings. Several DXGI wrappers are present, but their complete runtime wiring is not shown in the excerpts.

Main entry points: [`gta5_fsr/main.cpp`](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/main.cpp) (DLL entry and exports), [`gta5_fsr/wrappers/d3d11/ID3D11DeviceContextWrapper.cpp`](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/d3d11/ID3D11DeviceContextWrapper.cpp) (D3D11 context wrapper), [`gta5_fsr/CSuperResolutionMgr.cpp`](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/CSuperResolutionMgr.cpp) (FSR pass manager), [`gta5_fsr/wrappers/d3d11/ID3D11DeviceWrapper.cpp`](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/d3d11/ID3D11DeviceWrapper.cpp) (D3D11 device wrapper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["DLL startup"]
  node_config["Settings<br/>[config.h]"]
  node_entry["DLL entry and exports<br/>[main.cpp]"]
end

subgraph group_interception["D3D11 interception"]
  node_defines["GTA render definitions<br/>[gta5_defines.h]"]
  node_device["D3D11 device wrapper"]
  node_context["D3D11 context wrapper"]
end

subgraph group_processing["Upscaling"]
  node_manager["FSR pass manager"]
end

subgraph group_dxgi["DXGI wrappers"]
  node_swapchain["Swap-chain wrapper"]
  node_factory["DXGI factory wrapper"]
  node_adapter["DXGI adapter wrapper"]
  node_dxgi_device["DXGI device wrapper"]
end

node_game(("GTA V"))
node_d3d11["D3D11 runtime"]

node_game -->|"loads DLL"| node_entry
node_entry -->|"reads settings"| node_config
node_entry -->|"loads runtime"| node_d3d11
node_entry -->|"initializes"| node_manager
node_entry -->|"wraps device"| node_device
node_entry -->|"wraps context"| node_context
node_entry -->|"wraps swap chain"| node_swapchain
node_context -->|"runs FSR pass"| node_manager
node_context -->|"checks render slots"| node_defines
node_manager -.->|"uses GPU resources"| node_d3d11
node_device -->|"wraps DXGI device"| node_dxgi_device
node_dxgi_device -->|"wraps adapter"| node_adapter
node_adapter -->|"wraps parent factory"| node_factory

click node_config "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/config.h"
click node_entry "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/main.cpp"
click node_defines "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/gta5_defines.h"
click node_device "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/d3d11/ID3D11DeviceWrapper.cpp"
click node_context "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/d3d11/ID3D11DeviceContextWrapper.cpp"
click node_manager "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/CSuperResolutionMgr.cpp"
click node_swapchain "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGISwapChainWrapper.cpp"
click node_factory "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGIFactoryWrapper.cpp"
click node_adapter "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGIAdapterWrapper.cpp"
click node_dxgi_device "https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGIDeviceWrapper.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_entry toneBlue
class node_defines,node_device,node_context toneAmber
class node_manager toneMint
class node_swapchain,node_factory,node_adapter,node_dxgi_device toneRose
class node_game,node_d3d11 toneIndigo
```

## Components

### DLL startup

- [Settings](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/config.h): `gta5_fsr/config.h`
- [DLL entry and exports](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/main.cpp): `gta5_fsr/main.cpp`

### D3D11 interception

- [GTA render definitions](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/gta5_defines.h): `gta5_fsr/gta5_defines.h`
- [D3D11 device wrapper](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/d3d11/ID3D11DeviceWrapper.cpp): `gta5_fsr/wrappers/d3d11/ID3D11DeviceWrapper.cpp`
- [D3D11 context wrapper](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/d3d11/ID3D11DeviceContextWrapper.cpp): `gta5_fsr/wrappers/d3d11/ID3D11DeviceContextWrapper.cpp`

### Upscaling

- [FSR pass manager](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/CSuperResolutionMgr.cpp): `gta5_fsr/CSuperResolutionMgr.cpp`

### DXGI wrappers

- [Swap-chain wrapper](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGISwapChainWrapper.cpp): `gta5_fsr/wrappers/dxgi/IDXGISwapChainWrapper.cpp`
- [DXGI factory wrapper](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGIFactoryWrapper.cpp): `gta5_fsr/wrappers/dxgi/IDXGIFactoryWrapper.cpp`
- [DXGI adapter wrapper](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGIAdapterWrapper.cpp): `gta5_fsr/wrappers/dxgi/IDXGIAdapterWrapper.cpp`
- [DXGI device wrapper](https://github.com/narutoua/gta5_fsr/blob/master/gta5_fsr/wrappers/dxgi/IDXGIDeviceWrapper.cpp): `gta5_fsr/wrappers/dxgi/IDXGIDeviceWrapper.cpp`

### Other components

- **GTA V**
- **D3D11 runtime**

## Connections

- GTA V → DLL entry and exports: loads DLL (evidence: `README.md`)
- DLL entry and exports → Settings: reads settings (evidence: `gta5_fsr/main.cpp`)
- DLL entry and exports → D3D11 runtime: loads runtime (evidence: `gta5_fsr/main.cpp`)
- DLL entry and exports → FSR pass manager: initializes (evidence: `gta5_fsr/main.cpp`)
- DLL entry and exports → D3D11 device wrapper: wraps device (evidence: `gta5_fsr/main.cpp`)
- DLL entry and exports → D3D11 context wrapper: wraps context (evidence: `gta5_fsr/main.cpp`)
- DLL entry and exports → Swap-chain wrapper: wraps swap chain (evidence: `gta5_fsr/main.cpp`)
- D3D11 context wrapper → FSR pass manager: runs FSR pass (evidence: `gta5_fsr/wrappers/d3d11/ID3D11DeviceContextWrapper.cpp`)
- D3D11 context wrapper → GTA render definitions: checks render slots (evidence: `gta5_fsr/wrappers/d3d11/ID3D11DeviceContextWrapper.cpp`)
- FSR pass manager → D3D11 runtime: uses GPU resources
- D3D11 device wrapper → DXGI device wrapper: wraps DXGI device (evidence: `gta5_fsr/wrappers/d3d11/ID3D11DeviceWrapper.cpp`)
- DXGI device wrapper → DXGI adapter wrapper: wraps adapter (evidence: `gta5_fsr/wrappers/dxgi/IDXGIDeviceWrapper.cpp`)
- DXGI adapter wrapper → DXGI factory wrapper: wraps parent factory (evidence: `gta5_fsr/wrappers/dxgi/IDXGIAdapterWrapper.cpp`)
