Flutter Engine
 
Loading...
Searching...
No Matches
flutter::gpu::RenderPass Class Reference

#include <render_pass.h>

Inheritance diagram for flutter::gpu::RenderPass:
flutter::RefCountedDartWrappable< RenderPass > fml::RefCountedThreadSafe< T > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Classes

struct  BufferAndUniformSlot
 

Public Types

using BufferUniformMap = std::unordered_map< const flutter::gpu::Shader::UniformBinding *, BufferAndUniformSlot >
 
using TextureUniformMap = std::unordered_map< const flutter::gpu::Shader::TextureBinding *, impeller::TextureAndSampler >
 
- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex ,
  kNumberOfNativeFields
}
 

Public Member Functions

 RenderPass ()
 
 ~RenderPass () override
 
const std::shared_ptr< const impeller::Context > & GetContext () const
 
impeller::RenderTargetGetRenderTarget ()
 
const impeller::RenderTargetGetRenderTarget () const
 
impeller::ColorAttachmentDescriptorGetColorAttachmentDescriptor (size_t color_attachment_index)
 
impeller::DepthAttachmentDescriptorGetDepthAttachmentDescriptor ()
 
impeller::StencilAttachmentDescriptorGetStencilFrontAttachmentDescriptor ()
 
impeller::StencilAttachmentDescriptorGetStencilBackAttachmentDescriptor ()
 
impeller::PipelineDescriptorGetPipelineDescriptor ()
 
bool Begin (flutter::gpu::CommandBuffer &command_buffer)
 
void SetPipeline (fml::RefPtr< RenderPipeline > pipeline)
 
void ClearBindings ()
 
bool Draw ()
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< RenderPass >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< T >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Public Attributes

BufferUniformMap vertex_uniform_bindings
 
TextureUniformMap vertex_texture_bindings
 
BufferUniformMap fragment_uniform_bindings
 
TextureUniformMap fragment_texture_bindings
 
impeller::BufferView vertex_buffer
 
impeller::BufferView index_buffer
 
impeller::IndexType index_buffer_type = impeller::IndexType::kNone
 
size_t element_count = 0
 
uint32_t stencil_reference = 0
 
std::optional< impeller::IRect32scissor
 
std::optional< impeller::Viewportviewport
 
bool has_index_buffer = false
 

Additional Inherited Members

- Protected Member Functions inherited from fml::RefCountedThreadSafe< T >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 27 of file render_pass.h.

Member Typedef Documentation

◆ BufferUniformMap

◆ TextureUniformMap

Constructor & Destructor Documentation

◆ RenderPass()

flutter::gpu::RenderPass::RenderPass ( )
default

◆ ~RenderPass()

flutter::gpu::RenderPass::~RenderPass ( )
overridedefault

Member Function Documentation

◆ Begin()

bool flutter::gpu::RenderPass::Begin ( flutter::gpu::CommandBuffer command_buffer)

Definition at line 76 of file render_pass.cc.

76 {
77 render_pass_ =
78 command_buffer.GetCommandBuffer()->CreateRenderPass(render_target_);
79 if (!render_pass_) {
80 return false;
81 }
82 command_buffer.AddRenderPass(render_pass_);
83 return true;
84}
std::shared_ptr< impeller::CommandBuffer > GetCommandBuffer()
void AddRenderPass(std::shared_ptr< impeller::RenderPass > render_pass)

References flutter::gpu::CommandBuffer::AddRenderPass(), and flutter::gpu::CommandBuffer::GetCommandBuffer().

Referenced by InternalFlutterGpu_RenderPass_Begin().

◆ ClearBindings()

void flutter::gpu::RenderPass::ClearBindings ( )

Definition at line 92 of file render_pass.cc.

92 {
97 vertex_buffer = {};
98 index_buffer = {};
100 element_count = 0;
101}
impeller::BufferView vertex_buffer
Definition render_pass.h:77
TextureUniformMap fragment_texture_bindings
Definition render_pass.h:75
BufferUniformMap fragment_uniform_bindings
Definition render_pass.h:74
TextureUniformMap vertex_texture_bindings
Definition render_pass.h:73
BufferUniformMap vertex_uniform_bindings
Definition render_pass.h:72
impeller::IndexType index_buffer_type
Definition render_pass.h:79
impeller::BufferView index_buffer
Definition render_pass.h:78
@ kNone
Does not use the index buffer.

