Workspace model

Documents and bindings introduces open, focused, and bound state. This page describes the native ownership that implements it.

ShaderWorkspace owns ShaderDocument objects, exactly one focused document, per-document DocumentSession view state, TimeContext, and TimeTransport. It emits focus and lifetime signals but has no Render Toy or ShaderToy binding policy.

ShaderDocument owns source identity, authored buffer, compiler diagnostics, reflection, resources, entry points, generated targets, parameter model, and dependency graph. DocumentSession retains only cursor/selection, scroll positions, view mode, and generated target.

ShaderWorkspace
   +-> ShaderDocument A
   +-> ShaderDocument B
   `-> focus -> WorkspaceEditor + active-document Inspector

RenderToySession ----references----> A/B
ShaderToySession ----references----> A

Closing a document notifies sessions to remove references. Changing the visible tool leaves the workspace and both runtime sessions alive.

Implementation

Relevant source:

  • cpp/include/miskeyed/workbench/slang/ShaderWorkspace.h

  • cpp/src/workbench/slang/ShaderWorkspace.cpp

  • cpp/include/miskeyed/workbench/slang/ShaderDocument.h

  • cpp/include/miskeyed/workbench/editor/WorkspaceEditor.h