Repository navigation
shader, runtime: lower mesh table texture loads and refuse integer views - #3712
lukaslw-lab wants to merge 6 commits into
Conversation
Leyukaka
left a comment
There was a problem hiding this comment.
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.
The mesh frontend accepted image loads only through the Texture1D heap slot map. Route an image_load (opcode 0, no D16) whose eight descriptor words come from a descriptor table to the shared image_io, as the other stages do: it checks the opcode, modifiers and descriptor words, binds the table record as a texture SRV of the encoded dimension and emits textureLoad. The slot 86 runtime already resolves such a view from the table record. Under a narrowed EXEC each written channel is a partial write, as for buffer loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mesh frontend lowers a 2D table load to Texture2D<float4> and textureLoad.f32, but a table record can hold an integer view such as R8G8B8A8_UINT. Check each material texture record in mesh86_table_texture before anything is bound or uploaded, and refuse UINT and SINT views. startup_mesh86_table_texture_probe runs guest UNORM, UINT, SINT, 2D-array and empty records of one typeless texture through the same check via a fixture export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ba82316 to
9781e79
Compare
|
Thanks, that was a real gap. Fixed in Binder. The slot 86 material-texture branch now checks each table record in one function, Binding test.
Control: without the integer check, the UINT row is bound and the test fails. The test checks the binding decision, not a submitted The pre-existing Texture1D heap map ( Local, Windows Release,
cc mumba17: #3770 adds a branch right after this one in the same binder loop. |
…_check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The new UINT/SINT controls cover color SRVs. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. Fixed in
Verification, release build, Windows 10 19045, RTX 3080 Ti (driver 32.0.16.1047, debug layer):
AI-assisted. |
Leyukaka
left a comment
There was a problem hiding this comment.
Re-review of 1620be9d (fixes in 9781e798 and f8bc2888, 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 full DispatchMesh through the native binder can be a follow-up.
About the failing Build and test on Windows check on 1620be9d: the only failure (1 of 273) is startup_indirect_mesh_cache_heap_wide_warp. It stops at tests/startup_indirect_mesh_cache_check.py:205, where marker, = 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 new lower_mesh image branch is not reached, and the log shows the draw refused at mesh_profile_missing before any binding, so mesh86_table_texture is not reached either. The same test passed on f8bc2888, 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_mesh86 could reuse the same format check. A linked issue would keep track of it.
Approving 1620be9d; the rerun still has to pass before merge.
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