identity: texture slots are the set-1 elements their pushed resource IDs name
Under the identity domains a kernel's texture slots now lower. A slot's gpuResourceID is pushed as its PushField::SlotGuestBase (the index in the low word, the word in the high one). Its texture is the element at that index of one of set 1's two fixed arrays: binding 0, SAMPLED_IMAGE x 65,536, and binding 1, STORAGE_IMAGE x 4,096. Each is partially bound, updated after binding and while unused elements are pending, and seen by every stage, with the same layout for every pipeline (BindingSource::IdentityArray). Each image class the kernel declares (shape, numeric type and depth comparison, sampled, or storage without a format) is a variable of its descriptor type's binding. The slot binds no descriptor and declares no specialization constant: - is_null_texture answers whether the index is 0. Nil needs nothing else in the shader, since element 0 of each array is a null descriptor (the device test ofba4454b05b). - A read the shader checks itself takes Metal's out-of-bounds alpha of 1 from bit 12 of the word (TextureWord::OUT_OF_BOUNDS_ALPHA_ONE). - The ResourcePresence and OutOfBoundsAlpha facts are not stated there. No binder chooses a variant under identity, so a slot reads whatever texture its ID names through the plain form: - the variant facts (cross-class reads, planes read in place, texel rows, texture-buffer parts) are not stated; - a float or half read takes the device's sRGB decode with PrecisionNote::SrgbTexelDecode (VkProperty::MetalSampler on MoltenVK), as a heap element's does, with no SrgbTexture twin; - no texture is sparse (the consumer refuses one): no write-dropping SparseTexture constant and no ConstantLanes; - a storage slot is formatless with no StorageTextureFormat fact. Where the device cannot access it without a format, the slot is refused as Unsupported{IdentityDomains} instead of asking for an input no consumer gives there. Admission stays typed. Under identity, a function is refused as Unsupported{IdentityDomains}, not implemented, if it: - samples (any sampler plan; Metal's own sampler as a requirement is allowed); - reaches textures through argument buffers (any heap group); - declares a slot with no identity class: texture buffers, level views, cube-as-array, planes, extended range, RGBX, ulong, or a storage image with a format; - uses a slot whose state comes from anything but its ID: border texels, sparse residency arms, a half conversion by the bound format, swizzles, offset bases; - carries a fact naming such state (identity_unsourced). That keeps the arm64-only forms (two-plane, extended range, sRGB twins) out of the identity domains, as the x86 scope wants. The old binder refuses an identity array as an internal error, since the consumer writes those arrays. SEMANTICS_VERSION 2150 (identity output changes), ARTIFACT_FORMAT_VERSION 529 (BindingSource gains IdentityArray). docs/RESOURCE-ID.md says what the arrays are and what the shader reads of an ID. docs/API.md says what the identity domains lower. The refusal surface and the API signatures are regenerated. The blessed table also gains metal2vulkan-rt::PrecisionNote::CappedLodBias, a variant development's table lacked. Verified, on developmentcfa389aa9b(check commit 564d131163, same tree): - msi, job m3-max-41519: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc -D warnings, and nextest of metal2vulkan's whole suite: 3672 tests run, 3672 passed, 20 skipped. - msi, job m3-max-41520: clippy of metal2vulkan under --cfg m2v_gpu and --cfg m2v_cpu_icd, both clean. - The new test, texture_slots_are_the_set_1_elements_their_pushed_resource_ids_name, runs on lavapipe, moltenvk-m3, and moltenvk-m3 without robustImageAccess2. Its words come from tests/resource_words.tsv rows 70 and 10, checked against TextureWord::of. It checks the fixed set-1 layout and that the pushed fields are exactly the buffer, the three texture IDs and the region. On the interpreter, with the source at sampled element 3 and the destination at storage element 2, it checks the reads, the writes, the width and is_null_texture both ways (index 0 and index 1). On moltenvk-m3 without robustImageAccess2, where the shader checks the read, the source image traps any access outside it and the out-of-bounds alpha comes from bit 12 of the word: 1.0 for R8Unorm, 0.0 for RGBA8Unorm. On the other two profiles the device's robust texel answers. - The same change on the earlier base 9a3b6587b2 (jobs m3-max-41478 and 41479): 3670 of 3670, clippy clean in all three configurations.
This commit is contained in:
1 parent
1ceaea8eec
commit
fa52012831
16 files changed
+736
-72
No files matched your search
+11
-2
@@ -117,8 +117,17 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
|
||||
the window always holds. A kernel that reads a grid builtin reads `PushField::DispatchRegion` on
|
||||
every dispatch, with no `MultiRegion` constant: a dispatch the host knows states Metal's grid
|
||||
and its piece's first threadgroup there, and an indirect dispatch a zero grid, whose kernel
|
||||
takes `NumWorkgroups` times its workgroup size. So far they lower a kernel that reaches memory
|
||||
only through its buffer slots; any other function is refused as `Unsupported{IdentityDomains}`.
|
||||
takes `NumWorkgroups` times its workgroup size. A texture slot's `gpuResourceID` is pushed as
|
||||
its `PushField::SlotGuestBase`, and its texture is the element at the ID's index of set 1's two
|
||||
fixed arrays, the same layout for every pipeline ([RESOURCE-ID.md](RESOURCE-ID.md)); it binds no
|
||||
descriptor of its own and declares no specialization constant. No binder chooses a variant
|
||||
there: a slot reads whatever texture its ID names through the plain form, its `float` or `half`
|
||||
reads take the device's sRGB decode with `PrecisionNote::SrgbTexelDecode`, as a heap element's
|
||||
do, and no texture is sparse (the consumer refuses a sparse texture). So far they lower a
|
||||
kernel that reaches memory through its buffer slots and reads, writes, sizes or tests for nil
|
||||
its texture slots. Any other function is refused as `Unsupported{IdentityDomains}`: one that samples, uses
|
||||
an argument buffer's textures, a texture buffer, a slot's levels or swizzle, a two-plane,
|
||||
extended-range or sRGB-twin form, or any other state of a bound texture beyond its ID.
|
||||
- **The model's linear sample of planes read in place** (`YCbCrInPlacePolicy::Model`, the
|
||||
default; changes emitted code). On an integrated GPU or a CPU device a function that only
|
||||
samples, gathers or sizes a `YCBCR8_420_2P` or `YCBCR10_420_2P` texture reads its planes' codes
|
||||
|
||||
Reference in new issue
Block a user