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 <future>
7#include <memory>
8
12#include "fml/make_copyable.h"
13#include "fml/memory/ref_ptr.h"
23#include "lib/gpu/context.h"
26
27namespace flutter {
28namespace gpu {
29
31
32RenderPass::RenderPass() = default;
33
34RenderPass::~RenderPass() = default;
35
36const std::shared_ptr<const impeller::Context>& RenderPass::GetContext() const {
37 return render_pass_->GetContext();
38}
39
41 return render_target_;
42}
43
45 return render_target_;
46}
47
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] = {};
53 }
54 return color->second;
55}
56
59 return depth_desc_;
60}
61
64 return stencil_front_desc_;
65}
66
69 return stencil_back_desc_;
70}
71
73 return pipeline_descriptor_;
74}
75
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}
85
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}
91
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 // For GLES, new pipeline creation must be done on the reactor (raster)
157 // thread. We're about the draw, so we need to synchronize with a raster
158 // task in order to get the new pipeline. Depending on how busy the raster
159 // thread is, this could hang the UI thread long enough to miss a frame.
160
161 // Note that this branch is only called if a new pipeline actually needs to
162 // be built.
163 auto dart_state = flutter::UIDartState::Current();
164 std::promise<
165 std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>>>
166 pipeline_promise;
167 auto pipeline_future = pipeline_promise.get_future();
169 dart_state->GetTaskRunners().GetRasterTaskRunner(),
170 fml::MakeCopyable([promise = std::move(pipeline_promise),
171 context = GetContext(), pipeline_desc]() mutable {
172 promise.set_value(context->GetPipelineLibrary()
173 ->GetPipeline(pipeline_desc, true, true)
174 .Get());
175 }));
176 pipeline = pipeline_future.get();
177 } else {
178 pipeline = context.GetPipelineLibrary()->GetPipeline(pipeline_desc).Get();
179 }
180
181 FML_DCHECK(pipeline) << "Couldn't resolve render pipeline";
182 return pipeline;
183}
184
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}
237
238} // namespace gpu
239} // namespace flutter
240
241//----------------------------------------------------------------------------
242/// Exports
243///
244
246 auto res = fml::MakeRefCounted<flutter::gpu::RenderPass>();
247 res->AssociateWithDartWrapper(wrapper);
248}
249
252 flutter::gpu::Context* context,
253 int color_attachment_index,
254 int load_action,
255 int store_action,
256 float clear_color_r,
257 float clear_color_g,
258 float clear_color_b,
259 float clear_color_a,
261 Dart_Handle resolve_texture_wrapper) {
265 desc.clear_color = impeller::Color(clear_color_r, clear_color_g,
266 clear_color_b, clear_color_a);
267 desc.texture = texture->GetTexture();
268 if (!Dart_IsNull(resolve_texture_wrapper)) {
269 flutter::gpu::Texture* resolve_texture =
271 resolve_texture_wrapper);
272 desc.resolve_texture = resolve_texture->GetTexture();
273
274 // If the backend doesn't support normal MSAA, gracefully fallback to
275 // rendering without MSAA.
277 desc.texture = desc.resolve_texture;
278 desc.resolve_texture = nullptr;
280 }
281 }
282 wrapper->GetRenderTarget().SetColorAttachment(desc, color_attachment_index);
283 return Dart_Null();
284}
285
288 int depth_load_action,
289 int depth_store_action,
290 float depth_clear_value,
291 int stencil_load_action,
292 int stencil_store_action,
293 int stencil_clear_value,
295 {
297 desc.load_action = flutter::gpu::ToImpellerLoadAction(depth_load_action);
298 desc.store_action = flutter::gpu::ToImpellerStoreAction(depth_store_action);
299 desc.clear_depth = depth_clear_value;
300 desc.texture = texture->GetTexture();
301 wrapper->GetRenderTarget().SetDepthAttachment(desc);
302 }
303 {
305 desc.load_action = flutter::gpu::ToImpellerLoadAction(stencil_load_action);
306 desc.store_action =
307 flutter::gpu::ToImpellerStoreAction(stencil_store_action);
308 desc.clear_stencil = stencil_clear_value;
309 desc.texture = texture->GetTexture();
310 wrapper->GetRenderTarget().SetStencilAttachment(desc);
311 }
312
313 return Dart_Null();
314}
315
318 flutter::gpu::CommandBuffer* command_buffer) {
319 if (!wrapper->Begin(*command_buffer)) {
320 return tonic::ToDart("Failed to begin RenderPass");
321 }
322 return Dart_Null();
323}
324
329 wrapper->SetPipeline(std::move(ref));
330}
331
334 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
335 int offset_in_bytes,
336 int length_in_bytes,
337 int vertex_count,
338 int slot) {
339 if (slot < 0 || static_cast<size_t>(slot) >=
341 return;
342 }
343 wrapper->vertex_buffers[slot] = impeller::BufferView(
344 buffer, impeller::Range(offset_in_bytes, length_in_bytes));
345 if (static_cast<size_t>(slot) >= wrapper->vertex_buffer_count) {
346 wrapper->vertex_buffer_count = static_cast<size_t>(slot) + 1;
347 }
348
349 // `vertex_count` is only meaningful for slot 0: the Dart-side docstring
350 // for `bindVertexBuffer` states that for slots > 0 the value is ignored
351 // (the slot-0 binding determines the draw range). When the index type is
352 // set, `vertex_count` would become the index count and is already set by
353 // the index-buffer binding path, so we only assign it here if no index
354 // buffer has been bound.
355 // TODO(bdero): Consider just doing a more traditional API with
356 // draw(vertexCount) and drawIndexed(indexCount). This is fine,
357 // but overall it would be a bit more explicit and we wouldn't
358 // have to document this behavior where the presence of the index
359 // buffer always takes precedent.
360 if (slot == 0 && !wrapper->has_index_buffer) {
361 wrapper->element_count = vertex_count;
362 }
363}
364
367 flutter::gpu::DeviceBuffer* device_buffer,
368 int offset_in_bytes,
369 int length_in_bytes,
370 int vertex_count,
371 int slot) {
372 BindVertexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
373 length_in_bytes, vertex_count, slot);
374}
375
376static void BindIndexBuffer(
378 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
379 int offset_in_bytes,
380 int length_in_bytes,
381 int index_type,
382 int index_count) {
385 buffer, impeller::Range(offset_in_bytes, length_in_bytes));
386 wrapper->index_buffer_type = type;
387
388 bool setting_index_buffer = type != impeller::IndexType::kNone;
389 if (setting_index_buffer) {
390 wrapper->element_count = index_count;
391 }
392 wrapper->has_index_buffer = setting_index_buffer;
393}
394
397 flutter::gpu::DeviceBuffer* device_buffer,
398 int offset_in_bytes,
399 int length_in_bytes,
400 int index_type,
401 int index_count) {
402 BindIndexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
403 length_in_bytes, index_type, index_count);
404}
405
406static bool BindUniform(
408 flutter::gpu::Shader* shader,
409 Dart_Handle uniform_name_handle,
410 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
411 int offset_in_bytes,
412 int length_in_bytes) {
413 auto uniform_name = tonic::StdStringFromDart(uniform_name_handle);
414 const flutter::gpu::Shader::UniformBinding* uniform_struct =
416 // TODO(bdero): Return an error string stating that no uniform struct with
417 // this name exists and throw an exception.
418 if (!uniform_struct) {
419 return false;
420 }
421
422 flutter::gpu::RenderPass::BufferUniformMap* uniform_map = nullptr;
423 switch (shader->GetShaderStage()) {
425 uniform_map = &wrapper->vertex_uniform_bindings;
426 break;
428 uniform_map = &wrapper->fragment_uniform_bindings;
429 break;
432 return false;
433 }
434
435 if (!buffer || static_cast<size_t>(offset_in_bytes + length_in_bytes) >
436 buffer->GetDeviceBufferDescriptor().size) {
437 return false;
438 }
439
440 uniform_map->insert_or_assign(
441 uniform_struct,
443 .slot = uniform_struct->slot,
445 &uniform_struct->metadata,
447 buffer, impeller::Range(offset_in_bytes, length_in_bytes)),
448 }});
449 return true;
450}
451
454 flutter::gpu::Shader* shader,
455 Dart_Handle uniform_name_handle,
456 flutter::gpu::DeviceBuffer* device_buffer,
457 int offset_in_bytes,
458 int length_in_bytes) {
459 return BindUniform(wrapper, shader, uniform_name_handle,
460 device_buffer->GetBuffer(), offset_in_bytes,
461 length_in_bytes);
462}
463
466 flutter::gpu::Shader* shader,
467 Dart_Handle uniform_name_handle,
469 int min_filter,
470 int mag_filter,
471 int mip_filter,
472 int width_address_mode,
473 int height_address_mode) {
474 auto uniform_name = tonic::StdStringFromDart(uniform_name_handle);
475 const flutter::gpu::Shader::TextureBinding* texture_binding =
477 // TODO(bdero): Return an error string stating that no uniform texture with
478 // this name exists and throw an exception.
479 if (!texture_binding) {
480 return false;
481 }
482
483 impeller::SamplerDescriptor sampler_desc;
484 sampler_desc.min_filter = flutter::gpu::ToImpellerMinMagFilter(min_filter);
485 sampler_desc.mag_filter = flutter::gpu::ToImpellerMinMagFilter(mag_filter);
486 sampler_desc.mip_filter = flutter::gpu::ToImpellerMipFilter(mip_filter);
487 sampler_desc.width_address_mode =
489 sampler_desc.height_address_mode =
491 auto sampler =
492 wrapper->GetContext()->GetSamplerLibrary()->GetSampler(sampler_desc);
493
494 flutter::gpu::RenderPass::TextureUniformMap* uniform_map = nullptr;
495 switch (shader->GetShaderStage()) {
497 uniform_map = &wrapper->vertex_texture_bindings;
498 break;
500 uniform_map = &wrapper->fragment_texture_bindings;
501 break;
504 return false;
505 }
506 uniform_map->insert_or_assign(
507 texture_binding,
509 .slot = texture_binding->slot,
510 .texture = {&texture_binding->metadata, texture->GetTexture()},
511 .sampler = sampler,
512 });
513 return true;
514}
515
520
523 int color_attachment_index,
524 bool enable) {
525 auto& color = wrapper->GetColorAttachmentDescriptor(color_attachment_index);
526 color.blending_enabled = enable;
527}
528
531 int color_attachment_index,
532 int color_blend_operation,
533 int source_color_blend_factor,
534 int destination_color_blend_factor,
535 int alpha_blend_operation,
536 int source_alpha_blend_factor,
537 int destination_alpha_blend_factor) {
538 auto& color = wrapper->GetColorAttachmentDescriptor(color_attachment_index);
539 color.color_blend_op =
540 flutter::gpu::ToImpellerBlendOperation(color_blend_operation);
541 color.src_color_blend_factor =
542 flutter::gpu::ToImpellerBlendFactor(source_color_blend_factor);
543 color.dst_color_blend_factor =
544 flutter::gpu::ToImpellerBlendFactor(destination_color_blend_factor);
545 color.alpha_blend_op =
546 flutter::gpu::ToImpellerBlendOperation(alpha_blend_operation);
547 color.src_alpha_blend_factor =
548 flutter::gpu::ToImpellerBlendFactor(source_alpha_blend_factor);
549 color.dst_alpha_blend_factor =
550 flutter::gpu::ToImpellerBlendFactor(destination_alpha_blend_factor);
551}
552
555 bool enable) {
556 auto& depth = wrapper->GetDepthAttachmentDescriptor();
557 depth.depth_write_enabled = true;
558}
559
562 int compare_operation) {
563 auto& depth = wrapper->GetDepthAttachmentDescriptor();
564 depth.depth_compare =
566}
567
570 int stencil_reference) {
571 wrapper->stencil_reference = static_cast<uint32_t>(stencil_reference);
572}
573
575 int x,
576 int y,
577 int width,
578 int height) {
580}
581
584 int x,
585 int y,
586 int width,
587 int height,
588 float z_near,
589 float z_far) {
591
592 auto depth_range = impeller::DepthRange();
593 depth_range.z_near = z_near;
594 depth_range.z_far = z_far;
595
596 auto viewport = impeller::Viewport();
597 viewport.rect = rect;
598 viewport.depth_range = depth_range;
599
600 wrapper->viewport = viewport;
601}
602
605 int stencil_compare_operation,
606 int stencil_fail_operation,
607 int depth_fail_operation,
608 int depth_stencil_pass_operation,
609 int read_mask,
610 int write_mask,
611 int target_face) {
613 desc.stencil_compare =
614 flutter::gpu::ToImpellerCompareFunction(stencil_compare_operation);
615 desc.stencil_failure =
616 flutter::gpu::ToImpellerStencilOperation(stencil_fail_operation);
617 desc.depth_failure =
618 flutter::gpu::ToImpellerStencilOperation(depth_fail_operation);
619 desc.depth_stencil_pass =
620 flutter::gpu::ToImpellerStencilOperation(depth_stencil_pass_operation);
621 desc.read_mask = static_cast<uint32_t>(read_mask);
622 desc.write_mask = static_cast<uint32_t>(write_mask);
623
624 // Corresponds to the `StencilFace` enum in `gpu/lib/src/render_pass.dart`.
625 if (target_face != 2 /* both or front */) {
626 wrapper->GetStencilFrontAttachmentDescriptor() = desc;
627 }
628 if (target_face != 1 /* both or back */) {
629 wrapper->GetStencilBackAttachmentDescriptor() = desc;
630 }
631}
632
635 int cull_mode) {
636 impeller::PipelineDescriptor& pipeline_descriptor =
637 wrapper->GetPipelineDescriptor();
638 pipeline_descriptor.SetCullMode(flutter::gpu::ToImpellerCullMode(cull_mode));
639}
640
643 int primitive_type) {
644 impeller::PipelineDescriptor& pipeline_descriptor =
645 wrapper->GetPipelineDescriptor();
646 pipeline_descriptor.SetPrimitiveType(
648}
649
652 int winding_order) {
653 impeller::PipelineDescriptor& pipeline_descriptor =
654 wrapper->GetPipelineDescriptor();
655 pipeline_descriptor.SetWindingOrder(
657}
658
661 int polygon_mode) {
662 impeller::PipelineDescriptor& pipeline_descriptor =
663 wrapper->GetPipelineDescriptor();
664 pipeline_descriptor.SetPolygonMode(
666}
667
669 return wrapper->Draw();
670}
static UIDartState * Current()
std::shared_ptr< impeller::CommandBuffer > GetCommandBuffer()
void AddRenderPass(std::shared_ptr< impeller::RenderPass > render_pass)
impeller::Context & GetContext()
Definition context.cc:84
std::shared_ptr< impeller::DeviceBuffer > GetBuffer()
std::optional< impeller::Viewport > viewport
Definition render_pass.h:95
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:68
static constexpr size_t kMaxVertexBufferSlots
Definition render_pass.h:85
impeller::DepthAttachmentDescriptor & GetDepthAttachmentDescriptor()
std::unordered_map< const flutter::gpu::Shader::TextureBinding *, impeller::TextureAndSampler > TextureUniformMap
Definition render_pass.h:71
std::optional< impeller::IRect32 > scissor
Definition render_pass.h:94
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::StencilAttachmentDescriptor & GetStencilFrontAttachmentDescriptor()
impeller::ColorAttachmentDescriptor & GetColorAttachmentDescriptor(size_t color_attachment_index)
impeller::PipelineDescriptor & GetPipelineDescriptor()
const std::shared_ptr< const impeller::Context > & GetContext() const
impeller::BufferView index_buffer
Definition render_pass.h:89
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:122
impeller::ShaderStage GetShaderStage() const
Definition shader.cc:113
const Shader::TextureBinding * GetUniformTexture(const std::string &name) const
Definition shader.cc:131
std::shared_ptr< impeller::Texture > GetTexture()
Definition texture.cc:38
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)
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)
void InternalFlutterGpu_RenderPass_BindVertexBufferDevice(flutter::gpu::RenderPass *wrapper, flutter::gpu::DeviceBuffer *device_buffer, int offset_in_bytes, int length_in_bytes, int vertex_count, int slot)
void InternalFlutterGpu_RenderPass_ClearBindings(flutter::gpu::RenderPass *wrapper)
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, int index_count)
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)
void InternalFlutterGpu_RenderPass_BindIndexBufferDevice(flutter::gpu::RenderPass *wrapper, flutter::gpu::DeviceBuffer *device_buffer, int offset_in_bytes, int length_in_bytes, int index_type, int index_count)
void InternalFlutterGpu_RenderPass_SetStencilReference(flutter::gpu::RenderPass *wrapper, int stencil_reference)
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)
static void BindVertexBuffer(flutter::gpu::RenderPass *wrapper, const std::shared_ptr< const impeller::DeviceBuffer > &buffer, int offset_in_bytes, int length_in_bytes, int vertex_count, int slot)
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)
void InternalFlutterGpu_RenderPass_SetDepthWriteEnable(flutter::gpu::RenderPass *wrapper, bool enable)
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)
bool InternalFlutterGpu_RenderPass_Draw(flutter::gpu::RenderPass *wrapper)
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)
void InternalFlutterGpu_RenderPass_SetViewport(flutter::gpu::RenderPass *wrapper, int x, int y, int width, int height, float z_near, float z_far)
FlTexture * texture
double y
constexpr impeller::BlendFactor ToImpellerBlendFactor(FlutterGPUBlendFactor value)
Definition formats.h:182
bool SupportsNormalOffscreenMSAA(const impeller::Context &context)
Definition context.cc:18
constexpr impeller::BlendOperation ToImpellerBlendOperation(FlutterGPUBlendOperation value)
Definition formats.h:228
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode(FlutterGPUSamplerAddressMode value)
Definition formats.h:368
constexpr impeller::MipFilter ToImpellerMipFilter(FlutterGPUMipFilter value)
Definition formats.h:349
constexpr impeller::WindingOrder ToImpellerWindingOrder(FlutterGPUWindingOrder value)
Definition formats.h:533
constexpr impeller::CompareFunction ToImpellerCompareFunction(FlutterGPUCompareFunction value)
Definition formats.h:442
constexpr impeller::LoadAction ToImpellerLoadAction(FlutterGPULoadAction value)
Definition formats.h:250
constexpr impeller::StoreAction ToImpellerStoreAction(FlutterGPUStoreAction value)
Definition formats.h:273
constexpr impeller::PolygonMode ToImpellerPolygonMode(FlutterGPUPolygonMode value)
Definition formats.h:552
constexpr impeller::IndexType ToImpellerIndexType(FlutterGPUIndexType value)
Definition formats.h:390
constexpr impeller::StencilOperation ToImpellerStencilOperation(FlutterGPUStencilOperation value)
Definition formats.h:480
constexpr impeller::PrimitiveType ToImpellerPrimitiveType(FlutterGPUPrimitiveType value)
Definition formats.h:411
constexpr impeller::CullMode ToImpellerCullMode(FlutterGPUCullMode value)
Definition formats.h:513
constexpr impeller::MinMagFilter ToImpellerMinMagFilter(FlutterGPUMinMagFilter value)
Definition formats.h:330
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:120
constexpr bool IsStencilWritable(PixelFormat format)
Definition formats.h:130
Dart_Handle ToDart(const T &object)
std::string StdStringFromDart(Dart_Handle handle)
impeller::ShaderType type
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:662
LoadAction load_action
Definition formats.h:663
std::shared_ptr< Texture > texture
Definition formats.h:661
StoreAction store_action
Definition formats.h:664
Describe the color attachment that will be used with this pipeline.
Definition formats.h:522
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