Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
render_pass.cc File Reference

Go to the source code of this file.

Namespaces

namespace  flutter
 
namespace  flutter::gpu
 

Functions

 flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, RenderPass)
 
void InternalFlutterGpu_RenderPass_Initialize (Dart_Handle 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)
 
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)
 
Dart_Handle InternalFlutterGpu_RenderPass_Begin (flutter::gpu::RenderPass *wrapper, flutter::gpu::CommandBuffer *command_buffer)
 
void InternalFlutterGpu_RenderPass_BindPipeline (flutter::gpu::RenderPass *wrapper, flutter::gpu::RenderPipeline *pipeline)
 
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_BindVertexBufferDevice (flutter::gpu::RenderPass *wrapper, flutter::gpu::DeviceBuffer *device_buffer, int offset_in_bytes, int length_in_bytes, int vertex_count, int slot)
 
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_BindIndexBufferDevice (flutter::gpu::RenderPass *wrapper, flutter::gpu::DeviceBuffer *device_buffer, int offset_in_bytes, int length_in_bytes, int index_type, int index_count)
 
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)
 
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)
 
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)
 
void InternalFlutterGpu_RenderPass_ClearBindings (flutter::gpu::RenderPass *wrapper)
 
void InternalFlutterGpu_RenderPass_SetColorBlendEnable (flutter::gpu::RenderPass *wrapper, int color_attachment_index, bool enable)
 
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_SetDepthWriteEnable (flutter::gpu::RenderPass *wrapper, bool enable)
 
void InternalFlutterGpu_RenderPass_SetDepthCompareOperation (flutter::gpu::RenderPass *wrapper, int compare_operation)
 
void InternalFlutterGpu_RenderPass_SetStencilReference (flutter::gpu::RenderPass *wrapper, int stencil_reference)
 
void InternalFlutterGpu_RenderPass_SetScissor (flutter::gpu::RenderPass *wrapper, int x, int y, int width, int height)
 
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_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_SetCullMode (flutter::gpu::RenderPass *wrapper, int cull_mode)
 
void InternalFlutterGpu_RenderPass_SetPrimitiveType (flutter::gpu::RenderPass *wrapper, int primitive_type)
 
void InternalFlutterGpu_RenderPass_SetWindingOrder (flutter::gpu::RenderPass *wrapper, int winding_order)
 
void InternalFlutterGpu_RenderPass_SetPolygonMode (flutter::gpu::RenderPass *wrapper, int polygon_mode)
 
bool InternalFlutterGpu_RenderPass_Draw (flutter::gpu::RenderPass *wrapper)
 

Function Documentation

◆ BindIndexBuffer()

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 
)
static

Definition at line 376 of file render_pass.cc.

382 {
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}
impeller::IndexType index_buffer_type
Definition render_pass.h:90
impeller::BufferView index_buffer
Definition render_pass.h:89
constexpr impeller::IndexType ToImpellerIndexType(FlutterGPUIndexType value)
Definition formats.h:390
@ kNone
Does not use the index buffer.
impeller::ShaderType type

References flutter::gpu::RenderPass::element_count, flutter::gpu::RenderPass::has_index_buffer, flutter::gpu::RenderPass::index_buffer, flutter::gpu::RenderPass::index_buffer_type, impeller::kNone, flutter::gpu::ToImpellerIndexType(), and type.

Referenced by InternalFlutterGpu_RenderPass_BindIndexBufferDevice().

◆ BindUniform()

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

Definition at line 406 of file render_pass.cc.

412 {
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}
std::unordered_map< const flutter::gpu::Shader::UniformBinding *, BufferAndUniformSlot > BufferUniformMap
Definition render_pass.h:68
BufferUniformMap fragment_uniform_bindings
Definition render_pass.h:75
BufferUniformMap vertex_uniform_bindings
Definition render_pass.h:73
const Shader::UniformBinding * GetUniformStruct(const std::string &name) const
Definition shader.cc:122
impeller::ShaderStage GetShaderStage() const
Definition shader.cc:113
std::string uniform_name
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
std::string StdStringFromDart(Dart_Handle handle)
impeller::ShaderMetadata metadata
Definition shader.h:30
impeller::ShaderUniformSlot slot
Definition shader.h:29

