diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 9b5ab1f8b..b142534dd 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -832,9 +832,10 @@ meanwhile wait for it. second run could not have, runs on the new `VkDevice` where the loss came before it took them, and completes on the lost one where the loss came after, its object then one made before the recovery. -- The recovery carries the events, the fences, the uses of guest RAM (`HostRamUse`), the no-copy - buffers, the `Private` buffers, the buffers in the runtime's own pages and the `Private` heaps - with the buffers placed in them to the new `VkDevice`: the same objects, at the same addresses. +- The recovery carries the events, the fences, the depth/stencil states, the uses of guest RAM + (`HostRamUse`), the no-copy buffers, the `Private` buffers, the buffers in the runtime's own + pages and the `Private` heaps with the buffers placed in them to the new `VkDevice`: the same + objects, at the same addresses. An event keeps the value the host saw and its listeners' notifications. A buffer in the runtime's own pages keeps its bytes and its `contents` pointer: a long host-visible buffer's fresh pages, and, on a device whose checks found that a held import of host pages costs its diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index 9e46a65e8..628bc65fa 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -2335,14 +2335,14 @@ degradations! { /// waits on), and where its new `VkDevice` could not be made (the device then answers as /// a lost one). DeviceRecovered = "device-recovered", Performance, - "the events, fences, uses of guest RAM, no-copy buffers, `Private` buffers, buffers \ - in the runtime's own pages (fresh pages, and the blocks of pages the `Shared` and \ - `Managed` buffers lie in where the device's checks found a held host-page import \ - costs its submissions nothing and textures over such pages take what they take over \ - its own memory) and `Private` heaps with the buffers placed in them made before it go \ - on, a `Private` buffer's or heap's contents lost (it reads zero); the other objects \ - made before it are refused (`MadeBeforeRecovery`), where Metal's go on; the calls \ - during it wait for it"; + "the events, fences, depth/stencil states, uses of guest RAM, no-copy buffers, \ + `Private` buffers, buffers in the runtime's own pages (fresh pages, and the blocks of \ + pages the `Shared` and `Managed` buffers lie in where the device's checks found a \ + held host-page import costs its submissions nothing and textures over such pages take \ + what they take over its own memory) and `Private` heaps with the buffers placed in \ + them made before it go on, a `Private` buffer's or heap's contents lost (it reads \ + zero); the other objects made before it are refused (`MadeBeforeRecovery`), where \ + Metal's go on; the calls during it wait for it"; /// Apple's private device properties the device has no answer for /// (`private_properties.rs`): no document describes them and nothing the device reports /// maps to them. Announced once, when `Device::private_properties` is first read; the diff --git a/crates/metal2vulkan-runtime/src/depth_stencil.rs b/crates/metal2vulkan-runtime/src/depth_stencil.rs index 8d9703575..82efd9937 100644 --- a/crates/metal2vulkan-runtime/src/depth_stencil.rs +++ b/crates/metal2vulkan-runtime/src/depth_stencil.rs @@ -6,7 +6,9 @@ //! ([`metal2vulkan::metal::state::depth_stencil_state`]): a render encoder's draws take it as the //! pipeline's static depth/stencil state, or as dynamic state where the pipeline makes it dynamic //! (`render.rs`). Metal makes a state of any descriptor, masks wider than the 8-bit stencil -//! included (measured on an M4), so creation refuses nothing. +//! included (measured on an M4), so creation refuses nothing. A state holds no Vulkan object, so +//! it is no generation's (`device/line.rs`): it holds a root handle of its device and goes on past +//! the device's recovery, as Metal's state does. //! //! A state's `gpuResourceID` below Apple10 is the release's answer, not a refusal: Metal's API //! validation stops the call ("Obtaining the resourceID of a DepthStencilState object requires @@ -30,6 +32,7 @@ use std::sync::Arc; pub struct DepthStencilState(Arc); struct Shared { + /// A root handle of the device (`device/line.rs`): of whatever generation serves. device: Device, descriptor: DepthStencilDescriptor, vulkan: metal2vulkan::metal::state::DepthStencilState, @@ -65,7 +68,7 @@ impl Device { descriptor: &DepthStencilDescriptor, ) -> Result { Ok(DepthStencilState(Arc::new(Shared { - device: self.clone(), + device: self.root(), descriptor: *descriptor, vulkan: depth_stencil_state(descriptor), }))) @@ -73,7 +76,8 @@ impl Device { } impl DepthStencilState { - /// `device`: the device that made the state. + /// `device`: the device that made the state, as a root handle, whose calls go to the + /// generation that serves (the module docs). pub fn device(&self) -> &Device { &self.0.device } @@ -88,7 +92,7 @@ impl DepthStencilState { /// `NotImplemented(IndirectRenderCommands)` on a device that claims Apple10: indirect render /// commands that set a depth/stencil state are not built. pub fn gpu_resource_id(&self) -> Result { - if self.0.device.supports_family_now(GpuFamily::Apple10.raw()) { + if self.0.device.supports_family(GpuFamily::Apple10.raw()) { return Err(Error::NotImplemented(RuntimeGap::IndirectRenderCommands( IndirectRule::CommandRenderStates, ))); diff --git a/crates/metal2vulkan-runtime/src/device/carry.rs b/crates/metal2vulkan-runtime/src/device/carry.rs index 7ed72bc4a..a90ac25f5 100644 --- a/crates/metal2vulkan-runtime/src/device/carry.rs +++ b/crates/metal2vulkan-runtime/src/device/carry.rs @@ -2,8 +2,8 @@ //! uses of guest RAM, its no-copy buffers, the buffers of the runtime's memory whose bytes no //! pointer of the program's reaches or whose pages the runtime owns, and its `Private` heaps with //! the buffers placed in them, each the same object on the new `VkDevice`, as Metal keeps its -//! objects across its GPU's recovery. A fence, which has no Vulkan object, is no generation's -//! (`fence.rs`): nothing here carries it. +//! objects across its GPU's recovery. A fence and a depth/stencil state, which hold no Vulkan +//! object, are no generation's (`fence.rs`, `depth_stencil.rs`): nothing here carries them. //! //! - **Kept as made.** Each event (`EventShared::new`) and heap (`Device::new_heap`) is kept here, //! held weakly, by the generation it was made on; each buffer the program made of its own (`Device::visible`) is diff --git a/crates/metal2vulkan-runtime/src/error.rs b/crates/metal2vulkan-runtime/src/error.rs index 7ead8a8ae..1f2f40818 100644 --- a/crates/metal2vulkan-runtime/src/error.rs +++ b/crates/metal2vulkan-runtime/src/error.rs @@ -2131,26 +2131,26 @@ pub enum RuntimeGap { /// An object made before its device's recovery from the loss of its `VkDevice` that the /// recovery did not carry to the new one (the runtime made a new `VkDevice` behind the device, /// announced as `Degradation::DeviceRecovered`; `Device::recover_for_test` runs the same - /// recovery). The recovery carries the events, the fences (no generation's: they have no Vulkan - /// object), the uses of guest RAM, the no-copy buffers (made again over the same pages), the - /// `Private` buffers (their contents lost: they read zero), the buffers in the runtime's own - /// pages (their contents and `contents` pointer kept): a long host-visible buffer's fresh - /// pages, and the blocks of pages the `Shared` and `Managed` buffers lie in where the device's - /// checks found a held host-page import costs its submissions nothing and textures over such - /// pages take what they take over its own memory; and the `Private` heaps with the buffers - /// placed in them (their contents lost: they read zero), in which buffers and textures are made - /// again after it. Every other object's Vulkan objects are the lost `VkDevice`'s, which serves - /// nothing more: a pooled `Shared` or `Managed` buffer in memory the device allocated, whose - /// `contents` pointer is its lost memory's mapping, a detached no-copy buffer, a `Shared`, - /// no-copy or sparse heap and the buffers placed in it, a texture (a heap's too), a pipeline - /// state, a library, a sampler state, an indirect command buffer, a buffer over the caller's - /// `VkBuffer` or in exportable memory, and an event made exportable. A call that meets such an - /// object with the new generation (an encoder's bind, a pipeline's making from its functions, a - /// buffer or texture placed in its heap) or that needs its own lost `VkDevice` (its placements, - /// its imports again, its event signals) is refused, where Metal's object goes on; the - /// recovery's notice counts the buffers, heaps and events it left. The same object made again - /// on the device serves; a command buffer made before the recovery fails as its victim - /// (`GpuRecoveryVictim`). + /// recovery). The recovery carries the events, the fences and the depth/stencil states (no + /// generation's: they have no Vulkan object), the uses of guest RAM, the no-copy buffers (made + /// again over the same pages), the `Private` buffers (their contents lost: they read zero), the + /// buffers in the runtime's own pages (their contents and `contents` pointer kept): a long + /// host-visible buffer's fresh pages, and the blocks of pages the `Shared` and `Managed` + /// buffers lie in where the device's checks found a held host-page import costs its submissions + /// nothing and textures over such pages take what they take over its own memory; and the + /// `Private` heaps with the buffers placed in them (their contents lost: they read zero), in + /// which buffers and textures are made again after it. Every other object's Vulkan objects are + /// the lost `VkDevice`'s, which serves nothing more: a pooled `Shared` or `Managed` buffer in + /// memory the device allocated, whose `contents` pointer is its lost memory's mapping, a + /// detached no-copy buffer, a `Shared`, no-copy or sparse heap and the buffers placed in it, a + /// texture (a heap's too), a pipeline state, a library, a sampler state, an indirect command + /// buffer, a buffer over the caller's `VkBuffer` or in exportable memory, and an event made + /// exportable. A call that meets such an object with the new generation (an encoder's bind, a + /// pipeline's making from its functions, a buffer or texture placed in its heap) or that needs + /// its own lost `VkDevice` (its placements, its imports again, its event signals) is refused, + /// where Metal's object goes on; the recovery's notice counts the buffers, heaps and events it + /// left. The same object made again on the device serves; a command buffer made before the + /// recovery fails as its victim (`GpuRecoveryVictim`). MadeBeforeRecovery, /// `Device::recover_for_test` on a device the consumer made (`Device::from_raw`): the runtime /// cannot make a new `VkDevice` of the consumer's, so it recovers none, and the device is diff --git a/docs/API.md b/docs/API.md index c179f4209..7936c896f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -3670,13 +3670,13 @@ bound. recovery announced: where a call waited past 10 seconds for the recovery under way, where its command buffers in flight took past 10 seconds to fail, and where its new `VkDevice` could not be made, after which the device answers as a lost one. `Device::recover_for_test` runs the - same recovery with no GPU fault. Cost: the events, fences, uses of guest RAM, no-copy buffers, - `Private` buffers, buffers in the runtime's own pages (fresh pages, and the blocks of pages the - `Shared` and `Managed` buffers lie in where the device's checks found a held host-page import - costs its submissions nothing and textures over such pages take what they take over its own - memory) and `Private` heaps with the buffers placed in them made before it go on, a `Private` - buffer's or heap's contents lost (it reads zero); the other objects made before it are refused - (`MadeBeforeRecovery`), where Metal's go on; the calls during it wait for it, and a + same recovery with no GPU fault. Cost: the events, fences, depth/stencil states, uses of guest + RAM, no-copy buffers, `Private` buffers, buffers in the runtime's own pages (fresh pages, and the + blocks of pages the `Shared` and `Managed` buffers lie in where the device's checks found a held + host-page import costs its submissions nothing and textures over such pages take what they take + over its own memory) and `Private` heaps with the buffers placed in them made before it go on, a + `Private` buffer's or heap's contents lost (it reads zero); the other objects made before it are + refused (`MadeBeforeRecovery`), where Metal's go on; the calls during it wait for it, and a device call the loss met while it ran runs again after it. A no-copy buffer is made again over the same pages on the new `VkDevice`, as its making or last rebind made it, so the caller's import gate, resolver of guest RAM runs and dma-buf source are asked again, on the thread that