Skip to content

Revises runtime, rendering, and resource architecture - #9

Merged
cppcooper merged 164 commits into
developfrom
refactor-runtime-render-resource-architecture
Oct 2, 2026
Merged

cppcooper merged 164 commits into
developfrom
refactor-runtime-render-resource-architecture

Conversation

@cppcooper

@cppcooper cppcooper commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

This PR completes Cheryl’s runtime, input, rendering, backend, and resource refactor around explicit ownership, scheduling, and state-transfer contracts. The legacy iEngine / RuntimeEngine / glEngine hierarchy is replaced by composition through EngineContext, with separate platform/display, presentation, input, rendering, and resource-provider responsibilities.

Sequential and concurrent execution remain first-class supported modes. In concurrent mode, the platform thread owns window/input polling, presentation, and the graphics context, while a simulation worker owns game-state mutation and render-frame preparation. Simulation publishes complete retained RenderFrame submissions so rendering can consume published state without accessing mutable game objects.

Platform, simulation, and general CPU execution have distinct dispatch boundaries. Event registrations persist until explicit unsubscribe, with ordered queued delivery, owned payloads, observable failures, and barriers for active callbacks. A reusable, independently owned worker pool provides shared worker groups with concurrency caps, weighted scheduling, and capability-aware CPU eligibility.

Input is separated into gameplay State, ordered physical Events, and OS Text capture. Polling cadence is independent of simulation cadence, and simulation consumes the whole completed polling backlog at update boundaries. Scoped capture and focus routing provide stronger fidelity where needed. Simulation timing supports variable and fixed-step policies, bounded recovery, capped variable catch-up, and explicit dropped-time reporting; input observation durations remain separate from simulation deltas.

Rendering has migrated away from legacy immediate asset drawing. CPU-side submission resolves geometry, images, immutable pipeline/material contracts, semantic parameters, and explicit pass state into retained packets. Reload preserves older generations referenced by published frames. Batching and sorting remain extension points.

OpenGL resources have an explicit context-owned lifetime. Final logical release may occur on any thread; native retirement and deletion run on the graphics-context owner. Strong caches retain residency until explicit clearing, replacement, or provider teardown. Compiled shader stages are transient linking details, and only successfully linked executable programs are published. Both runtime modes settle accepted CPU/platform dependencies before releasing frames and application resources.

Asset loading separates CPU preparation from backend upload. Owned loaders support independent roots, generic loading no longer implicitly selects host fonts or shader recipes, and cache publication/provider teardown are synchronized. Font allocation failures now propagate bad_alloc while releasing outstanding scratch. RGBA uploads also correct source-row orientation while preserving caller pixels and STB alpha ordering. Native shutdown unbinds the current program so deletion completes while the borrowed context remains alive.

Normal and CHERYL_SANDBOX_BUILD Release configurations compile successfully. Complete aggregate suites pass 349 normal tests and 335 sandbox tests, with no failures or skips. Coverage includes dispatch/event lifetime, worker policies, timing/input recovery, cache publication, retained rendering, resource ownership, reload, and startup/shutdown failures.

Automated native acceptance runs on Mesa 25.2.8 llvmpipe and includes twelve real-context cases alongside three real-font cases. Checks exercise sequential/concurrent timing and polling backpressure, ordered X11 Events/Text, retained resources, shader reload failures, context restoration, and native deletion. Six runtime failure combinations verify original-error preservation and accepted CPU/platform settlement. Real Linux affinity checks verify inherited restrictions, required/preferred eligibility, restoration, kernel rejection, and subsequent worker recovery.

Desktop checks were also reported as passing for camera/mouse input, text focus, resize, successful/failed/recovered F5 reload, and normal close. The completed-task source audit and planned technical acceptance are complete for their recorded scopes.

cppcooper and others added 30 commits September 27, 2026 14:10
cppcooper and others added 28 commits October 1, 2026 14:47
The first sandbox aggregate run exposed two startup-failure fixtures expecting
failed_operation from already accepted requests cancelled during cleanup. Both
dispatchers document broken_promise for that path; failed_operation instead
rejects new submissions after closure.