References flutter::gpu::RenderPass::fragment_uniform_bindings, flutter::gpu::Shader::GetShaderStage(), flutter::gpu::Shader::GetUniformStruct(), impeller::kCompute, impeller::kFragment, impeller::kUnknown, impeller::kVertex, flutter::gpu::Shader::UniformBinding::metadata, flutter::gpu::RenderPass::BufferAndUniformSlot::slot, flutter::gpu::Shader::UniformBinding::slot, tonic::StdStringFromDart(), uniform_name, and flutter::gpu::RenderPass::vertex_uniform_bindings.

Referenced by InternalFlutterGpu_RenderPass_BindUniformDevice().

◆ BindVertexBuffer()

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 
)
static

Definition at line 332 of file render_pass.cc.

338 {
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}
static constexpr size_t kMaxVertexBufferSlots
Definition render_pass.h:85
std::array< impeller::BufferView, kMaxVertexBufferSlots > vertex_buffers
Definition render_pass.h:86

References flutter::gpu::RenderPass::element_count, flutter::gpu::RenderPass::has_index_buffer, flutter::gpu::RenderPass::kMaxVertexBufferSlots, flutter::gpu::RenderPass::vertex_buffer_count, and flutter::gpu::RenderPass::vertex_buffers.

Referenced by impeller::EncodeCommandsInReactor(), and InternalFlutterGpu_RenderPass_BindVertexBufferDevice().

◆ InternalFlutterGpu_RenderPass_Begin()

Dart_Handle InternalFlutterGpu_RenderPass_Begin ( flutter::gpu::RenderPass wrapper,
flutter::gpu::CommandBuffer command_buffer 
)

Definition at line 316 of file render_pass.cc.

318 {
319 if (!wrapper->Begin(*command_buffer)) {
320 return tonic::ToDart("Failed to begin RenderPass");
321 }
322 return Dart_Null();
323}
bool Begin(flutter::gpu::CommandBuffer &command_buffer)
Dart_Handle ToDart(const T &object)

References flutter::gpu::RenderPass::Begin(), and tonic::ToDart().

◆ InternalFlutterGpu_RenderPass_BindIndexBufferDevice()

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 
)

Definition at line 395 of file render_pass.cc.

401 {
402 BindIndexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
403 length_in_bytes, index_type, index_count);
404}
std::shared_ptr< impeller::DeviceBuffer > GetBuffer()
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)

References BindIndexBuffer(), and flutter::gpu::DeviceBuffer::GetBuffer().

◆ InternalFlutterGpu_RenderPass_BindPipeline()

void InternalFlutterGpu_RenderPass_BindPipeline ( flutter::gpu::RenderPass wrapper,
flutter::gpu::RenderPipeline pipeline 
)

Definition at line 325 of file render_pass.cc.

327 {
329 wrapper->SetPipeline(std::move(ref));
330}
void SetPipeline(fml::RefPtr< RenderPipeline > pipeline)

References flutter::gpu::RenderPass::SetPipeline().

◆ InternalFlutterGpu_RenderPass_BindTexture()

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 
)

Definition at line 464 of file render_pass.cc.

473 {
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}
std::unordered_map< const flutter::gpu::Shader::TextureBinding *, impeller::TextureAndSampler > TextureUniformMap
Definition render_pass.h:71
TextureUniformMap fragment_texture_bindings
Definition render_pass.h:76
TextureUniformMap vertex_texture_bindings
Definition render_pass.h:74
const std::shared_ptr< const impeller::Context > & GetContext() const
const Shader::TextureBinding * GetUniformTexture(const std::string &name) const
Definition shader.cc:131
FlTexture * texture
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode(FlutterGPUSamplerAddressMode value)
Definition formats.h:368
constexpr impeller::MipFilter ToImpellerMipFilter(FlutterGPUMipFilter value)
Definition formats.h:349
constexpr impeller::MinMagFilter ToImpellerMinMagFilter(FlutterGPUMinMagFilter value)
Definition formats.h:330
impeller::SampledImageSlot slot
Definition shader.h:38
impeller::ShaderMetadata metadata
Definition shader.h:39
SamplerAddressMode width_address_mode
SamplerAddressMode height_address_mode
combines the texture, sampler and sampler slot information.
Definition command.h:59
SampledImageSlot slot
Definition command.h:60

