Skip to content

Commit 3aebe09

Browse files
committed
Always set the wrapped texture descriptor to the correct size
1 parent 72fb1b8 commit 3aebe09

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

impeller/renderer/backend/metal/surface_mtl.mm

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,10 @@
4545
id<MTLTexture> texture,
4646
bool requires_blit,
4747
std::optional<IRect> clip_rect) {
48-
// compositor_context.cc will offset the rendering by the clip origin. Here we
49-
// shrink to the size of the clip. This has the same effect as clipping the
50-
// rendering but also creates smaller intermediate passes.
51-
ISize root_size;
52-
if (requires_blit) {
53-
if (!clip_rect.has_value()) {
54-
VALIDATION_LOG << "Missing clip rectangle.";
55-
return std::nullopt;
56-
}
57-
root_size = ISize(clip_rect->size.width, clip_rect->size.height);
58-
} else {
59-
root_size = {static_cast<ISize::Type>(texture.width),
60-
static_cast<ISize::Type>(texture.height)};
61-
}
62-
6348
TextureDescriptor resolve_tex_desc;
6449
resolve_tex_desc.format = FromMTLPixelFormat(texture.pixelFormat);
65-
resolve_tex_desc.size = root_size;
50+
resolve_tex_desc.size = {static_cast<ISize::Type>(texture.width),
51+
static_cast<ISize::Type>(texture.height)};
6652
resolve_tex_desc.usage = static_cast<uint64_t>(TextureUsage::kRenderTarget) |
6753
static_cast<uint64_t>(TextureUsage::kShaderRead);
6854
resolve_tex_desc.sample_count = SampleCount::kCount1;
@@ -110,8 +96,8 @@
11096
color0.store_action = StoreAction::kMultisampleResolve;
11197
color0.resolve_texture = std::move(resolve_tex);
11298

113-
RenderTarget render_target_desc;
114-
render_target_desc.SetColorAttachment(color0, 0u);
99+
auto render_target_desc = std::make_optional<RenderTarget>();
100+
render_target_desc->SetColorAttachment(color0, 0u);
115101

116102
return render_target_desc;
117103
}

0 commit comments

Comments
 (0)