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