NewBuffer makes a buffer in pool, setting Buff to point to it if Buff == nil, returning the buffer.
(dv *Device)
| 47 | // NewBuffer makes a buffer in pool, setting Buff to point to it |
| 48 | // if Buff == nil, returning the buffer. |
| 49 | func (cp *CmdPool) NewBuffer(dv *Device) vk.CommandBuffer { |
| 50 | var cmdBuff = make([]vk.CommandBuffer, 1) |
| 51 | ret := vk.AllocateCommandBuffers(dv.Device, &vk.CommandBufferAllocateInfo{ |
| 52 | SType: vk.StructureTypeCommandBufferAllocateInfo, |
| 53 | CommandPool: cp.Pool, |
| 54 | Level: vk.CommandBufferLevelPrimary, |
| 55 | CommandBufferCount: 1, |
| 56 | }, cmdBuff) |
| 57 | IfPanic(NewError(ret)) |
| 58 | cBuff := cmdBuff[0] |
| 59 | if cp.Buff == nil { |
| 60 | cp.Buff = cBuff |
| 61 | } |
| 62 | return cBuff |
| 63 | } |
| 64 | |
| 65 | // BeginCmd does BeginCommandBuffer on buffer |
| 66 | func (cp *CmdPool) BeginCmd() vk.CommandBuffer { |
no test coverage detected