Flutter Engine
The Flutter Engine
formats.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_GPU_FORMATS_H_
6#define FLUTTER_LIB_GPU_FORMATS_H_
7
8#include "fml/logging.h"
11
12// ATTENTION! ATTENTION! ATTENTION!
13// All enums defined in this file must exactly match the contents and order of
14// the corresponding enums defined in `gpu/lib/src/formats.dart`.
15
16namespace flutter {
17namespace gpu {
18
20 kHostVisible,
21 kDevicePrivate,
22 kDeviceTransient,
23};
24
27 switch (value) {
34 }
35}
36
39}
40
42 kUnknown,
43 kA8UNormInt,
44 kR8UNormInt,
45 kR8G8UNormInt,
46 kR8G8B8A8UNormInt,
47 kR8G8B8A8UNormIntSRGB,
48 kB8G8R8A8UNormInt,
49 kB8G8R8A8UNormIntSRGB,
50 kR32G32B32A32Float,
51 kR16G16B16A16Float,
52 kB10G10R10XR,
53 kB10G10R10XRSRGB,
54 kB10G10R10A10XR,
55 kS8UInt,
56 kD24UnormS8Uint,
57 kD32FloatS8UInt,
58};
59
62 switch (value) {
95 }
96}
97
100}
101
104 switch (value) {
137 }
138}
139
141 kUploadFromHost,
142 kRenderToTexture,
143};
144
147 switch (value) {
152 }
153}
154
156 int value) {
159}
160
162 kZero,
163 kOne,
164 kSourceColor,
165 kOneMinusSourceColor,
166 kSourceAlpha,
167 kOneMinusSourceAlpha,
168 kDestinationColor,
169 kOneMinusDestinationColor,
170 kDestinationAlpha,
171 kOneMinusDestinationAlpha,
172 kSourceAlphaSaturated,
173 kBlendColor,
174 kOneMinusBlendColor,
175 kBlendAlpha,
176 kOneMinusBlendAlpha,
177};
178
181 switch (value) {
212 }
213}
214
217}
218
220 kAdd,
221 kSubtract,
222 kReverseSubtract,
223};
224
227 switch (value) {
234 }
235}
236
239}
240
242 kDontCare,
243 kLoad,
244 kClear,
245};
246
249 switch (value) {
256 }
257}
258
260 return ToImpellerLoadAction(static_cast<FlutterGPULoadAction>(value));
261}
262
264 kDontCare,
265 kStore,
266 kMultisampleResolve,
267 kStoreAndMultisampleResolve,
268};
269
272 switch (value) {
281 }
282}
283
286}
287
289 kVertex,
290 kFragment,
291};
292
295 switch (value) {
300 }
301}
302
305}
306
309 switch (value) {
316 FML_LOG(FATAL) << "Invalid Flutter GPU ShaderStage "
317 << static_cast<size_t>(value);
319 }
320}
321
323 kNearest,
324 kLinear,
325};
326
329 switch (value) {
334 }
335}
336
339}
340
342 kNearest,
343 kLinear,
344};
345
347 switch (value) {
352 }
353}
354
356 return ToImpellerMipFilter(static_cast<FlutterGPUMipFilter>(value));
357}
358
360 kClampToEdge,
361 kRepeat,
362 kMirror,
363};
364
367 switch (value) {
374 }
375}
376
379 static_cast<FlutterGPUSamplerAddressMode>(value));
380}
381
383 k16bit,
384 k32bit,
385};
386
388 switch (value) {
393 }
394}
395
397 return ToImpellerIndexType(static_cast<FlutterGPUIndexType>(value));
398}
399
401 kTriangle,
403 kLine,
404 kLineStrip,
405 kPoint,
406};
407
410 switch (value) {
421 }
422}
423
426}
427
429 kNever,
430 kAlways,
431 kLess,
432 kEqual,
433 kLessEqual,
434 kGreater,
435 kNotEqual,
436 kGreaterEqual,
437};
438
441 switch (value) {
458 }
459}
460
463 static_cast<FlutterGPUCompareFunction>(value));
464}
465
467 kKeep,
468 kZero,
469 kSetToReferenceValue,
470 kIncrementClamp,
471 kDecrementClamp,
472 kInvert,
473 kIncrementWrap,
474 kDecrementWrap,
475};
476
479 switch (value) {
496 }
497}
498
501 static_cast<FlutterGPUStencilOperation>(value));
502}
503
504} // namespace gpu
505} // namespace flutter
506
507#endif // FLUTTER_LIB_GPU_FORMATS_H_
constexpr auto kNever
Definition: SkSLTest.cpp:963
@ kAdd
Definition: embedder.h:990
#define FATAL(error)
uint8_t value
#define FML_LOG(severity)
Definition: logging.h:82
#define FML_UNREACHABLE()
Definition: logging.h:109
FlutterGPUShaderStage
Definition: formats.h:288
FlutterGPUMipFilter
Definition: formats.h:341
FlutterGPUPixelFormat
Definition: formats.h:41
FlutterGPUTextureCoordinateSystem
Definition: formats.h:140
constexpr impeller::PixelFormat ToImpellerPixelFormat(FlutterGPUPixelFormat value)
Definition: formats.h:60
FlutterGPUCompareFunction
Definition: formats.h:428
FlutterGPUStorageMode
Definition: formats.h:19
FlutterGPUBlendOperation
Definition: formats.h:219
constexpr impeller::BlendFactor ToImpellerBlendFactor(FlutterGPUBlendFactor value)
Definition: formats.h:179
FlutterGPUMinMagFilter
Definition: formats.h:322
constexpr FlutterGPUShaderStage FromImpellerShaderStage(impeller::ShaderStage value)
Definition: formats.h:307
constexpr impeller::BlendOperation ToImpellerBlendOperation(FlutterGPUBlendOperation value)
Definition: formats.h:225
FlutterGPUBlendFactor
Definition: formats.h:161
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode(FlutterGPUSamplerAddressMode value)
Definition: formats.h:365
constexpr impeller::MipFilter ToImpellerMipFilter(FlutterGPUMipFilter value)
Definition: formats.h:346
constexpr FlutterGPUPixelFormat FromImpellerPixelFormat(impeller::PixelFormat value)
Definition: formats.h:102
FlutterGPUSamplerAddressMode
Definition: formats.h:359
FlutterGPUStencilOperation
Definition: formats.h:466
constexpr impeller::TextureCoordinateSystem ToImpellerTextureCoordinateSystem(FlutterGPUTextureCoordinateSystem value)
Definition: formats.h:145
constexpr impeller::CompareFunction ToImpellerCompareFunction(FlutterGPUCompareFunction value)
Definition: formats.h:439
constexpr impeller::ShaderStage ToImpellerShaderStage(FlutterGPUShaderStage value)
Definition: formats.h:293
FlutterGPUPrimitiveType
Definition: formats.h:400
constexpr impeller::LoadAction ToImpellerLoadAction(FlutterGPULoadAction value)
Definition: formats.h:247
constexpr impeller::StoreAction ToImpellerStoreAction(FlutterGPUStoreAction value)
Definition: formats.h:270
FlutterGPULoadAction
Definition: formats.h:241
constexpr impeller::IndexType ToImpellerIndexType(FlutterGPUIndexType value)
Definition: formats.h:387
FlutterGPUIndexType
Definition: formats.h:382
constexpr impeller::StencilOperation ToImpellerStencilOperation(FlutterGPUStencilOperation value)
Definition: formats.h:477
FlutterGPUStoreAction
Definition: formats.h:263
constexpr impeller::PrimitiveType ToImpellerPrimitiveType(FlutterGPUPrimitiveType value)
Definition: formats.h:408
constexpr impeller::StorageMode ToImpellerStorageMode(FlutterGPUStorageMode value)
Definition: formats.h:25
constexpr impeller::MinMagFilter ToImpellerMinMagFilter(FlutterGPUMinMagFilter value)
Definition: formats.h:327
BlendFactor
Definition: formats.h:178
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:352
@ kPoint
Draws a point at each input vertex.
MipFilter
Options for selecting and filtering between mipmap levels.
Definition: formats.h:419
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
@ kNearest
The nearst mipmap level is selected.
StorageMode
Specified where the allocation resides and how it is used.
Definition: formats.h:32
SamplerAddressMode
Definition: formats.h:435
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
CompareFunction
Definition: formats.h:546
@ kEqual
Comparison test passes if new_value == current_value.
@ kLessEqual
Comparison test passes if new_value <= current_value.
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
@ kAlways
Comparison test passes always passes.
@ kLess
Comparison test passes if new_value < current_value.
@ kGreater
Comparison test passes if new_value > current_value.
@ kNotEqual
Comparison test passes if new_value != current_value.
@ kNever
Comparison test never passes.
StencilOperation
Definition: formats.h:565
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
@ kSetToReferenceValue
Reset the stencil value to the reference value.
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
@ kZero
Reset the stencil value to zero.
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
@ kInvert
Perform a logical bitwise invert on the current stencil value.
@ kKeep
Don't modify the current stencil value.
TextureCoordinateSystem
Definition: formats.h:327
LoadAction
Definition: formats.h:202
StoreAction
Definition: formats.h:208
MinMagFilter
Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (...
Definition: formats.h:409
@ kNearest
Select nearest to the sample point. Most widely supported.
BlendOperation
Definition: formats.h:196