mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Add len method to IndexBuffer (#2342)
* ### Additions - `IndexBuffer::len` method. * Fixed formatting
This commit is contained in:
parent
56b051c954
commit
c24c7ad155
@ -672,7 +672,7 @@ impl BufferState {
|
|||||||
gpu_reads: 0,
|
gpu_reads: 0,
|
||||||
} => (),
|
} => (),
|
||||||
CurrentAccess::Shared { cpu_reads, .. } if *cpu_reads > 0 => {
|
CurrentAccess::Shared { cpu_reads, .. } if *cpu_reads > 0 => {
|
||||||
return Err(AccessConflict::HostRead)
|
return Err(AccessConflict::HostRead);
|
||||||
}
|
}
|
||||||
CurrentAccess::Shared { .. } => return Err(AccessConflict::DeviceRead),
|
CurrentAccess::Shared { .. } => return Err(AccessConflict::DeviceRead),
|
||||||
}
|
}
|
||||||
@ -1014,6 +1014,16 @@ impl IndexBuffer {
|
|||||||
IndexBuffer::U32(buffer) => buffer.as_bytes(),
|
IndexBuffer::U32(buffer) => buffer.as_bytes(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the number of elements in the buffer.
|
||||||
|
#[inline]
|
||||||
|
pub fn len(&self) -> DeviceSize {
|
||||||
|
match self {
|
||||||
|
IndexBuffer::U8(buffer) => buffer.len(),
|
||||||
|
IndexBuffer::U16(buffer) => buffer.len(),
|
||||||
|
IndexBuffer::U32(buffer) => buffer.len(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Subbuffer<[u8]>> for IndexBuffer {
|
impl From<Subbuffer<[u8]>> for IndexBuffer {
|
||||||
|
Loading…
Reference in New Issue
Block a user