Repository navigation
Graphics parity: Windows D3D11 reference, crawl admission fix, prepare-hook seam (G4 Task 7) - #1258
Merged
Merged
Conversation
…Bytes The D3D11 raster still inlined the layered-only admission bound, so a crawl longer than about two raster widths was admitted at w*h*8 and the worker then failed it with 'Graphics preparation exceeded its admitted budget.' Switch to the shared graphics::overlayAdmissionBytes the Metal raster already uses (identical layered term, plus the crawl atlas term). Windows-session agenda item 1 from the G3-G5 outcomes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One-line seam, matching CoreTextOverlayRaster::prepareRaster, so OverlayRasterContract.ScaleRetentionDrawsTheAcceptedRaster can block the D3D11 preparation worker. No-op unless a test installs a hook. Windows-session agenda item 2 from the G3-G5 outcomes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D3D11GraphicsReferenceTest.cpp (written on the Mac) compiled unchanged in Release on Windows build 26300. Run of OverlayRasterContract.*:GraphicsRasterParity*:GraphicsCompositionPixel.*:ParityPng.* on D3D11: 46 passed, 2 failed, repeat-stable. - CrawlAtTheItemLimitPreparesOrFailsWithAtlasWording: PASS (agenda item 1). - ScaleRetentionDrawsTheAcceptedRaster: PASS with the prepare-hook seam. - FailedScaleKeepsTheAcceptedRaster, ImageDecodeFailureWording: RED, a recorded Windows/Mac difference. The corrupt-pixel PNG (valid header, zeroed IDAT payload) prepares 'ready' with an empty warning on D3D11; Metal fails it. Windows raster deliberately not changed. Only comments change: the stale 'needs a seam' / 'expected red' notes are replaced by what the run showed. No tolerance or assertion changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndard (G4) Generated on Windows (build 26300; d2d1.dll 6.2.26100.9818, dwrite.dll 6.2.26100.9974; font stamps in the environment block) from a Release corevideo-native-tests built at 9248e6b (the 'commit' field): - contracts/graphics-raster-reference.json: 23 fixtures, every one 'ready' with no warning, 3 verbatim samples each. - native/tests/golden/windows-graphics/<fixture>.png: 23 PNGs, re-read through WIC and byte-checked by the writer. - native/tests/golden/windows-graphics/catalog.json: 9 catalog rows with real D2D thumbnails (all ready, backend d3d11-native). GraphicsRasterReference.WindowsMatchesItsOwnReference passes in a fresh process without the writer env. Task 7 step 5 command note: the thumbnail test runs before the writer creates windows-graphics/, so on a clean tree the catalog export fails to open its file; it was re-run once the folder existed. No tolerance changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With no params set, D2D took gamma and grayscale enhanced contrast from the PC's ClearType tuning, so the weight of on-air text could differ from one customer PC to the next, and the Windows parity reference depended on the machine that wrote it. Pin explicit grayscale params equal to the values CreateRenderingParams() returns on the reference machine (gamma 2.2, enhanced contrast 0.5, grayscale enhanced contrast 1.0). The output is deterministic across runs. Against the old unpinned output, 3 of 23 reference PNGs move by 2-72 pixels and summed alpha changes by at most 0.01%. Owner ruling 2026-11-27: pin today's Windows look; the Mac matches it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Written by GraphicsRasterReference.WriteWindowsReference at 173389a. Three PNGs move by 2-72 pixels; catalog.json is unchanged. WindowsMatchesItsOwnReference passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…curve The G4 Mac-vs-Windows run failed text-wrap-ellipsis-3-lines at 8.1% summed alpha. Root cause: layout matched exactly (line breaks, line boxes, ellipsis), but D2D lifts grayscale edge coverage (mean edge alpha 177) and Core Text draws linear coverage (120). The Mac text was 7-10% light on the plain-text fixtures and +19% heavy at 14 px, where D9's font smoothing over-dilates. The Mac now draws text unsmoothed into an offscreen layer over the text clip, maps each pixel's coverage through a*(k+1)/(a*k+1) with k = 1.0 (the grayscale enhanced contrast now pinned on Windows), and composites at the primitive's opacity. Offline, against the existing Mac goldens, the plain-text fixtures move to 2-3.4% under Windows. The 14 px result needs a Mac run. - MacMatchesWindowsReference reports every fixture and fails once at the end (the vendored EXPECT_* throws on the first failure). No tolerance changed. - CI uploads the parity sheet (Windows / Mac / diff) from native-metal-macos. - Mac goldens are NOT regenerated here: they need COREVIDEO_WRITE_MAC_GOLDENS=1 on the owner's Mac (advisory in CI, blocking in release-macos.sh). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ctToDeviceSpace CI (run 45948538637) showed the text layer covering the text clip flipped vertically against the CTM: text was drawn in the right place but cut off. Single-line fixtures lost all their ink, and the 3-line fixture kept only rows 31-160. The rect now comes from CGRectApplyAffineTransform with the same CTM that the layer and the composite use. On the rows the bug left intact, the new curve's summed alpha is within 0.04% of Windows (old Mac: 6% light). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D2D's DrawTextLayout rounds each line's baseline to the nearest device pixel (no D2D1_DRAW_TEXT_OPTIONS_NO_SNAP). Core Text drew at the exact fractional baseline, so 28 px secondary labels (baseline .4 below a pixel) landed 2 px low against the Windows reference once the coverage curve lifted the partial row. Outlines and shadows stay unsnapped: on Windows they come from a custom renderer with pixel snapping disabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both rasters clip every primitive to its clip rect (aliased PushAxisAlignedClip / CGContextClipToRect), so no ink of a text primitive can fall outside it. The judge still grew the measured area 7 px past it: a 40 px table cell then counted the top of the next row's text and took the neighbouring row's fill as its background, which zeroed faint edge pixels. table-12x8 failed 17 cells at 8-9% light for that reason. No tolerance changes; the geometry tier's text exclusion is unchanged. Owner ruling 2026-11-27. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd font The parity judge's motion brand set brand.fontBody to Segoe UI, so on the Mac the layered-motion title drew Selawik and read 8.6% heavy from the font, not the rasterizer (Segoe UI through D2D matches the reference exactly, 112574; Selawik through D2D is +12.9%). Spec 7.3 has fixtures use fonts both platforms ship; Segoe UI to Selawik keeps its own fixture. Only the judge's local motionBrand() changes. Owner ruling 2026-11-27. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fixture Written by GraphicsRasterReference.WriteWindowsReference at d87e274. Only layered-motion-mid-entrance changed (PNG and metrics); the other 22 fixtures are byte-identical and WindowsMatchesItsOwnReference passes. Windows raster code is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D2D flattens every ellipse and rounded corner to line segments at 0.25 device px before rasterizing; the chords lie inside the true curve, so its antialiased curved edges hold ~0.07 less coverage than exact. Core Graphics fills true curves, so the Mac read heavier on every curved edge (shapes-inset-strokes ellipse worst 71/255). D2DCurveFlattening.h reproduces D2D's polygons exactly: the same four cubics and traversal order as ID2D1EllipseGeometry and ID2D1RoundedRectangleGeometry, flattened with WPF's CBezierFlattener hybrid forward differencing (dotnet/wpf, MIT). D2DCurveFlatteningTest checks every vertex against ID2D1Geometry::Simplify (1,000+ ellipses, rounded rects at four tolerances). The Mac raster now builds its rect, ellipse and stroke paths from it. Legacy band: Windows pushes the rounded band as a layer mask and fills the rounded band inside it, so corner coverage is applied twice; the Mac filled a rectangle inside its rounded clip (legacy accent worst 96/255). It now clips to and fills the same polygon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Windows raster draws images with D2D1_BITMAP_INTERPOLATION_MODE_LINEAR: centre-aligned bilinear on premultiplied pixels, clamped edges, and a fractional destination edge antialiased by area (probed: one white pixel upscaled 8x reads 16, 48, ... 239 per column). The Mac used kCGInterpolationMedium, whose filter Core Graphics does not specify; it read sharper than bilinear, so image-contain-cover-align content edges were up to 66/255 off. The Mac now resamples exactly that kernel from the decoded pixels and composites the result 1:1 in device pixels, under the primitive's clip and opacity. A non-axis-aligned CTM keeps the old draw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nces segoe-substitution (Selawik in place of Segoe UI, owner decision 5, still open) and text-emoji (colour emoji, plan default D6) are marked "recordedDifference" in the fixture index. They are still rendered, judged and printed on the parity sheet, but their failures no longer fail MacMatchesWindowsReference, which becomes blocking on main once the Windows reference lands. Tolerances are unchanged and every other fixture still blocks. IndexIsWellFormed keeps the list closed to these two. Owner ruling 2026-11-27. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iamfatness
marked this pull request as ready for review
November 27, 2026 17:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows half of Metal graphics G4 Task 7 (plan
docs/superpowers/plans/2026-11-22-mac-metal-graphics-g3-g5.md, Windows-session agenda items 1-3 in the outcomes doc). Offorigin/main0b5f04d. Do not merge without the owner.Commits
9df7fe3ffix:CompositorOverlayRasteradmits through the sharedgraphics::overlayAdmissionBytes, the same helper Metal uses. Long crawls (about 2+ raster widths) no longer fail withGraphics preparation exceeded its admitted budget.This is customer-visible on Windows today.0e9b2d4btest seam:prepareRastercallscompositor::invokeOverlayRasterPrepareHook(), which does nothing unless a test installs a hook.9248e6beD3D11GraphicsReferenceTest.cppbuilt for the first time. It compiled unchanged. Only its stale comments were updated to match what the run showed.22107a59The Windows reference (contracts/graphics-raster-reference.json) and the 23 PNGs pluscatalog.jsoninnative/tests/golden/windows-graphics/, with the environment block filled in:Evidence
All runs use Release (
--config Release,build:native-dev), with D3D11 on, stub off and dev adapters on. The tests exe is 15,073,280 bytes.OverlayRasterContract.*:GraphicsRasterParity*:GraphicsCompositionPixel.*:ParityPng.*CrawlAtTheItemLimitPreparesOrFailsWithAtlasWording(item 1 acceptance)ready after 36 calls)Graphics preparation exceeded its admitted budget.ScaleRetentionDrawsTheAcceptedRaster(needs item 2)WriteWindowsReferenceready, no warnings, 3 verbatim samples eachWindowsMatchesItsOwnReference, fresh process, writer env unsetThumbnailsAreExplicitWorkerProducts…)ready/d3d11-nativeGraphics*:D3D11*:OverlayRaster*:OverlayTile*:ParityPng.*No comparison tolerance changed. The Windows raster was not edited to make anything pass.
Recorded Windows/Mac difference (red, NOT fixed here)
A PNG with a valid header and a zeroed IDAT payload (CRC repaired) comes back
readywith an empty warning on D3D11. Metal fails it withGraphics image could not be decoded: <id>(outcomes bug 1, forced decode). The outcomes doc assumed Windows already failed this asset, but that was observed with the earlier fixture, which had the IDAT removed.Three cases are red from this one cause:
OverlayRasterContract.FailedScaleKeepsTheAcceptedRaster(stateready, expectedfailed)OverlayRasterContract.ImageDecodeFailureWording(same)GraphicsTemplateRegistry.ABrokenTemplateThumbnailDoesNotBlockTheOthers(thumbnailready, expectedunavailable)All three were already red on main: they fail the same way with commits 1-2 reverted. This branch did not cause them. Likely customer impact: a corrupt image could air blank while the UI says ready. The exact pixels drawn were not inspected.
The corrupt-PNG fix is its own PR, #1263 (owner OK 2026-11-27). The four agenda items are #1264, stacked on this PR.
Mac parity work (owner rulings 2026-11-27)
Task 8 ran on Mac CI. Each row below was root-caused before it was fixed. No tolerance changed, and no Windows drawing code changed except the text params, which were pinned.
173389a7,faa0bcd1,ab0e053b,d753d707)DrawTextLayoutrounds each baseline to the nearest device pixelf3f1e13c)5a363e2e)d87e2746,f2fa476b)D2DCurveFlattening.h, a port of WPF'sCBezierFlattener, proven point for point againstID2D1Geometry::Simplify(0ec54b2b)0ec54b2b)LINEARis centre-aligned bilinear; Core Graphics Medium is sharper1891f761)Mac CI 46032144533 passed 21 of 23 fixtures. The other two are recorded differences (
ef45a203): they are still rendered, judged and on the sheet, but they don't fail the test. IndexIsWellFormed keeps that list closed.segoe-substitution: Selawik in place of Segoe UI. Owner decision 5 is still open.text-emoji: colour emoji (plan default D6).For the owner
COREVIDEO_WRITE_MAC_GOLDENS=1): the Mac's text, curve and image output all changed. They are advisory on CI runners and block only the release ctest on your Mac.graphics-parity-mac-vs-windowssheet artifact.windows-graphics/, so on a clean tree the catalog export cannot open its file (GraphicsTemplateTest.cpp:372).Not verified
MetalCompositor.VcamTapAbsorbsTheProgramInFlightDepthWhileTheTapIsBusyfailed on two consecutive Mac runs (16:21 and 16:27 UTC) and passed on re-run. Graphics code is not in that test.🤖 Generated with Claude Code