chromium/third_party/vulkan-validation-layers/src/layers/state_tracker/state_tracker.h

/* Copyright (c) 2015-2024 The Khronos Group Inc.
 * Copyright (c) 2015-2024 Valve Corporation
 * Copyright (c) 2015-2024 LunarG, Inc.
 * Copyright (C) 2015-2024 Google Inc.
 * Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
 * Modifications Copyright (C) 2022 RasterGrid Kft.
 *
 * 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 "generated/chassis.h"
#include "utils/hash_vk_types.h"
#include "state_tracker/video_session_state.h"
#include "generated/layer_chassis_dispatch.h"
#include "generated/device_features.h"
#include "error_message/logging.h"
#include "containers/custom_containers.h"
#include "utils/android_ndk_types.h"
#include "containers/range_vector.h"
#include <vulkan/utility/vk_struct_helper.hpp>
#include <atomic>
#include <functional>
#include <memory>
#include <vector>

namespace vvl {
struct AllocateDescriptorSetsData;
class Fence;
class DescriptorPool;
class DescriptorSet;
class DescriptorSetLayout;
class DescriptorUpdateTemplate;
class Queue;
class Semaphore;
class Buffer;
class BufferView;
class Sampler;
class SamplerYcbcrConversion;
class Framebuffer;
class RenderPass;
class PipelineCache;
class Surface;
class PhysicalDevice;
class DisplayMode;
class Event;
class PipelineLayout;
class Image;
class ImageView;
class Swapchain;
struct SwapchainImage;
class CommandPool;
class CommandBuffer;
class Pipeline;
class DeviceMemory;
class AccelerationStructureNV;
class AccelerationStructureKHR;
class QueryPool;
struct DedicatedBinding;
struct ShaderModule;
struct ShaderObject;
}  // namespace vvl

namespace chassis {
struct CreateShaderModule;
}  // namespace chassis

namespace spirv {
struct StatelessData;
}  // namespace spirv

#define VALSTATETRACK_MAP_AND_TRAITS_IMPL(handle_type, state_type, map_member, instance_scope)

#define VALSTATETRACK_MAP_AND_TRAITS(handle_type, state_type, map_member)
#define VALSTATETRACK_MAP_AND_TRAITS_INSTANCE_SCOPE(handle_type, state_type, map_member)

namespace state_object {
// Traits for State function resolution.  Specializations defined in the macros below.
template <typename StateType>
struct Traits {};

// Helper object to make the macros simpler
// HandleType_ is a vulkan handle type
// StateType_ is the type of the corresponding state object, which may be a derived type
// BaseType_ is the type of object stored in the ValidationStateTracker, there
//            *must* be a corresponding map using this type
template <typename HandleType_, typename StateType_, typename BaseType_ = StateType_>
struct TraitsBase {};
}  // namespace state_object

#define VALSTATETRACK_STATE_OBJECT(handle_type, state_type)

#define VALSTATETRACK_DERIVED_STATE_OBJECT(handle_type, state_type, base_type)

// For image copies between compressed/uncompressed formats, the extent is provided in source image texels
// Destination image texel extents must be adjusted by block size for the dest validation checks
static inline VkExtent3D GetAdjustedDestImageExtent(VkFormat src_format, VkFormat dst_format, VkExtent3D extent) {}

// Get buffer size from VkBufferImageCopy / VkBufferImageCopy2KHR structure, for a given format
template <typename RegionType>
static inline VkDeviceSize GetBufferSizeFromCopyImage(const RegionType& region, VkFormat image_format,
                                                      uint32_t image_layout_count) {}

VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()
VALSTATETRACK_STATE_OBJECT()

class ValidationStateTracker : public ValidationObject {};