Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef mozilla_gfx_layers_mlgpu_MLGDeviceTypes_h
7 : #define mozilla_gfx_layers_mlgpu_MLGDeviceTypes_h
8 :
9 : #include "mozilla/TypedEnumBits.h"
10 :
11 : namespace mozilla {
12 : namespace layers {
13 :
14 : enum class MLGUsage
15 : {
16 : // GPU read-only, CPU write once on creation and read/write never.
17 : Immutable,
18 :
19 : // GPU read-only, CPU write-only. Must be mapped with WRITE_DISCARD.
20 : Dynamic,
21 :
22 : // GPU read/write-only, no CPU access.
23 : Default,
24 :
25 : // GPU->CPU transfer, and read from the CPU.
26 : Staging
27 : };
28 :
29 : enum class MLGDepthTestMode
30 : {
31 : Disabled,
32 : Write,
33 : ReadOnly,
34 : AlwaysWrite,
35 : MaxModes
36 : };
37 :
38 : enum class MLGBufferType : uint32_t
39 : {
40 : Vertex,
41 : Constant
42 : };
43 :
44 : enum class SamplerMode
45 : {
46 : // Linear filter, clamped to border.
47 : LinearClamp = 0,
48 : // Linear filter, clamped to transparent pixels.
49 : LinearClampToZero,
50 : // Point filter, clamped to border.
51 : Point,
52 : MaxModes
53 : };
54 :
55 : enum class MLGBlendState
56 : {
57 : Copy = 0,
58 : Over,
59 : OverAndPremultiply,
60 : Min,
61 : ComponentAlpha,
62 : MaxStates
63 : };
64 :
65 : enum class MLGPrimitiveTopology
66 : {
67 : Unknown = 0,
68 : TriangleStrip = 1,
69 : TriangleList = 2,
70 : UnitQuad = 3,
71 : UnitTriangle = 4
72 : };
73 :
74 : struct MLGMappedResource
75 : {
76 : uint8_t* mData;
77 : uint32_t mStride;
78 : };
79 :
80 : enum class MLGMapType
81 : {
82 : READ = 0,
83 : WRITE,
84 : READ_WRITE,
85 : WRITE_DISCARD
86 : };
87 :
88 : enum class MLGTextureFlags
89 : {
90 : None,
91 : ShaderResource,
92 : RenderTarget
93 : };
94 : MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(MLGTextureFlags);
95 :
96 : enum class MLGRenderTargetFlags : uint32_t
97 : {
98 : Default = 0,
99 : ZBuffer = (1 << 0)
100 : };
101 0 : MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(MLGRenderTargetFlags);
102 :
103 : // NVIDIA drivers crash when we supply too many rects to ClearView - it
104 : // seems to cause a stack overflow >= 20 rects. We cap to 12 for now.
105 : static const size_t kMaxClearViewRects = 12;
106 :
107 : } // namespace layers
108 : } // namespace mozilla
109 :
110 : #endif // mozilla_gfx_layers_mlgpu_MLGDeviceTypes_h
|