class PaperRenderer

Defined at line 73 of file ../../src/ui/lib/escher/paper/paper_renderer.h

PaperRenderer knows how to render PaperDrawables to an output framebuffer.

Clients configure the renderer's behavior by setting a config object.

Public Methods

PaperRendererPtr New (EscherWeakPtr escher, const PaperRendererConfig & config)

Defined at line 41 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void ~PaperRenderer ()

Defined at line 66 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

const VulkanContext & vulkan_context ()

Defined at line 80 of file ../../src/ui/lib/escher/paper/paper_renderer.h

Escher * escher ()

Defined at line 82 of file ../../src/ui/lib/escher/paper/paper_renderer.h

EscherWeakPtr GetEscherWeakPtr ()

Defined at line 83 of file ../../src/ui/lib/escher/paper/paper_renderer.h

const PaperRendererConfig & config ()

Defined at line 88 of file ../../src/ui/lib/escher/paper/paper_renderer.h

void EndFrame (SemaphorePtr upload_wait_semaphore)

Defined at line 132 of file ../../src/ui/lib/escher/paper/paper_renderer.h

void SetConfig (const PaperRendererConfig & config)

Set configuration parameters which affect how the renderer will render subsequent frames. Must

not be called during a frame, i.e. between |BeginFrame()| and |EndFrame()|.

Defined at line 139 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

PaperTransformStack * transform_stack ()

Return the transform stack, which affects the transform and clipping that

is applied to subsequently-drawn |PaperDrawables|.

Defined at line 141 of file ../../src/ui/lib/escher/paper/paper_renderer.h

PaperDrawCallFactory * draw_call_factory ()

TODO(https://fxbug.dev/42152434) - We will remove this once PaperDrawCallFactory becomes

injectable. We should never have to access this directly from the

renderer - it should be completely opaque.

Defined at line 172 of file ../../src/ui/lib/escher/paper/paper_renderer.h

bool SupportsShadowType (PaperRendererShadowType shadow_type)

Does the renderer support the specified shadow type?

Defined at line 194 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void BeginFrame (const FramePtr & frame, std::shared_ptr<BatchGpuUploader> uploader, const PaperScenePtr & scene, const std::vector<Camera> & cameras, const escher::ImagePtr & output_image)

Configures the renderer to render a frame into |output_image|. The

renderer configures its sub-components to render the frame based on the

|scene| and |camera| parameters, along with the configuration params

previously set by |SetConfig()|.

|PaperScene| describes aspects of the scene that affect the appearance of

scene object (e.g. lighting parameters), but does not provide the list of

scene objects to be rendered. To render the scene, clients should follow

these steps:

- |BeginFrame()|

- |Draw()| each object in the scene.

- |FinalizeFrame()|

- |EndFrame()| emits the Vulkan commands that actually render the scene.

Multiple cameras are supported, each rendering into its own viewport.

However, the position of the first camera is the one used for depth-sorting

the scene contents. For use-cases such as stereo rendering this is not a

problem, however there can be problems with e.g. translucent objects if two

cameras have dramatically different positions.

Defined at line 199 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void FinalizeFrame ()

After calling |FinalizeFrame()|:

- No more upload requests will be made for this frame. Therefore, it is safe for the

client to call |BatchGpuUploader::Submit()| on the uploader that was passed to

|BeginFrame()|.

- It is illegal to make any additional draw calls.

Defined at line 250 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void EndFrame (const std::vector<SemaphorePtr> & upload_wait_semaphores)

See |BeginFrame()|. After telling the renderer to draw the scene content,

|EndFrame()| emits commands into a Vulkan command buffer. Submitting this

command buffer causes the scene to be rendered into |output_image|.

The layout of |output_image| should be initialized to its swapchain layout

(or scheduled to be initialized by the time we submit te commands) before

we call this method.

Defined at line 285 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void Draw (PaperDrawable * drawable, PaperDrawableFlags flags)

Invokes DrawInScene() on the drawable object to generate and enqueue the

draw-calls that be transformed into Vulkan commands during EndFrame().

Defined at line 394 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawCircle (float radius, const PaperMaterialPtr & material, PaperDrawableFlags flags)

Draw predefined shapes: circles, rectangles, and rounded-rectangles.

Generates and enqueues draw-calls that will emit Vulkan commands during

EndFrame().

Defined at line 407 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawRect (vec2 min, vec2 max, const PaperMaterialPtr & material, PaperDrawableFlags flags)

Defined at line 420 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawRect (float width, float height, const PaperMaterialPtr & material, PaperDrawableFlags flags)

Convenience function for the above DrawRect function that takes in the width/ height

of the rect and centers it at (0,0).

Defined at line 434 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawRoundedRect (const RoundedRectSpec & spec, const PaperMaterialPtr & material, PaperDrawableFlags flags)

Defined at line 440 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawBoundingBox (const BoundingBox & box, const PaperMaterialPtr & material, PaperDrawableFlags flags)

Defined at line 453 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawMesh (const MeshPtr & mesh, const PaperMaterialPtr & material, PaperDrawableFlags flags)

Defined at line 475 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawDebugText (std::string text, vk::Offset2D offset, int32_t scale)

Draws debug text on top of output image.

Defined at line 325 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawVLine (DebugRects::Color kColor, uint32_t x_coord, int32_t y_start, uint32_t y_end, uint32_t thickness)

Draws vertical line to the output image. The entire line will be to the right of |x_coord|.

Defined at line 334 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void DrawHLine (DebugRects::Color kColor, int32_t y_coord, int32_t x_start, uint32_t x_end, int32_t thickness)

Draws horizontal line to the output image. The entire line will be below |y_coord|.

Defined at line 354 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

void WarmPipelineAndRenderPassCaches (Escher * escher, const PaperRendererConfig & config, vk::Format output_format, vk::ImageLayout output_swapchain_layout, const std::vector<SamplerPtr> & immutable_samplers, bool use_protected_memory)

Populate caches with all render passes and pipelines required by |config|.

Defined at line 825 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

vk::DeviceSize GetTransientImageMemoryCommitment ()

Compute the sum total memory commitment of all transient depth-stencil and MSAA images. Only

count those images which are intended to be transient.

Defined at line 986 of file ../../src/ui/lib/escher/paper/paper_renderer.cc

Records

Friends

class PaperRendererTest