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
104
105std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>>
106RenderPass::GetOrCreatePipeline() {
107 // Infer the pipeline layout based on the shape of the RenderTarget.
108 auto pipeline_desc = pipeline_descriptor_;
109
110 pipeline_desc.SetSampleCount(render_target_.GetSampleCount());
111
112 render_target_.IterateAllColorAttachments(
113 [&](size_t index, const impeller::ColorAttachment& attachment) -> bool {
114 auto& color = GetColorAttachmentDescriptor(index);
115 color.format = render_target_.GetRenderTargetPixelFormat();
116 return true;
117 });
118
119 pipeline_desc.SetColorAttachmentDescriptors(color_descriptors_);
120
121 {
122 auto stencil = render_target_.GetStencilAttachment();
123 if (stencil && impeller::IsStencilWritable(
124 stencil->texture->GetTextureDescriptor().format)) {
125 pipeline_desc.SetStencilPixelFormat(
126 stencil->texture->GetTextureDescriptor().format);
127 pipeline_desc.SetStencilAttachmentDescriptors(stencil_front_desc_,
128 stencil_back_desc_);
129 } else {
130 pipeline_desc.ClearStencilAttachments();
131 }
132 }
133
134 {
135 auto depth = render_target_.GetDepthAttachment();
136 if (depth && impeller::IsDepthWritable(
137 depth->texture->GetTextureDescriptor().format)) {
138 pipeline_desc.SetDepthPixelFormat(
139 depth->texture->GetTextureDescriptor().format);
140 pipeline_desc.SetDepthStencilAttachmentDescriptor(depth_desc_);
141 } else {
142 pipeline_desc.ClearDepthAttachment();
143 }
144 }
145
146 auto& context = *GetContext();
147
148 render_pipeline_->BindToPipelineDescriptor(*context.GetShaderLibrary(),
149 pipeline_desc);
150
151 std::shared_ptr<impeller::Pipeline<impeller::PipelineDescriptor>> pipeline;
152
153 if (context.GetBackendType() == impeller::Context::BackendType::kOpenGLES &&
154 !context.GetPipelineLibrary()->HasPipeline(pipeline_desc)) {
155 // New pipeline creation for this backend must be done on the reactor
156 // (raster) thread. We're about the draw, so we need to synchronize with a
157 // raster task in order to get the new pipeline. Depending on how busy the
158 // raster thread is, this could hang the UI thread long enough to miss a
159 // 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
185bool RenderPass::Draw(size_t element_count,
186 size_t instance_count,
187 bool indexed) {
188 if (element_count == 0u || instance_count == 0u) {
189 return true;
190 }
191
193 // drawIndexed was called without an index buffer bound.
194 return false;
195 }
196
197 render_pass_->SetPipeline(impeller::PipelineRef(GetOrCreatePipeline()));
198
199 for (const auto& [_, buffer] : vertex_uniform_bindings) {
200 render_pass_->BindDynamicResource(
203 std::make_unique<impeller::ShaderMetadata>(*buffer.view.GetMetadata()),
204 buffer.view.resource);
205 }
206 for (const auto& [_, texture] : vertex_texture_bindings) {
207 render_pass_->BindDynamicResource(
209 texture.slot,
210 std::make_unique<impeller::ShaderMetadata>(
211 *texture.texture.GetMetadata()),
212 texture.texture.resource, texture.sampler);
213 }
214 for (const auto& [_, buffer] : fragment_uniform_bindings) {
215 render_pass_->BindDynamicResource(
218 std::make_unique<impeller::ShaderMetadata>(*buffer.view.GetMetadata()),
219 buffer.view.resource);
220 }
221 for (const auto& [_, texture] : fragment_texture_bindings) {
222 render_pass_->BindDynamicResource(
225 std::make_unique<impeller::ShaderMetadata>(
226 *texture.texture.GetMetadata()),
227 texture.texture.resource, texture.sampler);
228 }
229
230 render_pass_->SetVertexBuffer(vertex_buffers.data(), vertex_buffer_count);
231 if (indexed) {
232 render_pass_->SetIndexBuffer(index_buffer, index_buffer_type);
233 } else {
234 render_pass_->SetIndexBuffer(impeller::BufferView{},
236 }
237 render_pass_->SetElementCount(element_count);
238 render_pass_->SetInstanceCount(instance_count);
239
240 render_pass_->SetStencilReference(stencil_reference);
241
242 if (viewport.has_value()) {
243 render_pass_->SetViewport(viewport.value());
244 }
245
246 if (scissor.has_value()) {
247 render_pass_->SetScissor(scissor.value());
248 }
249
250 bool result = render_pass_->Draw().ok();
251
252 return result;
253}
254
255} // namespace gpu
256} // namespace flutter
257
258//----------------------------------------------------------------------------
259/// Exports
260///
261
263 auto res = fml::MakeRefCounted<flutter::gpu::RenderPass>();
264 res->AssociateWithDartWrapper(wrapper);
265}
266
270 int color_attachment_index,
271 int load_action,
272 int store_action,
273 float clear_color_r,
274 float clear_color_g,
275 float clear_color_b,
276 float clear_color_a,
278 Dart_Handle resolve_texture_wrapper,
279 int mip_level,
280 int slice) {
284 desc.clear_color = impeller::Color(clear_color_r, clear_color_g,
285 clear_color_b, clear_color_a);
286 desc.texture = texture->GetTexture();
287 desc.mip_level = mip_level;
288 desc.slice = slice;
289 if (!Dart_IsNull(resolve_texture_wrapper)) {
290 flutter::gpu::Texture* resolve_texture =
292 resolve_texture_wrapper);
293 desc.resolve_texture = resolve_texture->GetTexture();
294
295 // If the backend doesn't support normal MSAA, gracefully fallback to
296 // rendering without MSAA.
298 desc.texture = desc.resolve_texture;
299 desc.resolve_texture = nullptr;
301 }
302 }
303 wrapper->GetRenderTarget().SetColorAttachment(desc, color_attachment_index);
304 return Dart_Null();
305}
306
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,
316 int mip_level,
317 int slice) {
318 {
320 desc.load_action = flutter::gpu::ToImpellerLoadAction(depth_load_action);
321 desc.store_action = flutter::gpu::ToImpellerStoreAction(depth_store_action);
322 desc.clear_depth = depth_clear_value;
323 desc.texture = texture->GetTexture();
324 desc.mip_level = mip_level;
325 desc.slice = slice;
326 wrapper->GetRenderTarget().SetDepthAttachment(desc);
327 }
328 {
330 desc.load_action = flutter::gpu::ToImpellerLoadAction(stencil_load_action);
331 desc.store_action =
332 flutter::gpu::ToImpellerStoreAction(stencil_store_action);
333 desc.clear_stencil = stencil_clear_value;
334 desc.texture = texture->GetTexture();
335 desc.mip_level = mip_level;
336 desc.slice = slice;
337 wrapper->GetRenderTarget().SetStencilAttachment(desc);
338 }
339
340 return Dart_Null();
341}
342
346 if (!wrapper->Begin(*command_buffer)) {
347 return tonic::ToDart("Failed to begin RenderPass");
348 }
349 return Dart_Null();
350}
351
358
361 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
362 int offset_in_bytes,
363 int length_in_bytes,
364 int slot) {
365 if (slot < 0 || static_cast<size_t>(slot) >=
367 return;
368 }
369 wrapper->vertex_buffers[slot] = impeller::BufferView(
370 buffer, impeller::Range(offset_in_bytes, length_in_bytes));
371 if (static_cast<size_t>(slot) >= wrapper->vertex_buffer_count) {
372 wrapper->vertex_buffer_count = static_cast<size_t>(slot) + 1;
373 }
374}
375
378 flutter::gpu::DeviceBuffer* device_buffer,
379 int offset_in_bytes,
380 int length_in_bytes,
381 int slot) {
382 BindVertexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
383 length_in_bytes, slot);
384}
385
386static void BindIndexBuffer(
388 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
389 int offset_in_bytes,
390 int length_in_bytes,
391 int index_type) {
393 buffer, impeller::Range(offset_in_bytes, length_in_bytes));
395}
396
399 flutter::gpu::DeviceBuffer* device_buffer,
400 int offset_in_bytes,
401 int length_in_bytes,
402 int index_type) {
403 BindIndexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
404 length_in_bytes, index_type);
405}
406
407static bool BindUniform(
409 flutter::gpu::Shader* shader,
410 Dart_Handle uniform_name_handle,
411 const std::shared_ptr<const impeller::DeviceBuffer>& buffer,
412 int offset_in_bytes,
413 int length_in_bytes) {
414 auto uniform_name = tonic::StdStringFromDart(uniform_name_handle);
415 const flutter::gpu::Shader::UniformBinding* uniform_struct =
417 // TODO(bdero): Return an error string stating that no uniform struct with
418 // this name exists and throw an exception.
419 if (!uniform_struct) {
420 return false;
421 }
422
423 flutter::gpu::RenderPass::BufferUniformMap* uniform_map = nullptr;
424 switch (shader->GetShaderStage()) {
426 uniform_map = &wrapper->vertex_uniform_bindings;
427 break;
429 uniform_map = &wrapper->fragment_uniform_bindings;
430 break;
433 return false;
434 }
435
436 if (!buffer || static_cast<size_t>(offset_in_bytes + length_in_bytes) >
437 buffer->GetDeviceBufferDescriptor().size) {
438 return false;
439 }
440
441 uniform_map->insert_or_assign(
442 uniform_struct,
444 .slot = uniform_struct->slot,
446 &uniform_struct->metadata,
448 buffer, impeller::Range(offset_in_bytes, length_in_bytes)),
449 }});
450 return true;
451}
452
455 flutter::gpu::Shader* shader,
456 Dart_Handle uniform_name_handle,
457 flutter::gpu::DeviceBuffer* device_buffer,
458 int offset_in_bytes,
459 int length_in_bytes) {
460 return BindUniform(wrapper, shader, uniform_name_handle,
461 device_buffer->GetBuffer(), offset_in_bytes,
462 length_in_bytes);
463}
464
467 flutter::gpu::Shader* shader,
468 Dart_Handle uniform_name_handle,
470 int min_filter,
471 int mag_filter,
472 int mip_filter,
473 int width_address_mode,
474 int height_address_mode) {
475 auto uniform_name = tonic::StdStringFromDart(uniform_name_handle);
476 const flutter::gpu::Shader::TextureBinding* texture_binding =
478 // TODO(bdero): Return an error string stating that no uniform texture with
479 // this name exists and throw an exception.
480 if (!texture_binding) {
481 return false;
482 }
483
484 impeller::SamplerDescriptor sampler_desc;
485 sampler_desc.min_filter = flutter::gpu::ToImpellerMinMagFilter(min_filter);
486 sampler_desc.mag_filter = flutter::gpu::ToImpellerMinMagFilter(mag_filter);
487 sampler_desc.mip_filter = flutter::gpu::ToImpellerMipFilter(mip_filter);
488 sampler_desc.width_address_mode =
490 sampler_desc.height_address_mode =
492 auto sampler =
493 wrapper->GetContext()->GetSamplerLibrary()->GetSampler(sampler_desc);
494
495 flutter::gpu::RenderPass::TextureUniformMap* uniform_map = nullptr;
496 switch (shader->GetShaderStage()) {
498 uniform_map = &wrapper->vertex_texture_bindings;
499 break;
501 uniform_map = &wrapper->fragment_texture_bindings;
502 break;
505 return false;
506 }
507 uniform_map->insert_or_assign(
508 texture_binding,
510 .slot = texture_binding->slot,
511 .texture = {&texture_binding->metadata, texture->GetTexture()},
512 .sampler = sampler,
513 });
514 return true;
515}
516
521
524 int color_attachment_index,
525 bool enable) {
526 auto& color = wrapper->GetColorAttachmentDescriptor(color_attachment_index);
527 color.blending_enabled = enable;
528}
529
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) {
539 auto& color = wrapper->GetColorAttachmentDescriptor(color_attachment_index);
540 color.color_blend_op =
541 flutter::gpu::ToImpellerBlendOperation(color_blend_operation);
542 color.src_color_blend_factor =
543 flutter::gpu::ToImpellerBlendFactor(source_color_blend_factor);
544 color.dst_color_blend_factor =
545 flutter::gpu::ToImpellerBlendFactor(destination_color_blend_factor);
546 color.alpha_blend_op =
547 flutter::gpu::ToImpellerBlendOperation(alpha_blend_operation);
548 color.src_alpha_blend_factor =
549 flutter::gpu::ToImpellerBlendFactor(source_alpha_blend_factor);
550 color.dst_alpha_blend_factor =
551 flutter::gpu::ToImpellerBlendFactor(destination_alpha_blend_factor);
552}
553
556 bool enable) {
557 auto& depth = wrapper->GetDepthAttachmentDescriptor();
558 depth.depth_write_enabled = true;
559}
560
563 int compare_operation) {
564 auto& depth = wrapper->GetDepthAttachmentDescriptor();
565 depth.depth_compare =
567}
568
571 int stencil_reference) {
572 wrapper->stencil_reference = static_cast<uint32_t>(stencil_reference);
573}
574
576 int x,
577 int y,
578 int width,
579 int height) {
581}
582
585 int x,
586 int y,
587 int width,
588 int height,
589 float z_near,
590 float z_far) {
592
593 auto depth_range = impeller::DepthRange();
594 depth_range.z_near = z_near;
595 depth_range.z_far = z_far;
596
597 auto viewport = impeller::Viewport();
598 viewport.rect = rect;
599 viewport.depth_range = depth_range;
600
601 wrapper->viewport = viewport;
602}
603
606 int stencil_compare_operation,
607 int stencil_fail_operation,
608 int depth_fail_operation,
609 int depth_stencil_pass_operation,
610 int read_mask,
611 int write_mask,
612 int target_face) {
614 desc.stencil_compare =
615 flutter::gpu::ToImpellerCompareFunction(stencil_compare_operation);
616 desc.stencil_failure =
617 flutter::gpu::ToImpellerStencilOperation(stencil_fail_operation);
618 desc.depth_failure =
619 flutter::gpu::ToImpellerStencilOperation(depth_fail_operation);
620 desc.depth_stencil_pass =
621 flutter::gpu::ToImpellerStencilOperation(depth_stencil_pass_operation);
622 desc.read_mask = static_cast<uint32_t>(read_mask);
623 desc.write_mask = static_cast<uint32_t>(write_mask);
624
625 // Corresponds to the `StencilFace` enum in `gpu/lib/src/render_pass.dart`.
626 if (target_face != 2 /* both or front */) {
627 wrapper->GetStencilFrontAttachmentDescriptor() = desc;
628 }
629 if (target_face != 1 /* both or back */) {
630 wrapper->GetStencilBackAttachmentDescriptor() = desc;
631 }
632}
633
636 int cull_mode) {
637 impeller::PipelineDescriptor& pipeline_descriptor =
638 wrapper->GetPipelineDescriptor();
639 pipeline_descriptor.SetCullMode(flutter::gpu::ToImpellerCullMode(cull_mode));
640}
641
644 int primitive_type) {
645 impeller::PipelineDescriptor& pipeline_descriptor =
646 wrapper->GetPipelineDescriptor();
647 pipeline_descriptor.SetPrimitiveType(
649}
650
653 int winding_order) {
654 impeller::PipelineDescriptor& pipeline_descriptor =
655 wrapper->GetPipelineDescriptor();
656 pipeline_descriptor.SetWindingOrder(
658}
659
662 int polygon_mode) {
663 impeller::PipelineDescriptor& pipeline_descriptor =
664 wrapper->GetPipelineDescriptor();
665 pipeline_descriptor.SetPolygonMode(
667}
668
670 int vertex_count,
671 int instance_count) {
672 // Guard the casts to size_t; a negative value would wrap.
673 return vertex_count >= 0 && instance_count >= 0 &&
674 wrapper->Draw(vertex_count, instance_count, /*indexed=*/false);
675}
676
679 int index_count,
680 int instance_count) {
681 // Guard the casts to size_t; a negative value would wrap.
682 return index_count >= 0 && instance_count >= 0 &&
683 wrapper->Draw(index_count, instance_count, /*indexed=*/true);
684}
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: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)
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)
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)
FlTexture * texture
double y
constexpr impeller::BlendFactor ToImpellerBlendFactor(FlutterGPUBlendFactor value)
Definition formats.h:267
bool SupportsNormalOffscreenMSAA(const impeller::Context &context)
Definition context.cc:21
constexpr impeller::BlendOperation ToImpellerBlendOperation(FlutterGPUBlendOperation value)
Definition formats.h:313
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode(FlutterGPUSamplerAddressMode value)
Definition formats.h:453
constexpr impeller::MipFilter ToImpellerMipFilter(FlutterGPUMipFilter value)
Definition formats.h:434
constexpr impeller::WindingOrder ToImpellerWindingOrder(FlutterGPUWindingOrder value)
Definition formats.h:618
constexpr impeller::CompareFunction ToImpellerCompareFunction(FlutterGPUCompareFunction value)
Definition formats.h:527
constexpr impeller::LoadAction ToImpellerLoadAction(FlutterGPULoadAction value)
Definition formats.h:335
constexpr impeller::StoreAction ToImpellerStoreAction(FlutterGPUStoreAction value)
Definition formats.h:358
constexpr impeller::PolygonMode ToImpellerPolygonMode(FlutterGPUPolygonMode value)
Definition formats.h:637
constexpr impeller::IndexType ToImpellerIndexType(FlutterGPUIndexType value)
Definition formats.h:475
constexpr impeller::StencilOperation ToImpellerStencilOperation(FlutterGPUStencilOperation value)
Definition formats.h:565
constexpr impeller::PrimitiveType ToImpellerPrimitiveType(FlutterGPUPrimitiveType value)
Definition formats.h:496
constexpr impeller::CullMode ToImpellerCullMode(FlutterGPUCullMode value)
Definition formats.h:598
constexpr impeller::MinMagFilter ToImpellerMinMagFilter(FlutterGPUMinMagFilter value)
Definition formats.h:415
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