Flutter Engine
 
Loading...
Searching...
No Matches
impeller::testing::RecordingRenderPass Class Reference

#include <recording_render_pass.h>

Inheritance diagram for impeller::testing::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 (PipelineRef 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 (IRect32 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 SampledImageSlot &slot, const ShaderMetadata *metadata, std::shared_ptr< const Texture > texture, raw_ptr< const Sampler > sampler) override
 
bool BindDynamicResource (ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, std::unique_ptr< ShaderMetadata > metadata, BufferView view) override
 Bind with dynamically generated shader metadata.
 
bool BindDynamicResource (ShaderStage stage, DescriptorType type, const SampledImageSlot &slot, std::unique_ptr< ShaderMetadata > metadata, std::shared_ptr< const Texture > texture, raw_ptr< const Sampler > sampler) override
 
void OnSetLabel (std::string_view 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_view label)
 
void SetPipeline (const std::shared_ptr< Pipeline< PipelineDescriptor > > &pipeline)
 The pipeline to use for this command.
 
virtual void SetElementCount (size_t count)
 
bool SetVertexBuffer (BufferView vertex_buffer)
 Specify a vertex buffer to use for this command.
 
bool SetVertexBuffer (std::vector< BufferView > vertex_buffers)
 Specify a set of vertex buffers to use for this command.
 
virtual bool SetVertexBuffer (BufferView vertex_buffers[], size_t vertex_buffer_count)
 Specify a set of vertex buffers to use for this command.
 
virtual bool SetIndexBuffer (BufferView index_buffer, IndexType index_type)
 Specify an index buffer to use for this command. To unset the index buffer, pass IndexType::kNone to index_type.
 
virtual bool BindResource (ShaderStage stage, DescriptorType type, const SampledImageSlot &slot, const ShaderMetadata *metadata, std::shared_ptr< const Texture > texture, raw_ptr< const Sampler >) override
 
virtual bool BindDynamicResource (ShaderStage stage, DescriptorType type, const SampledImageSlot &slot, std::unique_ptr< ShaderMetadata > metadata, std::shared_ptr< const Texture > texture, raw_ptr< const Sampler >)
 Bind with dynamically generated shader metadata.
 
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)
 
- Static Protected Member Functions inherited from impeller::RenderPass
static bool ValidateVertexBuffers (const BufferView vertex_buffers[], size_t vertex_buffer_count)
 
static bool ValidateIndexBuffer (const BufferView &index_buffer, IndexType index_type)
 
- 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_
 
std::vector< BufferViewvertex_buffers_
 
std::vector< BufferResourcebound_buffers_
 
std::vector< TextureAndSamplerbound_textures_
 
const Matrix orthographic_
 

Detailed Description

Definition at line 12 of file recording_render_pass.h.

Constructor & Destructor Documentation

◆ RecordingRenderPass()

impeller::testing::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::testing::RecordingRenderPass::~RecordingRenderPass ( )
default

Member Function Documentation

◆ BindDynamicResource() [1/2]

bool impeller::testing::RecordingRenderPass::BindDynamicResource ( ShaderStage  stage,
DescriptorType  type,
const SampledImageSlot slot,
std::unique_ptr< ShaderMetadata metadata,
std::shared_ptr< const Texture texture,
raw_ptr< const Sampler sampler 
)
override

Definition at line 132 of file recording_render_pass.cc.

138 {
139 if (delegate_) {
140 return delegate_->BindDynamicResource(
141 stage, type, slot, std::move(metadata), texture, sampler);
142 }
143 return true;
144}
GLenum type
FlTexture * texture

References texture, and type.

◆ BindDynamicResource() [2/2]

bool impeller::testing::RecordingRenderPass::BindDynamicResource ( ShaderStage  stage,
DescriptorType  type,
const ShaderUniformSlot slot,
std::unique_ptr< ShaderMetadata metadata,
BufferView  view 
)
overridevirtual

