mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 22:41:07 +01: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:
1 parent
aeb2c3e6c7
commit
ad4286102a
1 file changed
+8
@@ -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
|
||||
|
||||
Reference in new issue
Block a user