diff --git a/CMakeLists.txt b/CMakeLists.txt index f295d0a..2add65a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,18 +61,18 @@ set(APP_SOURCES "${APP_DIR}/gl/renderer/GlScopedObjects.h" "${APP_DIR}/gl/shader/GlShaderSources.cpp" "${APP_DIR}/gl/shader/GlShaderSources.h" - "${APP_DIR}/gl/OpenGLComposite.cpp" - "${APP_DIR}/gl/OpenGLComposite.h" - "${APP_DIR}/gl/OpenGLCompositeRuntimeControls.cpp" - "${APP_DIR}/gl/RenderCommandQueue.cpp" - "${APP_DIR}/gl/RenderCommandQueue.h" + "${APP_DIR}/gl/composite/OpenGLComposite.cpp" + "${APP_DIR}/gl/composite/OpenGLComposite.h" + "${APP_DIR}/gl/composite/OpenGLCompositeRuntimeControls.cpp" + "${APP_DIR}/gl/threading/RenderCommandQueue.cpp" + "${APP_DIR}/gl/threading/RenderCommandQueue.h" "${APP_DIR}/gl/RenderEngine.cpp" "${APP_DIR}/gl/RenderEngine.h" - "${APP_DIR}/gl/RenderFrameState.h" - "${APP_DIR}/gl/RenderFrameStateResolver.cpp" - "${APP_DIR}/gl/RenderFrameStateResolver.h" - "${APP_DIR}/gl/RuntimeUpdateController.cpp" - "${APP_DIR}/gl/RuntimeUpdateController.h" + "${APP_DIR}/gl/frame/RenderFrameState.h" + "${APP_DIR}/gl/frame/RenderFrameStateResolver.cpp" + "${APP_DIR}/gl/frame/RenderFrameStateResolver.h" + "${APP_DIR}/gl/frame/RuntimeUpdateController.cpp" + "${APP_DIR}/gl/frame/RuntimeUpdateController.h" "${APP_DIR}/gl/pipeline/OpenGLRenderPass.cpp" "${APP_DIR}/gl/pipeline/OpenGLRenderPass.h" "${APP_DIR}/gl/pipeline/OpenGLRenderPipeline.cpp" @@ -173,9 +173,12 @@ target_include_directories(LoopThroughWithOpenGLCompositing PRIVATE "${APP_DIR}" "${APP_DIR}/control" "${APP_DIR}/gl" + "${APP_DIR}/gl/composite" + "${APP_DIR}/gl/frame" "${APP_DIR}/gl/pipeline" "${APP_DIR}/gl/renderer" "${APP_DIR}/gl/shader" + "${APP_DIR}/gl/threading" "${APP_DIR}/platform" "${APP_DIR}/runtime" "${APP_DIR}/runtime/coordination" @@ -394,13 +397,14 @@ endif() add_test(NAME Std140BufferTests COMMAND Std140BufferTests) add_executable(RenderCommandQueueTests - "${APP_DIR}/gl/RenderCommandQueue.cpp" + "${APP_DIR}/gl/threading/RenderCommandQueue.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCommandQueueTests.cpp" ) target_include_directories(RenderCommandQueueTests PRIVATE "${APP_DIR}" "${APP_DIR}/gl" + "${APP_DIR}/gl/threading" "${APP_DIR}/videoio" "${APP_DIR}/videoio/decklink" ) diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp rename to apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.h b/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.h similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.h rename to apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.h diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLCompositeRuntimeControls.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLCompositeRuntimeControls.cpp similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/OpenGLCompositeRuntimeControls.cpp rename to apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLCompositeRuntimeControls.cpp diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RenderFrameState.h b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameState.h similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/RenderFrameState.h rename to apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameState.h diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RenderFrameStateResolver.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.cpp similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/RenderFrameStateResolver.cpp rename to apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.cpp diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RenderFrameStateResolver.h b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.h similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/RenderFrameStateResolver.h rename to apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.h diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RuntimeUpdateController.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.cpp similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/RuntimeUpdateController.cpp rename to apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.cpp diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RuntimeUpdateController.h b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.h similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/RuntimeUpdateController.h rename to apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.h diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RenderCommandQueue.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.cpp similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/RenderCommandQueue.cpp rename to apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.cpp diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RenderCommandQueue.h b/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.h similarity index 100% rename from apps/LoopThroughWithOpenGLCompositing/gl/RenderCommandQueue.h rename to apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.h diff --git a/docs/ARCHITECTURE_RESILIENCE_REVIEW.md b/docs/ARCHITECTURE_RESILIENCE_REVIEW.md index 72aee4c..c8ed28d 100644 --- a/docs/ARCHITECTURE_RESILIENCE_REVIEW.md +++ b/docs/ARCHITECTURE_RESILIENCE_REVIEW.md @@ -68,7 +68,7 @@ Relevant code: - [RenderEngine.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/RenderEngine.cpp:36) - [OpenGLVideoIOBridge.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.cpp:11) -- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:168) +- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:168) This removes cross-thread GL context borrowing as the central correctness model. The remaining timing risk is that output frame production is still synchronous from the DeckLink completion path, so a render/readback spike can still reduce playout headroom. @@ -113,7 +113,7 @@ Failures are often surfaced via `MessageBoxA`, while background services mainly Relevant code: -- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:314) +- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:314) - [DeckLinkSession.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkSession.cpp:478) - [RuntimeServices.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.cpp:205) @@ -316,7 +316,7 @@ The desktop preview is rate-limited, but still presented from inside the render Relevant code: - [OpenGLRenderPipeline.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.cpp:54) -- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:235) +- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:235) This means preview presentation can still consume time on the same path that is trying to meet output deadlines. diff --git a/docs/PHASE_1_SUBSYSTEM_BOUNDARIES_DESIGN.md b/docs/PHASE_1_SUBSYSTEM_BOUNDARIES_DESIGN.md index b41cac7..3f54f18 100644 --- a/docs/PHASE_1_SUBSYSTEM_BOUNDARIES_DESIGN.md +++ b/docs/PHASE_1_SUBSYSTEM_BOUNDARIES_DESIGN.md @@ -58,8 +58,8 @@ The following current code paths are the strongest evidence for the split propos - `RuntimeHost.h` - `RuntimeHost.cpp` - `OpenGLComposite` is both app orchestrator and render/runtime coordinator: - - [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:106) - - [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:283) + - [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:106) + - [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:283) - `RuntimeServices` mixes service orchestration with polling and deferred state work: - [RuntimeServices.h](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.h:46) - [RuntimeServices.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.cpp:194) diff --git a/docs/PHASE_3_LIVE_STATE_SERVICE_COORDINATION_DESIGN.md b/docs/PHASE_3_LIVE_STATE_SERVICE_COORDINATION_DESIGN.md index 1103b77..7b795e8 100644 --- a/docs/PHASE_3_LIVE_STATE_SERVICE_COORDINATION_DESIGN.md +++ b/docs/PHASE_3_LIVE_STATE_SERVICE_COORDINATION_DESIGN.md @@ -345,9 +345,9 @@ The current groundwork is intended to let these lanes proceed in parallel with l | Lane | Primary files | Goal | | --- | --- | --- | | A. Live-state behavior | `runtime/live/RuntimeLiveState.*`, `tests/RuntimeLiveStateTests.cpp` | Implemented for Phase 3: stale completion, smoothing, trigger behavior, and overlay settle policy are covered by focused tests. | -| B. Render-state composition | `runtime/live/RenderStateComposer.*`, `gl/RenderFrameStateResolver.*`, `gl/RenderEngine.*` | Implemented for Phase 3: value composition and frame-state selection sit outside GL drawing while GL calls remain in `RenderEngine`. | +| B. Render-state composition | `runtime/live/RenderStateComposer.*`, `gl/frame/RenderFrameStateResolver.*`, `gl/RenderEngine.*` | Implemented for Phase 3: value composition and frame-state selection sit outside GL drawing while GL calls remain in `RenderEngine`. | | C. Service bridge | `control/RuntimeServices.*`, `control/RuntimeServiceLiveBridge.*`, `control/ControlServices.*` | Implemented for Phase 3: `OpenGLComposite::renderEffect()` no longer drains OSC update/completion queues directly. | -| D. App-frame orchestration | `gl/OpenGLComposite.*`, `gl/RuntimeUpdateController.*` | Implemented for Phase 3: render-effect glue is a narrow runtime-work, frame-input, render-frame sequence. | +| D. App-frame orchestration | `gl/composite/OpenGLComposite.*`, `gl/frame/RuntimeUpdateController.*` | Implemented for Phase 3: render-effect glue is a narrow runtime-work, frame-input, render-frame sequence. | | E. Persistence boundary | `runtime/coordination/RuntimeCoordinator.*`, `runtime/store/*`, event tests | Implemented for Phase 3: persistence request publication is explicit and ready for a later background writer. | ## Phase 3 Exit Criteria diff --git a/docs/subsystems/ControlServices.md b/docs/subsystems/ControlServices.md index ec7618e..d0123a2 100644 --- a/docs/subsystems/ControlServices.md +++ b/docs/subsystems/ControlServices.md @@ -508,8 +508,8 @@ The goal is for transports to emit actions, even if temporary adapters still cal `OpenGLComposite` currently owns `RuntimeServices` startup and consumption: -- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:312) -- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:723) +- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:312) +- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:723) That should move toward a composition root or subsystem host arrangement where render is no longer the owner of control ingress. diff --git a/docs/subsystems/RenderEngine.md b/docs/subsystems/RenderEngine.md index 3d94d7d..632f825 100644 --- a/docs/subsystems/RenderEngine.md +++ b/docs/subsystems/RenderEngine.md @@ -36,7 +36,7 @@ In the Phase 1 terminology, `RenderEngine` consumes snapshots plus render-local The current rendering path is split across several classes: -- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:86) constructs the renderer, render pipeline, shader programs, runtime services, and video bridge in one owner. +- [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:86) constructs the renderer, render pipeline, shader programs, runtime services, and video bridge in one owner. - [OpenGLRenderPipeline.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.cpp:31) performs pass execution, pack/readback, preview paint, and performance stat publication. - [OpenGLVideoIOBridge.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.cpp:58) accepts capture frames and still performs render work from the playout completion callback path. - `RenderFrameStateResolver` and `RenderStateComposer` now keep frame-state selection and live value composition outside GL drawing, while `RenderEngine` still owns the current GL resource and draw path. diff --git a/docs/subsystems/RuntimeCoordinator.md b/docs/subsystems/RuntimeCoordinator.md index 560a25b..a9d275d 100644 --- a/docs/subsystems/RuntimeCoordinator.md +++ b/docs/subsystems/RuntimeCoordinator.md @@ -12,7 +12,7 @@ Before the Phase 1 runtime split, the app's mutation path was split across sever - `RuntimeHost.h` - `RuntimeHost.cpp` - `OpenGLComposite` currently acts like an orchestration shell and a mutation coordinator at the same time: - - [OpenGLCompositeRuntimeControls.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLCompositeRuntimeControls.cpp:1) + - [OpenGLCompositeRuntimeControls.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLCompositeRuntimeControls.cpp:1) - `RuntimeServices` still owns some deferred control flow around OSC commit and polling: - [RuntimeServices.h](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.h:46) @@ -369,7 +369,7 @@ currently do this pattern: 2. decide whether to call `ReloadShader(...)` 3. call `broadcastRuntimeState()` -See [OpenGLCompositeRuntimeControls.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLCompositeRuntimeControls.cpp:1). +See [OpenGLCompositeRuntimeControls.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLCompositeRuntimeControls.cpp:1). That "call host, then decide reload/broadcast policy" logic is a direct candidate for migration into `RuntimeCoordinator`. diff --git a/docs/subsystems/RuntimeSnapshotProvider.md b/docs/subsystems/RuntimeSnapshotProvider.md index feb23db..b657189 100644 --- a/docs/subsystems/RuntimeSnapshotProvider.md +++ b/docs/subsystems/RuntimeSnapshotProvider.md @@ -21,7 +21,7 @@ Before the Phase 1 runtime split, the closest behavior lived in: - `RuntimeHost::TryRefreshCachedLayerStates(...)` - `RuntimeHost::RefreshDynamicRenderStateFields(...)` - `RuntimeHost::BuildLayerRenderStatesLocked(...)` -- the render-side cache usage in [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:589) +- the render-side cache usage in [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:589) `RuntimeSnapshotProvider` should absorb that responsibility, but in a cleaner and more publish-oriented way. @@ -381,7 +381,7 @@ The migrated runtime path is: 4. apply render-local overlay state 5. attach frame context -That is a much cleaner split than the current mixed lock/cache/fallback flow in [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/OpenGLComposite.cpp:589). +That is a much cleaner split than the current mixed lock/cache/fallback flow in [OpenGLComposite.cpp](/c:/Users/Aiden/Documents/GitHub/video-shader-toys/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp:589). ## Migration Plan