• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / luma.gl / 7922223183

15 Feb 2024 09:01PM UTC coverage: 71.178%. Remained the same
7922223183

push

github

web-flow
chore: Update build system to latest ocular: typescript+esbuild (#1942)

1419 of 1928 branches covered (73.6%)

Branch coverage included in aggregate %.

20982 of 29544 relevant lines covered (71.02%)

18.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/modules/core/src/adapter/types/parameters.ts
1
import {DepthStencilTextureFormat} from './texture-formats';
×
2

×
3
export type CompareFunction =
×
4
  'never' |
×
5
  'less' |
×
6
  'equal' |
×
7
  'less-equal' |
×
8
  'greater' |
×
9
  'not-equal' |
×
10
  'greater-equal' |
×
11
  'always';
×
12

×
13
// Primitive state
×
14

×
15
export type PrimitiveTopology =
×
16
  'point-list' |
×
17
  'line-list' |
×
18
  'line-strip' |
×
19
  /** @deprecated */
×
20
  'line-loop-webgl' |
×
21
  'triangle-list' |
×
22
  'triangle-strip' |
×
23
  /** @deprecated */
×
24
  'triangle-fan-webgl';
×
25

×
26
export type IndexFormat = 'uint16' | 'uint32';
×
27

×
28
export type CullMode = 'none' | 'front' | 'back';
×
29
export type FrontFace = 'ccw' | 'cw';
×
30

×
31
// Rasterization Parameters
×
32

×
33
type _RenderParameters = {
×
34
  /** Defines which polygon orientation will be culled, if any. Only applies to triangle topologies/ */
×
35
  cullMode?: CullMode;
×
36
  /** Defines which polygons are considered front-facing. Only applies to triangle topologies. Default to "ccw" */
×
37
  frontFace?: FrontFace;
×
38
  /** TBD */
×
39
  depthClamp?: boolean;
×
40
  /** Constant depth bias (polygon offset) added to each fragment. */
×
41
  depthBias?: number;
×
42
  /** Depth bias (polygon offset) that scales with the fragment’s slope. */
×
43
  depthBiasSlopeScale?: number;
×
44
  /** Maximum depth bias of a fragment. */
×
45
  depthBiasClamp?: number;
×
46
}
×
47

×
48
export type RasterizationParameters = _RenderParameters & {
×
49
  /** The type of primitive to be constructed from the vertex inputs. Defaults to "triangle-list". */
×
50
  topology?: PrimitiveTopology;
×
51
  /** For pipelines with strip topologies ("line-strip" or "triangle-strip"), this determines the index buffer format and primitive restart value ("uint16"/0xFFFF or "uint32"/0xFFFFFFFF). It is not allowed on pipelines with non-strip topologies. */
×
52
  stripIndexFormat?: IndexFormat; // WebGPU only
×
53
}
×
54

×
55
// Depth Stencil Parameters
×
56

×
57
/** Types of operations that can be performed on stencil buffers when various tests pass */
×
58
export type StencilOperation =
×
59
  'keep' |
×
60
  'zero' |
×
61
  'replace' |
×
62
  'invert' |
×
63
  'increment-clamp' |
×
64
  'decrement-clamp' |
×
65
  'increment-wrap' |
×
66
  'decrement-wrap';
×
67

×
68
export type DepthStencilParameters = {
×
69
  /** Whether this GPURenderPipeline can modify depthStencilAttachment depth values. */
×
70
  depthWriteEnabled?: boolean;
×
71
  /** The comparison operation used to test fragment depths against existing depthStencilAttachment depth values. */
×
72
  depthCompare?: CompareFunction;
×
73
  /** The format of depthStencilAttachment this GPURenderPipeline will be compatible with. */
×
74
  depthFormat?: DepthStencilTextureFormat;
×
75

×
76
  /** Bitmask controlling which depthStencilAttachment stencil value bits are read when performing stencil comparison tests. */
×
77
  stencilReadMask?: number;
×
78
  /** Bitmask controlling which depthStencilAttachment stencil value bits are written to when performing stencil operations. */
×
79
  stencilWriteMask?: number;
×
80

×
81
  /** The CompareFunction used when testing fragments against depthStencilAttachment stencil values. */
×
82
  stencilCompare?: CompareFunction;
×
83
  /** The StencilOperation performed if the fragment stencil comparison test described by compare fails. */
×
84
  stencilPassOperation?: StencilOperation;
×
85
  /** The GPUStencilOperation performed if the fragment depth comparison described by depthCompare fails. */
×
86
  stencilFailOperation?: StencilOperation;
×
87
  /** The GPUStencilOperation performed if the fragment stencil comparison test described by compare passes. */
×
88
  stencilDepthFailOperation?: StencilOperation;
×
89
}
×
90

×
91
// Color Parameters
×
92

×
93
/** BlendFactor defines how either a source or destination blend factors is calculated */
×
94
export type BlendFactor =
×
95
  'zero' |
×
96
  'one' |
×
97
  'src-color' |
×
98
  'one-minus-src-color' |
×
99
  'src-alpha' |
×
100
  'one-minus-src-alpha' |
×
101
  'dst-color' |
×
102
  'one-minus-dst-color' |
×
103
  'dst-alpha' |
×
104
  'one-minus-dst-alpha' |
×
105
  'src-alpha-saturated' |
×
106
  'blend-color' |
×
107
  'one-minus-blend-color';
×
108

×
109
/** BlendOperation defines the algorithm used to combine source and destination blend factors: */
×
110
export type BlendOperation =
×
111
  'add' |
×
112
  'subtract' |
×
113
  'reverse-subtract' |
×
114
  'min' |
×
115
  'max';
×
116

×
117
/*
×
118
export const ColorWrite = {
×
119
  RED: 0x1,
×
120
  GREEN: 0x2,
×
121
  BLUE: 0x4,
×
122
  ALPHA: 0x8,
×
123
  ALL: 0xF
×
124
};
×
125

×
126
blend: {
×
127
  color: {operation, srcFactor, dstFactor}
×
128
  alpha: {operation, srcFactor, dstFactor}
×
129
}
×
130
colorWriteMask
×
131

×
132
rgba
×
133
rgb
×
134
rga
×
135
rba
×
136
gba
×
137
rg
×
138
rb
×
139
ra
×
140
gb
×
141
ga
×
142
ba
×
143
r
×
144
g
×
145
b
×
146
a
×
147
none
×
148
*/
×
149

×
150
/* Color parameters are set on the RenderPipeline */
×
151
export type ColorParameters = {
×
152
  /** Defines the operation used to calculate the values written to the target attachment components. */
×
153
  blendColorOperation?: BlendOperation;
×
154
  /** Defines the operation to be performed on values from the fragment shader. */
×
155
  blendColorSrcFactor?: BlendFactor;
×
156
  /** Defines the operation to be performed on values from the target attachment. */
×
157
  blendColorDstFactor?: BlendFactor;
×
158

×
159
  /** Defines the operation used to calculate the values written to the target attachment components. */
×
160
  blendAlphaOperation?: BlendOperation;
×
161
  /** Defines the operation to be performed on values from the fragment shader. */
×
162
  blendAlphaSrcFactor?: BlendFactor;
×
163
  /** Defines the operation to be performed on values from the target attachment. */
×
164
  blendAlphaDstFactor?: BlendFactor;
×
165

×
166
  /** Bitmask controlling which channels are are written to when drawing to this color target. defaulting to 0xF */
×
167
  colorMask?: number;
×
168
}
×
169

×
170
/** Multisample */
×
171
export type MultisampleParameters = {
×
172
  /** Number of samples per pixel. RenderPipeline will be compatible only with attachment textures with matching sampleCounts. */
×
173
  sampleCount?: number; //  = 1;
×
174
  /** Mask determining which samples are written to. defaulting to 0xFFFFFFFF */
×
175
  sampleMask?: number; 
×
176
  /** When true indicates that a fragment’s alpha channel should be used to generate a sample coverage mask. */
×
177
  sampleAlphaToCoverageEnabled?: boolean; //  = false;
×
178
};
×
179

×
180
/** These parameters are set on the render pass and are thus easy to change frequently */
×
181
export type RenderPassParameters = {
×
182
  /** Linear map from normalized device coordinates to viewport coordinates [x, y, width, height, minDepth, maxDepth] */
×
183
  viewport?: number[]; 
×
184
  /** Sets scissor rectangle used during rasterization. Discards fragments outside viewport coords [x, y, width, height]. */
×
185
  scissorRect?: number[]; // ;
×
186
  /** Sets constant blend color and alpha values used with "constant" and "one-minus-constant" blend factors. */
×
187
  blendConstant?: number[]; // GPUColor
×
188
  /** Stencil operation "replace" sets the value to stencilReference */
×
189
  stencilReference?: number; // GPUStencilValue
×
190
};
×
191

×
192
export type RenderPipelineParameters =
×
193
  RasterizationParameters &
×
194
  DepthStencilParameters &
×
195
  ColorParameters &
×
196
  MultisampleParameters;
×
197

×
198
export type Parameters =
×
199
  _RenderParameters &
×
200
  DepthStencilParameters &
×
201
  ColorParameters &
×
202
  MultisampleParameters;
×
203

×
204
// export const DEFAULT_PARAMETERS: Parameters;
×
205

×
206
export const DEFAULT_PARAMETERS: Required<Parameters> = {
×
207

×
208
  // Rasterization Parameters
×
209

×
210
  cullMode: 'none',
×
211
  frontFace: 'ccw',
×
212

×
213
  // Depth Parameters
×
214

×
215
  depthWriteEnabled: false,
×
216
  depthCompare: 'always',
×
217
  depthFormat: 'depth24plus',
×
218

×
219
  depthClamp: false,
×
220
  depthBias: 0,
×
221
  depthBiasSlopeScale: 0,
×
222
  depthBiasClamp: 0,
×
223

×
224
  // Stencil parameters
×
225

×
226
  stencilReadMask: 0xFFFFFFFF,
×
227
  stencilWriteMask: 0xFFFFFFFF,
×
228

×
229
  stencilCompare: 'always',
×
230
  stencilPassOperation: 'keep',
×
231
  stencilFailOperation: 'keep',
×
232
  stencilDepthFailOperation: 'keep',
×
233

×
234
  // Multisample parameters
×
235
  sampleCount: 0,
×
236
  sampleMask: 0xFFFFFFFF,
×
237
  sampleAlphaToCoverageEnabled: false,
×
238

×
239
  // Color and blend parameters
×
240

×
241
  blendColorOperation: 'add',
×
242
  blendColorSrcFactor: 'one',
×
243
  blendColorDstFactor: 'zero',
×
244

×
245
  blendAlphaOperation: 'add',
×
246
  blendAlphaSrcFactor: 'one',
×
247
  blendAlphaDstFactor: 'zero',
×
248

×
249
  colorMask: 0xF
×
250
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc