#pragma once
#include <cassert>
#include <cctype>
#include <cstring>
#include <string>
#include <vector>
#include <bitset>
#include <shared_mutex>
#include <vulkan/utility/vk_format_utils.h>
#include <vulkan/utility/vk_concurrent_unordered_map.hpp>
#include "generated/vk_extension_helper.h"
#include "error_message/logging.h"
#ifndef WIN32
#include <strings.h>
#else
#include <intrin.h>
#endif
#define STRINGIFY(s) …
#define STRINGIFY_HELPER(s) …
#if defined __PRETTY_FUNCTION__
#define VVL_PRETTY_FUNCTION …
#else
#if defined(__FUNCSIG__)
#define VVL_PRETTY_FUNCTION …
#else
#define VVL_PRETTY_FUNCTION …
#endif
#endif
#define ASSERT_AND_RETURN(cond) …
#define ASSERT_AND_RETURN_SKIP(cond) …
#define ASSERT_AND_CONTINUE(cond) …
static inline VkExtent3D CastTo3D(const VkExtent2D &d2) { … }
static inline VkOffset3D CastTo3D(const VkOffset2D &d2) { … }
static const uint32_t kCommonMaxGraphicsShaderStages = …;
dispatch_key;
static inline dispatch_key GetDispatchKey(const void *object) { … }
VkLayerInstanceCreateInfo *GetChainInfo(const VkInstanceCreateInfo *pCreateInfo, VkLayerFunction func);
VkLayerDeviceCreateInfo *GetChainInfo(const VkDeviceCreateInfo *pCreateInfo, VkLayerFunction func);
template <typename T>
constexpr bool IsPowerOfTwo(T x) { … }
static inline int MostSignificantBit(uint32_t mask) { … }
static inline int u_ffs(int val) { … }
template <typename T>
constexpr T Align(T x, T p2) { … }
static inline int LeastSignificantBit(uint32_t mask) { … }
template <typename FlagBits, typename Flags>
FlagBits LeastSignificantFlag(Flags flags) { … }
template <typename FlagBits, typename Flags, typename Callback>
void IterateFlags(Flags flags, Callback callback) { … }
static inline uint32_t SampleCountSize(VkSampleCountFlagBits sample_count) { … }
static inline bool IsImageLayoutReadOnly(VkImageLayout layout) { … }
static inline bool IsImageLayoutDepthOnly(VkImageLayout layout) { … }
static inline bool IsImageLayoutDepthReadOnly(VkImageLayout layout) { … }
static inline bool IsImageLayoutStencilOnly(VkImageLayout layout) { … }
static inline bool IsImageLayoutStencilReadOnly(VkImageLayout layout) { … }
static inline bool IsIdentitySwizzle(VkComponentMapping components) { … }
static inline uint32_t GetIndexAlignment(VkIndexType indexType) { … }
static inline bool IsValidPlaneAspect(VkFormat format, VkImageAspectFlags aspect_mask) { … }
static inline bool IsOnlyOneValidPlaneAspect(VkFormat format, VkImageAspectFlags aspect_mask) { … }
static inline bool IsMultiplePlaneAspect(VkImageAspectFlags aspect_mask) { … }
static inline bool IsAnyPlaneAspect(VkImageAspectFlags aspect_mask) { … }
static const VkShaderStageFlags kShaderStageAllGraphics = …;
static const VkShaderStageFlags kShaderStageAllRayTracing = …;
static bool inline IsStageInPipelineBindPoint(VkShaderStageFlags stages, VkPipelineBindPoint bind_point) { … }
static inline bool IsAdvanceBlendOperation(const VkBlendOp blend_op) { … }
static inline bool IsSecondaryColorInputBlendFactor(VkBlendFactor blend_factor) { … }
static inline bool IsBetweenInclusive(VkDeviceSize value, VkDeviceSize min, VkDeviceSize max) { … }
static inline bool IsBetweenInclusive(const VkExtent2D &value, const VkExtent2D &min, const VkExtent2D &max) { … }
static inline bool IsBetweenInclusive(float value, float min, float max) { … }
static inline bool IsIntegerMultipleOf(VkDeviceSize value, VkDeviceSize granularity) { … }
static inline bool IsIntegerMultipleOf(const VkOffset2D &value, const VkOffset2D &granularity) { … }
static inline VkDeviceSize SafeModulo(VkDeviceSize dividend, VkDeviceSize divisor) { … }
static inline VkDeviceSize SafeDivision(VkDeviceSize dividend, VkDeviceSize divisor) { … }
inline std::optional<VkDeviceSize> ComputeValidSize(VkDeviceSize offset, VkDeviceSize size, VkDeviceSize whole_size) { … }
static inline uint32_t GetBitSetCount(uint32_t field) { … }
static inline uint32_t FullMipChainLevels(VkExtent3D extent) { … }
VkExtent3D GetEffectiveExtent(const VkImageCreateInfo &ci, const VkImageAspectFlags aspect_mask, const uint32_t mip_level);
constexpr uint64_t GetExternalFormat(const void *pNext) { … }
template <typename T, typename RANGE>
bool IsValueIn(const T &v, const RANGE &range) { … }
template <typename T>
bool IsValueIn(const T &v, const std::initializer_list<T> &list) { … }
#define VK_LAYER_API_VERSION …
VkStringErrorFlagBits;
VkStringErrorFlags;
void LayerDebugMessengerActions(DebugReport *debug_report, const char *layer_identifier);
std::string GetTempFilePath();
ReadLockGuard;
WriteLockGuard;
template <typename T, typename Guard>
class LockedSharedPtr : public std::shared_ptr<T> { … };
static constexpr VkPipelineStageFlags2KHR kFramebufferStagePipelineStageFlags = …;
static constexpr VkAccessFlags2 kShaderTileImageAllowedAccessFlags = …;
static constexpr bool HasNonFramebufferStagePipelineStageFlags(VkPipelineStageFlags2KHR inflags) { … }
static constexpr bool HasFramebufferStagePipelineStageFlags(VkPipelineStageFlags2KHR inflags) { … }
static constexpr bool HasNonShaderTileImageAccessFlags(VkAccessFlags2 in_flags) { … }
bool RangesIntersect(int64_t x, uint64_t x_size, int64_t y, uint64_t y_size);
namespace vvl {
static inline void ToLower(std::string &str) { … }
static inline void ToUpper(std::string &str) { … }
template <typename T>
const typename T::value_type *DataOrNull(const T &container) { … }
dependent_false_v;
template <typename T>
inline T atomic_fetch_max(std::atomic<T> ¤t_max, const T &value) noexcept { … }
}