diff --git a/AGENTS.md b/AGENTS.md index 3bea5fbbe..1592adc3e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -97,16 +97,18 @@ order, and a lower one never overrides a higher one. is Load, a counted copy in at its begin; those copies and that image's memory are recorded as a known gap), texture buffer formats (ruled 12-02; for each format, does the device serve it natively for every access a texture buffer makes, as a uniform texel buffer, as a storage texel - buffer, and as a storage write without a format? A device that does makes a texture buffer of - it the format's own view; where any of the three is missing, that format's texture buffer is - held as words, an `R32_UINT` view whose texels shaders convert, one answer per format per - device; on a device that holds any format so, a stage that reaches a texture buffer declares a - stage constant, false by default, under which every word arm is dead code at pipeline creation, - and each of its `VkPipeline`s has a words twin specialized with it true, made in the same make, - which a draw or dispatch runs where a texture buffer held as words is bound at a slot its stage - reaches or, for a stage that reaches one through a handle, while one lives on the device; the - twins' second compile and memory, and the words' cost, 7.3 times the own view's GPU time for an - `R8Unorm` texture buffer written on an RTX 3090, are recorded as a known gap), and Shared + buffer, and as a storage write without a format, and, for a texture buffer made with both + shader read and shader write usage, as a storage read without a format? A device that does + makes a texture buffer of it the format's own view; where any of those is missing, that + format's texture buffer of that usage is held as words, an `R32_UINT` view whose texels shaders + convert, one answer per format and usage per device; on a device that holds any format so, a + stage that reaches a texture buffer declares a stage constant, false by default, under which + every word arm is dead code at pipeline creation, and each of its `VkPipeline`s has a words twin + specialized with it true, made in the same make, which a draw or dispatch runs where a texture + buffer held as words is bound at a slot its stage reaches or, for a stage that reaches one + through a handle, while one lives on the device; the twins' second compile and memory, and the + words' cost, 7.3 times the own view's GPU time for an `R8Unorm` texture buffer written on an + RTX 3090, are recorded as a known gap), and Shared memory's host coherence (decided by the host-coherent flag of the memory type Shared takes, the first host-visible, host-cached type a buffer can use, a host-coherent one first: a device whose type has it makes no flush or invalidate call; on a device whose type is diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 2e2aab552..c3b7f1eef 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -2033,17 +2033,21 @@ made, with no lock, and never rewritten for layouts. its bytes, as Metal's heap does (the heap paragraph above). `offset` is a multiple of `Device::minimum_texture_buffer_alignment(pixel_format)`, `minimumTextureBufferAlignmentForPixelFormat:` (`Refusal::TextureBufferAlignment` otherwise): the device's texel-buffer offset alignment for - the format's texel, the larger of the uniform and the storage texel buffer's (Vulkan 1.3's - `…TexelBufferOffsetAlignmentBytes`, or the texel's bytes where the device's - `…TexelBufferOffsetSingleTexelAlignment` says one texel suffices), at most 256, so it divides - the multiple of 256 every buffer starts at. Metal documents the alignment for the row's bytes + the element of the format's view, the larger of the uniform and the storage texel buffer's + (Vulkan 1.3's `…TexelBufferOffsetAlignmentBytes`, or the element's bytes where the device's + `…TexelBufferOffsetSingleTexelAlignment` says one element suffices), at most 256, so it divides + the multiple of 256 every buffer starts at. Metal's query names no usage: where a texture + buffer of the format made both to be read and to be written is held as words and one made + otherwise is its own view (below), it answers the larger of the two views' alignments. Metal documents the alignment for the row's bytes too; a texture buffer's one row reads no other, so any `bytes_per_row` that covers the row is taken (`Refusal::BufferTextureLayout` below it, or for texels past the buffer). The view is of a - buffer of both usages, so its format takes both. One answer per format per device decides its - form (`metal::format::texel_buffer_form`): where the device holds the format directly, of one - colour texel an element, as a uniform texel buffer, a storage texel buffer and a storage texel - buffer written without a format, the view is of the format's own Vulkan format. Where it lacks - any of the three and the format has a word layout, 39 formats (docs/RESOURCE-ID.md, the texture + buffer of both usages, so its format takes both. One answer per format and usage per device + decides its form (`metal::format::texel_buffer_form`): where the device holds the format + directly, of one colour texel an element, as a uniform texel buffer, a storage texel buffer and + a storage texel buffer written without a format, and, for a texture buffer made both to be read + and to be written (`MTLTextureUsageShaderRead` with `MTLTextureUsageShaderWrite`, or + `MTLTextureUsageUnknown`), as a storage texel buffer read without a format, the view is of the + format's own Vulkan format. Where it lacks any of those and the format has a word layout, 39 formats (docs/RESOURCE-ID.md, the texture buffer word), the texture buffer is held as words: the view is of `R32_UINT` over the same bytes, its last word ending inside the buffer's block past the last texel, and shaders convert each texel themselves; a texel of one or two bytes shares its word with its neighbours, and a @@ -2060,7 +2064,9 @@ made, with no lock, and never rewritten for layouts. or dispatch runs the plain pipeline. A format without a word layout (those Vulkan requires as a storage texel buffer) is its own view where the device holds it for the first two, and `Gap::TextureFormat` otherwise. The resource ID's word is the same on every device either way: it carries the - format's code wherever the format has a word layout, and the shader holds the device's answer. + format's code wherever the format has a word layout, and whether the texture buffer was made + both to be read and to be written (bit 11), and the shader holds the device's answers, testing + that bit only where they differ for some format. A width whose view's elements pass `maxTexelBufferElements` is `Limit::TextureSize`. Its view is the element of the uniform texel-buffer array at its index where shaders read it, and of the storage one where they write it (the known gaps say where a @@ -2326,10 +2332,10 @@ made, with no lock, and never rewritten for layouts. two device-scope atomics on its word. An `R8Unorm` texture buffer of 2^24 texels written one texel a thread took 7.3 times the GPU time of the format's own view on an RTX 3090 (p50 658 us against 90.3 us; harness row `texel_buffer_r8_write`, job m3-max-80580). A device holds a format - so only where it lacks the format's own view for one of a texture buffer's accesses; - `metal::format::texel_buffer_form` says which formats a device's profile holds so. On such a - device each pipeline of a function that reaches a texture buffer is made twice, its words twin - beside it, in the same make: a second driver compile and a second `VkPipeline` held while the + so only where it lacks the format's own view for one of the accesses a texture buffer of its + usage makes; `metal::format::texel_buffer_form` says, for each format and usage, which a + device's profile holds so. On such a device each pipeline of a function that reaches a texture + buffer is made twice, its words twin beside it, in the same make: a second driver compile and a second `VkPipeline` held while the first is. The twin compiles longer than the plain pipeline, whose word arms the driver folds away: a program that binds a texture buffer pays it at each such state's make. On lavapipe (llvmpipe, job m3-max-80997) a kernel state of the fixture `tb_word_formats` spent 16.9 to @@ -2449,28 +2455,31 @@ made, with no lock, and never rewritten for layouts. of a format without one (those Vulkan requires as a storage texel buffer) that a function writes or reads through `access::read_write` is refused at that draw or dispatch, but at a slot a texture atomic updates, and one it reads through `access::read` runs. On any device whose - buffer features lack `VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT` for a format held as - its own view, a read of a texture buffer of that format through `access::read_write` at a slot - is refused at the draw or dispatch alike, a format with a word layout held so (which takes the - write bit) among them. No further form is built for these; that changes on a second device + buffer features lack `VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT` for a format without + a word layout, a read of a texture buffer of that format through `access::read_write` at a slot + is refused at the draw or dispatch alike. A format with a word layout whose own view lacks that + bit is held as words for a texture buffer made both to be read and to be written (below), so + its read through `access::read_write` runs; one made to be read or written alone, which Metal + does not let a function reach through `access::read_write`, keeps its own view and that refusal. + No further form is built for these; that changes on a second device above the floor whose formats lack those buffer features, or on a guest's walk that meets the refusal on any device. -- ANV on an Intel Iris Xe Graphics (RPL-P) holds `BGRA8Unorm`, `B5G6R5Unorm`, `BGR5A1Unorm` and - `BGR10A2Unorm` as their own views: their Vulkan formats' buffer features take a uniform texel - buffer, a storage texel buffer and `VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT`, the - three uses `metal::format::texel_buffer_form` asks. They lack - `VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT`, the read without a format on the format's - own view, so there a draw or dispatch whose function reads a texture buffer of one of them through - `access::read_write` at a slot is `Gap::StorageElement` (case `ReadWithoutFormat`; jobs - m3-max-81883 and m3-max-82116). Its committed profile (`intel-irisxe-rplp-anv`) answers the same - for `RG11B10Float`, `RGB10A2Unorm` and `RGB10A2Uint`, and so do `intel-irisxe-anv` and - `intel-uhd770-rpls-anv` for all seven (job m3-max-82025). Holding those formats as words would - serve that read and slows every other: on that Iris Xe (ANV, Mesa 26.2.6) the harness rows - `texel_buffer_bgra8_read` and `texel_buffer_b5g6r5_read` take a GPU p50 of 11857.1 us and 12133.8 - us as words against 9007.0 us and 9215.2 us as their own views, 31.6% and 31.7% more (the median - of 8 rounds of 500 runs each, the two forms' builds alternating, the own views' build against - itself within 0.1%; job m3-max-82136). No further form is built for this; that changes on a - guest's run or stream that meets this refusal. +- ANV on an Intel Iris Xe Graphics (RPL-P) serves `BGRA8Unorm`, `B5G6R5Unorm`, `BGR5A1Unorm` and + `BGR10A2Unorm` in their own views' buffer features as a uniform texel buffer, a storage texel + buffer and `VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT`, but lacks + `VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT` for them (jobs m3-max-81883 and + m3-max-82116), and its committed profile (`intel-irisxe-rplp-anv`) answers the same for + `RG11B10Float`, `RGB10A2Unorm` and `RGB10A2Uint`, as do `intel-irisxe-anv` and + `intel-uhd770-rpls-anv` for all seven (job m3-max-82025). There a texture buffer of one of the + seven made both to be read and to be written (or with unknown usage) is held as words, which a + function reads through `access::read_write` at a slot with no format's bit, and one made to be + read or written alone keeps its own view (`metal::format::texel_buffer_form` of its format and + usage). A texture buffer made to be read and written pays the words' cost on every access, read + and write alike: on that Iris Xe (ANV, Mesa 26.2.6) the harness rows `texel_buffer_bgra8_read` + and `texel_buffer_b5g6r5_read` take a GPU p50 of 11857.1 us and 12133.8 us as words against + 9007.0 us and 9215.2 us as their own views, 31.6% and 31.7% more (the median of 8 rounds of 500 + runs each, the two forms' builds alternating, the own views' build against itself within 0.1%; + job m3-max-82136). - An upload into a 32-bit float depth (`Depth32Float`, or the depth of `Depth32Float_Stencil8`) by `replace_region`, `upload_region` or a blit's `copy_from_buffer` is the device's copy into the depth aspect, on every device, under the static note `PrecisionNote::RestrictedDepthUpload` diff --git a/crates/metal2vulkan-runtime/src/counters.rs b/crates/metal2vulkan-runtime/src/counters.rs index 74c21d8f0..0b65d2dfb 100644 --- a/crates/metal2vulkan-runtime/src/counters.rs +++ b/crates/metal2vulkan-runtime/src/counters.rs @@ -3837,9 +3837,10 @@ pub struct Gauges { /// [`kernel_variants`](Self::kernel_variants)' kernels' variants and in a render content's /// pipelines. Only a device that holds some format's texture buffer as words makes them. pub word_pipelines: u64, - /// Texture buffers held as words (`metal2vulkan::metal::format::texel_buffer_form`): while - /// any lives, a draw or dispatch of a stage that reaches a texture buffer through a handle runs - /// its words twin ([`word_pipelines`](Self::word_pipelines)). + /// Texture buffers held as words (`metal2vulkan::metal::format::texel_buffer_form` of each + /// one's format and usage): while any lives, a draw or dispatch of a stage that reaches a + /// texture buffer through a handle runs its words twin + /// ([`word_pipelines`](Self::word_pipelines)). pub word_texture_buffers: u64, /// Entries of the device's map of compiled contents, compute and render, which holds at most /// 1,024 and forgets the least recently used past them. diff --git a/crates/metal2vulkan-runtime/src/tests/texture_buffer_words.rs b/crates/metal2vulkan-runtime/src/tests/texture_buffer_words.rs index cd0d5c281..8e4fa580e 100644 --- a/crates/metal2vulkan-runtime/src/tests/texture_buffer_words.rs +++ b/crates/metal2vulkan-runtime/src/tests/texture_buffer_words.rs @@ -512,12 +512,13 @@ mod on_device { (!agree).then(|| format!("read {got:?}, the CPU's {want:?}")) } - /// How `case`'s texels decode on `device`: where it holds the format's texture buffers as the - /// format's own view, a normalized format's fields are the device's conversion - /// ([`Decode::Device`]); else, words decoding as the CPU does, the case's own. - fn decode_on(device: &Device, case: &Case) -> Decode { + /// How `case`'s texels decode on `device` through a texture buffer made with `usage`: where + /// it holds such a texture buffer as the format's own view, a normalized format's fields are + /// the device's conversion ([`Decode::Device`]); else, words decoding as the CPU does, the + /// case's own. + fn decode_on(device: &Device, case: &Case, usage: TextureUsage) -> Decode { let own = matches!( - formats::texel_buffer_form(case.format, device.translator().profile()), + formats::texel_buffer_form(case.format, usage, device.translator().profile()), Some(formats::TexelBufferForm::View(_)) ); let layout = formats::texel_words(case.format).map(|w| w.layout); @@ -534,14 +535,27 @@ mod on_device { } } - /// Whether `device` holds `format`'s texture buffers as the format's own view and that view's - /// format lacks a storage texel buffer read without a format - /// (`VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT`), which a read-written texture + /// The usage of a texture buffer made both to be read and to be written. + const BOTH: TextureUsage = TextureUsage::SHADER_READ.union(TextureUsage::SHADER_WRITE); + + /// Whether `device` holds a texture buffer of `format` made with `usage` as words. + fn held_as_words(device: &Device, format: PixelFormat, usage: TextureUsage) -> bool { + let profile = device.translator().profile(); + matches!( + formats::texel_buffer_form(format, usage, profile), + Some(formats::TexelBufferForm::Words(_)) + ) + } + + /// Whether `device` holds `format`'s texture buffers made both to be read and to be written as + /// the format's own view and that view's format lacks a storage texel buffer read without a + /// format (`VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT`), which a read-written texture /// buffer (`access::read_write`) reads through: the runtime refuses that access - /// ([`read_write_gap`]), the runtime README's known gap. + /// ([`read_write_gap`]), the runtime README's known gap. Never for a format with a word + /// layout, which such a device holds as words for that usage. fn reads_none_without_format(device: &Device, format: PixelFormat) -> bool { let profile = device.translator().profile(); - match formats::texel_buffer_form(format, profile) { + match formats::texel_buffer_form(format, BOTH, profile) { Some(formats::TexelBufferForm::View(view)) => { !profile.supports_format(view, FormatUsage::StorageTexelBufferReadWithoutFormat) } @@ -620,10 +634,10 @@ mod on_device { }; let counters = &device.core().counters; let twins = counters.twin_runs(); - let held = matches!( - formats::texel_buffer_form(case.format, device.translator().profile()), - Some(formats::TexelBufferForm::Words(_)) - ); + // Read alone at slot 0, written alone at slot 1, read and written at slot 2. + let held = held_as_words(device, case.format, TextureUsage::SHADER_READ) + || held_as_words(device, case.format, TextureUsage::SHADER_WRITE) + || held_as_words(device, case.format, BOTH); let out_of_bounds = [0.0, 0.0, 0.0, if case.alpha { 0.0 } else { 1.0 }]; // The read-written one (slot 2) is refused where the device's own view of the format reads // none without a format (the runtime README's known gap); the handles' kernel below reads @@ -645,8 +659,8 @@ mod on_device { Ok(()) => {} } if !refused { - // The words twin runs where the device holds the format as words, the plain pipeline - // elsewhere. + // The words twin runs where the device holds a bound texture buffer as words, the + // plain pipeline elsewhere. let ran = counters.twin_runs() - twins; if ran != u64::from(held) { wrong.push(format!( @@ -662,15 +676,15 @@ mod on_device { ), false => (out_of_bounds, out_of_bounds), }; - let decode = if t < WIDTH { - decode_on(device, case) - } else { - Decode::Exact + let decode = |usage| match t < WIDTH { + true => decode_on(device, case, usage), + false => Decode::Exact, }; - if let Some(d) = differs(&reads[4 * t..4 * t + 4], want, decode) { + let read = decode(TextureUsage::SHADER_READ); + if let Some(d) = differs(&reads[4 * t..4 * t + 4], want, read) { wrong.push(format!("texel {t} of the read one: {d}")); } - if let Some(d) = differs(&rw_reads[4 * t..4 * t + 4], rw_want, decode) { + if let Some(d) = differs(&rw_reads[4 * t..4 * t + 4], rw_want, decode(BOTH)) { wrong.push(format!("texel {t} of the read-written one: {d}")); } } @@ -749,7 +763,7 @@ mod on_device { let (want, decode) = match t < WIDTH { true => ( (case.value)(&texel(&case.texels, t)), - decode_on(device, case), + decode_on(device, case, TextureUsage::SHADER_READ), ), false => (out_of_bounds, Decode::Exact), }; @@ -797,11 +811,17 @@ mod on_device { let mut failed = Vec::new(); let profile = device.translator().profile(); for case in cases() { - let form = match formats::texel_buffer_form(case.format, profile) { + let form_of = |usage| match formats::texel_buffer_form(case.format, usage, profile) + { Some(formats::TexelBufferForm::Words(_)) => "words", Some(formats::TexelBufferForm::View(_)) => "own view", None => "refused", }; + let (alone, both) = (form_of(TextureUsage::SHADER_READ), form_of(BOTH)); + let form = match alone == both { + true => alone.to_owned(), + false => format!("{alone}; made to be read and written, {both}"), + }; let wrong = run(&device, &library, &case); let refused = reads_none_without_format(&device, case.format); match wrong.is_empty() { @@ -875,11 +895,10 @@ mod on_device { let made = data.new_texture(&d, Some(index), at, 256); made.map(|t| (t, counters.gauges().word_texture_buffers > before)) }; - let both = TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE; let made = ( - make(PLACES[0], 1, both), - make(PLACES[1], 2, both), - make(PLACES[2], 3, both), + make(PLACES[0], 1, BOTH), + make(PLACES[1], 2, BOTH), + make(PLACES[2], 3, BOTH), ); let ((src, src_words), (dst, dst_words), (rw, rw_words)) = match made { (Ok(src), Ok(dst), Ok(rw)) => (src, dst, rw), @@ -888,6 +907,12 @@ mod on_device { return vec![format!("not made: {why:?}")]; } }; + // Each is held as the form the device answers for its format and usage. + let held = held_as_words(device, case.format, BOTH); + if [src_words, dst_words, rw_words] != [held; 3] { + let made = [src_words, dst_words, rw_words]; + wrong.push(format!("held as words {made:?}, the form's answer {held}")); + } let function = library.function("tb_word_formats").expect("the kernel"); let descriptor = ComputePipelineDescriptor::new(StageSource::Function( FunctionDescriptor::new(function), @@ -897,8 +922,8 @@ mod on_device { Err(error) => return vec![format!("no state: {error}")], }; let out_of_bounds = [0.0, 0.0, 0.0, if case.alpha { 0.0 } else { 1.0 }]; - let decode = |t: usize| match t < WIDTH { - true => decode_on(device, case), + let decode = |t: usize, usage| match t < WIDTH { + true => decode_on(device, case, usage), false => Decode::Exact, }; // Read at slot 0, written at slot 1, read and written at slot 2, each made to be both. @@ -923,10 +948,10 @@ mod on_device { ), false => (out_of_bounds, out_of_bounds), }; - if let Some(d) = differs(&got[4 * t..4 * t + 4], want, decode(t)) { + if let Some(d) = differs(&got[4 * t..4 * t + 4], want, decode(t, BOTH)) { wrong.push(format!("texel {t} read at slot 0: {d}")); } - if let Some(d) = differs(&rw_got[4 * t..4 * t + 4], rw_want, decode(t)) { + if let Some(d) = differs(&rw_got[4 * t..4 * t + 4], rw_want, decode(t, BOTH)) { wrong.push(format!("texel {t} read at slot 2: {d}")); } } @@ -956,6 +981,16 @@ mod on_device { return wrong; } }; + let answers = [ + held_as_words(device, case.format, TextureUsage::SHADER_READ), + held_as_words(device, case.format, TextureUsage::SHADER_WRITE), + ]; + if [read_words, write_words] != answers { + let made = [read_words, write_words]; + wrong.push(format!( + "alone held as words {made:?}, the form's answers {answers:?}" + )); + } set_bytes(&reads, 0, &[0; 256]); set_bytes(&rw_reads, 0, &[0; 256]); let twins = counters.twin_runs(); @@ -977,10 +1012,11 @@ mod on_device { true => (case.value)(&texel(&case.texels, t)), false => out_of_bounds, }; - if let Some(d) = differs(&got[4 * t..4 * t + 4], want, decode(t)) { + let read = decode(t, TextureUsage::SHADER_READ); + if let Some(d) = differs(&got[4 * t..4 * t + 4], want, read) { wrong.push(format!("texel {t} read by one made to be read alone: {d}")); } - if let Some(d) = differs(&rw_got[4 * t..4 * t + 4], want, decode(t)) { + if let Some(d) = differs(&rw_got[4 * t..4 * t + 4], want, decode(t, BOTH)) { wrong.push(format!("texel {t} read again at slot 2: {d}")); } } @@ -1188,7 +1224,7 @@ mod on_device { .enumerate() .map(|(k, format)| { let words = matches!( - formats::texel_buffer_form(format, profile), + formats::texel_buffer_form(format, TextureUsage::SHADER_READ, profile), Some(formats::TexelBufferForm::Words(_)) ); let form = if words { "words" } else { "own view" }; @@ -1331,10 +1367,7 @@ mod on_device { let positions = buffers.of(&device, &floats(&[-1.0, -1.0, 3.0, -1.0, -1.0, 3.0])); let colors = buffers.of(&device, &floats(&[0.0; 12])); for (index, (format, texels)) in (1..).zip(&cases) { - let held = matches!( - formats::texel_buffer_form(*format, device.translator().profile()), - Some(formats::TexelBufferForm::Words(_)) - ); + let held = held_as_words(&device, *format, TextureUsage::SHADER_READ); let data = buffers.of(&device, texels); let mut td = TextureDescriptor::new(TextureType::TextureBuffer, *format, 5, 1); td.usage = TextureUsage::SHADER_READ; diff --git a/crates/metal2vulkan-runtime/src/texture.rs b/crates/metal2vulkan-runtime/src/texture.rs index e1de74f92..d582004a5 100644 --- a/crates/metal2vulkan-runtime/src/texture.rs +++ b/crates/metal2vulkan-runtime/src/texture.rs @@ -4493,7 +4493,7 @@ impl Transfer { impl TextureInner { /// Whether it is a texture buffer held as words - /// (`metal2vulkan::metal::format::texel_buffer_form`), for which a draw or dispatch that binds + /// (`metal2vulkan::metal::format::texel_buffer_form` of its format and usage), for which a draw or dispatch that binds /// it where a function reaches it runs its words twin. pub(crate) fn held_as_words(&self) -> bool { matches!(&self.body, Body::Texels(texels) if texels.words) @@ -7240,23 +7240,25 @@ struct TexelForm { reads: bool, } -/// What a texture buffer of `pf` holds on the device of `core`, as -/// `metal::format::texel_buffer_form` decides for the device: the format's own view, of one color -/// texel an element, which the device holds directly as a uniform texel buffer, a storage texel -/// buffer and a storage texel buffer written without a format, as its one view is of a buffer of -/// both usages and its format takes both (`VUID-VkBufferViewCreateInfo-format-08778`, `-08779`); -/// else words, a view of `R32_UINT`, which Vulkan requires as both texel buffers, whose texels -/// shaders convert, and whose storage element is declared with that format, so neither its writes -/// nor its reads ask a format's bits for a storage texel buffer without a format; else, for a -/// format with no word layout, its own view of the two texel buffers alone, whose write without a -/// format a dispatch then refuses ([`TexelForm`]'s `writes`). +/// What a texture buffer of `pf` made with `usage` holds on the device of `core`, as +/// `metal::format::texel_buffer_form` decides for the device, one answer per format and usage: the +/// format's own view, of one color texel an element, which the device holds directly as a uniform +/// texel buffer, a storage texel buffer and a storage texel buffer written without a format, and, +/// made both to be read and to be written (`metal::format::texel_buffer_read_write`), read +/// without a format, as its one view is of a buffer of both usages and its format takes both +/// (`VUID-VkBufferViewCreateInfo-format-08778`, `-08779`); else words, a view of `R32_UINT`, which +/// Vulkan requires as both texel buffers, whose texels shaders convert, and whose storage element +/// is declared with that format, so neither its writes nor its reads ask a format's bits for a +/// storage texel buffer without a format; else, for a format with no word layout, its own view of +/// the two texel buffers alone, whose write or read without a format a dispatch then refuses +/// where the format lacks it ([`TexelForm`]'s `writes` and `reads`). /// /// Err: [`Gap::TextureFormat`] for any other format. -fn texel_form(core: &Core, pf: PixelFormat) -> Result { +fn texel_form(core: &Core, pf: PixelFormat, usage: TextureUsage) -> Result { let gap = || Error::Unsupported(Gap::TextureFormat { pixel_format: pf }); TextureWord::of(pf, TextureSwizzleChannels::DEFAULT).ok_or_else(gap)?; let profile = core.translator.profile(); - match formats::texel_buffer_form(pf, profile).ok_or_else(gap)? { + match formats::texel_buffer_form(pf, usage, profile).ok_or_else(gap)? { formats::TexelBufferForm::Words(words) => Ok(TexelForm { format: words.element_format().into(), bytes: words.bytes, @@ -7357,10 +7359,13 @@ fn texel_width(core: &Core, d: &TextureDescriptor, form: &TexelForm) -> Result Result { let core = self.core(); - let form = texel_form(core, pixel_format)?; - Ok(core.texels.alignment(u64::from(form.element))) + // The larger of the format's two forms' alignments: a texture buffer made both to be read + // and to be written may be words where one made to be read or written alone is the + // format's own view. + let usages = [ + TextureUsage::SHADER_READ, + TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE, + ]; + let mut alignment = 0; + for usage in usages { + let form = texel_form(core, pixel_format, usage)?; + alignment = alignment.max(core.texels.alignment(u64::from(form.element))); + } + Ok(alignment) } /// [`Device::heap_texture_size_and_align`] of a texture buffer: its texels' bytes, the width @@ -7388,7 +7404,7 @@ impl Device { fn heap_texels_fit(&self, d: &TextureDescriptor) -> Result { let core = self.core(); texel_shape(d)?; - let form = texel_form(core, d.pixel_format)?; + let form = texel_form(core, d.pixel_format, d.usage)?; texel_width(core, d, &form)?; let texel = u64::from(form.bytes); Ok(SizeAndAlign { @@ -7460,7 +7476,7 @@ impl Device { Reach::Index(index) => index, Reach::Views => None, }; - let form = texel_form(core, d.pixel_format)?; + let form = texel_form(core, d.pixel_format, d.usage)?; let alignment = core.texels.alignment(u64::from(form.element)); if !offset.is_multiple_of(alignment) { return refused(Refusal::TextureBufferAlignment { @@ -7571,7 +7587,7 @@ impl Device { block: [1, 1], }), index, - word: TextureWord::of_texture_buffer(d.pixel_format, d.width) + word: TextureWord::of_texture_buffer(d.pixel_format, d.width, d.usage) .ok_or(Error::Unsupported(Gap::TextureFormat { pixel_format: d.pixel_format, }))? diff --git a/crates/metal2vulkan-validation/runtime-sources.sha256 b/crates/metal2vulkan-validation/runtime-sources.sha256 index f77729118..de279a086 100644 --- a/crates/metal2vulkan-validation/runtime-sources.sha256 +++ b/crates/metal2vulkan-validation/runtime-sources.sha256 @@ -1 +1 @@ -4361761cd1b7abfc1100a2b80a0cdf66a5324cf12567f8ccee91fa07eafce585 +a92fe0a8051bc835e111d4c69f56892c6035dee3a96cb2f9ab75d1b0b3002002 diff --git a/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs b/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs index 0802c4b71..3eccd45c8 100644 --- a/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs +++ b/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs @@ -3213,9 +3213,11 @@ impl Backend for NewRuntime { Object::Texture(texture) => { let descriptor = texture.descriptor(); let word = match descriptor.texture_type { - rt::TextureType::TextureBuffer => { - TextureWord::of_texture_buffer(descriptor.pixel_format, descriptor.width) - } + rt::TextureType::TextureBuffer => TextureWord::of_texture_buffer( + descriptor.pixel_format, + descriptor.width, + descriptor.usage, + ), _ => TextureWord::of(descriptor.pixel_format, descriptor.swizzle), }; word.map(|word| word.0) diff --git a/crates/metal2vulkan-validation/src/replay/rt_replay.rs b/crates/metal2vulkan-validation/src/replay/rt_replay.rs index 5a9671620..6493a2803 100644 --- a/crates/metal2vulkan-validation/src/replay/rt_replay.rs +++ b/crates/metal2vulkan-validation/src/replay/rt_replay.rs @@ -145,18 +145,18 @@ //! (`external_acquires`, `external_releases`) are what the runtime's documented contract gives //! for the frame's records; where the device exports no such handle, the refusal is counted. //! - Texture buffers over a Shared buffer (`newTextureWithDescriptor:offset:bytesPerRow:` of a -//! texture buffer's descriptor) of five formats, each read, written, and read then written by the -//! owned fixture `tb_word_formats`, play with the IDs the stream recorded (each its index and -//! `TextureWord::of_texture_buffer`, which is the same on every device), no `id` line, and the -//! texels and values the CPU decodes, whichever form the device holds each format in -//! (`metal::format::texel_buffer_form`: its own view or words), which the test prints. Words -//! decode to the CPU's values bit for bit; an own view's values are the device's own conversion -//! of each code, `PrecisionNote::DeviceTexelConversion`, which the fixture's state records, within -//! that note's recorded bound of the CPU's (lavapipe multiplies by the reciprocal: one ulp). -//! Where the device holds a format as its own view and that view reads none without a format -//! (the Iris Xe's `BGRA8Unorm` and `B5G6R5Unorm`), the play ends at the dispatch in the runtime's -//! refusal of the read-written one by name (`Gap::StorageElement`, `ReadWithoutFormat`, the -//! runtime README's known gap), with no `id` line before it. +//! texture buffer's descriptor) of five formats, one made to be read, one to be written and one +//! to be both, each read, written, and read then written by the owned fixture `tb_word_formats`, +//! play with the IDs the stream recorded (each its index and `TextureWord::of_texture_buffer` of +//! its format, width and usage, which is the same on every device), no `id` line, and the texels +//! and values the CPU decodes, whichever form the device holds each in +//! (`metal::format::texel_buffer_form` of its format and usage: its own view or words), which the +//! test prints. Words decode to the CPU's values bit for bit; an own view's values are the +//! device's own conversion of each code, `PrecisionNote::DeviceTexelConversion`, which the +//! fixture's state records, within that note's recorded bound of the CPU's (lavapipe multiplies +//! by the reciprocal: one ulp). The texture buffer made to be read and written is words wherever +//! its format's own view reads none without a format (the Iris Xe's `BGRA8Unorm` and +//! `B5G6R5Unorm`), so each format plays on every device. //! //! The runtime's device is opened behind the hang tripwire, as every device open in this crate //! is (`gpu.rs`), its kernels kept in a cache the test owns ([`ScratchCache`]). Every device a test @@ -174,9 +174,9 @@ use crate::replay::{ StreamReader, StreamWriter, Value, HELD, WAIT_COMPLETED, }; use crate::ScratchDir; -use metal2vulkan::device::FormatUsage; use metal2vulkan::metal::format::{texel_buffer_form, TexelBufferForm}; use metal2vulkan::metal::resource_word::TextureWord; +use metal2vulkan::metal::TextureUsage; use metal2vulkan_devtools::metallib::{metallib, wrap, MtlbFunction}; use sha2::{Digest, Sha256}; use std::collections::{BTreeSet, HashSet}; @@ -2385,6 +2385,14 @@ const TB_THREADS: usize = 8; const TB_SENTINEL: u8 = 0x5a; /// Where the read, the written and the read-written texture buffers lie in the data buffer. const TB_PLACES: [usize; 3] = [1024, 2048, 3072]; +/// The read-written texture buffer's usage: both, fixed at its making. +const TB_READ_WRITE: TextureUsage = TextureUsage::SHADER_READ.union(TextureUsage::SHADER_WRITE); +/// The usages the read, the written and the read-written texture buffers are made with. +const TB_USAGES: [TextureUsage; 3] = [ + TextureUsage::SHADER_READ, + TextureUsage::SHADER_WRITE, + TB_READ_WRITE, +]; /// The five texels of `case`'s source: byte `i` of the texels is `37 i + 11`. fn tb_texels(case: &TexelBufferCase) -> Vec { @@ -2444,14 +2452,14 @@ fn texture_buffer_stream(dir: &ScratchDir, case: &TexelBufferCase) -> PathBuf { let args = [Value::Bytes(data), Value::Uint(len), Value::Uint(0)]; w.call("newBufferWithBytes:length:options:", 1, id, &args, &[])?; } - for (i, (at, usage)) in TB_PLACES.into_iter().zip([1, 2, 3]).enumerate() { + for (i, (at, usage)) in TB_PLACES.into_iter().zip(TB_USAGES).enumerate() { let id = 20 + i as u64; let descriptor = uints(&[ ("textureType", 9), ("pixelFormat", u64::from(case.format.as_raw())), ("width", TB_WIDTH as u64), ("height", 1), - ("usage", usage), + ("usage", u64::from(usage.as_raw())), ("storageMode", 0), ]); let made = 40 + i as u64; @@ -2468,7 +2476,7 @@ fn texture_buffer_stream(dir: &ScratchDir, case: &TexelBufferCase) -> PathBuf { &args, &[], )?; - let word = TextureWord::of_texture_buffer(case.format, TB_WIDTH as u32) + let word = TextureWord::of_texture_buffer(case.format, TB_WIDTH as u32, usage) .expect("a texture buffer's word") .0; let index = 1 + i as u64; @@ -2545,61 +2553,18 @@ fn texture_buffers_play_with_their_recorded_ids_and_the_cpu_s_texels() { let cache = ScratchCache::new().unwrap(); let device = rt_device(&cache); let profile = device.translator().profile(); - let form = match texel_buffer_form(case.format, profile) { + // The read-only and write-only textures hold the format in one form, the read-written + // one (made with both usages) in its own: words wherever its own view reads none without + // a format (`texel_buffer_form`). + let form_of = |usage| match texel_buffer_form(case.format, usage, profile) { Some(TexelBufferForm::Words(_)) => "words", Some(TexelBufferForm::View(_)) => "own view", None => "refused", }; + let read_form = form_of(TextureUsage::SHADER_READ); + let rw_form = form_of(TB_READ_WRITE); + let form = format!("{read_form}, read_write {rw_form}"); let test = format!("texture-buffers-{:?}", case.format); - // Where the device's own view of the format reads none without a format, the runtime - // refuses the read-written one (`access::read_write`) at the dispatch, by name - // (`Gap::StorageElement`, `StorageElementCase::ReadWithoutFormat`): the runtime README's - // known gap. The textures before it play with their recorded IDs all the same. - let reads_none = match texel_buffer_form(case.format, profile) { - Some(TexelBufferForm::View(view)) => { - !profile.supports_format(view, FormatUsage::StorageTexelBufferReadWithoutFormat) - } - _ => false, - }; - if reads_none { - let mut backend = NewRuntime::new(device, gpu::TEST_DEVICE).unwrap(); - let mut reader = StreamReader::open(std::slice::from_ref(&path), None).unwrap(); - let (report, ended) = Player::new(&mut backend).play(&mut reader); - let ids: Vec = (report.lines().iter()) - .filter(|l| l.starts_with("id ")) - .cloned() - .collect(); - let refusal = format!( - "texture slot 2, which a function writes or reads as storage, bound to a {:?} \ - texture with no storage element on this device, or one it cannot read without a \ - format", - case.format - ); - match ended { - Err(PlayError::Runtime { selector, error }) - if ids.is_empty() - && selector == "dispatchThreads:threadsPerThreadgroup:" - && error.starts_with(&refusal) => - { - eprintln!( - "TEXTURE-BUFFERS {:?} ({form}): recorded IDs; the read-written one refused \ - (Gap::StorageElement, ReadWithoutFormat): its own view reads none without \ - a format", - case.format - ); - } - other => { - eprintln!( - "TEXTURE-BUFFERS {:?} ({form}): not the read-written one's refusal: IDs \ - {ids:?}, {other:?}", - case.format - ); - failed.push(case.format); - } - } - drop(cache); - continue; - } let (report, lines, read) = play_on(device, &test, &path, |backend| { [10, 12, 13, 14].map(|object| backend.read(object).unwrap()) }); @@ -2618,7 +2583,7 @@ fn texture_buffers_play_with_their_recorded_ids_and_the_cpu_s_texels() { } // Words decode bit for bit; an own view is the device's conversion of each code // (`PrecisionNote::DeviceTexelConversion`), within its recorded bound. - let agree = |got: [f32; 4], want: [f32; 4]| { + let agree = |form: &str, got: [f32; 4], want: [f32; 4]| { (got.iter().zip(want)).all(|(&g, w)| match form { "words" => g.to_bits() == w.to_bits(), _ => within_texel_conversion(g, w, case.bits), @@ -2632,14 +2597,14 @@ fn texture_buffers_play_with_their_recorded_ids_and_the_cpu_s_texels() { }; for t in 0..TB_WIDTH { let read = (case.value)(tb_texel(&case, &texels, t)); - if !agree(floats(&reads, t), read) { + if !agree(read_form, floats(&reads, t), read) { wrong.push(format!( "read {t}: {:?}, the CPU's {read:?}", floats(&reads, t) )); } let first = (case.value)(tb_texel(&case, &texels, TB_WIDTH - 1 - t)); - if !agree(floats(&rw_reads, t), first) { + if !agree(rw_form, floats(&rw_reads, t), first) { wrong.push(format!( "read_write {t}: {:?}, the CPU's {first:?}", floats(&rw_reads, t) diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index faf95cc47..1751619e0 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -60,7 +60,7 @@ mod tests; /// unchanged version, and its bless records the version. Independent of the crate's version and of /// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no /// history. -pub const SEMANTICS_VERSION: u32 = 2338; +pub const SEMANTICS_VERSION: u32 = 2339; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another @@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 605; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 2557; +pub const RUNTIME_VERSION: u32 = 2558; /// Writes a digest as lowercase hex. pub(crate) fn write_hex(f: &mut fmt::Formatter<'_>, name: &str, hash: &Hash256) -> fmt::Result { diff --git a/crates/metal2vulkan/src/lower/texture/words.rs b/crates/metal2vulkan/src/lower/texture/words.rs index cfa07c518..6c3100ddb 100644 --- a/crates/metal2vulkan/src/lower/texture/words.rs +++ b/crates/metal2vulkan/src/lower/texture/words.rs @@ -2,13 +2,16 @@ //! //! Under the identity domains a texture buffer of a colour format the device does not hold //! directly as a uniform texel buffer, a storage texel buffer and a storage texel buffer written -//! without a format is a view of its bytes as `R32_UINT`. Its +//! without a format, and, for one made both to be read and to be written, read without a format, +//! is a view of its bytes as `R32_UINT`. Its //! resource ID's word carries, on every device, its format's code wherever the format has a word //! layout, its texels per word, whether a texel is two words, and the texels its last word holds -//! past its width (`resource_word::TextureWord::of_texture_buffer`); the module takes the codes its -//! device holds as words from its profile (`metal::format::texel_buffer_word_codes`), and declares -//! nothing of this where there are none. A texture-buffer slot's read, write and width query test -//! the code against those ([`Words`]), under the stage's `SpecKey::TexelBufferWords` ([`gate`]): +//! past its width, and whether it was made both to be read and to be written +//! (`resource_word::TextureWord::of_texture_buffer`); the module takes the codes its device holds +//! as words for each usage from its profile (`metal::format::texel_buffer_word_codes`), and +//! declares nothing of this where there are none. A texture-buffer slot's read, write and width +//! query test the code, and where the two usages' codes differ the usage bit, against those +//! ([`Words`]), under the stage's `SpecKey::TexelBufferWords` ([`gate`]): //! where that is false, as it is by default, the test and every arm of the words are dead code at //! pipeline creation and each access is the texture's own view's alone. Where the device does //! not hold the code as words the access is the texture's own view's, as it is for every other @@ -71,7 +74,7 @@ use crate::lower::select::SelectCx; use crate::memory::leaf::Coherence; use crate::metal::format::{ texel_buffer_word_codes, texel_words, ExtendedRange, FieldKind, TexelField, TexelWords, - WordLayout, WORD_FORMATS, + WordCodes, WordLayout, WORD_FORMATS, }; use crate::metal::resource_word::TextureWord; use crate::pipeline::artifact::PrecisionNote; @@ -132,9 +135,9 @@ pub struct WordsPlan { /// An access is of an argument buffer's texture buffer, whose handle then carries its word's /// low bits ([`HANDLE_WORD`]). pub heap: bool, - /// The codes the profile holds as words: bit `c` for code `c` + /// The codes the profile holds as words, by usage: bit `c` for code `c` /// (`metal::format::texel_buffer_word_codes`). - pub codes: u64, + pub codes: WordCodes, /// Its writes store an `RGB9E5Float` word's mantissas rounded half up (`Write::half_up`: a /// fragment function's, in a pipeline of `textureWriteRoundingMode` 2), else toward zero. pub half_up: bool, @@ -235,7 +238,7 @@ pub(super) fn wrap( return Ok(s); } let codes = texel_buffer_word_codes(cx.profile); - if codes == 0 { + if codes.any() == 0 { return Ok(s); } let (storage, _) = super::image_access(cx, image)?; @@ -279,11 +282,11 @@ pub(super) fn wrap( plan.codes = codes; // The conversions the routine's cases take: an 8-bit sRGB colour's and an extended-range // texel's are the device's. - let srgb = held(codes).any(|w| match w.layout { + let srgb = held(codes.any()).any(|w| match w.layout { WordLayout::Fields { fields, .. } => fields.iter().flatten().any(|f| f.srgb), _ => false, }); - let extended = held(codes).any(|w| matches!(w.layout, WordLayout::Extended(_))); + let extended = held(codes.any()).any(|w| matches!(w.layout, WordLayout::Extended(_))); if let Some(r) = routine { plan.routines.insert(r); match r { @@ -399,7 +402,7 @@ pub(super) fn declare( storage, nonuniform, }; - define_read(mb, (class, plan.codes), array, (coherence, volatile))? + define_read(mb, (class, plan.codes.any()), array, (coherence, volatile))? } Routine::Write { class, nonuniform } => { let Some(g) = d.storage else { continue }; @@ -410,7 +413,7 @@ pub(super) fn declare( }; define_write( mb, - (class, plan.codes, plan.half_up), + (class, plan.codes.any(), plan.half_up), array, (coherence, volatile), )? @@ -575,18 +578,32 @@ pub(crate) fn gate(cx: &EmitCx<'_>, fb: &mut FunctionBuilder<'_>) -> BResult, word: SValue, codes: u64) -> BResult { +/// clears, its bits 2-7 then a border texel's) whose code is held as words for its usage. Where +/// the profile holds the same codes for either usage the word's usage bit +/// (`TextureWord::TEXEL_BUFFER_READ_WRITE`) is not read: the code's bit of those codes, or +/// nothing besides the layout where they are every format's. Else the code's bit of those held +/// for a texture buffer made to be read or written alone, or the usage bit and the code's bit of +/// those held only for one made both to be read and to be written. +fn held_test(fb: &mut FunctionBuilder<'_>, word: SValue, codes: WordCodes) -> BResult { let every = held(u64::MAX).fold(0u64, |all, w| all | 1 << w.code); let layout = layout_test(fb, word)?; - if codes == every { + if codes.alone == codes.read_write && codes.alone == every { return Ok(layout); } let code = code_of(fb, word)?; - let bit = code_in(fb, code, codes)?; + let mut bit = code_in(fb, code, codes.alone)?; + let read_write_alone = codes.read_write & !codes.alone; + if read_write_alone != 0 { + let flag = ku(fb, TextureWord::TEXEL_BUFFER_READ_WRITE)?; + let flag = fb.binary(BinOp::BitwiseAnd, word, flag)?; + let zero = ku(fb, 0)?; + let made = fb.binary(BinOp::INotEqual, flag, zero)?; + let moved = code_in(fb, code, read_write_alone)?; + let moved = fb.binary(BinOp::LogicalAnd, made, moved)?; + bit = fb.binary(BinOp::LogicalOr, bit, moved)?; + } fb.binary(BinOp::LogicalAnd, layout, bit) } diff --git a/crates/metal2vulkan/src/metal/format/mod.rs b/crates/metal2vulkan/src/metal/format/mod.rs index 6a75fc918..3bd40962a 100644 --- a/crates/metal2vulkan/src/metal/format/mod.rs +++ b/crates/metal2vulkan/src/metal/format/mod.rs @@ -40,11 +40,12 @@ mod texel_words; mod word; pub use footprint::{footprint, Footprint}; pub(crate) use packed_codes::packed_codes; -pub(crate) use texel_words::texel_buffer_word_codes; pub use texel_words::{ - required_storage_texel_buffer, texel_buffer_form, texel_buffer_words, texel_words, word_format, - FieldKind, TexelBufferForm, TexelField, TexelWords, WordLayout, WORD_FORMATS, + required_storage_texel_buffer, texel_buffer_form, texel_buffer_read_write, texel_buffer_words, + texel_words, word_format, FieldKind, TexelBufferForm, TexelField, TexelWords, WordLayout, + WORD_FORMATS, }; +pub(crate) use texel_words::{texel_buffer_word_codes, WordCodes}; pub use word::{WordAttachment, WordField}; /// How a Metal pixel format is represented on a device, for a set of usages. diff --git a/crates/metal2vulkan/src/metal/format/texel_words.rs b/crates/metal2vulkan/src/metal/format/texel_words.rs index a200ac06e..f811af294 100644 --- a/crates/metal2vulkan/src/metal/format/texel_words.rs +++ b/crates/metal2vulkan/src/metal/format/texel_words.rs @@ -7,20 +7,24 @@ //! `VK_KHR_maintenance5`, which the floor does not require, a view takes its buffer's usages //! (`VUID-VkBufferViewCreateInfo-format-08778`, `-08779`), so its format must hold both; a shader //! writes it through a storage texel buffer declared without a format, so its format must take -//! that write too. [`texel_buffer_form`] is the one place that decides, for each format on each -//! device: the format's own view where the device holds it directly as a uniform texel buffer, a -//! storage texel buffer and a storage texel buffer written without a format, else words where the +//! that write too, and reads one made both to be read and to be written through that storage +//! texel buffer (`access::read_write`), so its format must take that read too. +//! [`texel_buffer_form`] is the one place that decides, for each format and usage on each device: +//! the format's own view where the device holds it directly as a uniform texel buffer, a storage +//! texel buffer and a storage texel buffer written without a format, and, made both to be read +//! and to be written ([`texel_buffer_read_write`]), read without a format; else words where the //! format has a word layout ([`texel_buffer_words`]), else its own view of the first two, whose -//! writes the runtime refuses. Vulkan requires the first two of few formats +//! writes and reads without a format the runtime refuses where the format lacks them. Vulkan requires the first two of few formats //! (its mandatory format tables: the 8-bit four-channel and the 32-bit formats, and the 16-bit //! four-channel float and integer ones, [`required_storage_texel_buffer`]), which have no word //! layout. `R32_UINT` is among them, and its storage texel buffer atomics are required too; a word //! view's storage element is declared `R32ui`, so its writes ask no format's bit. //! //! A texture buffer's resource ID word carries its format's code wherever the format has a word -//! layout, on every device, so a program's IDs are the same on every device; a module takes the -//! codes its device holds as words from the profile it is compiled for -//! ([`texel_buffer_word_codes`]), and reaches the format's own view for any other. +//! layout, and whether it was made both to be read and to be written, on every device, so a +//! program's IDs are the same on every device; a module takes the codes its device holds as words +//! for each usage from the profile it is compiled for ([`texel_buffer_word_codes`]), and reaches +//! the format's own view for any other. //! //! The view's elements are words: a texel of one or two bytes shares its word with its //! neighbours, read by shifting it out and written by an atomic AND that clears its bits and an @@ -37,7 +41,7 @@ use std::collections::BTreeSet; use crate::device::requirements::FormatUsage; use crate::device::DeviceProfile; use crate::metal::format::{ExtendedRange, FormatEmulation}; -use crate::metal::PixelFormat; +use crate::metal::{PixelFormat, TextureUsage}; use crate::vk; /// How a texture buffer of a format held as words holds a texel (the module docs). @@ -203,33 +207,56 @@ const VIEW_USES: [FormatUsage; 2] = [ /// The further uses a device holds a format for where a texture buffer of a format with a word /// layout is its own view rather than words: the storage texel buffer's write without a format. -/// With [`VIEW_USES`] these are the three checks [`texel_buffer_form`] makes: a read -/// (`access::read`) through the uniform texel buffer, the storage texel buffer the view's usage -/// takes, and a write through it declared without a format. A read through that storage texel -/// buffer (`access::read_write`) is not among them: where the own view lacks the read without a -/// format, the runtime refuses that read (`Gap::StorageElement`). +/// With [`VIEW_USES`] these are the three checks [`texel_buffer_form`] makes of every texture +/// buffer: a read (`access::read`) through the uniform texel buffer, the storage texel buffer the +/// view's usage takes, and a write through it declared without a format. const NATIVE_USES: [FormatUsage; 1] = [FormatUsage::StorageTexelBufferWriteWithoutFormat]; -/// How a texture buffer of `pf` holds its texels on a device of `profile`, the one place that -/// decides it (the module docs). Its own view ([`TexelBufferForm::View`]) where the device holds -/// the format directly (with no component mapping or conversion), of one colour texel an element, -/// as a uniform texel buffer, a storage texel buffer and a storage texel buffer written without a -/// format; else words ([`TexelBufferForm::Words`]) where the format has a word layout -/// ([`texel_buffer_words`]); else its own view where the device holds it so as the two texel -/// buffers alone (a format Vulkan requires, on a device that writes none without a format, whose -/// write the runtime then refuses). `None` for any other format, whose texture -/// buffer is refused. -pub fn texel_buffer_form(pf: PixelFormat, profile: &DeviceProfile) -> Option { +/// The fourth check [`texel_buffer_form`] makes of a texture buffer made both to be read and to +/// be written ([`texel_buffer_read_write`]): a read through its storage texel buffer declared +/// without a format (`access::read_write`). A texture buffer made otherwise is never read so (a +/// slot's `access::read_write` needs both usages), and one of a format without a word layout whose +/// own view lacks it is refused that read at the draw or dispatch (`Gap::StorageElement`). +const READ_WRITE_USES: [FormatUsage; 1] = [FormatUsage::StorageTexelBufferReadWithoutFormat]; + +/// Whether a texture buffer made with `usage` (`MTLTextureUsage`, fixed at its making) is made +/// both to be read and to be written by shaders: its usage holds `ShaderRead` and `ShaderWrite`, +/// or is Metal's unknown usage, which allows every use. [`texel_buffer_form`] checks a fourth use +/// of such a texture buffer's format, and its resource ID word says so +/// (`resource_word::TextureWord::TEXEL_BUFFER_READ_WRITE`). +pub const fn texel_buffer_read_write(usage: TextureUsage) -> bool { + usage.is_empty() + || (usage.contains(TextureUsage::SHADER_READ) && usage.contains(TextureUsage::SHADER_WRITE)) +} + +/// How a texture buffer of `pf` made with `usage` holds its texels on a device of `profile`, the +/// one place that decides it (the module docs): one answer per format and usage per device. Its +/// own view ([`TexelBufferForm::View`]) where the device holds the format directly (with no +/// component mapping or conversion), of one colour texel an element, as a uniform texel buffer, a +/// storage texel buffer and a storage texel buffer written without a format, and, for a texture +/// buffer made both to be read and to be written ([`texel_buffer_read_write`]), a storage texel +/// buffer read without a format; else words ([`TexelBufferForm::Words`]) where the format has a +/// word layout ([`texel_buffer_words`]); else its own view where the device holds it so as the +/// two texel buffers alone (a format Vulkan requires, on a device that writes or reads none +/// without a format, whose write or read the runtime then refuses). `None` for any other format, +/// whose texture buffer is refused. +pub fn texel_buffer_form( + pf: PixelFormat, + usage: TextureUsage, + profile: &DeviceProfile, +) -> Option { let uses: BTreeSet = VIEW_USES.into_iter().collect(); let own = super::vk_format(pf, &uses, profile).ok().filter(|m| { m.emulation == FormatEmulation::Direct && m.aspects == vk::ImageAspectFlags::COLOR && super::block_extent(pf).is_none() }); + let read_write: &[FormatUsage] = match texel_buffer_read_write(usage) { + true => &READ_WRITE_USES, + false => &[], + }; let native = own.filter(|m| { - NATIVE_USES - .iter() - .all(|&u| profile.supports_format(m.format, u)) + (NATIVE_USES.iter().chain(read_write)).all(|&u| profile.supports_format(m.format, u)) }); match (native, texel_buffer_words(pf), own) { (Some(m), _, _) => Some(TexelBufferForm::View(m.format)), @@ -238,16 +265,42 @@ pub fn texel_buffer_form(pf: PixelFormat, profile: &DeviceProfile) -> Option u64 { - WORD_FORMATS - .iter() - .filter_map(|&pf| match texel_buffer_form(pf, profile)? { - TexelBufferForm::Words(w) => Some(1u64 << w.code), - TexelBufferForm::View(_) => None, - }) - .fold(0, |codes, bit| codes | bit) +/// The codes of the formats a device holds texture buffers of as words ([`texel_buffer_form`]), +/// bit `c` set for code `c`, by usage. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub(crate) struct WordCodes { + /// Of a texture buffer made to be read or written alone. + pub(crate) alone: u64, + /// Of one made both to be read and to be written ([`texel_buffer_read_write`]): those of + /// [`alone`](Self::alone) and those whose own view a device holds for the three uses but not + /// the fourth. + pub(crate) read_write: u64, +} + +impl WordCodes { + /// The codes held as words for either usage: [`read_write`](Self::read_write)'s, which hold + /// [`alone`](Self::alone)'s. + pub(crate) fn any(self) -> u64 { + self.alone | self.read_write + } +} + +/// The codes of the formats a device of `profile` holds texture buffers of as words, by usage +/// ([`WordCodes`]). +pub(crate) fn texel_buffer_word_codes(profile: &DeviceProfile) -> WordCodes { + let codes = |usage| { + WORD_FORMATS + .iter() + .filter_map(|&pf| match texel_buffer_form(pf, usage, profile)? { + TexelBufferForm::Words(w) => Some(1u64 << w.code), + TexelBufferForm::View(_) => None, + }) + .fold(0, |codes, bit| codes | bit) + }; + WordCodes { + alone: codes(TextureUsage::SHADER_READ), + read_write: codes(TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE), + } } /// The formats a texture buffer may hold as words, in the order of their codes (1 for the first): @@ -433,45 +486,118 @@ mod tests { } } - /// On every committed profile, a format Vulkan requires as a storage texel buffer is its own - /// view, each format with a word layout is words or its own view, the latter only where the - /// profile holds it directly for the three uses `NATIVE_USES` and `VIEW_USES` name, and the - /// module's codes are the formats held as words. Prints each profile's formats held as words. + /// On every committed profile, for a texture buffer made to be read alone, written alone, and + /// both read and written (and Metal's unknown usage, which is both), a format Vulkan requires + /// as a storage texel buffer is its own view, each format with a word layout is words or its + /// own view, the latter only where the profile holds it directly for the uses `VIEW_USES` and + /// `NATIVE_USES` name and, made both to be read and to be written, `READ_WRITE_USES`, and the + /// module's codes for each usage are the formats held as words for it, those made to be read + /// alone among those made both. Prints each profile's formats held as words by usage. #[test] - fn each_profile_holds_each_format_one_way() { + fn each_profile_holds_each_format_one_way_for_each_usage() { use PixelFormat as P; + use TextureUsage as U; let profiles = crate::spirv::testing::committed_profiles().expect("committed profiles"); assert!(!profiles.is_empty()); + let usages = [ + U::SHADER_READ, + U::SHADER_WRITE, + U::SHADER_READ | U::SHADER_WRITE, + U::UNKNOWN, + ]; for (stem, profile) in &profiles { - for pf in [P::RGBA8Unorm, P::R32Uint, P::RG32Float, P::RGBA16Float] { - let form = texel_buffer_form(pf, profile); - assert!( - matches!(form, Some(TexelBufferForm::View(_))), - "{stem}: {pf:?}" - ); + let held = texel_buffer_word_codes(profile); + assert_eq!(held.alone & !held.read_write, 0, "{stem}: {held:?}"); + for usage in usages { + let read_write = texel_buffer_read_write(usage); + for pf in [P::RGBA8Unorm, P::R32Uint, P::RG32Float, P::RGBA16Float] { + let form = texel_buffer_form(pf, usage, profile); + assert!( + matches!(form, Some(TexelBufferForm::View(_))), + "{stem}: {pf:?} {usage:?}" + ); + } + let mut words = Vec::new(); + let mut codes = 0u64; + for &pf in &WORD_FORMATS { + match texel_buffer_form(pf, usage, profile) { + Some(TexelBufferForm::Words(w)) => { + assert_eq!(Some(w), texel_words(pf), "{stem}: {pf:?}"); + codes |= 1 << w.code; + words.push(format!("{pf:?}")); + } + Some(TexelBufferForm::View(f)) => { + let fourth: &[FormatUsage] = match read_write { + true => &READ_WRITE_USES, + false => &[], + }; + let mut uses = VIEW_USES.iter().chain(&NATIVE_USES).chain(fourth); + assert!( + uses.all(|&u| profile.supports_format(f, u)), + "{stem}: {pf:?} {usage:?}" + ); + } + None => panic!("{stem}: {pf:?} {usage:?} has no form"), + } + } + let want = match read_write { + true => held.read_write, + false => held.alone, + }; + assert_eq!(want, codes, "{stem}: {usage:?}"); + eprintln!("{stem}: {usage:?}: held as words: {}", words.join(" ")); } - let mut words = Vec::new(); + } + } + + /// Made both to be read and to be written, a texture buffer of a format whose own view takes + /// the three uses but not the read without a format is words, and made to be read or written + /// alone it is that own view: on ANV's Iris Xe (RPL-P), whose buffer features lack + /// `STORAGE_READ_WITHOUT_FORMAT` for `B5G6R5Unorm`, `BGR5A1Unorm`, `BGRA8Unorm`, + /// `RGB10A2Unorm`, `RGB10A2Uint`, `BGR10A2Unorm` and `RG11B10Float`, those seven are the codes + /// held as words for that usage alone. On a profile whose `shaderStorageImageReadWithoutFormat` + /// holds, the two usages' codes are the same. + #[test] + fn a_texture_buffer_made_to_be_read_and_written_is_words_where_its_own_view_reads_none_so() { + use PixelFormat as P; + use TextureUsage as U; + let profiles = crate::spirv::testing::committed_profiles().expect("committed profiles"); + let both = U::SHADER_READ | U::SHADER_WRITE; + let moved = [ + P::B5G6R5Unorm, + P::BGR5A1Unorm, + P::BGRA8Unorm, + P::RGB10A2Unorm, + P::RGB10A2Uint, + P::BGR10A2Unorm, + P::RG11B10Float, + ]; + let mut iris = false; + for (stem, profile) in &profiles { + let held = texel_buffer_word_codes(profile); + if profile.images().storage_read_without_format { + assert_eq!(held.alone, held.read_write, "{stem}"); + } + if stem != "intel-irisxe-rplp-anv" { + continue; + } + iris = true; let mut codes = 0u64; - for &pf in &WORD_FORMATS { - match texel_buffer_form(pf, profile) { - Some(TexelBufferForm::Words(w)) => { - assert_eq!(Some(w), texel_words(pf), "{stem}: {pf:?}"); - codes |= 1 << w.code; - words.push(format!("{pf:?}")); - } - Some(TexelBufferForm::View(f)) => { - let uses = VIEW_USES.iter().chain(&NATIVE_USES); - assert!( - uses.into_iter().all(|&u| profile.supports_format(f, u)), - "{stem}: {pf:?}" - ); - } - None => panic!("{stem}: {pf:?} has no form"), + for pf in moved { + let words = texel_buffer_words(pf).expect("a word layout"); + codes |= 1 << words.code; + for alone in [U::SHADER_READ, U::SHADER_WRITE] { + let form = texel_buffer_form(pf, alone, profile); + assert!(matches!(form, Some(TexelBufferForm::View(_))), "{pf:?}"); + } + for usage in [both, U::UNKNOWN] { + let form = texel_buffer_form(pf, usage, profile); + assert_eq!(form, Some(TexelBufferForm::Words(words)), "{pf:?}"); } } - assert_eq!(texel_buffer_word_codes(profile), codes, "{stem}"); - eprintln!("{stem}: held as words: {}", words.join(" ")); + assert_eq!(held.read_write & !held.alone, codes); } + assert!(iris, "no intel-irisxe-rplp-anv profile"); } /// Each layout's fields lie inside its texel and never cross a 32-bit word, so a texel of diff --git a/crates/metal2vulkan/src/metal/resource_word.rs b/crates/metal2vulkan/src/metal/resource_word.rs index c268fa0da..817d4ce7a 100644 --- a/crates/metal2vulkan/src/metal/resource_word.rs +++ b/crates/metal2vulkan/src/metal/resource_word.rs @@ -3,7 +3,7 @@ //! no round trip. `docs/RESOURCE-ID.md` is the specification; a sampler's word is //! [`SamplerWord`](crate::metal::sampler::SamplerWord). -use crate::metal::{PixelFormat, TextureSwizzleChannels}; +use crate::metal::{PixelFormat, TextureSwizzleChannels, TextureUsage}; /// The high word of a texture's `gpuResourceID`, from its pixel format and swizzle alone. The /// bits: @@ -21,9 +21,10 @@ use crate::metal::{PixelFormat, TextureSwizzleChannels}; /// ([`TEXEL_BUFFER_LAYOUT`](Self::TEXEL_BUFFER_LAYOUT)) and its bits 0-10 its padding /// ([`TEXEL_BUFFER_PADDING`](Self::TEXEL_BUFFER_PADDING), bits 0-1), its word format's code /// ([`TEXEL_BUFFER_WORDS`](Self::TEXEL_BUFFER_WORDS), bits 2-7), its texels per word -/// ([`TEXEL_BUFFER_PACKING`](Self::TEXEL_BUFFER_PACKING), bits 8-9) and whether a texel is two -/// words ([`TEXEL_BUFFER_WIDE`](Self::TEXEL_BUFFER_WIDE), bit 10) in place of the border texels, -/// which a read through a sampler then takes from the code. +/// ([`TEXEL_BUFFER_PACKING`](Self::TEXEL_BUFFER_PACKING), bits 8-9), whether a texel is two +/// words ([`TEXEL_BUFFER_WIDE`](Self::TEXEL_BUFFER_WIDE), bit 10) and whether it was made both to +/// be read and to be written ([`TEXEL_BUFFER_READ_WRITE`](Self::TEXEL_BUFFER_READ_WRITE), bit 11) +/// in place of the border texels, which a read through a sampler then takes from the code. /// Bit `3c + b` of the border texels is set where channel `c` (0 red to 3 alpha) of the texel a /// Metal 4.1 read through a sampler hands back outside the level on a border axis, for border /// color `b` (`MTLSamplerBorderColor`'s raw value: transparent black, opaque black, opaque @@ -62,12 +63,18 @@ impl TextureWord { pub const TEXEL_BUFFER_PACKING_SHIFT: u32 = 8; /// A texture buffer held as words whose texel is two words of its view, the low word first. pub const TEXEL_BUFFER_WIDE: u32 = 1 << 10; + /// A texture buffer of a format with a word layout made both to be read and to be written + /// (`metal::format::texel_buffer_read_write`): a device holds its format as words for it + /// where its own view lacks the read without a format (`metal::format::texel_buffer_form`), so + /// a shader tests this bit beside the code. Clear for one made to be read or written alone. + pub const TEXEL_BUFFER_READ_WRITE: u32 = 1 << 11; /// The bits a texture buffer of a format with a word layout carries in place of its border /// texels, beside [`TEXEL_BUFFER_LAYOUT`](Self::TEXEL_BUFFER_LAYOUT). pub const TEXEL_BUFFER_FIELDS: u32 = Self::TEXEL_BUFFER_PADDING | Self::TEXEL_BUFFER_WORDS | Self::TEXEL_BUFFER_PACKING - | Self::TEXEL_BUFFER_WIDE; + | Self::TEXEL_BUFFER_WIDE + | Self::TEXEL_BUFFER_READ_WRITE; /// The lowest bit of the pixel format. pub const PIXEL_FORMAT_SHIFT: u32 = 16; /// The pixel format's bits. @@ -87,14 +94,19 @@ impl TextureWord { } /// The word of a texture buffer (`MTLTextureTypeTextureBuffer`) of `pixel_format`, `width` - /// texels wide: [`of`](Self::of)'s with each channel's own swizzle, and where its format has a - /// word layout (`metal::format::texel_buffer_words`), on every device whether or not the - /// device holds it as words, [`TEXEL_BUFFER_LAYOUT`](Self::TEXEL_BUFFER_LAYOUT) and - /// [`TEXEL_BUFFER_FIELDS`](Self::TEXEL_BUFFER_FIELDS) in place of its border texels: its - /// format's code, its texels per word, whether a texel is two words, and its padding. `None` - /// for a format without a word, and for a texture buffer of a word layout whose words - /// overflow a `u32`. - pub fn of_texture_buffer(pixel_format: PixelFormat, width: u32) -> Option { + /// texels wide, made with `usage`: [`of`](Self::of)'s with each channel's own swizzle, and + /// where its format has a word layout (`metal::format::texel_buffer_words`), on every device + /// whether or not the device holds it as words, [`TEXEL_BUFFER_LAYOUT`](Self::TEXEL_BUFFER_LAYOUT) + /// and [`TEXEL_BUFFER_FIELDS`](Self::TEXEL_BUFFER_FIELDS) in place of its border texels: its + /// format's code, its texels per word, whether a texel is two words, its padding, and whether + /// `usage` makes it both to be read and to be written + /// (`metal::format::texel_buffer_read_write`). `None` for a format without a word, and for a + /// texture buffer of a word layout whose words overflow a `u32`. + pub fn of_texture_buffer( + pixel_format: PixelFormat, + width: u32, + usage: TextureUsage, + ) -> Option { let TextureWord(w) = TextureWord::of(pixel_format, TextureSwizzleChannels::DEFAULT)?; let Some(words) = crate::metal::format::texel_buffer_words(pixel_format) else { return Some(TextureWord(w)); @@ -107,7 +119,11 @@ impl TextureWord { true => Self::TEXEL_BUFFER_WIDE, false => 0, }; - let fields = Self::TEXEL_BUFFER_LAYOUT | code | packing | wide | padding; + let read_write = match crate::metal::format::texel_buffer_read_write(usage) { + true => Self::TEXEL_BUFFER_READ_WRITE, + false => 0, + }; + let fields = Self::TEXEL_BUFFER_LAYOUT | code | packing | wide | read_write | padding; Some(TextureWord(kept | fields)) } } @@ -143,26 +159,39 @@ mod tests { } /// A texture buffer of a format with a word layout carries bit 13, its code, packing and - /// padding in place of the border texels; one of a format without a word layout has the - /// texture's word, its border texels included. + /// padding in place of the border texels, and bit 11 where it is made both to be read and to + /// be written (or with Metal's unknown usage); one of a format without a word layout has the + /// texture's word, its border texels included, whatever its usage. #[test] fn a_texture_buffer_held_as_words_carries_its_padding() { - let a8 = TextureWord::of_texture_buffer(PixelFormat::A8Unorm, 5); + let read = TextureUsage::SHADER_READ; + let both = TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE; + let a8 = TextureWord::of_texture_buffer(PixelFormat::A8Unorm, 5, read); assert_eq!( a8, Some(TextureWord(1 << 16 | 1 << 13 | 2 << 8 | 1 << 2 | 3)) ); - let r16 = TextureWord::of_texture_buffer(PixelFormat::R16Unorm, 6); + let r16 = TextureWord::of_texture_buffer(PixelFormat::R16Unorm, 6, read); let r16_word = 20 << 16 | 1 << 13 | 1 << 12 | 1 << 8 | 7 << 2; assert_eq!(r16, Some(TextureWord(r16_word))); - let wide = TextureWord::of_texture_buffer(PixelFormat::RGBA16Unorm, 5); + let written = TextureWord::of_texture_buffer(PixelFormat::R16Unorm, 6, both); + assert_eq!(written, Some(TextureWord(r16_word | 1 << 11))); + let unknown = + TextureWord::of_texture_buffer(PixelFormat::R16Unorm, 6, TextureUsage::UNKNOWN); + assert_eq!(unknown, written); + let alone = + TextureWord::of_texture_buffer(PixelFormat::R16Unorm, 6, TextureUsage::SHADER_WRITE); + assert_eq!(alone, r16); + let wide = TextureWord::of_texture_buffer(PixelFormat::RGBA16Unorm, 5, read); assert_eq!( wide, Some(TextureWord(110 << 16 | 1 << 13 | 1 << 10 | 34 << 2)) ); - let rgba = TextureWord::of_texture_buffer(PixelFormat::RGBA8Unorm, 5); let plain = TextureWord::of(PixelFormat::RGBA8Unorm, TextureSwizzleChannels::DEFAULT); - assert_eq!(rgba, plain); - assert_eq!(rgba, Some(TextureWord(70 << 16 | 0b110_100_100_100))); + for usage in [read, both] { + let rgba = TextureWord::of_texture_buffer(PixelFormat::RGBA8Unorm, 5, usage); + assert_eq!(rgba, plain); + assert_eq!(rgba, Some(TextureWord(70 << 16 | 0b110_100_100_100))); + } } } diff --git a/crates/metal2vulkan/src/tests/engine_identity.rs b/crates/metal2vulkan/src/tests/engine_identity.rs index 3a17208e5..4ab3bb791 100644 --- a/crates/metal2vulkan/src/tests/engine_identity.rs +++ b/crates/metal2vulkan/src/tests/engine_identity.rs @@ -585,7 +585,7 @@ fn a_read_through_a_sampler_of_a_texture_buffer_reads_the_words() { let mut holding = 0; for stem in PROFILES { let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}")); - let held = crate::metal::format::texel_buffer_word_codes(&p) != 0; + let held = crate::metal::format::texel_buffer_word_codes(&p).any() != 0; holding += usize::from(held); for entry in ["rt_buffer", "rt_buffer_ow", "rt_arg_buffer"] { let (a, plan, _) = diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 76ebc162f..1f800d7bd 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -90,6 +90,7 @@ assoc-const metal2vulkan::metal::resource_word::TextureWord::TEXEL_BUFFER_LAYOUT assoc-const metal2vulkan::metal::resource_word::TextureWord::TEXEL_BUFFER_PACKING pub const TEXEL_BUFFER_PACKING: u32 assoc-const metal2vulkan::metal::resource_word::TextureWord::TEXEL_BUFFER_PACKING_SHIFT pub const TEXEL_BUFFER_PACKING_SHIFT: u32 assoc-const metal2vulkan::metal::resource_word::TextureWord::TEXEL_BUFFER_PADDING pub const TEXEL_BUFFER_PADDING: u32 +assoc-const metal2vulkan::metal::resource_word::TextureWord::TEXEL_BUFFER_READ_WRITE pub const TEXEL_BUFFER_READ_WRITE: u32 assoc-const metal2vulkan::metal::resource_word::TextureWord::TEXEL_BUFFER_WIDE pub const TEXEL_BUFFER_WIDE: u32 assoc-const metal2vulkan::metal::resource_word::TextureWord::TEXEL_BUFFER_WORDS pub const TEXEL_BUFFER_WORDS: u32 assoc-const metal2vulkan::metal::sampler::AddressModeMap::IDENTITY pub const IDENTITY: AddressModeMap @@ -244,11 +245,12 @@ assoc-const-value metal2vulkan::metal::resource_word::TextureWord::OUT_OF_BOUNDS assoc-const-value metal2vulkan::metal::resource_word::TextureWord::PIXEL_FORMAT 0xffff < Option fn metal2vulkan::metal::format::storage_image_choice pub fn storage_image_choice(pf: PixelFormat, profile: &DeviceProfile) -> Result fn metal2vulkan::metal::format::storage_view_formats pub fn storage_view_formats(pf: PixelFormat, profile: &DeviceProfile) -> Vec -fn metal2vulkan::metal::format::texel_buffer_form pub fn texel_buffer_form(pf: PixelFormat, profile: &DeviceProfile) -> Option +fn metal2vulkan::metal::format::texel_buffer_form pub fn texel_buffer_form(pf: PixelFormat, usage: TextureUsage, profile: &DeviceProfile) -> Option +fn metal2vulkan::metal::format::texel_buffer_read_write pub const fn texel_buffer_read_write(usage: TextureUsage) -> bool fn metal2vulkan::metal::format::texel_buffer_words pub fn texel_buffer_words(pf: PixelFormat) -> Option fn metal2vulkan::metal::format::texel_words pub fn texel_words(pf: PixelFormat) -> Option fn metal2vulkan::metal::format::texture_usages pub fn texture_usages(pf: PixelFormat, usage: TextureUsage) -> BTreeSet @@ -6551,7 +6554,7 @@ method metal2vulkan::metal::format::WordAttachment::output_word pub fn output_wo method metal2vulkan::metal::format::WordAttachment::pack pub fn pack(self, codes: [u32; 4]) -> u32 method metal2vulkan::metal::format::WordAttachment::word_format pub fn word_format(self) -> vk::Format method metal2vulkan::metal::resource_word::TextureWord::of pub fn of(pixel_format: PixelFormat, swizzle: TextureSwizzleChannels) -> Option -method metal2vulkan::metal::resource_word::TextureWord::of_texture_buffer pub fn of_texture_buffer(pixel_format: PixelFormat, width: u32) -> Option +method metal2vulkan::metal::resource_word::TextureWord::of_texture_buffer pub fn of_texture_buffer(pixel_format: PixelFormat, width: u32, usage: TextureUsage) -> Option method metal2vulkan::metal::sampler::AddressModeMap::constexpr_mode pub fn constexpr_mode(&self, from: SamplerAddressMode) -> Option method metal2vulkan::metal::sampler::AddressModeMap::is_identity pub fn is_identity(&self) -> bool method metal2vulkan::metal::sampler::AddressModeMap::mode pub fn mode(&self, from: SamplerAddressMode) -> SamplerAddressMode diff --git a/crates/metal2vulkan/tests/api_surface.rs b/crates/metal2vulkan/tests/api_surface.rs index b21fef4fc..e8af8657b 100644 --- a/crates/metal2vulkan/tests/api_surface.rs +++ b/crates/metal2vulkan/tests/api_surface.rs @@ -600,6 +600,7 @@ surface! { fn required_storage_texel_buffer; fn texel_buffer_words; fn texel_buffer_form; + fn texel_buffer_read_write; const WORD_FORMATS; fn texel_words; fn word_format; diff --git a/crates/metal2vulkan/tests/resource_words.rs b/crates/metal2vulkan/tests/resource_words.rs index 80cad0f24..f281699f3 100644 --- a/crates/metal2vulkan/tests/resource_words.rs +++ b/crates/metal2vulkan/tests/resource_words.rs @@ -18,13 +18,13 @@ use metal2vulkan::metal::resource_word::TextureWord; use metal2vulkan::metal::sampler::SamplerWord; use metal2vulkan::metal::{ CompareFunction, PixelFormat, SamplerAddressMode, SamplerBorderColor, SamplerMinMagFilter, - SamplerMipFilter, SamplerReductionMode, TextureSwizzle, TextureSwizzleChannels, + SamplerMipFilter, SamplerReductionMode, TextureSwizzle, TextureSwizzleChannels, TextureUsage, }; const HEADER: &str = "\ # gpuResourceID high words (docs/RESOURCE-ID.md): one Metal descriptor per line, raw Metal values. # texture\tpixelFormat\tswizzleRed\tswizzleGreen\tswizzleBlue\tswizzleAlpha\tword -# texturebuffer\tpixelFormat\twidth\tword +# texturebuffer\tpixelFormat\twidth\tusage\tword # sampler\tminFilter\tmagFilter\tmipFilter\tsAddressMode\ttAddressMode\trAddressMode\tborderColor\tnormalizedCoordinates\tlodMinClamp\tlodMaxClamp\tlodAverage\tmaxAnisotropy\tcompareFunction\treductionMode\tword # lodMinClamp and lodMaxClamp are a float's IEEE-754 bits; booleans are 0 or 1; words are hex. "; @@ -177,21 +177,38 @@ fn samplers(out: &mut String) { }); } -/// The texture buffer lines: every pixel format with a texture buffer word at width 1, and at -/// widths 2 to 4 too where its word changes with the width (a texture buffer held as words of -/// more than one texel a word, whose padding the word carries). +/// The texture buffer lines: every pixel format with a texture buffer word at width 1 under each +/// usage that tells the word apart, read (1), write (2), read and write (3) and unknown (0); and, +/// read and read-write, at widths 2 to 4 too where its word changes with the width (a texture +/// buffer held as words of more than one texel a word, whose padding the word carries). fn texture_buffers(out: &mut String) { + let read = TextureUsage::SHADER_READ; + let both = read.union(TextureUsage::SHADER_WRITE); for &pf in PixelFormat::ALL { - let Some(TextureWord(first)) = TextureWord::of_texture_buffer(pf, 1) else { - continue; - }; - let _ = writeln!(out, "texturebuffer\t{}\t1\t{first:#010x}", pf.as_raw()); - let words: Vec<_> = (2..=4) - .filter_map(|w| Some((w, TextureWord::of_texture_buffer(pf, w)?.0))) - .collect(); - if words.iter().any(|&(_, word)| word != first) { - for (w, word) in words { - let _ = writeln!(out, "texturebuffer\t{}\t{w}\t{word:#010x}", pf.as_raw()); + for usage in [read, both] { + let Some(TextureWord(first)) = TextureWord::of_texture_buffer(pf, 1, usage) else { + continue; + }; + let raw = usage.as_raw(); + let _ = writeln!( + out, + "texturebuffer\t{}\t1\t{raw}\t{first:#010x}", + pf.as_raw() + ); + let words: Vec<_> = (2..=4) + .filter_map(|w| Some((w, TextureWord::of_texture_buffer(pf, w, usage)?.0))) + .collect(); + if words.iter().any(|&(_, word)| word != first) { + for (w, word) in words { + let pf = pf.as_raw(); + let _ = writeln!(out, "texturebuffer\t{pf}\t{w}\t{raw}\t{word:#010x}"); + } + } + } + for usage in [TextureUsage::SHADER_WRITE, TextureUsage::UNKNOWN] { + if let Some(TextureWord(word)) = TextureWord::of_texture_buffer(pf, 1, usage) { + let (pf, raw) = (pf.as_raw(), usage.as_raw()); + let _ = writeln!(out, "texturebuffer\t{pf}\t1\t{raw}\t{word:#010x}"); } } } @@ -244,10 +261,14 @@ fn word_of(fields: &[&str]) -> u32 { let channels = TextureSwizzleChannels::new(s(r), s(g), s(b), s(a)); TextureWord::of(pf, channels).expect("a word").0 } - ["texturebuffer", pf, width] => { + ["texturebuffer", pf, width, usage] => { let pf = raw(PixelFormat::ALL, PixelFormat::as_raw, pf); let width = width.parse().expect("width"); - TextureWord::of_texture_buffer(pf, width).expect("a word").0 + let usage: u32 = usage.parse().expect("usage"); + let usage = TextureUsage::try_from(usage).expect("a usage"); + TextureWord::of_texture_buffer(pf, width, usage) + .expect("a word") + .0 } ["sampler", min, mag, mip, sa, ta, ra, border, normalized, lo, hi, average, aniso, compare, reduction] => { diff --git a/crates/metal2vulkan/tests/resource_words.tsv b/crates/metal2vulkan/tests/resource_words.tsv index 9375c755e..463d5f895 100644 --- a/crates/metal2vulkan/tests/resource_words.tsv +++ b/crates/metal2vulkan/tests/resource_words.tsv @@ -1,6 +1,6 @@ # gpuResourceID high words (docs/RESOURCE-ID.md): one Metal descriptor per line, raw Metal values. # texture pixelFormat swizzleRed swizzleGreen swizzleBlue swizzleAlpha word -# texturebuffer pixelFormat width word +# texturebuffer pixelFormat width usage word # sampler minFilter magFilter mipFilter sAddressMode tAddressMode rAddressMode borderColor normalizedCoordinates lodMinClamp lodMaxClamp lodAverage maxAnisotropy compareFunction reductionMode word # lodMinClamp and lodMaxClamp are a float's IEEE-754 bits; booleans are 0 or 1; words are hex. texture 1 2 3 4 5 0x00010800 @@ -334,257 +334,890 @@ texture 252 2 3 4 1 0x00fc1f24 texture 252 2 3 4 2 0x00fc1924 texture 252 2 3 4 3 0x00fc1924 texture 252 2 3 4 4 0x00fc1924 -texturebuffer 1 1 0x00012207 -texturebuffer 1 2 0x00012206 -texturebuffer 1 3 0x00012205 -texturebuffer 1 4 0x00012204 -texturebuffer 10 1 0x000a320b -texturebuffer 10 2 0x000a320a -texturebuffer 10 3 0x000a3209 -texturebuffer 10 4 0x000a3208 -texturebuffer 11 1 0x000b320f -texturebuffer 11 2 0x000b320e -texturebuffer 11 3 0x000b320d -texturebuffer 11 4 0x000b320c -texturebuffer 12 1 0x000c3213 -texturebuffer 12 2 0x000c3212 -texturebuffer 12 3 0x000c3211 -texturebuffer 12 4 0x000c3210 -texturebuffer 13 1 0x000d3217 -texturebuffer 13 2 0x000d3216 -texturebuffer 13 3 0x000d3215 -texturebuffer 13 4 0x000d3214 -texturebuffer 14 1 0x000e321b -texturebuffer 14 2 0x000e321a -texturebuffer 14 3 0x000e3219 -texturebuffer 14 4 0x000e3218 -texturebuffer 20 1 0x0014311d -texturebuffer 20 2 0x0014311c -texturebuffer 20 3 0x0014311d -texturebuffer 20 4 0x0014311c -texturebuffer 22 1 0x00163121 -texturebuffer 22 2 0x00163120 -texturebuffer 22 3 0x00163121 -texturebuffer 22 4 0x00163120 -texturebuffer 23 1 0x00173125 -texturebuffer 23 2 0x00173124 -texturebuffer 23 3 0x00173125 -texturebuffer 23 4 0x00173124 -texturebuffer 24 1 0x00183129 -texturebuffer 24 2 0x00183128 -texturebuffer 24 3 0x00183129 -texturebuffer 24 4 0x00183128 -texturebuffer 25 1 0x0019312d -texturebuffer 25 2 0x0019312c -texturebuffer 25 3 0x0019312d -texturebuffer 25 4 0x0019312c -texturebuffer 30 1 0x001e3131 -texturebuffer 30 2 0x001e3130 -texturebuffer 30 3 0x001e3131 -texturebuffer 30 4 0x001e3130 -texturebuffer 31 1 0x001f3135 -texturebuffer 31 2 0x001f3134 -texturebuffer 31 3 0x001f3135 -texturebuffer 31 4 0x001f3134 -texturebuffer 32 1 0x00203139 -texturebuffer 32 2 0x00203138 -texturebuffer 32 3 0x00203139 -texturebuffer 32 4 0x00203138 -texturebuffer 33 1 0x0021313d -texturebuffer 33 2 0x0021313c -texturebuffer 33 3 0x0021313d -texturebuffer 33 4 0x0021313c -texturebuffer 34 1 0x00223141 -texturebuffer 34 2 0x00223140 -texturebuffer 34 3 0x00223141 -texturebuffer 34 4 0x00223140 -texturebuffer 40 1 0x00283145 -texturebuffer 40 2 0x00283144 -texturebuffer 40 3 0x00283145 -texturebuffer 40 4 0x00283144 -texturebuffer 41 1 0x00292149 -texturebuffer 41 2 0x00292148 -texturebuffer 41 3 0x00292149 -texturebuffer 41 4 0x00292148 -texturebuffer 42 1 0x002a214d -texturebuffer 42 2 0x002a214c -texturebuffer 42 3 0x002a214d -texturebuffer 42 4 0x002a214c -texturebuffer 43 1 0x002b2151 -texturebuffer 43 2 0x002b2150 -texturebuffer 43 3 0x002b2151 -texturebuffer 43 4 0x002b2150 -texturebuffer 53 1 0x00351e04 -texturebuffer 54 1 0x00361e04 -texturebuffer 55 1 0x00371e04 -texturebuffer 60 1 0x003c3054 -texturebuffer 62 1 0x003e3058 -texturebuffer 63 1 0x003f305c -texturebuffer 64 1 0x00403060 -texturebuffer 65 1 0x00413064 -texturebuffer 70 1 0x00460d24 -texturebuffer 71 1 0x00472068 -texturebuffer 72 1 0x00480d24 -texturebuffer 73 1 0x00490d24 -texturebuffer 74 1 0x004a0d24 -texturebuffer 80 1 0x0050206c -texturebuffer 81 1 0x00512070 -texturebuffer 90 1 0x005a2074 -texturebuffer 91 1 0x005b2078 -texturebuffer 92 1 0x005c3080 -texturebuffer 93 1 0x005d3084 -texturebuffer 94 1 0x005e207c -texturebuffer 554 1 0x022a3090 -texturebuffer 555 1 0x022b3094 -texturebuffer 103 1 0x00671e24 -texturebuffer 104 1 0x00681e24 -texturebuffer 105 1 0x00691e24 -texturebuffer 110 1 0x006e2488 -texturebuffer 112 1 0x0070248c -texturebuffer 113 1 0x00710d24 -texturebuffer 114 1 0x00720d24 -texturebuffer 115 1 0x00730d24 -texturebuffer 552 1 0x02282498 -texturebuffer 553 1 0x0229249c -texturebuffer 123 1 0x007b0d24 -texturebuffer 124 1 0x007c0d24 -texturebuffer 125 1 0x007d0d24 -texturebuffer 130 1 0x00820d24 -texturebuffer 131 1 0x00830d24 -texturebuffer 132 1 0x00840d24 -texturebuffer 133 1 0x00850d24 -texturebuffer 134 1 0x00860d24 -texturebuffer 135 1 0x00870d24 -texturebuffer 140 1 0x008c1e04 -texturebuffer 141 1 0x008d1e04 -texturebuffer 142 1 0x008e1e24 -texturebuffer 143 1 0x008f1e24 -texturebuffer 150 1 0x00961f24 -texturebuffer 151 1 0x00971f24 -texturebuffer 152 1 0x00980d24 -texturebuffer 153 1 0x00990d24 -texturebuffer 160 1 0x00a01f24 -texturebuffer 161 1 0x00a11f24 -texturebuffer 162 1 0x00a21f24 -texturebuffer 163 1 0x00a31f24 -texturebuffer 164 1 0x00a40d24 -texturebuffer 165 1 0x00a50d24 -texturebuffer 166 1 0x00a60d24 -texturebuffer 167 1 0x00a70d24 -texturebuffer 170 1 0x00aa1e04 -texturebuffer 172 1 0x00ac1e04 -texturebuffer 174 1 0x00ae1e24 -texturebuffer 176 1 0x00b01e24 -texturebuffer 178 1 0x00b20d24 -texturebuffer 179 1 0x00b30d24 -texturebuffer 180 1 0x00b41f24 -texturebuffer 181 1 0x00b51f24 -texturebuffer 182 1 0x00b60d24 -texturebuffer 183 1 0x00b70d24 -texturebuffer 186 1 0x00ba0d24 -texturebuffer 187 1 0x00bb0d24 -texturebuffer 188 1 0x00bc0d24 -texturebuffer 189 1 0x00bd0d24 -texturebuffer 190 1 0x00be0d24 -texturebuffer 192 1 0x00c00d24 -texturebuffer 193 1 0x00c10d24 -texturebuffer 194 1 0x00c20d24 -texturebuffer 195 1 0x00c30d24 -texturebuffer 196 1 0x00c40d24 -texturebuffer 197 1 0x00c50d24 -texturebuffer 198 1 0x00c60d24 -texturebuffer 199 1 0x00c70d24 -texturebuffer 200 1 0x00c80d24 -texturebuffer 204 1 0x00cc0d24 -texturebuffer 205 1 0x00cd0d24 -texturebuffer 206 1 0x00ce0d24 -texturebuffer 207 1 0x00cf0d24 -texturebuffer 208 1 0x00d00d24 -texturebuffer 210 1 0x00d20d24 -texturebuffer 211 1 0x00d30d24 -texturebuffer 212 1 0x00d40d24 -texturebuffer 213 1 0x00d50d24 -texturebuffer 214 1 0x00d60d24 -texturebuffer 215 1 0x00d70d24 -texturebuffer 216 1 0x00d80d24 -texturebuffer 217 1 0x00d90d24 -texturebuffer 218 1 0x00da0d24 -texturebuffer 222 1 0x00de0d24 -texturebuffer 223 1 0x00df0d24 -texturebuffer 224 1 0x00e00d24 -texturebuffer 225 1 0x00e10d24 -texturebuffer 226 1 0x00e20d24 -texturebuffer 228 1 0x00e40d24 -texturebuffer 229 1 0x00e50d24 -texturebuffer 230 1 0x00e60d24 -texturebuffer 231 1 0x00e70d24 -texturebuffer 232 1 0x00e80d24 -texturebuffer 233 1 0x00e90d24 -texturebuffer 234 1 0x00ea0d24 -texturebuffer 235 1 0x00eb0d24 -texturebuffer 236 1 0x00ec0d24 -texturebuffer 240 1 0x00f01f24 -texturebuffer 241 1 0x00f11f24 -texturebuffer 250 1 0x00fa1f24 -texturebuffer 252 1 0x00fc1f24 -texturebuffer 253 1 0x00fd1f24 -texturebuffer 255 1 0x00ff1f24 -texturebuffer 260 1 0x01041f24 -texturebuffer 261 1 0x01051f24 -texturebuffer 262 1 0x01061f24 -texturebuffer 84 1 0x005409a4 -texturebuffer 550 1 0x02260d24 -texturebuffer 551 1 0x02270d24 -texturebuffer 500 1 0x01f41f24 -texturebuffer 502 1 0x01f61f24 -texturebuffer 503 1 0x01f71f24 -texturebuffer 505 1 0x01f91f24 -texturebuffer 506 1 0x01fa1f24 -texturebuffer 507 1 0x01fb1f24 -texturebuffer 508 1 0x01fc1f24 -texturebuffer 509 1 0x01fd1f24 -texturebuffer 510 1 0x01fe1f24 -texturebuffer 520 1 0x02081f24 -texturebuffer 522 1 0x020a1f24 -texturebuffer 523 1 0x020b1f24 -texturebuffer 525 1 0x020d1f24 -texturebuffer 526 1 0x020e1f24 -texturebuffer 527 1 0x020f1f24 -texturebuffer 528 1 0x02101f24 -texturebuffer 529 1 0x02111f24 -texturebuffer 530 1 0x02121f24 -texturebuffer 540 1 0x021c1f24 -texturebuffer 541 1 0x021d1f24 -texturebuffer 542 1 0x021e1f24 -texturebuffer 543 1 0x021f1f24 -texturebuffer 544 1 0x02201f24 -texturebuffer 545 1 0x02211f24 -texturebuffer 185 1 0x00b90d24 -texturebuffer 191 1 0x00bf0d24 -texturebuffer 203 1 0x00cb0d24 -texturebuffer 209 1 0x00d10d24 -texturebuffer 221 1 0x00dd0d24 -texturebuffer 227 1 0x00e30d24 -texturebuffer 26 1 0x001a1e04 -texturebuffer 44 1 0x002c0d24 -texturebuffer 66 1 0x00421e24 -texturebuffer 116 1 0x00740d24 -texturebuffer 300 1 0x012c1f24 -texturebuffer 301 1 0x012d1f24 -texturebuffer 302 1 0x012e1f24 -texturebuffer 303 1 0x012f1f24 -texturebuffer 304 1 0x01301f24 -texturebuffer 313 1 0x01391f24 -texturebuffer 314 1 0x013a1f24 -texturebuffer 315 1 0x013b1f24 -texturebuffer 323 1 0x01431f24 -texturebuffer 324 1 0x01441f24 -texturebuffer 325 1 0x01451f24 -texturebuffer 576 1 0x02401e04 -texturebuffer 577 1 0x02411e04 -texturebuffer 578 1 0x02421e24 -texturebuffer 579 1 0x02431e24 -texturebuffer 586 1 0x024a0d24 +texturebuffer 1 1 1 0x00012207 +texturebuffer 1 2 1 0x00012206 +texturebuffer 1 3 1 0x00012205 +texturebuffer 1 4 1 0x00012204 +texturebuffer 1 1 3 0x00012a07 +texturebuffer 1 2 3 0x00012a06 +texturebuffer 1 3 3 0x00012a05 +texturebuffer 1 4 3 0x00012a04 +texturebuffer 1 1 2 0x00012207 +texturebuffer 1 1 0 0x00012a07 +texturebuffer 10 1 1 0x000a320b +texturebuffer 10 2 1 0x000a320a +texturebuffer 10 3 1 0x000a3209 +texturebuffer 10 4 1 0x000a3208 +texturebuffer 10 1 3 0x000a3a0b +texturebuffer 10 2 3 0x000a3a0a +texturebuffer 10 3 3 0x000a3a09 +texturebuffer 10 4 3 0x000a3a08 +texturebuffer 10 1 2 0x000a320b +texturebuffer 10 1 0 0x000a3a0b +texturebuffer 11 1 1 0x000b320f +texturebuffer 11 2 1 0x000b320e +texturebuffer 11 3 1 0x000b320d +texturebuffer 11 4 1 0x000b320c +texturebuffer 11 1 3 0x000b3a0f +texturebuffer 11 2 3 0x000b3a0e +texturebuffer 11 3 3 0x000b3a0d +texturebuffer 11 4 3 0x000b3a0c +texturebuffer 11 1 2 0x000b320f +texturebuffer 11 1 0 0x000b3a0f +texturebuffer 12 1 1 0x000c3213 +texturebuffer 12 2 1 0x000c3212 +texturebuffer 12 3 1 0x000c3211 +texturebuffer 12 4 1 0x000c3210 +texturebuffer 12 1 3 0x000c3a13 +texturebuffer 12 2 3 0x000c3a12 +texturebuffer 12 3 3 0x000c3a11 +texturebuffer 12 4 3 0x000c3a10 +texturebuffer 12 1 2 0x000c3213 +texturebuffer 12 1 0 0x000c3a13 +texturebuffer 13 1 1 0x000d3217 +texturebuffer 13 2 1 0x000d3216 +texturebuffer 13 3 1 0x000d3215 +texturebuffer 13 4 1 0x000d3214 +texturebuffer 13 1 3 0x000d3a17 +texturebuffer 13 2 3 0x000d3a16 +texturebuffer 13 3 3 0x000d3a15 +texturebuffer 13 4 3 0x000d3a14 +texturebuffer 13 1 2 0x000d3217 +texturebuffer 13 1 0 0x000d3a17 +texturebuffer 14 1 1 0x000e321b +texturebuffer 14 2 1 0x000e321a +texturebuffer 14 3 1 0x000e3219 +texturebuffer 14 4 1 0x000e3218 +texturebuffer 14 1 3 0x000e3a1b +texturebuffer 14 2 3 0x000e3a1a +texturebuffer 14 3 3 0x000e3a19 +texturebuffer 14 4 3 0x000e3a18 +texturebuffer 14 1 2 0x000e321b +texturebuffer 14 1 0 0x000e3a1b +texturebuffer 20 1 1 0x0014311d +texturebuffer 20 2 1 0x0014311c +texturebuffer 20 3 1 0x0014311d +texturebuffer 20 4 1 0x0014311c +texturebuffer 20 1 3 0x0014391d +texturebuffer 20 2 3 0x0014391c +texturebuffer 20 3 3 0x0014391d +texturebuffer 20 4 3 0x0014391c +texturebuffer 20 1 2 0x0014311d +texturebuffer 20 1 0 0x0014391d +texturebuffer 22 1 1 0x00163121 +texturebuffer 22 2 1 0x00163120 +texturebuffer 22 3 1 0x00163121 +texturebuffer 22 4 1 0x00163120 +texturebuffer 22 1 3 0x00163921 +texturebuffer 22 2 3 0x00163920 +texturebuffer 22 3 3 0x00163921 +texturebuffer 22 4 3 0x00163920 +texturebuffer 22 1 2 0x00163121 +texturebuffer 22 1 0 0x00163921 +texturebuffer 23 1 1 0x00173125 +texturebuffer 23 2 1 0x00173124 +texturebuffer 23 3 1 0x00173125 +texturebuffer 23 4 1 0x00173124 +texturebuffer 23 1 3 0x00173925 +texturebuffer 23 2 3 0x00173924 +texturebuffer 23 3 3 0x00173925 +texturebuffer 23 4 3 0x00173924 +texturebuffer 23 1 2 0x00173125 +texturebuffer 23 1 0 0x00173925 +texturebuffer 24 1 1 0x00183129 +texturebuffer 24 2 1 0x00183128 +texturebuffer 24 3 1 0x00183129 +texturebuffer 24 4 1 0x00183128 +texturebuffer 24 1 3 0x00183929 +texturebuffer 24 2 3 0x00183928 +texturebuffer 24 3 3 0x00183929 +texturebuffer 24 4 3 0x00183928 +texturebuffer 24 1 2 0x00183129 +texturebuffer 24 1 0 0x00183929 +texturebuffer 25 1 1 0x0019312d +texturebuffer 25 2 1 0x0019312c +texturebuffer 25 3 1 0x0019312d +texturebuffer 25 4 1 0x0019312c +texturebuffer 25 1 3 0x0019392d +texturebuffer 25 2 3 0x0019392c +texturebuffer 25 3 3 0x0019392d +texturebuffer 25 4 3 0x0019392c +texturebuffer 25 1 2 0x0019312d +texturebuffer 25 1 0 0x0019392d +texturebuffer 30 1 1 0x001e3131 +texturebuffer 30 2 1 0x001e3130 +texturebuffer 30 3 1 0x001e3131 +texturebuffer 30 4 1 0x001e3130 +texturebuffer 30 1 3 0x001e3931 +texturebuffer 30 2 3 0x001e3930 +texturebuffer 30 3 3 0x001e3931 +texturebuffer 30 4 3 0x001e3930 +texturebuffer 30 1 2 0x001e3131 +texturebuffer 30 1 0 0x001e3931 +texturebuffer 31 1 1 0x001f3135 +texturebuffer 31 2 1 0x001f3134 +texturebuffer 31 3 1 0x001f3135 +texturebuffer 31 4 1 0x001f3134 +texturebuffer 31 1 3 0x001f3935 +texturebuffer 31 2 3 0x001f3934 +texturebuffer 31 3 3 0x001f3935 +texturebuffer 31 4 3 0x001f3934 +texturebuffer 31 1 2 0x001f3135 +texturebuffer 31 1 0 0x001f3935 +texturebuffer 32 1 1 0x00203139 +texturebuffer 32 2 1 0x00203138 +texturebuffer 32 3 1 0x00203139 +texturebuffer 32 4 1 0x00203138 +texturebuffer 32 1 3 0x00203939 +texturebuffer 32 2 3 0x00203938 +texturebuffer 32 3 3 0x00203939 +texturebuffer 32 4 3 0x00203938 +texturebuffer 32 1 2 0x00203139 +texturebuffer 32 1 0 0x00203939 +texturebuffer 33 1 1 0x0021313d +texturebuffer 33 2 1 0x0021313c +texturebuffer 33 3 1 0x0021313d +texturebuffer 33 4 1 0x0021313c +texturebuffer 33 1 3 0x0021393d +texturebuffer 33 2 3 0x0021393c +texturebuffer 33 3 3 0x0021393d +texturebuffer 33 4 3 0x0021393c +texturebuffer 33 1 2 0x0021313d +texturebuffer 33 1 0 0x0021393d +texturebuffer 34 1 1 0x00223141 +texturebuffer 34 2 1 0x00223140 +texturebuffer 34 3 1 0x00223141 +texturebuffer 34 4 1 0x00223140 +texturebuffer 34 1 3 0x00223941 +texturebuffer 34 2 3 0x00223940 +texturebuffer 34 3 3 0x00223941 +texturebuffer 34 4 3 0x00223940 +texturebuffer 34 1 2 0x00223141 +texturebuffer 34 1 0 0x00223941 +texturebuffer 40 1 1 0x00283145 +texturebuffer 40 2 1 0x00283144 +texturebuffer 40 3 1 0x00283145 +texturebuffer 40 4 1 0x00283144 +texturebuffer 40 1 3 0x00283945 +texturebuffer 40 2 3 0x00283944 +texturebuffer 40 3 3 0x00283945 +texturebuffer 40 4 3 0x00283944 +texturebuffer 40 1 2 0x00283145 +texturebuffer 40 1 0 0x00283945 +texturebuffer 41 1 1 0x00292149 +texturebuffer 41 2 1 0x00292148 +texturebuffer 41 3 1 0x00292149 +texturebuffer 41 4 1 0x00292148 +texturebuffer 41 1 3 0x00292949 +texturebuffer 41 2 3 0x00292948 +texturebuffer 41 3 3 0x00292949 +texturebuffer 41 4 3 0x00292948 +texturebuffer 41 1 2 0x00292149 +texturebuffer 41 1 0 0x00292949 +texturebuffer 42 1 1 0x002a214d +texturebuffer 42 2 1 0x002a214c +texturebuffer 42 3 1 0x002a214d +texturebuffer 42 4 1 0x002a214c +texturebuffer 42 1 3 0x002a294d +texturebuffer 42 2 3 0x002a294c +texturebuffer 42 3 3 0x002a294d +texturebuffer 42 4 3 0x002a294c +texturebuffer 42 1 2 0x002a214d +texturebuffer 42 1 0 0x002a294d +texturebuffer 43 1 1 0x002b2151 +texturebuffer 43 2 1 0x002b2150 +texturebuffer 43 3 1 0x002b2151 +texturebuffer 43 4 1 0x002b2150 +texturebuffer 43 1 3 0x002b2951 +texturebuffer 43 2 3 0x002b2950 +texturebuffer 43 3 3 0x002b2951 +texturebuffer 43 4 3 0x002b2950 +texturebuffer 43 1 2 0x002b2151 +texturebuffer 43 1 0 0x002b2951 +texturebuffer 53 1 1 0x00351e04 +texturebuffer 53 1 3 0x00351e04 +texturebuffer 53 1 2 0x00351e04 +texturebuffer 53 1 0 0x00351e04 +texturebuffer 54 1 1 0x00361e04 +texturebuffer 54 1 3 0x00361e04 +texturebuffer 54 1 2 0x00361e04 +texturebuffer 54 1 0 0x00361e04 +texturebuffer 55 1 1 0x00371e04 +texturebuffer 55 1 3 0x00371e04 +texturebuffer 55 1 2 0x00371e04 +texturebuffer 55 1 0 0x00371e04 +texturebuffer 60 1 1 0x003c3054 +texturebuffer 60 1 3 0x003c3854 +texturebuffer 60 1 2 0x003c3054 +texturebuffer 60 1 0 0x003c3854 +texturebuffer 62 1 1 0x003e3058 +texturebuffer 62 1 3 0x003e3858 +texturebuffer 62 1 2 0x003e3058 +texturebuffer 62 1 0 0x003e3858 +texturebuffer 63 1 1 0x003f305c +texturebuffer 63 1 3 0x003f385c +texturebuffer 63 1 2 0x003f305c +texturebuffer 63 1 0 0x003f385c +texturebuffer 64 1 1 0x00403060 +texturebuffer 64 1 3 0x00403860 +texturebuffer 64 1 2 0x00403060 +texturebuffer 64 1 0 0x00403860 +texturebuffer 65 1 1 0x00413064 +texturebuffer 65 1 3 0x00413864 +texturebuffer 65 1 2 0x00413064 +texturebuffer 65 1 0 0x00413864 +texturebuffer 70 1 1 0x00460d24 +texturebuffer 70 1 3 0x00460d24 +texturebuffer 70 1 2 0x00460d24 +texturebuffer 70 1 0 0x00460d24 +texturebuffer 71 1 1 0x00472068 +texturebuffer 71 1 3 0x00472868 +texturebuffer 71 1 2 0x00472068 +texturebuffer 71 1 0 0x00472868 +texturebuffer 72 1 1 0x00480d24 +texturebuffer 72 1 3 0x00480d24 +texturebuffer 72 1 2 0x00480d24 +texturebuffer 72 1 0 0x00480d24 +texturebuffer 73 1 1 0x00490d24 +texturebuffer 73 1 3 0x00490d24 +texturebuffer 73 1 2 0x00490d24 +texturebuffer 73 1 0 0x00490d24 +texturebuffer 74 1 1 0x004a0d24 +texturebuffer 74 1 3 0x004a0d24 +texturebuffer 74 1 2 0x004a0d24 +texturebuffer 74 1 0 0x004a0d24 +texturebuffer 80 1 1 0x0050206c +texturebuffer 80 1 3 0x0050286c +texturebuffer 80 1 2 0x0050206c +texturebuffer 80 1 0 0x0050286c +texturebuffer 81 1 1 0x00512070 +texturebuffer 81 1 3 0x00512870 +texturebuffer 81 1 2 0x00512070 +texturebuffer 81 1 0 0x00512870 +texturebuffer 90 1 1 0x005a2074 +texturebuffer 90 1 3 0x005a2874 +texturebuffer 90 1 2 0x005a2074 +texturebuffer 90 1 0 0x005a2874 +texturebuffer 91 1 1 0x005b2078 +texturebuffer 91 1 3 0x005b2878 +texturebuffer 91 1 2 0x005b2078 +texturebuffer 91 1 0 0x005b2878 +texturebuffer 92 1 1 0x005c3080 +texturebuffer 92 1 3 0x005c3880 +texturebuffer 92 1 2 0x005c3080 +texturebuffer 92 1 0 0x005c3880 +texturebuffer 93 1 1 0x005d3084 +texturebuffer 93 1 3 0x005d3884 +texturebuffer 93 1 2 0x005d3084 +texturebuffer 93 1 0 0x005d3884 +texturebuffer 94 1 1 0x005e207c +texturebuffer 94 1 3 0x005e287c +texturebuffer 94 1 2 0x005e207c +texturebuffer 94 1 0 0x005e287c +texturebuffer 554 1 1 0x022a3090 +texturebuffer 554 1 3 0x022a3890 +texturebuffer 554 1 2 0x022a3090 +texturebuffer 554 1 0 0x022a3890 +texturebuffer 555 1 1 0x022b3094 +texturebuffer 555 1 3 0x022b3894 +texturebuffer 555 1 2 0x022b3094 +texturebuffer 555 1 0 0x022b3894 +texturebuffer 103 1 1 0x00671e24 +texturebuffer 103 1 3 0x00671e24 +texturebuffer 103 1 2 0x00671e24 +texturebuffer 103 1 0 0x00671e24 +texturebuffer 104 1 1 0x00681e24 +texturebuffer 104 1 3 0x00681e24 +texturebuffer 104 1 2 0x00681e24 +texturebuffer 104 1 0 0x00681e24 +texturebuffer 105 1 1 0x00691e24 +texturebuffer 105 1 3 0x00691e24 +texturebuffer 105 1 2 0x00691e24 +texturebuffer 105 1 0 0x00691e24 +texturebuffer 110 1 1 0x006e2488 +texturebuffer 110 1 3 0x006e2c88 +texturebuffer 110 1 2 0x006e2488 +texturebuffer 110 1 0 0x006e2c88 +texturebuffer 112 1 1 0x0070248c +texturebuffer 112 1 3 0x00702c8c +texturebuffer 112 1 2 0x0070248c +texturebuffer 112 1 0 0x00702c8c +texturebuffer 113 1 1 0x00710d24 +texturebuffer 113 1 3 0x00710d24 +texturebuffer 113 1 2 0x00710d24 +texturebuffer 113 1 0 0x00710d24 +texturebuffer 114 1 1 0x00720d24 +texturebuffer 114 1 3 0x00720d24 +texturebuffer 114 1 2 0x00720d24 +texturebuffer 114 1 0 0x00720d24 +texturebuffer 115 1 1 0x00730d24 +texturebuffer 115 1 3 0x00730d24 +texturebuffer 115 1 2 0x00730d24 +texturebuffer 115 1 0 0x00730d24 +texturebuffer 552 1 1 0x02282498 +texturebuffer 552 1 3 0x02282c98 +texturebuffer 552 1 2 0x02282498 +texturebuffer 552 1 0 0x02282c98 +texturebuffer 553 1 1 0x0229249c +texturebuffer 553 1 3 0x02292c9c +texturebuffer 553 1 2 0x0229249c +texturebuffer 553 1 0 0x02292c9c +texturebuffer 123 1 1 0x007b0d24 +texturebuffer 123 1 3 0x007b0d24 +texturebuffer 123 1 2 0x007b0d24 +texturebuffer 123 1 0 0x007b0d24 +texturebuffer 124 1 1 0x007c0d24 +texturebuffer 124 1 3 0x007c0d24 +texturebuffer 124 1 2 0x007c0d24 +texturebuffer 124 1 0 0x007c0d24 +texturebuffer 125 1 1 0x007d0d24 +texturebuffer 125 1 3 0x007d0d24 +texturebuffer 125 1 2 0x007d0d24 +texturebuffer 125 1 0 0x007d0d24 +texturebuffer 130 1 1 0x00820d24 +texturebuffer 130 1 3 0x00820d24 +texturebuffer 130 1 2 0x00820d24 +texturebuffer 130 1 0 0x00820d24 +texturebuffer 131 1 1 0x00830d24 +texturebuffer 131 1 3 0x00830d24 +texturebuffer 131 1 2 0x00830d24 +texturebuffer 131 1 0 0x00830d24 +texturebuffer 132 1 1 0x00840d24 +texturebuffer 132 1 3 0x00840d24 +texturebuffer 132 1 2 0x00840d24 +texturebuffer 132 1 0 0x00840d24 +texturebuffer 133 1 1 0x00850d24 +texturebuffer 133 1 3 0x00850d24 +texturebuffer 133 1 2 0x00850d24 +texturebuffer 133 1 0 0x00850d24 +texturebuffer 134 1 1 0x00860d24 +texturebuffer 134 1 3 0x00860d24 +texturebuffer 134 1 2 0x00860d24 +texturebuffer 134 1 0 0x00860d24 +texturebuffer 135 1 1 0x00870d24 +texturebuffer 135 1 3 0x00870d24 +texturebuffer 135 1 2 0x00870d24 +texturebuffer 135 1 0 0x00870d24 +texturebuffer 140 1 1 0x008c1e04 +texturebuffer 140 1 3 0x008c1e04 +texturebuffer 140 1 2 0x008c1e04 +texturebuffer 140 1 0 0x008c1e04 +texturebuffer 141 1 1 0x008d1e04 +texturebuffer 141 1 3 0x008d1e04 +texturebuffer 141 1 2 0x008d1e04 +texturebuffer 141 1 0 0x008d1e04 +texturebuffer 142 1 1 0x008e1e24 +texturebuffer 142 1 3 0x008e1e24 +texturebuffer 142 1 2 0x008e1e24 +texturebuffer 142 1 0 0x008e1e24 +texturebuffer 143 1 1 0x008f1e24 +texturebuffer 143 1 3 0x008f1e24 +texturebuffer 143 1 2 0x008f1e24 +texturebuffer 143 1 0 0x008f1e24 +texturebuffer 150 1 1 0x00961f24 +texturebuffer 150 1 3 0x00961f24 +texturebuffer 150 1 2 0x00961f24 +texturebuffer 150 1 0 0x00961f24 +texturebuffer 151 1 1 0x00971f24 +texturebuffer 151 1 3 0x00971f24 +texturebuffer 151 1 2 0x00971f24 +texturebuffer 151 1 0 0x00971f24 +texturebuffer 152 1 1 0x00980d24 +texturebuffer 152 1 3 0x00980d24 +texturebuffer 152 1 2 0x00980d24 +texturebuffer 152 1 0 0x00980d24 +texturebuffer 153 1 1 0x00990d24 +texturebuffer 153 1 3 0x00990d24 +texturebuffer 153 1 2 0x00990d24 +texturebuffer 153 1 0 0x00990d24 +texturebuffer 160 1 1 0x00a01f24 +texturebuffer 160 1 3 0x00a01f24 +texturebuffer 160 1 2 0x00a01f24 +texturebuffer 160 1 0 0x00a01f24 +texturebuffer 161 1 1 0x00a11f24 +texturebuffer 161 1 3 0x00a11f24 +texturebuffer 161 1 2 0x00a11f24 +texturebuffer 161 1 0 0x00a11f24 +texturebuffer 162 1 1 0x00a21f24 +texturebuffer 162 1 3 0x00a21f24 +texturebuffer 162 1 2 0x00a21f24 +texturebuffer 162 1 0 0x00a21f24 +texturebuffer 163 1 1 0x00a31f24 +texturebuffer 163 1 3 0x00a31f24 +texturebuffer 163 1 2 0x00a31f24 +texturebuffer 163 1 0 0x00a31f24 +texturebuffer 164 1 1 0x00a40d24 +texturebuffer 164 1 3 0x00a40d24 +texturebuffer 164 1 2 0x00a40d24 +texturebuffer 164 1 0 0x00a40d24 +texturebuffer 165 1 1 0x00a50d24 +texturebuffer 165 1 3 0x00a50d24 +texturebuffer 165 1 2 0x00a50d24 +texturebuffer 165 1 0 0x00a50d24 +texturebuffer 166 1 1 0x00a60d24 +texturebuffer 166 1 3 0x00a60d24 +texturebuffer 166 1 2 0x00a60d24 +texturebuffer 166 1 0 0x00a60d24 +texturebuffer 167 1 1 0x00a70d24 +texturebuffer 167 1 3 0x00a70d24 +texturebuffer 167 1 2 0x00a70d24 +texturebuffer 167 1 0 0x00a70d24 +texturebuffer 170 1 1 0x00aa1e04 +texturebuffer 170 1 3 0x00aa1e04 +texturebuffer 170 1 2 0x00aa1e04 +texturebuffer 170 1 0 0x00aa1e04 +texturebuffer 172 1 1 0x00ac1e04 +texturebuffer 172 1 3 0x00ac1e04 +texturebuffer 172 1 2 0x00ac1e04 +texturebuffer 172 1 0 0x00ac1e04 +texturebuffer 174 1 1 0x00ae1e24 +texturebuffer 174 1 3 0x00ae1e24 +texturebuffer 174 1 2 0x00ae1e24 +texturebuffer 174 1 0 0x00ae1e24 +texturebuffer 176 1 1 0x00b01e24 +texturebuffer 176 1 3 0x00b01e24 +texturebuffer 176 1 2 0x00b01e24 +texturebuffer 176 1 0 0x00b01e24 +texturebuffer 178 1 1 0x00b20d24 +texturebuffer 178 1 3 0x00b20d24 +texturebuffer 178 1 2 0x00b20d24 +texturebuffer 178 1 0 0x00b20d24 +texturebuffer 179 1 1 0x00b30d24 +texturebuffer 179 1 3 0x00b30d24 +texturebuffer 179 1 2 0x00b30d24 +texturebuffer 179 1 0 0x00b30d24 +texturebuffer 180 1 1 0x00b41f24 +texturebuffer 180 1 3 0x00b41f24 +texturebuffer 180 1 2 0x00b41f24 +texturebuffer 180 1 0 0x00b41f24 +texturebuffer 181 1 1 0x00b51f24 +texturebuffer 181 1 3 0x00b51f24 +texturebuffer 181 1 2 0x00b51f24 +texturebuffer 181 1 0 0x00b51f24 +texturebuffer 182 1 1 0x00b60d24 +texturebuffer 182 1 3 0x00b60d24 +texturebuffer 182 1 2 0x00b60d24 +texturebuffer 182 1 0 0x00b60d24 +texturebuffer 183 1 1 0x00b70d24 +texturebuffer 183 1 3 0x00b70d24 +texturebuffer 183 1 2 0x00b70d24 +texturebuffer 183 1 0 0x00b70d24 +texturebuffer 186 1 1 0x00ba0d24 +texturebuffer 186 1 3 0x00ba0d24 +texturebuffer 186 1 2 0x00ba0d24 +texturebuffer 186 1 0 0x00ba0d24 +texturebuffer 187 1 1 0x00bb0d24 +texturebuffer 187 1 3 0x00bb0d24 +texturebuffer 187 1 2 0x00bb0d24 +texturebuffer 187 1 0 0x00bb0d24 +texturebuffer 188 1 1 0x00bc0d24 +texturebuffer 188 1 3 0x00bc0d24 +texturebuffer 188 1 2 0x00bc0d24 +texturebuffer 188 1 0 0x00bc0d24 +texturebuffer 189 1 1 0x00bd0d24 +texturebuffer 189 1 3 0x00bd0d24 +texturebuffer 189 1 2 0x00bd0d24 +texturebuffer 189 1 0 0x00bd0d24 +texturebuffer 190 1 1 0x00be0d24 +texturebuffer 190 1 3 0x00be0d24 +texturebuffer 190 1 2 0x00be0d24 +texturebuffer 190 1 0 0x00be0d24 +texturebuffer 192 1 1 0x00c00d24 +texturebuffer 192 1 3 0x00c00d24 +texturebuffer 192 1 2 0x00c00d24 +texturebuffer 192 1 0 0x00c00d24 +texturebuffer 193 1 1 0x00c10d24 +texturebuffer 193 1 3 0x00c10d24 +texturebuffer 193 1 2 0x00c10d24 +texturebuffer 193 1 0 0x00c10d24 +texturebuffer 194 1 1 0x00c20d24 +texturebuffer 194 1 3 0x00c20d24 +texturebuffer 194 1 2 0x00c20d24 +texturebuffer 194 1 0 0x00c20d24 +texturebuffer 195 1 1 0x00c30d24 +texturebuffer 195 1 3 0x00c30d24 +texturebuffer 195 1 2 0x00c30d24 +texturebuffer 195 1 0 0x00c30d24 +texturebuffer 196 1 1 0x00c40d24 +texturebuffer 196 1 3 0x00c40d24 +texturebuffer 196 1 2 0x00c40d24 +texturebuffer 196 1 0 0x00c40d24 +texturebuffer 197 1 1 0x00c50d24 +texturebuffer 197 1 3 0x00c50d24 +texturebuffer 197 1 2 0x00c50d24 +texturebuffer 197 1 0 0x00c50d24 +texturebuffer 198 1 1 0x00c60d24 +texturebuffer 198 1 3 0x00c60d24 +texturebuffer 198 1 2 0x00c60d24 +texturebuffer 198 1 0 0x00c60d24 +texturebuffer 199 1 1 0x00c70d24 +texturebuffer 199 1 3 0x00c70d24 +texturebuffer 199 1 2 0x00c70d24 +texturebuffer 199 1 0 0x00c70d24 +texturebuffer 200 1 1 0x00c80d24 +texturebuffer 200 1 3 0x00c80d24 +texturebuffer 200 1 2 0x00c80d24 +texturebuffer 200 1 0 0x00c80d24 +texturebuffer 204 1 1 0x00cc0d24 +texturebuffer 204 1 3 0x00cc0d24 +texturebuffer 204 1 2 0x00cc0d24 +texturebuffer 204 1 0 0x00cc0d24 +texturebuffer 205 1 1 0x00cd0d24 +texturebuffer 205 1 3 0x00cd0d24 +texturebuffer 205 1 2 0x00cd0d24 +texturebuffer 205 1 0 0x00cd0d24 +texturebuffer 206 1 1 0x00ce0d24 +texturebuffer 206 1 3 0x00ce0d24 +texturebuffer 206 1 2 0x00ce0d24 +texturebuffer 206 1 0 0x00ce0d24 +texturebuffer 207 1 1 0x00cf0d24 +texturebuffer 207 1 3 0x00cf0d24 +texturebuffer 207 1 2 0x00cf0d24 +texturebuffer 207 1 0 0x00cf0d24 +texturebuffer 208 1 1 0x00d00d24 +texturebuffer 208 1 3 0x00d00d24 +texturebuffer 208 1 2 0x00d00d24 +texturebuffer 208 1 0 0x00d00d24 +texturebuffer 210 1 1 0x00d20d24 +texturebuffer 210 1 3 0x00d20d24 +texturebuffer 210 1 2 0x00d20d24 +texturebuffer 210 1 0 0x00d20d24 +texturebuffer 211 1 1 0x00d30d24 +texturebuffer 211 1 3 0x00d30d24 +texturebuffer 211 1 2 0x00d30d24 +texturebuffer 211 1 0 0x00d30d24 +texturebuffer 212 1 1 0x00d40d24 +texturebuffer 212 1 3 0x00d40d24 +texturebuffer 212 1 2 0x00d40d24 +texturebuffer 212 1 0 0x00d40d24 +texturebuffer 213 1 1 0x00d50d24 +texturebuffer 213 1 3 0x00d50d24 +texturebuffer 213 1 2 0x00d50d24 +texturebuffer 213 1 0 0x00d50d24 +texturebuffer 214 1 1 0x00d60d24 +texturebuffer 214 1 3 0x00d60d24 +texturebuffer 214 1 2 0x00d60d24 +texturebuffer 214 1 0 0x00d60d24 +texturebuffer 215 1 1 0x00d70d24 +texturebuffer 215 1 3 0x00d70d24 +texturebuffer 215 1 2 0x00d70d24 +texturebuffer 215 1 0 0x00d70d24 +texturebuffer 216 1 1 0x00d80d24 +texturebuffer 216 1 3 0x00d80d24 +texturebuffer 216 1 2 0x00d80d24 +texturebuffer 216 1 0 0x00d80d24 +texturebuffer 217 1 1 0x00d90d24 +texturebuffer 217 1 3 0x00d90d24 +texturebuffer 217 1 2 0x00d90d24 +texturebuffer 217 1 0 0x00d90d24 +texturebuffer 218 1 1 0x00da0d24 +texturebuffer 218 1 3 0x00da0d24 +texturebuffer 218 1 2 0x00da0d24 +texturebuffer 218 1 0 0x00da0d24 +texturebuffer 222 1 1 0x00de0d24 +texturebuffer 222 1 3 0x00de0d24 +texturebuffer 222 1 2 0x00de0d24 +texturebuffer 222 1 0 0x00de0d24 +texturebuffer 223 1 1 0x00df0d24 +texturebuffer 223 1 3 0x00df0d24 +texturebuffer 223 1 2 0x00df0d24 +texturebuffer 223 1 0 0x00df0d24 +texturebuffer 224 1 1 0x00e00d24 +texturebuffer 224 1 3 0x00e00d24 +texturebuffer 224 1 2 0x00e00d24 +texturebuffer 224 1 0 0x00e00d24 +texturebuffer 225 1 1 0x00e10d24 +texturebuffer 225 1 3 0x00e10d24 +texturebuffer 225 1 2 0x00e10d24 +texturebuffer 225 1 0 0x00e10d24 +texturebuffer 226 1 1 0x00e20d24 +texturebuffer 226 1 3 0x00e20d24 +texturebuffer 226 1 2 0x00e20d24 +texturebuffer 226 1 0 0x00e20d24 +texturebuffer 228 1 1 0x00e40d24 +texturebuffer 228 1 3 0x00e40d24 +texturebuffer 228 1 2 0x00e40d24 +texturebuffer 228 1 0 0x00e40d24 +texturebuffer 229 1 1 0x00e50d24 +texturebuffer 229 1 3 0x00e50d24 +texturebuffer 229 1 2 0x00e50d24 +texturebuffer 229 1 0 0x00e50d24 +texturebuffer 230 1 1 0x00e60d24 +texturebuffer 230 1 3 0x00e60d24 +texturebuffer 230 1 2 0x00e60d24 +texturebuffer 230 1 0 0x00e60d24 +texturebuffer 231 1 1 0x00e70d24 +texturebuffer 231 1 3 0x00e70d24 +texturebuffer 231 1 2 0x00e70d24 +texturebuffer 231 1 0 0x00e70d24 +texturebuffer 232 1 1 0x00e80d24 +texturebuffer 232 1 3 0x00e80d24 +texturebuffer 232 1 2 0x00e80d24 +texturebuffer 232 1 0 0x00e80d24 +texturebuffer 233 1 1 0x00e90d24 +texturebuffer 233 1 3 0x00e90d24 +texturebuffer 233 1 2 0x00e90d24 +texturebuffer 233 1 0 0x00e90d24 +texturebuffer 234 1 1 0x00ea0d24 +texturebuffer 234 1 3 0x00ea0d24 +texturebuffer 234 1 2 0x00ea0d24 +texturebuffer 234 1 0 0x00ea0d24 +texturebuffer 235 1 1 0x00eb0d24 +texturebuffer 235 1 3 0x00eb0d24 +texturebuffer 235 1 2 0x00eb0d24 +texturebuffer 235 1 0 0x00eb0d24 +texturebuffer 236 1 1 0x00ec0d24 +texturebuffer 236 1 3 0x00ec0d24 +texturebuffer 236 1 2 0x00ec0d24 +texturebuffer 236 1 0 0x00ec0d24 +texturebuffer 240 1 1 0x00f01f24 +texturebuffer 240 1 3 0x00f01f24 +texturebuffer 240 1 2 0x00f01f24 +texturebuffer 240 1 0 0x00f01f24 +texturebuffer 241 1 1 0x00f11f24 +texturebuffer 241 1 3 0x00f11f24 +texturebuffer 241 1 2 0x00f11f24 +texturebuffer 241 1 0 0x00f11f24 +texturebuffer 250 1 1 0x00fa1f24 +texturebuffer 250 1 3 0x00fa1f24 +texturebuffer 250 1 2 0x00fa1f24 +texturebuffer 250 1 0 0x00fa1f24 +texturebuffer 252 1 1 0x00fc1f24 +texturebuffer 252 1 3 0x00fc1f24 +texturebuffer 252 1 2 0x00fc1f24 +texturebuffer 252 1 0 0x00fc1f24 +texturebuffer 253 1 1 0x00fd1f24 +texturebuffer 253 1 3 0x00fd1f24 +texturebuffer 253 1 2 0x00fd1f24 +texturebuffer 253 1 0 0x00fd1f24 +texturebuffer 255 1 1 0x00ff1f24 +texturebuffer 255 1 3 0x00ff1f24 +texturebuffer 255 1 2 0x00ff1f24 +texturebuffer 255 1 0 0x00ff1f24 +texturebuffer 260 1 1 0x01041f24 +texturebuffer 260 1 3 0x01041f24 +texturebuffer 260 1 2 0x01041f24 +texturebuffer 260 1 0 0x01041f24 +texturebuffer 261 1 1 0x01051f24 +texturebuffer 261 1 3 0x01051f24 +texturebuffer 261 1 2 0x01051f24 +texturebuffer 261 1 0 0x01051f24 +texturebuffer 262 1 1 0x01061f24 +texturebuffer 262 1 3 0x01061f24 +texturebuffer 262 1 2 0x01061f24 +texturebuffer 262 1 0 0x01061f24 +texturebuffer 84 1 1 0x005409a4 +texturebuffer 84 1 3 0x005409a4 +texturebuffer 84 1 2 0x005409a4 +texturebuffer 84 1 0 0x005409a4 +texturebuffer 550 1 1 0x02260d24 +texturebuffer 550 1 3 0x02260d24 +texturebuffer 550 1 2 0x02260d24 +texturebuffer 550 1 0 0x02260d24 +texturebuffer 551 1 1 0x02270d24 +texturebuffer 551 1 3 0x02270d24 +texturebuffer 551 1 2 0x02270d24 +texturebuffer 551 1 0 0x02270d24 +texturebuffer 500 1 1 0x01f41f24 +texturebuffer 500 1 3 0x01f41f24 +texturebuffer 500 1 2 0x01f41f24 +texturebuffer 500 1 0 0x01f41f24 +texturebuffer 502 1 1 0x01f61f24 +texturebuffer 502 1 3 0x01f61f24 +texturebuffer 502 1 2 0x01f61f24 +texturebuffer 502 1 0 0x01f61f24 +texturebuffer 503 1 1 0x01f71f24 +texturebuffer 503 1 3 0x01f71f24 +texturebuffer 503 1 2 0x01f71f24 +texturebuffer 503 1 0 0x01f71f24 +texturebuffer 505 1 1 0x01f91f24 +texturebuffer 505 1 3 0x01f91f24 +texturebuffer 505 1 2 0x01f91f24 +texturebuffer 505 1 0 0x01f91f24 +texturebuffer 506 1 1 0x01fa1f24 +texturebuffer 506 1 3 0x01fa1f24 +texturebuffer 506 1 2 0x01fa1f24 +texturebuffer 506 1 0 0x01fa1f24 +texturebuffer 507 1 1 0x01fb1f24 +texturebuffer 507 1 3 0x01fb1f24 +texturebuffer 507 1 2 0x01fb1f24 +texturebuffer 507 1 0 0x01fb1f24 +texturebuffer 508 1 1 0x01fc1f24 +texturebuffer 508 1 3 0x01fc1f24 +texturebuffer 508 1 2 0x01fc1f24 +texturebuffer 508 1 0 0x01fc1f24 +texturebuffer 509 1 1 0x01fd1f24 +texturebuffer 509 1 3 0x01fd1f24 +texturebuffer 509 1 2 0x01fd1f24 +texturebuffer 509 1 0 0x01fd1f24 +texturebuffer 510 1 1 0x01fe1f24 +texturebuffer 510 1 3 0x01fe1f24 +texturebuffer 510 1 2 0x01fe1f24 +texturebuffer 510 1 0 0x01fe1f24 +texturebuffer 520 1 1 0x02081f24 +texturebuffer 520 1 3 0x02081f24 +texturebuffer 520 1 2 0x02081f24 +texturebuffer 520 1 0 0x02081f24 +texturebuffer 522 1 1 0x020a1f24 +texturebuffer 522 1 3 0x020a1f24 +texturebuffer 522 1 2 0x020a1f24 +texturebuffer 522 1 0 0x020a1f24 +texturebuffer 523 1 1 0x020b1f24 +texturebuffer 523 1 3 0x020b1f24 +texturebuffer 523 1 2 0x020b1f24 +texturebuffer 523 1 0 0x020b1f24 +texturebuffer 525 1 1 0x020d1f24 +texturebuffer 525 1 3 0x020d1f24 +texturebuffer 525 1 2 0x020d1f24 +texturebuffer 525 1 0 0x020d1f24 +texturebuffer 526 1 1 0x020e1f24 +texturebuffer 526 1 3 0x020e1f24 +texturebuffer 526 1 2 0x020e1f24 +texturebuffer 526 1 0 0x020e1f24 +texturebuffer 527 1 1 0x020f1f24 +texturebuffer 527 1 3 0x020f1f24 +texturebuffer 527 1 2 0x020f1f24 +texturebuffer 527 1 0 0x020f1f24 +texturebuffer 528 1 1 0x02101f24 +texturebuffer 528 1 3 0x02101f24 +texturebuffer 528 1 2 0x02101f24 +texturebuffer 528 1 0 0x02101f24 +texturebuffer 529 1 1 0x02111f24 +texturebuffer 529 1 3 0x02111f24 +texturebuffer 529 1 2 0x02111f24 +texturebuffer 529 1 0 0x02111f24 +texturebuffer 530 1 1 0x02121f24 +texturebuffer 530 1 3 0x02121f24 +texturebuffer 530 1 2 0x02121f24 +texturebuffer 530 1 0 0x02121f24 +texturebuffer 540 1 1 0x021c1f24 +texturebuffer 540 1 3 0x021c1f24 +texturebuffer 540 1 2 0x021c1f24 +texturebuffer 540 1 0 0x021c1f24 +texturebuffer 541 1 1 0x021d1f24 +texturebuffer 541 1 3 0x021d1f24 +texturebuffer 541 1 2 0x021d1f24 +texturebuffer 541 1 0 0x021d1f24 +texturebuffer 542 1 1 0x021e1f24 +texturebuffer 542 1 3 0x021e1f24 +texturebuffer 542 1 2 0x021e1f24 +texturebuffer 542 1 0 0x021e1f24 +texturebuffer 543 1 1 0x021f1f24 +texturebuffer 543 1 3 0x021f1f24 +texturebuffer 543 1 2 0x021f1f24 +texturebuffer 543 1 0 0x021f1f24 +texturebuffer 544 1 1 0x02201f24 +texturebuffer 544 1 3 0x02201f24 +texturebuffer 544 1 2 0x02201f24 +texturebuffer 544 1 0 0x02201f24 +texturebuffer 545 1 1 0x02211f24 +texturebuffer 545 1 3 0x02211f24 +texturebuffer 545 1 2 0x02211f24 +texturebuffer 545 1 0 0x02211f24 +texturebuffer 185 1 1 0x00b90d24 +texturebuffer 185 1 3 0x00b90d24 +texturebuffer 185 1 2 0x00b90d24 +texturebuffer 185 1 0 0x00b90d24 +texturebuffer 191 1 1 0x00bf0d24 +texturebuffer 191 1 3 0x00bf0d24 +texturebuffer 191 1 2 0x00bf0d24 +texturebuffer 191 1 0 0x00bf0d24 +texturebuffer 203 1 1 0x00cb0d24 +texturebuffer 203 1 3 0x00cb0d24 +texturebuffer 203 1 2 0x00cb0d24 +texturebuffer 203 1 0 0x00cb0d24 +texturebuffer 209 1 1 0x00d10d24 +texturebuffer 209 1 3 0x00d10d24 +texturebuffer 209 1 2 0x00d10d24 +texturebuffer 209 1 0 0x00d10d24 +texturebuffer 221 1 1 0x00dd0d24 +texturebuffer 221 1 3 0x00dd0d24 +texturebuffer 221 1 2 0x00dd0d24 +texturebuffer 221 1 0 0x00dd0d24 +texturebuffer 227 1 1 0x00e30d24 +texturebuffer 227 1 3 0x00e30d24 +texturebuffer 227 1 2 0x00e30d24 +texturebuffer 227 1 0 0x00e30d24 +texturebuffer 26 1 1 0x001a1e04 +texturebuffer 26 1 3 0x001a1e04 +texturebuffer 26 1 2 0x001a1e04 +texturebuffer 26 1 0 0x001a1e04 +texturebuffer 44 1 1 0x002c0d24 +texturebuffer 44 1 3 0x002c0d24 +texturebuffer 44 1 2 0x002c0d24 +texturebuffer 44 1 0 0x002c0d24 +texturebuffer 66 1 1 0x00421e24 +texturebuffer 66 1 3 0x00421e24 +texturebuffer 66 1 2 0x00421e24 +texturebuffer 66 1 0 0x00421e24 +texturebuffer 116 1 1 0x00740d24 +texturebuffer 116 1 3 0x00740d24 +texturebuffer 116 1 2 0x00740d24 +texturebuffer 116 1 0 0x00740d24 +texturebuffer 300 1 1 0x012c1f24 +texturebuffer 300 1 3 0x012c1f24 +texturebuffer 300 1 2 0x012c1f24 +texturebuffer 300 1 0 0x012c1f24 +texturebuffer 301 1 1 0x012d1f24 +texturebuffer 301 1 3 0x012d1f24 +texturebuffer 301 1 2 0x012d1f24 +texturebuffer 301 1 0 0x012d1f24 +texturebuffer 302 1 1 0x012e1f24 +texturebuffer 302 1 3 0x012e1f24 +texturebuffer 302 1 2 0x012e1f24 +texturebuffer 302 1 0 0x012e1f24 +texturebuffer 303 1 1 0x012f1f24 +texturebuffer 303 1 3 0x012f1f24 +texturebuffer 303 1 2 0x012f1f24 +texturebuffer 303 1 0 0x012f1f24 +texturebuffer 304 1 1 0x01301f24 +texturebuffer 304 1 3 0x01301f24 +texturebuffer 304 1 2 0x01301f24 +texturebuffer 304 1 0 0x01301f24 +texturebuffer 313 1 1 0x01391f24 +texturebuffer 313 1 3 0x01391f24 +texturebuffer 313 1 2 0x01391f24 +texturebuffer 313 1 0 0x01391f24 +texturebuffer 314 1 1 0x013a1f24 +texturebuffer 314 1 3 0x013a1f24 +texturebuffer 314 1 2 0x013a1f24 +texturebuffer 314 1 0 0x013a1f24 +texturebuffer 315 1 1 0x013b1f24 +texturebuffer 315 1 3 0x013b1f24 +texturebuffer 315 1 2 0x013b1f24 +texturebuffer 315 1 0 0x013b1f24 +texturebuffer 323 1 1 0x01431f24 +texturebuffer 323 1 3 0x01431f24 +texturebuffer 323 1 2 0x01431f24 +texturebuffer 323 1 0 0x01431f24 +texturebuffer 324 1 1 0x01441f24 +texturebuffer 324 1 3 0x01441f24 +texturebuffer 324 1 2 0x01441f24 +texturebuffer 324 1 0 0x01441f24 +texturebuffer 325 1 1 0x01451f24 +texturebuffer 325 1 3 0x01451f24 +texturebuffer 325 1 2 0x01451f24 +texturebuffer 325 1 0 0x01451f24 +texturebuffer 576 1 1 0x02401e04 +texturebuffer 576 1 3 0x02401e04 +texturebuffer 576 1 2 0x02401e04 +texturebuffer 576 1 0 0x02401e04 +texturebuffer 577 1 1 0x02411e04 +texturebuffer 577 1 3 0x02411e04 +texturebuffer 577 1 2 0x02411e04 +texturebuffer 577 1 0 0x02411e04 +texturebuffer 578 1 1 0x02421e24 +texturebuffer 578 1 3 0x02421e24 +texturebuffer 578 1 2 0x02421e24 +texturebuffer 578 1 0 0x02421e24 +texturebuffer 579 1 1 0x02431e24 +texturebuffer 579 1 3 0x02431e24 +texturebuffer 579 1 2 0x02431e24 +texturebuffer 579 1 0 0x02431e24 +texturebuffer 586 1 1 0x024a0d24 +texturebuffer 586 1 3 0x024a0d24 +texturebuffer 586 1 2 0x024a0d24 +texturebuffer 586 1 0 0x024a0d24 sampler 0 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000000 sampler 1 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000002 sampler 0 1 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000004 diff --git a/docs/API.md b/docs/API.md index 41d436eba..f396eaecb 100644 --- a/docs/API.md +++ b/docs/API.md @@ -270,8 +270,8 @@ and so do the command line, the compile worker and every validation tool. It hol [RESOURCE-ID.md](RESOURCE-ID.md)), reads, writes and updates atomically its texture buffers, slots and argument buffers' members alike (a uniform texel buffer where it reads one, a storage texel buffer where it writes one, the element of set 1's texel-buffer array at its ID's index; where - the ID's word names a format the profile holds as words, `metal::format::texel_buffer_form`, - that element is a view of `R32_UINT` and the function converts its texels itself, under the + the ID's word names a format the profile holds as words for the usage its bit 11 tells, + `metal::format::texel_buffer_form`, that element is a view of `R32_UINT` and the function converts its texels itself, under the stage's `SpecKey::TexelBufferWords`, which a binder sets true where such a texture buffer may be reached and under which, false, each access is the element's own view's: RESOURCE-ID.md, the texture buffer word), and @@ -2091,8 +2091,8 @@ category, and says what makes an operation carry the note and what may differ. E device's filter of them) by the MSL transfer through the device's `Pow`, at every such access on every device. A `float` read of a texture buffer held as words decodes an 8-bit sRGB colour code the same way, and records the note where the profile holds an 8-bit sRGB format's texture - buffers as words (`metal::format::texel_buffer_form`): its routine reads every format the - profile holds so. + buffers of some usage as words (`metal::format::texel_buffer_form`): its routine reads every + format the profile holds so for some usage. - `metal2vulkan-degrade-function-storage-assumed` (precision). `PrecisionNote::FunctionStorageAssumed`: A vertex or fragment function keeps more private memory (its `alloca`s, a call stack among them, or constants held as `Private` variables) than the floor, diff --git a/docs/REPLAY-STREAM.md b/docs/REPLAY-STREAM.md index 478819f71..1b5000f51 100644 --- a/docs/REPLAY-STREAM.md +++ b/docs/REPLAY-STREAM.md @@ -1197,7 +1197,7 @@ gives another `gpuResourceID` than the program saw (both in hex, `PLAYED` `none` runtime's getter raises), `id ID RECORDED PLAYED word WORD`, as the runtime lays its IDs out as [RESOURCE-ID.md](RESOURCE-ID.md) does: there the ID's low word, its index, is compared with the recording's, and its high word with `WORD`, the document's own function of the descriptor the -object was made of (a texture's `TextureWord`, a texture buffer's `TextureWord::of_texture_buffer` of its format and width, a sampler state's `SamplerWord`), never with the +object was made of (a texture's `TextureWord`, a texture buffer's `TextureWord::of_texture_buffer` of its format, width and usage, a sampler state's `SamplerWord`), never with the recording's high word, which is the recording runtime's own; `covered N: texture writes over other objects of a placement heap; C checks they covered not compared; B covers taken off by a binding, which may be a read` where a texture write covered diff --git a/docs/RESOURCE-ID.md b/docs/RESOURCE-ID.md index 9137eb83f..3f22feb6c 100644 --- a/docs/RESOURCE-ID.md +++ b/docs/RESOURCE-ID.md @@ -93,7 +93,8 @@ arrays with the low word, answers `is_null_texture` by whether the index is 0, a where it checks a `read` itself (a device without `robustImageAccess2`), takes an out-of-bounds alpha of 1 from bit 12 of the word. A texture buffer whose word names a format the device holds as words takes its format, its texels per word, whether a texel is two words and its padding from -bits 0-10 of its word. A slot's `read` through a sampler (MSL 4.1) takes the border +bits 0-10 of its word, and the shader learns that the device holds it as words from its code and, +where the device's answer for its format differs with the usage, bit 11. A slot's `read` through a sampler (MSL 4.1) takes the border texel an index outside the level reads on a border axis from bits 0-11 of the word, for the sampler's border color; a texture buffer's whose word has bit 13 set, from the border texels of the format its code names, as an argument buffer's texture buffer held as words does from the code @@ -152,8 +153,8 @@ no word. ## The texture buffer word -`metal2vulkan::metal::resource_word::TextureWord::of_texture_buffer(pixelFormat, width)`: the -texture word of its format under each channel's own swizzle. Where the format has a word layout, +`metal2vulkan::metal::resource_word::TextureWord::of_texture_buffer(pixelFormat, width, usage)`: +the texture word of its format under each channel's own swizzle. Where the format has a word layout, bit 13 is set and bits 0-11 hold the layout's fields in place of the border texels; a read through a sampler of such a texture buffer takes its format's border texels from its code. Every other texture buffer's word is its texture word, border texels included: @@ -164,7 +165,7 @@ other texture buffer's word is its texture word, border texels included: | 2-7 | its code, 1 to 39 (below) | the border texels | | 8-9 | the base-2 logarithm of the texels one word holds, 0, 1 or 2 | the border texels | | 10 | a texel is two words, the low word first | the border texels | -| 11 | 0 | the border texels | +| 11 | it was made both to be read and to be written: `usage` holds `MTLTextureUsageShaderRead` and `MTLTextureUsageShaderWrite`, or is `MTLTextureUsageUnknown` (`metal::format::texel_buffer_read_write`) | the border texels | | 12 | the format has no alpha | the format has no alpha | | 13 | 1 | 0 | | 14-15 | 0 | 0 | @@ -175,9 +176,12 @@ require as a storage texel buffer (its mandatory format tables), or that has no its own, and the word carries its fields on every device (`metal::format::texel_buffer_words`), so the word is the same on every device. A device holds a texture buffer of such a format as words where it lacks the format's own Vulkan format, held directly, as a uniform texel buffer, a storage -texel buffer or a storage texel buffer written without a format (`metal::format::texel_buffer_form`); -a module holds that answer for the profile it is compiled for, and tests a word's bit 13 and -code only where its stage's `SpecKey::TexelBufferWords` is set (the runtime's words twin). The view is then of `R32_UINT`, its +texel buffer or a storage texel buffer written without a format, and, for a texture buffer made +both to be read and to be written (bit 11), as a storage texel buffer read without a format +(`metal::format::texel_buffer_form`): one answer per format and usage. A module holds those answers +for the profile it is compiled for, and tests a word's bit 13 and code, and its bit 11 where the two +answers differ for some format, only where its stage's `SpecKey::TexelBufferWords` is set (the +runtime's words twin). The view is then of `R32_UINT`, its texels packed in the buffer's bytes as Metal lays them out: a texel of `b` bytes, `w` texels wide, views `⌈w · b / 4⌉` words, and its width is the words times its texels per word, halved where a texel is two words, less its padding. Elsewhere the view is of the format's own Vulkan format, @@ -222,7 +226,7 @@ Vulkan sampler applies them. [`crates/metal2vulkan/tests/resource_words.tsv`](../crates/metal2vulkan/tests/resource_words.tsv) holds one descriptor per line with its word, in tab-separated raw Metal values; its header names the columns. A texture line is a pixel format and its four swizzle sources; a texture buffer line a -pixel format and a width; a sampler line is every +pixel format, a width and a usage (`MTLTextureUsage`'s raw value); a sampler line is every `MTLSamplerDescriptor` field above, with `lodMinClamp` and `lodMaxClamp` as the float's IEEE-754 bits. Words are hexadecimal.