startup: preserve typed pixel colour exports #1259
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1266"
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 Jess-Doit on 2026-11-24T06:16:46Z.
Change
Refs #1259. This covers colour exports from
gfx2hlsl.The flat-parameter half of #1259 is #1262. Both change
Stage.export()intools/startup/gfx2hlsl.py, so whichever merges second needs a small merge there. This branch merges cleanly with currentmain.R32_UINTandR32_SINTthroughuint4andint4. The other attachment in the fixture keeps its float-to-UNORM conversion. Packed integer exports and wider or narrower integer formats are outside this change.R32G32B32A32_FLOATtarget.Fixture
The source-built wrapped-stream draw reuses one shader and root with UINT and SINT RTVs over typeless storage. The reflected signatures match each RTV. MRT0 reads
80000001and MRT1 reads RGBAff0000ffin both variants. A stale SINT manifest at the UINT key is refused before desktop PSO creation and both targets retain their clear values.For the FLOAT draw, the exact words are
00000001 00000002 7fc00001 80000001. A nonzero control binds00800000and reads00800001 00800002 7f400001 80800001. With the run-time operand removed, optimized FXC reads00000000 00000000 7fc00001 00000000. FXC/Odand optimized DXC keep the original four words.Verification
Tested
136ed589on base48b31812. Windows 10 22H2 build19045.6456, MSVC x6419.44.35230.0, FXC and DXC from Windows SDK10.0.26100.0.32.0.15.609410.0.19041.5794Each configuration includes four MRT tests (FXC and DXC on both adapters) and 11 startup, stream, sampler-heap and unsigned-byte vertex-fetch regressions. The docs-link check also passed. Set
$pythonto a venv withrequirements-dev.txtinstalled.AI-assisted (Codex).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:30:47Z.
Review: COMMENTED
Dual-platform review at commit
136ed5898c33507567c0887edc8a42cfc941782e:Verification
git diff --check origin/main...HEAD: passedpython -B tests/docs_links_check.py: passed (16 Markdown files, 283 links)python -B tests/bidi_controls_check.py: passed (1056 files)--preset dev):cmake --build --preset dev --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim -- -j 6+ctest --preset dev -R '^startup_(mrt_(fxc|dxc)_warp|stream_(draw|request)_warp)$' --parallel 4 --no-tests=error --output-on-failure-> 4/4 passed (2.64s:startup_stream_request_warp,startup_stream_draw_warp,startup_mrt_dxc_warp,startup_mrt_fxc_warp)/O2(--preset release):cmake --build --preset release --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim -- -j 6+ctest --preset release -R '^startup_(mrt_(fxc|dxc)_warp|stream_(draw|request)_warp)$' --parallel 4 --no-tests=error --output-on-failure-> 4/4 passed (2.88s)Code Notes
publish_shader_requestinsrc/startup_stubs/d3d12_draw.inlstages requests via.tmpandMoveFileExW(..., 0), andtranslate_tointools/startup/gfx2hlsl.pyusesos.replaceon.txt, preventing partial reads by the offline scanner or runtime.load_translationstrictly validates thertv1line against the requested format tuple and rejects stale/mismatched variants before desktop PSO creation.mrtbitsingfx2hlsl.py+d3d12_draw.inlcleanly prevents FXC constant-folding of binary32 denormals/NaNs/negative zero while keepingUINT/SINTexports strictly scoped to verifiedR32_UINT/R32_SINTformats (and rejectingcomprinteger exports).Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T06:35:20Z.
Merged current
main(943a9ccd) asf93ae14f. There were two conflicts:CMakeLists.txt: both test registrations are kept.tests/startup_stream_draw.cpp: kept both sides. This PR'scheck_stream_draw(..., format, export_word)signature and per-format targets stay.main'sdraw_logical_tablesand itsX2W_TEST_LOGICAL_VIEWbranch stay too, after this PR's root-constant write. With no format given, the logical-view path still draws into the 8x4 target.Retest: Windows 10 22H2
19045.6456, GTX 1060 6 GB (10de:1c03, driver32.0.15.6094) and in-box WARP (10.0.19041.5794),X2W_D3D12_DEBUG=1, run with:Debug and Release gave the same result:
startup_mrt_{fxc,dxc}_{warp,hardware},startup_stream_{request_warp,draw_warp,draw_hardware},startup_sampler_heap_*,startup_r8_uint_*.startup_logical_view_warpreturned 77.startup_logical_view_hardwareexits with 34 afterphysical capacity 1013760, logical count 1245184. It fails the same way on unmodifiedmain943a9ccdon this GPU, with or without the debug layer, so this merge does not cause it. It looks specific to this host's descriptor-heap limit and needs a separate look.Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T06:39:50Z.
Merged
mainagain (3709e10a, after #1260 and #1263) as3e48d345. This time the conflicts were intests/startup_stream_draw.cppandtests/startup_stream_consumer.cpp.check_stream_drawnow takes both inputs:(…, const StartupBc7Input* bc7 = nullptr, std::uint32_t format = 0, std::uint32_t export_word = 0)instartup_stream_draw.h.main's plain-draw branch.Retest: same host and filter as before, plus
startup_xg_bc7_draw_andstartup_address_srv_, withX2W_D3D12_DEBUG=1. Debug and Release gave the same result:startup_mrt_{fxc,dxc}_{warp,hardware},startup_xg_bc7_draw_{warp,hardware},startup_address_srv_{warp,hardware},startup_stream_{request_warp,draw_warp,draw_hardware},startup_sampler_heap_*,startup_r8_uint_*.startup_logical_view_warpreturned 77.startup_logical_view_hardwareexits with 34. It fails the same way on unmodifiedmainon this GTX 1060, as in my previous comment.Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T07:10:19Z.
Merged
main(9bc96316, after #1273) as16326d8a. #1273 adds A8/R8 targets and the BC-view mode tocheck_stream_draw. The signature is now(…, bc7 = nullptr, DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM, std::uint32_t export_word = 0).parent-a8/child-a8/child-r8still selectmain's A8/R8 derive path. A number selects this PR's R32 format.main's 8x4, BC7 and BC-view sizes. The clear alpha and readback row size followmainfor A8/R8.Retest: same host and filter as before, plus
startup_address_bc_view_. Debug and Release gave the same result: 20 passed,startup_logical_view_warpskipped (77), andstartup_logical_view_hardwarefailed with exit 34. That test fails the same way on unmodifiedmainon this GTX 1060, as noted above.Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T07:30:15Z.
Merged
main(dc73c29e, after #1262) asda6ef404.tools/startup/gfx2hlsl.pyStage.export(): this PR'suint/int/bitsrender-target kinds are kept. #1262's flatuint4copy forparamexports is kept as well:wordsis set in each branch, andparamexports are always the float kind. Thestartup_flat_param_check.pycontrols pass on the merged translator.tests/startup_stream_draw.cpp:main's 384x32X2W_TEST_BC_CHAINsize is added. Its draw uses the full width, as onmain.Retest: same host as before, Debug,
X2W_D3D12_DEBUG=1. The filter is as before plusstartup_xg_bc_chain_andstartup_flat_param_. 25 passed,startup_logical_view_warpskipped (77), andstartup_logical_view_hardwarefailed with exit 34. As noted above, that test fails the same way on unmodifiedmainon this GPU.