37 return render_pass_->GetContext();
41 return render_target_;
45 return render_target_;
49 size_t color_attachment_index) {
50 auto color = color_descriptors_.find(color_attachment_index);
51 if (color == color_descriptors_.end()) {
52 return color_descriptors_[color_attachment_index] = {};
64 return stencil_front_desc_;
69 return stencil_back_desc_;
73 return pipeline_descriptor_;
78 command_buffer.GetCommandBuffer()->CreateRenderPass(render_target_);
89 render_pipeline_ = std::move(
pipeline);
105std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>>
106RenderPass::GetOrCreatePipeline() {
108 auto pipeline_desc = pipeline_descriptor_;
119 pipeline_desc.SetColorAttachmentDescriptors(color_descriptors_);
124 stencil->texture->GetTextureDescriptor().format)) {
125 pipeline_desc.SetStencilPixelFormat(
126 stencil->texture->GetTextureDescriptor().format);
127 pipeline_desc.SetStencilAttachmentDescriptors(stencil_front_desc_,
130 pipeline_desc.ClearStencilAttachments();
137 depth->texture->GetTextureDescriptor().format)) {
138 pipeline_desc.SetDepthPixelFormat(
139 depth->texture->GetTextureDescriptor().format);
140 pipeline_desc.SetDepthStencilAttachmentDescriptor(depth_desc_);
142 pipeline_desc.ClearDepthAttachment();
148 render_pipeline_->BindToPipelineDescriptor(*
context.GetShaderLibrary(),
151 std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>>
pipeline;
154 !
context.GetPipelineLibrary()->HasPipeline(pipeline_desc)) {
165 std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>>>
167 auto pipeline_future = pipeline_promise.get_future();
169 dart_state->GetTaskRunners().GetRasterTaskRunner(),
172 promise.set_value(
context->GetPipelineLibrary()
173 ->GetPipeline(pipeline_desc,
true,
true)
178 pipeline =
context.GetPipelineLibrary()->GetPipeline(pipeline_desc).Get();
186 size_t instance_count,
188 if (element_count == 0u || instance_count == 0u) {
200 render_pass_->BindDynamicResource(
203 std::make_unique<impeller::ShaderMetadata>(*
buffer.view.GetMetadata()),
207 render_pass_->BindDynamicResource(
210 std::make_unique<impeller::ShaderMetadata>(
211 *
texture.texture.GetMetadata()),
215 render_pass_->BindDynamicResource(
218 std::make_unique<impeller::ShaderMetadata>(*
buffer.view.GetMetadata()),
222 render_pass_->BindDynamicResource(
225 std::make_unique<impeller::ShaderMetadata>(
226 *
texture.texture.GetMetadata()),
237 render_pass_->SetElementCount(element_count);
238 render_pass_->SetInstanceCount(instance_count);
243 render_pass_->SetViewport(
viewport.value());
247 render_pass_->SetScissor(
scissor.value());
250 bool result = render_pass_->Draw().ok();
263 auto res = fml::MakeRefCounted<flutter::gpu::RenderPass>();
264 res->AssociateWithDartWrapper(wrapper);
270 int color_attachment_index,
278 Dart_Handle resolve_texture_wrapper,
285 clear_color_b, clear_color_a);
289 if (!Dart_IsNull(resolve_texture_wrapper)) {
292 resolve_texture_wrapper);
309 int depth_load_action,
310 int depth_store_action,
311 float depth_clear_value,
312 int stencil_load_action,
313 int stencil_store_action,
314 int stencil_clear_value,
361 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
365 if (slot < 0 ||
static_cast<size_t>(slot) >=
383 length_in_bytes, slot);
388 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
404 length_in_bytes, index_type);
410 Dart_Handle uniform_name_handle,
411 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
413 int length_in_bytes) {
419 if (!uniform_struct) {
436 if (!buffer ||
static_cast<size_t>(offset_in_bytes + length_in_bytes) >
437 buffer->GetDeviceBufferDescriptor().size) {
441 uniform_map->insert_or_assign(
456 Dart_Handle uniform_name_handle,
459 int length_in_bytes) {
460 return BindUniform(wrapper, shader, uniform_name_handle,
461 device_buffer->
GetBuffer(), offset_in_bytes,
468 Dart_Handle uniform_name_handle,
473 int width_address_mode,
474 int height_address_mode) {
480 if (!texture_binding) {
493 wrapper->
GetContext()->GetSamplerLibrary()->GetSampler(sampler_desc);
507 uniform_map->insert_or_assign(
524 int color_attachment_index,
532 int color_attachment_index,
533 int color_blend_operation,
534 int source_color_blend_factor,
535 int destination_color_blend_factor,
536 int alpha_blend_operation,
537 int source_alpha_blend_factor,
538 int destination_alpha_blend_factor) {
542 color.src_color_blend_factor =
544 color.dst_color_blend_factor =
546 color.alpha_blend_op =
548 color.src_alpha_blend_factor =
550 color.dst_alpha_blend_factor =
563 int compare_operation) {
571 int stencil_reference) {
594 depth_range.z_near = z_near;
595 depth_range.z_far = z_far;
598 viewport.rect = rect;
599 viewport.depth_range = depth_range;
606 int stencil_compare_operation,
607 int stencil_fail_operation,
608 int depth_fail_operation,
609 int depth_stencil_pass_operation,
622 desc.
read_mask =
static_cast<uint32_t
>(read_mask);
623 desc.
write_mask =
static_cast<uint32_t
>(write_mask);
626 if (target_face != 2 ) {
629 if (target_face != 1 ) {
644 int primitive_type) {
671 int instance_count) {
673 return vertex_count >= 0 && instance_count >= 0 &&
674 wrapper->
Draw(vertex_count, instance_count,
false);
680 int instance_count) {
682 return index_count >= 0 && instance_count >= 0 &&
683 wrapper->
Draw(index_count, instance_count,
true);
static UIDartState * Current()
std::shared_ptr< impeller::DeviceBuffer > GetBuffer()
uint32_t stencil_reference
std::optional< impeller::Viewport > viewport
impeller::StencilAttachmentDescriptor & GetStencilBackAttachmentDescriptor()
void SetPipeline(fml::RefPtr< RenderPipeline > pipeline)
impeller::RenderTarget & GetRenderTarget()
bool Begin(flutter::gpu::CommandBuffer &command_buffer)
std::unordered_map< const flutter::gpu::Shader::UniformBinding *, BufferAndUniformSlot > BufferUniformMap
static constexpr size_t kMaxVertexBufferSlots
impeller::DepthAttachmentDescriptor & GetDepthAttachmentDescriptor()
std::unordered_map< const flutter::gpu::Shader::TextureBinding *, impeller::TextureAndSampler > TextureUniformMap
size_t vertex_buffer_count
std::optional< impeller::IRect32 > scissor
TextureUniformMap fragment_texture_bindings
BufferUniformMap fragment_uniform_bindings
TextureUniformMap vertex_texture_bindings
BufferUniformMap vertex_uniform_bindings
impeller::IndexType index_buffer_type
std::array< impeller::BufferView, kMaxVertexBufferSlots > vertex_buffers
impeller::StencilAttachmentDescriptor & GetStencilFrontAttachmentDescriptor()
impeller::ColorAttachmentDescriptor & GetColorAttachmentDescriptor(size_t color_attachment_index)
bool Draw(size_t element_count, size_t instance_count, bool indexed)
impeller::PipelineDescriptor & GetPipelineDescriptor()
const std::shared_ptr< const impeller::Context > & GetContext() const
impeller::BufferView index_buffer
An immutable collection of shaders loaded from a shader bundle asset.
const Shader::UniformBinding * GetUniformStruct(const std::string &name) const
impeller::ShaderStage GetShaderStage() const
const Shader::TextureBinding * GetUniformTexture(const std::string &name) const
std::shared_ptr< impeller::Texture > GetTexture()
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
void SetCullMode(CullMode mode)
void SetPolygonMode(PolygonMode mode)
PipelineDescriptor & SetSampleCount(SampleCount samples)
void SetPrimitiveType(PrimitiveType type)
void SetWindingOrder(WindingOrder order)
virtual fml::Status Draw()
Record the currently pending command.
SampleCount GetSampleCount() const
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
PixelFormat GetRenderTargetPixelFormat() const
RenderTarget & SetStencilAttachment(std::optional< StencilAttachment > attachment)
bool IterateAllColorAttachments(const std::function< bool(size_t index, const ColorAttachment &attachment)> &iterator) const
const std::optional< DepthAttachment > & GetDepthAttachment() const
const std::optional< StencilAttachment > & GetStencilAttachment() const
#define IMPLEMENT_WRAPPERTYPEINFO(LibraryName, ClassName)
#define FML_DCHECK(condition)
void InternalFlutterGpu_RenderPass_BindPipeline(flutter::gpu::RenderPass *wrapper, flutter::gpu::RenderPipeline *pipeline)
static bool BindUniform(flutter::gpu::RenderPass *wrapper, flutter::gpu::Shader *shader, Dart_Handle uniform_name_handle, const std::shared_ptr< const impeller::DeviceBuffer > &buffer, int offset_in_bytes, int length_in_bytes)
static void BindIndexBuffer(flutter::gpu::RenderPass *wrapper, const std::shared_ptr< const impeller::DeviceBuffer > &buffer, int offset_in_bytes, int length_in_bytes, int index_type)
void InternalFlutterGpu_RenderPass_ClearBindings(flutter::gpu::RenderPass *wrapper)
Dart_Handle InternalFlutterGpu_RenderPass_SetDepthStencilAttachment(flutter::gpu::RenderPass *wrapper, int depth_load_action, int depth_store_action, float depth_clear_value, int stencil_load_action, int stencil_store_action, int stencil_clear_value, flutter::gpu::Texture *texture, int mip_level, int slice)
void InternalFlutterGpu_RenderPass_SetStencilConfig(flutter::gpu::RenderPass *wrapper, int stencil_compare_operation, int stencil_fail_operation, int depth_fail_operation, int depth_stencil_pass_operation, int read_mask, int write_mask, int target_face)
void InternalFlutterGpu_RenderPass_SetPrimitiveType(flutter::gpu::RenderPass *wrapper, int primitive_type)
void InternalFlutterGpu_RenderPass_SetColorBlendEquation(flutter::gpu::RenderPass *wrapper, int color_attachment_index, int color_blend_operation, int source_color_blend_factor, int destination_color_blend_factor, int alpha_blend_operation, int source_alpha_blend_factor, int destination_alpha_blend_factor)
Dart_Handle InternalFlutterGpu_RenderPass_SetColorAttachment(flutter::gpu::RenderPass *wrapper, flutter::gpu::Context *context, int color_attachment_index, int load_action, int store_action, float clear_color_r, float clear_color_g, float clear_color_b, float clear_color_a, flutter::gpu::Texture *texture, Dart_Handle resolve_texture_wrapper, int mip_level, int slice)
void InternalFlutterGpu_RenderPass_SetStencilReference(flutter::gpu::RenderPass *wrapper, int stencil_reference)
void InternalFlutterGpu_RenderPass_BindVertexBufferDevice(flutter::gpu::RenderPass *wrapper, flutter::gpu::DeviceBuffer *device_buffer, int offset_in_bytes, int length_in_bytes, int slot)
bool InternalFlutterGpu_RenderPass_BindTexture(flutter::gpu::RenderPass *wrapper, flutter::gpu::Shader *shader, Dart_Handle uniform_name_handle, flutter::gpu::Texture *texture, int min_filter, int mag_filter, int mip_filter, int width_address_mode, int height_address_mode)
Dart_Handle InternalFlutterGpu_RenderPass_Begin(flutter::gpu::RenderPass *wrapper, flutter::gpu::CommandBuffer *command_buffer)
void InternalFlutterGpu_RenderPass_SetDepthCompareOperation(flutter::gpu::RenderPass *wrapper, int compare_operation)
void InternalFlutterGpu_RenderPass_SetCullMode(flutter::gpu::RenderPass *wrapper, int cull_mode)
void InternalFlutterGpu_RenderPass_SetPolygonMode(flutter::gpu::RenderPass *wrapper, int polygon_mode)
bool InternalFlutterGpu_RenderPass_BindUniformDevice(flutter::gpu::RenderPass *wrapper, flutter::gpu::Shader *shader, Dart_Handle uniform_name_handle, flutter::gpu::DeviceBuffer *device_buffer, int offset_in_bytes, int length_in_bytes)
void InternalFlutterGpu_RenderPass_SetWindingOrder(flutter::gpu::RenderPass *wrapper, int winding_order)
void InternalFlutterGpu_RenderPass_SetScissor(flutter::gpu::RenderPass *wrapper, int x, int y, int width, int height)
void InternalFlutterGpu_RenderPass_SetColorBlendEnable(flutter::gpu::RenderPass *wrapper, int color_attachment_index, bool enable)
void InternalFlutterGpu_RenderPass_Initialize(Dart_Handle wrapper)
bool InternalFlutterGpu_RenderPass_DrawIndexed(flutter::gpu::RenderPass *wrapper, int index_count, int instance_count)
bool InternalFlutterGpu_RenderPass_Draw(flutter::gpu::RenderPass *wrapper, int vertex_count, int instance_count)
void InternalFlutterGpu_RenderPass_SetDepthWriteEnable(flutter::gpu::RenderPass *wrapper, bool enable)
static void BindVertexBuffer(flutter::gpu::RenderPass *wrapper, const std::shared_ptr< const impeller::DeviceBuffer > &buffer, int offset_in_bytes, int length_in_bytes, int slot)
void InternalFlutterGpu_RenderPass_SetViewport(flutter::gpu::RenderPass *wrapper, int x, int y, int width, int height, float z_near, float z_far)
void InternalFlutterGpu_RenderPass_BindIndexBufferDevice(flutter::gpu::RenderPass *wrapper, flutter::gpu::DeviceBuffer *device_buffer, int offset_in_bytes, int length_in_bytes, int index_type)
constexpr impeller::BlendFactor ToImpellerBlendFactor(FlutterGPUBlendFactor value)
bool SupportsNormalOffscreenMSAA(const impeller::Context &context)
constexpr impeller::BlendOperation ToImpellerBlendOperation(FlutterGPUBlendOperation value)
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode(FlutterGPUSamplerAddressMode value)
constexpr impeller::MipFilter ToImpellerMipFilter(FlutterGPUMipFilter value)
constexpr impeller::WindingOrder ToImpellerWindingOrder(FlutterGPUWindingOrder value)
constexpr impeller::CompareFunction ToImpellerCompareFunction(FlutterGPUCompareFunction value)
constexpr impeller::LoadAction ToImpellerLoadAction(FlutterGPULoadAction value)
constexpr impeller::StoreAction ToImpellerStoreAction(FlutterGPUStoreAction value)
constexpr impeller::PolygonMode ToImpellerPolygonMode(FlutterGPUPolygonMode value)
constexpr impeller::IndexType ToImpellerIndexType(FlutterGPUIndexType value)
constexpr impeller::StencilOperation ToImpellerStencilOperation(FlutterGPUStencilOperation value)
constexpr impeller::PrimitiveType ToImpellerPrimitiveType(FlutterGPUPrimitiveType value)
constexpr impeller::CullMode ToImpellerCullMode(FlutterGPUCullMode value)
constexpr impeller::MinMagFilter ToImpellerMinMagFilter(FlutterGPUMinMagFilter value)
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
internal::CopyableLambda< T > MakeCopyable(T lambda)
@ kNone
Does not use the index buffer.
constexpr bool IsDepthWritable(PixelFormat format)
constexpr bool IsStencilWritable(PixelFormat format)
Dart_Handle ToDart(const T &object)
std::string StdStringFromDart(Dart_Handle handle)
std::shared_ptr< ContextGLES > context
std::shared_ptr< PipelineGLES > pipeline
std::shared_ptr< CommandBuffer > command_buffer
impeller::SampledImageSlot slot
impeller::ShaderMetadata metadata
std::shared_ptr< Texture > resolve_texture
std::shared_ptr< Texture > texture
Describe the color attachment that will be used with this pipeline.
BlendOperation color_blend_op
CompareFunction depth_compare
SamplerAddressMode width_address_mode
SamplerAddressMode height_address_mode
StencilOperation stencil_failure
CompareFunction stencil_compare
StencilOperation depth_failure
StencilOperation depth_stencil_pass
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
combines the texture, sampler and sampler slot information.