Git Product home page Git Product logo

vulkan-utility-libraries's Introduction

Vulkan-Utility-Libraries

This repo was created to share code across various Vulkan repositories, solving long standing issues for Vulkan SDK developers and users.

Historical Context

The Vulkan-ValidationLayers contained many libraries and utilities that were useful for other Vulkan repositories, and became the primary mechanism for code sharing in the Vulkan ecosystem.

This caused the Vulkan-ValidationLayers to have to maintain and export source code which was never intended for that purpose. This not only hindered development of the Vulkan-ValidationLayers, but would frequently break anyone depending on the source code due to the poorly located nature of it. On top of numerous other issues.

This repository was created to facilitate official source deliverables that can be reliably used by developers.

Vulkan::LayerSettings

The Vulkan::LayerSettings library was created to standardize layer configuration code for various SDK layer deliverables.

This is to ensure they all worked consistently with the 3 main methods of layer configuration.

For more information see layer_configuration.md.

Vulkan::UtilityHeaders

The Vulkan::UtilityHeaders library contains header only files that provide useful functionality to developers:

  • vk_dispatch_table.h: Initializing instance/device dispatch tables
  • vk_format_utils.h: Utilities for VkFormat
  • vk_struct_helper.hpp: Utilities for vulkan structs
  • vk_enum_string_helper.h: Converts Vulkan enums into strings

vulkan-utility-libraries's People

Contributors

aqnuep avatar bradgrantham-lunarg avatar charles-lunarg avatar christophe-lunarg avatar dependabot[bot] avatar jeremyg-lunarg avatar jrprice avatar juan-lunarg avatar khronoswebservices avatar kocdemir avatar mikes-lunarg avatar ncesario-lunarg avatar spencer-lunarg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vulkan-utility-libraries's Issues

Add 32 bit builds to CI

A recent issue was only present in 32 bit builds, which the CI for this repo lacks.

The primary 32 bit platform is Windows, so I recommend only adding 32 bit builds for that platform. Apple lacks it, and its very rare on linux. Not sure about Android, since I don't have a great grasp of the ecosystem there.

Remove Android.mk from the vulkan validation layers

In order to avoid adding another build system to the utility libraries, I've been working on completely removing the Android.mk build system from the validation layers.

This will make the work much simpler for the utility libraries moving forward.

The `vk_enum_string_helper.h` problem

Currently this file is shipped as it is for backwards compatibility to not break SDK users.

We should deprecate this file. Since it can't conform to coding standards, prefixing, etc.

It's also confusingly placed in the Vulkan include directory. Which causes confusion (KhronosGroup/Vulkan-Headers#414).

EX:

#include <vulkan/vk_enum_string_helper.h>

Also it has questionable functionality not everyone needs. The std::string functionality in particular.

For similar scenario see this vulkan headers issue: KhronosGroup/Vulkan-Headers#316

Obviously the functionality is still useful. But we should offer something akin to

#include <vulkan/utility/vk_enum_reflection.h>

and for C++ usage (If needed).

#include <vulkan/utility/vk_enum_reflection.hpp>

Add support for FetchContent and find_package

CC @gregjohnson2017

Disclaimer: I am not an expert on CMake usage.

TL;DR: Acquiring this library with FetchContent prevents Vulkan SDK from building.


I took the example from tests/add_subdirectory and modified it to use FetchContent instead of add_subdirectory. Running this works, but when you add a call to find_package, it fails:

CMake Error at CMakeLists.txt:34 (find_package):
  By not providing "FindVulkanUtilityLibraries.cmake" in CMAKE_MODULE_PATH
  this project has asked CMake to find a package configuration file provided
  by "VulkanUtilityLibraries", but CMake did not find one.

  Could not find a package configuration file provided by
  "VulkanUtilityLibraries" with any of the following names:

    VulkanUtilityLibrariesConfig.cmake
    vulkanutilitylibraries-config.cmake

  Add the installation prefix of "VulkanUtilityLibraries" to
  CMAKE_PREFIX_PATH or set "VulkanUtilityLibraries_DIR" to a directory
  containing one of the above files.  If "VulkanUtilityLibraries" provides a
  separate development package or SDK, be sure it has been installed.

This is important, because most projects, like the Vulkan SDK, will use find_package to locate this library. So, projects that use FetchContent for their Vulkan dependencies do not work.