References element_count, fragment_texture_bindings, fragment_uniform_bindings, index_buffer, index_buffer_type, impeller::kNone, vertex_buffer, vertex_texture_bindings, and vertex_uniform_bindings.

Referenced by InternalFlutterGpu_RenderPass_ClearBindings().

◆ Draw()

bool flutter::gpu::RenderPass::Draw ( )

Definition at line 182 of file render_pass.cc.

182 {
183 render_pass_->SetPipeline(impeller::PipelineRef(GetOrCreatePipeline()));
184
185 for (const auto& [_, buffer] : vertex_uniform_bindings) {
186 render_pass_->BindDynamicResource(
189 std::make_unique<impeller::ShaderMetadata>(*buffer.view.GetMetadata()),
190 buffer.view.resource);
191 }
192 for (const auto& [_, texture] : vertex_texture_bindings) {
193 render_pass_->BindDynamicResource(
195 texture.slot,
196 std::make_unique<impeller::ShaderMetadata>(
197 *texture.texture.GetMetadata()),
198 texture.texture.resource, texture.sampler);
199 }
200 for (const auto& [_, buffer] : fragment_uniform_bindings) {
201 render_pass_->BindDynamicResource(
204 std::make_unique<impeller::ShaderMetadata>(*buffer.view.GetMetadata()),
205 buffer.view.resource);
206 }
207 for (const auto& [_, texture] : fragment_texture_bindings) {
208 render_pass_->BindDynamicResource(
211 std::make_unique<impeller::ShaderMetadata>(
212 *texture.texture.GetMetadata()),
213 texture.texture.resource, texture.sampler);
214 }
215
216 render_pass_->SetVertexBuffer(vertex_buffer);
217 render_pass_->SetIndexBuffer(index_buffer, index_buffer_type);
218 render_pass_->SetElementCount(element_count);
219
220 render_pass_->SetStencilReference(stencil_reference);
221
222 if (viewport.has_value()) {
223 render_pass_->SetViewport(viewport.value());
224 }
225
226 if (scissor.has_value()) {
227 render_pass_->SetScissor(scissor.value());
228 }
229
230 bool result = render_pass_->Draw().ok();
231
232 return result;
233}
std::optional< impeller::Viewport > viewport
Definition render_pass.h:84
std::optional< impeller::IRect32 > scissor
Definition render_pass.h:83
FlTexture * texture
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98

References flutter::buffer, element_count, fragment_texture_bindings, fragment_uniform_bindings, index_buffer, index_buffer_type, impeller::kFragment, impeller::kSampledImage, impeller::kUniformBuffer, impeller::kVertex, scissor, stencil_reference, texture, vertex_buffer, vertex_texture_bindings, vertex_uniform_bindings, and viewport.

Referenced by InternalFlutterGpu_RenderPass_Draw().

◆ GetColorAttachmentDescriptor()

impeller::ColorAttachmentDescriptor & flutter::gpu::RenderPass::GetColorAttachmentDescriptor ( size_t  color_attachment_index)

Definition at line 48 of file render_pass.cc.

49 {
50 auto color = color_descriptors_.find(color_attachment_index);
51 if (color == color_descriptors_.end()) {
52 return color_descriptors_[color_attachment_index] = {};
53 }
54 return color->second;
55}

Referenced by InternalFlutterGpu_RenderPass_SetColorBlendEnable(), and InternalFlutterGpu_RenderPass_SetColorBlendEquation().

◆ GetContext()

const std::shared_ptr< const impeller::Context > & flutter::gpu::RenderPass::GetContext ( ) const

Definition at line 36 of file render_pass.cc.

36 {
37 return render_pass_->GetContext();
38}

Referenced by InternalFlutterGpu_RenderPass_BindTexture().

◆ GetDepthAttachmentDescriptor()

impeller::DepthAttachmentDescriptor & flutter::gpu::RenderPass::GetDepthAttachmentDescriptor ( )

Definition at line 58 of file render_pass.cc.

58 {
59 return depth_desc_;
60}

Referenced by InternalFlutterGpu_RenderPass_SetDepthCompareOperation(), and InternalFlutterGpu_RenderPass_SetDepthWriteEnable().

◆ GetPipelineDescriptor()

impeller::PipelineDescriptor & flutter::gpu::RenderPass::GetPipelineDescriptor ( )

◆ GetRenderTarget() [1/2]

impeller::RenderTarget & flutter::gpu::RenderPass::GetRenderTarget ( )

Definition at line 40 of file render_pass.cc.

40 {
41 return render_target_;
42}

