Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
impeller::RecordingRenderPass Class Reference

#include <recording_render_pass.h>

Inheritance diagram for impeller::RecordingRenderPass:
impeller::RenderPass impeller::ResourceBinder

Public Member Functions

 RecordingRenderPass (std::shared_ptr< RenderPass > delegate, const std::shared_ptr< const Context > &context, const RenderTarget &render_target)
 
 ~RecordingRenderPass ()=default
 
const std::vector< Command > & GetCommands () const override
 Accessor for the current Commands.
 
void SetPipeline (const std::shared_ptr< Pipeline< PipelineDescriptor > > &pipeline) override
 The pipeline to use for this command.
 
void SetCommandLabel (std::string_view label) override
 The debugging label to use for the command.
 
void SetStencilReference (uint32_t value) override
 
void SetBaseVertex (uint64_t value) override
 
void SetViewport (Viewport viewport) override
 
void SetScissor (IRect scissor) override
 
void SetInstanceCount (size_t count) override
 
bool SetVertexBuffer (VertexBuffer buffer) override
 Specify the vertex and index buffer to use for this command.
 
fml::Status Draw () override
 Record the currently pending command.
 
bool BindResource (ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata &metadata, BufferView view) override
 
bool BindResource (ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const std::shared_ptr< const ShaderMetadata > &metadata, BufferView view) override
 
bool BindResource (ShaderStage stage, DescriptorType type, const SampledImageSlot &slot, const ShaderMetadata &metadata, std::shared_ptr< const Texture > texture, const std::unique_ptr< const Sampler > &sampler) override
 
void OnSetLabel (std::string label) override
 
bool OnEncodeCommands (const Context &context) const override
 
bool IsValid () const override
 
- Public Member Functions inherited from impeller::RenderPass
virtual ~RenderPass ()
 
const std::shared_ptr< const Context > & GetContext () const
 
const RenderTargetGetRenderTarget () const
 
ISize GetRenderTargetSize () const
 
const MatrixGetOrthographicTransform () const
 
void SetLabel (std::string label)
 
virtual void ReserveCommands (size_t command_count)
 Reserve [command_count] commands in the HAL command buffer.
 
bool EncodeCommands () const
 Encode the recorded commands to the underlying command buffer.
 
SampleCount GetSampleCount () const
 The sample count of the attached render target.
 
PixelFormat GetRenderTargetPixelFormat () const
 The pixel format of the attached render target.
 
bool HasDepthAttachment () const
 Whether the render target has a depth attachment.
 
bool HasStencilAttachment () const
 Whether the render target has an stencil attachment.
 
- Public Member Functions inherited from impeller::ResourceBinder
virtual ~ResourceBinder ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from impeller::RenderPass
bool AddCommand (Command &&command)
 Record a command for subsequent encoding to the underlying command buffer. No work is encoded into the command buffer at this time.
 
 RenderPass (std::shared_ptr< const Context > context, const RenderTarget &target)
 
- Protected Attributes inherited from impeller::RenderPass
const std::shared_ptr< const Contextcontext_
 
const SampleCount sample_count_
 
const PixelFormat pixel_format_
 
const bool has_depth_attachment_
 
const bool has_stencil_attachment_
 
const ISize render_target_size_
 
const RenderTarget render_target_
 
std::vector< Commandcommands_
 
const Matrix orthographic_
 

Detailed Description

Definition at line 12 of file recording_render_pass.h.

Constructor & Destructor Documentation

◆ RecordingRenderPass()

impeller::RecordingRenderPass::RecordingRenderPass ( std::shared_ptr< RenderPass delegate,
const std::shared_ptr< const Context > &  context,
const RenderTarget render_target 
)
explicit

Definition at line 11 of file recording_render_pass.cc.

15 : RenderPass(context, render_target), delegate_(std::move(delegate)) {}
RenderPass(std::shared_ptr< const Context > context, const RenderTarget &target)

◆ ~RecordingRenderPass()

impeller::RecordingRenderPass::~RecordingRenderPass ( )
default

Member Function Documentation

