Skip to content

Commit e25051e

Browse files
committed
[d3d12] treat failure to populate references to resources as DeviceError::Unexpected
These are guaranteed to be populated if the creation methods didn't error. If they are not, the driver/runtime is at fault.
1 parent 43f6279 commit e25051e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

wgpu-hal/src/dx12/device.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl super::Device {
8585
}
8686
.into_device_result("Zero buffer creation")?;
8787

88-
let zero_buffer = zero_buffer.ok_or(crate::DeviceError::ResourceCreationFailed)?;
88+
let zero_buffer = zero_buffer.ok_or(crate::DeviceError::Unexpected)?;
8989

9090
// Note: without `D3D12_HEAP_FLAG_CREATE_NOT_ZEROED`
9191
// this resource is zeroed by default.
@@ -114,7 +114,7 @@ impl super::Device {
114114
)
115115
}
116116
.into_device_result("Command signature creation")?;
117-
signature.ok_or(crate::DeviceError::ResourceCreationFailed)
117+
signature.ok_or(crate::DeviceError::Unexpected)
118118
}
119119

120120
let shared = super::DeviceShared {
@@ -1637,7 +1637,7 @@ impl crate::Device for super::Device {
16371637
}
16381638
.into_device_result("Query heap creation")?;
16391639

1640-
let raw = raw.ok_or(crate::DeviceError::ResourceCreationFailed)?;
1640+
let raw = raw.ok_or(crate::DeviceError::Unexpected)?;
16411641

16421642
if let Some(label) = desc.label {
16431643
unsafe { raw.SetName(&windows::core::HSTRING::from(label)) }

wgpu-hal/src/dx12/suballocation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub(crate) fn create_buffer_resource(
9494
}
9595
.into_device_result("Placed buffer creation")?;
9696

97-
let resource = resource.ok_or(crate::DeviceError::ResourceCreationFailed)?;
97+
let resource = resource.ok_or(crate::DeviceError::Unexpected)?;
9898

9999
device
100100
.counters
@@ -141,7 +141,7 @@ pub(crate) fn create_texture_resource(
141141
}
142142
.into_device_result("Placed texture creation")?;
143143

144-
let resource = resource.ok_or(crate::DeviceError::ResourceCreationFailed)?;
144+
let resource = resource.ok_or(crate::DeviceError::Unexpected)?;
145145

146146
device
147147
.counters
@@ -265,7 +265,7 @@ pub(crate) fn create_committed_buffer_resource(
265265
}
266266
.into_device_result("Committed buffer creation")?;
267267

268-
resource.ok_or(crate::DeviceError::ResourceCreationFailed)
268+
resource.ok_or(crate::DeviceError::Unexpected)
269269
}
270270

271271
pub(crate) fn create_committed_texture_resource(
@@ -302,5 +302,5 @@ pub(crate) fn create_committed_texture_resource(
302302
}
303303
.into_device_result("Committed texture creation")?;
304304

305-
resource.ok_or(crate::DeviceError::ResourceCreationFailed)
305+
resource.ok_or(crate::DeviceError::Unexpected)
306306
}

0 commit comments

Comments
 (0)