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