diff --git a/crates/metal2vulkan-air/src/canon/mod.rs b/crates/metal2vulkan-air/src/canon/mod.rs index bd699cc72..a4e0865b5 100644 --- a/crates/metal2vulkan-air/src/canon/mod.rs +++ b/crates/metal2vulkan-air/src/canon/mod.rs @@ -67,9 +67,9 @@ //! 9. **Arm speculation**: a branch whose short arms Metal's backend runs in every lane of the //! branch's block, and whose arms hold a group operation that answers differently there, //! becomes a jump into its arms with a `select` for each value they join with (`speculate`). -//! **Rasterization-rate maps**: each `float2` `air.map_*_coordinates` call becomes Apple's GPU -//! decoder of Metal's parameter data (`rate_map_data`) in plain AIR: word loads through the -//! call's map pointer and Apple's arithmetic. **AIR 2.7 simdgroup-matrix block loads and +//! **Rasterization-rate maps**: each `air.map_*_coordinates` call, `float2` or `uint2`, becomes +//! Apple's GPU decoder of Metal's parameter data (`rate_map_data`) in plain AIR: word loads +//! through the call's map pointer and Apple's arithmetic. **AIR 2.7 simdgroup-matrix block loads and //! stores** take their AIR 2.8 form, their extent, stride and origin built from the elements per //! row, the origin and the constant transpose flag (`legacy_matrix`). **Aggregate accesses**: a //! load or store of a whole array or struct in buffer or threadgroup memory becomes its scalar @@ -722,8 +722,8 @@ pub fn specialize_dynamic( }; speculate::expand(body, (&parts.types, &parts.consts), (tys, &f.params), m)? }; - // Rasterization-rate maps: each `float2` map call becomes Apple's GPU decoder of the parameter - // data, word loads through its own map pointer. + // Rasterization-rate maps: each map call, `float2` or `uint2`, becomes Apple's GPU decoder of + // the parameter data, word loads through its own map pointer. let body = rate_map::expand(body, &mut parts, m)?; // The AIR 2.7 simdgroup-matrix block loads and stores in their AIR 2.8 form. let body = legacy_matrix::expand(body, &mut parts, m)?; diff --git a/crates/metal2vulkan-air/src/canon/rate_map.rs b/crates/metal2vulkan-air/src/canon/rate_map.rs index c28225a87..5c913bcec 100644 --- a/crates/metal2vulkan-air/src/canon/rate_map.rs +++ b/crates/metal2vulkan-air/src/canon/rate_map.rs @@ -16,10 +16,12 @@ //! `NaN`: Metal's on a device measured to read them so, the device's own elsewhere, noted. The //! call's fast-math flags are not carried: the decoder's arithmetic is Apple's, not the source's. //! -//! The `uint2` overloads (`.v2i32`) stay calls and lowering refuses them -//! (`Unsupported{RasterizationRateMap, NotImplemented}`): on Apple M3 the screen-to-physical one -//! answers `⌊map(x + 0.5)⌋` and the physical-to-screen one words of Apple's tables, so no reading -//! of the latter is established. +//! The `uint2` overloads (`.v2i32`) become Apple's GPU answers too, measured on an Apple M3 Max +//! (`rate_map_data`'s `shader_screen_to_physical_integer` and `shader_physical_to_screen_integer`): +//! screen to physical, per axis, the `float2` decoder at the pixel's centre (`uitofp` of the +//! coordinate plus 1/2) and the saturating conversion of its answer to `uint`; physical to screen, +//! the entry of granule `c >> 5` and the bits of `(0 - offset) · reciprocal`, the coordinate's +//! value not read, as Apple's GPU answers. use crate::budget::Meter; use crate::error::Error; @@ -40,8 +42,36 @@ enum Direction { ToScreen, } -/// The call's decoded direction, when it is a `float2` map. -fn decoded(kind: &InstKind) -> Option<(Direction, &Call)> { +/// What a decoded call maps: its direction, and whether it is a `uint2` overload. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +struct Shape { + dir: Direction, + integer: bool, +} + +impl Shape { + const ALL: [Shape; 4] = [ + Shape { + dir: Direction::ToPhysical, + integer: false, + }, + Shape { + dir: Direction::ToScreen, + integer: false, + }, + Shape { + dir: Direction::ToPhysical, + integer: true, + }, + Shape { + dir: Direction::ToScreen, + integer: true, + }, + ]; +} + +/// The call's decoded shape, when it is a rate-map call. +fn decoded(kind: &InstKind) -> Option<(Shape, &Call)> { let InstKind::Call(call) = kind else { return None; }; @@ -50,29 +80,31 @@ fn decoded(kind: &InstKind) -> Option<(Direction, &Call)> { op: AirIntrinsic::Fragment(Fragment::MapCoordinates { to_physical, - integer: false, + integer, }), .. - } => Some(( - if to_physical { + } => { + let dir = if to_physical { Direction::ToPhysical } else { Direction::ToScreen - }, - call, - )), + }; + Some((Shape { dir, integer }, call)) + } _ => None, } } /// The integer constants the decoder uses. -const INTS: [u32; 10] = [ +const INTS: [u32; 12] = [ 0, 1, u32::MAX, format::ENTRY_WORDS, + format::GRANULE_SHIFT, format::OFFSET_SHIFT, format::NO_BOUNDARY, + format::BOUNDARY_MASK, format::TABLE_WORDS, format::HORIZONTAL_TO_PHYSICAL, format::VERTICAL_TO_SCREEN, @@ -87,6 +119,7 @@ struct Vocab { i1t: TypeId, ptr: TypeId, v2f32: TypeId, + v2i32: TypeId, ints: Vec<(u32, ConstId)>, zero_f: ConstId, saturation_f: ConstId, @@ -96,6 +129,7 @@ struct Vocab { two_f: ConstId, offset_unit_f: ConstId, poison_v2: ConstId, + poison_v2i: ConstId, } impl Vocab { @@ -111,6 +145,7 @@ impl Vocab { m, )?; let v2f32 = parts.types.intern(Type::Vector { elem: f32t, len: 2 }, m)?; + let v2i32 = parts.types.intern(Type::Vector { elem: i32t, len: 2 }, m)?; let mut c = |ty, value| parts.consts.intern(Constant { ty, value }, m); let mut ints = Vec::new(); for v in INTS { @@ -124,6 +159,7 @@ impl Vocab { i1t, ptr, v2f32, + v2i32, ints, zero_f: f(0.0)?, saturation_f: f(format::SHADER_INDEX_SATURATION)?, @@ -133,6 +169,7 @@ impl Vocab { two_f: f(2.0)?, offset_unit_f: f(format::OFFSET_UNIT)?, poison_v2: c(v2f32, Const::Poison)?, + poison_v2i: c(v2i32, Const::Poison)?, }) } @@ -304,9 +341,11 @@ impl Sink<'_> { let at = self.entry(table, j, m)?; let at = self.int_k(BinOp::Add, at, 1, m)?; let packed = self.load(map, at, i32t, m)?; - let boundary = self.int_k(BinOp::And, packed, format::NO_BOUNDARY, m)?; + let byte = self.int_k(BinOp::And, packed, format::NO_BOUNDARY, m)?; let none = self.v.int(format::NO_BOUNDARY)?; - let some = self.icmp(IntPredicate::Ne, boundary, none, m)?; + let some = self.icmp(IntPredicate::Ne, byte, none, m)?; + // Its low seven bits are compared (`rate_map_data::BOUNDARY_MASK`). + let boundary = self.int_k(BinOp::And, packed, format::BOUNDARY_MASK, m)?; let jf = self.cast(CastOp::UIToFP, f32t, j, m)?; let g = Value::Const(self.v.granularity_f); let start = self.float(BinOp::FMul, jf, g, m)?; @@ -342,33 +381,72 @@ impl Sink<'_> { } } - /// The decoder of one call: coordinate `c`, map pointer `map`, layer `layer`. Its last - /// instruction is the result. - fn decode( + /// One axis of a `uint2` overload over the table at word `table`, of the `uint` coordinate + /// `c` (`rate_map_data`'s `shader_screen_to_physical_integer` and + /// `shader_physical_to_screen_integer`). + fn integer_axis( &mut self, dir: Direction, + map: Value, + table: Value, + c: Value, + m: &mut Meter, + ) -> Result { + let (i32t, f32t) = (self.v.i32t, self.v.f32t); + match dir { + Direction::ToPhysical => { + // The `float2` decoder at the pixel's centre, its answer converted saturating. + let cf = self.cast(CastOp::UIToFP, f32t, c, m)?; + let half = Value::Const(self.v.half_f); + let centre = self.float(BinOp::FAdd, cf, half, m)?; + let r = self.axis(Direction::ToPhysical, map, table, centre, m)?; + self.index(r, m) + } + Direction::ToScreen => { + // The granule's entry; the coordinate's value is not read. + let k = self.int_k(BinOp::LShr, c, format::GRANULE_SHIFT, m)?; + let at = self.entry(table, k, m)?; + let reciprocal = self.load(map, at, f32t, m)?; + let at = self.int_k(BinOp::Add, at, 1, m)?; + let offset = self.load(map, at, f32t, m)?; + let zero = Value::Const(self.v.zero_f); + let d = self.float(BinOp::FSub, zero, offset, m)?; + let r = self.float(BinOp::FMul, d, reciprocal, m)?; + self.cast(CastOp::Bitcast, i32t, r, m) + } + } + } + + /// The decoder of one call of `shape`: coordinate `c`, map pointer `map`, layer `layer`. Its + /// last instruction is the result. + fn decode( + &mut self, + shape: Shape, c: Value, map: Value, layer: Value, m: &mut Meter, ) -> Result { + let Shape { dir, integer } = shape; let to_physical = dir == Direction::ToPhysical; // The layer's horizontal table, unclamped (`rate_map_data::table`); the vertical one is // every layer's. let offset = self.int_k(BinOp::Mul, layer, format::TABLE_WORDS, m)?; let horizontal = self.int_k(BinOp::Add, offset, format::table(0, 0, to_physical), m)?; let vertical = self.v.int(format::table(0, 1, to_physical))?; - let mut v = Value::Const(self.v.poison_v2); + let (elem, vec, mut v) = match integer { + false => (self.v.f32t, self.v.v2f32, Value::Const(self.v.poison_v2)), + true => (self.v.i32t, self.v.v2i32, Value::Const(self.v.poison_v2i)), + }; for (axis, table) in [(0u32, horizontal), (1, vertical)] { let lane = self.v.int(axis)?; - let ca = self.push( - self.v.f32t, - InstKind::ExtractElement { vec: c, idx: lane }, - m, - )?; - let r = self.axis(dir, map, table, ca, m)?; + let ca = self.push(elem, InstKind::ExtractElement { vec: c, idx: lane }, m)?; + let r = match integer { + false => self.axis(dir, map, table, ca, m)?, + true => self.integer_axis(dir, map, table, ca, m)?, + }; v = self.push( - self.v.v2f32, + vec, InstKind::InsertElement { vec: v, elt: r, @@ -381,38 +459,43 @@ impl Sink<'_> { } } -/// The number of instructions one call of `dir` becomes. -fn decoder_len(dir: Direction, v: &Vocab, m: &mut Meter) -> Result { +/// The number of instructions one call of `shape` becomes. +fn decoder_len(shape: Shape, v: &Vocab, m: &mut Meter) -> Result { let mut scratch = Body::default(); let mut s = Sink { out: &mut scratch, v, }; let any = Value::Const(v.poison_v2); - s.decode(dir, any, any, any, m)?; + s.decode(shape, any, any, any, m)?; let len = scratch.insts.len(); scratch.release(m); u32::try_from(len).map_err(|_| invariant("decoder length")) } -/// Replace every `float2` rate-map call of `body` by its decoder. +/// Replace every rate-map call of `body` by its decoder. pub(super) fn expand(body: Body, parts: &mut ModuleParts, m: &mut Meter) -> Result { if !body.insts.iter().any(|(_, i)| decoded(&i.kind).is_some()) { return Ok(body); } let v = Vocab::new(parts, m)?; - let lens = [ - decoder_len(Direction::ToPhysical, &v, m)?, - decoder_len(Direction::ToScreen, &v, m)?, - ]; + let mut lens = [0u32; Shape::ALL.len()]; + for (len, shape) in lens.iter_mut().zip(Shape::ALL) { + *len = decoder_len(shape, &v, m)?; + } + let len_of = |shape: Shape| { + (Shape::ALL.iter().zip(lens)) + .find(|&(s, _)| *s == shape) + .map(|(_, len)| len) + .ok_or_else(|| invariant("a decoder shape not measured")) + }; // Each old instruction's id in the output: a decoded call's is its decoder's last. let mut result = Vec::new(); m.reserve(&mut result, body.insts.len())?; let mut next = 0u32; for (_, inst) in body.insts.iter() { let n = match decoded(&inst.kind) { - Some((Direction::ToPhysical, _)) => lens[0], - Some((Direction::ToScreen, _)) => lens[1], + Some((shape, _)) => len_of(shape)?, None => 1, }; next = next @@ -439,7 +522,7 @@ pub(super) fn expand(body: Body, parts: &mut ModuleParts, m: &mut Meter) -> Resu .get(i) .ok_or_else(|| invariant("instruction out of range"))?; match decoded(&inst.kind) { - Some((dir, call)) => { + Some((shape, call)) => { let [c, ptr, layer] = call.args.as_ref() else { return Err(invariant("a rate-map call without three operands")); }; @@ -448,7 +531,7 @@ pub(super) fn expand(body: Body, parts: &mut ModuleParts, m: &mut Meter) -> Resu out: &mut out, v: &v, }; - s.decode(dir, c, ptr, layer, m)?; + s.decode(shape, c, ptr, layer, m)?; } None => { let mut kind = inst.kind.clone(); diff --git a/crates/metal2vulkan-air/src/canon/rate_map_data.rs b/crates/metal2vulkan-air/src/canon/rate_map_data.rs index b49de9a90..98dce5ac3 100644 --- a/crates/metal2vulkan-air/src/canon/rate_map_data.rs +++ b/crates/metal2vulkan-air/src/canon/rate_map_data.rs @@ -68,7 +68,8 @@ //! - screen to physical, as the map answers it (Apple's CPU, `physicalCoordinates`, the layer //! clamped to the map's by the caller): `j` the integer part of `s / 32` clamped to the table's //! last written entry (`NaN` reading 0); where the entry's boundary byte `b` is not -//! [`NO_BOUNDARY`] and `2·(s - 32·j) ≥ b`, entry `j + 1` instead; the result is +//! [`NO_BOUNDARY`] and `2·(s - 32·j) ≥ b`, `b` read as its low seven bits +//! ([`BOUNDARY_MASK`]), entry `j + 1` instead; the result is //! `fma(s, scale, O / 256)`, one rounding. Past either end of the screen the first or last //! tile's line extends without limit; //! - screen to physical, as a shader answers it (Apple's GPU, `map_screen_to_physical_coordinates`): @@ -80,7 +81,17 @@ //! `⌈E/32⌉·32 + 32` physical to screen it answers 0 where the data's entries end; //! - physical to screen: `k` the integer part of `p / 32`, the map's clamped to the table's last //! written entry, a shader's saturating and unclamped as above, and `(p - offset) · reciprocal`, -//! two roundings. +//! two roundings; +//! - a shader's `uint2` overloads (`.v2i32`): screen to physical answers the `float2` decoder's +//! answer at the pixel's centre, `c + 1/2`, converted to `uint` (its integer part, saturating); +//! physical to screen reads the entry of granule `c >> 5` as the `float2` decoder does and +//! answers the bits of the `float` `(0 - offset) · reciprocal`, two roundings: the coordinate's +//! value is not read, so every coordinate of a granule answers alike and the answer is a +//! `float`'s bits, not a screen coordinate. Measured on an Apple M3 Max under macOS 27.0.1 (our +//! probe `rate_map_integer_overloads`): every coordinate along each axis of four maps (64 by 64 +//! of quality 1; 256 by 128 falling to 0.25; 200 by 96 of two layers; 3648 by 1734 falling to +//! 0.3), from 0 to 48 past the larger of the axis's screen and physical extents, at each map's +//! layers and two past them, 20,114 coordinates in all, both overloads, every answer. //! //! The shader's operations read Metal's `float` denormals: each operand and result that is //! denormal is the zero of its sign, and a `NaN` result is Metal's `0x7fc00000` (the translated @@ -120,10 +131,17 @@ pub const VERTICAL_TO_PHYSICAL: u32 = VERTICAL_TO_SCREEN + TABLE_WORDS; pub const GRANULARITY: u32 = 32; /// `1 / GRANULARITY`, exact. pub const INV_GRANULARITY: f32 = 1.0 / 32.0; +/// `GRANULARITY`'s power of two: a shader's `uint` physical coordinate's granule is the +/// coordinate shifted right this many bits. +pub const GRANULE_SHIFT: u32 = GRANULARITY.trailing_zeros(); /// The largest screen extent the tables hold (512 granules; entry 512 lies past it). pub const MAX_EXTENT: u32 = LAST_ENTRY * GRANULARITY; /// A screen-to-physical entry's boundary byte where no tile starts inside its granule. pub const NO_BOUNDARY: u32 = 0xff; +/// The bits of a boundary byte the decoders compare: its low seven. A boundary is at most 64 half +/// pixels; a byte of `0x80`, which a shader reads only in another table's words (a layer past the +/// map's), compares as 0 on Apple's GPU (measured on an Apple M3 Max, macOS 27.0.1). +pub const BOUNDARY_MASK: u32 = 0x7f; /// A screen-to-physical entry's second word holds the boundary byte below this many bits. pub const OFFSET_SHIFT: u32 = 8; /// The unit of a screen-to-physical entry's offset: `1/256` pixel. @@ -373,10 +391,10 @@ fn axis_to_physical(words: &[u32], table: u32, s: f32, decoder: Decoder) -> f32 }; let j = decoder.index(t); let (_, packed) = entry(words, table, j); - let boundary = packed & NO_BOUNDARY; + let (byte, boundary) = (packed & NO_BOUNDARY, packed & BOUNDARY_MASK); let start = r(j as f32 * GRANULARITY as f32); let into = r(r(s - start) * 2.0); - let j = if boundary != NO_BOUNDARY && into >= boundary as f32 { + let j = if byte != NO_BOUNDARY && into >= boundary as f32 { j.wrapping_add(1) } else { j @@ -453,5 +471,27 @@ pub fn shader_physical_to_screen(words: &[u32], layer: u32, c: [f32; 2]) -> [f32 ] } +/// A shader's `uint2` `map_screen_to_physical_coordinates(c, layer)` over parameter data +/// `words`, as Apple's GPU answers it (the module docs): per axis, the `float2` decoder's answer +/// at the pixel's centre, `c + 1/2`, converted to `uint` as a shader converts, saturating. +pub fn shader_screen_to_physical_integer(words: &[u32], layer: u32, c: [u32; 2]) -> [u32; 2] { + let centre = c.map(|v| v as f32 + 0.5); + shader_screen_to_physical(words, layer, centre).map(shader_index) +} + +/// A shader's `uint2` `map_physical_to_screen_coordinates(c, layer)` over parameter data +/// `words`, as Apple's GPU answers it (the module docs): per axis, the bits of the `float` +/// `(0 - offset) · reciprocal` of the entry of granule `c >> 5`, the coordinate's own value not +/// read. +pub fn shader_physical_to_screen_integer(words: &[u32], layer: u32, c: [u32; 2]) -> [u32; 2] { + let r = |x| Decoder::Shader.read(x); + let axis = |axis: u32, p: u32| { + let (reciprocal, offset) = entry(words, table(layer, axis, false), p >> GRANULE_SHIFT); + let (reciprocal, offset) = (r(f32::from_bits(reciprocal)), r(f32::from_bits(offset))); + canonical(r(r(0.0 - offset) * reciprocal)).to_bits() + }; + [axis(0, c[0]), axis(1, c[1])] +} + #[cfg(test)] mod tests; diff --git a/crates/metal2vulkan/src/bind/rate_map.rs b/crates/metal2vulkan/src/bind/rate_map.rs index 0fc1108a6..e378d7578 100644 --- a/crates/metal2vulkan/src/bind/rate_map.rs +++ b/crates/metal2vulkan/src/bind/rate_map.rs @@ -17,7 +17,11 @@ //! which differs from the CPU's (the granule of the coordinate plus half a pixel, two roundings //! where the CPU fuses, denormals flushed, the layer unclamped). Measured on an Apple M4: the bytes //! of 45 maps, and every CPU and GPU answer probed over them, bit for bit, the sign of a zero -//! included. The translated decoder's `float` arithmetic is the device's: it computes the shader's +//! included. A shader's `uint2` overloads answer as `air::canon::rate_map_data`'s +//! `shader_screen_to_physical_integer` and `shader_physical_to_screen_integer` (measured on an +//! Apple M3 Max): the `float2` decoder at the pixel's centre converted to `uint`, and the bits of +//! a `float` the coordinate's granule gives, not a screen coordinate. The translated decoder's +//! `float` arithmetic is the device's: it computes the shader's //! answers bit for bit on a device that reads `float` denormals as Metal does, and with the //! device's own denormals elsewhere (`PrecisionNote::DeviceDenormals`), as the SPIR-V interpreter //! keeps them. The buffer is then bound like any other ([`BoundBuffer::Buffer`]). @@ -800,4 +804,4 @@ pub use regions::{RateMapRegion, RateMapRegions, RegionError, RegionLimits}; mod tests; #[cfg(test)] -mod apple_tests; +pub(crate) mod apple_tests; diff --git a/crates/metal2vulkan/src/bind/rate_map/apple_integer_vectors.txt b/crates/metal2vulkan/src/bind/rate_map/apple_integer_vectors.txt new file mode 100644 index 000000000..79a42e11d --- /dev/null +++ b/crates/metal2vulkan/src/bind/rate_map/apple_integer_vectors.txt @@ -0,0 +1,1573 @@ +# Apple M3 Max (macOS 27.0.1) answers of a shader's `uint2` map_screen_to_physical_coordinates +# and map_physical_to_screen_coordinates, from our probe rate_map_integer_overloads +# (crates/metal2vulkan-conformance/probes). No guest data. map ; +# : a sample of the probe's +# coordinates along each axis (the first 34, three in each granule, of the large map's in each +# fourth granule, the last two before 48 past the larger extent), at the map's layers and two past +# them. +map uniform 64 64 h:1.0|v:1.0 6089b43a88df5c50cb2b8e171ba9c305a1655d5b89bae283d730203c2b231d0b +map falling 256 128 h:1.0,0.5,0.25,0.5|v:0.5,1.0 8b205fe27750916a7e1dcf3dc5cb69eb8e6fcf127c57ccf1e7b5ddbbfdcffe8a +map twolayer 200 96 h:1.0,0.3|v:1.0,0.4;h:0.3,1.0,0.6|v:0.7,0.2 2e10972bd28f8258ff197c6fb51310b2860f88b28fd8a9a4f023dd7ad1c8b7a7 +map large 3648 1734 h:0.3,0.6,1.0,0.6,0.3|v:0.3,0.6,1.0,0.6,0.3 17aa959a1ceb64f9215103ee7794c3fc5116e91ef3218a685eb9573442281a2c +uniform 0 0 0 0 00000000 +uniform 0 0 1 1 00000000 +uniform 0 0 2 2 00000000 +uniform 0 0 3 3 00000000 +uniform 0 0 4 4 00000000 +uniform 0 0 5 5 00000000 +uniform 0 0 6 6 00000000 +uniform 0 0 7 7 00000000 +uniform 0 0 8 8 00000000 +uniform 0 0 9 9 00000000 +uniform 0 0 10 10 00000000 +uniform 0 0 11 11 00000000 +uniform 0 0 12 12 00000000 +uniform 0 0 13 13 00000000 +uniform 0 0 14 14 00000000 +uniform 0 0 15 15 00000000 +uniform 0 0 16 16 00000000 +uniform 0 0 17 17 00000000 +uniform 0 0 18 18 00000000 +uniform 0 0 19 19 00000000 +uniform 0 0 20 20 00000000 +uniform 0 0 21 21 00000000 +uniform 0 0 22 22 00000000 +uniform 0 0 23 23 00000000 +uniform 0 0 24 24 00000000 +uniform 0 0 25 25 00000000 +uniform 0 0 26 26 00000000 +uniform 0 0 27 27 00000000 +uniform 0 0 28 28 00000000 +uniform 0 0 29 29 00000000 +uniform 0 0 30 30 00000000 +uniform 0 0 31 31 00000000 +uniform 0 0 32 32 00000000 +uniform 0 0 33 33 00000000 +uniform 0 0 48 48 00000000 +uniform 0 0 63 63 00000000 +uniform 0 0 64 64 00000000 +uniform 0 0 80 80 00000000 +uniform 0 0 95 95 00000000 +uniform 0 0 96 96 00000000 +uniform 0 0 110 110 00000000 +uniform 0 0 111 111 00000000 +uniform 0 1 0 0 00000000 +uniform 0 1 1 1 00000000 +uniform 0 1 2 2 00000000 +uniform 0 1 3 3 00000000 +uniform 0 1 4 4 00000000 +uniform 0 1 5 5 00000000 +uniform 0 1 6 6 00000000 +uniform 0 1 7 7 00000000 +uniform 0 1 8 8 00000000 +uniform 0 1 9 9 00000000 +uniform 0 1 10 10 00000000 +uniform 0 1 11 11 00000000 +uniform 0 1 12 12 00000000 +uniform 0 1 13 13 00000000 +uniform 0 1 14 14 00000000 +uniform 0 1 15 15 00000000 +uniform 0 1 16 16 00000000 +uniform 0 1 17 17 00000000 +uniform 0 1 18 18 00000000 +uniform 0 1 19 19 00000000 +uniform 0 1 20 20 00000000 +uniform 0 1 21 21 00000000 +uniform 0 1 22 22 00000000 +uniform 0 1 23 23 00000000 +uniform 0 1 24 24 00000000 +uniform 0 1 25 25 00000000 +uniform 0 1 26 26 00000000 +uniform 0 1 27 27 00000000 +uniform 0 1 28 28 00000000 +uniform 0 1 29 29 00000000 +uniform 0 1 30 30 00000000 +uniform 0 1 31 31 00000000 +uniform 0 1 32 32 00000000 +uniform 0 1 33 33 00000000 +uniform 0 1 48 48 00000000 +uniform 0 1 63 63 00000000 +uniform 0 1 64 64 00000000 +uniform 0 1 80 80 00000000 +uniform 0 1 95 95 00000000 +uniform 0 1 96 96 00000000 +uniform 0 1 110 110 00000000 +uniform 0 1 111 111 00000000 +uniform 1 0 0 0 00000000 +uniform 1 0 1 0 00000000 +uniform 1 0 2 0 00000000 +uniform 1 0 3 0 00000000 +uniform 1 0 4 0 00000000 +uniform 1 0 5 0 00000000 +uniform 1 0 6 0 00000000 +uniform 1 0 7 0 00000000 +uniform 1 0 8 0 00000000 +uniform 1 0 9 0 00000000 +uniform 1 0 10 0 00000000 +uniform 1 0 11 0 00000000 +uniform 1 0 12 0 00000000 +uniform 1 0 13 0 00000000 +uniform 1 0 14 0 00000000 +uniform 1 0 15 0 00000000 +uniform 1 0 16 0 00000000 +uniform 1 0 17 0 00000000 +uniform 1 0 18 0 00000000 +uniform 1 0 19 0 00000000 +uniform 1 0 20 0 00000000 +uniform 1 0 21 0 00000000 +uniform 1 0 22 0 00000000 +uniform 1 0 23 0 00000000 +uniform 1 0 24 0 00000000 +uniform 1 0 25 0 00000000 +uniform 1 0 26 0 00000000 +uniform 1 0 27 0 00000000 +uniform 1 0 28 0 00000000 +uniform 1 0 29 0 00000000 +uniform 1 0 30 0 00000000 +uniform 1 0 31 0 00000000 +uniform 1 0 32 0 00000000 +uniform 1 0 33 0 00000000 +uniform 1 0 48 0 00000000 +uniform 1 0 63 0 00000000 +uniform 1 0 64 0 00000000 +uniform 1 0 80 0 00000000 +uniform 1 0 95 0 00000000 +uniform 1 0 96 0 00000000 +uniform 1 0 110 0 00000000 +uniform 1 0 111 0 00000000 +uniform 1 1 0 0 00000000 +uniform 1 1 1 1 00000000 +uniform 1 1 2 2 00000000 +uniform 1 1 3 3 00000000 +uniform 1 1 4 4 00000000 +uniform 1 1 5 5 00000000 +uniform 1 1 6 6 00000000 +uniform 1 1 7 7 00000000 +uniform 1 1 8 8 00000000 +uniform 1 1 9 9 00000000 +uniform 1 1 10 10 00000000 +uniform 1 1 11 11 00000000 +uniform 1 1 12 12 00000000 +uniform 1 1 13 13 00000000 +uniform 1 1 14 14 00000000 +uniform 1 1 15 15 00000000 +uniform 1 1 16 16 00000000 +uniform 1 1 17 17 00000000 +uniform 1 1 18 18 00000000 +uniform 1 1 19 19 00000000 +uniform 1 1 20 20 00000000 +uniform 1 1 21 21 00000000 +uniform 1 1 22 22 00000000 +uniform 1 1 23 23 00000000 +uniform 1 1 24 24 00000000 +uniform 1 1 25 25 00000000 +uniform 1 1 26 26 00000000 +uniform 1 1 27 27 00000000 +uniform 1 1 28 28 00000000 +uniform 1 1 29 29 00000000 +uniform 1 1 30 30 00000000 +uniform 1 1 31 31 00000000 +uniform 1 1 32 32 00000000 +uniform 1 1 33 33 00000000 +uniform 1 1 48 48 00000000 +uniform 1 1 63 63 00000000 +uniform 1 1 64 64 00000000 +uniform 1 1 80 80 00000000 +uniform 1 1 95 95 00000000 +uniform 1 1 96 96 00000000 +uniform 1 1 110 110 00000000 +uniform 1 1 111 111 00000000 +uniform 2 0 0 0 00000000 +uniform 2 0 1 1 00000000 +uniform 2 0 2 2 00000000 +uniform 2 0 3 3 00000000 +uniform 2 0 4 4 00000000 +uniform 2 0 5 5 00000000 +uniform 2 0 6 6 00000000 +uniform 2 0 7 7 00000000 +uniform 2 0 8 8 00000000 +uniform 2 0 9 9 00000000 +uniform 2 0 10 10 00000000 +uniform 2 0 11 11 00000000 +uniform 2 0 12 12 00000000 +uniform 2 0 13 13 00000000 +uniform 2 0 14 14 00000000 +uniform 2 0 15 15 00000000 +uniform 2 0 16 16 00000000 +uniform 2 0 17 17 00000000 +uniform 2 0 18 18 00000000 +uniform 2 0 19 19 00000000 +uniform 2 0 20 20 00000000 +uniform 2 0 21 21 00000000 +uniform 2 0 22 22 00000000 +uniform 2 0 23 23 00000000 +uniform 2 0 24 24 00000000 +uniform 2 0 25 25 00000000 +uniform 2 0 26 26 00000000 +uniform 2 0 27 27 00000000 +uniform 2 0 28 28 00000000 +uniform 2 0 29 29 00000000 +uniform 2 0 30 30 00000000 +uniform 2 0 31 31 00000000 +uniform 2 0 32 32 00000000 +uniform 2 0 33 33 00000000 +uniform 2 0 48 48 00000000 +uniform 2 0 63 63 00000000 +uniform 2 0 64 0 00000000 +uniform 2 0 80 0 00000000 +uniform 2 0 95 0 00000000 +uniform 2 0 96 0 00000000 +uniform 2 0 110 0 00000000 +uniform 2 0 111 0 00000000 +uniform 2 1 0 0 00000000 +uniform 2 1 1 1 00000000 +uniform 2 1 2 2 00000000 +uniform 2 1 3 3 00000000 +uniform 2 1 4 4 00000000 +uniform 2 1 5 5 00000000 +uniform 2 1 6 6 00000000 +uniform 2 1 7 7 00000000 +uniform 2 1 8 8 00000000 +uniform 2 1 9 9 00000000 +uniform 2 1 10 10 00000000 +uniform 2 1 11 11 00000000 +uniform 2 1 12 12 00000000 +uniform 2 1 13 13 00000000 +uniform 2 1 14 14 00000000 +uniform 2 1 15 15 00000000 +uniform 2 1 16 16 00000000 +uniform 2 1 17 17 00000000 +uniform 2 1 18 18 00000000 +uniform 2 1 19 19 00000000 +uniform 2 1 20 20 00000000 +uniform 2 1 21 21 00000000 +uniform 2 1 22 22 00000000 +uniform 2 1 23 23 00000000 +uniform 2 1 24 24 00000000 +uniform 2 1 25 25 00000000 +uniform 2 1 26 26 00000000 +uniform 2 1 27 27 00000000 +uniform 2 1 28 28 00000000 +uniform 2 1 29 29 00000000 +uniform 2 1 30 30 00000000 +uniform 2 1 31 31 00000000 +uniform 2 1 32 32 00000000 +uniform 2 1 33 33 00000000 +uniform 2 1 48 48 00000000 +uniform 2 1 63 63 00000000 +uniform 2 1 64 64 00000000 +uniform 2 1 80 80 00000000 +uniform 2 1 95 95 00000000 +uniform 2 1 96 96 00000000 +uniform 2 1 110 110 00000000 +uniform 2 1 111 111 00000000 +falling 0 0 0 0 00000000 +falling 0 0 1 1 00000000 +falling 0 0 2 2 00000000 +falling 0 0 3 3 00000000 +falling 0 0 4 4 00000000 +falling 0 0 5 5 00000000 +falling 0 0 6 6 00000000 +falling 0 0 7 7 00000000 +falling 0 0 8 8 00000000 +falling 0 0 9 9 00000000 +falling 0 0 10 10 00000000 +falling 0 0 11 11 00000000 +falling 0 0 12 12 00000000 +falling 0 0 13 13 00000000 +falling 0 0 14 14 00000000 +falling 0 0 15 15 00000000 +falling 0 0 16 16 00000000 +falling 0 0 17 17 00000000 +falling 0 0 18 18 00000000 +falling 0 0 19 19 00000000 +falling 0 0 20 20 00000000 +falling 0 0 21 21 00000000 +falling 0 0 22 22 00000000 +falling 0 0 23 23 00000000 +falling 0 0 24 24 00000000 +falling 0 0 25 25 00000000 +falling 0 0 26 26 00000000 +falling 0 0 27 27 00000000 +falling 0 0 28 28 00000000 +falling 0 0 29 29 00000000 +falling 0 0 30 30 00000000 +falling 0 0 31 31 00000000 +falling 0 0 32 32 c0dff200 +falling 0 0 33 33 c0dff200 +falling 0 0 48 45 c0dff200 +falling 0 0 63 57 c0dff200 +falling 0 0 64 58 c213ffc0 +falling 0 0 80 69 c213ffc0 +falling 0 0 95 78 c213ffc0 +falling 0 0 96 79 c2f1ff00 +falling 0 0 112 88 c2f1ff00 +falling 0 0 127 96 c2f1ff00 +falling 0 0 128 97 c18801ff +falling 0 0 144 103 c18801ff +falling 0 0 159 109 c18801ff +falling 0 0 160 109 c18801ff +falling 0 0 176 116 c18801ff +falling 0 0 191 121 c18801ff +falling 0 0 192 122 00000000 +falling 0 0 208 128 00000000 +falling 0 0 223 137 00000000 +falling 0 0 224 138 00000000 +falling 0 0 240 147 00000000 +falling 0 0 255 155 00000000 +falling 0 0 256 156 00000000 +falling 0 0 272 165 00000000 +falling 0 0 287 174 00000000 +falling 0 0 288 174 00000000 +falling 0 0 302 182 00000000 +falling 0 0 303 183 00000000 +falling 0 1 0 0 00000000 +falling 0 1 1 1 00000000 +falling 0 1 2 1 00000000 +falling 0 1 3 2 00000000 +falling 0 1 4 3 00000000 +falling 0 1 5 3 00000000 +falling 0 1 6 4 00000000 +falling 0 1 7 5 00000000 +falling 0 1 8 5 00000000 +falling 0 1 9 6 00000000 +falling 0 1 10 7 00000000 +falling 0 1 11 8 00000000 +falling 0 1 12 8 00000000 +falling 0 1 13 9 00000000 +falling 0 1 14 10 00000000 +falling 0 1 15 10 00000000 +falling 0 1 16 11 00000000 +falling 0 1 17 12 00000000 +falling 0 1 18 12 00000000 +falling 0 1 19 13 00000000 +falling 0 1 20 14 00000000 +falling 0 1 21 14 00000000 +falling 0 1 22 15 00000000 +falling 0 1 23 16 00000000 +falling 0 1 24 17 00000000 +falling 0 1 25 17 00000000 +falling 0 1 26 18 00000000 +falling 0 1 27 19 00000000 +falling 0 1 28 19 00000000 +falling 0 1 29 20 00000000 +falling 0 1 30 21 00000000 +falling 0 1 31 21 00000000 +falling 0 1 32 22 41000700 +falling 0 1 33 23 41000700 +falling 0 1 48 34 41000700 +falling 0 1 63 46 41000700 +falling 0 1 64 47 418ffd00 +falling 0 1 80 61 418ffd00 +falling 0 1 95 75 418ffd00 +falling 0 1 96 76 41a80000 +falling 0 1 112 91 41a80000 +falling 0 1 127 106 41a80000 +falling 0 1 128 107 41a80000 +falling 0 1 144 123 41a80000 +falling 0 1 159 138 41a80000 +falling 0 1 160 139 00000000 +falling 0 1 174 153 00000000 +falling 0 1 175 154 00000000 +falling 1 0 0 0 00000000 +falling 1 0 1 0 00000000 +falling 1 0 2 0 00000000 +falling 1 0 3 0 00000000 +falling 1 0 4 0 00000000 +falling 1 0 5 0 00000000 +falling 1 0 6 0 00000000 +falling 1 0 7 0 00000000 +falling 1 0 8 0 00000000 +falling 1 0 9 0 00000000 +falling 1 0 10 0 00000000 +falling 1 0 11 0 00000000 +falling 1 0 12 0 00000000 +falling 1 0 13 0 00000000 +falling 1 0 14 0 00000000 +falling 1 0 15 0 00000000 +falling 1 0 16 0 00000000 +falling 1 0 17 0 00000000 +falling 1 0 18 0 00000000 +falling 1 0 19 0 00000000 +falling 1 0 20 0 00000000 +falling 1 0 21 0 00000000 +falling 1 0 22 0 00000000 +falling 1 0 23 0 00000000 +falling 1 0 24 0 00000000 +falling 1 0 25 0 00000000 +falling 1 0 26 0 00000000 +falling 1 0 27 0 00000000 +falling 1 0 28 0 00000000 +falling 1 0 29 0 00000000 +falling 1 0 30 0 00000000 +falling 1 0 31 0 00000000 +falling 1 0 32 0 00000000 +falling 1 0 33 0 00000000 +falling 1 0 48 0 00000000 +falling 1 0 63 0 00000000 +falling 1 0 64 0 00000000 +falling 1 0 80 0 00000000 +falling 1 0 95 0 00000000 +falling 1 0 96 0 00000000 +falling 1 0 112 0 00000000 +falling 1 0 127 0 00000000 +falling 1 0 128 0 00000000 +falling 1 0 144 0 00000000 +falling 1 0 159 0 00000000 +falling 1 0 160 0 00000000 +falling 1 0 176 0 00000000 +falling 1 0 191 0 00000000 +falling 1 0 192 0 00000000 +falling 1 0 208 0 00000000 +falling 1 0 223 0 00000000 +falling 1 0 224 0 00000000 +falling 1 0 240 0 00000000 +falling 1 0 255 0 00000000 +falling 1 0 256 0 00000000 +falling 1 0 272 0 00000000 +falling 1 0 287 0 00000000 +falling 1 0 288 0 00000000 +falling 1 0 302 0 00000000 +falling 1 0 303 0 00000000 +falling 1 1 0 0 00000000 +falling 1 1 1 1 00000000 +falling 1 1 2 1 00000000 +falling 1 1 3 2 00000000 +falling 1 1 4 3 00000000 +falling 1 1 5 3 00000000 +falling 1 1 6 4 00000000 +falling 1 1 7 5 00000000 +falling 1 1 8 5 00000000 +falling 1 1 9 6 00000000 +falling 1 1 10 7 00000000 +falling 1 1 11 8 00000000 +falling 1 1 12 8 00000000 +falling 1 1 13 9 00000000 +falling 1 1 14 10 00000000 +falling 1 1 15 10 00000000 +falling 1 1 16 11 00000000 +falling 1 1 17 12 00000000 +falling 1 1 18 12 00000000 +falling 1 1 19 13 00000000 +falling 1 1 20 14 00000000 +falling 1 1 21 14 00000000 +falling 1 1 22 15 00000000 +falling 1 1 23 16 00000000 +falling 1 1 24 17 00000000 +falling 1 1 25 17 00000000 +falling 1 1 26 18 00000000 +falling 1 1 27 19 00000000 +falling 1 1 28 19 00000000 +falling 1 1 29 20 00000000 +falling 1 1 30 21 00000000 +falling 1 1 31 21 00000000 +falling 1 1 32 22 41000700 +falling 1 1 33 23 41000700 +falling 1 1 48 34 41000700 +falling 1 1 63 46 41000700 +falling 1 1 64 47 418ffd00 +falling 1 1 80 61 418ffd00 +falling 1 1 95 75 418ffd00 +falling 1 1 96 76 41a80000 +falling 1 1 112 91 41a80000 +falling 1 1 127 106 41a80000 +falling 1 1 128 107 41a80000 +falling 1 1 144 123 41a80000 +falling 1 1 159 138 41a80000 +falling 1 1 160 139 00000000 +falling 1 1 174 153 00000000 +falling 1 1 175 154 00000000 +falling 2 0 0 0 00000000 +falling 2 0 1 0 00000000 +falling 2 0 2 0 00000000 +falling 2 0 3 0 00000000 +falling 2 0 4 0 00000000 +falling 2 0 5 0 00000000 +falling 2 0 6 0 00000000 +falling 2 0 7 0 00000000 +falling 2 0 8 0 00000000 +falling 2 0 9 0 00000000 +falling 2 0 10 0 00000000 +falling 2 0 11 0 00000000 +falling 2 0 12 0 00000000 +falling 2 0 13 0 00000000 +falling 2 0 14 0 00000000 +falling 2 0 15 0 00000000 +falling 2 0 16 0 00000000 +falling 2 0 17 0 00000000 +falling 2 0 18 0 00000000 +falling 2 0 19 0 00000000 +falling 2 0 20 0 00000000 +falling 2 0 21 0 00000000 +falling 2 0 22 0 00000000 +falling 2 0 23 0 00000000 +falling 2 0 24 0 00000000 +falling 2 0 25 0 00000000 +falling 2 0 26 0 00000000 +falling 2 0 27 0 00000000 +falling 2 0 28 0 00000000 +falling 2 0 29 0 00000000 +falling 2 0 30 0 00000000 +falling 2 0 31 0 00000000 +falling 2 0 32 0 00000000 +falling 2 0 33 0 00000000 +falling 2 0 48 0 00000000 +falling 2 0 63 0 00000000 +falling 2 0 64 0 00000000 +falling 2 0 80 0 00000000 +falling 2 0 95 0 00000000 +falling 2 0 96 0 00000000 +falling 2 0 112 0 00000000 +falling 2 0 127 0 00000000 +falling 2 0 128 0 00000000 +falling 2 0 144 0 00000000 +falling 2 0 159 0 00000000 +falling 2 0 160 0 00000000 +falling 2 0 176 0 00000000 +falling 2 0 191 0 00000000 +falling 2 0 192 0 00000000 +falling 2 0 208 0 00000000 +falling 2 0 223 0 00000000 +falling 2 0 224 0 00000000 +falling 2 0 240 0 00000000 +falling 2 0 255 0 00000000 +falling 2 0 256 0 00000000 +falling 2 0 272 0 00000000 +falling 2 0 287 0 00000000 +falling 2 0 288 0 00000000 +falling 2 0 302 0 00000000 +falling 2 0 303 0 00000000 +falling 2 1 0 0 00000000 +falling 2 1 1 1 00000000 +falling 2 1 2 1 00000000 +falling 2 1 3 2 00000000 +falling 2 1 4 3 00000000 +falling 2 1 5 3 00000000 +falling 2 1 6 4 00000000 +falling 2 1 7 5 00000000 +falling 2 1 8 5 00000000 +falling 2 1 9 6 00000000 +falling 2 1 10 7 00000000 +falling 2 1 11 8 00000000 +falling 2 1 12 8 00000000 +falling 2 1 13 9 00000000 +falling 2 1 14 10 00000000 +falling 2 1 15 10 00000000 +falling 2 1 16 11 00000000 +falling 2 1 17 12 00000000 +falling 2 1 18 12 00000000 +falling 2 1 19 13 00000000 +falling 2 1 20 14 00000000 +falling 2 1 21 14 00000000 +falling 2 1 22 15 00000000 +falling 2 1 23 16 00000000 +falling 2 1 24 17 00000000 +falling 2 1 25 17 00000000 +falling 2 1 26 18 00000000 +falling 2 1 27 19 00000000 +falling 2 1 28 19 00000000 +falling 2 1 29 20 00000000 +falling 2 1 30 21 00000000 +falling 2 1 31 21 00000000 +falling 2 1 32 22 41000700 +falling 2 1 33 23 41000700 +falling 2 1 48 34 41000700 +falling 2 1 63 46 41000700 +falling 2 1 64 47 418ffd00 +falling 2 1 80 61 418ffd00 +falling 2 1 95 75 418ffd00 +falling 2 1 96 76 41a80000 +falling 2 1 112 91 41a80000 +falling 2 1 127 106 41a80000 +falling 2 1 128 107 41a80000 +falling 2 1 144 123 41a80000 +falling 2 1 159 138 41a80000 +falling 2 1 160 139 00000000 +falling 2 1 174 153 00000000 +falling 2 1 175 154 00000000 +twolayer 0 0 0 0 00000000 +twolayer 0 0 1 1 00000000 +twolayer 0 0 2 2 00000000 +twolayer 0 0 3 3 00000000 +twolayer 0 0 4 4 00000000 +twolayer 0 0 5 5 00000000 +twolayer 0 0 6 6 00000000 +twolayer 0 0 7 7 00000000 +twolayer 0 0 8 8 00000000 +twolayer 0 0 9 9 00000000 +twolayer 0 0 10 10 00000000 +twolayer 0 0 11 11 00000000 +twolayer 0 0 12 12 00000000 +twolayer 0 0 13 13 00000000 +twolayer 0 0 14 14 00000000 +twolayer 0 0 15 15 00000000 +twolayer 0 0 16 16 00000000 +twolayer 0 0 17 17 00000000 +twolayer 0 0 18 18 00000000 +twolayer 0 0 19 19 00000000 +twolayer 0 0 20 20 00000000 +twolayer 0 0 21 21 00000000 +twolayer 0 0 22 22 00000000 +twolayer 0 0 23 23 00000000 +twolayer 0 0 24 24 00000000 +twolayer 0 0 25 25 00000000 +twolayer 0 0 26 26 00000000 +twolayer 0 0 27 27 00000000 +twolayer 0 0 28 28 00000000 +twolayer 0 0 29 29 00000000 +twolayer 0 0 30 30 00000000 +twolayer 0 0 31 31 00000000 +twolayer 0 0 32 32 c07ff000 +twolayer 0 0 33 33 c07ff000 +twolayer 0 0 48 46 c07ff000 +twolayer 0 0 63 59 c07ff000 +twolayer 0 0 64 60 c15ffa80 +twolayer 0 0 80 73 c15ffa80 +twolayer 0 0 95 85 c15ffa80 +twolayer 0 0 96 86 c2300280 +twolayer 0 0 112 98 c2300280 +twolayer 0 0 127 107 c2300280 +twolayer 0 0 128 108 c2c00000 +twolayer 0 0 144 118 c2c00000 +twolayer 0 0 159 127 c2c00000 +twolayer 0 0 160 128 c2c00000 +twolayer 0 0 176 136 c2c00000 +twolayer 0 0 191 143 c2c00000 +twolayer 0 0 192 144 00000000 +twolayer 0 0 208 152 00000000 +twolayer 0 0 223 159 00000000 +twolayer 0 0 224 160 00000000 +twolayer 0 0 240 168 00000000 +twolayer 0 0 246 171 00000000 +twolayer 0 0 247 171 00000000 +twolayer 0 1 0 0 00000000 +twolayer 0 1 1 1 00000000 +twolayer 0 1 2 2 00000000 +twolayer 0 1 3 3 00000000 +twolayer 0 1 4 4 00000000 +twolayer 0 1 5 5 00000000 +twolayer 0 1 6 6 00000000 +twolayer 0 1 7 7 00000000 +twolayer 0 1 8 8 00000000 +twolayer 0 1 9 9 00000000 +twolayer 0 1 10 10 00000000 +twolayer 0 1 11 11 00000000 +twolayer 0 1 12 12 00000000 +twolayer 0 1 13 13 00000000 +twolayer 0 1 14 14 00000000 +twolayer 0 1 15 15 00000000 +twolayer 0 1 16 16 00000000 +twolayer 0 1 17 17 00000000 +twolayer 0 1 18 18 00000000 +twolayer 0 1 19 19 00000000 +twolayer 0 1 20 20 00000000 +twolayer 0 1 21 21 00000000 +twolayer 0 1 22 22 00000000 +twolayer 0 1 23 23 00000000 +twolayer 0 1 24 24 00000000 +twolayer 0 1 25 25 00000000 +twolayer 0 1 26 26 00000000 +twolayer 0 1 27 27 00000000 +twolayer 0 1 28 28 00000000 +twolayer 0 1 29 29 00000000 +twolayer 0 1 30 30 00000000 +twolayer 0 1 31 31 00000000 +twolayer 0 1 32 32 c0dff200 +twolayer 0 1 33 33 c0dff200 +twolayer 0 1 48 45 c0dff200 +twolayer 0 1 63 57 c0dff200 +twolayer 0 1 64 58 c10ffc00 +twolayer 0 1 80 71 c10ffc00 +twolayer 0 1 95 83 c10ffc00 +twolayer 0 1 96 84 c10ffc00 +twolayer 0 1 112 97 c10ffc00 +twolayer 0 1 127 109 c10ffc00 +twolayer 0 1 128 109 00000000 +twolayer 0 1 142 121 00000000 +twolayer 0 1 143 121 00000000 +twolayer 1 0 0 0 00000000 +twolayer 1 0 1 0 00000000 +twolayer 1 0 2 1 00000000 +twolayer 1 0 3 2 00000000 +twolayer 1 0 4 2 00000000 +twolayer 1 0 5 3 00000000 +twolayer 1 0 6 4 00000000 +twolayer 1 0 7 4 00000000 +twolayer 1 0 8 5 00000000 +twolayer 1 0 9 6 00000000 +twolayer 1 0 10 6 00000000 +twolayer 1 0 11 7 00000000 +twolayer 1 0 12 8 00000000 +twolayer 1 0 13 8 00000000 +twolayer 1 0 14 9 00000000 +twolayer 1 0 15 10 00000000 +twolayer 1 0 16 10 00000000 +twolayer 1 0 17 11 00000000 +twolayer 1 0 18 12 00000000 +twolayer 1 0 19 12 00000000 +twolayer 1 0 20 13 00000000 +twolayer 1 0 21 14 00000000 +twolayer 1 0 22 14 00000000 +twolayer 1 0 23 15 00000000 +twolayer 1 0 24 16 00000000 +twolayer 1 0 25 16 00000000 +twolayer 1 0 26 17 00000000 +twolayer 1 0 27 17 00000000 +twolayer 1 0 28 18 00000000 +twolayer 1 0 29 19 00000000 +twolayer 1 0 30 19 00000000 +twolayer 1 0 31 20 00000000 +twolayer 1 0 32 21 41600380 +twolayer 1 0 33 21 41600380 +twolayer 1 0 48 31 41600380 +twolayer 1 0 63 45 41600380 +twolayer 1 0 64 46 41a00000 +twolayer 1 0 80 60 41a00000 +twolayer 1 0 95 75 41a00000 +twolayer 1 0 96 76 415ffd00 +twolayer 1 0 112 92 415ffd00 +twolayer 1 0 127 106 415ffd00 +twolayer 1 0 128 107 c0bff400 +twolayer 1 0 144 122 c0bff400 +twolayer 1 0 159 135 c0bff400 +twolayer 1 0 160 136 c1f80400 +twolayer 1 0 176 149 c1f80400 +twolayer 1 0 191 161 c1f80400 +twolayer 1 0 192 162 c1f80400 +twolayer 1 0 208 174 c1f80400 +twolayer 1 0 223 185 c1f80400 +twolayer 1 0 224 185 00000000 +twolayer 1 0 240 197 00000000 +twolayer 1 0 246 201 00000000 +twolayer 1 0 247 202 00000000 +twolayer 1 1 0 0 00000000 +twolayer 1 1 1 1 00000000 +twolayer 1 1 2 2 00000000 +twolayer 1 1 3 3 00000000 +twolayer 1 1 4 4 00000000 +twolayer 1 1 5 5 00000000 +twolayer 1 1 6 6 00000000 +twolayer 1 1 7 7 00000000 +twolayer 1 1 8 8 00000000 +twolayer 1 1 9 9 00000000 +twolayer 1 1 10 10 00000000 +twolayer 1 1 11 11 00000000 +twolayer 1 1 12 12 00000000 +twolayer 1 1 13 13 00000000 +twolayer 1 1 14 14 00000000 +twolayer 1 1 15 15 00000000 +twolayer 1 1 16 16 00000000 +twolayer 1 1 17 17 00000000 +twolayer 1 1 18 18 00000000 +twolayer 1 1 19 19 00000000 +twolayer 1 1 20 20 00000000 +twolayer 1 1 21 21 00000000 +twolayer 1 1 22 22 00000000 +twolayer 1 1 23 23 00000000 +twolayer 1 1 24 24 00000000 +twolayer 1 1 25 25 00000000 +twolayer 1 1 26 26 00000000 +twolayer 1 1 27 27 00000000 +twolayer 1 1 28 28 00000000 +twolayer 1 1 29 29 00000000 +twolayer 1 1 30 30 00000000 +twolayer 1 1 31 31 00000000 +twolayer 1 1 32 32 c0dff200 +twolayer 1 1 33 33 c0dff200 +twolayer 1 1 48 45 c0dff200 +twolayer 1 1 63 57 c0dff200 +twolayer 1 1 64 58 c10ffc00 +twolayer 1 1 80 71 c10ffc00 +twolayer 1 1 95 83 c10ffc00 +twolayer 1 1 96 84 c10ffc00 +twolayer 1 1 112 97 c10ffc00 +twolayer 1 1 127 109 c10ffc00 +twolayer 1 1 128 109 00000000 +twolayer 1 1 142 121 00000000 +twolayer 1 1 143 121 00000000 +twolayer 2 0 0 16568 00000000 +twolayer 2 0 1 16569 00000000 +twolayer 2 0 2 16570 00000000 +twolayer 2 0 3 16572 00000000 +twolayer 2 0 4 16573 00000000 +twolayer 2 0 5 16574 00000000 +twolayer 2 0 6 16575 00000000 +twolayer 2 0 7 16576 00000000 +twolayer 2 0 8 16578 00000000 +twolayer 2 0 9 16579 00000000 +twolayer 2 0 10 16580 00000000 +twolayer 2 0 11 16581 00000000 +twolayer 2 0 12 16582 00000000 +twolayer 2 0 13 16584 00000000 +twolayer 2 0 14 16585 00000000 +twolayer 2 0 15 16586 00000000 +twolayer 2 0 16 16587 00000000 +twolayer 2 0 17 16589 00000000 +twolayer 2 0 18 16590 00000000 +twolayer 2 0 19 16591 00000000 +twolayer 2 0 20 16592 00000000 +twolayer 2 0 21 16593 00000000 +twolayer 2 0 22 16595 00000000 +twolayer 2 0 23 16596 00000000 +twolayer 2 0 24 16597 00000000 +twolayer 2 0 25 16598 00000000 +twolayer 2 0 26 16600 00000000 +twolayer 2 0 27 16601 00000000 +twolayer 2 0 28 16602 00000000 +twolayer 2 0 29 16603 00000000 +twolayer 2 0 30 16604 00000000 +twolayer 2 0 31 16606 00000000 +twolayer 2 0 32 16655 00000000 +twolayer 2 0 33 16656 00000000 +twolayer 2 0 48 16675 00000000 +twolayer 2 0 63 16693 00000000 +twolayer 2 0 64 16695 00000000 +twolayer 2 0 80 16715 00000000 +twolayer 2 0 95 16733 00000000 +twolayer 2 0 96 0 00000000 +twolayer 2 0 112 0 00000000 +twolayer 2 0 127 0 00000000 +twolayer 2 0 128 0 00000000 +twolayer 2 0 144 0 00000000 +twolayer 2 0 159 0 00000000 +twolayer 2 0 160 0 00000000 +twolayer 2 0 176 0 00000000 +twolayer 2 0 191 0 00000000 +twolayer 2 0 192 0 00000000 +twolayer 2 0 208 0 00000000 +twolayer 2 0 223 0 00000000 +twolayer 2 0 224 0 00000000 +twolayer 2 0 240 0 00000000 +twolayer 2 0 246 0 00000000 +twolayer 2 0 247 0 00000000 +twolayer 2 1 0 0 00000000 +twolayer 2 1 1 1 00000000 +twolayer 2 1 2 2 00000000 +twolayer 2 1 3 3 00000000 +twolayer 2 1 4 4 00000000 +twolayer 2 1 5 5 00000000 +twolayer 2 1 6 6 00000000 +twolayer 2 1 7 7 00000000 +twolayer 2 1 8 8 00000000 +twolayer 2 1 9 9 00000000 +twolayer 2 1 10 10 00000000 +twolayer 2 1 11 11 00000000 +twolayer 2 1 12 12 00000000 +twolayer 2 1 13 13 00000000 +twolayer 2 1 14 14 00000000 +twolayer 2 1 15 15 00000000 +twolayer 2 1 16 16 00000000 +twolayer 2 1 17 17 00000000 +twolayer 2 1 18 18 00000000 +twolayer 2 1 19 19 00000000 +twolayer 2 1 20 20 00000000 +twolayer 2 1 21 21 00000000 +twolayer 2 1 22 22 00000000 +twolayer 2 1 23 23 00000000 +twolayer 2 1 24 24 00000000 +twolayer 2 1 25 25 00000000 +twolayer 2 1 26 26 00000000 +twolayer 2 1 27 27 00000000 +twolayer 2 1 28 28 00000000 +twolayer 2 1 29 29 00000000 +twolayer 2 1 30 30 00000000 +twolayer 2 1 31 31 00000000 +twolayer 2 1 32 32 c0dff200 +twolayer 2 1 33 33 c0dff200 +twolayer 2 1 48 45 c0dff200 +twolayer 2 1 63 57 c0dff200 +twolayer 2 1 64 58 c10ffc00 +twolayer 2 1 80 71 c10ffc00 +twolayer 2 1 95 83 c10ffc00 +twolayer 2 1 96 84 c10ffc00 +twolayer 2 1 112 97 c10ffc00 +twolayer 2 1 127 109 c10ffc00 +twolayer 2 1 128 109 00000000 +twolayer 2 1 142 121 00000000 +twolayer 2 1 143 121 00000000 +twolayer 3 0 0 0 00000000 +twolayer 3 0 1 1 00000000 +twolayer 3 0 2 2 00000000 +twolayer 3 0 3 3 00000000 +twolayer 3 0 4 4 00000000 +twolayer 3 0 5 5 00000000 +twolayer 3 0 6 6 00000000 +twolayer 3 0 7 7 00000000 +twolayer 3 0 8 8 00000000 +twolayer 3 0 9 9 00000000 +twolayer 3 0 10 10 00000000 +twolayer 3 0 11 11 00000000 +twolayer 3 0 12 12 00000000 +twolayer 3 0 13 13 00000000 +twolayer 3 0 14 14 00000000 +twolayer 3 0 15 15 00000000 +twolayer 3 0 16 16 00000000 +twolayer 3 0 17 17 00000000 +twolayer 3 0 18 18 00000000 +twolayer 3 0 19 19 00000000 +twolayer 3 0 20 20 00000000 +twolayer 3 0 21 21 00000000 +twolayer 3 0 22 22 00000000 +twolayer 3 0 23 23 00000000 +twolayer 3 0 24 24 00000000 +twolayer 3 0 25 25 00000000 +twolayer 3 0 26 26 00000000 +twolayer 3 0 27 27 00000000 +twolayer 3 0 28 28 00000000 +twolayer 3 0 29 29 00000000 +twolayer 3 0 30 30 00000000 +twolayer 3 0 31 31 00000000 +twolayer 3 0 32 32 00000000 +twolayer 3 0 33 33 00000000 +twolayer 3 0 48 45 00000000 +twolayer 3 0 63 57 00000000 +twolayer 3 0 64 58 7fc00000 +twolayer 3 0 80 71 7fc00000 +twolayer 3 0 95 83 7fc00000 +twolayer 3 0 96 84 7fc00000 +twolayer 3 0 112 97 7fc00000 +twolayer 3 0 127 109 7fc00000 +twolayer 3 0 128 109 7fc00000 +twolayer 3 0 144 122 7fc00000 +twolayer 3 0 159 0 7fc00000 +twolayer 3 0 160 0 00000000 +twolayer 3 0 176 0 00000000 +twolayer 3 0 191 0 00000000 +twolayer 3 0 192 0 00000000 +twolayer 3 0 208 0 00000000 +twolayer 3 0 223 0 00000000 +twolayer 3 0 224 0 00000000 +twolayer 3 0 240 0 00000000 +twolayer 3 0 246 0 00000000 +twolayer 3 0 247 0 00000000 +twolayer 3 1 0 0 00000000 +twolayer 3 1 1 1 00000000 +twolayer 3 1 2 2 00000000 +twolayer 3 1 3 3 00000000 +twolayer 3 1 4 4 00000000 +twolayer 3 1 5 5 00000000 +twolayer 3 1 6 6 00000000 +twolayer 3 1 7 7 00000000 +twolayer 3 1 8 8 00000000 +twolayer 3 1 9 9 00000000 +twolayer 3 1 10 10 00000000 +twolayer 3 1 11 11 00000000 +twolayer 3 1 12 12 00000000 +twolayer 3 1 13 13 00000000 +twolayer 3 1 14 14 00000000 +twolayer 3 1 15 15 00000000 +twolayer 3 1 16 16 00000000 +twolayer 3 1 17 17 00000000 +twolayer 3 1 18 18 00000000 +twolayer 3 1 19 19 00000000 +twolayer 3 1 20 20 00000000 +twolayer 3 1 21 21 00000000 +twolayer 3 1 22 22 00000000 +twolayer 3 1 23 23 00000000 +twolayer 3 1 24 24 00000000 +twolayer 3 1 25 25 00000000 +twolayer 3 1 26 26 00000000 +twolayer 3 1 27 27 00000000 +twolayer 3 1 28 28 00000000 +twolayer 3 1 29 29 00000000 +twolayer 3 1 30 30 00000000 +twolayer 3 1 31 31 00000000 +twolayer 3 1 32 32 c0dff200 +twolayer 3 1 33 33 c0dff200 +twolayer 3 1 48 45 c0dff200 +twolayer 3 1 63 57 c0dff200 +twolayer 3 1 64 58 c10ffc00 +twolayer 3 1 80 71 c10ffc00 +twolayer 3 1 95 83 c10ffc00 +twolayer 3 1 96 84 c10ffc00 +twolayer 3 1 112 97 c10ffc00 +twolayer 3 1 127 109 c10ffc00 +twolayer 3 1 128 109 00000000 +twolayer 3 1 142 121 00000000 +twolayer 3 1 143 121 00000000 +large 0 0 0 0 00000000 +large 0 0 1 0 00000000 +large 0 0 2 0 00000000 +large 0 0 3 1 00000000 +large 0 0 4 1 00000000 +large 0 0 5 1 00000000 +large 0 0 6 2 00000000 +large 0 0 7 2 00000000 +large 0 0 8 2 00000000 +large 0 0 9 3 00000000 +large 0 0 10 3 00000000 +large 0 0 11 3 00000000 +large 0 0 12 4 00000000 +large 0 0 13 4 00000000 +large 0 0 14 4 00000000 +large 0 0 15 5 00000000 +large 0 0 16 5 00000000 +large 0 0 17 5 00000000 +large 0 0 18 6 00000000 +large 0 0 19 6 00000000 +large 0 0 20 6 00000000 +large 0 0 21 7 00000000 +large 0 0 22 7 00000000 +large 0 0 23 7 00000000 +large 0 0 24 8 00000000 +large 0 0 25 8 00000000 +large 0 0 26 8 00000000 +large 0 0 27 9 00000000 +large 0 0 28 9 00000000 +large 0 0 29 9 00000000 +large 0 0 30 10 00000000 +large 0 0 31 10 00000000 +large 0 0 32 10 40ffe700 +large 0 0 33 11 40ffe700 +large 0 0 128 44 424c0301 +large 0 0 144 50 424c0301 +large 0 0 159 55 424c0301 +large 0 0 256 93 42f20121 +large 0 0 272 99 42f20121 +large 0 0 287 106 42f20121 +large 0 0 384 148 434b0028 +large 0 0 400 155 434b0028 +large 0 0 415 162 434b0028 +large 0 0 512 207 43907ff0 +large 0 0 528 215 43907ff0 +large 0 0 543 222 43907ff0 +large 0 0 640 272 43bdfff0 +large 0 0 656 280 43bdfff0 +large 0 0 671 288 43bdfff0 +large 0 0 768 343 43eafff0 +large 0 0 784 352 43eafff0 +large 0 0 799 361 43eafff0 +large 0 0 896 418 4402c020 +large 0 0 912 428 4402c020 +large 0 0 927 438 4402c020 +large 0 0 1024 501 4419800a +large 0 0 1040 511 4419800a +large 0 0 1055 521 4419800a +large 0 0 1152 590 44220000 +large 0 0 1168 601 44220000 +large 0 0 1183 612 44220000 +large 0 0 1280 686 44184018 +large 0 0 1296 698 44184018 +large 0 0 1311 710 44184018 +large 0 0 1408 790 44034000 +large 0 0 1424 803 44034000 +large 0 0 1439 816 44034000 +large 0 0 1536 900 43c0ffb8 +large 0 0 1552 915 43c0ffb8 +large 0 0 1567 928 43c0ffb8 +large 0 0 1664 1018 436affd0 +large 0 0 1680 1034 436affd0 +large 0 0 1695 1048 436affd0 +large 0 0 1792 1144 c217fe40 +large 0 0 1808 1160 c217fe40 +large 0 0 1823 1175 c217fe40 +large 0 0 1920 1271 c3c2ffff +large 0 0 1936 1287 c3c2ffff +large 0 0 1951 1301 c3c2ffff +large 0 0 2048 1392 c44ec012 +large 0 0 2064 1407 c44ec012 +large 0 0 2079 1421 c44ec012 +large 0 0 2176 1507 c4c2e021 +large 0 0 2192 1520 c4c2e021 +large 0 0 2207 1533 c4c2e021 +large 0 0 2304 1613 c53e4006 +large 0 0 2320 1626 c53e4006 +large 0 0 2335 1638 c53e4006 +large 0 0 2432 1714 00000000 +large 0 0 2448 1726 00000000 +large 0 0 2463 1738 00000000 +large 0 0 2560 1807 00000000 +large 0 0 2576 1818 00000000 +large 0 0 2591 1829 00000000 +large 0 0 2688 1893 00000000 +large 0 0 2704 1903 00000000 +large 0 0 2719 1913 00000000 +large 0 0 2816 1972 00000000 +large 0 0 2832 1981 00000000 +large 0 0 2847 1990 00000000 +large 0 0 2944 2045 00000000 +large 0 0 2960 2054 00000000 +large 0 0 2975 2062 00000000 +large 0 0 3072 2113 00000000 +large 0 0 3088 2121 00000000 +large 0 0 3103 2128 00000000 +large 0 0 3200 2175 00000000 +large 0 0 3216 2183 00000000 +large 0 0 3231 2189 00000000 +large 0 0 3328 2232 00000000 +large 0 0 3344 2239 00000000 +large 0 0 3359 2245 00000000 +large 0 0 3456 2284 00000000 +large 0 0 3472 2290 00000000 +large 0 0 3487 2296 00000000 +large 0 0 3584 2330 00000000 +large 0 0 3600 2336 00000000 +large 0 0 3615 2345 00000000 +large 0 0 3694 2390 00000000 +large 0 0 3695 2391 00000000 +large 0 1 0 0 00000000 +large 0 1 1 0 00000000 +large 0 1 2 0 00000000 +large 0 1 3 1 00000000 +large 0 1 4 1 00000000 +large 0 1 5 2 00000000 +large 0 1 6 2 00000000 +large 0 1 7 2 00000000 +large 0 1 8 3 00000000 +large 0 1 9 3 00000000 +large 0 1 10 3 00000000 +large 0 1 11 4 00000000 +large 0 1 12 4 00000000 +large 0 1 13 4 00000000 +large 0 1 14 5 00000000 +large 0 1 15 5 00000000 +large 0 1 16 6 00000000 +large 0 1 17 6 00000000 +large 0 1 18 6 00000000 +large 0 1 19 7 00000000 +large 0 1 20 7 00000000 +large 0 1 21 7 00000000 +large 0 1 22 8 00000000 +large 0 1 23 8 00000000 +large 0 1 24 9 00000000 +large 0 1 25 9 00000000 +large 0 1 26 9 00000000 +large 0 1 27 10 00000000 +large 0 1 28 10 00000000 +large 0 1 29 10 00000000 +large 0 1 30 11 00000000 +large 0 1 31 11 00000000 +large 0 1 32 11 41300c00 +large 0 1 33 12 41300c00 +large 0 1 128 49 42780040 +large 0 1 144 56 42780040 +large 0 1 159 62 42780040 +large 0 1 256 108 430fff70 +large 0 1 272 117 430fff70 +large 0 1 287 124 430fff70 +large 0 1 384 179 43620070 +large 0 1 400 188 43620070 +large 0 1 415 197 43620070 +large 0 1 512 262 43950000 +large 0 1 528 273 43950000 +large 0 1 543 284 43950000 +large 0 1 640 359 43818020 +large 0 1 656 372 43818020 +large 0 1 671 385 43818020 +large 0 1 768 472 4311ff68 +large 0 1 784 487 4311ff68 +large 0 1 799 501 4311ff68 +large 0 1 896 598 c2f1ff50 +large 0 1 912 614 c2f1ff50 +large 0 1 927 628 c2f1ff50 +large 0 1 1024 718 c4190017 +large 0 1 1040 732 c4190017 +large 0 1 1055 745 c4190017 +large 0 1 1152 824 c40a8000 +large 0 1 1168 836 c40a8000 +large 0 1 1183 847 c40a8000 +large 0 1 1280 915 00000000 +large 0 1 1296 925 00000000 +large 0 1 1311 935 00000000 +large 0 1 1408 992 00000000 +large 0 1 1424 1000 00000000 +large 0 1 1439 1008 00000000 +large 0 1 1536 1057 00000000 +large 0 1 1552 1064 00000000 +large 0 1 1567 1071 00000000 +large 0 1 1664 1111 00000000 +large 0 1 1680 1117 00000000 +large 0 1 1695 1124 00000000 +large 0 1 1780 1167 00000000 +large 0 1 1781 1167 00000000 +large 1 0 0 0 00000000 +large 1 0 1 0 00000000 +large 1 0 2 0 00000000 +large 1 0 3 0 00000000 +large 1 0 4 0 00000000 +large 1 0 5 0 00000000 +large 1 0 6 0 00000000 +large 1 0 7 0 00000000 +large 1 0 8 0 00000000 +large 1 0 9 0 00000000 +large 1 0 10 0 00000000 +large 1 0 11 0 00000000 +large 1 0 12 0 00000000 +large 1 0 13 0 00000000 +large 1 0 14 0 00000000 +large 1 0 15 0 00000000 +large 1 0 16 0 00000000 +large 1 0 17 0 00000000 +large 1 0 18 0 00000000 +large 1 0 19 0 00000000 +large 1 0 20 0 00000000 +large 1 0 21 0 00000000 +large 1 0 22 0 00000000 +large 1 0 23 0 00000000 +large 1 0 24 0 00000000 +large 1 0 25 0 00000000 +large 1 0 26 0 00000000 +large 1 0 27 0 00000000 +large 1 0 28 0 00000000 +large 1 0 29 0 00000000 +large 1 0 30 0 00000000 +large 1 0 31 0 00000000 +large 1 0 32 0 00000000 +large 1 0 33 0 00000000 +large 1 0 128 0 00000000 +large 1 0 144 0 00000000 +large 1 0 159 0 00000000 +large 1 0 256 0 00000000 +large 1 0 272 0 00000000 +large 1 0 287 0 00000000 +large 1 0 384 0 00000000 +large 1 0 400 0 00000000 +large 1 0 415 0 00000000 +large 1 0 512 0 00000000 +large 1 0 528 0 00000000 +large 1 0 543 0 00000000 +large 1 0 640 0 00000000 +large 1 0 656 0 00000000 +large 1 0 671 0 00000000 +large 1 0 768 0 00000000 +large 1 0 784 0 00000000 +large 1 0 799 0 00000000 +large 1 0 896 0 00000000 +large 1 0 912 0 00000000 +large 1 0 927 0 00000000 +large 1 0 1024 0 00000000 +large 1 0 1040 0 00000000 +large 1 0 1055 0 00000000 +large 1 0 1152 0 00000000 +large 1 0 1168 0 00000000 +large 1 0 1183 0 00000000 +large 1 0 1280 0 00000000 +large 1 0 1296 0 00000000 +large 1 0 1311 0 00000000 +large 1 0 1408 0 00000000 +large 1 0 1424 0 00000000 +large 1 0 1439 0 00000000 +large 1 0 1536 0 00000000 +large 1 0 1552 0 00000000 +large 1 0 1567 0 00000000 +large 1 0 1664 0 00000000 +large 1 0 1680 0 00000000 +large 1 0 1695 0 00000000 +large 1 0 1792 0 00000000 +large 1 0 1808 0 00000000 +large 1 0 1823 0 00000000 +large 1 0 1920 0 00000000 +large 1 0 1936 0 00000000 +large 1 0 1951 0 00000000 +large 1 0 2048 0 00000000 +large 1 0 2064 0 00000000 +large 1 0 2079 0 00000000 +large 1 0 2176 0 00000000 +large 1 0 2192 0 00000000 +large 1 0 2207 0 00000000 +large 1 0 2304 0 00000000 +large 1 0 2320 0 00000000 +large 1 0 2335 0 00000000 +large 1 0 2432 0 00000000 +large 1 0 2448 0 00000000 +large 1 0 2463 0 00000000 +large 1 0 2560 0 00000000 +large 1 0 2576 0 00000000 +large 1 0 2591 0 00000000 +large 1 0 2688 0 00000000 +large 1 0 2704 0 00000000 +large 1 0 2719 0 00000000 +large 1 0 2816 0 00000000 +large 1 0 2832 0 00000000 +large 1 0 2847 0 00000000 +large 1 0 2944 0 00000000 +large 1 0 2960 0 00000000 +large 1 0 2975 0 00000000 +large 1 0 3072 0 00000000 +large 1 0 3088 0 00000000 +large 1 0 3103 0 00000000 +large 1 0 3200 0 00000000 +large 1 0 3216 0 00000000 +large 1 0 3231 0 00000000 +large 1 0 3328 0 00000000 +large 1 0 3344 0 00000000 +large 1 0 3359 0 00000000 +large 1 0 3456 0 00000000 +large 1 0 3472 0 00000000 +large 1 0 3487 0 00000000 +large 1 0 3584 0 00000000 +large 1 0 3600 0 00000000 +large 1 0 3615 0 00000000 +large 1 0 3694 0 00000000 +large 1 0 3695 0 00000000 +large 1 1 0 0 00000000 +large 1 1 1 0 00000000 +large 1 1 2 0 00000000 +large 1 1 3 1 00000000 +large 1 1 4 1 00000000 +large 1 1 5 2 00000000 +large 1 1 6 2 00000000 +large 1 1 7 2 00000000 +large 1 1 8 3 00000000 +large 1 1 9 3 00000000 +large 1 1 10 3 00000000 +large 1 1 11 4 00000000 +large 1 1 12 4 00000000 +large 1 1 13 4 00000000 +large 1 1 14 5 00000000 +large 1 1 15 5 00000000 +large 1 1 16 6 00000000 +large 1 1 17 6 00000000 +large 1 1 18 6 00000000 +large 1 1 19 7 00000000 +large 1 1 20 7 00000000 +large 1 1 21 7 00000000 +large 1 1 22 8 00000000 +large 1 1 23 8 00000000 +large 1 1 24 9 00000000 +large 1 1 25 9 00000000 +large 1 1 26 9 00000000 +large 1 1 27 10 00000000 +large 1 1 28 10 00000000 +large 1 1 29 10 00000000 +large 1 1 30 11 00000000 +large 1 1 31 11 00000000 +large 1 1 32 11 41300c00 +large 1 1 33 12 41300c00 +large 1 1 128 49 42780040 +large 1 1 144 56 42780040 +large 1 1 159 62 42780040 +large 1 1 256 108 430fff70 +large 1 1 272 117 430fff70 +large 1 1 287 124 430fff70 +large 1 1 384 179 43620070 +large 1 1 400 188 43620070 +large 1 1 415 197 43620070 +large 1 1 512 262 43950000 +large 1 1 528 273 43950000 +large 1 1 543 284 43950000 +large 1 1 640 359 43818020 +large 1 1 656 372 43818020 +large 1 1 671 385 43818020 +large 1 1 768 472 4311ff68 +large 1 1 784 487 4311ff68 +large 1 1 799 501 4311ff68 +large 1 1 896 598 c2f1ff50 +large 1 1 912 614 c2f1ff50 +large 1 1 927 628 c2f1ff50 +large 1 1 1024 718 c4190017 +large 1 1 1040 732 c4190017 +large 1 1 1055 745 c4190017 +large 1 1 1152 824 c40a8000 +large 1 1 1168 836 c40a8000 +large 1 1 1183 847 c40a8000 +large 1 1 1280 915 00000000 +large 1 1 1296 925 00000000 +large 1 1 1311 935 00000000 +large 1 1 1408 992 00000000 +large 1 1 1424 1000 00000000 +large 1 1 1439 1008 00000000 +large 1 1 1536 1057 00000000 +large 1 1 1552 1064 00000000 +large 1 1 1567 1071 00000000 +large 1 1 1664 1111 00000000 +large 1 1 1680 1117 00000000 +large 1 1 1695 1124 00000000 +large 1 1 1780 1167 00000000 +large 1 1 1781 1167 00000000 +large 2 0 0 0 00000000 +large 2 0 1 0 00000000 +large 2 0 2 0 00000000 +large 2 0 3 0 00000000 +large 2 0 4 0 00000000 +large 2 0 5 0 00000000 +large 2 0 6 0 00000000 +large 2 0 7 0 00000000 +large 2 0 8 0 00000000 +large 2 0 9 0 00000000 +large 2 0 10 0 00000000 +large 2 0 11 0 00000000 +large 2 0 12 0 00000000 +large 2 0 13 0 00000000 +large 2 0 14 0 00000000 +large 2 0 15 0 00000000 +large 2 0 16 0 00000000 +large 2 0 17 0 00000000 +large 2 0 18 0 00000000 +large 2 0 19 0 00000000 +large 2 0 20 0 00000000 +large 2 0 21 0 00000000 +large 2 0 22 0 00000000 +large 2 0 23 0 00000000 +large 2 0 24 0 00000000 +large 2 0 25 0 00000000 +large 2 0 26 0 00000000 +large 2 0 27 0 00000000 +large 2 0 28 0 00000000 +large 2 0 29 0 00000000 +large 2 0 30 0 00000000 +large 2 0 31 0 00000000 +large 2 0 32 0 00000000 +large 2 0 33 0 00000000 +large 2 0 128 0 7fc00000 +large 2 0 144 0 7fc00000 +large 2 0 159 0 7fc00000 +large 2 0 256 0 7fc00000 +large 2 0 272 0 7fc00000 +large 2 0 287 0 7fc00000 +large 2 0 384 0 7fc00000 +large 2 0 400 0 7fc00000 +large 2 0 415 0 7fc00000 +large 2 0 512 0 7fc00000 +large 2 0 528 0 7fc00000 +large 2 0 543 0 7fc00000 +large 2 0 640 0 7fc00000 +large 2 0 656 0 7fc00000 +large 2 0 671 0 7fc00000 +large 2 0 768 0 7fc00000 +large 2 0 784 0 7fc00000 +large 2 0 799 0 7fc00000 +large 2 0 896 18608 7f16c969 +large 2 0 912 18634 7f16c969 +large 2 0 927 18659 7f16c969 +large 2 0 1024 19644 7f06aac2 +large 2 0 1040 19680 7f06aac2 +large 2 0 1055 19714 7f06aac2 +large 2 0 1152 0 7ec5d1bd +large 2 0 1168 0 7ec5d1bd +large 2 0 1183 0 7ec5d1bd +large 2 0 1280 0 7e9b55fe +large 2 0 1296 0 7e9b55fe +large 2 0 1311 0 7e9b55fe +large 2 0 1408 0 7e4da6d1 +large 2 0 1424 0 7e4da6d1 +large 2 0 1439 0 7e4da6d1 +large 2 0 1536 0 7e1ba754 +large 2 0 1552 0 7e1ba754 +large 2 0 1567 0 7e1ba754 +large 2 0 1664 0 7dcf4793 +large 2 0 1680 0 7dcf4793 +large 2 0 1695 0 7dcf4793 +large 2 0 1792 0 7d780010 +large 2 0 1808 0 7d780010 +large 2 0 1823 0 7d780010 +large 2 0 1920 0 7dac1377 +large 2 0 1936 0 7dac1377 +large 2 0 1951 0 7dac1377 +large 2 0 2048 0 7e124944 +large 2 0 2064 0 7e124944 +large 2 0 2079 0 7e124944 +large 2 0 2176 0 7e6c5f21 +large 2 0 2192 0 7e6c5f21 +large 2 0 2207 0 7e6c5f21 +large 2 0 2304 0 7ef709e3 +large 2 0 2320 0 7ef709e3 +large 2 0 2335 0 7ef709e3 +large 2 0 2432 0 7f3aeb89 +large 2 0 2448 0 7f3aeb89 +large 2 0 2463 0 7f3aeb89 +large 2 0 2560 0 00000000 +large 2 0 2576 0 00000000 +large 2 0 2591 0 00000000 +large 2 0 2688 0 80000000 +large 2 0 2704 0 80000000 +large 2 0 2719 0 80000000 +large 2 0 2816 0 80cfe3be +large 2 0 2832 0 80cfe3be +large 2 0 2847 0 80cfe3be +large 2 0 2944 0 81192cf5 +large 2 0 2960 0 81192cf5 +large 2 0 2975 0 81192cf5 +large 2 0 3072 0 81c100ff +large 2 0 3088 0 81c100ff +large 2 0 3103 0 81c100ff +large 2 0 3200 0 82011caa +large 2 0 3216 0 82011caa +large 2 0 3231 0 82011caa +large 2 0 3328 0 8284c470 +large 2 0 3344 0 8284c470 +large 2 0 3359 0 8284c470 +large 2 0 3456 0 8318179d +large 2 0 3472 0 8318179d +large 2 0 3487 0 8318179d +large 2 0 3584 0 837555f7 +large 2 0 3600 0 837555f7 +large 2 0 3615 0 837555f7 +large 2 0 3694 0 80ad1124 +large 2 0 3695 0 80ad1124 +large 2 1 0 0 00000000 +large 2 1 1 0 00000000 +large 2 1 2 0 00000000 +large 2 1 3 1 00000000 +large 2 1 4 1 00000000 +large 2 1 5 2 00000000 +large 2 1 6 2 00000000 +large 2 1 7 2 00000000 +large 2 1 8 3 00000000 +large 2 1 9 3 00000000 +large 2 1 10 3 00000000 +large 2 1 11 4 00000000 +large 2 1 12 4 00000000 +large 2 1 13 4 00000000 +large 2 1 14 5 00000000 +large 2 1 15 5 00000000 +large 2 1 16 6 00000000 +large 2 1 17 6 00000000 +large 2 1 18 6 00000000 +large 2 1 19 7 00000000 +large 2 1 20 7 00000000 +large 2 1 21 7 00000000 +large 2 1 22 8 00000000 +large 2 1 23 8 00000000 +large 2 1 24 9 00000000 +large 2 1 25 9 00000000 +large 2 1 26 9 00000000 +large 2 1 27 10 00000000 +large 2 1 28 10 00000000 +large 2 1 29 10 00000000 +large 2 1 30 11 00000000 +large 2 1 31 11 00000000 +large 2 1 32 11 41300c00 +large 2 1 33 12 41300c00 +large 2 1 128 49 42780040 +large 2 1 144 56 42780040 +large 2 1 159 62 42780040 +large 2 1 256 108 430fff70 +large 2 1 272 117 430fff70 +large 2 1 287 124 430fff70 +large 2 1 384 179 43620070 +large 2 1 400 188 43620070 +large 2 1 415 197 43620070 +large 2 1 512 262 43950000 +large 2 1 528 273 43950000 +large 2 1 543 284 43950000 +large 2 1 640 359 43818020 +large 2 1 656 372 43818020 +large 2 1 671 385 43818020 +large 2 1 768 472 4311ff68 +large 2 1 784 487 4311ff68 +large 2 1 799 501 4311ff68 +large 2 1 896 598 c2f1ff50 +large 2 1 912 614 c2f1ff50 +large 2 1 927 628 c2f1ff50 +large 2 1 1024 718 c4190017 +large 2 1 1040 732 c4190017 +large 2 1 1055 745 c4190017 +large 2 1 1152 824 c40a8000 +large 2 1 1168 836 c40a8000 +large 2 1 1183 847 c40a8000 +large 2 1 1280 915 00000000 +large 2 1 1296 925 00000000 +large 2 1 1311 935 00000000 +large 2 1 1408 992 00000000 +large 2 1 1424 1000 00000000 +large 2 1 1439 1008 00000000 +large 2 1 1536 1057 00000000 +large 2 1 1552 1064 00000000 +large 2 1 1567 1071 00000000 +large 2 1 1664 1111 00000000 +large 2 1 1680 1117 00000000 +large 2 1 1695 1124 00000000 +large 2 1 1780 1167 00000000 +large 2 1 1781 1167 00000000 diff --git a/crates/metal2vulkan/src/bind/rate_map/apple_tests.rs b/crates/metal2vulkan/src/bind/rate_map/apple_tests.rs index 09e841962..32ec91c88 100644 --- a/crates/metal2vulkan/src/bind/rate_map/apple_tests.rs +++ b/crates/metal2vulkan/src/bind/rate_map/apple_tests.rs @@ -3,7 +3,8 @@ //! and GPU answers, bit for bit, the sign of a zero and a `NaN`'s bits included: inside the screen, //! in the half pixel before a tile boundary at a multiple of 32, past both ends, at denormals, //! `NaN`s, infinities and far values, at offsets that lie near a half step, and a shader's layers 1 -//! to 5 over the bytes followed by a pattern. +//! to 5 over the bytes followed by a pattern. A shader's `uint2` answers, measured on an Apple M3 +//! Max by our probe `rate_map_integer_overloads`, are `apple_integer_vectors.txt`. use super::*; use crate::air::canon::rate_map_data as format; @@ -11,6 +12,8 @@ use sha2::{Digest, Sha256}; use std::collections::BTreeMap; const VECTORS: &str = include_str!("apple_vectors.txt"); +/// A shader's `uint2` answers on an Apple M3 Max (the file's header has its format). +pub(crate) const INTEGER_VECTORS: &str = include_str!("apple_integer_vectors.txt"); /// The words past the parameter data in the probe's padded buffer: word `i` of the buffer. fn pattern(i: u32) -> u32 { @@ -35,7 +38,7 @@ fn sha(bytes: &[u8]) -> String { } /// The descriptor of a vector line's layers: `h:...|v:...` per layer, `;` between, `-` for none. -fn descriptor(width: &str, height: &str, layers: &str) -> RateMapDescriptor { +pub(crate) fn descriptor(width: &str, height: &str, layers: &str) -> RateMapDescriptor { let size = |v: &str| v.parse::().expect("extent"); let mut d = RateMapDescriptor::new([size(width), size(height)]); if layers != "-" { @@ -125,6 +128,58 @@ fn metals_bytes_and_answers() { ); } +/// A shader's `uint2` maps answer as Metal's, bit for bit, over each measured map's bytes, which +/// are Metal's (`apple_integer_vectors.txt`, an Apple M3 Max under macOS 27.0.1): screen to +/// physical the `float2` decoder's answer at the pixel's centre converted to `uint`, physical to +/// screen the bits of a `float` the granule's entry gives, at the maps' layers and two past them. +#[test] +fn metals_integer_answers() { + let mut maps = BTreeMap::new(); + let (mut points, mut mismatches) = (0usize, Vec::new()); + for line in INTEGER_VECTORS.lines().filter(|l| !l.starts_with('#')) { + let f: Vec<&str> = line.split_whitespace().collect(); + match f.as_slice() { + ["map", id, width, height, layers, want] => { + let map = RasterizationRateMap::new(&descriptor(width, height, layers)) + .unwrap_or_else(|e| panic!("{id}: {e}")); + assert_eq!( + sha(&map.to_bytes()), + *want, + "{id}: the bytes are not Metal's" + ); + maps.insert(id.to_string(), map); + } + [id, layer, axis, input, to_physical, to_screen] => { + let words = maps[*id].words(); + let number = |v: &str| v.parse::().expect("number"); + let (layer, axis) = (number(layer), number(axis) as usize); + let mut c = [0u32; 2]; + c[axis] = number(input); + let got = [ + format::shader_screen_to_physical_integer(words, layer, c)[axis], + format::shader_physical_to_screen_integer(words, layer, c)[axis], + ]; + let want = [ + number(to_physical), + u32::from_str_radix(to_screen, 16).expect("bits"), + ]; + points += 1; + if got != want { + mismatches.push(format!("{line}: got {} {:08x}", got[0], got[1])); + } + } + other => panic!("{other:?}"), + } + } + assert_eq!(points, 1561, "the file's answers, every one read"); + assert!( + mismatches.is_empty(), + "{} of {points} answers are not Metal's:\n{}", + mismatches.len(), + mismatches[..mismatches.len().min(20)].join("\n") + ); +} + /// A reset to and from a map of a zero screen extent writes Metal's words (an Apple M3 Max under /// macOS 27.0.1, our probe `vec`, one map per process): a 64 by 64 map of quality 0.5 reset to 0 /// by 64 keeps the entries the narrower map does not write, and the same map reset the other way diff --git a/crates/metal2vulkan/src/lower/fragment/mod.rs b/crates/metal2vulkan/src/lower/fragment/mod.rs index 29092698e..2489cee4d 100644 --- a/crates/metal2vulkan/src/lower/fragment/mod.rs +++ b/crates/metal2vulkan/src/lower/fragment/mod.rs @@ -52,9 +52,8 @@ //! - **Pull-model interpolation** (`interpolate`): each `interpolate_at_*` call of an //! `interpolant` reads the interpolant's variable where it says (`stage_io::interpolate`); the //! interpolant itself is planned by `lower::stage_io`. -//! - Refused: the `uint2` overloads of `map_screen_to_physical_coordinates` and its inverse -//! (canon compiles the `float2` ones to the rate map's decoder; no reading of the -//! physical-to-screen `uint2` one is established). +//! - `map_screen_to_physical_coordinates` and its inverse never reach lowering: canon compiles +//! every overload, `float2` and `uint2`, to the rate map's decoder (`air::canon::rate_map`). mod color; mod coverage; @@ -1016,9 +1015,9 @@ pub fn select(cx: &mut SelectCx<'_>, at: InstId, inst: &Inst) -> Result Err(not_lowered()), - // Canon compiled every `float2` map; the `uint2` ones reach here. + // Canon compiled every map, `float2` and `uint2`, to its decoder. Fragment::MapCoordinates { .. } => { - Err(Unsupported::not_implemented(Feature::RasterizationRateMap).into()) + Err(cx.invariant("a rasterization-rate map call canon compiles reached lowering")) } Fragment::NumSamples if cx.stage == Stage::Fragment => num_samples(cx, inst, &call.args), Fragment::NumSamples => Err(not_lowered()), diff --git a/crates/metal2vulkan/src/tests/engine_rate_map.rs b/crates/metal2vulkan/src/tests/engine_rate_map.rs index b61f6e339..f7abf9d3d 100644 --- a/crates/metal2vulkan/src/tests/engine_rate_map.rs +++ b/crates/metal2vulkan/src/tests/engine_rate_map.rs @@ -20,7 +20,8 @@ //! The kernel is the shape Apple's compiler emits for //! `out[tid] = float4(dec.map_screen_to_physical_coordinates(in[tid], layer), //! dec.map_physical_to_screen_coordinates(in[tid], layer))` (fast math, denormals off). -//! `llvm-as` assembles it; without it the tests skip visibly. +//! `llvm-as` assembles it; without it the tests skip visibly. The `uint2` overloads are +//! `integer`'s. use std::sync::atomic::{AtomicU64, Ordering}; @@ -39,6 +40,8 @@ use crate::pipeline::testing::{ use crate::pipeline::PrecisionNote; use crate::spirv::interp::{run, Buffer, Config, Resources}; +mod integer; + const PROFILES: [&str; 4] = [ "moltenvk-m3", "lunarg-desktop-baseline-2023", @@ -146,9 +149,10 @@ fn kept(words: &[u32], layer: u32, c: [f32; 2], to_physical: bool) -> [f32; 2] { return (x - f32::from_bits(offset)) * f32::from_bits(reciprocal); } let j = format::shader_index((x + format::SHADER_GRANULE_OFFSET) * format::INV_GRANULARITY); - let boundary = entry(table, j).1 & format::NO_BOUNDARY; + let packed = entry(table, j).1; + let (byte, boundary) = (packed & format::NO_BOUNDARY, packed & format::BOUNDARY_MASK); let into = (x - j as f32 * format::GRANULARITY as f32) * 2.0; - let j = if boundary != format::NO_BOUNDARY && into >= boundary as f32 { + let j = if byte != format::NO_BOUNDARY && into >= boundary as f32 { j.wrapping_add(1) } else { j diff --git a/crates/metal2vulkan/src/tests/engine_rate_map/integer.rs b/crates/metal2vulkan/src/tests/engine_rate_map/integer.rs new file mode 100644 index 000000000..cdd372406 --- /dev/null +++ b/crates/metal2vulkan/src/tests/engine_rate_map/integer.rs @@ -0,0 +1,244 @@ +//! The `uint2` overloads end to end, in the fixture `rate_map_integer` (compiled from our MSL by +//! `scripts/regen-air-fixtures`): its kernel and its fragment function compile on every tested +//! profile, pass L3 and record no `RasterizationRateMap` note. On the CPU interpreter, which keeps +//! `float` denormals as lavapipe does, the kernel answers what `rate_map_data`'s shader decoders +//! compute with denormals kept ([`kept_integer`]), for every layer and two past a map's, inside +//! the screen, at and around each multiple of 32, past both extents and, under the in-shader +//! containment encoding, at far coordinates; where no denormal arises, that is Metal's answer +//! (`shader_screen_to_physical_integer` and `shader_physical_to_screen_integer`, measured on an +//! Apple M3 Max). + +use super::*; + +const FIXTURE: &str = "../metal2vulkan-validation/fixtures/public/engine/rate_map_integer.ll"; + +/// The fixture's module, assembled; `None` (the test skips visibly) without `llvm-as`. +fn fixture() -> Option> { + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(FIXTURE); + assemble(&std::fs::read_to_string(path).expect("the fixture")) +} + +/// A shader's `uint2` map of `c` over parameter data `words` in layer `layer`, to physical +/// coordinates if `to_physical`, as the translated decoder computes it on a device that keeps +/// `float` denormals: screen to physical the `float2` decoder's arithmetic ([`kept`]) at the +/// pixel's centre, converted saturating; physical to screen the bits of `(0 - offset) · +/// reciprocal` of granule `c >> 5`'s entry, IEEE `f32`, a read past the words 0. +fn kept_integer(words: &[u32], layer: u32, c: [u32; 2], to_physical: bool) -> [u32; 2] { + if to_physical { + let centre = c.map(|v| v as f32 + 0.5); + return kept(words, layer, centre, true).map(format::shader_index); + } + let word = |i: u32| words.get(i as usize).copied().unwrap_or(0); + let axis = |axis: u32, p: u32| { + let at = format::table(layer, axis, false) + .wrapping_add((p >> format::GRANULE_SHIFT).wrapping_mul(format::ENTRY_WORDS)); + let (reciprocal, offset) = (word(at), word(at.wrapping_add(1))); + ((0.0 - f32::from_bits(offset)) * f32::from_bits(reciprocal)).to_bits() + }; + [axis(0, c[0]), axis(1, c[1])] +} + +/// Bit for bit; a physical-to-screen answer that is a `NaN`'s bits matches any `NaN`'s (the +/// module leaves a `NaN`'s bits to the device, which the interpreter does not model). +fn same_answer(got: [u32; 4], want: [u32; 4]) -> bool { + let nan = |b: u32| f32::from_bits(b).is_nan(); + got[..2] == want[..2] + && (got[2..].iter()) + .zip(&want[2..]) + .all(|(&g, &w)| g == w || (nan(g) && nan(w))) +} + +/// The coordinates every map is decoded at: the first granule's, each multiple of 32 and its +/// neighbours past both extents, and (`far`) coordinates whose index reads far past the words. +fn integer_points(screen: [u32; 2], far: bool) -> Vec<[u32; 2]> { + let reach = screen[0].max(screen[1]) + 96; + let mut out: Vec<[u32; 2]> = (0..34).map(|i| [i, 33 - i]).collect(); + for edge in (32..reach).step_by(32) { + for (i, c) in [edge - 1, edge, edge + 1].into_iter().enumerate() { + out.push([c, reach - c + i as u32]); + } + } + if far { + out.extend([[16_383, 1 << 20], [1 << 24, 7], [u32::MAX, 1 << 31]]); + } + out +} + +fn uints(c: &[[u32; 2]]) -> Vec { + c.iter() + .flat_map(|p| p.iter().flat_map(|v| v.to_le_bytes())) + .collect() +} + +/// Both `uint2` maps of every layer, as the shader decoders' arithmetic computes them with the +/// device's denormals ([`kept_integer`]), on every profile, with no `RasterizationRateMap` note; +/// Metal's answers at every point of a map's own layers. +#[test] +fn the_integer_maps_answer_as_metal() { + let Some(bc) = fixture() else { + return; + }; + let (mut metals, mut apart) = (0, 0); + for stem in PROFILES { + for robust in [true, false] { + let what = format!("{stem} robust={robust}"); + let p = profile_with(stem, robust); + for entry in ["rate_map_integer", "rate_map_integer_pixel"] { + let a = compile(&bc, entry, &p).unwrap_or_else(|e| panic!("{what} {entry}: {e}")); + assert!( + !a.precision.contains(&PrecisionNote::RasterizationRateMap), + "{what} {entry}: {:?}", + a.precision + ); + link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what} {entry}: L3: {e}")); + } + let (plan, m) = typed_module(&bc, "rate_map_integer", &p).expect("module"); + for (name, map) in maps() { + let words = map.words(); + // Robust descriptors contain a far read on a device, which the interpreter traps + // on (the module docs), so with them only the near points run. + let pts = integer_points(map.screen_size(), !robust); + for layer in 0..map.layer_count() + 2 { + let res = Resources { + buffers: vec![ + bound(0, &map.to_bytes()), + bound(1, &uints(&pts)), + bound(2, &vec![0u8; pts.len() * 16]), + bound(3, &layer.to_le_bytes()), + ], + push: push_bytes(&plan), + spec: Default::default(), + }; + let cfg = Config { + workgroups: [pts.len() as u32, 1, 1], + ..Config::default() + }; + let out = run(&m, &cfg, res).unwrap_or_else(|e| panic!("{what}: {e:?}")); + for (i, &c) in pts.iter().enumerate() { + let mut got = [0u32; 4]; + for (k, b) in out.buffers[2][i * 16..i * 16 + 16].chunks(4).enumerate() { + got[k] = u32::from_le_bytes([b[0], b[1], b[2], b[3]]); + } + let [s, t] = [true, false].map(|to| kept_integer(words, layer, c, to)); + let want = [s[0], s[1], t[0], t[1]]; + assert!( + same_answer(got, want), + "{what}: {name} layer {layer} at {c:?}: {got:x?}, kept {want:x?}" + ); + let [s, t] = [ + format::shader_screen_to_physical_integer(words, layer, c), + format::shader_physical_to_screen_integer(words, layer, c), + ]; + if same_answer(want, [s[0], s[1], t[0], t[1]]) { + metals += 1; + } else { + assert!( + layer >= map.layer_count(), + "{what}: {name} layer {layer} at {c:?}: {want:x?}, Metal's \ + {s:?} {t:x?}" + ); + apart += 1; + } + } + } + } + } + } + // Both kinds of point were decoded, so neither comparison is vacuous. + assert!( + metals > 0 && apart > 0, + "{metals} points Metal's, {apart} apart" + ); +} + +/// The translated kernel answers Metal's recorded `uint2` answers (`apple_integer_vectors.txt`, +/// an Apple M3 Max under macOS 27.0.1) at every recorded point of each map's own layers, on the +/// CPU interpreter, every tested profile: screen to physical and physical to screen, bit for bit. +/// The points of layers past a map's read other tables' words, whose `float`s may be denormal, +/// which the interpreter keeps where Metal flushes them (the device's own denormals, +/// `PrecisionNote::DeviceDenormals`); [`the_integer_maps_answer_as_metal`] holds them to the +/// decoder's arithmetic instead. +#[test] +fn the_translated_integer_maps_answer_metals_recorded_answers() { + use crate::bind::rate_map::apple_tests::{descriptor, INTEGER_VECTORS}; + use std::collections::BTreeMap; + let Some(bc) = fixture() else { + return; + }; + // Each map, and its recorded points by layer: the axis, the coordinate and both answers. + let mut maps: BTreeMap<&str, RasterizationRateMap> = BTreeMap::new(); + let mut points: BTreeMap<(&str, u32), Vec<(usize, u32, [u32; 2])>> = BTreeMap::new(); + for line in INTEGER_VECTORS.lines().filter(|l| !l.starts_with('#')) { + let f: Vec<&str> = line.split_whitespace().collect(); + let number = |v: &str| v.parse::().expect("number"); + match f.as_slice() { + ["map", id, width, height, layers, _] => { + let map = RasterizationRateMap::new(&descriptor(width, height, layers)) + .unwrap_or_else(|e| panic!("{id}: {e}")); + maps.insert(id, map); + } + [id, layer, axis, input, to_physical, to_screen] => { + let to_screen = u32::from_str_radix(to_screen, 16).expect("bits"); + let point = ( + number(axis) as usize, + number(input), + [number(to_physical), to_screen], + ); + points.entry((id, number(layer))).or_default().push(point); + } + other => panic!("{other:?}"), + } + } + let mut compared = 0usize; + for stem in PROFILES { + let p = profile_with(stem, false); + let (plan, m) = typed_module(&bc, "rate_map_integer", &p).expect("module"); + for (&(id, layer), recorded) in &points { + let map = &maps[id]; + if layer >= map.layer_count() { + continue; + } + let coordinates: Vec<[u32; 2]> = (recorded.iter()) + .map(|&(axis, c, _)| { + let mut at = [0u32; 2]; + at[axis] = c; + at + }) + .collect(); + let res = Resources { + buffers: vec![ + bound(0, &map.to_bytes()), + bound(1, &uints(&coordinates)), + bound(2, &vec![0u8; coordinates.len() * 16]), + bound(3, &layer.to_le_bytes()), + ], + push: push_bytes(&plan), + spec: Default::default(), + }; + let cfg = Config { + workgroups: [coordinates.len() as u32, 1, 1], + ..Config::default() + }; + let out = run(&m, &cfg, res).unwrap_or_else(|e| panic!("{stem}: {e:?}")); + for (i, &(axis, c, want)) in recorded.iter().enumerate() { + let word = |k: usize| { + let at = i * 16 + k * 4; + let b = &out.buffers[2][at..at + 4]; + u32::from_le_bytes([b[0], b[1], b[2], b[3]]) + }; + let got = [word(axis), word(2 + axis)]; + assert_eq!( + got, want, + "{stem}: {id} layer {layer} axis {axis} at {c}: got {got:x?}, Metal's {want:x?}" + ); + compared += 1; + } + } + } + // Every recorded point of a map's own layers, on every profile. + assert_eq!( + compared, + 587 * PROFILES.len(), + "the recorded points compared" + ); +} diff --git a/crates/metal2vulkan/src/tests/engine_refused_families.rs b/crates/metal2vulkan/src/tests/engine_refused_families.rs index 2fb4129de..16f53a51a 100644 --- a/crates/metal2vulkan/src/tests/engine_refused_families.rs +++ b/crates/metal2vulkan/src/tests/engine_refused_families.rs @@ -285,38 +285,6 @@ fn imageblocks_are_refused() { assert_at_instruction(&u, "k"); } -/// The `uint2` rasterization-rate map overloads are refused at the coordinate mapping, in both -/// directions (canon compiles the `float2` ones; no reading of the physical-to-screen `uint2` one -/// is established). -#[test] -fn integer_rasterization_rate_maps_are_refused() { - for name in [ - "map_physical_to_screen_coordinates", - "map_screen_to_physical_coordinates", - ] { - let text = format!( - "define void @k(ptr addrspace(2) %0, ptr addrspace(1) %1) {{\n %m = call <2 x i32> \ - @air.{name}.v2i32.p2i8.i32(<2 x i32> zeroinitializer, ptr addrspace(2) %0, i32 0)\n \ - %x = extractelement <2 x i32> %m, i64 0\n store i32 %x, ptr addrspace(1) %1, align \ - 4\n ret void\n}}\n\ndeclare <2 x i32> @air.{name}.v2i32.p2i8.i32(<2 x i32>, ptr \ - addrspace(2), i32)\n\n!air.kernel = !{{!0}}\n!0 = !{{ptr @k, !1, !2}}\n!1 = !{{}}\n\ - !2 = !{{!3, !4}}\n!3 = !{{i32 0, !\"air.buffer\", !\"air.location_index\", i32 0, i32 \ - 1, !\"air.read\", !\"air.address_space\", i32 2, !\"air.arg_type_name\", \ - !\"metal::rasterization_rate_map_data\", !\"air.arg_name\", !\"map\"}}\n!4 = !{{i32 \ - 1, !\"air.buffer\", !\"air.location_index\", i32 1, i32 1, !\"air.read_write\", \ - !\"air.address_space\", i32 1, !\"air.arg_type_size\", i32 4, \ - !\"air.arg_type_align_size\", i32 4, !\"air.arg_type_name\", !\"uint\", \ - !\"air.arg_name\", !\"out\"}}\n" - ); - let Some(bc) = assemble(&format!("rate-map-{name}"), &text) else { - return; - }; - let u = refusal(&bc, "k"); - assert_refused(&u, Feature::RasterizationRateMap); - assert_at_instruction(&u, "k"); - } -} - /// A fragment function's threadgroup memory (a `[[threadgroup(0)]]` buffer, which the corpus's /// splat rasterizers set bits in) is its tile's memory, kept across the render pass: it compiles on /// every committed profile with `fragmentStoresAndAtomics`, binding the pass's tile memory buffer diff --git a/crates/metal2vulkan/tests/public_fixture_expectations_engine.tsv b/crates/metal2vulkan/tests/public_fixture_expectations_engine.tsv index bfe28d6fe..93a22680a 100644 --- a/crates/metal2vulkan/tests/public_fixture_expectations_engine.tsv +++ b/crates/metal2vulkan/tests/public_fixture_expectations_engine.tsv @@ -2194,10 +2194,10 @@ engine/px_samplers.ll px_const_linear_zero ok ok ok ok ok ok ok ok ok ok ok ok o engine/px_samplers.ll px_const_linear_border ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok engine/quad_shuffle.air.ll quad_shuffle_rotate ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok engine/quad_shuffle.ll quad_shuffle_rotate ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok -engine/rate_map_integer.air.ll rate_map_integer Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} -engine/rate_map_integer.air.ll rate_map_integer_pixel Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} -engine/rate_map_integer.ll rate_map_integer Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} -engine/rate_map_integer.ll rate_map_integer_pixel Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} Unsupported{RasterizationRateMap; NotImplemented} +engine/rate_map_integer.air.ll rate_map_integer ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok +engine/rate_map_integer.air.ll rate_map_integer_pixel ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok +engine/rate_map_integer.ll rate_map_integer ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok +engine/rate_map_integer.ll rate_map_integer_pixel ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok engine/rch_guarded_effects.air.ll rch_guarded_vertex ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok engine/rch_guarded_effects.air.ll rch_guarded_store ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok Unsupported{StageStoresAndAtomics; AnyOf[[Feature(FragmentStoresAndAtomics)]]} engine/rch_guarded_effects.air.ll rch_guarded_atomic ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok Unsupported{StageStoresAndAtomics; AnyOf[[Feature(FragmentStoresAndAtomics)]]} diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index fd6f31c5a..ced3e9350 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -130,7 +130,7 @@ Columns: | `Imageblocks` | An imageblock outside the forms implemented | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`missing`); drivers with a defect; every device (not implemented) | `ours` | 10: `crates/metal2vulkan/src/lower/access/imageblock.rs (imageblocks)`, `crates/metal2vulkan/src/lower/access/mod.rs (select_param)` (+7) | `rare`: imageblocks (Apple GPU families) | | `RayTracing` | | devices without a capability the site computes (`missing`); every device (no Vulkan mechanism); every device (not implemented) | `ours` | 12: `crates/metal2vulkan/src/bind/acceleration.rs (instance_record, 2 sites)`, `crates/metal2vulkan/src/lower/raytracing/mod.rs (instance_count)` (+5) | `rare`: ray tracing (out of scope by ruling) | | `Tensors` | | every device (not implemented) | `ours` | 2: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs (refuse)`, `crates/metal2vulkan/src/lower/select.rs (route_air)` | `rare`: shader tensors | -| `RasterizationRateMap` | | devices without VkFeature::MultiViewport; devices without VkFeature::ShaderDrawParameters; devices without VkFeature::ShaderOutputViewportIndex; devices without VkLimit::MaxGeometryTotalOutputComponents; devices without a capability the site computes; devices without a capability the site computes (`vec![Capability::Feature(lacks)]`); every device (not implemented) | `ours` | 7: `crates/metal2vulkan/src/lower/fragment/mod.rs (select)`, `crates/metal2vulkan/src/lower/stage_io/plan.rs (region_viewport, 2 sites)` (+2) | `rare`: rasterization rate maps | +| `RasterizationRateMap` | | devices without VkFeature::MultiViewport; devices without VkFeature::ShaderDrawParameters; devices without VkFeature::ShaderOutputViewportIndex; devices without VkLimit::MaxGeometryTotalOutputComponents; devices without a capability the site computes; devices without a capability the site computes (`vec![Capability::Feature(lacks)]`); every device (not implemented) | `ours` | 6: `crates/metal2vulkan/src/lower/stage_io/plan.rs (region_viewport, 2 sites)`, `crates/metal2vulkan/src/pipeline/link/geometry.rs (check_limits)` (+1) | `rare`: rasterization rate maps | | `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism); every device (not implemented) | `ours` | 20: `crates/metal2vulkan/src/bind/replay.rs (preprocess)`, `crates/metal2vulkan/src/bind/replay.rs (replay_preprocess_module)` (+13) | `rare`: indirect command buffers encoded by a kernel | | `VulkanVersion` | The device's Vulkan version is below the 1.2 floor | devices without ApiVersion::V1_2 | `device` | 2: `crates/metal2vulkan/src/ash_interop/query.rs (query)`, `crates/metal2vulkan/src/device/derive.rs (with_deviations)` | `none`: a device below Vulkan 1.2 | | `Constant` | A constants-block record LLVM defines that the typed model has no form for (a block address, a `select` and the other constant expressions of... | - | `-` | via a helper: 3: `crates/metal2vulkan-air/src/bitcode/constants.rs (record, 2 sites)`, `crates/metal2vulkan/src/error/mod.rs (from)` | `none`: LLVM constant forms AIR does not emit | @@ -655,7 +655,7 @@ Each refusal's sites, with the function that builds it. - `feature::Imageblocks`: `crates/metal2vulkan/src/lower/access/imageblock.rs (imageblocks)`; `crates/metal2vulkan/src/lower/access/mod.rs (select_param)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (not_implemented)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (plan_tests, 2 sites)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (reach)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (require)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select)`; `crates/metal2vulkan/src/lower/texture/slice.rs (imageblocks)`; `crates/metal2vulkan/src/pipeline/link/imageblock.rs (fragment_imageblock)` - `feature::RayTracing`: `crates/metal2vulkan/src/bind/acceleration.rs (instance_record, 2 sites)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (instance_count)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (intersect, 5 sites)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (primitive_data_read)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (select_param)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (slot_of)`; `crates/metal2vulkan/src/lower/select.rs (route_air)` - `feature::Tensors`: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs (refuse)`; `crates/metal2vulkan/src/lower/select.rs (route_air)` -- `feature::RasterizationRateMap`: `crates/metal2vulkan/src/lower/fragment/mod.rs (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (region_viewport, 2 sites)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs (check_limits)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs (fan_plan, 3 sites)` +- `feature::RasterizationRateMap`: `crates/metal2vulkan/src/lower/stage_io/plan.rs (region_viewport, 2 sites)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs (check_limits)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs (fan_plan, 3 sites)` - `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/flat.rs (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs (needs, 2 sites)`; `crates/metal2vulkan/src/lower/access/encode.rs (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs (plan_replay, 3 sites)`; `crates/metal2vulkan/src/lower/mesh/mod.rs (plan_partial_groups)`; `crates/metal2vulkan/src/lower/select.rs (finish, 2 sites)`; `crates/metal2vulkan/src/lower/simd/divergent.rs (barriers)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)`; `crates/metal2vulkan/src/pipeline/compile.rs (plan_one, 2 sites)` - `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs (query)`; `crates/metal2vulkan/src/device/derive.rs (with_deviations)` - `feature::Constant`: `crates/metal2vulkan-air/src/bitcode/constants.rs (record, 2 sites)`; `crates/metal2vulkan/src/error/mod.rs (from)`