References flutter::gpu::RenderPass::fragment_texture_bindings, flutter::gpu::RenderPass::GetContext(), flutter::gpu::Shader::GetShaderStage(), flutter::gpu::Shader::GetUniformTexture(), impeller::SamplerDescriptor::height_address_mode, impeller::kCompute, impeller::kFragment, impeller::kUnknown, impeller::kVertex, impeller::SamplerDescriptor::mag_filter, flutter::gpu::Shader::TextureBinding::metadata, impeller::SamplerDescriptor::min_filter, impeller::SamplerDescriptor::mip_filter, impeller::TextureAndSampler::slot, flutter::gpu::Shader::TextureBinding::slot, tonic::StdStringFromDart(), texture, flutter::gpu::ToImpellerMinMagFilter(), flutter::gpu::ToImpellerMipFilter(), flutter::gpu::ToImpellerSamplerAddressMode(), uniform_name, flutter::gpu::RenderPass::vertex_texture_bindings, and impeller::SamplerDescriptor::width_address_mode.

◆ InternalFlutterGpu_RenderPass_BindUniformDevice()

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 
)

Definition at line 452 of file render_pass.cc.

458 {
459 return BindUniform(wrapper, shader, uniform_name_handle,
460 device_buffer->GetBuffer(), offset_in_bytes,
461 length_in_bytes);
462}
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)

References BindUniform(), and flutter::gpu::DeviceBuffer::GetBuffer().

◆ InternalFlutterGpu_RenderPass_BindVertexBufferDevice()

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 
)

Definition at line 365 of file render_pass.cc.

371 {
372 BindVertexBuffer(wrapper, device_buffer->GetBuffer(), offset_in_bytes,
373 length_in_bytes, vertex_count, slot);
374}
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)

References BindVertexBuffer(), and flutter::gpu::DeviceBuffer::GetBuffer().

◆ InternalFlutterGpu_RenderPass_ClearBindings()

void InternalFlutterGpu_RenderPass_ClearBindings ( flutter::gpu::RenderPass wrapper)

Definition at line 516 of file render_pass.cc.

517 {
518 wrapper->ClearBindings();
519}

References flutter::gpu::RenderPass::ClearBindings().

◆ InternalFlutterGpu_RenderPass_Draw()

bool InternalFlutterGpu_RenderPass_Draw ( flutter::gpu::RenderPass wrapper)

Definition at line 668 of file render_pass.cc.

668 {
669 return wrapper->Draw();
670}

References flutter::gpu::RenderPass::Draw().

◆ InternalFlutterGpu_RenderPass_Initialize()

void InternalFlutterGpu_RenderPass_Initialize ( Dart_Handle  wrapper)

Exports

Definition at line 245 of file render_pass.cc.

245 {
246 auto res = fml::MakeRefCounted<flutter::gpu::RenderPass>();
247 res->AssociateWithDartWrapper(wrapper);
248}

◆ InternalFlutterGpu_RenderPass_SetColorAttachment()

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 
)

Definition at line 250 of file render_pass.cc.

261 {
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}
impeller::Context & GetContext()
Definition context.cc:84
impeller::RenderTarget & GetRenderTarget()
std::shared_ptr< impeller::Texture > GetTexture()
Definition texture.cc:38
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
bool SupportsNormalOffscreenMSAA(const impeller::Context &context)
Definition context.cc:18
constexpr impeller::LoadAction ToImpellerLoadAction(FlutterGPULoadAction value)
Definition formats.h:250
constexpr impeller::StoreAction ToImpellerStoreAction(FlutterGPUStoreAction value)
Definition formats.h:273
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

References impeller::ColorAttachment::clear_color, flutter::gpu::Context::GetContext(), flutter::gpu::RenderPass::GetRenderTarget(), flutter::gpu::Texture::GetTexture(), impeller::kStore, impeller::Attachment::load_action, impeller::Attachment::resolve_texture, impeller::RenderTarget::SetColorAttachment(), impeller::Attachment::store_action, flutter::gpu::SupportsNormalOffscreenMSAA(), impeller::Attachment::texture, texture, flutter::gpu::ToImpellerLoadAction(), and flutter::gpu::ToImpellerStoreAction().

◆ InternalFlutterGpu_RenderPass_SetColorBlendEnable()

void InternalFlutterGpu_RenderPass_SetColorBlendEnable ( flutter::gpu::RenderPass wrapper,
int  color_attachment_index,
bool  enable 
)

Definition at line 521 of file render_pass.cc.

524 {
525 auto& color = wrapper->GetColorAttachmentDescriptor(color_attachment_index);
526 color.blending_enabled = enable;
527}
impeller::ColorAttachmentDescriptor & GetColorAttachmentDescriptor(size_t color_attachment_index)