Referenced by InternalFlutterGpu_RenderPass_SetColorAttachment(), and InternalFlutterGpu_RenderPass_SetDepthStencilAttachment().

◆ GetRenderTarget() [2/2]

const impeller::RenderTarget & flutter::gpu::RenderPass::GetRenderTarget ( ) const

Definition at line 44 of file render_pass.cc.

44 {
45 return render_target_;
46}

◆ GetStencilBackAttachmentDescriptor()

impeller::StencilAttachmentDescriptor & flutter::gpu::RenderPass::GetStencilBackAttachmentDescriptor ( )

Definition at line 68 of file render_pass.cc.

68 {
69 return stencil_back_desc_;
70}

Referenced by InternalFlutterGpu_RenderPass_SetStencilConfig().

◆ GetStencilFrontAttachmentDescriptor()

impeller::StencilAttachmentDescriptor & flutter::gpu::RenderPass::GetStencilFrontAttachmentDescriptor ( )

Definition at line 63 of file render_pass.cc.

63 {
64 return stencil_front_desc_;
65}

Referenced by InternalFlutterGpu_RenderPass_SetStencilConfig().

◆ SetPipeline()

void flutter::gpu::RenderPass::SetPipeline ( fml::RefPtr< RenderPipeline pipeline)

Definition at line 86 of file render_pass.cc.

86 {
87 // On debug this makes a difference, but not on release builds.
88 // NOLINTNEXTLINE(performance-move-const-arg)
89 render_pipeline_ = std::move(pipeline);
90}

Referenced by InternalFlutterGpu_RenderPass_BindPipeline().

Member Data Documentation

◆ element_count

size_t flutter::gpu::RenderPass::element_count = 0

Definition at line 80 of file render_pass.h.

Referenced by BindIndexBuffer(), BindVertexBuffer(), ClearBindings(), and Draw().

◆ fragment_texture_bindings

TextureUniformMap flutter::gpu::RenderPass::fragment_texture_bindings

Definition at line 75 of file render_pass.h.

Referenced by ClearBindings(), Draw(), and InternalFlutterGpu_RenderPass_BindTexture().

◆ fragment_uniform_bindings

BufferUniformMap flutter::gpu::RenderPass::fragment_uniform_bindings

Definition at line 74 of file render_pass.h.

Referenced by BindUniform(), ClearBindings(), and Draw().

◆ has_index_buffer

bool flutter::gpu::RenderPass::has_index_buffer = false

Definition at line 88 of file render_pass.h.

Referenced by BindIndexBuffer(), and BindVertexBuffer().

◆ index_buffer

impeller::BufferView flutter::gpu::RenderPass::index_buffer

Definition at line 78 of file render_pass.h.

Referenced by BindIndexBuffer(), ClearBindings(), and Draw().

◆ index_buffer_type

impeller::IndexType flutter::gpu::RenderPass::index_buffer_type = impeller::IndexType::kNone

Definition at line 79 of file render_pass.h.

Referenced by BindIndexBuffer(), ClearBindings(), and Draw().

◆ scissor

std::optional<impeller::IRect32> flutter::gpu::RenderPass::scissor

Definition at line 83 of file render_pass.h.

Referenced by Draw(), and InternalFlutterGpu_RenderPass_SetScissor().

◆ stencil_reference

uint32_t flutter::gpu::RenderPass::stencil_reference = 0

Definition at line 82 of file render_pass.h.

Referenced by Draw(), and InternalFlutterGpu_RenderPass_SetStencilReference().

◆ vertex_buffer

impeller::BufferView flutter::gpu::RenderPass::vertex_buffer

Definition at line 77 of file render_pass.h.

Referenced by BindVertexBuffer(), ClearBindings(), and Draw().

◆ vertex_texture_bindings

TextureUniformMap flutter::gpu::RenderPass::vertex_texture_bindings

Definition at line 73 of file render_pass.h.

Referenced by ClearBindings(), Draw(), and InternalFlutterGpu_RenderPass_BindTexture().

◆ vertex_uniform_bindings

BufferUniformMap flutter::gpu::RenderPass::vertex_uniform_bindings

Definition at line 72 of file render_pass.h.

Referenced by BindUniform(), ClearBindings(), and Draw().

◆ viewport

std::optional<impeller::Viewport> flutter::gpu::RenderPass::viewport

Definition at line 84 of file render_pass.h.

Referenced by Draw(), and InternalFlutterGpu_RenderPass_SetViewport().


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