runtime: bind 1D, 2D-array and 3D texture SRVs for published native compute #3306
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3306"
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 JB2WIN on 2026-11-28T07:03:19Z.
Change
A published native compute manifest (
compile_dxil --requests) can now name 1D, 2D-array and 3D texture SRVs:srv N tex1d|tex2da|tex3d table R B, fortexture_srvwitharray_count1. The stand-in Dispatch binds the title's view for them, or refuses with a named reason.tex2dbehaves as before.Refs #3224 (the texture SRV part I claimed there; typed buffers stay with @Not-Saii).
src/direct_compute_cache.cpp): image_dimension 0/2/5 now publish. Cube (3) and MSAA keep their view-shape refusal from #3268.d3d12_compute_dispatch.inl): the new dims need a recorded title view description whoseViewDimensionmatches the line, and the view must passaddress_view_fits(same format or typeless parent, mips/slices inside the texture, MinLODClamp 0). Otherwise the dispatch is refused with "has no recorded view description", "view is not " or "view does not fit its texture". This is stricter than the draw path, which binds null on a mismatch; the docs say so.Cube is left for a follow-up: the translator declares cube samples as TextureCubeArray, so the SRV needs a TEXTURECUBE → TEXTURECUBEARRAY view.
Verification
Build of this branch on
main6c5f4ed0. Windows 11 26200, RTX 3080 (32.0.16.2124) and WARP, DXC 1.8.2502.11.170/170 passed. The 2 skips (
startup_compute_descriptor_scc_warp,startup_compute_dispatch_native_warp) also skip onmain.New tests:
native_compute_manifest_reasons: exact published lines for 1d, 2d-array and 3d; image_dimension 3 still gets "SRV kind texture_srv cube".startup_compute_dispatch_texture_dims_{warp,hardware}: one program per dim (1D image_sample_lz, 2D-array slice > 0 and 3D z > 0 image_load) writing to a raw UAV. On both adapters 320 words match the texel and 288 written words change. Each control is refused with the output untouched: a view of another dimension, no view description, a view that does not fit, and the manifest line rewritten totex2dor another dim. Debug layer on, no error message.Impact on a local capture (2,689 compute requests, same build, only the writer swapped back to
main): 751 compile in both. Published manifests went from 301 to 350. All 49 new ones carry a new line (51tex2da, 30tex3d, 6tex1d), and the 301 existing manifests are byte-identical. That capture data stays local; the public fixtures are synthetic.Evidence and follow-up
mainbuild of the same capture, 31 programs were blocked only on a cube SRV.address_view_fitskeeps D3D12's casting rule (a view may only reinterpret the format of a typeless resource), so a title view that relies on console-only format casting is refused, not bound.Checklist
AI-assisted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EF3hKGcUDvQ6pxjDDMrvbn
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T07:29:29Z.
I merged
mainc3204a9cinto this branch ase59c5042(a merge commit on top of03c22974; no rebase and no force-push). Againstmain, the branch still changes the same 10 files.Conflict and how I resolved it. Only
src/startup_stubs/d3d12_compute_dispatch.inlconflicted, withmain's typed half-buffer outputs (uav <i> bufhalf ...) and resource-heap ranges (resheap):main'sbufhalfoutput line and this branch'ssrv <i> tex1d|tex2d|tex2da|tex3dinput line.ComputeTranslation::Slot: kept both new fields,srv_dimensionandhalf_buffer_bytes. Both come afterchannelsand are assigned afterpush_back, so the existing positional initialisers mean the same.srv <i> <kind> tablebranch, thenmain'sresheapbranch.a resource that is not a raw table buffer or a 1D/2D/2D-array/3D texture, whichtests/startup_compute_root_srv_dispatch_check.pyexpects) andmain's generic UAV text (an unsupported compute output view), since outputs now includebufhalftoo.src/direct_compute_cache.cpp,docs/startup-runtime.mdandtests/startup_stream_consumer.cppmerged without conflicts.What I ran. I built the whole tree in
devandrelease, then ran:_hardware: 104 of 104 pass in Debug and in Release/O2, includingstartup_compute_dispatch_texture_dims_warp,startup_compute_root_srv_dispatch_warp,native_compute_manifest_reasonsandstartup_compute_half_buffer_uav_controls. Four report capability skips (77) on WARP:startup_compute_descriptor_scc_warp,native_compute_implicit_lod_warp,startup_compute_dispatch_native_warpandstartup_compute_half_buffer_uav_warp._hardware: 75 of 75 pass in Debug and Release on an RTX 5090, includingstartup_compute_dispatch_texture_dims_hardwareandstartup_compute_half_buffer_uav_hardware. The debug layer was off.git diff --check origin/main...HEADis clean.This needs a review from someone other than me before it can be merged.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10.
This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:43:59Z.
Thanks for this. I reviewed head
e59c5042by reading it and doing a compile-only check (no Wine, no GPU). I found nothing blocking, only the nits below. Once you've had a look at them, it looks ready from our side.d3d12_compute_dispatch.inlmatches one I made independently:git merge-tree --write-treeof03c22974intomainc3204a9c, then the union of its 4 hunks. The only difference is the order of the two default-initializedSlotfields,srv_dimensionandhalf_buffer_bytes. The other 9 files have the same added and removed lines as03c22974.dx_kind[]{1, 2, 4, 5, 6, 7, 3, 8}ingfx1013_direct_compute.inldeclares dims 0, 2 and 5 as Texture1D, Texture3D and Texture2DArray. These are the view dimensions the Dispatch now requires.direct_compute_cache.cpp,d3d12_xs_device.cpp,startup_stream_consumer.cppandnative_compute_manifest_reasons.cppcompile (clang-cl cross build, rc=0).e59c5042passed (Windows build/test, gfx1013 fixtures, Linux Python). Itsctest --preset pr(100% tests passed out of 73) includes none of the new or edited tests:grep -c texture_dimson the job log gives 0. So the runtime evidence is your run plus pigalot's WARP and RTX 5090 run.Nits (none blocking):
git grep -l 'has a packed format' -- testsfinds nothing). The existing 2D one isn't reached by any test either.published[]and the cube case cover only 0, 1, 2, 3 and 5. The name ternary maps every other dimension to"tex2da", so if the guard were widened, dim 4 would be published as a 2D array and no test would fail.view_shapeindirect_compute_cache.cppstill uses"SRV kind texture_srv 3d"as its example, but that kind now publishes.cubewould work as the example.address_view_fits: component mapping, depth formats, and the refusal of a typeless view format.This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T08:01:41Z.
Review: APPROVED
I reviewed
e59c5042on Windows (your change plus b's merge ofmain). It does what the description says, and the tests are solid, so I'm approving.Merge of
main.git show --remerge-diff e59c5042shows one conflicted file,src/startup_stubs/d3d12_compute_dispatch.inl. All three hunks keep both sides: the header comment lists thebufhalfoutput and the new SRV names; theComputeTranslationslot holds bothsrv_dimensionandhalf_buffer_bytes; and the reader keeps your SRV line next tomain'sresheapline, with your SRV catch-all message andmain's "an unsupported compute output view". A trial merge over currentmain(c3204a9c) is clean, andgit diff --cached --checkreports no problems.What I checked in the code.
tex1d/tex2d/tex3d/tex2dafor image dimensions 0/1/2/5 witharray_count1 only. Cube (3) and the array-count case still get their view-shape refusal.%15sinto the 16-bytenamebuffer and accepts it only when it maps to an SRV dimension. Any other name,bufincluded, falls through to the later branches as before.ViewDimension, andaddress_view_fits.address_view_fitsalso checks the resource's dimension (1D needs a 1D resource withDepthOrArraySize1, and 3D needs a 3D resource), so a view is never created over a resource of another dimension. The 2D path is unchanged.Testing on the trial merge,
ctest --test-dir out/build/<preset> --no-tests=error -R '^(startup_compute.*|native_compile_dxil.*|direct_compute.*|.*compute_manifest.*)$':devandrelease: 100 of 103 pass in each. The 3 capability skips arestartup_compute_descriptor_scc_warp,startup_compute_dispatch_native_warpandstartup_compute_half_buffer_uav_warp._hardwarevariants, under a GPU lock with-j 1andX2W_TEST_DEBUG_LAYER=1: 75 of 75 pass in each preset, includingstartup_compute_dispatch_texture_dims_hardware.dev: 2052 of 2052 pass.Mutants, each rebuilt in
devand run againstnative_compute_manifest_reasons,startup_compute_dispatch_texture_dims_warpandstartup_compute_dispatch_texture_warp:tex2dnative_compute_manifest_reasons)native_compute_manifest_reasons)array_countnative_compute_manifest_reasons)tex2danative_compute_manifest_reasons)tex2dato 2D_dims_warp: 288 words differ)tex3d_dims_warp: thetex3dcontrol refused as an unknown resource)_dims_warpand the existingstartup_compute_dispatch_texture_warp)_dims_warp)ViewDimensioncheck_dims_warp: the mismatch control dispatched)address_view_fitscheck_dims_warp: the clamped control dispatched)_dims_warp)Non-blocking. The packed-format refusal in the new branch has no case. The 2D path's packed check is marked as a shortcut until its first user, so this matches it. A one-line control with a packed view format on one of the new dimensions would pin it, if you want to add one here or later.
Verdict: approve at
e59c5042.Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; NVIDIA GeForce RTX 5090, driver 32.0.16.1088, D3D12 debug layer on for the hardware runs; WARP for the
_warptests.This reply was AI-assisted.