Skip to content

Graphics G4 Windows-session agenda: fact warning by reference, preparedResource memo, thumbnail fold, raster front half - #1264

Draft
iamfatness wants to merge 5 commits into
mainfrom
codex/graphics-g4-agenda
Draft

iamfatness wants to merge 5 commits into
mainfrom
codex/graphics-g4-agenda

Conversation

@iamfatness

Copy link
Copy Markdown
Owner

Stacked on #1258 (codex/win-d3d11-graphics-reference). Draft. Do not merge.

This does the four Windows-session agenda items that the Metal graphics G3-G5 plan (Task 7, step 6) and its outcomes doc carried. There is one commit per item, plus a docs commit. These are refactors and render-thread allocation fixes. No rendered pixel changes: GraphicsRasterReference.WindowsMatchesItsOwnReference passes against the committed reference, which was not regenerated.

Item Source Change
D3D11 fact warning copy G2 review 2 (G2 outcomes: "the D3D11 adapter still copies") CompositorOverlayRaster gains sharedWarning() and setWarning(), as on Metal. D3D11CompositorAdapter's graphicsPreparations loop passes sharedReason instead of copying lastWarning(). The warning text is unchanged.
preparedResource() memo G2 D7 (CompositorOverlayRaster.cpp:504 "Windows still allocates per call") This ports the Metal weak, 32-entry memo. The same prepared texture keeps one resource identity while anyone holds it.
Thumbnail fold G3-G5 plan Task 5 GraphicsThumbnail.cpp has one thumbnailInput() and one thumbnailResult() shared by the D3D11 and Metal branches.
Raster front half Spec 5.1 / 3.2 rules 1-8 New portable compositor/OverlayRasterFrontHalf.h covers rules 1-4 and 7-8 plus the wording and interned warnings. Both rasters call it. Rules 5-6 (cache find and request) stay per backend because the types differ.

New tests:

  • D3D11OverlayRaster.WarningsTravelByReferenceWithoutAPerTickCopy
  • D3D11OverlayRaster.PreparedResourceIsStableWhileHeld
  • OverlayRasterFrontHalf.* (6 tests, portable)

Tests (Windows 11 26300, VS 2026, --config Release)

Filter Before (ab0e053) After
OverlayRasterContract.*:GraphicsRasterParity*:GraphicsCompositionPixel.*:GraphicsRasterReference.* 47 passed, 2 failed 47 passed, 2 failed
Graphics*:D3D11*:OverlayRaster*:OverlayTile*:ParityPng.* 248 passed, 3 failed 256 passed, 3 failed (+8 new)

The red tests are the three already known, which a separate PR is fixing:

  • OverlayRasterContract.FailedScaleKeepsTheAcceptedRaster
  • OverlayRasterContract.ImageDecodeFailureWording
  • GraphicsTemplateRegistry.ABrokenTemplateThumbnailDoesNotBlockTheOthers

Unverified

  • Mac edits are compile-unverified (no Apple toolchain here). They are the Metal branch of GraphicsThumbnail.cpp, and in CoreTextOverlayRaster.mm the front half in rasterOverlayTexture, the internedWarning forwarder and two comments. The native-metal-macos CI job compiles them. Metal contract and pixel tests were not run.
  • The intermediate commits were not built one at a time. Only the full stack was built and tested.

🤖 Generated with Claude Code

@iamfatness
iamfatness force-pushed the codex/graphics-g4-agenda branch from 3161d22 to 9fff045 Compare November 27, 2026 17:23
@iamfatness
iamfatness changed the base branch from codex/win-d3d11-graphics-reference to main November 27, 2026 17:56
… review 2)

The D3D11 adapter's graphicsPreparations loop copied
overlayRaster_.lastWarning() into a GraphicsFrameFact on every Program
frame, an allocation per graphic per frame on the render thread whenever
a warning is longer than the small-string buffer. Metal fixed this in G2
review 2 (GraphicsFrameFact::sharedReason); D3D11 was flagged for a
Windows session.

CompositorOverlayRaster now keeps lastWarning_ and a sharedWarning_ in
step through setWarning(): a prepared result's own warning travels by an
aliasing pointer into the cache result, fixed wording is interned once,
and only the rare failed-scale text is built. The adapter passes
sharedWarning() as the fact's sharedReason with an empty reason. Every
warning string is unchanged; readers already use reasonText().

Test: D3D11OverlayRaster.WarningsTravelByReferenceWithoutAPerTickCopy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…G2 D7)

The facts loop calls preparedResource() for every preparation on every
Program tick, and beginFrame() clears activeResource_, so the D3D11 raster
allocated a fresh GraphicsPreparedResource per call. Metal got a weak,
fixed-size memo in G2 (D7); Windows was flagged for a Windows session.

Port it: 32 weak entries keyed by the cache result's address. A live weak
entry proves the result is still alive, so the address cannot have been
reused. The same prepared texture now yields the same resource pointer
while anyone holds it, with no allocation. Resource fields are unchanged.

Test: D3D11OverlayRaster.PreparedResourceIsStableWhileHeld.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one helper

GraphicsThumbnail.cpp's Metal branch (G5) duplicated the D3D11 branch's
overlay setup because the D3D11 branch could not be compiled on the Mac.
Both branches now share thumbnailInput() (overlay, template fields, brand,
size) and thumbnailResult() (the JSON row). Only the raster call and the
backend label differ. The output is unchanged.

The Metal branch is compile-unverified here (no Apple toolchain on
Windows); CI's native-metal-macos job compiles it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c 5.1)

The front half of rasterOverlayTexture (admission rules 1-8, spec 3.2)
was duplicated in CompositorOverlayRaster.cpp and CoreTextOverlayRaster.mm
and held together only by the contract test. The Metal spec deferred the
extraction to a Windows session.

native/src/compositor/OverlayRasterFrontHalf.h (portable, header-only) now
owns:
- rule 1, the metadata bound;
- rule 2, dimensions;
- rule 3, the strict-salted signature;
- rule 4, prepared-resource compatibility;
- rule 7, the state table;
- rule 8, capacity detection;
- the operator wording and the interned warning.
Both rasters call it. Rules 5-6 (cache find/findOrRequest) stay per
backend, because the Cache, Request and texture types differ. Every
decision and string is unchanged, so OverlayRasterContract.* and
WindowsMatchesItsOwnReference still pass against the committed reference.

New portable test: OverlayRasterFrontHalf.* (boundaries without a GPU).

The CoreTextOverlayRaster.mm edits are compile-unverified on Windows (no
Apple toolchain). They swap inline expressions for the same helpers.
CI's native-metal-macos job compiles them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iamfatness
iamfatness force-pushed the codex/graphics-g4-agenda branch from 9fff045 to 96f86a5 Compare November 27, 2026 17:56
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.

2 participants