# nvonbulow/flaming-webgpu architecture

> Architecture diagram of the GitHub repository nvonbulow/flaming-webgpu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nvonbulow/flaming-webgpu
- Repository: https://github.com/nvonbulow/flaming-webgpu

## Overview

##### Application Layer
- Entry Point (index.tsx, App.tsx)
- UI Components Layer (src/components/ui)
- Styled Components System (src/components/ui/styled)

##### Core Fractal Processing System
- FractalCanvas Module
- Compute Pipeline
- Rendering Pipeline
- UI Overlay Layer

##### GPU Computation Layer
- WGSL Shaders
- Compute Kernels
- Rendering Shaders

##### Flame Engine
- Generators
- Palette Management
- Type System

##### Component Relationships
- UI Components → FractalCanvas
- FractalCanvas → GPU Pipeline
- Flame Engine → Compute Pipeline
- WGSL Shaders ↔ GPU Pipeline

##### Specific Components to Detail

a. UI Layer:
- ┌─ UI Components ─┐
- Buttons      │
- Cards        │
- Sliders      │
- Tabs         │
- ┘

b. FractalCanvas System:
- ┌─ FractalCanvas ──────┐
- ComputeLoop       │
- Renderer Pipeline │
- UI Layer          │
- ┘

c. GPU Pipeline:
- ┌─ GPU Pipeline ───────┐
- Point Generation  │
- Histogram Process │
- Rendering        │
- ┘

##### Important Flows to Highlight
- User Input → UI Components → FractalCanvas
- FractalCanvas → GPU Shaders
- Compute Results → Rendering Pipeline
- Rendering Output → Canvas Display

##### Technical Details
- WebGPU API Integration Points
- WGSL Shader Pipeline Stages
- Compute/Render Pass Organization

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface Layer"
        UI["UI Components"]
        SC["Styled Components"]
        App["App Component"]
        Entry["Main Entry"]
    end

    subgraph "Application Logic Layer"
        FC["FractalCanvas"]
        CP["Compute Pipeline"]
        RP["Rendering Pipeline"]
        UO["UI Overlay"]
    end

    subgraph "Flame Engine Layer"
        FE["Main Engine"]
        GEN["Generators"]
        PAL["Palette Management"]
        TYP["Type Definitions"]
        UTIL["Utilities"]
    end

    subgraph "GPU Computation Layer"
        WGSL["WGSL Shaders"]
        PG["Point Generation"]
        HP["Histogram Processing"]
        RS["Rendering Shader"]
        TD["Types Definition"]
    end

    Entry --> App
    App --> UI
    UI --> FC
    SC --> UI
    FC --> CP
    FC --> RP
    FC --> UO
    FE --> CP
    GEN --> FE
    PAL --> FE
    TYP --> FE
    UTIL --> FE
    CP --> WGSL
    RP --> WGSL
    WGSL --> PG
    WGSL --> HP
    WGSL --> RS
    WGSL --> TD

    %% Component Mappings
    click Entry "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/index.tsx"
    click App "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/App.tsx"
    click UI "https://github.com/nvonbulow/flaming-webgpu/tree/main/src/components/ui/"
    click SC "https://github.com/nvonbulow/flaming-webgpu/tree/main/src/components/ui/styled/"
    click FC "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/index.tsx"
    click CP "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/ComputeLoop.tsx"
    click RP "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/FractalRendererPipeline.tsx"
    click UO "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/FractalUiLayer.tsx"
    click WGSL "https://github.com/nvonbulow/flaming-webgpu/tree/main/src/FractalCanvas/wgsl/"
    click PG "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/wgsl/generate_points.wgsl"
    click HP "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/wgsl/histogram_max.wgsl"
    click RS "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/wgsl/histogram_render.wgsl"
    click TD "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/FractalCanvas/wgsl/types.wgsl"
    click FE "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/flame/index.ts"
    click GEN "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/flame/generators.ts"
    click PAL "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/flame/palette.ts"
    click TYP "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/flame/types.ts"
    click UTIL "https://github.com/nvonbulow/flaming-webgpu/blob/main/src/flame/util.ts"

    classDef ui fill:#a8dadc,stroke:#457b9d
    classDef app fill:#e9c46a,stroke:#f4a261
    classDef gpu fill:#e76f51,stroke:#d62828
    classDef flame fill:#2a9d8f,stroke:#264653

    class Entry,App,UI,SC ui
    class FC,CP,RP,UO app
    class WGSL,PG,HP,RS,TD gpu
    class FE,GEN,PAL,TYP,UTIL flame
```
