Debian Codegraph @

tools/gpu/ContextType.h

raw
1 /*
2 * Copyright 2023 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 #ifndef ContextType_DEFINED
9 #define ContextType_DEFINED
10
11 #include "include/core/SkTypes.h"
12
13 #if defined(SK_GANESH)
14 enum class GrBackendApi : unsigned;
15 #endif
16
17 namespace skgpu {
18
19 #if defined(SK_GRAPHITE)
20 enum class BackendApi : unsigned;
21 #endif
22
23 // The availability of context types is subject to platform and build configuration
24 // restrictions.
25 enum class ContextType {
26 kGL, //! OpenGL context.
27 kGLES, //! OpenGL ES context.
28 kANGLE_D3D9_ES2, //! ANGLE on Direct3D9 OpenGL ES 2 context.
29 kANGLE_D3D11_ES2, //! ANGLE on Direct3D11 OpenGL ES 2 context.
30 kANGLE_D3D11_ES3, //! ANGLE on Direct3D11 OpenGL ES 3 context.
31 kANGLE_GL_ES2, //! ANGLE on OpenGL OpenGL ES 2 context.
32 kANGLE_GL_ES3, //! ANGLE on OpenGL OpenGL ES 3 context.
33 kANGLE_Metal_ES2, //! ANGLE on Metal ES 2 context.
34 kANGLE_Metal_ES3, //! ANGLE on Metal ES 3 context.
35 kVulkan, //! Vulkan
36 kMetal, //! Metal
37 kDirect3D, //! Direct3D 12
38 kDawn_D3D11, //! Dawn on Direct3D11
39 kDawn_D3D12, //! Dawn on Direct3D12
40 kDawn_Metal, //! Dawn on Metal
41 kDawn_Vulkan, //! Dawn on Vulkan
42 kDawn_OpenGL, //! Dawn on OpenGL
43 kDawn_OpenGLES, //! Dawn on OpenGL ES
44 kMock, //! Mock context that does not draw.
45 kLastContextType = kMock
46 };
47
48 static const int kContextTypeCount = (int)ContextType::kLastContextType + 1;
49
50 const char* ContextTypeName(skgpu::ContextType type);
51
52 bool IsNativeBackend(skgpu::ContextType type);
53
54 bool IsDawnBackend(skgpu::ContextType type);
55
56 bool IsRenderingContext(skgpu::ContextType type);
57
58 #if defined(SK_GANESH)
59 namespace ganesh {
60
61 GrBackendApi ContextTypeBackend(skgpu::ContextType type);
62
63 } // namespace ganesh
64 #endif
65
66 #if defined(SK_GRAPHITE)
67 namespace graphite {
68
69 skgpu::BackendApi ContextTypeBackend(skgpu::ContextType type);
70
71 } // namespace graphite
72 #endif
73
74 } // namespace skgpu
75
76 #endif