xref: /aosp_15_r20/external/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2024 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 GrMtlDirectContext_DEFINED
9 #define GrMtlDirectContext_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "include/private/base/SkAPI.h"
13 
14 class GrDirectContext;
15 struct GrContextOptions;
16 struct GrMtlBackendContext;
17 
18 namespace GrDirectContexts {
19 /**
20  * Makes a GrDirectContext which uses Metal as the backend. The GrMtlBackendContext contains a
21  * MTLDevice and MTLCommandQueue which should be used by the backend. These objects must
22  * have their own ref which will be released when the GrMtlBackendContext is destroyed.
23  * Ganesh will take its own ref on the objects which will be released when the GrDirectContext
24  * is destroyed.
25  */
26 SK_API sk_sp<GrDirectContext> MakeMetal(const GrMtlBackendContext&, const GrContextOptions&);
27 SK_API sk_sp<GrDirectContext> MakeMetal(const GrMtlBackendContext&);
28 }  // namespace GrDirectContexts
29 
30 #endif
31