| Flutter Impeller |

Public Types | Public Member Functions | Static Public Member Functions | List of all members
impeller::SurfaceGLES Class Referencefinal

`#include <surface_gles.h>`

Inheritance diagram for impeller::SurfaceGLES:

## Public Types
using | SwapCallback = std::function< bool(void)>

## Public Member Functions
| ~SurfaceGLES () override
Public Member Functions inherited from impeller::Surface
| Surface ()
| Surface (const RenderTarget &target_desc)
virtual | ~Surface ()
const ISize & | GetSize () const
bool | IsValid () const
const RenderTarget & | GetTargetRenderPassDescriptor () const

## Static Public Member Functions
static std::unique_ptr< Surface > | WrapFBO (const std::shared_ptr< Context > &context, SwapCallback swap_callback, GLuint fbo, PixelFormat color_format, ISize fbo_size)

## Detailed Description

Definition at line 17 of file surface_gles.h.

## Member Typedef Documentation

## ◆ SwapCallback

using impeller::SurfaceGLES::SwapCallback = std::function<bool(void)>

Definition at line 19 of file surface_gles.h.

## Constructor & Destructor Documentation

## ◆ ~SurfaceGLES()

impeller::SurfaceGLES::~SurfaceGLES | ( |  | ) |
| override default

## Member Function Documentation

## ◆ WrapFBO()

std::unique_ptr< Surface > impeller::SurfaceGLES::WrapFBO | ( | const std::shared_ptr< Context > & | context,
|  | SwapCallback | swap_callback,
|  | GLuint | fbo,
|  | PixelFormat | color_format,
|  | ISize | fbo_size
| ) |  |
| static

Definition at line 14 of file surface_gles.cc.

19 {
20 TRACE_EVENT0("impeller", "SurfaceGLES::WrapOnScreenFBO");
21
22 if (context == nullptr || !context->IsValid() || !swap_callback) {
23 return nullptr;
24 }
25
26 const auto& gl_context = ContextGLES::Cast(*context);
27
28 TextureDescriptor color0_tex;
29 color0_tex.type = TextureType::kTexture2D;
30 color0_tex.format = color_format;
31 color0_tex.size = fbo_size;
32 color0_tex.usage = static_cast<TextureUsageMask>(TextureUsage::kRenderTarget);
33 color0_tex.sample_count = SampleCount::kCount1;
34 color0_tex.storage_mode = StorageMode::kDevicePrivate;
35
36 ColorAttachment color0;
37 color0.texture = std::make_shared<TextureGLES>(
38 gl_context.GetReactor(), color0_tex, TextureGLES::IsWrapped::kWrapped);
39 color0.clear_color = Color::DarkSlateGray();
40 color0.load_action = LoadAction::kClear;
41 color0.store_action = StoreAction::kStore;
42
43 TextureDescriptor stencil0_tex;
44 stencil0_tex.type = TextureType::kTexture2D;
45 stencil0_tex.format = color_format;
46 stencil0_tex.size = fbo_size;
47 stencil0_tex.usage =
48 static_cast<TextureUsageMask>(TextureUsage::kRenderTarget);
49 stencil0_tex.sample_count = SampleCount::kCount1;
50
51 StencilAttachment stencil0;
52 stencil0.clear_stencil = 0;
53 stencil0.texture = std::make_shared<TextureGLES>(
54 gl_context.GetReactor(), stencil0_tex, TextureGLES::IsWrapped::kWrapped);
55 stencil0.load_action = LoadAction::kClear;
56 stencil0.store_action = StoreAction::kDontCare;
57
58 RenderTarget render_target_desc;
59
60 render_target_desc.SetColorAttachment(color0, 0u);
61 render_target_desc.SetStencilAttachment(stencil0);
62
63 return std::unique_ptr<SurfaceGLES>(
64 new SurfaceGLES(std::move(swap_callback), render_target_desc));
65 }

References impeller::BackendCast< ContextGLES, Context >::Cast(), impeller::ColorAttachment::clear_color, impeller::StencilAttachment::clear_stencil, impeller::Color::DarkSlateGray(), impeller::TextureDescriptor::format, impeller::kClear, impeller::kCount1, impeller::kDevicePrivate, impeller::kDontCare, impeller::kRenderTarget, impeller::kStore, impeller::kTexture2D, impeller::TextureGLES::kWrapped, impeller::Attachment::load_action, impeller::TextureDescriptor::sample_count, impeller::RenderTarget::SetColorAttachment(), impeller::RenderTarget::SetStencilAttachment(), impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, impeller::Attachment::store_action, impeller::Attachment::texture, impeller::TextureDescriptor::type, and impeller::TextureDescriptor::usage.

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

- impeller/renderer/backend/gles/surface_gles.h
- impeller/renderer/backend/gles/surface_gles.cc

impeller::TextureUsageMask
uint64_t TextureUsageMask
Definition: formats.h:274
impeller::SampleCount::kCount1
@ kCount1
impeller::TextureUsage::kRenderTarget
@ kRenderTarget
impeller::StoreAction::kDontCare
@ kDontCare
impeller::Color::DarkSlateGray
static constexpr Color DarkSlateGray()
Definition: color.h:408
impeller::LoadAction::kClear
@ kClear
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::StoreAction::kStore
@ kStore
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::BackendCast< ContextGLES, Context >::Cast
static ContextGLES & Cast(Context &base)
Definition: backend_cast.h:14
impeller::TextureGLES::IsWrapped::kWrapped
@ kWrapped