Take new textures' pattern reads at the commit, in commit order, not as encoded
What: a command buffer now logs its commands' reads and writes of noted new textures (`fresh_unwritten.rs`'s FreshLog: pass loads, clears, resolves, blit writes and reads, shader reads, and a pass's load of a signed-depth pattern) in encode order, and its commit replays the log against the device's record under one lock, before the scheduler sees it, announcing `fresh-pattern-zeroed`, `device-nan-encoding` (a fresh texture's converted NaNs) and `signed-depth-test` (a loaded signed-NaN depth pattern) there. A command buffer dropped uncommitted takes nothing; a refused commit's log is discarded. With no noted texture a command reads one flag and logs nothing, and a commit reads it once. Why: the record followed encode order, so a queue's command buffers encoded out of commit order (the consumer's host encodes one queue on several threads, then commits in order) announced a read Metal never makes (a load after a committed-earlier clear, encoded first: a precision note the consumer makes fatal) and missed one it makes (a load before a committed-later clear, encoded after it: the texture read zero where Metal reads its pattern, unannounced). Metal runs a queue's command buffers in commit order. Tests: runtime_lane::parallel_encodes::a_fresh_texture_s_pattern_notice_follows_the_commit_order runs two command buffers of depth-only passes (4-sample and single-sample Depth32Float, clear-then-load and load-then-clear) serially and with the later-committed one encoded whole first on another thread, and requires the same notices both ways and Metal's reads of the pattern. Before the fix it failed on the M3 Max (MoltenVK 1.4.2): 1 notice instead of 0, and 0 instead of 1. The same module's a_shadowed_texture_keeps_each_command_buffer_s_bytes (a texture over a Private buffer at 48-byte rows, eight command buffers on four threads) checks every copy and read against its own command buffer's words and prints the copies in. Docs: fresh_unwritten.rs's Observed and Order bullets, the FreshPatternZeroed and SignedDepthTest declarations, docs/API.md's catalogue entries. Verified on the M3 Max under --cfg m2v_gpu: the new test passes; so do runtime_lane's fresh_writes, fresh_contents, depth_denormals, degrade_notices, made_at_creation, texture_blits, renders, sample_copies, nan_resolves, buffer_depth_samples, compressed_blits, color_fills, color_writes, cross_class_storage and half_* modules, and the runtime's tests::fresh_unwritten and tests::heap_tiled (118 tests); degradation_catalogue passes. clippy -D warnings clean for the runtime crate (plain). (cherry picked from commit 95d7bdf6dc8c6e411114b2d9a8203ea1e4970168)
This commit is contained in:
1 parent
87cdea9b49
commit
48ec97832d
10 files changed
+745
-136
No files matched your search
+7
-4
@@ -1859,8 +1859,10 @@ bound.
|
||||
texture Metal keeps losslessly compressed reads a fixed pattern in Metal, which the device cannot
|
||||
write exactly into its image: a NaN depth where a copy into a depth image may store it clamped or
|
||||
the image is multisampled, a NaN texel of a multisampled image (whose bits a clear leaves to the
|
||||
device), or an image holding other bytes than Metal's texel. Cost: the new texture reads zero
|
||||
where Metal reads its fixed pattern until a write.
|
||||
device), or an image holding other bytes than Metal's texel. Announced at the commit of the
|
||||
command buffer whose command first reads a texel of that content no clear, resolve or blit
|
||||
covered, in commit order, whatever order or thread the command buffers were encoded in. Cost:
|
||||
the new texture reads zero where Metal reads its fixed pattern until a write.
|
||||
- `metal2vulkan-degrade-zeroed-index-fetch` (precision). `ZeroedIndexFetch`: An indexed draw from an
|
||||
index offset at or past its index buffer's length draws index 0 plus the base vertex at each
|
||||
position, a direct draw from a zero-padded copy and an indirect one through the index bounds pass,
|
||||
@@ -2743,8 +2745,9 @@ bound.
|
||||
a pass with depth writes that may store such a value with its sign, where Metal's test compares
|
||||
the stored value's magnitude (a NaN above +inf) and its pass with depth writes stores every texel
|
||||
no fragment wrote without its sign. Announced at a write that may give a render target's depth
|
||||
such a value, or at the pass that loads a new texture's pattern (a NaN with the sign set) before a
|
||||
write covered it, on a device that keeps such a value in a depth image:
|
||||
such a value, or at the commit of a pass that loads a new texture's pattern (a NaN with the sign
|
||||
set) before a write covered it in commit order, on a device that keeps such a value in a depth
|
||||
image:
|
||||
`VK_EXT_depth_range_unrestricted` enabled, or `DriverFact::DepthImageKeepsValuesOutsideUnitRange`
|
||||
(elsewhere `restricted-depth-upload` is announced). MoltenVK's test is Metal's own
|
||||
(`DriverFact::DepthTestComparesMagnitudes`): there it is announced at a pass that loads and stores
|
||||
|
||||
Reference in new issue
Block a user