shader, runtime: lower mesh table texture loads and refuse integer views #3712
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3712"
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 lukaslw-lab on 2026-12-01T08:41:35Z.
Change
The mesh frontend accepted image loads only through the Texture1D heap slot map of #3638. Any other
image_loadstopped atmesh image load lacks a remapped Texture1D heap contract.It now also routes an
image_load(MIMG opcode 0, no D16) whose eight descriptor words come from a descriptor table to the sharedimage_io, as the other stages do. That lowering:textureLoad.Under a narrowed EXEC each written channel is a partial write, as buffer loads already are.
Runtime: the lowering declares every table texture with a float result (
Texture2D<float4>,textureLoad.f32), but a table record can hold an integer view such asR8G8B8A8_UINT. The slot 86 binder now checks each material-texture record inmesh86_table_texture(native_mesh86.inl) before anything is bound or uploaded. A UINT or SINT view refuses the draw withnative Mesh86 material texture has an integer format. The root-SRV path of #3639 is untouched.This is item 4 of #3703. The 18 captured slot 86 requests behind the scalar loop use only this form:
image_load2D, DMASK 0x2, unorm, through a table record, about four per program. Onmain158ef794with #3707 (802f682d) and this PR (9781e798), all 18 translate. Each binds a 2D table texture, four table buffers, root constants, and the 128-byte root SRV of root parameter 3. So at draw time they wait on #3639. Refs #3703, #3641, #3639.Verification
Build
releaseat9781e798(Windows 10 19045, MSVC 2022, DXC 1.9.2609):All 18 failures are
_hardwaretests on this host (Windows 10 without the Agility SDK; NVIDIA RTX 3080 Ti, driver 32.0.16.1047, debug layer on). 14 are on this host's known-failure list. The other 4 (startup_indirect_mesh_cache_texture_map,_heap_wide,native_fixed_mesh57_published_pair,_refusal) stop atserialize root failed (HRESULT 0x80070057)before any binding code runs, and their WARP twins are capability skips.startup_mesh86_table_texture_probe_warpand_hardware,native_direct_meshandnative_direct_containerpass.New cases in
native_direct_mesh_check.py, next toroot-branch. Each runss_load_dwordx8from table 1, thenimage_load v1, v[1:2], s[24:31] dmask:0x2 dim:2D unorm:table-texture-loadand-xy(DMASK 0x3) check theTexture2Dhandle and the two-coordinatetextureLoad.table-texture-load-skipruns the same load into v3 underv_cmpxand an EXECZ skip.table-texture-load-skip-read-aftersets v3 to 0 for every lane before the skip; reading it after full EXEC returns is refused (graphics register undefined on an incoming path: 259).-d16and-overwrittenkeepunsupported image dimension or D16andnon-contiguous resource descriptor.startup_mesh86_table_texture_probe_{warp,hardware}(new, binder side) creates oneR8G8B8A8_TYPELESS2D texture through the guest API. It writes guest SRVs of it into a guest heap and runs each 32-byte record throughmesh86_table_texture, using the fixture exportx2w_mesh86_table_texture_probe, the same pattern as the committed-root probe of #3718:R8G8B8A8_UNORM2D: bound;R8G8B8A8_UINT2D andR8G8B8A8_SINT2D: refused, integer format;R8G8B8A8_UNORM2D array: refused, does not resolve to the expected SRV;It checks the binding decision only and submits no draw.
Controls:
table-texture-loadfails withunsupported mesh instruction or EXEC state: image_load.table-texture-load-skip-read-aftercompiles, so its expected refusal is missing.Evidence and follow-up
Source-built words only. The 18-request counts are local and offline (
compile_dxil ... gfx1013-container-ms-texture-heap); the outputs are valid DXIL mesh shaders (dxc -dumpbin). Note:docs/experiments/native-mesh-table-texture-load.md.Checklist
AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T16:37:42Z.
Review: CHANGES_REQUESTED
The new 2D table-load path emits a Texture2D declaration and textureLoad.f32. An otherwise valid mesh table entry can carry DXGI_FORMAT_R8G8B8A8_UINT. mesh86_texture preserves that format, and mesh86_realize_texture checks the dimension, mip range and component mapping without checking the numeric type. The runtime can therefore create an integer SRV in the shader-visible heap for a shader that expects a float result.
Please reject incompatible integer views before issuing the draw, or select a shader variant whose result type matches the bound view. Cover the same guest mesh shader with R8G8B8A8_UNORM and R8G8B8A8_UINT in a binding test. The added DXIL fixture verifies the float declaration but does not bind either view.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T19:42:16Z.
Thanks, that was a real gap. Fixed in
9781e798, with the branch rebased onmain158ef794. I took the first option you suggested: incompatible integer views are rejected before the draw.Binder. The slot 86 material-texture branch now checks each table record in one function,
mesh86_table_texture, before anything is bound or uploaded. The lowering declares every table texture with a float result, so a UINT or SINT view refuses the draw withnative Mesh86 material texture has an integer format. UNORM, other float formats and the all-zero typed null bind as before.Binding test.
startup_mesh86_table_texture_probe_{warp,hardware}creates oneR8G8B8A8_TYPELESS2D texture through the guest API. It writes guest SRVs of that texture into a guest heap, then runs each 32-byte record through the binder's check. The check is reached through the fixture exportx2w_mesh86_table_texture_probe, the same pattern as the committed-root probe of #3718.R8G8B8A8_UNORM,Texture2DR8G8B8A8_UINT,Texture2DR8G8B8A8_SINT,Texture2DR8G8B8A8_UNORM,Texture2DArrayControl: without the integer check, the UINT row is bound and the test fails.
The test checks the binding decision, not a submitted
DispatchMesh. No test drives the native slot 86 binder through a real draw yet: the existing Mesh86 draw fixtures go through the published-cache path. If you want the full draw, I can add it as a follow-up.The pre-existing Texture1D heap map (
plan.mesh/plan.pixel_heapinbind_native_mesh86) also feedstextureLoad.f32from guest records without a numeric-type check. I left it alone to keep this PR to the table path, butmesh86_table_texture's format check could be reused there. Your call.Local, Windows Release,
9781e798:startup_mesh86_table_texture_probe_warpand_hardware: pass.native_direct_meshandnative_direct_container: pass.startup_mesh86_|startup_indirect_mesh|startup_indirect_draw|native_direct|native_fixed_mesh|mesh_set: 4 new failures, all_hardwaretests that stop atserialize root failedon this host without the Agility SDK. Their WARP twins are capability skips.cc mumba17: #3770 adds a branch right after this one in the same binder loop.
git merge-treemerges the two cleanly.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T02:42:07Z.
The new UINT/SINT controls cover color SRVs.
integer_uav_format()omits the stencil SRV formatsDXGI_FORMAT_X24_TYPELESS_G8_UINTandDXGI_FORMAT_X32_TYPELESS_G8X24_UINT.mesh86_realize_texture()explicitly accepts their stencil plane when the SRV and resource are compatible, so this float-result table path can still bind an integer stencil SRV. Please reject these SRV formats too and add a stencil-plane negative control.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T03:02:40Z.
Thanks. Fixed in
f8bc2888:mesh86_table_texturenow also refusesDXGI_FORMAT_X24_TYPELESS_G8_UINTandDXGI_FORMAT_X32_TYPELESS_G8X24_UINT, with the same "integer format" refusal. The check stays local to the Mesh86 table path, and the sharedinteger_uav_format()is unchanged.startup_mesh86_table_texture_probegains three records on depth-stencil textures:X24_TYPELESS_G8_UINT, plane 1)X32_TYPELESS_G8X24_UINT, plane 1)R24_UNORM_X8_TYPELESS, plane 0)Verification, release build, Windows 10 19045, RTX 3080 Ti (driver 32.0.16.1047, debug layer):
ctest --preset release -R 'mesh86_table_texture_probe|native_direct_mesh$':startup_mesh86_table_texture_probe_{warp,hardware}andnative_direct_meshpass.startup_mesh86_indexed_raw_hardware(#3807) fails here withserialize root failed (HRESULT 0x80070057), and fails the same way on main without this PR.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T07:02:28Z.
Review: APPROVED
Re-review of
1620be9d(fixes in9781e798andf8bc2888, then a merge of main). Read the diff and the CI log; not built or run.The finding from my earlier review is addressed.
mesh86_table_texture(src/startup_stubs/native_mesh86.inl) now checks each table record before anything is bound.integer_uav_format()covers the UINT/SINT color formats, and the two stencil SRV formats from the follow-up (X24_TYPELESS_G8_UINT,X32_TYPELESS_G8X24_UINT) are refused in the same place, while the depth plane still binds.startup_mesh86_table_texture_probe_{warp,hardware}exercises the same function with UNORM, UINT, SINT, wrong-dimension, both stencil-plane, D24 depth-plane and all-zero records. I agree that a fullDispatchMeshthrough the native binder can be a follow-up.About the failing
Build and test on Windowscheck on1620be9d: the only failure (1 of 273) isstartup_indirect_mesh_cache_heap_wide_warp. It stops attests/startup_indirect_mesh_cache_check.py:205, wheremarker, = work.glob('req_*.m86')finds no file. This PR does not modify that test. Its source part is a placeholder envelope with no shader code, so the newlower_meshimage branch is not reached, and the log shows the draw refused atmesh_profile_missingbefore any binding, somesh86_table_textureis not reached either. The same test passed onf8bc2888, and it passes on #3707 and #3825, which include a newer main. I don't think the failure comes from this change. Could the job be rerun so the required check covers the current head?Optional and not blocking: as you noted, the Texture1D heap-map path in
bind_native_mesh86could reuse the same format check. A linked issue would keep track of it.Approving
1620be9d; the rerun still has to pass before merge.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T18:47:50Z.
Review: APPROVED
Re-reviewed
a6ec98edafter the main update. The float table declaration and binder agree, including the typed null and refusals for integer/stencil formats. Independent MSVC Debugctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^native_direct_mesh$|^startup_mesh86_table_texture_probe_(warp|hardware)$'passed 3/3 on Windows 11 build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 with the debug layer enabled. The GPU-hosted cases exercise the binder probe and its controls. Trial merge intoefa6b78dwas clean.