class CommandBuffer
Defined at line 37 of file ../../src/ui/lib/escher/impl/command_buffer.h
CommandBuffer is a wrapper around vk::CommandBuffer. Vulkan forbids the
client application from destroying any resources while they are used by
any "pending command buffers" (i.e. those that have not finished executing
on the GPU).
CommandBuffers are obtained from a CommandBufferPool, and is automatically
returned to it when all GPU-work is finished.
Not thread-safe.
TODO(https://fxbug.dev/42151081): RenderPass and Framebuffer are deprecated, to be replaced by
impl::RenderPass and impl::Framebuffer. The latter two aren't visible to
Escher clients; they are an implementation detail of escher::CommandBuffer
(NOTE: NOT escher::impl::CommandBuffer, which is also deprecated).
Public Methods
void ~CommandBuffer ()
Defined at line 27 of file ../../src/ui/lib/escher/impl/command_buffer.cc
vk::CommandBuffer vk ()
Defined at line 41 of file ../../src/ui/lib/escher/impl/command_buffer.h
bool Submit (vk::Queue queue, CommandBufferFinishedCallback callback)
Return true if successful. The callback will be invoked after all commands
have finished executing on the GPU (there is no guarantee about how long
afterward: this depends on when the CommandBufferPool that owns this buffer
calls Retire()).
Defined at line 42 of file ../../src/ui/lib/escher/impl/command_buffer.cc
template <typename ResourceT>
void KeepAlive (const fxl::RefPtr<ResourceT> & ptr)
Defined at line 65 of file ../../src/ui/lib/escher/impl/command_buffer.h
void AddWaitSemaphore (SemaphorePtr semaphore, vk::PipelineStageFlags stage)
During Submit(), these semaphores will be added to the vk::SubmitInfo.
No-op if semaphore is null.
Defined at line 84 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void AddSignalSemaphore (SemaphorePtr semaphore)
During Submit(), these semaphores will be added to the vk::SubmitInfo.
No-op if semaphore is null.
Defined at line 95 of file ../../src/ui/lib/escher/impl/command_buffer.cc
bool ContainsSignalSemaphore (const SemaphorePtr & semaphore)
Checks to see if the provided semaphore is part of the command buffer's vector
of signal semaphores.
Defined at line 105 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void KeepAlive (const Resource * resource)
These resources will be retained until the command-buffer is finished
running on the GPU.
Defined at line 110 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void CopyImage (const ImagePtr &src_image,const ImagePtr &dst_image,vk::ImageLayoutsrc_layout,vk::ImageLayoutdst_layout,vk::ImageCopy *region)
Copy pixels from one image to another. No image barriers or other
synchronization is used. Retain both images in used_resources.
Defined at line 120 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void CopyBuffer (const BufferPtr &src,const BufferPtr &dst,vk::BufferCopyregion)
Copy memory from one buffer to another.
Defined at line 132 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void CopyBufferAfterBarrier (const BufferPtr &src,const BufferPtr &dst,vk::BufferCopyregion,vk::AccessFlagssrc_access_mask,vk::PipelineStageFlagssrc_stage_mask)
Copy the specified region of |src| into |dst| after inserting a
memory-barrier to use the memory on the same queue (i.e. the barrier's
queue family indices are VK_QUEUE_FAMILY_IGNORED).
Defined at line 144 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void TransitionImageLayout (const ImagePtr &image,vk::ImageLayoutold_layout,vk::ImageLayoutnew_layout,uint32_tsrc_queue_family_index,uint32_tdst_queue_family_index)
TODO(https://fxbug.dev/42117363): Move this function out to a separated utility function, rather
than part of impl::CommandBuffer.
Defined at line 162 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void BeginRenderPass (const escher::RenderPassPtr &render_pass,const escher::FramebufferPtr &framebuffer,const std::vector<vk::ClearValue> &clear_values,const vk::Rect2Dviewport)
Convenient way to begin a render-pass that renders to the whole framebuffer
(i.e. width/height of viewport and scissors are obtained from framebuffer).
Defined at line 299 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void BeginRenderPass (vk::RenderPassrender_pass,const escher::FramebufferPtr &framebuffer,const std::vector<vk::ClearValue> &clear_values,const vk::Rect2Dviewport)
Defined at line 308 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void BeginRenderPass (vk::RenderPassrender_pass,const escher::FramebufferPtr &framebuffer,const vk::ClearValue *clear_values,size_tclear_value_count,const vk::Rect2Dviewport)
Defined at line 315 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void EndRenderPass ()
Simple wrapper around endRenderPass().
Defined at line 349 of file ../../src/ui/lib/escher/impl/command_buffer.cc
vk::Result Wait (uint64_t timeout_nanoseconds)
Block until the command-buffer is no longer pending, or the specified
number of nanoseconds has elapsed. Return vk::Result::eSuccess in the
former case, and vk::Result::eTimeout in the latter.
Defined at line 75 of file ../../src/ui/lib/escher/impl/command_buffer.cc
uint64_t sequence_number ()
Each CommandBuffer that is obtained from a CommandBufferPool is given a
monotonically-increasing sequence number. This number is globally unique
(per Escher instance), even across multiple CommandBufferPools.
Defined at line 113 of file ../../src/ui/lib/escher/impl/command_buffer.h
size_t NumWaitSemaphores ()
Defined at line 115 of file ../../src/ui/lib/escher/impl/command_buffer.h
size_t NumSignalSemaphores ()
Defined at line 116 of file ../../src/ui/lib/escher/impl/command_buffer.h
bool use_protected_memory ()
Defined at line 117 of file ../../src/ui/lib/escher/impl/command_buffer.h
Friends
class CommandBufferPool