class CommandBuffer
Defined at line 38 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 29 of file ../../src/ui/lib/escher/impl/command_buffer.cc
vk::CommandBuffer vk ()
Defined at line 42 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 44 of file ../../src/ui/lib/escher/impl/command_buffer.cc
template <typename ResourceT>
void KeepAlive (const fxl::RefPtr<ResourceT> & ptr)
Defined at line 66 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 86 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 97 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 107 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 112 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void CopyImage (const ImagePtr & src_image, const ImagePtr & dst_image, vk::ImageLayout src_layout, vk::ImageLayout dst_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 122 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void CopyBuffer (const BufferPtr & src, const BufferPtr & dst, vk::BufferCopy region)
Copy memory from one buffer to another.
Defined at line 134 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void CopyBufferAfterBarrier (const BufferPtr & src, const BufferPtr & dst, vk::BufferCopy region, vk::AccessFlags src_access_mask, vk::PipelineStageFlags src_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 146 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void TransitionImageLayout (const ImagePtr & image, vk::ImageLayout old_layout, vk::ImageLayout new_layout, uint32_t src_queue_family_index, uint32_t dst_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 164 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::Rect2D viewport)
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 301 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void BeginRenderPass (vk::RenderPass render_pass, const escher::FramebufferPtr & framebuffer, const std::vector<vk::ClearValue> & clear_values, const vk::Rect2D viewport)
Defined at line 310 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void BeginRenderPass (vk::RenderPass render_pass, const escher::FramebufferPtr & framebuffer, const vk::ClearValue * clear_values, size_t clear_value_count, const vk::Rect2D viewport)
Defined at line 317 of file ../../src/ui/lib/escher/impl/command_buffer.cc
void EndRenderPass ()
Simple wrapper around endRenderPass().
Defined at line 351 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 77 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 114 of file ../../src/ui/lib/escher/impl/command_buffer.h
size_t NumWaitSemaphores ()
Defined at line 116 of file ../../src/ui/lib/escher/impl/command_buffer.h
size_t NumSignalSemaphores ()
Defined at line 117 of file ../../src/ui/lib/escher/impl/command_buffer.h
bool use_protected_memory ()
Defined at line 118 of file ../../src/ui/lib/escher/impl/command_buffer.h
Friends
class CommandBufferPool