Translator: a depth cube's read by face samples its cube view, as a colour cube's does
A read of a depth cube or depth cube array by face (depthcube<float, access::read>'s
read(coord, face, lod), air.read_depth_cube and air.read_depth_cube_array) was refused on every
profile, Unsupported{IdentityDomains; NotImplemented}: the read kept the 2D-array view
(RuntimeFact::ImageViewShape), which the identity arrays hold no element of. The resident tables
built it before the cutover to the one form, and that commit deleted its interpreter test with
them; the runtime's README listed it as a known gap.
A colour cube's read by face already samples its cube element, the texture's cube view, at the
texel's centre and the read's explicit level through element 0 of the plain sampler array (the
default sampler, nearest, every level), its operands tested in the shader. A depth cube's element
is its cube view of the depth, which that plain float sampler samples without a comparison as a
depth cube's sample() does, the depth the sample's first component. So slot::samples_cube_element
no longer excludes a depth shape: the read takes the same form, and the slot states no
ImageViewShape.
Tests:
- engine_texture's an_identity_cube_read_by_face_samples_its_cube_element compiles
unk_read_depth_cube too, on every identity profile: L3 passes, no ImageViewShape fact, its two
textures from the sampled float depth cube and depth cube-array classes, its sampler from the
plain array, OpImageSampleExplicitLod and no OpImageFetch. Red with slot.rs at the base.
- The runtime's tests::cube_reads gains cr_depth (a Depth32Float depth cube of three levels) and
cr_depth_array (a depth cube array of two cubes and two levels): every texel of every face,
level and cube reads its uploaded depth bit for bit, and each read outside the texture reads 0.
- scripts/qualify-public-cases, CI's step, qualifies the public case
depth-cube-and-cube-array-reads-at-32-and-16-bit-coordinates (3 x 3 depth textures, every
texel of every face and cube, depths over many binades) on lavapipe against its Apple M3 Max
observation.
Docs: lower::texture's module docs, slot.rs, emit.rs, API.md and RESOURCE-ID.md say a depth
cube's read by face samples its cube view; the runtime README's known gap loses the depth cube
read and names it lowered. engine_texture_unk's module docs no longer claim an interpreter run of
the depth cube reads.
Engine inventory: engine/unk_read_depth_cube.ll moves from Unsupported{IdentityDomains;
NotImplemented} to ok on all 15 profiles; its .air.ll twin moves at the M3 bless.
SEMANTICS_VERSION 2365 -> 2367 (a placeholder, renumbered at landing): the fixture's 15 golden
cells, one a profile, change from the refusal to modules, and no other cell moves. The golden
table and the authored compile census (the case's row, not_supported today) are re-blessed on
development.
Verified, at this commit's tree on 6459eaa946 (rebased since onto the sparse path's deletion,
whose only overlap is the SEMANTICS line):
- m3-max-85654, on the CPU with no device: the engine inventory's eight llvm_as parts differ
from the table by nothing (the row moved with the change). Red, with slot.rs at the base:
an_identity_cube_read_by_face_samples_its_cube_element fails at the depth cube; green: it and
the 20 other cube tests of the translator pass. The golden table's cells: 105 change at this
commit, the base's 90 (development's, blessed since) and unk_read_depth_cube's 15, the two lists
otherwise equal. The refusal surface's check, fmt, signatures, clippy (plain, --cfg m2v_gpu,
--cfg m2v_cpu_icd), Rustdoc, private docs, doctests and scripts/api-docs pass; the metal2vulkan
suites ran 3,471 tests: 3,470 passed, 24 skipped, and the failure is
golden_hashes_match_the_table, whose table is blessed on development; validation ran 1,344
tests, all passed, 2 skipped; conformance ran 1,053, all passed.
- m3-max-85654, on devices: the runtime's every_device_reads_a_cube_by_face_as_its_texels, with
the depth cube and depth cube array rows, passes on lavapipe (llvmpipe, LLVM 23.1.1, 256 bits,
m2v_cpu_icd) and on the RTX 5080 Laptop GPU (m2v_gpu).
- m3-max-85654, CI's lavapipe image: scripts/qualify-public-cases exits 0, every case's slot
current, the depth cube case's among them.
- m3-max-85857, on the CPU with no device, at this commit on the sparse path's deletion: clippy
of the workspace (all targets and features) passes, and the 34 cube and engine-inventory tests
of the translator all pass.
This commit is contained in:
1 parent
ee45758ba9
commit
41438f2693
12 files changed
+176
-95
No files matched your search
@@ -4530,11 +4530,11 @@ cache is answered compile-required on both.
|
||||
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
|
||||
state beyond its resource ID the function reads ("texture argument S: a type the identity
|
||||
arrays hold no element of, or state of the bound texture beyond its resource ID"), a depth
|
||||
cube read by face among them: no test yet. A sampled cube or cube array read by face through
|
||||
`access::read` or `access::sample` is lowered, a sample of its cube view through element 0 of
|
||||
the sampler arrays (the default sampler, every level reached) at the texel's centre: the
|
||||
device test `tests::cube_reads` and the validation case
|
||||
arrays hold no element of, or state of the bound texture beyond its resource ID"): no test
|
||||
yet. A sampled cube or cube array read by face through `access::read` or `access::sample`, a
|
||||
depth cube's and depth cube array's included, is lowered, a sample of its cube view through
|
||||
element 0 of the sampler arrays (the default sampler, every level reached) at the texel's
|
||||
centre: the device test `tests::cube_reads` and the validation case
|
||||
`cube_and_cube_array_face_reads_read_their_faces_under_the_identity_domains`. A storage cube
|
||||
written or read by face is lowered: the translator test
|
||||
`a_storage_cube_written_by_face_is_the_2d_array_element_of_its_faces`;
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
//! and column among them; `cr_int` reads an `R32Sint` cube array of two cubes and two levels at
|
||||
//! every texel of every face, cube and level. Each read is the texel uploaded there. `cr_float`
|
||||
//! over an `RGBA8Unorm_sRGB` cube is compared with `cr_ref`'s read of a 2D array of six slices
|
||||
//! holding the same bytes at the same levels: the device's sRGB decode, through a fetch. Each
|
||||
//! kernel also reads past the level's extent on each axis (inside level 0's), at face 6 and past,
|
||||
//! at the level count and past, at the cube count and past, and at `u32::MAX` on each operand:
|
||||
//! each Metal's out-of-bounds texel, zero with alpha 1 for a format without alpha.
|
||||
//! holding the same bytes at the same levels: the device's sRGB decode, through a fetch.
|
||||
//! `cr_depth` reads a `Depth32Float` depth cube of three levels and `cr_depth_array` a depth cube
|
||||
//! array of two cubes and two levels (`depthcube<float, access::read>`,
|
||||
//! `depthcube_array<float, access::read>`), each read the depth uploaded there. Each kernel also
|
||||
//! reads past the level's extent on each axis (inside level 0's), at face 6 and past, at the level
|
||||
//! count and past, at the cube count and past, and at `u32::MAX` on each operand: each Metal's
|
||||
//! out-of-bounds texel, zero with alpha 1 for a format without alpha, and zero for a depth.
|
||||
//!
|
||||
//! `llvm-as` assembles the kernels; without it the test skips visibly.
|
||||
|
||||
@@ -112,13 +115,53 @@ define void @cr_ref(ptr addrspace(1) %t, ptr addrspace(1) noundef %at, ptr addrs
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @cr_depth(ptr addrspace(1) %t, ptr addrspace(1) noundef %at, ptr addrspace(1) noundef %out, i32 noundef %gid) {
|
||||
%s = tail call ptr addrspace(2) @air.get_read_sampler()
|
||||
%z = zext i32 %gid to i64
|
||||
%i = shl i64 %z, 1
|
||||
%pa = getelementptr inbounds <4 x i32>, ptr addrspace(1) %at, i64 %i
|
||||
%a = load <4 x i32>, ptr addrspace(1) %pa, align 16
|
||||
%xy = shufflevector <4 x i32> %a, <4 x i32> poison, <2 x i32> <i32 0, i32 1>
|
||||
%f = extractelement <4 x i32> %a, i64 2
|
||||
%l = extractelement <4 x i32> %a, i64 3
|
||||
%r = tail call { float, i8 } @air.read_depth_cube.f32(ptr addrspace(1) %t, ptr addrspace(2) %s, i32 1, <2 x i32> %xy, i32 %f, i32 %l, i32 1)
|
||||
%d = extractvalue { float, i8 } %r, 0
|
||||
%v = insertelement <4 x float> zeroinitializer, float %d, i64 0
|
||||
%po = getelementptr inbounds <4 x float>, ptr addrspace(1) %out, i64 %z
|
||||
store <4 x float> %v, ptr addrspace(1) %po, align 16
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @cr_depth_array(ptr addrspace(1) %t, ptr addrspace(1) noundef %at, ptr addrspace(1) noundef %out, i32 noundef %gid) {
|
||||
%s = tail call ptr addrspace(2) @air.get_read_sampler()
|
||||
%z = zext i32 %gid to i64
|
||||
%i = shl i64 %z, 1
|
||||
%pa = getelementptr inbounds <4 x i32>, ptr addrspace(1) %at, i64 %i
|
||||
%a = load <4 x i32>, ptr addrspace(1) %pa, align 16
|
||||
%j = or i64 %i, 1
|
||||
%pb = getelementptr inbounds <4 x i32>, ptr addrspace(1) %at, i64 %j
|
||||
%b = load <4 x i32>, ptr addrspace(1) %pb, align 16
|
||||
%xy = shufflevector <4 x i32> %a, <4 x i32> poison, <2 x i32> <i32 0, i32 1>
|
||||
%f = extractelement <4 x i32> %a, i64 2
|
||||
%l = extractelement <4 x i32> %a, i64 3
|
||||
%c = extractelement <4 x i32> %b, i64 0
|
||||
%r = tail call { float, i8 } @air.read_depth_cube_array.f32(ptr addrspace(1) %t, ptr addrspace(2) %s, i32 1, <2 x i32> %xy, i32 %f, i32 %c, i32 %l, i32 1)
|
||||
%d = extractvalue { float, i8 } %r, 0
|
||||
%v = insertelement <4 x float> zeroinitializer, float %d, i64 0
|
||||
%po = getelementptr inbounds <4 x float>, ptr addrspace(1) %out, i64 %z
|
||||
store <4 x float> %v, ptr addrspace(1) %po, align 16
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr addrspace(2) @air.get_read_sampler()
|
||||
declare { <4 x float>, i8 } @air.read_texture_cube.v4f32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, i32, i32)
|
||||
declare { <4 x i32>, i8 } @air.read_texture_cube.u.v4i32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, i32, i32)
|
||||
declare { <4 x i32>, i8 } @air.read_texture_cube_array.s.v4i32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, i32, i32, i32)
|
||||
declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, <2 x i32>, i32, i32)
|
||||
declare { float, i8 } @air.read_depth_cube.f32(ptr addrspace(1), ptr addrspace(2), i32, <2 x i32>, i32, i32, i32)
|
||||
declare { float, i8 } @air.read_depth_cube_array.f32(ptr addrspace(1), ptr addrspace(2), i32, <2 x i32>, i32, i32, i32, i32)
|
||||
|
||||
!air.kernel = !{!0, !10, !20, !30}
|
||||
!air.kernel = !{!0, !10, !20, !30, !40, !50}
|
||||
!air.version = !{!8}
|
||||
!air.language_version = !{!9}
|
||||
!0 = !{ptr @cr_float, !1, !2}
|
||||
@@ -141,6 +184,12 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
|
||||
!30 = !{ptr @cr_ref, !1, !31}
|
||||
!31 = !{!32, !4, !5, !6}
|
||||
!32 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.read", !"air.arg_type_name", !"texture2d_array<float, read>", !"air.arg_name", !"t"}
|
||||
!40 = !{ptr @cr_depth, !1, !41}
|
||||
!41 = !{!42, !4, !5, !6}
|
||||
!42 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.read", !"air.arg_type_name", !"depthcube<float, read>", !"air.arg_name", !"t"}
|
||||
!50 = !{ptr @cr_depth_array, !1, !51}
|
||||
!51 = !{!52, !4, !5, !6}
|
||||
!52 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.read", !"air.arg_type_name", !"depthcube_array<float, read>", !"air.arg_name", !"t"}
|
||||
"#;
|
||||
|
||||
/// A texture's bytes and the words a read of each texel answers.
|
||||
@@ -221,6 +270,21 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
|
||||
outside: [0, 0, 0, 1],
|
||||
};
|
||||
|
||||
/// The depth of texel `(x, y)` of level `level` of layer `layer`: distinct, inside [0, 1], and
|
||||
/// exact in `float`.
|
||||
fn depth(layer: u32, level: u32, x: u32, y: u32) -> f32 {
|
||||
(64 * layer + 16 * level + 4 * y + x + 1) as f32 / 1024.0
|
||||
}
|
||||
|
||||
/// A depth read answers the depth in its first word; the kernels store zero in the others.
|
||||
const DEPTH: Texels = Texels {
|
||||
format: PixelFormat::Depth32Float,
|
||||
size: 4,
|
||||
bytes: |layer, level, x, y| depth(layer, level, x, y).to_le_bytes().to_vec(),
|
||||
read: |layer, level, x, y| [depth(layer, level, x, y).to_bits(), 0, 0, 0],
|
||||
outside: [0; 4],
|
||||
};
|
||||
|
||||
/// The sRGB texture's reads are compared with the 2D array's, not with these words.
|
||||
const SRGB: Texels = Texels {
|
||||
format: PixelFormat::RGBA8UnormSRGB,
|
||||
@@ -395,7 +459,7 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
|
||||
};
|
||||
let library = Library::from_air(&bitcode).expect("the library");
|
||||
each_device("cube_reads", |name, _, device| {
|
||||
let _textures = (device.grant_indices(IndexClass::Texture, 1, 5))
|
||||
let _textures = (device.grant_indices(IndexClass::Texture, 1, 7))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let mut buffers = Buffers::sized(&device, 1 << 20);
|
||||
let queue = device.new_command_queue(4).expect("a queue");
|
||||
@@ -404,6 +468,8 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
|
||||
(1, "cr_float", TextureType::Cube, &FLOAT, 3, 1),
|
||||
(2, "cr_uint", TextureType::Cube, &UINT, 3, 1),
|
||||
(3, "cr_int", TextureType::CubeArray, &INT, 2, 2),
|
||||
(6, "cr_depth", TextureType::Cube, &DEPTH, 3, 1),
|
||||
(7, "cr_depth_array", TextureType::CubeArray, &DEPTH, 2, 2),
|
||||
] {
|
||||
let shape = (texture_type, texels, levels, 6 * cubes);
|
||||
let t = texture(name, &device, shape, index);
|
||||
|
||||
Vendored
+1
-1
@@ -60,7 +60,7 @@ mod tests;
|
||||
/// unchanged version, and its bless records the version. Independent of the crate's version and of
|
||||
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
|
||||
/// history.
|
||||
pub const SEMANTICS_VERSION: u32 = 2371;
|
||||
pub const SEMANTICS_VERSION: u32 = 2372;
|
||||
|
||||
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
|
||||
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
|
||||
|
||||
@@ -1625,9 +1625,10 @@ fn read(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>, r: &Read) -> BResult<
|
||||
}
|
||||
|
||||
/// [`read`]'s texel ([`ReadTexel`]).
|
||||
/// Under the identity domains, read `r` of a sampled cube or cube array slot, whose element `img`
|
||||
/// (declared `decl`) is the texture's cube view (`slot::samples_cube_element`): the texel `(x, y)`
|
||||
/// of face `f` (of cube `c`) at level `l` is the sample of that view through element 0 of its
|
||||
/// Under the identity domains, read `r` of a sampled cube or cube array slot, a depth one's
|
||||
/// included, whose element `img` (declared `decl`) is the texture's cube view
|
||||
/// (`slot::samples_cube_element`): the texel `(x, y)` of face `f` (of cube `c`) at level `l` is
|
||||
/// the sample of that view, a depth one's depth its first component, through element 0 of its
|
||||
/// numeric type's sampler array (`slot::face_sampler_use`), the default sampler (nearest, every
|
||||
/// level: docs/RESOURCE-ID.md), at the direction of the texel's centre and at the explicit level
|
||||
/// `l`. On face `f` the centre is `(sc, tc) = ((2x + 1 − w) / w, (2y + 1 − h) / h)`, inside
|
||||
|
||||
@@ -30,10 +30,11 @@
|
||||
//! `OpTypeImage` derived from the typed operand positions of the intrinsics that use it (the ABI
|
||||
//! spells no shape, `air::abi`) and the parameter's declared access: `sample`/`read` textures are
|
||||
//! sampled images (`Sampled = 1`, format `Unknown`), `write`/`read_write` textures storage images
|
||||
//! (`Sampled = 2`) whose format is the slot's `StorageImageChoice` (`LowerInputs`). A cube texture
|
||||
//! that is read or written, and every storage cube, is declared as the 2D array the binder views it
|
||||
//! as (layer = face + 6 · cube, `RuntimeFact::ImageViewShape`), because Vulkan fetches no cube by
|
||||
//! face. Texture buffers are texel buffers, elements of set 1's texel-buffer arrays.
|
||||
//! (`Sampled = 2`) whose format is the slot's `StorageImageChoice` (`LowerInputs`). A storage cube
|
||||
//! is declared as the 2D array of its faces (layer = face + 6 · cube), because Vulkan fetches no
|
||||
//! cube by face; a sampled cube's read by face, a depth cube's included, samples its cube view at
|
||||
//! the texel's centre (`slot::samples_cube_element`). Texture buffers are texel buffers, elements
|
||||
//! of set 1's texel-buffer arrays.
|
||||
//!
|
||||
//! **Operations.** `read` is `OpImageFetch` on a sampled image and `OpImageRead` on a storage
|
||||
//! image; `write` is `OpImageWrite`; `get_*` are `OpImageQuery*`; `fence` is an image memory
|
||||
|
||||
@@ -541,14 +541,14 @@ pub enum ReadCheck {
|
||||
}
|
||||
|
||||
/// Whether a read of a texture slot of shape `shape` (`storage`: a storage slot) is a sample of
|
||||
/// its cube element: a sampled cube's or cube
|
||||
/// array's element is its cube view, whose texels no fetch addresses (SPIR-V's `OpImageFetch`
|
||||
/// takes no cube), so the read samples it through element 0 of its sampler array
|
||||
/// ([`SlotPlan::face_sampler`]) at the texel's centre (`emit::cube_face_texel`). A sample clamps
|
||||
/// each operand, so such a read is checked in the shader on every device ([`ReadCheck::Shader`]).
|
||||
/// A depth cube's read keeps the 2D-array view.
|
||||
/// its cube element: a sampled cube's or cube array's element, a depth one's included, is its
|
||||
/// cube view, whose texels no fetch addresses (SPIR-V's `OpImageFetch` takes no cube), so the
|
||||
/// read samples it through element 0 of its sampler array ([`SlotPlan::face_sampler`]) at the
|
||||
/// texel's centre (`emit::cube_face_texel`). A depth cube's element is its depth view, which the
|
||||
/// plain float sampler samples as any other, its depth the first component. A sample clamps each
|
||||
/// operand, so such a read is checked in the shader on every device ([`ReadCheck::Shader`]).
|
||||
pub(super) fn samples_cube_element(storage: bool, shape: ImageShape) -> bool {
|
||||
shape.dim == ImageDim::Cube && !storage && !shape.depth
|
||||
shape.dim == ImageDim::Cube && !storage
|
||||
}
|
||||
|
||||
/// The sampler use of a read of a slot declared `decl`, a sampled cube or cube array
|
||||
@@ -1277,11 +1277,10 @@ impl SlotPlan {
|
||||
/// elements of the same array, the run its `PushField::TextureLevelBase` names. A sampled cube or
|
||||
/// cube array, read by face or not, is its cube view's ([`samples_cube_element`]). `None` for a
|
||||
/// declaration the identity arrays hold no element of yet: a sampled cube viewed as an array (a
|
||||
/// depth cube read by face, or a cube whose faces an emulated filter fetches), a
|
||||
/// texture buffer's parts, an extended-range or RGBX form, or a storage image with another format
|
||||
/// or a conversion. A storage image without a format whose class converts 8-bit sRGB codes
|
||||
/// (`SrgbEncode`, `LoweringInputs::srgb_storage`) is an element of the array without a format: the
|
||||
/// runtime holds such a texture's UNORM twin there.
|
||||
/// cube whose faces an emulated filter fetches), a texture buffer's parts, an extended-range or
|
||||
/// RGBX form, or a storage image with another format or a conversion. A storage image without a
|
||||
/// format whose class converts 8-bit sRGB codes (`SrgbEncode`, `LoweringInputs::srgb_storage`) is
|
||||
/// an element of the array without a format: the runtime holds such a texture's UNORM twin there.
|
||||
pub(crate) fn identity_class(decl: &ImageDecl) -> Option<ImageHandleClass> {
|
||||
let storage = decl.usage == ImageUsage::Storage;
|
||||
let srgb = storage
|
||||
|
||||
@@ -398,66 +398,75 @@ fn a_constant_texel_without_a_nan_records_no_nan_encoding() {
|
||||
|
||||
/// Under the identity domains a sampled cube or cube array read by face is its cube element, the
|
||||
/// texture's cube view, which the read samples at the texel's centre through element 0 of the
|
||||
/// plain sampler array (`emit::cube_face_texel`): `cube_faces` compiles and passes L3 on every
|
||||
/// profile the identity domains derive, states no `ImageViewShape`, takes its two textures from
|
||||
/// the sampled float cube and cube-array classes and its sampler from the plain array, and samples
|
||||
/// at an explicit level where it fetches nothing. The texels it reads are a device's (the runtime's
|
||||
/// `tests::cube_reads`, and the validation case of `cube_faces`): the CPU interpreter models no
|
||||
/// sampler.
|
||||
/// plain sampler array (`emit::cube_face_texel`), a depth cube's and depth cube array's as any
|
||||
/// other's: `cube_faces` and `unk_read_depth_cube` compile and pass L3 on every profile the
|
||||
/// identity domains derive, state no `ImageViewShape`, take their two textures from the sampled
|
||||
/// float cube and cube-array classes (the depth ones' for the depth fixture) and their sampler
|
||||
/// from the plain array, and sample at an explicit level where they fetch nothing. The texels they
|
||||
/// read are a device's (the runtime's `tests::cube_reads`, and the validation case of
|
||||
/// `cube_faces`): the CPU interpreter models no sampler.
|
||||
#[test]
|
||||
fn an_identity_cube_read_by_face_samples_its_cube_element() {
|
||||
let Some(bc) = fixture("texture_ops") else {
|
||||
return;
|
||||
};
|
||||
let profiles = identity_profiles();
|
||||
assert!(
|
||||
!profiles.is_empty(),
|
||||
"no profile the identity domains derive"
|
||||
);
|
||||
let cube = |arrayed| {
|
||||
let cube = |arrayed, depth_compare| {
|
||||
ResourceKind::Heap(HandleClass::Image(ImageHandleClass {
|
||||
dim: ImageDim::Cube,
|
||||
arrayed,
|
||||
multisampled: false,
|
||||
sampled_type: SampledType::Float,
|
||||
depth_compare: false,
|
||||
depth_compare,
|
||||
access: ImageAccess::Sampled,
|
||||
format: StorageFormatClass::NotStorage,
|
||||
}))
|
||||
};
|
||||
for (stem, p) in profiles {
|
||||
let (a, plan, _) =
|
||||
compile_kept(&bc, "cube_faces", &p).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: L3: {e}"));
|
||||
assert!(
|
||||
!(plan.facts.iter()).any(|f| matches!(f, RuntimeFact::ImageViewShape { .. })),
|
||||
"{stem}: {:?}",
|
||||
plan.facts
|
||||
);
|
||||
let linked =
|
||||
link(&[&a], &LinkInputs::standalone(), &p).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
let at = |binding: (u32, u32)| -> Vec<ResourceKind> {
|
||||
let mut kinds: Vec<ResourceKind> = (linked.table.bindings.iter())
|
||||
.filter(|(_, b)| **b == binding)
|
||||
.map(|(s, _)| s.kind)
|
||||
.collect();
|
||||
kinds.sort();
|
||||
kinds
|
||||
for (name, entry, depth) in [
|
||||
("texture_ops", "cube_faces", false),
|
||||
("unk_read_depth_cube", "unk_read_depth_cube", true),
|
||||
] {
|
||||
let Some(bc) = fixture(name) else {
|
||||
return;
|
||||
};
|
||||
let mut want = vec![cube(false), cube(true)];
|
||||
want.sort();
|
||||
assert_eq!(at((1, 0)), want, "{stem}: the sampled classes");
|
||||
assert_eq!(
|
||||
at((1, 2)),
|
||||
vec![ResourceKind::Heap(HandleClass::Sampler {
|
||||
compare: false,
|
||||
integer: false
|
||||
})],
|
||||
"{stem}: the sampler arrays"
|
||||
);
|
||||
let ops = opcodes(&a.module.words);
|
||||
assert!(ops.contains(&OP_IMAGE_SAMPLE_EXPLICIT_LOD), "{stem}");
|
||||
assert!(!ops.contains(&OP_IMAGE_FETCH), "{stem}");
|
||||
for (stem, p) in &profiles {
|
||||
let (a, plan, _) =
|
||||
compile_kept(&bc, entry, p).unwrap_or_else(|e| panic!("{stem}: {entry}: {e}"));
|
||||
link_and_validate(&a, p).unwrap_or_else(|e| panic!("{stem}: {entry}: L3: {e}"));
|
||||
assert!(
|
||||
!(plan.facts.iter()).any(|f| matches!(f, RuntimeFact::ImageViewShape { .. })),
|
||||
"{stem}: {entry}: {:?}",
|
||||
plan.facts
|
||||
);
|
||||
let linked = link(&[&a], &LinkInputs::standalone(), p)
|
||||
.unwrap_or_else(|e| panic!("{stem}: {entry}: {e}"));
|
||||
let at = |binding: (u32, u32)| -> Vec<ResourceKind> {
|
||||
let mut kinds: Vec<ResourceKind> = (linked.table.bindings.iter())
|
||||
.filter(|(_, b)| **b == binding)
|
||||
.map(|(s, _)| s.kind)
|
||||
.collect();
|
||||
kinds.sort();
|
||||
kinds
|
||||
};
|
||||
let mut want = vec![cube(false, depth), cube(true, depth)];
|
||||
want.sort();
|
||||
assert_eq!(at((1, 0)), want, "{stem}: {entry}: the sampled classes");
|
||||
assert_eq!(
|
||||
at((1, 2)),
|
||||
vec![ResourceKind::Heap(HandleClass::Sampler {
|
||||
compare: false,
|
||||
integer: false
|
||||
})],
|
||||
"{stem}: {entry}: the sampler arrays"
|
||||
);
|
||||
let ops = opcodes(&a.module.words);
|
||||
assert!(
|
||||
ops.contains(&OP_IMAGE_SAMPLE_EXPLICIT_LOD),
|
||||
"{stem}: {entry}"
|
||||
);
|
||||
assert!(!ops.contains(&OP_IMAGE_FETCH), "{stem}: {entry}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
//! containment, two profiles without robustness):
|
||||
//!
|
||||
//! - family A: the 1D-array read and width query, the size queries of multisampled arrays, texture
|
||||
//! buffers, and depth multisampled and cube textures, and the reads of depth cubes, depth cube
|
||||
//! arrays, and depth multisampled arrays (owned fixtures `unk_read_1d_array`,
|
||||
//! `unk_size_queries`, `unk_read_depth_cube`, `unk_read_depth_ms_array`).
|
||||
//! buffers, and depth multisampled and cube textures, and the reads of depth multisampled arrays
|
||||
//! (owned fixtures `unk_read_1d_array`, `unk_size_queries`, `unk_read_depth_ms_array`). A depth
|
||||
//! cube's read by face samples its cube view, which the interpreter does not model:
|
||||
//! `engine_texture`'s cube test compiles `unk_read_depth_cube`.
|
||||
//!
|
||||
//! Previously each of these kernels was refused `UnknownIntrinsic`, so every test here fails
|
||||
//! without it. A profile that lacks a capability a kernel needs (a cube array on `vk12-floor`)
|
||||
|
||||
@@ -3401,7 +3401,7 @@ engine/unk_gather.ll unk_gather ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
|
||||
engine/unk_read_1d_array.air.ll unk_read_1d_array ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
|
||||
engine/unk_read_1d_array.ll unk_read_1d_array ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
|
||||
engine/unk_read_depth_cube.air.ll unk_read_depth_cube Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented}
|
||||
engine/unk_read_depth_cube.ll unk_read_depth_cube Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented} Unsupported{IdentityDomains; NotImplemented}
|
||||
engine/unk_read_depth_cube.ll unk_read_depth_cube ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
|
||||
engine/unk_read_depth_ms_array.air.ll unk_read_depth_ms_array ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
|
||||
engine/unk_read_depth_ms_array.ll unk_read_depth_ms_array ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
|
||||
engine/unk_sample_grad.air.ll unk_sample_grad ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
|
||||
|
||||
|
Can't render this file because it is too large.
|
+8
-8
@@ -195,14 +195,14 @@ the runtime's, the command line's, the compile worker's and every validation too
|
||||
its `PushField::SlotGuestBase`, and its texture is the element at the ID's index of set 1's two
|
||||
fixed arrays, the same layout for every pipeline ([RESOURCE-ID.md](RESOURCE-ID.md)); it binds no
|
||||
descriptor of its own and declares no specialization constant. A storage cube or cube array slot
|
||||
is declared as the 2D array of its faces and written and read by face at layer
|
||||
`6 · cube + face`, so the storage element a consumer holds for a cube texture is that 2D-array
|
||||
view of its layers. A sampled cube or cube array slot read by face is its cube view, which the
|
||||
read samples through element 0 of its numeric type's sampler array (the default sampler,
|
||||
nearest with every level reached) at the texel's centre and the read's level, its operands
|
||||
tested in the shader ([RESOURCE-ID.md](RESOURCE-ID.md)). An argument buffer's texture is
|
||||
the element at the index of the `gpuResourceID` its member holds, with no handle table, so a
|
||||
slot and a member of one class index one array. No variant is chosen there: a
|
||||
is declared as the 2D array of its faces and written and read by face at layer `6 · cube + face`,
|
||||
so the storage element a consumer holds for a cube texture is that 2D-array view of its layers. A
|
||||
sampled cube or cube array slot read by face, a depth one's included, is its cube view, which the
|
||||
read samples through element 0 of its numeric type's sampler array (the default sampler, nearest
|
||||
with every level reached) at the texel's centre and the read's level, its operands tested in the
|
||||
shader ([RESOURCE-ID.md](RESOURCE-ID.md)). An argument buffer's texture is the element at the
|
||||
index of the `gpuResourceID` its member holds, with no handle table, so a slot and a member of one
|
||||
class index one array. No variant is chosen there: a
|
||||
texture reads through the plain form whatever texture its ID names, its `float` or `half` reads
|
||||
take the device's sRGB decode with `PrecisionNote::SrgbTexelDecode`, and no texture is sparse
|
||||
(the runtime makes none). A texture slot sampled through a runtime sampler slot
|
||||
|
||||
+10
-9
@@ -111,15 +111,16 @@ included); a min or mag filter of `Cubic`, Metal's undeclared raw value 2, is ma
|
||||
push field, samples through the element its low word indexes, and reads the word's fields where a
|
||||
sample depends on them (pixel coordinates, a nearest pixel sampler).
|
||||
|
||||
A sampled cube's or cube array's element is its cube view, whose texels no fetch addresses, so a
|
||||
`read` of it by face (`read(coord, face, lod)`, and with the cube index for a cube array) samples
|
||||
that view through element 0 of binding 2, or of binding 4 for an integer texture, which no ID
|
||||
reaches: the default sampler, nearest with every level reached. It samples at the direction of
|
||||
the texel's centre on the face and at the read's level as an explicit level, which reads exactly
|
||||
that texel; the shader tests the coordinate against the level's extent, the face against 6, the
|
||||
cube index against the cube count and the level against the level count itself, and reads
|
||||
Metal's out-of-bounds texel (its alpha from the word) outside them. A consumer that lays the
|
||||
arrays out itself places that default sampler at element 0 of both.
|
||||
A sampled cube's or cube array's element, a depth cube's or depth cube array's included, is its cube
|
||||
view, whose texels no fetch addresses, so a `read` of it by face (`read(coord, face, lod)`, and with
|
||||
the cube index for a cube array; a depth read answers the sample's first component) samples that
|
||||
view through element 0 of binding 2, or of binding 4 for an integer texture, which no ID reaches:
|
||||
the default sampler, nearest with every level reached. It samples at the direction of the texel's
|
||||
centre on the face and at the read's level as an explicit level, which reads exactly that texel; the
|
||||
shader tests the coordinate against the level's extent, the face against 6, the cube index against
|
||||
the cube count and the level against the level count itself, and reads Metal's out-of-bounds texel
|
||||
(its alpha from the word) outside them. A consumer that lays the arrays out itself places that
|
||||
default sampler at element 0 of both.
|
||||
|
||||
A constexpr sampler has no ID: the consumer places a device sampler of it (the function's
|
||||
`PushField::ConstexprSampler` names it and its use, and `CombinedSampler::constexpr_sampler`
|
||||
|
||||
@@ -101,6 +101,9 @@ cases=(
|
||||
# fence, a device-scope flag and an acquire fence (engine/coherent_texture_handoff): no read
|
||||
# that saw every writer's flag reads the texel's earlier value.
|
||||
32697a0895a8dcf85651da45ed7d6139ae86bc80f18f986eb28a72f06eb3b061
|
||||
# Reads of a 3 x 3 depth cube and depth cube array by face (engine/unk_read_depth_cube), at 32-
|
||||
# and 16-bit coordinates: every texel of every face and cube.
|
||||
6bcb5f4b1eff579886ef9a22e53f950a74032d334f97705a7c07515f064e0b4c
|
||||
)
|
||||
|
||||
for case_id in "${cases[@]}"; do
|
||||
|
||||
Reference in new issue
Block a user