Render passes encode render commands directed as one specific render target into an underlying command buffer. More...
#include <render_pass.h>
Public Member Functions | |
virtual | ~RenderPass () |
const std::shared_ptr< const Context > & | GetContext () const |
const RenderTarget & | GetRenderTarget () const |
ISize | GetRenderTargetSize () const |
const Matrix & | GetOrthographicTransform () const |
virtual bool | IsValid () const =0 |
void | SetLabel (std::string_view label) |
virtual void | SetPipeline (PipelineRef pipeline) |
The pipeline to use for this command. More... | |
void | SetPipeline (const std::shared_ptr< Pipeline< PipelineDescriptor >> &pipeline) |
The pipeline to use for this command. More... | |
virtual void | SetCommandLabel (std::string_view label) |
The debugging label to use for the command. More... | |
virtual void | SetStencilReference (uint32_t value) |
virtual void | SetBaseVertex (uint64_t value) |
virtual void | SetViewport (Viewport viewport) |
virtual void | SetScissor (IRect scissor) |
virtual void | SetElementCount (size_t count) |
virtual void | SetInstanceCount (size_t count) |
virtual bool | SetVertexBuffer (VertexBuffer buffer) |
Specify the vertex and index buffer to use for this command. More... | |
bool | SetVertexBuffer (BufferView vertex_buffer) |
Specify a vertex buffer to use for this command. More... | |
bool | SetVertexBuffer (std::vector< BufferView > vertex_buffers) |
Specify a set of vertex buffers to use for this command. More... | |
virtual bool | SetVertexBuffer (BufferView vertex_buffers[], size_t vertex_buffer_count) |
Specify a set of vertex buffers to use for this command. More... | |
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. More... | |
virtual fml::Status | Draw () |
Record the currently pending command. More... | |
virtual bool | BindResource (ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata *metadata, BufferView view) override |
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. More... | |
virtual bool | BindDynamicResource (ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, std::unique_ptr< ShaderMetadata > metadata, BufferView view) |
Bind with dynamically generated shader metadata. More... | |
bool | EncodeCommands () const |
Encode the recorded commands to the underlying command buffer. More... | |
virtual const std::vector< Command > & | GetCommands () const |
Accessor for the current Commands. More... | |
SampleCount | GetSampleCount () const |
The sample count of the attached render target. More... | |
PixelFormat | GetRenderTargetPixelFormat () const |
The pixel format of the attached render target. More... | |
bool | HasDepthAttachment () const |
Whether the render target has a depth attachment. More... | |
bool | HasStencilAttachment () const |
Whether the render target has an stencil attachment. More... | |
![]() | |
virtual | ~ResourceBinder ()=default |
Protected Member Functions | |
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. More... | |
RenderPass (std::shared_ptr< const Context > context, const RenderTarget &target) | |
virtual void | OnSetLabel (std::string_view label)=0 |
virtual bool | OnEncodeCommands (const Context &context) const =0 |
Static Protected Member Functions | |
static bool | ValidateVertexBuffers (const BufferView vertex_buffers[], size_t vertex_buffer_count) |
static bool | ValidateIndexBuffer (const BufferView &index_buffer, IndexType index_type) |
Protected Attributes | |
const std::shared_ptr< const Context > | context_ |
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< Command > | commands_ |
std::vector< BufferView > | vertex_buffers_ |
std::vector< BufferResource > | bound_buffers_ |
std::vector< TextureAndSampler > | bound_textures_ |
const Matrix | orthographic_ |
Render passes encode render commands directed as one specific render target into an underlying command buffer.
Render passes can be obtained from the command buffer in which the pass is meant to encode commands into.
CommandBuffer
Definition at line 30 of file render_pass.h.
|
virtual |
Definition at line 25 of file render_pass.cc.
|
protected |
Definition at line 14 of file render_pass.cc.
|
protected |
Record a command for subsequent encoding to the underlying command buffer. No work is encoded into the command buffer at this time.
[in] | command | The command |
Definition at line 62 of file render_pass.cc.
References commands_, and VALIDATION_LOG.
Referenced by Draw().
|
virtual |
Bind with dynamically generated shader metadata.
Definition at line 270 of file render_pass.cc.
References impeller::Resource< std::shared_ptr< const Texture > >::MakeDynamic().
Referenced by impeller::RuntimeEffectContents::Render().
|
virtual |
Bind with dynamically generated shader metadata.
Definition at line 255 of file render_pass.cc.
References impeller::ShaderUniformSlot::ext_res_0, impeller::VertexDescriptor::kReservedVertexBufferIndex, and impeller::Resource< T >::MakeDynamic().
|
overridevirtual |
|
overridevirtual |
Implements impeller::ResourceBinder.
Definition at line 225 of file render_pass.cc.
References impeller::ShaderUniformSlot::ext_res_0, and impeller::VertexDescriptor::kReservedVertexBufferIndex.
Referenced by impeller::RuntimeEffectContents::Render().
|
virtual |
Record the currently pending command.
Definition at line 208 of file render_pass.cc.
References AddCommand(), impeller::Command::bound_buffers, impeller::Command::bound_textures, impeller::Range::offset, and impeller::Command::vertex_buffers.
Referenced by impeller::ColorSourceContents::DrawGeometry(), ImGui_ImplImpeller_RenderDrawData(), impeller::AtlasContents::Render(), impeller::ColorFilterAtlasContents::Render(), impeller::SolidRRectLikeBlurContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::Render(), impeller::VerticesSimpleBlendContents::Render(), impeller::ClipContents::Render(), impeller::RenderClipRestore(), and impeller::testing::TEST_P().
bool impeller::RenderPass::EncodeCommands | ( | ) | const |
Encode the recorded commands to the underlying command buffer.
Definition at line 78 of file render_pass.cc.
References context_, and OnEncodeCommands().
|
inlinevirtual |
Accessor for the current Commands.
Visible for testing.
Definition at line 217 of file render_pass.h.
References commands_.
const std::shared_ptr< const Context > & impeller::RenderPass::GetContext | ( | ) | const |
const Matrix & impeller::RenderPass::GetOrthographicTransform | ( | ) | const |
Definition at line 51 of file render_pass.cc.
References orthographic_.
Referenced by impeller::Entity::GetShaderTransform(), impeller::ClipContents::Render(), impeller::RenderClipRestore(), and impeller::testing::TEST_P().
const RenderTarget & impeller::RenderPass::GetRenderTarget | ( | ) | const |
Definition at line 43 of file render_pass.cc.
References render_target_.
PixelFormat impeller::RenderPass::GetRenderTargetPixelFormat | ( | ) | const |
The pixel format of the attached render target.
Definition at line 31 of file render_pass.cc.
References pixel_format_.
Referenced by impeller::OptionsFromPass().
ISize impeller::RenderPass::GetRenderTargetSize | ( | ) | const |
Definition at line 47 of file render_pass.cc.
References render_target_size_.
Referenced by ImGui_ImplImpeller_RenderDrawData(), impeller::Entity::Render(), impeller::ClipContents::Render(), impeller::RenderClipRestore(), and impeller::testing::TEST_P().
SampleCount impeller::RenderPass::GetSampleCount | ( | ) | const |
The sample count of the attached render target.
Definition at line 27 of file render_pass.cc.
References sample_count_.
Referenced by impeller::OptionsFromPass().
bool impeller::RenderPass::HasDepthAttachment | ( | ) | const |
Whether the render target has a depth attachment.
Definition at line 35 of file render_pass.cc.
References has_depth_attachment_.
Referenced by impeller::OptionsFromPass().
bool impeller::RenderPass::HasStencilAttachment | ( | ) | const |
Whether the render target has an stencil attachment.
Definition at line 39 of file render_pass.cc.
References has_stencil_attachment_.
Referenced by impeller::OptionsFromPass().
|
pure virtual |
|
protectedpure virtual |
Referenced by EncodeCommands().
|
protectedpure virtual |
Referenced by SetLabel().
|
virtual |
Definition at line 107 of file render_pass.cc.
References impeller::Command::base_vertex, and value.
Referenced by ImGui_ImplImpeller_RenderDrawData().
|
virtual |
The debugging label to use for the command.
Definition at line 97 of file render_pass.cc.
Referenced by impeller::ColorSourceContents::DrawGeometry(), ImGui_ImplImpeller_RenderDrawData(), impeller::AtlasContents::Render(), impeller::ColorFilterAtlasContents::Render(), impeller::SolidColorContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::Render(), impeller::TiledTextureContents::Render(), impeller::VerticesSimpleBlendContents::Render(), impeller::ClipContents::Render(), impeller::RenderClipRestore(), impeller::SolidRRectBlurContents::SetPassInfo(), and impeller::testing::TEST_P().
|
virtual |
The number of elements to draw. When only a vertex buffer is set, this is the vertex count. When an index buffer is set, this is the index count.
Definition at line 119 of file render_pass.cc.
References impeller::Command::element_count.
Referenced by impeller::TextContents::Render(), and SetVertexBuffer().
|
virtual |
Specify an index buffer to use for this command. To unset the index buffer, pass IndexType::kNone to index_type.
[in] | index_buffer | The buffer view to use for sourcing indices. When an index buffer is bound, the vertex_count set via SetVertexBuffer is used as the number of indices to draw. |
[in] | index_type | The size of each index in the index buffer. Pass IndexType::kNone to unset the index buffer. |
Definition at line 164 of file render_pass.cc.
References impeller::Command::index_buffer, impeller::Command::index_type, and ValidateIndexBuffer().
Referenced by impeller::TextContents::Render(), and SetVertexBuffer().
|
virtual |
The number of instances of the given set of vertices to render. Not all backends support rendering more than one instance at a time.
Definition at line 123 of file render_pass.cc.
References impeller::Command::instance_count.
Referenced by impeller::testing::TEST_P().
void impeller::RenderPass::SetLabel | ( | std::string_view | label | ) |
Definition at line 55 of file render_pass.cc.
References OnSetLabel().
void impeller::RenderPass::SetPipeline | ( | const std::shared_ptr< Pipeline< PipelineDescriptor >> & | pipeline | ) |
The pipeline to use for this command.
Definition at line 92 of file render_pass.cc.
References SetPipeline().
|
virtual |
The pipeline to use for this command.
Definition at line 86 of file render_pass.cc.
References impeller::Command::pipeline.
Referenced by impeller::ColorSourceContents::DrawGeometry(), ImGui_ImplImpeller_RenderDrawData(), impeller::AtlasContents::Render(), impeller::ColorFilterAtlasContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::Render(), impeller::VerticesSimpleBlendContents::Render(), impeller::ClipContents::Render(), impeller::RenderClipRestore(), impeller::SolidRRectBlurContents::SetPassInfo(), SetPipeline(), and impeller::testing::TEST_P().
|
virtual |
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.
Definition at line 115 of file render_pass.cc.
References impeller::Command::scissor.
Referenced by ImGui_ImplImpeller_RenderDrawData().
|
virtual |
The reference value to use in stenciling operations. Stencil configuration is part of pipeline setup and can be read from the pipelines descriptor.
Pipeline
PipelineDescriptor
Definition at line 103 of file render_pass.cc.
References impeller::Command::stencil_reference, and value.
Referenced by impeller::ColorSourceContents::DrawGeometry(), impeller::ClipContents::Render(), and impeller::RenderClipRestore().
bool impeller::RenderPass::SetVertexBuffer | ( | BufferView | vertex_buffer | ) |
Specify a vertex buffer to use for this command.
[in] | vertex_buffer | The buffer view to use for sourcing vertices. |
Definition at line 139 of file render_pass.cc.
References SetVertexBuffer().
|
virtual |
Specify a set of vertex buffers to use for this command.
[in] | vertex_buffers | Pointer to an array of vertex buffers to be copied. The maximum number of vertex buffers is 16. |
[in] | vertex_buffer_count | The number of vertex buffers to copy from the array (max 16). |
Definition at line 147 of file render_pass.cc.
References impeller::Range::length, ValidateVertexBuffers(), impeller::Command::vertex_buffers, and vertex_buffers_.
bool impeller::RenderPass::SetVertexBuffer | ( | std::vector< BufferView > | vertex_buffers | ) |
Specify a set of vertex buffers to use for this command.
[in] | vertex_buffers | The array of vertex buffer views to use. The maximum number of vertex buffers is 16. |
Definition at line 143 of file render_pass.cc.
References SetVertexBuffer().
|
virtual |
Specify the vertex and index buffer to use for this command.
[in] | buffer | The vertex and index buffer definition. If possible, this value should be moved and not copied. |
Definition at line 127 of file render_pass.cc.
References impeller::VertexBuffer::index_buffer, impeller::VertexBuffer::index_type, SetElementCount(), SetIndexBuffer(), impeller::VertexBuffer::vertex_buffer, and impeller::VertexBuffer::vertex_count.
Referenced by impeller::ColorSourceContents::DrawGeometry(), ImGui_ImplImpeller_RenderDrawData(), impeller::AtlasContents::Render(), impeller::ColorFilterAtlasContents::Render(), impeller::SolidRRectLikeBlurContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::Render(), impeller::VerticesSimpleBlendContents::Render(), impeller::ClipContents::Render(), impeller::RenderClipRestore(), SetVertexBuffer(), and impeller::testing::TEST_P().
|
virtual |
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.
Definition at line 111 of file render_pass.cc.
References impeller::Command::viewport.
Referenced by ImGui_ImplImpeller_RenderDrawData().
|
staticprotected |
Definition at line 193 of file render_pass.cc.
References impeller::kNone, impeller::kUnknown, and VALIDATION_LOG.
Referenced by SetIndexBuffer().
|
staticprotected |
Definition at line 174 of file render_pass.cc.
References impeller::kMaxVertexBuffers, and VALIDATION_LOG.
Referenced by SetVertexBuffer().
|
protected |
Definition at line 250 of file render_pass.h.
|
protected |
Definition at line 251 of file render_pass.h.
|
protected |
Definition at line 248 of file render_pass.h.
Referenced by AddCommand(), and GetCommands().
|
protected |
Definition at line 236 of file render_pass.h.
Referenced by EncodeCommands(), and GetContext().
|
protected |
Definition at line 244 of file render_pass.h.
Referenced by HasDepthAttachment().
|
protected |
Definition at line 245 of file render_pass.h.
Referenced by HasStencilAttachment().
|
protected |
Definition at line 252 of file render_pass.h.
Referenced by GetOrthographicTransform().
|
protected |
Definition at line 243 of file render_pass.h.
Referenced by GetRenderTargetPixelFormat().
|
protected |
Definition at line 247 of file render_pass.h.
Referenced by GetRenderTarget().
|
protected |
Definition at line 246 of file render_pass.h.
Referenced by GetRenderTargetSize().
|
protected |
Definition at line 242 of file render_pass.h.
Referenced by GetSampleCount().
|
protected |
Definition at line 249 of file render_pass.h.
Referenced by SetVertexBuffer().