◆ BindResource() [1/3]

bool impeller::RecordingRenderPass::BindResource ( ShaderStage  stage,
DescriptorType  type,
const SampledImageSlot slot,
const ShaderMetadata metadata,
std::shared_ptr< const Texture texture,
const std::unique_ptr< const Sampler > &  sampler 
)
overridevirtual

Reimplemented from impeller::RenderPass.

Definition at line 135 of file recording_render_pass.cc.

141 {
142 pending_.BindResource(stage, type, slot, metadata, texture, sampler);
143 if (delegate_) {
144 return delegate_->BindResource(stage, type, slot, metadata, texture,
145 sampler);
146 }
147 return true;
148}
FlTexture * texture
bool BindResource(ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata &metadata, BufferView view) override
Definition command.cc:25

◆ BindResource() [2/3]

bool impeller::RecordingRenderPass::BindResource ( ShaderStage  stage,
DescriptorType  type,
const ShaderUniformSlot slot,
const ShaderMetadata metadata,
BufferView  view 
)
overridevirtual

Reimplemented from impeller::RenderPass.

Definition at line 108 of file recording_render_pass.cc.

112 {
113 pending_.BindResource(stage, type, slot, metadata, view);
114 if (delegate_) {
115 return delegate_->BindResource(stage, type, slot, metadata, view);
116 }
117 return true;
118}

◆ BindResource() [3/3]

bool impeller::RecordingRenderPass::BindResource ( ShaderStage  stage,
DescriptorType  type,
const ShaderUniformSlot slot,
const std::shared_ptr< const ShaderMetadata > &  metadata,
BufferView  view 
)
overridevirtual

Reimplemented from impeller::RenderPass.

Definition at line 121 of file recording_render_pass.cc.

126 {
127 pending_.BindResource(stage, type, slot, metadata, view);
128 if (delegate_) {
129 return delegate_->BindResource(stage, type, slot, metadata, view);
130 }
131 return true;
132}

◆ Draw()

fml::Status impeller::RecordingRenderPass::Draw ( )
overridevirtual

Record the currently pending command.

Reimplemented from impeller::RenderPass.

Definition at line 85 of file recording_render_pass.cc.

85 {
86 commands_.emplace_back(std::move(pending_));
87 pending_ = {};
88 if (delegate_) {
89 return delegate_->Draw();
90 }
91 return fml::Status();
92}

◆ GetCommands()

const std::vector< Command > & impeller::RecordingRenderPass::GetCommands ( ) const
inlineoverridevirtual

Accessor for the current Commands.

Visible for testing.

Reimplemented from impeller::RenderPass.

Definition at line 20 of file recording_render_pass.h.

20{ return commands_; }

◆ IsValid()

bool impeller::RecordingRenderPass::IsValid ( ) const
inlineoverridevirtual

Implements impeller::RenderPass.

Definition at line 77 of file recording_render_pass.h.

77{ return true; }

◆ OnEncodeCommands()

bool impeller::RecordingRenderPass::OnEncodeCommands ( const Context context) const
overridevirtual

Implements impeller::RenderPass.

Definition at line 100 of file recording_render_pass.cc.

100 {
101 if (delegate_) {
102 return delegate_->EncodeCommands();
103 }
104 return true;
105}

◆ OnSetLabel()

void impeller::RecordingRenderPass::OnSetLabel ( std::string  label)
overridevirtual

Implements impeller::RenderPass.

Definition at line 95 of file recording_render_pass.cc.

95 {
96 return;
97}

◆ SetBaseVertex()

void impeller::RecordingRenderPass::SetBaseVertex ( uint64_t  value)
overridevirtual

Reimplemented from impeller::RenderPass.

Definition at line 44 of file recording_render_pass.cc.

44 {
45 pending_.base_vertex = value;
46 if (delegate_) {
47 delegate_->SetBaseVertex(value);
48 }
49}
uint8_t value
uint64_t base_vertex
Definition command.h:126

◆ SetCommandLabel()

void impeller::RecordingRenderPass::SetCommandLabel ( std::string_view  label)
overridevirtual

