An object's device stays a generation handle across a recovery

What: a fence, a depth/stencil state, a library and its functions and an address pool hold
their device as a LineDevice (device/carry.rs): a root handle, which their own checks match by
the line as before, and a chain of generation handles, kept by the generation's carry registry.
device() answers the generation handle of the generation the object was made on, else of the one
a recovery carried it to last, as a carried buffer's or texture's device does. The recovery
links the next generation's handle after the lost one and lets the lost one go at the lost
generation's rest (MadeOn, a LostParts entry), so the object still holds nothing of the lost
generation once it rests; a handle a caller took keeps meaning its generation and keeps it
alive while held. A library's functions share the library's chain. The internal checks
(encoders' fence and depth/stencil checks, sparse fences, dynamic libraries, function handles,
pipeline additions, compute creation from a function, a pool slot's placement) use the new
root_device() accessors. Docs: the four modules, carry.rs, MadeBeforeRecovery, the runtime
README. REFUSALS.md regenerated: unchanged.

Why: RV 2155-2159 made those device() accessors answer a root handle, an API break: a root's
raw() answers whichever VkDevice serves and lets go of the one it answered before, so a consumer
that takes `new_fence().device()` as the serving generation's handle destroyed objects made on
the lost VkDevice through the new one's handles (SIGSEGV in vkDestroyCommandPool on ANV).

Verified: see the lane run reported with this sha (the test commit before it fails, this one
passes).
This commit is contained in:
Anees Iqbal committed 2026-11-12 16:17:14 -08:00
1 parent e5e0747961
commit 4ae4f9b5d4
15 files changed
+238 -66

No files matched your search

+4
View File
@@ -867,6 +867,10 @@ meanwhile wait for it.
answered its handles, a later `raw` call answered the new one's: `WorkCounts::vk_devices_live`
reads 2 until then. A carried object holds nothing of it once none of its command buffers
records. `vk_devices_made` and `device_recoveries` count the rest.
- An object's `device` is a generation handle: of the `VkDevice` it was made on, else of the one
a recovery carried it to last. A handle taken of it before the recovery keeps meaning the lost
`VkDevice`: its `raw` answers that one's handles, kept alive while the consumer holds the
handle, so the consumer destroys what it made with them through it.
- Each recovery is announced (`device-recovered`), naming the hang's command buffer.
- `Device::raw` answers the new `VkDevice`'s handles once a later call asks; the handles it
answered before stay valid until then, and the lost `VkDevice` stays alive until then, so the
@@ -8,6 +8,7 @@
//! its model gives (`BufferDescriptor::with_pool_slot`): the buffer answers Metal's address.
use super::address::{AddressPlacement, AddressSpace, GpuAddress};
use super::device::carry::LineDevice;
use super::device::lock;
use super::error::Error;
use super::Device;
@@ -24,9 +25,9 @@ use std::sync::{Arc, Mutex};
/// device shares, and holds no Vulkan object, so buffers made after the recovery take its slots
/// as before.
pub struct AddressPool {
/// A root handle (`device/line.rs`): of the device, never of the `VkDevice` it was reserved
/// on.
device: Device,
/// The device: its root handle, which a buffer's placement in a slot matches by its line,
/// and the generation handle `device` answers.
device: LineDevice,
/// The device's address space, which its span is of.
addresses: Arc<Mutex<AddressSpace>>,
address: GpuAddress,
@@ -44,10 +45,17 @@ impl AddressPool {
self.length
}
/// The device whose address space the pool is of: a handle of the device whose calls go to
/// the `VkDevice` that serves it, across its recoveries.
/// The device whose address space the pool is of: a generation handle of the device: of the generation the pool was made on, then of
/// each one the device's recoveries carried the pool to. A handle taken of it keeps meaning that
/// generation: its raw handles are that generation's `VkDevice`'s, kept alive while held.
pub fn device(&self) -> &Device {
&self.device
self.device.generation()
}
/// A root handle of the pool's device, which a buffer's placement in a slot matches by its
/// line.
pub(crate) fn root_device(&self) -> &Device {
self.device.root()
}
}
@@ -92,7 +100,7 @@ impl Device {
) -> Result<AddressPool, Error> {
let address = (self.address_space_for(placement)).reserve_pool(placement, length)?;
Ok(AddressPool {
device: self.root(),
device: LineDevice::new(self),
addresses: Arc::clone(&self.shared().addresses),
address,
length,
@@ -370,8 +370,8 @@ impl Device {
self.shared_place(CALL, other, &contents, length, placement, in_pool)?
}
(None, Some((pool, offset))) => {
if !pool.device().same(self) {
return Err(pool.device().foreign(CALL, self));
if !pool.root_device().same(self) {
return Err(pool.root_device().foreign(CALL, self));
}
Place::InPool {
pool: pool.gpu_address().0,
@@ -7,8 +7,8 @@
//! 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. 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.
//! it goes on past the device's recovery, as Metal's state does, the recovery carrying its handle
//! of the device alone (`device/carry.rs`'s `LineDevice`).
//!
//! 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
@@ -32,8 +32,9 @@ use std::sync::Arc;
pub struct DepthStencilState(Arc<Shared>);
struct Shared {
/// A root handle of the device (`device/line.rs`): of whatever generation serves.
device: Device,
/// The device: its root handle, which the encoders' checks match by its line, and the
/// generation handle `device` answers.
device: LineDevice,
descriptor: DepthStencilDescriptor,
vulkan: metal2vulkan::metal::state::DepthStencilState,
}
@@ -68,7 +69,7 @@ impl Device {
descriptor: &DepthStencilDescriptor,
) -> Result<DepthStencilState, Error> {
Ok(DepthStencilState(Arc::new(Shared {
device: self.root(),
device: LineDevice::new(self),
descriptor: *descriptor,
vulkan: depth_stencil_state(descriptor),
})))
@@ -76,10 +77,16 @@ impl Device {
}
impl DepthStencilState {
/// `device`: the device that made the state, as a root handle, whose calls go to the
/// generation that serves (the module docs).
/// `device`: a generation handle of the device: of the generation the state was made on, then of
/// each one the device's recoveries carried the state to. A handle taken of it keeps meaning that
/// generation: its raw handles are that generation's `VkDevice`'s, kept alive while held.
pub fn device(&self) -> &Device {
&self.0.device
self.0.device.generation()
}
/// A root handle of the state's device, which an encoder of any of its generations matches.
pub(super) fn root_device(&self) -> &Device {
self.0.device.root()
}
/// The descriptor the state was made with. No Metal counterpart: Metal's state keeps none.
@@ -92,7 +99,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<ResourceId, Error> {
if self.0.device.supports_family(GpuFamily::Apple10.raw()) {
if (self.0.device.root()).supports_family(GpuFamily::Apple10.raw()) {
return Err(Error::NotImplemented(RuntimeGap::IndirectRenderCommands(
IndirectRule::CommandRenderStates,
)));
+130 -3
View File
@@ -3,8 +3,8 @@
//! 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, a depth/stencil state, a library, a function and
//! an address pool, which hold no Vulkan object, are no generation's (`fence.rs`,
//! `depth_stencil.rs`, `library.rs`, `address_pool.rs`): nothing here carries them.
//! an address pool hold no Vulkan object (`fence.rs`, `depth_stencil.rs`, `library.rs`,
//! `address_pool.rs`): the recovery carries their handle of the device alone ([`LineDevice`]).
//!
//! - **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
@@ -101,9 +101,10 @@ use crate::resource::ObjectId;
use crate::Error;
use std::cell::UnsafeCell;
use std::collections::HashSet;
use std::convert::Infallible;
use std::mem::ManuallyDrop;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex, Weak};
use std::sync::{Arc, Mutex, OnceLock, Weak};
/// The least size at which the registry drops gone objects' entries.
const PRUNE_FLOOR: usize = 256;
@@ -139,8 +140,13 @@ struct State {
ram_uses: Vec<Weak<RamUseCell>>,
/// The program's heaps, held weakly: as `ram_uses`.
heaps: Vec<WeakHeap>,
/// The handles of the device that the objects holding no Vulkan object answer
/// ([`LineDevice`]), held weakly.
links: Vec<Weak<GenerationLink>>,
/// The size at which the next keeping drops the gone events' entries.
prune_at: usize,
/// The size at which the next keeping drops the gone handles' entries.
links_prune_at: usize,
/// The recovery took the generation's objects ([`Carry::take`]): what is kept from now on,
/// its maker carries.
taken: bool,
@@ -186,6 +192,7 @@ pub(crate) struct Taken {
events: Vec<Arc<EventShared>>,
ram_uses: Vec<Arc<RamUseCell>>,
heaps: Vec<Heap>,
links: Vec<Arc<GenerationLink>>,
}
impl Carry {
@@ -230,6 +237,19 @@ impl Carry {
state.taken
}
/// Keep `link`, this generation's handle of the device an object holding no Vulkan object
/// answers ([`LineDevice`]): as [`event`](Self::event), its gone entries dropped as the
/// registry grows.
fn link(&self, link: &Arc<GenerationLink>) -> bool {
let mut state = lock(&self.state);
if state.links.len() >= state.links_prune_at {
state.links.retain(|link| link.strong_count() > 0);
state.links_prune_at = (2 * state.links.len()).max(PRUNE_FLOOR);
}
state.links.push(Arc::downgrade(link));
state.taken
}
/// The live objects of `shared`, this generation, for its recovery to carry: its events, its
/// uses of guest RAM, its heaps and its program resources' buffers (`Owners::buffers`). From
/// now on, each one made is its maker's to carry.
@@ -244,6 +264,7 @@ impl Carry {
events: state.events.iter().filter_map(Weak::upgrade).collect(),
ram_uses: state.ram_uses.iter().filter_map(Weak::upgrade).collect(),
heaps: state.heaps.iter().filter_map(WeakHeap::upgrade).collect(),
links: state.links.iter().filter_map(Weak::upgrade).collect(),
}
}
@@ -566,7 +587,11 @@ impl Device {
events,
ram_uses,
heaps,
links,
} = shared.carry.take(shared);
for link in &links {
link.carry(next);
}
let mut carried = Carried::default();
for event in &events {
carried.event(event.carry(next));
@@ -663,3 +688,105 @@ impl Drop for MadeOn {
}
}
}
/// The device of an object that holds no Vulkan object (a fence, a depth/stencil state, a library
/// and its functions, an address pool), which a recovery carries as its handle of the device
/// alone: a root handle, which the object's own calls and checks go through
/// ([`root`](Self::root): of whatever generation serves, matched by its line), and the generation
/// handle its `device` answers ([`generation`](Self::generation)): the generation it was made on,
/// then each one the device's recoveries carried it to. A handle taken of it keeps meaning that
/// generation, as any object's device does: its raw handles are that generation's `VkDevice`'s,
/// kept alive while the caller holds it. The object lets go of a lost generation's handle at that
/// generation's rest ([`MadeOn`]), so it holds nothing of it after.
#[derive(Clone)]
pub(crate) struct LineDevice {
root: Device,
first: Arc<GenerationLink>,
}
/// One generation's handle of a [`LineDevice`], linked to the next generation's once a recovery
/// carried the object there.
pub(crate) struct GenerationLink {
device: MadeOn,
next: OnceLock<Arc<GenerationLink>>,
}
impl LineDevice {
/// The device of an object made on `made_on`, a generation handle: its handle kept by the
/// generation's registry for its recovery to carry ([`Carry::take`]), or carried by its maker
/// where the recovery took the generation's objects before then ([`Device::carry_late`]).
pub(crate) fn new(made_on: &Device) -> LineDevice {
LineDevice {
root: made_on.root(),
first: GenerationLink::kept(made_on),
}
}
/// The root handle: of whatever generation serves, as the object is no generation's.
pub(crate) fn root(&self) -> &Device {
&self.root
}
/// The generation handle of the generation the object was carried to last, else of the one
/// it was made on.
pub(crate) fn generation(&self) -> &Device {
let mut link = &self.first;
while let Some(next) = link.next.get() {
link = next;
}
&link.device
}
}
impl std::fmt::Debug for LineDevice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.generation().fmt(f)
}
}
impl GenerationLink {
/// `device`'s handle, a generation handle, kept by its generation's registry; carried by
/// this maker where that generation's recovery took its objects before.
fn kept(device: &Device) -> Arc<GenerationLink> {
let link = Arc::new(GenerationLink {
device: MadeOn::new(device.clone()),
next: OnceLock::new(),
});
if device.shared().carry.link(&link) {
device.carry_late(|serving| {
link.carry(serving);
Ok::<(), Infallible>(())
});
}
link
}
/// Carry the handle to `to`, the generation this one's recovery made: `to`'s handle linked
/// after it, and this one let go of at the lost generation's rest. Nothing where it was
/// carried already.
fn carry(self: &Arc<Self>, to: &Device) {
if self.next.get().is_some() {
return;
}
if self.next.set(GenerationLink::kept(to)).is_err() {
// Another carry of it came first.
return;
}
let lost = Device::clone(&self.device);
let parts = Box::new(LostHandle(Arc::clone(self)));
lost.shared().carry.lost(lost.shared(), parts);
}
}
/// A [`LineDevice`]'s handle of a lost generation, let go of once none of the generation's command
/// buffers may record.
struct LostHandle(Arc<GenerationLink>);
impl LostParts for LostHandle {
fn release(self: Box<Self>) {
// SAFETY: its next link is set, so the object's device answers a later generation's handle
// (`LineDevice::generation`), and its own calls and checks go through its root handle: no
// reach of the object reads this handle any more.
unsafe { self.0.device.let_go() };
}
}
@@ -59,8 +59,8 @@ impl Device {
&self,
library: &Library,
) -> Result<DynamicLibrary, Error> {
if !library.device().same(self) {
return Err(library.device().foreign("new_dynamic_library", self));
if !library.root_device().same(self) {
return Err(library.root_device().foreign("new_dynamic_library", self));
}
self.dynamic_library(library.compile_library().clone())
}
+2 -2
View File
@@ -2132,8 +2132,8 @@ pub enum RuntimeGap {
/// 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, the depth/stencil states, the
/// libraries and their functions and the address pools (no generation's: they hold no Vulkan
/// object), the uses of guest RAM, the no-copy buffers (made again over the same pages), the `Private` buffers
/// libraries and their functions and the address pools (their handle of the device alone: they
/// hold 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
+21 -13
View File
@@ -5,10 +5,10 @@
//! "after this encoder's work" in the device's submission order, and a later encoder's
//! `wait_for_fence` becomes a barrier from that work's stages, or a wait for its `VkQueue` when
//! the update ran on another ([`tracker`](super::tracker)). A fence has no Vulkan object: it is
//! an identity the tracker keys on. 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 fence does, an
//! encoder of any generation updating and waiting for it, its updates on a lost generation
//! gone with that generation's work.
//! an identity the tracker keys on. So it goes on past the device's recovery as Metal's fence
//! does, the recovery carrying its handle of the device alone (`device/carry.rs`'s
//! `LineDevice`): an encoder of any generation updates and waits for it, its updates on a lost
//! generation gone with that generation's work.
//! - **Resource barriers** order dispatches of one compute encoder: one global memory barrier,
//! as for a scope barrier.
//! - **A render encoder's** fences order the render stages its calls name, as the M3 Max's do
@@ -72,6 +72,7 @@
use super::blit::BlitCommandEncoder;
use super::compute::ComputeCommandEncoder;
use super::device::carry::LineDevice;
use super::device::{lock, Device};
use super::encoder::EncoderCore;
use super::error::Error;
@@ -93,8 +94,9 @@ use std::sync::{Arc, Mutex};
pub struct Fence(Arc<FenceShared>);
struct FenceShared {
/// A root handle of the device (`device/line.rs`): of whatever generation serves.
device: Device,
/// The device: its root handle, which the encoders' checks match by its line, and the
/// generation handle `device` answers.
device: LineDevice,
key: ResourceKey,
label: Mutex<Option<String>>,
}
@@ -128,10 +130,10 @@ impl Device {
}
/// [`Device::new_fence`] on the generation that serves (`device/line.rs`): a fence of the
/// device whatever generation serves, which holds none (the module docs).
/// device whatever generation serves (the module docs).
pub(crate) fn new_fence_now(&self) -> Fence {
Fence(Arc::new(FenceShared {
device: self.root(),
device: LineDevice::new(self),
key: ResourceKey::new(),
label: Mutex::new(None),
}))
@@ -139,10 +141,16 @@ impl Device {
}
impl Fence {
/// `device`: a root handle, whose calls go to the generation that serves, as the fence is no
/// generation's (the module docs).
/// `device`: a generation handle of the device: of the generation the fence was made on, then of
/// each one the device's recoveries carried the fence to. A handle taken of it keeps meaning that
/// generation: its raw handles are that generation's `VkDevice`'s, kept alive while held.
pub fn device(&self) -> &Device {
&self.0.device
self.0.device.generation()
}
/// A root handle of the fence's device, which an encoder of any of its generations matches.
pub(super) fn root_device(&self) -> &Device {
self.0.device.root()
}
/// `setLabel:`.
@@ -170,7 +178,7 @@ impl EncoderCore {
fence: &Fence,
draws: Option<vk::PipelineStageFlags2>,
) -> Result<(), Error> {
self.check_device(call, fence.device())?;
self.check_device(call, fence.root_device())?;
self.uses().update_fence(fence.0.key, draws);
Ok(())
}
@@ -185,7 +193,7 @@ impl EncoderCore {
fence: &Fence,
draws: Option<vk::PipelineStageFlags2>,
) -> Result<(), Error> {
self.check_device(call, fence.device())?;
self.check_device(call, fence.root_device())?;
self.uses().wait_for_fence(fence.0.key, draws);
// Metal shows the work the wait orders after it the bytes the update's writer left, so
// no shadowed texture's image is carried on (`shadow::ShadowCarry`).
@@ -195,8 +195,10 @@ impl Maker {
/// link in `functions` or `binary_functions`. A function of another device is refused
/// (`Invalid(ForeignObject)`).
fn function_handle(self, function: &Function) -> Result<Option<FunctionHandle>, Error> {
if !function.device().same(self.device()) {
return Err(function.device().foreign("function_handle", self.device()));
if !function.root_device().same(self.device()) {
return Err(function
.root_device()
.foreign("function_handle", self.device()));
}
let handle = self
.linked_functions()
+28 -12
View File
@@ -9,10 +9,11 @@
//! it with, as its stage or as a function the stage links ([`Function::linked_function`],
//! `MTLLinkedFunctions`), and the options it was made with (`newFunctionWithDescriptor:`): one
//! compiled to a binary is what Metal takes in a stage's `binaryFunctions` and adds to a made
//! pipeline state. A library and its functions hold no Vulkan object, so they are no generation's
//! (`device/line.rs`): they hold a root handle of their device and go on past the device's
//! recovery, as Metal's do.
//! pipeline state. A library and its functions hold no Vulkan object, so they go on past the
//! device's recovery, as Metal's do, the recovery carrying their handle of the device alone
//! (`device/carry.rs`'s `LineDevice`), which a library's functions share.
use super::device::carry::LineDevice;
use super::device::device_error;
use super::error::{invalid, Problem, RuntimeGap};
use super::Device;
@@ -33,8 +34,9 @@ use std::sync::{Arc, Mutex};
/// A Metal library (`MTLLibrary`). Cheap to clone; `Send + Sync`.
#[derive(Clone, Debug)]
pub struct Library {
/// A root handle of the device (`device/line.rs`): of whatever generation serves.
device: Device,
/// The device: its root handle, which the checks of the calls that take the library match
/// by its line, and the generation handle `device` answers.
device: LineDevice,
library: metal2vulkan::library::Library,
/// What the library holds of the sampler IDs its functions' pipeline states numbered, shared
/// with every live library of the same content (`resource_ids/numbered.rs`).
@@ -56,8 +58,8 @@ pub struct Library {
/// Cheap to clone; `Send + Sync`.
#[derive(Clone, Debug)]
pub struct Function {
/// A root handle of the device (`device/line.rs`), its library's.
device: Device,
/// The device, its library's.
device: LineDevice,
function: metal2vulkan::library::Function,
constants: FunctionConstantValues,
/// Whether the function was made with constant values (`newFunctionWithName:constantValues:`),
@@ -196,7 +198,7 @@ impl Device {
) -> Library {
let holds = LibraryHolds::of(&self.shared().resource_ids, *library.content_hash());
Library {
device: self.root(),
device: LineDevice::new(self),
library,
holds,
reflections: Arc::default(),
@@ -205,9 +207,16 @@ impl Device {
}
impl Library {
/// `device`: a root handle, whose calls go to the generation that serves (the module docs).
/// `device`: a generation handle of the device: of the generation the library was made on, then of
/// each one the device's recoveries carried the library to. A handle taken of it keeps meaning that
/// generation: its raw handles are that generation's `VkDevice`'s, kept alive while held.
pub fn device(&self) -> &Device {
&self.device
self.device.generation()
}
/// A root handle of the library's device, which the calls that take it match by its line.
pub(crate) fn root_device(&self) -> &Device {
self.device.root()
}
/// `functionNames`, in the library's table order. A Core Image kernel library's extern
@@ -413,9 +422,16 @@ impl Library {
}
impl Function {
/// `device`: a root handle, whose calls go to the generation that serves (the module docs).
/// `device`: a generation handle of the device: of the generation its library was made on, then of
/// each one the device's recoveries carried its library to. A handle taken of it keeps meaning that
/// generation: its raw handles are that generation's `VkDevice`'s, kept alive while held.
pub fn device(&self) -> &Device {
&self.device
self.device.generation()
}
/// A root handle of the function's device, which the calls that take it match by its line.
pub(crate) fn root_device(&self) -> &Device {
self.device.root()
}
/// `name`: the specialized name a [`FunctionDescriptor`] made the function with, else the
@@ -482,8 +482,8 @@ fn added(
};
let mut descriptor = descriptor.clone();
for function in functions {
if !function.device().same(device) {
return Err(function.device().foreign(call, device));
if !function.root_device().same(device) {
return Err(function.root_device().foreign(call, device));
}
let linked = function.linked_function();
if !linked.precompiled {
@@ -543,8 +543,8 @@ fn added_counting(
/// of another device.
fn ignored(device: &Device, call: &'static str, functions: &[Function]) -> Result<(), Error> {
for function in functions {
if !function.device().same(device) {
return Err(function.device().foreign(call, device));
if !function.root_device().same(device) {
return Err(function.root_device().foreign(call, device));
}
}
Ok(())
@@ -600,9 +600,9 @@ impl Device {
function: &Function,
options: &PipelineOptions,
) -> Result<ComputePipelineState, Error> {
if !function.device().same(self) {
if !function.root_device().same(self) {
return Err(function
.device()
.root_device()
.foreign("new_compute_pipeline_state_with_function", self));
}
self.new_compute_pipeline_state_now(
@@ -722,8 +722,8 @@ impl Device {
function: &Function,
options: &PipelineOptions,
) -> Result<(ComputePipelineState, Option<ComputePipelineReflection>), Error> {
if !function.device().same(self) {
return Err(function.device().foreign(
if !function.root_device().same(self) {
return Err(function.root_device().foreign(
"new_compute_pipeline_state_with_function_and_reflection",
self,
));
+1 -1
View File
@@ -3574,7 +3574,7 @@ impl RenderLowering {
});
if let Some(state) = state {
self.core
.check_device("set_depth_stencil_state", state.device())?;
.check_device("set_depth_stencil_state", state.root_device())?;
}
// One boolean: a pass that sets one but draws under none keeps a depth's signs.
self.depth_writes |= state.is_some_and(|s| s.descriptor().depth_write_enabled);
@@ -278,7 +278,7 @@ impl CallChecks {
C::DepthStencilState(held) => {
let state = held.map(|held| log.depth_stencil(held));
if let Some(state) = state {
check_device(device, "set_depth_stencil_state", state.device())?;
check_device(device, "set_depth_stencil_state", state.root_device())?;
}
self.state.set_depth_stencil(state);
Ok(Checked::Logged)
@@ -371,9 +371,9 @@ impl ResourceStateCommandEncoder {
/// Refused (`Invalid`): a fence of another device.
pub fn update_fence(&mut self, fence: &Fence) -> Result<(), Error> {
let _for = self.open.command_buffer.notices_for();
if !fence.device().same(self.open.command_buffer.device()) {
if !fence.root_device().same(self.open.command_buffer.device()) {
return Err(fence
.device()
.root_device()
.foreign("update_fence", self.open.command_buffer.device()));
}
let key = fence.key();
@@ -393,9 +393,9 @@ impl ResourceStateCommandEncoder {
pub fn wait_for_fence(&mut self, fence: &Fence) -> Result<(), Error> {
let _for = self.open.command_buffer.notices_for();
const CALL: &str = "wait_for_fence";
if !fence.device().same(self.open.command_buffer.device()) {
if !fence.root_device().same(self.open.command_buffer.device()) {
return Err(fence
.device()
.root_device()
.foreign(CALL, self.open.command_buffer.device()));
}
let key = fence.key();