References impeller::ColorAttachmentDescriptor::blending_enabled, and flutter::gpu::RenderPass::GetColorAttachmentDescriptor().

◆ InternalFlutterGpu_RenderPass_SetColorBlendEquation()

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 
)

Definition at line 529 of file render_pass.cc.

537 {
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}
constexpr impeller::BlendFactor ToImpellerBlendFactor(FlutterGPUBlendFactor value)
Definition formats.h:182
constexpr impeller::BlendOperation ToImpellerBlendOperation(FlutterGPUBlendOperation value)
Definition formats.h:228

References impeller::ColorAttachmentDescriptor::color_blend_op, flutter::gpu::RenderPass::GetColorAttachmentDescriptor(), flutter::gpu::ToImpellerBlendFactor(), and flutter::gpu::ToImpellerBlendOperation().

◆ InternalFlutterGpu_RenderPass_SetCullMode()

void InternalFlutterGpu_RenderPass_SetCullMode ( flutter::gpu::RenderPass wrapper,
int  cull_mode 
)

Definition at line 633 of file render_pass.cc.

635 {
636 impeller::PipelineDescriptor& pipeline_descriptor =
637 wrapper->GetPipelineDescriptor();
638 pipeline_descriptor.SetCullMode(flutter::gpu::ToImpellerCullMode(cull_mode));
639}
impeller::PipelineDescriptor & GetPipelineDescriptor()
constexpr impeller::CullMode ToImpellerCullMode(FlutterGPUCullMode value)
Definition formats.h:513

References flutter::gpu::RenderPass::GetPipelineDescriptor(), impeller::PipelineDescriptor::SetCullMode(), and flutter::gpu::ToImpellerCullMode().

◆ InternalFlutterGpu_RenderPass_SetDepthCompareOperation()

void InternalFlutterGpu_RenderPass_SetDepthCompareOperation ( flutter::gpu::RenderPass wrapper,
int  compare_operation 
)

Definition at line 560 of file render_pass.cc.

562 {
563 auto& depth = wrapper->GetDepthAttachmentDescriptor();
564 depth.depth_compare =
566}
impeller::DepthAttachmentDescriptor & GetDepthAttachmentDescriptor()
constexpr impeller::CompareFunction ToImpellerCompareFunction(FlutterGPUCompareFunction value)
Definition formats.h:442

References impeller::DepthAttachmentDescriptor::depth_compare, flutter::gpu::RenderPass::GetDepthAttachmentDescriptor(), and flutter::gpu::ToImpellerCompareFunction().

◆ InternalFlutterGpu_RenderPass_SetDepthStencilAttachment()

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 
)

Definition at line 286 of file render_pass.cc.

294 {
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}
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
RenderTarget & SetStencilAttachment(std::optional< StencilAttachment > attachment)

References impeller::DepthAttachment::clear_depth, impeller::StencilAttachment::clear_stencil, flutter::gpu::RenderPass::GetRenderTarget(), impeller::Attachment::load_action, impeller::RenderTarget::SetDepthAttachment(), impeller::RenderTarget::SetStencilAttachment(), impeller::Attachment::store_action, impeller::Attachment::texture, texture, flutter::gpu::ToImpellerLoadAction(), and flutter::gpu::ToImpellerStoreAction().

◆ InternalFlutterGpu_RenderPass_SetDepthWriteEnable()

void InternalFlutterGpu_RenderPass_SetDepthWriteEnable ( flutter::gpu::RenderPass wrapper,
bool  enable 
)

◆ InternalFlutterGpu_RenderPass_SetPolygonMode()

void InternalFlutterGpu_RenderPass_SetPolygonMode ( flutter::gpu::RenderPass wrapper,
int  polygon_mode 
)

Definition at line 659 of file render_pass.cc.