The debugging label to use for the command.

Reimplemented from impeller::RenderPass.

Definition at line 26 of file recording_render_pass.cc.

26 {
27#ifdef IMPELLER_DEBUG
28 pending_.label = std::string(label);
29#endif // IMPELLER_DEBUG
30 if (delegate_) {
31 delegate_->SetCommandLabel(label);
32 }
33}

◆ SetInstanceCount()

void impeller::RecordingRenderPass::SetInstanceCount ( size_t  count)
overridevirtual

The number of instances of the given set of vertices to render. Not all backends support rendering more than one instance at a time.

Warning
Setting this to more than one will limit the availability of backends to use with this command.

Reimplemented from impeller::RenderPass.

Definition at line 68 of file recording_render_pass.cc.

68 {
69 pending_.instance_count = count;
70 if (delegate_) {
71 delegate_->SetInstanceCount(count);
72 }
73}
int count
size_t instance_count
Definition command.h:147

◆ SetPipeline()

void impeller::RecordingRenderPass::SetPipeline ( const std::shared_ptr< Pipeline< PipelineDescriptor > > &  pipeline)
overridevirtual

The pipeline to use for this command.

Reimplemented from impeller::RenderPass.

Definition at line 18 of file recording_render_pass.cc.

19 {
20 pending_.pipeline = pipeline;
21 if (delegate_) {
22 delegate_->SetPipeline(pipeline);
23 }
24}
std::shared_ptr< Pipeline< PipelineDescriptor > > pipeline
Definition command.h:96

◆ SetScissor()

void impeller::RecordingRenderPass::SetScissor ( IRect  scissor)
overridevirtual

The scissor rect to use for clipping writes to the render target. The scissor rect must lie entirely within the render target. If unset, no scissor is applied.

Reimplemented from impeller::RenderPass.

Definition at line 60 of file recording_render_pass.cc.

60 {
61 pending_.scissor = scissor;
62 if (delegate_) {
63 delegate_->SetScissor(scissor);
64 }
65}
std::optional< IRect > scissor
Definition command.h:139

◆ SetStencilReference()

void impeller::RecordingRenderPass::SetStencilReference ( uint32_t  value)
overridevirtual

The reference value to use in stenciling operations. Stencil configuration is part of pipeline setup and can be read from the pipelines descriptor.

See also
Pipeline
PipelineDescriptor

Reimplemented from impeller::RenderPass.

Definition at line 36 of file recording_render_pass.cc.

36 {
37 pending_.stencil_reference = value;
38 if (delegate_) {
39 delegate_->SetStencilReference(value);
40 }
41}
uint32_t stencil_reference
Definition command.h:122

◆ SetVertexBuffer()

bool impeller::RecordingRenderPass::SetVertexBuffer ( VertexBuffer  buffer)
overridevirtual

Specify the vertex and index buffer to use for this command.

Parameters
[in]bufferThe vertex and index buffer definition. If possible, this value should be moved and not copied.
Returns
returns if the binding was updated.

Reimplemented from impeller::RenderPass.

Definition at line 76 of file recording_render_pass.cc.

76 {
77 pending_.vertex_buffer = buffer;
78 if (delegate_) {
79 return delegate_->SetVertexBuffer(buffer);
80 }
81 return true;
82}
static const uint8_t buffer[]
VertexBuffer vertex_buffer
The bound per-vertex data and optional index buffer.
Definition command.h:151

◆ SetViewport()

void impeller::RecordingRenderPass::SetViewport ( Viewport  viewport)
overridevirtual

The viewport coordinates that the rasterizer linearly maps normalized device coordinates to. If unset, the viewport is the size of the render target with a zero origin, znear=0, and zfar=1.

Reimplemented from impeller::RenderPass.

Definition at line 52 of file recording_render_pass.cc.

52 {
53 pending_.viewport = viewport;
54 if (delegate_) {
55 delegate_->SetViewport(viewport);
56 }
57}
std::optional< Viewport > viewport
Definition command.h:133

The documentation for this class was generated from the following files: