webgpu/dawn/include/tint/binding_remapper_options.h
1// Copyright 2023 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_BINDING_REMAPPER_OPTIONS_H_
16#define INCLUDE_TINT_BINDING_REMAPPER_OPTIONS_H_
17
18#include <unordered_map>
19
20#include "src/tint/lang/core/access.h"
21#include "tint/binding_point.h"
22
23namespace tint {
24
25/// Options used to specify mappings of binding points.
26struct BindingRemapperOptions {
27 /// BindingPoints is a map of old binding point to new binding point
28 using BindingPoints = std::unordered_map<BindingPoint, BindingPoint>;
29
30 /// AccessControls is a map of old binding point to new access control
31 using AccessControls = std::unordered_map<BindingPoint, core::Access>;
32
33 /// A map of old binding point to new binding point
34 BindingPoints binding_points;
35
36 /// A map of old binding point to new access controls
37 AccessControls access_controls;
38
39 /// If true, then validation will be disabled for binding point collisions
40 /// generated by this transform
41 bool allow_collisions = false;
42
43 /// Reflect the fields of this class so that it can be used by tint::ForeachField()
44 TINT_REFLECT(binding_points, access_controls, allow_collisions);
45};
46
47} // namespace tint
48
49#endif // INCLUDE_TINT_BINDING_REMAPPER_OPTIONS_H_