native: admit fixed pixel entries with zero or more than seven interpolants #3527
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3527"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T23:04:20Z.
Refs #870 (claim: https://github.com/R0Y00/Xbox2Windows/issues/870#issuecomment-7262972255, parts (a) and (b) in one PR).
Why
With the interface catalog installed (#3521), a fixed slot-57
PSI1pixel entry reaches the layout check inprepare_direct_graphics(src/direct_compute_cache.cpp). Onmainthat check refuses an interpolant count of zero or above seven withcaptured interpolation count disagrees with pixel interface, and any captured/reviewed address pair other than0x0002/0x0002and0x8002/0x0302withunsupported fixed pixel entry layout. Those pairs get no native graphics pipeline.What
Count rule,
prepare_direct_graphics:min(D3D12_VS_OUTPUT_REGISTER_COUNT, reviewed pixel attribute count)instead of 7.Address rule, same function. The captured address must equal the reviewed address, except for the existing
0x8002/0x0302packed-XY pair, which now also requires a nonzero count. Admitted values:0x0002, any admitted count;0x0000, zero count only;0x0f00(float position bits), zero count only. The matchingSV_Positionfloat input is skipped in the post-link input check.Zero count:
raw and reflected interpolation inputs disagree.unsupported pixel entry VGPR ncheck insrc/gfx1013_direct_graphics.inl. The two refusals are separate fixtures with separate diagnostics.Exact pairs:
GuestShaderStage::pixel_interpolant_count(src/guest_shader_container.h), set from the captured count.gfx1013_direct_graphics.inlrefuses an attribute location at or above that count.TEXCOORDrows of a fixed exact pair skip the per-PARAM index check; the VS/PS link still applies.Raw pairs with more than seven interpolants:
translate_graphics_pairtakesextended_fixed_params;read_raw_graphicsthen accepts 32 PARAMs instead of 7 (src/gfx1013_compute_native.cpp).pack_fixed_graphics_varyingskeeps the provisional rows when they fit. Otherwise it packs one register per (PARAM, flat/smooth) with the same channel assignment on both stages, and refuses past the 32-register budget withinvalid signature register or component mask.Tests
New CTest
startup_native_graphics_fixed_entry_{warp,hardware}:tests/startup_native_graphics_draw_check.py --fixed-slot57. It draws through the catalog with native shaders only and compares every pixel: zero count at addresses0,2,0x100,0x300, then exact and raw pairs at counts 8 and 32.tests/native_graphics_interface_library_check.pyadds compile cases with refusal controls. Each refusal checks the diagnostic and that no output is published.zero-{0,2,100,300}zero-position-mismatch,zero-center-positionunsupported fixed pixel entry layoutzero-inexact,zero-paramzero-unallocated-vgprunsupported pixel entry VGPR 4zero-barycentricsraw and reflected interpolation inputs disagreeexact-{8,32},raw-{8,32}dxc -dumpbinexact-location-{8,32},raw-location-32(count one below a consumed location)count-above-interface-{8,32}exact-missing-producer-channelgraphics stages disagreeraw-full-budget(31 full exports)raw-overflowing-signatureinvalid signature register or component maskLocal Windows build of
a1b10c53,devpreset, 8/8 passed:startup_native_graphics_draw_{warp,hardware},startup_native_graphics_fixed_entry_{warp,hardware},native_direct_container,native_direct_mesh,native_graphics_interface_library,startup_gfx2hlsl_ps57in.Mutations, each applied alone, then restored and rebuilt to 8/8:
!n || n > 7native_graphics_interface_library,startup_native_graphics_fixed_entry_warpn > 7restoredcaptured_interp_count != 0guard dropped from the kind-28 skipnative_graphics_interface_library(zero-barycentricsaccepted)zero-unallocated-vgprnative_graphics_interface_library(unsupported pixel entry VGPR 4)An earlier Windows Sandbox run of the same eight tests on
9c6d359egave 7/8.native_graphics_interface_libraryfailed: thezero-barycentricsfixture exported an unallocated v4, so lowering refused it withunsupported pixel entry VGPR 4before the zero-count check.a1b10c53changes only that test: the original bytes becomezero-unallocated-vgprwith the lowering diagnostic, and a newzero-barycentricsfixture exports center I and an initialized v2 to reach the zero-count check. No source change after9c6d359e. The Sandbox run was not repeated ona1b10c53.Not covered
unsupported fixed pixel entry layout.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T06:23:55Z.
Review: COMMENTED
Reviewed
a1b10c53by reading the diff, then ran it merged onto main44a3ad5awith #3506, #3516, #3464, #3521 and #3097 (native shaders only, interface catalog installed, its tests not run). Reads correct for what it admits; one real-title case it still refuses, filed as #3560.05dc00b8b79c1d4b. Its capturedPSI1isSPI_PS_INPUT_ADDR = 0x8080(bit 15POS_FIXED_PT, and bit 7) withNUM_INTERP = 0.direct_compute_cache.cpp:730(captured interpolation count disagrees with pixel interface), so the pair is not exact. An exact pair would stop at:733-737: zero count is admitted only for0x0000or a subset of0x0f00.POS_FIXED_PTfor a non-exact pair would fit this PR's count and address rules; a fixture withADDR 0x8080, NUM_INTERP 0would pin it. Details and the run table are in #3560. A follow-up works too.RTX 3080 Ti, Windows 10 19045, Agility SDK 1.620. This review was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T21:03:37Z.
Data point for this PR's area, from a native-shader run tonight: main
d5970858plus #3635/#3645/#3646 (mesh frontend only),run_preset.py --set translate=false, RTX 3090, Windows 11, saved profile, about 8 minutes.The run cache has 376 graphics requests; 19 compile and 357 are refused. The top reason is
unsupported fixed pixel entry layout(214). For most of those, the PSI1 control word is not a plain interpolant count.d3d12_draw.inl:1346capturesSPI_PS_IN_CONTROLwith its flags intact, butdirect_compute_cache.cpp:772-790uses the whole dword asinterpolants:0x8080,0x8000NUM_INTERP0,PS_W32_EN(bit 15) set0x8080,00x2, 1..30x8002,0x8002NUM_INTERP2,PS_W32_ENset0x8c02,0x8402,0x80,0x8002with 3..8)So 184 of the 214 are wave32 pixel shaders:
0x8000 != 0defeatspacked_position_only, and the address check then refuses. MaskingNUM_INTERP(bits 5:0) is not enough alone. Bit 15 should also set the pixel entry ofstage_wave32, so the raw frontend lowers the pixel program's lane masks as wave32.#3527 rewrites these exact lines, so I'm not claiming it separately. Leyukaka, do you want to fold it into this PR, or should I open a follow-up on top of it once it merges? I can retest either way on this cache.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T18:36:20Z.
Review: APPROVED
Reviewed
0b62bd6fby reading the diff; not built or run.Verdict: approve. The new count and address rules fail closed, and the rebase keeps main's
0x8080zero-count path separate from them. No MUST.a1b10c53. The rebase ontoce7eb9d3resolved conflicts in these same lines, and of the eight tests onlynative_direct_mesh, which this PR does not change, is in the Windowsprpreset filter. CI at this head ran none of the seven that cover the change. One local run of the same eight at0b62bd6fwould cover the merged code.packed_position_only(direct_compute_cache.cpp:803) is skipped by both the new count/address block (:843) and the post-link check (:913). So #3560's case does not hit the new kind-28 rule at:917.:917.captured_interp_count != 0is an optional compared with 0. It still skips for requests without a fixed entry (nullopt) and stops only for a captured zero.SPI_PS_IN_CONTROLdword. Raising the bound from 7 tomin(32, attributes)admits only values that are pureNUM_INTERP; any flag bit (6 and up) stays above it and is refused.pack_fixed_graphics_varyings(gfx1013_compute_native.cpp:2435). Provisional rows reach 1 + 4·31 + 3 = 128, which fits both the 128-entry channel array and theuint8_trow. Splitting by flat/smooth per PARAM keeps DXIL packing legal, and the budget check refuses before row 32.pixel_interpolant_countguard (gfx1013_direct_graphics.inl:46) is set only for exact pairs (:872), so it does not touch the raw path.Tests:
native_graphics_interface_librarycovers each count, address and budget refusal with its diagnostic and no published output.startup_native_graphics_fixed_entry_{warp,hardware}draws the accepted cases through the catalog and compares every pixel.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T03:12:49Z.
Independently verified
0b62bd6fin a clean trial merge withmain162fab1f. MSVC 19.51, SDK 10.0.26100, Windows build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop GPU (616.56), D3D12 debug layer enabled. Release/O2, withX2W_WITH_OPUS=OFFfor this graphics-only build.cmake --build --preset release --target compile_dxil d3d12_xs_shim startup_stream_consumer -j 5passed.ctest --preset release --no-tests=error -j 1 -R '^(startup_native_graphics_(draw|fixed_entry)_(warp|hardware)|native_direct_(container|mesh)|native_graphics_interface_library|startup_gfx2hlsl_ps57in)$' --output-on-failure: 8 passed, 0 failed, 0 skipped. Both fixed-entry GPU fixtures ran and passed.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T03:17:43Z.
After #3521 landed, pushed
c53ffed4to preserve both the launcher catalog checks and the fixed-entry fixtures in the shared Python test. Rebuilt Release and reran the same eight tests on this head. Seven passed in the sandbox.native_graphics_interface_libraryhit Windows error 32 when deleting the synthetic watcher's log. The same test rerun outside the sandbox passed 1/1, on the same binaries and commit. PR CI is running onc53ffed4.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T04:09:31Z.
Review: APPROVED
Re-reviewed
c53ffed4by reading the diff; not built or run.Verdict: approve. The PR's own source change is identical to
0b62bd6f: thesrc/diff against main has the same patch ID. The two new commits are merges of main. No MUST, no open points.0b62bd6fwith main162fab1fcloses our SHOULD. That covers the merged code, including the seven tests outside theprpreset.c53ffed4resolvestests/native_graphics_interface_library_check.pyby keeping both sides:run_case, with the catalog error control);zero_fixed_cases,fixed_varying_caseand the varying-row jobs).Both import sets are kept. The only failure reported on this head is the sandbox's file-delete error 32, which passed when rerun outside the sandbox.
Tests: CI is green at this head. The fixed-entry fixtures still run only in R0Y00's local runs, because they are outside the
prpreset.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T07:34:34Z.
Rebased onto
main(f365f125b); the new head is0b4ec28e8and replaces the mergec53ffed4. Two conflicts: the import block oftests/native_graphics_interface_library_check.py(both sides kept, so the file is identical to the one inc53ffed4) and the signature oftranslate_graphics_pair(the newextended_fixed_paramsparameter plus the function-try-block frommain). No other change; the CTest selection from the description passes again on the new head.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T08:58:56Z.
Review: APPROVED
Reviewed
0b4ec28ebygit range-diffagainstc53ffed4; not built or run.Verdict: approve. This is a rebase onto
f365f125with no change to the PR's own behaviour. No MUST.mainnow wraps the two entry functions in function-try-blocks () try {). Commit 3 is identical.tests/native_graphics_interface_library_check.py, the import block keeps both sides, so the file matchesc53ffed4as the rebase comment says.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T22:25:49Z.
Review: APPROVED
Reviewed
d5ab5981, the GitHub Update branch merge ofmain67862ee4. Its tree is identical to the separately tested trial merge. The previous Windows job's only failure was the missing.m86marker instartup_indirect_mesh_cache_heap_wide_warp, the signature tracked in #3822 and addressed by #3883. After rebuildingstartup_indirect_draw_indexed,startup_stream_consumerandcompile_dxilfrom the new head, MSVC Debugctest --preset dev --no-tests=error -j 1 --output-on-failure --repeat until-fail:5 -R '^startup_indirect_mesh_cache_heap_wide_warp$'passed five times.ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^startup_native_graphics_(draw|fixed_entry)_(warp|hardware)$'passed 4/4 with zero skips on Windows 11 build 26300, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The nine-test trial-tree selection also passed. This was source-built fixture evidence.Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-12-02T22:28:24Z.
@Leyukaka heads up: I have work on pixel-entry VGPR inputs past the entry block that overlaps with this PR. It touches the same area, the fixed pixel entry layout checks in
prepare_direct_graphicsand theunsupported pixel entry VGPR nrefusal insrc/gfx1013_direct_graphics.inl. In short, it names each VGPR refusal route and accepts a dead unallocated read, accepts a few more fixed entry layouts, reads the interpolant count fromSPI_PS_IN_CONTROL, and allows scalar branches and exec masks on pixel entries with no I,J inputs. It's only on my fork so far (not a PR), and it's based on an older main.Would you rather I hold off, build on your PR after it lands, or send mine as a separate PR?
AI-Assisted