shader: lower pixel structured-to-raw buffer loads #3100
Open
SimSalabimse wants to merge 7 commits from
upstream-pr/3100 into main
pull from: upstream-pr/3100
merge into: R0Y00:main
R0Y00:main
R0Y00:codex/indirect-large-backed-views
R0Y00:codex/word3-preflight-check
R0Y00:codex/vertex-table-two-records
R0Y00:codex/live-index-alias
R0Y00:codex/copied-vertex-buffer-srv
R0Y00:codex/windows-stage-test-output
R0Y00:codex/preserve-live-srv-retirement
R0Y00:codex/share-render-target-tracking
R0Y00:codex/sgd5-negative-offset-fixture
R0Y00:coverage-dashboard
R0Y00:codex/mesh-loose-root
R0Y00:codex/mesh86-cache-padding
R0Y00:codex/xmem-scatter-preflight
R0Y00:codex/mesh-depth-ps
R0Y00:codex/indirect-dispatch-refresh
R0Y00:codex/compute-container-index
R0Y00:codex/startup-compute-formatted-load
R0Y00:codex/compute-indirect-producer
R0Y00:codex/compute-atomic-soffset
R0Y00:codex/mesh-dual-handoff
R0Y00:codex/startup-run-sh-watcher-control
R0Y00:codex/queue31-page-alias
R0Y00:codex/indexed-indirect-compute-root
R0Y00:codex/typed-buffer-view-metadata
R0Y00:codex/translated-indexed-address-alias
R0Y00:codex/fixed-mesh-create-result
R0Y00:codex/xmem-section-lease
R0Y00:codex/startup-slot86-mesh-cache
R0Y00:codex/restore-mesh-barrier-iteration
R0Y00:codex/translated-indirect-upload-index
R0Y00:codex/xapu-completion-opt-in
R0Y00:codex/translated-indexed-rect
R0Y00:codex/translated-indexed-indirect
R0Y00:codex/startup-mesh-lds-integration
R0Y00:codex/startup-console-ms24
R0Y00:codex/startup-slot57-mesh-request
R0Y00:codex/indirect-copy-provenance
R0Y00:codex/present-color-producer-trace
R0Y00:codex/compute-dispatch-binding-trace
R0Y00:codex/translated-indirect-table-buffers
R0Y00:codex/indirect-copy-provenance-base
R0Y00:codex/mix-half-literal-source
R0Y00:codex/translated-indirect-draw
R0Y00:codex/xmem-scatter-diagnostics
R0Y00:codex/slot148-recording-upload
R0Y00:codex/slot70-loading-art-verified
R0Y00:codex/command-list-upload-arena
R0Y00:codex/recover-failed-command-list
R0Y00:codex/startup-heap-timing-notes
R0Y00:codex/align-audio-input-timeline
R0Y00:codex/synthetic-depth-export-control
R0Y00:codex/startup-texture1d-on-windows
R0Y00:codex/1629-packed-position-fixture
R0Y00:codex/cpu-srv-refresh
R0Y00:codex/stream-root-srv-draw
R0Y00:codex/audio-mixer-timer
R0Y00:codex/startup-reload-published-shader
R0Y00:codex/priority-integrate-1284
R0Y00:codex/guest-sixteen-page-record
R0Y00:codex/aot-placed-dxr-batch
R0Y00:codex/guest-directory-selection
R0Y00:codex/gamesave-enumerate-read
R0Y00:codex/readme-archive-to-pixels
R0Y00:codex/pe-placed-view-draw
R0Y00:codex/archive-directory-gpu
R0Y00:codex/slot133-dxr-build
R0Y00:codex/materialize-placed-vertex-view
R0Y00:codex/dstorage-directory-offsets
R0Y00:codex/xg-nine-bc-copy
R0Y00:codex/xg-slot10-bc64-arrays
R0Y00:codex/dxr-guest-address-readback
R0Y00:codex/gpu-va-high-bits
R0Y00:codex/clarify-diagnostic-startup-scope
R0Y00:codex/xg-six-levels
R0Y00:codex/typed-derived-blend
R0Y00:codex/english-legal-text-progress
R0Y00:codex/address-bc-4ks
R0Y00:codex/dstorage-bounded-file-read
R0Y00:codex/wide-srv-offsets-menu
R0Y00:codex/startup-memory-srv
R0Y00:codex/bound-view-tail
R0Y00:codex/language-selector-readback
R0Y00:codex/setup-menu-progress
R0Y00:codex/cpu-plane-refresh
R0Y00:codex/startup-ubyte-vertex
R0Y00:codex/presenter-window-selection
R0Y00:codex/startup-uniform-buffer-lane
R0Y00:codex/intro-loop-timing
R0Y00:codex/static-clzero-loops
R0Y00:codex/document-rtx-intro
R0Y00:codex/startup-insertq
R0Y00:codex/nv12-startup-texture
R0Y00:codex/stream-stage-draw
R0Y00:codex/startup-null-uav-format
R0Y00:codex/startup-draw-capture
R0Y00:codex/shorten-windows-checks
R0Y00:codex/dstorage-rfc1950
R0Y00:codex/startup-dump-fence
R0Y00:codex/pr1135-review-base
R0Y00:codex/startup-stream-requests
R0Y00:codex/startup-chroma-view
R0Y00:codex/readme-graphics-pipeline-streams
R0Y00:codex/static-crt-free-tls
R0Y00:codex/arc-140t-rtx-5080-laptop-gpu-reports
R0Y00:codex/main-startup-progress-entry
R0Y00:codex/signed-dxil-catalogue
R0Y00:codex/reloc-free-preferred-base
R0Y00:codex/quad-dpp-bit-mask
R0Y00:codex/raw-srv-bounds
R0Y00:codex/rx9070-31044-hardware-report
R0Y00:codex/gpu-page-source-provenance
R0Y00:codex/runtime-placeholder-interior
R0Y00:codex/gpu-copy-queue-tile-order
R0Y00:codex/pe-pin-external-providers
R0Y00:codex/xmem-placeholder-reservations
R0Y00:codex/xmem-shared-physical-pages
R0Y00:codex/pe-package-startup
R0Y00:codex/xmem-tools-memory-query
R0Y00:codex/cpu-stack-output-import
R0Y00:codex/pe-load-security-cookie
R0Y00:codex/record-three-bvh-retests
R0Y00:codex/cpu-rbp-frame-anchor
R0Y00:codex/xmem-default-startup
R0Y00:codex/record-rtx-3050-ti-9597
R0Y00:codex/docs-readme-start-here
R0Y00:codex/check-compute-mad24-truncation
R0Y00:codex/docs-discord-community
R0Y00:codex/bound-rcx-branch-mutants
R0Y00:codex/rtx5060ti-bvh-62114
R0Y00:codex/837-neutral-readme-disclaimer
R0Y00:codex/record-rtx-3070-ti
R0Y00:codex/title-neutral-public-wording
R0Y00:codex/exe-shadow-frame-submissions
R0Y00:codex/exe-shadow-runtime-chain
R0Y00:codex/readme-polish
R0Y00:codex/gpu-coverage-nov23
R0Y00:codex/spirv-minlod
R0Y00:codex/shadow-shim-device
R0Y00:codex/exe-two-shadow-frames
R0Y00:codex/shim-dispatch-cleanup
R0Y00:codex/fix-spirv-cache-probe
R0Y00:codex/sampler-use
R0Y00:codex/ballot-bit-extract
R0Y00:codex/packed-fma-release
R0Y00:codex/cpu-packed-fma-o2
R0Y00:codex/publish-coverage-dashboard
R0Y00:codex/mesh-cbv-binding-order
R0Y00:codex/spirv-window-fixture
R0Y00:codex/ps-e32-float-uint
R0Y00:codex/ps-cbuffer-reads
R0Y00:codex/fixed-profile-rescan
R0Y00:codex/shim-compute-integration
R0Y00:codex/readme-visible-coverage
R0Y00:codex/readme-research-navigation
R0Y00:codex/integrate-pr-256
R0Y00:codex/indexed-mesh
R0Y00:codex/sampled-coverage
R0Y00:codex/first-ms
R0Y00:codex/dual-ps
R0Y00:codex/ps-attribute
R0Y00:codex/compute-first
R0Y00:codex/ps-export
R0Y00:codex/readme-research-status
R0Y00:codex/ps-layout
R0Y00:codex/blast-window
R0Y00:codex/chart-caption
R0Y00:codex/reviewer-roles
R0Y00:codex/blast-aot
R0Y00:codex/archive-program
R0Y00:codex/crc-stream-program
R0Y00:codex/exe-image-data-chain
R0Y00:codex/local-cpu-fixture-coverage
R0Y00:codex/exe-bound-frame-chain
R0Y00:codex/exe-mapped-comparison
R0Y00:codex/contribution-dependencies
R0Y00:codex/exe-entry-aot
R0Y00:codex/bink-frame-heap-integration
R0Y00:docs/hardware-seven-reports
R0Y00:codex/bink-custom-heap
R0Y00:codex/bink-heap-callers
R0Y00:codex/discussions-entry-points
R0Y00:codex/gpu-community-batch-64
R0Y00:codex/ffx-scratch-writers
R0Y00:codex/generic-project-documentation
R0Y00:codex/ffx-dispatch-rcas
R0Y00:codex/four-windows-gpu-reports
R0Y00:codex/title-neutral-project-wording
R0Y00:codex/community-coverage-provenance
R0Y00:codex/rcas-packed-texels
R0Y00:codex/community-gpu-retests
R0Y00:codex/community-build-and-gpu-reports
R0Y00:codex/ffx-provider-loop
R0Y00:codex/ffx-recurrent-views
R0Y00:codex/ffx-recurrent-resource
R0Y00:codex/amd-wave64-reports
R0Y00:codex/ffx-backend-slots
R0Y00:codex/upscaler-device-init
R0Y00:codex/ffx-context-lifecycle
R0Y00:codex/ffx-version-query
R0Y00:codex/ffx-provider-contract
R0Y00:codex/typed-object-callback
R0Y00:codex/cpu-ordinal-import
R0Y00:codex/chained-cpu-ranges
R0Y00:codex/cpu-import-call
R0Y00:codex/cpu-direct-call
R0Y00:codex/cpu-leaf-aot
R0Y00:codex/community-project-status
R0Y00:codex/script-state-path-replay
R0Y00:codex/script-state-evidence
R0Y00:codex/bc7-resident-tail
R0Y00:codex/bcpack-mip-tail
R0Y00:codex/bc7-texture-draw
R0Y00:codex/asset-ranges
R0Y00:codex/pixel-constants
R0Y00:codex/pixel-aot
R0Y00:codex/pre-exe-workloads
R0Y00:codex/root-signature-device-coverage
R0Y00:engineering/packed-bvh-leaves
R0Y00:engineering/bvh-build-and-update
R0Y00:engineering/intake-root-roundtrip
R0Y00:community/gpu-check-release
R0Y00:community/english-contributor-entry
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
R0Y00/Xbox2Windows!3100
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3100"
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 SimSalabimse on 2026-11-27T15:10:24Z.
Change
Since #2910, a non-indexed MUBUF load in a pixel stage through the standard structured-to-raw descriptor conversion is refused as
buffer load through a modified descriptor.load_descriptor()already accepts that shape, butraw_descriptor_alu()only ran for compute and vertex stages.This change:
raw_descriptor_alu()in a pixel stage as well, so the four conversion words are tracked the same way as for compute and vertex stages.NUM_RECORDS * stride(NUM_RECORDS * max(stride, 1)when the stride extract was clamped). A wrapped address reads as zero.byte_count+min1tag when that extract was clamped. Stores already accepted either product; they now match both tags explicitly.idxenloads refused under their current messages.A stride-only clear still lowers as an unbounded raw load, as in compute and vertex stages. Compute and vertex load emission is unchanged.
The graphics stand-in fills
strideand does not yet publishnumrecords, so a completed title pipeline still needs that constant before a draw applies the bound. The offscreen fixture supplies both.Verification
Commit under test:
185b7decd0e0cb0bf359990c6a5dc6ead9e03dc7, rebased onto upstream main77d1ba4d63ba31abaf4ca3635d4159189a423201.A source-built pixel fixture converts a table descriptor and reads it with
buffer_load_dword ... offenat four offsets, including one word pastNUM_RECORDS * stride. Negative controls, each refused by name: byte count missing, OOB step missing, in-place word rewrite, and anidxenload. A clamped extract usesmax(stride, 1) * NUM_RECORDS. A draw readback is compared with a CPU model of the same product. Dropping the bound must read the word past the limit.The Mesh57 upload-range path constructs its indirect buffer view with
indirect_buffer_view(range.resource, range.offset, range.bytes, 0u, 0u, true, 0), so the upload flag cannot shift intorecords. The pixel fixture asserts that construction.Windows test PC (MSVC,
--preset dev,-j 1), at185b7dec:6/6 passed, ctest exit 0:
native_fixed_mesh57_buffers_warp,native_fixed_mesh57_buffers_hardware,startup_gfx2hlsl_ps_raw_descriptor_udsrc,startup_gfx2hlsl_ps_raw_descriptor,startup_gfx2hlsl_ps_raw_descriptor_warp,startup_gfx2hlsl_ps_raw_descriptor_hardware. Build exit 0.Earlier on
c0d43994, the same worktree ranstartup_gfx2hlsl_ps_raw_descriptorandstartup_compute_dispatch_input_(6/6, exit 0). On an earlier head the fullstartup_gfx2hlsl_list was 379/379, exit 0.The fixtures are hand-assembled gfx1013 words. No game files or captured programs.
Checklist
Fixes #3064
AI-assisted (Cursor)
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T16:15:00Z.
Review: CHANGES_REQUESTED
Independent Debug and Release
/O2each passed 3/3 (ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_ps_raw_descriptor', builtoffscreen_check), on551708c4integrated over300b93f0(tree23601ed0692b940e59b6f2515077a0734a34099a). The ordinary address case and the existing bound-drop mutant behaved as expected.Two added source-built probes expose gaps:
ud 5andudsrc 4 numrecords 0.load_translationinsrc/startup_stubs/d3d12_draw.inlskips the unrecognized source and sizes the root constants from the four accepted entries. I reproduced that exact omission with the offscreen fixture by callingdraw_once(..., constants[:-1], expected_words()). The draw succeeded through PSO creation with no debug warnings or errors. WARP returned four zeros, and RTX returned3f800000,40800000,41000000,deadbeefinstead of3f800000,40800000,41000000,00000000. Please bind the count or keep the unsupported ordinary draw on an explicit refusal path. A synthetic regression should exercise one of those two outcomes through the manifest loader.a + payloadafterahas already been truncated. In the same fixture, replace the instructionv_mov(0, 0)withstruct.pack('<I', 0x7e0002c4)to makev0=0xfffffffc. At immediate offsets 12, 28 and 32, the generated HLSL wraps the byte address to 8, 24 and 28 before testing it. Both WARP and RTX then read40400000,40e00000,41000000from the wrong portion of the view. Please check overflow when forming the initial byte address and add a guard for this case. The RDNA 2 ISA, §8.1 and Table 35 describes the immediate-plus-VGPR offset and raw bounds check.Windows
26200.9974, SDK/DXC10.0.26100.0, WARP10.0.26100.9818, RTX 4060 Laptop driver32.0.16.1656, D3D12 debug layer enabled.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T21:52:53Z.
Review: COMMENTED
Reviewed head
551708c42(Linux, Python only: no Windows run on my side).What works:
python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.pypasses at the head: the four controls are refused by name and the CPU model gives3f800000,40800000,41000000,00000000.raw_descriptor_alu()in the pixel stage is the right fix. The conversion words are tagged the same way as in compute and vertex stages, andraw_conversion_shapes()keeps the clamped and unclamped products apart.buffer_load_dword*matches the raw out-of-range rule for OOB_SELECT 3. The "RDNA 2" ISA guide, 8.1.8 Table 37 and 8.1.5, describes the converted NUM_RECORDS as a byte count.One more gap, besides the two already reported (the
numrecordsentry the runtime drops, and the wrap after truncation):tbuffer_load_format_*now gets through unbounded.tbuffer()reachesload_descriptor()throughbuffer_address(), so a pixeltbufferread through the converted descriptor now passes the check and setsraw_load_bound. But onlyop_buffer_load_dwordreads that bound. Source-built case: in your fixtureprogram(conversion()), replace the fourbuffer_load_dwordreads with onetbuffer_load_format_x v1, v0, s[16:19], 0 format:[BUF_FMT_32_FLOAT] offen offset:32. That is the word right pastNUM_RECORDS * stride = 32.db28a796, it is refused:buffer load through a modified descriptor.551708c42, it translates asa = v0 + 32; v1 = r0.Load(a);. There is no bound and nostride/numrecordsentry, so it reads0xdeadbeefwhere the hardware returns 0.Two ways to fix it. Apply the same bound in
tbuffer()(andload_format()), with one byte count per element. Or keepraw_conversion_ok=Falsefor the MTBUF path, so it stays refused as before. A control for this case in the existing check would lock it in.Commands run:
(
probe_tbuffer.pyimports your check module and builds the program above:smem_load_x4(DESC, 8) + conversion() + v_mov(0, 0) + <MTBUF word> + s_waitcnt + exp_mrt0(1, 1, 1, 1). The MTBUF word is op 0, FORMAT 22, offen, offset 32, srsrc s[16:19], soffset inline 0.)AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-27T21:55:11Z.
Review: COMMENTED
Review of
551708c4. Comment only.The translator part is good. It turns the pixel structured-to-raw descriptor conversion into a raw load with a bound. Everything else that touches those words still refuses. I tried 17 bad variants locally (wrong masks, wrong constants, words from a second descriptor, steps out of order) and all of them refused.
Blocking: the draw never fills
numrecords. The new stage asks forudsrc N numrecords <srv>. Theudsrcparser ind3d12_draw.inlonly knowsrect,basevertex,startinstance,rootconst,stride,d16unorm16,descword3andmrtbits. So the entry is never added, and because of thei == tr.uds.size()check, everyudsrcafter it is dropped too. In a real draw that means either the root signature doesn't match the shader, or the limit reads 0 and every converted load returns zero, with no warning. Fix: fillnumrecordsfromwords[2]of the table SRV, the waystrideis filled, or refuse unknownudsrckinds. The--startup-raw-buffertest fills its constants by hand, so it can't catch this.Should fix:
soffset, and the out-of-place (s_movcopy) form;Nits: unaligned addresses lose their low two bits without a refusal. The DW1 swizzle bits, ADD_TID and the DW3 format are kept but never checked; one line in the docs would cover it.
Ran on this head:
tests/startup_gfx2hlsl_ps_raw_descriptor_check.pypasses, with all 4 controls refusing.tools/run_checks_parallel.pyovertests/checks/python-linuxpasses 235/235. CI is green.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T22:45:55Z.
Review of
551708c4. Comment only. Edited: I have since built and run it; see the measurement below.Beyond what is already reported here (the dropped
numrecordsentry, the wrap after truncation, MTBUF without the bound, and the extra test cases), I found one small thing:--startup-raw-bufferaccepts 1 to 64 entry constants (tests/offscreen_check.cppandtests/startup_flat_param.cpp). The root signature puts them in one 32-bit-constants parameter and adds a one-range descriptor table, which costs one more DWORD. With 64 constants that is 65 DWORDs, over the D3D12 limit of 64. Measured on551708c4merged overmain14d56502: with the fixture padded to 63 constants the draw passes on WARP and on an RTX 5080; with 64,CreateRootSignaturefails with0x80070057("Create raw buffer root signature failed") on both. Capping it at 63 would fix it. The 1..64 bound is unchanged at327d134c. The fixture in this PR uses fewer, so it is not affected.I also checked two things that are not problems in this PR:
s_buffer_load_dwordthrough the converted quartet is not refused. Butop_s_buffer_load_dwordtakes the descriptor key without checking for modifications in any stage onmain, so this PR does not introduce it.main, and the PR tests it on purpose.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:55:07Z.
Review: CHANGES_REQUESTED
I tried to review
327d134cmerged overmain4b0350ea. The merge is clean (tree90ef8851) andgit diff --cached --checkis clean, but the stand-in does not compile. This matches theBuild and test on Windowsfailure on this head.Finding:
IndirectBufferViewinitialisers don't match the new field order.stride, records, upload, withUINT records = 0;added beforebool upload = false;.indirect_table_bufferpass the values in the other order, as{..., stride, true, records},{..., stride, false, records}and{native, offset, bytes, stride, upload, records}.Even with narrowing allowed,
recordswould land inuploadand the upload flag inrecords.Suggested direction: declare
recordsafterupload, so the existing initialisers line up. Or swap the last two values in the three initialisers. The draw path that readsrecordsshould then be covered by thenumrecordsmanifest case you added.Earlier findings. I read
327d134cagainst the requests on551708c4. Because the stand-in doesn't build, I couldn't run the Windows fixture, so none of these is confirmed yet:numrecordsdropped by the loader (R0Y00 1, rasptum):accept_udsrc_linenow acceptsnumrecords, and an unknownudsrcmakesload_translationrefuse the manifest instead of skipping it.tbufferpassesraw_conversion_ok=False, so a typed load through the converted descriptor stays refused.I'll run the fixture and the
0xfffffffcand MTBUF probes once the stand-in builds.Verdict: request changes on
327d134c, because the head does not compile.Environment: Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0.
CI:
Build and test on Windowsfails on327d134cwith the same C2397 errors.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:56:52Z.
Follow-up to the changes-requested review on
327d134c(same trial tree90ef8851overmain4b0350ea), with two additions.A second blocker:
startup_gfx2hlsl_ps_raw_descriptorneedsg++on Windows.check_udsrc()builds its driver withg++unconditionally. The test is registered for Windows CTest as well as in thepython-linuxlist, so on a Windows host withoutg++it fails before any check runs. The_warpand_hardwarevariants callcontrols()first, so they fail the same way:CI never reaches this step because the build fails first. Possible directions (unconfirmed): skip the driver when
g++is missing; build it as a small CMake test target; or useclon Windows.The translator fixes run clean. With only the
g++step stubbed out, every case incontrols()passes:v0 = 0xfffffffcwrap at offsets 12, 28 and 32 reads 0;tbufferload is refused withbuffer load through a modified descriptor;soffsetand thes_mov-copied descriptor all pass;Still open (non-blocking): Leyukaka's limit.
tests/offscreen_check.cppandtests/startup_flat_param.cppstill accept 64 entry constants. With the descriptor table that is 65 DWORDs, over the 64-DWORD root-signature limit.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:57:08Z.
One more blocking item on
327d134c, which I left out of the review above.check_udsrc()intests/startup_gfx2hlsl_ps_raw_descriptor_check.pyalways builds its driver withg++(line 409).controls()calls it, and so do the no-argument anddrawmodes. All three tests are registered in the Windows CTest block:startup_gfx2hlsl_ps_raw_descriptor,_warpand_hardware. On a Windows host with nog++onPATH, like this one, all three fail before any check runs:Possible directions, none of them tried:
clon Windows;This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T23:23:44Z.
Review: APPROVED
Retested
587a3decintegrated overmain2e12dd8e(tree8448e705). The merge is clean andgit diff --cached --checkis clean.My changes-requested review on
327d134c.IndirectBufferViewfield order: addressed. All six construction sites now go throughindirect_buffer_view(resource, offset, bytes, stride, records, upload), which assigns by member name. That covers the three inindirect_table_bufferand the alias return that only passed four values. It also covers the two incompute_root_srv_buffer, where{..., 0, true}had been compiling silently withtrueinrecordsanduploadleft false.d3d12_xs_shimbuilds indevandrelease.g++on Windows: addressed. The udsrc cases are nowtests/startup_udsrc_line_check.cpp, built as the CMake targetstartup_udsrc_line_checkand registered asstartup_gfx2hlsl_ps_raw_descriptor_udsrc. The Python check gets the built binary throughX2W_UDSRC_CHECK. A direct run compiles the same source withclon Windows andg++elsewhere.numrecordsloader fix are covered by the mutants below.What I traced. In a pixel stage the full conversion now matches either
byte_countorbyte_count+min1. The load is bounded per dword bya + 4(i+1) <= lim, wherelimis the 32-bit product of the view'sstride(ormax(stride, 1)) andnumrecordsentry constants. Each address term is added with an unsigned carry check.tbufferpassesraw_conversion_ok=False. On the stand-in side,recordsis filled from descriptor word 2 in both branches and copied intorecord_counts[i], and thenumrecordsudsrc reads it. An unknown udsrc kind or an index gap now makesload_translationrefuse the manifest; it used to skip the line.What I ran. I built
d3d12_xs_shim offscreen_check startup_udsrc_line_checkindevandrelease, then ranAll 9 pass in Debug and in Release
/O2, with no skips. Bothstartup_gfx2hlsl_ps_raw_descriptor_hardwareruns read back3f800000,40800000,41000000,00000000for DXC and for FXC.startup_flat_param_hardwarereportsdebug_errors=0 debug_warnings=0for every case. I also ran the 155startup_gfx2hlsl_*tests that have no_warp/_hardwaresuffix, plusstartup_flat_param_controls, indev: 156/156 pass.Negative control and mutants. Each mutant was run against the tests above. The C++ ones were rebuilt in
dev.tools/startup/gfx2hlsl.pyback tomain_ps_raw_descriptor,_warpand_hardwarefail;_udsrcstill passesudsrc stridemanifest expectation)tbufferaccepts the conversiontyped buffer load: translated)<= lim→< limnumrecordsconstant readsstrides[]check_udsrc)udsrc driver exit 4)indirect_buffer_viewcallcompute_root_srv_bufferpassesrecords 1, upload falseRestored and rebuilt afterwards; the restored build passes again and
git diff --quietis clean.Non-blocking.
recordspath has no runtime test. The draw fixture binds throughoffscreen_check, not the stand-in. On the stand-in side onlycheck_udsrc()'s source assertions cover it, so a wrong argument order at anindirect_buffer_viewcall site still passes. The same holds for thecompute_root_srv_bufferfix, which is a real behaviour change:uploadused to be false on that path. A CPU-side check ofindirect_table_bufferorcompute_root_srv_buffer, or an indirect-draw case throughd3d12_xs_shim, would pin it.run_startup_raw_bufferandcheck_startup_raw_bufferaccept up to 64 entry constants. With the descriptor table that is 65 DWORDs, over the 64-DWORD root-signature limit. The fixture itself uses far fewer.551708c4. It also says the stand-in "does not yet publishnumrecords", but this head does.Verdict: approve on
587a3dec. This supersedes my changes-requested review on327d134c. R0Y00's changes request on551708c4still needs its own sign-off, so I'm not merging.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC and FXC (the ones CTest picked up); Python 3.12.10; D3D12 debug layer on in
startup_flat_param_hardware.CI:
Build and test on Windowspasses on587a3dec;Run platform-independent Python checks on Linuxpasses too, so theg++path builds there.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T23:28:50Z.
Review: CHANGES_REQUESTED
Retested
587a3decintegrated overmain2e12dd8e(tree8448e705). The merge is clean andgit diff --cached --checkis clean.My changes-requested review on
327d134c.IndirectBufferViewfield order: addressed. All six construction sites now go throughindirect_buffer_view(resource, offset, bytes, stride, records, upload), which assigns by member name. That covers the three inindirect_table_bufferand the alias return that only passed four values. It also covers the two incompute_root_srv_buffer, where{..., 0, true}had been compiling silently withtrueinrecordsanduploadleft false.d3d12_xs_shimbuilds indevandrelease.g++on Windows: addressed. The udsrc cases are nowtests/startup_udsrc_line_check.cpp, built as the CMake targetstartup_udsrc_line_checkand registered asstartup_gfx2hlsl_ps_raw_descriptor_udsrc. The Python check gets the built binary throughX2W_UDSRC_CHECK. A direct run compiles the same source withclon Windows andg++elsewhere.numrecordsloader fix are covered by the mutants below.What I traced. In a pixel stage the full conversion now matches either
byte_countorbyte_count+min1. The load is bounded per dword bya + 4(i+1) <= lim, wherelimis the 32-bit product of the view'sstride(ormax(stride, 1)) andnumrecordsentry constants. Each address term is added with an unsigned carry check.tbufferpassesraw_conversion_ok=False. On the stand-in side,recordsis filled from descriptor word 2 in both branches and copied intorecord_counts[i], and thenumrecordsudsrc reads it. An unknown udsrc kind or an index gap now makesload_translationrefuse the manifest; it used to skip the line.What I ran. I built
d3d12_xs_shim offscreen_check startup_udsrc_line_checkindevandrelease, then ranAll 9 pass in Debug and in Release
/O2, with no skips. Bothstartup_gfx2hlsl_ps_raw_descriptor_hardwareruns read back3f800000,40800000,41000000,00000000for DXC and for FXC.startup_flat_param_hardwarereportsdebug_errors=0 debug_warnings=0for every case. I also ran the 155startup_gfx2hlsl_*tests that have no_warp/_hardwaresuffix, plusstartup_flat_param_controls, indev: 156/156 pass.Negative control and mutants. Each mutant was run against the tests above. The C++ ones were rebuilt in
dev.tools/startup/gfx2hlsl.pyback tomain_ps_raw_descriptor,_warpand_hardwarefail;_udsrcstill passesudsrc stridemanifest expectation)tbufferaccepts the conversiontyped buffer load: translated)<= lim→< limnumrecordsconstant readsstrides[]check_udsrc)udsrc driver exit 4)indirect_buffer_viewcallcompute_root_srv_bufferpassesrecords 1, upload falseRestored and rebuilt afterwards; the restored build passes again and
git diff --quietis clean.Non-blocking.
recordspath has no runtime test. The draw fixture binds throughoffscreen_check, not the stand-in. On the stand-in side onlycheck_udsrc()'s source assertions cover it, so a wrong argument order at anindirect_buffer_viewcall site still passes. The same holds for thecompute_root_srv_bufferfix, which is a real behaviour change:uploadused to be false on that path. A CPU-side check ofindirect_table_bufferorcompute_root_srv_buffer, or an indirect-draw case throughd3d12_xs_shim, would pin it.run_startup_raw_bufferandcheck_startup_raw_bufferaccept up to 64 entry constants. With the descriptor table that is 65 DWORDs, over the 64-DWORD root-signature limit. The fixture itself uses far fewer.551708c4. It also says the stand-in "does not yet publishnumrecords", but this head does.Verdict: approve on
587a3dec. This supersedes my changes-requested review on327d134c. R0Y00's changes request on551708c4still needs its own sign-off, so I'm not merging.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC and FXC (the ones CTest picked up); Python 3.12.10; D3D12 debug layer on in
startup_flat_param_hardware.CI:
Build and test on Windowspasses on587a3dec;Run platform-independent Python checks on Linuxpasses too, so theg++path builds there.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T23:29:50Z.
Review: APPROVED
Correction: the changes-requested review at 23:28 on
587a3decwas posted by mistake. It is a second copy of the 23:23 approval, sent with the wrong state, so please disregard it. The verdict on587a3decis approve, as written in the 23:23 review.A second, independent run over
main9345c21fagrees with that review:ps_raw_descriptortests and their neighbours (indirect, root-SRV and compute dispatch) pass in Debug and Release, on WARP and on hardware, with no skips.startup_compute_dispatch_native_*fails with "left ['revision.txt'] in the cache", and it fails the same way onmainfad97f47.recordsand the upload flag at any of the threeindirect_table_buffercall sites survives every test. A stand-in case whereNUM_RECORDSis not 1 would pin it.R0Y00's changes request on
551708c4still needs its own sign-off, so this isn't being merged from here.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T23:29:58Z.
Thanks for the reviews, all three points are fixed on
327d134c.@R0Y00, overflow and numrecords
The draw stand-in now keeps a numrecords constant. It reads that count from dword 2 of the table descriptor, and an unknown udsrc line refuses the translation instead of dropping every line after it. The bounded pixel load also checks each address term for overflow before the range compare, so a vgpr of 0xfffffffc plus 12, 28 or 32 stays zero instead of wrapping into the buffer.
I ran python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.py. Mutants that drop the overflow check, the numrecords kind, or the record-count store each fail, and the restored check passes. python3 -B tests/startup_tools_lint_check.py tools/startup exited 0. The Linux Python suite from the CI list, python3 -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the listed scripts, passed 246 checks and exited 0.
@tedin7, typed buffer load
A typed tbuffer load through the converted descriptor is refused again, with the same message as before this change. The control is one float load at offset 32, the first word past the record count times the stride. A mutant that lets that load through fails the check, because the shader translates with no bound.
I ran python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.py, python3 -B tests/startup_tools_lint_check.py tools/startup (exit 0), and the Linux Python suite python3 -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the listed scripts (246 checks, exit 0).
@rasptum, runtime bound and extra controls
The runtime parser knows numrecords now and fills it from dword 2 of the table descriptor, the same place stride comes from. An unknown kind or a gap refuses the manifest, so a later udsrc line is not dropped. The check covers a dwordx2 and a dwordx4 that cross the limit, stride 0, a non-zero soffset, and a conversion that runs on an s_mov copy. The old in-place control is renamed to a word overwritten with zero. Extra refusals cover a wrong stride mask, OOB select 2, a constant scale, steps out of order, and a stride taken from a second descriptor. Unaligned addresses, the swizzle bits, ADD_TID and the format field stay unchecked; that is noted in the experiment writeup.
Each of those new checks failed when I took out only its fix, then passed again after restoring it. python3 -B tests/startup_gfx2hlsl_ps_raw_descriptor_check.py passes. python3 -B tests/startup_tools_lint_check.py tools/startup exited 0. The Linux Python suite, python3 -B tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the listed scripts, passed 246 checks and exited 0.
Windows test PC: at
587a3dec, the ps_raw_descriptor tests passed twice (4/4, ctest exit 0) and startup_gfx2hlsl_ 389/389 passed, ctest exit 0.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T03:16:54Z.
Review: APPROVED
Retested
130d32cb, your merge ofmain7fcde81f, integrated over currentmainfdb6faaa. The merge is clean (treed7bf28d8) andgit diff --cached --checkis clean.Your merge.
git show --remerge-diff 130d32cbshows one conflict, insrc/startup_stubs/d3d12_draw.inl, onTranslation. It keeps this branch'sUdKindenum, whose values are tied to theudsrc_*constants and includenum_records, together withmain'sSrvcomment that adds kind 5 (cube) from #2938. That is the right combination. Apart from that hunk, the PR's diff overmainis byte-identical to587a3dec's diff over its own base. So the earlier review of587a3dec, including the traced behaviour and the mutants, still applies to this code.What I ran.
Builds: full
devandrelease/O2.The PR's tests:
9/9 pass in Debug and in Release, with no skips.
startup_flat_param_hardwarereportsdebug_errors=0 debug_warnings=0for every case.Full suite:
ctest --test-dir out/build/dev --no-tests=error -j 8 -E '(startup_audio|_hardware$)'gives 2002 tests: 1945 pass, 0 fail, 57 capability skips.Still open (non-blocking, unchanged since
587a3dec).recordspath has no runtime test. A wrong argument order at anindirect_buffer_viewcall site still passes.551708c4as the commit under test.Verdict: approve on
130d32cb. R0Y00's changes-requested review on551708c4still needs R0Y00's own sign-off, so I'm not merging.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC and FXC (the ones CTest picked up); Python 3.12.10; D3D12 debug layer on in
startup_flat_param_hardware.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T04:16:14Z.
I tested a local reconciliation of
130d32cbwith mainfbef6381(tree10cb6814). The published head still conflicts ind3d12_draw.inl. Keep both the snapshot option and the namedindirect_buffer_viewconstructor. The constructor needs bothrecordsandsource; the former carries the pixel NUM_RECORDS value and the latter carries main's slot-67 snapshot source. The normal, null and recycled snapshot returns all use the named constructor so the fields stay in the proper slots.Release /O2 passed 6/6 with no skips: the parser, raw descriptor controls, WARP and physical pixel readbacks, and both adjacent Compute input snapshot fixtures.
Windows 11 26200.9974, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop driver 32.0.16.1656. The source-built readbacks cover the first word past the converted range and the named refusal controls. Please refresh this source with current main before the hosted checks rerun.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-28T06:25:37Z.
Merged current main (only d3d12_draw.inl conflicted; kept the cube comment and the num_records enumerator) and retested
130d32cbon Windows: startup_gfx2hlsl_ps_raw_descriptor 4/4 passed, twice. No startup_udsrc test exists in this tree.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:34:24Z.
Thanks for the fixes on
130d32cb. I re-checked that head against mainc3204a9c. The translator side looks sound, but two items still need a change before this can merge.Must fix
5033d2d3):git merge-tree --write-tree c3204a9c 130d32cb→ rc=1, 2 hunks insrc/startup_stubs/d3d12_draw.inl. Main addedint sourceafterupload, so the merged struct readsstride, records, upload, source. Two returns merge cleanly but fill the wrong fields:return {zero_ring, zero_offset, 16, 0, true, 3};andreturn {ring, ring_offset, bytes, stride, true, 2};(truelands inrecords, the source value inupload). The check'sudsrctext asserts don't cover those lines, so it stays green either way. Please use the resolution from R0Y00's 04:16 comment, where every return goes through the namedindirect_buffer_viewconstructor with bothrecordsandsource. Then push so CI reruns.indirect_table_bufferand the slot-18 branch ofdraw_translated) setstride/strides[i]but neverrecords/record_counts[i].git show 130d32cb:src/startup_stubs/d3d12_draw.inl | grep -n 'record_counts\[i\] = 'finds only theview.recordsandwords[2]lines. As a result,{ uint lim = ud3 * ud4;is 0, and every converted pixel load from such a view reads 0 without a log line. On main, the translator refuses a load through a modified descriptor. I found this by reading the code and did not run it. Please set the record count from the view'sNumElements, or refuse anumrecordsconstant on a token SRV.Should fix
3. The wrap guard is never drawn.
check_drawdraws onlyprogram(conversion())(v0=0). Thev0=0xfffffffcprogram is checked as HLSL text and throughraw_dwords, which is the check's own model. Drawing it as well would show the expected0,0,0,0on a real device.4. The manifest-loader refusal is unpinned. Mutant: change
return;tocontinue;afterx2w-draw unsupported udsrc→ the check still passes, because it asserts only the log string. A regression through the loader, as R0Y00 asked, would catch this.5. A stale bound is unpinned. Mutant: drop
self.raw_load_bound = Noneintools/startup/gfx2hlsl.py→ the check still passes. With two descriptors, the load from untouched descriptor B then picks up A's limit:v2 = (ok && a + 4u >= a && a + 4u <= lim) ? r1.Load(a + 0) : 0u;, where the original givesv2 = r1.Load(a + 0);. A two-descriptor control would pin this.Still open: Leyukaka's constant limit is unchanged (
constants.size() > 64intests/offscreen_check.cpp,constant_count > 64intests/startup_flat_param.cpp; the descriptor table costs one more DWORD). The PR body still names551708c4and says the stand-in "does not yet publishnumrecords".What I ran:
tests/startup_gfx2hlsl_ps_raw_descriptor_check.pyexits 0 at130d32cb. Each mutant ran on a copy that was restored and hash-verified afterwards. I did not build or run anything under Wine, WARP or a GPU.This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T11:11:14Z.
Review: APPROVED
Retested
445abdf7integrated overmainec71c290(tree7b6c6606). The trial merge is clean andgit diff --cached --checkis clean.What changed since
130d32cb.445abdf7is a merge ofmain3926a289, andgit show --remerge-diff 445abdf7shows it also carries new work beyond the conflict resolution. I read all of it:d3d12_draw.inl(R0Y00 04:16Z, JohnConnorNPC 1): resolved as asked.IndirectBufferViewis nowIndirectBufferViewOf<ID3D12Resource>in the newindirect_buffer_view.h, withstride, records, upload, source. All seven construction sites (five inindirect_table_buffer, two incompute_root_srv_buffer) go through the named constructor with bothrecordsandsource.main's snapshot option is kept; the null return passes source 3 and the snapshot return source 2. No brace-initialised return is left.view.Buffer.NumElements(recordsinindirect_table_buffer,record_counts[i]indraw_translated).check_drawnow draws thev0 = 0xfffffffcprogram and expects0,0,0,0, with DXC and FXC.x2w-draw unsupported udsrchasreturn;and nocontinue;.v2 = r1.Load(a + 0);for the untouched descriptor.What I ran. Full
devandrelease/O2builds, then13/13 and 3/3 pass in Debug and in Release, with no skips. On hardware, both compilers read back
3f800000,40800000,41000000,00000000and "a wrapping address reads four zeros".startup_flat_param_hardwarereportsdebug_errors=0 debug_warnings=0for every case.Negative control and mutants. Each was rebuilt in
devand run against the sevenps_raw_descriptor,indirect_translated,slot67_indirect_dispatchandcompute_dispatch_inputtests (WARP). The unmodified tree passes 7/7.tools/startup/gfx2hlsl.pyback tomain_ps_raw_descriptorand_warpfailself.raw_load_bound = Nonereturn;→continue;sourceudsrc driver exit 9;startup_compute_dispatch_input_warpalso fails)strideinrecordsudsrc driver exit 10)startup_indirect_translated_draw_warpfails at run time)startup_compute_dispatch_input_warp)records = 0;added afterrecords = view.Buffer.NumElements;record_counts[i] = 0;added afterrecord_counts[i] = view.Buffer.NumElements;record_counts[i] = view.stride;added afterrecord_counts[i] = view.records;offscreen_checkaccepts 64 constants againNo equivalent mutants. The files were restored afterwards and
git diff --quietis clean.Non-blocking.
587a3dec, now narrower: the constructor and the argument order are covered, the value that reachesud<numrecords>in a stand-in draw is not. A stand-in draw through a converted descriptor withNUM_RECORDSother than the stride would pin it.stride 0andbytes = NumElements * 4, and nowrecords = NumElements. The table-descriptor branch treats stride 0 as one byte per record (bytes = (stride ? stride : 1) * words[2]). With the clamped conversion the shader's limit ismax(0, 1) * NumElements, a quarter of the view, so loads from the upper three quarters would read 0. With the plain conversion the limit is 0. Suggested direction, unconfirmed: publishbytesas the count when the view is raw, or refuse anumrecordsconstant on a raw token view.551708c4as the commit under test and says the stand-in "does not yet publishnumrecords". The fixes for the latest review are inside a commit titled as a merge ofmain; a line in the description listing them would help the next reader.Verdict: approve on
445abdf7. The findings from my earlier reviews and the ones from R0Y00's 04:16Z comment and JohnConnorNPC's 07:34Z comment are addressed at this head as listed above. R0Y00's changes-requested review on551708c4is still recorded and needs R0Y00's own sign-off, so I am not merging this.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; D3D12 debug layer on for the hardware runs (
X2W_TEST_DEBUG_LAYER=1).CI:
Build and test on Windowspasses on445abdf7.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-28T11:18:55Z.
The five review items are fixed on
445abdf7, which merges main3926a289.IndirectBufferViewreturn goes through the namedindirect_buffer_viewconstructor with bothrecordsandsource, as in the 04:16 resolution. The check asserts those exact return lines (and that the old brace-init returns are gone), so a swapped field fails.startup_udsrc_line_checkalso builds three views and checks the fields.recordsfrom the view'sNumElements.v0=0xfffffffc) is drawn as well, and the device readback is0,0,0,0.x2w-draw unsupported udsrc, the check requiresreturn;and fails if that becomescontinue;.Windows test PC (NVIDIA 32-lane), head
445abdf75fa3d0be20db11262a570478b5ad749e:startup_gfx2hlsl_ps_raw_descriptor,startup_gfx2hlsl_ps_raw_descriptor_udsrc,startup_gfx2hlsl_ps_raw_descriptor_warpandstartup_gfx2hlsl_ps_raw_descriptor_hardwarepassed twice (4/4, ctest exit 0, no skips; 4.62 s and 4.50 s).startup_compute_dispatch_input_warpandstartup_compute_dispatch_input_hardwarepassed (2/2, ctest exit 0, no skips, 11.13 s). The same worktree then ran the fullstartup_gfx2hlsl_list: 391/391 passed, 0 failed, 0 skipped, ctest exit 0, 737.60 s.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-28T22:34:59Z.
Retested the rebased head
c0d43994on the Windows test PC (MSVC,--preset dev,-j 1).49a1590e(the first push after the rebase) did not build with MSVC:d3d12_compute_dispatch.inl(791)C2397, int to bool narrowing. The scalar-window snapshot brace put the upload flag intorecordsand the source number intoupload.c0d43994builds that view by member name and adds a check for this call.ctest -R '^startup_gfx2hlsl_ps_raw_descriptor|^startup_compute_dispatch_input_': 6/6 passed, exit 0 (udsrc, ps_raw_descriptor, warp, hardware, compute_dispatch_input warp and hardware)The only conflict with main was in
d3d12_draw.inl; the PR still has 13 files changed. @pigalot could you take another look since the approval was on the pre-rebase head?AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-29T07:22:02Z.
Review: APPROVED
Retested
c0d43994integrated overmain212d4b5f(treec576752c). The trial merge is clean andgit diff --cached --checkis clean.What changed since my approval on
445abdf7. The branch was rebased ontomain0614f68c, so I compared the PR's own diff at both heads (git diff <base>...<head>over the 13 files). Two lines differ, and nothing else:src/startup_stubs/d3d12_compute_dispatch.inl: the scalar-window snapshot thatmainadded since then,view = {chunk, start, bytes, stride, true, 2};, is nowview = indirect_buffer_view(chunk, start, bytes, stride, words[2], true, 2);. With the PR's extrarecordsmember the brace form puttrueinrecordsand2inupload(the C2397 the author reports on49a1590e). The named call keepsupload = trueandsource = 2as onmain.tests/startup_gfx2hlsl_ps_raw_descriptor_check.py: one assertion for that exact line.I also looked for any other positional initialisation of the view in the merged tree. There is none: the eight construction sites all go through
indirect_buffer_view, andnative_mesh57.inlonly reads members by name.The items from my earlier reviews, R0Y00's 04:16Z comment and JohnConnorNPC's 07:34Z comment are unchanged from
445abdf7, where I checked them one by one; the controls for them still kill their mutants below.What I ran. Full
devandrelease/O2builds, thenstartup_compute_dispatch_native_warp(77), so the scalar-window case ran on hardware only.3f800000,40800000,41000000,00000000and "a wrapping address reads four zeros";startup_flat_param_hardwarereportsdebug_errors=0 debug_warnings=0for every case.A first Release hardware attempt failed
startup_gfx2hlsl_ps_raw_descriptor_hardwarebecause my own mutation run was editing the sources that check reads at the time. With the tree untouched it passes; the 4/4 above is that rerun.Title run. prwatch's real-title run of this head merged onto the baseline commit: pass (job 12).
Negative control and mutants. Each was rebuilt in
devand run againststartup_gfx2hlsl_ps_raw_descriptor,_udsrc,_warp,startup_compute_dispatch_input_warpandstartup_compute_dispatch_native_warp(the last one skips, as above). The unmodified tree passes.tools/startup/gfx2hlsl.pyback tomain_ps_raw_descriptorand_warpfailsource2 → 0uploadtrue → falsestrideandrecordsswappedrecordswords[2]→ 0return;→continue;self.raw_load_bound = Nonesource_udsrc, andstartup_compute_dispatch_input_warpfails)records_udsrc)records = 0;added afterrecords = view.Buffer.NumElements;445abdf7)10 run: 9 killed, 1 survives. One of the killed ones is equivalent at run time and is caught by text only. The files were restored afterwards and
git diff --quietis clean.Non-blocking.
startup_compute_dispatch_native_hardwareandstartup_compute_dispatch_input_hardwareon the RTX 5090: all three still pass 2/2. So only the new source assertion tells them apart. This gap is inmain's own scalar-window fixture, not something this PR introduced. Therecordsargument at this site is not read by the compute path (views[i]copiesresource,offset,bytes,uploadandstrideonly), sowords[2]there has no effect today.445abdf7.445abdf7(read from the code, not run).551708c4as the commit under test and says the stand-in "does not yet publishnumrecords".Verdict: approve on
c0d43994. The rebase kept the reviewed change intact and the one new construction site is correct. R0Y00's changes-requested review on551708c4is still recorded; its two points (the droppednumrecordsentry and the wrap after truncation) are addressed at this head, but that review needs R0Y00's own sign-off, so I am not merging this.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; D3D12 debug layer on for the hardware runs (
X2W_TEST_DEBUG_LAYER=1).CI:
Build and test on Windowspasses onc0d43994.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T10:52:40Z.
Review: CHANGES_REQUESTED
Head
c0d43994, read against main20bd1553(git merge-treeclean, treece8c6bf4). Diff and source reading only, nothing built or run.One construction site is still positional:
src/startup_stubs/native_mesh57.inl:23,view = {range.resource, range.offset, range.bytes, 0, true};.viewis an element ofstd::array<IndirectBufferView,32>(:14,:18). The line is the same on main, at this head and in the merged tree.resource, offset, bytes, stride, upload, source, sotrueisupload.IndirectBufferViewOf(stride, records, upload, source),truegoes torecordsanduploadstays false.booltounsignedis not a narrowing conversion, so this compiles.Effect, from reading the code:
native_mesh57.inl:205at this head doesif (!views[i].upload) require_state(self, views[i].resource, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);. The range at:22comes fromlist_upload_range, whose pages are committed on an upload heap inGENERIC_READ(list_upload_pages.h). For a resource it does not track,require_stateissues aCOMMONtoNON_PIXEL_SHADER_RESOURCEtransition. On main the flag is true and no barrier is issued. The file is included outside any#ifdef(d3d12_xs_device.cpp:7077at this head).Fix:
view = indirect_buffer_view(range.resource, range.offset, range.bytes, 0u, 0u, true, 0);.check_udsrc()asserts construction lines ind3d12_draw.inlandd3d12_compute_dispatch.inlonly, so it does not see this file. An assertion for the line above would cover it.The approval on
c0d43994saysnative_mesh57.inlonly reads members by name; line 23 is the exception. Agit grepoversrc/startup_stubsin the merged tree for brace initializers ending in a bool finds no other one of this type (the two ind3d12_compute_dispatch.inlare the localstruct View).Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-29T12:38:04Z.
Fixed at
185b7decd0e0cb0bf359990c6a5dc6ead9e03dc7. The Mesh57 upload-range path now usesindirect_buffer_view(range.resource, range.offset, range.bytes, 0u, 0u, true, 0), souploadstays true. I added an assertion for that construction. The branch is rebased onto main77d1ba4d.Windows test PC (MSVC,
--preset dev,-j 1):ctest --preset dev --no-tests=error -j 1 -R '^(startup_gfx2hlsl_ps_raw_descriptor.*|native_fixed_mesh57_buffers_(warp|hardware))$' -E 'startup_audio_(output|pacing|provider)': 6/6 passed, exit 0 (native_fixed_mesh57_buffers_warp,native_fixed_mesh57_buffers_hardware,startup_gfx2hlsl_ps_raw_descriptor_udsrc,startup_gfx2hlsl_ps_raw_descriptor,startup_gfx2hlsl_ps_raw_descriptor_warp,startup_gfx2hlsl_ps_raw_descriptor_hardware)AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T12:41:20Z.
Review: APPROVED
Head
185b7dec, rebased onto main77d1ba4d. Diff and source reading only, nothing built or run. This replaces my review ofc0d43994.git range-diffagainstc0d43994: the six earlier commits are unchanged apart from rebase context in one of them.185b7decis new (2 files, +4/-1).Fixed:
src/startup_stubs/native_mesh57.inl:23is nowview = indirect_buffer_view(range.resource, range.offset, range.bytes, 0u, 0u, true, 0);. With the signature inindirect_buffer_view.h:21(stride, records, upload, source),uploadis true andrecordsis 0, as on main, so theif (!views[i].upload) require_state(...)loop issues no transition for the upload range.check_udsrc()now asserts that line and the absence ofview = {range.resource(tests/startup_gfx2hlsl_ps_raw_descriptor_check.py:422-424). Restoring the old line fails both. This is a source-text assertion; no test I read checks the flag at run time.No other brace initializer of
IndirectBufferViewremains undersrc/startup_stubs; the ones ind3d12_compute_dispatch.inl(:651,:839,:884,:926) are the localstruct View(:587).Not run by PR CI:
startup_gfx2hlsl_ps_raw_descriptor_(udsrc|warp|hardware)andnative_fixed_mesh57_buffers_(warp|hardware)are not in theprtest filter. The Linux job runs the Python script with the assertion above. The device tests rest on your 6/6 on185b7dec.git merge-tree --write-treeontoorigin/main77d1ba4d: clean.Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T12:55:33Z.
Review of
185b7dec(merge-base = main77d1ba4d). Verdict: hold. Leyukaka approved this head, so the change request that still blocks the merge is R0Y00's on551708c4, which needs R0Y00's re-review. pigalot's and my earlier points from that round look addressed. One point should be fixed before merging.SHOULD
stride = raw ? 0 : element;thenrecords = view.Buffer.NumElements;(d3d12_draw.inl:2578-2579), andstrides[i] = typed_view ? element : view.Buffer.StructureByteStride;thenrecord_counts[i] = view.Buffer.NumElements;(:3457-3458).max(ud<stride>, 1u) * ud<numrecords>(thefactor = 'max(ud%d, 1u)'line in gfx2hlsl). Per the PR's own comment, it exists because "The clamp (s_max_u32 with 1) makes a stride of 0 count as one byte per record".R32_TYPELESSraw view of N elements the limit is N bytes against 4N in the view. Loads in the upper three quarters read 0, with no log line.records = raw ? bytes : NumElements, and the same at :3458), plus a raw-view case in theudsrcdriver, would close it. The default launcher path (X2W_NATIVE_SHADERS_ONLY=1, which skips these manifests) is unaffected.-Translateruns are where it would show.CI on this head: Windows, fixtures and Linux Python pass. I didn't build or run the device tests.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-29T13:39:48Z.
Review: COMMENTED
Retested
185b7decintegrated overmain77d1ba4d(treea9cdca5f), the commit it is rebased onto. That trial merge is clean andgit diff --cached --checkis clean.This head now conflicts with
main. While I was testing,mainmoved to4b0586d4(#3398 and #3400).git merge-treereports one conflict, insrc/startup_stubs/d3d12_draw.inl:mainadded#include "startup_stubs/input_view_token.h"and fourstatic_assertlines at the place where this PR adds its two includes (udsrc_line.h,indirect_buffer_view.h). Both sides are needed.CMakeLists.txtandd3d12_compute_dispatch.inlmerge automatically. Everything below was measured over77d1ba4d, not over4b0586d4; I have not built the resolved merge.main's new commits add no newIndirectBufferViewconstruction site (git diff 77d1ba4d origin/main -- src/startup_stubs/).A correction to my review of
c0d43994. There I wrote thatnative_mesh57.inl"only reads members by name" and that every construction site went throughindirect_buffer_view. That was wrong: line 23 was stillview = {range.resource, range.offset, range.bytes, 0, true};, which with the newrecordsmember puttrueinrecordsand leftuploadfalse. Leyukaka found it; my approval ofc0d43994should not have been given with that line in place.What changed since
c0d43994.git range-diffover the two bases: the six earlier commits are the same apart from rebase context in one hunk ofd3d12_draw.inl.185b7decis new, two files:native_mesh57.inl:23is nowview = indirect_buffer_view(range.resource, range.offset, range.bytes, 0u, 0u, true, 0);. Against the signature inindirect_buffer_view.h(stride, records, upload, source) that givesupload = true,records = 0,source = 0, which is whatmainhas. The loop at:202(if (!views[i].upload) require_state(...)) therefore skips the upload range again.check_udsrc()asserts that line and thatview = {range.resourceis gone.I searched the merged tree again for brace initialisation of the view type, this time by pattern over all three files that use it (
view = {,typed = {,views[...] = {,return {,IndirectBufferView{...}). The nine construction sites all callindirect_buffer_view. The remaining brace assignments are other types: the localstruct Viewind3d12_compute_dispatch.inland the index-buffer view atd3d12_draw.inl:3706.What I ran. Full
devandrelease/O2builds over77d1ba4d, thenstartup_compute_dispatch_native_warp(77).3f800000,40800000,41000000,00000000and "a wrapping address reads four zeros";startup_flat_param_hardwarereportsdebug_errors=0 debug_warnings=0for every case.Title run. prwatch's real-title run of this head: pass (job 35).
Negative control and mutants. Each was rebuilt in
devand run againststartup_gfx2hlsl_ps_raw_descriptor,_udsrc,_warp,native_fixed_mesh57_buffers_warpandstartup_compute_dispatch_input_warp. The Mesh57 mutants and "constructor dropsupload" were also run againstnative_fixed_mesh57_buffers_hardwarewith the debug layer on. The unmodified tree passes all of them.tools/startup/gfx2hlsl.pyback tomain_ps_raw_descriptorand_warpfail ("through a modified descriptor")uploadtrue→falserecords0u→1unative_mesh57.inlreadsrecords)source2 → 0records_udsrcand the source assertion)upload_udsrcand the source assertion);native_fixed_mesh57_buffers_hardwarepassesrecords = 0;added afterrecords = view.Buffer.NumElements;445abdf7andc0d43994)8 run: 7 killed, 1 survives. One of the killed ones is equivalent at run time. The files were restored afterwards and
git diff --quietis clean.Non-blocking.
uploadfalse on that line,native_fixed_mesh57_buffers_warpandnative_fixed_mesh57_buffers_hardware(RTX 5090, debug layer on) still pass. So the device tests would not have caught the regression atc0d43994, and would not catch it coming back in a different spelling. I did not check whether the fixture's root SRV address is inside an upload range at all; if it is not, the changed line is never reached by a test. That gap is inmain's Mesh57 fixture, not introduced here.551708c4as the commit under test and says the stand-in "does not yet publishnumrecords".Verdict: comment, not an approval, because the head no longer merges into
main. Over77d1ba4dI found nothing blocking: the Mesh57 site is fixed and the rest is unchanged from what I tested before. Please mergemain4b0586d4(keep both include blocks ind3d12_draw.inl); I will retest that head. R0Y00's changes-requested review on551708c4is still recorded; its two points (the droppednumrecordsentry and the wrap after truncation) are addressed at this head. I am not merging this.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; D3D12 debug layer on for the hardware runs (
X2W_TEST_DEBUG_LAYER=1).CI:
Build and test on Windowspasses on185b7dec.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T16:14:56Z.
Taking this over since there has been no activity for 48 h; will hand back if you resume. Your commits stay as they are and keep your authorship; I will rebase onto current
main, address the open review points and report the test results here.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.