Docs, versions and API tables: the level-0 elements and unnormalized twins

The runtime's README describes set 1's sampled-image array of 196,608 elements (textures, second
elements, level-0 elements) and the plain sampler array's 8,000 unnormalized twins, the level-0
element written at the first dispatch or draw that samples a texture through a state that reads
unnormalized (Gauges::level_zero_views), the floor's limits (sampled images 262,144, samplers
32,000, per-stage resources 458,752, all pools 490,752; Vulkan's least with descriptorIndexing is
500,000), and attachment reads on every device. docs/RESOURCE-ID.md gives the two ranges, the word
test and what a consumer laying the arrays out itself writes; an argument buffer's sampler still
scales a pixel coordinate. The API signature table is blessed and api_surface names the two consts.

Versions: SEMANTICS_VERSION 2375 (slot pixel samples gain the exact arm, and the interface's
level_zero_samplers), ARTIFACT_FORMAT_VERSION 610 (TextureSlot's codec gains level_zero_samplers),
RUNTIME_VERSION 2574 (set 1's sizes, twins, level-0 elements and the floor's limits).
REFUSALS.md regenerated with no change.
This commit is contained in:
Anees Iqbal committed 2026-12-03 16:17:56 -08:00
1 parent 8f69218029
commit 43f22a5661
5 files changed
+102 -57

No files matched your search

+65 -52
View File
@@ -1763,19 +1763,20 @@ exported block, an exported surface in either form, and a Direct3D 11 import.
Shaders reach textures and samplers by index (`docs/RESOURCE-ID.md`). Every pipeline takes set 1,
one descriptor set the device makes at creation, of seven arrays whose element `i` is the object
whose `gpuResourceID` holds index `i`: 65,536 sampled textures (binding 0), 65,536 storage
textures and then 65,536 level elements (binding 1), 8,000 samplers of each use, plain, depth comparison and integer texture
(bindings 2, 3 and 4), and 65,536 uniform and 65,536 storage texel buffers, the texture buffers
(bindings 5 and 6). A texture's index is the same element of both texture arrays: one with a
storage view takes both, any other the sampled one alone, and its storage element stays null. A
texture buffer's index is the same element of both texel-buffer arrays: the uniform one where
shaders read it, the storage one where they write it, the other null; its texture elements stay
null, as a texture's texel-buffer elements do. Every binding is partially bound, updated after bind and
updated while unused elements are pending, so an object's element is written once, as it is
made, with no lock, and never rewritten for layouts.
whose `gpuResourceID` holds index `i`: 65,536 sampled textures and then 65,536 second elements and
65,536 level-0 elements (binding 0), 65,536 storage textures and then 65,536 level elements (binding
1), 8,000 samplers of each use, plain, depth comparison and integer texture (bindings 2, 3 and 4),
the plain array's followed by their 8,000 unnormalized twins, and 65,536 uniform and 65,536 storage
texel buffers, the texture buffers (bindings 5 and 6). A texture's index is the same element of both
texture arrays: one with a storage view takes both, any other the sampled one alone, and its storage
element stays null. A texture buffer's index is the same element of both texel-buffer arrays: the
uniform one where shaders read it, the storage one where they write it, the other null; its texture
elements stay null, as a texture's texel-buffer elements do. Every binding is partially bound,
updated after bind and updated while unused elements are pending, so an object's element is written
once, as it is made, with no lock, and never rewritten for layouts.
- Where the device reads attachments (Floor, Attachment reads), binding 0 holds 131,072
elements: element `i + 65,536` is texture `i`'s second element, which a draw pushes in place of
- Binding 0's elements 65,536 to 131,071 are second elements: element `i + 65,536` is texture
`i`'s second element, which a draw pushes in place of
the texture's own index while it reads an attachment of its pass through the texture. Through
the attachment feedback loop it is the texture's view in the feedback layout, written with
element `i` for a texture whose image a pass may move there (a colour render target not in place
@@ -1800,6 +1801,22 @@ made, with no lock, and never rewritten for layouts.
does not run. No grant and no resource ID reaches the level elements.
`Metrics::level_field_commands` counts the dispatches and draws that push a texture's level
count, these and those of a function that asks `get_num_mip_levels` of a storage texture.
- Binding 0's elements 131,072 to 196,607 are level-0 elements, and binding 2's elements 8,000 to
15,999 unnormalized twins. A sample or gather through a sampler slot whose state reads pixel
coordinates (`SamplerWord::reads_unnormalized`: nearest or linear filters alike for min and
mag, no mip filter, no anisotropy, and s and t clamped to the edge, to zero or to the border)
of a 1D or 2D texture slot, with no compare (`TextureSlot::level_zero_samplers`), samples at
the coordinate Metal gives, at level 0, through the state's twin at element `s + 8,000`, the
same sampler with Vulkan's unnormalized coordinates, and the texture's level-0 element at
`i + 131,072`. A state whose word reads so writes its twin as it is made, and a twin of each of
its LOD clamp variants; every other twin is the default sampler. The first dispatch or draw
that binds a texture to such a slot while such a state is bound beside it writes the texture's
level-0 element: a texture of one level its own sampled view, one of more its view of its first
level alone, which it owns (`Gauges::level_zero_views`, one per texture, however many states
sample it), made then and not at the texture's making. A later bind makes nothing. The view goes
with the texture, once its work has retired, and its element is null again; a texture that is
not one layer of a 1D or 2D texture writes none, and samples zeros there. No grant and no
resource ID reaches either range.
- A shader masks the index of a texture ID it reads from an argument buffer to its low 16 bits,
so a bad ID there reads the element at `index & 0xFFFF`, never one outside the arrays. A slot's
index is the runtime's own push, unmasked, and no argument buffer's ID reaches the feedback
@@ -1884,7 +1901,7 @@ made, with no lock, and never rewritten for layouts.
the usage. `TextureUsage` with no bits is Metal's unknown usage: shader read and write, render
target and pixel-format view.
- The image's usage is the descriptor's plus transfer source and destination, and, for a colour
render target where the device reads attachments, sampled, with the feedback usage where it has
render target, sampled, with the feedback usage where it has
the attachment feedback loop (Render encoders). Its home layout is general where it has a storage
element, shader-read-only where shaders only read it, and the attachment layout where only render
passes use it. Its elements of set 1 are written before the call returns, with that layout, and
@@ -5516,8 +5533,8 @@ cache is answered compile-required on both.
the rectangles set where several are, each cut to the pixels its viewport covers. The index is
stored as the function writes it, as a layer index is (Layered rendering, below).
- A draw may read an attachment of its own pass through a texture, as Metal reads a render
target, where the device reads attachments (Floor, Attachment reads): through the attachment
feedback loop where the device has it, else through a copy. The texture reaches the
target (Floor, Attachment reads): through the attachment feedback loop where the device has it,
else through a copy. The texture reaches the
attachment's level and layer, the fragment function reads it and nothing writes it, and its
image is a colour render target, which one attachment of the pass renders. A texture in place
over a buffer is read through the loop where its linear image took the feedback usage, else
@@ -6670,39 +6687,40 @@ pipeline states). So `Device::extensions` names the extension only with its feat
### Limits
The descriptor limits are what the runtime's fixed arrays need: 65,536 sampled textures, 65,536
storage textures and 65,536 level elements, 65,536 read and 65,536 written texture buffers, and three arrays of 8,000
samplers, one per use (plain, depth comparison, integer texture): 4,000 indices and 4,000 variant
elements each (Set 1 and index grants). A read texture buffer (a uniform texel buffer) counts
against the sampled-image limits and a written one (a storage texel buffer) against the
storage-image limits. Vulkan requires at least 500,000 of each texture and sampler limit and of
the two resource totals on a device that supports `descriptorIndexing`, as every lab device does.
4,000 is Vulkan's minimum `maxSamplerAllocationCount`. Of the lab's devices, the least
The descriptor limits are what the runtime's fixed arrays need: 65,536 sampled textures with their
65,536 second elements and 65,536 level-0 elements, 65,536 storage textures and 65,536 level
elements, 65,536 read and 65,536 written texture buffers, and three arrays of 8,000 samplers, one
per use (plain, depth comparison, integer texture): 4,000 indices and 4,000 variant elements each,
the plain array's followed by their 8,000 unnormalized twins (Set 1 and index grants). A read
texture buffer (a uniform texel buffer) counts against the sampled-image limits and a written one (a
storage texel buffer) against the storage-image limits. Vulkan requires at least 500,000 of each
texture and sampler limit and of the two resource totals on a device that supports
`descriptorIndexing`, as every lab device does. 4,000 is Vulkan's minimum
`maxSamplerAllocationCount`. Of the lab's devices, the least
`maxPerStageDescriptorUpdateAfterBindSamplers` and `maxDescriptorSetUpdateAfterBindSamplers` is
500,000 (MoltenVK on an Apple M3 Max) and the least `maxUpdateAfterBindDescriptorsInAllPools`
1,048,576 (Intel UHD Graphics 630 on Windows). The compute limits let a threadgroup take
Metal's 1,024 threads in any shape up to 1,024 by 1,024 by 64. `maxColorAttachments` holds
Metal's eight color attachments on every device; Vulkan 1.3 requires 4 of it, and Vulkan 1.4 8.
1,048,576 (Intel UHD Graphics 630 on Windows). The compute limits let a threadgroup take Metal's
1,024 threads in any shape up to 1,024 by 1,024 by 64. `maxColorAttachments` holds Metal's eight
color attachments on every device; Vulkan 1.3 requires 4 of it, and Vulkan 1.4 8.
`maxFragmentOutputAttachments` holds a fragment function's output to each of them; Vulkan 1.3 and
1.4 require 4 of it, and Roadmap 2026 8.
A Boolean limit's minimum is 1,
`VK_TRUE`; `timestampValidBits` is the queue family's. No `maxPushConstantsSize` is asked: the
push window, and the pipeline layout's one push range, is the device's `maxPushConstantsSize` up to
256 bytes (`metal2vulkan::device::DeviceProfile::push_window`), at least Vulkan's least, 128, and a
function's fields past it go to a parameter block whose address the window holds. On a device
below 256 an indirect command reaches fewer vertex slots (Known gaps of indirect command buffers).
1.4 require 4 of it, and Roadmap 2026 8. A Boolean limit's minimum is 1, `VK_TRUE`;
`timestampValidBits` is the queue family's. No `maxPushConstantsSize` is asked: the push window, and
the pipeline layout's one push range, is the device's `maxPushConstantsSize` up to 256 bytes
(`metal2vulkan::device::DeviceProfile::push_window`), at least Vulkan's least, 128, and a function's
fields past it go to a parameter block whose address the window holds. On a device below 256 an
indirect command reaches fewer vertex slots (Known gaps of indirect command buffers).
| Limit | Minimum | Used for |
|---|---|---|
| `maxPerStageDescriptorUpdateAfterBindSampledImages` | `131072` | the sampled-texture and read texture-buffer arrays |
| `maxDescriptorSetUpdateAfterBindSampledImages` | `131072` | the sampled-texture and read texture-buffer arrays |
| `maxPerStageDescriptorUpdateAfterBindSampledImages` | `262144` | the sampled-texture array with its second and level-0 elements, and the read texture-buffer array |
| `maxDescriptorSetUpdateAfterBindSampledImages` | `262144` | the sampled-texture array with its second and level-0 elements, and the read texture-buffer array |
| `maxPerStageDescriptorUpdateAfterBindStorageImages` | `196608` | the storage-texture array with its level elements, and the written texture-buffer array |
| `maxDescriptorSetUpdateAfterBindStorageImages` | `196608` | the storage-texture array with its level elements, and the written texture-buffer array |
| `maxPerStageDescriptorUpdateAfterBindSamplers` | `24000` | the three sampler arrays; the lab's least is 500,000 |
| `maxDescriptorSetUpdateAfterBindSamplers` | `24000` | the three sampler arrays; the lab's least is 500,000 |
| `maxPerStageDescriptorUpdateAfterBindSamplers` | `32000` | the three sampler arrays and the plain array's twins; the lab's least is 500,000 |
| `maxDescriptorSetUpdateAfterBindSamplers` | `32000` | the three sampler arrays and the plain array's twins; the lab's least is 500,000 |
| `maxSamplerAllocationCount` | `4000` | Vulkan's minimum: live samplers |
| `maxPerStageUpdateAfterBindResources` | `327680` | the four texture and texture-buffer arrays, the level elements among them, in one stage; a fragment stage needs its `maxColorAttachments` more |
| `maxUpdateAfterBindDescriptorsInAllPools` | `351680` | all seven arrays; the lab's least is 1,048,576 |
| `maxPerStageUpdateAfterBindResources` | `458752` | the four texture and texture-buffer arrays, the second, level-0 and level elements among them, in one stage; a fragment stage needs its `maxColorAttachments` more |
| `maxUpdateAfterBindDescriptorsInAllPools` | `490752` | all seven arrays; the lab's least is 1,048,576 |
| `maxComputeWorkGroupInvocations` | `1024` | Metal's most threads per threadgroup |
| `maxComputeWorkGroupSize[0]` | `1024` | a threadgroup's width |
| `maxComputeWorkGroupSize[1]` | `1024` | a threadgroup's height |
@@ -6810,19 +6828,14 @@ blocks), and only that call makes a sparse buffer. Elsewhere the call refuses.
### Attachment reads
A draw that reads, through a texture, an attachment its own pass renders (Metal's read of a
render target) is built where the device's descriptor limits hold the sampled-texture array's
second elements beside the floor's arrays: 65,536 sampled images more than the limits above name
(`maxPerStageDescriptorUpdateAfterBindSampledImages`,
`maxDescriptorSetUpdateAfterBindSampledImages`, `maxPerStageUpdateAfterBindResources` and
`maxUpdateAfterBindDescriptorsInAllPools`); a device without them refuses such a draw
(`Gap::Draw` of `DrawKind::AttachmentRead`), and is otherwise the same
(`floor::Capabilities::attachment_reads`). The draw reads through the attachment feedback loop
where the device also lists the extension marked "with the feedback loop" above and reports the
feature below, which device creation then enables, and neither otherwise
(`floor::Capabilities::feedback_loop`). A device that reads attachments without them reads
through a copy of the image into its shadow (Render encoders), a known gap. AMD's Windows driver
is expected to take the loop, not verified in the lab (public reports of it list
A draw that reads, through a texture, an attachment its own pass renders (Metal's read of a render
target) is built on every device: the floor's limits above hold the sampled-texture array's second
elements (`floor::Capabilities::attachment_reads` is always true). The draw reads through the
attachment feedback loop where the device also lists the extension marked "with the feedback loop"
above and reports the feature below, which device creation then enables, and neither otherwise
(`floor::Capabilities::feedback_loop`). A device that reads attachments without them reads through a
copy of the image into its shadow (Render encoders), a known gap. AMD's Windows driver is expected
to take the loop, not verified in the lab (public reports of it list
`VK_EXT_attachment_feedback_loop_layout` from 2.0.250 on).
| Attachment-read feature | Structure | Used for |
+3 -3
View File
@@ -60,7 +60,7 @@ mod tests;
/// unchanged version, and its bless records the version. Independent of the crate's version and of
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
/// history.
pub const SEMANTICS_VERSION: u32 = 2374;
pub const SEMANTICS_VERSION: u32 = 2375;
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
@@ -70,7 +70,7 @@ pub const SEMANTICS_VERSION: u32 = 2374;
/// re-typed in an encoded type, its `codec` body or its `envelope`. A variant removed while its tag
/// stays unused needs no bump: an entry holding it fails to decode, which is a miss. The commit that
/// bumps it says what changed; this comment keeps no history.
pub const ARTIFACT_FORMAT_VERSION: u32 = 609;
pub const ARTIFACT_FORMAT_VERSION: u32 = 610;
/// The version of what this crate gives a runtime for the runs of a compiled pipeline, beside the
/// compile: the device a run opens and what it enables, the Vulkan and Metal vocabularies a runtime
@@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 609;
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
/// keeps no history.
pub const RUNTIME_VERSION: u32 = 2573;
pub const RUNTIME_VERSION: u32 = 2574;
/// Writes a digest as lowercase hex.
pub(crate) fn write_hex(f: &mut fmt::Formatter<'_>, name: &str, hash: &Hash256) -> fmt::Result {
@@ -116,6 +116,10 @@ assoc-const metal2vulkan::metal::sampler::SamplerWord::PIXEL_COORDINATES pub con
assoc-const metal2vulkan::metal::sampler::SamplerWord::READ_STATE pub const READ_STATE: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::REDUCTION pub const REDUCTION: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::REDUCTION_SHIFT pub const REDUCTION_SHIFT: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_FILTERS pub const UNNORMALIZED_FILTERS: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_LINEAR pub const UNNORMALIZED_LINEAR: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_MODES pub const UNNORMALIZED_MODES: [u32; 3]
assoc-const metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_NEAREST pub const UNNORMALIZED_NEAREST: u32
assoc-const metal2vulkan::pipeline::AccessSet::READ pub const READ: AccessSet
assoc-const metal2vulkan::pipeline::AccessSet::READ_WRITE pub const READ_WRITE: AccessSet
assoc-const metal2vulkan::pipeline::AccessSet::UNUSED pub const UNUSED: AccessSet
@@ -284,6 +288,10 @@ assoc-const-value metal2vulkan::metal::sampler::SamplerWord::PIXEL_COORDINATES 1
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::READ_STATE Self::MIP_FILTER | Self::ADDRESS[0] | Self::ADDRESS[1] | Self::ADDRESS[2] | Self::BORDER
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::REDUCTION 0b11 <<Self::REDUCTION_SHIFT
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::REDUCTION_SHIFT 19
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_FILTERS Self::PIXEL_COORDINATES | Self::MIN_LINEAR | Self::MAG_LINEAR | Self::MIP_FILTER | Self::ANISOTROPIC
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_LINEAR Self::PIXEL_COORDINATES | Self::LINEAR
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_MODES [0, 4, 5]
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::UNNORMALIZED_NEAREST Self::PIXEL_COORDINATES
assoc-const-value metal2vulkan::pipeline::AccessSet::READ AccessSet
assoc-const-value metal2vulkan::pipeline::AccessSet::READ_WRITE AccessSet
assoc-const-value metal2vulkan::pipeline::AccessSet::UNUSED AccessSet
@@ -405,8 +413,10 @@ const metal2vulkan::metal::vertex::MAX_VERTEX_ALIGNMENT pub const MAX_VERTEX_ALI
const metal2vulkan::pipeline::COMPILED_STAGE_WEIGHT pub const COMPILED_STAGE_WEIGHT: u64
const metal2vulkan::pipeline::DEEP_THREADGROUP pub const DEEP_THREADGROUP: u32
const metal2vulkan::pipeline::GRID_TILE_THREADS pub const GRID_TILE_THREADS: u32
const metal2vulkan::pipeline::LEVEL_ZERO_ELEMENT pub const LEVEL_ZERO_ELEMENT: u32
const metal2vulkan::pipeline::NONUNIFORM pub const NONUNIFORM: u32
const metal2vulkan::pipeline::SEQ_CST_FENCE_WORD pub const SEQ_CST_FENCE_WORD: u64
const metal2vulkan::pipeline::UNNORMALIZED_TWIN_ELEMENT pub const UNNORMALIZED_TWIN_ELEMENT: u32
const-value metal2vulkan-air::bitstream::BLOCKINFO_BLOCK_ID 0
const-value metal2vulkan-air::bitstream::TOP_LEVEL_ABBREV_WIDTH 2
const-value metal2vulkan-air::budget::BITSTREAM_NESTING 64
@@ -468,8 +478,10 @@ const-value metal2vulkan::metal::vertex::MAX_VERTEX_ALIGNMENT 4
const-value metal2vulkan::pipeline::COMPILED_STAGE_WEIGHT 39_014
const-value metal2vulkan::pipeline::DEEP_THREADGROUP 64
const-value metal2vulkan::pipeline::GRID_TILE_THREADS 256
const-value metal2vulkan::pipeline::LEVEL_ZERO_ELEMENT 2 * IDENTITY_TEXTURES
const-value metal2vulkan::pipeline::NONUNIFORM 1
const-value metal2vulkan::pipeline::SEQ_CST_FENCE_WORD 256
const-value metal2vulkan::pipeline::UNNORMALIZED_TWIN_ELEMENT 8_000
enum metal2vulkan-air::abi::AbiHandle #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum AbiHandle
enum metal2vulkan-air::abi::AbiInt #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum AbiInt
enum metal2vulkan-air::abi::AccelerationStructureKind #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum AccelerationStructureKind
@@ -2769,6 +2781,7 @@ field metal2vulkan::pipeline::TextureAccess.write pub write: bool
field metal2vulkan::pipeline::TextureSlot.access pub access: TextureAccess
field metal2vulkan::pipeline::TextureSlot.declared_format pub declared_format: bool
field metal2vulkan::pipeline::TextureSlot.depth_compare pub depth_compare: bool
field metal2vulkan::pipeline::TextureSlot.level_zero_samplers pub level_zero_samplers: u16
field metal2vulkan::pipeline::TextureSlot.sampled_type pub sampled_type: SampledType
field metal2vulkan::pipeline::TextureSlot.storage pub storage: bool
field metal2vulkan::pipeline::TextureSlot.texture_type pub texture_type: metal::TextureType
@@ -6558,6 +6571,7 @@ method metal2vulkan::metal::sampler::SamplerUse::with_lod_bias pub fn with_lod_b
method metal2vulkan::metal::sampler::SamplerUse::with_unnormalized pub fn with_unnormalized(self, unnormalized: bool) -> SamplerUse
method metal2vulkan::metal::sampler::SamplerWord::nearest_pixel pub fn nearest_pixel(integer: bool) -> u32
method metal2vulkan::metal::sampler::SamplerWord::of pub fn of(desc: &SamplerDescriptor) -> SamplerWord
method metal2vulkan::metal::sampler::SamplerWord::reads_unnormalized pub fn reads_unnormalized(self) -> bool
method metal2vulkan::pipeline::AliasView::new pub fn new(image_format: vk::Format) -> AliasView
method metal2vulkan::pipeline::AmplificationDraws::new pub fn new(layered: bool, viewports: bool) -> AmplificationDraws
method metal2vulkan::pipeline::BandPrimitive::patch_control_points pub fn patch_control_points(self) -> u32
Can't render this file because it is too large.
+2
View File
@@ -305,6 +305,8 @@ surface! {
"pipeline" => metal2vulkan::pipeline {
fn heap_sampler_capacity;
fn heap_unused_while_pending;
const LEVEL_ZERO_ELEMENT;
const UNNORMALIZED_TWIN_ELEMENT;
fn arena_bytes;
fn region_bytes;
fn nonuniform_region_bytes;
+18 -2
View File
@@ -64,7 +64,9 @@ texel-buffer arrays of 65,536 elements each, every one partially bound, updated
while unused elements are pending, and seen by every stage. Shaders declare the arrays unsized, so
a consumer's layout may hold more elements than these; the runtime's sampler arrays hold 8,000,
the last 4,000 for sampler states bound with LOD clamps of their own, which no ID a program
writes reaches, and its storage-image array 131,072, the last 65,536 the level elements: 4,096
writes reaches, its plain sampler array 8,000 more, their unnormalized twins, its sampled-image
array 196,608, the second 65,536 the second elements and the last 65,536 the level-0 elements
(below), and its storage-image array 131,072, the last 65,536 the level elements: 4,096
runs of 16, each the single-level storage views of one texture's levels in order from its first,
which a slot written or read at a level other than the constant 0 indexes. The slot pushes the
run's first element (`PushField::TextureLevelBase`) beside the texture's level count
@@ -115,6 +117,20 @@ included); a min or mag filter of `Cubic`, Metal's undeclared raw value 2, is ma
push field, samples through the element its low word indexes, and reads the word's fields where a
sample depends on them (pixel coordinates, a nearest pixel sampler).
A runtime sampler slot's sample or gather of a 1D or 2D texture slot, not an array, with no
compare, takes Metal's pixel coordinate itself where the bound sampler's word reads unnormalized
(`SamplerWord::reads_unnormalized`: pixel coordinates, nearest or linear filters alike for min and
mag, no mip filter, no anisotropy, and `s` and `t` clamped to the edge, to zero or to the border)
and the texture's index is below 65,536. It samples at that coordinate, moved by its offset, at
level 0, through element `s + 8,000` of binding 2 (`pipeline::UNNORMALIZED_TWIN_ELEMENT`), the
device sampler of sampler `s`'s descriptor made with `unnormalizedCoordinates`, and element
`i + 131,072` of binding 0 (`pipeline::LEVEL_ZERO_ELEMENT`), a view of texture `i`'s first level
and one layer alone (its own sampled view where it has one level). Under any other word it takes
the path above. A function names each texture slot it samples so and the sampler slots it samples
it through (`TextureSlot::level_zero_samplers`); a consumer that lays the arrays out itself writes
both elements for every texture and sampler state such a slot may sample, as the runtime does at
the first dispatch or draw that binds them.
A sampled cube's or cube array's element, a depth cube's or depth cube array's included, is its cube
view, whose texels no fetch addresses, so a `read` of it by face (`read(coord, face, lod)`, and with
the cube index for a cube array; a depth read answers the sample's first component) samples that
@@ -132,7 +148,7 @@ describes it) at an index of the use's array and pushes that index as a `u32`. I
are normalized; the shader scales a pixel sampler's coordinate itself. It samples with its own
address modes. A shader takes an argument buffer's sampler's ID from the member's 8 bytes,
samples through the element of its use's array that its low word indexes, and reads the word's
fields as a runtime sampler slot's. The program writes the ID, so the shader compares its index
fields as a runtime sampler slot's, but takes no level-0 element: it scales a pixel coordinate. The program writes the ID, so the shader compares its index
with the arrays' length: an index of 4,000 or more reads element 0, the default sampler, never one
outside the arrays.