Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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
 
std::array< impeller::BufferView, kMaxVertexBufferSlotsvertex_buffers
 
size_t vertex_buffer_count = 0
 
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
 

Static Public Attributes

static constexpr size_t kMaxVertexBufferSlots = 16
 

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 28 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 for (auto& buffer : vertex_buffers) {
98 buffer = {};
99 }
101 index_buffer = {};
103 element_count = 0;
104}
TextureUniformMap fragment_texture_bindings
Definition render_pass.h:76
BufferUniformMap fragment_uniform_bindings
Definition render_pass.h:75
TextureUniformMap vertex_texture_bindings
Definition render_pass.h:74
BufferUniformMap vertex_uniform_bindings
Definition render_pass.h:73
impeller::IndexType index_buffer_type
Definition render_pass.h:90
std::array< impeller::BufferView, kMaxVertexBufferSlots > vertex_buffers
Definition render_pass.h:86
impeller::BufferView index_buffer
Definition render_pass.h:89
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
@ kNone
Does not use the index buffer.

References flutter::buffer, element_count, fragment_texture_bindings, fragment_uniform_bindings, index_buffer, index_buffer_type, impeller::kNone, vertex_buffer_count, vertex_buffers, vertex_texture_bindings, and vertex_uniform_bindings.

Referenced by InternalFlutterGpu_RenderPass_ClearBindings().

◆ Draw()

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

Definition at line 185 of file render_pass.cc.

185 {
186 render_pass_->SetPipeline(impeller::PipelineRef(GetOrCreatePipeline()));
187
188 for (const auto& [_, buffer] : vertex_uniform_bindings) {
189 render_pass_->BindDynamicResource(
192 std::make_unique<impeller::ShaderMetadata>(*buffer.view.GetMetadata()),
193 buffer.view.resource);
194 }
195 for (const auto& [_, texture] : vertex_texture_bindings) {
196 render_pass_->BindDynamicResource(
198 texture.slot,
199 std::make_unique<impeller::ShaderMetadata>(
200 *texture.texture.GetMetadata()),
201 texture.texture.resource, texture.sampler);
202 }
203 for (const auto& [_, buffer] : fragment_uniform_bindings) {
204 render_pass_->BindDynamicResource(
207 std::make_unique<impeller::ShaderMetadata>(*buffer.view.GetMetadata()),
208 buffer.view.resource);
209 }
210 for (const auto& [_, texture] : fragment_texture_bindings) {
211 render_pass_->BindDynamicResource(
214 std::make_unique<impeller::ShaderMetadata>(
215 *texture.texture.GetMetadata()),
216 texture.texture.resource, texture.sampler);
217 }
218
219 render_pass_->SetVertexBuffer(vertex_buffers.data(), vertex_buffer_count);
220 render_pass_->SetIndexBuffer(index_buffer, index_buffer_type);
221 render_pass_->SetElementCount(element_count);
222
223 render_pass_->SetStencilReference(stencil_reference);
224
225 if (viewport.has_value()) {
226 render_pass_->SetViewport(viewport.value());
227 }
228
229 if (scissor.has_value()) {
230 render_pass_->SetScissor(scissor.value());
231 }
232
233 bool result = render_pass_->Draw().ok();
234
235 return result;
236}
std::optional< impeller::Viewport > viewport
Definition render_pass.h:95
std::optional< impeller::IRect32 > scissor
Definition render_pass.h:94
FlTexture * texture

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_count, vertex_buffers, 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 91 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 76 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 75 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 99 of file render_pass.h.

Referenced by BindIndexBuffer(), and BindVertexBuffer().

◆ index_buffer

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

Definition at line 89 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 90 of file render_pass.h.

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

◆ kMaxVertexBufferSlots

constexpr size_t flutter::gpu::RenderPass::kMaxVertexBufferSlots = 16
staticconstexpr

Definition at line 85 of file render_pass.h.

Referenced by BindVertexBuffer().

◆ scissor

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

Definition at line 94 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 93 of file render_pass.h.

Referenced by Draw(), and InternalFlutterGpu_RenderPass_SetStencilReference().

◆ vertex_buffer_count

size_t flutter::gpu::RenderPass::vertex_buffer_count = 0

Definition at line 88 of file render_pass.h.

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

◆ vertex_buffers

std::array<impeller::BufferView, kMaxVertexBufferSlots> flutter::gpu::RenderPass::vertex_buffers

Definition at line 86 of file render_pass.h.

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

◆ vertex_texture_bindings

TextureUniformMap flutter::gpu::RenderPass::vertex_texture_bindings

Definition at line 74 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 73 of file render_pass.h.

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

◆ viewport

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

Definition at line 95 of file render_pass.h.

Referenced by Draw(), and InternalFlutterGpu_RenderPass_SetViewport().


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