| 1 |
/* |
| 2 |
* Copyright 2021 Google LLC |
| 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 |
#ifndef skgpu_graphite_MtlBackendContext_DEFINED |
| 9 |
#define skgpu_graphite_MtlBackendContext_DEFINED |
| 10 |
|
| 11 |
#include "include/gpu/graphite/Context.h" |
| 12 |
#include "include/ports/SkCFObject.h" |
| 13 |
#include "include/private/base/SkAPI.h" |
| 14 |
|
| 15 |
#import <CoreFoundation/CoreFoundation.h> |
| 16 |
#include <memory> |
| 17 |
|
| 18 |
namespace skgpu::graphite { |
| 19 |
|
| 20 |
// The MtlBackendContext contains all of the base Metal objects needed by the graphite Metal |
| 21 |
// backend. The client will create this object and pass it into the Context::MakeMetal factory call |
| 22 |
// when setting up Skia. |
| 23 |
struct SK_API MtlBackendContext { |
| 24 |
sk_cfp<CFTypeRef> fDevice; |
| 25 |
sk_cfp<CFTypeRef> fQueue; |
| 26 |
}; |
| 27 |
|
| 28 |
namespace ContextFactory { |
| 29 |
SK_API std::unique_ptr<Context> MakeMetal(const MtlBackendContext&, const ContextOptions&); |
| 30 |
} // namespace ContextFactory |
| 31 |
|
| 32 |
} // namespace skgpu::graphite |
| 33 |
|
| 34 |
#endif // skgpu_graphite_MtlBackendContext_DEFINED |