Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5d72b38

Browse files
committed
Fix GLES onscreen texture setup
1 parent ae5c0ff commit 5d72b38

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

impeller/renderer/backend/gles/surface_gles.cc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,34 @@ std::unique_ptr<Surface> SurfaceGLES::WrapFBO(
4040
color0.load_action = LoadAction::kClear;
4141
color0.store_action = StoreAction::kStore;
4242

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 =
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 =
4848
static_cast<TextureUsageMask>(TextureUsage::kRenderTarget);
49-
stencil0_tex.sample_count = SampleCount::kCount1;
49+
depth_stencil_texture_desc.sample_count = SampleCount::kCount1;
50+
51+
auto depth_stencil_tex = std::make_shared<TextureGLES>(
52+
gl_context.GetReactor(), depth_stencil_texture_desc,
53+
TextureGLES::IsWrapped::kWrapped);
54+
55+
DepthAttachment depth0;
56+
depth0.clear_depth = 0;
57+
depth0.texture = depth_stencil_tex;
58+
depth0.load_action = LoadAction::kClear;
59+
depth0.store_action = StoreAction::kDontCare;
5060

5161
StencilAttachment stencil0;
5262
stencil0.clear_stencil = 0;
53-
stencil0.texture = std::make_shared<TextureGLES>(
54-
gl_context.GetReactor(), stencil0_tex, TextureGLES::IsWrapped::kWrapped);
63+
stencil0.texture = depth_stencil_tex;
5564
stencil0.load_action = LoadAction::kClear;
5665
stencil0.store_action = StoreAction::kDontCare;
5766

5867
RenderTarget render_target_desc;
5968

6069
render_target_desc.SetColorAttachment(color0, 0u);
70+
render_target_desc.SetDepthAttachment(depth0);
6171
render_target_desc.SetStencilAttachment(stencil0);
6272

6373
#ifdef IMPELLER_DEBUG

impeller/renderer/render_target.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "impeller/base/strings.h"
1010
#include "impeller/base/validation.h"
1111
#include "impeller/core/allocator.h"
12+
#include "impeller/core/formats.h"
1213
#include "impeller/core/texture.h"
1314
#include "impeller/renderer/context.h"
1415

0 commit comments

Comments
 (0)