Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
impeller::RenderPassGLES Class Referencefinal

#include <render_pass_gles.h>

Inheritance diagram for impeller::RenderPassGLES:
impeller::RenderPass impeller::ResourceBinder

Public Member Functions

 ~RenderPassGLES () override
 
- Public Member Functions inherited from impeller::RenderPass
virtual ~RenderPass ()
 
const std::shared_ptr< const Context > & GetContext () const
 
const RenderTargetGetRenderTarget () const
 
ISize GetRenderTargetSize () const
 
const MatrixGetOrthographicTransform () const
 
void SetLabel (std::string label)
 
virtual void ReserveCommands (size_t command_count)
 Reserve [command_count] commands in the HAL command buffer.
 
virtual void SetPipeline (const std::shared_ptr< Pipeline< PipelineDescriptor > > &pipeline)
 The pipeline to use for this command.
 
virtual void SetCommandLabel (std::string_view label)
 The debugging label to use for the command.
 
virtual void SetStencilReference (uint32_t value)
 
virtual void SetBaseVertex (uint64_t value)
 
virtual void SetViewport (Viewport viewport)
 
virtual void SetScissor (IRect scissor)
 
virtual void SetInstanceCount (size_t count)
 
virtual bool SetVertexBuffer (VertexBuffer buffer)
 Specify the vertex and index buffer to use for this command.
 
virtual fml::Status Draw ()
 Record the currently pending command.
 
virtual bool BindResource (ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata &metadata, BufferView view) override
 
virtual bool BindResource (ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const std::shared_ptr< const ShaderMetadata > &metadata, BufferView view)
 
virtual bool BindResource (ShaderStage stage, DescriptorType type, const SampledImageSlot &slot, const ShaderMetadata &metadata, std::shared_ptr< const Texture > texture, const std::unique_ptr< const Sampler > &sampler) override
 
bool EncodeCommands () const
 Encode the recorded commands to the underlying command buffer.
 
virtual const std::vector< Command > & GetCommands () const
 Accessor for the current Commands.
 
SampleCount GetSampleCount () const
 The sample count of the attached render target.
 
PixelFormat GetRenderTargetPixelFormat () const
 The pixel format of the attached render target.
 
bool HasDepthAttachment () const
 Whether the render target has a depth attachment.
 
bool HasStencilAttachment () const
 Whether the render target has an stencil attachment.
 
- Public Member Functions inherited from impeller::ResourceBinder
virtual ~ResourceBinder ()=default
 

Private Member Functions

bool IsValid () const override
 
void OnSetLabel (std::string label) override
 
bool OnEncodeCommands (const Context &context) const override
 

Friends

class CommandBufferGLES
 

Additional Inherited Members

- Protected Member Functions inherited from impeller::RenderPass
bool AddCommand (Command &&command)
 Record a command for subsequent encoding to the underlying command buffer. No work is encoded into the command buffer at this time.
 
 RenderPass (std::shared_ptr< const Context > context, const RenderTarget &target)
 
- Protected Attributes inherited from impeller::RenderPass
const std::shared_ptr< const Contextcontext_
 
const SampleCount sample_count_
 
const PixelFormat pixel_format_
 
const bool has_depth_attachment_
 
const bool has_stencil_attachment_
 
const ISize render_target_size_
 
const RenderTarget render_target_
 
std::vector< Commandcommands_
 
const Matrix orthographic_
 

Detailed Description

Definition at line 15 of file render_pass_gles.h.

Constructor & Destructor Documentation

◆ ~RenderPassGLES()

impeller::RenderPassGLES::~RenderPassGLES ( )
overridedefault

Member Function Documentation

◆ IsValid()

bool impeller::RenderPassGLES::IsValid ( ) const
overrideprivatevirtual

Implements impeller::RenderPass.

Definition at line 34 of file render_pass_gles.cc.

34 {
35 return is_valid_;
36}

◆ OnEncodeCommands()

bool impeller::RenderPassGLES::OnEncodeCommands ( const Context context) const
overrideprivatevirtual