I don't know how to solve this yet. I'm looking into this answer to figure out what may need to be done. Any help would be appreciated.


Command used to run sample: cmake -B build -G Ninja && cmake --build build
Modified CMakeLists.txt:

# Copyright 2023 The Khronos Group Inc. Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Modified by Tyler Kropp
cmake_minimum_required(VERSION 3.17)

project(TEST_ADD_SUBDIRECTORY LANGUAGES C)

add_library(add_subdirectory_example STATIC)

# Test c99 support
target_compile_features(add_subdirectory_example PRIVATE c_std_99)

target_sources(add_subdirectory_example
               PRIVATE client.c vk_enum_string_helper.c vul_dispatch_table.c)

include(FetchContent)

FetchContent_Declare(
  vulkan-headers
  GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Headers.git"
  GIT_TAG "2634c96" # latest as of writing
)

FetchContent_Declare(
  vulkan-utility
  GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git"
  GIT_TAG "87801a6" # latest as of writing
)

FetchContent_MakeAvailable(vulkan-headers vulkan-utility)

# Vulkan SDK uses find_package to look for this library
find_package(VulkanUtilityLibraries REQUIRED) # <<< this call fails

if(NOT TARGET Vulkan::LayerSettings)
  message(FATAL_ERROR "Vulkan::LayerSettings target not defined!")
endif()

if(NOT TARGET Vulkan::UtilityHeaders)
  message(FATAL_ERROR "Vulkan::UtilityHeaders target not defined!")
endif()

target_link_libraries(add_subdirectory_example PRIVATE Vulkan::LayerSettings
                                                       Vulkan::UtilityHeaders)

Undeclared Identifiers & duplicate case values

I'm getting a lot of undeclared identifier errors and duplicate case value errors when I try to use the headers (vk_enum_string_helper.h and utility/vk_format_utils.h) from Vulkan Utilities as opposed the system installed headers. Have I done something wrong here, or is there something else I need to include and/or configure? In this case I am compiling for Android.

vk_enum_string_helper.h

/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android33 -DLANCZOS_TYPE="" -I/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include -I/Users/rrauwend/test_project/C -I"/Program Files/RenderDoc" -I/Users/rrauwend/test_project/. -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++  -g  -fno-limit-debug-info -std=gnu++20 -MD -MT CMakeFiles/test_project32_debug_android.dir/src/main.cpp.o -MF CMakeFiles/test_project32_debug_android.dir/src/main.cpp.o.d -o CMakeFiles/test_project32_debug_android.dir/src/main.cpp.o -c /Users/rrauwend/test_project/src/main.cpp
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:81:14: error: use of undeclared identifier 'VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR'
        case VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:83:14: error: use of undeclared identifier 'VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR'
        case VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:85:14: error: use of undeclared identifier 'VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR'
        case VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:87:14: error: use of undeclared identifier 'VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR'
        case VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:89:14: error: use of undeclared identifier 'VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR'
        case VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:91:14: error: use of undeclared identifier 'VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR'
        case VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:107:14: error: use of undeclared identifier 'VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR'
        case VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:111:14: error: use of undeclared identifier 'VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT'
        case VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:593:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR'; did you mean 'VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR'?
        case VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:851:5: note: 'VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR' declared here
    VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR = 1000269001,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:595:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR'; did you mean 'VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR'?
        case VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:669:5: note: 'VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR' declared here
    VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:597:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR'; did you mean 'VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR'?
        case VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1166:5: note: 'VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR' declared here
    VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:599:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_SESSION_MEMORY_REQUIREMENTS_KHR'
        case VK_STRUCTURE_TYPE_VIDEO_SESSION_MEMORY_REQUIREMENTS_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:601:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_BIND_VIDEO_SESSION_MEMORY_INFO_KHR'
        case VK_STRUCTURE_TYPE_BIND_VIDEO_SESSION_MEMORY_INFO_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:603:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR'; did you mean 'VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR'?
        case VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:440:5: note: 'VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR' declared here
    VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:605:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR'; did you mean 'VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR'?
        case VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:712:5: note: 'VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR' declared here
    VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR = 1000150017,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:607:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_UPDATE_INFO_KHR'; did you mean 'VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR'?
        case VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_UPDATE_INFO_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:712:5: note: 'VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR' declared here
    VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR = 1000150017,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:609:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR'
        case VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:611:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR'; did you mean 'VK_STRUCTURE_TYPE_RENDERING_INFO_KHR'?
        case VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_STRUCTURE_TYPE_RENDERING_INFO_KHR
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1081:5: note: 'VK_STRUCTURE_TYPE_RENDERING_INFO_KHR' declared here
    VK_STRUCTURE_TYPE_RENDERING_INFO_KHR = VK_STRUCTURE_TYPE_RENDERING_INFO,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:2:
In file included from /Users/rrauwend/test_project/./util/vkUtil.h:13:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/vk_enum_string_helper.h:613:14: error: use of undeclared identifier 'VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR'
        case VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR:
             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
ninja: build stopped: subcommand failed.

vk_format_utils.h

/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android33 -DLANCZOS_TYPE="" -I/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include -I/Users/rrauwend/test_project/C -I"/Program Files/RenderDoc" -I/Users/rrauwend/test_project/. -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++  -g  -fno-limit-debug-info -std=gnu++20 -MD -MT CMakeFiles/test_project32_debug_android.dir/src/main.cpp.o -MF CMakeFiles/test_project32_debug_android.dir/src/main.cpp.o.d -o CMakeFiles/test_project32_debug_android.dir/src/main.cpp.o -c /Users/rrauwend/test_project/src/main.cpp
In file included from /Users/rrauwend/test_project/src/main.cpp:8:
In file included from /Users/rrauwend/test_project/./util/vkPrintPixelUtil.h:7:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:379:14: error: use of undeclared identifier 'VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR'; did you mean 'VK_FORMAT_A1R5G5B5_UNORM_PACK16'?
        case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR: {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_FORMAT_A1R5G5B5_UNORM_PACK16
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1404:5: note: 'VK_FORMAT_A1R5G5B5_UNORM_PACK16' declared here
    VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:8:
In file included from /Users/rrauwend/test_project/./util/vkPrintPixelUtil.h:7:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:382:14: error: use of undeclared identifier 'VK_FORMAT_A8_UNORM_KHR'; did you mean 'VK_FORMAT_R8_UNORM'?
        case VK_FORMAT_A8_UNORM_KHR: {
             ^~~~~~~~~~~~~~~~~~~~~~
             VK_FORMAT_R8_UNORM
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1405:5: note: 'VK_FORMAT_R8_UNORM' declared here
    VK_FORMAT_R8_UNORM = 9,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:8:
In file included from /Users/rrauwend/test_project/./util/vkPrintPixelUtil.h:7:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:379:14: error: duplicate case value 'VK_FORMAT_A1R5G5B5_UNORM_PACK16'
        case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR: {
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:376:14: note: previous case defined here
        case VK_FORMAT_A1R5G5B5_UNORM_PACK16: {
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:385:14: error: duplicate case value 'VK_FORMAT_R8_UNORM'
        case VK_FORMAT_R8_UNORM: {
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:382:14: note: previous case defined here
        case VK_FORMAT_A8_UNORM_KHR: {
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1415:14: error: use of undeclared identifier 'VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR'; did you mean 'VK_FORMAT_A1R5G5B5_UNORM_PACK16'?
        case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_FORMAT_A1R5G5B5_UNORM_PACK16
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1404:5: note: 'VK_FORMAT_A1R5G5B5_UNORM_PACK16' declared here
    VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:8:
In file included from /Users/rrauwend/test_project/./util/vkPrintPixelUtil.h:7:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1416:14: error: use of undeclared identifier 'VK_FORMAT_A8_UNORM_KHR'; did you mean 'VK_FORMAT_R8_UNORM'?
        case VK_FORMAT_A8_UNORM_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~
             VK_FORMAT_R8_UNORM
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1405:5: note: 'VK_FORMAT_R8_UNORM' declared here
    VK_FORMAT_R8_UNORM = 9,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:8:
In file included from /Users/rrauwend/test_project/./util/vkPrintPixelUtil.h:7:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1415:14: error: duplicate case value 'VK_FORMAT_A1R5G5B5_UNORM_PACK16'
        case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1414:14: note: previous case defined here
        case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1417:14: error: duplicate case value 'VK_FORMAT_R8_UNORM'
        case VK_FORMAT_R8_UNORM:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1416:14: note: previous case defined here
        case VK_FORMAT_A8_UNORM_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1800:14: error: use of undeclared identifier 'VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR'; did you mean 'VK_FORMAT_A1R5G5B5_UNORM_PACK16'?
        case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             VK_FORMAT_A1R5G5B5_UNORM_PACK16
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1404:5: note: 'VK_FORMAT_A1R5G5B5_UNORM_PACK16' declared here
    VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:8:
In file included from /Users/rrauwend/test_project/./util/vkPrintPixelUtil.h:7:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1800:14: error: duplicate case value 'VK_FORMAT_A1R5G5B5_UNORM_PACK16'
        case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:1799:14: note: previous case defined here
        case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:2069:14: error: use of undeclared identifier 'VK_FORMAT_A8_UNORM_KHR'; did you mean 'VK_FORMAT_R8_UNORM'?
        case VK_FORMAT_A8_UNORM_KHR:
             ^~~~~~~~~~~~~~~~~~~~~~
             VK_FORMAT_R8_UNORM
/Users/rrauwend/Library/Android/sdk/ndk/26.1.10909125//toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/vulkan/vulkan_core.h:1405:5: note: 'VK_FORMAT_R8_UNORM' declared here
    VK_FORMAT_R8_UNORM = 9,
    ^
In file included from /Users/rrauwend/test_project/src/main.cpp:8:
In file included from /Users/rrauwend/test_project/./util/vkPrintPixelUtil.h:7:
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:2070:14: error: duplicate case value 'VK_FORMAT_R8_UNORM'
        case VK_FORMAT_R8_UNORM:
             ^
/Users/rrauwend/test_project/./util/ext/Vulkan-Utility-Libraries/include/vulkan/utility/vk_format_utils.h:2069:14: note: previous case defined here
        case VK_FORMAT_A8_UNORM_KHR:
             ^
12 errors generated.
ninja: build stopped: subcommand failed.

Remove `BUILD_LAYER_SUPPORT_FILES` from the vulkan validation layers

The ultimate goal of this repo is that the validation layers will no longer need to install header/source files anymore.

The vulkan validation layer repo was never meant for shipping header / source files.

It's only deliverables are a shared library, and a json file. All other files are unintended artifacts resulting from the days everything was in a mono repo.

Instead of the validation layers facilitating code sharing across vulkan repos, it will now be the responsibility of the utility libraries.

This is better for all parties since validation layers developers won't have to worry about unintentionally breaking downstream users. And users get proper source deliverables.

lvt_function_pointers & vk_function_pointers

environment variable to save configured settings in a file

Some application vendors configure the validation layer programmatically (i.e. via switches like -vulkan_enable_validation -vulkan_enable_sync_validation etc.).

For local analysis, it would be very helpful to know exactly how the validation layer is actually being configured in these cases.

Defining an environment variable VK_VALIDATION_SAVE_SETTINGS=/path/to/file/to/save/settings that caused VVL to write a settings file to the given location would make it easy.

vk_enum_string_helper.h

Currently this header file is generated in the vulkan validation layers. The code generation will be moved here instead.

Recent GetObjectType additions don't compile on x86

@charles-lunarg @mikes-lunarg

Looks like one of the GetObjectType commits on Oct 4 introduced this. Some of our builds are ok, but multiple builds are failing.

https://ci.chromium.org/ui/p/angle/builders/try/win-x86-test/15700/overview
https://logs.chromium.org/logs/angle/buildbucket/cr-buildbucket/8768076008413092417/+/u/compile/stdout

../../third_party/vulkan-deps/vulkan-utility-libraries/src/include\vulkan/utility/vk_struct_helper.hpp(1179,32): error: redefinition of 'GetObjectType<unsigned long long>'
 1179 | template<> inline VkObjectType GetObjectType<VkImage>() { return VK_OBJECT_TYPE_IMAGE; }
      |                                ^
../../third_party/vulkan-deps/vulkan-utility-libraries/src/include\vulkan/utility/vk_struct_helper.hpp(1178,32): note: previous definition is here
 1178 | template<> inline VkObjectType GetObjectType<VkBuffer>() { return VK_OBJECT_TYPE_BUFFER; }

(and other errors)

Project description missing

Since KhronosGroup/Vulkan-ValidationLayers@3348709 which is included in v1.3.263 this is a requirement to build Vulkan-ValidationLayers now, however essential parts are missing, no tag, no proper description in README.md or Project "About". It would have been really nice to have had these things addressed before tagging a new version depending on it.

Remove VVL as a dependency of LunarG/VulkanTools

Currently VulkanTools consumes VVL as a dependency:

        {
            "name": "Vulkan-ValidationLayers",
            "url": "https://github.com/KhronosGroup/Vulkan-ValidationLayers.git",
            "sub_dir": "Vulkan-ValidationLayers",
            "build_dir": "Vulkan-ValidationLayers/build",
            "install_dir": "Vulkan-ValidationLayers/build/install",
            "commit": "e6bdb8d71409a96a4174589ea195d0dc1e920625",
            "deps": [
                {
                    "var_name": "VULKAN_HEADERS_INSTALL_DIR",
                    "repo_name": "Vulkan-Headers"
                },
                {
                    "var_name": "VULKAN_LOADER_INSTALL_DIR",
                    "repo_name": "Vulkan-Loader"
                }
            ],
            "cmake_options": [
                "-DBUILD_LAYERS=OFF",
                "-DBUILD_LAYER_SUPPORT_FILES=ON",
                "-DUSE_ROBIN_HOOD_HASHING=OFF"
            ]
        },

Vulkan SDK Installation

We need to be a lot more careful of how we deliver things for the Vulkan SDK.

Currently only vk_enum_string_helper.h and vk_format_utils.h should be shipped for now.

Add Android testing

Because the testing in this repo doesn't require an APK. We can test the executable directly 🎉 without a bunch of hassle.

Don't install .clang-format

Under no circumstances should .clang-format be installed.

install
    ├───include
    │   └───vulkan
    │       │   vk_enum_string_helper.h
    │       │
    │       ├───layer
    │       │       vk_layer_settings.h
    │       │       vk_layer_settings.hpp
    │       │       vk_layer_settings_ext.h
    │       │
    │       └───utility
    │               .clang-format
    │               vk_dispatch_table.h
    │               vk_format_utils.h
    │               vk_struct_helper.hpp
    │
    └───lib
        │   VulkanLayerSettings.lib
        │
        └───cmake
            └───VulkanUtilityLibraries
                    VulkanUtilityLibrariesConfig-relwithdebinfo.cmake
                    VulkanUtilityLibrariesConfig.cmake

UtilityLibraries accidentally exported stricter warnings

VulkanUtilityLibrariesConfig.cmake contains the following now.

# Create imported target Vulkan::LayerSettings
add_library(Vulkan::LayerSettings STATIC IMPORTED)

set_target_properties(Vulkan::LayerSettings PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS;NOMINMAX;WIN32_LEAN_AND_MEAN"
  INTERFACE_COMPILE_OPTIONS "/W4;/we5038;/permissive-;\$<\$<BOOL:0>:/MP>"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "Vulkan::Headers"
)

# Create imported target Vulkan::UtilityHeaders
add_library(Vulkan::UtilityHeaders INTERFACE IMPORTED)

set_target_properties(Vulkan::UtilityHeaders PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS;NOMINMAX;WIN32_LEAN_AND_MEAN"
  INTERFACE_COMPILE_OPTIONS "/W4;/we5038;/permissive-;\$<\$<BOOL:0>:/MP>"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "Vulkan::Headers"
)

This was added in a3235b3 by @christophe-lunarg.

FYI @charles-lunarg

Minimize CMake flags developer has to set

Instead of -D VUL_WERROR=ON -D BUILD_TESTS=ON -D UPDATE_DEPS=ON etc.

Have 1 build option that sets it all up.

-D VLK_DEV=ON

IE the intent is to streamline the workflow for developers.

Add .gitattributes

PS D:\projects\vul> git diff
warning: in the working copy of 'include/vulkan/utility/vk_dispatch_table.h', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'include/vulkan/utility/vk_format_utils.h', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'include/vulkan/vk_enum_string_helper.h', LF will be replaced by CRLF the next time Git touches it

See how VVL currently deals with this:
https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/1b0a375df5f724b870868d678b7ac4bf71344ed0/.gitattributes#L17

Run clang-tidy on header files that we ship

Due to CMake's built in clang-tidy functionality only working on Ninja / Makefile generators using the built in functionality is problematic.

However, it's still straightforward to make sure that at the least the files we are installing follow proper conventions and coding guidelines.

IE the header files we ship will be consistent in quality. With the exception of vk_enum_string_helper.h due to legacy reasons.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.