661 {
662 impeller::PipelineDescriptor& pipeline_descriptor =
663 wrapper->GetPipelineDescriptor();
664 pipeline_descriptor.SetPolygonMode(
666}
void SetPolygonMode(PolygonMode mode)
constexpr impeller::PolygonMode ToImpellerPolygonMode(FlutterGPUPolygonMode value)
Definition formats.h:552

References flutter::gpu::RenderPass::GetPipelineDescriptor(), impeller::PipelineDescriptor::SetPolygonMode(), and flutter::gpu::ToImpellerPolygonMode().

◆ InternalFlutterGpu_RenderPass_SetPrimitiveType()

void InternalFlutterGpu_RenderPass_SetPrimitiveType ( flutter::gpu::RenderPass wrapper,
int  primitive_type 
)

Definition at line 641 of file render_pass.cc.

643 {
644 impeller::PipelineDescriptor& pipeline_descriptor =
645 wrapper->GetPipelineDescriptor();
646 pipeline_descriptor.SetPrimitiveType(
648}
void SetPrimitiveType(PrimitiveType type)
constexpr impeller::PrimitiveType ToImpellerPrimitiveType(FlutterGPUPrimitiveType value)
Definition formats.h:411

References flutter::gpu::RenderPass::GetPipelineDescriptor(), impeller::PipelineDescriptor::SetPrimitiveType(), and flutter::gpu::ToImpellerPrimitiveType().

◆ InternalFlutterGpu_RenderPass_SetScissor()

void InternalFlutterGpu_RenderPass_SetScissor ( flutter::gpu::RenderPass wrapper,
int  x,
int  y,
int  width,
int  height 
)

Definition at line 574 of file render_pass.cc.

578 {
580}
std::optional< impeller::IRect32 > scissor
Definition render_pass.h:94
int32_t x
double y
int32_t height
int32_t width
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
Definition rect.h:136

References height, impeller::TRect< T >::MakeXYWH(), flutter::gpu::RenderPass::scissor, width, x, and y.

◆ InternalFlutterGpu_RenderPass_SetStencilConfig()

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 
)

Definition at line 603 of file render_pass.cc.

611 {
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}
impeller::StencilAttachmentDescriptor & GetStencilBackAttachmentDescriptor()
impeller::StencilAttachmentDescriptor & GetStencilFrontAttachmentDescriptor()
constexpr impeller::StencilOperation ToImpellerStencilOperation(FlutterGPUStencilOperation value)
Definition formats.h:480

References impeller::StencilAttachmentDescriptor::depth_failure, impeller::StencilAttachmentDescriptor::depth_stencil_pass, flutter::gpu::RenderPass::GetStencilBackAttachmentDescriptor(), flutter::gpu::RenderPass::GetStencilFrontAttachmentDescriptor(), impeller::StencilAttachmentDescriptor::read_mask, impeller::StencilAttachmentDescriptor::stencil_compare, impeller::StencilAttachmentDescriptor::stencil_failure, flutter::gpu::ToImpellerCompareFunction(), flutter::gpu::ToImpellerStencilOperation(), and impeller::StencilAttachmentDescriptor::write_mask.

◆ InternalFlutterGpu_RenderPass_SetStencilReference()

void InternalFlutterGpu_RenderPass_SetStencilReference ( flutter::gpu::RenderPass wrapper,
int  stencil_reference 
)

Definition at line 568 of file render_pass.cc.

570 {
571 wrapper->stencil_reference = static_cast<uint32_t>(stencil_reference);
572}

References flutter::gpu::RenderPass::stencil_reference.

◆ InternalFlutterGpu_RenderPass_SetViewport()

void InternalFlutterGpu_RenderPass_SetViewport ( flutter::gpu::RenderPass wrapper,
int  x,
int  y,
int  width,
int  height,
float  z_near,
float  z_far 
)

Definition at line 582 of file render_pass.cc.

589 {
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}
std::optional< impeller::Viewport > viewport
Definition render_pass.h:95

References height, impeller::TRect< T >::MakeXYWH(), flutter::gpu::RenderPass::viewport, width, x, and y.

◆ InternalFlutterGpu_RenderPass_SetWindingOrder()

void InternalFlutterGpu_RenderPass_SetWindingOrder ( flutter::gpu::RenderPass wrapper,
int  winding_order 
)

Definition at line 650 of file render_pass.cc.

652 {
653 impeller::PipelineDescriptor& pipeline_descriptor =
654 wrapper->GetPipelineDescriptor();
655 pipeline_descriptor.SetWindingOrder(
657}
void SetWindingOrder(WindingOrder order)
constexpr impeller::WindingOrder ToImpellerWindingOrder(FlutterGPUWindingOrder value)
Definition formats.h:533

References flutter::gpu::RenderPass::GetPipelineDescriptor(), impeller::PipelineDescriptor::SetWindingOrder(), and flutter::gpu::ToImpellerWindingOrder().