Repository navigation
Conversation
R0Y00
left a comment
There was a problem hiding this comment.
Thanks for documenting the stack. #3819 has now landed by squash. Please rebase #3821 onto current main so the review diff contains only the physical-table changes, then rerun the listed manifest, WARP and hardware controls on the rebased head. The v4 manifest links compiler output to the draw path, so the next review will check both sides of that contract.
A raw fixed stage reads its descriptor table at physical byte offsets. A fixed-size buffer or texture read past the declared ranges of a resource table is no longer refused at translation: the manifest (version 4) marks it with a `tablecheck` line. At draw time the runtime requires a direct draw with the guest pipeline's root signature, a descriptor table parameter, and, at that heap offset, either a CBV record covering the required span or a typed texture SRV of the shader's dimension that does not alias a written target. Otherwise the draw is refused with a named reason. The slot 57 fixture can now bind the stream root signature and a position texture (X2W_TEST_SLOT57_POSITION_TEXTURE) to exercise the accepted and refused cases, including a span past the heap end and a texture in a buffer slot.
The declared range type does not reach a raw fixed stage. A texture read from a slot that the root signature declares as a CBV now takes the same physical table check: the draw requires a typed texture SRV record of the shader's dimension at that heap offset. Textures in UAV ranges and buffers outside CBV and SRV ranges stay refused.
959b6ff to
c72d70f
Compare
|
Rebased onto Heads-up on an interaction with #3792: this PR adds |
Problem
A raw fixed graphics stage (a PSI1 pair without reflection) reads its descriptor table at the byte offsets compiled into the shader. The declared ranges of the root signature do not reach such a stage, so two reads that the shader really performs are refused at translation with
graphics descriptor range does not cover resource:Translation cannot decide whether such a read is valid. That depends on what the guest has written at that heap offset when the draw is issued.
Change
This PR is stacked on #3819 (EXECZ/WQM), because its tests use the
root_signature()andTABLE_ROOThelpers added there. Only the last two commits belong to this PR. I will rebase it ontomainonce that one lands.Translation (
src/direct_compute_cache.cpp,src/gfx1013_compute_native.h). For a raw fixed stage only, a binding that the declared ranges do not cover keeps the shader's own byte offset and is marked for a draw-time check when all of these hold:Everything else keeps the refusal: non-fixed entries, sampler tables, textures in UAV ranges, and buffers in UAV ranges.
Shared interface: the graphics manifest. A pair with at least one marked binding is written as
x2w-manifest 4, with onetablecheck <srv index> <required bytes>line per marked binding (0bytes for a texture). Pairs without marked bindings keep their current manifest version and content. The cached pair payload gains one leading word for the mark set.Draw time (
src/startup_stubs/d3d12_draw.inl). The runtime accepts version 4 only if everytablecheckline is well formed and refers to a table SRV. A pipeline with marked bindings then draws only if:If a condition fails, the draw is refused and nothing is substituted. The refusal is recorded with a named reason (
physical_table_root_refusedorphysical_table_view_refused, for examplemissing typed texture SRV recordormissing CBV record or insufficient CBV span).Related open work: #3818 and #3100 also touch
d3d12_draw.inl, and #3792 touchesdirect_compute_cache.cpp. As far as I can see none of them changes the table range check or the manifest version, so I expect textual rebases only. #3772 filters descriptor history for diagnostics and does not overlap in behaviour.Old cached pairs are not reused:
X2W_NATIVE_SHADER_REVISIONhashesdirect_compute_cache.cppandgfx1013_compute_native.h, so the pair cache keys change with this patch.A scalar buffer load whose SOFFSET is an SGPR has no fixed bound, so such a binding stays refused when it lies outside the declared ranges.
Validation
Windows, MSVC.
compile_dxilneedsDXC_BIN_DIR. GPU tests were run serially.These tests pass on WARP and on a hardware adapter on the exact head of this PR, and a 300 s run of a guest application on it showed no device loss.
Translation cases in
tests/native_fixed_graphics_psi1_check.py:physical-cbv, cold and cached: manifest version 4 withtablecheck 0 32;cbv-range-texture: version 4 withtablecheck 0 0;srv-range-textureandordinary-table-slot: the ordinary binding, without atablecheckline;physical-cbv-no-fixed-entry,physical-cbv-sampler-table,uav-range-texture,uav-range-buffer.Draw cases in
tests/startup_native_slot57_packed_position_check.py. Each one compares the rendered pixels and requires that the debug layer reports no error or corruption:To drive these cases, the slot 57 fixture can now bind the stream root signature and a position texture (
X2W_TEST_SLOT57_POSITION_TEXTURE).startup_address_srvandstartup_stream_draware in the filter because they share that harness. The fixtures are hand-assembled instruction words and generated root signatures written for these tests.Beyond the fixtures: in a run of a guest application,
graphics descriptor range does not cover resourceno longer appeared for the pipelines that had it. That is a local observation. The public fixtures verify the manifest contract and the accept and refuse decisions listed above, not that run.Checklist