Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
render_pass.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6#include <algorithm>
7#include <future>
8#include <memory>
9
13#include "fml/make_copyable.h"
14#include "fml/memory/ref_ptr.h"
24#include "lib/gpu/context.h"
27
28namespace flutter {
29namespace gpu {
30
32
33RenderPass::RenderPass() = default;
34
35RenderPass::~RenderPass() = default;
36
37const std::shared_ptr<const impeller::Context>& RenderPass::GetContext() const {
38 return render_pass_->GetContext();
39}
40
42 return render_target_;
43}
44
46 return render_target_;
47}
48
50 size_t color_attachment_index) {
51 auto color = color_descriptors_.find(color_attachment_index);
52 if (color == color_descriptors_.end()) {
53 return color_descriptors_[color_attachment_index] = {};
54 }
55 return color->second;
56}
57
60 return depth_desc_;
61}
62
65 return stencil_front_desc_;
66}
67
70 return stencil_back_desc_;
71}
72
74 return pipeline_descriptor_;
75}
76
78 render_pass_ =
79 command_buffer.GetCommandBuffer()->CreateRenderPass(render_target_);
80 if (!render_pass_) {
81 return false;
82 }
83 command_buffer.AddRenderPass(render_pass_);
84 return true;
85}
86
88 // On debug this makes a difference, but not on release builds.
89 // NOLINTNEXTLINE(performance-move-const-arg)
90 render_pipeline_ = std::move(pipeline);
91}
92
105
106std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>>
107RenderPass::GetOrCreatePipeline() {
108 // Infer the pipeline layout based on the shape of the RenderTarget.
109 auto pipeline_desc = pipeline_descriptor_;
110
111 pipeline_desc.SetSampleCount(render_target_.GetSampleCount());
112
113 render_target_.IterateAllColorAttachments(
114 [&](size_t index, const impeller::ColorAttachment& attachment) -> bool {
115 auto& color = GetColorAttachmentDescriptor(index);
116 color.format = render_target_.GetRenderTargetPixelFormat();
117 return true;
118 });
119
120 pipeline_desc.SetColorAttachmentDescriptors(color_descriptors_);
121
122 {
123 auto stencil = render_target_.GetStencilAttachment();
124 if (stencil && impeller::IsStencilWritable(
125 stencil->texture->GetTextureDescriptor().format)) {
126 pipeline_desc.SetStencilPixelFormat(
127 stencil->texture->GetTextureDescriptor().format);
128 pipeline_desc.SetStencilAttachmentDescriptors(stencil_front_desc_,
129 stencil_back_desc_);
130 } else {
131 pipeline_desc.ClearStencilAttachments();
132 }
133 }
134
135 {
136 auto depth = render_target_.GetDepthAttachment();
137 if (depth && impeller::IsDepthWritable(
138 depth->texture->GetTextureDescriptor().format)) {
139 pipeline_desc.SetDepthPixelFormat(
140 depth->texture->GetTextureDescriptor().format);
141 pipeline_desc.SetDepthStencilAttachmentDescriptor(depth_desc_);
142 } else {
143 pipeline_desc.ClearDepthAttachment();
144 }
145 }
146
147 auto& context = *GetContext();
148
149 render_pipeline_->BindToPipelineDescriptor(*context.GetShaderLibrary(),
150 pipeline_desc);
151
152 std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>> pipeline;
153
154 if (context.GetBackendType() == impeller::Context::BackendType::kOpenGLES &&
155 !context.GetPipelineLibrary()->HasPipeline(pipeline_desc)) {
156 // New pipeline creation for this backend must be done on the reactor
157 // (raster) thread. We're about the draw, so we need to synchronize with a
158 // raster task in order to get the new pipeline. Depending on how busy the
159 // raster thread is, this could hang the UI thread long enough to miss a
160 // frame.
161
162 // Note that this branch is only called if a new pipeline actually needs to
163 // be built.
164 auto dart_state = flutter::UIDartState::Current();
165 std::promise<
166 std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>>>
167 pipeline_promise;
168 auto pipeline_future = pipeline_promise.get_future();
170 dart_state->GetTaskRunners().GetRasterTaskRunner(),
171 fml::MakeCopyable([promise = std::move(pipeline_promise),
172 context = GetContext(), pipeline_desc]() mutable {
173 promise.set_value(context->GetPipelineLibrary()
174 ->GetPipeline(pipeline_desc, true, true)
175 .Get());
176 }));
177 pipeline = pipeline_future.get();
178 } else {
179 pipeline = context.GetPipelineLibrary()->GetPipeline(pipeline_desc).Get();
180 }
181
182 FML_DCHECK(pipeline) << "Couldn't resolve render pipeline";
183 return pipeline;
184}
185
186bool RenderPass::Draw(size_t element_count,
187 size_t instance_count,
188 bool indexed) {
189 if (element_count == 0u || instance_count == 0u) {
190 return true;
191 }
192
194 // drawIndexed was called without an index buffer bound.
195 return false;
196 }
197
198 render_pass_->SetPipeline(impeller::PipelineRef(GetOrCreatePipeline()));
199
200 for (const auto& [_, buffer] : vertex_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] : vertex_texture_bindings) {
208 render_pass_->BindDynamicResource(
210 texture.slot,
211 std::make_unique<impeller::ShaderMetadata>(
212 *texture.texture.GetMetadata()),
213 texture.texture.resource, texture.sampler);
214 }
215 for (const auto& [_, buffer] : fragment_uniform_bindings) {
216 render_pass_->BindDynamicResource(
219 std::make_unique<impeller::ShaderMetadata>(*buffer.view.GetMetadata()),
220 buffer.view.resource);
221 }
222 for (const auto& [_, texture] : fragment_texture_bindings) {
223 render_pass_->BindDynamicResource(
226 std::make_unique<impeller::ShaderMetadata>(
227 *texture.texture.GetMetadata()),
228 texture.texture.resource, texture.sampler);
229 }
230
231 render_pass_->SetVertexBuffer(vertex_buffers.data(), vertex_buffer_count);
232 if (indexed) {
233 render_pass_->SetIndexBuffer(index_buffer, index_buffer_type);
234 } else {
235 render_pass_->SetIndexBuffer(impeller::BufferView{},
237 }
238 render_pass_->SetElementCount(element_count);
239 render_pass_->SetInstanceCount(instance_count);
240
241 render_pass_->SetStencilReference(stencil_reference);
242
243 if (viewport.has_value()) {
244 render_pass_->SetViewport(viewport.value());
245 }
246
247 if (scissor.has_value()) {
248 render_pass_->SetScissor(scissor.value());
249 }
250
251 bool result = render_pass_->Draw().ok();
252
253 return result;
254}
255
256} // namespace gpu
257} // namespace flutter
258
259//----------------------------------------------------------------------------
260/// Exports
261///
262
264 auto res = fml::MakeRefCounted<flutter::gpu::RenderPass>();
265 res->AssociateWithDartWrapper(wrapper);
266}
267
271 int color_attachment_index,
272 int load_action,
273 int store_action,
274 float clear_color_r,
275 float clear_color_g,
276 float clear_color_b,
277 float clear_color_a,
279 Dart_Handle resolve_texture_wrapper,
280 int mip_level,
281 int slice) {
285 desc.clear_color = impeller::Color(clear_color_r, clear_color_g,
286 clear_color_b, clear_color_a);
287 desc.texture = texture->GetTexture();
288 desc.mip_level = mip_level;
289 desc.slice = slice;
290 if (!Dart_IsNull(resolve_texture_wrapper)) {
291 flutter::gpu::Texture* resolve_texture =
293 resolve_texture_wrapper);
294 desc.resolve_texture = resolve_texture->GetTexture();
295
296 // If the backend doesn't support normal MSAA, gracefully fallback to
297 // rendering without MSAA.
299 desc.texture = desc.resolve_texture;
300 desc.resolve_texture = nullptr;
302 }
303 }
304 wrapper->GetRenderTarget().SetColorAttachment(desc, color_attachment_index);
305 return Dart_Null();
306}
307
310 int depth_load_action,
311 int depth_store_action,
312 float depth_clear_value,
313 int stencil_load_action,
314 int stencil_store_action,
315 int stencil_clear_value,
317 int mip_level,
318 int slice) {
319 {
321 desc.load_action = flutter::gpu::ToImpellerLoadAction(depth_load_action);
322 desc.store_action = flutter::gpu::ToImpellerStoreAction(depth_store_action);
323 desc.clear_depth = depth_clear_value;
324 desc.texture = texture->GetTexture();
325 desc.mip_level = mip_level;
326 desc.slice = slice;
327 wrapper->GetRenderTarget().SetDepthAttachment(desc);
328 }
329 {
331 desc.load_action = flutter::gpu::ToImpellerLoadAction(stencil_load_action);
332 desc.store_action =
333 flutter::gpu::ToImpellerStoreAction(stencil_store_action);
334 desc.clear_stencil = stencil_clear_value;
335 desc.texture = texture->GetTexture();
336 desc.mip_level = mip_level;
337 desc.slice = slice;
338 wrapper->GetRenderTarget().SetStencilAttachment(desc);
339 }
340
341 return Dart_Null();
342}
343
347 if (!wrapper->Begin(*command_buffer)) {
348 return tonic::ToDart("Failed to begin RenderPass");
349 }
350 return Dart_Null();
351}
352
359
362 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
363 int offset_in_bytes,
364 int length_in_bytes,
365 int slot) {
366 if (slot < 0 || static_cast<size_t>(slot) >=
368 return;
369 }
370 wrapper->vertex_buffers[slot] = impeller::BufferView(
371 buffer, impeller::Range(offset_in_bytes, length_in_bytes));
372 if (static_cast<size_t>(slot) >= wrapper->vertex_buffer_count) {
373 wrapper->vertex_buffer_count = static_cast<size_t>(slot) + 1;
374 }
375}
376
379 flutter::gpu::DeviceBuffer* device_buffer,
380 int offset_in_bytes,
381 int length_in_bytes,
382 int slot) {
383 BindVertexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
384 length_in_bytes, slot);
385}
386
387static void BindIndexBuffer(
389 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
390 int offset_in_bytes,
391 int length_in_bytes,
392 int index_type) {
394 buffer, impeller::Range(offset_in_bytes, length_in_bytes));
396}
397
400 flutter::gpu::DeviceBuffer* device_buffer,
401 int offset_in_bytes,
402 int length_in_bytes,
403 int index_type) {
404 BindIndexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
405 length_in_bytes, index_type);
406}
407
408static bool BindUniform(
410 flutter::gpu::Shader* shader,
411 Dart_Handle uniform_name_handle,
412 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
413 int offset_in_bytes,
414 int length_in_bytes) {
415 auto uniform_name = tonic::StdStringFromDart(uniform_name_handle);
416 const flutter::gpu::Shader::UniformBinding* uniform_struct =
418 // TODO(bdero): Return an error string stating that no uniform struct with
419 // this name exists and throw an exception.
420 if (!uniform_struct) {
421 return false;
422 }
423
424 flutter::gpu::RenderPass::BufferUniformMap* uniform_map = nullptr;
425 switch (shader->GetShaderStage()) {
427 uniform_map = &wrapper->vertex_uniform_bindings;
428 break;
430 uniform_map = &wrapper->fragment_uniform_bindings;
431 break;
434 return false;
435 }
436
437 if (!buffer || static_cast<size_t>(offset_in_bytes + length_in_bytes) >
438 buffer->GetDeviceBufferDescriptor().size) {
439 return false;
440 }
441
442 uniform_map->insert_or_assign(
443 uniform_struct,
445 .slot = uniform_struct->slot,
447 &uniform_struct->metadata,
449 buffer, impeller::Range(offset_in_bytes, length_in_bytes)),
450 }});
451 return true;
452}
453
456 flutter::gpu::Shader* shader,
457 Dart_Handle uniform_name_handle,
458 flutter::gpu::DeviceBuffer* device_buffer,
459 int offset_in_bytes,
460 int length_in_bytes) {
461 return BindUniform(wrapper, shader, uniform_name_handle,
462 device_buffer->GetBuffer(), offset_in_bytes,
463 length_in_bytes);
464}
465
468 flutter::gpu::Shader* shader,
469 Dart_Handle uniform_name_handle,
471 int min_filter,
472 int mag_filter,
473 int mip_filter,
474 int width_address_mode,
475 int height_address_mode,
476 int max_anisotropy) {
477 auto uniform_name = tonic::StdStringFromDart(uniform_name_handle);
478 const flutter::gpu::Shader::TextureBinding* texture_binding =
480 // TODO(bdero): Return an error string stating that no uniform texture with
481 // this name exists and throw an exception.
482 if (!texture_binding) {
483 return false;
484 }
485
486 impeller::SamplerDescriptor sampler_desc;
487 sampler_desc.min_filter = flutter::gpu::ToImpellerMinMagFilter(min_filter);
488 sampler_desc.mag_filter = flutter::gpu::ToImpellerMinMagFilter(mag_filter);
489 sampler_desc.mip_filter = flutter::gpu::ToImpellerMipFilter(mip_filter);
490 sampler_desc.width_address_mode =
492 sampler_desc.height_address_mode =
494 // Backends clamp this to the device limit reported by
495 // Capabilities::GetMaxSamplerAnisotropy.
496 sampler_desc.max_anisotropy =
497 static_cast<uint8_t>(std::clamp(max_anisotropy, 1, 255));
498 auto sampler =
499 wrapper->GetContext()->GetSamplerLibrary()->GetSampler(sampler_desc);
500
501 flutter::gpu::RenderPass::TextureUniformMap* uniform_map = nullptr;
502 switch (shader->GetShaderStage()) {
504 uniform_map = &wrapper->vertex_texture_bindings;
505 break;
507 uniform_map = &wrapper->fragment_texture_bindings;
508 break;
511 return false;
512 }
513 uniform_map->insert_or_assign(
514 texture_binding,
516 .slot = texture_binding->slot,
517 .texture = {&texture_binding->metadata, texture->GetTexture()},
518 .sampler = sampler,
519 });
520 return true;
521}
522
527
530 int color_attachment_index,
531 bool enable) {
532 auto& color = wrapper->GetColorAttachmentDescriptor(color_attachment_index);
533 color.blending_enabled = enable;
534}
535
538 int color_attachment_index,
539 int color_blend_operation,
540 int source_color_blend_factor,
541 int destination_color_blend_factor,
542 int alpha_blend_operation,
543 int source_alpha_blend_factor,
544 int destination_alpha_blend_factor) {
545 auto& color = wrapper->GetColorAttachmentDescriptor(color_attachment_index);
546 color.color_blend_op =
547 flutter::gpu::ToImpellerBlendOperation(color_blend_operation);
548 color.src_color_blend_factor =
549 flutter::gpu::ToImpellerBlendFactor(source_color_blend_factor);
550 color.dst_color_blend_factor =
551 flutter::gpu::ToImpellerBlendFactor(destination_color_blend_factor);
552 color.alpha_blend_op =
553 flutter::gpu::ToImpellerBlendOperation(alpha_blend_operation);
554 color.src_alpha_blend_factor =
555 flutter::gpu::ToImpellerBlendFactor(source_alpha_blend_factor);
556 color.dst_alpha_blend_factor =
557 flutter::gpu::ToImpellerBlendFactor(destination_alpha_blend_factor);
558}
559
562 bool enable) {
563 auto& depth = wrapper->GetDepthAttachmentDescriptor();
564 depth.depth_write_enabled = enable;
565}
566
569 int compare_operation) {
570 auto& depth = wrapper->GetDepthAttachmentDescriptor();
571 depth.depth_compare =
573}
574
577 int stencil_reference) {
578 wrapper->stencil_reference = static_cast<uint32_t>(stencil_reference);
579}
580
582 int x,
583 int y,
584 int width,
585 int height) {
587}
588
591 int x,
592 int y,
593 int width,
594 int height,
595 float z_near,
596 float z_far) {
598
599 auto depth_range = impeller::DepthRange();
600 depth_range.z_near = z_near;
601 depth_range.z_far = z_far;
602
603 auto viewport = impeller::Viewport();
604 viewport.rect = rect;
605 viewport.depth_range = depth_range;
606
607 wrapper->viewport = viewport;
608}
609
612 int stencil_compare_operation,
613 int stencil_fail_operation,
614 int depth_fail_operation,
615 int depth_stencil_pass_operation,
616 int read_mask,
617 int write_mask,
618 int target_face) {
620 desc.stencil_compare =
621 flutter::gpu::ToImpellerCompareFunction(stencil_compare_operation);
622 desc.stencil_failure =
623 flutter::gpu::ToImpellerStencilOperation(stencil_fail_operation);
624 desc.depth_failure =
625 flutter::gpu::ToImpellerStencilOperation(depth_fail_operation);
626 desc.depth_stencil_pass =
627 flutter::gpu::ToImpellerStencilOperation(depth_stencil_pass_operation);
628 desc.read_mask = static_cast<uint32_t>(read_mask);
629 desc.write_mask = static_cast<uint32_t>(write_mask);
630
631 // Corresponds to the `StencilFace` enum in `gpu/lib/src/render_pass.dart`.
632 if (target_face != 2 /* both or front */) {
633 wrapper->GetStencilFrontAttachmentDescriptor() = desc;
634 }
635 if (target_face != 1 /* both or back */) {
636 wrapper->GetStencilBackAttachmentDescriptor() = desc;
637 }
638}
639
642 int cull_mode) {
643 impeller::PipelineDescriptor& pipeline_descriptor =
644 wrapper->GetPipelineDescriptor();
645 pipeline_descriptor.SetCullMode(flutter::gpu::ToImpellerCullMode(cull_mode));
646}
647
650 int primitive_type) {
651 impeller::PipelineDescriptor& pipeline_descriptor =
652 wrapper->GetPipelineDescriptor();
653 pipeline_descriptor.SetPrimitiveType(
655}
656
659 int winding_order) {
660 impeller::PipelineDescriptor& pipeline_descriptor =
661 wrapper->GetPipelineDescriptor();
662 pipeline_descriptor.SetWindingOrder(
664}
665
668 int polygon_mode) {
669 impeller::PipelineDescriptor& pipeline_descriptor =
670 wrapper->GetPipelineDescriptor();
671 pipeline_descriptor.SetPolygonMode(
673}
674
676 int vertex_count,
677 int instance_count) {
678 // Guard the casts to size_t; a negative value would wrap.
679 return vertex_count >= 0 && instance_count >= 0 &&
680 wrapper->Draw(vertex_count, instance_count, /*indexed=*/false);
681}
682
685 int index_count,
686 int instance_count) {
687 // Guard the casts to size_t; a negative value would wrap.
688 return index_count >= 0 && instance_count >= 0 &&
689 wrapper->Draw(index_count, instance_count, /*indexed=*/true);
690}
static UIDartState * Current()
std::shared_ptr< impeller::DeviceBuffer > GetBuffer()
std::optional< impeller::Viewport > viewport
Definition render_pass.h:96
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
Definition render_pass.h:71
static constexpr size_t kMaxVertexBufferSlots
Definition render_pass.h:87
impeller::DepthAttachmentDescriptor & GetDepthAttachmentDescriptor()
std::unordered_map< const flutter::gpu::Shader::TextureBinding *, impeller::TextureAndSampler > TextureUniformMap
Definition render_pass.h:74
std::optional< impeller::IRect32 > scissor
Definition render_pass.h:95
TextureUniformMap fragment_texture_bindings
Definition render_pass.h:79
BufferUniformMap fragment_uniform_bindings
Definition render_pass.h:78
TextureUniformMap vertex_texture_bindings
Definition render_pass.h:77
BufferUniformMap vertex_uniform_bindings
Definition render_pass.h:76
impeller::IndexType index_buffer_type
Definition render_pass.h:92
std::array< impeller::BufferView, kMaxVertexBufferSlots > vertex_buffers
Definition render_pass.h:88
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
Definition render_pass.h:91
An immutable collection of shaders loaded from a shader bundle asset.
Definition shader.h:23
const Shader::UniformBinding * GetUniformStruct(const std::string &name) const
Definition shader.cc:176
impeller::ShaderStage GetShaderStage() const
Definition shader.cc:167
const Shader::TextureBinding * GetUniformTexture(const std::string &name) const
Definition shader.cc:185
std::shared_ptr< impeller::Texture > GetTexture()
Definition texture.cc:43
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
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
std::string uniform_name
#define IMPLEMENT_WRAPPERTYPEINFO(LibraryName, ClassName)
int32_t x
#define FML_DCHECK(condition)
Definition logging.h:122
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)
Dart_Handle InternalFlutterGpu_RenderPass_Begin(flutter::gpu::RenderPass *wrapper, flutter::gpu::CommandBuffer *command_buffer)
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, int max_anisotropy)
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)
FlTexture * texture
double y
constexpr impeller::BlendFactor ToImpellerBlendFactor(FlutterGPUBlendFactor value)
Definition formats.h:279
bool SupportsNormalOffscreenMSAA(const impeller::Context &context)
Definition context.cc:21
constexpr impeller::BlendOperation ToImpellerBlendOperation(FlutterGPUBlendOperation value)
Definition formats.h:325
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode(FlutterGPUSamplerAddressMode value)
Definition formats.h:465
constexpr impeller::MipFilter ToImpellerMipFilter(FlutterGPUMipFilter value)
Definition formats.h:446
constexpr impeller::WindingOrder ToImpellerWindingOrder(FlutterGPUWindingOrder value)
Definition formats.h:630
constexpr impeller::CompareFunction ToImpellerCompareFunction(FlutterGPUCompareFunction value)
Definition formats.h:539
constexpr impeller::LoadAction ToImpellerLoadAction(FlutterGPULoadAction value)
Definition formats.h:347
constexpr impeller::StoreAction ToImpellerStoreAction(FlutterGPUStoreAction value)
Definition formats.h:370
constexpr impeller::PolygonMode ToImpellerPolygonMode(FlutterGPUPolygonMode value)
Definition formats.h:649
constexpr impeller::IndexType ToImpellerIndexType(FlutterGPUIndexType value)
Definition formats.h:487
constexpr impeller::StencilOperation ToImpellerStencilOperation(FlutterGPUStencilOperation value)
Definition formats.h:577
constexpr impeller::PrimitiveType ToImpellerPrimitiveType(FlutterGPUPrimitiveType value)
Definition formats.h:508
constexpr impeller::CullMode ToImpellerCullMode(FlutterGPUCullMode value)
Definition formats.h:610
constexpr impeller::MinMagFilter ToImpellerMinMagFilter(FlutterGPUMinMagFilter value)
Definition formats.h:427
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
internal::CopyableLambda< T > MakeCopyable(T lambda)
@ kNone
Does not use the index buffer.
constexpr bool IsDepthWritable(PixelFormat format)
Definition formats.h:271
constexpr bool IsStencilWritable(PixelFormat format)
Definition formats.h:281
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
int32_t height
int32_t width
impeller::SampledImageSlot slot
Definition shader.h:38
impeller::ShaderMetadata metadata
Definition shader.h:39
impeller::ShaderMetadata metadata
Definition shader.h:30
impeller::ShaderUniformSlot slot
Definition shader.h:29
std::shared_ptr< Texture > resolve_texture
Definition formats.h:910
LoadAction load_action
Definition formats.h:911
std::shared_ptr< Texture > texture
Definition formats.h:909
StoreAction store_action
Definition formats.h:912
Describe the color attachment that will be used with this pipeline.
Definition formats.h:770
SamplerAddressMode width_address_mode
SamplerAddressMode height_address_mode
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
Definition rect.h:136
combines the texture, sampler and sampler slot information.
Definition command.h:59
SampledImageSlot slot
Definition command.h:60