# yarodash/shadertoy architecture

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

- Interactive diagram: https://gitdiagram.com/yarodash/shadertoy
- Repository: https://github.com/yarodash/shadertoy

## Overview

This is a browser-based GLSL shader playground. Users edit a fragment shader, apply it, and see it rendered continuously on a WebGL canvas; they can also add named image textures and use the documented time and mouse uniforms. The graph follows the React entry point into the app, then separates shader editing/compilation, canvas rendering, and texture management. Source excerpts establish the principal calls; README documentation supplies the product capabilities. Some rendering and texture details are implemented directly inside App.js or ImageSelector.js.

Main entry points: [`src/App.js`](https://github.com/yarodash/shadertoy/blob/master/src/App.js) (App orchestration), [`src/ImageSelector.js`](https://github.com/yarodash/shadertoy/blob/master/src/ImageSelector.js) (Image selector), [`src/ImageSelectorList.js`](https://github.com/yarodash/shadertoy/blob/master/src/ImageSelectorList.js) (Texture list), [`src/webgl-scripts.js`](https://github.com/yarodash/shadertoy/blob/master/src/webgl-scripts.js) (WebGL utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Playground interface"]
  node_entry["React entry<br/>[index.js]"]
  node_app["App orchestration<br/>[App.js]"]
  node_errors["Shader errors<br/>[ErrorShow.js]"]
end

subgraph group_shader["Shader pipeline"]
  node_editor["Fragment editor"]
  node_defaults["Default shaders<br/>[defaultShaders.js]"]
end

subgraph group_render["Canvas rendering"]
  node_glscripts["WebGL utilities<br/>[webgl-scripts.js]"]
  node_canvas["Canvas input<br/>[Canvas.js]"]
  node_renderer["Shader render loop<br/>[App.js]"]
end

subgraph group_texture["Texture inputs"]
  node_texturelist["Texture list"]
  node_imageinput["Image selector<br/>[ImageSelector.js]"]
  node_reload["Image reload hook<br/>[customHooks.js]"]
end

node_user(("User"))

node_user -->|"opens app"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"renders"| node_editor
node_editor -->|"updates source"| node_app
node_app -->|"loads defaults"| node_defaults
node_app -->|"compiles and links"| node_glscripts
node_app -->|"renders"| node_canvas
node_canvas -->|"initializes context"| node_glscripts
node_app -->|"runs"| node_renderer
node_renderer -->|"binds textures"| node_glscripts
node_app -->|"displays errors"| node_errors
node_app -->|"renders and supplies state"| node_texturelist
node_texturelist -->|"renders selectors"| node_imageinput
node_imageinput -->|"uses reload hook"| node_reload
node_imageinput -->|"updates texture state"| node_texturelist

click node_entry "https://github.com/yarodash/shadertoy/blob/master/src/index.js"
click node_app "https://github.com/yarodash/shadertoy/blob/master/src/App.js"
click node_editor "https://github.com/yarodash/shadertoy/blob/master/src/FragmentShaderInput.js"
click node_defaults "https://github.com/yarodash/shadertoy/blob/master/src/defaultShaders.js"
click node_glscripts "https://github.com/yarodash/shadertoy/blob/master/src/webgl-scripts.js"
click node_canvas "https://github.com/yarodash/shadertoy/blob/master/src/Canvas.js"
click node_renderer "https://github.com/yarodash/shadertoy/blob/master/src/App.js"
click node_errors "https://github.com/yarodash/shadertoy/blob/master/src/ErrorShow.js"
click node_texturelist "https://github.com/yarodash/shadertoy/blob/master/src/ImageSelectorList.js"
click node_imageinput "https://github.com/yarodash/shadertoy/blob/master/src/ImageSelector.js"
click node_reload "https://github.com/yarodash/shadertoy/blob/master/src/customHooks.js"

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_entry,node_app,node_errors,node_user toneBlue
class node_editor,node_defaults toneAmber
class node_glscripts,node_canvas,node_renderer toneMint
class node_texturelist,node_imageinput,node_reload toneRose
```

## Components

### Playground interface

- [React entry](https://github.com/yarodash/shadertoy/blob/master/src/index.js): `src/index.js`
- [App orchestration](https://github.com/yarodash/shadertoy/blob/master/src/App.js): `src/App.js`
- [Shader errors](https://github.com/yarodash/shadertoy/blob/master/src/ErrorShow.js): `src/ErrorShow.js`

### Shader pipeline

- [Fragment editor](https://github.com/yarodash/shadertoy/blob/master/src/FragmentShaderInput.js): `src/FragmentShaderInput.js`
- [Default shaders](https://github.com/yarodash/shadertoy/blob/master/src/defaultShaders.js): `src/defaultShaders.js`

### Canvas rendering

- [WebGL utilities](https://github.com/yarodash/shadertoy/blob/master/src/webgl-scripts.js): `src/webgl-scripts.js`
- [Canvas input](https://github.com/yarodash/shadertoy/blob/master/src/Canvas.js): `src/Canvas.js`
- [Shader render loop](https://github.com/yarodash/shadertoy/blob/master/src/App.js): `src/App.js`

### Texture inputs

- [Texture list](https://github.com/yarodash/shadertoy/blob/master/src/ImageSelectorList.js): `src/ImageSelectorList.js`
- [Image selector](https://github.com/yarodash/shadertoy/blob/master/src/ImageSelector.js): `src/ImageSelector.js`
- [Image reload hook](https://github.com/yarodash/shadertoy/blob/master/src/customHooks.js): `src/customHooks.js`

### Other components

- **User**

## Connections

- User → React entry: opens app (evidence: `src/index.js`)
- React entry → App orchestration: renders (evidence: `src/index.js`)
- App orchestration → Fragment editor: renders (evidence: `src/App.js`)
- Fragment editor → App orchestration: updates source (evidence: `src/FragmentShaderInput.js`)
- App orchestration → Default shaders: loads defaults (evidence: `src/App.js`)
- App orchestration → WebGL utilities: compiles and links (evidence: `src/App.js`)
- App orchestration → Canvas input: renders (evidence: `src/App.js`)
- Canvas input → WebGL utilities: initializes context (evidence: `src/Canvas.js`)
- App orchestration → Shader render loop: runs (evidence: `src/App.js`)
- Shader render loop → WebGL utilities: binds textures (evidence: `src/App.js`)
- App orchestration → Shader errors: displays errors (evidence: `src/App.js`)
- App orchestration → Texture list: renders and supplies state (evidence: `src/App.js`)
- Texture list → Image selector: renders selectors (evidence: `src/ImageSelectorList.js`)
- Image selector → Image reload hook: uses reload hook (evidence: `src/ImageSelector.js`)
- Image selector → Texture list: updates texture state (evidence: `src/ImageSelectorList.js`)
