diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2415bda60..a66e847e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -135,6 +135,21 @@ jobs: echo "::endgroup::" done + # rt's documentation for both Windows targets, from Linux as above: a doc link to an item + # only one host has (a Unix host's dma-buf import, Windows' Direct3D 11 import) is + # unresolved on the other host. + - name: Build rt's documentation for Windows (warnings denied, Linux) + if: runner.os == 'Linux' + env: + RUSTDOCFLAGS: -Dwarnings + run: | + set -euo pipefail + for target in x86_64-pc-windows-gnullvm x86_64-pc-windows-msvc; do + echo "::group::$target" + cargo doc --target "$target" -p metal2vulkan-rt --all-features --no-deps + echo "::endgroup::" + done + - name: Build public documentation (warnings denied) env: RUSTDOCFLAGS: -Dwarnings diff --git a/crates/metal2vulkan-rt/src/block.rs b/crates/metal2vulkan-rt/src/block.rs index d3a220671..041d7ab8d 100644 --- a/crates/metal2vulkan-rt/src/block.rs +++ b/crates/metal2vulkan-rt/src/block.rs @@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex, PoisonError, Weak}; /// No Metal counterpart: rt's own handle of a block of memory the consumer places buffers in, as /// a placement `MTLHeap`'s buffers sit in its memory /// ([`Device::take_block`](crate::Device::take_block)), or as a no-copy buffer's bytes are the -/// memory it was made over ([`Device::import_dma_buf`](crate::Device::import_dma_buf), +/// memory it was made over (`Device::import_dma_buf` on Unix, /// [`Device::import_host_memory`](crate::Device::import_host_memory)), or as another API reaches /// it by a handle ([`Device::new_exported_block`](crate::Device::new_exported_block)). It derefs /// to the block's [`BlockInfo`], plain data. diff --git a/crates/metal2vulkan-rt/src/counters.rs b/crates/metal2vulkan-rt/src/counters.rs index 382cd43af..93b9200e2 100644 --- a/crates/metal2vulkan-rt/src/counters.rs +++ b/crates/metal2vulkan-rt/src/counters.rs @@ -1197,7 +1197,7 @@ pub struct Metrics { pub over_copy_bytes: u64, /// Of [`over_copies`](Self::over_copies), those of a texture whose buffer's bytes are in an /// imported block ([`Device::import_host_memory`](crate::Device::import_host_memory), - /// [`Device::import_dma_buf`](crate::Device::import_dma_buf)); the rest are over a buffer in a + /// `Device::import_dma_buf` on Unix); the rest are over a buffer in a /// block of the runtime's own, where the device's linear image does not take the texture. pub over_copies_imported: u64, /// The bytes of those copies, which count in [`over_copy_bytes`](Self::over_copy_bytes) too. @@ -1471,7 +1471,7 @@ pub struct Gauges { /// from its first record until its times are read at its completion: made as command buffers /// need them, and kept until the device drops. pub timestamp_pools: u64, - /// Imported blocks ([`Device::import_dma_buf`](crate::Device::import_dma_buf), + /// Imported blocks (`Device::import_dma_buf` on Unix, /// [`Device::import_host_memory`](crate::Device::import_host_memory)) whose memory is not yet /// freed: each is also one of [`blocks`](Self::blocks). pub imports: u64, diff --git a/crates/metal2vulkan-rt/src/device.rs b/crates/metal2vulkan-rt/src/device.rs index e4ce4c851..0587b605a 100644 --- a/crates/metal2vulkan-rt/src/device.rs +++ b/crates/metal2vulkan-rt/src/device.rs @@ -302,7 +302,7 @@ pub(crate) struct Core { #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] pub(crate) hold_completions: std::sync::RwLock<()>, pub(crate) pool: Pool, - /// What the device imports ([`Device::import_dma_buf`], [`Device::import_host_memory`]). + /// What the device imports (`Device::import_dma_buf` on Unix, [`Device::import_host_memory`]). pub(crate) imports: Imports, /// What the device exports ([`Device::new_exported_block`]). pub(crate) exports: Exports, diff --git a/crates/metal2vulkan-rt/src/error.rs b/crates/metal2vulkan-rt/src/error.rs index 0718378a2..997fa5493 100644 --- a/crates/metal2vulkan-rt/src/error.rs +++ b/crates/metal2vulkan-rt/src/error.rs @@ -1439,7 +1439,7 @@ pub enum Limit { len: u64, }, /// An import of a handle the device does not take - /// ([`Device::import_dma_buf`](crate::Device::import_dma_buf), + /// (`Device::import_dma_buf` on Unix, /// [`Device::import_host_memory`](crate::Device::import_host_memory), and a dma-buf surface's /// buffer, [`Surface::buffer`](crate::Surface::buffer)): it does not list the /// handle's extensions (`VK_KHR_external_memory_fd` and `VK_EXT_external_memory_dma_buf` for a diff --git a/crates/metal2vulkan-rt/src/floor.rs b/crates/metal2vulkan-rt/src/floor.rs index cd85d2bc2..d97d38107 100644 --- a/crates/metal2vulkan-rt/src/floor.rs +++ b/crates/metal2vulkan-rt/src/floor.rs @@ -44,7 +44,7 @@ pub const TIME_DOMAINS: [vk::TimeDomainKHR; 2] = /// of their own: the KHR, and the EXT it was promoted from, whose feature and pipeline structures /// are the same and which a device may list alone, the imports' three: host memory by its /// address ([`Device::import_host_memory`](crate::Device::import_host_memory)), and a dma-buf -/// ([`Device::import_dma_buf`](crate::Device::import_dma_buf)) through the fd's, and the +/// (`Device::import_dma_buf`, on Unix) through the fd's, and the /// exports' ([`Device::new_exported_block`](crate::Device::new_exported_block)): the fd's and /// the dma-buf's again, an NT handle's, and the foreign queue family a dma-buf's ownership /// transfers name, and the DRM format modifier, through which a dma-buf's surface lies in place diff --git a/crates/metal2vulkan-rt/src/import.rs b/crates/metal2vulkan-rt/src/import.rs index edeb2df55..e54f3c42c 100644 --- a/crates/metal2vulkan-rt/src/import.rs +++ b/crates/metal2vulkan-rt/src/import.rs @@ -1,8 +1,9 @@ //! Imports: blocks over memory the consumer brings, the memory of Metal's no-copy buffers //! (`newBufferWithBytesNoCopy:length:options:deallocator:`). A dma-buf by its fd -//! ([`Device::import_dma_buf`]) or host memory by its address ([`Device::import_host_memory`]), -//! each into the memory type its own rule takes from the handle's query, and each a block the -//! consumer places buffers in as it places them in a block it took. +//! (`Device::import_dma_buf`, on Unix) or host memory by its address +//! ([`Device::import_host_memory`]), each into the memory type its own rule takes from the +//! handle's query, and each a block the consumer places buffers in as it places them in a block +//! it took. //! //! The two rules differ. A dma-buf is imported only into the first type its fd's query offers, //! and only where that type is host-visible and host-coherent: on NVIDIA's Linux driver @@ -23,7 +24,7 @@ use std::sync::Arc; /// No Metal counterpart: the handle an import takes. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum ImportHandle { - /// A Linux dma-buf by its fd ([`Device::import_dma_buf`]). + /// A Linux dma-buf by its fd (`Device::import_dma_buf`, on Unix). DmaBuf, /// Host memory by its address ([`Device::import_host_memory`]). HostMemory, @@ -250,12 +251,13 @@ impl Device { /// /// The pages are pinnable host memory: anonymous memory, or a mapping of a file (a memfd's /// among them). Pages the consumer maps through a dma-buf's fd go through - /// [`Device::import_dma_buf`] instead. On NVIDIA's Linux driver (620.70.06, an RTX 3090), a - /// pointer into a mapping of a udmabuf is refused with `VK_ERROR_OUT_OF_DEVICE_MEMORY` in each - /// type its query offers, and the process's later allocations fail too: a device-local one - /// after either refusal, and a host-cached one after the refusal in the host-cached type. + /// `Device::import_dma_buf` (Unix) instead. On NVIDIA's Linux driver (620.70.06, an RTX + /// 3090), a pointer into a mapping of a udmabuf is refused with + /// `VK_ERROR_OUT_OF_DEVICE_MEMORY` in each type its query offers, and the process's later + /// allocations fail too: a device-local one after either refusal, and a host-cached one after + /// the refusal in the host-cached type. /// - /// The block lives, and `release` runs, as for [`Device::import_dma_buf`]: `release`, + /// The block lives, and `release` runs, as for `Device::import_dma_buf` (Unix): `release`, /// Metal's deallocator, runs once the memory is freed, and from then the pages are the /// consumer's alone. Each import is one `VkDeviceMemory` allocation and counts against the /// device's `maxMemoryAllocationCount`. diff --git a/crates/metal2vulkan-rt/src/memory.rs b/crates/metal2vulkan-rt/src/memory.rs index c93c87ec4..6a5c0cc95 100644 --- a/crates/metal2vulkan-rt/src/memory.rs +++ b/crates/metal2vulkan-rt/src/memory.rs @@ -148,7 +148,7 @@ impl AllocationId { /// Nearest Metal counterpart: the memory of a placement `MTLHeap`, which the consumer places /// buffers in ([`Device::new_buffer`](crate::Device::new_buffer)); for an imported block -/// ([`Device::import_dma_buf`](crate::Device::import_dma_buf), +/// (`Device::import_dma_buf` on Unix, /// [`Device::import_host_memory`](crate::Device::import_host_memory)), the memory of a no-copy /// buffer (`newBufferWithBytesNoCopy:length:options:deallocator:`); for an exported block /// ([`Device::new_exported_block`](crate::Device::new_exported_block)), none. diff --git a/crates/metal2vulkan-rt/src/texture.rs b/crates/metal2vulkan-rt/src/texture.rs index 25247849b..4539f36d0 100644 --- a/crates/metal2vulkan-rt/src/texture.rs +++ b/crates/metal2vulkan-rt/src/texture.rs @@ -4249,7 +4249,7 @@ impl Buffer { /// its memory alignment, a format or usage its linear tiling lacks, memory that spilled, a /// render target whose advertised subresource passes its rows or the buffer), over a buffer /// in an imported block (a no-copy buffer's, [`Device::import_host_memory`], - /// [`Device::import_dma_buf`]), and over a buffer in an exported block + /// `Device::import_dma_buf` on Unix), and over a buffer in an exported block /// ([`Device::new_exported_block`], whose memory is dedicated to its buffer), the /// texture is an optimal image of its own, which the device copies the bytes shaders reach /// into and back (`crate::over`): over a Shared buffer once a submission, over a Managed