1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci* Copyright 2021 Google Inc.
3cb93a386Sopenharmony_ci*
4cb93a386Sopenharmony_ci* Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci* found in the LICENSE file.
6cb93a386Sopenharmony_ci*/
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#include "src/gpu/mtl/GrMtlFramebuffer.h"
9cb93a386Sopenharmony_ci
10cb93a386Sopenharmony_ci#include "src/gpu/mtl/GrMtlAttachment.h"
11cb93a386Sopenharmony_ci
12cb93a386Sopenharmony_cisk_sp<const GrMtlFramebuffer> GrMtlFramebuffer::Make(
13cb93a386Sopenharmony_ci        GrMtlAttachment* colorAttachment,
14cb93a386Sopenharmony_ci        GrMtlAttachment* resolveAttachment,
15cb93a386Sopenharmony_ci        GrMtlAttachment* stencilAttachment) {
16cb93a386Sopenharmony_ci    // At the very least we need a colorAttachment
17cb93a386Sopenharmony_ci    SkASSERT(colorAttachment);
18cb93a386Sopenharmony_ci
19cb93a386Sopenharmony_ci    auto fb = new GrMtlFramebuffer(sk_ref_sp(colorAttachment), sk_ref_sp(resolveAttachment),
20cb93a386Sopenharmony_ci                                   sk_ref_sp(stencilAttachment));
21cb93a386Sopenharmony_ci    return sk_sp<const GrMtlFramebuffer>(fb);
22cb93a386Sopenharmony_ci}
23cb93a386Sopenharmony_ci
24cb93a386Sopenharmony_ciGrMtlFramebuffer::GrMtlFramebuffer(sk_sp<GrMtlAttachment> colorAttachment,
25cb93a386Sopenharmony_ci                                   sk_sp<GrMtlAttachment> resolveAttachment,
26cb93a386Sopenharmony_ci                                   sk_sp<GrMtlAttachment> stencilAttachment)
27cb93a386Sopenharmony_ci        : fColorAttachment(std::move(colorAttachment))
28cb93a386Sopenharmony_ci        , fResolveAttachment(std::move(resolveAttachment))
29cb93a386Sopenharmony_ci        , fStencilAttachment(std::move(stencilAttachment)) {
30cb93a386Sopenharmony_ci}
31