Performance recipe: dropped draws, dark faces and other visual defects in the Series S intro #17
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/paveledits--ScarlettMac#17
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@jgrizon on GitHub · 2026-11-27 14:01 UTC · original
Findings from the performance recipe (
runtime-preview/build.sh --perf) on the Series S intro, from release and diagnostics builds. Setup: Apple M5 Pro, 24 GB, macOS 27.3, CrossOver 26.3.0.39832, D3DMetal 3.0. Posting so others can pick them up.1. Draws dropped for want of a host pipeline
note_droprecords nothing when a pipeline exists but binding it fails. The last runs that still printed reasons namedbeing madeandindirect kind N: no host pipeline.pipeline/make.rs(around lines 195 and 272-290) gives each title frame a single 500 ms wait, shared by every thread. One slow driver compile can use it all up. That explains drops during loading, but not steady drops once the caches are warm.2. Faces and skin render nearly black
Diagnostics captures show people as dark silhouettes in front of lit buildings, and car occupants almost black. This looks like the dark geometry the checkpoint's wave64 work fixed on the M3 Pro (
VICTORY_WAVE64_REDUCE, checkpoint patches 0013-0015). The performance recipe does not have those patches. #14's tester also reported better faces withVICTORY_AMBIENT=1.0. We are trying a port of the checkpoint's wave64 patches onto the performance recipe.3. No depth bounds test under Wine
host.rs(around lines 352-364) turns depth bounds off under Wine. As a result, pipelines are built without it, andOMSetDepthBoundsis never called. Every draw that relies on it renders more pixels than the title intended. An idea: emulate it with a pixel-shader clip, the way mesh clipping is emulated.4.
SW_64KB_R_X(Swizzle 27) textures are never copied backa texture of a kind copied back is not: its layout (Swizzle(27)) cannot be tiled. Three kinds of texture are affected (1x1 f41,256x256 f41,10x12 f42), so the GPU keeps reading stale results. The fix would be the R_X XOR swizzle in victory-formats, plus enabling it in the copy-back path.5. Not a bug: the mesh shader output warning
mesh shader outputs exceed Metal's limitmeasures the mesh program alone (33,792 to 34,816 B). Linked with its pixel shader, the pair is 28,160 B, under the limit. The real refusal line never appears in about 475 run logs. So no draws are lost to it; only the warning is misleading.6. Still open: the green credits panel
The opening credits show a flat green panel where a video should play. The video planes read as near zero with the credits text on top. We have not found the cause.
A false lead worth knowing about
host pipeline refused error=Call failed. (0x80004005)in large numbers means Wine loaded vkd3d instead of D3DMetal. That happens with a rebuiltntdll.sothat is not the CrossOver one. vkd3d ignores the root-signature flags for directly indexed heaps (0xc00,0xc01), so every such pipeline fails. With D3DMetal loaded, no pipelines are refused.@jgrizon on GitHub · 2026-11-27 15:48 UTC · original
Update on item 1 (dropped draws) and item 2 (dark faces): they have the same cause.
What the dropped draws are. We made every dropped call record its reason, in release builds too. In steady world play, 100% of drops are
dispatch: the BVH builder held back, 72 to 169 per frame.XboxBvhBuilder.dllis the title's own compute builder for its ray-tracing structure (the BVH, a tree of bounding boxes), 53 compute pipelines. It is not DXR.pipeline/builder.rsopens it only when!halves && all_made. WithVICTORY_HALVES_LOCAL=1/VICTORY_HALVES_SHARED_LDS=1, which the play preset sets,halvesis always true, so the builder never runs:The guard is there because approximate halves in the builder hung GPUs.
Why faces are black. The probe resolve then traces against a structure that was never built. As
ambient.rssays, it "leaves next to nothing, and whatever the sun does not reach directly is black". The preset'sVICTORY_AMBIENT=estimatereplaces that output, but its floor is about 0.04, so 99 to 100% of sampled points stay under it. Raising the floor (VICTORY_AMBIENT_FLOOR=1) still left faces black.What fixes it today.
VICTORY_AMBIENT=1.0, the constant stand-in that #14's tester also liked. In the same intro scene, a character who was a black silhouette shows a lit face, cap, skin and clothing colours, with some small dotted artifacts on skin and beard. It costs nothing measurable: 431 world frames in the first 120 s in a diagnostics build, against 386 for the preset'sestimate. Release timing runs are queued.What did not help. Upstream's checkpoint wave64 patches (0005 to 0015), ported onto the perf recipe with
VICTORY_WAVE64_REDUCE=1, gave speckled hair and faces and green blobs on this M5 Pro with D3DMetal 3.0. They cost no speed (525 frames), but the picture was worse.The real fix still to do. Let the builder run when every one of its 53 programs translates exactly across the two halves, i.e. with no approximate half-local answers. We are working on a per-pipeline "exact" mark and a
VICTORY_BUILDER_EXACT=1gate. Anyone who knows the builder's cross-lane ops well is welcome to jump in.Also: the
mesh shader outputs exceed Metal's limitwarning (item 5) and the 10% of profile samples inmmdevapiare both phantoms. The audio threads are parked in one Unix call that the profiler's wait list does not know about, and turning audio off gave no gain.@jgrizon on GitHub · 2026-11-27 18:58 UTC · original
Follow-up: the dark faces are fixed in #20, and the cause of the green credits panel is narrowed down.
Dark faces and dropped draws: fixed in #20.
VICTORY_BUILDER_EXACT=1withVICTORY_WAVE64_REDUCE=1lets the title's BVH builder run:53 made, 0 refused. WithVICTORY_AMBIENT=0the title's own lighting is correct, and the most dropped draws in a frame fell from about 1,400 to 1 or 2. It costs about 15% of frames in release.Green credits panel: diagnosed, fix not yet verified. VIctory has no Bink or NV12 code.
bink2scarlett.dlldecodes in its own x86 code into title memory, and the title converts YUV to RGB itself, sampling ordinary textures. The panel isR=B=0withGbetween 15 and 43 everywhere. That is exactlyY=U=V=0through BT.709 (G≈84), dimmed by the panel's fade. So the video planes are sampled while still all zero.Two shortcuts in
texture.rsskip the upload from title memory:flags_title_written: a render target, depth or UAV texture is never uploaded, because the GPU is assumed to own it. A console decoder fills a texture it created as writable.is_host_written: once the host has copied into a texture, the texture keeps the host's contents forever.The write tracking itself is right; the upload is just never asked for. On our branch,
VICTORY_VIDEO_FIX=1makes the texture take title memory's contents whenever nothing on the host wrote it. It uploads only the subresources whose bytes changed. It is off by default, and I will report once a run confirms or rules it out.Depth bounds. D3DMetal has no depth bounds test. On our branch,
VICTORY_DEPTH_BOUNDS_CLIP=1imitates it in the pixel shader: adiscardagainst the bounds passed in two root constants. It compares the fragment's own depth, not the stored depth that D3D tests. In D3D12 and Metal a pixel shader cannot read the depth target bound to its own pass. Its effect on looks and speed is not measured yet.Swizzle(27)(SW_64KB_R_X) copy-back. Every XOR swizzle mode is unaddressable today, so those textures are never written back to title memory. This may be the stale water. A port of addrlib'sSW_64K_R_XRBPLUS equations is in progress. The open question is Series X's pipe and packer counts (GB_ADDR_CONFIG). If someone knows them, please post them here.@paveledits on GitHub · 2026-11-28 00:48 UTC · original
I tested the exact #20 renderer on a 48 GB M3 Max with D3DMetal 4.0 beta 3. All 53 BVH programs passed the gate. Two late café shots regained visible geometry and both the camera and movement worked in the prison room. Earlier dialogue still appeared over black, and the prison room was darker with exact lighting. The merged recipe exposes
SCARLETTMAC_LIGHTING=exactas an option and keeps estimated lighting as the default.A separate presentation probe reproduced black picture samples before the swap-chain copy. Some preceding FidelityFX outputs in the same native queue had color. The selected picture, copy source and back buffer were black at all four sample points for 11 consecutive Presents, then all three acquired color together. The link from the upscaler output to the intermediate draw that writes the selected picture remains open. The green credits panel, depth bounds and Swizzle(27) copy-back also remain open.