Check readiness and the exact future_errc::broken_promise code for the owned-root
rollback and dedicated simulation-thread startup cases. Preserve their assertions
on callback suppression, capture release, worker/upload completion and the original
startup error through later cleanup failures. Production behavior is unchanged.

Validation: normal and sandbox Release targets compile and link with GCC 13.3 and
C++23. Full aggregate reruns pass all 332 normal and 330 sandbox tests, with no
failures, errors, disabled tests or skips. Real demo/driver/font acceptance remains
open under task 9.5.
Record exact remote/audit reconciliation, current Release build configurations,
initial regression failures and successful complete normal/sandbox aggregate runs.
Separate executed Linux affinity and controlled adapter evidence from real demo,
GL driver/context/font and remaining OS failure/restriction acceptance.

Add completed 9.5a/b substeps without closing the overall 9.5 gate. Align current
status, source-audit history, convergence notes and the local PR description draft.
Preserve the original base and ordered patches; new delivery is 91-92 from integrated
remote checkpoint 90. No push or PR publication is included.

Validation: documentation links and git diff --check pass. Documentation only;
validated C++ remains unchanged from checkpoint 91, whose full normal/sandbox
regressions pass 332/330 cases with no skips.
Accept --max-updates=N in the existing demo; zero or omission preserves interactive
execution. A positive limit calls GameRuntime::stop from the simulation owner and
reports completed updates after normal shutdown. Keep all demo members above methods.

Validation: normal Release demo builds. Eight real GLFW/OpenGL runs on Mesa llvmpipe
complete twelve updates and return zero: sequential/concurrent variable finite,
variable unlimited, fixed drop with capacity one, and fixed hybrid configurations.
These exercise configured paths without claiming forced recovery or visual sign-off.
Integrate two native tests into the existing aggregate executable. Require explicit
CHERYL_NATIVE_GL_TESTS=1 for normal builds; the sandbox translation unit is empty.
A real provider texture released on a foreign thread survives until owner maintenance
without drawing. A second unshared GLFW context rejects use/collection; shutdown
restores the selected context, deletes retained native storage and supports final
foreign release after both windows and the engine are destroyed.

Validation: both Release builds pass. In an authorized TCP Xvfb session on Mesa 25.2.8
llvmpipe OpenGL 4.5, full normal/sandbox suites pass 334/330 cases with no skips or
failures. No additional regression executable is created. Hardware-driver, interactive
input/resize/reload and remaining native failure/font acceptance stay open.
Records successful full Release builds, 334 native-enabled normal and 330 sandbox tests without skips, and eight finite demo runs on Mesa llvmpipe. Distinguishes actual context retirement and shutdown evidence from remaining hardware, interactive input/resize/reload, forced overload and font/OS failure acceptance.

Provides a short desktop sequence for the user while preserving the open task-9 gates and the verified remote-92 delivery baseline. Source execution was validated at checkpoint 94; this checkpoint records results only.
Records the user-reported desktop checklist pass after remote checkpoint 95: input/text focus, resize, valid/failed/recovered F5 reload and normal close behaved as expected. Provides explicit copied-asset commands and explains the positional asset-root argument.

Keeps forced overload, further native failure/resource combinations, stb allocation, rotated FFont, OS policy acceptance and PR publication open. Updates the local PR draft and status records without changing source or automated counts. Delivers only checkpoint 96 from the verified remote-95 baseline.
The last drawn program can remain current after its final CPU owner retires. OpenGL defers program deletion while it is current, so idle maintenance and renderer shutdown previously left its native storage alive while the borrowed window/context remained alive. Require the selected current context and unbind the program before collection or the shutdown sweep. Later draws select their own complete program state.

Adds three opt-in real-context acceptance cases: shader-source replacement and cache clear preserve retained red/green frame output; compile/link/missing-file/reflection failures preserve the published material while deleting partial or retired candidates; shutdown deletes programs, VAOs, buffers and textures before context destruction and supports final foreign owner release afterward. Native forwarding traces observe actual driver IDs without replacing the native implementation.