Setup color data.

Setup depth data.

Setup stencil data.

Implements impeller::RenderPass.

Definition at line 512 of file render_pass_gles.cc.

512 {
513 if (!IsValid()) {
514 return false;
515 }
516 const auto& render_target = GetRenderTarget();
517 if (!render_target.HasColorAttachment(0u)) {
518 return false;
519 }
520 const auto& color0 = render_target.GetColorAttachments().at(0u);
521 const auto& depth0 = render_target.GetDepthAttachment();
522 const auto& stencil0 = render_target.GetStencilAttachment();
523
524 auto pass_data = std::make_shared<RenderPassData>();
525 pass_data->label = label_;
526 pass_data->viewport.rect = Rect::MakeSize(GetRenderTargetSize());
527
528 //----------------------------------------------------------------------------
529 /// Setup color data.
530 ///
531 pass_data->color_attachment = color0.texture;
532 pass_data->clear_color = color0.clear_color;
533 pass_data->clear_color_attachment = CanClearAttachment(color0.load_action);
534 pass_data->discard_color_attachment =
535 CanDiscardAttachmentWhenDone(color0.store_action);
536
537 // When we are using EXT_multisampled_render_to_texture, it is implicitly
538 // resolved when we bind the texture to the framebuffer. We don't need to
539 // discard the attachment when we are done.
540 if (color0.resolve_texture) {
541 FML_DCHECK(context.GetCapabilities()->SupportsImplicitResolvingMSAA());
542 pass_data->discard_color_attachment = false;
543 }
544
545 //----------------------------------------------------------------------------
546 /// Setup depth data.
547 ///
548 if (depth0.has_value()) {
549 pass_data->depth_attachment = depth0->texture;
550 pass_data->clear_depth = depth0->clear_depth;
551 pass_data->clear_depth_attachment = CanClearAttachment(depth0->load_action);
552 pass_data->discard_depth_attachment =
553 CanDiscardAttachmentWhenDone(depth0->store_action);
554 }
555
556 //----------------------------------------------------------------------------
557 /// Setup stencil data.
558 ///
559 if (stencil0.has_value()) {
560 pass_data->stencil_attachment = stencil0->texture;
561 pass_data->clear_stencil = stencil0->clear_stencil;
562 pass_data->clear_stencil_attachment =
563 CanClearAttachment(stencil0->load_action);
564 pass_data->discard_stencil_attachment =
565 CanDiscardAttachmentWhenDone(stencil0->store_action);
566 }
567
568 std::shared_ptr<const RenderPassGLES> shared_this = shared_from_this();
569 auto tracer = ContextGLES::Cast(context).GetGPUTracer();
570 return reactor_->AddOperation([pass_data,
571 allocator = context.GetResourceAllocator(),
572 render_pass = std::move(shared_this),
573 tracer](const auto& reactor) {
574 auto result = EncodeCommandsInReactor(*pass_data, allocator, reactor,
575 render_pass->commands_, tracer);
576 FML_CHECK(result) << "Must be able to encode GL commands without error.";
577 });
578}
static ContextGLES & Cast(Context &base)
std::shared_ptr< GPUTracerGLES > GetGPUTracer() const
bool IsValid() const override
const RenderTarget & GetRenderTarget() const
ISize GetRenderTargetSize() const
#define FML_DCHECK(condition)
Definition logging.h:103
constexpr bool CanClearAttachment(LoadAction action)
Definition formats.h:240
constexpr bool CanDiscardAttachmentWhenDone(StoreAction action)
Definition formats.h:251
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:146

◆ OnSetLabel()

void impeller::RenderPassGLES::OnSetLabel ( std::string  label)
overrideprivatevirtual

Implements impeller::RenderPass.

Definition at line 39 of file render_pass_gles.cc.

39 {
40 label_ = std::move(label);
41}

Friends And Related Symbol Documentation

◆ CommandBufferGLES

friend class CommandBufferGLES
friend

Definition at line 23 of file render_pass_gles.h.


The documentation for this class was generated from the following files: