gpu: translate 2D array images in the startup shader translator #1374
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1381"
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 JohnConnorNPC on 2026-11-24T10:00:50Z.
Change
tools/startup/gfx2hlsl.pyrefused every image instruction withdim:SQ_RSRC_IMG_2D_ARRAY(image dimension SQ_RSRC_IMG_2D_ARRAY). A pipeline whose pixel stage reads an array texture was therefore never translated, and the draw path skipped all of its draws.image_sample,image_sample_lz,image_sample_landimage_loadon a 2D array now translate:Texture2DArray<float4>and listed in the manifest astex2da, the kind the draw path already binds asD3D12_SRV_DIMENSION_TEXTURE2DARRAY;float3(u, v, slice)for a sample,int4(x, y, slice, 0)for a load.image_sample_ltakes the level from the last address register, as it does for 2D and 3D.The change in the translator is three lines: the accepted dimensions, the manifest kind, and the declared type. Cube, multisampled and 1D images are still refused.
Tests
New
tests/startup_image_2d_array_check.py, modelled onstartup_image_3d_check.py:Sample,SampleLevelandLoadcalls, the manifest lines, no sampler for the load stage. The same words with only the dim field changed still giveTexture3D/tex3d, andSQ_RSRC_IMG_2D_MSAAis still refused.llvm-mc(binarymode, added to the Ubuntu job).startup_image_2d_array_warp/_hardware):tests/startup_image_3d.cppgains an array mode (offscreen_check --startup-image-2d-array) that binds a 2x2 texture with two slices holding the same eight texels as the 3D fixture. A sample stage and a load stage each read back the texel of the slice the root constant selects (slices 0 and 1; for the sample also 0.25 and 0.75, which round to 0 and 1). Negative controls on the translated HLSL: the slice fixed to 0, and two coordinates exchanged, must each read a different, named texel.tests/startup_image_sample_l_check.pylisted the array form among the refused ones. That case now asserts the lowering instead:u, v, slicefromv0, v1, v2and the level fromv3, on aTexture2DArray. No other expectation there changes.Results
At
34f03603:startup_image_sample_l_check.py(alsobinary),startup_image_3d_check.py,startup_translator_check.py,startup_sampler_heap_check.py,docs_links_check.pyandbidi_controls_check.pypass.Draw, clang-cl build under Wine 11.0 with vkd3d-proton on an RTX 4070 Ti SUPER (translation layer,
hardwareonly), FXCps_5_1:The existing 3D draw (
startup_image_3d_check.py draw) still passes on the same build through the shared renderer.Measured on one console executable under the startup debugger, same host: before, one of 14 pipelines stayed untranslated with the message above and 13,460 draws were skipped in a 220 s run; with this change all 14 translate and no draw is skipped in a 200 s run (133,254 translated draws). The stage in question reads the array with
image_load. Null bindings rose from 2,813 to 12,642 between those two runs, which were not identical in length or input; I have not looked into which bindings those are.Not verified
ps_6_0compile of the draw. I have no way to run DXC from the Wine-side test here, so the draw above used FXC only; CI is the first run of the rest.image_load_mipon an array, and array textures with more than one mip.offscreen_check, not through the device wrapper, so it shows the translated HLSL, not the binding of a title-created view to thetex2daslot.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T10:10:53Z.
Review: APPROVED
Approved the 2D array lowering on this tested head: the third coordinate selects the array layer and tex2da is recognized by the draw binding reader. Preserve all tests when resolving the current conflicts. Runtime texture binding remains outside the fixture evidence.