/* Copyright (c) 2021-2024 The Khronos Group Inc. * Copyright (c) 2021-2024 Valve Corporation * Copyright (c) 2021-2024 LunarG, Inc. * Copyright (C) 2021-2022 Google Inc. * * 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. */ #pragma once #include <cstdint> #include <string> #include "generated/error_location_helper.h" #include "logging.h" #include "containers/custom_containers.h" #include "chassis/chassis_handle_data.h" // Holds the 'Location' of where the code is inside a function/struct/etc // see docs/error_object.md for more details struct Location { … }; // Contains the base information needed for errors to be logged out // Created for each function as a starting point to build off of struct ErrorObject { … }; namespace vvl { template <typename VuidFunctor> struct LocationVuidAdapter { … }; struct LocationCapture { … }; // Key for use in tables of VUIDs. // // Fuzzy match rules: // key.function OR key.structure may be Empty // loc.structure may be Empty // key.field may be Empty // if key.recurse_field is true, key.field can match loc.field or any fields in loc.prev // struct Key { … }; bool operator<(const Key& lhs, const Key& rhs); bool operator==(const Key& key, const Location& loc); // Entry in a VUID lookup table struct Entry { … }; // look for a matching VUID in a vector or array-ish table template <typename Table> static const std::string& FindVUID(const Location& loc, const Table& table) { … } // 2-level look up where the outer container is a map where we need to find // different VUIDs for different values of an enum or bitfield template <typename OuterKey, typename Table> static const std::string& FindVUID(OuterKey key, const Location& loc, const Table& table) { … } } // namespace vvl