class RectangleCompositor
Defined at line 21 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.h
|RectangleCompositor| provides an interface for rendering axis-aligned rectangles in 2D space,
to support the implementation of the `fuchsia.ui.composition/Flatland` API.
It composites opaque and (premultiplied/straight) images to generate a premultiplied output
image.
Public Members
static Flags kRenderTargetUsageFlags
static Flags kTextureUsageFlags
Public Methods
void ~RectangleCompositor ()
Defined at line 44 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.h
void RectangleCompositor (EscherWeakPtr escher)
RectangleCompositor constructor. Initializes the shader program and allocates
GPU buffers to store mesh data.
Defined at line 262 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.cc
void DrawBatch (CommandBuffer *cmd_buf,const std::vector<Rectangle2D> &rectangles,const std::vector<TexturePtr> &textures,const std::vector<ColorData> &color_data,const ImagePtr &output_image,const TexturePtr &depth_buffer,boolapply_color_conversion)
Draws a single batch of renderables into the provided output image.
Parameters:
- cmd_buf: The command buffer used to record commands.
- rectangles: geometry to be drawn.
- textures: must be 1-1 with rectangles, to which they are textured onto.
- color_data: must be 1-1 with rectangles and textures.
|color| is multiply_color to the texture used in the shader.
|opacity| determines use of opaque or transparent rendering.
- output_image: the render target the renderables will be rendered into.
- depth_buffer: The depth texture to be used for z-buffering.
- apply_color_conversion: Does a color conversion pass over the rendered output
using the data set with |SetColorConversionParams|.
Depth is implicit. Renderables are drawn in the order they appear in the input
vector, with the first entry being the furthest back, and the last the closest.
Defined at line 271 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.cc
void SetColorConversionParams (const ColorConversionParams & color_conversion_params)
This data is used to apply a color-conversion post processing effect over the entire
rendered output, when making a call to |DrawBatch|. The color conversion formula
used is matrix * (color + preoffsets) + postoffsets.
Defined at line 357 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.cc
vk::ImageCreateInfo GetDefaultImageConstraints (const vk::Format & vk_format, vk::ImageUsageFlags usage)
Minimal image constraints to be set on textures and render targets passed into
DrawBatch. These are meant to also be compatible with AFBC
(Arm Framebuffer Compression).
Defined at line 406 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.cc
void WarmPipelineCache (vk::Formatoutput_format,vk::ImageLayoutoutput_swapchain_layout,vk::Formatdepth_format,const std::vector<SamplerPtr> &immutable_samplers,booluse_protected_memory)
Pre-generate and cache Vulkan render passes and pipelines at startup to avoid subsequent
jank at runtime: when DrawBatch() looks for the renderpasses and pipelines in their respective
caches, they will already be there.
WarmPipelineCache() may be called several times with different parameters to accommodate
e.g. different framebuffer formats and layouts.
Args:
- |output_format| Describes the target framebuffer.
- |output_swapchain_layout| Describes the target framebuffer.
- |depth_format| Describes the target framebuffer.
- |depth_swapchain_layout| Describes the target framebuffer.
- |immutable_samplers| Support various types of YUV video.
- |use_protected_memory| If true, allows rendering protected (and unprotected) content into
a protected framebuffer. If false, only unprotected content can be
rendered by the generated pipelines.
Defined at line 506 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.cc
Enumerations
enum class Opacity
| Name | Value |
|---|---|
| Opaque | 0 |
| Translucent | 1 |
| NonPremultipliedTranslucent | 2 |
Defined at line 26 of file ../../src/ui/lib/escher/flatland/rectangle_compositor.h