(&self, count: usize)
| 517 | } |
| 518 | |
| 519 | fn alloc_output(&self, count: usize) -> MappedBuffer { |
| 520 | let bytes = (count * 4) as u64; |
| 521 | let key = BufferPool::bucket(bytes); |
| 522 | let mut pool = self.buffer_pool.lock().unwrap(); |
| 523 | if let Some(bufs) = pool.free.get_mut(&key) { |
| 524 | if let Some(buf) = bufs.pop() { |
| 525 | return buf; |
| 526 | } |
| 527 | } |
| 528 | drop(pool); |
| 529 | let mut alloc_guard = self.allocator.lock().unwrap(); |
| 530 | let alloc = alloc_guard.as_mut().unwrap(); |
| 531 | Self::alloc_mapped_buffer( |
| 532 | &self.vk_device, |
| 533 | alloc, |
| 534 | key, |
| 535 | vk::BufferUsageFlags::STORAGE_BUFFER, |
| 536 | self.uma_memory_type, |
| 537 | ) |
| 538 | .expect("failed to allocate output buffer") |
| 539 | } |
| 540 | |
| 541 | fn release_output(&self, buf: MappedBuffer) { |
| 542 | let key = BufferPool::bucket(buf.size); |
no outgoing calls
no test coverage detected