Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions impeller/renderer/backend/metal/surface_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,24 @@
id<MTLTexture> texture,
bool requires_blit,
std::optional<IRect> clip_rect) {
// compositor_context.cc will offset the rendering by the clip origin. Here we
// shrink to the size of the clip. This has the same effect as clipping the
// rendering but also creates smaller intermediate passes.
ISize root_size;
if (requires_blit) {
if (!clip_rect.has_value()) {
VALIDATION_LOG << "Missing clip rectangle.";
return std::nullopt;
}
root_size = ISize(clip_rect->size.width, clip_rect->size.height);
} else {
root_size = {static_cast<ISize::Type>(texture.width),
static_cast<ISize::Type>(texture.height)};
}

TextureDescriptor resolve_tex_desc;
resolve_tex_desc.format = FromMTLPixelFormat(texture.pixelFormat);
resolve_tex_desc.size = {static_cast<ISize::Type>(texture.width),
static_cast<ISize::Type>(texture.height)};
resolve_tex_desc.size = root_size;
resolve_tex_desc.usage = static_cast<uint64_t>(TextureUsage::kRenderTarget) |
static_cast<uint64_t>(TextureUsage::kShaderRead);
resolve_tex_desc.sample_count = SampleCount::kCount1;
Expand Down