Report more information when we panic due to an allocation failure
This commit is contained in:
parent
133d9f947b
commit
aeb0b42c7a
1 changed files with 7 additions and 1 deletions
|
@ -2,6 +2,7 @@ use crate::geometry::{
|
||||||
rect::RectI,
|
rect::RectI,
|
||||||
vector::{vec2i, Vector2I},
|
vector::{vec2i, Vector2I},
|
||||||
};
|
};
|
||||||
|
use anyhow::anyhow;
|
||||||
use etagere::BucketedAtlasAllocator;
|
use etagere::BucketedAtlasAllocator;
|
||||||
use foreign_types::ForeignType;
|
use foreign_types::ForeignType;
|
||||||
use metal::{Device, TextureDescriptor};
|
use metal::{Device, TextureDescriptor};
|
||||||
|
@ -48,7 +49,12 @@ impl AtlasAllocator {
|
||||||
.allocate(requested_size)
|
.allocate(requested_size)
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
let mut atlas = self.new_atlas(requested_size);
|
let mut atlas = self.new_atlas(requested_size);
|
||||||
let (id, origin) = atlas.allocate(requested_size).unwrap();
|
let (id, origin) = atlas
|
||||||
|
.allocate(requested_size)
|
||||||
|
.ok_or_else(|| {
|
||||||
|
anyhow!("could not allocate requested size {:?}", requested_size)
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
self.atlases.push(atlas);
|
self.atlases.push(atlas);
|
||||||
(id, origin)
|
(id, origin)
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue