7#include "flutter/fml/trace_event.h"
15 const std::shared_ptr<Context>& context,
20 TRACE_EVENT0(
"impeller",
"SurfaceGLES::WrapOnScreenFBO");
22 if (context ==
nullptr || !context->IsValid() || !swap_callback) {
30 color0_tex.
format = color_format;
31 color0_tex.
size = fbo_size;
37 color0.
texture = std::make_shared<TextureGLES>(
45 depth_stencil_texture_desc.
format = color_format;
46 depth_stencil_texture_desc.
size = fbo_size;
50 auto depth_stencil_tex = std::make_shared<TextureGLES>(
51 gl_context.GetReactor(), depth_stencil_texture_desc,
56 depth0.
texture = depth_stencil_tex;
62 stencil0.
texture = depth_stencil_tex;
73 gl_context.GetGPUTracer()->RecordRasterThread();
76 return std::unique_ptr<SurfaceGLES>(
77 new SurfaceGLES(std::move(swap_callback), render_target_desc));
80SurfaceGLES::SurfaceGLES(SwapCallback swap_callback,
82 :
Surface(target_desc), swap_callback_(
std::move(swap_callback)) {}
88bool SurfaceGLES::Present()
const {
89 return swap_callback_ ? swap_callback_() :
false;
static ContextGLES & Cast(Context &base)
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
RenderTarget & SetStencilAttachment(std::optional< StencilAttachment > attachment)
static std::unique_ptr< Surface > WrapFBO(const std::shared_ptr< Context > &context, SwapCallback swap_callback, GLuint fbo, PixelFormat color_format, ISize fbo_size)
std::function< bool(void)> SwapCallback
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
std::shared_ptr< Texture > texture
static constexpr Color DarkSlateGray()
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
#define TRACE_EVENT0(category_group, name)