| 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
24 enum RuntimeUniformType {
25 kFloat,
26 kSampledImage,
27 kStruct,
28 };
29
30 enum class RuntimeShaderStage {
31 kVertex,
32 kFragment,
33 kCompute,
34 };
35
36 struct RuntimeUniformDimensions {
37 size_t rows = 0;
38 size_t cols = 0;
39 };
40
41 struct RuntimeUniformDescription {
42 std::string name;
43 size_t location = 0u;
44 /// Location, but for Vulkan.
45 size_t binding = 0u;
46 RuntimeUniformType type = RuntimeUniformType::kFloat;
47 RuntimeUniformDimensions dimensions = {};
48 size_t bit_width = 0u;
49 std::optional<size_t> array_elements;
50 std::vector<uint8_t> struct_layout = {};
51 size_t struct_float_count = 0u;
52
53 /// @brief Computes the total number of bytes that this uniform requires.
54 size_t GetSize() const;
55 };
56
57 } // namespace impeller
58
59 #endif // FLUTTER_IMPELLER_CORE_RUNTIME_TYPES_H_
impeller
Definition: allocation.cc:12
impeller::RuntimeShaderStage
RuntimeShaderStage
Definition: runtime_types.h:30
impeller::RuntimeShaderStage::kCompute
@ kCompute
impeller::RuntimeShaderStage::kFragment
@ kFragment
impeller::RuntimeShaderStage::kVertex
@ kVertex
impeller::RuntimeStageBackend
RuntimeStageBackend
Definition: runtime_types.h:16
impeller::RuntimeStageBackend::kOpenGLES
@ kOpenGLES
impeller::RuntimeStageBackend::kMetal
@ kMetal
impeller::RuntimeStageBackend::kVulkan
@ kVulkan
impeller::RuntimeStageBackend::kSkSL
@ kSkSL
impeller::RuntimeStageBackend::kOpenGLES3
@ kOpenGLES3
impeller::RuntimeUniformType
RuntimeUniformType
Definition: runtime_types.h:24
impeller::kSampledImage
@ kSampledImage
Definition: runtime_types.h:26
impeller::kFloat
@ kFloat
Definition: runtime_types.h:25
impeller::kStruct
@ kStruct
Definition: runtime_types.h:27
impeller::RuntimeUniformDescription
Definition: runtime_types.h:41
impeller::RuntimeUniformDescription::dimensions
RuntimeUniformDimensions dimensions
Definition: runtime_types.h:47
impeller::RuntimeUniformDescription::location
size_t location
Definition: runtime_types.h:43
impeller::RuntimeUniformDescription::GetSize
size_t GetSize() const
Computes the total number of bytes that this uniform requires.
Definition: runtime_types.cc:9
impeller::RuntimeUniformDescription::struct_layout
std::vector< uint8_t > struct_layout
Definition: runtime_types.h:50
impeller::RuntimeUniformDescription::name
std::string name
Definition: runtime_types.h:42
impeller::RuntimeUniformDescription::type
RuntimeUniformType type
Definition: runtime_types.h:46
impeller::RuntimeUniformDescription::struct_float_count
size_t struct_float_count
Definition: runtime_types.h:51
impeller::RuntimeUniformDescription::array_elements
std::optional< size_t > array_elements
Definition: runtime_types.h:49
impeller::RuntimeUniformDescription::bit_width
size_t bit_width
Definition: runtime_types.h:48
impeller::RuntimeUniformDescription::binding
size_t binding
Location, but for Vulkan.
Definition: runtime_types.h:45
impeller::RuntimeUniformDimensions
Definition: runtime_types.h:36
impeller::RuntimeUniformDimensions::cols
size_t cols
Definition: runtime_types.h:38
impeller::RuntimeUniformDimensions::rows
size_t rows
Definition: runtime_types.h:37