xref: /aosp_15_r20/external/skia/include/gpu/GpuTypes.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2022 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_GpuTypes_DEFINED
9 #define skgpu_GpuTypes_DEFINED
10 
11 #include "include/core/SkTypes.h"
12 
13 /**
14  * This file includes numerous public types that are used by all of our gpu backends.
15  */
16 
17 namespace skgpu {
18 
19 /**
20  * Possible 3D APIs that may be used by Graphite.
21  */
22 enum class BackendApi : unsigned {
23     kDawn,
24     kMetal,
25     kVulkan,
26     kMock,
27 
28     /**
29      * Graphite doesn't support some context types (e.g. Direct3D) and will return Unsupported.
30      */
31     kUnsupported,
32 };
33 
34 /** Indicates whether an allocation should count against a cache budget. */
35 enum class Budgeted : bool {
36     kNo = false,
37     kYes = true,
38 };
39 
40 /**
41  * Value passed into various callbacks to tell the client the result of operations connected to a
42  * specific callback. The actual interpretation of kFailed and kSuccess are dependent on the
43  * specific callbacks and are documented with the callback itself.
44  */
45 enum class CallbackResult : bool {
46     kFailed = false,
47     kSuccess = true,
48 };
49 
50 /**
51  * Is the texture mipmapped or not
52  */
53 enum class Mipmapped : bool {
54     kNo = false,
55     kYes = true,
56 };
57 
58 /**
59  * Is the data protected on the GPU or not.
60  */
61 enum class Protected : bool {
62     kNo = false,
63     kYes = true,
64 };
65 
66 /**
67  * Is a texture renderable or not
68  */
69 enum class Renderable : bool {
70     kNo = false,
71     kYes = true,
72 };
73 
74 /**
75  * What is the logical origin of a BackendTexture passed into Skia
76  */
77 enum class Origin : unsigned {
78     kTopLeft,
79     kBottomLeft,
80 };
81 
82 enum class GpuStatsFlags : uint32_t {
83     kNone = 0b00,
84     kElapsedTime = 0b01,
85 };
86 
87 struct GpuStats {
88     uint64_t elapsedTime = 0;
89 };
90 
91 } // namespace skgpu
92 
93 
94 #endif // skgpu_GpuTypes_DEFINED
95