Flutter Engine
The Flutter Engine
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:
impeller::Surface

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 ISizeGetSize () const
 
bool IsValid () const
 
const RenderTargetGetTargetRenderPassDescriptor () const
 
virtual bool Present () const
 

Static Public Member Functions

static std::unique_ptr< SurfaceWrapFBO (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

Definition at line 19 of file surface_gles.h.

Constructor & Destructor Documentation

◆ ~SurfaceGLES()

impeller::SurfaceGLES::~SurfaceGLES ( )
overridedefault

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 = 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 depth_stencil_texture_desc;
44 depth_stencil_texture_desc.type = TextureType::kTexture2D;
45 depth_stencil_texture_desc.format = color_format;
46 depth_stencil_texture_desc.size = fbo_size;
47 depth_stencil_texture_desc.usage = TextureUsage::kRenderTarget;
48 depth_stencil_texture_desc.sample_count = SampleCount::kCount1;
49
50 auto depth_stencil_tex = std::make_shared<TextureGLES>(
51 gl_context.GetReactor(), depth_stencil_texture_desc,
53
54 DepthAttachment depth0;
55 depth0.clear_depth = 0;
56 depth0.texture = depth_stencil_tex;
57 depth0.load_action = LoadAction::kClear;
58 depth0.store_action = StoreAction::kDontCare;
59
60 StencilAttachment stencil0;
61 stencil0.clear_stencil = 0;
62 stencil0.texture = depth_stencil_tex;
63 stencil0.load_action = LoadAction::kClear;
64 stencil0.store_action = StoreAction::kDontCare;
65
66 RenderTarget render_target_desc;
67
68 render_target_desc.SetColorAttachment(color0, 0u);
69 render_target_desc.SetDepthAttachment(depth0);
70 render_target_desc.SetStencilAttachment(stencil0);
71
72#ifdef IMPELLER_DEBUG
73 gl_context.GetGPUTracer()->RecordRasterThread();
74#endif // IMPELLER_DEBUG
75
76 return std::unique_ptr<SurfaceGLES>(
77 new SurfaceGLES(std::move(swap_callback), render_target_desc));
78}
static ContextGLES & Cast(Context &base)
Definition: backend_cast.h:13
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static constexpr Color DarkSlateGray()
Definition: color.h:420
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131

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