Flutter Impeller
runtime_types.cc
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 
6 
7 namespace impeller {
8 
10  size_t size = 0;
11  if (!padding_layout.empty()) {
13  if (byte_type == RuntimePaddingType::kFloat) {
14  size += sizeof(float);
15  }
16  }
17  } else {
18  size = dimensions.rows * dimensions.cols * bit_width / 8u;
19  }
20  if (array_elements.value_or(0) > 0) {
21  // Covered by check on the line above.
22  // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
23  size *= array_elements.value();
24  }
25  return size;
26 }
27 
29  size_t size = 0;
30  if (padding_layout.empty()) {
31  size = dimensions.rows * dimensions.cols * bit_width / 8u;
32  } else {
33  size = sizeof(float) * padding_layout.size();
34  }
35  if (array_elements.value_or(0) > 0) {
36  // Covered by check on the line above.
37  // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
38  size *= array_elements.value();
39  }
40  return size;
41 }
42 
43 } // namespace impeller
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< RuntimePaddingType > padding_layout
Definition: runtime_types.h:61
std::optional< size_t > array_elements
Definition: runtime_types.h:60