Bind with dynamically generated shader metadata.

Reimplemented from impeller::RenderPass.

Definition at line 118 of file recording_render_pass.cc.

123 {
124 if (delegate_) {
125 return delegate_->BindDynamicResource(stage, type, slot,
126 std::move(metadata), view);
127 }
128 return true;
129}
FlView * view

References type, and view.

◆ BindResource() [1/2]

bool impeller::testing::RecordingRenderPass::BindResource ( ShaderStage  stage,
DescriptorType  type,
const SampledImageSlot slot,
const ShaderMetadata metadata,
std::shared_ptr< const Texture texture,
raw_ptr< const Sampler sampler 
)
override

Definition at line 146 of file recording_render_pass.cc.

151 {
152 if (delegate_) {
153 return delegate_->BindResource(stage, type, slot, metadata, texture,
154 sampler);
155 }
156 return true;
157}

References texture, and type.

◆ BindResource() [2/2]

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

Reimplemented from impeller::RenderPass.

Definition at line 106 of file recording_render_pass.cc.

110 {
111 if (delegate_) {
112 return delegate_->BindResource(stage, type, slot, metadata, view);
113 }
114 return true;
115}

References type, and view.

◆ Draw()

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

Record the currently pending command.

Reimplemented from impeller::RenderPass.

Definition at line 83 of file recording_render_pass.cc.

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

◆ GetCommands()

const std::vector< Command > & impeller::testing::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::testing::RecordingRenderPass::IsValid ( ) const
inlineoverridevirtual

Implements impeller::RenderPass.

Definition at line 82 of file recording_render_pass.h.

82{ return true; }

◆ OnEncodeCommands()

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

Implements impeller::RenderPass.

Definition at line 98 of file recording_render_pass.cc.

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

◆ OnSetLabel()

void impeller::testing::RecordingRenderPass::OnSetLabel ( std::string_view  label)
overridevirtual

Implements impeller::RenderPass.

Definition at line 93 of file recording_render_pass.cc.

93 {
94 return;
95}

◆ SetBaseVertex()

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

Reimplemented from impeller::RenderPass.

Definition at line 43 of file recording_render_pass.cc.

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

References impeller::Command::base_vertex, and value.

◆ SetCommandLabel()

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

The debugging label to use for the command.

Reimplemented from impeller::RenderPass.

Definition at line 25 of file recording_render_pass.cc.

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

◆ SetInstanceCount()

void impeller::testing::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 67 of file recording_render_pass.cc.

67 {
68 pending_.instance_count = count;
69 if (delegate_) {
70 delegate_->SetInstanceCount(count);
71 }
72}
uint32_t instance_count
Definition command.h:140

References impeller::Command::instance_count.

◆ SetPipeline()

void impeller::testing::RecordingRenderPass::SetPipeline ( PipelineRef  pipeline)
overridevirtual

The pipeline to use for this command.

Reimplemented from impeller::RenderPass.

Definition at line 18 of file recording_render_pass.cc.

18 {
19 pending_.pipeline = pipeline;
20 if (delegate_) {
21 delegate_->SetPipeline(pipeline);
22 }
23}
PipelineRef pipeline
Definition command.h:84

References impeller::Command::pipeline.

◆ SetScissor()

void impeller::testing::RecordingRenderPass::SetScissor ( IRect32  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 59 of file recording_render_pass.cc.

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

References impeller::Command::scissor.

◆ SetStencilReference()

void impeller::testing::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 35 of file recording_render_pass.cc.

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

References impeller::Command::stencil_reference, and value.

◆ SetVertexBuffer()

bool impeller::testing::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 75 of file recording_render_pass.cc.

75 {
76 if (delegate_) {
77 return delegate_->SetVertexBuffer(buffer);
78 }
79 return true;
80}

References flutter::buffer.

◆ SetViewport()

void impeller::testing::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 51 of file recording_render_pass.cc.

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

References impeller::Command::viewport.


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