# stanleylin924/dxrtutorials architecture

> Architecture diagram of the GitHub repository stanleylin924/dxrtutorials, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stanleylin924/dxrtutorials
- Repository: https://github.com/stanleylin924/dxrtutorials

## Overview

##### Project Type and Purpose
- This is an educational sample repository demonstrating DirectX Raytracing (DXR) usage via a shared C++ Framework and multiple tutorial executables.
- The goal is to provide step-by-step, self-contained sample applications (under “Tutorials”) that each link against a common “Framework” library and a set of external dependencies.

##### High-Level File Structure
- Top-Level Components
- Framework
– Core C++ library (Framework.cpp / .h), project files (.vcxproj, .props)
– Externals subfolder bundles third-party libraries:
· GLM (math library)
· DXCAPI headers (compiler API wrapper)
· dxcompiler binaries (shader compiler)
- Tutorials
– 14 numbered tutorial subprojects, each an independent executable demonstrating a DXR concept
– Per-tutorial HLSL shader files under Data/
– Word DOCX guides alongside .cpp/.h source
- Configuration & Build
- Solution file (DxrTutorials.sln) orchestrates building Framework + all Tutorial projects
- .gitignore, LICENSE.md, README.md for project metadata

2. Shared Framework Library
3. External Dependencies
a. GLM (Math)
b. DXCAPI (Compiler wrapper)
c. dxcompiler (Shader compiler)
4. DirectX 12 / DXR Runtime (part of Windows OS / GPU driver)
5. GPU Hardware
1. Each Tutorial → links against → Framework
2. Framework → includes/utilizes → Externals (GLM, DXCAPI, dxcompiler)
3. Framework → calls → DirectX 12 / DXR APIs (Acceleration Structures, Ray-Tracing Pipeline)
4. DirectX 12 Runtime → dispatches → GPU Hardware workloads (ray generation, hit shaders)
5. Tutorials → load → HLSL shaders via dxcompiler & framework loader
C. Architectural Patterns & Principles
- Modular layering:
- Tutorial layer (application)
- Framework layer (abstraction/helper APIs)
- External library layer (math & compiler)
- System layer (DirectX / DXR / GPU)
- Single responsibility: each tutorial focuses on one DXR concept, reusing Framework for boilerplate (window creation, device init, swap chain, command lists)
- Dependency Injection: Framework projects reference specific Externals via props files; .vcxproj filters manage linking
D. Key Technologies
- C++17, Visual Studio 2019 build system
- DirectX 12 & DXR API calls (ID3D12Device5, acceleration structures, pipeline state objects, shader tables)
- HLSL shader files compiled via DXC (Shader Model 6+)
- GLM for vector/matrix math

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Tutorial Layer
    subgraph "Tutorials Layer"
        direction TB
        Tutorials["Tutorials (01-14)"]:::tutorial
    end

    %% Framework Layer
    Framework["Framework Library"]:::framework

    %% Externals Layer
    subgraph "Externals Layer"
        direction TB
        GLM["GLM (Math)"]:::external
        DXCAPI["DXCAPI (Compiler API)"]:::external
        dxcompiler["dxcompiler (Shader compiler)"]:::external
    end

    %% System Layer
    DXR["DirectX 12 / DXR Runtime"]:::system
    GPU["GPU Hardware"]:::hardware

    %% Build Config
    subgraph "Build Configuration"
        direction TB
        DxrSolution["DxrTutorials.sln"]:::config
        GitIgnore[".gitignore"]:::config
        License["LICENSE.md"]:::config
        Readme["README.md"]:::config
    end

    %% Connections
    Tutorials -->|"links against"| Framework
    Framework -->|"utilizes"| GLM
    Framework -->|"utilizes"| DXCAPI
    Framework -->|"utilizes"| dxcompiler
    Framework -->|"calls DXR APIs"| DXR
    DXR -->|"dispatches workloads"| GPU
    DxrSolution --> Framework
    DxrSolution --> Tutorials

    %% Click Events
    click Tutorials "https://github.com/stanleylin924/dxrtutorials/tree/master/Tutorials/"
    click Framework "https://github.com/stanleylin924/dxrtutorials/tree/master/Framework/"
    click GLM "https://github.com/stanleylin924/dxrtutorials/tree/master/Framework/Externals/GLM/"
    click DXCAPI "https://github.com/stanleylin924/dxrtutorials/tree/master/Framework/Externals/DXCAPI/"
    click dxcompiler "https://github.com/stanleylin924/dxrtutorials/tree/master/Framework/Externals/dxcompiler/"
    click DxrSolution "https://github.com/stanleylin924/dxrtutorials/blob/master/DxrTutorials.sln"
    click GitIgnore "https://github.com/stanleylin924/dxrtutorials/blob/master/.gitignore"
    click License "https://github.com/stanleylin924/dxrtutorials/blob/master/LICENSE.md"
    click Readme "https://github.com/stanleylin924/dxrtutorials/blob/master/README.md"

    %% Styles
    classDef tutorial fill:#a8e6cf,stroke:#333,stroke-width:1px
    classDef framework fill:#8ecae6,stroke:#333,stroke-width:1px
    classDef external fill:#ffd166,stroke:#333,stroke-width:1px
    classDef system fill:#9d4edd,stroke:#333,stroke-width:1px
    classDef hardware fill:#adb5bd,stroke:#333,stroke-width:1px
    classDef config fill:#ffadad,stroke:#333,stroke-width:1px
```
