19 {
20 TRACE_EVENT0(
"impeller",
"SurfaceGLES::WrapOnScreenFBO");
21
22 if (context == nullptr || !context->IsValid() || !swap_callback) {
23 return nullptr;
24 }
25
27
28 TextureDescriptor color0_tex;
30 color0_tex.format = color_format;
31 color0_tex.size = fbo_size;
35
36 ColorAttachment color0;
37 color0.texture =
42
43 TextureDescriptor depth_stencil_texture_desc;
45 depth_stencil_texture_desc.format = color_format;
46 depth_stencil_texture_desc.size = fbo_size;
49
50 auto depth_stencil_tex =
52 depth_stencil_texture_desc
53 );
54
55 DepthAttachment depth0;
56 depth0.clear_depth = 0;
57 depth0.texture = depth_stencil_tex;
60
61 StencilAttachment stencil0;
62 stencil0.clear_stencil = 0;
63 stencil0.texture = depth_stencil_tex;
66
67 RenderTarget render_target_desc;
68
69 render_target_desc.SetColorAttachment(color0, 0u);
70 render_target_desc.SetDepthAttachment(depth0);
71 render_target_desc.SetStencilAttachment(stencil0);
72
73#ifdef IMPELLER_DEBUG
74 gl_context.GetGPUTracer()->RecordRasterThread();
75#endif
76
77
78 return std::unique_ptr<SurfaceGLES>(
79 new SurfaceGLES(std::move(swap_callback), render_target_desc));
80}
static ContextGLES & Cast(Context &base)
static std::shared_ptr< TextureGLES > WrapFBO(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc, GLuint fbo)
Create a texture by wrapping an external framebuffer object whose lifecycle is owned by the caller.
static std::shared_ptr< TextureGLES > CreatePlaceholder(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc)
Create a "texture" that is never expected to be bound/unbound explicitly or initialized in any way....
static constexpr Color DarkSlateGray()
#define TRACE_EVENT0(category_group, name)