# google/angle architecture

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

- Interactive diagram: https://gitdiagram.com/google/angle
- Repository: https://github.com/google/angle

## Overview

ANGLE is a graphics translation layer: applications submit OpenGL ES (and EGL) calls, ANGLE manages graphics state, translates shaders, and dispatches work to a platform-supported renderer. The README also documents an experimental OpenCL runtime and standalone shader translation/validation. The graph preserves those branches and the major renderer choices. Some renderer internals are represented by their existing source directories because they were not sampled; edges among those components reflect README-level capabilities, not inspected call sites.

Main entry points: [`src/libANGLE/Context.h`](https://github.com/google/angle/blob/main/src/libANGLE/Context.h) (GL Context), [`src/compiler/translator/ShaderLang.cpp`](https://github.com/google/angle/blob/main/src/compiler/translator/ShaderLang.cpp) (Shader Compiler), [`src/libOpenCL`](https://github.com/google/angle/tree/main/src/libOpenCL) (OpenCL API), [`src/libGLESv2`](https://github.com/google/angle/tree/main/src/libGLESv2) (GLES Entry Points)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Graphics API"]
  node_gles["GLES Entry Points"]
  node_egl["EGL Runtime"]
end

subgraph group_compiler["Shader Translation"]
  node_shadercompiler["Shader Compiler<br/>[ShaderLang.cpp]"]
  node_preprocessor["Shader Preprocessor<br/>[Preprocessor.cpp]"]
  node_shaderir["Shader IR<br/>[IntermNode.h]"]
  node_glsl["GLSL Translators"]
  node_hlsl["HLSL Translator"]
  node_spirv["SPIR-V Translator"]
  node_msl["Metal Translator<br/>[TranslatorMSL.cpp]"]
  node_wgsl["WGSL Rewriting"]
end

subgraph group_runtime["Graphics Runtime"]
  node_context["GL Context<br/>[Context.h]"]
  node_glstate["GL Resource State"]
  node_pls["Pixel Local Storage"]
end

subgraph group_renderers["Backing Renderers"]
  node_d3d11["Direct3D 11"]
  node_desktopgl["Desktop GL"]
  node_vulkan["Vulkan"]
  node_metal["Metal"]
  node_webgpu["WebGPU"]
end

subgraph group_compute["OpenCL Runtime"]
  node_openclapi["OpenCL API"]
  node_openclpassthrough["OpenCL Passthrough"]
end

node_application(("Graphics Application"))
node_nativeopencl["Native OpenCL Drivers"]
node_shaderuser(("Shader Tool User"))

node_application -->|"calls"| node_gles
node_application -->|"uses"| node_egl
node_gles -.->|"dispatches"| node_context
node_egl -.->|"creates contexts"| node_context
node_context -.->|"manages"| node_glstate
node_context -.->|"compiles shaders"| node_shadercompiler
node_shadercompiler -.->|"preprocesses"| node_preprocessor
node_shadercompiler -.->|"builds IR"| node_shaderir
node_shadercompiler -->|"translates to GLSL"| node_glsl
node_shadercompiler -->|"translates to HLSL"| node_hlsl
node_shadercompiler -->|"translates to SPIR-V"| node_spirv
node_shadercompiler -.->|"translates to Metal"| node_msl
node_shadercompiler -.->|"translates to WGSL"| node_wgsl
node_context -->|"dispatches rendering"| node_d3d11
node_context -->|"dispatches rendering"| node_desktopgl
node_context -->|"dispatches rendering"| node_vulkan
node_context -->|"dispatches rendering"| node_metal
node_context -->|"dispatches rendering"| node_webgpu
node_context -.->|"manages storage"| node_pls
node_shaderuser -->|"submits shaders"| node_shadercompiler
node_openclapi -->|"forwards calls"| node_openclpassthrough
node_openclpassthrough -->|"forwards to drivers"| node_nativeopencl
node_openclapi -.->|"offers platform"| node_vulkan

click node_gles "https://github.com/google/angle/tree/main/src/libGLESv2"
click node_egl "https://github.com/google/angle/tree/main/src/libEGL"
click node_context "https://github.com/google/angle/blob/main/src/libANGLE/Context.h"
click node_glstate "https://github.com/google/angle/tree/main/src/libANGLE"
click node_pls "https://github.com/google/angle/blob/main/src/libANGLE/PixelLocalStorage.cpp"
click node_shadercompiler "https://github.com/google/angle/blob/main/src/compiler/translator/ShaderLang.cpp"
click node_preprocessor "https://github.com/google/angle/blob/main/src/compiler/preprocessor/Preprocessor.cpp"
click node_shaderir "https://github.com/google/angle/blob/main/src/compiler/translator/IntermNode.h"
click node_glsl "https://github.com/google/angle/tree/main/src/compiler/translator/glsl"
click node_hlsl "https://github.com/google/angle/tree/main/src/compiler/translator/hlsl"
click node_spirv "https://github.com/google/angle/tree/main/src/compiler/translator/spirv"
click node_msl "https://github.com/google/angle/blob/main/src/compiler/translator/msl/TranslatorMSL.cpp"
click node_wgsl "https://github.com/google/angle/blob/main/src/compiler/translator/wgsl/RewritePipelineVariables.cpp"
click node_d3d11 "https://github.com/google/angle/blob/main/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp"
click node_desktopgl "https://github.com/google/angle/tree/main/src/libANGLE/renderer/gl"
click node_vulkan "https://github.com/google/angle/tree/main/src/libANGLE/renderer/vulkan"
click node_metal "https://github.com/google/angle/tree/main/src/libANGLE/renderer/metal"
click node_webgpu "https://github.com/google/angle/blob/main/src/libANGLE/renderer/wgpu/wgpu_pipeline_state.cpp"
click node_openclapi "https://github.com/google/angle/tree/main/src/libOpenCL"
click node_openclpassthrough "https://github.com/google/angle/tree/main/src/libOpenCL"

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_gles,node_egl,node_shaderuser toneBlue
class node_shadercompiler,node_preprocessor,node_shaderir,node_glsl,node_hlsl,node_spirv,node_msl,node_wgsl toneAmber
class node_context,node_glstate,node_pls toneMint
class node_d3d11,node_desktopgl,node_vulkan,node_metal,node_webgpu toneRose
class node_openclapi,node_openclpassthrough,node_application,node_nativeopencl toneIndigo
```

## Components

### Graphics API

- [GLES Entry Points](https://github.com/google/angle/tree/main/src/libGLESv2): `src/libGLESv2`
- [EGL Runtime](https://github.com/google/angle/tree/main/src/libEGL): `src/libEGL`

### Shader Translation

- [Shader Compiler](https://github.com/google/angle/blob/main/src/compiler/translator/ShaderLang.cpp): `src/compiler/translator/ShaderLang.cpp`
- [Shader Preprocessor](https://github.com/google/angle/blob/main/src/compiler/preprocessor/Preprocessor.cpp): `src/compiler/preprocessor/Preprocessor.cpp`
- [Shader IR](https://github.com/google/angle/blob/main/src/compiler/translator/IntermNode.h): `src/compiler/translator/IntermNode.h`
- [GLSL Translators](https://github.com/google/angle/tree/main/src/compiler/translator/glsl): `src/compiler/translator/glsl`
- [HLSL Translator](https://github.com/google/angle/tree/main/src/compiler/translator/hlsl): `src/compiler/translator/hlsl`
- [SPIR-V Translator](https://github.com/google/angle/tree/main/src/compiler/translator/spirv): `src/compiler/translator/spirv`
- [Metal Translator](https://github.com/google/angle/blob/main/src/compiler/translator/msl/TranslatorMSL.cpp): `src/compiler/translator/msl/TranslatorMSL.cpp`
- [WGSL Rewriting](https://github.com/google/angle/blob/main/src/compiler/translator/wgsl/RewritePipelineVariables.cpp): `src/compiler/translator/wgsl/RewritePipelineVariables.cpp`

### Graphics Runtime

- [GL Context](https://github.com/google/angle/blob/main/src/libANGLE/Context.h): `src/libANGLE/Context.h`
- [GL Resource State](https://github.com/google/angle/tree/main/src/libANGLE): `src/libANGLE`
- [Pixel Local Storage](https://github.com/google/angle/blob/main/src/libANGLE/PixelLocalStorage.cpp): `src/libANGLE/PixelLocalStorage.cpp`

### Backing Renderers

- [Direct3D 11](https://github.com/google/angle/blob/main/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp): `src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp`
- [Desktop GL](https://github.com/google/angle/tree/main/src/libANGLE/renderer/gl): `src/libANGLE/renderer/gl`
- [Vulkan](https://github.com/google/angle/tree/main/src/libANGLE/renderer/vulkan): `src/libANGLE/renderer/vulkan`
- [Metal](https://github.com/google/angle/tree/main/src/libANGLE/renderer/metal): `src/libANGLE/renderer/metal`
- [WebGPU](https://github.com/google/angle/blob/main/src/libANGLE/renderer/wgpu/wgpu_pipeline_state.cpp): `src/libANGLE/renderer/wgpu/wgpu_pipeline_state.cpp`

### OpenCL Runtime

- [OpenCL API](https://github.com/google/angle/tree/main/src/libOpenCL): `src/libOpenCL`
- [OpenCL Passthrough](https://github.com/google/angle/tree/main/src/libOpenCL): `src/libOpenCL`

### Other components

- **Graphics Application**
- **Native OpenCL Drivers**
- **Shader Tool User**

## Connections

- Graphics Application → GLES Entry Points: calls
- Graphics Application → EGL Runtime: uses
- GLES Entry Points → GL Context: dispatches
- EGL Runtime → GL Context: creates contexts
- GL Context → GL Resource State: manages (evidence: `src/libANGLE/Context.h`)
- GL Context → Shader Compiler: compiles shaders
- Shader Compiler → Shader Preprocessor: preprocesses
- Shader Compiler → Shader IR: builds IR
- Shader Compiler → GLSL Translators: translates to GLSL
- Shader Compiler → HLSL Translator: translates to HLSL
- Shader Compiler → SPIR-V Translator: translates to SPIR-V
- Shader Compiler → Metal Translator: translates to Metal
- Shader Compiler → WGSL Rewriting: translates to WGSL
- GL Context → Direct3D 11: dispatches rendering (evidence: `src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp`)
- GL Context → Desktop GL: dispatches rendering
- GL Context → Vulkan: dispatches rendering
- GL Context → Metal: dispatches rendering
- GL Context → WebGPU: dispatches rendering
- GL Context → Pixel Local Storage: manages storage (evidence: `src/libANGLE/PixelLocalStorage.cpp`)
- Shader Tool User → Shader Compiler: submits shaders
- OpenCL API → OpenCL Passthrough: forwards calls
- OpenCL Passthrough → Native OpenCL Drivers: forwards to drivers
- OpenCL API → Vulkan: offers platform