The initial native shutdown case reproduced one failure among five tests. Both complete Release builds and corrected full suites pass: 337 normal and 330 sandbox, no skips. Real checks ran on Mesa llvmpipe. Remaining task-9 acceptance stays open.
Records the initial real-driver shutdown failure and corrected maintenance/shutdown behavior, retained shader-source generation readbacks, native partial failure cleanup and late final owner release. Full builds and 337 normal / 330 sandbox tests pass with all five native cases enabled and no skips.

Preserves the user-reported desktop checklist pass and includes pending documentation checkpoint 96 in the next code delivery from confirmed remote 95. Keeps forced overload, further native context faults, stb allocation, rotated FFont, OS policy acceptance and PR publication open. Source work stopped at the first checkpoint past 20 minutes; this commit changes documentation only.
Routes real stb scratch allocations through a private scoped memory-resource
boundary while preserving the public font-loading API. Intrusive allocation
records release all outstanding glyph/raster scratch when bad_alloc unwinds
stb manual cleanup. Scope ownership restores across nested bakes and is local
to the calling thread. Allocation failure precedes geometry/atlas publication.

Adds aggregate opt-in real TrueType and CFF fault sweeps, rejecting each of
793 and 727 allocation requests respectively, including the heap scanline
path. Checks zero outstanding scratch, no uploads, successful subsequent
loads, and nested failure with both successful and failing outer loads.

Validation: full normal/sandbox Release builds and suites, 340/333 passes
with no failures/errors/disabled/skips, including all five native GL cases.
An isolated null-return vendor reproduction gives a successful but altered
TrueType atlas and SIGSEGV on CFF. The managed loader rejects these requests
with bad_alloc and releases its tracked scratch.
Records the isolated TrueType partial-atlas and CFF null-allocation crash
reproductions, the tracked allocation boundary, complete request sweeps and
nested-failure ownership checks at source checkpoint 99.

Records full normal/sandbox Release build success, 340/333 passing tests
without failures/errors/disabled/skips, all five native OpenGL cases, and
successful finite sequential/concurrent demos after the font allocator fix.
Marks bounded real-font allocation acceptance 9.5e.1 complete while leaving
rotated FFont and remaining overload/native/OS/publication acceptance open.

Reconciles active evidence and the pending 96-100 delivery from confirmed
remote 95. Retains the original cumulative base and historical result scopes.
This checkpoint changes documentation only; prior source validation applies.
Converts top-to-bottom RGBA source rows to bottom-up OpenGL storage while
preserving the source buffer and stb's separate one-channel baked UV order.
Both raw/file Texture paths and decoded provider uploads share this boundary.
Checks row-storage size before allocating the transient reordered copy.

Adds native aggregate acceptance through real FFont widths loading, uploaded
atlas geometry, production shader contracts and retained text packets.
Asymmetric colored cells verify normal/alternate banks, distinct stored
widths and spaces, quarter-turn rotation, the legacy transformed newline,
source/cache release and final idle retirement of texture/VAO/buffer/program.
The initial real-context run reproduced incorrect atlas-row selection.

A second native case decodes a small committed PNG and reads actual driver
storage for direct file construction, file loading and prepared RGBA upload.
It verifies unchanged input pixels and unchanged odd-width stb alpha rows.

Validation: full normal/sandbox Release builds and aggregate suites pass
342/333 tests without failures/errors/disabled/skips, including seven native
GL and three real-font allocation cases. Both finite real demo modes pass.
Records the native FFont pixel failure and shared RGBA row-orientation fix
at source 101, plus real widths/geometry/shader/packet rendering acceptance.
Documents normal/alternate banks, width/space motion, quarter-turn output,
legacy newline displacement and retained resource retirement.

Records actual PNG decoding, direct/file/prepared image storage readbacks,
unchanged caller pixels and unchanged odd-width stb alpha rows. Updates
image upload documentation to the explicit CPU and backend row conventions.

