rt: storage textures written or read at a run-time level, through runs of set 1's level elements
What: under the identity domains a storage slot written, read or size-queried at a level other
than the constant 0 indexes a run of set 1's storage-image array instead of being refused as
Unsupported{IdentityDomains} ("an encoder value the function reads as TextureLevels(S)"). The
translator pushes the bound texture's level count (PushField::TextureLevels) and the run's first
element (the new PushField::TextureLevelBase, beside it), states no StorageTextureLevels or
StorageTextureLevelViews fact, and an access at level l takes element
first + min(l, max(n, 1) - 1) of the array, NonUniform, inside l < n. A texture of one level
pushes its own index, nil 0 with count 0.
The runtime's binding 1 grows by 65,536 level elements past its 65,536 textures, 4,096 runs of 16
(floor::LEVEL_ELEMENTS, floor::LEVEL_RUN). The first dispatch or draw that binds a texture of more
than one level to such a slot (the encoder's checks, compute and render stages alike) gives it a
run: a single-level storage view of each level, of its storage element's type (a cube's level as
the 2D array of its faces, a view's from its own first level), written at the run's elements. A
later bind takes the texture's lock and pushes the same two words: no Vulkan call. The run goes
back through the pool and reaper once the texture is released and its work retired: elements null,
views destroyed (Gauges::level_elements). Every run held, or a texture of more than 16 levels, is
the new Limit::LevelElements { max: 4096 }, and the dispatch or draw does not run. The floor's
storage-image limits and both totals rise by 65,536: storage 196,608, per-stage resources 327,688,
pools 351,680; every lab device's profile is far above (llvmpipe 1,015,808 storage, the least).
SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION bump in the branch's last commit (a new PushField).
Why: 17 guest kernels in 6 libraries were refused at state creation by this form.
Docs: REFUSALS.md and the signatures table regenerated, RESOURCE-ID.md (binding 1 past 65,536),
API.md (storage levels under identity), the runtime README (Set 1, the floor table, the known-gap
line replaced by the Limit), the runtime-floor profile's limits, and the conformance ledger's
level-sizes-storage row removed.
Checked by: engine_texture_levels' identity test and the runtime's storage_levels device tests
(red at 6ad1c33124: jobs m3-max-70886 and m3-max-70892 on lavapipe), engine_identity's
a_storage_slot_written_at_a_run_time_level_is_an_element_of_its_run; the lane's jobs report the
runs per card.
This commit is contained in:
1 parent
316d88a913
commit
ed4b0ecd76
32 files changed
+1041
-134
No files matched your search
@@ -1205,7 +1205,6 @@ half-texel-nans-rgb9e5f RX 550 divergent case/words/nearest-sample 384 elements
|
||||
half-texel-nans-rgb9e5f RX 550 divergent case/words/read 384 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a shared-exponent (`RGB9E5Float`) texel's channel below half's normal range through a `half` `read()` of a read-access texture. Metal hands back a `half` denormal (Metal 0x6f at the first differing element); the RX 550 answers zero (ours 0x0). The device has no `shaderFloat16` (the case announced `native-half-quantize`, which only such a device records), so the module rounds the texel's `float`, a normal one, to `half` by the device's `OpQuantizeToF16` and encodes it by `PackHalf2x16`, the 16-bit float form that query chooses; the SPIR-V specification lets the quantize answer zero below half's normal range. Notes `half-texel-conversion`, `native-half-conversion` and `native-half-quantize`.
|
||||
half-texel-nans-rgb9e5f RX 550 divergent case/words/read-through-sample 384 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a shared-exponent (`RGB9E5Float`) texel's channel below half's normal range through a `half` `read()` of a sample-access texture. Metal hands back a `half` denormal (Metal 0x6f at the first differing element); the RX 550 answers zero (ours 0x0). The device has no `shaderFloat16` (the case announced `native-half-quantize`, which only such a device records), so the module rounds the texel's `float`, a normal one, to `half` by the device's `OpQuantizeToF16` and encodes it by `PackHalf2x16`, the 16-bit float form that query chooses; the SPIR-V specification lets the quantize answer zero below half's normal range. Notes `half-texel-conversion`, `native-half-conversion` and `native-half-quantize`.
|
||||
half-texel-nans-rgb9e5f RX 550 divergent case/words/widened 384 elements differ (U32), the largest difference 939491328 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read, a shared-exponent texel's channel below half's normal range. Metal widens a `half` denormal (Metal 0x36de0000 at the first differing element); the RX 550's `half` was already zero (ours 0x0): the device has no `shaderFloat16`, and its `OpQuantizeToF16` of the texel's `float`, which the SPIR-V specification lets answer zero below half's normal range, took it there. Notes `native-half-conversion` and `native-half-quantize`.
|
||||
level-sizes-storage * refused case/pipeline Err(Error::Translation("the translator made no pipeline: unsupported: IdentityDomains (an encoder value the function reads as TextureLevels(SlotRef { stage: Kernel, class: Texture, index: 0 })); needs NotImplemented")) refused: no stream uses it yet (states-only play 11-19, m3-max-56371-56373, 56375, player 44668b439f: 32 streams, every render and compute pipeline state made). The translator refuses the state (IdentityDomains: a form the identity domains do not lower); rt README, Known gaps of pipeline states.
|
||||
math-frexp-ilogb-half 780M divergent case/output/frexp-mantissa 1 element differs (U32): Metal 31745 (0x7c01), ours 32257 (0x7e01) The device's own answer (rule 1): `frexp`'s mantissa of the signalling `half` NaN 0x7c01: Metal keeps its bits; the device answers it quieted (0x7e01). Note `native-nan-encoding`.
|
||||
math-frexp-ilogb-half RX 7900 XTX divergent case/output/frexp-mantissa 1 element differs (U32): Metal 31745 (0x7c01), ours 32257 (0x7e01) The device's own answer (rule 1): `frexp`'s mantissa of the signalling `half` NaN 0x7c01: Metal keeps its bits; the device answers it quieted (0x7e01). Note `native-nan-encoding`.
|
||||
math-frexp-ilogb-half Iris(R) Xe divergent case/output/frexp-mantissa 1 element differs (U32): Metal 31745 (0x7c01), ours 32257 (0x7e01) The device's own answer (rule 1): `frexp`'s mantissa of the signalling `half` NaN 0x7c01: Metal keeps its bits; the device answers it quieted (0x7e01). Note `native-nan-encoding`.
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1294,7 +1294,7 @@ the Direct3D 11 texture's payload until it is freed.
|
||||
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 (binding 1), 8,000 samplers of each use, plain, depth comparison and integer texture
|
||||
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
|
||||
@@ -1312,6 +1312,22 @@ made, with no lock, and never rewritten for layouts.
|
||||
over a buffer); on a device without the loop it is the texture's view of its image's
|
||||
shadow (Render encoders), written at the first draw that reads through it where the texture
|
||||
still owns index `i`. It is a null descriptor otherwise, and no grant reaches it.
|
||||
- Binding 1's elements 65,536 to 131,071 are level elements, in 4,096 runs of 16. A function that
|
||||
writes or reads a storage texture at a level other than the constant 0 (MSL
|
||||
`write(color, coord, lod)` or `read(coord, lod)` at a level it computes or reads) indexes a
|
||||
run: the first dispatch or draw that binds a texture of more than one level to such a slot
|
||||
gives the texture a run and writes the run's elements, each a single-level storage view of one
|
||||
of the texture's levels, in order from its first (a cube's level as the 2D array of its faces, a
|
||||
texture view's from its own first level). The dispatch or draw pushes the texture's level count
|
||||
and the run's first element, and an access at level `l` reads or writes element
|
||||
`first + min(l, count - 1)` only where `l < count`: a write past the count is dropped and a
|
||||
read there answers zeros, and no level reaches another texture's elements. A texture of one
|
||||
level pushes its own index, and nil pushes count 0, so its writes are dropped. A later bind of the texture makes nothing: it takes the texture's lock and
|
||||
pushes the same two words. The run goes back once the texture is released and its work has
|
||||
retired: its views are destroyed and its elements are null again
|
||||
(`Gauges::level_elements`). A texture bound so when every run is held, or one of more than 16
|
||||
levels, past any texture Metal makes, is `Limit::LevelElements`, and the dispatch or draw
|
||||
does not run. No grant and no resource ID reaches the level elements.
|
||||
- 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
|
||||
@@ -3392,16 +3408,9 @@ cache is answered compile-required on both.
|
||||
function"): no test yet;
|
||||
- a value from the encoder that the function reads and the identity domains do not source ("an
|
||||
encoder value the function reads as F", `F` the `PushField`: a texture buffer's bind offset,
|
||||
`SlotBindOffset`; a texture's level count, `TextureLevels`; the draw's `InstanceCount` or
|
||||
`BaseVertexInstance`; a stage-in stride, `StageInStride`; and the others the translator
|
||||
pushes beside the identity fields): no test yet;
|
||||
- among those, a storage texture written or read at a level other than the constant 0 (MSL
|
||||
`write(color, coord, lod)` at a level the kernel computes or reads), whose slot the
|
||||
translator declares as one storage element per level, which the identity arrays do not hold
|
||||
("an encoder value the function reads as TextureLevels(S)"). Metal writes such a level on
|
||||
Intel Macs as well as on Apple silicon: an owned kernel's writes at levels 1 and 2, read
|
||||
from a buffer, landed exactly on a Radeon Pro 5300M and on a UHD 630 under macOS 26.7.1, with
|
||||
Metal's validation off, with its API validation, and with its shader validation. No test yet;
|
||||
`SlotBindOffset`; the draw's `InstanceCount` or `BaseVertexInstance`; a stage-in stride,
|
||||
`StageInStride`; and the others the translator pushes beside the identity fields): no test
|
||||
yet;
|
||||
- a buffer argument not reached through its device address ("a buffer argument not reached
|
||||
through its device address"): no test yet;
|
||||
- a texture argument of a type the identity arrays hold no element of, or whose bound texture's
|
||||
@@ -5153,7 +5162,7 @@ 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, 65,536 read and 65,536 written texture buffers, and three arrays of 8,000
|
||||
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
|
||||
@@ -5178,13 +5187,13 @@ below 256 an indirect command reaches fewer vertex slots (Known gaps of indirect
|
||||
|---|---|---|
|
||||
| `maxPerStageDescriptorUpdateAfterBindSampledImages` | `131072` | the sampled-texture and read texture-buffer arrays |
|
||||
| `maxDescriptorSetUpdateAfterBindSampledImages` | `131072` | the sampled-texture and read texture-buffer arrays |
|
||||
| `maxPerStageDescriptorUpdateAfterBindStorageImages` | `131072` | the storage-texture and written texture-buffer arrays |
|
||||
| `maxDescriptorSetUpdateAfterBindStorageImages` | `131072` | the storage-texture and written texture-buffer arrays |
|
||||
| `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 |
|
||||
| `maxSamplerAllocationCount` | `4000` | Vulkan's minimum: live samplers |
|
||||
| `maxPerStageUpdateAfterBindResources` | `262144` | the four texture and texture-buffer arrays in one stage; a fragment stage needs its `maxColorAttachments` more |
|
||||
| `maxUpdateAfterBindDescriptorsInAllPools` | `286144` | all seven arrays; the lab's least is 1,048,576 |
|
||||
| `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 |
|
||||
| `maxComputeWorkGroupInvocations` | `1024` | Metal's most threads per threadgroup |
|
||||
| `maxComputeWorkGroupSize[0]` | `1024` | a threadgroup's width |
|
||||
| `maxComputeWorkGroupSize[1]` | `1024` | a threadgroup's height |
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
//!
|
||||
//! One descriptor set of the translator's identity domains' seven arrays, made at device creation
|
||||
//! and never rewritten for layouts: binding 0 the sampled textures and binding 1 the storage
|
||||
//! textures (65,536 each, element `i` of both the texture at index `i`), bindings 2, 3 and 4 the
|
||||
//! textures (65,536 each, element `i` of both the texture at index `i`; binding 1 then holds the
|
||||
//! level elements), bindings 2, 3 and 4 the
|
||||
//! samplers of each use, plain, depth comparison and integer texture (8,000 each: the 4,000 indices
|
||||
//! a resource ID reaches, then 4,000 variant elements), and bindings 5 and 6 the texture buffers'
|
||||
//! uniform and storage texel buffers (65,536 each, element `i` of both the texture buffer at index
|
||||
@@ -38,6 +39,13 @@
|
||||
//! image's shadow, written at the first draw that reads through it where the texture still owns
|
||||
//! the index (`crate::shadow`). It is a null descriptor otherwise. No index of a grant reaches it.
|
||||
//!
|
||||
//! Past its 65,536 textures the storage-texture array holds 65,536 level elements in runs of 16
|
||||
//! (`floor::LEVEL_ELEMENTS`, `floor::LEVEL_RUN`): a texture of more than one level bound to a slot
|
||||
//! a function writes or reads at a level other than the constant 0 takes a run at that bind, each
|
||||
//! element its own single-level storage view of a level, from its first, which the slot's
|
||||
//! `PushField::TextureLevelBase` names ([`Arrays::place_levels`]); the run is null again and free
|
||||
//! once the texture is released and its work retired. No grant and no resource ID reaches them.
|
||||
//!
|
||||
//! The consumer names each range of indices it takes ([`Device::grant_indices`]), so resource IDs
|
||||
//! are chosen on the guest's side and reproduce in replay. Two classes: textures of every usage
|
||||
//! take 1 to 65,535, an index valid in both texture arrays; samplers 1 to 3,999. Index 0 is nil
|
||||
@@ -47,7 +55,8 @@ use crate::counters::{Counters, Gauge, Metric, Part};
|
||||
use crate::device::lock;
|
||||
use crate::error::{Error, Limit, Refusal};
|
||||
use crate::floor::{
|
||||
BelowFloor, Missing, SAMPLERS, SAMPLER_ARRAYS, SAMPLER_ELEMENTS, SAMPLER_VARIANTS, TEXTURES,
|
||||
BelowFloor, Missing, LEVEL_ELEMENTS, LEVEL_RUN, SAMPLERS, SAMPLER_ARRAYS, SAMPLER_ELEMENTS,
|
||||
SAMPLER_VARIANTS, TEXTURES,
|
||||
};
|
||||
use crate::Device;
|
||||
use ash::vk;
|
||||
@@ -70,7 +79,8 @@ pub(crate) const STORAGE_TEXELS_BINDING: u32 = 6;
|
||||
/// Set 1's bindings, each its binding, descriptor type and count: the arrays a kernel's layout
|
||||
/// names under the identity domains, which every pipeline's layout takes from this set. Shaders
|
||||
/// declare the arrays unsized, and the set's layout holds [`layout_counts`] elements: more in the
|
||||
/// sampled-texture array with the second elements, and in each sampler array its variants'.
|
||||
/// sampled-texture array with the second elements, in the storage-texture array its level
|
||||
/// elements, and in each sampler array its variants'.
|
||||
pub(crate) const BINDINGS: [(u32, vk::DescriptorType, u32); 7] = [
|
||||
(SAMPLED_BINDING, vk::DescriptorType::SAMPLED_IMAGE, TEXTURES),
|
||||
(STORAGE_BINDING, vk::DescriptorType::STORAGE_IMAGE, TEXTURES),
|
||||
@@ -206,6 +216,9 @@ pub(crate) struct Grants {
|
||||
last: u64,
|
||||
/// The variant elements no variant holds, the lowest last.
|
||||
variants: Vec<u32>,
|
||||
/// The first elements of the storage-texture array's runs of level elements no texture holds,
|
||||
/// the lowest last.
|
||||
runs: Vec<u32>,
|
||||
}
|
||||
|
||||
impl Grants {
|
||||
@@ -215,6 +228,10 @@ impl Grants {
|
||||
owners: [HashMap::new(), HashMap::new()],
|
||||
last: 0,
|
||||
variants: (SAMPLERS..SAMPLER_ELEMENTS).rev().collect(),
|
||||
runs: (TEXTURES..TEXTURES + LEVEL_ELEMENTS)
|
||||
.step_by(LEVEL_RUN as usize)
|
||||
.rev()
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,6 +806,87 @@ impl Arrays {
|
||||
grants.variants.push(index);
|
||||
}
|
||||
|
||||
/// Places a texture's levels at a run of the storage-texture array's level elements no texture
|
||||
/// holds ([`LEVEL_RUN`] elements past [`TEXTURES`]) and writes `views`, each a single-level
|
||||
/// storage view of its level, at the run's elements in order; the run's other elements stay
|
||||
/// null. The level-elements gauge rises. The run's first element, which no grant reaches.
|
||||
///
|
||||
/// Err: [`Limit::LevelElements`] where every run is held.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// `views` are at most [`LEVEL_RUN`], each live and of the device, of an image in the general
|
||||
/// layout whenever work uses it, until the run is vacated ([`Arrays::vacate_levels`]).
|
||||
pub(crate) unsafe fn place_levels(
|
||||
&self,
|
||||
device: &ash::Device,
|
||||
counters: &Counters,
|
||||
views: &[vk::ImageView],
|
||||
) -> Result<u32, Error> {
|
||||
let mut grants = lock(&self.grants);
|
||||
let first = (grants.runs.pop()).ok_or(Error::Limit(Limit::LevelElements {
|
||||
max: LEVEL_ELEMENTS / LEVEL_RUN,
|
||||
}))?;
|
||||
counters.rise(Gauge::LevelElements);
|
||||
// SAFETY: the caller's contract; no texture held the run, so no work uses it, and the
|
||||
// lock is held.
|
||||
unsafe { self.write_storage(device, first, views) };
|
||||
Ok(first)
|
||||
}
|
||||
|
||||
/// The texture of the run at `first` goes: each of the run's elements is null again, the run
|
||||
/// is free, and the level-elements gauge falls.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// `first` is the first element of a run a texture held, and no work in flight reads its
|
||||
/// elements.
|
||||
pub(crate) unsafe fn vacate_levels(
|
||||
&self,
|
||||
device: &ash::Device,
|
||||
counters: &Counters,
|
||||
first: u32,
|
||||
) {
|
||||
let mut grants = lock(&self.grants);
|
||||
let null = [vk::ImageView::null(); LEVEL_RUN as usize];
|
||||
// SAFETY: the caller's contract; the lock is held, so no texture is placed at the run
|
||||
// before its elements are null.
|
||||
unsafe { self.write_storage(device, first, &null) };
|
||||
grants.runs.push(first);
|
||||
counters.fall(Gauge::LevelElements);
|
||||
}
|
||||
|
||||
/// Writes `views` at the storage-texture array's elements from `first`, in the general layout,
|
||||
/// a null descriptor where a view is null.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The grants' lock is held by a placement or a vacating of the elements, no pending work uses
|
||||
/// them, and each view is live and of the device whenever work uses it.
|
||||
unsafe fn write_storage(&self, device: &ash::Device, first: u32, views: &[vk::ImageView]) {
|
||||
if views.is_empty() {
|
||||
return;
|
||||
}
|
||||
let infos: Vec<vk::DescriptorImageInfo> = (views.iter())
|
||||
.map(|&view| {
|
||||
vk::DescriptorImageInfo::default()
|
||||
.image_view(view)
|
||||
.image_layout(vk::ImageLayout::GENERAL)
|
||||
})
|
||||
.collect();
|
||||
let write = write(
|
||||
self.set,
|
||||
STORAGE_BINDING,
|
||||
vk::DescriptorType::STORAGE_IMAGE,
|
||||
&infos,
|
||||
)
|
||||
.dst_array_element(first);
|
||||
// SAFETY: the caller's contract; the binding is update-after-bind and
|
||||
// update-unused-while-pending, so elements of other owners may be written meanwhile, and
|
||||
// a null image view is a null descriptor under `nullDescriptor`.
|
||||
unsafe { device.update_descriptor_sets(&[write], &[]) };
|
||||
}
|
||||
|
||||
/// Writes elements at `index` of the sampler arrays, each `(array, sampler)`, the array 0
|
||||
/// plain, 1 comparison and 2 integer texture: the array's default where the sampler is `None`.
|
||||
/// An element that holds that sampler already is not written: an equal sampler state, whose
|
||||
@@ -906,7 +1004,7 @@ impl Made {
|
||||
},
|
||||
vk::DescriptorPoolSize {
|
||||
ty: vk::DescriptorType::STORAGE_IMAGE,
|
||||
descriptor_count: TEXTURES,
|
||||
descriptor_count: TEXTURES + LEVEL_ELEMENTS,
|
||||
},
|
||||
vk::DescriptorPoolSize {
|
||||
ty: vk::DescriptorType::SAMPLER,
|
||||
@@ -1042,11 +1140,13 @@ pub(crate) unsafe fn supported(
|
||||
}
|
||||
|
||||
/// The elements of each binding of set 1's layout, by [`BINDINGS`]: theirs, the sampled-texture
|
||||
/// array's [`sampled_images`], and each sampler array's [`SAMPLER_ELEMENTS`], its variant elements
|
||||
/// past the [`SAMPLERS`] a pipeline's layout names.
|
||||
/// array's [`sampled_images`], the storage-texture array's level elements past its textures, and
|
||||
/// each sampler array's [`SAMPLER_ELEMENTS`], its variant elements past the [`SAMPLERS`] a
|
||||
/// pipeline's layout names.
|
||||
pub(crate) fn layout_counts(seconds: bool) -> [u32; 7] {
|
||||
let mut counts = BINDINGS.map(|(_, _, count)| count);
|
||||
counts[SAMPLED_BINDING as usize] = sampled_images(seconds);
|
||||
counts[STORAGE_BINDING as usize] = TEXTURES + LEVEL_ELEMENTS;
|
||||
for array in 0..SAMPLER_ARRAYS {
|
||||
counts[(FIRST_SAMPLER_BINDING + array) as usize] = SAMPLER_ELEMENTS;
|
||||
}
|
||||
@@ -1062,7 +1162,8 @@ pub(crate) fn sampled_images(seconds: bool) -> u32 {
|
||||
}
|
||||
|
||||
/// Writes every element of `set` its default: a null descriptor in each texture and texel-buffer
|
||||
/// array, the sampled-texture array's `sampled` elements, `plain` in the plain and
|
||||
/// array, the sampled-texture array's `sampled` elements and the storage-texture array's level
|
||||
/// elements among them, `plain` in the plain and
|
||||
/// integer-texture sampler arrays and `compare` in the comparison array.
|
||||
///
|
||||
/// # Safety
|
||||
@@ -1083,7 +1184,7 @@ unsafe fn fill(
|
||||
];
|
||||
let storage = vec![
|
||||
vk::DescriptorImageInfo::default().image_layout(vk::ImageLayout::GENERAL);
|
||||
TEXTURES as usize
|
||||
(TEXTURES + LEVEL_ELEMENTS) as usize
|
||||
];
|
||||
let samplers = |sampler| {
|
||||
vec![vk::DescriptorImageInfo::default().sampler(sampler); SAMPLER_ELEMENTS as usize]
|
||||
|
||||
@@ -421,6 +421,8 @@ pub(crate) enum Gauge {
|
||||
Samplers,
|
||||
/// [`Gauges::lod_clamp_variants`].
|
||||
LodClampVariants,
|
||||
/// [`Gauges::level_elements`].
|
||||
LevelElements,
|
||||
/// [`Gauges::descriptor_slots`].
|
||||
DescriptorSlots,
|
||||
/// [`Gauges::pipelines`].
|
||||
@@ -800,6 +802,7 @@ struct Atomics {
|
||||
textures: AtomicU64,
|
||||
samplers: AtomicU64,
|
||||
lod_clamp_variants: AtomicU64,
|
||||
level_elements: AtomicU64,
|
||||
pipelines: AtomicU64,
|
||||
kernels: AtomicU64,
|
||||
kernel_variants: AtomicU64,
|
||||
@@ -1595,6 +1598,7 @@ impl Counters {
|
||||
Gauge::Textures => &a.textures,
|
||||
Gauge::Samplers => &a.samplers,
|
||||
Gauge::LodClampVariants => &a.lod_clamp_variants,
|
||||
Gauge::LevelElements => &a.level_elements,
|
||||
Gauge::DescriptorSlots => &a.descriptor_slots,
|
||||
Gauge::Pipelines => &a.pipelines,
|
||||
Gauge::Kernels => &a.kernels,
|
||||
@@ -1941,6 +1945,7 @@ impl Counters {
|
||||
textures: a.textures.load(Relaxed),
|
||||
samplers: a.samplers.load(Relaxed),
|
||||
lod_clamp_variants: a.lod_clamp_variants.load(Relaxed),
|
||||
level_elements: a.level_elements.load(Relaxed),
|
||||
pipelines: a.pipelines.load(Relaxed),
|
||||
kernels: a.kernels.load(Relaxed),
|
||||
kernel_variants: a.kernel_variants.load(Relaxed),
|
||||
@@ -3066,6 +3071,11 @@ pub struct Gauges {
|
||||
/// 1's sampler arrays: at most 4,000
|
||||
/// ([`Limit::LodClampVariants`](crate::Limit::LodClampVariants)).
|
||||
pub lod_clamp_variants: u64,
|
||||
/// Runs of set 1's level elements textures hold, each a texture's single-level storage views
|
||||
/// from its first bind to a slot written or read at a level other than the constant 0 until it
|
||||
/// is released and its work retired: at most 4,096
|
||||
/// ([`Limit::LevelElements`](crate::Limit::LevelElements)).
|
||||
pub level_elements: u64,
|
||||
/// `VkPipeline`s.
|
||||
pub pipelines: u64,
|
||||
/// Compiled kernels: each the translation of one compute pipeline content (its descriptor's
|
||||
|
||||
@@ -949,6 +949,8 @@ impl ComputeCommandEncoder {
|
||||
/// kernel; [`Limit::ThreadgroupThreads`] within it and past this device's;
|
||||
/// [`Refusal::BufferOffsetAlignment`] for a buffer the kernel reaches bound off its argument's
|
||||
/// alignment, which nothing records; [`Gap::SwizzledReadWrite`]; [`Gap::BicubicTexels`];
|
||||
/// [`Limit::LevelElements`] where no run of level elements holds a texture of several levels
|
||||
/// the kernel writes or reads at a level other than the constant 0;
|
||||
/// [`Limit::ThreadgroupMemory`], the imageblock's cells at the size
|
||||
/// [`set_imageblock_size`](Self::set_imageblock_size) set counted with the lengths;
|
||||
/// [`Gap::PartialSimdgroups`] for a threadgroup that is not whole SIMD groups of a kernel
|
||||
@@ -1107,6 +1109,15 @@ impl ComputeCommandEncoder {
|
||||
backing: gap.backing,
|
||||
}));
|
||||
}
|
||||
// The run of level elements of each texture the kernel writes or reads at a level
|
||||
// other than the constant 0, which its push names.
|
||||
for field in &interface.fields {
|
||||
if let FieldValue::TextureLevelBase(slot) = field.value {
|
||||
if let Some(Some(texture)) = self.textures.get(slot as usize) {
|
||||
texture.hold_levels()?;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.facts.extended = (interface.textures.iter()).any(|&(slot, access)| {
|
||||
access.writes()
|
||||
&& matches!(self.textures.get(slot as usize), Some(Some(t)) if t.extended_view())
|
||||
@@ -1694,6 +1705,21 @@ impl Parameters {
|
||||
};
|
||||
bytes[at..at + 4].copy_from_slice(&word.to_le_bytes());
|
||||
}
|
||||
FieldValue::TextureLevels(slot) => {
|
||||
let count = match textures.get(slot as usize) {
|
||||
Some(Some(texture)) => texture.level_count(),
|
||||
_ => 0,
|
||||
};
|
||||
bytes[at..at + 4].copy_from_slice(&count.to_le_bytes());
|
||||
}
|
||||
// A texture of several levels holds its run: the dispatch's checks took it.
|
||||
FieldValue::TextureLevelBase(slot) => {
|
||||
let first = match textures.get(slot as usize) {
|
||||
Some(Some(texture)) => texture.level_base(),
|
||||
_ => 0,
|
||||
};
|
||||
bytes[at..at + 4].copy_from_slice(&first.to_le_bytes());
|
||||
}
|
||||
FieldValue::ConstexprSampler(place) => {
|
||||
let index = sampler_ids.get(place).copied().unwrap_or(0);
|
||||
bytes[at..at + 4].copy_from_slice(&index.to_le_bytes());
|
||||
|
||||
@@ -2145,6 +2145,19 @@ pub enum Limit {
|
||||
/// The most variants live at once.
|
||||
max: u32,
|
||||
},
|
||||
/// A dispatch or a draw that binds a texture of more than one level to a slot its function
|
||||
/// writes or reads at a level other than the constant 0 (MSL `write(color, coord, lod)` at a
|
||||
/// level the function computes), where no run of set 1's level elements holds the texture's
|
||||
/// levels: each such texture holds one run of 16, a single-level storage view of each of its
|
||||
/// levels, from its first such bind until it is released and its work retired, and every run
|
||||
/// is held; or the texture has more than 16 levels, past any texture Metal makes (16,384
|
||||
/// texels a side, 15 levels). Nothing is recorded.
|
||||
///
|
||||
/// Basis: ours (the runtime's 65,536 level elements, 4,096 runs of 16).
|
||||
LevelElements {
|
||||
/// The most textures that hold runs at once.
|
||||
max: u32,
|
||||
},
|
||||
/// A `VkDeviceMemory` allocation past the device's `maxMemoryAllocationCount` live ones,
|
||||
/// refused before the driver is called: each block, each imported block, each texture's own
|
||||
/// memory, each staging buffer of [`Texture::replace_region`](crate::Texture::replace_region)
|
||||
@@ -3012,6 +3025,10 @@ impl fmt::Display for Limit {
|
||||
f,
|
||||
"{max} sampler states bound with LOD clamps of their own are live already"
|
||||
),
|
||||
Limit::LevelElements { max } => write!(
|
||||
f,
|
||||
"none of the {max} runs of 16 level elements holds the texture's levels"
|
||||
),
|
||||
Limit::MemoryAllocations { max } => {
|
||||
write!(f, "the device holds {max} memory allocations already")
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ impl Limit {
|
||||
Limit::TextureSize { .. } => RefusalBasis::Device,
|
||||
Limit::DeviceSamplers { .. } => RefusalBasis::Device,
|
||||
Limit::LodClampVariants { .. } => RefusalBasis::Ours,
|
||||
Limit::LevelElements { .. } => RefusalBasis::Ours,
|
||||
Limit::MemoryAllocations { .. } => RefusalBasis::Device,
|
||||
Limit::AllocationNotMapped { .. } => RefusalBasis::Ours,
|
||||
Limit::NoImport { .. } => RefusalBasis::Device,
|
||||
|
||||
@@ -240,6 +240,16 @@ pub(crate) fn shader_extension(name: &CStr) -> Option<VkExtension> {
|
||||
/// supports `descriptorIndexing`.
|
||||
pub(crate) const TEXTURES: u32 = 65_536;
|
||||
|
||||
/// The elements past [`TEXTURES`] in the storage-texture array: runs of single-level storage views,
|
||||
/// each run a texture's levels, which a function written or read at a level other than the
|
||||
/// constant 0 indexes (`crate::arrays`), at indices no grant and no resource ID reaches. They count
|
||||
/// against the storage-image limits beside the arrays a resource ID reaches.
|
||||
pub(crate) const LEVEL_ELEMENTS: u32 = 65_536;
|
||||
|
||||
/// The elements of one run of [`LEVEL_ELEMENTS`]: a texture's levels, at most 16 of a texture of
|
||||
/// 32,768 texels a side, past any texture Metal makes (16,384, 15 levels); so 4,096 runs.
|
||||
pub(crate) const LEVEL_RUN: u32 = 16;
|
||||
|
||||
/// The indices of each sampler array a resource ID reaches: 0, nil, and the consumer's grants, 1
|
||||
/// to 3,999. 4000 is Vulkan's minimum `maxSamplerAllocationCount`, so every device can hold a
|
||||
/// sampler at every index.
|
||||
@@ -1575,12 +1585,13 @@ fn second_elements_fit(device: &Queried) -> bool {
|
||||
let limits = &device.limits;
|
||||
let descriptors = &device.vulkan12;
|
||||
let sampled = 3 * TEXTURES;
|
||||
let storage = 2 * TEXTURES + LEVEL_ELEMENTS;
|
||||
descriptors.max_per_stage_descriptor_update_after_bind_sampled_images >= sampled
|
||||
&& descriptors.max_descriptor_set_update_after_bind_sampled_images >= sampled
|
||||
&& descriptors.max_per_stage_update_after_bind_resources
|
||||
>= sampled + 2 * TEXTURES + limits.max_color_attachments
|
||||
>= sampled + storage + limits.max_color_attachments
|
||||
&& descriptors.max_update_after_bind_descriptors_in_all_pools
|
||||
>= sampled + 2 * TEXTURES + SAMPLER_ARRAYS * SAMPLER_ELEMENTS
|
||||
>= sampled + storage + SAMPLER_ARRAYS * SAMPLER_ELEMENTS
|
||||
}
|
||||
|
||||
/// Each limit the floor sets: its Vulkan name, the device's value, and the least value the runtime
|
||||
@@ -1588,7 +1599,9 @@ fn second_elements_fit(device: &Queried) -> bool {
|
||||
pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
|
||||
let limits = &device.limits;
|
||||
let descriptors = &device.vulkan12;
|
||||
// A uniform texel buffer counts as a sampled image, and a storage one as a storage image.
|
||||
// A uniform texel buffer counts as a sampled image, and a storage one as a storage image; the
|
||||
// storage-texture array holds its level elements past its textures.
|
||||
let storage = 2 * TEXTURES + LEVEL_ELEMENTS;
|
||||
[
|
||||
(
|
||||
"maxPerStageDescriptorUpdateAfterBindSampledImages",
|
||||
@@ -1603,12 +1616,12 @@ pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
|
||||
(
|
||||
"maxPerStageDescriptorUpdateAfterBindStorageImages",
|
||||
descriptors.max_per_stage_descriptor_update_after_bind_storage_images,
|
||||
2 * TEXTURES,
|
||||
storage,
|
||||
),
|
||||
(
|
||||
"maxDescriptorSetUpdateAfterBindStorageImages",
|
||||
descriptors.max_descriptor_set_update_after_bind_storage_images,
|
||||
2 * TEXTURES,
|
||||
storage,
|
||||
),
|
||||
(
|
||||
"maxPerStageDescriptorUpdateAfterBindSamplers",
|
||||
@@ -1629,12 +1642,12 @@ pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
|
||||
(
|
||||
"maxPerStageUpdateAfterBindResources",
|
||||
descriptors.max_per_stage_update_after_bind_resources,
|
||||
4 * TEXTURES + limits.max_color_attachments,
|
||||
2 * TEXTURES + storage + limits.max_color_attachments,
|
||||
),
|
||||
(
|
||||
"maxUpdateAfterBindDescriptorsInAllPools",
|
||||
descriptors.max_update_after_bind_descriptors_in_all_pools,
|
||||
4 * TEXTURES + SAMPLER_ARRAYS * SAMPLER_ELEMENTS,
|
||||
2 * TEXTURES + storage + SAMPLER_ARRAYS * SAMPLER_ELEMENTS,
|
||||
),
|
||||
(
|
||||
"maxComputeWorkGroupInvocations",
|
||||
|
||||
@@ -998,7 +998,10 @@ impl Pool {
|
||||
if now
|
||||
&& matches!(
|
||||
object,
|
||||
Free::TextureIndex(..) | Free::TexelIndex(..) | Free::SamplerIndex(..)
|
||||
Free::TextureIndex(..)
|
||||
| Free::TexelIndex(..)
|
||||
| Free::SamplerIndex(..)
|
||||
| Free::LevelElements(_)
|
||||
)
|
||||
{
|
||||
return crate::reaper::free(core, object);
|
||||
@@ -1757,9 +1760,10 @@ pub(crate) fn run(core: Arc<Core>) {
|
||||
// An index goes here, before the gauge falls, so every released index is vacated once
|
||||
// nothing waits; an object goes to the reaper.
|
||||
match object {
|
||||
Free::TextureIndex(..) | Free::TexelIndex(..) | Free::SamplerIndex(..) => {
|
||||
crate::reaper::free(&core, object)
|
||||
}
|
||||
Free::TextureIndex(..)
|
||||
| Free::TexelIndex(..)
|
||||
| Free::SamplerIndex(..)
|
||||
| Free::LevelElements(_) => crate::reaper::free(&core, object),
|
||||
_ => core.reaper.give(Job::Free(object)),
|
||||
}
|
||||
core.counters.fall(Gauge::ReleasesWaiting);
|
||||
|
||||
@@ -877,6 +877,13 @@ pub(crate) enum FieldValue {
|
||||
/// `metal::format::BICUBIC_TEXELS_UNBOUND` where none is; a texture of a format with no
|
||||
/// such treatment is refused at the dispatch or the draw ([`Gap::BicubicTexels`]).
|
||||
BicubicTexels(u32),
|
||||
/// A `u32`: the level count of the texture bound at the slot, 0 where none is
|
||||
/// (`PushField::TextureLevels`).
|
||||
TextureLevels(u32),
|
||||
/// A `u32`: the first element of the run of set 1's storage-texture array that holds the
|
||||
/// levels of the texture bound at the slot, 0 where none is (`PushField::TextureLevelBase`);
|
||||
/// the dispatch or the draw holds the texture's run first.
|
||||
TextureLevelBase(u32),
|
||||
/// A `u32`: the sampler index the consumer gave the constexpr sampler at this place of the
|
||||
/// state's numbered samplers (a render state's: the vertex function's, then the fragment
|
||||
/// function's).
|
||||
@@ -1775,6 +1782,22 @@ pub(crate) fn interface(
|
||||
}),
|
||||
_,
|
||||
) => FieldValue::BicubicTexels(index),
|
||||
(
|
||||
PushField::TextureLevels(SlotRef {
|
||||
stage: Stage::Kernel,
|
||||
class: SlotClass::Texture,
|
||||
index,
|
||||
}),
|
||||
_,
|
||||
) => FieldValue::TextureLevels(index),
|
||||
(
|
||||
PushField::TextureLevelBase(SlotRef {
|
||||
stage: Stage::Kernel,
|
||||
class: SlotClass::Texture,
|
||||
index,
|
||||
}),
|
||||
_,
|
||||
) => FieldValue::TextureLevelBase(index),
|
||||
(PushField::ConstexprSampler(sampler), _) => {
|
||||
let SamplerRef::Constexpr(words) = sampler.sampler else {
|
||||
return Err(KernelInputKind::ConstexprSampler);
|
||||
|
||||
@@ -77,6 +77,11 @@ pub(crate) enum Free {
|
||||
},
|
||||
/// A dropped texture's view of its image's shadow.
|
||||
ShadowView(vk::ImageView),
|
||||
/// A released texture's run of set 1's level elements, by its first element
|
||||
/// (`Arrays::vacate_levels`).
|
||||
LevelElements(u32),
|
||||
/// A dropped texture's single-level storage views, which its run of level elements held.
|
||||
LevelViews(Vec<vk::ImageView>),
|
||||
/// A dropped texture's resolve image (`crate::texture`'s `Resolved`), its attachment view
|
||||
/// and its memory of `bytes`, freed as a texture's are; the resolve images gauges fall with
|
||||
/// it.
|
||||
@@ -240,6 +245,19 @@ pub(crate) fn free(core: &Core, object: Free) {
|
||||
// SAFETY: no pending work uses it: every command buffer that read through it held its
|
||||
// texture until it retired, and its element of set 1 is null or another texture's.
|
||||
Free::ShadowView(view) => unsafe { device.destroy_image_view(view, None) },
|
||||
// SAFETY: no pending work reads the run: every command buffer that bound the texture held
|
||||
// it until it retired, and no resource ID reaches the run.
|
||||
Free::LevelElements(first) => unsafe {
|
||||
(core.arrays).vacate_levels(device, &core.counters, first)
|
||||
},
|
||||
Free::LevelViews(views) => {
|
||||
// SAFETY: as above; the run's elements are null.
|
||||
unsafe {
|
||||
for view in views {
|
||||
device.destroy_image_view(view, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
Free::Resolved {
|
||||
view,
|
||||
image,
|
||||
|
||||
@@ -157,6 +157,11 @@ pub(crate) struct Draws {
|
||||
/// and whose texture a draw's checks refuse where the filter's treatment of its format is not
|
||||
/// established (`Gap::BicubicTexels`). Empty for every other content.
|
||||
pub(crate) bicubic: Vec<(usize, u32)>,
|
||||
/// Each texture slot a function writes or reads at a level other than the constant 0, with its
|
||||
/// function: the slots whose `PushField::TextureLevelBase` a draw writes, the first element
|
||||
/// of the bound texture's run of level elements, which a draw's checks hold first. Empty for
|
||||
/// every other content.
|
||||
pub(crate) levels: Vec<(usize, u32)>,
|
||||
/// Each fixed-function vertex binding: its binding and the vertex buffer index it reads.
|
||||
pub(crate) bindings: Vec<(u32, u32)>,
|
||||
/// Whether a function reads through an address that is not one of its slots.
|
||||
@@ -702,6 +707,7 @@ fn draws(
|
||||
let mut fields = Vec::new();
|
||||
let mut fetched = Vec::new();
|
||||
let mut bicubic = Vec::new();
|
||||
let mut levels = Vec::new();
|
||||
let mut push_len = 0;
|
||||
let mut blocks = [None; 2];
|
||||
for placement in &translated.push {
|
||||
@@ -765,6 +771,26 @@ fn draws(
|
||||
bicubic.push((of, index));
|
||||
continue;
|
||||
}
|
||||
// The bound texture's level count, and the first element of the run that holds
|
||||
// its levels, the words a dispatch writes for its kernel's slot.
|
||||
PushField::TextureLevels(SlotRef {
|
||||
stage,
|
||||
class: SlotClass::Texture,
|
||||
index,
|
||||
}) => {
|
||||
fields.push((offset, table(stage)?, FieldValue::TextureLevels(index)));
|
||||
continue;
|
||||
}
|
||||
PushField::TextureLevelBase(SlotRef {
|
||||
stage,
|
||||
class: SlotClass::Texture,
|
||||
index,
|
||||
}) => {
|
||||
let of = table(stage)?;
|
||||
fields.push((offset, of, FieldValue::TextureLevelBase(index)));
|
||||
levels.push((of, index));
|
||||
continue;
|
||||
}
|
||||
PushField::ConstexprSampler(sampler) => {
|
||||
let SamplerRef::Constexpr(words) = sampler.sampler else {
|
||||
return Err(draw_input());
|
||||
@@ -861,6 +887,7 @@ fn draws(
|
||||
own_pixel,
|
||||
fetched,
|
||||
bicubic,
|
||||
levels,
|
||||
bindings,
|
||||
reads_unbound: translated.reads_unbound_resources,
|
||||
writes_unbound: translated.writes_unbound_resources,
|
||||
|
||||
@@ -286,7 +286,7 @@ impl Facts {
|
||||
///
|
||||
/// Err: [`Refusal::VertexBufferOffset`]; [`Refusal::NoBufferAtIndex`] for a vertex buffer the
|
||||
/// vertex descriptor reads that is not bound; [`Gap::SwizzledReadWrite`];
|
||||
/// [`Gap::BicubicTexels`]; [`Gap::StorageElement`].
|
||||
/// [`Gap::BicubicTexels`]; [`Gap::StorageElement`]; [`Limit::LevelElements`].
|
||||
fn find(
|
||||
&mut self,
|
||||
draws: &Draws,
|
||||
@@ -362,6 +362,13 @@ impl Facts {
|
||||
backing: gap.backing,
|
||||
}));
|
||||
}
|
||||
// The run of level elements of each texture a function writes or reads at a level other
|
||||
// than the constant 0, which its push names.
|
||||
for &(table, slot) in &draws.levels {
|
||||
if let Some(texture) = tables[table].texture(slot) {
|
||||
texture.hold_levels()?;
|
||||
}
|
||||
}
|
||||
self.attachments = !draws.fetched.is_empty()
|
||||
|| (draws.textures.iter()).any(|&(table, slot, _)| {
|
||||
tables[table].texture(slot).is_some_and(|texture| {
|
||||
@@ -3598,6 +3605,15 @@ fn fill_push(
|
||||
});
|
||||
bytes[at..at + 4].copy_from_slice(&word.to_le_bytes());
|
||||
}
|
||||
FieldValue::TextureLevels(slot) => {
|
||||
let count = (tables.texture(slot)).map_or(0, |t| t.level_count());
|
||||
bytes[at..at + 4].copy_from_slice(&count.to_le_bytes());
|
||||
}
|
||||
// A texture of several levels holds its run: the draw's checks took it.
|
||||
FieldValue::TextureLevelBase(slot) => {
|
||||
let first = (tables.texture(slot)).map_or(0, |t| t.level_base());
|
||||
bytes[at..at + 4].copy_from_slice(&first.to_le_bytes());
|
||||
}
|
||||
FieldValue::ConstexprSampler(place) => {
|
||||
let index = ids.get(place).copied().unwrap_or(0);
|
||||
bytes[at..at + 4].copy_from_slice(&index.to_le_bytes());
|
||||
|
||||
@@ -174,6 +174,7 @@ fn every_device_of_the_cfgs_kind_opens_presents_and_tears_down_to_zero() {
|
||||
("events", gauges.events),
|
||||
("device_samplers", gauges.device_samplers),
|
||||
("lod_clamp_variants", gauges.lod_clamp_variants),
|
||||
("level_elements", gauges.level_elements),
|
||||
("kernel_variants", gauges.kernel_variants),
|
||||
] {
|
||||
println!("M2V-MATRIX gauge device_teardown/{kind}@drop {value}");
|
||||
|
||||
@@ -139,12 +139,12 @@ pub(super) fn at_the_floor() -> Queried {
|
||||
vulkan12: vk::PhysicalDeviceVulkan12Properties::default()
|
||||
.max_per_stage_descriptor_update_after_bind_sampled_images(2 * 65_536)
|
||||
.max_descriptor_set_update_after_bind_sampled_images(2 * 65_536)
|
||||
.max_per_stage_descriptor_update_after_bind_storage_images(2 * 65_536)
|
||||
.max_descriptor_set_update_after_bind_storage_images(2 * 65_536)
|
||||
.max_per_stage_descriptor_update_after_bind_storage_images(3 * 65_536)
|
||||
.max_descriptor_set_update_after_bind_storage_images(3 * 65_536)
|
||||
.max_per_stage_descriptor_update_after_bind_samplers(3 * 8000)
|
||||
.max_descriptor_set_update_after_bind_samplers(3 * 8000)
|
||||
.max_per_stage_update_after_bind_resources(4 * 65_536 + 8)
|
||||
.max_update_after_bind_descriptors_in_all_pools(4 * 65_536 + 3 * 8000),
|
||||
.max_per_stage_update_after_bind_resources(5 * 65_536 + 8)
|
||||
.max_update_after_bind_descriptors_in_all_pools(5 * 65_536 + 3 * 8000),
|
||||
features,
|
||||
extensions: DEVICE_EXTENSIONS
|
||||
.iter()
|
||||
@@ -802,18 +802,18 @@ fn each_low_limit_is_named() {
|
||||
(
|
||||
|d| {
|
||||
d.vulkan12
|
||||
.max_per_stage_descriptor_update_after_bind_storage_images = 2 * 65_536 - 1
|
||||
.max_per_stage_descriptor_update_after_bind_storage_images = 3 * 65_536 - 1
|
||||
},
|
||||
"maxPerStageDescriptorUpdateAfterBindStorageImages",
|
||||
2 * 65_536,
|
||||
3 * 65_536,
|
||||
),
|
||||
(
|
||||
|d| {
|
||||
d.vulkan12
|
||||
.max_descriptor_set_update_after_bind_storage_images = 2 * 65_536 - 1
|
||||
.max_descriptor_set_update_after_bind_storage_images = 3 * 65_536 - 1
|
||||
},
|
||||
"maxDescriptorSetUpdateAfterBindStorageImages",
|
||||
2 * 65_536,
|
||||
3 * 65_536,
|
||||
),
|
||||
(
|
||||
|d| {
|
||||
@@ -834,14 +834,14 @@ fn each_low_limit_is_named() {
|
||||
4000,
|
||||
),
|
||||
(
|
||||
|d| d.vulkan12.max_per_stage_update_after_bind_resources = 4 * 65_536 + 7,
|
||||
|d| d.vulkan12.max_per_stage_update_after_bind_resources = 5 * 65_536 + 7,
|
||||
"maxPerStageUpdateAfterBindResources",
|
||||
4 * 65_536 + 8,
|
||||
5 * 65_536 + 8,
|
||||
),
|
||||
(
|
||||
|d| d.vulkan12.max_update_after_bind_descriptors_in_all_pools = 4 * 65_536 + 23_999,
|
||||
|d| d.vulkan12.max_update_after_bind_descriptors_in_all_pools = 5 * 65_536 + 23_999,
|
||||
"maxUpdateAfterBindDescriptorsInAllPools",
|
||||
4 * 65_536 + 24_000,
|
||||
5 * 65_536 + 24_000,
|
||||
),
|
||||
(
|
||||
|d| d.limits.max_compute_work_group_invocations = 1023,
|
||||
@@ -1650,8 +1650,8 @@ fn the_attachment_reads_take_the_feedback_loop_where_reported_and_a_copy_elsewhe
|
||||
let descriptors = &mut device.vulkan12;
|
||||
descriptors.max_per_stage_descriptor_update_after_bind_sampled_images = 3 * 65_536;
|
||||
descriptors.max_descriptor_set_update_after_bind_sampled_images = 3 * 65_536;
|
||||
descriptors.max_per_stage_update_after_bind_resources = 5 * 65_536 + 8;
|
||||
descriptors.max_update_after_bind_descriptors_in_all_pools = 5 * 65_536 + 3 * 8000;
|
||||
descriptors.max_per_stage_update_after_bind_resources = 6 * 65_536 + 8;
|
||||
descriptors.max_update_after_bind_descriptors_in_all_pools = 6 * 65_536 + 3 * 8000;
|
||||
};
|
||||
let looped = |device: &mut Queried| {
|
||||
(device.extensions).extend(
|
||||
|
||||
@@ -17,6 +17,7 @@ fn each_refusal_enum_answers_its_declared_basis() {
|
||||
assert_eq!(Gap::LinearPlanePass { kind }.basis(), Device);
|
||||
assert_eq!(Gap::CubicSampler.basis(), Ours);
|
||||
assert_eq!(Limit::LodClampVariants { max: 4000 }.basis(), Ours);
|
||||
assert_eq!(Limit::LevelElements { max: 4096 }.basis(), Ours);
|
||||
}
|
||||
|
||||
/// A refusal enum's variant answers its own; a device that lacks the floor's mechanism `Device`;
|
||||
|
||||
@@ -1,22 +1,38 @@
|
||||
//! Storage textures written at a level a function reads at run time (MSL `write(color, coord,
|
||||
//! lod)`), under a device cfg on every device of the cfg's kind, through an owned kernel that
|
||||
//! writes `(x, y, lod, 1)` at texel `(x, y)` of level `lod` of a `texture2d<float, write>`, `lod`
|
||||
//! read from its buffer:
|
||||
//! lod)`), under a device cfg on every device of the cfg's kind, through owned functions that
|
||||
//! write at level `lod` of a `texture2d<float, write>`, `lod` read from their buffer: a kernel that
|
||||
//! writes `(x, y, lod, 1)` at texel `(x, y)`, and a fragment function that writes `(1, 2, lod, 1)`
|
||||
//! at texel `(0, 0)`.
|
||||
//!
|
||||
//! - over an 8 by 8 `RGBA32Float` texture of four levels, every level filled first, dispatches at
|
||||
//! - Over an 8 by 8 `RGBA32Float` texture of four levels, every level filled first, dispatches at
|
||||
//! levels 0, 1 and 2, each over its level's texels, write exactly the 64, 16 and 4 texels of
|
||||
//! those levels, and level 3, which no dispatch writes, keeps its fill: what Metal does on an
|
||||
//! Intel Mac (a Radeon Pro 5300M and a UHD 630 under macOS 26.7.1).
|
||||
//! - Dispatches at levels 4, 9 and `u32::MAX`, past the texture's count, and at levels 0 and 1 of
|
||||
//! nil write nothing: every level keeps its fill.
|
||||
//! - A texture bound again makes no view (`Metrics::image_view_creates`) and takes no run
|
||||
//! (`Gauges::level_elements`): the first bind of each of two textures makes its four views and
|
||||
//! takes one run, and twenty binds after them make none.
|
||||
//! - Draws at levels 1 and 2, then 5, through the fragment function write texel `(0, 0)` of levels
|
||||
//! 1 and 2 and nothing else.
|
||||
//! - 4,097 textures of two levels, each bound to the kernel in one command buffer: the 4,097th's
|
||||
//! dispatch is `Limit::LevelElements { max: 4096 }`, holding no run; once the first texture is
|
||||
//! released and its command buffer has retired, the 4,097th's dispatch runs. Every run is back
|
||||
//! once the device is gone ([`each_device`]'s gauges).
|
||||
//!
|
||||
//! `llvm-as` assembles the kernel; without it the test skips visibly.
|
||||
//! `llvm-as` assembles the functions; without it each test skips visibly.
|
||||
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod on_device {
|
||||
use crate::tests::command::on_device::{each_device, finished};
|
||||
use crate::error::{Error, Limit};
|
||||
use crate::tests::command::on_device::{each_device, finished, within};
|
||||
use crate::tests::draw::on_device::{examples, pass, run, state as render_state, target};
|
||||
use crate::tests::draw::on_device::{vertices, Buffers};
|
||||
use crate::{
|
||||
ComputePipelineDescriptor, ComputePipelineState, Device, DispatchType, FunctionDescriptor,
|
||||
IndexClass, Library, PixelFormat, Region, StageSource, StorageMode, Texture,
|
||||
TextureDescriptor, TextureType, TextureUsage,
|
||||
ColorAttachmentDescriptor, ComputeCommandEncoder, ComputePipelineDescriptor,
|
||||
ComputePipelineState, Device, DispatchType, FunctionDescriptor, IndexClass, Library,
|
||||
PixelFormat, PrimitiveType, Region, RenderPipelineDescriptor, StageSource, StorageMode,
|
||||
Texture, TextureDescriptor, TextureType, TextureUsage,
|
||||
};
|
||||
use metal2vulkan_devtools::{llvm_assemble_text, AssembleError};
|
||||
|
||||
@@ -54,21 +70,51 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
!5 = !{i32 2, !"air.thread_position_in_grid", !"air.arg_type_name", !"uint2", !"air.arg_name", !"gid"}
|
||||
!7 = !{i32 2, i32 8, i32 0}
|
||||
!8 = !{!"Metal", i32 4, i32 0, i32 0}
|
||||
"#;
|
||||
|
||||
/// `level_write_fragment`: a fragment function over `texture2d<float, write> t
|
||||
/// [[texture(0)]]` and `constant uint &lod [[buffer(0)]]` that writes `(1, 2, lod, 1)` at texel
|
||||
/// `(0, 0)` of level `lod` and returns opaque green.
|
||||
const LEVEL_WRITE_FRAGMENT: &str = r#"target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
|
||||
target triple = "air64_v28-apple-macosx26.0.0"
|
||||
|
||||
define <4 x float> @level_write_fragment(ptr addrspace(1) %t, ptr addrspace(2) noundef "air-buffer-no-alias" %lod) {
|
||||
entry:
|
||||
%l = load i32, ptr addrspace(2) %lod, align 4
|
||||
%fl = uitofp i32 %l to float
|
||||
%v = insertelement <4 x float> <float 1.0, float 2.0, float poison, float 1.0>, float %fl, i64 2
|
||||
tail call void @air.write_texture_2d.v4f32(ptr addrspace(1) %t, <2 x i32> zeroinitializer, <4 x float> %v, i32 %l, i32 2)
|
||||
ret <4 x float> <float 0.0, float 1.0, float 0.0, float 1.0>
|
||||
}
|
||||
|
||||
declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float>, i32, i32)
|
||||
|
||||
!air.fragment = !{!0}
|
||||
!air.version = !{!7}
|
||||
!air.language_version = !{!8}
|
||||
!0 = !{ptr @level_write_fragment, !1, !3}
|
||||
!1 = !{!2}
|
||||
!2 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
|
||||
!3 = !{!4, !5}
|
||||
!4 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.write", !"air.arg_type_name", !"texture2d<float, write>", !"air.arg_name", !"t"}
|
||||
!5 = !{i32 1, !"air.buffer", !"air.buffer_size", i32 4, !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 2, !"air.arg_type_size", i32 4, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"uint", !"air.arg_name", !"lod"}
|
||||
!7 = !{i32 2, i32 8, i32 0}
|
||||
!8 = !{!"Metal", i32 4, i32 0, i32 0}
|
||||
"#;
|
||||
|
||||
/// The texture's side, and its levels.
|
||||
const SIDE: u32 = 8;
|
||||
const LEVELS: u32 = 4;
|
||||
|
||||
/// The library of [`LEVEL_WRITE`], or None where `llvm-as` is missing.
|
||||
fn library() -> Option<Library> {
|
||||
match llvm_assemble_text(LEVEL_WRITE) {
|
||||
/// The library of `text`, or None where `llvm-as` is missing.
|
||||
fn library(text: &str) -> Option<Library> {
|
||||
match llvm_assemble_text(text) {
|
||||
Ok(bitcode) => Some(Library::from_air(&bitcode).expect("the library")),
|
||||
Err(AssembleError::Missing(why)) => {
|
||||
eprintln!("SKIPPED: {why}");
|
||||
None
|
||||
}
|
||||
Err(error) => panic!("level_write: {error:?}"),
|
||||
Err(error) => panic!("an owned function: {error:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +133,7 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
(SIDE >> level).max(1)
|
||||
}
|
||||
|
||||
/// The fill of texel `(x, y)` of level `level`: no texel the kernel writes holds it.
|
||||
/// The fill of texel `(x, y)` of level `level`: no texel the functions write holds it.
|
||||
fn fill(level: u32, x: u32, y: u32) -> [f32; 4] {
|
||||
[-1.0 - level as f32, x as f32, y as f32, 0.5]
|
||||
}
|
||||
@@ -109,6 +155,21 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
words.as_chunks::<4>().0.to_vec()
|
||||
}
|
||||
|
||||
/// Asserts that each level of `texture` holds `want(level, x, y)` at each texel.
|
||||
fn holds(name: &str, texture: &Texture, want: impl Fn(u32, u32, u32) -> [f32; 4]) {
|
||||
for level in 0..LEVELS {
|
||||
let side = side(level);
|
||||
let want: Vec<[f32; 4]> = (0..side * side)
|
||||
.map(|i| want(level, i % side, i / side))
|
||||
.collect();
|
||||
assert_eq!(
|
||||
level_texels(name, texture, level),
|
||||
want,
|
||||
"{name}: level {level}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// An 8 by 8 `RGBA32Float` texture of four levels at `index`, of shader-read and shader-write
|
||||
/// usage, each level holding its [`fill`].
|
||||
fn filled(name: &str, device: &Device, index: u32) -> Texture {
|
||||
@@ -143,9 +204,22 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
texture
|
||||
}
|
||||
|
||||
/// Binds `texture` (None: nil) to the kernel's slot and dispatches `grid` threads at level
|
||||
/// `level`.
|
||||
fn dispatch(
|
||||
encoder: &mut ComputeCommandEncoder,
|
||||
texture: Option<&Texture>,
|
||||
level: u32,
|
||||
grid: u32,
|
||||
) -> Result<(), Error> {
|
||||
encoder.set_texture(texture, 0)?;
|
||||
encoder.set_bytes(&level.to_le_bytes(), 0)?;
|
||||
encoder.dispatch_threads([grid, grid, 1], [1, 1, 1])
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_device_writes_the_levels_a_kernel_reads_from_a_buffer() {
|
||||
let Some(library) = library() else {
|
||||
let Some(library) = library(LEVEL_WRITE) else {
|
||||
return;
|
||||
};
|
||||
each_device("storage_levels", |name, _, device| {
|
||||
@@ -170,23 +244,217 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
command_buffer.commit().expect("a commit");
|
||||
finished(name, &command_buffer);
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
for level in 0..LEVELS {
|
||||
let side = side(level);
|
||||
let want: Vec<[f32; 4]> = (0..side * side)
|
||||
.map(|i| {
|
||||
let (x, y) = (i % side, i / side);
|
||||
match level {
|
||||
0..3 => [x as f32, y as f32, level as f32, 1.0],
|
||||
_ => fill(level, x, y),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(
|
||||
level_texels(name, &texture, level),
|
||||
want,
|
||||
"{name}: level {level}"
|
||||
);
|
||||
holds(name, &texture, |level, x, y| match level {
|
||||
0..3 => [x as f32, y as f32, level as f32, 1.0],
|
||||
_ => fill(level, x, y),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_device_drops_a_write_past_the_level_count_and_at_nil() {
|
||||
let Some(library) = library(LEVEL_WRITE) else {
|
||||
return;
|
||||
};
|
||||
each_device("storage_levels_dropped", |name, _, device| {
|
||||
let state = state(name, &device, &library);
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let texture = filled(name, &device, 1);
|
||||
let queue = device.new_command_queue(1).expect("a queue");
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut encoder = (command_buffer.compute_command_encoder(DispatchType::Serial))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
(encoder.set_compute_pipeline_state(&state))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
for level in [LEVELS, 9, u32::MAX] {
|
||||
(dispatch(&mut encoder, Some(&texture), level, SIDE))
|
||||
.unwrap_or_else(|error| panic!("{name}: level {level}: {error}"));
|
||||
}
|
||||
for level in [0, 1] {
|
||||
(dispatch(&mut encoder, None, level, SIDE))
|
||||
.unwrap_or_else(|error| panic!("{name}: nil at level {level}: {error}"));
|
||||
}
|
||||
encoder.end_encoding();
|
||||
command_buffer.commit().expect("a commit");
|
||||
finished(name, &command_buffer);
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
holds(name, &texture, fill);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_device_binds_a_texture_again_with_no_view_made() {
|
||||
let Some(library) = library(LEVEL_WRITE) else {
|
||||
return;
|
||||
};
|
||||
each_device("storage_levels_rebind", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let views = || counters.metrics().image_view_creates.count;
|
||||
let runs = || counters.gauges().level_elements;
|
||||
let state = state(name, &device, &library);
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let (a, b) = (filled(name, &device, 1), filled(name, &device, 2));
|
||||
let made = views();
|
||||
let queue = device.new_command_queue(1).expect("a queue");
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut encoder = (command_buffer.compute_command_encoder(DispatchType::Serial))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
(encoder.set_compute_pipeline_state(&state))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let mut bind = |texture, level| {
|
||||
(dispatch(&mut encoder, Some(texture), level, side(level)))
|
||||
.unwrap_or_else(|error| panic!("{name}: level {level}: {error}"))
|
||||
};
|
||||
bind(&a, 1);
|
||||
assert_eq!(views() - made, u64::from(LEVELS), "{name}: a's first bind");
|
||||
assert_eq!(runs(), 1, "{name}: a's first bind");
|
||||
bind(&b, 2);
|
||||
assert_eq!(
|
||||
views() - made,
|
||||
2 * u64::from(LEVELS),
|
||||
"{name}: b's first bind"
|
||||
);
|
||||
assert_eq!(runs(), 2, "{name}: b's first bind");
|
||||
for _ in 0..10 {
|
||||
bind(&a, 1);
|
||||
bind(&b, 2);
|
||||
}
|
||||
assert_eq!(
|
||||
views() - made,
|
||||
2 * u64::from(LEVELS),
|
||||
"{name}: the binds again"
|
||||
);
|
||||
assert_eq!(runs(), 2, "{name}: the binds again");
|
||||
encoder.end_encoding();
|
||||
command_buffer.commit().expect("a commit");
|
||||
finished(name, &command_buffer);
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
let written = |at: u32| {
|
||||
move |level: u32, x: u32, y: u32| match level == at {
|
||||
true => [x as f32, y as f32, level as f32, 1.0],
|
||||
false => fill(level, x, y),
|
||||
}
|
||||
};
|
||||
holds(name, &a, written(1));
|
||||
holds(name, &b, written(2));
|
||||
drop(command_buffer);
|
||||
drop((a, b));
|
||||
within("the runs' return", || runs() == 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_device_writes_a_level_a_fragment_function_reads_from_a_buffer() {
|
||||
let (Some(examples), Some(library)) = (examples(), library(LEVEL_WRITE_FRAGMENT)) else {
|
||||
return;
|
||||
};
|
||||
let mut descriptor = RenderPipelineDescriptor::new(StageSource::Function(
|
||||
FunctionDescriptor::new(examples.function("colored_vertex").expect("the function")),
|
||||
));
|
||||
descriptor.fragment = Some(StageSource::Function(FunctionDescriptor::new(
|
||||
(library.function("level_write_fragment")).expect("the function"),
|
||||
)));
|
||||
descriptor.color_attachments[0] =
|
||||
Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm));
|
||||
each_device("storage_levels_draw", |name, _, device| {
|
||||
let state = render_state(name, &device, &descriptor);
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let texture = filled(name, &device, 1);
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let (positions, colors) = vertices(&device, &mut buffers);
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let queue = device.new_command_queue(1).expect("a queue");
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut encoder = (command_buffer.render_command_encoder(&pass(&color, None)))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let call = |result: Result<(), Error>| {
|
||||
result.unwrap_or_else(|error| panic!("{name}: {error}"))
|
||||
};
|
||||
call(encoder.set_render_pipeline_state(&state));
|
||||
call(encoder.set_vertex_buffer(Some(&positions), 0, 0));
|
||||
call(encoder.set_vertex_buffer(Some(&colors), 0, 1));
|
||||
call(encoder.set_fragment_texture(Some(&texture), 0));
|
||||
for level in [1u32, 2, 5] {
|
||||
call(encoder.set_fragment_bytes(&level.to_le_bytes(), 0));
|
||||
call(encoder.draw_primitives(PrimitiveType::Triangle, 3, 3, 1, 0));
|
||||
}
|
||||
encoder.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
holds(name, &texture, |level, x, y| match (level, x, y) {
|
||||
(1 | 2, 0, 0) => [1.0, 2.0, level as f32, 1.0],
|
||||
_ => fill(level, x, y),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_device_fills_the_level_elements_past_their_capacity() {
|
||||
let Some(library) = library(LEVEL_WRITE) else {
|
||||
return;
|
||||
};
|
||||
each_device("storage_levels_full", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let runs = || counters.gauges().level_elements;
|
||||
let state = state(name, &device, &library);
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 4097))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let mut d = TextureDescriptor::new(TextureType::Type2D, PixelFormat::RGBA8Unorm, 2, 2);
|
||||
d.mipmap_level_count = 2;
|
||||
d.usage = TextureUsage::SHADER_WRITE;
|
||||
d.storage_mode = StorageMode::Private;
|
||||
let mut textures: Vec<Texture> = (1..=4097)
|
||||
.map(|index| {
|
||||
(device.new_texture(&d, Some(index)))
|
||||
.unwrap_or_else(|error| panic!("{name}: texture {index}: {error}"))
|
||||
})
|
||||
.collect();
|
||||
let queue = device.new_command_queue(2).expect("a queue");
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut encoder = (command_buffer.compute_command_encoder(DispatchType::Concurrent))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
(encoder.set_compute_pipeline_state(&state))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
for (at, texture) in textures[..4096].iter().enumerate() {
|
||||
(dispatch(&mut encoder, Some(texture), 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: texture {}: {error}", at + 1));
|
||||
}
|
||||
assert_eq!(runs(), 4096, "{name}");
|
||||
match dispatch(&mut encoder, Some(&textures[4096]), 1, 1) {
|
||||
Err(Error::Limit(limit)) => {
|
||||
assert_eq!(limit, Limit::LevelElements { max: 4096 }, "{name}")
|
||||
}
|
||||
other => panic!("{name}: the 4,097th texture's dispatch: {other:?}"),
|
||||
}
|
||||
assert_eq!(runs(), 4096, "{name}: the refused dispatch holds no run");
|
||||
encoder.end_encoding();
|
||||
command_buffer.commit().expect("a commit");
|
||||
finished(name, &command_buffer);
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
drop(command_buffer);
|
||||
drop(textures.remove(0));
|
||||
within("the first texture's run", || runs() == 4095);
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut encoder = (command_buffer.compute_command_encoder(DispatchType::Concurrent))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
(encoder.set_compute_pipeline_state(&state))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
(dispatch(&mut encoder, Some(&textures[4095]), 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: the 4,097th texture, again: {error}"));
|
||||
assert_eq!(runs(), 4096, "{name}");
|
||||
encoder.end_encoding();
|
||||
command_buffer.commit().expect("a commit");
|
||||
finished(name, &command_buffer);
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
drop(command_buffer);
|
||||
drop(textures);
|
||||
within("every run's return", || runs() == 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -250,6 +250,18 @@ pub(crate) struct TextureInner {
|
||||
/// mapping and range, and the view once a draw read through it, which its second element
|
||||
/// names.
|
||||
shadow: Option<ShadowView>,
|
||||
/// Its run of set 1's level elements ([`TextureObject::hold_levels`]), once a dispatch or a
|
||||
/// draw bound it to a slot written or read at a level other than the constant 0, and given
|
||||
/// back with it.
|
||||
levels: Mutex<Option<LevelRun>>,
|
||||
}
|
||||
|
||||
/// A texture's run of set 1's level elements ([`TextureInner`]'s `levels`): its first element,
|
||||
/// and the single-level storage views of the texture's levels its elements hold, from its first
|
||||
/// level; none where the texture has no storage element, whose run stays null.
|
||||
struct LevelRun {
|
||||
first: u32,
|
||||
views: Vec<vk::ImageView>,
|
||||
}
|
||||
|
||||
/// What holds a texture's texels ([`TextureInner`]'s `body`).
|
||||
@@ -1058,6 +1070,16 @@ impl Drop for TextureInner {
|
||||
if let Some(view) = shadow {
|
||||
core.pool.release(core, Free::ShadowView(view));
|
||||
}
|
||||
// Its run's elements go null before its views go.
|
||||
let levels = (self.levels.get_mut())
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
.take();
|
||||
if let Some(LevelRun { first, views }) = levels {
|
||||
core.pool.release(core, Free::LevelElements(first));
|
||||
if !views.is_empty() {
|
||||
core.pool.release(core, Free::LevelViews(views));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1500,6 +1522,7 @@ impl Device {
|
||||
emulation: plan.emulation,
|
||||
attachments: Mutex::new(Vec::new()),
|
||||
shadow: None,
|
||||
levels: Mutex::new(None),
|
||||
};
|
||||
Ok(Texture {
|
||||
inner: Arc::new(inner),
|
||||
@@ -1756,6 +1779,7 @@ impl Device {
|
||||
emulation: plan.emulation,
|
||||
attachments: Mutex::new(Vec::new()),
|
||||
shadow,
|
||||
levels: Mutex::new(None),
|
||||
};
|
||||
// Over a buffer of no device copy, the commands track what they write while it lives
|
||||
// (`crate::over`).
|
||||
@@ -2991,6 +3015,18 @@ unsafe fn image_view(
|
||||
made.map_err(Error::vulkan("vkCreateImageView"))
|
||||
}
|
||||
|
||||
/// Destroys `views`.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Each is of `device`, and no work uses it.
|
||||
unsafe fn destroy_views(device: &ash::Device, views: Vec<vk::ImageView>) {
|
||||
for view in views {
|
||||
// SAFETY: the caller's contract.
|
||||
unsafe { device.destroy_image_view(view, None) };
|
||||
}
|
||||
}
|
||||
|
||||
/// Every level and layer of an image of `aspects`.
|
||||
fn whole(aspects: vk::ImageAspectFlags) -> vk::ImageSubresourceRange {
|
||||
vk::ImageSubresourceRange {
|
||||
@@ -3866,6 +3902,52 @@ impl TextureInner {
|
||||
.expect("an image path reached by a texture buffer, which every such call refuses")
|
||||
}
|
||||
|
||||
/// A single-level storage view of each of its first `levels` levels, from its first, of its
|
||||
/// storage element's type, format and layers ([`storage_view_type`]): the views its run of
|
||||
/// level elements holds ([`TextureObject::hold_levels`]).
|
||||
///
|
||||
/// Err: [`Error::Vulkan`] where a view cannot be made; what was made is destroyed.
|
||||
fn level_views(&self, levels: u32) -> Result<Vec<vk::ImageView>, Error> {
|
||||
let shape = shape(&self.descriptor)?;
|
||||
let view_type = storage_view_type(shape.view_type);
|
||||
let [level, layer] = self.base();
|
||||
let image = self.imaged().image;
|
||||
let usage = (self.views_usage).map(|usage| usage & vk::ImageUsageFlags::STORAGE);
|
||||
let mut views = Vec::with_capacity(levels as usize);
|
||||
for at in level..level + levels {
|
||||
let range = vk::ImageSubresourceRange {
|
||||
aspect_mask: vk::ImageAspectFlags::COLOR,
|
||||
base_mip_level: at,
|
||||
level_count: 1,
|
||||
base_array_layer: layer,
|
||||
layer_count: shape.layers,
|
||||
};
|
||||
let components = vk::ComponentMapping::default();
|
||||
// SAFETY: the image is bound, of the storage usage its storage element has, lists the
|
||||
// view's format, and holds the range: the texture's levels and layers.
|
||||
let made = unsafe {
|
||||
image_view(
|
||||
&self.core,
|
||||
image,
|
||||
view_type,
|
||||
self.format,
|
||||
components,
|
||||
range,
|
||||
usage,
|
||||
)
|
||||
};
|
||||
match made {
|
||||
Ok(view) => views.push(view),
|
||||
Err(error) => {
|
||||
// SAFETY: nothing used the views.
|
||||
unsafe { destroy_views(&self.core.device, views) };
|
||||
return Err(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(views)
|
||||
}
|
||||
|
||||
/// Whether it has a storage element: a storage view of its image, or a texture buffer's view
|
||||
/// in the storage texel-buffer array.
|
||||
fn stores(&self) -> bool {
|
||||
@@ -4270,6 +4352,7 @@ impl Texture {
|
||||
emulation: plan.emulation,
|
||||
attachments: Mutex::new(Vec::new()),
|
||||
shadow,
|
||||
levels: Mutex::new(None),
|
||||
};
|
||||
Ok(Texture {
|
||||
inner: Arc::new(view),
|
||||
@@ -5296,6 +5379,76 @@ pub(crate) trait TextureObject {
|
||||
TextureInner::reads(self.object()) != TextureSwizzleChannels::DEFAULT
|
||||
}
|
||||
|
||||
/// Its level count as a function's `get_num_mip_levels` of a storage texture and the bounds of
|
||||
/// its levels read it (`PushField::TextureLevels`): its own where shaders reach it at an
|
||||
/// index, else 0, as nil's, whose resource ID it pushes.
|
||||
fn level_count(&self) -> u32 {
|
||||
let inner = self.object();
|
||||
match inner.index {
|
||||
Some(_) => inner.descriptor.mipmap_level_count,
|
||||
None => 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// The first element of the run of set 1's storage-texture array that holds its levels
|
||||
/// (`PushField::TextureLevelBase`): its run of level elements where it holds one
|
||||
/// ([`hold_levels`](Self::hold_levels)), else its own index, whose storage element is its one
|
||||
/// level, and 0, nil's, where shaders reach it at no index. A dispatch or a draw that pushes
|
||||
/// it held the texture's run first.
|
||||
fn level_base(&self) -> u32 {
|
||||
let inner = self.object();
|
||||
match &*lock(&inner.levels) {
|
||||
Some(run) => run.first,
|
||||
None => inner.index.map_or(0, |(index, _)| index),
|
||||
}
|
||||
}
|
||||
|
||||
/// Its run of set 1's level elements, taken where it has more than one level, shaders reach
|
||||
/// it at an index, and it holds none yet (`Arrays::place_levels`): a single-level storage
|
||||
/// view of each of its levels at the run's elements, where it has a storage element; none
|
||||
/// where it has not, so its run reads and writes as nil does. Made at the first dispatch or
|
||||
/// draw that binds it to a slot written or read at a level other than the constant 0, and
|
||||
/// given back as it goes; a later bind takes its lock and makes nothing.
|
||||
///
|
||||
/// Err: [`Limit::LevelElements`] where every run is held, or it has more levels than a run;
|
||||
/// [`Error::Vulkan`] where a view cannot be made.
|
||||
fn hold_levels(&self) -> Result<(), Error> {
|
||||
let inner = self.object();
|
||||
let levels = inner.descriptor.mipmap_level_count;
|
||||
if levels < 2 || inner.index.is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
let mut run = lock(&inner.levels);
|
||||
if run.is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
if levels > crate::floor::LEVEL_RUN {
|
||||
return Err(Error::Limit(Limit::LevelElements {
|
||||
max: crate::floor::LEVEL_ELEMENTS / crate::floor::LEVEL_RUN,
|
||||
}));
|
||||
}
|
||||
let views = match inner.stores() {
|
||||
true => inner.level_views(levels)?,
|
||||
false => Vec::new(),
|
||||
};
|
||||
let core = &inner.core;
|
||||
// SAFETY: each view is live, of the device and of the texture's image, which is in the
|
||||
// general layout whenever work uses its storage views, until the texture's drop gives back
|
||||
// the run before its views.
|
||||
let placed = unsafe { (core.arrays).place_levels(&core.device, &core.counters, &views) };
|
||||
match placed {
|
||||
Ok(first) => {
|
||||
*run = Some(LevelRun { first, views });
|
||||
Ok(())
|
||||
}
|
||||
Err(error) => {
|
||||
// SAFETY: nothing used the views.
|
||||
unsafe { destroy_views(&core.device, views) };
|
||||
Err(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// How Metal's bicubic filter treats its texels, under the swizzle it is sampled through
|
||||
/// (`metal::format::bicubic_texels_word`): `None` for a format with no such treatment.
|
||||
fn bicubic_texels(&self) -> Option<u32> {
|
||||
@@ -5849,6 +6002,7 @@ impl Device {
|
||||
emulation: FormatEmulation::Direct,
|
||||
attachments: Mutex::new(Vec::new()),
|
||||
shadow: None,
|
||||
levels: Mutex::new(None),
|
||||
};
|
||||
Ok(Texture {
|
||||
inner: Arc::new(inner),
|
||||
@@ -6113,6 +6267,7 @@ impl Device {
|
||||
emulation: plan.emulation,
|
||||
attachments: Mutex::new(Vec::new()),
|
||||
shadow,
|
||||
levels: Mutex::new(None),
|
||||
};
|
||||
let texture = Texture {
|
||||
inner: Arc::new(inner),
|
||||
|
||||
@@ -1224,12 +1224,12 @@
|
||||
"VkPhysicalDeviceVulkan12Properties": {
|
||||
"maxPerStageDescriptorUpdateAfterBindSampledImages": 131072,
|
||||
"maxDescriptorSetUpdateAfterBindSampledImages": 131072,
|
||||
"maxPerStageDescriptorUpdateAfterBindStorageImages": 131072,
|
||||
"maxDescriptorSetUpdateAfterBindStorageImages": 131072,
|
||||
"maxPerStageDescriptorUpdateAfterBindStorageImages": 196608,
|
||||
"maxDescriptorSetUpdateAfterBindStorageImages": 196608,
|
||||
"maxPerStageDescriptorUpdateAfterBindSamplers": 24000,
|
||||
"maxDescriptorSetUpdateAfterBindSamplers": 24000,
|
||||
"maxPerStageUpdateAfterBindResources": 262152,
|
||||
"maxUpdateAfterBindDescriptorsInAllPools": 286144
|
||||
"maxPerStageUpdateAfterBindResources": 327688,
|
||||
"maxUpdateAfterBindDescriptorsInAllPools": 351680
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+1
@@ -898,6 +898,7 @@ codec_enum! {
|
||||
IndirectRange,
|
||||
IndirectSequence,
|
||||
IndirectBase,
|
||||
TextureLevelBase(f0),
|
||||
}
|
||||
Symbol { Binding(f0), DescriptorSet(f0), Location(f0), Component(f0), SpecId(f0) }
|
||||
}
|
||||
|
||||
@@ -209,11 +209,12 @@ pub const fn shape(f: PushField) -> FieldShape {
|
||||
PushField::ZeroAddress | PushField::IndirectRange => FieldShape::U64,
|
||||
// The command of an indirect command buffer's execution, and its part's first.
|
||||
PushField::IndirectSequence | PushField::IndirectBase => FieldShape::U32,
|
||||
// A texture's mipmap level count, an acceleration structure's instance count, the render
|
||||
// encoder's viewport count, the render pass's array length, a kernel stage-in buffer's
|
||||
// bound stride, a storage texture's integer channels' widths, a bicubic slot's format
|
||||
// treatment.
|
||||
// A texture's mipmap level count and its levels' first storage element, an acceleration
|
||||
// structure's instance count, the render encoder's viewport count, the render pass's array
|
||||
// length, a kernel stage-in buffer's bound stride, a storage texture's integer channels'
|
||||
// widths, a bicubic slot's format treatment.
|
||||
PushField::TextureLevels(_)
|
||||
| PushField::TextureLevelBase(_)
|
||||
| PushField::TextureIntegerChannels(_)
|
||||
| PushField::BicubicTexels(_)
|
||||
| PushField::InstanceCount(_)
|
||||
|
||||
@@ -1806,8 +1806,6 @@ fn identity_unsourced(f: &RuntimeFact) -> bool {
|
||||
| RuntimeFact::HeapNumericType { .. }
|
||||
| RuntimeFact::StorageTextureNumericType { .. }
|
||||
| RuntimeFact::BicubicTexels { .. }
|
||||
| RuntimeFact::StorageTextureLevels { .. }
|
||||
| RuntimeFact::StorageTextureLevelViews { .. }
|
||||
| RuntimeFact::SparseTexture { .. }
|
||||
| RuntimeFact::SrgbTexture { .. }
|
||||
| RuntimeFact::OpenClLineTexture { .. }
|
||||
@@ -1837,7 +1835,9 @@ fn identity_unsourced(f: &RuntimeFact) -> bool {
|
||||
/// descriptor and no state of a bound texture or sampler but its resource ID's: a texture's
|
||||
/// presence, its format's missing alpha and the border texels a read through a sampler reads
|
||||
/// (`SlotPlan::identity_lowered`, [`identity_unsourced`]). The values it reads of the encoder are
|
||||
/// pushed: the dispatch's region, a storage texture's integer channel widths, the compute
|
||||
/// pushed: the dispatch's region, a storage texture's integer channel widths, its level count
|
||||
/// and the first element of its levels' run in set 1's storage array (`PushField::TextureLevels`,
|
||||
/// `PushField::TextureLevelBase`), the compute
|
||||
/// encoder's stage-in region (`PushField::StageInRegion`), the stride of a vertex layout whose
|
||||
/// attributes the function pulls (`PushField::VertexBufferStride`): a post-tessellation function's
|
||||
/// control points and patches, and a plain vertex function's layouts that a pulled-vertex-buffer
|
||||
@@ -1885,6 +1885,8 @@ fn identity_refusal(plan: &Plan) -> Option<String> {
|
||||
| PushField::ZeroAddress
|
||||
| PushField::DispatchRegion
|
||||
| PushField::TextureIntegerChannels(_)
|
||||
| PushField::TextureLevels(_)
|
||||
| PushField::TextureLevelBase(_)
|
||||
| PushField::BicubicTexels(_)
|
||||
| PushField::ConstexprSampler(_)
|
||||
| PushField::StageInRegion
|
||||
|
||||
@@ -479,7 +479,7 @@ fn image_in(
|
||||
flagged: None,
|
||||
});
|
||||
};
|
||||
let (img, within) = level_element(cx, fb, at, ptr, n, level)?;
|
||||
let (img, within) = level_element(cx, fb, at, ptr, Some(n), level)?;
|
||||
Ok(Loaded {
|
||||
decl,
|
||||
img,
|
||||
@@ -509,26 +509,38 @@ pub(crate) fn identity_id(
|
||||
|
||||
/// Under the identity domains, texture slot `index`'s image: the element of its class's set-1
|
||||
/// array (`slot::identity_class`) at the index its resource ID holds, which is uniform over the
|
||||
/// call. A slot has one level here (`level` is `None`).
|
||||
/// call; a slot with level views reads level `level` (`None`: 0) of the run of that array its
|
||||
/// `PushField::TextureLevelBase` names ([`level_element`]). A slot without them has one level
|
||||
/// here (`level` is `None`).
|
||||
fn identity_image(
|
||||
cx: &mut EmitCx<'_>,
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
index: u32,
|
||||
level: Option<ValueId>,
|
||||
) -> BResult<Loaded> {
|
||||
let decl = cx
|
||||
.plan
|
||||
.families
|
||||
.texture
|
||||
.slots
|
||||
.get(&index)
|
||||
.and_then(|s| s.decl);
|
||||
let slot = cx.plan.families.texture.slots.get(&index);
|
||||
let (decl, at) = (slot.and_then(|s| s.decl), slot.map(|s| s.slot));
|
||||
let global = cx.decl.families.texture.images.get(&index).copied();
|
||||
let (Some(decl), Some((g, _)), None) = (decl, global, level) else {
|
||||
let (Some(decl), Some(at), Some((g, _))) = (decl, at, global) else {
|
||||
return Err(cx.fail(format!("texture slot {index} is not declared")));
|
||||
};
|
||||
let (element, _) = identity_id(cx, fb, index)?;
|
||||
let base = fb.module().global_value(g)?;
|
||||
if decl.level_views.is_some() {
|
||||
let (img, within) = level_element(cx, fb, at, base, None, level)?;
|
||||
return Ok(Loaded {
|
||||
decl,
|
||||
img,
|
||||
live: None,
|
||||
within: Some(within),
|
||||
flagged: None,
|
||||
});
|
||||
}
|
||||
if level.is_some() {
|
||||
return Err(cx.fail(format!(
|
||||
"a level of texture slot {index} without level views"
|
||||
)));
|
||||
}
|
||||
let (element, _) = identity_id(cx, fb, index)?;
|
||||
let p = fb.access_chain(base, &[element])?;
|
||||
let img = fb.load(p, MemAccess::default())?;
|
||||
Ok(Loaded {
|
||||
@@ -551,33 +563,49 @@ pub(crate) fn slot_image(
|
||||
Ok((decl, img))
|
||||
}
|
||||
|
||||
/// Element `level` (`None`: 0) of the `n` level views `ptr` points to, slot `slot`'s, and whether
|
||||
/// the level is below the bound texture's level count (`PushField::TextureLevels`). A constant
|
||||
/// level below `n` indexes the array as is (that element is a neutral where the texture lacks the
|
||||
/// level); any other level is clamped below the count first (element 0, a neutral, for a count of
|
||||
/// 0), so the access never leaves the array, and indexes it `NonUniform`.
|
||||
/// Element `level` (`None`: 0) of slot `slot`'s level views, and whether the level is below the
|
||||
/// bound texture's level count (`PushField::TextureLevels`). The views are the `n` elements of the
|
||||
/// slot's own array `ptr` points to (`Some(n)`), or under the identity domains (`None`) the run of
|
||||
/// the set-1 array `ptr` points to from the element the slot's `PushField::TextureLevelBase`
|
||||
/// names. A constant level below `n` indexes the slot's array as is (that element is a neutral
|
||||
/// where the texture lacks the level), and the level 0 the run's first element; any other level is
|
||||
/// clamped below the count first (the first element for a count of 0), so the access never leaves
|
||||
/// the views, and indexes them `NonUniform` where the level is not a constant.
|
||||
fn level_element(
|
||||
cx: &mut EmitCx<'_>,
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
slot: crate::pipeline::sym::SlotRef,
|
||||
ptr: SValue,
|
||||
n: u32,
|
||||
n: Option<u32>,
|
||||
level: Option<ValueId>,
|
||||
) -> BResult<(SValue, SValue)> {
|
||||
let count = cx.push_field(fb, crate::pipeline::sym::PushField::TextureLevels(slot))?;
|
||||
use crate::pipeline::sym::PushField;
|
||||
let count = cx.push_field(fb, PushField::TextureLevels(slot))?;
|
||||
let l = match level {
|
||||
Some(l) => cx.operand(fb, l)?,
|
||||
None => u32s(fb, 1, 0)?,
|
||||
};
|
||||
let within = fb.binary(BinOp::ULessThan, l, count)?;
|
||||
let element = match fb.const_scalar(l)? {
|
||||
Some(k) if k < u64::from(n) => fb.access_chain(ptr, &[l])?,
|
||||
let first = match n {
|
||||
Some(_) => None,
|
||||
None => Some(cx.push_field(fb, PushField::TextureLevelBase(slot))?),
|
||||
};
|
||||
let constant = fb.const_scalar(l)?;
|
||||
let element = match (constant, n, first) {
|
||||
(Some(k), Some(n), _) if k < u64::from(n) => fb.access_chain(ptr, &[l])?,
|
||||
(Some(0), _, Some(first)) => fb.access_chain(ptr, &[first])?,
|
||||
_ => {
|
||||
let one = u32s(fb, 1, 1)?;
|
||||
let some = fb.glsl(GlslOp::UMax, &[count, one])?;
|
||||
let top = fb.binary(BinOp::ISub, some, one)?;
|
||||
let index = fb.glsl(GlslOp::UMin, &[l, top])?;
|
||||
fb.access_chain_non_uniform(ptr, index)?
|
||||
let mut index = fb.glsl(GlslOp::UMin, &[l, top])?;
|
||||
if let Some(first) = first {
|
||||
index = fb.binary(BinOp::IAdd, first, index)?;
|
||||
}
|
||||
match (constant, first) {
|
||||
(Some(_), Some(_)) => fb.access_chain(ptr, &[index])?,
|
||||
_ => fb.access_chain_non_uniform(ptr, index)?,
|
||||
}
|
||||
}
|
||||
};
|
||||
let img = fb.load(element, MemAccess::default())?;
|
||||
|
||||
@@ -117,6 +117,14 @@
|
||||
//! textures). Heap storage images take only the constant 0, and a
|
||||
//! texture atomic on a slot with level views is not implemented.
|
||||
//!
|
||||
//! Under the identity domains the level views are no array of the slot's own: they are a run of
|
||||
//! the set-1 storage array, each element a single-level view of the bound texture's level, in
|
||||
//! order from its first, and the consumer pushes the run's first element
|
||||
//! (`PushField::TextureLevelBase`) beside the level count, with no fact. An access at level `l`
|
||||
//! takes element `first + min(l, max(n, 1) − 1)` within the `l < n` check, `NonUniform` where `l`
|
||||
//! is not a constant, and the level 0 the first element. A texture of one level is its own run
|
||||
//! (its resource ID's element), and nil's run is element 0, the null descriptor, of count 0.
|
||||
//!
|
||||
//! **Size queries at a level** (`emit::level_extent`). A width, height, or depth query at a level
|
||||
//! that is not the constant 0, of a sampled or storage texture, answers Metal's
|
||||
//! `max(1, e >> (l & 255))` of the extent `e` of the texture's first level, at every level `l`,
|
||||
|
||||
@@ -980,8 +980,10 @@ pub fn max_levels(profile: &crate::device::DeviceProfile, dim: ImageDim) -> u32
|
||||
d.max(1).ilog2() + 1
|
||||
}
|
||||
|
||||
/// The level views of storage slot `s`, checked on the profile, with their facts and push field:
|
||||
/// `None` for a slot without them.
|
||||
/// The level views of storage slot `s`, checked on the profile, with their facts and push fields:
|
||||
/// `None` for a slot without them. Under the identity domains the views are the run of set 1's
|
||||
/// storage array the slot's `PushField::TextureLevelBase` names, and no fact is stated: the
|
||||
/// consumer pushes the bound texture's level count and its run's first element.
|
||||
fn level_views(
|
||||
cx: &SelectCx<'_>,
|
||||
s: &SlotPlan,
|
||||
@@ -990,8 +992,11 @@ fn level_views(
|
||||
push: &mut Vec<PushField>,
|
||||
) -> Result<Option<u32>, Error> {
|
||||
let u = &s.uses;
|
||||
let identity = crate::lower::access::identity(cx.profile);
|
||||
if u.levels || u.level_views {
|
||||
facts.push(RuntimeFact::StorageTextureLevels { slot: s.slot });
|
||||
if !identity {
|
||||
facts.push(RuntimeFact::StorageTextureLevels { slot: s.slot });
|
||||
}
|
||||
push.push(PushField::TextureLevels(s.slot));
|
||||
}
|
||||
if !u.level_views {
|
||||
@@ -1010,7 +1015,10 @@ fn level_views(
|
||||
VkFeature::ShaderStorageImageArrayNonUniformIndexing,
|
||||
));
|
||||
}
|
||||
facts.push(RuntimeFact::StorageTextureLevelViews { slot: s.slot });
|
||||
match identity {
|
||||
true => push.push(PushField::TextureLevelBase(s.slot)),
|
||||
false => facts.push(RuntimeFact::StorageTextureLevelViews { slot: s.slot }),
|
||||
}
|
||||
Ok(Some(n))
|
||||
}
|
||||
|
||||
@@ -1541,14 +1549,14 @@ impl SlotPlan {
|
||||
/// buffer's is a texel buffer's, uniform where the slot reads and storage where it writes, the
|
||||
/// element its resource ID holds in the texel-buffer arrays. A storage cube or cube array is
|
||||
/// declared as the 2D array of its faces (layer `6 · cube + face`), which is its storage element:
|
||||
/// the runtime holds a cube's storage view as that 2D array. `None` for a declaration the identity
|
||||
/// arrays hold no element of yet: a sampled cube viewed as an array, level views, a texture
|
||||
/// buffer's parts, an extended-range or RGBX form, or a storage image with another format or a
|
||||
/// conversion.
|
||||
/// the runtime holds a cube's storage view as that 2D array. A storage slot's level views are
|
||||
/// elements of the same array, the run its `PushField::TextureLevelBase` names. `None` for a
|
||||
/// declaration the identity arrays hold no element of yet: a sampled cube viewed as an array, a
|
||||
/// texture buffer's parts, an extended-range or RGBX form, or a storage image with another format
|
||||
/// or a conversion.
|
||||
pub(crate) fn identity_class(decl: &ImageDecl) -> Option<ImageHandleClass> {
|
||||
let storage = decl.usage == ImageUsage::Storage;
|
||||
let plain = !(decl.cube_as_array && !storage)
|
||||
&& decl.level_views.is_none()
|
||||
&& decl.extended.is_none()
|
||||
&& !decl.x_channel
|
||||
&& decl.parts.is_none()
|
||||
|
||||
@@ -891,8 +891,17 @@ pub enum PushField {
|
||||
/// The encoder's tessellation factor scale rounded to `half` (`float`), a control-stage field.
|
||||
TessellationFactorScale,
|
||||
/// The mipmap level count (`u32`) of the storage texture bound to the slot, 0 where the binder
|
||||
/// binds a neutral (`RuntimeFact::StorageTextureLevels`).
|
||||
/// binds a neutral (`RuntimeFact::StorageTextureLevels`). Under the identity domains no fact
|
||||
/// is stated: 0 where the slot's resource ID is nil.
|
||||
TextureLevels(SlotRef),
|
||||
/// Under the identity domains, the first element (`u32`) of the run of set 1's storage-image
|
||||
/// array that holds the levels of the storage texture bound to a slot read or written at a
|
||||
/// level other than the constant 0, each its own single-level storage view, in order from the
|
||||
/// texture's first level (`docs/RESOURCE-ID.md`): an access at level `l` reads or writes element
|
||||
/// `first + min(l, max(n, 1) − 1)`, `n` the slot's [`PushField::TextureLevels`], and only
|
||||
/// where `l < n`. A texture of one level pushes its resource ID's index, whose storage element
|
||||
/// is that level, and nil pushes 0.
|
||||
TextureLevelBase(SlotRef),
|
||||
/// The instance count (`u32`) of the instance acceleration structure bound at the buffer slot,
|
||||
/// 0 where none is bound (`RuntimeFact::AccelerationStructureInstanceCount`).
|
||||
InstanceCount(SlotRef),
|
||||
|
||||
@@ -910,6 +910,152 @@ fn a_storage_cube_written_by_face_is_the_2d_array_element_of_its_faces() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A kernel over a `side × side` grid writing `(x, y, lod, 7)` at texel `(x, y)` of level `lod`
|
||||
/// of its `texture2d<uint, write>` slot 0, `lod` read from `constant uint &lod` (buffer 1).
|
||||
const LEVEL_WRITE_KERNEL: &str = "define void @lw(ptr addrspace(1) %t, ptr addrspace(2) noundef \"air-buffer-no-alias\" %lod, <2 x i32> noundef %gid) {\n\
|
||||
entry:\n\
|
||||
%l = load i32, ptr addrspace(2) %lod, align 4\n\
|
||||
%x = extractelement <2 x i32> %gid, i64 0\n\
|
||||
%y = extractelement <2 x i32> %gid, i64 1\n\
|
||||
%v0 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 7>, i32 %x, i64 0\n\
|
||||
%v1 = insertelement <4 x i32> %v0, i32 %y, i64 1\n\
|
||||
%v = insertelement <4 x i32> %v1, i32 %l, i64 2\n\
|
||||
tail call void @air.write_texture_2d.u.v4i32(ptr addrspace(1) %t, <2 x i32> %gid, <4 x i32> %v, i32 %l, i32 2)\n\
|
||||
ret void\n\
|
||||
}\n\n\
|
||||
declare void @air.write_texture_2d.u.v4i32(ptr addrspace(1), <2 x i32>, <4 x i32>, i32, i32)\n\n\
|
||||
!air.kernel = !{!0}\n!air.version = !{!4}\n!air.language_version = !{!5}\n\
|
||||
!0 = !{ptr @lw, !1, !2}\n!1 = !{}\n!2 = !{!6, !7, !3}\n\
|
||||
!6 = !{i32 0, !\"air.texture\", !\"air.location_index\", i32 0, i32 1, !\"air.write\", !\"air.arg_type_name\", !\"texture2d<uint, write>\", !\"air.arg_name\", !\"t\"}\n\
|
||||
!7 = !{i32 1, !\"air.buffer\", !\"air.buffer_size\", i32 4, !\"air.location_index\", i32 1, i32 1, !\"air.read\", !\"air.address_space\", i32 2, !\"air.arg_type_size\", i32 4, !\"air.arg_type_align_size\", i32 4, !\"air.arg_type_name\", !\"uint\", !\"air.arg_name\", !\"lod\"}\n\
|
||||
!3 = !{i32 2, !\"air.thread_position_in_grid\", !\"air.arg_type_name\", !\"uint2\", !\"air.arg_name\", !\"gid\"}\n\
|
||||
!4 = !{i32 2, i32 8, i32 0}\n!5 = !{!\"Metal\", i32 4, i32 0, i32 0}\n";
|
||||
|
||||
/// A storage slot written at a level the kernel reads from a buffer is, under the identity
|
||||
/// domains, an element of the storage class's run its pushed `TextureLevelBase` names, at the
|
||||
/// level below its pushed `TextureLevels`: levels 0, 1 and 2 of a texture of three levels land on
|
||||
/// the run's three elements in order and nowhere else; levels 3 and 7, past the count, land
|
||||
/// nowhere; a texture of one level (its own element, count 1) takes level 0 and drops level 1;
|
||||
/// nil (element 0, count 0) drops every level.
|
||||
#[test]
|
||||
fn a_storage_slot_written_at_a_run_time_level_is_an_element_of_its_run() {
|
||||
let Some(bc) = assemble_text("lw", LEVEL_WRITE_KERNEL) else {
|
||||
return;
|
||||
};
|
||||
const LOD: u64 = 0x10_0000;
|
||||
// The texture's resource ID holds index 3, its run is elements 8 to 10, and element 11 is
|
||||
// past it; the others are other textures'.
|
||||
const I: u32 = 3;
|
||||
const RUN: u32 = 8;
|
||||
for stem in ["lavapipe", "runtime-floor"] {
|
||||
let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}"));
|
||||
let (a, plan, module) =
|
||||
compile_kept(&bc, "lw", &p).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: L3: {e}"));
|
||||
let linked = link(&[&a], &LinkInputs::standalone(), &p).unwrap_or_else(|e| panic!("{e}"));
|
||||
let mut classes = (linked.table.bindings.iter()).filter(|(_, b)| **b == (1, 1));
|
||||
let (storage, _) = classes
|
||||
.next()
|
||||
.unwrap_or_else(|| panic!("{stem}: no storage class"));
|
||||
assert!(classes.next().is_none(), "{stem}: two storage classes");
|
||||
// A dispatch of `side × side` threads at level `lod` over elements 0 to 11, the slot
|
||||
// pushing its resource ID's index, its level count and its run's first element.
|
||||
let dispatch = |lod: u32, side: u32, (id, count, first): (u32, u32, u32)| {
|
||||
let l = [side, side, 1];
|
||||
let mut push = vec![0u8; plan.push.push_range.map_or(0, |(_, end)| end as usize)];
|
||||
for field in &plan.push.fields {
|
||||
let PushLoc::Push { offset } = field.loc else {
|
||||
panic!("{stem}: {field:?} spilled");
|
||||
};
|
||||
let o = offset as usize;
|
||||
match field.field {
|
||||
PushField::SlotGuestBase(s) => {
|
||||
let word = match (s.class, s.index) {
|
||||
(SlotClass::Texture, 0) => resource_id(id, 0),
|
||||
(SlotClass::Buffer, 1) => slot_word(LOD),
|
||||
_ => panic!("{stem}: unexpected slot {s:?}"),
|
||||
};
|
||||
push[o..o + 8].copy_from_slice(&word.to_le_bytes());
|
||||
}
|
||||
PushField::SlotBounds(_) => push[o..o + 8].copy_from_slice(&bounds_word(4, 0)),
|
||||
PushField::ZeroAddress => {
|
||||
push[o..o + 8].copy_from_slice(&ZERO_UNMAPPED.to_le_bytes())
|
||||
}
|
||||
PushField::DispatchRegion => {
|
||||
let region = region_bytes([0; 3], l, l).expect("packs");
|
||||
push[o..o + 32].copy_from_slice(®ion);
|
||||
}
|
||||
PushField::TextureLevels(_) => {
|
||||
push[o..o + 4].copy_from_slice(&count.to_le_bytes())
|
||||
}
|
||||
PushField::TextureLevelBase(_) => {
|
||||
push[o..o + 4].copy_from_slice(&first.to_le_bytes())
|
||||
}
|
||||
// 0: the images' channels are 32-bit, so each lane stores as written.
|
||||
PushField::TextureIntegerChannels(_) => {
|
||||
push[o..o + 4].copy_from_slice(&0u32.to_le_bytes())
|
||||
}
|
||||
other => panic!("{stem}: unexpected push field {other:?}"),
|
||||
}
|
||||
}
|
||||
let images: Vec<Image> = (0..12)
|
||||
.map(|e| {
|
||||
let side = match e {
|
||||
I => 4,
|
||||
RUN..=10 => 4 >> (e - RUN),
|
||||
_ => 1,
|
||||
};
|
||||
Image::new(*storage, [side, side, 1], 1, 1, 1).at_element(e)
|
||||
})
|
||||
.collect();
|
||||
let res = Resources {
|
||||
buffers: vec![Buffer {
|
||||
slot: None,
|
||||
address: Some(LOD),
|
||||
bytes: lod.to_le_bytes().to_vec(),
|
||||
}],
|
||||
push,
|
||||
spec: local_size3(l),
|
||||
};
|
||||
let (_, images) = run_with_images(&module, &Config::default(), res, images)
|
||||
.unwrap_or_else(|e| panic!("{stem}: level {lod}: {e}"));
|
||||
images
|
||||
};
|
||||
// Element `written` holds `side × side` texels of level `lod`, and every other element
|
||||
// its zeros.
|
||||
let holds = |images: &[Image], written: Option<u32>, lod: u32, what: &str| {
|
||||
for (e, img) in images.iter().enumerate() {
|
||||
let side = img.extent[0];
|
||||
let want: Vec<[u32; 4]> = match written == Some(e as u32) {
|
||||
true => (0..side)
|
||||
.flat_map(|y| (0..side).map(move |x| [x, y, lod, 7]))
|
||||
.collect(),
|
||||
false => vec![[0; 4]; (side * side) as usize],
|
||||
};
|
||||
assert_eq!(img.texels, want, "{stem}: {what}, element {e}");
|
||||
}
|
||||
};
|
||||
for lod in 0..3u32 {
|
||||
let images = dispatch(lod, 4 >> lod, (I, 3, RUN));
|
||||
holds(&images, Some(RUN + lod), lod, &format!("level {lod}"));
|
||||
}
|
||||
for lod in [3, 7] {
|
||||
let images = dispatch(lod, 4, (I, 3, RUN));
|
||||
holds(&images, None, lod, &format!("level {lod}, past the count"));
|
||||
}
|
||||
holds(&dispatch(0, 4, (I, 1, I)), Some(I), 0, "one level, level 0");
|
||||
holds(&dispatch(1, 4, (I, 1, I)), None, 1, "one level, level 1");
|
||||
for lod in [0, 1] {
|
||||
holds(
|
||||
&dispatch(lod, 4, (0, 0, 0)),
|
||||
None,
|
||||
lod,
|
||||
&format!("nil, level {lod}"),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Set 1's fixed arrays under the identity domains: binding, descriptor type and count.
|
||||
fn identity_arrays() -> Vec<(u32, vk::DescriptorType, u32)> {
|
||||
vec), reads, writes and updates atomically its texture buffers, slots and
|
||||
argument buffers' members alike (a uniform texel buffer where it reads one, a storage texel
|
||||
buffer where it writes one, the element of set 1's texel-buffer array at its ID's index), and
|
||||
samples its texture slots
|
||||
@@ -261,7 +265,7 @@ and so do the command line, the compile worker and every validation tool. It hol
|
||||
the function holds: one that samples through an argument buffer's sampler or samples an
|
||||
argument buffer's texture, emulates a sampler's anisotropy, samples a 1D
|
||||
texture through a bicubic filter, uses a texture buffer's parts or rows
|
||||
form, a slot's levels or swizzle, a two-plane, extended-range or sRGB-twin form, reads an
|
||||
form, a slot's swizzle, a two-plane, extended-range or sRGB-twin form, reads an
|
||||
argument buffer's texture
|
||||
through another numeric type or as raw texels, or uses any other state of a texture or sampler
|
||||
beyond its ID.
|
||||
|
||||
+4
-2
@@ -32,7 +32,7 @@ Columns:
|
||||
| The translation deadline | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
|
||||
| Devices below the runtime's floor | 8 | 8 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 86 | 86 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 18 | 18 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 19 | 19 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 31 | 31 | 0 | 0 | 0 | 0 | 0 |
|
||||
|
||||
## Totals by basis
|
||||
@@ -45,7 +45,7 @@ Columns:
|
||||
| The translation deadline | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
|
||||
| Devices below the runtime's floor | 0 | 0 | 0 | 8 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 23 | 25 | 0 | 0 | 38 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 0 | 0 | 0 | 13 | 5 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 0 | 0 | 0 | 13 | 6 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 0 | 0 | 0 | 3 | 28 | 0 | 0 | 0 |
|
||||
|
||||
## 1. Translator and front-end refusals (`Unsupported`: a `Feature` and its `Needs`)
|
||||
@@ -327,6 +327,7 @@ Columns:
|
||||
| `TextureSize` | A texture whose extent or array layers are past what the device makes of its format, type, usage and sample count | at the device's limit | `device`: the image format query's `maxExtent` and `maxArrayLayers`, and `maxTexelBufferElements` | 2: `crates/metal2vulkan-runtime/src/texture.rs (planned)`, `crates/metal2vulkan-runtime/src/texture.rs (texel_texture)` | `-` |
|
||||
| `DeviceSamplers` | A sampler state whose device samplers would take the device past its `maxSamplerAllocationCount`, less the sampler arrays' two defaults... | at the device's limit | `device`: the device's `maxSamplerAllocationCount` | 1: `crates/metal2vulkan-runtime/src/sampler.rs (take)` | `-` |
|
||||
| `LodClampVariants` | A sampler state bound with LOD clamps of its own past the variants the runtime holds at once | every device (a public call's own check of its arguments) | `ours`: the runtime's 4,000 variant elements | 1: `crates/metal2vulkan-runtime/src/arrays.rs (place_variant)` | `-` |
|
||||
| `LevelElements` | A dispatch or a draw that binds a texture of more than one level to a slot its function writes or reads at a level other than the constant 0 (MSL... | every device (a public call's own check of its arguments) | `ours`: the runtime's 65,536 level elements, 4,096 runs of 16 | 2: `crates/metal2vulkan-runtime/src/arrays.rs (place_levels)`, `crates/metal2vulkan-runtime/src/texture.rs (hold_levels)` | `-` |
|
||||
| `MemoryAllocations` | A `VkDeviceMemory` allocation past the device's `maxMemoryAllocationCount` live ones, refused before the driver is called | at the device's limit | `device`: the device's `maxMemoryAllocationCount` | 1: `crates/metal2vulkan-runtime/src/memory.rs (allocate)` | `-` |
|
||||
| `AllocationNotMapped` | A take that no free range fits made an allocation that the consumer's `BlockMappings::map` did not map | every device (a public call's own check of its arguments) | `ours`: the consumer's hook gave the allocation no place in its own address range | 1: `crates/metal2vulkan-runtime/src/memory.rs (own)` | `-` |
|
||||
| `NoImport` | An import of a handle the device does not take (`Device::import_dma_buf` and `Device::import_dma_bufs` on Unix, `Device::import_host_memory`, a... | at the device's limit | `device`: the device's extensions, features, queue family and external buffer properties | 6: `crates/metal2vulkan-runtime/src/d3d11.rs (d3d11_plane)`, `crates/metal2vulkan-runtime/src/d3d11.rs (import_d3d11_surface)` (+4) | `-` |
|
||||
@@ -617,6 +618,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `rt:Limit::TextureSize`: `crates/metal2vulkan-runtime/src/texture.rs (planned)`; `crates/metal2vulkan-runtime/src/texture.rs (texel_texture)`
|
||||
- `rt:Limit::DeviceSamplers`: `crates/metal2vulkan-runtime/src/sampler.rs (take)`
|
||||
- `rt:Limit::LodClampVariants`: `crates/metal2vulkan-runtime/src/arrays.rs (place_variant)`
|
||||
- `rt:Limit::LevelElements`: `crates/metal2vulkan-runtime/src/arrays.rs (place_levels)`; `crates/metal2vulkan-runtime/src/texture.rs (hold_levels)`
|
||||
- `rt:Limit::MemoryAllocations`: `crates/metal2vulkan-runtime/src/memory.rs (allocate)`
|
||||
- `rt:Limit::AllocationNotMapped`: `crates/metal2vulkan-runtime/src/memory.rs (own)`
|
||||
- `rt:Limit::NoImport`: `crates/metal2vulkan-runtime/src/d3d11.rs (d3d11_plane)`; `crates/metal2vulkan-runtime/src/d3d11.rs (import_d3d11_surface)`; `crates/metal2vulkan-runtime/src/import.rs (import_dma_buf)`; `crates/metal2vulkan-runtime/src/import.rs (import_dma_bufs)`; `crates/metal2vulkan-runtime/src/import.rs (import_host_memory)`; `crates/metal2vulkan-runtime/src/import.rs (surface_import)`
|
||||
|
||||
+7
-1
@@ -54,7 +54,13 @@ 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. Element `i` of each image array is the
|
||||
writes reaches, 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
|
||||
(`PushField::TextureLevels`), and an access at level `l` takes element
|
||||
`first + min(l, max(count, 1) - 1)` only where `l < count`; a texture of one level pushes its own
|
||||
index, and nil 0 with count 0. No ID reaches a level element. Element `i` of each image array is the
|
||||
texture whose ID holds index `i`, and element `i` of each texel-buffer array the texture buffer
|
||||
whose ID holds it (a read texture buffer is a uniform texel buffer, a written one a storage texel
|
||||
buffer), so the consumer writes an element once, as it makes the texture, for every pipeline; a
|
||||
|
||||
@@ -160,12 +160,12 @@ RUNTIME_FLOOR = {
|
||||
"VkPhysicalDeviceVulkan12Properties": {
|
||||
"maxPerStageDescriptorUpdateAfterBindSampledImages": 131072,
|
||||
"maxDescriptorSetUpdateAfterBindSampledImages": 131072,
|
||||
"maxPerStageDescriptorUpdateAfterBindStorageImages": 131072,
|
||||
"maxDescriptorSetUpdateAfterBindStorageImages": 131072,
|
||||
"maxPerStageDescriptorUpdateAfterBindStorageImages": 196608,
|
||||
"maxDescriptorSetUpdateAfterBindStorageImages": 196608,
|
||||
"maxPerStageDescriptorUpdateAfterBindSamplers": 24000,
|
||||
"maxDescriptorSetUpdateAfterBindSamplers": 24000,
|
||||
"maxPerStageUpdateAfterBindResources": 262152,
|
||||
"maxUpdateAfterBindDescriptorsInAllPools": 286144,
|
||||
"maxPerStageUpdateAfterBindResources": 327688,
|
||||
"maxUpdateAfterBindDescriptorsInAllPools": 351680,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user