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 SRC_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_ 16 #define SRC_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_ 17 18 #include <unordered_map> 19 20 #include "src/sem/binding_point.h" 21 22 namespace tint { 23 namespace writer { 24 25 /// Options used to specify a mapping of binding points to indices into a UBO 26 /// from which to load buffer sizes. 27 struct ArrayLengthFromUniformOptions { 28 /// Constructor 29 ArrayLengthFromUniformOptions(); 30 /// Destructor 31 ~ArrayLengthFromUniformOptions(); 32 /// Copy constructor 33 ArrayLengthFromUniformOptions(const ArrayLengthFromUniformOptions&); 34 /// Copy assignment 35 /// @returns this ArrayLengthFromUniformOptions 36 ArrayLengthFromUniformOptions& operator=( 37 const ArrayLengthFromUniformOptions&); 38 /// Move constructor 39 ArrayLengthFromUniformOptions(ArrayLengthFromUniformOptions&&); 40 41 /// The binding point to use to generate a uniform buffer from which to read 42 /// buffer sizes. 43 sem::BindingPoint ubo_binding; 44 /// The mapping from storage buffer binding points to the index into the 45 /// uniform buffer where the length of the buffer is stored. 46 std::unordered_map<sem::BindingPoint, uint32_t> bindpoint_to_size_index; 47 48 // NOTE: Update fuzzers/data_builder.h when adding or changing any struct 49 // members. 50 }; 51 52 } // namespace writer 53 } // namespace tint 54 55 #endif // SRC_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_ 56