class RenderQueue
Defined at line 23 of file ../../src/ui/lib/escher/renderer/render_queue.h
RenderQueue provides an abstraction to allow renderable objects of different
types to be sorted according to a uniform criterion before emitting commands
into a Vulkan command buffer. Client use of RenderQueue typically follows
these steps:
- call Push() repeatedly to add all renderable objects to the queue.
- call Sort() once to sort the items according to their integer sort key.
- call GenerateCommands() once to add Vulkan commands to a command buffer.
- call clear() to clear all items, preparing the queue to be used next frame.
See the method documentation for additional details.
Protected Members
vector items_
Public Methods
void RenderQueue ()
Defined at line 11 of file ../../src/ui/lib/escher/renderer/render_queue.cc
void RenderQueue (const RenderQueue & other)
Defined at line 26 of file ../../src/ui/lib/escher/renderer/render_queue.h
void RenderQueue (RenderQueue && other)
void ~RenderQueue ()
Defined at line 12 of file ../../src/ui/lib/escher/renderer/render_queue.cc
void Push (uint64_t sort_key, const void * object_data, const void * instance_data, RenderQueueItem::Func func)
Inline function definitions.
Defined at line 75 of file ../../src/ui/lib/escher/renderer/render_queue.h
void Push (const RenderQueueItem & item)
Defined at line 80 of file ../../src/ui/lib/escher/renderer/render_queue.h
void Sort ()
Performs a stable sort of all items, according to the |sort_key| provided
to Push(). Using a simple integer as the sort key allows clients a large
degree of flexibility in defining sort criteria. For example, translucent
objects must be sorted back-to-front after all opaque objects, whereas
opaque objects are more efficiently rendered front-to-back.
Defined at line 14 of file ../../src/ui/lib/escher/renderer/render_queue.cc
void GenerateCommands (CommandBuffer * cmd_buf, const CommandBuffer::SavedState * state, const RenderQueueContext * context)
Generate Vulkan commands for items in the queue, by iterating over the
items and invoking each item's RenderFunc on it. If multiple consecutive
items have the same |object_data|, they are batched into a single call to
RenderFunc; in this case the number of consecutive items is encoded in the
|instance_count|. Otherwise, |instance_count| == 1.
This is typically called after Sort(), but this is not necessary. For
example, clients may choose to not call Sort() in order to profile the
performance difference of sorting vs. not sorting.
Defined at line 20 of file ../../src/ui/lib/escher/renderer/render_queue.cc
void GenerateCommands (CommandBuffer * cmd_buf, const CommandBuffer::SavedState * state, const RenderQueueContext * context, size_t start_index, size_t count)
This variant of GenerateCommands() behaves similarly to the one above,
except that it only generates commands for a sub-range of the items in the
queue. This is typically used for debugging.
Defined at line 25 of file ../../src/ui/lib/escher/renderer/render_queue.cc
void clear ()
Defined at line 65 of file ../../src/ui/lib/escher/renderer/render_queue.h
size_t size ()
Defined at line 66 of file ../../src/ui/lib/escher/renderer/render_queue.h
bool empty ()
Defined at line 67 of file ../../src/ui/lib/escher/renderer/render_queue.h