mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
[dx12] Return OOM error when GetResourceAllocationInfo() returns SizeInBytes == 0
Some versions of WARP return an allocation info with SizeInBytes == 0 for very large allocations. Proceeding to attempt to allocate a zero- sized resource results in a device lost error. It's preferable to instead return an out of memory error.
This commit is contained in:
parent
aeb2c3e6c7
commit
ad4286102a
@ -566,6 +566,14 @@ impl<'a> DeviceAllocationContext<'a> {
|
||||
.GetResourceAllocationInfo(0, core::slice::from_ref(desc))
|
||||
};
|
||||
|
||||
// Some versions of WARP return SizeInBytes == 0 for very large
|
||||
// allocations. Proceeding to attempt to allocate a zero-sized resource
|
||||
// will result in a device lost error, so it seems preferable to return
|
||||
// an out of memory error now.
|
||||
if allocation_info.SizeInBytes == 0 {
|
||||
return Err(crate::DeviceError::OutOfMemory);
|
||||
}
|
||||
|
||||
let Some(threshold) = self
|
||||
.mem_allocator
|
||||
.memory_budget_thresholds
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user