Flutter Impeller
runtime_types.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_IMPELLER_CORE_RUNTIME_TYPES_H_
6 #define FLUTTER_IMPELLER_CORE_RUNTIME_TYPES_H_
7 
8 #include <cstddef>
9 #include <cstdint>
10 #include <optional>
11 #include <string>
12 #include <vector>
13 
14 namespace impeller {
15 
16 enum class RuntimeStageBackend {
17  kSkSL,
18  kMetal,
19  kOpenGLES,
20  kOpenGLES3,
21  kVulkan,
22 };
23 
28 };
29 
30 enum class RuntimeShaderStage {
31  kVertex,
32  kFragment,
33  kCompute,
34 };
35 
37  size_t rows = 0;
38  size_t cols = 0;
39 };
40 
41 enum class RuntimePaddingType : uint8_t {
42  kPadding = 0,
43  kFloat = 1,
44 };
45 
46 struct StructField {
47  std::string name;
48  // The size in bytes of this field, not including padding.
49  size_t byte_size;
50 };
51 
53  std::string name;
54  size_t location = 0u;
55  /// Location, but for Vulkan.
56  size_t binding = 0u;
59  size_t bit_width = 0u;
60  std::optional<size_t> array_elements;
61  std::vector<RuntimePaddingType> padding_layout = {};
62  // The fields of the struct. Necessary on Vulkan, where everything is
63  // packed into a struct.
64  std::vector<StructField> struct_fields = {};
65  size_t struct_float_count = 0u;
66 
67  /// @brief Computes the total number of bytes that this uniform requires for
68  /// representation in the Dart float buffer.
69  size_t GetDartSize() const;
70 
71  /// @brief Computes the total number of bytes that this uniform requires for
72  /// representation in the GPU.
73  size_t GetGPUSize() const;
74 };
75 
76 } // namespace impeller
77 
78 #endif // FLUTTER_IMPELLER_CORE_RUNTIME_TYPES_H_
size_t GetGPUSize() const
Computes the total number of bytes that this uniform requires for representation in the GPU.
RuntimeUniformDimensions dimensions
Definition: runtime_types.h:58
size_t GetDartSize() const
Computes the total number of bytes that this uniform requires for representation in the Dart float bu...
Definition: runtime_types.cc:9
std::vector< StructField > struct_fields
Definition: runtime_types.h:64
std::vector< RuntimePaddingType > padding_layout
Definition: runtime_types.h:61
std::optional< size_t > array_elements
Definition: runtime_types.h:60
size_t binding
Location, but for Vulkan.
Definition: runtime_types.h:56