Debian Codegraph @

include/gpu/graphite/mtl/MtlGraphiteTypes_cpp.h

raw
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 skgpu_graphite_MtlGraphiteTypesUtils_DEFINED
9 #define skgpu_graphite_MtlGraphiteTypesUtils_DEFINED
10
11 #include "include/core/SkTypes.h"
12
13 #include "include/gpu/graphite/BackendTexture.h"
14 #include "include/gpu/graphite/TextureInfo.h"
15 #include "include/private/base/SkAPI.h"
16
17 #import <CoreFoundation/CoreFoundation.h>
18
19 namespace skgpu::graphite {
20
21 // MtlTextureInfo requires compiling with Objective-C, so this header is split to allow invoking
22 // the various backend wrapping APIs from a C++-only compilation unit.
23 class SK_API MtlTextureInfo;
24
25 namespace TextureInfos {
26 SK_API TextureInfo MakeMetal(const MtlTextureInfo&);
27 SK_API TextureInfo MakeMetal(CFTypeRef mtlTexture);
28
29 SK_API bool GetMtlTextureInfo(const TextureInfo&, MtlTextureInfo*);
30 } // namespace TextureInfos
31
32 namespace BackendTextures {
33 // The BackendTexture will not call retain or release on the passed in CFTypeRef. Thus the
34 // client must keep the CFTypeRef valid until they are no longer using the BackendTexture.
35 SK_API BackendTexture MakeMetal(SkISize dimensions, CFTypeRef mtlTexture);
36
37 SK_API CFTypeRef GetMtlTexture(const BackendTexture&);
38 } // namespace BackendTextures
39
40 namespace BackendSemaphores {
41 // TODO(b/286088355) Determine creator's responsibility for setting refcnt.
42 SK_API BackendSemaphore MakeMetal(CFTypeRef mtlEvent, uint64_t value);
43
44 SK_API CFTypeRef GetMtlEvent(const BackendSemaphore&);
45 SK_API uint64_t GetMtlValue(const BackendSemaphore&);
46 } // namespace BackendSemaphores
47
48 } // namespace skgpu::graphite
49
50 #endif // skgpu_graphite_MtlGraphiteTypesUtils_DEFINED