startup: support pixel-stage 2D-array image_store and UAV binding #2822
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2830"
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 R0D4X on 2026-11-26T12:40:44Z.
Fixes #2742
Root Cause / Motivation
Following the merged compute 2D-array UAV slices (#2744, #2777, #2787), the remaining open part of #2742 was the pixel-stage 2D-array
image_storepath:tools/startup/gfx2hlsl.py(op_image_store) still refuseddim:SQ_RSRC_IMG_2D_ARRAYoutside compute stages.src/startup_stubs/d3d12_draw.inl(read_pixel_uav_lineandpixel_uav_view) accepted onlytex2dmanifest lines andD3D12_UAV_DIMENSION_TEXTURE2Dviews.Summary
tools/startup/gfx2hlsl.py): Allowdim:SQ_RSRC_IMG_2D_ARRAYin pixel-stageop_image_store(emittingRWTexture2DArray<float4>,uint3(x, y, layer), anduav N tex2da table P O), reusing the existing per-laneexecguard and manifest emission. Pixeld16, 1D/3D/cube dimensions, and partialdmaskremain refused.src/startup_stubs/d3d12_draw.inl):PixelUavandread_pixel_uav_lineto accepttex2dain addition totex2d(still refusingtex3d, raw buffers, view qualifiers, andchannels).pixel_uav_viewto validate explicitD3D12_UAV_DIMENSION_TEXTURE2DARRAYviews fortex2da(checkingMipSlice == 0,PlaneSlice == 0, in-boundsFirstArraySlice/ArraySize, float format withD3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE), preservingFirstArraySlice/ArraySizeon the created desktop view, and refusing plain 2D or default views fortex2da.tests/startup_pixel_image_store_check.py,tests/startup_pixel_uav.cpp,tests/startup_pixel_uav_check.py):image_storeprograms (relative layers 1 and 3, full andv_cmpxpartial EXEC),llvm-mcbinary round-trip verification, and refusal checks (2 address registers, pixeld16, 1D/3D/cube).R32G32B32A32_FLOATALLOW_UNORDERED_ACCESStexture array instartup_pixel_uav.cppbound through an explicitTEXTURE2DARRAYUAV withFirstArraySlice=1, ArraySize=4(covering physical slices1..4).(1, 2)mip 0;exec-on writes slice 2 whileexec-off leaves all 6 slices untouched; wrong-layer and dropped-EXEC shader mutations fail readback as expected; plain 2D, default, mip-1, SRV+UAV conflict, no-ALLOW_UNORDERED_ACCESS, and integer-format array views are refused before draw with all 6 slices untouched.Before / After
image_store ... dim:SQ_RSRC_IMG_2D_ARRAYwas refused bygfx2hlsl.py, andd3d12_draw.inlrejecteduav N tex2damanifest lines.image_storetranslates cleanly and binds trackedTEXTURE2DARRAYUAV views throughd3d12_xs.dllwith full fenced readback verified on WARP and hardware.Verification
9a7e98a3(based on8c9f168f)10.0.26300.9974), MSVC19.44.35230, Windows SDK10.0.26100.0, FXC + DXC1.9.2602.17Microsoft Basic Render Driver(1414:008c), driver10.0.26100.9818NVIDIA GeForce RTX 5080(10de:2c02), driver32.0.16.2124Commands and measured results (0 failures, 0 skips):
git diff --check,startup_pixel_image_store_check.py,startup_compute_image_store_check.py,startup_compute_image_store_d16_check.py,startup_translator_check.py,docs_links_check.py,bidi_controls_check.py): PASSctest --preset dev --no-tests=error -j 1 -R '^(startup_tools_lint|startup_pixel_image_store_|startup_pixel_uav_|startup_compute_dispatch_array_)' -V: 10/10 passed (50.03 sec,debug layer: on, errors: 0on WARP and RTX 5080)ctest --preset release --no-tests=error -j 1 -R '^(startup_pixel_image_store_|startup_pixel_uav_|startup_compute_dispatch_array_)' -V: 9/9 passed (56.33 sec,debug layer: on, errors: 0on WARP and RTX 5080)X2W_PIXEL_UAV_NO_DEBUG=1 ctest --preset release --no-tests=error -j 1 -R '^startup_pixel_uav_' -V: 2/2 passed (27.95 sec,debug layer: absenton WARP and RTX 5080)refuse_pixel_array,force_tex2d_kind): 2/2 caught (rc=1) and reverted cleanly.Evidence Scope
devandreleasebuilds and CTests (debug layer enabled and disabled) on WARP and RTX 5080, andtools/disasm_rdna2.pydecode of all binary fixture words.tests/startup_pixel_image_store_check.py binary llvm-mc-15in the Ubuntupixel-binaryjob (no localllvm-mcinstalled).AI-assisted; source-built fixtures only.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:47:25Z.
Review: COMMENTED
Review of head
9a7e98a3against current main (0 behind).What I checked
tools/startup/gfx2hlsl.py: the pixel gate now accepts 2D and 2D-array; 1D/3D/cube, pixel d16 and partial dmask stay refused. Pixel and compute share the array branch, so theuint3(x, y, layer)lowering is the same code already merged in #2744 / #2787.src/startup_stubs/d3d12_draw.inl:tex2damanifest line, the TEXTURE2DARRAY view checks (mip 0, plane 0, slice range with no overflow, float typed-store format) and the plain-2D / default-view refusals fortex2da.startup_pixel_uav.cppdoes a real D3D12 fenced readback of all 6 slices x 2 mips and the python check compares it with a CPU-side expectation (layers 1 and 3 land in physical slices 2 and 4, exec-off leaves all slices untouched). Wrong-layer and dropped-EXEC mutations must fail in that check.read_pixel_uav_line/pixel_uav_viewregion, so whichever merges second will need a keep-both rebase. It is a different slice, not a duplicate.Commands run locally (Linux)
python3 tests/startup_pixel_image_store_check.py: rc 0python3 tests/docs_links_check.py: ok;python3 tests/bidi_controls_check.py: ok;git diff --check origin/main...HEAD: cleangfx2hlsl.py;startup_pixel_image_store_check.pyfails withonly 2D images are lowered. Restored afterwards.startup_pixel_uav_check.pyneeds the built D3D12 fixtures, so I did not run it here. The author's Windows run on this head (WARP and hardware, dev 10/10 and release 9/9) is in the PR body, and the PR's CI "Build and test on Windows" is green.No blocking findings.
AI-assisted; commands listed were executed locally.