# attackgoat/screen-13 architecture

> Architecture diagram of the GitHub repository attackgoat/screen-13, 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/attackgoat/screen-13
- Repository: https://github.com/attackgoat/screen-13

## Overview

##### Main Components

a. Core Engine Layer:
- Driver Component (src/driver/*)
- Vulkan Instance Management
- Physical Device Management
- Command Buffer Handling
- Resource Management (buffers, images, etc.)

b. Render Graph System (src/graph/*)
- Graph Resolver
- Node Management
- Edge Management
- Resource Binding System

c. Resource Management Layer (src/pool/*)
- Resource Pooling
- Memory Management
- Resource Aliasing

d. Extension Components (contrib/*):
- Hot Reload System (screen-13-hot)
- UI Integration (screen-13-imgui, screen-13-egui)
- Effects System (screen-13-fx)
- Window Management (screen-13-window)

**[Application Layer]**
- ↓
**[Window Management]**
- ↓
**[Render Graph System] ←→ [Resource Management]**
- ↓
**[Driver Layer] ←→ [Extensions]**
- ↓
**[Vulkan API]**

##### Component Details

a. Driver Layer:
- Vulkan abstractions (Instance, Device, CommandBuffer)
- Smart pointer management
- Resource creation/management flow

b. Render Graph:
- Node/edge relationship
- Pipeline integration (Compute, Graphics, Ray-tracing)
- Demonstrate resource binding system

c. Resource Management:
- Pooling system
- Memory management flow
- Aliasing optimization

d. Extensions:
- How they plug into the core system
- Optional nature
- Integration points

##### Implementation Notes

- Use UML-style notation for clarity
- Brief descriptions for major components
- Version compatibility (Vulkan version support)
- Performance-critical paths

##### Key Relationships to Highlight

- Render Graph → Driver (resource utilization)
- Extensions → Core (integration points)
- Resource Management → Driver (memory optimization)
- Window System → Render Graph (frame presentation)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef resource fill:#2ecc71,stroke:#27ae60,color:white
    classDef extension fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    
    %% Application Layer
    subgraph AppLayer
        App[Application]
    end

    %% Window Management
    WM["Window Management"]:::extension
    click WM "https://github.com/attackgoat/screen-13/tree/master/contrib/screen-13-window/"

    %% Render Graph System
    subgraph RenderGraph
        GraphResolver["Graph Resolver"]:::core
        NodeMgmt["Node Management"]:::core
        EdgeMgmt["Edge Management"]:::core
        ResourceBinding["Resource Binding"]:::core

        click GraphResolver "https://github.com/attackgoat/screen-13/blob/master/src/graph/resolver.rs"
        click NodeMgmt "https://github.com/attackgoat/screen-13/blob/master/src/graph/node.rs"
        click EdgeMgmt "https://github.com/attackgoat/screen-13/blob/master/src/graph/edge.rs"
        click ResourceBinding "https://github.com/attackgoat/screen-13/blob/master/src/graph/binding.rs"
    end

    %% Resource Management
    subgraph ResourceMgmt
        ResPool["Resource Pooling"]:::resource
        MemMgmt["Memory Management"]:::resource
        ResAlias["Resource Aliasing"]:::resource

        click ResPool "https://github.com/attackgoat/screen-13/blob/master/src/pool/mod.rs"
        click MemMgmt "https://github.com/attackgoat/screen-13/blob/master/src/pool/lazy.rs"
        click ResAlias "https://github.com/attackgoat/screen-13/blob/master/src/pool/alias.rs"
    end

    %% Driver Layer
    subgraph DriverLayer
        VulkanInst["Vulkan Instance"]:::core
        PhysDevice["Physical Device"]:::core
        CmdBuffer["Command Buffer"]:::core
        ResMgmt["Resource Management"]:::core

        click VulkanInst "https://github.com/attackgoat/screen-13/blob/master/src/driver/instance.rs"
        click PhysDevice "https://github.com/attackgoat/screen-13/blob/master/src/driver/physical_device.rs"
        click CmdBuffer "https://github.com/attackgoat/screen-13/blob/master/src/driver/cmd_buf.rs"
        click ResMgmt "https://github.com/attackgoat/screen-13/tree/master/src/driver/"
    end

    %% Pipeline Systems
    subgraph Pipelines
        GraphicsPipe["Graphics Pipeline"]:::core
        ComputePipe["Compute Pipeline"]:::core
        RayTracePipe["Ray Tracing Pipeline"]:::core

        click GraphicsPipe "https://github.com/attackgoat/screen-13/blob/master/src/driver/graphic.rs"
        click ComputePipe "https://github.com/attackgoat/screen-13/blob/master/src/driver/compute.rs"
        click RayTracePipe "https://github.com/attackgoat/screen-13/blob/master/src/driver/ray_trace.rs"
    end

    %% Extensions
    subgraph Extensions
        HotReload["Hot Reload System"]:::extension
        ImGui["ImGui Integration"]:::extension
        EGui["EGui Integration"]:::extension
        FX["Effects System"]:::extension

        click HotReload "https://github.com/attackgoat/screen-13/tree/master/contrib/screen-13-hot/"
        click ImGui "https://github.com/attackgoat/screen-13/tree/master/contrib/screen-13-imgui/"
        click EGui "https://github.com/attackgoat/screen-13/tree/master/contrib/screen-13-egui/"
        click FX "https://github.com/attackgoat/screen-13/tree/master/contrib/screen-13-fx/"
    end

    %% External Interface
    VulkanAPI["Vulkan API"]:::external

    %% Relationships
    App --> WM
    WM --> GraphResolver
    GraphResolver --> NodeMgmt
    GraphResolver --> EdgeMgmt
    GraphResolver --> ResourceBinding
    
    ResourceBinding -.-> ResPool
    ResPool --> MemMgmt
    ResPool --> ResAlias
    
    NodeMgmt --> VulkanInst
    EdgeMgmt --> CmdBuffer
    ResourceBinding --> ResMgmt
    
    VulkanInst --> PhysDevice
    PhysDevice --> CmdBuffer
    CmdBuffer --> ResMgmt
    
    ResMgmt --> Pipelines
    Pipelines --> VulkanAPI
    
    Extensions -.-> DriverLayer
    
    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        ResourceComp["Resource Management"]:::resource
        ExtensionComp["Extension Component"]:::extension
        ExternalComp["External Interface"]:::external
    end
```
