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 label) |
virtual void | ReserveCommands (size_t command_count) |
Reserve [command_count] commands in the HAL command buffer. More... | |
virtual 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 | SetInstanceCount (size_t count) |
virtual bool | SetVertexBuffer (VertexBuffer buffer) |
Specify the vertex and index buffer to use for this command. 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 ShaderUniformSlot &slot, const std::shared_ptr< const ShaderMetadata > &metadata, BufferView view) |
virtual 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 |
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 label)=0 |
virtual bool | OnEncodeCommands (const Context &context) const =0 |
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_ |
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 33 of file render_pass.h.
|
virtual |
Definition at line 21 of file render_pass.cc.
|
protected |
Definition at line 10 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 58 of file render_pass.cc.
References commands_, impeller::RenderTarget::GetRenderTargetSize(), impeller::TRect< int64_t >::MakeSize(), render_target_, and VALIDATION_LOG.
Referenced by Draw().
|
overridevirtual |
Implements impeller::ResourceBinder.
Definition at line 156 of file render_pass.cc.
References impeller::Command::BindResource().
|
overridevirtual |
Implements impeller::ResourceBinder.
Definition at line 138 of file render_pass.cc.
References impeller::Command::BindResource().
Referenced by impeller::RuntimeEffectContents::Render().
|
virtual |
Definition at line 146 of file render_pass.cc.
References impeller::Command::BindResource().
|
virtual |
Record the currently pending command.
Definition at line 127 of file render_pass.cc.
References AddCommand().
Referenced by impeller::scene::EncodeCommand(), ImGui_ImplImpeller_RenderDrawData(), impeller::CheckerboardContents::Render(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::VerticesColorContents::Render(), impeller::TextureContents::Render(), impeller::AtlasContents::Render(), impeller::VerticesUVContents::Render(), impeller::ClipRestoreContents::Render(), impeller::AtlasTextureContents::Render(), impeller::AtlasColorContents::Render(), and impeller::testing::TEST_P().
bool impeller::RenderPass::EncodeCommands | ( | ) | const |
Encode the recorded commands to the underlying command buffer.
Definition at line 84 of file render_pass.cc.
References context_, and OnEncodeCommands().
|
inlinevirtual |
Accessor for the current Commands.
Visible for testing.
Definition at line 149 of file render_pass.h.
References commands_.
const std::shared_ptr< const Context > & impeller::RenderPass::GetContext | ( | ) | const |
Definition at line 88 of file render_pass.cc.
References context_.
Referenced by ImGui_ImplImpeller_RenderDrawData().
const Matrix & impeller::RenderPass::GetOrthographicTransform | ( | ) | const |
Definition at line 47 of file render_pass.cc.
References orthographic_.
Referenced by impeller::Entity::GetShaderTransform(), impeller::ClipRestoreContents::Render(), and impeller::testing::TEST_P().
const RenderTarget & impeller::RenderPass::GetRenderTarget | ( | ) | const |
Definition at line 39 of file render_pass.cc.
References render_target_.
Referenced by impeller::scene::Material::GetContextOptions().
PixelFormat impeller::RenderPass::GetRenderTargetPixelFormat | ( | ) | const |
The pixel format of the attached render target.
Definition at line 27 of file render_pass.cc.
References pixel_format_.
Referenced by impeller::OptionsFromPass().
ISize impeller::RenderPass::GetRenderTargetSize | ( | ) | const |
Definition at line 43 of file render_pass.cc.
References render_target_size_.
Referenced by ImGui_ImplImpeller_RenderDrawData(), impeller::SceneContents::Render(), impeller::ClipRestoreContents::Render(), impeller::Entity::Render(), impeller::SetClipScissor(), and impeller::testing::TEST_P().
SampleCount impeller::RenderPass::GetSampleCount | ( | ) | const |
The sample count of the attached render target.
Definition at line 23 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 31 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 35 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().
|
inlinevirtual |
Reserve [command_count] commands in the HAL command buffer.
Note: this is not the native command buffer.
Definition at line 52 of file render_pass.h.
References commands_.
|
virtual |
Definition at line 107 of file render_pass.cc.
References impeller::Command::base_vertex.
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::scene::EncodeCommand(), ImGui_ImplImpeller_RenderDrawData(), impeller::CheckerboardContents::Render(), impeller::TiledTextureContents::Render(), impeller::SolidRRectBlurContents::Render(), impeller::SolidColorContents::Render(), impeller::TextContents::Render(), impeller::VerticesColorContents::Render(), impeller::TextureContents::Render(), impeller::AtlasContents::Render(), impeller::ClipRestoreContents::Render(), impeller::VerticesUVContents::Render(), impeller::AtlasTextureContents::Render(), impeller::AtlasColorContents::Render(), and impeller::testing::TEST_P().
|
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 119 of file render_pass.cc.
References impeller::Command::instance_count.
Referenced by impeller::testing::TEST_P().
void impeller::RenderPass::SetLabel | ( | std::string | label | ) |
Definition at line 51 of file render_pass.cc.
References OnSetLabel().
|
virtual |
The pipeline to use for this command.
Definition at line 92 of file render_pass.cc.
References impeller::Command::pipeline.
Referenced by impeller::scene::EncodeCommand(), ImGui_ImplImpeller_RenderDrawData(), impeller::CheckerboardContents::Render(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::VerticesColorContents::Render(), impeller::TextureContents::Render(), impeller::AtlasContents::Render(), impeller::VerticesUVContents::Render(), impeller::ClipRestoreContents::Render(), impeller::AtlasTextureContents::Render(), impeller::AtlasColorContents::Render(), 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(), and impeller::SetClipScissor().
|
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.
Referenced by impeller::scene::EncodeCommand(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::VerticesColorContents::Render(), impeller::TextureContents::Render(), impeller::AtlasContents::Render(), impeller::ClipRestoreContents::Render(), impeller::VerticesUVContents::Render(), impeller::AtlasTextureContents::Render(), and impeller::AtlasColorContents::Render().
|
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 123 of file render_pass.cc.
References impeller::Command::BindVertices().
Referenced by impeller::scene::CuboidGeometry::BindToCommand(), impeller::scene::UnskinnedVertexBufferGeometry::BindToCommand(), impeller::scene::SkinnedVertexBufferGeometry::BindToCommand(), ImGui_ImplImpeller_RenderDrawData(), impeller::CheckerboardContents::Render(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::VerticesColorContents::Render(), impeller::TextureContents::Render(), impeller::AtlasContents::Render(), impeller::VerticesUVContents::Render(), impeller::ClipRestoreContents::Render(), impeller::AtlasTextureContents::Render(), impeller::AtlasColorContents::Render(), 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().
|
protected |
Definition at line 180 of file render_pass.h.
Referenced by AddCommand(), GetCommands(), and ReserveCommands().
|
protected |
Definition at line 168 of file render_pass.h.
Referenced by EncodeCommands(), and GetContext().
|
protected |
Definition at line 176 of file render_pass.h.
Referenced by HasDepthAttachment().
|
protected |
Definition at line 177 of file render_pass.h.
Referenced by HasStencilAttachment().
|
protected |
Definition at line 181 of file render_pass.h.
Referenced by GetOrthographicTransform().
|
protected |
Definition at line 175 of file render_pass.h.
Referenced by GetRenderTargetPixelFormat().
|
protected |
Definition at line 179 of file render_pass.h.
Referenced by AddCommand(), and GetRenderTarget().
|
protected |
Definition at line 178 of file render_pass.h.
Referenced by GetRenderTargetSize().
|
protected |
Definition at line 174 of file render_pass.h.
Referenced by GetSampleCount().