# opencl/gegl-opencl architecture

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

- Interactive diagram: https://gitdiagram.com/opencl/gegl-opencl
- Repository: https://github.com/opencl/gegl-opencl

## Overview

GEGL is a graph-based image-processing framework: callers connect operation nodes, request an output region, and receive rendered pixels. The main runtime path runs from the CLI or API through graph evaluation and traversal to image operations, whose buffers are backed by a tiled storage and handler system. The README documents loading, filtering, transforming, compositing, saving, pixel-format conversion via BABL, and optional OpenCL execution. The excerpts show graph evaluation and tile-handler setup; several other links are based on README documentation, not sampled implementation.

Main entry points: [`gegl/operation/gegl-operation.c`](https://github.com/opencl/gegl-opencl/blob/master/gegl/operation/gegl-operation.c) (Operation framework), [`gegl/buffer/gegl-buffer.c`](https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-buffer.c) (Image buffers), [`gegl/graph/gegl-node.c`](https://github.com/opencl/gegl-opencl/blob/master/gegl/graph/gegl-node.c) (Node graph), [`gegl/buffer/gegl-tile-storage.c`](https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-tile-storage.c) (Tile storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Entry points"]
  node_cli["GEGL CLI<br/>[gegl.c]"]
  node_api["C API<br/>[gegl.h]"]
end

subgraph group_graph["Graph execution"]
  node_nodes["Node graph<br/>[gegl-node.c]"]
  node_eval["Evaluation manager"]
  node_traversal["Graph traversal"]
  node_registry["Operation registry<br/>[gegl-operations.c]"]
end

subgraph group_operations["Image operations"]
  node_operation["Operation framework<br/>[gegl-operation.c]"]
  node_io["Image I/O<br/>[load.c]"]
  node_filters["Filters and color"]
  node_transforms["Transforms and composites<br/>[transform-core.c]"]
end

subgraph group_data["Pixel data"]
  node_buffer["Image buffers<br/>[gegl-buffer.c]"]
  node_storage[("Tile storage")]
  node_cache["Tile cache"]
  node_backends["Tile backends"]
  node_babl["BABL formats"]
end

subgraph group_acceleration["Acceleration"]
  node_opencl["OpenCL runtime<br/>[gegl-cl.c]"]
  node_kernels["OpenCL kernels<br/>[box-blur.cl.h]"]
end

node_user(("Caller"))

node_user -->|"runs"| node_cli
node_user -->|"requests rendering"| node_api
node_cli -.->|"constructs graph"| node_nodes
node_api -->|"builds graph"| node_nodes
node_nodes -->|"requests evaluation"| node_eval
node_eval -->|"builds and processes"| node_traversal
node_nodes -->|"resolves operations"| node_registry
node_traversal -.->|"dispatches work"| node_operation
node_registry -.->|"registers operations"| node_operation
node_operation -->|"provides I/O"| node_io
node_operation -->|"provides filtering"| node_filters
node_operation -->|"provides transforms"| node_transforms
node_io -->|"reads and writes"| node_buffer
node_filters -->|"processes pixels"| node_buffer
node_transforms -->|"processes pixels"| node_buffer
node_buffer -.->|"stores tiles"| node_storage
node_storage -->|"uses backend"| node_backends
node_storage -->|"adds handler"| node_cache
node_buffer -->|"converts formats"| node_babl
node_operation -->|"may use"| node_opencl
node_opencl -.->|"runs kernels"| node_kernels

click node_cli "https://github.com/opencl/gegl-opencl/blob/master/bin/gegl.c"
click node_api "https://github.com/opencl/gegl-opencl/blob/master/gegl/gegl.h"
click node_nodes "https://github.com/opencl/gegl-opencl/blob/master/gegl/graph/gegl-node.c"
click node_eval "https://github.com/opencl/gegl-opencl/blob/master/gegl/process/gegl-eval-manager.c"
click node_traversal "https://github.com/opencl/gegl-opencl/blob/master/gegl/process/gegl-graph-traversal.c"
click node_registry "https://github.com/opencl/gegl-opencl/blob/master/gegl/operation/gegl-operations.c"
click node_operation "https://github.com/opencl/gegl-opencl/blob/master/gegl/operation/gegl-operation.c"
click node_io "https://github.com/opencl/gegl-opencl/blob/master/operations/core/load.c"
click node_filters "https://github.com/opencl/gegl-opencl/blob/master/operations/common/brightness-contrast.c"
click node_transforms "https://github.com/opencl/gegl-opencl/blob/master/operations/transform/transform-core.c"
click node_buffer "https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-buffer.c"
click node_storage "https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-tile-storage.c"
click node_cache "https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-tile-handler-cache.c"
click node_backends "https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-tile-backend.c"
click node_opencl "https://github.com/opencl/gegl-opencl/blob/master/gegl/opencl/gegl-cl.c"
click node_kernels "https://github.com/opencl/gegl-opencl/blob/master/opencl/box-blur.cl.h"

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_cli,node_api toneBlue
class node_nodes,node_eval,node_traversal,node_registry toneAmber
class node_operation,node_io,node_filters,node_transforms toneMint
class node_buffer,node_storage,node_cache,node_backends,node_babl toneRose
class node_opencl,node_kernels,node_user toneIndigo
```

## Components

### Entry points

- [GEGL CLI](https://github.com/opencl/gegl-opencl/blob/master/bin/gegl.c): `bin/gegl.c`
- [C API](https://github.com/opencl/gegl-opencl/blob/master/gegl/gegl.h): `gegl/gegl.h`

### Graph execution

- [Node graph](https://github.com/opencl/gegl-opencl/blob/master/gegl/graph/gegl-node.c): `gegl/graph/gegl-node.c`
- [Evaluation manager](https://github.com/opencl/gegl-opencl/blob/master/gegl/process/gegl-eval-manager.c): `gegl/process/gegl-eval-manager.c`
- [Graph traversal](https://github.com/opencl/gegl-opencl/blob/master/gegl/process/gegl-graph-traversal.c): `gegl/process/gegl-graph-traversal.c`
- [Operation registry](https://github.com/opencl/gegl-opencl/blob/master/gegl/operation/gegl-operations.c): `gegl/operation/gegl-operations.c`

### Image operations

- [Operation framework](https://github.com/opencl/gegl-opencl/blob/master/gegl/operation/gegl-operation.c): `gegl/operation/gegl-operation.c`
- [Image I/O](https://github.com/opencl/gegl-opencl/blob/master/operations/core/load.c): `operations/core/load.c`
- [Filters and color](https://github.com/opencl/gegl-opencl/blob/master/operations/common/brightness-contrast.c): `operations/common/brightness-contrast.c`
- [Transforms and composites](https://github.com/opencl/gegl-opencl/blob/master/operations/transform/transform-core.c): `operations/transform/transform-core.c`

### Pixel data

- [Image buffers](https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-buffer.c): `gegl/buffer/gegl-buffer.c`
- [Tile storage](https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-tile-storage.c): `gegl/buffer/gegl-tile-storage.c`
- [Tile cache](https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-tile-handler-cache.c): `gegl/buffer/gegl-tile-handler-cache.c`
- [Tile backends](https://github.com/opencl/gegl-opencl/blob/master/gegl/buffer/gegl-tile-backend.c): `gegl/buffer/gegl-tile-backend.c`
- **BABL formats**

### Acceleration

- [OpenCL runtime](https://github.com/opencl/gegl-opencl/blob/master/gegl/opencl/gegl-cl.c): `gegl/opencl/gegl-cl.c`
- [OpenCL kernels](https://github.com/opencl/gegl-opencl/blob/master/opencl/box-blur.cl.h): `opencl/box-blur.cl.h`

### Other components

- **Caller**

## Connections

- Caller → GEGL CLI: runs
- Caller → C API: requests rendering (evidence: `gegl/gegl.h`)
- GEGL CLI → Node graph: constructs graph
- C API → Node graph: builds graph (evidence: `gegl/gegl.h`)
- Node graph → Evaluation manager: requests evaluation (evidence: `gegl/graph/gegl-node.c`)
- Evaluation manager → Graph traversal: builds and processes (evidence: `gegl/process/gegl-eval-manager.c`)
- Node graph → Operation registry: resolves operations (evidence: `gegl/graph/gegl-node.c`)
- Graph traversal → Operation framework: dispatches work
- Operation registry → Operation framework: registers operations
- Operation framework → Image I/O: provides I/O
- Operation framework → Filters and color: provides filtering
- Operation framework → Transforms and composites: provides transforms
- Image I/O → Image buffers: reads and writes
- Filters and color → Image buffers: processes pixels
- Transforms and composites → Image buffers: processes pixels
- Image buffers → Tile storage: stores tiles
- Tile storage → Tile backends: uses backend (evidence: `gegl/buffer/gegl-tile-storage.c`)
- Tile storage → Tile cache: adds handler (evidence: `gegl/buffer/gegl-tile-storage.c`)
- Image buffers → BABL formats: converts formats
- Operation framework → OpenCL runtime: may use
- OpenCL runtime → OpenCL kernels: runs kernels
