[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.
This commit is contained in:
teoxoy 2024-08-21 12:37:31 +02:00 committed by Teodor Tanasoaia
parent 43f6279605
commit e25051ec8f
2 changed files with 7 additions and 7 deletions

View File

@ -85,7 +85,7 @@ impl super::Device {
}
.into_device_result("Zero buffer creation")?;
let zero_buffer = zero_buffer.ok_or(crate::DeviceError::ResourceCreationFailed)?;
let zero_buffer = zero_buffer.ok_or(crate::DeviceError::Unexpected)?;
// Note: without `D3D12_HEAP_FLAG_CREATE_NOT_ZEROED`
// this resource is zeroed by default.
@ -114,7 +114,7 @@ impl super::Device {
)
}
.into_device_result("Command signature creation")?;
signature.ok_or(crate::DeviceError::ResourceCreationFailed)
signature.ok_or(crate::DeviceError::Unexpected)
}
let shared = super::DeviceShared {
@ -1637,7 +1637,7 @@ impl crate::Device for super::Device {
}
.into_device_result("Query heap creation")?;
let raw = raw.ok_or(crate::DeviceError::ResourceCreationFailed)?;
let raw = raw.ok_or(crate::DeviceError::Unexpected)?;
if let Some(label) = desc.label {
unsafe { raw.SetName(&windows::core::HSTRING::from(label)) }

View File

@ -94,7 +94,7 @@ pub(crate) fn create_buffer_resource(
}
.into_device_result("Placed buffer creation")?;
let resource = resource.ok_or(crate::DeviceError::ResourceCreationFailed)?;
let resource = resource.ok_or(crate::DeviceError::Unexpected)?;
device
.counters
@ -141,7 +141,7 @@ pub(crate) fn create_texture_resource(
}
.into_device_result("Placed texture creation")?;
let resource = resource.ok_or(crate::DeviceError::ResourceCreationFailed)?;
let resource = resource.ok_or(crate::DeviceError::Unexpected)?;
device
.counters
@ -265,7 +265,7 @@ pub(crate) fn create_committed_buffer_resource(
}
.into_device_result("Committed buffer creation")?;
resource.ok_or(crate::DeviceError::ResourceCreationFailed)
resource.ok_or(crate::DeviceError::Unexpected)
}
pub(crate) fn create_committed_texture_resource(
@ -302,5 +302,5 @@ pub(crate) fn create_committed_texture_resource(
}
.into_device_result("Committed texture creation")?;
resource.ok_or(crate::DeviceError::ResourceCreationFailed)
resource.ok_or(crate::DeviceError::Unexpected)
}