blob: 2c06287c23fdfffe03eb2e7141adbd776eecf17e [file] [log] [blame]
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SRC_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_
#define SRC_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_
#include <unordered_map>
#include "src/sem/binding_point.h"
namespace tint {
namespace writer {
/// Options used to specify a mapping of binding points to indices into a UBO
/// from which to load buffer sizes.
struct ArrayLengthFromUniformOptions {
/// Constructor
ArrayLengthFromUniformOptions();
/// Destructor
~ArrayLengthFromUniformOptions();
/// Copy constructor
ArrayLengthFromUniformOptions(const ArrayLengthFromUniformOptions&);
/// Copy assignment
/// @returns this ArrayLengthFromUniformOptions
ArrayLengthFromUniformOptions& operator=(
const ArrayLengthFromUniformOptions&);
/// Move constructor
ArrayLengthFromUniformOptions(ArrayLengthFromUniformOptions&&);
/// The binding point to use to generate a uniform buffer from which to read
/// buffer sizes.
sem::BindingPoint ubo_binding;
/// The mapping from storage buffer binding points to the index into the
/// uniform buffer where the length of the buffer is stored.
std::unordered_map<sem::BindingPoint, uint32_t> bindpoint_to_size_index;
// NOTE: Update fuzzers/data_builder.h when adding or changing any struct
// members.
};
} // namespace writer
} // namespace tint
#endif // SRC_WRITER_ARRAY_LENGTH_FROM_UNIFORM_OPTIONS_H_