/* 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 <variant> #include "state_tracker/device_memory_state.h" #include "state_tracker/image_layout_map.h" #include "utils/vk_layer_utils.h" namespace vvl { class Fence; class Semaphore; class Surface; class Swapchain; class VideoProfileDesc; } // namespace vvl class ValidationStateTracker; static inline bool operator==(const VkImageSubresource &lhs, const VkImageSubresource &rhs) { … } VkImageSubresourceRange NormalizeSubresourceRange(const VkImageCreateInfo &image_create_info, const VkImageSubresourceRange &range); VkImageSubresourceRange NormalizeSubresourceRange(const VkImageCreateInfo &image_create_info, const VkImageViewCreateInfo &view_create_info); // Transfer VkImageSubresourceRange into VkImageSubresourceLayers struct static inline VkImageSubresourceLayers LayersFromRange(const VkImageSubresourceRange &subresource_range) { … } // Transfer VkImageSubresourceLayers into VkImageSubresourceRange struct static inline VkImageSubresourceRange RangeFromLayers(const VkImageSubresourceLayers &subresource_layers) { … } namespace vvl { // State for VkImage objects. // Parent -> child relationships in the object usage tree: // 1. Normal images: // vvl::Image [1] -> [1] vvl::DeviceMemory // // 2. Sparse images: // vvl::Image [1] -> [N] vvl::DeviceMemory // // 3. VK_IMAGE_CREATE_ALIAS_BIT images: // vvl::Image [N] -> [1] vvl::DeviceMemory // All other images using the same device memory are in the aliasing_images set. // // 4. Swapchain images // vvl::Image [N] -> [1] vvl::Swapchain // All other images using the same swapchain and swapchain_image_index are in the aliasing_images set. // Note that the images for *every* image_index will show up as parents of the swapchain, // so swapchain_image_index values must be compared. // class Image : public Bindable { … }; // State for VkImageView objects. // Parent -> child relationships in the object usage tree: // ImageView [N] -> [1] vv::Image class ImageView : public StateObject { … }; struct SwapchainImage { … }; // State for VkSwapchainKHR objects. // Parent -> child relationships in the object usage tree: // vvl::Swapchain [N] -> [1] vvl::Surface // However, only 1 swapchain for each surface can be !retired. class Swapchain : public StateObject { … }; } // namespace vvl struct GpuQueue { … }; inline bool operator==(GpuQueue const &lhs, GpuQueue const &rhs) { … } namespace std { template <> struct hash<GpuQueue> { … }; } // namespace std class ValidationObject; namespace vvl { // Parent -> child relationships in the object usage tree: // vvl::Surface -> nothing class Surface : public StateObject { … }; } // namespace vvl