webgpu/dawn/include/tint/array_length_from_uniform_options.h
1// Copyright 2021 The Tint Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef INCLUDE_TINT_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_
16#define INCLUDE_TINT_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_
17
18#include <unordered_map>
19
20#include "tint/binding_point.h"
21
22namespace tint {
23
24/// Options used to specify a mapping of binding points to indices into a UBO
25/// from which to load buffer sizes.
26struct ArrayLengthFromUniformOptions {
27 /// The binding point to use to generate a uniform buffer from which to read
28 /// buffer sizes.
29 BindingPoint ubo_binding;
30 /// The mapping from storage buffer binding points to the index into the
31 /// uniform buffer where the length of the buffer is stored.
32 std::unordered_map<BindingPoint, uint32_t> bindpoint_to_size_index;
33
34 /// Reflect the fields of this class so that it can be used by tint::ForeachField()
35 TINT_REFLECT(ubo_binding, bindpoint_to_size_index);
36};
37
38} // namespace tint
39
40#endif // INCLUDE_TINT_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_