mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 14:56:42 +00:00
Panic with message if empty data buffer
This commit is contained in:
parent
9229acb069
commit
1768891c33
@ -124,12 +124,16 @@ impl<T> CpuAccessibleBuffer<T> {
|
||||
impl<T> CpuAccessibleBuffer<[T]> {
|
||||
/// Builds a new buffer that contains an array `T`. The initial data comes from an iterator
|
||||
/// that produces that list of Ts.
|
||||
/// # Panics
|
||||
/// Panics if the initial data is empty.
|
||||
pub fn from_iter<'a, I, Q>(device: Arc<Device>, usage: BufferUsage, queue_families: Q, data: I)
|
||||
-> Result<Arc<CpuAccessibleBuffer<[T]>>, OomError>
|
||||
where I: ExactSizeIterator<Item = T>,
|
||||
T: Content + 'static,
|
||||
Q: IntoIterator<Item = QueueFamily<'a>>
|
||||
{
|
||||
assert_neq!(data.len(), 0, "Tried to create buffer from empty iterator.");
|
||||
|
||||
unsafe {
|
||||
let uninitialized = try!(
|
||||
CpuAccessibleBuffer::uninitialized_array(device, data.len(), usage, queue_families)
|
||||
|
Loading…
Reference in New Issue
Block a user