Full normal/sandbox Release builds and aggregate suites pass 342/333 tests
without failures/errors/disabled/skips, including seven native GL and three
real-font allocation cases. Both finite demo modes pass after the fix.
Closes bounded font acceptance 9.5e while retaining overload, native/context
failure, OS acceptance and PR publication gates. Pending delivery is 96-102
from confirmed remote 95; the cumulative original base remains unchanged.
This checkpoint changes documentation only.
Executes both runtime owners with real GLFW/Gainput/OpenGL adapters and
resolved geometry/material packets. Forces an 80 ms update workload under
variable, fixed-drop and capped variable-catch-up timing, with both zero
and one fixed-prefix recovery configurations. Checks actual update kinds,
fixed deltas, observed elapsed lag, recovery caps and dropped time.

Adds a delegating native context whose first completed swap holds the
platform within presentation. Sequential timing reflects the workload;
concurrent simulation must advance eight updates while at most two frame
preparations fit the remaining slots. A condition predicate establishes
that progress; its deadline bounds failure. Real framebuffer pixel reads
verify packet playback before native swaps and presentation resumes.

Forwards real input State snapshots to fill lockstep and three-poll finite
batches during a held concurrent update. Two separately completed platform
drains prove native polling stays paused while presentation and platform
requests continue. The next update consumes every retained poll in order,
and subsequent polling resumes. This does not inject hardware Events/Text
or claim physical GPU/compositor pacing. Adds three cases to the existing
opt-in aggregate native suite; production behavior is unchanged.
Records source 103's eight real-clock timing workload runs, two-mode native
presentation hold, real packet pixel readbacks and coordinated lockstep/
finite State backpressure. The concurrent presentation hold reports eight
updates with two preparations; full input batches pause actual native polls
while platform drains and retained-frame presentation continue, then transfer
all polls in order and resume polling.

Records complete normal/sandbox Release builds and aggregate execution:
345 normal and 333 sandbox cases pass without failures, errors, disabled
cases or skips, including ten real-context and three real-font cases.
Keeps physical GPU/compositor stalls and hardware Events/Text outside this
controlled workload claim; ordered native records under forced backlog,
further native/context faults, OS policy acceptance and PR publication remain
open. Closes only the bounded 9.5c.1/c.2 scopes and retains 9.5e completion.

Uses the user's confirmed application through patch 98 as delivery baseline
even though a fresh fetch still observes remote 95. Pending delivery contains
99-104, excluding applied 96-98, with a unique bundle and original cumulative
base. Updates timing/acceptance/status/work-order/ledger and local PR draft.
This checkpoint changes documentation only.
Sends synthetic key events through this test's own X server window and the
runtime's normal GLFW pump, exercising real key translation, repeat handling,
character conversion, Gainput State publication and ordered record capture.
Runs sequential/concurrent fixed-drop and capped catch-up configurations.
Each run receives exactly eleven records: a shifted repeated A, a B tap,
and a C tap after focus/capture replacement. Checks native codes/modifiers,
combined sequence/timestamp order, old exclusive and new pass-through routing,
and one semantic press/release without replay in later recovery updates.

A concurrent simulation-mailbox gate precedes backlog consumption. Three
actual native polls fill capacity while two separate platform drains verify
polling remains paused. The C tap is already in Xlib's queue during that
pause; normal resumed polling captures it under the replacement focus.
Old queued records survive capture-lease release and focus replacement.
Sequential mode exercises the same real record/focus/recovery pipeline on
its shared owner. A deliberate 120 ms workload forces dropped/catch-up lag;
future/predicate coordination proves ordering independently of that delay.

Extends only the aggregate native fixture and its forwarding observer.
Production behavior and dependencies are unchanged. The Linux X11 case is
opt-in with CHERYL_NATIVE_GL_TESTS and skips on another GLFW platform.
Synthetic server events do not claim physical keyboard/IME/device coverage.
Records source 105's synthetic X server input through normal GLFW key/text
conversion in sequential/concurrent fixed-drop and capped catch-up runs.
Each delivers eleven records once with native codes/modifiers, chronological
sequence, old exclusive/new pass-through focus metadata and one semantic
press/release. Coordinated concurrent capacity keeps later server events
queued until native polling resumes; capture replacement retains older data.

Both full Release builds and enabled aggregate suites pass 346 normal and
333 sandbox cases without failures/errors/disabled/skips, including eleven
native-context and three real-font cases. Closes bounded 9.5c acceptance with
103's timing/presentation/State checks and prior reported desktop/demo results.
Retains font 9.5e closure and explicitly scopes the remaining work to native
resource/runtime failure cleanup (9.5d.2), actual OS affinity restrictions and
request rejection (9.5f.1), plus separately requested PR publication (9.7).
Does not infer physical device/IME, privileged policy or GPU reset coverage.

Updates input/timing/acceptance/status/work-order/ledger and local PR draft.
Delivery remains based on user-confirmed applied 98 while fresh fetch still
observes remote 95. Pending patches 99-106 exclude already-applied 96-98;
original cumulative base and author/history replay are preserved. This
checkpoint changes documentation only.
Enables the aggregate X11 input fixture only when the Linux normal build
selects GLFW_BUILD_X11. A source-specific compile definition guards both
the native-access include and the X server case, preserving native tests
that do not require that backend. Production dependencies remain unchanged.

Checks the affected translation unit with the macro absent and verifies
no glfwGetX11/XSendEvent/XSync references. Both Release builds and rebuilt
native-enabled suites pass 346 normal and 333 sandbox cases without skips.
Retains the earlier full-suite run separately because it overlapped the
rebuild; final acceptance runs only after the rebuilt executable completes.
This check does not claim a complete Wayland-only build.

Records the guard as a necessary checkpoint-buffer correction after source
105 and evidence 106. Bounded 9.5c/9.5e closures remain; native runtime failure
cleanup, actual OS affinity rejection/restrictions and PR metadata remain
open. Delivery is 99-107 from user-confirmed applied 98, with preserved
numbered patches, cumulative original base and exact replay evidence.
Exercises initialization, partially prepared frame and completed-swap failures
with real GLFW/OpenGL resources in sequential and concurrent GameRuntime runs.
Accepted CPU work waits until quiesce and posts a real platform upload during
shutdown; checks owner execution, settled futures and resource dependency life.

Unbinds the actual current context during game deinit and raises a secondary
cleanup error. Verifies original-error preservation, input detachment, context
recovery, expired retained owners and native program/VAO/buffer/texture deletion
while the borrowed window remains alive. Records all six exercised scenarios.
Narrows only the calling test thread mask, constructs a production worker pool
with the restricted inheritance, and verifies discovered capability, required
rejection, preferred intersection/fallback and actual worker execution masks.
Joins every child before restoring the caller mask, including exceptional exits.

Submits an in-range mask containing an absent CPU through the production native
adapter. Records the actual kernel error, checks future failure and subsequent
required-group recovery/accounting on the same worker. Keeps this callback error
separate from controlled pre-callback scheduler policy failures.
…cation

Records six native runtime failure combinations and actual Linux inherited mask
restriction/discovery/restoration and kernel request rejection at sources 108-109.
Normal/sandbox Release builds and complete 349/335 suites pass without skips;
twelve real-context and three real-font cases execute. The affected native source
also compiles with its X11 test macro absent and has no X11 helper references.

Reconciles these results with prior finite-demo, reported desktop, native reload/
retirement, timing/input/presentation and real-font acceptance. Closes 9.5d.2,
9.5f.1 and parent 9.5d/f/9.5 for their recorded scopes; retains historical audit
and execution claims at their original checkpoints. Only separately requested
9.7 PR metadata publication remains open, with its local draft updated.

Preserves user-confirmed applied checkpoint 98 as pending delivery base, keeping
99-107 intact and adding 108-110. Records unique pending bundle routing, fixed
original-base cumulative delivery, exact replay and evidence archive scope.
@cppcooper
cppcooper merged commit 555ddec into develop Oct 2, 2026
@cppcooper
cppcooper deleted the refactor-runtime-render-resource-architecture branch October 15, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant