diff --git a/.gitattributes b/.gitattributes index acfc1e831..725e7ce8c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,3 +20,6 @@ loader/generated/*.c text eol=lf loader/generated/*.h text eol=lf loader/generated/*.cmake text eol=lf +loader/generated-vksc/*.c text eol=lf +loader/generated-vksc/*.h text eol=lf +loader/generated-vksc/*.cmake text eol=lf diff --git a/.github/workflows/build_sc.yml b/.github/workflows/build_sc.yml new file mode 100644 index 000000000..774942ac8 --- /dev/null +++ b/.github/workflows/build_sc.yml @@ -0,0 +1,479 @@ +# Copyright (c) 2021-2023 Valve Corporation +# Copyright (c) 2021-2023 LunarG, Inc. +# Copyright (c) 2023-2023 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. + +name: CI Build - Vulkan SC + +# https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + # github.head_ref is only defined on pull_request + # Fallback to the run ID, which is guaranteed to be both unique and defined for the run. + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + push: + pull_request: + branches: + - sc_main + +permissions: read-all + +jobs: + linux: + runs-on: ${{matrix.os}} + + strategy: + matrix: + cc: [ gcc, clang ] + cxx: [ g++, clang++ ] + config: [ Debug, Release ] + os: [ ubuntu-20.04, ubuntu-22.04 ] + exclude: + - cc: gcc + cxx: clang++ + - cc: clang + cxx: g++ + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.17.2 + - run: sudo apt update + - name: Install Dependencies + run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev + + - name: Generate build files + run: cmake -S. -B build -D CMAKE_BUILD_TYPE=${{matrix.config}} -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D LOADER_ENABLE_ADDRESS_SANITIZER=ON -D ENABLE_WERROR=ON -D VULKANSC=ON + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + + - name: Build the loader + run: cmake --build build + + - name: Install the loader + run: cmake --install build --prefix build/install + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure + + - name: Verify generated source files + run: python scripts/generate_source.py --verify external/${{matrix.config}}/Vulkan-Headers/registry --api vulkansc + + - name: Verify code formatting with clang-format + run: ./scripts/check_code_format.sh + + - name: Verify commit message formatting + run: ./scripts/check_commit_message_format.sh + + linux-no-asm: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.17.2 + - run: sudo apt update + - name: Install Dependencies + run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev + + - name: Generate build files + run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D USE_GAS=OFF -D VULKANSC=ON + env: + CC: clang + CXX: clang++ + + - name: Build the loader + run: cmake --build build + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure -E UnknownFunction + + linux-32: + runs-on: ${{matrix.os}} + + strategy: + matrix: + cc: [ gcc, clang ] + cxx: [ g++, clang++ ] + config: [ Debug, Release ] + os: [ ubuntu-20.04, ubuntu-22.04 ] + exclude: + - cc: gcc + cxx: clang++ + - cc: clang + cxx: g++ + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.17.2 + + - name: Enable 32 bit + run: |- + sudo dpkg --add-architecture i386 + - name: Update packages + run: |- + sudo apt-get update + - name: Install Dependencies + run: |- + sudo apt install --yes --no-install-recommends gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 libwayland-dev:i386 libxrandr-dev:i386 + + - name: Generate build files + run: cmake -S. -B build -D CMAKE_BUILD_TYPE=${{matrix.config}} -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D SYSCONFDIR=/etc/not_vulkan -D VULKANSC=ON + env: + CFLAGS: -m32 + CXXFLAGS: -m32 + LDFLAGS: -m32 + ASFLAGS: --32 + + - name: Build the loader + run: cmake --build build + + - name: Install the loader + run: cmake --install build --prefix build/install + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure + + linux-32-no-asm: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.17.2 + + - name: Enable 32 bit + run: |- + sudo dpkg --add-architecture i386 + - name: Update packages + run: |- + sudo apt-get update + - name: Install Dependencies + run: |- + sudo apt install --yes --no-install-recommends gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 libwayland-dev:i386 libxrandr-dev:i386 + + - name: Generate build files + run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D USE_GAS=OFF -D VULKANSC=ON + env: + CFLAGS: -m32 + CXXFLAGS: -m32 + LDFLAGS: -m32 + ASFLAGS: --32 + + - name: Build the loader + run: cmake --build build + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure -E UnknownFunction + + windows_vs: + runs-on: windows-latest + strategy: + matrix: + arch: [ Win32, x64 ] + config: [ Debug, Release ] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + + - name: Generate build files + run: cmake -S. -B build -DBUILD_TESTS=ON -DUPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=${{matrix.config}} -A ${{ matrix.arch }} -D ENABLE_WERROR=ON -D VULKANSC=ON + + - name: Build the loader + run: cmake --build ./build --config ${{matrix.config}} + + - name: Install the loader + run: cmake --install build --prefix build/install --config ${{matrix.config}} + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure -C ${{matrix.config}} + + windows_vs-no-asm: + runs-on: windows-latest + strategy: + matrix: + arch: [ Win32, x64 ] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + + - name: Generate build files + run: cmake -S. -B build -DBUILD_TESTS=ON -DUPDATE_DEPS=ON -D USE_MASM=OFF -D CMAKE_BUILD_TYPE=Release -A ${{ matrix.arch }} -D ENABLE_WERROR=ON -D VULKANSC=ON + + - name: Build the loader + run: cmake --build ./build --config Release + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure -C Release -E UnknownFunction + + # Something about Github Actions + Windows + Ninja + Unicode doesn't play nicely together. + # https://github.com/KhronosGroup/Vulkan-Loader/pull/1188#issuecomment-1536659318 + # + # Disable testing explicitly for Ninja. But still ensure it builds properly. + windows_ninja: + runs-on: windows-2019 + strategy: + matrix: + arch: [ Win32, x64 ] + config: [ Debug, Release ] + exclude: + - arch: Win32 + config: release + - arch: x64 + config: debug + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: Configure + run: cmake -S. -B build -DUPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=${{matrix.config}} -G "Ninja" -D ENABLE_WERROR=ON -D LOADER_USE_UNSAFE_FILE_SEARCH=ON -D VULKANSC=ON + + - name: Build + run: cmake --build ./build + + - name: Install the loader + run: cmake --install build --prefix build/install + + # Make sure clang-cl builds still succeed - used by the chromium project + windows_clang_cl: + runs-on: windows-2022 + strategy: + matrix: + arch: [ x64 ] + config: [ Release ] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: Configure + run: cmake -S. -B build -D UPDATE_DEPS=ON -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=${{matrix.config}} -T "ClangCL" -D ENABLE_WERROR=ON -D VULKANSC=ON + + - name: Build + run: cmake --build ./build --config ${{matrix.config}} + + - name: Install the loader + run: cmake --install build --prefix build/install --config ${{matrix.config}} + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure -C ${{matrix.config}} + + mac: + runs-on: ${{matrix.os}} + + strategy: + matrix: + config: [ Debug, Release ] + os: [ macos-11, macos-latest ] + static_build: [ BUILD_STATIC_LOADER=ON, BUILD_STATIC_LOADER=OFF ] + exclude: + - os: macos-latest + static_build: BUILD_STATIC_LOADER=ON + - config: Debug + os: macos-11 + static_build: BUILD_STATIC_LOADER=ON + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + - name: Generate build files + run: cmake -S. -B build -D CMAKE_BUILD_TYPE=${{matrix.config}} -D ${{matrix.static_build}} -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D LOADER_ENABLE_ADDRESS_SANITIZER=ON -G "Ninja" -D VULKANSC=ON + env: + # Specify the minimum version of macOS on which the target binaries are to be deployed. + # https://cmake.org/cmake/help/latest/envvar/MACOSX_DEPLOYMENT_TARGET.html + MACOSX_DEPLOYMENT_TARGET: 10.12 + + - name: Build the loader + run: cmake --build build + + - name: Install the loader + run: cmake --install build --prefix build/install + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure + + mac-no-asm: + runs-on: macos-latest + + strategy: + matrix: + static_build: [ BUILD_STATIC_LOADER=ON, BUILD_STATIC_LOADER=OFF ] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + - name: Generate build files + run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D ${{matrix.static_build}} -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D USE_GAS=OFF -G "Ninja" -D VULKANSC=ON + env: + # Specify the minimum version of macOS on which the target binaries are to be deployed. + # https://cmake.org/cmake/help/latest/envvar/MACOSX_DEPLOYMENT_TARGET.html + MACOSX_DEPLOYMENT_TARGET: 10.12 + + - name: Build the loader + run: cmake --build build + + - name: Run regression tests + working-directory: ./build + run: ctest --output-on-failure -E UnknownFunction + + + mingw: + runs-on: windows-2022 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: mingw-ccache + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - uses: lukka/get-cmake@latest + - name: GCC Version + run: gcc --version # If this fails MINGW is not setup correctly + - name: Setup uasm + run: | + C:/msys64/usr/bin/pacman -Sy --noconfirm --needed mingw-w64-x86_64-uasm + printf '%s\n' 'C:/msys64/mingw64/bin' >> $GITHUB_PATH + - name: UASM Check + run: uasm -? + - name: Configure + run: cmake -S. -B build -D UPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=Release + env: + LDFLAGS: -fuse-ld=lld # MINGW linking is very slow. Use llvm linker instead. + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache + CMAKE_GENERATOR: Ninja + - name: Build + run: cmake --build build -- --quiet + - name: Install + run: cmake --install build --prefix build/install + - name: MinGW ccache stats # The Post Setup ccache doesn't work right on MinGW + run: ccache --show-stats + + mingw-no-asm: + runs-on: windows-2022 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: mingw-ccache + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - uses: lukka/get-cmake@latest + - name: GCC Version + run: gcc --version # If this fails MINGW is not setup correctly + - name: Configure + # Make sure this doesn't fail even without -D USE_MASM=OFF and without uasm + run: cmake -S. -B build -D UPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=Release + env: + LDFLAGS: -fuse-ld=lld # MINGW linking is very slow. Use llvm linker instead. + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache + CMAKE_GENERATOR: Ninja + - name: Build + run: cmake --build build -- --quiet + - name: Install + run: cmake --install build --prefix build/install + - name: MinGW ccache stats # The Post Setup ccache doesn't work right on MinGW + run: ccache --show-stats + + mingw-no-asm-explicit: + runs-on: windows-2022 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: mingw-ccache + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - uses: lukka/get-cmake@latest + - name: GCC Version + run: gcc --version # If this fails MINGW is not setup correctly + - name: Configure + run: cmake -S. -B build -D UPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=Release -D ENABLE_WERROR=ON -D USE_MASM=OFF + env: + LDFLAGS: -fuse-ld=lld # MINGW linking is very slow. Use llvm linker instead. + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache + CMAKE_GENERATOR: Ninja + - name: Build + run: cmake --build build -- --quiet + - name: Install + run: cmake --install build --prefix build/install + - name: MinGW ccache stats # The Post Setup ccache doesn't work right on MinGW + run: ccache --show-stats diff --git a/BUILD.md b/BUILD.md index 1c2f0c920..de0609cea 100644 --- a/BUILD.md +++ b/BUILD.md @@ -51,6 +51,7 @@ Instructions for building this repository on Linux, Windows, and MacOS. - [Building on Fuchsia](#building-on-fuchsia) - [SDK Symbols](#sdk-symbols) - [Building on QNX](#building-on-qnx) + - [Building Vulkan SC Loader](#building-vulkan-sc-loader) - [Cross Compilation](#cross-compilation) - [Unknown function handling which requires explicit assembly implementations](#unknown-function-handling-which-requires-explicit-assembly-implementations) - [Platforms which fully support unknown function handling](#platforms-which-fully-support-unknown-function-handling) @@ -116,6 +117,10 @@ This repository has a required dependency on the [Vulkan Headers repository](htt The Vulkan-Headers repository contains the Vulkan API definition files that are required to build the loader. +For Vulkan SC, the `sc_main` branch or an appropriately tagged Vulkan SC version +(e.g., `vksc1.0.13`) of the [Vulkan SC Headers repository](https://github.com/KhronosGroup/VulkanSC-Headers) +repository must be checked out. + #### Test Dependencies The loader tests depend on the [Google Test](https://github.com/google/googletest) library and @@ -143,12 +148,12 @@ to checkout dependent repository revisions that are known to be compatible with the revision of this repository that you currently have checked out. You can choose to do this automatically or manually. -The first step to either is cloning the Vulkan-Loader repo and stepping into +The first step to either is cloning the VulkanSC-Loader repo and stepping into that newly cloned folder: ``` - git clone git@github.com:KhronosGroup/Vulkan-Loader.git - cd Vulkan-Loader + git clone git@github.com:KhronosGroup/VulkanSC-Loader.git + cd VulkanSC-Loader ``` #### Automatically @@ -215,6 +220,9 @@ cmake -S . -B build -D LOADER_CODEGEN=ON cmake --build . --target loader_codegen ``` +To generate source code for Vulkan SC the `--api vulkansc` option must be +passed to the `generate_source.py` command. + ### Build Options When generating build files through CMake, several options can be specified to @@ -223,12 +231,14 @@ The following is a table of all on/off options currently supported by this repos | Option | Platform | Default | Description | | ------------------------------- | ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| VULKANSC | All | `OFF` | Controls whether the loader is built for Vulkan (`OFF`, the default), or for Vulkan SC (`ON`). | | BUILD_TESTS | All | `OFF` | Controls whether or not the loader tests are built. | | BUILD_WSI_XCB_SUPPORT | Linux | `ON` | Build the loader with the XCB entry points enabled. Without this, the XCB headers should not be needed, but the extension `VK_KHR_xcb_surface` won't be available. | | BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the loader with the Xlib entry points enabled. Without this, the X11 headers should not be needed, but the extension `VK_KHR_xlib_surface` won't be available. | | BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the loader with the Wayland entry points enabled. Without this, the Wayland headers should not be needed, but the extension `VK_KHR_wayland_surface` won't be available. | | BUILD_WSI_DIRECTFB_SUPPORT | Linux | `OFF` | Build the loader with the DirectFB entry points enabled. Without this, the DirectFB headers should not be needed, but the extension `VK_EXT_directfb_surface` won't be available. | | BUILD_WSI_SCREEN_QNX_SUPPORT | QNX | `OFF` | Build the loader with the QNX Screen entry points enabled. Without this the extension `VK_QNX_screen_surface` won't be available. | +| BUILD_WSI_SCI_SUPPORT | Linux, QNX | `OFF` | Vulkan SC only. Build the loader with the SCI entry points enabled. | | ENABLE_WIN10_ONECORE | Windows | `OFF` | Link the loader to the [OneCore](https://msdn.microsoft.com/en-us/library/windows/desktop/mt654039.aspx) umbrella library, instead of the standard Win32 ones. | | USE_GAS | Linux | `ON` | Controls whether to build assembly files with the GNU assembler, else fallback to C code. | | USE_MASM | Windows | `ON` | Controls whether to build assembly files with MS assembler, else fallback to C code | @@ -282,7 +292,7 @@ work with the solution interactively. Open a developer command prompt and enter: - cd Vulkan-Loader + cd VulkanSC-Loader mkdir build cd build cmake -A x64 -D UPDATE_DEPS=ON .. @@ -298,7 +308,7 @@ configuration of the solution. Change your current directory to the top of the cloned repository directory, create a build directory and generate the Visual Studio project files: - cd Vulkan-Loader + cd VulkanSC-Loader mkdir build cd build cmake -D UPDATE_DEPS=ON -G "Visual Studio 16 2019" -A x64 .. @@ -323,7 +333,7 @@ install directory must be provided. This can be done automatically by the either case, the variable should point to the installation directory of a Vulkan-Headers repository built with the install target. -The above steps create a Windows solution file named `Vulkan-Loader.sln` in +The above steps create a Windows solution file named `VulkanSC-Loader.sln` in the build directory. At this point, you can build the solution from the command line or open the @@ -343,7 +353,7 @@ to make a Release build. #### Build the Solution With Visual Studio -Launch Visual Studio and open the "Vulkan-Loader.sln" solution file in the +Launch Visual Studio and open the "VulkanSC-Loader.sln" solution file in the build folder. You may select "Debug" or "Release" from the Solution Configurations drop-down list. Start a build by selecting the Build->Build Solution menu item. @@ -387,7 +397,7 @@ CMake with the `--build` option or `make` to build from the command line. #### Linux Quick Start - cd Vulkan-Loader + cd VulkanSC-Loader mkdir build cd build cmake -D UPDATE_DEPS=ON .. @@ -400,7 +410,7 @@ See below for the details. Change your current directory to the top of the cloned repository directory, create a build directory and generate the make files. - cd Vulkan-Loader + cd VulkanSC-Loader mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Debug \ @@ -550,9 +560,9 @@ Setup Homebrew and components ### Clone the Repository -Clone the Vulkan-Loader repository: +Clone the VulkanSC-Loader repository: - git clone https://github.com/KhronosGroup/Vulkan-Loader.git + git clone https://github.com/KhronosGroup/VulkanSC-Loader.git ### MacOS build @@ -587,7 +597,7 @@ To create and open an Xcode project: mkdir build-xcode cd build-xcode cmake -GXcode .. - open Vulkan-Loader.xcodeproj + open VulkanSC-Loader.xcodeproj Within Xcode, you can select Debug or Release builds in the project's Build Settings. @@ -610,6 +620,13 @@ the shell/batch script provided with QNX installation. Then change working directory to the "build-qnx" in this project and type "make". It will build the ICD loader for all CPU targets supported by QNX. +## Building Vulkan SC Loader + +Commands for building the Vulkan SC version of the tools are similar to the instructions in the sections above with a few minor differences: + +1) When running `update_deps.py` and/or `generate_source.py`, the option `--api vulkansc` should be specified. +2) When running `cmake` configuration, the option `-DVULKANSC=ON` should be passed in. + ## Cross Compilation While this repo is capable of cross compilation, there are a handful of caveats. diff --git a/CMakeLists.txt b/CMakeLists.txt index 16e65a62c..28aa72b10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ # ~~~ # Copyright (c) 2014-2023 Valve Corporation # Copyright (c) 2014-2023 LunarG, Inc. +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2023 RasterGrid Kft. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,13 +18,31 @@ # ~~~ cmake_minimum_required(VERSION 3.17.2) -project(VULKAN_LOADER VERSION 1.3.268) +if(VULKANSC) + project(VULKAN_LOADER VERSION 1.0.13) +else() + project(VULKAN_LOADER VERSION 1.3.268) +endif() + +# This variable enables downstream users to customize the target API +# variant (e.g. Vulkan SC) +set(API_TYPE "vulkan") + +if(VULKANSC) + set(API_TYPE vulkansc) + # Add preprocessor definition for the Vulkan SC projects. + # This "VULKANSC" definition can be used to deactivate the loader code that is not required for the VULKANSC builds. + add_definitions(-DVULKANSC) +endif() add_subdirectory(scripts) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) +# Add support for VULKANSC mode from the command line +set(VULKANSC OFF CACHE BOOL "User defined variable for VULKANSC mode to be passed in through cmake command line e.g. -DVULKANSC=ON") + # By default, loader & tests are built without sanitizers # Use these options to force a specific sanitizer on the loader and test executables if (UNIX) @@ -95,11 +115,22 @@ endif() add_library(platform_wsi INTERFACE) if(WIN32) - target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_WIN32_KHR) + if(NOT VULKANSC) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_WIN32_KHR) + endif() elseif(ANDROID) message(FATAL_ERROR "Android build not supported!") elseif(APPLE) - target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK VK_USE_PLATFORM_METAL_EXT) + if(NOT VULKANSC) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK VK_USE_PLATFORM_METAL_EXT) + endif() +elseif(UNIX AND NOT APPLE AND VULKANSC) + option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" OFF) + option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" OFF) + option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" OFF) + option(BUILD_WSI_DIRECTFB_SUPPORT "Build DirectFB WSI support" OFF) + option(BUILD_WSI_SCREEN_QNX_SUPPORT "Build QNX Screen WSI support" OFF) + option(BUILD_WSI_SCI_SUPPORT "Build SCI WSI support" OFF) elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU") option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) @@ -131,6 +162,9 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU") # Part of OS, no additional include directories are required target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_SCREEN_QNX) endif() + if(BUILD_WSI_SCI_SUPPORT) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_SCI) + endif() else() message(FATAL_ERROR "Unsupported Platform!") endif() @@ -242,7 +276,7 @@ if(LOADER_CODEGEN) add_custom_target(loader_codegen COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/generate_source.py "${VULKAN_HEADERS_INSTALL_DIR}/${CMAKE_INSTALL_DATADIR}/vulkan/registry" - --generated-version ${VulkanHeaders_VERSION} --incremental + --generated-version ${VulkanHeaders_VERSION} --incremental --api ${API_TYPE} ) endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c65e1203..e18f9df66 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,12 +7,18 @@ by Khronos and LunarG. * [KhronosGroup/Vulkan-Loader](https://github.com/KhronosGroup/Vulkan-Loader) +The source code for the Vulkan SC Loader component is sponsored by Khronos. + +* [KhronosGroup/VulkanSC-Loader](https://github.com/KhronosGroup/VulkanSC-Loader) + ### The Vulkan Ecosystem Needs Your Help There are a couple of methods to identify areas of need: * Examine the [issues list](https://github.com/KhronosGroup/Vulkan-Loader/issues) in this repository and look for issues that are of interest +* Examine the [issues list](https://github.com/KhronosGroup/VulkanSC-Loader/issues) + for Vulkan SC specific issues that are of interest * If you have your own work in mind, please open an issue to describe it and assign it to yourself. @@ -147,7 +153,7 @@ submitting your pull request or other contribution to GitHub. ### License and Copyrights -All contributions made to the Vulkan-Loader repository are Khronos branded +All contributions made to the VulkanSC-Loader repository are Khronos branded and as such, any new files need to have the Khronos license (Apache 2.0 style) and copyright included. Please see an existing file in this repository for an example. diff --git a/README.md b/README.md index 3f9193b04..3c3c09af5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# Vulkan Loader +# Vulkan SC Loader -This project provides the Khronos official Vulkan Loader for all platforms except [Android](https://android.googlesource.com/platform/frameworks/native/+/master/vulkan/) +This project provides the Khronos official Vulkan SC Loader for all platforms. + +> **IMPORTANT NOTE:** This repository is to be used with the [Vulkan SC](https://www.khronos.org/vulkansc/) API and should not be confused with the similar repository that exists for the Vulkan API (see https://github.com/KhronosGroup/Vulkan-Loader). While it is possible to build the Vulkan version from this repository, this repository contains a forked version of the upstream code and may not be up-to-date with the latest changes in the upstream repository. ## Introduction @@ -10,8 +12,11 @@ Vulkan also supports multiple global contexts (instances, in Vulkan terminology) The ICD loader is a library that is placed between a Vulkan application and any number of Vulkan drivers, in order to support multiple drivers and the instance-level functionality that works across these drivers. Additionally, the loader manages inserting Vulkan layer libraries, such as validation layers, between an application and the drivers. -This repository contains the Vulkan loader that is used for Linux, Windows, MacOS, and iOS. -There is also a separate loader, maintained by Google, which is used on Android. +Vulkan SC is an API derived from Vulkan with various changes applied to fulfill the special +requirements of safety critical applications. The Vulkan SC API has a large overlap with Vulkan. +As such, we endeavor to leverage as many of the Vulkan Ecosystem components as possible. + +This repository contains the Vulkan SC loader that is used for Linux, Windows, and QNX. The following components are available in this repository: @@ -19,6 +24,20 @@ The following components are available in this repository: - [Loader Documentation](docs/LoaderInterfaceArchitecture.md) - [Tests](tests/) +This repository contains the Vulkan SC Loader which is intended for **development** environments, +and is not expected to be used in **production** (safety) environments. + +**NOTE**: This repository is a downstream fork of +[KhronosGroup/Vulkan-Loader](https://github.com/KhronosGroup/Vulkan-Loader) +which is periodically rebased. + +This repository continues to have a functioning Vulkan loader with equivalent functionality +to the upstream branch point. + +The choice of Vulkan or Vulkan SC support is determined at build time. + +The `sc_main` branch is currently based on the `sdk-1.3.257` Vulkan-Loader tag and contains Vulkan SC modifications to support the Vulkan SC 1.0 API. + ## Contact Information - [Charles Giessen](mailto:charles@lunarg.com) @@ -43,6 +62,8 @@ Updates to this repository which correspond to a new Vulkan specification releas This scheme was adopted following the `1.3.266` Vulkan specification release. +For Vulkan SC, updates to a new API version will be tagged using the following format `vksc<`_`version`_`>.<`_`patch`_`>` (e.g., `vksc1.0.13`). + ## License This work is released as open source under a Apache-style license from Khronos including a Khronos copyright. @@ -52,3 +73,5 @@ This work is released as open source under a Apache-style license from Khronos i While this project has been developed primarily by LunarG, Inc., there are many other companies and individuals making this possible: Valve Corporation, funding project development; Khronos providing oversight and hosting of the project. + +Original Vulkan SC modifications have been contributed by NVIDIA CORPORATION. diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 7a0b47af8..51def1ef7 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -3,6 +3,7 @@ # Copyright (c) 2014-2023 Valve Corporation # Copyright (c) 2014-2023 LunarG, Inc. # Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2023 RasterGrid Kft. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +20,11 @@ add_library(loader_specific_options INTERFACE) target_link_libraries(loader_specific_options INTERFACE loader_common_options Vulkan::Headers) -target_include_directories(loader_specific_options INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/generated ${CMAKE_CURRENT_BINARY_DIR}) +if(VULKANSC) +target_include_directories(loader_specific_options INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/generated-vksc ${CMAKE_CURRENT_BINARY_DIR}) +else() + target_include_directories(loader_specific_options INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/generated ${CMAKE_CURRENT_BINARY_DIR}) +endif() if(WIN32) @@ -311,7 +316,7 @@ if(WIN32) SHARED ${NORMAL_LOADER_SRCS} ${LOADER_UNKNOWN_CHAIN_LIBRARY} - ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1.def + ${CMAKE_CURRENT_SOURCE_DIR}/${API_TYPE}-1.def ${RC_FILE_LOCATION}) target_link_libraries(vulkan PRIVATE loader_specific_options loader-opt) @@ -321,7 +326,7 @@ if(WIN32) # msvc: vulkan-1.lib / vulkan-1.dll set_target_properties(vulkan PROPERTIES - OUTPUT_NAME vulkan-1) + OUTPUT_NAME ${API_TYPE}-1) if(MINGW) # generate the same DLL with mingw set_target_properties(vulkan @@ -349,7 +354,14 @@ else() set_target_properties(vulkan PROPERTIES SOVERSION "1" VERSION ${VULKAN_LOADER_VERSION}) - target_link_libraries(vulkan PRIVATE ${CMAKE_DL_LIBS} m Threads::Threads) + # On QNX libdl and pthread is part of libc and there is no separate library. + if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "QNX")) + target_link_libraries(vulkan PRIVATE ${CMAKE_DL_LIBS} m Threads::Threads) + else() + target_link_libraries(vulkan PRIVATE m) + endif() + + set_target_properties(vulkan PROPERTIES OUTPUT_NAME ${API_TYPE}) if (LOADER_ENABLE_ADDRESS_SANITIZER) target_compile_options(vulkan PUBLIC -fsanitize=address) @@ -458,5 +470,5 @@ if (PKG_CONFIG_FOUND) file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR_PC ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_INCLUDEDIR}) endif() configure_file("vulkan.pc.in" "vulkan.pc" @ONLY) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vulkan.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vulkan.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" RENAME "${API_TYPE}.pc") endif() diff --git a/loader/cJSON.h b/loader/cJSON.h index 4878288f5..7d2719294 100644 --- a/loader/cJSON.h +++ b/loader/cJSON.h @@ -27,7 +27,11 @@ #include +#ifdef VULKANSC +#include +#else #include +#endif // VULKANSC /* cJSON Types: */ #define cJSON_False 0 diff --git a/loader/debug_utils.c b/loader/debug_utils.c index bdd633177..02ce73181 100644 --- a/loader/debug_utils.c +++ b/loader/debug_utils.c @@ -3,6 +3,8 @@ * Copyright (c) 2015-2021 Valve Corporation * Copyright (c) 2015-2021 LunarG, Inc. * Copyright (C) 2015-2016 Google Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +34,9 @@ #endif #include "vulkan/vk_layer.h" +#ifndef VULKANSC #include "vk_object_types.h" +#endif // VULKANSC #include "allocation.h" #include "debug_utils.h" @@ -83,6 +87,7 @@ VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkD if (NULL != pCallbackData) { VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; +#ifndef VULKANSC VkDebugReportObjectTypeEXT object_type = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT; VkDebugReportFlagsEXT object_flags = 0; uint64_t object_handle = 0; @@ -91,7 +96,7 @@ VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkD if (0 < pCallbackData->objectCount) { debug_utils_AnnotObjectToDebugReportObject(pCallbackData->pObjects, &object_type, &object_handle); } - +#endif // VULKANSC while (pTrav) { if (pTrav->is_messenger && (pTrav->messenger.messageSeverity & messageSeverity) && (pTrav->messenger.messageType & messageTypes)) { @@ -99,13 +104,14 @@ VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkD bail = true; } } +#ifndef VULKANSC if (!pTrav->is_messenger && pTrav->report.msgFlags & object_flags) { if (pTrav->report.pfnMsgCallback(object_flags, object_type, object_handle, 0, pCallbackData->messageIdNumber, pCallbackData->pMessageIdName, pCallbackData->pMessage, pTrav->pUserData)) { bail = true; } } - +#endif // VULKANSC pTrav = pTrav->pNext; } } @@ -288,6 +294,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_SubmitDebugUtilsMessageEXT(VkInstance inst // VK_EXT_debug_report related items +#ifndef VULKANSC VkResult util_CreateDebugReportCallback(struct loader_instance *inst, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback) { VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; @@ -546,11 +553,14 @@ VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(VkInstance instance, loader_platform_thread_unlock_mutex(&loader_lock); } +#endif // VULKANSC // General utilities const VkExtensionProperties debug_utils_extension_info[] = { +#ifndef VULKANSC {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}, +#endif // VULKANSC {VK_EXT_DEBUG_UTILS_EXTENSION_NAME, VK_EXT_DEBUG_UTILS_SPEC_VERSION}, }; @@ -572,9 +582,12 @@ VkResult add_debug_extensions_to_ext_list(const struct loader_instance *inst, st void check_for_enabled_debug_extensions(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { +#ifndef VULKANSC if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) { ptr_instance->enabled_known_extensions.ext_debug_report = 1; - } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_UTILS_EXTENSION_NAME) == 0) { + } else +#endif // VULKANSC + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_UTILS_EXTENSION_NAME) == 0) { ptr_instance->enabled_known_extensions.ext_debug_utils = 1; } } @@ -585,6 +598,7 @@ bool debug_extensions_InstanceGpa(struct loader_instance *ptr_instance, const ch *addr = NULL; +#ifndef VULKANSC if (!strcmp("vkCreateDebugReportCallbackEXT", name)) { *addr = ptr_instance->enabled_known_extensions.ext_debug_report == 1 ? (void *)debug_utils_CreateDebugReportCallbackEXT : NULL; @@ -597,6 +611,7 @@ bool debug_extensions_InstanceGpa(struct loader_instance *ptr_instance, const ch *addr = ptr_instance->enabled_known_extensions.ext_debug_report == 1 ? (void *)debug_utils_DebugReportMessageEXT : NULL; return true; } +#endif // VULKANSC if (!strcmp("vkCreateDebugUtilsMessengerEXT", name)) { *addr = ptr_instance->enabled_known_extensions.ext_debug_utils == 1 ? (void *)debug_utils_CreateDebugUtilsMessengerEXT : NULL; @@ -613,6 +628,7 @@ bool debug_extensions_InstanceGpa(struct loader_instance *ptr_instance, const ch return ret_type; } +#ifndef VULKANSC bool debug_utils_ReportFlagsToAnnotFlags(VkDebugReportFlagsEXT dr_flags, bool default_flag_is_spec, VkDebugUtilsMessageSeverityFlagBitsEXT *da_severity, VkDebugUtilsMessageTypeFlagsEXT *da_type) { @@ -697,3 +713,4 @@ bool debug_utils_AnnotObjectToDebugReportObject(const VkDebugUtilsObjectNameInfo *dr_object_handle = da_object_name_info->objectHandle; return true; } +#endif // VULKANSC diff --git a/loader/debug_utils.h b/loader/debug_utils.h index 9472ef947..34382b82b 100644 --- a/loader/debug_utils.h +++ b/loader/debug_utils.h @@ -3,6 +3,8 @@ * Copyright (c) 2015-2021 Valve Corporation * Copyright (c) 2015-2021 LunarG, Inc. * Copyright (C) 2015-2016 Google Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +33,7 @@ VkResult add_debug_extensions_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list); void check_for_enabled_debug_extensions(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); bool debug_extensions_InstanceGpa(struct loader_instance *ptr_instance, const char *name, void **addr); +#ifndef VULKANSC bool debug_utils_ReportFlagsToAnnotFlags(VkDebugReportFlagsEXT dr_flags, bool default_flag_is_spec, VkDebugUtilsMessageSeverityFlagBitsEXT *da_severity, VkDebugUtilsMessageTypeFlagsEXT *da_type); @@ -40,7 +43,7 @@ bool debug_utils_ReportObjectToAnnotObject(VkDebugReportObjectTypeEXT dr_object_ VkDebugUtilsObjectNameInfoEXT *da_object_name_info); bool debug_utils_AnnotObjectToDebugReportObject(const VkDebugUtilsObjectNameInfoEXT *da_object_name_info, VkDebugReportObjectTypeEXT *dr_object_type, uint64_t *dr_object_handle); - +#endif // VULKANSC void destroy_debug_callbacks_chain(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator); // VK_EXT_debug_utils related items @@ -60,6 +63,7 @@ VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkD VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData); +#ifndef VULKANSC // VK_EXT_debug_report related items VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstance instance, @@ -77,3 +81,4 @@ VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(VkInstance instance, VkResult util_CreateDebugReportCallbacks(struct loader_instance *inst, const void *pChain, const VkAllocationCallbacks *pAllocator); VkBool32 util_DebugReportMessage(const struct loader_instance *inst, VkFlags msgFlags, VkDebugReportObjectTypeEXT objectType, uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg); +#endif // VULKANSC diff --git a/loader/dirent_on_windows.h b/loader/dirent_on_windows.h index cf55d614c..bbcd04644 100644 --- a/loader/dirent_on_windows.h +++ b/loader/dirent_on_windows.h @@ -10,7 +10,11 @@ */ +#ifdef VULKANSC +#include +#else #include +#endif #if defined(__cplusplus) extern "C" { diff --git a/loader/extension_manual.c b/loader/extension_manual.c index feadd6de4..e3d536c7b 100644 --- a/loader/extension_manual.c +++ b/loader/extension_manual.c @@ -2,6 +2,8 @@ * Copyright (c) 2015-2022 The Khronos Group Inc. * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +39,7 @@ // These functions, for whatever reason, require more complex changes than // can easily be automatically generated. +#ifndef VULKANSC // ---- VK_NV_external_memory_capabilities extension trampoline/terminators VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( @@ -84,6 +87,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceExternalImageFormatPr return icd_term->dispatch.GetPhysicalDeviceExternalImageFormatPropertiesNV( phys_dev_term->phys_dev, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); } +#endif // VULKANSC // ---- VK_EXT_display_surface_counter extension trampoline/terminators @@ -179,6 +183,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice phy return icd_term->dispatch.ReleaseDisplayEXT(phys_dev_term->phys_dev, display); } +#ifndef VULKANSC // ---- VK_EXT_acquire_xlib_display extension trampoline/terminators #if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) @@ -400,3 +405,4 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolPropertiesEXT(VkP return res; } +#endif // VULKANSC diff --git a/loader/extension_manual.h b/loader/extension_manual.h index 0ba63ef1f..4194fed2f 100644 --- a/loader/extension_manual.h +++ b/loader/extension_manual.h @@ -2,6 +2,8 @@ * Copyright (c) 2015-2021 The Khronos Group Inc. * Copyright (c) 2015-2021 Valve Corporation * Copyright (c) 2015-2021 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +23,18 @@ #pragma once +#ifdef VULKANSC +#include +#else #include +#endif // VULKANSC // ---- Manually added trampoline/terminator functions // These functions, for whatever reason, require more complex changes than // can easily be automatically generated. +#ifndef VULKANSC VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, @@ -37,6 +44,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceExternalImageFormatPr VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); +#endif // VULKANSC VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT* pSurfaceCapabilities); @@ -49,6 +57,7 @@ VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display); +#ifndef VULKANSC #if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); @@ -88,3 +97,4 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevi VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolPropertiesEXT* pToolProperties); +#endif // VULKANSC diff --git a/loader/generated-vksc/.clang-format b/loader/generated-vksc/.clang-format new file mode 100644 index 000000000..3bb983a45 --- /dev/null +++ b/loader/generated-vksc/.clang-format @@ -0,0 +1,5 @@ +--- +# Disable clang-format for generated code +DisableFormat: true +SortIncludes: false +... diff --git a/loader/generated-vksc/vk_layer_dispatch_table.h b/loader/generated-vksc/vk_layer_dispatch_table.h new file mode 100644 index 000000000..9e0467044 --- /dev/null +++ b/loader/generated-vksc/vk_layer_dispatch_table.h @@ -0,0 +1,440 @@ +// *** THIS FILE IS GENERATED - DO NOT EDIT *** +// See loader_extension_generator.py for modifications + +/* + * Copyright (c) 2015-2022 The Khronos Group Inc. + * Copyright (c) 2015-2022 Valve Corporation + * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 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. + * + * Author: Mark Lobodzinski + * Author: Mark Young + */ + +#pragma once + +#if !defined(PFN_GetPhysicalDeviceProcAddr) +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName); +#endif + +// Instance function pointer dispatch table +typedef struct VkLayerInstanceDispatchTable_ { + // Manually add in GetPhysicalDeviceProcAddr entry + PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr; + + // ---- Core SC 1_0 commands + PFN_vkCreateInstance CreateInstance; + PFN_vkDestroyInstance DestroyInstance; + PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; + PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures; + PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties; + PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties; + PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties; + PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties; + PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties; + PFN_vkGetInstanceProcAddr GetInstanceProcAddr; + PFN_vkCreateDevice CreateDevice; + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties; + PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; + PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties; + PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties; + PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion; + PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups; + PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2; + PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2; + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2; + PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysicalDeviceImageFormatProperties2; + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2; + PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysicalDeviceMemoryProperties2; + PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties; + PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties; + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties; + + // ---- VK_KHR_surface extension commands + PFN_vkDestroySurfaceKHR DestroySurfaceKHR; + PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR; + PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR; + PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR; + PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR; + + // ---- VK_KHR_swapchain extension commands + PFN_vkGetPhysicalDevicePresentRectanglesKHR GetPhysicalDevicePresentRectanglesKHR; + + // ---- VK_KHR_display extension commands + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR; + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR; + PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR; + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR; + PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR; + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR; + PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR; + + // ---- VK_KHR_performance_query extension commands + PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR; + PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR; + + // ---- VK_KHR_get_surface_capabilities2 extension commands + PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR GetPhysicalDeviceSurfaceCapabilities2KHR; + PFN_vkGetPhysicalDeviceSurfaceFormats2KHR GetPhysicalDeviceSurfaceFormats2KHR; + + // ---- VK_KHR_get_display_properties2 extension commands + PFN_vkGetPhysicalDeviceDisplayProperties2KHR GetPhysicalDeviceDisplayProperties2KHR; + PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR GetPhysicalDeviceDisplayPlaneProperties2KHR; + PFN_vkGetDisplayModeProperties2KHR GetDisplayModeProperties2KHR; + PFN_vkGetDisplayPlaneCapabilities2KHR GetDisplayPlaneCapabilities2KHR; + + // ---- VK_KHR_fragment_shading_rate extension commands + PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR GetPhysicalDeviceFragmentShadingRatesKHR; + + // ---- VK_KHR_object_refresh extension commands + PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR GetPhysicalDeviceRefreshableObjectTypesKHR; + + // ---- VK_EXT_direct_mode_display extension commands + PFN_vkReleaseDisplayEXT ReleaseDisplayEXT; + + // ---- VK_EXT_display_surface_counter extension commands + PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT; + + // ---- VK_EXT_debug_utils extension commands + PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT; + PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT; + PFN_vkSubmitDebugUtilsMessageEXT SubmitDebugUtilsMessageEXT; + + // ---- VK_EXT_sample_locations extension commands + PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT GetPhysicalDeviceMultisamplePropertiesEXT; + + // ---- VK_EXT_calibrated_timestamps extension commands + PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT; + + // ---- VK_EXT_headless_surface extension commands + PFN_vkCreateHeadlessSurfaceEXT CreateHeadlessSurfaceEXT; + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetPhysicalDeviceSciSyncAttributesNV GetPhysicalDeviceSciSyncAttributesNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV GetPhysicalDeviceExternalMemorySciBufPropertiesNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetPhysicalDeviceSciBufAttributesNV GetPhysicalDeviceSciBufAttributesNV; +#endif // VK_USE_PLATFORM_SCI +} VkLayerInstanceDispatchTable; + +// Device function pointer dispatch table +#define DEVICE_DISP_TABLE_MAGIC_NUMBER 0x10ADED040410ADEDUL +typedef struct VkLayerDispatchTable_ { + uint64_t magic; // Should be DEVICE_DISP_TABLE_MAGIC_NUMBER + + // ---- Core SC 1_0 commands + PFN_vkGetDeviceProcAddr GetDeviceProcAddr; + PFN_vkDestroyDevice DestroyDevice; + PFN_vkGetDeviceQueue GetDeviceQueue; + PFN_vkQueueSubmit QueueSubmit; + PFN_vkQueueWaitIdle QueueWaitIdle; + PFN_vkDeviceWaitIdle DeviceWaitIdle; + PFN_vkAllocateMemory AllocateMemory; + PFN_vkMapMemory MapMemory; + PFN_vkUnmapMemory UnmapMemory; + PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges; + PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges; + PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment; + PFN_vkBindBufferMemory BindBufferMemory; + PFN_vkBindImageMemory BindImageMemory; + PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements; + PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements; + PFN_vkCreateFence CreateFence; + PFN_vkDestroyFence DestroyFence; + PFN_vkResetFences ResetFences; + PFN_vkGetFenceStatus GetFenceStatus; + PFN_vkWaitForFences WaitForFences; + PFN_vkCreateSemaphore CreateSemaphore; + PFN_vkDestroySemaphore DestroySemaphore; + PFN_vkCreateEvent CreateEvent; + PFN_vkDestroyEvent DestroyEvent; + PFN_vkGetEventStatus GetEventStatus; + PFN_vkSetEvent SetEvent; + PFN_vkResetEvent ResetEvent; + PFN_vkCreateQueryPool CreateQueryPool; + PFN_vkGetQueryPoolResults GetQueryPoolResults; + PFN_vkCreateBuffer CreateBuffer; + PFN_vkDestroyBuffer DestroyBuffer; + PFN_vkCreateBufferView CreateBufferView; + PFN_vkDestroyBufferView DestroyBufferView; + PFN_vkCreateImage CreateImage; + PFN_vkDestroyImage DestroyImage; + PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout; + PFN_vkCreateImageView CreateImageView; + PFN_vkDestroyImageView DestroyImageView; + PFN_vkCreatePipelineCache CreatePipelineCache; + PFN_vkDestroyPipelineCache DestroyPipelineCache; + PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines; + PFN_vkCreateComputePipelines CreateComputePipelines; + PFN_vkDestroyPipeline DestroyPipeline; + PFN_vkCreatePipelineLayout CreatePipelineLayout; + PFN_vkDestroyPipelineLayout DestroyPipelineLayout; + PFN_vkCreateSampler CreateSampler; + PFN_vkDestroySampler DestroySampler; + PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout; + PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout; + PFN_vkCreateDescriptorPool CreateDescriptorPool; + PFN_vkResetDescriptorPool ResetDescriptorPool; + PFN_vkAllocateDescriptorSets AllocateDescriptorSets; + PFN_vkFreeDescriptorSets FreeDescriptorSets; + PFN_vkUpdateDescriptorSets UpdateDescriptorSets; + PFN_vkCreateFramebuffer CreateFramebuffer; + PFN_vkDestroyFramebuffer DestroyFramebuffer; + PFN_vkCreateRenderPass CreateRenderPass; + PFN_vkDestroyRenderPass DestroyRenderPass; + PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity; + PFN_vkCreateCommandPool CreateCommandPool; + PFN_vkResetCommandPool ResetCommandPool; + PFN_vkAllocateCommandBuffers AllocateCommandBuffers; + PFN_vkFreeCommandBuffers FreeCommandBuffers; + PFN_vkBeginCommandBuffer BeginCommandBuffer; + PFN_vkEndCommandBuffer EndCommandBuffer; + PFN_vkResetCommandBuffer ResetCommandBuffer; + PFN_vkCmdBindPipeline CmdBindPipeline; + PFN_vkCmdSetViewport CmdSetViewport; + PFN_vkCmdSetScissor CmdSetScissor; + PFN_vkCmdSetLineWidth CmdSetLineWidth; + PFN_vkCmdSetDepthBias CmdSetDepthBias; + PFN_vkCmdSetBlendConstants CmdSetBlendConstants; + PFN_vkCmdSetDepthBounds CmdSetDepthBounds; + PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask; + PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask; + PFN_vkCmdSetStencilReference CmdSetStencilReference; + PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets; + PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer; + PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers; + PFN_vkCmdDraw CmdDraw; + PFN_vkCmdDrawIndexed CmdDrawIndexed; + PFN_vkCmdDrawIndirect CmdDrawIndirect; + PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect; + PFN_vkCmdDispatch CmdDispatch; + PFN_vkCmdDispatchIndirect CmdDispatchIndirect; + PFN_vkCmdCopyBuffer CmdCopyBuffer; + PFN_vkCmdCopyImage CmdCopyImage; + PFN_vkCmdBlitImage CmdBlitImage; + PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage; + PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer; + PFN_vkCmdUpdateBuffer CmdUpdateBuffer; + PFN_vkCmdFillBuffer CmdFillBuffer; + PFN_vkCmdClearColorImage CmdClearColorImage; + PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage; + PFN_vkCmdClearAttachments CmdClearAttachments; + PFN_vkCmdResolveImage CmdResolveImage; + PFN_vkCmdSetEvent CmdSetEvent; + PFN_vkCmdResetEvent CmdResetEvent; + PFN_vkCmdWaitEvents CmdWaitEvents; + PFN_vkCmdPipelineBarrier CmdPipelineBarrier; + PFN_vkCmdBeginQuery CmdBeginQuery; + PFN_vkCmdEndQuery CmdEndQuery; + PFN_vkCmdResetQueryPool CmdResetQueryPool; + PFN_vkCmdWriteTimestamp CmdWriteTimestamp; + PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults; + PFN_vkCmdPushConstants CmdPushConstants; + PFN_vkCmdBeginRenderPass CmdBeginRenderPass; + PFN_vkCmdNextSubpass CmdNextSubpass; + PFN_vkCmdEndRenderPass CmdEndRenderPass; + PFN_vkCmdExecuteCommands CmdExecuteCommands; + PFN_vkBindBufferMemory2 BindBufferMemory2; + PFN_vkBindImageMemory2 BindImageMemory2; + PFN_vkGetDeviceGroupPeerMemoryFeatures GetDeviceGroupPeerMemoryFeatures; + PFN_vkCmdSetDeviceMask CmdSetDeviceMask; + PFN_vkCmdDispatchBase CmdDispatchBase; + PFN_vkGetImageMemoryRequirements2 GetImageMemoryRequirements2; + PFN_vkGetBufferMemoryRequirements2 GetBufferMemoryRequirements2; + PFN_vkGetDeviceQueue2 GetDeviceQueue2; + PFN_vkCreateSamplerYcbcrConversion CreateSamplerYcbcrConversion; + PFN_vkDestroySamplerYcbcrConversion DestroySamplerYcbcrConversion; + PFN_vkGetDescriptorSetLayoutSupport GetDescriptorSetLayoutSupport; + PFN_vkCmdDrawIndirectCount CmdDrawIndirectCount; + PFN_vkCmdDrawIndexedIndirectCount CmdDrawIndexedIndirectCount; + PFN_vkCreateRenderPass2 CreateRenderPass2; + PFN_vkCmdBeginRenderPass2 CmdBeginRenderPass2; + PFN_vkCmdNextSubpass2 CmdNextSubpass2; + PFN_vkCmdEndRenderPass2 CmdEndRenderPass2; + PFN_vkResetQueryPool ResetQueryPool; + PFN_vkGetSemaphoreCounterValue GetSemaphoreCounterValue; + PFN_vkWaitSemaphores WaitSemaphores; + PFN_vkSignalSemaphore SignalSemaphore; + PFN_vkGetBufferDeviceAddress GetBufferDeviceAddress; + PFN_vkGetBufferOpaqueCaptureAddress GetBufferOpaqueCaptureAddress; + PFN_vkGetDeviceMemoryOpaqueCaptureAddress GetDeviceMemoryOpaqueCaptureAddress; + PFN_vkGetCommandPoolMemoryConsumption GetCommandPoolMemoryConsumption; + PFN_vkGetFaultData GetFaultData; + + // ---- VK_KHR_swapchain extension commands + PFN_vkCreateSwapchainKHR CreateSwapchainKHR; + PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR; + PFN_vkAcquireNextImageKHR AcquireNextImageKHR; + PFN_vkQueuePresentKHR QueuePresentKHR; + PFN_vkGetDeviceGroupPresentCapabilitiesKHR GetDeviceGroupPresentCapabilitiesKHR; + PFN_vkGetDeviceGroupSurfacePresentModesKHR GetDeviceGroupSurfacePresentModesKHR; + PFN_vkAcquireNextImage2KHR AcquireNextImage2KHR; + + // ---- VK_KHR_display_swapchain extension commands + PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR; + + // ---- VK_KHR_external_memory_fd extension commands + PFN_vkGetMemoryFdKHR GetMemoryFdKHR; + PFN_vkGetMemoryFdPropertiesKHR GetMemoryFdPropertiesKHR; + + // ---- VK_KHR_external_semaphore_fd extension commands + PFN_vkImportSemaphoreFdKHR ImportSemaphoreFdKHR; + PFN_vkGetSemaphoreFdKHR GetSemaphoreFdKHR; + + // ---- VK_KHR_shared_presentable_image extension commands + PFN_vkGetSwapchainStatusKHR GetSwapchainStatusKHR; + + // ---- VK_KHR_external_fence_fd extension commands + PFN_vkImportFenceFdKHR ImportFenceFdKHR; + PFN_vkGetFenceFdKHR GetFenceFdKHR; + + // ---- VK_KHR_performance_query extension commands + PFN_vkAcquireProfilingLockKHR AcquireProfilingLockKHR; + PFN_vkReleaseProfilingLockKHR ReleaseProfilingLockKHR; + + // ---- VK_KHR_fragment_shading_rate extension commands + PFN_vkCmdSetFragmentShadingRateKHR CmdSetFragmentShadingRateKHR; + + // ---- VK_KHR_object_refresh extension commands + PFN_vkCmdRefreshObjectsKHR CmdRefreshObjectsKHR; + + // ---- VK_KHR_synchronization2 extension commands + PFN_vkCmdSetEvent2KHR CmdSetEvent2KHR; + PFN_vkCmdResetEvent2KHR CmdResetEvent2KHR; + PFN_vkCmdWaitEvents2KHR CmdWaitEvents2KHR; + PFN_vkCmdPipelineBarrier2KHR CmdPipelineBarrier2KHR; + PFN_vkCmdWriteTimestamp2KHR CmdWriteTimestamp2KHR; + PFN_vkQueueSubmit2KHR QueueSubmit2KHR; + PFN_vkCmdWriteBufferMarker2AMD CmdWriteBufferMarker2AMD; + PFN_vkGetQueueCheckpointData2NV GetQueueCheckpointData2NV; + + // ---- VK_KHR_copy_commands2 extension commands + PFN_vkCmdCopyBuffer2KHR CmdCopyBuffer2KHR; + PFN_vkCmdCopyImage2KHR CmdCopyImage2KHR; + PFN_vkCmdCopyBufferToImage2KHR CmdCopyBufferToImage2KHR; + PFN_vkCmdCopyImageToBuffer2KHR CmdCopyImageToBuffer2KHR; + PFN_vkCmdBlitImage2KHR CmdBlitImage2KHR; + PFN_vkCmdResolveImage2KHR CmdResolveImage2KHR; + + // ---- VK_EXT_display_control extension commands + PFN_vkDisplayPowerControlEXT DisplayPowerControlEXT; + PFN_vkRegisterDeviceEventEXT RegisterDeviceEventEXT; + PFN_vkRegisterDisplayEventEXT RegisterDisplayEventEXT; + PFN_vkGetSwapchainCounterEXT GetSwapchainCounterEXT; + + // ---- VK_EXT_discard_rectangles extension commands + PFN_vkCmdSetDiscardRectangleEXT CmdSetDiscardRectangleEXT; + PFN_vkCmdSetDiscardRectangleEnableEXT CmdSetDiscardRectangleEnableEXT; + PFN_vkCmdSetDiscardRectangleModeEXT CmdSetDiscardRectangleModeEXT; + + // ---- VK_EXT_hdr_metadata extension commands + PFN_vkSetHdrMetadataEXT SetHdrMetadataEXT; + + // ---- VK_EXT_debug_utils extension commands + PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT; + PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT; + PFN_vkQueueBeginDebugUtilsLabelEXT QueueBeginDebugUtilsLabelEXT; + PFN_vkQueueEndDebugUtilsLabelEXT QueueEndDebugUtilsLabelEXT; + PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsertDebugUtilsLabelEXT; + PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT; + PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT; + PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT; + + // ---- VK_EXT_sample_locations extension commands + PFN_vkCmdSetSampleLocationsEXT CmdSetSampleLocationsEXT; + + // ---- VK_EXT_image_drm_format_modifier extension commands + PFN_vkGetImageDrmFormatModifierPropertiesEXT GetImageDrmFormatModifierPropertiesEXT; + + // ---- VK_EXT_external_memory_host extension commands + PFN_vkGetMemoryHostPointerPropertiesEXT GetMemoryHostPointerPropertiesEXT; + + // ---- VK_EXT_calibrated_timestamps extension commands + PFN_vkGetCalibratedTimestampsEXT GetCalibratedTimestampsEXT; + + // ---- VK_EXT_line_rasterization extension commands + PFN_vkCmdSetLineStippleEXT CmdSetLineStippleEXT; + + // ---- VK_EXT_extended_dynamic_state extension commands + PFN_vkCmdSetCullModeEXT CmdSetCullModeEXT; + PFN_vkCmdSetFrontFaceEXT CmdSetFrontFaceEXT; + PFN_vkCmdSetPrimitiveTopologyEXT CmdSetPrimitiveTopologyEXT; + PFN_vkCmdSetViewportWithCountEXT CmdSetViewportWithCountEXT; + PFN_vkCmdSetScissorWithCountEXT CmdSetScissorWithCountEXT; + PFN_vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT; + PFN_vkCmdSetDepthTestEnableEXT CmdSetDepthTestEnableEXT; + PFN_vkCmdSetDepthWriteEnableEXT CmdSetDepthWriteEnableEXT; + PFN_vkCmdSetDepthCompareOpEXT CmdSetDepthCompareOpEXT; + PFN_vkCmdSetDepthBoundsTestEnableEXT CmdSetDepthBoundsTestEnableEXT; + PFN_vkCmdSetStencilTestEnableEXT CmdSetStencilTestEnableEXT; + PFN_vkCmdSetStencilOpEXT CmdSetStencilOpEXT; + + // ---- VK_EXT_vertex_input_dynamic_state extension commands + PFN_vkCmdSetVertexInputEXT CmdSetVertexInputEXT; + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetFenceSciSyncFenceNV GetFenceSciSyncFenceNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetFenceSciSyncObjNV GetFenceSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkImportFenceSciSyncFenceNV ImportFenceSciSyncFenceNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkImportFenceSciSyncObjNV ImportFenceSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetSemaphoreSciSyncObjNV GetSemaphoreSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkImportSemaphoreSciSyncObjNV ImportSemaphoreSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetMemorySciBufNV GetMemorySciBufNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_EXT_extended_dynamic_state2 extension commands + PFN_vkCmdSetPatchControlPointsEXT CmdSetPatchControlPointsEXT; + PFN_vkCmdSetRasterizerDiscardEnableEXT CmdSetRasterizerDiscardEnableEXT; + PFN_vkCmdSetDepthBiasEnableEXT CmdSetDepthBiasEnableEXT; + PFN_vkCmdSetLogicOpEXT CmdSetLogicOpEXT; + PFN_vkCmdSetPrimitiveRestartEnableEXT CmdSetPrimitiveRestartEnableEXT; + + // ---- VK_EXT_color_write_enable extension commands + PFN_vkCmdSetColorWriteEnableEXT CmdSetColorWriteEnableEXT; + + // ---- VK_NV_external_sci_sync2 extension commands +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkCreateSemaphoreSciSyncPoolNV CreateSemaphoreSciSyncPoolNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_QNX_external_memory_screen_buffer extension commands +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + PFN_vkGetScreenBufferPropertiesQNX GetScreenBufferPropertiesQNX; +#endif // VK_USE_PLATFORM_SCREEN_QNX +} VkLayerDispatchTable; + + diff --git a/loader/generated-vksc/vk_loader_extensions.c b/loader/generated-vksc/vk_loader_extensions.c new file mode 100644 index 000000000..2bf03fb50 --- /dev/null +++ b/loader/generated-vksc/vk_loader_extensions.c @@ -0,0 +1,3695 @@ +// *** THIS FILE IS GENERATED - DO NOT EDIT *** +// See loader_extension_generator.py for modifications + +/* + * Copyright (c) 2015-2022 The Khronos Group Inc. + * Copyright (c) 2015-2022 Valve Corporation + * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 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. + * + * Author: Mark Lobodzinski + * Author: Mark Young + */ + +#include +#include +#include +#include "vk_loader_platform.h" +#include "loader.h" +#include "vk_loader_extensions.h" +#include +#include "wsi.h" +#include "debug_utils.h" +#include "extension_manual.h" + +// Device extension error function +VKAPI_ATTR VkResult VKAPI_CALL vkDevExtError(VkDevice dev) { + struct loader_device *found_dev; + // The device going in is a trampoline device + struct loader_icd_term *icd_term = loader_get_icd_and_device(dev, &found_dev, NULL); + + if (icd_term) + loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + "Bad destination in loader trampoline dispatch," + "Are layers and extensions that you are calling enabled?"); + return VK_ERROR_EXTENSION_NOT_PRESENT; +} + +VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_term, VkInstance inst, + const PFN_vkGetInstanceProcAddr fp_gipa) { + +#define LOOKUP_GIPA(func, required) \ + do { \ + icd_term->dispatch.func = (PFN_vk##func)fp_gipa(inst, "vk" #func); \ + if (!icd_term->dispatch.func && required) { \ + loader_log((struct loader_instance *)inst, VULKAN_LOADER_WARN_BIT, 0, \ + loader_platform_get_proc_address_error("vk" #func)); \ + return false; \ + } \ + } while (0) + + + // ---- Core SC 1_0 + LOOKUP_GIPA(DestroyInstance, true); + LOOKUP_GIPA(EnumeratePhysicalDevices, true); + LOOKUP_GIPA(GetPhysicalDeviceFeatures, true); + LOOKUP_GIPA(GetPhysicalDeviceFormatProperties, true); + LOOKUP_GIPA(GetPhysicalDeviceImageFormatProperties, true); + LOOKUP_GIPA(GetPhysicalDeviceProperties, true); + LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyProperties, true); + LOOKUP_GIPA(GetPhysicalDeviceMemoryProperties, true); + LOOKUP_GIPA(GetDeviceProcAddr, true); + LOOKUP_GIPA(CreateDevice, true); + LOOKUP_GIPA(EnumerateDeviceExtensionProperties, true); + LOOKUP_GIPA(EnumeratePhysicalDeviceGroups, true); + LOOKUP_GIPA(GetPhysicalDeviceFeatures2, true); + LOOKUP_GIPA(GetPhysicalDeviceProperties2, true); + LOOKUP_GIPA(GetPhysicalDeviceFormatProperties2, true); + LOOKUP_GIPA(GetPhysicalDeviceImageFormatProperties2, true); + LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyProperties2, true); + LOOKUP_GIPA(GetPhysicalDeviceMemoryProperties2, true); + LOOKUP_GIPA(GetPhysicalDeviceExternalBufferProperties, true); + LOOKUP_GIPA(GetPhysicalDeviceExternalFenceProperties, true); + LOOKUP_GIPA(GetPhysicalDeviceExternalSemaphoreProperties, true); + + // ---- VK_KHR_surface extension commands + LOOKUP_GIPA(DestroySurfaceKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceSupportKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilitiesKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceFormatsKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceSurfacePresentModesKHR, false); + + // ---- VK_KHR_swapchain extension commands + LOOKUP_GIPA(GetPhysicalDevicePresentRectanglesKHR, false); + + // ---- VK_KHR_display extension commands + LOOKUP_GIPA(GetPhysicalDeviceDisplayPropertiesKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceDisplayPlanePropertiesKHR, false); + LOOKUP_GIPA(GetDisplayPlaneSupportedDisplaysKHR, false); + LOOKUP_GIPA(GetDisplayModePropertiesKHR, false); + LOOKUP_GIPA(CreateDisplayModeKHR, false); + LOOKUP_GIPA(GetDisplayPlaneCapabilitiesKHR, false); + LOOKUP_GIPA(CreateDisplayPlaneSurfaceKHR, false); + + // ---- VK_KHR_performance_query extension commands + LOOKUP_GIPA(EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR, false); + + // ---- VK_KHR_get_surface_capabilities2 extension commands + LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilities2KHR, false); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceFormats2KHR, false); + + // ---- VK_KHR_get_display_properties2 extension commands + LOOKUP_GIPA(GetPhysicalDeviceDisplayProperties2KHR, false); + LOOKUP_GIPA(GetPhysicalDeviceDisplayPlaneProperties2KHR, false); + LOOKUP_GIPA(GetDisplayModeProperties2KHR, false); + LOOKUP_GIPA(GetDisplayPlaneCapabilities2KHR, false); + + // ---- VK_KHR_fragment_shading_rate extension commands + LOOKUP_GIPA(GetPhysicalDeviceFragmentShadingRatesKHR, false); + + // ---- VK_KHR_object_refresh extension commands + LOOKUP_GIPA(GetPhysicalDeviceRefreshableObjectTypesKHR, false); + + // ---- VK_EXT_direct_mode_display extension commands + LOOKUP_GIPA(ReleaseDisplayEXT, false); + + // ---- VK_EXT_display_surface_counter extension commands + LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilities2EXT, false); + + // ---- VK_EXT_debug_utils extension commands + LOOKUP_GIPA(CreateDebugUtilsMessengerEXT, false); + LOOKUP_GIPA(DestroyDebugUtilsMessengerEXT, false); + LOOKUP_GIPA(SubmitDebugUtilsMessageEXT, false); + + // ---- VK_EXT_sample_locations extension commands + LOOKUP_GIPA(GetPhysicalDeviceMultisamplePropertiesEXT, false); + + // ---- VK_EXT_calibrated_timestamps extension commands + LOOKUP_GIPA(GetPhysicalDeviceCalibrateableTimeDomainsEXT, false); + + // ---- VK_EXT_headless_surface extension commands + LOOKUP_GIPA(CreateHeadlessSurfaceEXT, false); + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + LOOKUP_GIPA(GetPhysicalDeviceSciSyncAttributesNV, false); +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + LOOKUP_GIPA(GetPhysicalDeviceExternalMemorySciBufPropertiesNV, false); +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + LOOKUP_GIPA(GetPhysicalDeviceSciBufAttributesNV, false); +#endif // VK_USE_PLATFORM_SCI + +#undef LOOKUP_GIPA + + return true; +}; + +// Init Device function pointer dispatch table with core commands +VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa, + VkDevice dev) { + VkLayerDispatchTable *table = &dev_table->core_dispatch; + if (table->magic != DEVICE_DISP_TABLE_MAGIC_NUMBER) { abort(); } + for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) dev_table->ext_dispatch[i] = (PFN_vkDevExt)vkDevExtError; + + // ---- Core SC 1_0 commands + table->GetDeviceProcAddr = gpa; + table->DestroyDevice = (PFN_vkDestroyDevice)gpa(dev, "vkDestroyDevice"); + table->GetDeviceQueue = (PFN_vkGetDeviceQueue)gpa(dev, "vkGetDeviceQueue"); + table->QueueSubmit = (PFN_vkQueueSubmit)gpa(dev, "vkQueueSubmit"); + table->QueueWaitIdle = (PFN_vkQueueWaitIdle)gpa(dev, "vkQueueWaitIdle"); + table->DeviceWaitIdle = (PFN_vkDeviceWaitIdle)gpa(dev, "vkDeviceWaitIdle"); + table->AllocateMemory = (PFN_vkAllocateMemory)gpa(dev, "vkAllocateMemory"); + table->MapMemory = (PFN_vkMapMemory)gpa(dev, "vkMapMemory"); + table->UnmapMemory = (PFN_vkUnmapMemory)gpa(dev, "vkUnmapMemory"); + table->FlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges)gpa(dev, "vkFlushMappedMemoryRanges"); + table->InvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges)gpa(dev, "vkInvalidateMappedMemoryRanges"); + table->GetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment)gpa(dev, "vkGetDeviceMemoryCommitment"); + table->BindBufferMemory = (PFN_vkBindBufferMemory)gpa(dev, "vkBindBufferMemory"); + table->BindImageMemory = (PFN_vkBindImageMemory)gpa(dev, "vkBindImageMemory"); + table->GetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)gpa(dev, "vkGetBufferMemoryRequirements"); + table->GetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)gpa(dev, "vkGetImageMemoryRequirements"); + table->CreateFence = (PFN_vkCreateFence)gpa(dev, "vkCreateFence"); + table->DestroyFence = (PFN_vkDestroyFence)gpa(dev, "vkDestroyFence"); + table->ResetFences = (PFN_vkResetFences)gpa(dev, "vkResetFences"); + table->GetFenceStatus = (PFN_vkGetFenceStatus)gpa(dev, "vkGetFenceStatus"); + table->WaitForFences = (PFN_vkWaitForFences)gpa(dev, "vkWaitForFences"); + table->CreateSemaphore = (PFN_vkCreateSemaphore)gpa(dev, "vkCreateSemaphore"); + table->DestroySemaphore = (PFN_vkDestroySemaphore)gpa(dev, "vkDestroySemaphore"); + table->CreateEvent = (PFN_vkCreateEvent)gpa(dev, "vkCreateEvent"); + table->DestroyEvent = (PFN_vkDestroyEvent)gpa(dev, "vkDestroyEvent"); + table->GetEventStatus = (PFN_vkGetEventStatus)gpa(dev, "vkGetEventStatus"); + table->SetEvent = (PFN_vkSetEvent)gpa(dev, "vkSetEvent"); + table->ResetEvent = (PFN_vkResetEvent)gpa(dev, "vkResetEvent"); + table->CreateQueryPool = (PFN_vkCreateQueryPool)gpa(dev, "vkCreateQueryPool"); + table->GetQueryPoolResults = (PFN_vkGetQueryPoolResults)gpa(dev, "vkGetQueryPoolResults"); + table->CreateBuffer = (PFN_vkCreateBuffer)gpa(dev, "vkCreateBuffer"); + table->DestroyBuffer = (PFN_vkDestroyBuffer)gpa(dev, "vkDestroyBuffer"); + table->CreateBufferView = (PFN_vkCreateBufferView)gpa(dev, "vkCreateBufferView"); + table->DestroyBufferView = (PFN_vkDestroyBufferView)gpa(dev, "vkDestroyBufferView"); + table->CreateImage = (PFN_vkCreateImage)gpa(dev, "vkCreateImage"); + table->DestroyImage = (PFN_vkDestroyImage)gpa(dev, "vkDestroyImage"); + table->GetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout)gpa(dev, "vkGetImageSubresourceLayout"); + table->CreateImageView = (PFN_vkCreateImageView)gpa(dev, "vkCreateImageView"); + table->DestroyImageView = (PFN_vkDestroyImageView)gpa(dev, "vkDestroyImageView"); + table->CreatePipelineCache = (PFN_vkCreatePipelineCache)gpa(dev, "vkCreatePipelineCache"); + table->DestroyPipelineCache = (PFN_vkDestroyPipelineCache)gpa(dev, "vkDestroyPipelineCache"); + table->CreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines)gpa(dev, "vkCreateGraphicsPipelines"); + table->CreateComputePipelines = (PFN_vkCreateComputePipelines)gpa(dev, "vkCreateComputePipelines"); + table->DestroyPipeline = (PFN_vkDestroyPipeline)gpa(dev, "vkDestroyPipeline"); + table->CreatePipelineLayout = (PFN_vkCreatePipelineLayout)gpa(dev, "vkCreatePipelineLayout"); + table->DestroyPipelineLayout = (PFN_vkDestroyPipelineLayout)gpa(dev, "vkDestroyPipelineLayout"); + table->CreateSampler = (PFN_vkCreateSampler)gpa(dev, "vkCreateSampler"); + table->DestroySampler = (PFN_vkDestroySampler)gpa(dev, "vkDestroySampler"); + table->CreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout)gpa(dev, "vkCreateDescriptorSetLayout"); + table->DestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout)gpa(dev, "vkDestroyDescriptorSetLayout"); + table->CreateDescriptorPool = (PFN_vkCreateDescriptorPool)gpa(dev, "vkCreateDescriptorPool"); + table->ResetDescriptorPool = (PFN_vkResetDescriptorPool)gpa(dev, "vkResetDescriptorPool"); + table->AllocateDescriptorSets = (PFN_vkAllocateDescriptorSets)gpa(dev, "vkAllocateDescriptorSets"); + table->FreeDescriptorSets = (PFN_vkFreeDescriptorSets)gpa(dev, "vkFreeDescriptorSets"); + table->UpdateDescriptorSets = (PFN_vkUpdateDescriptorSets)gpa(dev, "vkUpdateDescriptorSets"); + table->CreateFramebuffer = (PFN_vkCreateFramebuffer)gpa(dev, "vkCreateFramebuffer"); + table->DestroyFramebuffer = (PFN_vkDestroyFramebuffer)gpa(dev, "vkDestroyFramebuffer"); + table->CreateRenderPass = (PFN_vkCreateRenderPass)gpa(dev, "vkCreateRenderPass"); + table->DestroyRenderPass = (PFN_vkDestroyRenderPass)gpa(dev, "vkDestroyRenderPass"); + table->GetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity)gpa(dev, "vkGetRenderAreaGranularity"); + table->CreateCommandPool = (PFN_vkCreateCommandPool)gpa(dev, "vkCreateCommandPool"); + table->ResetCommandPool = (PFN_vkResetCommandPool)gpa(dev, "vkResetCommandPool"); + table->AllocateCommandBuffers = (PFN_vkAllocateCommandBuffers)gpa(dev, "vkAllocateCommandBuffers"); + table->FreeCommandBuffers = (PFN_vkFreeCommandBuffers)gpa(dev, "vkFreeCommandBuffers"); + table->BeginCommandBuffer = (PFN_vkBeginCommandBuffer)gpa(dev, "vkBeginCommandBuffer"); + table->EndCommandBuffer = (PFN_vkEndCommandBuffer)gpa(dev, "vkEndCommandBuffer"); + table->ResetCommandBuffer = (PFN_vkResetCommandBuffer)gpa(dev, "vkResetCommandBuffer"); + table->CmdBindPipeline = (PFN_vkCmdBindPipeline)gpa(dev, "vkCmdBindPipeline"); + table->CmdSetViewport = (PFN_vkCmdSetViewport)gpa(dev, "vkCmdSetViewport"); + table->CmdSetScissor = (PFN_vkCmdSetScissor)gpa(dev, "vkCmdSetScissor"); + table->CmdSetLineWidth = (PFN_vkCmdSetLineWidth)gpa(dev, "vkCmdSetLineWidth"); + table->CmdSetDepthBias = (PFN_vkCmdSetDepthBias)gpa(dev, "vkCmdSetDepthBias"); + table->CmdSetBlendConstants = (PFN_vkCmdSetBlendConstants)gpa(dev, "vkCmdSetBlendConstants"); + table->CmdSetDepthBounds = (PFN_vkCmdSetDepthBounds)gpa(dev, "vkCmdSetDepthBounds"); + table->CmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask)gpa(dev, "vkCmdSetStencilCompareMask"); + table->CmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask)gpa(dev, "vkCmdSetStencilWriteMask"); + table->CmdSetStencilReference = (PFN_vkCmdSetStencilReference)gpa(dev, "vkCmdSetStencilReference"); + table->CmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets)gpa(dev, "vkCmdBindDescriptorSets"); + table->CmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer)gpa(dev, "vkCmdBindIndexBuffer"); + table->CmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers)gpa(dev, "vkCmdBindVertexBuffers"); + table->CmdDraw = (PFN_vkCmdDraw)gpa(dev, "vkCmdDraw"); + table->CmdDrawIndexed = (PFN_vkCmdDrawIndexed)gpa(dev, "vkCmdDrawIndexed"); + table->CmdDrawIndirect = (PFN_vkCmdDrawIndirect)gpa(dev, "vkCmdDrawIndirect"); + table->CmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect)gpa(dev, "vkCmdDrawIndexedIndirect"); + table->CmdDispatch = (PFN_vkCmdDispatch)gpa(dev, "vkCmdDispatch"); + table->CmdDispatchIndirect = (PFN_vkCmdDispatchIndirect)gpa(dev, "vkCmdDispatchIndirect"); + table->CmdCopyBuffer = (PFN_vkCmdCopyBuffer)gpa(dev, "vkCmdCopyBuffer"); + table->CmdCopyImage = (PFN_vkCmdCopyImage)gpa(dev, "vkCmdCopyImage"); + table->CmdBlitImage = (PFN_vkCmdBlitImage)gpa(dev, "vkCmdBlitImage"); + table->CmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage)gpa(dev, "vkCmdCopyBufferToImage"); + table->CmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer)gpa(dev, "vkCmdCopyImageToBuffer"); + table->CmdUpdateBuffer = (PFN_vkCmdUpdateBuffer)gpa(dev, "vkCmdUpdateBuffer"); + table->CmdFillBuffer = (PFN_vkCmdFillBuffer)gpa(dev, "vkCmdFillBuffer"); + table->CmdClearColorImage = (PFN_vkCmdClearColorImage)gpa(dev, "vkCmdClearColorImage"); + table->CmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage)gpa(dev, "vkCmdClearDepthStencilImage"); + table->CmdClearAttachments = (PFN_vkCmdClearAttachments)gpa(dev, "vkCmdClearAttachments"); + table->CmdResolveImage = (PFN_vkCmdResolveImage)gpa(dev, "vkCmdResolveImage"); + table->CmdSetEvent = (PFN_vkCmdSetEvent)gpa(dev, "vkCmdSetEvent"); + table->CmdResetEvent = (PFN_vkCmdResetEvent)gpa(dev, "vkCmdResetEvent"); + table->CmdWaitEvents = (PFN_vkCmdWaitEvents)gpa(dev, "vkCmdWaitEvents"); + table->CmdPipelineBarrier = (PFN_vkCmdPipelineBarrier)gpa(dev, "vkCmdPipelineBarrier"); + table->CmdBeginQuery = (PFN_vkCmdBeginQuery)gpa(dev, "vkCmdBeginQuery"); + table->CmdEndQuery = (PFN_vkCmdEndQuery)gpa(dev, "vkCmdEndQuery"); + table->CmdResetQueryPool = (PFN_vkCmdResetQueryPool)gpa(dev, "vkCmdResetQueryPool"); + table->CmdWriteTimestamp = (PFN_vkCmdWriteTimestamp)gpa(dev, "vkCmdWriteTimestamp"); + table->CmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults)gpa(dev, "vkCmdCopyQueryPoolResults"); + table->CmdPushConstants = (PFN_vkCmdPushConstants)gpa(dev, "vkCmdPushConstants"); + table->CmdBeginRenderPass = (PFN_vkCmdBeginRenderPass)gpa(dev, "vkCmdBeginRenderPass"); + table->CmdNextSubpass = (PFN_vkCmdNextSubpass)gpa(dev, "vkCmdNextSubpass"); + table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass)gpa(dev, "vkCmdEndRenderPass"); + table->CmdExecuteCommands = (PFN_vkCmdExecuteCommands)gpa(dev, "vkCmdExecuteCommands"); + table->BindBufferMemory2 = (PFN_vkBindBufferMemory2)gpa(dev, "vkBindBufferMemory2"); + table->BindImageMemory2 = (PFN_vkBindImageMemory2)gpa(dev, "vkBindImageMemory2"); + table->GetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures)gpa(dev, "vkGetDeviceGroupPeerMemoryFeatures"); + table->CmdSetDeviceMask = (PFN_vkCmdSetDeviceMask)gpa(dev, "vkCmdSetDeviceMask"); + table->CmdDispatchBase = (PFN_vkCmdDispatchBase)gpa(dev, "vkCmdDispatchBase"); + table->GetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2)gpa(dev, "vkGetImageMemoryRequirements2"); + table->GetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2)gpa(dev, "vkGetBufferMemoryRequirements2"); + table->GetDeviceQueue2 = (PFN_vkGetDeviceQueue2)gpa(dev, "vkGetDeviceQueue2"); + table->CreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion)gpa(dev, "vkCreateSamplerYcbcrConversion"); + table->DestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion)gpa(dev, "vkDestroySamplerYcbcrConversion"); + table->GetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport)gpa(dev, "vkGetDescriptorSetLayoutSupport"); + table->CmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount)gpa(dev, "vkCmdDrawIndirectCount"); + table->CmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount)gpa(dev, "vkCmdDrawIndexedIndirectCount"); + table->CreateRenderPass2 = (PFN_vkCreateRenderPass2)gpa(dev, "vkCreateRenderPass2"); + table->CmdBeginRenderPass2 = (PFN_vkCmdBeginRenderPass2)gpa(dev, "vkCmdBeginRenderPass2"); + table->CmdNextSubpass2 = (PFN_vkCmdNextSubpass2)gpa(dev, "vkCmdNextSubpass2"); + table->CmdEndRenderPass2 = (PFN_vkCmdEndRenderPass2)gpa(dev, "vkCmdEndRenderPass2"); + table->ResetQueryPool = (PFN_vkResetQueryPool)gpa(dev, "vkResetQueryPool"); + table->GetSemaphoreCounterValue = (PFN_vkGetSemaphoreCounterValue)gpa(dev, "vkGetSemaphoreCounterValue"); + table->WaitSemaphores = (PFN_vkWaitSemaphores)gpa(dev, "vkWaitSemaphores"); + table->SignalSemaphore = (PFN_vkSignalSemaphore)gpa(dev, "vkSignalSemaphore"); + table->GetBufferDeviceAddress = (PFN_vkGetBufferDeviceAddress)gpa(dev, "vkGetBufferDeviceAddress"); + table->GetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress)gpa(dev, "vkGetBufferOpaqueCaptureAddress"); + table->GetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress)gpa(dev, "vkGetDeviceMemoryOpaqueCaptureAddress"); + table->GetCommandPoolMemoryConsumption = (PFN_vkGetCommandPoolMemoryConsumption)gpa(dev, "vkGetCommandPoolMemoryConsumption"); + table->GetFaultData = (PFN_vkGetFaultData)gpa(dev, "vkGetFaultData"); +} + +// Init Device function pointer dispatch table with extension commands +VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct loader_dev_dispatch_table *dev_table, + PFN_vkGetInstanceProcAddr gipa, + PFN_vkGetDeviceProcAddr gdpa, + VkInstance inst, + VkDevice dev) { + VkLayerDispatchTable *table = &dev_table->core_dispatch; + table->magic = DEVICE_DISP_TABLE_MAGIC_NUMBER; + + // ---- VK_KHR_swapchain extension commands + table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gdpa(dev, "vkCreateSwapchainKHR"); + table->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)gdpa(dev, "vkGetSwapchainImagesKHR"); + table->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gdpa(dev, "vkAcquireNextImageKHR"); + table->QueuePresentKHR = (PFN_vkQueuePresentKHR)gdpa(dev, "vkQueuePresentKHR"); + table->GetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR)gdpa(dev, "vkGetDeviceGroupPresentCapabilitiesKHR"); + table->GetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR)gdpa(dev, "vkGetDeviceGroupSurfacePresentModesKHR"); + table->AcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR)gdpa(dev, "vkAcquireNextImage2KHR"); + + // ---- VK_KHR_display_swapchain extension commands + table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gdpa(dev, "vkCreateSharedSwapchainsKHR"); + + // ---- VK_KHR_external_memory_fd extension commands + table->GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)gdpa(dev, "vkGetMemoryFdKHR"); + table->GetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHR)gdpa(dev, "vkGetMemoryFdPropertiesKHR"); + + // ---- VK_KHR_external_semaphore_fd extension commands + table->ImportSemaphoreFdKHR = (PFN_vkImportSemaphoreFdKHR)gdpa(dev, "vkImportSemaphoreFdKHR"); + table->GetSemaphoreFdKHR = (PFN_vkGetSemaphoreFdKHR)gdpa(dev, "vkGetSemaphoreFdKHR"); + + // ---- VK_KHR_shared_presentable_image extension commands + table->GetSwapchainStatusKHR = (PFN_vkGetSwapchainStatusKHR)gdpa(dev, "vkGetSwapchainStatusKHR"); + + // ---- VK_KHR_external_fence_fd extension commands + table->ImportFenceFdKHR = (PFN_vkImportFenceFdKHR)gdpa(dev, "vkImportFenceFdKHR"); + table->GetFenceFdKHR = (PFN_vkGetFenceFdKHR)gdpa(dev, "vkGetFenceFdKHR"); + + // ---- VK_KHR_performance_query extension commands + table->AcquireProfilingLockKHR = (PFN_vkAcquireProfilingLockKHR)gdpa(dev, "vkAcquireProfilingLockKHR"); + table->ReleaseProfilingLockKHR = (PFN_vkReleaseProfilingLockKHR)gdpa(dev, "vkReleaseProfilingLockKHR"); + + // ---- VK_KHR_fragment_shading_rate extension commands + table->CmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR)gdpa(dev, "vkCmdSetFragmentShadingRateKHR"); + + // ---- VK_KHR_object_refresh extension commands + table->CmdRefreshObjectsKHR = (PFN_vkCmdRefreshObjectsKHR)gdpa(dev, "vkCmdRefreshObjectsKHR"); + + // ---- VK_KHR_synchronization2 extension commands + table->CmdSetEvent2KHR = (PFN_vkCmdSetEvent2KHR)gdpa(dev, "vkCmdSetEvent2KHR"); + table->CmdResetEvent2KHR = (PFN_vkCmdResetEvent2KHR)gdpa(dev, "vkCmdResetEvent2KHR"); + table->CmdWaitEvents2KHR = (PFN_vkCmdWaitEvents2KHR)gdpa(dev, "vkCmdWaitEvents2KHR"); + table->CmdPipelineBarrier2KHR = (PFN_vkCmdPipelineBarrier2KHR)gdpa(dev, "vkCmdPipelineBarrier2KHR"); + table->CmdWriteTimestamp2KHR = (PFN_vkCmdWriteTimestamp2KHR)gdpa(dev, "vkCmdWriteTimestamp2KHR"); + table->QueueSubmit2KHR = (PFN_vkQueueSubmit2KHR)gdpa(dev, "vkQueueSubmit2KHR"); + table->CmdWriteBufferMarker2AMD = (PFN_vkCmdWriteBufferMarker2AMD)gdpa(dev, "vkCmdWriteBufferMarker2AMD"); + table->GetQueueCheckpointData2NV = (PFN_vkGetQueueCheckpointData2NV)gdpa(dev, "vkGetQueueCheckpointData2NV"); + + // ---- VK_KHR_copy_commands2 extension commands + table->CmdCopyBuffer2KHR = (PFN_vkCmdCopyBuffer2KHR)gdpa(dev, "vkCmdCopyBuffer2KHR"); + table->CmdCopyImage2KHR = (PFN_vkCmdCopyImage2KHR)gdpa(dev, "vkCmdCopyImage2KHR"); + table->CmdCopyBufferToImage2KHR = (PFN_vkCmdCopyBufferToImage2KHR)gdpa(dev, "vkCmdCopyBufferToImage2KHR"); + table->CmdCopyImageToBuffer2KHR = (PFN_vkCmdCopyImageToBuffer2KHR)gdpa(dev, "vkCmdCopyImageToBuffer2KHR"); + table->CmdBlitImage2KHR = (PFN_vkCmdBlitImage2KHR)gdpa(dev, "vkCmdBlitImage2KHR"); + table->CmdResolveImage2KHR = (PFN_vkCmdResolveImage2KHR)gdpa(dev, "vkCmdResolveImage2KHR"); + + // ---- VK_EXT_display_control extension commands + table->DisplayPowerControlEXT = (PFN_vkDisplayPowerControlEXT)gdpa(dev, "vkDisplayPowerControlEXT"); + table->RegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT)gdpa(dev, "vkRegisterDeviceEventEXT"); + table->RegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT)gdpa(dev, "vkRegisterDisplayEventEXT"); + table->GetSwapchainCounterEXT = (PFN_vkGetSwapchainCounterEXT)gdpa(dev, "vkGetSwapchainCounterEXT"); + + // ---- VK_EXT_discard_rectangles extension commands + table->CmdSetDiscardRectangleEXT = (PFN_vkCmdSetDiscardRectangleEXT)gdpa(dev, "vkCmdSetDiscardRectangleEXT"); + table->CmdSetDiscardRectangleEnableEXT = (PFN_vkCmdSetDiscardRectangleEnableEXT)gdpa(dev, "vkCmdSetDiscardRectangleEnableEXT"); + table->CmdSetDiscardRectangleModeEXT = (PFN_vkCmdSetDiscardRectangleModeEXT)gdpa(dev, "vkCmdSetDiscardRectangleModeEXT"); + + // ---- VK_EXT_hdr_metadata extension commands + table->SetHdrMetadataEXT = (PFN_vkSetHdrMetadataEXT)gdpa(dev, "vkSetHdrMetadataEXT"); + + // ---- VK_EXT_debug_utils extension commands + table->SetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)gipa(inst, "vkSetDebugUtilsObjectNameEXT"); + table->SetDebugUtilsObjectTagEXT = (PFN_vkSetDebugUtilsObjectTagEXT)gipa(inst, "vkSetDebugUtilsObjectTagEXT"); + table->QueueBeginDebugUtilsLabelEXT = (PFN_vkQueueBeginDebugUtilsLabelEXT)gipa(inst, "vkQueueBeginDebugUtilsLabelEXT"); + table->QueueEndDebugUtilsLabelEXT = (PFN_vkQueueEndDebugUtilsLabelEXT)gipa(inst, "vkQueueEndDebugUtilsLabelEXT"); + table->QueueInsertDebugUtilsLabelEXT = (PFN_vkQueueInsertDebugUtilsLabelEXT)gipa(inst, "vkQueueInsertDebugUtilsLabelEXT"); + table->CmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)gipa(inst, "vkCmdBeginDebugUtilsLabelEXT"); + table->CmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)gipa(inst, "vkCmdEndDebugUtilsLabelEXT"); + table->CmdInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT)gipa(inst, "vkCmdInsertDebugUtilsLabelEXT"); + + // ---- VK_EXT_sample_locations extension commands + table->CmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)gdpa(dev, "vkCmdSetSampleLocationsEXT"); + + // ---- VK_EXT_image_drm_format_modifier extension commands + table->GetImageDrmFormatModifierPropertiesEXT = (PFN_vkGetImageDrmFormatModifierPropertiesEXT)gdpa(dev, "vkGetImageDrmFormatModifierPropertiesEXT"); + + // ---- VK_EXT_external_memory_host extension commands + table->GetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT)gdpa(dev, "vkGetMemoryHostPointerPropertiesEXT"); + + // ---- VK_EXT_calibrated_timestamps extension commands + table->GetCalibratedTimestampsEXT = (PFN_vkGetCalibratedTimestampsEXT)gdpa(dev, "vkGetCalibratedTimestampsEXT"); + + // ---- VK_EXT_line_rasterization extension commands + table->CmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)gdpa(dev, "vkCmdSetLineStippleEXT"); + + // ---- VK_EXT_extended_dynamic_state extension commands + table->CmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)gdpa(dev, "vkCmdSetCullModeEXT"); + table->CmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)gdpa(dev, "vkCmdSetFrontFaceEXT"); + table->CmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)gdpa(dev, "vkCmdSetPrimitiveTopologyEXT"); + table->CmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)gdpa(dev, "vkCmdSetViewportWithCountEXT"); + table->CmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)gdpa(dev, "vkCmdSetScissorWithCountEXT"); + table->CmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)gdpa(dev, "vkCmdBindVertexBuffers2EXT"); + table->CmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)gdpa(dev, "vkCmdSetDepthTestEnableEXT"); + table->CmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)gdpa(dev, "vkCmdSetDepthWriteEnableEXT"); + table->CmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)gdpa(dev, "vkCmdSetDepthCompareOpEXT"); + table->CmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)gdpa(dev, "vkCmdSetDepthBoundsTestEnableEXT"); + table->CmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)gdpa(dev, "vkCmdSetStencilTestEnableEXT"); + table->CmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)gdpa(dev, "vkCmdSetStencilOpEXT"); + + // ---- VK_EXT_vertex_input_dynamic_state extension commands + table->CmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)gdpa(dev, "vkCmdSetVertexInputEXT"); + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + table->GetFenceSciSyncFenceNV = (PFN_vkGetFenceSciSyncFenceNV)gdpa(dev, "vkGetFenceSciSyncFenceNV"); +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + table->GetFenceSciSyncObjNV = (PFN_vkGetFenceSciSyncObjNV)gdpa(dev, "vkGetFenceSciSyncObjNV"); +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + table->ImportFenceSciSyncFenceNV = (PFN_vkImportFenceSciSyncFenceNV)gdpa(dev, "vkImportFenceSciSyncFenceNV"); +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + table->ImportFenceSciSyncObjNV = (PFN_vkImportFenceSciSyncObjNV)gdpa(dev, "vkImportFenceSciSyncObjNV"); +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + table->GetSemaphoreSciSyncObjNV = (PFN_vkGetSemaphoreSciSyncObjNV)gdpa(dev, "vkGetSemaphoreSciSyncObjNV"); +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + table->ImportSemaphoreSciSyncObjNV = (PFN_vkImportSemaphoreSciSyncObjNV)gdpa(dev, "vkImportSemaphoreSciSyncObjNV"); +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + table->GetMemorySciBufNV = (PFN_vkGetMemorySciBufNV)gdpa(dev, "vkGetMemorySciBufNV"); +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_EXT_extended_dynamic_state2 extension commands + table->CmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT)gdpa(dev, "vkCmdSetPatchControlPointsEXT"); + table->CmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT)gdpa(dev, "vkCmdSetRasterizerDiscardEnableEXT"); + table->CmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT)gdpa(dev, "vkCmdSetDepthBiasEnableEXT"); + table->CmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT)gdpa(dev, "vkCmdSetLogicOpEXT"); + table->CmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT)gdpa(dev, "vkCmdSetPrimitiveRestartEnableEXT"); + + // ---- VK_EXT_color_write_enable extension commands + table->CmdSetColorWriteEnableEXT = (PFN_vkCmdSetColorWriteEnableEXT)gdpa(dev, "vkCmdSetColorWriteEnableEXT"); + + // ---- VK_NV_external_sci_sync2 extension commands +#if defined(VK_USE_PLATFORM_SCI) + table->CreateSemaphoreSciSyncPoolNV = (PFN_vkCreateSemaphoreSciSyncPoolNV)gdpa(dev, "vkCreateSemaphoreSciSyncPoolNV"); +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_QNX_external_memory_screen_buffer extension commands +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + table->GetScreenBufferPropertiesQNX = (PFN_vkGetScreenBufferPropertiesQNX)gdpa(dev, "vkGetScreenBufferPropertiesQNX"); +#endif // VK_USE_PLATFORM_SCREEN_QNX +} + +// Init Instance function pointer dispatch table with core commands +VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, + VkInstance inst) { + + // ---- Core SC 1_0 commands + table->DestroyInstance = (PFN_vkDestroyInstance)gpa(inst, "vkDestroyInstance"); + table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices)gpa(inst, "vkEnumeratePhysicalDevices"); + table->GetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures)gpa(inst, "vkGetPhysicalDeviceFeatures"); + table->GetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties)gpa(inst, "vkGetPhysicalDeviceFormatProperties"); + table->GetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties)gpa(inst, "vkGetPhysicalDeviceImageFormatProperties"); + table->GetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)gpa(inst, "vkGetPhysicalDeviceProperties"); + table->GetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties)gpa(inst, "vkGetPhysicalDeviceQueueFamilyProperties"); + table->GetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties)gpa(inst, "vkGetPhysicalDeviceMemoryProperties"); + table->GetInstanceProcAddr = gpa; + table->EnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties)gpa(inst, "vkEnumerateDeviceExtensionProperties"); + table->EnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties)gpa(inst, "vkEnumerateDeviceLayerProperties"); + table->EnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups)gpa(inst, "vkEnumeratePhysicalDeviceGroups"); + table->GetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2)gpa(inst, "vkGetPhysicalDeviceFeatures2"); + table->GetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2)gpa(inst, "vkGetPhysicalDeviceProperties2"); + table->GetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2)gpa(inst, "vkGetPhysicalDeviceFormatProperties2"); + table->GetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2)gpa(inst, "vkGetPhysicalDeviceImageFormatProperties2"); + table->GetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2)gpa(inst, "vkGetPhysicalDeviceQueueFamilyProperties2"); + table->GetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2)gpa(inst, "vkGetPhysicalDeviceMemoryProperties2"); + table->GetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties)gpa(inst, "vkGetPhysicalDeviceExternalBufferProperties"); + table->GetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties)gpa(inst, "vkGetPhysicalDeviceExternalFenceProperties"); + table->GetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)gpa(inst, "vkGetPhysicalDeviceExternalSemaphoreProperties"); +} + +// Init Instance function pointer dispatch table with core commands +VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, + VkInstance inst) { + + // ---- VK_KHR_surface extension commands + table->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)gpa(inst, "vkDestroySurfaceKHR"); + table->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(inst, "vkGetPhysicalDeviceSurfaceSupportKHR"); + table->GetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(inst, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); + table->GetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(inst, "vkGetPhysicalDeviceSurfaceFormatsKHR"); + table->GetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(inst, "vkGetPhysicalDeviceSurfacePresentModesKHR"); + + // ---- VK_KHR_swapchain extension commands + table->GetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR)gpa(inst, "vkGetPhysicalDevicePresentRectanglesKHR"); + + // ---- VK_KHR_display extension commands + table->GetPhysicalDeviceDisplayPropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa(inst, "vkGetPhysicalDeviceDisplayPropertiesKHR"); + table->GetPhysicalDeviceDisplayPlanePropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)gpa(inst, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + table->GetDisplayPlaneSupportedDisplaysKHR = (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)gpa(inst, "vkGetDisplayPlaneSupportedDisplaysKHR"); + table->GetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR)gpa(inst, "vkGetDisplayModePropertiesKHR"); + table->CreateDisplayModeKHR = (PFN_vkCreateDisplayModeKHR)gpa(inst, "vkCreateDisplayModeKHR"); + table->GetDisplayPlaneCapabilitiesKHR = (PFN_vkGetDisplayPlaneCapabilitiesKHR)gpa(inst, "vkGetDisplayPlaneCapabilitiesKHR"); + table->CreateDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR)gpa(inst, "vkCreateDisplayPlaneSurfaceKHR"); + + // ---- VK_KHR_performance_query extension commands + table->EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR = (PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR)gpa(inst, "vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR"); + table->GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR = (PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR)gpa(inst, "vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR"); + + // ---- VK_KHR_get_surface_capabilities2 extension commands + table->GetPhysicalDeviceSurfaceCapabilities2KHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)gpa(inst, "vkGetPhysicalDeviceSurfaceCapabilities2KHR"); + table->GetPhysicalDeviceSurfaceFormats2KHR = (PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)gpa(inst, "vkGetPhysicalDeviceSurfaceFormats2KHR"); + + // ---- VK_KHR_get_display_properties2 extension commands + table->GetPhysicalDeviceDisplayProperties2KHR = (PFN_vkGetPhysicalDeviceDisplayProperties2KHR)gpa(inst, "vkGetPhysicalDeviceDisplayProperties2KHR"); + table->GetPhysicalDeviceDisplayPlaneProperties2KHR = (PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR)gpa(inst, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR"); + table->GetDisplayModeProperties2KHR = (PFN_vkGetDisplayModeProperties2KHR)gpa(inst, "vkGetDisplayModeProperties2KHR"); + table->GetDisplayPlaneCapabilities2KHR = (PFN_vkGetDisplayPlaneCapabilities2KHR)gpa(inst, "vkGetDisplayPlaneCapabilities2KHR"); + + // ---- VK_KHR_fragment_shading_rate extension commands + table->GetPhysicalDeviceFragmentShadingRatesKHR = (PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR)gpa(inst, "vkGetPhysicalDeviceFragmentShadingRatesKHR"); + + // ---- VK_KHR_object_refresh extension commands + table->GetPhysicalDeviceRefreshableObjectTypesKHR = (PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR)gpa(inst, "vkGetPhysicalDeviceRefreshableObjectTypesKHR"); + + // ---- VK_EXT_direct_mode_display extension commands + table->ReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT)gpa(inst, "vkReleaseDisplayEXT"); + + // ---- VK_EXT_display_surface_counter extension commands + table->GetPhysicalDeviceSurfaceCapabilities2EXT = (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)gpa(inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); + + // ---- VK_EXT_debug_utils extension commands + table->CreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT)gpa(inst, "vkCreateDebugUtilsMessengerEXT"); + table->DestroyDebugUtilsMessengerEXT = (PFN_vkDestroyDebugUtilsMessengerEXT)gpa(inst, "vkDestroyDebugUtilsMessengerEXT"); + table->SubmitDebugUtilsMessageEXT = (PFN_vkSubmitDebugUtilsMessageEXT)gpa(inst, "vkSubmitDebugUtilsMessageEXT"); + + // ---- VK_EXT_sample_locations extension commands + table->GetPhysicalDeviceMultisamplePropertiesEXT = (PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT)gpa(inst, "vkGetPhysicalDeviceMultisamplePropertiesEXT"); + + // ---- VK_EXT_calibrated_timestamps extension commands + table->GetPhysicalDeviceCalibrateableTimeDomainsEXT = (PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT)gpa(inst, "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT"); + + // ---- VK_EXT_headless_surface extension commands + table->CreateHeadlessSurfaceEXT = (PFN_vkCreateHeadlessSurfaceEXT)gpa(inst, "vkCreateHeadlessSurfaceEXT"); + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + table->GetPhysicalDeviceSciSyncAttributesNV = (PFN_vkGetPhysicalDeviceSciSyncAttributesNV)gpa(inst, "vkGetPhysicalDeviceSciSyncAttributesNV"); +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + table->GetPhysicalDeviceExternalMemorySciBufPropertiesNV = (PFN_vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV)gpa(inst, "vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV"); +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + table->GetPhysicalDeviceSciBufAttributesNV = (PFN_vkGetPhysicalDeviceSciBufAttributesNV)gpa(inst, "vkGetPhysicalDeviceSciBufAttributesNV"); +#endif // VK_USE_PLATFORM_SCI +} + +// Functions that required a terminator need to have a separate dispatch table which contains their corresponding +// device function. This is used in the terminators themselves. +void init_extension_device_proc_terminator_dispatch(struct loader_device *dev) { + struct loader_device_terminator_dispatch* dispatch = &dev->loader_dispatch.extension_terminator_dispatch; + PFN_vkGetDeviceProcAddr gpda = (PFN_vkGetDeviceProcAddr)dev->phys_dev_term->this_icd_term->dispatch.GetDeviceProcAddr; + // ---- VK_KHR_swapchain extension commands + if (dev->driver_extensions.khr_swapchain_enabled) + dispatch->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpda(dev->icd_device, "vkCreateSwapchainKHR"); + if (dev->driver_extensions.khr_swapchain_enabled) + dispatch->GetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR)gpda(dev->icd_device, "vkGetDeviceGroupSurfacePresentModesKHR"); + // ---- VK_KHR_display_swapchain extension commands + if (dev->driver_extensions.khr_display_swapchain_enabled) + dispatch->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gpda(dev->icd_device, "vkCreateSharedSwapchainsKHR"); + // ---- VK_EXT_debug_utils extension commands + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->SetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)gpda(dev->icd_device, "vkSetDebugUtilsObjectNameEXT"); + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->SetDebugUtilsObjectTagEXT = (PFN_vkSetDebugUtilsObjectTagEXT)gpda(dev->icd_device, "vkSetDebugUtilsObjectTagEXT"); + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->QueueBeginDebugUtilsLabelEXT = (PFN_vkQueueBeginDebugUtilsLabelEXT)gpda(dev->icd_device, "vkQueueBeginDebugUtilsLabelEXT"); + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->QueueEndDebugUtilsLabelEXT = (PFN_vkQueueEndDebugUtilsLabelEXT)gpda(dev->icd_device, "vkQueueEndDebugUtilsLabelEXT"); + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->QueueInsertDebugUtilsLabelEXT = (PFN_vkQueueInsertDebugUtilsLabelEXT)gpda(dev->icd_device, "vkQueueInsertDebugUtilsLabelEXT"); + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->CmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)gpda(dev->icd_device, "vkCmdBeginDebugUtilsLabelEXT"); + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->CmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)gpda(dev->icd_device, "vkCmdEndDebugUtilsLabelEXT"); + if (dev->driver_extensions.ext_debug_utils_enabled) + dispatch->CmdInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT)gpda(dev->icd_device, "vkCmdInsertDebugUtilsLabelEXT"); +} + +// These are prototypes for functions that need their trampoline called in all circumstances. +// They are used in loader_lookup_device_dispatch_table but are defined afterwards. + // ---- VK_EXT_debug_utils extension commands +VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectNameEXT( + VkDevice device, + const VkDebugUtilsObjectNameInfoEXT* pNameInfo); +VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectTagEXT( + VkDevice device, + const VkDebugUtilsObjectTagInfoEXT* pTagInfo); + +// Device command lookup function +VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name, bool* found_name) { + if (!name || name[0] != 'v' || name[1] != 'k') { + *found_name = false; + return NULL; + } + + name += 2; + *found_name = true; + struct loader_device* dev = (struct loader_device *)table; + const struct loader_instance* inst = dev->phys_dev_term->this_icd_term->this_instance; + uint32_t api_version = VK_MAKE_API_VERSION(0, inst->app_api_version.major, inst->app_api_version.minor, inst->app_api_version.patch); + + + // ---- Core SC 1_0 commands + if (!strcmp(name, "GetDeviceProcAddr")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetDeviceProcAddr; + } + if (!strcmp(name, "DestroyDevice")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyDevice; + } + if (!strcmp(name, "GetDeviceQueue")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetDeviceQueue; + } + if (!strcmp(name, "QueueSubmit")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->QueueSubmit; + } + if (!strcmp(name, "QueueWaitIdle")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->QueueWaitIdle; + } + if (!strcmp(name, "DeviceWaitIdle")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DeviceWaitIdle; + } + if (!strcmp(name, "AllocateMemory")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->AllocateMemory; + } + if (!strcmp(name, "MapMemory")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->MapMemory; + } + if (!strcmp(name, "UnmapMemory")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->UnmapMemory; + } + if (!strcmp(name, "FlushMappedMemoryRanges")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->FlushMappedMemoryRanges; + } + if (!strcmp(name, "InvalidateMappedMemoryRanges")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->InvalidateMappedMemoryRanges; + } + if (!strcmp(name, "GetDeviceMemoryCommitment")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetDeviceMemoryCommitment; + } + if (!strcmp(name, "BindBufferMemory")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->BindBufferMemory; + } + if (!strcmp(name, "BindImageMemory")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->BindImageMemory; + } + if (!strcmp(name, "GetBufferMemoryRequirements")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetBufferMemoryRequirements; + } + if (!strcmp(name, "GetImageMemoryRequirements")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetImageMemoryRequirements; + } + if (!strcmp(name, "CreateFence")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateFence; + } + if (!strcmp(name, "DestroyFence")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyFence; + } + if (!strcmp(name, "ResetFences")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->ResetFences; + } + if (!strcmp(name, "GetFenceStatus")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetFenceStatus; + } + if (!strcmp(name, "WaitForFences")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->WaitForFences; + } + if (!strcmp(name, "CreateSemaphore")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateSemaphore; + } + if (!strcmp(name, "DestroySemaphore")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroySemaphore; + } + if (!strcmp(name, "CreateEvent")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateEvent; + } + if (!strcmp(name, "DestroyEvent")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyEvent; + } + if (!strcmp(name, "GetEventStatus")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetEventStatus; + } + if (!strcmp(name, "SetEvent")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->SetEvent; + } + if (!strcmp(name, "ResetEvent")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->ResetEvent; + } + if (!strcmp(name, "CreateQueryPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateQueryPool; + } + if (!strcmp(name, "GetQueryPoolResults")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetQueryPoolResults; + } + if (!strcmp(name, "CreateBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateBuffer; + } + if (!strcmp(name, "DestroyBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyBuffer; + } + if (!strcmp(name, "CreateBufferView")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateBufferView; + } + if (!strcmp(name, "DestroyBufferView")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyBufferView; + } + if (!strcmp(name, "CreateImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateImage; + } + if (!strcmp(name, "DestroyImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyImage; + } + if (!strcmp(name, "GetImageSubresourceLayout")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetImageSubresourceLayout; + } + if (!strcmp(name, "CreateImageView")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateImageView; + } + if (!strcmp(name, "DestroyImageView")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyImageView; + } + if (!strcmp(name, "CreatePipelineCache")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreatePipelineCache; + } + if (!strcmp(name, "DestroyPipelineCache")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyPipelineCache; + } + if (!strcmp(name, "CreateGraphicsPipelines")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateGraphicsPipelines; + } + if (!strcmp(name, "CreateComputePipelines")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateComputePipelines; + } + if (!strcmp(name, "DestroyPipeline")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyPipeline; + } + if (!strcmp(name, "CreatePipelineLayout")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreatePipelineLayout; + } + if (!strcmp(name, "DestroyPipelineLayout")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyPipelineLayout; + } + if (!strcmp(name, "CreateSampler")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateSampler; + } + if (!strcmp(name, "DestroySampler")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroySampler; + } + if (!strcmp(name, "CreateDescriptorSetLayout")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateDescriptorSetLayout; + } + if (!strcmp(name, "DestroyDescriptorSetLayout")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyDescriptorSetLayout; + } + if (!strcmp(name, "CreateDescriptorPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateDescriptorPool; + } + if (!strcmp(name, "ResetDescriptorPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->ResetDescriptorPool; + } + if (!strcmp(name, "AllocateDescriptorSets")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->AllocateDescriptorSets; + } + if (!strcmp(name, "FreeDescriptorSets")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->FreeDescriptorSets; + } + if (!strcmp(name, "UpdateDescriptorSets")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->UpdateDescriptorSets; + } + if (!strcmp(name, "CreateFramebuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateFramebuffer; + } + if (!strcmp(name, "DestroyFramebuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyFramebuffer; + } + if (!strcmp(name, "CreateRenderPass")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateRenderPass; + } + if (!strcmp(name, "DestroyRenderPass")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyRenderPass; + } + if (!strcmp(name, "GetRenderAreaGranularity")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetRenderAreaGranularity; + } + if (!strcmp(name, "CreateCommandPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateCommandPool; + } + if (!strcmp(name, "ResetCommandPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->ResetCommandPool; + } + if (!strcmp(name, "AllocateCommandBuffers")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->AllocateCommandBuffers; + } + if (!strcmp(name, "FreeCommandBuffers")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->FreeCommandBuffers; + } + if (!strcmp(name, "BeginCommandBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->BeginCommandBuffer; + } + if (!strcmp(name, "EndCommandBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->EndCommandBuffer; + } + if (!strcmp(name, "ResetCommandBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->ResetCommandBuffer; + } + if (!strcmp(name, "CmdBindPipeline")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBindPipeline; + } + if (!strcmp(name, "CmdSetViewport")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetViewport; + } + if (!strcmp(name, "CmdSetScissor")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetScissor; + } + if (!strcmp(name, "CmdSetLineWidth")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetLineWidth; + } + if (!strcmp(name, "CmdSetDepthBias")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetDepthBias; + } + if (!strcmp(name, "CmdSetBlendConstants")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetBlendConstants; + } + if (!strcmp(name, "CmdSetDepthBounds")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetDepthBounds; + } + if (!strcmp(name, "CmdSetStencilCompareMask")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetStencilCompareMask; + } + if (!strcmp(name, "CmdSetStencilWriteMask")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetStencilWriteMask; + } + if (!strcmp(name, "CmdSetStencilReference")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetStencilReference; + } + if (!strcmp(name, "CmdBindDescriptorSets")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBindDescriptorSets; + } + if (!strcmp(name, "CmdBindIndexBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBindIndexBuffer; + } + if (!strcmp(name, "CmdBindVertexBuffers")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBindVertexBuffers; + } + if (!strcmp(name, "CmdDraw")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDraw; + } + if (!strcmp(name, "CmdDrawIndexed")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDrawIndexed; + } + if (!strcmp(name, "CmdDrawIndirect")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDrawIndirect; + } + if (!strcmp(name, "CmdDrawIndexedIndirect")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDrawIndexedIndirect; + } + if (!strcmp(name, "CmdDispatch")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDispatch; + } + if (!strcmp(name, "CmdDispatchIndirect")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDispatchIndirect; + } + if (!strcmp(name, "CmdCopyBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdCopyBuffer; + } + if (!strcmp(name, "CmdCopyImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdCopyImage; + } + if (!strcmp(name, "CmdBlitImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBlitImage; + } + if (!strcmp(name, "CmdCopyBufferToImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdCopyBufferToImage; + } + if (!strcmp(name, "CmdCopyImageToBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdCopyImageToBuffer; + } + if (!strcmp(name, "CmdUpdateBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdUpdateBuffer; + } + if (!strcmp(name, "CmdFillBuffer")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdFillBuffer; + } + if (!strcmp(name, "CmdClearColorImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdClearColorImage; + } + if (!strcmp(name, "CmdClearDepthStencilImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdClearDepthStencilImage; + } + if (!strcmp(name, "CmdClearAttachments")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdClearAttachments; + } + if (!strcmp(name, "CmdResolveImage")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdResolveImage; + } + if (!strcmp(name, "CmdSetEvent")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetEvent; + } + if (!strcmp(name, "CmdResetEvent")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdResetEvent; + } + if (!strcmp(name, "CmdWaitEvents")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdWaitEvents; + } + if (!strcmp(name, "CmdPipelineBarrier")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdPipelineBarrier; + } + if (!strcmp(name, "CmdBeginQuery")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBeginQuery; + } + if (!strcmp(name, "CmdEndQuery")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdEndQuery; + } + if (!strcmp(name, "CmdResetQueryPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdResetQueryPool; + } + if (!strcmp(name, "CmdWriteTimestamp")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdWriteTimestamp; + } + if (!strcmp(name, "CmdCopyQueryPoolResults")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdCopyQueryPoolResults; + } + if (!strcmp(name, "CmdPushConstants")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdPushConstants; + } + if (!strcmp(name, "CmdBeginRenderPass")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBeginRenderPass; + } + if (!strcmp(name, "CmdNextSubpass")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdNextSubpass; + } + if (!strcmp(name, "CmdEndRenderPass")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdEndRenderPass; + } + if (!strcmp(name, "CmdExecuteCommands")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdExecuteCommands; + } + if (!strcmp(name, "BindBufferMemory2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->BindBufferMemory2; + } + if (!strcmp(name, "BindImageMemory2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->BindImageMemory2; + } + if (!strcmp(name, "GetDeviceGroupPeerMemoryFeatures")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetDeviceGroupPeerMemoryFeatures; + } + if (!strcmp(name, "CmdSetDeviceMask")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdSetDeviceMask; + } + if (!strcmp(name, "CmdDispatchBase")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDispatchBase; + } + if (!strcmp(name, "GetImageMemoryRequirements2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetImageMemoryRequirements2; + } + if (!strcmp(name, "GetBufferMemoryRequirements2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetBufferMemoryRequirements2; + } + if (!strcmp(name, "GetDeviceQueue2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetDeviceQueue2; + } + if (!strcmp(name, "CreateSamplerYcbcrConversion")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateSamplerYcbcrConversion; + } + if (!strcmp(name, "DestroySamplerYcbcrConversion")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroySamplerYcbcrConversion; + } + if (!strcmp(name, "GetDescriptorSetLayoutSupport")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetDescriptorSetLayoutSupport; + } + if (!strcmp(name, "CmdDrawIndirectCount")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDrawIndirectCount; + } + if (!strcmp(name, "CmdDrawIndexedIndirectCount")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdDrawIndexedIndirectCount; + } + if (!strcmp(name, "CreateRenderPass2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateRenderPass2; + } + if (!strcmp(name, "CmdBeginRenderPass2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdBeginRenderPass2; + } + if (!strcmp(name, "CmdNextSubpass2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdNextSubpass2; + } + if (!strcmp(name, "CmdEndRenderPass2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CmdEndRenderPass2; + } + if (!strcmp(name, "ResetQueryPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->ResetQueryPool; + } + if (!strcmp(name, "GetSemaphoreCounterValue")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetSemaphoreCounterValue; + } + if (!strcmp(name, "WaitSemaphores")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->WaitSemaphores; + } + if (!strcmp(name, "SignalSemaphore")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->SignalSemaphore; + } + if (!strcmp(name, "GetBufferDeviceAddress")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetBufferDeviceAddress; + } + if (!strcmp(name, "GetBufferOpaqueCaptureAddress")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetBufferOpaqueCaptureAddress; + } + if (!strcmp(name, "GetDeviceMemoryOpaqueCaptureAddress")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetDeviceMemoryOpaqueCaptureAddress; + } + if (!strcmp(name, "GetCommandPoolMemoryConsumption")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetCommandPoolMemoryConsumption; + } + if (!strcmp(name, "GetFaultData")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetFaultData; + } + + // ---- VK_KHR_swapchain extension commands + if (!strcmp(name, "CreateSwapchainKHR")) return (void *)table->CreateSwapchainKHR; + if (!strcmp(name, "GetSwapchainImagesKHR")) return (void *)table->GetSwapchainImagesKHR; + if (!strcmp(name, "AcquireNextImageKHR")) return (void *)table->AcquireNextImageKHR; + if (!strcmp(name, "QueuePresentKHR")) return (void *)table->QueuePresentKHR; + if (!strcmp(name, "GetDeviceGroupPresentCapabilitiesKHR")) return (void *)table->GetDeviceGroupPresentCapabilitiesKHR; + if (!strcmp(name, "GetDeviceGroupSurfacePresentModesKHR")) return (void *)table->GetDeviceGroupSurfacePresentModesKHR; + if (!strcmp(name, "AcquireNextImage2KHR")) return (void *)table->AcquireNextImage2KHR; + + // ---- VK_KHR_display_swapchain extension commands + if (!strcmp(name, "CreateSharedSwapchainsKHR")) return (void *)table->CreateSharedSwapchainsKHR; + + // ---- VK_KHR_external_memory_fd extension commands + if (!strcmp(name, "GetMemoryFdKHR")) return (void *)table->GetMemoryFdKHR; + if (!strcmp(name, "GetMemoryFdPropertiesKHR")) return (void *)table->GetMemoryFdPropertiesKHR; + + // ---- VK_KHR_external_semaphore_fd extension commands + if (!strcmp(name, "ImportSemaphoreFdKHR")) return (void *)table->ImportSemaphoreFdKHR; + if (!strcmp(name, "GetSemaphoreFdKHR")) return (void *)table->GetSemaphoreFdKHR; + + // ---- VK_KHR_shared_presentable_image extension commands + if (!strcmp(name, "GetSwapchainStatusKHR")) return (void *)table->GetSwapchainStatusKHR; + + // ---- VK_KHR_external_fence_fd extension commands + if (!strcmp(name, "ImportFenceFdKHR")) return (void *)table->ImportFenceFdKHR; + if (!strcmp(name, "GetFenceFdKHR")) return (void *)table->GetFenceFdKHR; + + // ---- VK_KHR_performance_query extension commands + if (!strcmp(name, "AcquireProfilingLockKHR")) return (void *)table->AcquireProfilingLockKHR; + if (!strcmp(name, "ReleaseProfilingLockKHR")) return (void *)table->ReleaseProfilingLockKHR; + + // ---- VK_KHR_fragment_shading_rate extension commands + if (!strcmp(name, "CmdSetFragmentShadingRateKHR")) return (void *)table->CmdSetFragmentShadingRateKHR; + + // ---- VK_KHR_object_refresh extension commands + if (!strcmp(name, "CmdRefreshObjectsKHR")) return (void *)table->CmdRefreshObjectsKHR; + + // ---- VK_KHR_synchronization2 extension commands + if (!strcmp(name, "CmdSetEvent2KHR")) return (void *)table->CmdSetEvent2KHR; + if (!strcmp(name, "CmdResetEvent2KHR")) return (void *)table->CmdResetEvent2KHR; + if (!strcmp(name, "CmdWaitEvents2KHR")) return (void *)table->CmdWaitEvents2KHR; + if (!strcmp(name, "CmdPipelineBarrier2KHR")) return (void *)table->CmdPipelineBarrier2KHR; + if (!strcmp(name, "CmdWriteTimestamp2KHR")) return (void *)table->CmdWriteTimestamp2KHR; + if (!strcmp(name, "QueueSubmit2KHR")) return (void *)table->QueueSubmit2KHR; + if (!strcmp(name, "CmdWriteBufferMarker2AMD")) return (void *)table->CmdWriteBufferMarker2AMD; + if (!strcmp(name, "GetQueueCheckpointData2NV")) return (void *)table->GetQueueCheckpointData2NV; + + // ---- VK_KHR_copy_commands2 extension commands + if (!strcmp(name, "CmdCopyBuffer2KHR")) return (void *)table->CmdCopyBuffer2KHR; + if (!strcmp(name, "CmdCopyImage2KHR")) return (void *)table->CmdCopyImage2KHR; + if (!strcmp(name, "CmdCopyBufferToImage2KHR")) return (void *)table->CmdCopyBufferToImage2KHR; + if (!strcmp(name, "CmdCopyImageToBuffer2KHR")) return (void *)table->CmdCopyImageToBuffer2KHR; + if (!strcmp(name, "CmdBlitImage2KHR")) return (void *)table->CmdBlitImage2KHR; + if (!strcmp(name, "CmdResolveImage2KHR")) return (void *)table->CmdResolveImage2KHR; + + // ---- VK_EXT_display_control extension commands + if (!strcmp(name, "DisplayPowerControlEXT")) return (void *)table->DisplayPowerControlEXT; + if (!strcmp(name, "RegisterDeviceEventEXT")) return (void *)table->RegisterDeviceEventEXT; + if (!strcmp(name, "RegisterDisplayEventEXT")) return (void *)table->RegisterDisplayEventEXT; + if (!strcmp(name, "GetSwapchainCounterEXT")) return (void *)table->GetSwapchainCounterEXT; + + // ---- VK_EXT_discard_rectangles extension commands + if (!strcmp(name, "CmdSetDiscardRectangleEXT")) return (void *)table->CmdSetDiscardRectangleEXT; + if (!strcmp(name, "CmdSetDiscardRectangleEnableEXT")) return (void *)table->CmdSetDiscardRectangleEnableEXT; + if (!strcmp(name, "CmdSetDiscardRectangleModeEXT")) return (void *)table->CmdSetDiscardRectangleModeEXT; + + // ---- VK_EXT_hdr_metadata extension commands + if (!strcmp(name, "SetHdrMetadataEXT")) return (void *)table->SetHdrMetadataEXT; + + // ---- VK_EXT_debug_utils extension commands + if (!strcmp(name, "SetDebugUtilsObjectNameEXT")) return dev->layer_extensions.ext_debug_utils_enabled ? (void *)SetDebugUtilsObjectNameEXT : NULL; + if (!strcmp(name, "SetDebugUtilsObjectTagEXT")) return dev->layer_extensions.ext_debug_utils_enabled ? (void *)SetDebugUtilsObjectTagEXT : NULL; + if (!strcmp(name, "QueueBeginDebugUtilsLabelEXT")) return (void *)table->QueueBeginDebugUtilsLabelEXT; + if (!strcmp(name, "QueueEndDebugUtilsLabelEXT")) return (void *)table->QueueEndDebugUtilsLabelEXT; + if (!strcmp(name, "QueueInsertDebugUtilsLabelEXT")) return (void *)table->QueueInsertDebugUtilsLabelEXT; + if (!strcmp(name, "CmdBeginDebugUtilsLabelEXT")) return (void *)table->CmdBeginDebugUtilsLabelEXT; + if (!strcmp(name, "CmdEndDebugUtilsLabelEXT")) return (void *)table->CmdEndDebugUtilsLabelEXT; + if (!strcmp(name, "CmdInsertDebugUtilsLabelEXT")) return (void *)table->CmdInsertDebugUtilsLabelEXT; + + // ---- VK_EXT_sample_locations extension commands + if (!strcmp(name, "CmdSetSampleLocationsEXT")) return (void *)table->CmdSetSampleLocationsEXT; + + // ---- VK_EXT_image_drm_format_modifier extension commands + if (!strcmp(name, "GetImageDrmFormatModifierPropertiesEXT")) return (void *)table->GetImageDrmFormatModifierPropertiesEXT; + + // ---- VK_EXT_external_memory_host extension commands + if (!strcmp(name, "GetMemoryHostPointerPropertiesEXT")) return (void *)table->GetMemoryHostPointerPropertiesEXT; + + // ---- VK_EXT_calibrated_timestamps extension commands + if (!strcmp(name, "GetCalibratedTimestampsEXT")) return (void *)table->GetCalibratedTimestampsEXT; + + // ---- VK_EXT_line_rasterization extension commands + if (!strcmp(name, "CmdSetLineStippleEXT")) return (void *)table->CmdSetLineStippleEXT; + + // ---- VK_EXT_extended_dynamic_state extension commands + if (!strcmp(name, "CmdSetCullModeEXT")) return (void *)table->CmdSetCullModeEXT; + if (!strcmp(name, "CmdSetFrontFaceEXT")) return (void *)table->CmdSetFrontFaceEXT; + if (!strcmp(name, "CmdSetPrimitiveTopologyEXT")) return (void *)table->CmdSetPrimitiveTopologyEXT; + if (!strcmp(name, "CmdSetViewportWithCountEXT")) return (void *)table->CmdSetViewportWithCountEXT; + if (!strcmp(name, "CmdSetScissorWithCountEXT")) return (void *)table->CmdSetScissorWithCountEXT; + if (!strcmp(name, "CmdBindVertexBuffers2EXT")) return (void *)table->CmdBindVertexBuffers2EXT; + if (!strcmp(name, "CmdSetDepthTestEnableEXT")) return (void *)table->CmdSetDepthTestEnableEXT; + if (!strcmp(name, "CmdSetDepthWriteEnableEXT")) return (void *)table->CmdSetDepthWriteEnableEXT; + if (!strcmp(name, "CmdSetDepthCompareOpEXT")) return (void *)table->CmdSetDepthCompareOpEXT; + if (!strcmp(name, "CmdSetDepthBoundsTestEnableEXT")) return (void *)table->CmdSetDepthBoundsTestEnableEXT; + if (!strcmp(name, "CmdSetStencilTestEnableEXT")) return (void *)table->CmdSetStencilTestEnableEXT; + if (!strcmp(name, "CmdSetStencilOpEXT")) return (void *)table->CmdSetStencilOpEXT; + + // ---- VK_EXT_vertex_input_dynamic_state extension commands + if (!strcmp(name, "CmdSetVertexInputEXT")) return (void *)table->CmdSetVertexInputEXT; + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "GetFenceSciSyncFenceNV")) return (void *)table->GetFenceSciSyncFenceNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "GetFenceSciSyncObjNV")) return (void *)table->GetFenceSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "ImportFenceSciSyncFenceNV")) return (void *)table->ImportFenceSciSyncFenceNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "ImportFenceSciSyncObjNV")) return (void *)table->ImportFenceSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "GetSemaphoreSciSyncObjNV")) return (void *)table->GetSemaphoreSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "ImportSemaphoreSciSyncObjNV")) return (void *)table->ImportSemaphoreSciSyncObjNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "GetMemorySciBufNV")) return (void *)table->GetMemorySciBufNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_EXT_extended_dynamic_state2 extension commands + if (!strcmp(name, "CmdSetPatchControlPointsEXT")) return (void *)table->CmdSetPatchControlPointsEXT; + if (!strcmp(name, "CmdSetRasterizerDiscardEnableEXT")) return (void *)table->CmdSetRasterizerDiscardEnableEXT; + if (!strcmp(name, "CmdSetDepthBiasEnableEXT")) return (void *)table->CmdSetDepthBiasEnableEXT; + if (!strcmp(name, "CmdSetLogicOpEXT")) return (void *)table->CmdSetLogicOpEXT; + if (!strcmp(name, "CmdSetPrimitiveRestartEnableEXT")) return (void *)table->CmdSetPrimitiveRestartEnableEXT; + + // ---- VK_EXT_color_write_enable extension commands + if (!strcmp(name, "CmdSetColorWriteEnableEXT")) return (void *)table->CmdSetColorWriteEnableEXT; + + // ---- VK_NV_external_sci_sync2 extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "CreateSemaphoreSciSyncPoolNV")) return (void *)table->CreateSemaphoreSciSyncPoolNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_QNX_external_memory_screen_buffer extension commands +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + if (!strcmp(name, "GetScreenBufferPropertiesQNX")) return (void *)table->GetScreenBufferPropertiesQNX; +#endif // VK_USE_PLATFORM_SCREEN_QNX + + *found_name = false; + return NULL; +} + +// Instance command lookup function +VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name, + bool *found_name) { + if (!name || name[0] != 'v' || name[1] != 'k') { + *found_name = false; + return NULL; + } + + *found_name = true; + name += 2; + + // ---- Core SC 1_0 commands + if (!strcmp(name, "DestroyInstance")) return (void *)table->DestroyInstance; + if (!strcmp(name, "EnumeratePhysicalDevices")) return (void *)table->EnumeratePhysicalDevices; + if (!strcmp(name, "GetPhysicalDeviceFeatures")) return (void *)table->GetPhysicalDeviceFeatures; + if (!strcmp(name, "GetPhysicalDeviceFormatProperties")) return (void *)table->GetPhysicalDeviceFormatProperties; + if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties")) return (void *)table->GetPhysicalDeviceImageFormatProperties; + if (!strcmp(name, "GetPhysicalDeviceProperties")) return (void *)table->GetPhysicalDeviceProperties; + if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties")) return (void *)table->GetPhysicalDeviceQueueFamilyProperties; + if (!strcmp(name, "GetPhysicalDeviceMemoryProperties")) return (void *)table->GetPhysicalDeviceMemoryProperties; + if (!strcmp(name, "GetInstanceProcAddr")) return (void *)table->GetInstanceProcAddr; + if (!strcmp(name, "EnumerateDeviceExtensionProperties")) return (void *)table->EnumerateDeviceExtensionProperties; + if (!strcmp(name, "EnumerateDeviceLayerProperties")) return (void *)table->EnumerateDeviceLayerProperties; + if (!strcmp(name, "EnumeratePhysicalDeviceGroups")) return (void *)table->EnumeratePhysicalDeviceGroups; + if (!strcmp(name, "GetPhysicalDeviceFeatures2")) return (void *)table->GetPhysicalDeviceFeatures2; + if (!strcmp(name, "GetPhysicalDeviceProperties2")) return (void *)table->GetPhysicalDeviceProperties2; + if (!strcmp(name, "GetPhysicalDeviceFormatProperties2")) return (void *)table->GetPhysicalDeviceFormatProperties2; + if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties2")) return (void *)table->GetPhysicalDeviceImageFormatProperties2; + if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties2")) return (void *)table->GetPhysicalDeviceQueueFamilyProperties2; + if (!strcmp(name, "GetPhysicalDeviceMemoryProperties2")) return (void *)table->GetPhysicalDeviceMemoryProperties2; + if (!strcmp(name, "GetPhysicalDeviceExternalBufferProperties")) return (void *)table->GetPhysicalDeviceExternalBufferProperties; + if (!strcmp(name, "GetPhysicalDeviceExternalFenceProperties")) return (void *)table->GetPhysicalDeviceExternalFenceProperties; + if (!strcmp(name, "GetPhysicalDeviceExternalSemaphoreProperties")) return (void *)table->GetPhysicalDeviceExternalSemaphoreProperties; + + // ---- VK_KHR_surface extension commands + if (!strcmp(name, "DestroySurfaceKHR")) return (void *)table->DestroySurfaceKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceSupportKHR")) return (void *)table->GetPhysicalDeviceSurfaceSupportKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilitiesKHR")) return (void *)table->GetPhysicalDeviceSurfaceCapabilitiesKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceFormatsKHR")) return (void *)table->GetPhysicalDeviceSurfaceFormatsKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModesKHR")) return (void *)table->GetPhysicalDeviceSurfacePresentModesKHR; + + // ---- VK_KHR_swapchain extension commands + if (!strcmp(name, "GetPhysicalDevicePresentRectanglesKHR")) return (void *)table->GetPhysicalDevicePresentRectanglesKHR; + + // ---- VK_KHR_display extension commands + if (!strcmp(name, "GetPhysicalDeviceDisplayPropertiesKHR")) return (void *)table->GetPhysicalDeviceDisplayPropertiesKHR; + if (!strcmp(name, "GetPhysicalDeviceDisplayPlanePropertiesKHR")) return (void *)table->GetPhysicalDeviceDisplayPlanePropertiesKHR; + if (!strcmp(name, "GetDisplayPlaneSupportedDisplaysKHR")) return (void *)table->GetDisplayPlaneSupportedDisplaysKHR; + if (!strcmp(name, "GetDisplayModePropertiesKHR")) return (void *)table->GetDisplayModePropertiesKHR; + if (!strcmp(name, "CreateDisplayModeKHR")) return (void *)table->CreateDisplayModeKHR; + if (!strcmp(name, "GetDisplayPlaneCapabilitiesKHR")) return (void *)table->GetDisplayPlaneCapabilitiesKHR; + if (!strcmp(name, "CreateDisplayPlaneSurfaceKHR")) return (void *)table->CreateDisplayPlaneSurfaceKHR; + + // ---- VK_KHR_performance_query extension commands + if (!strcmp(name, "EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR")) return (void *)table->EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR; + if (!strcmp(name, "GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR")) return (void *)table->GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR; + + // ---- VK_KHR_get_surface_capabilities2 extension commands + if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2KHR")) return (void *)table->GetPhysicalDeviceSurfaceCapabilities2KHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceFormats2KHR")) return (void *)table->GetPhysicalDeviceSurfaceFormats2KHR; + + // ---- VK_KHR_get_display_properties2 extension commands + if (!strcmp(name, "GetPhysicalDeviceDisplayProperties2KHR")) return (void *)table->GetPhysicalDeviceDisplayProperties2KHR; + if (!strcmp(name, "GetPhysicalDeviceDisplayPlaneProperties2KHR")) return (void *)table->GetPhysicalDeviceDisplayPlaneProperties2KHR; + if (!strcmp(name, "GetDisplayModeProperties2KHR")) return (void *)table->GetDisplayModeProperties2KHR; + if (!strcmp(name, "GetDisplayPlaneCapabilities2KHR")) return (void *)table->GetDisplayPlaneCapabilities2KHR; + + // ---- VK_KHR_fragment_shading_rate extension commands + if (!strcmp(name, "GetPhysicalDeviceFragmentShadingRatesKHR")) return (void *)table->GetPhysicalDeviceFragmentShadingRatesKHR; + + // ---- VK_KHR_object_refresh extension commands + if (!strcmp(name, "GetPhysicalDeviceRefreshableObjectTypesKHR")) return (void *)table->GetPhysicalDeviceRefreshableObjectTypesKHR; + + // ---- VK_EXT_direct_mode_display extension commands + if (!strcmp(name, "ReleaseDisplayEXT")) return (void *)table->ReleaseDisplayEXT; + + // ---- VK_EXT_display_surface_counter extension commands + if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2EXT")) return (void *)table->GetPhysicalDeviceSurfaceCapabilities2EXT; + + // ---- VK_EXT_debug_utils extension commands + if (!strcmp(name, "CreateDebugUtilsMessengerEXT")) return (void *)table->CreateDebugUtilsMessengerEXT; + if (!strcmp(name, "DestroyDebugUtilsMessengerEXT")) return (void *)table->DestroyDebugUtilsMessengerEXT; + if (!strcmp(name, "SubmitDebugUtilsMessageEXT")) return (void *)table->SubmitDebugUtilsMessageEXT; + + // ---- VK_EXT_sample_locations extension commands + if (!strcmp(name, "GetPhysicalDeviceMultisamplePropertiesEXT")) return (void *)table->GetPhysicalDeviceMultisamplePropertiesEXT; + + // ---- VK_EXT_calibrated_timestamps extension commands + if (!strcmp(name, "GetPhysicalDeviceCalibrateableTimeDomainsEXT")) return (void *)table->GetPhysicalDeviceCalibrateableTimeDomainsEXT; + + // ---- VK_EXT_headless_surface extension commands + if (!strcmp(name, "CreateHeadlessSurfaceEXT")) return (void *)table->CreateHeadlessSurfaceEXT; + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "GetPhysicalDeviceSciSyncAttributesNV")) return (void *)table->GetPhysicalDeviceSciSyncAttributesNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "GetPhysicalDeviceExternalMemorySciBufPropertiesNV")) return (void *)table->GetPhysicalDeviceExternalMemorySciBufPropertiesNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp(name, "GetPhysicalDeviceSciBufAttributesNV")) return (void *)table->GetPhysicalDeviceSciBufAttributesNV; +#endif // VK_USE_PLATFORM_SCI + + *found_name = false; + return NULL; +} + + +// ---- VK_KHR_external_memory_fd extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdKHR( + VkDevice device, + const VkMemoryGetFdInfoKHR* pGetFdInfo, + int* pFd) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetMemoryFdKHR: Invalid device " + "[VUID-vkGetMemoryFdKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetMemoryFdKHR(device, pGetFdInfo, pFd); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdPropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBits handleType, + int fd, + VkMemoryFdPropertiesKHR* pMemoryFdProperties) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetMemoryFdPropertiesKHR: Invalid device " + "[VUID-vkGetMemoryFdPropertiesKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetMemoryFdPropertiesKHR(device, handleType, fd, pMemoryFdProperties); +} + + +// ---- VK_KHR_external_semaphore_fd extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreFdKHR( + VkDevice device, + const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkImportSemaphoreFdKHR: Invalid device " + "[VUID-vkImportSemaphoreFdKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->ImportSemaphoreFdKHR(device, pImportSemaphoreFdInfo); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreFdKHR( + VkDevice device, + const VkSemaphoreGetFdInfoKHR* pGetFdInfo, + int* pFd) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetSemaphoreFdKHR: Invalid device " + "[VUID-vkGetSemaphoreFdKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetSemaphoreFdKHR(device, pGetFdInfo, pFd); +} + + +// ---- VK_KHR_shared_presentable_image extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainStatusKHR( + VkDevice device, + VkSwapchainKHR swapchain) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetSwapchainStatusKHR: Invalid device " + "[VUID-vkGetSwapchainStatusKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetSwapchainStatusKHR(device, swapchain); +} + + +// ---- VK_KHR_external_fence_fd extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL ImportFenceFdKHR( + VkDevice device, + const VkImportFenceFdInfoKHR* pImportFenceFdInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkImportFenceFdKHR: Invalid device " + "[VUID-vkImportFenceFdKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->ImportFenceFdKHR(device, pImportFenceFdInfo); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetFenceFdKHR( + VkDevice device, + const VkFenceGetFdInfoKHR* pGetFdInfo, + int* pFd) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetFenceFdKHR: Invalid device " + "[VUID-vkGetFenceFdKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetFenceFdKHR(device, pGetFdInfo, pFd); +} + + +// ---- VK_KHR_performance_query extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + uint32_t* pCounterCount, + VkPerformanceCounterKHR* pCounters, + VkPerformanceCounterDescriptionKHR* pCounterDescriptions) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR: Invalid physicalDevice " + "[VUID-vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(unwrapped_phys_dev, queueFamilyIndex, pCounterCount, pCounters, pCounterDescriptions); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + uint32_t* pCounterCount, + VkPerformanceCounterKHR* pCounters, + VkPerformanceCounterDescriptionKHR* pCounterDescriptions) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(phys_dev_term->phys_dev, queueFamilyIndex, pCounterCount, pCounters, pCounterDescriptions); +} + +VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR( + VkPhysicalDevice physicalDevice, + const VkQueryPoolPerformanceCreateInfoKHR* pPerformanceQueryCreateInfo, + uint32_t* pNumPasses) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + disp->GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(unwrapped_phys_dev, pPerformanceQueryCreateInfo, pNumPasses); +} + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR( + VkPhysicalDevice physicalDevice, + const VkQueryPoolPerformanceCreateInfoKHR* pPerformanceQueryCreateInfo, + uint32_t* pNumPasses) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR"); + abort(); /* Intentionally fail so user can correct issue. */ + } + icd_term->dispatch.GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(phys_dev_term->phys_dev, pPerformanceQueryCreateInfo, pNumPasses); +} + +VKAPI_ATTR VkResult VKAPI_CALL AcquireProfilingLockKHR( + VkDevice device, + const VkAcquireProfilingLockInfoKHR* pInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkAcquireProfilingLockKHR: Invalid device " + "[VUID-vkAcquireProfilingLockKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->AcquireProfilingLockKHR(device, pInfo); +} + +VKAPI_ATTR void VKAPI_CALL ReleaseProfilingLockKHR( + VkDevice device) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkReleaseProfilingLockKHR: Invalid device " + "[VUID-vkReleaseProfilingLockKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->ReleaseProfilingLockKHR(device); +} + + +// ---- VK_KHR_fragment_shading_rate extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceFragmentShadingRatesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pFragmentShadingRateCount, + VkPhysicalDeviceFragmentShadingRateKHR* pFragmentShadingRates) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceFragmentShadingRatesKHR: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceFragmentShadingRatesKHR-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceFragmentShadingRatesKHR(unwrapped_phys_dev, pFragmentShadingRateCount, pFragmentShadingRates); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceFragmentShadingRatesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pFragmentShadingRateCount, + VkPhysicalDeviceFragmentShadingRateKHR* pFragmentShadingRates) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceFragmentShadingRatesKHR) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceFragmentShadingRatesKHR"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceFragmentShadingRatesKHR(phys_dev_term->phys_dev, pFragmentShadingRateCount, pFragmentShadingRates); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateKHR( + VkCommandBuffer commandBuffer, + const VkExtent2D* pFragmentSize, + const VkFragmentShadingRateCombinerOpKHR combinerOps[2]) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetFragmentShadingRateKHR: Invalid commandBuffer " + "[VUID-vkCmdSetFragmentShadingRateKHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetFragmentShadingRateKHR(commandBuffer, pFragmentSize, combinerOps); +} + + +// ---- VK_KHR_object_refresh extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdRefreshObjectsKHR( + VkCommandBuffer commandBuffer, + const VkRefreshObjectListKHR* pRefreshObjects) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdRefreshObjectsKHR: Invalid commandBuffer " + "[VUID-vkCmdRefreshObjectsKHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdRefreshObjectsKHR(commandBuffer, pRefreshObjects); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceRefreshableObjectTypesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pRefreshableObjectTypeCount, + VkObjectType* pRefreshableObjectTypes) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceRefreshableObjectTypesKHR: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceRefreshableObjectTypesKHR-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceRefreshableObjectTypesKHR(unwrapped_phys_dev, pRefreshableObjectTypeCount, pRefreshableObjectTypes); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceRefreshableObjectTypesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pRefreshableObjectTypeCount, + VkObjectType* pRefreshableObjectTypes) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceRefreshableObjectTypesKHR) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceRefreshableObjectTypesKHR"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceRefreshableObjectTypesKHR(phys_dev_term->phys_dev, pRefreshableObjectTypeCount, pRefreshableObjectTypes); +} + + +// ---- VK_KHR_synchronization2 extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetEvent2KHR( + VkCommandBuffer commandBuffer, + VkEvent event, + const VkDependencyInfo* pDependencyInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetEvent2KHR: Invalid commandBuffer " + "[VUID-vkCmdSetEvent2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetEvent2KHR(commandBuffer, event, pDependencyInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdResetEvent2KHR( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags2 stageMask) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdResetEvent2KHR: Invalid commandBuffer " + "[VUID-vkCmdResetEvent2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdResetEvent2KHR(commandBuffer, event, stageMask); +} + +VKAPI_ATTR void VKAPI_CALL CmdWaitEvents2KHR( + VkCommandBuffer commandBuffer, + uint32_t eventCount, + const VkEvent* pEvents, + const VkDependencyInfo* pDependencyInfos) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdWaitEvents2KHR: Invalid commandBuffer " + "[VUID-vkCmdWaitEvents2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdWaitEvents2KHR(commandBuffer, eventCount, pEvents, pDependencyInfos); +} + +VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier2KHR( + VkCommandBuffer commandBuffer, + const VkDependencyInfo* pDependencyInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdPipelineBarrier2KHR: Invalid commandBuffer " + "[VUID-vkCmdPipelineBarrier2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdPipelineBarrier2KHR(commandBuffer, pDependencyInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp2KHR( + VkCommandBuffer commandBuffer, + VkPipelineStageFlags2 stage, + VkQueryPool queryPool, + uint32_t query) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdWriteTimestamp2KHR: Invalid commandBuffer " + "[VUID-vkCmdWriteTimestamp2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdWriteTimestamp2KHR(commandBuffer, stage, queryPool, query); +} + +VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit2KHR( + VkQueue queue, + uint32_t submitCount, + const VkSubmitInfo2* pSubmits, + VkFence fence) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkQueueSubmit2KHR: Invalid queue " + "[VUID-vkQueueSubmit2KHR-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->QueueSubmit2KHR(queue, submitCount, pSubmits, fence); +} + +VKAPI_ATTR void VKAPI_CALL CmdWriteBufferMarker2AMD( + VkCommandBuffer commandBuffer, + VkPipelineStageFlags2 stage, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + uint32_t marker) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdWriteBufferMarker2AMD: Invalid commandBuffer " + "[VUID-vkCmdWriteBufferMarker2AMD-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdWriteBufferMarker2AMD(commandBuffer, stage, dstBuffer, dstOffset, marker); +} + +VKAPI_ATTR void VKAPI_CALL GetQueueCheckpointData2NV( + VkQueue queue, + uint32_t* pCheckpointDataCount, + VkCheckpointData2NV* pCheckpointData) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetQueueCheckpointData2NV: Invalid queue " + "[VUID-vkGetQueueCheckpointData2NV-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetQueueCheckpointData2NV(queue, pCheckpointDataCount, pCheckpointData); +} + + +// ---- VK_KHR_copy_commands2 extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer2KHR( + VkCommandBuffer commandBuffer, + const VkCopyBufferInfo2* pCopyBufferInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdCopyBuffer2KHR: Invalid commandBuffer " + "[VUID-vkCmdCopyBuffer2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCopyBuffer2KHR(commandBuffer, pCopyBufferInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdCopyImage2KHR( + VkCommandBuffer commandBuffer, + const VkCopyImageInfo2* pCopyImageInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdCopyImage2KHR: Invalid commandBuffer " + "[VUID-vkCmdCopyImage2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCopyImage2KHR(commandBuffer, pCopyImageInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage2KHR( + VkCommandBuffer commandBuffer, + const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdCopyBufferToImage2KHR: Invalid commandBuffer " + "[VUID-vkCmdCopyBufferToImage2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCopyBufferToImage2KHR(commandBuffer, pCopyBufferToImageInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer2KHR( + VkCommandBuffer commandBuffer, + const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdCopyImageToBuffer2KHR: Invalid commandBuffer " + "[VUID-vkCmdCopyImageToBuffer2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCopyImageToBuffer2KHR(commandBuffer, pCopyImageToBufferInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdBlitImage2KHR( + VkCommandBuffer commandBuffer, + const VkBlitImageInfo2* pBlitImageInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdBlitImage2KHR: Invalid commandBuffer " + "[VUID-vkCmdBlitImage2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdBlitImage2KHR(commandBuffer, pBlitImageInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdResolveImage2KHR( + VkCommandBuffer commandBuffer, + const VkResolveImageInfo2* pResolveImageInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdResolveImage2KHR: Invalid commandBuffer " + "[VUID-vkCmdResolveImage2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdResolveImage2KHR(commandBuffer, pResolveImageInfo); +} + + +// ---- VK_EXT_display_control extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL DisplayPowerControlEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayPowerInfoEXT* pDisplayPowerInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkDisplayPowerControlEXT: Invalid device " + "[VUID-vkDisplayPowerControlEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->DisplayPowerControlEXT(device, display, pDisplayPowerInfo); +} + +VKAPI_ATTR VkResult VKAPI_CALL RegisterDeviceEventEXT( + VkDevice device, + const VkDeviceEventInfoEXT* pDeviceEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkRegisterDeviceEventEXT: Invalid device " + "[VUID-vkRegisterDeviceEventEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->RegisterDeviceEventEXT(device, pDeviceEventInfo, pAllocator, pFence); +} + +VKAPI_ATTR VkResult VKAPI_CALL RegisterDisplayEventEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayEventInfoEXT* pDisplayEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkRegisterDisplayEventEXT: Invalid device " + "[VUID-vkRegisterDisplayEventEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->RegisterDisplayEventEXT(device, display, pDisplayEventInfo, pAllocator, pFence); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainCounterEXT( + VkDevice device, + VkSwapchainKHR swapchain, + VkSurfaceCounterFlagBitsEXT counter, + uint64_t* pCounterValue) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetSwapchainCounterEXT: Invalid device " + "[VUID-vkGetSwapchainCounterEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetSwapchainCounterEXT(device, swapchain, counter, pCounterValue); +} + + +// ---- VK_EXT_discard_rectangles extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleEXT( + VkCommandBuffer commandBuffer, + uint32_t firstDiscardRectangle, + uint32_t discardRectangleCount, + const VkRect2D* pDiscardRectangles) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDiscardRectangleEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDiscardRectangleEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, pDiscardRectangles); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 discardRectangleEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDiscardRectangleEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDiscardRectangleEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDiscardRectangleEnableEXT(commandBuffer, discardRectangleEnable); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleModeEXT( + VkCommandBuffer commandBuffer, + VkDiscardRectangleModeEXT discardRectangleMode) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDiscardRectangleModeEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDiscardRectangleModeEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDiscardRectangleModeEXT(commandBuffer, discardRectangleMode); +} + + +// ---- VK_EXT_hdr_metadata extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL SetHdrMetadataEXT( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainKHR* pSwapchains, + const VkHdrMetadataEXT* pMetadata) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkSetHdrMetadataEXT: Invalid device " + "[VUID-vkSetHdrMetadataEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata); +} + + +// ---- VK_EXT_debug_utils extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectNameEXT( + VkDevice device, + const VkDebugUtilsObjectNameInfoEXT* pNameInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkSetDebugUtilsObjectNameEXT: Invalid device " + "[VUID-vkSetDebugUtilsObjectNameEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkDebugUtilsObjectNameInfoEXT local_name_info; + memcpy(&local_name_info, pNameInfo, sizeof(VkDebugUtilsObjectNameInfoEXT)); + // If this is a physical device, we have to replace it with the proper one for the next call. + if (pNameInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->objectHandle; + local_name_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev; + } + if (pNameInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pNameInfo->objectHandle; + local_name_info.objectHandle = (uint64_t)(uintptr_t)instance->instance; + } + if (disp->SetDebugUtilsObjectNameEXT != NULL) { + return disp->SetDebugUtilsObjectNameEXT(device, &local_name_info); + } else { + return VK_SUCCESS; + } +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_SetDebugUtilsObjectNameEXT( + VkDevice device, + const VkDebugUtilsObjectNameInfoEXT* pNameInfo) { + uint32_t icd_index = 0; + struct loader_device *dev; + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); + if (NULL == icd_term || NULL == dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "SetDebugUtilsObjectNameEXT: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkDebugUtilsObjectNameInfoEXT local_name_info; + memcpy(&local_name_info, pNameInfo, sizeof(VkDebugUtilsObjectNameInfoEXT)); + // If this is a physical device, we have to replace it with the proper one for the next call. + if (pNameInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pNameInfo->objectHandle; + local_name_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; + // If this is a KHR_surface, and the ICD has created its own, we have to replace it with the proper one for the next call. + } else if (pNameInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) { + if (NULL != dev && NULL != dev->loader_dispatch.core_dispatch.CreateSwapchainKHR) { + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pNameInfo->objectHandle; + if (NULL != icd_surface->real_icd_surfaces) { + local_name_info.objectHandle = (uint64_t)icd_surface->real_icd_surfaces[icd_index]; + } + } + // If this is an instance we have to replace it with the proper one for the next call. + } else if (pNameInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + local_name_info.objectHandle = (uint64_t)(uintptr_t)icd_term->instance; + } + // Exit early if the driver does not support the function - this can happen as a layer or the loader itself supports + // debug utils but the driver does not. + if (NULL == dev->loader_dispatch.extension_terminator_dispatch.SetDebugUtilsObjectNameEXT) + return VK_SUCCESS; + return dev->loader_dispatch.extension_terminator_dispatch.SetDebugUtilsObjectNameEXT(device, &local_name_info); +} + +VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectTagEXT( + VkDevice device, + const VkDebugUtilsObjectTagInfoEXT* pTagInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkSetDebugUtilsObjectTagEXT: Invalid device " + "[VUID-vkSetDebugUtilsObjectTagEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkDebugUtilsObjectTagInfoEXT local_tag_info; + memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugUtilsObjectTagInfoEXT)); + // If this is a physical device, we have to replace it with the proper one for the next call. + if (pTagInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->objectHandle; + local_tag_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev; + } + if (pTagInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pTagInfo->objectHandle; + local_tag_info.objectHandle = (uint64_t)(uintptr_t)instance->instance; + } + if (disp->SetDebugUtilsObjectTagEXT != NULL) { + return disp->SetDebugUtilsObjectTagEXT(device, &local_tag_info); + } else { + return VK_SUCCESS; + } +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_SetDebugUtilsObjectTagEXT( + VkDevice device, + const VkDebugUtilsObjectTagInfoEXT* pTagInfo) { + uint32_t icd_index = 0; + struct loader_device *dev; + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); + if (NULL == icd_term || NULL == dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "SetDebugUtilsObjectTagEXT: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkDebugUtilsObjectTagInfoEXT local_tag_info; + memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugUtilsObjectTagInfoEXT)); + // If this is a physical device, we have to replace it with the proper one for the next call. + if (pTagInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pTagInfo->objectHandle; + local_tag_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; + // If this is a KHR_surface, and the ICD has created its own, we have to replace it with the proper one for the next call. + } else if (pTagInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) { + if (NULL != dev && NULL != dev->loader_dispatch.core_dispatch.CreateSwapchainKHR) { + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pTagInfo->objectHandle; + if (NULL != icd_surface->real_icd_surfaces) { + local_tag_info.objectHandle = (uint64_t)icd_surface->real_icd_surfaces[icd_index]; + } + } + // If this is an instance we have to replace it with the proper one for the next call. + } else if (pTagInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + local_tag_info.objectHandle = (uint64_t)(uintptr_t)icd_term->instance; + } + // Exit early if the driver does not support the function - this can happen as a layer or the loader itself supports + // debug utils but the driver does not. + if (NULL == dev->loader_dispatch.extension_terminator_dispatch.SetDebugUtilsObjectTagEXT) + return VK_SUCCESS; + return dev->loader_dispatch.extension_terminator_dispatch.SetDebugUtilsObjectTagEXT(device, &local_tag_info); +} + +VKAPI_ATTR void VKAPI_CALL QueueBeginDebugUtilsLabelEXT( + VkQueue queue, + const VkDebugUtilsLabelEXT* pLabelInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkQueueBeginDebugUtilsLabelEXT: Invalid queue " + "[VUID-vkQueueBeginDebugUtilsLabelEXT-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (disp->QueueBeginDebugUtilsLabelEXT != NULL) { + disp->QueueBeginDebugUtilsLabelEXT(queue, pLabelInfo); + } +} + +VKAPI_ATTR void VKAPI_CALL terminator_QueueBeginDebugUtilsLabelEXT( + VkQueue queue, + const VkDebugUtilsLabelEXT* pLabelInfo) { + struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch(queue); + if (NULL == dispatch_table) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "VK_EXT_debug_utils: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + // Only call down if the device supports the function + if (NULL != dispatch_table->extension_terminator_dispatch.QueueBeginDebugUtilsLabelEXT) + dispatch_table->extension_terminator_dispatch.QueueBeginDebugUtilsLabelEXT(queue, pLabelInfo); +} + +VKAPI_ATTR void VKAPI_CALL QueueEndDebugUtilsLabelEXT( + VkQueue queue) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkQueueEndDebugUtilsLabelEXT: Invalid queue " + "[VUID-vkQueueEndDebugUtilsLabelEXT-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (disp->QueueEndDebugUtilsLabelEXT != NULL) { + disp->QueueEndDebugUtilsLabelEXT(queue); + } +} + +VKAPI_ATTR void VKAPI_CALL terminator_QueueEndDebugUtilsLabelEXT( + VkQueue queue) { + struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch(queue); + if (NULL == dispatch_table) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "VK_EXT_debug_utils: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + // Only call down if the device supports the function + if (NULL != dispatch_table->extension_terminator_dispatch.QueueEndDebugUtilsLabelEXT) + dispatch_table->extension_terminator_dispatch.QueueEndDebugUtilsLabelEXT(queue); +} + +VKAPI_ATTR void VKAPI_CALL QueueInsertDebugUtilsLabelEXT( + VkQueue queue, + const VkDebugUtilsLabelEXT* pLabelInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkQueueInsertDebugUtilsLabelEXT: Invalid queue " + "[VUID-vkQueueInsertDebugUtilsLabelEXT-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (disp->QueueInsertDebugUtilsLabelEXT != NULL) { + disp->QueueInsertDebugUtilsLabelEXT(queue, pLabelInfo); + } +} + +VKAPI_ATTR void VKAPI_CALL terminator_QueueInsertDebugUtilsLabelEXT( + VkQueue queue, + const VkDebugUtilsLabelEXT* pLabelInfo) { + struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch(queue); + if (NULL == dispatch_table) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "VK_EXT_debug_utils: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + // Only call down if the device supports the function + if (NULL != dispatch_table->extension_terminator_dispatch.QueueInsertDebugUtilsLabelEXT) + dispatch_table->extension_terminator_dispatch.QueueInsertDebugUtilsLabelEXT(queue, pLabelInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdBeginDebugUtilsLabelEXT( + VkCommandBuffer commandBuffer, + const VkDebugUtilsLabelEXT* pLabelInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdBeginDebugUtilsLabelEXT: Invalid commandBuffer " + "[VUID-vkCmdBeginDebugUtilsLabelEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (disp->CmdBeginDebugUtilsLabelEXT != NULL) { + disp->CmdBeginDebugUtilsLabelEXT(commandBuffer, pLabelInfo); + } +} + +VKAPI_ATTR void VKAPI_CALL terminator_CmdBeginDebugUtilsLabelEXT( + VkCommandBuffer commandBuffer, + const VkDebugUtilsLabelEXT* pLabelInfo) { + struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch(commandBuffer); + if (NULL == dispatch_table) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "VK_EXT_debug_utils: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + // Only call down if the device supports the function + if (NULL != dispatch_table->extension_terminator_dispatch.CmdBeginDebugUtilsLabelEXT) + dispatch_table->extension_terminator_dispatch.CmdBeginDebugUtilsLabelEXT(commandBuffer, pLabelInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdEndDebugUtilsLabelEXT( + VkCommandBuffer commandBuffer) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdEndDebugUtilsLabelEXT: Invalid commandBuffer " + "[VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (disp->CmdEndDebugUtilsLabelEXT != NULL) { + disp->CmdEndDebugUtilsLabelEXT(commandBuffer); + } +} + +VKAPI_ATTR void VKAPI_CALL terminator_CmdEndDebugUtilsLabelEXT( + VkCommandBuffer commandBuffer) { + struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch(commandBuffer); + if (NULL == dispatch_table) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "VK_EXT_debug_utils: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + // Only call down if the device supports the function + if (NULL != dispatch_table->extension_terminator_dispatch.CmdEndDebugUtilsLabelEXT) + dispatch_table->extension_terminator_dispatch.CmdEndDebugUtilsLabelEXT(commandBuffer); +} + +VKAPI_ATTR void VKAPI_CALL CmdInsertDebugUtilsLabelEXT( + VkCommandBuffer commandBuffer, + const VkDebugUtilsLabelEXT* pLabelInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdInsertDebugUtilsLabelEXT: Invalid commandBuffer " + "[VUID-vkCmdInsertDebugUtilsLabelEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (disp->CmdInsertDebugUtilsLabelEXT != NULL) { + disp->CmdInsertDebugUtilsLabelEXT(commandBuffer, pLabelInfo); + } +} + +VKAPI_ATTR void VKAPI_CALL terminator_CmdInsertDebugUtilsLabelEXT( + VkCommandBuffer commandBuffer, + const VkDebugUtilsLabelEXT* pLabelInfo) { + struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch(commandBuffer); + if (NULL == dispatch_table) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "VK_EXT_debug_utils: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + // Only call down if the device supports the function + if (NULL != dispatch_table->extension_terminator_dispatch.CmdInsertDebugUtilsLabelEXT) + dispatch_table->extension_terminator_dispatch.CmdInsertDebugUtilsLabelEXT(commandBuffer, pLabelInfo); +} + + +// ---- VK_EXT_sample_locations extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetSampleLocationsEXT( + VkCommandBuffer commandBuffer, + const VkSampleLocationsInfoEXT* pSampleLocationsInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetSampleLocationsEXT: Invalid commandBuffer " + "[VUID-vkCmdSetSampleLocationsEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetSampleLocationsEXT(commandBuffer, pSampleLocationsInfo); +} + +VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMultisamplePropertiesEXT( + VkPhysicalDevice physicalDevice, + VkSampleCountFlagBits samples, + VkMultisamplePropertiesEXT* pMultisampleProperties) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceMultisamplePropertiesEXT: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceMultisamplePropertiesEXT-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + disp->GetPhysicalDeviceMultisamplePropertiesEXT(unwrapped_phys_dev, samples, pMultisampleProperties); +} + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMultisamplePropertiesEXT( + VkPhysicalDevice physicalDevice, + VkSampleCountFlagBits samples, + VkMultisamplePropertiesEXT* pMultisampleProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceMultisamplePropertiesEXT) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceMultisamplePropertiesEXT"); + abort(); /* Intentionally fail so user can correct issue. */ + } + icd_term->dispatch.GetPhysicalDeviceMultisamplePropertiesEXT(phys_dev_term->phys_dev, samples, pMultisampleProperties); +} + + +// ---- VK_EXT_image_drm_format_modifier extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetImageDrmFormatModifierPropertiesEXT( + VkDevice device, + VkImage image, + VkImageDrmFormatModifierPropertiesEXT* pProperties) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetImageDrmFormatModifierPropertiesEXT: Invalid device " + "[VUID-vkGetImageDrmFormatModifierPropertiesEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetImageDrmFormatModifierPropertiesEXT(device, image, pProperties); +} + + +// ---- VK_EXT_external_memory_host extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetMemoryHostPointerPropertiesEXT( + VkDevice device, + VkExternalMemoryHandleTypeFlagBits handleType, + const void* pHostPointer, + VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetMemoryHostPointerPropertiesEXT: Invalid device " + "[VUID-vkGetMemoryHostPointerPropertiesEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetMemoryHostPointerPropertiesEXT(device, handleType, pHostPointer, pMemoryHostPointerProperties); +} + + +// ---- VK_EXT_calibrated_timestamps extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCalibrateableTimeDomainsEXT( + VkPhysicalDevice physicalDevice, + uint32_t* pTimeDomainCount, + VkTimeDomainEXT* pTimeDomains) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceCalibrateableTimeDomainsEXT-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceCalibrateableTimeDomainsEXT(unwrapped_phys_dev, pTimeDomainCount, pTimeDomains); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceCalibrateableTimeDomainsEXT( + VkPhysicalDevice physicalDevice, + uint32_t* pTimeDomainCount, + VkTimeDomainEXT* pTimeDomains) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceCalibrateableTimeDomainsEXT) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceCalibrateableTimeDomainsEXT"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceCalibrateableTimeDomainsEXT(phys_dev_term->phys_dev, pTimeDomainCount, pTimeDomains); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetCalibratedTimestampsEXT( + VkDevice device, + uint32_t timestampCount, + const VkCalibratedTimestampInfoEXT* pTimestampInfos, + uint64_t* pTimestamps, + uint64_t* pMaxDeviation) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetCalibratedTimestampsEXT: Invalid device " + "[VUID-vkGetCalibratedTimestampsEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetCalibratedTimestampsEXT(device, timestampCount, pTimestampInfos, pTimestamps, pMaxDeviation); +} + + +// ---- VK_EXT_line_rasterization extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetLineStippleEXT( + VkCommandBuffer commandBuffer, + uint32_t lineStippleFactor, + uint16_t lineStipplePattern) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetLineStippleEXT: Invalid commandBuffer " + "[VUID-vkCmdSetLineStippleEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetLineStippleEXT(commandBuffer, lineStippleFactor, lineStipplePattern); +} + + +// ---- VK_EXT_extended_dynamic_state extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetCullModeEXT( + VkCommandBuffer commandBuffer, + VkCullModeFlags cullMode) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetCullModeEXT: Invalid commandBuffer " + "[VUID-vkCmdSetCullModeEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetCullModeEXT(commandBuffer, cullMode); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetFrontFaceEXT( + VkCommandBuffer commandBuffer, + VkFrontFace frontFace) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetFrontFaceEXT: Invalid commandBuffer " + "[VUID-vkCmdSetFrontFaceEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetFrontFaceEXT(commandBuffer, frontFace); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetPrimitiveTopologyEXT( + VkCommandBuffer commandBuffer, + VkPrimitiveTopology primitiveTopology) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetPrimitiveTopologyEXT: Invalid commandBuffer " + "[VUID-vkCmdSetPrimitiveTopologyEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetPrimitiveTopologyEXT(commandBuffer, primitiveTopology); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetViewportWithCountEXT( + VkCommandBuffer commandBuffer, + uint32_t viewportCount, + const VkViewport* pViewports) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetViewportWithCountEXT: Invalid commandBuffer " + "[VUID-vkCmdSetViewportWithCountEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetViewportWithCountEXT(commandBuffer, viewportCount, pViewports); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetScissorWithCountEXT( + VkCommandBuffer commandBuffer, + uint32_t scissorCount, + const VkRect2D* pScissors) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetScissorWithCountEXT: Invalid commandBuffer " + "[VUID-vkCmdSetScissorWithCountEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetScissorWithCountEXT(commandBuffer, scissorCount, pScissors); +} + +VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers2EXT( + VkCommandBuffer commandBuffer, + uint32_t firstBinding, + uint32_t bindingCount, + const VkBuffer* pBuffers, + const VkDeviceSize* pOffsets, + const VkDeviceSize* pSizes, + const VkDeviceSize* pStrides) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdBindVertexBuffers2EXT: Invalid commandBuffer " + "[VUID-vkCmdBindVertexBuffers2EXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdBindVertexBuffers2EXT(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDepthTestEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 depthTestEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDepthTestEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDepthTestEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDepthTestEnableEXT(commandBuffer, depthTestEnable); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDepthWriteEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 depthWriteEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDepthWriteEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDepthWriteEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDepthWriteEnableEXT(commandBuffer, depthWriteEnable); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDepthCompareOpEXT( + VkCommandBuffer commandBuffer, + VkCompareOp depthCompareOp) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDepthCompareOpEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDepthCompareOpEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDepthCompareOpEXT(commandBuffer, depthCompareOp); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDepthBoundsTestEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 depthBoundsTestEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDepthBoundsTestEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDepthBoundsTestEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDepthBoundsTestEnableEXT(commandBuffer, depthBoundsTestEnable); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetStencilTestEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 stencilTestEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetStencilTestEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetStencilTestEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetStencilTestEnableEXT(commandBuffer, stencilTestEnable); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetStencilOpEXT( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + VkStencilOp failOp, + VkStencilOp passOp, + VkStencilOp depthFailOp, + VkCompareOp compareOp) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetStencilOpEXT: Invalid commandBuffer " + "[VUID-vkCmdSetStencilOpEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetStencilOpEXT(commandBuffer, faceMask, failOp, passOp, depthFailOp, compareOp); +} + + +// ---- VK_EXT_vertex_input_dynamic_state extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetVertexInputEXT( + VkCommandBuffer commandBuffer, + uint32_t vertexBindingDescriptionCount, + const VkVertexInputBindingDescription2EXT* pVertexBindingDescriptions, + uint32_t vertexAttributeDescriptionCount, + const VkVertexInputAttributeDescription2EXT* pVertexAttributeDescriptions) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetVertexInputEXT: Invalid commandBuffer " + "[VUID-vkCmdSetVertexInputEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetVertexInputEXT(commandBuffer, vertexBindingDescriptionCount, pVertexBindingDescriptions, vertexAttributeDescriptionCount, pVertexAttributeDescriptions); +} + + +// ---- VK_NV_external_sci_sync extension trampoline/terminators + +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL GetFenceSciSyncFenceNV( + VkDevice device, + const VkFenceGetSciSyncInfoNV* pGetSciSyncHandleInfo, + void* pHandle) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetFenceSciSyncFenceNV: Invalid device " + "[VUID-vkGetFenceSciSyncFenceNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetFenceSciSyncFenceNV(device, pGetSciSyncHandleInfo, pHandle); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL GetFenceSciSyncObjNV( + VkDevice device, + const VkFenceGetSciSyncInfoNV* pGetSciSyncHandleInfo, + void* pHandle) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetFenceSciSyncObjNV: Invalid device " + "[VUID-vkGetFenceSciSyncObjNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetFenceSciSyncObjNV(device, pGetSciSyncHandleInfo, pHandle); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL ImportFenceSciSyncFenceNV( + VkDevice device, + const VkImportFenceSciSyncInfoNV* pImportFenceSciSyncInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkImportFenceSciSyncFenceNV: Invalid device " + "[VUID-vkImportFenceSciSyncFenceNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->ImportFenceSciSyncFenceNV(device, pImportFenceSciSyncInfo); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL ImportFenceSciSyncObjNV( + VkDevice device, + const VkImportFenceSciSyncInfoNV* pImportFenceSciSyncInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkImportFenceSciSyncObjNV: Invalid device " + "[VUID-vkImportFenceSciSyncObjNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->ImportFenceSciSyncObjNV(device, pImportFenceSciSyncInfo); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSciSyncAttributesNV( + VkPhysicalDevice physicalDevice, + const VkSciSyncAttributesInfoNV* pSciSyncAttributesInfo, + NvSciSyncAttrList pAttributes) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceSciSyncAttributesNV: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceSciSyncAttributesNV-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceSciSyncAttributesNV(unwrapped_phys_dev, pSciSyncAttributesInfo, pAttributes); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSciSyncAttributesNV( + VkPhysicalDevice physicalDevice, + const VkSciSyncAttributesInfoNV* pSciSyncAttributesInfo, + NvSciSyncAttrList pAttributes) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceSciSyncAttributesNV) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceSciSyncAttributesNV"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceSciSyncAttributesNV(phys_dev_term->phys_dev, pSciSyncAttributesInfo, pAttributes); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreSciSyncObjNV( + VkDevice device, + const VkSemaphoreGetSciSyncInfoNV* pGetSciSyncInfo, + void* pHandle) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetSemaphoreSciSyncObjNV: Invalid device " + "[VUID-vkGetSemaphoreSciSyncObjNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetSemaphoreSciSyncObjNV(device, pGetSciSyncInfo, pHandle); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreSciSyncObjNV( + VkDevice device, + const VkImportSemaphoreSciSyncInfoNV* pImportSemaphoreSciSyncInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkImportSemaphoreSciSyncObjNV: Invalid device " + "[VUID-vkImportSemaphoreSciSyncObjNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->ImportSemaphoreSciSyncObjNV(device, pImportSemaphoreSciSyncInfo); +} + +#endif // VK_USE_PLATFORM_SCI + +// ---- VK_NV_external_memory_sci_buf extension trampoline/terminators + +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL GetMemorySciBufNV( + VkDevice device, + const VkMemoryGetSciBufInfoNV* pGetSciBufInfo, + NvSciBufObj* pHandle) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetMemorySciBufNV: Invalid device " + "[VUID-vkGetMemorySciBufNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetMemorySciBufNV(device, pGetSciBufInfo, pHandle); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalMemorySciBufPropertiesNV( + VkPhysicalDevice physicalDevice, + VkExternalMemoryHandleTypeFlagBits handleType, + NvSciBufObj handle, + VkMemorySciBufPropertiesNV* pMemorySciBufProperties) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceExternalMemorySciBufPropertiesNV(unwrapped_phys_dev, handleType, handle, pMemorySciBufProperties); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceExternalMemorySciBufPropertiesNV( + VkPhysicalDevice physicalDevice, + VkExternalMemoryHandleTypeFlagBits handleType, + NvSciBufObj handle, + VkMemorySciBufPropertiesNV* pMemorySciBufProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceExternalMemorySciBufPropertiesNV) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceExternalMemorySciBufPropertiesNV"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceExternalMemorySciBufPropertiesNV(phys_dev_term->phys_dev, handleType, handle, pMemorySciBufProperties); +} + +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSciBufAttributesNV( + VkPhysicalDevice physicalDevice, + NvSciBufAttrList pAttributes) { + const VkLayerInstanceDispatchTable *disp; + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); + if (VK_NULL_HANDLE == unwrapped_phys_dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceSciBufAttributesNV: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceSciBufAttributesNV-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceSciBufAttributesNV(unwrapped_phys_dev, pAttributes); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSciBufAttributesNV( + VkPhysicalDevice physicalDevice, + NvSciBufAttrList pAttributes) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + if (NULL == icd_term->dispatch.GetPhysicalDeviceSciBufAttributesNV) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceSciBufAttributesNV"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceSciBufAttributesNV(phys_dev_term->phys_dev, pAttributes); +} + +#endif // VK_USE_PLATFORM_SCI + +// ---- VK_EXT_extended_dynamic_state2 extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetPatchControlPointsEXT( + VkCommandBuffer commandBuffer, + uint32_t patchControlPoints) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetPatchControlPointsEXT: Invalid commandBuffer " + "[VUID-vkCmdSetPatchControlPointsEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetPatchControlPointsEXT(commandBuffer, patchControlPoints); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetRasterizerDiscardEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 rasterizerDiscardEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetRasterizerDiscardEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetRasterizerDiscardEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetRasterizerDiscardEnableEXT(commandBuffer, rasterizerDiscardEnable); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDepthBiasEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 depthBiasEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetDepthBiasEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDepthBiasEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDepthBiasEnableEXT(commandBuffer, depthBiasEnable); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetLogicOpEXT( + VkCommandBuffer commandBuffer, + VkLogicOp logicOp) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetLogicOpEXT: Invalid commandBuffer " + "[VUID-vkCmdSetLogicOpEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetLogicOpEXT(commandBuffer, logicOp); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetPrimitiveRestartEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 primitiveRestartEnable) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetPrimitiveRestartEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetPrimitiveRestartEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetPrimitiveRestartEnableEXT(commandBuffer, primitiveRestartEnable); +} + + +// ---- VK_EXT_color_write_enable extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetColorWriteEnableEXT( + VkCommandBuffer commandBuffer, + uint32_t attachmentCount, + const VkBool32* pColorWriteEnables) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetColorWriteEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetColorWriteEnableEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetColorWriteEnableEXT(commandBuffer, attachmentCount, pColorWriteEnables); +} + + +// ---- VK_NV_external_sci_sync2 extension trampoline/terminators + +#if defined(VK_USE_PLATFORM_SCI) +VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphoreSciSyncPoolNV( + VkDevice device, + const VkSemaphoreSciSyncPoolCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSemaphoreSciSyncPoolNV* pSemaphorePool) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateSemaphoreSciSyncPoolNV: Invalid device " + "[VUID-vkCreateSemaphoreSciSyncPoolNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreateSemaphoreSciSyncPoolNV(device, pCreateInfo, pAllocator, pSemaphorePool); +} + +#endif // VK_USE_PLATFORM_SCI + +// ---- VK_QNX_external_memory_screen_buffer extension trampoline/terminators + +#if defined(VK_USE_PLATFORM_SCREEN_QNX) +VKAPI_ATTR VkResult VKAPI_CALL GetScreenBufferPropertiesQNX( + VkDevice device, + const struct _screen_buffer* buffer, + VkScreenBufferPropertiesQNX* pProperties) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetScreenBufferPropertiesQNX: Invalid device " + "[VUID-vkGetScreenBufferPropertiesQNX-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetScreenBufferPropertiesQNX(device, buffer, pProperties); +} + +#endif // VK_USE_PLATFORM_SCREEN_QNX +// GPA helpers for extensions +bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { + *addr = NULL; + + + // ---- VK_KHR_external_memory_fd extension commands + if (!strcmp("vkGetMemoryFdKHR", name)) { + *addr = (void *)GetMemoryFdKHR; + return true; + } + if (!strcmp("vkGetMemoryFdPropertiesKHR", name)) { + *addr = (void *)GetMemoryFdPropertiesKHR; + return true; + } + + // ---- VK_KHR_external_semaphore_fd extension commands + if (!strcmp("vkImportSemaphoreFdKHR", name)) { + *addr = (void *)ImportSemaphoreFdKHR; + return true; + } + if (!strcmp("vkGetSemaphoreFdKHR", name)) { + *addr = (void *)GetSemaphoreFdKHR; + return true; + } + + // ---- VK_KHR_shared_presentable_image extension commands + if (!strcmp("vkGetSwapchainStatusKHR", name)) { + *addr = (void *)GetSwapchainStatusKHR; + return true; + } + + // ---- VK_KHR_external_fence_fd extension commands + if (!strcmp("vkImportFenceFdKHR", name)) { + *addr = (void *)ImportFenceFdKHR; + return true; + } + if (!strcmp("vkGetFenceFdKHR", name)) { + *addr = (void *)GetFenceFdKHR; + return true; + } + + // ---- VK_KHR_performance_query extension commands + if (!strcmp("vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR", name)) { + *addr = (void *)EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR; + return true; + } + if (!strcmp("vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR", name)) { + *addr = (void *)GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR; + return true; + } + if (!strcmp("vkAcquireProfilingLockKHR", name)) { + *addr = (void *)AcquireProfilingLockKHR; + return true; + } + if (!strcmp("vkReleaseProfilingLockKHR", name)) { + *addr = (void *)ReleaseProfilingLockKHR; + return true; + } + + // ---- VK_KHR_fragment_shading_rate extension commands + if (!strcmp("vkGetPhysicalDeviceFragmentShadingRatesKHR", name)) { + *addr = (void *)GetPhysicalDeviceFragmentShadingRatesKHR; + return true; + } + if (!strcmp("vkCmdSetFragmentShadingRateKHR", name)) { + *addr = (void *)CmdSetFragmentShadingRateKHR; + return true; + } + + // ---- VK_KHR_object_refresh extension commands + if (!strcmp("vkCmdRefreshObjectsKHR", name)) { + *addr = (void *)CmdRefreshObjectsKHR; + return true; + } + if (!strcmp("vkGetPhysicalDeviceRefreshableObjectTypesKHR", name)) { + *addr = (void *)GetPhysicalDeviceRefreshableObjectTypesKHR; + return true; + } + + // ---- VK_KHR_synchronization2 extension commands + if (!strcmp("vkCmdSetEvent2KHR", name)) { + *addr = (void *)CmdSetEvent2KHR; + return true; + } + if (!strcmp("vkCmdResetEvent2KHR", name)) { + *addr = (void *)CmdResetEvent2KHR; + return true; + } + if (!strcmp("vkCmdWaitEvents2KHR", name)) { + *addr = (void *)CmdWaitEvents2KHR; + return true; + } + if (!strcmp("vkCmdPipelineBarrier2KHR", name)) { + *addr = (void *)CmdPipelineBarrier2KHR; + return true; + } + if (!strcmp("vkCmdWriteTimestamp2KHR", name)) { + *addr = (void *)CmdWriteTimestamp2KHR; + return true; + } + if (!strcmp("vkQueueSubmit2KHR", name)) { + *addr = (void *)QueueSubmit2KHR; + return true; + } + if (!strcmp("vkCmdWriteBufferMarker2AMD", name)) { + *addr = (void *)CmdWriteBufferMarker2AMD; + return true; + } + if (!strcmp("vkGetQueueCheckpointData2NV", name)) { + *addr = (void *)GetQueueCheckpointData2NV; + return true; + } + + // ---- VK_KHR_copy_commands2 extension commands + if (!strcmp("vkCmdCopyBuffer2KHR", name)) { + *addr = (void *)CmdCopyBuffer2KHR; + return true; + } + if (!strcmp("vkCmdCopyImage2KHR", name)) { + *addr = (void *)CmdCopyImage2KHR; + return true; + } + if (!strcmp("vkCmdCopyBufferToImage2KHR", name)) { + *addr = (void *)CmdCopyBufferToImage2KHR; + return true; + } + if (!strcmp("vkCmdCopyImageToBuffer2KHR", name)) { + *addr = (void *)CmdCopyImageToBuffer2KHR; + return true; + } + if (!strcmp("vkCmdBlitImage2KHR", name)) { + *addr = (void *)CmdBlitImage2KHR; + return true; + } + if (!strcmp("vkCmdResolveImage2KHR", name)) { + *addr = (void *)CmdResolveImage2KHR; + return true; + } + + // ---- VK_EXT_direct_mode_display extension commands + if (!strcmp("vkReleaseDisplayEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_direct_mode_display == 1) + ? (void *)ReleaseDisplayEXT + : NULL; + return true; + } + + // ---- VK_EXT_display_surface_counter extension commands + if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilities2EXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_display_surface_counter == 1) + ? (void *)GetPhysicalDeviceSurfaceCapabilities2EXT + : NULL; + return true; + } + + // ---- VK_EXT_display_control extension commands + if (!strcmp("vkDisplayPowerControlEXT", name)) { + *addr = (void *)DisplayPowerControlEXT; + return true; + } + if (!strcmp("vkRegisterDeviceEventEXT", name)) { + *addr = (void *)RegisterDeviceEventEXT; + return true; + } + if (!strcmp("vkRegisterDisplayEventEXT", name)) { + *addr = (void *)RegisterDisplayEventEXT; + return true; + } + if (!strcmp("vkGetSwapchainCounterEXT", name)) { + *addr = (void *)GetSwapchainCounterEXT; + return true; + } + + // ---- VK_EXT_discard_rectangles extension commands + if (!strcmp("vkCmdSetDiscardRectangleEXT", name)) { + *addr = (void *)CmdSetDiscardRectangleEXT; + return true; + } + if (!strcmp("vkCmdSetDiscardRectangleEnableEXT", name)) { + *addr = (void *)CmdSetDiscardRectangleEnableEXT; + return true; + } + if (!strcmp("vkCmdSetDiscardRectangleModeEXT", name)) { + *addr = (void *)CmdSetDiscardRectangleModeEXT; + return true; + } + + // ---- VK_EXT_hdr_metadata extension commands + if (!strcmp("vkSetHdrMetadataEXT", name)) { + *addr = (void *)SetHdrMetadataEXT; + return true; + } + + // ---- VK_EXT_debug_utils extension commands + if (!strcmp("vkSetDebugUtilsObjectNameEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)SetDebugUtilsObjectNameEXT + : NULL; + return true; + } + if (!strcmp("vkSetDebugUtilsObjectTagEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)SetDebugUtilsObjectTagEXT + : NULL; + return true; + } + if (!strcmp("vkQueueBeginDebugUtilsLabelEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)QueueBeginDebugUtilsLabelEXT + : NULL; + return true; + } + if (!strcmp("vkQueueEndDebugUtilsLabelEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)QueueEndDebugUtilsLabelEXT + : NULL; + return true; + } + if (!strcmp("vkQueueInsertDebugUtilsLabelEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)QueueInsertDebugUtilsLabelEXT + : NULL; + return true; + } + if (!strcmp("vkCmdBeginDebugUtilsLabelEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)CmdBeginDebugUtilsLabelEXT + : NULL; + return true; + } + if (!strcmp("vkCmdEndDebugUtilsLabelEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)CmdEndDebugUtilsLabelEXT + : NULL; + return true; + } + if (!strcmp("vkCmdInsertDebugUtilsLabelEXT", name)) { + *addr = (ptr_instance->enabled_known_extensions.ext_debug_utils == 1) + ? (void *)CmdInsertDebugUtilsLabelEXT + : NULL; + return true; + } + + // ---- VK_EXT_sample_locations extension commands + if (!strcmp("vkCmdSetSampleLocationsEXT", name)) { + *addr = (void *)CmdSetSampleLocationsEXT; + return true; + } + if (!strcmp("vkGetPhysicalDeviceMultisamplePropertiesEXT", name)) { + *addr = (void *)GetPhysicalDeviceMultisamplePropertiesEXT; + return true; + } + + // ---- VK_EXT_image_drm_format_modifier extension commands + if (!strcmp("vkGetImageDrmFormatModifierPropertiesEXT", name)) { + *addr = (void *)GetImageDrmFormatModifierPropertiesEXT; + return true; + } + + // ---- VK_EXT_external_memory_host extension commands + if (!strcmp("vkGetMemoryHostPointerPropertiesEXT", name)) { + *addr = (void *)GetMemoryHostPointerPropertiesEXT; + return true; + } + + // ---- VK_EXT_calibrated_timestamps extension commands + if (!strcmp("vkGetPhysicalDeviceCalibrateableTimeDomainsEXT", name)) { + *addr = (void *)GetPhysicalDeviceCalibrateableTimeDomainsEXT; + return true; + } + if (!strcmp("vkGetCalibratedTimestampsEXT", name)) { + *addr = (void *)GetCalibratedTimestampsEXT; + return true; + } + + // ---- VK_EXT_line_rasterization extension commands + if (!strcmp("vkCmdSetLineStippleEXT", name)) { + *addr = (void *)CmdSetLineStippleEXT; + return true; + } + + // ---- VK_EXT_extended_dynamic_state extension commands + if (!strcmp("vkCmdSetCullModeEXT", name)) { + *addr = (void *)CmdSetCullModeEXT; + return true; + } + if (!strcmp("vkCmdSetFrontFaceEXT", name)) { + *addr = (void *)CmdSetFrontFaceEXT; + return true; + } + if (!strcmp("vkCmdSetPrimitiveTopologyEXT", name)) { + *addr = (void *)CmdSetPrimitiveTopologyEXT; + return true; + } + if (!strcmp("vkCmdSetViewportWithCountEXT", name)) { + *addr = (void *)CmdSetViewportWithCountEXT; + return true; + } + if (!strcmp("vkCmdSetScissorWithCountEXT", name)) { + *addr = (void *)CmdSetScissorWithCountEXT; + return true; + } + if (!strcmp("vkCmdBindVertexBuffers2EXT", name)) { + *addr = (void *)CmdBindVertexBuffers2EXT; + return true; + } + if (!strcmp("vkCmdSetDepthTestEnableEXT", name)) { + *addr = (void *)CmdSetDepthTestEnableEXT; + return true; + } + if (!strcmp("vkCmdSetDepthWriteEnableEXT", name)) { + *addr = (void *)CmdSetDepthWriteEnableEXT; + return true; + } + if (!strcmp("vkCmdSetDepthCompareOpEXT", name)) { + *addr = (void *)CmdSetDepthCompareOpEXT; + return true; + } + if (!strcmp("vkCmdSetDepthBoundsTestEnableEXT", name)) { + *addr = (void *)CmdSetDepthBoundsTestEnableEXT; + return true; + } + if (!strcmp("vkCmdSetStencilTestEnableEXT", name)) { + *addr = (void *)CmdSetStencilTestEnableEXT; + return true; + } + if (!strcmp("vkCmdSetStencilOpEXT", name)) { + *addr = (void *)CmdSetStencilOpEXT; + return true; + } + + // ---- VK_EXT_vertex_input_dynamic_state extension commands + if (!strcmp("vkCmdSetVertexInputEXT", name)) { + *addr = (void *)CmdSetVertexInputEXT; + return true; + } + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkGetFenceSciSyncFenceNV", name)) { + *addr = (void *)GetFenceSciSyncFenceNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkGetFenceSciSyncObjNV", name)) { + *addr = (void *)GetFenceSciSyncObjNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkImportFenceSciSyncFenceNV", name)) { + *addr = (void *)ImportFenceSciSyncFenceNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkImportFenceSciSyncObjNV", name)) { + *addr = (void *)ImportFenceSciSyncObjNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkGetPhysicalDeviceSciSyncAttributesNV", name)) { + *addr = (void *)GetPhysicalDeviceSciSyncAttributesNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkGetSemaphoreSciSyncObjNV", name)) { + *addr = (void *)GetSemaphoreSciSyncObjNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkImportSemaphoreSciSyncObjNV", name)) { + *addr = (void *)ImportSemaphoreSciSyncObjNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkGetMemorySciBufNV", name)) { + *addr = (void *)GetMemorySciBufNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV", name)) { + *addr = (void *)GetPhysicalDeviceExternalMemorySciBufPropertiesNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkGetPhysicalDeviceSciBufAttributesNV", name)) { + *addr = (void *)GetPhysicalDeviceSciBufAttributesNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_EXT_extended_dynamic_state2 extension commands + if (!strcmp("vkCmdSetPatchControlPointsEXT", name)) { + *addr = (void *)CmdSetPatchControlPointsEXT; + return true; + } + if (!strcmp("vkCmdSetRasterizerDiscardEnableEXT", name)) { + *addr = (void *)CmdSetRasterizerDiscardEnableEXT; + return true; + } + if (!strcmp("vkCmdSetDepthBiasEnableEXT", name)) { + *addr = (void *)CmdSetDepthBiasEnableEXT; + return true; + } + if (!strcmp("vkCmdSetLogicOpEXT", name)) { + *addr = (void *)CmdSetLogicOpEXT; + return true; + } + if (!strcmp("vkCmdSetPrimitiveRestartEnableEXT", name)) { + *addr = (void *)CmdSetPrimitiveRestartEnableEXT; + return true; + } + + // ---- VK_EXT_color_write_enable extension commands + if (!strcmp("vkCmdSetColorWriteEnableEXT", name)) { + *addr = (void *)CmdSetColorWriteEnableEXT; + return true; + } + + // ---- VK_NV_external_sci_sync2 extension commands +#if defined(VK_USE_PLATFORM_SCI) + if (!strcmp("vkCreateSemaphoreSciSyncPoolNV", name)) { + *addr = (void *)CreateSemaphoreSciSyncPoolNV; + return true; + } +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_QNX_external_memory_screen_buffer extension commands +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + if (!strcmp("vkGetScreenBufferPropertiesQNX", name)) { + *addr = (void *)GetScreenBufferPropertiesQNX; + return true; + } +#endif // VK_USE_PLATFORM_SCREEN_QNX + return false; +} + +// A function that can be used to query enabled extensions during a vkCreateInstance call +void extensions_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { + for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { + + // ---- VK_EXT_direct_mode_display extension commands + if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)) { + ptr_instance->enabled_known_extensions.ext_direct_mode_display = 1; + + // ---- VK_EXT_display_surface_counter extension commands + } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)) { + ptr_instance->enabled_known_extensions.ext_display_surface_counter = 1; + + // ---- VK_EXT_debug_utils extension commands + } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_UTILS_EXTENSION_NAME)) { + ptr_instance->enabled_known_extensions.ext_debug_utils = 1; + } + } +} + +// Some device commands still need a terminator because the loader needs to unwrap something about them. +// In many cases, the item needing unwrapping is a VkPhysicalDevice or VkSurfaceKHR object. But there may be other items +// in the future. +PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *dev, const char *name, bool* found_name) { + *found_name = false; + if (!name || name[0] != 'v' || name[1] != 'k') { + return NULL; + } + name += 2; + // ---- VK_KHR_swapchain extension commands + if (!strcmp(name, "CreateSwapchainKHR")) { + *found_name = true; + return dev->driver_extensions.khr_swapchain_enabled ? + (PFN_vkVoidFunction)terminator_CreateSwapchainKHR : NULL; + } + if (!strcmp(name, "GetDeviceGroupSurfacePresentModesKHR")) { + *found_name = true; + return dev->driver_extensions.khr_swapchain_enabled ? + (PFN_vkVoidFunction)terminator_GetDeviceGroupSurfacePresentModesKHR : NULL; + } + // ---- VK_KHR_display_swapchain extension commands + if (!strcmp(name, "CreateSharedSwapchainsKHR")) { + *found_name = true; + return dev->driver_extensions.khr_display_swapchain_enabled ? + (PFN_vkVoidFunction)terminator_CreateSharedSwapchainsKHR : NULL; + } + // ---- VK_EXT_debug_utils extension commands + if (!strcmp(name, "SetDebugUtilsObjectNameEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectNameEXT : NULL; + } + if (!strcmp(name, "SetDebugUtilsObjectTagEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectTagEXT : NULL; + } + if (!strcmp(name, "QueueBeginDebugUtilsLabelEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_QueueBeginDebugUtilsLabelEXT : NULL; + } + if (!strcmp(name, "QueueEndDebugUtilsLabelEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_QueueEndDebugUtilsLabelEXT : NULL; + } + if (!strcmp(name, "QueueInsertDebugUtilsLabelEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_QueueInsertDebugUtilsLabelEXT : NULL; + } + if (!strcmp(name, "CmdBeginDebugUtilsLabelEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_CmdBeginDebugUtilsLabelEXT : NULL; + } + if (!strcmp(name, "CmdEndDebugUtilsLabelEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_CmdEndDebugUtilsLabelEXT : NULL; + } + if (!strcmp(name, "CmdInsertDebugUtilsLabelEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_utils_enabled ? + (PFN_vkVoidFunction)terminator_CmdInsertDebugUtilsLabelEXT : NULL; + } + return NULL; +} + +// This table contains the loader's instance dispatch table, which contains +// default functions if no instance layers are activated. This contains +// pointers to "terminator functions". +const VkLayerInstanceDispatchTable instance_disp = { + + // ---- Core SC 1_0 commands + .DestroyInstance = terminator_DestroyInstance, + .EnumeratePhysicalDevices = terminator_EnumeratePhysicalDevices, + .GetPhysicalDeviceFeatures = terminator_GetPhysicalDeviceFeatures, + .GetPhysicalDeviceFormatProperties = terminator_GetPhysicalDeviceFormatProperties, + .GetPhysicalDeviceImageFormatProperties = terminator_GetPhysicalDeviceImageFormatProperties, + .GetPhysicalDeviceProperties = terminator_GetPhysicalDeviceProperties, + .GetPhysicalDeviceQueueFamilyProperties = terminator_GetPhysicalDeviceQueueFamilyProperties, + .GetPhysicalDeviceMemoryProperties = terminator_GetPhysicalDeviceMemoryProperties, + .GetInstanceProcAddr = vkGetInstanceProcAddr, + .EnumerateDeviceExtensionProperties = terminator_EnumerateDeviceExtensionProperties, + .EnumerateDeviceLayerProperties = terminator_EnumerateDeviceLayerProperties, + .EnumeratePhysicalDeviceGroups = terminator_EnumeratePhysicalDeviceGroups, + .GetPhysicalDeviceFeatures2 = terminator_GetPhysicalDeviceFeatures2, + .GetPhysicalDeviceProperties2 = terminator_GetPhysicalDeviceProperties2, + .GetPhysicalDeviceFormatProperties2 = terminator_GetPhysicalDeviceFormatProperties2, + .GetPhysicalDeviceImageFormatProperties2 = terminator_GetPhysicalDeviceImageFormatProperties2, + .GetPhysicalDeviceQueueFamilyProperties2 = terminator_GetPhysicalDeviceQueueFamilyProperties2, + .GetPhysicalDeviceMemoryProperties2 = terminator_GetPhysicalDeviceMemoryProperties2, + .GetPhysicalDeviceExternalBufferProperties = terminator_GetPhysicalDeviceExternalBufferProperties, + .GetPhysicalDeviceExternalFenceProperties = terminator_GetPhysicalDeviceExternalFenceProperties, + .GetPhysicalDeviceExternalSemaphoreProperties = terminator_GetPhysicalDeviceExternalSemaphoreProperties, + + // ---- VK_KHR_surface extension commands + .DestroySurfaceKHR = terminator_DestroySurfaceKHR, + .GetPhysicalDeviceSurfaceSupportKHR = terminator_GetPhysicalDeviceSurfaceSupportKHR, + .GetPhysicalDeviceSurfaceCapabilitiesKHR = terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR, + .GetPhysicalDeviceSurfaceFormatsKHR = terminator_GetPhysicalDeviceSurfaceFormatsKHR, + .GetPhysicalDeviceSurfacePresentModesKHR = terminator_GetPhysicalDeviceSurfacePresentModesKHR, + + // ---- VK_KHR_swapchain extension commands + .GetPhysicalDevicePresentRectanglesKHR = terminator_GetPhysicalDevicePresentRectanglesKHR, + + // ---- VK_KHR_display extension commands + .GetPhysicalDeviceDisplayPropertiesKHR = terminator_GetPhysicalDeviceDisplayPropertiesKHR, + .GetPhysicalDeviceDisplayPlanePropertiesKHR = terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR, + .GetDisplayPlaneSupportedDisplaysKHR = terminator_GetDisplayPlaneSupportedDisplaysKHR, + .GetDisplayModePropertiesKHR = terminator_GetDisplayModePropertiesKHR, + .CreateDisplayModeKHR = terminator_CreateDisplayModeKHR, + .GetDisplayPlaneCapabilitiesKHR = terminator_GetDisplayPlaneCapabilitiesKHR, + .CreateDisplayPlaneSurfaceKHR = terminator_CreateDisplayPlaneSurfaceKHR, + + // ---- VK_KHR_performance_query extension commands + .EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR = terminator_EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR, + .GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR = terminator_GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR, + + // ---- VK_KHR_get_surface_capabilities2 extension commands + .GetPhysicalDeviceSurfaceCapabilities2KHR = terminator_GetPhysicalDeviceSurfaceCapabilities2KHR, + .GetPhysicalDeviceSurfaceFormats2KHR = terminator_GetPhysicalDeviceSurfaceFormats2KHR, + + // ---- VK_KHR_get_display_properties2 extension commands + .GetPhysicalDeviceDisplayProperties2KHR = terminator_GetPhysicalDeviceDisplayProperties2KHR, + .GetPhysicalDeviceDisplayPlaneProperties2KHR = terminator_GetPhysicalDeviceDisplayPlaneProperties2KHR, + .GetDisplayModeProperties2KHR = terminator_GetDisplayModeProperties2KHR, + .GetDisplayPlaneCapabilities2KHR = terminator_GetDisplayPlaneCapabilities2KHR, + + // ---- VK_KHR_fragment_shading_rate extension commands + .GetPhysicalDeviceFragmentShadingRatesKHR = terminator_GetPhysicalDeviceFragmentShadingRatesKHR, + + // ---- VK_KHR_object_refresh extension commands + .GetPhysicalDeviceRefreshableObjectTypesKHR = terminator_GetPhysicalDeviceRefreshableObjectTypesKHR, + + // ---- VK_EXT_direct_mode_display extension commands + .ReleaseDisplayEXT = terminator_ReleaseDisplayEXT, + + // ---- VK_EXT_display_surface_counter extension commands + .GetPhysicalDeviceSurfaceCapabilities2EXT = terminator_GetPhysicalDeviceSurfaceCapabilities2EXT, + + // ---- VK_EXT_debug_utils extension commands + .CreateDebugUtilsMessengerEXT = terminator_CreateDebugUtilsMessengerEXT, + .DestroyDebugUtilsMessengerEXT = terminator_DestroyDebugUtilsMessengerEXT, + .SubmitDebugUtilsMessageEXT = terminator_SubmitDebugUtilsMessageEXT, + + // ---- VK_EXT_sample_locations extension commands + .GetPhysicalDeviceMultisamplePropertiesEXT = terminator_GetPhysicalDeviceMultisamplePropertiesEXT, + + // ---- VK_EXT_calibrated_timestamps extension commands + .GetPhysicalDeviceCalibrateableTimeDomainsEXT = terminator_GetPhysicalDeviceCalibrateableTimeDomainsEXT, + + // ---- VK_EXT_headless_surface extension commands + .CreateHeadlessSurfaceEXT = terminator_CreateHeadlessSurfaceEXT, + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + .GetPhysicalDeviceSciSyncAttributesNV = terminator_GetPhysicalDeviceSciSyncAttributesNV, +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + .GetPhysicalDeviceExternalMemorySciBufPropertiesNV = terminator_GetPhysicalDeviceExternalMemorySciBufPropertiesNV, +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + .GetPhysicalDeviceSciBufAttributesNV = terminator_GetPhysicalDeviceSciBufAttributesNV, +#endif // VK_USE_PLATFORM_SCI +}; + +// A null-terminated list of all of the instance extensions supported by the loader. +// If an instance extension name is not in this list, but it is exported by one or more of the +// ICDs detected by the loader, then the extension name not in the list will be filtered out +// before passing the list of extensions to the application. +const char *const LOADER_INSTANCE_EXTENSIONS[] = { + VK_KHR_SURFACE_EXTENSION_NAME, + VK_KHR_DISPLAY_EXTENSION_NAME, + VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME, + VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME, + VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME, + VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, + VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME, + VK_EXT_DEBUG_UTILS_EXTENSION_NAME, + VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME, + VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, + VK_EXT_APPLICATION_PARAMETERS_EXTENSION_NAME, + NULL }; + diff --git a/loader/generated-vksc/vk_loader_extensions.h b/loader/generated-vksc/vk_loader_extensions.h new file mode 100644 index 000000000..c74721fdc --- /dev/null +++ b/loader/generated-vksc/vk_loader_extensions.h @@ -0,0 +1,320 @@ +// *** THIS FILE IS GENERATED - DO NOT EDIT *** +// See loader_extension_generator.py for modifications + +/* + * Copyright (c) 2015-2022 The Khronos Group Inc. + * Copyright (c) 2015-2022 Valve Corporation + * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 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. + * + * Author: Mark Lobodzinski + * Author: Mark Young + */ + +#pragma once + +// Structures defined externally, but used here +struct loader_instance; +struct loader_device; +struct loader_icd_term; +struct loader_dev_dispatch_table; + +// Device extension error function +VKAPI_ATTR VkResult VKAPI_CALL vkDevExtError(VkDevice dev); + +// Extension interception for vkGetInstanceProcAddr function, so we can return +// the appropriate information for any instance extensions we know about. +bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr); + +// Extension interception for vkCreateInstance function, so we can properly +// detect and enable any instance extension information for extensions we know +// about. +void extensions_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); + +// Extension interception for vkGetDeviceProcAddr function, so we can return +// an appropriate terminator if this is one of those few device commands requiring +// a terminator. +PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *dev, const char *name, bool* found_name); + +// Dispatch table properly filled in with appropriate terminators for the +// supported extensions. +extern const VkLayerInstanceDispatchTable instance_disp; + +// Array of extension strings for instance extensions we support. +extern const char *const LOADER_INSTANCE_EXTENSIONS[]; + +VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_term, VkInstance inst, + const PFN_vkGetInstanceProcAddr fp_gipa); + +// Init Device function pointer dispatch table with core commands +VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa, + VkDevice dev); + +// Init Device function pointer dispatch table with extension commands +VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct loader_dev_dispatch_table *dev_table, + PFN_vkGetInstanceProcAddr gipa, + PFN_vkGetDeviceProcAddr gdpa, + VkInstance inst, + VkDevice dev); + +// Init Instance function pointer dispatch table with core commands +VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, + VkInstance inst); + +// Init Instance function pointer dispatch table with core commands +VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, + VkInstance inst); + +// Device command lookup function +VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name, bool* name_found); + +// Instance command lookup function +VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name, + bool *found_name); + +// Loader core instance terminators +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( + const VkInstanceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkInstance* pInstance); +VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance( + VkInstance instance, + const VkAllocationCallbacks* pAllocator); +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDevices( + VkInstance instance, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures* pFeatures); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties* pFormatProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkImageFormatProperties* pImageFormatProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties* pQueueFamilyProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties* pMemoryProperties); +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL terminator_GetInstanceProcAddr( + VkInstance instance, + const char* pName); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice( + VkPhysicalDevice physicalDevice, + const VkDeviceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDevice* pDevice); +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceExtensionProperties( + const VkEnumerateInstanceExtensionPropertiesChain* chain, + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( + VkPhysicalDevice physicalDevice, + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceLayerProperties( + const VkEnumerateInstanceLayerPropertiesChain* chain, + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceVersion( + const VkEnumerateInstanceVersionChain* chain, + uint32_t* pApiVersion); +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( + VkInstance instance, + uint32_t* pPhysicalDeviceGroupCount, + VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2* pFeatures); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties2( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2* pProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties2* pFormatProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties2( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, + VkImageFormatProperties2* pImageFormatProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties2( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties2* pQueueFamilyProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties2( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties2* pMemoryProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalBufferProperties( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, + VkExternalBufferProperties* pExternalBufferProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalFenceProperties( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, + VkExternalFenceProperties* pExternalFenceProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalSemaphoreProperties( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, + VkExternalSemaphoreProperties* pExternalSemaphoreProperties); + +// ICD function pointer dispatch table +struct loader_icd_term_dispatch { + + // ---- Core SC 1_0 commands + PFN_vkCreateInstance CreateInstance; + PFN_vkDestroyInstance DestroyInstance; + PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; + PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures; + PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties; + PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties; + PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties; + PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties; + PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties; + PFN_vkGetDeviceProcAddr GetDeviceProcAddr; + PFN_vkCreateDevice CreateDevice; + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties; + PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; + PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties; + PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion; + PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups; + PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2; + PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2; + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2; + PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysicalDeviceImageFormatProperties2; + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2; + PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysicalDeviceMemoryProperties2; + PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties; + PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties; + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties; + + // ---- VK_KHR_surface extension commands + PFN_vkDestroySurfaceKHR DestroySurfaceKHR; + PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR; + PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR; + PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR; + PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR; + + // ---- VK_KHR_swapchain extension commands + PFN_vkGetPhysicalDevicePresentRectanglesKHR GetPhysicalDevicePresentRectanglesKHR; + + // ---- VK_KHR_display extension commands + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR; + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR; + PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR; + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR; + PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR; + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR; + PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR; + + // ---- VK_KHR_performance_query extension commands + PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR; + PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR; + + // ---- VK_KHR_get_surface_capabilities2 extension commands + PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR GetPhysicalDeviceSurfaceCapabilities2KHR; + PFN_vkGetPhysicalDeviceSurfaceFormats2KHR GetPhysicalDeviceSurfaceFormats2KHR; + + // ---- VK_KHR_get_display_properties2 extension commands + PFN_vkGetPhysicalDeviceDisplayProperties2KHR GetPhysicalDeviceDisplayProperties2KHR; + PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR GetPhysicalDeviceDisplayPlaneProperties2KHR; + PFN_vkGetDisplayModeProperties2KHR GetDisplayModeProperties2KHR; + PFN_vkGetDisplayPlaneCapabilities2KHR GetDisplayPlaneCapabilities2KHR; + + // ---- VK_KHR_fragment_shading_rate extension commands + PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR GetPhysicalDeviceFragmentShadingRatesKHR; + + // ---- VK_KHR_object_refresh extension commands + PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR GetPhysicalDeviceRefreshableObjectTypesKHR; + + // ---- VK_EXT_direct_mode_display extension commands + PFN_vkReleaseDisplayEXT ReleaseDisplayEXT; + + // ---- VK_EXT_display_surface_counter extension commands + PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT; + + // ---- VK_EXT_debug_utils extension commands + PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT; + PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT; + PFN_vkSubmitDebugUtilsMessageEXT SubmitDebugUtilsMessageEXT; + + // ---- VK_EXT_sample_locations extension commands + PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT GetPhysicalDeviceMultisamplePropertiesEXT; + + // ---- VK_EXT_calibrated_timestamps extension commands + PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT; + + // ---- VK_EXT_headless_surface extension commands + PFN_vkCreateHeadlessSurfaceEXT CreateHeadlessSurfaceEXT; + + // ---- VK_NV_external_sci_sync extension commands +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetPhysicalDeviceSciSyncAttributesNV GetPhysicalDeviceSciSyncAttributesNV; +#endif // VK_USE_PLATFORM_SCI + + // ---- VK_NV_external_memory_sci_buf extension commands +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV GetPhysicalDeviceExternalMemorySciBufPropertiesNV; +#endif // VK_USE_PLATFORM_SCI +#if defined(VK_USE_PLATFORM_SCI) + PFN_vkGetPhysicalDeviceSciBufAttributesNV GetPhysicalDeviceSciBufAttributesNV; +#endif // VK_USE_PLATFORM_SCI +}; + +struct loader_instance_extension_enables { + uint8_t ext_direct_mode_display; + uint8_t ext_display_surface_counter; + uint8_t ext_debug_utils; +}; + +// Functions that required a terminator need to have a separate dispatch table which contains their corresponding +// device function. This is used in the terminators themselves. +struct loader_device_terminator_dispatch { + // ---- VK_KHR_swapchain extension commands + PFN_vkCreateSwapchainKHR CreateSwapchainKHR; + PFN_vkGetDeviceGroupSurfacePresentModesKHR GetDeviceGroupSurfacePresentModesKHR; + // ---- VK_KHR_display_swapchain extension commands + PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR; + // ---- VK_EXT_debug_utils extension commands + PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT; + PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT; + PFN_vkQueueBeginDebugUtilsLabelEXT QueueBeginDebugUtilsLabelEXT; + PFN_vkQueueEndDebugUtilsLabelEXT QueueEndDebugUtilsLabelEXT; + PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsertDebugUtilsLabelEXT; + PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT; + PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT; + PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT; +}; + + diff --git a/loader/generated/vk_layer_dispatch_table.h b/loader/generated/vk_layer_dispatch_table.h index 7c775c51b..01b01b25a 100644 --- a/loader/generated/vk_layer_dispatch_table.h +++ b/loader/generated/vk_layer_dispatch_table.h @@ -5,6 +5,8 @@ * Copyright (c) 2015-2022 The Khronos Group Inc. * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/loader/generated/vk_loader_extensions.c b/loader/generated/vk_loader_extensions.c index 948c2f176..51a5ac493 100644 --- a/loader/generated/vk_loader_extensions.c +++ b/loader/generated/vk_loader_extensions.c @@ -5,6 +5,8 @@ * Copyright (c) 2015-2022 The Khronos Group Inc. * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/loader/generated/vk_loader_extensions.h b/loader/generated/vk_loader_extensions.h index ca8bbd279..260714e0d 100644 --- a/loader/generated/vk_loader_extensions.h +++ b/loader/generated/vk_loader_extensions.h @@ -5,6 +5,8 @@ * Copyright (c) 2015-2022 The Khronos Group Inc. * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/loader/gpa_helper.c b/loader/gpa_helper.c index b0aeb5c3c..784eb4336 100644 --- a/loader/gpa_helper.c +++ b/loader/gpa_helper.c @@ -3,6 +3,8 @@ * Copyright (c) 2015-2021 The Khronos Group Inc. * Copyright (c) 2015-2021 Valve Corporation * Copyright (c) 2015-2021 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +39,9 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures")) return vkGetPhysicalDeviceFeatures; if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties")) return vkGetPhysicalDeviceFormatProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties")) return vkGetPhysicalDeviceImageFormatProperties; +#ifndef VULKANSC if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties")) return vkGetPhysicalDeviceSparseImageFormatProperties; +#endif // VULKANSC if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) return vkGetPhysicalDeviceProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties")) return vkGetPhysicalDeviceQueueFamilyProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties")) return vkGetPhysicalDeviceMemoryProperties; @@ -51,18 +55,24 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkQueueWaitIdle")) return vkQueueWaitIdle; if (!strcmp(funcName, "vkDeviceWaitIdle")) return vkDeviceWaitIdle; if (!strcmp(funcName, "vkAllocateMemory")) return vkAllocateMemory; +#ifndef VULKANSC if (!strcmp(funcName, "vkFreeMemory")) return vkFreeMemory; +#endif // VULKANSC if (!strcmp(funcName, "vkMapMemory")) return vkMapMemory; if (!strcmp(funcName, "vkUnmapMemory")) return vkUnmapMemory; if (!strcmp(funcName, "vkFlushMappedMemoryRanges")) return vkFlushMappedMemoryRanges; if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges")) return vkInvalidateMappedMemoryRanges; if (!strcmp(funcName, "vkGetDeviceMemoryCommitment")) return vkGetDeviceMemoryCommitment; +#ifndef VULKANSC if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements")) return vkGetImageSparseMemoryRequirements; +#endif // VULKANSC if (!strcmp(funcName, "vkGetImageMemoryRequirements")) return vkGetImageMemoryRequirements; if (!strcmp(funcName, "vkGetBufferMemoryRequirements")) return vkGetBufferMemoryRequirements; if (!strcmp(funcName, "vkBindImageMemory")) return vkBindImageMemory; if (!strcmp(funcName, "vkBindBufferMemory")) return vkBindBufferMemory; +#ifndef VULKANSC if (!strcmp(funcName, "vkQueueBindSparse")) return vkQueueBindSparse; +#endif // VULKANSC if (!strcmp(funcName, "vkCreateFence")) return vkCreateFence; if (!strcmp(funcName, "vkDestroyFence")) return vkDestroyFence; if (!strcmp(funcName, "vkGetFenceStatus")) return vkGetFenceStatus; @@ -76,7 +86,9 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkSetEvent")) return vkSetEvent; if (!strcmp(funcName, "vkResetEvent")) return vkResetEvent; if (!strcmp(funcName, "vkCreateQueryPool")) return vkCreateQueryPool; +#ifndef VULKANSC if (!strcmp(funcName, "vkDestroyQueryPool")) return vkDestroyQueryPool; +#endif // VULKANSC if (!strcmp(funcName, "vkGetQueryPoolResults")) return vkGetQueryPoolResults; if (!strcmp(funcName, "vkCreateBuffer")) return vkCreateBuffer; if (!strcmp(funcName, "vkDestroyBuffer")) return vkDestroyBuffer; @@ -87,12 +99,16 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkGetImageSubresourceLayout")) return vkGetImageSubresourceLayout; if (!strcmp(funcName, "vkCreateImageView")) return vkCreateImageView; if (!strcmp(funcName, "vkDestroyImageView")) return vkDestroyImageView; +#ifndef VULKANSC if (!strcmp(funcName, "vkCreateShaderModule")) return vkCreateShaderModule; if (!strcmp(funcName, "vkDestroyShaderModule")) return vkDestroyShaderModule; +#endif // VULKANSC if (!strcmp(funcName, "vkCreatePipelineCache")) return vkCreatePipelineCache; if (!strcmp(funcName, "vkDestroyPipelineCache")) return vkDestroyPipelineCache; +#ifndef VULKANSC if (!strcmp(funcName, "vkGetPipelineCacheData")) return vkGetPipelineCacheData; if (!strcmp(funcName, "vkMergePipelineCaches")) return vkMergePipelineCaches; +#endif // VULKANSC if (!strcmp(funcName, "vkCreateGraphicsPipelines")) return vkCreateGraphicsPipelines; if (!strcmp(funcName, "vkCreateComputePipelines")) return vkCreateComputePipelines; if (!strcmp(funcName, "vkDestroyPipeline")) return vkDestroyPipeline; @@ -103,7 +119,9 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) return vkCreateDescriptorSetLayout; if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) return vkDestroyDescriptorSetLayout; if (!strcmp(funcName, "vkCreateDescriptorPool")) return vkCreateDescriptorPool; +#ifndef VULKANSC if (!strcmp(funcName, "vkDestroyDescriptorPool")) return vkDestroyDescriptorPool; +#endif // VULKANSC if (!strcmp(funcName, "vkResetDescriptorPool")) return vkResetDescriptorPool; if (!strcmp(funcName, "vkAllocateDescriptorSets")) return vkAllocateDescriptorSets; if (!strcmp(funcName, "vkFreeDescriptorSets")) return vkFreeDescriptorSets; @@ -114,7 +132,9 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkDestroyRenderPass")) return vkDestroyRenderPass; if (!strcmp(funcName, "vkGetRenderAreaGranularity")) return vkGetRenderAreaGranularity; if (!strcmp(funcName, "vkCreateCommandPool")) return vkCreateCommandPool; +#ifndef VULKANSC if (!strcmp(funcName, "vkDestroyCommandPool")) return vkDestroyCommandPool; +#endif // VULKANSC if (!strcmp(funcName, "vkResetCommandPool")) return vkResetCommandPool; if (!strcmp(funcName, "vkAllocateCommandBuffers")) return vkAllocateCommandBuffers; if (!strcmp(funcName, "vkFreeCommandBuffers")) return vkFreeCommandBuffers; @@ -174,8 +194,10 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties2")) return vkGetPhysicalDeviceImageFormatProperties2; if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties2")) return vkGetPhysicalDeviceQueueFamilyProperties2; if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties2")) return vkGetPhysicalDeviceMemoryProperties2; +#ifndef VULKANSC if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties2")) return vkGetPhysicalDeviceSparseImageFormatProperties2; +#endif // VULKANSC if (!strcmp(funcName, "vkGetPhysicalDeviceExternalBufferProperties")) return vkGetPhysicalDeviceExternalBufferProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceExternalSemaphoreProperties")) return vkGetPhysicalDeviceExternalSemaphoreProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceExternalFenceProperties")) return vkGetPhysicalDeviceExternalFenceProperties; @@ -185,15 +207,19 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkCmdSetDeviceMask")) return vkCmdSetDeviceMask; if (!strcmp(funcName, "vkCmdDispatchBase")) return vkCmdDispatchBase; if (!strcmp(funcName, "vkGetImageMemoryRequirements2")) return vkGetImageMemoryRequirements2; +#ifndef VULKANSC if (!strcmp(funcName, "vkTrimCommandPool")) return vkTrimCommandPool; +#endif // VULKANSC if (!strcmp(funcName, "vkGetDeviceQueue2")) return vkGetDeviceQueue2; if (!strcmp(funcName, "vkCreateSamplerYcbcrConversion")) return vkCreateSamplerYcbcrConversion; if (!strcmp(funcName, "vkDestroySamplerYcbcrConversion")) return vkDestroySamplerYcbcrConversion; if (!strcmp(funcName, "vkGetDescriptorSetLayoutSupport")) return vkGetDescriptorSetLayoutSupport; +#ifndef VULKANSC if (!strcmp(funcName, "vkCreateDescriptorUpdateTemplate")) return vkCreateDescriptorUpdateTemplate; if (!strcmp(funcName, "vkDestroyDescriptorUpdateTemplate")) return vkDestroyDescriptorUpdateTemplate; if (!strcmp(funcName, "vkUpdateDescriptorSetWithTemplate")) return vkUpdateDescriptorSetWithTemplate; if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements2")) return vkGetImageSparseMemoryRequirements2; +#endif // VULKANSC if (!strcmp(funcName, "vkGetBufferMemoryRequirements2")) return vkGetBufferMemoryRequirements2; // Core 1.2 functions @@ -211,6 +237,7 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkGetDeviceMemoryOpaqueCaptureAddress")) return vkGetDeviceMemoryOpaqueCaptureAddress; if (!strcmp(funcName, "vkResetQueryPool")) return vkResetQueryPool; +#ifndef VULKANSC // Core 1.3 functions if (!strcmp(funcName, "vkGetPhysicalDeviceToolProperties")) return vkGetPhysicalDeviceToolProperties; if (!strcmp(funcName, "vkCreatePrivateDataSlot")) return vkCreatePrivateDataSlot; @@ -249,6 +276,7 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcNam if (!strcmp(funcName, "vkGetDeviceBufferMemoryRequirements")) return vkGetDeviceBufferMemoryRequirements; if (!strcmp(funcName, "vkGetDeviceImageMemoryRequirements")) return vkGetDeviceImageMemoryRequirements; if (!strcmp(funcName, "vkGetDeviceImageSparseMemoryRequirements")) return vkGetDeviceImageSparseMemoryRequirements; +#endif // VULKANSC // Instance extensions void *addr; diff --git a/loader/loader.c b/loader/loader.c index 471a7d8c1..7983a3006 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -4,6 +4,8 @@ * Copyright (c) 2014-2023 Valve Corporation * Copyright (c) 2014-2023 LunarG, Inc. * Copyright (C) 2015 Google Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1207,6 +1209,7 @@ VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { goto out; } +#ifndef VULKANSC const VkExtensionProperties portability_enumeration_extension_info[] = { {VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION}}; @@ -1226,6 +1229,7 @@ VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { goto out; } +#endif // VULKANSC out: return res; @@ -1406,6 +1410,7 @@ VkResult loader_scanned_icd_init(const struct loader_instance *inst, struct load return res; } +#ifndef VULKANSC VkResult loader_add_direct_driver(const struct loader_instance *inst, uint32_t index, const VkDirectDriverLoadingInfoLUNARG *pDriver, struct loader_icd_tramp_list *icd_tramp_list) { // Assume pDriver is valid, since there is no real way to check it. Calling code should make sure the pointer to the array @@ -1620,6 +1625,7 @@ VkResult loader_scan_for_direct_drivers(const struct loader_instance *inst, cons return VK_SUCCESS; } +#endif // VULKANSC VkResult loader_scanned_icd_add(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, const char *filename, uint32_t api_version, enum loader_layer_library_status *lib_status) { @@ -1794,6 +1800,7 @@ VkResult loader_scanned_icd_add(const struct loader_instance *inst, struct loade icd_tramp_list->capacity *= 2; } +#ifndef VULKANSC loader_api_version api_version_struct = loader_make_version(api_version); if (interface_vers <= 4 && loader_check_version_meets_required(LOADER_VERSION_1_1_0, api_version_struct)) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, @@ -1801,6 +1808,7 @@ VkResult loader_scanned_icd_add(const struct loader_instance *inst, struct loade " Interface version 5 or newer required to support this version of Vulkan (Policy #LDP_DRIVER_7)", filename, api_version_struct.major, api_version_struct.minor, interface_vers); } +#endif // VULKANSC new_scanned_icd = &(icd_tramp_list->scanned_list[icd_tramp_list->count]); new_scanned_icd->handle = handle; @@ -2384,10 +2392,12 @@ VkResult loader_read_layer_json(const struct loader_instance *inst, struct loade // Parse component_layers if (NULL == library_path) { +#ifndef VULKANSC if (!loader_check_version_meets_required(LOADER_VERSION_1_1_0, version)) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Indicating meta-layer-specific component_layers, but using older JSON file version."); } +#endif // VULKANSC result = loader_parse_json_array_of_strings(inst, layer_node, "component_layers", &(props.component_layer_names)); if (VK_ERROR_OUT_OF_HOST_MEMORY == result) { @@ -3567,6 +3577,10 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t return res; } +#ifdef VULKANSC + // Ignore unused parameters + (void)pCreateInfo; +#else bool direct_driver_loading_exclusive_mode = false; res = loader_scan_for_direct_drivers(inst, pCreateInfo, icd_tramp_list, &direct_driver_loading_exclusive_mode); if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { @@ -3577,6 +3591,7 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t // were successfully found through the direct driver loading mechanism goto out; } +#endif // VULKANSC // Parse the filter environment variables to determine if we have any special behavior res = parse_generic_filter_environment_var(inst, VK_DRIVERS_SELECT_ENV_VAR, &select_filter); @@ -4238,6 +4253,7 @@ bool loader_get_layer_interface_version(PFN_vkNegotiateLoaderLayerInterfaceVersi return true; } +#ifndef VULKANSC // Every extension that has a loader-defined trampoline needs to be marked as enabled or disabled so that we know whether or // not to return that trampoline when vkGetDeviceProcAddr is called void setup_logical_device_enabled_layer_extensions(const struct loader_instance *inst, struct loader_device *dev, @@ -4264,6 +4280,7 @@ void setup_logical_device_enabled_layer_extensions(const struct loader_instance } } } +#endif // VULKANSC VKAPI_ATTR VkResult VKAPI_CALL loader_layer_create_device(VkInstance instance, VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, @@ -4318,7 +4335,9 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_layer_create_device(VkInstance instance, V goto out; } +#ifndef VULKANSC setup_logical_device_enabled_layer_extensions(inst, dev, &icd_exts, pCreateInfo); +#endif // VULKANSC res = loader_create_device_chain(internal_device, pCreateInfo, pAllocator, inst, dev, layerGIPA, nextGDPA); if (res != VK_SUCCESS) { @@ -4691,18 +4710,18 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c loader_init_instance_core_dispatch_table(&inst->disp->layer_inst_disp, next_gipa, *created_instance); inst->instance = *created_instance; - } - if (pCreateInfo->enabledLayerCount > 0 && pCreateInfo->ppEnabledLayerNames != NULL) { - res = create_string_list(inst, pCreateInfo->enabledLayerCount, &inst->enabled_layer_names); - if (res != VK_SUCCESS) { - return res; - } + if (pCreateInfo->enabledLayerCount > 0 && pCreateInfo->ppEnabledLayerNames != NULL) { + res = create_string_list(inst, pCreateInfo->enabledLayerCount, &inst->enabled_layer_names); + if (res != VK_SUCCESS) { + return res; + } - for (uint32_t i = 0; i < pCreateInfo->enabledLayerCount; ++i) { - res = copy_str_to_string_list(inst, &inst->enabled_layer_names, pCreateInfo->ppEnabledLayerNames[i], - strlen(pCreateInfo->ppEnabledLayerNames[i])); - if (res != VK_SUCCESS) return res; + for (uint32_t i = 0; i < pCreateInfo->enabledLayerCount; ++i) { + res = copy_str_to_string_list(inst, &inst->enabled_layer_names, pCreateInfo->ppEnabledLayerNames[i], + strlen(pCreateInfo->ppEnabledLayerNames[i])); + if (res != VK_SUCCESS) return res; + } } } @@ -4730,7 +4749,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre VkLayerDeviceLink *layer_device_link_info; VkLayerDeviceCreateInfo chain_info; VkDeviceCreateInfo loader_create_info; - VkDeviceGroupDeviceCreateInfoKHR *original_device_group_create_info_struct = NULL; + VkDeviceGroupDeviceCreateInfo *original_device_group_create_info_struct = NULL; VkResult res; PFN_vkGetDeviceProcAddr fpGDPA = NULL, nextGDPA = loader_gpa_device_terminator; @@ -4775,14 +4794,14 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre VkBaseOutStructure *pPrev = (VkBaseOutStructure *)&loader_create_info; while (NULL != pNext) { if (VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO == pNext->sType) { - VkDeviceGroupDeviceCreateInfoKHR *cur_struct = (VkDeviceGroupDeviceCreateInfoKHR *)pNext; + VkDeviceGroupDeviceCreateInfo *cur_struct = (VkDeviceGroupDeviceCreateInfo *)pNext; if (0 < cur_struct->physicalDeviceCount && NULL != cur_struct->pPhysicalDevices) { - VkDeviceGroupDeviceCreateInfoKHR *temp_struct = loader_stack_alloc(sizeof(VkDeviceGroupDeviceCreateInfoKHR)); + VkDeviceGroupDeviceCreateInfo *temp_struct = loader_stack_alloc(sizeof(VkDeviceGroupDeviceCreateInfo)); VkPhysicalDevice *phys_dev_array = NULL; if (NULL == temp_struct) { return VK_ERROR_OUT_OF_HOST_MEMORY; } - memcpy(temp_struct, cur_struct, sizeof(VkDeviceGroupDeviceCreateInfoKHR)); + memcpy(temp_struct, cur_struct, sizeof(VkDeviceGroupDeviceCreateInfo)); phys_dev_array = loader_stack_alloc(sizeof(VkPhysicalDevice) * cur_struct->physicalDeviceCount); if (NULL == phys_dev_array) { return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -4797,7 +4816,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre } temp_struct->pPhysicalDevices = phys_dev_array; - original_device_group_create_info_struct = (VkDeviceGroupDeviceCreateInfoKHR *)pPrev->pNext; + original_device_group_create_info_struct = (VkDeviceGroupDeviceCreateInfo *)pPrev->pNext; // Replace the old struct in the pNext chain with this one. pPrev->pNext = (VkBaseOutStructure *)temp_struct; @@ -4958,7 +4977,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre VkBaseOutStructure *pPrev = (VkBaseOutStructure *)&loader_create_info; while (NULL != pNext) { if (VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO == pNext->sType) { - VkDeviceGroupDeviceCreateInfoKHR *cur_struct = (VkDeviceGroupDeviceCreateInfoKHR *)pNext; + VkDeviceGroupDeviceCreateInfo *cur_struct = (VkDeviceGroupDeviceCreateInfo *)pNext; if (0 < cur_struct->physicalDeviceCount && NULL != cur_struct->pPhysicalDevices) { pPrev->pNext = (VkBaseOutStructure *)original_device_group_create_info_struct; } @@ -5248,6 +5267,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI } icd_create_info.ppEnabledExtensionNames = (const char *const *)filtered_extension_names; +#ifdef VULKANSC + // GPDP2 is part of Vulkan SC 1.0 + ptr_instance->supports_get_dev_prop_2 = true; +#else // Determine if Get Physical Device Properties 2 is available to this Instance if (pCreateInfo->pApplicationInfo && pCreateInfo->pApplicationInfo->apiVersion >= VK_API_VERSION_1_1) { ptr_instance->supports_get_dev_prop_2 = true; @@ -5259,6 +5282,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI } } } +#endif // VULKANSC for (uint32_t i = 0; i < ptr_instance->icd_tramp_list.count; i++) { icd_term = loader_icd_add(ptr_instance, &ptr_instance->icd_tramp_list.scanned_list[i]); @@ -5314,6 +5338,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI icd_create_info.enabledExtensionCount++; } } +#ifndef VULKANSC #if defined(LOADER_ENABLE_LINUX_SORT) // Force on "VK_KHR_get_physical_device_properties2" for Linux as we use it for GPU sorting. This // should be done if the API version of either the application or the driver does not natively support @@ -5344,6 +5369,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI } } } +#endif // VULKANSC loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&icd_exts); @@ -5375,6 +5401,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI } } +#ifndef VULKANSC // Remove the portability enumeration flag bit if the ICD doesn't support the extension if ((pCreateInfo->flags & VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR) == 1) { bool supports_portability_enumeration = false; @@ -5389,15 +5416,23 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI ? pCreateInfo->flags : pCreateInfo->flags & (~VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR); } +#endif // VULKANSC // Create an instance, substituting the version to 1.0 if necessary VkApplicationInfo icd_app_info; +#ifdef VULKANSC + const uint32_t api_variant = VKSC_API_VARIANT; + const uint32_t api_version_1_0 = VKSC_API_VERSION_1_0; +#else + const uint32_t api_variant = 0; + const uint32_t api_version_1_0 = VK_API_VERSION_1_0; +#endif // VULKANSC uint32_t icd_version_nopatch = - VK_MAKE_API_VERSION(0, VK_API_VERSION_MAJOR(icd_version), VK_API_VERSION_MINOR(icd_version), 0); + VK_MAKE_API_VERSION(api_variant, VK_API_VERSION_MAJOR(icd_version), VK_API_VERSION_MINOR(icd_version), 0); uint32_t requested_version = (pCreateInfo == NULL || pCreateInfo->pApplicationInfo == NULL) - ? VK_API_VERSION_1_0 + ? api_version_1_0 : pCreateInfo->pApplicationInfo->apiVersion; - if ((requested_version != 0) && (icd_version_nopatch == VK_API_VERSION_1_0)) { + if ((requested_version != 0) && (icd_version_nopatch == api_version_1_0)) { if (icd_create_info.pApplicationInfo == NULL) { memset(&icd_app_info, 0, sizeof(icd_app_info)); } else { @@ -5433,6 +5468,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI if (ptr_instance->icd_tramp_list.scanned_list[i].interface_version < 3 && ( +#ifndef VULKANSC #if defined(VK_USE_PLATFORM_XLIB_KHR) NULL != icd_term->dispatch.CreateXlibSurfaceKHR || #endif // VK_USE_PLATFORM_XLIB_KHR @@ -5448,6 +5484,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI #if defined(VK_USE_PLATFORM_WIN32_KHR) NULL != icd_term->dispatch.CreateWin32SurfaceKHR || #endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VULKANSC NULL != icd_term->dispatch.DestroySurfaceKHR)) { loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0, "terminator_CreateInstance: Driver %s supports interface version %u but still exposes VkSurfaceKHR" @@ -5594,7 +5631,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical struct loader_extension_list icd_exts; VkBaseOutStructure *caller_dgci_container = NULL; - VkDeviceGroupDeviceCreateInfoKHR *caller_dgci = NULL; + VkDeviceGroupDeviceCreateInfo *caller_dgci = NULL; if (NULL == dev) { loader_log(icd_term->this_instance, VULKAN_LOADER_WARN_BIT, 0, @@ -5713,6 +5750,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical } } +#ifndef VULKANSC // Handle loader emulation for structs that are not supported by the ICD: // Presently, the emulation leaves the pNext chain alone. This means that the ICD will receive items in the chain which // are not recognized by the ICD. If this causes the ICD to fail, then the items would have to be removed here. The current @@ -5745,7 +5783,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical } case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO: { - const VkDeviceGroupDeviceCreateInfoKHR *group_info = pNext; + const VkDeviceGroupDeviceCreateInfo *group_info = pNext; if (icd_term->dispatch.EnumeratePhysicalDeviceGroups == NULL && icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHR == NULL) { @@ -5805,6 +5843,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical } } } +#endif // VULKANSC // Every extension that has a loader-defined terminator needs to be marked as enabled or disabled so that we know whether or // not to return that terminator when vkGetDeviceProcAddr is called @@ -5813,6 +5852,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical dev->driver_extensions.khr_swapchain_enabled = true; } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME)) { dev->driver_extensions.khr_display_swapchain_enabled = true; +#ifndef VULKANSC } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_DEVICE_GROUP_EXTENSION_NAME)) { dev->driver_extensions.khr_device_group_enabled = true; } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { @@ -5822,6 +5862,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_MAINTENANCE_5_EXTENSION_NAME) && maintenance5_feature_enabled) { dev->should_ignore_device_commands_from_newer_version = true; +#endif // VULKANSC } } dev->layer_extensions.ext_debug_utils_enabled = icd_term->this_instance->enabled_known_extensions.ext_debug_utils; @@ -6793,7 +6834,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( struct loader_icd_term *icd_term; uint32_t total_count = 0; uint32_t cur_icd_group_count = 0; - VkPhysicalDeviceGroupPropertiesKHR **new_phys_dev_groups = NULL; + VkPhysicalDeviceGroupProperties **new_phys_dev_groups = NULL; struct loader_physical_device_group_term *local_phys_dev_groups = NULL; PFN_vkEnumeratePhysicalDeviceGroups fpEnumeratePhysicalDeviceGroups = NULL; struct loader_phys_dev_per_icd *sorted_phys_dev_array = NULL; @@ -6803,6 +6844,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( // internal value for those physical devices. icd_term = inst->icd_terms; for (uint32_t icd_idx = 0; NULL != icd_term; icd_term = icd_term->next, icd_idx++) { + cur_icd_group_count = 0; + +#ifndef VULKANSC // Get the function pointer to use to call into the ICD. This could be the core or KHR version if (inst->enabled_known_extensions.khr_device_group_creation) { fpEnumeratePhysicalDeviceGroups = icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHR; @@ -6810,7 +6854,6 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( fpEnumeratePhysicalDeviceGroups = icd_term->dispatch.EnumeratePhysicalDeviceGroups; } - cur_icd_group_count = 0; if (NULL == fpEnumeratePhysicalDeviceGroups) { // Treat each ICD's GPU as it's own group if the extension isn't supported res = icd_term->dispatch.EnumeratePhysicalDevices(icd_term->instance, &cur_icd_group_count, NULL); @@ -6821,7 +6864,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( icd_idx); continue; } - } else { + } else +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + fpEnumeratePhysicalDeviceGroups = icd_term->dispatch.EnumeratePhysicalDeviceGroups; +#endif // VULKANSC + { // Query the actual group info res = fpEnumeratePhysicalDeviceGroups(icd_term->instance, &cur_icd_group_count, NULL); if (res != VK_SUCCESS) { @@ -6875,6 +6924,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( for (uint8_t icd_idx = 0; NULL != icd_term; icd_term = icd_term->next, icd_idx++) { uint32_t count_this_time = total_count - cur_icd_group_count; +#ifndef VULKANSC // Get the function pointer to use to call into the ICD. This could be the core or KHR version if (inst->enabled_known_extensions.khr_device_group_creation) { fpEnumeratePhysicalDeviceGroups = icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHR; @@ -6913,7 +6963,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( local_phys_dev_groups[cur_index].group_props.physicalDevices[0] = phys_dev_array[indiv_gpu]; } - } else { + } else +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + fpEnumeratePhysicalDeviceGroups = icd_term->dispatch.EnumeratePhysicalDeviceGroups; +#endif // VULKANSC + { res = fpEnumeratePhysicalDeviceGroups(icd_term->instance, &count_this_time, NULL); if (res != VK_SUCCESS) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, @@ -6948,7 +7004,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( VkPhysicalDeviceGroupProperties *tmp_group_props = loader_stack_alloc(count_this_time * sizeof(VkPhysicalDeviceGroupProperties)); for (uint32_t group = 0; group < count_this_time; group++) { - tmp_group_props[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR; + tmp_group_props[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; uint32_t cur_index = group + cur_icd_group_count; if (*pPhysicalDeviceGroupCount > cur_index) { tmp_group_props[group].pNext = pPhysicalDeviceGroupProperties[cur_index].pNext; @@ -7070,8 +7126,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( } // If this physical device group isn't in the old buffer, create it if (group_properties != NULL && NULL == new_phys_dev_groups[idx]) { - new_phys_dev_groups[idx] = (VkPhysicalDeviceGroupPropertiesKHR *)loader_instance_heap_alloc( - inst, sizeof(VkPhysicalDeviceGroupPropertiesKHR), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + new_phys_dev_groups[idx] = (VkPhysicalDeviceGroupProperties *)loader_instance_heap_alloc( + inst, sizeof(VkPhysicalDeviceGroupProperties), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_dev_groups[idx]) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "terminator_EnumeratePhysicalDeviceGroups: Failed to allocate physical device group Terminator " @@ -7081,7 +7137,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - memcpy(new_phys_dev_groups[idx], group_properties, sizeof(VkPhysicalDeviceGroupPropertiesKHR)); + memcpy(new_phys_dev_groups[idx], group_properties, sizeof(VkPhysicalDeviceGroupProperties)); } ++idx; diff --git a/loader/loader.h b/loader/loader.h index 93346a9d7..2f0b59b6c 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -217,5 +217,7 @@ bool loader_check_version_meets_required(loader_api_version required, loader_api #endif #if !defined(LOADER_VERSION_1_1_0) +#ifndef VULKANSC #define LOADER_VERSION_1_1_0 loader_combine_version(1, 1, 0) +#endif // VULKANSC #endif diff --git a/loader/loader_common.h b/loader/loader_common.h index 2ff67f863..f146fb78b 100644 --- a/loader/loader_common.h +++ b/loader/loader_common.h @@ -4,6 +4,8 @@ * Copyright (c) 2014-2022 Valve Corporation * Copyright (c) 2014-2022 LunarG, Inc. * Copyright (C) 2015 Google Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +32,11 @@ #pragma once #include "vulkan/vk_platform.h" +#ifdef VULKANSC +#include +#else #include +#endif // VULKANSC #include #include @@ -287,7 +293,9 @@ struct loader_instance { uint32_t phys_dev_ext_disp_function_count; char *phys_dev_ext_disp_functions[MAX_NUM_UNKNOWN_EXTS]; +#ifndef VULKANSC struct loader_msg_callback_map_entry *icd_msg_callback_map; +#endif // VULKANSC struct loader_string_list enabled_layer_names; @@ -475,10 +483,12 @@ struct loader_phys_dev_per_icd { struct loader_icd_term *icd_term; }; +#ifndef VULKANSC struct loader_msg_callback_map_entry { VkDebugReportCallbackEXT icd_obj; VkDebugReportCallbackEXT loader_obj; }; +#endif // VULKANSC typedef enum loader_filter_string_type { FILTER_STRING_FULLNAME = 0, diff --git a/loader/loader_linux.c b/loader/loader_linux.c index 189ddd37b..271a23db3 100644 --- a/loader/loader_linux.c +++ b/loader/loader_linux.c @@ -3,6 +3,7 @@ * Copyright (c) 2021-2022 The Khronos Group Inc. * Copyright (c) 2021-2022 Valve Corporation * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -236,7 +237,9 @@ VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32 struct loader_phys_dev_per_icd *icd_devices, uint32_t phys_dev_count, struct loader_physical_device_term **sorted_device_term) { VkResult res = VK_SUCCESS; +#ifndef VULKANSC bool app_is_vulkan_1_1 = loader_check_version_meets_required(LOADER_VERSION_1_1_0, inst->app_api_version); +#endif // VULKANSC struct LinuxSortedDeviceInfo *sorted_device_info = loader_instance_heap_calloc( inst, phys_dev_count * sizeof(struct LinuxSortedDeviceInfo), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); @@ -266,8 +269,10 @@ VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32 sorted_device_info[index].vendor_id = dev_props.vendorID; sorted_device_info[index].device_id = dev_props.deviceID; +#ifndef VULKANSC bool device_is_1_1_capable = loader_check_version_meets_required(LOADER_VERSION_1_1_0, loader_make_version(dev_props.apiVersion)); +#endif // VULKANSC if (!sorted_device_info[index].has_pci_bus_info) { uint32_t ext_count = 0; icd_term->dispatch.EnumerateDeviceExtensionProperties(sorted_device_info[index].physical_device, NULL, &ext_count, @@ -297,11 +302,16 @@ VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = (VkBaseInStructure *)&pci_props}; PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = NULL; +#ifndef VULKANSC if (app_is_vulkan_1_1 && device_is_1_1_capable) { GetPhysDevProps2 = icd_term->dispatch.GetPhysicalDeviceProperties2; } else { GetPhysDevProps2 = (PFN_vkGetPhysicalDeviceProperties2)icd_term->dispatch.GetPhysicalDeviceProperties2KHR; } +#else + // vkGetPhysicalDeviceProperties2 is part of Vulkan SC 1.0 + GetPhysDevProps2 = icd_term->dispatch.GetPhysicalDeviceProperties2; +#endif // VULKANSC if (NULL != GetPhysDevProps2) { GetPhysDevProps2(sorted_device_info[index].physical_device, &dev_props2); sorted_device_info[index].pci_domain = pci_props.pciDomain; @@ -347,7 +357,9 @@ VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32 VkResult linux_sort_physical_device_groups(struct loader_instance *inst, uint32_t group_count, struct loader_physical_device_group_term *sorted_group_term) { VkResult res = VK_SUCCESS; +#ifndef VULKANSC bool app_is_vulkan_1_1 = loader_check_version_meets_required(LOADER_VERSION_1_1_0, inst->app_api_version); +#endif // VULKANSC loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "linux_sort_physical_device_groups: Original order:"); @@ -370,8 +382,10 @@ VkResult linux_sort_physical_device_groups(struct loader_instance *inst, uint32_ sorted_group_term[group].internal_device_info[gpu].vendor_id = dev_props.vendorID; sorted_group_term[group].internal_device_info[gpu].device_id = dev_props.deviceID; +#ifndef VULKANSC bool device_is_1_1_capable = loader_check_version_meets_required(LOADER_VERSION_1_1_0, loader_make_version(dev_props.apiVersion)); +#endif // VULKANSC if (!sorted_group_term[group].internal_device_info[gpu].has_pci_bus_info) { uint32_t ext_count; icd_term->dispatch.EnumerateDeviceExtensionProperties( @@ -400,11 +414,16 @@ VkResult linux_sort_physical_device_groups(struct loader_instance *inst, uint32_ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = (VkBaseInStructure *)&pci_props}; PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = NULL; +#ifndef VULKANSC if (app_is_vulkan_1_1 && device_is_1_1_capable) { GetPhysDevProps2 = icd_term->dispatch.GetPhysicalDeviceProperties2; } else { GetPhysDevProps2 = (PFN_vkGetPhysicalDeviceProperties2)icd_term->dispatch.GetPhysicalDeviceProperties2KHR; } +#else + // vkGetPhysicalDeviceProperties2 is part of Vulkan SC 1.0 + GetPhysDevProps2 = icd_term->dispatch.GetPhysicalDeviceProperties2; +#endif // VULKANSC if (NULL != GetPhysDevProps2) { GetPhysDevProps2(sorted_group_term[group].internal_device_info[gpu].physical_device, &dev_props2); sorted_group_term[group].internal_device_info[gpu].pci_domain = pci_props.pciDomain; diff --git a/loader/loader_windows.c b/loader/loader_windows.c index 0f6c2c88c..a55d2405b 100644 --- a/loader/loader_windows.c +++ b/loader/loader_windows.c @@ -798,6 +798,7 @@ VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint struct loader_phys_dev_per_icd **sorted_devices) { VkResult res = VK_SUCCESS; +#ifndef VULKANSC uint32_t sorted_alloc = 0; struct loader_icd_term *icd_term = NULL; IDXGIFactory6 *dxgi_factory = NULL; @@ -915,6 +916,11 @@ VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint } *sorted_devices_count = *sorted_devices_count; *sorted_devices = *sorted_devices; +#else + (void)inst; + (void)sorted_devices; + *sorted_devices_count = 0; +#endif // VULKANSC return res; } diff --git a/loader/log.h b/loader/log.h index 58db918b3..08d84cd9a 100644 --- a/loader/log.h +++ b/loader/log.h @@ -31,7 +31,11 @@ #include #include +#ifdef VULKANSC +#include +#else #include "vulkan/vulkan_core.h" +#endif // VULKANSC struct loader_instance; diff --git a/loader/settings.c b/loader/settings.c index c12ebac7a..a99fdd61f 100644 --- a/loader/settings.c +++ b/loader/settings.c @@ -226,6 +226,24 @@ VkResult check_if_settings_path_exists(const struct loader_instance* inst, char* return VK_SUCCESS; } VkResult get_unix_settings_path(const struct loader_instance* inst, char** settings_file_path) { +#ifdef VULKANSC + VkResult res = + check_if_settings_path_exists(inst, loader_secure_getenv("HOME", inst), + "/.local/share/vulkansc/loader_settings.d/" VK_LOADER_SETTINGS_FILENAME, settings_file_path); + if (res == VK_SUCCESS) { + return res; + } + // If HOME isn't set, fallback to XDG_DATA_HOME + res = check_if_settings_path_exists(inst, loader_secure_getenv("XDG_DATA_HOME", inst), + "/vulkansc/loader_settings.d/" VK_LOADER_SETTINGS_FILENAME, settings_file_path); + if (res == VK_SUCCESS) { + return res; + } + // if XDG_DATA_HOME isn't set, fallback to /etc. + // note that the settings_fil_path_suffix stays the same since its the same layout as for XDG_DATA_HOME + return check_if_settings_path_exists(inst, "/etc", "/vulkansc/loader_settings.d/" VK_LOADER_SETTINGS_FILENAME, + settings_file_path); +#else VkResult res = check_if_settings_path_exists(inst, loader_secure_getenv("HOME", inst), "/.local/share/vulkan/loader_settings.d/" VK_LOADER_SETTINGS_FILENAME, settings_file_path); @@ -242,6 +260,7 @@ VkResult get_unix_settings_path(const struct loader_instance* inst, char** setti // note that the settings_fil_path_suffix stays the same since its the same layout as for XDG_DATA_HOME return check_if_settings_path_exists(inst, "/etc", "/vulkan/loader_settings.d/" VK_LOADER_SETTINGS_FILENAME, settings_file_path); +#endif // VULKANSC } bool check_if_settings_are_equal(loader_settings* a, loader_settings* b) { diff --git a/loader/settings.h b/loader/settings.h index d3cd8b7cc..d4b9da09d 100644 --- a/loader/settings.h +++ b/loader/settings.h @@ -28,7 +28,11 @@ #include #include +#ifdef VULKANSC +#include +#else #include "vulkan/vulkan_core.h" +#endif // VULKANSC #include "log.h" diff --git a/loader/terminator.c b/loader/terminator.c index 656f35bd1..db0b2cd9c 100644 --- a/loader/terminator.c +++ b/loader/terminator.c @@ -4,6 +4,8 @@ * Copyright (c) 2014-2021 Valve Corporation * Copyright (c) 2014-2021 LunarG, Inc. * Copyright (C) 2015 Google Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,6 +100,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties pImageFormatProperties); } +#ifndef VULKANSC VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, @@ -110,6 +113,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperti tiling, pNumProperties, pProperties); } } +#endif // VULKANSC VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties) { @@ -129,6 +133,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2(VkPhysicalDevic VkPhysicalDeviceFeatures2 *pFeatures) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -179,12 +184,20 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2(VkPhysicalDevic } } } +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceFeatures2 fpGetPhysicalDeviceFeatures2 = icd_term->dispatch.GetPhysicalDeviceFeatures2; + // Pass the call to the driver + fpGetPhysicalDeviceFeatures2(phys_dev_term->phys_dev, pFeatures); +#endif // VULKANSC } VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -242,12 +255,20 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties2(VkPhysicalDev } } } +#else + // Get the function pointer to use to call into the ICD. This could be the core or KHR version + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceProperties2 fpGetPhysicalDeviceProperties2 = icd_term->dispatch.GetPhysicalDeviceProperties2; + // Pass the call to the driver + fpGetPhysicalDeviceProperties2(phys_dev_term->phys_dev, pProperties); +#endif // VULKANSC } VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -279,13 +300,22 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2(VkPhysi "pFormatProperties->pNext - this struct will be ignored"); } } +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceFormatProperties2 fpGetPhysicalDeviceFormatProperties2 = + icd_term->dispatch.GetPhysicalDeviceFormatProperties2; + // Pass the call to the driver + fpGetPhysicalDeviceFormatProperties2(phys_dev_term->phys_dev, format, pFormatProperties); +#endif // VULKANSC } VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties2( - VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, - VkImageFormatProperties2KHR *pImageFormatProperties) { + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, + VkImageFormatProperties2 *pImageFormatProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -319,13 +349,22 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties phys_dev_term->phys_dev, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, pImageFormatInfo->usage, pImageFormatInfo->flags, &pImageFormatProperties->imageFormatProperties); } +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceImageFormatProperties2 fpGetPhysicalDeviceImageFormatProperties2 = + icd_term->dispatch.GetPhysicalDeviceImageFormatProperties2; + // Pass the call to the driver + return fpGetPhysicalDeviceImageFormatProperties2(phys_dev_term->phys_dev, pImageFormatInfo, pImageFormatProperties); +#endif // VULKANSC } VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, - VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { + VkQueueFamilyProperties2 *pQueueFamilyProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -378,12 +417,21 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties2(Vk } } } +#else + // Get the function pointer to use to call into the ICD. This could be the core or KHR version + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 fpGetPhysicalDeviceQueueFamilyProperties2 = + icd_term->dispatch.GetPhysicalDeviceQueueFamilyProperties2; + // Pass the call to the driver + fpGetPhysicalDeviceQueueFamilyProperties2(phys_dev_term->phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties); +#endif // VULKANSC } VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -415,8 +463,17 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties2(VkPhysi "pMemoryProperties->pNext - this struct will be ignored"); } } +#else + // Get the function pointer to use to call into the ICD. This could be the core or KHR version + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceMemoryProperties2 fpGetPhysicalDeviceMemoryProperties2 = + icd_term->dispatch.GetPhysicalDeviceMemoryProperties2; + // Pass the call to the driver + fpGetPhysicalDeviceMemoryProperties2(phys_dev_term->phys_dev, pMemoryProperties); +#endif // VULKANSC } +#ifndef VULKANSC VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties2( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2KHR *pProperties) { @@ -486,12 +543,14 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperti } } } +#endif // VULKANSC VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalBufferProperties( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -528,6 +587,14 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalBufferProperties( "pExternalBufferProperties->pNext - this struct will be ignored"); } } +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceExternalBufferProperties fpGetPhysicalDeviceExternalBufferProperties = + icd_term->dispatch.GetPhysicalDeviceExternalBufferProperties; + // Pass the call to the driver + fpGetPhysicalDeviceExternalBufferProperties(phys_dev_term->phys_dev, pExternalBufferInfo, pExternalBufferProperties); +#endif // VULKANSC } VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalSemaphoreProperties( @@ -535,6 +602,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalSemaphoreProperti VkExternalSemaphoreProperties *pExternalSemaphoreProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -575,6 +643,14 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalSemaphoreProperti "pExternalSemaphoreProperties->pNext - this struct will be ignored"); } } +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties fpGetPhysicalDeviceExternalSemaphoreProperties = + icd_term->dispatch.GetPhysicalDeviceExternalSemaphoreProperties; + // Pass the call to the driver + fpGetPhysicalDeviceExternalSemaphoreProperties(phys_dev_term->phys_dev, pExternalSemaphoreInfo, pExternalSemaphoreProperties); +#endif // VULKANSC } VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalFenceProperties( @@ -582,6 +658,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalFenceProperties( VkExternalFenceProperties *pExternalFenceProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; +#ifndef VULKANSC const struct loader_instance *inst = icd_term->this_instance; assert(inst != NULL); @@ -620,8 +697,17 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceExternalFenceProperties( "pExternalFenceProperties->pNext - this struct will be ignored"); } } +#else + // Get the function pointer to use to call into the ICD. + // In Vulkan SC this is core and no emulation is required. + PFN_vkGetPhysicalDeviceExternalFenceProperties fpGetPhysicalDeviceExternalFenceProperties = + icd_term->dispatch.GetPhysicalDeviceExternalFenceProperties; + // Pass the call to the driver + fpGetPhysicalDeviceExternalFenceProperties(phys_dev_term->phys_dev, pExternalFenceInfo, pExternalFenceProperties); +#endif // VULKANSC } +#ifndef VULKANSC // 1.3 Core terminators VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t *pToolCount, @@ -648,3 +734,4 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolProperties(VkPhys *pToolCount = 0; return VK_SUCCESS; } +#endif // VULKANSC diff --git a/loader/trampoline.c b/loader/trampoline.c index 65809efb5..1d0ba8411 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -4,6 +4,8 @@ * Copyright (c) 2015-2023 Valve Corporation * Copyright (c) 2015-2023 LunarG, Inc. * Copyright (C) 2015 Google Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,9 +82,13 @@ LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkI // First check if instance is valid - loader_get_instance() returns NULL if it isn't. struct loader_instance *ptr_instance = loader_get_instance(instance); +#ifdef VULKANSC + if (ptr_instance != NULL) { +#else if (ptr_instance != NULL && loader_check_version_meets_required(loader_combine_version(1, 3, 0), ptr_instance->app_api_version)) { // New behavior +#endif // VULKANSC return NULL; } else { // Old behavior @@ -537,6 +543,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr goto out; } +#ifndef VULKANSC // Handle cases of VK_EXT_debug_report // Setup the temporary callback(s) here to catch early issues: res = util_CreateDebugReportCallbacks(ptr_instance, pCreateInfo->pNext, pAllocator); @@ -544,6 +551,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr // Failure of setting up one or more of the callback. goto out; } +#endif // VULKANSC VkResult settings_file_res = get_loader_settings(ptr_instance, &ptr_instance->settings); if (settings_file_res == VK_ERROR_OUT_OF_HOST_MEMORY) { @@ -554,6 +562,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr log_settings(ptr_instance, &ptr_instance->settings); } +#ifndef VULKANSC // Check the VkInstanceCreateInfoFlags wether to allow the portability enumeration flag if ((pCreateInfo->flags & VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR) == 1) { ptr_instance->portability_enumeration_flag_bit_set = true; @@ -571,15 +580,21 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr } } } +#endif // VULKANSC - // Make sure the application provided API version has 0 for its variant + // Make sure the application provided API version has the correct variant if (NULL != pCreateInfo->pApplicationInfo) { uint32_t variant_version = VK_API_VERSION_VARIANT(pCreateInfo->pApplicationInfo->apiVersion); - if (0 != variant_version) { +#ifdef VULKANSC + const uint32_t expected_variant = VKSC_API_VARIANT; +#else + const uint32_t expected_variant = 0; +#endif // VULKANSC + if (expected_variant != variant_version) { loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0, "vkCreateInstance: The API Variant specified in pCreateInfo->pApplicationInfo.apiVersion is %d instead of " - "the expected value of 0.", - variant_version); + "the expected value of %d.", + variant_version, expected_variant); } } @@ -615,6 +630,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr if (ptr_instance->icd_tramp_list.count == 0) { // No drivers found +#ifndef VULKANSC if (skipped_portability_drivers) { if (ptr_instance->portability_enumeration_extension_enabled && !ptr_instance->portability_enumeration_flag_bit_set) { loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, @@ -638,6 +654,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr "flags and enable the VK_KHR_portability_enumeration instance extension."); } } +#endif // VULKANSC loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "vkCreateInstance: Found no drivers!"); res = VK_ERROR_INCOMPATIBLE_DRIVER; goto out; @@ -1108,6 +1125,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, c return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory mem, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); @@ -1119,6 +1137,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceM disp->FreeMemory(device, mem, pAllocator); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void **ppData) { @@ -1227,6 +1246,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice d disp->GetImageMemoryRequirements(device, image, pMemoryRequirements); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { @@ -1268,6 +1288,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, ui return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) { @@ -1418,6 +1439,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); @@ -1429,6 +1451,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQ disp->DestroyQueryPool(device, queryPool, pAllocator); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, @@ -1551,6 +1574,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkI disp->DestroyImageView(device, imageView, pAllocator); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkShaderModule *pShader) { @@ -1575,6 +1599,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, disp->DestroyShaderModule(device, shaderModule, pAllocator); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, @@ -1601,6 +1626,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, disp->DestroyPipelineCache(device, pipelineCache, pAllocator); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, void *pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); @@ -1624,6 +1650,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice devi return disp->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, @@ -1755,6 +1782,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice dev return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); @@ -1766,6 +1794,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device disp->DestroyDescriptorPool(device, descriptorPool, pAllocator); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) { @@ -1894,6 +1923,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device return disp->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); @@ -1905,6 +1935,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, V disp->DestroyCommandPool(device, commandPool, pAllocator); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { @@ -2596,11 +2627,14 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysical abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) { disp->GetPhysicalDeviceFeatures2KHR(unwrapped_phys_dev, pFeatures); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceFeatures2(unwrapped_phys_dev, pFeatures); } } @@ -2615,11 +2649,14 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysic abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) { disp->GetPhysicalDeviceProperties2KHR(unwrapped_phys_dev, pProperties); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceProperties2(unwrapped_phys_dev, pProperties); } } @@ -2634,11 +2671,14 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(Vk abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) { disp->GetPhysicalDeviceFormatProperties2KHR(unwrapped_phys_dev, format, pFormatProperties); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceFormatProperties2(unwrapped_phys_dev, format, pFormatProperties); } } @@ -2654,11 +2694,14 @@ vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) { return disp->GetPhysicalDeviceImageFormatProperties2KHR(unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties); - } else { + } else +#endif // VULKANSC + { return disp->GetPhysicalDeviceImageFormatProperties2(unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties); } } @@ -2673,11 +2716,14 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyPropertie abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) { disp->GetPhysicalDeviceQueueFamilyProperties2KHR(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceQueueFamilyProperties2(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties); } } @@ -2692,15 +2738,19 @@ vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysical abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) { disp->GetPhysicalDeviceMemoryProperties2KHR(unwrapped_phys_dev, pMemoryProperties); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceMemoryProperties2(unwrapped_phys_dev, pMemoryProperties); } } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties) { @@ -2720,6 +2770,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatPro disp->GetPhysicalDeviceSparseImageFormatProperties2(unwrapped_phys_dev, pFormatInfo, pPropertyCount, pProperties); } } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, @@ -2732,17 +2783,20 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProper abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_external_memory_capabilities) { disp->GetPhysicalDeviceExternalBufferPropertiesKHR(unwrapped_phys_dev, pExternalBufferInfo, pExternalBufferProperties); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceExternalBufferProperties(unwrapped_phys_dev, pExternalBufferInfo, pExternalBufferProperties); } } LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties( - VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR *pExternalSemaphoreInfo, + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { @@ -2752,12 +2806,15 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePro abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_external_semaphore_capabilities) { disp->GetPhysicalDeviceExternalSemaphorePropertiesKHR(unwrapped_phys_dev, pExternalSemaphoreInfo, pExternalSemaphoreProperties); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceExternalSemaphoreProperties(unwrapped_phys_dev, pExternalSemaphoreInfo, pExternalSemaphoreProperties); } @@ -2774,11 +2831,14 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropert abort(); /* Intentionally fail so user can correct issue. */ } const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice); +#ifndef VULKANSC const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance; if (inst != NULL && inst->enabled_known_extensions.khr_external_fence_capabilities) { disp->GetPhysicalDeviceExternalFencePropertiesKHR(unwrapped_phys_dev, pExternalFenceInfo, pExternalFenceProperties); - } else { + } else +#endif // VULKANSC + { disp->GetPhysicalDeviceExternalFenceProperties(unwrapped_phys_dev, pExternalFenceInfo, pExternalFenceProperties); } } @@ -2862,6 +2922,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice disp->GetBufferMemoryRequirements2(device, pInfo, pMemoryRequirements); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2( VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) { @@ -2885,6 +2946,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCo } disp->TrimCommandPool(device, commandPool, flags); } +#endif // VULKANSC LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); @@ -2935,6 +2997,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevic disp->GetDescriptorSetLayoutSupport(device, pCreateInfo, pSupport); } +#ifndef VULKANSC LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) { @@ -2970,6 +3033,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDev } disp->UpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, pData); } +#endif // VULKANSC // ---- Vulkan core 1.2 trampolines @@ -3122,6 +3186,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkResetQueryPool(VkDevice device, VkQue disp->ResetQueryPool(device, queryPool, firstQuery, queryCount); } +#ifndef VULKANSC // ---- Vulkan core 1.3 trampolines // Instance @@ -3348,3 +3413,4 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit2(VkQueue queue, uint3 const VkLayerDispatchTable *disp = loader_get_dispatch(queue); return disp->QueueSubmit2(queue, submitCount, pSubmits, fence); } +#endif // VULKANSC diff --git a/loader/vk_loader_layer.h b/loader/vk_loader_layer.h index c051f6eb9..137f0ba98 100644 --- a/loader/vk_loader_layer.h +++ b/loader/vk_loader_layer.h @@ -3,6 +3,8 @@ * Copyright (c) 2016-2021 The Khronos Group Inc. * Copyright (c) 2016-2021 Valve Corporation * Copyright (c) 2016-2021 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +25,20 @@ #pragma once #include +#ifdef VULKANSC +#include +#else #include +#endif // Linked list node for tree of debug callbacks +#ifndef VULKANSC typedef struct VkDebugReportContent { VkDebugReportCallbackEXT msgCallback; PFN_vkDebugReportCallbackEXT pfnMsgCallback; VkFlags msgFlags; } VkDebugReportContent; +#endif // VULKANSC typedef struct VkDebugUtilsMessengerContent { VkDebugUtilsMessengerEXT messenger; @@ -42,7 +50,9 @@ typedef struct VkDebugUtilsMessengerContent { typedef struct VkLayerDbgFunctionNode_ { bool is_messenger; union { +#ifndef VULKANSC VkDebugReportContent report; +#endif // VULKANSC VkDebugUtilsMessengerContent messenger; }; void *pUserData; diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index 3a8cafb7e..31b491726 100644 --- a/loader/vk_loader_platform.h +++ b/loader/vk_loader_platform.h @@ -3,6 +3,8 @@ * Copyright (c) 2015-2022 The Khronos Group Inc. * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +57,7 @@ #include #include #include +#include #elif defined(_WIN32) // WinBase.h defines CreateSemaphore and synchapi.h defines CreateEvent @@ -126,7 +129,11 @@ #define PATH_SEPARATOR ':' #define DIRECTORY_SYMBOL '/' +#ifdef VULKANSC +#define VULKAN_DIR "vulkansc/" +#else #define VULKAN_DIR "vulkan/" +#endif // VULKANSC #define VULKAN_ICDCONF_DIR "icd.d" #define VULKAN_ICD_DIR "icd" #define VULKAN_SETTINGSCONF_DIR "settings.d" diff --git a/loader/vulkansc-1.def b/loader/vulkansc-1.def new file mode 100644 index 000000000..c2a6736cb --- /dev/null +++ b/loader/vulkansc-1.def @@ -0,0 +1,217 @@ + +;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Copyright (c) 2015-2017, 2019 The Khronos Group Inc. +; Copyright (c) 2015-2017, 2019 Valve Corporation +; Copyright (c) 2015-2017, 2019 LunarG, Inc. +; Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +; Copyright (c) 2023-2023 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. +; +; Author: Courtney Goeltzenleuchter +; Author: Charles Giessen +; +;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +LIBRARY vulkansc-1.dll +EXPORTS + vkCreateInstance + vkDestroyInstance + vkEnumeratePhysicalDevices + vkGetPhysicalDeviceFeatures + vkGetPhysicalDeviceFormatProperties + vkGetPhysicalDeviceImageFormatProperties + vkGetPhysicalDeviceProperties + vkGetPhysicalDeviceQueueFamilyProperties + vkGetPhysicalDeviceMemoryProperties + vkGetInstanceProcAddr + vkGetDeviceProcAddr + vkCreateDevice + vkDestroyDevice + vkEnumerateInstanceExtensionProperties + vkEnumerateDeviceExtensionProperties + vkEnumerateInstanceLayerProperties + vkEnumerateDeviceLayerProperties + vkGetDeviceQueue + vkQueueSubmit + vkQueueWaitIdle + vkDeviceWaitIdle + vkAllocateMemory + vkMapMemory + vkUnmapMemory + vkFlushMappedMemoryRanges + vkInvalidateMappedMemoryRanges + vkGetDeviceMemoryCommitment + vkBindBufferMemory + vkBindImageMemory + vkGetBufferMemoryRequirements + vkGetImageMemoryRequirements + vkCreateFence + vkDestroyFence + vkResetFences + vkGetFenceStatus + vkWaitForFences + vkCreateSemaphore + vkDestroySemaphore + vkCreateEvent + vkDestroyEvent + vkGetEventStatus + vkSetEvent + vkResetEvent + vkCreateQueryPool + vkGetQueryPoolResults + vkCreateBuffer + vkDestroyBuffer + vkCreateBufferView + vkDestroyBufferView + vkCreateImage + vkDestroyImage + vkGetImageSubresourceLayout + vkCreateImageView + vkDestroyImageView + vkCreatePipelineCache + vkDestroyPipelineCache + vkCreateGraphicsPipelines + vkCreateComputePipelines + vkDestroyPipeline + vkCreatePipelineLayout + vkDestroyPipelineLayout + vkCreateSampler + vkDestroySampler + vkCreateDescriptorSetLayout + vkDestroyDescriptorSetLayout + vkCreateDescriptorPool + vkResetDescriptorPool + vkAllocateDescriptorSets + vkFreeDescriptorSets + vkUpdateDescriptorSets + vkCreateFramebuffer + vkDestroyFramebuffer + vkCreateRenderPass + vkDestroyRenderPass + vkGetRenderAreaGranularity + vkCreateCommandPool + vkResetCommandPool + vkAllocateCommandBuffers + vkFreeCommandBuffers + vkBeginCommandBuffer + vkEndCommandBuffer + vkResetCommandBuffer + vkCmdBindPipeline + vkCmdSetViewport + vkCmdSetScissor + vkCmdSetLineWidth + vkCmdSetDepthBias + vkCmdSetBlendConstants + vkCmdSetDepthBounds + vkCmdSetStencilCompareMask + vkCmdSetStencilWriteMask + vkCmdSetStencilReference + vkCmdBindDescriptorSets + vkCmdBindIndexBuffer + vkCmdBindVertexBuffers + vkCmdDraw + vkCmdDrawIndexed + vkCmdDrawIndirect + vkCmdDrawIndexedIndirect + vkCmdDispatch + vkCmdDispatchIndirect + vkCmdCopyBuffer + vkCmdCopyImage + vkCmdBlitImage + vkCmdCopyBufferToImage + vkCmdCopyImageToBuffer + vkCmdUpdateBuffer + vkCmdFillBuffer + vkCmdClearColorImage + vkCmdClearDepthStencilImage + vkCmdClearAttachments + vkCmdResolveImage + vkCmdSetEvent + vkCmdResetEvent + vkCmdWaitEvents + vkCmdPipelineBarrier + vkCmdBeginQuery + vkCmdEndQuery + vkCmdResetQueryPool + vkCmdWriteTimestamp + vkCmdCopyQueryPoolResults + vkCmdPushConstants + vkCmdBeginRenderPass + vkCmdNextSubpass + vkCmdEndRenderPass + vkCmdExecuteCommands + vkDestroySurfaceKHR + vkGetPhysicalDeviceSurfaceSupportKHR + vkGetPhysicalDeviceSurfaceCapabilitiesKHR + vkGetPhysicalDeviceSurfaceFormatsKHR + vkGetPhysicalDeviceSurfaceCapabilities2KHR + vkGetPhysicalDeviceSurfaceFormats2KHR + vkGetPhysicalDeviceSurfacePresentModesKHR + vkCreateSwapchainKHR + vkGetSwapchainImagesKHR + vkAcquireNextImageKHR + vkQueuePresentKHR + vkGetPhysicalDeviceDisplayPropertiesKHR + vkGetPhysicalDeviceDisplayPlanePropertiesKHR + vkGetDisplayPlaneSupportedDisplaysKHR + vkGetDisplayModePropertiesKHR + vkCreateDisplayModeKHR + vkGetDisplayPlaneCapabilitiesKHR + vkCreateDisplayPlaneSurfaceKHR + vkCreateSharedSwapchainsKHR + vkCreateHeadlessSurfaceEXT + vkEnumerateInstanceVersion + vkEnumeratePhysicalDeviceGroups + vkGetPhysicalDeviceFeatures2 + vkGetPhysicalDeviceProperties2 + vkGetPhysicalDeviceFormatProperties2 + vkGetPhysicalDeviceQueueFamilyProperties2 + vkGetPhysicalDeviceMemoryProperties2 + vkGetPhysicalDeviceExternalBufferProperties + vkGetPhysicalDeviceExternalSemaphoreProperties + vkGetPhysicalDeviceExternalFenceProperties + vkBindBufferMemory2 + vkBindImageMemory2 + vkGetDeviceGroupPeerMemoryFeatures + vkCmdSetDeviceMask + vkCmdDispatchBase + vkGetImageMemoryRequirements2 + vkGetBufferMemoryRequirements2 + vkGetDeviceQueue2 + vkCreateSamplerYcbcrConversion + vkDestroySamplerYcbcrConversion + vkGetDescriptorSetLayoutSupport + vkGetDeviceGroupPresentCapabilitiesKHR + vkGetDeviceGroupSurfacePresentModesKHR + vkGetPhysicalDevicePresentRectanglesKHR + vkAcquireNextImage2KHR + vkGetPhysicalDeviceDisplayProperties2KHR + vkGetPhysicalDeviceDisplayPlaneProperties2KHR + vkGetDisplayModeProperties2KHR + vkGetDisplayPlaneCapabilities2KHR + vkGetPhysicalDeviceImageFormatProperties2 + vkCreateRenderPass2 + vkCmdBeginRenderPass2 + vkCmdNextSubpass2 + vkCmdEndRenderPass2 + vkCmdDrawIndirectCount + vkCmdDrawIndexedIndirectCount + vkGetSemaphoreCounterValue + vkWaitSemaphores + vkSignalSemaphore + vkGetBufferDeviceAddress + vkGetBufferOpaqueCaptureAddress + vkGetDeviceMemoryOpaqueCaptureAddress + vkResetQueryPool diff --git a/loader/wsi.c b/loader/wsi.c index 8c86733c5..518771925 100644 --- a/loader/wsi.c +++ b/loader/wsi.c @@ -2,6 +2,8 @@ * Copyright (c) 2015-2022 The Khronos Group Inc. * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +46,7 @@ void wsi_create_instance(struct loader_instance *loader_inst, const VkInstanceCr loader_inst->wsi_surface_enabled = true; continue; } +#ifndef VULKANSC #if defined(VK_USE_PLATFORM_WIN32_KHR) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_win32_surface_enabled = true; @@ -68,6 +71,7 @@ void wsi_create_instance(struct loader_instance *loader_inst, const VkInstanceCr continue; } #endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VULKANSC #if defined(VK_USE_PLATFORM_DIRECTFB_EXT) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_directfb_surface_enabled = true; @@ -503,6 +507,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSwapchainKHR(VkDevice device, co return dev->loader_dispatch.extension_terminator_dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } +#ifndef VULKANSC // This is the trampoline entrypoint for DestroySwapchainKHR LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { @@ -514,6 +519,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, } disp->DestroySwapchainKHR(device, swapchain, pAllocator); } +#endif // VULKANSC // This is the trampoline entrypoint for GetSwapchainImagesKHR LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, @@ -571,6 +577,7 @@ VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, size_t return pIcdSurface; } +#ifndef VULKANSC #if defined(VK_USE_PLATFORM_WIN32_KHR) // Functions for the VK_KHR_win32_surface extension: @@ -1060,6 +1067,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSuppo return icd_term->dispatch.GetPhysicalDeviceXlibPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, dpy, visualID); } #endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VULKANSC #if defined(VK_USE_PLATFORM_DIRECTFB_EXT) @@ -2598,12 +2606,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2K if (icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilities2KHR != NULL) { VkBaseOutStructure *pNext = (VkBaseOutStructure *)pSurfaceCapabilities->pNext; while (pNext != NULL) { +#ifndef VULKANSC if ((int)pNext->sType == VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR) { // Not all ICDs may be supporting VK_KHR_surface_protected_capabilities // Initialize VkSurfaceProtectedCapabilitiesKHR.supportsProtected to false and // if an ICD supports protected surfaces, it will reset it to true accordingly. ((VkSurfaceProtectedCapabilitiesKHR *)pNext)->supportsProtected = VK_FALSE; } +#endif // VULKANSC pNext = (VkBaseOutStructure *)pNext->pNext; } @@ -2811,10 +2821,12 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char *addr = (void *)vkCreateSwapchainKHR; return true; } +#ifndef VULKANSC if (!strcmp("vkDestroySwapchainKHR", name)) { *addr = (void *)vkDestroySwapchainKHR; return true; } +#endif // VULKANSC if (!strcmp("vkGetSwapchainImagesKHR", name)) { *addr = (void *)vkGetSwapchainImagesKHR; return true; @@ -2832,6 +2844,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } +#ifndef VULKANSC #if defined(VK_USE_PLATFORM_WIN32_KHR) // Functions for the VK_KHR_win32_surface extension: @@ -2880,6 +2893,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VULKANSC #if defined(VK_USE_PLATFORM_DIRECTFB_EXT) // Functions for the VK_EXT_directfb_surface extension: diff --git a/loader/wsi.h b/loader/wsi.h index 07cc3f2d0..0e5919006 100644 --- a/loader/wsi.h +++ b/loader/wsi.h @@ -103,6 +103,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKH VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes); +#ifndef VULKANSC #if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); @@ -133,6 +134,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSuppo uint32_t queueFamilyIndex, Display *dpy, VisualID visualID); #endif +#endif // VULKANSC #if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDirectFBSurfaceEXT(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo, diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 4fce83e1b..2f11e9a3d 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -40,6 +40,8 @@ if (UPDATE_DEPS) endif() list(APPEND update_dep_command "--config") list(APPEND update_dep_command "${_build_type}") + list(APPEND update_dep_command "--api") + list(APPEND update_dep_command "${API_TYPE}") set(UPDATE_DEPS_DIR_SUFFIX "${_build_type}") if (ANDROID) diff --git a/scripts/common_codegen.py b/scripts/common_codegen.py index 92ebb5a72..77bb8c6ea 100644 --- a/scripts/common_codegen.py +++ b/scripts/common_codegen.py @@ -3,6 +3,8 @@ # Copyright (c) 2015-2017, 2019-2021 The Khronos Group Inc. # Copyright (c) 2015-2017, 2019-2021 Valve Corporation # Copyright (c) 2015-2017, 2019-2021 LunarG, Inc. +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2023 RasterGrid Kft. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,6 +62,7 @@ 'xlib_xrandr' : 'VK_USE_PLATFORM_XLIB_XRANDR_EXT', 'provisional' : 'VK_ENABLE_BETA_EXTENSIONS', 'screen' : 'VK_USE_PLATFORM_SCREEN_QNX', + 'sci': 'VK_USE_PLATFORM_SCI' } # diff --git a/scripts/dispatch_table_helper_generator.py b/scripts/dispatch_table_helper_generator.py index 67af7be1d..3fcc5db26 100644 --- a/scripts/dispatch_table_helper_generator.py +++ b/scripts/dispatch_table_helper_generator.py @@ -4,6 +4,8 @@ # Copyright (c) 2015-2021 Valve Corporation # Copyright (c) 2015-2021 LunarG, Inc. # Copyright (c) 2015-2021 Google Inc. +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2023 RasterGrid Kft. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -110,6 +112,8 @@ def beginFile(self, genOpts): copyright += ' * Copyright (c) 2015-2021 The Khronos Group Inc.\n' copyright += ' * Copyright (c) 2015-2021 Valve Corporation\n' copyright += ' * Copyright (c) 2015-2021 LunarG, Inc.\n' + copyright += ' * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n' + copyright += ' * Copyright (c) 2023-2023 RasterGrid Kft.\n' copyright += ' *\n' copyright += ' * Licensed under the Apache License, Version 2.0 (the "License");\n' copyright += ' * you may not use this file except in compliance with the License.\n' @@ -129,7 +133,10 @@ def beginFile(self, genOpts): copyright += ' */\n' preamble = '' - preamble += '#include \n' + if genOpts.apiname == 'vulkansc': + preamble += '#include \n' + else: + preamble += '#include \n' preamble += '#include \n' preamble += '#include \n' preamble += '#include "loader/generated/vk_layer_dispatch_table.h"\n' diff --git a/scripts/generate_source.py b/scripts/generate_source.py index 16a2b4700..d92a8a0a9 100755 --- a/scripts/generate_source.py +++ b/scripts/generate_source.py @@ -3,6 +3,8 @@ # Copyright (c) 2019 Valve Corporation # Copyright (c) 2019 LunarG, Inc. # Copyright (c) 2019 Google Inc. +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2023 RasterGrid Kft. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,21 +37,39 @@ def main(argv): parser = argparse.ArgumentParser(description='Generate source code for this repository') parser.add_argument('registry', metavar='REGISTRY_PATH', help='path to the Vulkan-Headers registry directory') + parser.add_argument('--api', + default='vulkan', + choices=['vulkan', 'vulkansc'], + help='Specify API name to generate') parser.add_argument('--generated-version', help='sets the header version used to generate the repo') group = parser.add_mutually_exclusive_group() group.add_argument('-i', '--incremental', action='store_true', help='only update repo files that change') group.add_argument('-v', '--verify', action='store_true', help='verify repo files match generator output') args = parser.parse_args(argv) + vksc_filenames =['vk_layer_dispatch_table.h', + 'vk_loader_extensions.h', + 'vk_loader_extensions.c'] + + vk_filenames =['vk_layer_dispatch_table.h', + 'vk_loader_extensions.h', + 'vk_loader_extensions.c', + 'vk_object_types.h'] + + gen_filenames = vk_filenames + + if args.api == 'vulkansc' : + gen_filenames = vksc_filenames + gen_cmds = [[common_codegen.repo_relative('scripts/loader_genvk.py'), + '-api', args.api, '-registry', os.path.abspath(os.path.join(args.registry, 'vk.xml')), '-quiet', - filename] for filename in ['vk_layer_dispatch_table.h', - 'vk_loader_extensions.h', - 'vk_loader_extensions.c', - 'vk_object_types.h']] + filename] for filename in gen_filenames] repo_dir = common_codegen.repo_relative('loader/generated') + if args.api == 'vulkansc': + repo_dir = common_codegen.repo_relative('loader/generated-vksc') # get directory where generators will run if args.verify or args.incremental: diff --git a/scripts/known_good.json b/scripts/known_good.json index bc6334e2f..7b77c9764 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -2,12 +2,25 @@ "repos": [ { "name": "Vulkan-Headers", + "api": "vulkan", "url": "https://github.com/KhronosGroup/Vulkan-Headers.git", "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", "commit": "v1.3.268" }, + { + "name": "Vulkan-Headers", + "api": "vulkansc", + "url": "https://github.com/KhronosGroup/VulkanSC-Headers.git", + "sub_dir": "Vulkan-Headers", + "build_dir": "Vulkan-Headers/build", + "install_dir": "Vulkan-Headers/build/install", + "cmake_options": [ + "-DVULKANSC=ON" + ], + "commit": "sc_next" + }, { "name": "googletest", "url": "https://github.com/google/googletest.git", diff --git a/scripts/loader_extension_generator.py b/scripts/loader_extension_generator.py index c52ca8862..6b2ac94fc 100644 --- a/scripts/loader_extension_generator.py +++ b/scripts/loader_extension_generator.py @@ -4,6 +4,8 @@ # Copyright (c) 2015-2022 Valve Corporation # Copyright (c) 2015-2022 LunarG, Inc. # Copyright (c) 2015-2017 Google Inc. +# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2023 RasterGrid Kft. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -194,6 +196,8 @@ def beginFile(self, genOpts): copyright += ' * Copyright (c) 2015-2022 The Khronos Group Inc.\n' copyright += ' * Copyright (c) 2015-2022 Valve Corporation\n' copyright += ' * Copyright (c) 2015-2022 LunarG, Inc.\n' + copyright += ' * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n' + copyright += ' * Copyright (c) 2023-2023 RasterGrid Kft.\n' copyright += ' *\n' copyright += ' * Licensed under the Apache License, Version 2.0 (the "License");\n' copyright += ' * you may not use this file except in compliance with the License.\n' @@ -335,6 +339,15 @@ def getLen(self, param): result = str(result).replace('::', '->') return result + # + # Translate Vulkan API version to Vulkan SC API version + def translateVersion(self, version): + if self.genOpts.apiname == 'vulkansc': + if version in ['VK_VERSION_1_0', 'VK_VERSION_1_1', 'VK_VERSION_1_2']: + # Vulkan 1.0-1.2 is included in Vulkan SC 1.0 + version = 'VKSC_VERSION_1_0' + return version + # # Determine if this API should be ignored or added to the instance or device dispatch table def AddCommandToDispatchList(self, extension_name, extension_type, name, cmdinfo, handle_type): @@ -369,6 +382,13 @@ def AddCommandToDispatchList(self, extension_name, extension_type, name, cmdinfo cmd_params.append(self.CommandParam(type=param_type, name=param_name, cdecl=param_cdecl)) + extension_name = self.translateVersion(extension_name) + + if self.genOpts.apiname == 'vulkansc': + if 'VK_VERSION_' in extension_name: + # Do not handle commands in Vulkan versions not included in a Vulkan SC version + return + if handle is not None and handle_type != 'VkInstance' and handle_type != 'VkPhysicalDevice': # The Core Vulkan code will be wrapped in a feature called VK_VERSION_#_# # For example: VK_VERSION_1_0 wraps the core 1.0 Vulkan functionality @@ -382,6 +402,16 @@ def AddCommandToDispatchList(self, extension_name, extension_type, name, cmdinfo handle_type = handle_type, params = cmd_params, cdecl=self.makeCDecls(cmdinfo.elem)[0])) + elif 'VKSC_VERSION_' in extension_name: + self.core_commands.append( + self.CommandData(name=name, ext_name=extension_name, + ext_type='device', + require=require, + protect=self.featureExtraProtect, + return_type = return_type, + handle_type = handle_type, + params = cmd_params, + cdecl=self.makeCDecls(cmdinfo.elem)[0])) else: self.ext_device_dispatch_list.append((name, self.featureExtraProtect)) self.ext_commands.append( @@ -406,7 +436,16 @@ def AddCommandToDispatchList(self, extension_name, extension_type, name, cmdinfo handle_type = handle_type, params = cmd_params, cdecl=self.makeCDecls(cmdinfo.elem)[0])) - + elif 'VKSC_VERSION_' in extension_name: + self.core_commands.append( + self.CommandData(name=name, ext_name=extension_name, + ext_type='instance', + require=require, + protect=self.featureExtraProtect, + return_type = return_type, + handle_type = handle_type, + params = cmd_params, + cdecl=self.makeCDecls(cmdinfo.elem)[0])) else: self.ext_instance_dispatch_list.append((name, self.featureExtraProtect)) self.ext_commands.append( @@ -538,6 +577,8 @@ def OutputLayerInstanceDispatchTable(self): if cur_cmd.ext_name != cur_extension_name: if 'VK_VERSION_' in cur_cmd.ext_name: table += '\n // ---- Core %s commands\n' % cur_cmd.ext_name[11:] + elif 'VKSC_VERSION_' in cur_cmd.ext_name: + table += '\n // ---- Core SC %s commands\n' % cur_cmd.ext_name[13:] else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -581,6 +622,8 @@ def OutputLayerDeviceDispatchTable(self): if cur_cmd.ext_name != cur_extension_name: if 'VK_VERSION_' in cur_cmd.ext_name: table += '\n // ---- Core %s commands\n' % cur_cmd.ext_name[11:] + elif 'VKSC_VERSION_' in cur_cmd.ext_name: + table += '\n // ---- Core SC %s commands\n' % cur_cmd.ext_name[13:] else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -630,6 +673,8 @@ def OutputIcdDispatchTable(self): if cur_cmd.ext_name != cur_extension_name: if 'VK_VERSION_' in cur_cmd.ext_name: table += '\n // ---- Core %s commands\n' % cur_cmd.ext_name[11:] + elif 'VKSC_VERSION_' in cur_cmd.ext_name: + table += '\n // ---- Core SC %s commands\n' % cur_cmd.ext_name[13:] else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -691,6 +736,9 @@ def OutputIcdDispatchTableInit(self): if 'VK_VERSION_' in cur_cmd.ext_name: table += '\n // ---- Core %s\n' % cur_cmd.ext_name[11:] required = cur_cmd.ext_name == 'VK_VERSION_1_0' + elif 'VKSC_VERSION_' in cur_cmd.ext_name: + table += '\n // ---- Core SC %s\n' % cur_cmd.ext_name[13:] + required = cur_cmd.ext_name == 'VKSC_VERSION_1_0' else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name required = False @@ -724,7 +772,7 @@ def OutputIcdExtensionEnableUnion(self): union = '' union += 'struct loader_instance_extension_enables {\n' for ext in extensions: - if ('VK_VERSION_' in ext.name or ext.name in WSI_EXT_NAMES or + if ('VK_VERSION_' in ext.name or 'VKSC_VERSION_' in ext.name or ext.name in WSI_EXT_NAMES or ext.type == 'device' or ext.num_commands == 0): continue @@ -821,6 +869,8 @@ def OutputLoaderDispatchTables(self): if cur_cmd.ext_name != cur_extension_name: if 'VK_VERSION_' in cur_cmd.ext_name: tables += '\n // ---- Core %s commands\n' % cur_cmd.ext_name[11:] + elif 'VKSC_VERSION_' in cur_cmd.ext_name: + tables += '\n // ---- Core SC %s commands\n' % cur_cmd.ext_name[13:] else: tables += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -915,6 +965,10 @@ def OutputLoaderLookupFunc(self): tables += '\n // ---- Core %s commands\n' % cur_cmd.ext_name[11:] if cur_type == 'device': version_check = f' if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_{cur_cmd.ext_name[11:]}) return NULL;\n' + elif 'VKSC_VERSION_' in cur_cmd.ext_name: + tables += '\n // ---- Core SC %s commands\n' % cur_cmd.ext_name[13:] + if cur_type == 'device': + version_check = f' if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_{cur_cmd.ext_name[13:]}) return NULL;\n' else: tables += '\n // ---- %s extension commands\n' % cur_cmd.ext_name @@ -1000,6 +1054,8 @@ def CreateTrampTermFuncs(self): if ext_cmd.ext_name != cur_extension_name: if 'VK_VERSION_' in ext_cmd.ext_name: funcs += '\n// ---- Core %s trampoline/terminators\n\n' % ext_cmd.ext_name[11:] + elif 'VKSC_VERSION_' in ext_cmd.ext_name: + funcs += '\n// ---- Core SC %s trampoline/terminators\n\n' % ext_cmd.ext_name[13:] else: funcs += '\n// ---- %s extension trampoline/terminators\n\n' % ext_cmd.ext_name cur_extension_name = ext_cmd.ext_name @@ -1387,6 +1443,7 @@ def InstExtensionGPA(self): for cur_cmd in self.ext_commands: if ('VK_VERSION_' in cur_cmd.ext_name or + 'VKSC_VERSION_' in cur_cmd.ext_name or cur_cmd.ext_name in WSI_EXT_NAMES or cur_cmd.ext_name in AVOID_EXT_NAMES or cur_cmd.name in AVOID_CMD_NAMES ): @@ -1438,7 +1495,7 @@ def InstantExtensionCreate(self): create_func += 'void extensions_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) {\n' create_func += ' for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {\n' for ext in entries: - if ('VK_VERSION_' in ext.name or ext.name in WSI_EXT_NAMES or + if ('VK_VERSION_' in ext.name or 'VKSC_VERSION_' in ext.name or ext.name in WSI_EXT_NAMES or ext.name in AVOID_EXT_NAMES or ext.name in AVOID_CMD_NAMES or ext.type == 'device' or ext.num_commands == 0): continue @@ -1490,6 +1547,8 @@ def DeviceExtensionGetTerminator(self): if ext_cmd.name in DEVICE_CMDS_NEED_TERM: if 'VK_VERSION_' in ext_cmd.ext_name: term_func += f' // ---- Core {ext_cmd.ext_name[11:]} commands\n' + elif 'VKSC_VERSION_' in ext_cmd.ext_name: + term_func += f' // ---- Core SC {ext_cmd.ext_name[13:]} commands\n' else: last_protect = ext_cmd.protect if ext_cmd.protect is not None: @@ -1529,6 +1588,8 @@ def OutputDeviceFunctionTerminatorDispatchTable(self): if ext_cmd.name in DEVICE_CMDS_NEED_TERM: if 'VK_VERSION_' in ext_cmd.ext_name: term_func += f' // ---- Core {ext_cmd.ext_name[11:]} commands\n' + elif 'VKSC_VERSION_' in ext_cmd.ext_name: + term_func += f' // ---- Core SC {ext_cmd.ext_name[13:]} commands\n' else: last_protect = ext_cmd.protect if ext_cmd.protect is not None: @@ -1556,6 +1617,8 @@ def OutputDeviceFunctionTrampolinePrototypes(self): if ext_cmd.name in DEVICE_CMDS_MUST_USE_TRAMP: if 'VK_VERSION_' in ext_cmd.ext_name: tramp_protos += f' // ---- Core {ext_cmd.ext_name[11:]} commands\n' + elif 'VKSC_VERSION_' in ext_cmd.ext_name: + tramp_protos += f' // ---- Core SC {ext_cmd.ext_name[13:]} commands\n' else: last_protect = ext_cmd.protect if ext_cmd.protect is not None: @@ -1588,6 +1651,8 @@ def InitDeviceFunctionTerminatorDispatchTable(self): if ext_cmd.name in DEVICE_CMDS_NEED_TERM: if 'VK_VERSION_' in ext_cmd.ext_name: term_func += f' // ---- Core {ext_cmd.ext_name[11:]} commands\n' + elif 'VKSC_VERSION_' in ext_cmd.ext_name: + term_func += f' // ---- Core SC {ext_cmd.ext_name[13:]} commands\n' else: last_protect = ext_cmd.protect if ext_cmd.protect is not None: @@ -1636,6 +1701,8 @@ def InitInstLoaderExtensionDispatchTable(self): if cur_cmd.ext_name != cur_extension_name: if 'VK_VERSION_' in cur_cmd.ext_name: table += '\n // ---- Core %s commands\n' % cur_cmd.ext_name[11:] + elif 'VKSC_VERSION_' in cur_cmd.ext_name: + table += '\n // ---- Core SC %s commands\n' % cur_cmd.ext_name[13:] else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -1676,7 +1743,7 @@ def OutputInstantExtensionWhitelistArray(self): table += '// before passing the list of extensions to the application.\n' table += 'const char *const LOADER_INSTANCE_EXTENSIONS[] = {\n' for ext in extensions: - if ext.type == 'device' or 'VK_VERSION_' in ext.name: + if ext.type == 'device' or 'VK_VERSION_' in ext.name or 'VKSC_VERSION_' in ext.name: continue if ext.protect is not None: diff --git a/scripts/loader_genvk.py b/scripts/loader_genvk.py index 3489599a2..a7de0193d 100644 --- a/scripts/loader_genvk.py +++ b/scripts/loader_genvk.py @@ -1,6 +1,8 @@ #!/usr/bin/python3 # # Copyright (c) 2013-2019 The Khronos Group Inc. +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2023 RasterGrid Kft. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,8 +49,14 @@ def makeGenOpts(args): global genOpts genOpts = {} + # API to generate sources for + apiname = args.api + # Default class of extensions to include, or None - defaultExtensions = args.defaultExtensions + if args.defaultExtensions is not None: + defaultExtensions = args.defaultExtensions + else: + defaultExtensions = apiname # Additional extensions to include (list of extensions) extensions = args.extension @@ -126,11 +134,11 @@ def makeGenOpts(args): filename = 'vk_dispatch_table_helper.h', directory = directory, genpath = None, - apiname = 'vulkan', + apiname = apiname, profile = None, versions = featuresPat, emitversions = featuresPat, - defaultExtensions = 'vulkan', + defaultExtensions = defaultExtensions, addExtensions = addExtensionsPat, removeExtensions = removeExtensionsPat, emitExtensions = emitExtensionsPat, @@ -150,11 +158,11 @@ def makeGenOpts(args): filename = 'vk_layer_dispatch_table.h', directory = directory, genpath = None, - apiname = 'vulkan', + apiname = apiname, profile = None, versions = featuresPat, emitversions = featuresPat, - defaultExtensions = 'vulkan', + defaultExtensions = defaultExtensions, addExtensions = addExtensionsPat, removeExtensions = removeExtensionsPat, emitExtensions = emitExtensionsPat, @@ -174,11 +182,11 @@ def makeGenOpts(args): filename = 'vk_loader_extensions.h', directory = directory, genpath = None, - apiname = 'vulkan', + apiname = apiname, profile = None, versions = featuresPat, emitversions = featuresPat, - defaultExtensions = 'vulkan', + defaultExtensions = defaultExtensions, addExtensions = addExtensionsPat, removeExtensions = removeExtensionsPat, emitExtensions = emitExtensionsPat, @@ -198,11 +206,11 @@ def makeGenOpts(args): filename = 'vk_loader_extensions.c', directory = directory, genpath = None, - apiname = 'vulkan', + apiname = apiname, profile = None, versions = featuresPat, emitversions = featuresPat, - defaultExtensions = 'vulkan', + defaultExtensions = defaultExtensions, addExtensions = addExtensionsPat, removeExtensions = removeExtensionsPat, emitExtensions = emitExtensionsPat, @@ -222,11 +230,11 @@ def makeGenOpts(args): filename = 'vk_object_types.h', directory = directory, genpath = None, - apiname = 'vulkan', + apiname = apiname, profile = None, versions = featuresPat, emitversions = featuresPat, - defaultExtensions = 'vulkan', + defaultExtensions = defaultExtensions, addExtensions = addExtensionsPat, removeExtensions = removeExtensionsPat, emitExtensions = emitExtensionsPat, @@ -262,6 +270,7 @@ def genTarget(args): if not args.quiet: write('* Building', options.filename, file=sys.stderr) + write('* options.apiname =', options.apiname, file=sys.stderr) write('* options.versions =', options.versions, file=sys.stderr) write('* options.emitversions =', options.emitversions, file=sys.stderr) write('* options.defaultExtensions =', options.defaultExtensions, file=sys.stderr) @@ -286,8 +295,12 @@ def genTarget(args): if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument('-defaultExtensions', action='store', + parser.add_argument('-api', action='store', default='vulkan', + choices=['vulkan', 'vulkansc'], + help='Specify API name to generate') + parser.add_argument('-defaultExtensions', action='store', + default=None, help='Specify a single class of extensions to add to targets') parser.add_argument('-extension', action='append', default=[], diff --git a/scripts/update_deps.py b/scripts/update_deps.py index 937c79028..833d16cdd 100755 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -663,7 +663,7 @@ def main(): '--api', dest='api', default='vulkan', - choices=['vulkan'], + choices=['vulkan', 'vulkansc'], help="Target API") parser.add_argument( '--generator', diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7734e531e..096180531 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,7 @@ # ~~~ # Copyright (c) 2014-2022 Valve Corporation # Copyright (c) 2014-2022 LunarG, Inc. +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -77,4 +78,8 @@ if(NOT CMAKE_CROSSCOMPILING) gtest_discover_tests(test_regression PROPERTIES DISCOVERY_TIMEOUT 100) else() gtest_add_tests(TARGET test_regression) + # Used to skip certain tests that require rebuilding + # 32 bit and 64 bit dummy libs. For more info see + # comments for TEST(TryLoadWrongBinaries, WrongICD). + add_compile_definitions(CROSS_COMPILING) endif() diff --git a/tests/framework/icd/physical_device.h b/tests/framework/icd/physical_device.h index b4b17f7e4..e9fe31b14 100644 --- a/tests/framework/icd/physical_device.h +++ b/tests/framework/icd/physical_device.h @@ -48,7 +48,9 @@ struct PhysicalDevice { BUILDER_VECTOR(PhysicalDevice, MockQueueFamilyProperties, queue_family_properties, queue_family_properties) BUILDER_VECTOR(PhysicalDevice, VkFormatProperties, format_properties, format_properties) +#ifndef VULKANSC // Sparse resources are not supported in Vulkan SC BUILDER_VECTOR(PhysicalDevice, VkSparseImageFormatProperties, sparse_image_format_properties, sparse_image_format_properties) +#endif // VULKANSC BUILDER_VECTOR(PhysicalDevice, Extension, extensions, extension) diff --git a/tests/framework/icd/test_icd.cpp b/tests/framework/icd/test_icd.cpp index a2c475743..f779c7449 100644 --- a/tests/framework/icd/test_icd.cpp +++ b/tests/framework/icd/test_icd.cpp @@ -2,6 +2,8 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -173,7 +175,12 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceLayerProperties(uint32_t* VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceVersion(uint32_t* pApiVersion) { if (pApiVersion != nullptr) { +#ifdef VULKANSC + // Make sure to include Vulkan SC API variant in the enumerated API version + *pApiVersion = icd.icd_api_version | VK_MAKE_API_VERSION(VKSC_API_VARIANT, 0, 0, 0); +#else *pApiVersion = icd.icd_api_version; +#endif } return VK_SUCCESS; } @@ -186,7 +193,11 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* } if (icd.icd_api_version < VK_API_VERSION_1_1) { +#ifdef VULKANSC + if (pCreateInfo->pApplicationInfo->apiVersion > VKSC_API_VERSION_1_0) { +#else if (pCreateInfo->pApplicationInfo->apiVersion > VK_API_VERSION_1_0) { +#endif return VK_ERROR_INCOMPATIBLE_DRIVER; } } @@ -298,7 +309,7 @@ test_vkEnumeratePhysicalDeviceGroups([[maybe_unused]] VkInstance instance, uint3 for (size_t device_group = 0; device_group < group_count; device_group++) { if (nullptr != pPhysicalDeviceGroupProperties[device_group].pNext) { VkBaseInStructure* base = reinterpret_cast(pPhysicalDeviceGroupProperties[device_group].pNext); - if (base->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT) { + if (base->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT) { FakePnextSharedWithICD* fake = reinterpret_cast(base); fake->value = 0xDECAFBAD; } @@ -343,6 +354,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroyDebugUtilsMessengerEXT([[maybe_unused]] } // Debug utils & debug marker ext stubs +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC VKAPI_ATTR VkResult VKAPI_CALL test_vkDebugMarkerSetObjectTagEXT(VkDevice dev, const VkDebugMarkerObjectTagInfoEXT* pTagInfo) { if (pTagInfo && pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { VkPhysicalDevice pd = (VkPhysicalDevice)(uintptr_t)(pTagInfo->object); @@ -374,6 +386,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkDebugMarkerSetObjectNameEXT(VkDevice dev, VKAPI_ATTR void VKAPI_CALL test_vkCmdDebugMarkerBeginEXT(VkCommandBuffer, const VkDebugMarkerMarkerInfoEXT*) {} VKAPI_ATTR void VKAPI_CALL test_vkCmdDebugMarkerEndEXT(VkCommandBuffer) {} VKAPI_ATTR void VKAPI_CALL test_vkCmdDebugMarkerInsertEXT(VkCommandBuffer, const VkDebugMarkerMarkerInfoEXT*) {} +#endif // VULKANSC VKAPI_ATTR VkResult VKAPI_CALL test_vkSetDebugUtilsObjectNameEXT(VkDevice dev, const VkDebugUtilsObjectNameInfoEXT* pNameInfo) { if (pNameInfo && pNameInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { @@ -467,6 +480,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroyDevice(VkDevice device, [[maybe_unused] phys_dev.device_create_infos.erase(phys_dev.device_create_infos.begin() + fd.dev_index); } +#ifndef VULKANSC // VK_EXT_tooling_info is not supported in Vulkan SC VKAPI_ATTR VkResult VKAPI_CALL generic_tool_props_function([[maybe_unused]] VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolPropertiesEXT* pToolProperties) { if (icd.tooling_properties.size() == 0) { @@ -494,6 +508,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceToolProperties(VkPhysical VkPhysicalDeviceToolPropertiesEXT* pToolProperties) { return generic_tool_props_function(physicalDevice, pToolCount, pToolProperties); } +#endif // VULKANSC template T to_nondispatch_handle(uint64_t handle) { @@ -526,6 +541,8 @@ void common_nondispatch_handle_creation(std::vector& handles, HandleTy *pHandle = to_nondispatch_handle(handles.back()); } } + +#ifndef VULKANSC // Usual WSI platforms are not supported in Vulkan SC #if defined(VK_USE_PLATFORM_ANDROID_KHR) VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, @@ -589,6 +606,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceXlibPresentationSupportKH return VK_TRUE; } #endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VULKANSC #if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDirectFBSurfaceEXT(VkInstance instance, @@ -831,16 +849,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalD VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDisplayPlaneSurfaceKHR( [[maybe_unused]] VkInstance instance, [[maybe_unused]] const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, [[maybe_unused]] const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { - if (nullptr != pSurface) { - uint64_t fake_surf_handle = reinterpret_cast(new uint8_t); - icd.surface_handles.push_back(fake_surf_handle); -#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || \ - defined(_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) - *pSurface = reinterpret_cast(fake_surf_handle); -#else - *pSurface = fake_surf_handle; -#endif - } + common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } @@ -916,6 +925,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetDeviceQueue([[maybe_unused]] VkDevice devic } // VK_EXT_acquire_drm_display +#ifndef VULKANSC // VK_EXT_acquire_drm_display is not supported in Vulkan SC VKAPI_ATTR VkResult VKAPI_CALL test_vkAcquireDrmDisplayEXT(VkPhysicalDevice, int32_t, VkDisplayKHR) { return VK_SUCCESS; } VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDrmDisplayEXT(VkPhysicalDevice physicalDevice, [[maybe_unused]] int32_t drmFd, @@ -925,6 +935,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDrmDisplayEXT(VkPhysicalDevice physical } return VK_SUCCESS; } +#endif // VULKANSC //// stubs // 1.0 @@ -950,12 +961,14 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDe memcpy(pMemoryProperties, &icd.GetPhysDevice(physicalDevice).memory_properties, sizeof(VkPhysicalDeviceMemoryProperties)); } } +#ifndef VULKANSC // Sparse resources are not supported in Vulkan SC VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceSparseImageFormatProperties( VkPhysicalDevice physicalDevice, [[maybe_unused]] VkFormat format, [[maybe_unused]] VkImageType type, [[maybe_unused]] VkSampleCountFlagBits samples, [[maybe_unused]] VkImageUsageFlags usage, [[maybe_unused]] VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) { FillCountPtr(icd.GetPhysDevice(physicalDevice).sparse_image_format_properties, pPropertyCount, pProperties); } +#endif // VULKANSC VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) { if (nullptr != pFormatProperties) { @@ -1018,6 +1031,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceQueueFamilyProperties2(VkPhys } } } +#ifndef VULKANSC // GPDP2 is included in core Vulkan SC 1.0 VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceSparseImageFormatProperties2( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties) { @@ -1036,6 +1050,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceSparseImageFormatProperties2( } } } +#endif // VULKANSC VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties) { if (nullptr != pFormatProperties) { @@ -1172,7 +1187,10 @@ FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDe //// trampolines PFN_vkVoidFunction get_instance_func_ver_1_1([[maybe_unused]] VkInstance instance, const char* pName) { - if (icd.icd_api_version >= VK_API_VERSION_1_1) { +#ifndef VULKANSC // Vulkan 1.1 features are included in core Vulkan SC 1.0 + if (icd.icd_api_version >= VK_API_VERSION_1_1) +#endif // VULKANSC + { if (string_eq(pName, "test_vkEnumerateInstanceVersion")) { return icd.can_query_vkEnumerateInstanceVersion ? to_vkVoidFunction(test_vkEnumerateInstanceVersion) : nullptr; } @@ -1212,15 +1230,18 @@ PFN_vkVoidFunction get_physical_device_func_wsi([[maybe_unused]] VkInstance inst if (string_eq(pName, "vkGetDisplayPlaneCapabilitiesKHR")) return to_vkVoidFunction(test_vkGetDisplayPlaneCapabilitiesKHR); if (string_eq(pName, "vkCreateDisplayPlaneSurfaceKHR")) return to_vkVoidFunction(test_vkCreateDisplayPlaneSurfaceKHR); } +#ifndef VULKANSC // VK_EXT_acquire_drm_display is not supported in Vulkan SC if (IsInstanceExtensionEnabled("VK_EXT_acquire_drm_display")) { if (string_eq(pName, "vkAcquireDrmDisplayEXT")) return to_vkVoidFunction(test_vkAcquireDrmDisplayEXT); if (string_eq(pName, "vkGetDrmDisplayEXT")) return to_vkVoidFunction(test_vkGetDrmDisplayEXT); } +#endif // VULKANSC return nullptr; } PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) { if (icd.min_icd_interface_version >= 3 && icd.enable_icd_wsi == true) { +#ifndef VULKANSC // Usual WSI platforms are not supported in Vulkan SC #if defined(VK_USE_PLATFORM_ANDROID_KHR) if (string_eq(pName, "vkCreateAndroidSurfaceKHR")) { icd.is_using_icd_wsi = true; @@ -1264,6 +1285,7 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) return to_vkVoidFunction(test_vkGetPhysicalDeviceWin32PresentationSupportKHR); } #endif +#endif // VULKANSC #if defined(VK_USE_PLATFORM_DIRECTFB_EXT) if (string_eq(pName, "vkCreateDirectFBSurfaceEXT")) { return to_vkVoidFunction(test_vkCreateDirectFBSurfaceEXT); @@ -1333,12 +1355,15 @@ PFN_vkVoidFunction get_physical_device_func([[maybe_unused]] VkInstance instance if (string_eq(pName, "vkGetPhysicalDeviceFeatures")) return to_vkVoidFunction(test_vkGetPhysicalDeviceFeatures); if (string_eq(pName, "vkGetPhysicalDeviceProperties")) return to_vkVoidFunction(test_vkGetPhysicalDeviceProperties); if (string_eq(pName, "vkGetPhysicalDeviceMemoryProperties")) return to_vkVoidFunction(test_vkGetPhysicalDeviceMemoryProperties); +#ifndef VULKANSC // Sparse resources are not supported in Vulkan SC if (string_eq(pName, "vkGetPhysicalDeviceSparseImageFormatProperties")) return to_vkVoidFunction(test_vkGetPhysicalDeviceSparseImageFormatProperties); +#endif // VULKANSC if (string_eq(pName, "vkGetPhysicalDeviceFormatProperties")) return to_vkVoidFunction(test_vkGetPhysicalDeviceFormatProperties); if (string_eq(pName, "vkGetPhysicalDeviceImageFormatProperties")) return to_vkVoidFunction(test_vkGetPhysicalDeviceImageFormatProperties); +#ifndef VULKANSC // GPDP2 is included in core Vulkan SC 1.0 if (IsInstanceExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { if (string_eq(pName, "vkGetPhysicalDeviceFeatures2KHR")) return to_vkVoidFunction(test_vkGetPhysicalDeviceFeatures2); if (string_eq(pName, "vkGetPhysicalDeviceProperties2KHR")) return to_vkVoidFunction(test_vkGetPhysicalDeviceProperties2); @@ -1369,6 +1394,7 @@ PFN_vkVoidFunction get_physical_device_func([[maybe_unused]] VkInstance instance if (string_eq(pName, "vkGetPhysicalDeviceExternalFencePropertiesKHR")) return to_vkVoidFunction(test_vkGetPhysicalDeviceExternalFenceProperties); } +#endif // VULKANSC // The following physical device extensions only need 1 device to support them for the ICD to export // them @@ -1391,7 +1417,10 @@ PFN_vkVoidFunction get_physical_device_func([[maybe_unused]] VkInstance instance if (string_eq(pName, "vkGetCalibratedTimestampsEXT")) return to_vkVoidFunction(test_vkGetCalibratedTimestampsEXT); } - if (icd.icd_api_version >= VK_MAKE_API_VERSION(0, 1, 1, 0)) { +#ifndef VULKANSC // GPDP2 is included in core Vulkan SC 1.0 + if (icd.icd_api_version >= VK_MAKE_API_VERSION(0, 1, 1, 0)) +#endif // VULKANSC + { if (string_eq(pName, "vkGetPhysicalDeviceFeatures2")) return to_vkVoidFunction(test_vkGetPhysicalDeviceFeatures2); if (string_eq(pName, "vkGetPhysicalDeviceProperties2")) return to_vkVoidFunction(test_vkGetPhysicalDeviceProperties2); if (string_eq(pName, "vkGetPhysicalDeviceFormatProperties2")) @@ -1402,8 +1431,10 @@ PFN_vkVoidFunction get_physical_device_func([[maybe_unused]] VkInstance instance if (string_eq(pName, "vkGetPhysicalDeviceQueueFamilyProperties2")) return to_vkVoidFunction(test_vkGetPhysicalDeviceQueueFamilyProperties2); +#ifndef VULKANSC // GPDP2 is included in core Vulkan SC 1.0 if (string_eq(pName, "vkGetPhysicalDeviceSparseImageFormatProperties2")) return to_vkVoidFunction(test_vkGetPhysicalDeviceSparseImageFormatProperties2); +#endif // VULKANSC if (string_eq(pName, "vkGetPhysicalDeviceImageFormatProperties2")) { return to_vkVoidFunction(test_vkGetPhysicalDeviceImageFormatProperties2); @@ -1417,6 +1448,7 @@ PFN_vkVoidFunction get_physical_device_func([[maybe_unused]] VkInstance instance return to_vkVoidFunction(test_vkGetPhysicalDeviceExternalFenceProperties); } +#ifndef VULKANSC // VK_EXT_tooling_info is not supported in Vulkan SC if (icd.supports_tooling_info_core) { if (string_eq(pName, "vkGetPhysicalDeviceToolProperties")) return to_vkVoidFunction(test_vkGetPhysicalDeviceToolProperties); } @@ -1424,6 +1456,7 @@ PFN_vkVoidFunction get_physical_device_func([[maybe_unused]] VkInstance instance if (string_eq(pName, "vkGetPhysicalDeviceToolPropertiesEXT")) return to_vkVoidFunction(test_vkGetPhysicalDeviceToolPropertiesEXT); } +#endif // VULKANSC for (auto& phys_dev : icd.physical_devices) { for (auto& func : phys_dev.custom_physical_device_functions) { @@ -1439,9 +1472,11 @@ PFN_vkVoidFunction get_instance_func(VkInstance instance, const char* pName) { if (string_eq(pName, "vkDestroyInstance")) return to_vkVoidFunction(test_vkDestroyInstance); if (string_eq(pName, "vkEnumeratePhysicalDevices")) return to_vkVoidFunction(test_vkEnumeratePhysicalDevices); +#ifndef VULKANSC // VK_KHR_device_group_creation is included in core Vulkan SC 1.0 if (IsInstanceExtensionEnabled(VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME)) { if (string_eq(pName, "vkEnumeratePhysicalDeviceGroupsKHR")) return to_vkVoidFunction(test_vkEnumeratePhysicalDeviceGroups); } +#endif // VULKANSC PFN_vkVoidFunction ret_phys_dev = get_physical_device_func(instance, pName); if (ret_phys_dev != nullptr) return ret_phys_dev; @@ -1499,6 +1534,7 @@ PFN_vkVoidFunction get_device_func(VkDevice device, const char* pName) { if (string_eq(pName, "vkGetDeviceGroupSurfacePresentModesKHR")) return to_vkVoidFunction(test_vkGetDeviceGroupSurfacePresentModesKHR); } +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC if (should_check(create_info.enabled_extensions, device, "VK_EXT_debug_marker")) { if (string_eq(pName, "vkDebugMarkerSetObjectTagEXT")) return to_vkVoidFunction(test_vkDebugMarkerSetObjectTagEXT); if (string_eq(pName, "vkDebugMarkerSetObjectNameEXT")) return to_vkVoidFunction(test_vkDebugMarkerSetObjectNameEXT); @@ -1506,6 +1542,7 @@ PFN_vkVoidFunction get_device_func(VkDevice device, const char* pName) { if (string_eq(pName, "vkCmdDebugMarkerEndEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerEndEXT); if (string_eq(pName, "vkCmdDebugMarkerInsertEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerInsertEXT); } +#endif // VULKANSC if (IsInstanceExtensionEnabled("VK_EXT_debug_utils")) { if (string_eq(pName, "vkSetDebugUtilsObjectNameEXT")) return to_vkVoidFunction(test_vkSetDebugUtilsObjectNameEXT); if (string_eq(pName, "vkSetDebugUtilsObjectTagEXT")) return to_vkVoidFunction(test_vkSetDebugUtilsObjectTagEXT); diff --git a/tests/framework/icd/test_icd.h b/tests/framework/icd/test_icd.h index 760a08b2f..e54d5f643 100644 --- a/tests/framework/icd/test_icd.h +++ b/tests/framework/icd/test_icd.h @@ -2,6 +2,8 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -128,12 +130,14 @@ struct TestICD { // known_device_functions member) BUILDER_VECTOR(TestICD, VulkanFunction, custom_instance_functions, custom_instance_function) +#ifndef VULKANSC // VK_EXT_tooling_info is not supported in Vulkan SC // Must explicitely state support for the tooling info extension, that way we can control if vkGetInstanceProcAddr returns a // function pointer for vkGetPhysicalDeviceToolPropertiesEXT or vkGetPhysicalDeviceToolProperties (core version) BUILDER_VALUE(TestICD, bool, supports_tooling_info_ext, false); BUILDER_VALUE(TestICD, bool, supports_tooling_info_core, false); // List of tooling properties that this driver 'supports' BUILDER_VECTOR(TestICD, VkPhysicalDeviceToolPropertiesEXT, tooling_properties, tooling_property) +#endif // VULKANSC std::vector> allocated_command_buffers; VkInstanceCreateFlags passed_in_instance_create_flags{}; diff --git a/tests/framework/layer/layer_util.h b/tests/framework/layer/layer_util.h index 549bfa701..79c671c0a 100644 --- a/tests/framework/layer/layer_util.h +++ b/tests/framework/layer/layer_util.h @@ -2,6 +2,8 @@ * Copyright (c) 2021 The Khronos Group Inc. * Copyright (c) 2021 Valve Corporation * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to diff --git a/tests/framework/layer/test_layer.cpp b/tests/framework/layer/test_layer.cpp index 14f0ebd60..9b51608e5 100644 --- a/tests/framework/layer/test_layer.cpp +++ b/tests/framework/layer/test_layer.cpp @@ -2,6 +2,8 @@ * Copyright (c) 2021-2022 The Khronos Group Inc. * Copyright (c) 2021-2022 Valve Corporation * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -27,7 +29,11 @@ #include "test_layer.h" +#ifdef VULKANSC +#include "vksc_dispatch_table_helper.h" +#else #include "vk_dispatch_table_helper.h" +#endif // VULKANSC // export the enumeration functions instance|device+layer|extension #if !defined(TEST_LAYER_EXPORT_ENUMERATE_FUNCTIONS) @@ -233,7 +239,11 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateDeviceExtensionProperties(VkPhysi VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceVersion(uint32_t* pApiVersion) { if (pApiVersion != nullptr) { +#ifdef VULKANSC + *pApiVersion = VKSC_API_VERSION_1_0; +#else *pApiVersion = VK_API_VERSION_1_0; +#endif // VULKANSC } return VK_SUCCESS; } @@ -369,7 +379,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* VKAPI_ATTR VkResult VKAPI_CALL test_override_vkCreateInstance(const VkInstanceCreateInfo*, const VkAllocationCallbacks*, VkInstance*) { - return VK_ERROR_INVALID_SHADER_NV; + return VK_ERROR_FRAGMENTED_POOL; } VKAPI_ATTR void VKAPI_CALL test_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) { @@ -688,6 +698,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroyDebugUtilsMessengerEXT(VkInstance insta } // Debug utils & debug marker ext stubs +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC VKAPI_ATTR VkResult VKAPI_CALL test_vkDebugMarkerSetObjectTagEXT(VkDevice dev, const VkDebugMarkerObjectTagInfoEXT* pTagInfo) { for (const auto& d : layer.created_devices) { if (d.device_handle == dev) { @@ -727,6 +738,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkCmdDebugMarkerInsertEXT(VkCommandBuffer cmd_bu if (layer.created_devices[0].dispatch_table.CmdDebugMarkerInsertEXT) layer.created_devices[0].dispatch_table.CmdDebugMarkerInsertEXT(cmd_buf, marker_info); } +#endif // VULKANSC VKAPI_ATTR VkResult VKAPI_CALL test_vkSetDebugUtilsObjectNameEXT(VkDevice dev, const VkDebugUtilsObjectNameInfoEXT* pNameInfo) { for (const auto& d : layer.created_devices) { @@ -796,6 +808,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func_impl([[maybe_unused]] V if (string_eq(pName, "vkGetDeviceProcAddr")) return to_vkVoidFunction(get_device_func); if (string_eq(pName, "vkDestroyDevice")) return to_vkVoidFunction(test_vkDestroyDevice); +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC if (IsDeviceExtensionAvailable(device, VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { if (string_eq(pName, "vkDebugMarkerSetObjectTagEXT")) return to_vkVoidFunction(test_vkDebugMarkerSetObjectTagEXT); if (string_eq(pName, "vkDebugMarkerSetObjectNameEXT")) return to_vkVoidFunction(test_vkDebugMarkerSetObjectNameEXT); @@ -803,6 +816,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func_impl([[maybe_unused]] V if (string_eq(pName, "vkCmdDebugMarkerEndEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerEndEXT); if (string_eq(pName, "vkCmdDebugMarkerInsertEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerInsertEXT); } +#endif // VULKANSC if (IsInstanceExtensionEnabled(VK_EXT_DEBUG_UTILS_EXTENSION_NAME)) { if (string_eq(pName, "vkSetDebugUtilsObjectNameEXT")) return to_vkVoidFunction(test_vkSetDebugUtilsObjectNameEXT); if (string_eq(pName, "vkSetDebugUtilsObjectTagEXT")) return to_vkVoidFunction(test_vkSetDebugUtilsObjectTagEXT); diff --git a/tests/framework/layer/test_layer.h b/tests/framework/layer/test_layer.h index d6d086c14..698496635 100644 --- a/tests/framework/layer/test_layer.h +++ b/tests/framework/layer/test_layer.h @@ -2,6 +2,8 @@ * Copyright (c) 2021-2022 The Khronos Group Inc. * Copyright (c) 2021-2022 Valve Corporation * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -31,7 +33,11 @@ #include "layer/layer_util.h" +#ifdef VULKANSC +#include "loader/generated-vksc/vk_layer_dispatch_table.h" +#else #include "loader/generated/vk_layer_dispatch_table.h" +#endif // VULKANSC /* Interface Version 0 @@ -90,20 +96,32 @@ using FP_layer_callback = VkResult (*)(TestLayer& layer, void* data); struct TestLayer { fs::path manifest_file_path; +#ifdef VULKANSC + uint32_t manifest_version = VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 13); +#else uint32_t manifest_version = VK_MAKE_API_VERSION(0, 1, 1, 2); +#endif // VULKANSC BUILDER_VALUE(TestLayer, bool, is_meta_layer, false) BUILDER_VALUE(TestLayer, uint32_t, api_version, VK_API_VERSION_1_0) BUILDER_VALUE(TestLayer, uint32_t, reported_layer_props, 1) BUILDER_VALUE(TestLayer, uint32_t, reported_extension_props, 0) +#ifdef VULKANSC + BUILDER_VALUE(TestLayer, uint32_t, reported_instance_version, VKSC_API_VERSION_1_0) +#else BUILDER_VALUE(TestLayer, uint32_t, reported_instance_version, VK_API_VERSION_1_0) +#endif // VULKANSC BUILDER_VALUE(TestLayer, uint32_t, implementation_version, 2) BUILDER_VALUE(TestLayer, uint32_t, min_implementation_version, 0) BUILDER_VALUE(TestLayer, std::string, description, {}) // Some layers may try to change the API version during instance creation - we should allow testing of such behavior +#ifdef VULKANSC + BUILDER_VALUE(TestLayer, uint32_t, alter_api_version, VKSC_API_VERSION_1_0) +#else BUILDER_VALUE(TestLayer, uint32_t, alter_api_version, VK_API_VERSION_1_0) +#endif // VULKANSC BUILDER_VECTOR(TestLayer, std::string, alternative_function_names, alternative_function_name) diff --git a/tests/framework/layer/vksc_dispatch_table_helper.h b/tests/framework/layer/vksc_dispatch_table_helper.h new file mode 100644 index 000000000..c5b995f80 --- /dev/null +++ b/tests/framework/layer/vksc_dispatch_table_helper.h @@ -0,0 +1,306 @@ +#pragma once +// *** THIS FILE IS GENERATED - DO NOT EDIT *** +// See dispatch_helper_generator.py for modifications + +/* + * Copyright (c) 2015-2021 The Khronos Group Inc. + * Copyright (c) 2015-2021 Valve Corporation + * Copyright (c) 2015-2021 LunarG, Inc. + * Copyright (c) 2023-2023 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. + * + * Author: Courtney Goeltzenleuchter + * Author: Jon Ashburn + * Author: Mark Lobodzinski + */ + +#include +#include +#include +#include "loader/generated-vksc/vk_layer_dispatch_table.h" + + + + +static inline void layer_init_device_dispatch_table(VkDevice device, VkLayerDispatchTable *table, PFN_vkGetDeviceProcAddr gpa) { + memset(table, 0, sizeof(*table)); + table->magic = DEVICE_DISP_TABLE_MAGIC_NUMBER; + + // Device function pointers + table->GetDeviceProcAddr = gpa; + table->DestroyDevice = (PFN_vkDestroyDevice) gpa(device, "vkDestroyDevice"); + table->GetDeviceQueue = (PFN_vkGetDeviceQueue) gpa(device, "vkGetDeviceQueue"); + table->QueueSubmit = (PFN_vkQueueSubmit) gpa(device, "vkQueueSubmit"); + table->QueueWaitIdle = (PFN_vkQueueWaitIdle) gpa(device, "vkQueueWaitIdle"); + table->DeviceWaitIdle = (PFN_vkDeviceWaitIdle) gpa(device, "vkDeviceWaitIdle"); + table->AllocateMemory = (PFN_vkAllocateMemory) gpa(device, "vkAllocateMemory"); + table->MapMemory = (PFN_vkMapMemory) gpa(device, "vkMapMemory"); + table->UnmapMemory = (PFN_vkUnmapMemory) gpa(device, "vkUnmapMemory"); + table->FlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) gpa(device, "vkFlushMappedMemoryRanges"); + table->InvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) gpa(device, "vkInvalidateMappedMemoryRanges"); + table->GetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) gpa(device, "vkGetDeviceMemoryCommitment"); + table->BindBufferMemory = (PFN_vkBindBufferMemory) gpa(device, "vkBindBufferMemory"); + table->BindImageMemory = (PFN_vkBindImageMemory) gpa(device, "vkBindImageMemory"); + table->GetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) gpa(device, "vkGetBufferMemoryRequirements"); + table->GetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) gpa(device, "vkGetImageMemoryRequirements"); + table->CreateFence = (PFN_vkCreateFence) gpa(device, "vkCreateFence"); + table->DestroyFence = (PFN_vkDestroyFence) gpa(device, "vkDestroyFence"); + table->ResetFences = (PFN_vkResetFences) gpa(device, "vkResetFences"); + table->GetFenceStatus = (PFN_vkGetFenceStatus) gpa(device, "vkGetFenceStatus"); + table->WaitForFences = (PFN_vkWaitForFences) gpa(device, "vkWaitForFences"); + table->CreateSemaphore = (PFN_vkCreateSemaphore) gpa(device, "vkCreateSemaphore"); + table->DestroySemaphore = (PFN_vkDestroySemaphore) gpa(device, "vkDestroySemaphore"); + table->CreateEvent = (PFN_vkCreateEvent) gpa(device, "vkCreateEvent"); + table->DestroyEvent = (PFN_vkDestroyEvent) gpa(device, "vkDestroyEvent"); + table->GetEventStatus = (PFN_vkGetEventStatus) gpa(device, "vkGetEventStatus"); + table->SetEvent = (PFN_vkSetEvent) gpa(device, "vkSetEvent"); + table->ResetEvent = (PFN_vkResetEvent) gpa(device, "vkResetEvent"); + table->CreateQueryPool = (PFN_vkCreateQueryPool) gpa(device, "vkCreateQueryPool"); + table->GetQueryPoolResults = (PFN_vkGetQueryPoolResults) gpa(device, "vkGetQueryPoolResults"); + table->CreateBuffer = (PFN_vkCreateBuffer) gpa(device, "vkCreateBuffer"); + table->DestroyBuffer = (PFN_vkDestroyBuffer) gpa(device, "vkDestroyBuffer"); + table->CreateBufferView = (PFN_vkCreateBufferView) gpa(device, "vkCreateBufferView"); + table->DestroyBufferView = (PFN_vkDestroyBufferView) gpa(device, "vkDestroyBufferView"); + table->CreateImage = (PFN_vkCreateImage) gpa(device, "vkCreateImage"); + table->DestroyImage = (PFN_vkDestroyImage) gpa(device, "vkDestroyImage"); + table->GetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) gpa(device, "vkGetImageSubresourceLayout"); + table->CreateImageView = (PFN_vkCreateImageView) gpa(device, "vkCreateImageView"); + table->DestroyImageView = (PFN_vkDestroyImageView) gpa(device, "vkDestroyImageView"); + table->CreatePipelineCache = (PFN_vkCreatePipelineCache) gpa(device, "vkCreatePipelineCache"); + table->DestroyPipelineCache = (PFN_vkDestroyPipelineCache) gpa(device, "vkDestroyPipelineCache"); + table->CreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) gpa(device, "vkCreateGraphicsPipelines"); + table->CreateComputePipelines = (PFN_vkCreateComputePipelines) gpa(device, "vkCreateComputePipelines"); + table->DestroyPipeline = (PFN_vkDestroyPipeline) gpa(device, "vkDestroyPipeline"); + table->CreatePipelineLayout = (PFN_vkCreatePipelineLayout) gpa(device, "vkCreatePipelineLayout"); + table->DestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) gpa(device, "vkDestroyPipelineLayout"); + table->CreateSampler = (PFN_vkCreateSampler) gpa(device, "vkCreateSampler"); + table->DestroySampler = (PFN_vkDestroySampler) gpa(device, "vkDestroySampler"); + table->CreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) gpa(device, "vkCreateDescriptorSetLayout"); + table->DestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) gpa(device, "vkDestroyDescriptorSetLayout"); + table->CreateDescriptorPool = (PFN_vkCreateDescriptorPool) gpa(device, "vkCreateDescriptorPool"); + table->ResetDescriptorPool = (PFN_vkResetDescriptorPool) gpa(device, "vkResetDescriptorPool"); + table->AllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) gpa(device, "vkAllocateDescriptorSets"); + table->FreeDescriptorSets = (PFN_vkFreeDescriptorSets) gpa(device, "vkFreeDescriptorSets"); + table->UpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) gpa(device, "vkUpdateDescriptorSets"); + table->CreateFramebuffer = (PFN_vkCreateFramebuffer) gpa(device, "vkCreateFramebuffer"); + table->DestroyFramebuffer = (PFN_vkDestroyFramebuffer) gpa(device, "vkDestroyFramebuffer"); + table->CreateRenderPass = (PFN_vkCreateRenderPass) gpa(device, "vkCreateRenderPass"); + table->DestroyRenderPass = (PFN_vkDestroyRenderPass) gpa(device, "vkDestroyRenderPass"); + table->GetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) gpa(device, "vkGetRenderAreaGranularity"); + table->CreateCommandPool = (PFN_vkCreateCommandPool) gpa(device, "vkCreateCommandPool"); + table->ResetCommandPool = (PFN_vkResetCommandPool) gpa(device, "vkResetCommandPool"); + table->AllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) gpa(device, "vkAllocateCommandBuffers"); + table->FreeCommandBuffers = (PFN_vkFreeCommandBuffers) gpa(device, "vkFreeCommandBuffers"); + table->BeginCommandBuffer = (PFN_vkBeginCommandBuffer) gpa(device, "vkBeginCommandBuffer"); + table->EndCommandBuffer = (PFN_vkEndCommandBuffer) gpa(device, "vkEndCommandBuffer"); + table->ResetCommandBuffer = (PFN_vkResetCommandBuffer) gpa(device, "vkResetCommandBuffer"); + table->CmdBindPipeline = (PFN_vkCmdBindPipeline) gpa(device, "vkCmdBindPipeline"); + table->CmdSetViewport = (PFN_vkCmdSetViewport) gpa(device, "vkCmdSetViewport"); + table->CmdSetScissor = (PFN_vkCmdSetScissor) gpa(device, "vkCmdSetScissor"); + table->CmdSetLineWidth = (PFN_vkCmdSetLineWidth) gpa(device, "vkCmdSetLineWidth"); + table->CmdSetDepthBias = (PFN_vkCmdSetDepthBias) gpa(device, "vkCmdSetDepthBias"); + table->CmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) gpa(device, "vkCmdSetBlendConstants"); + table->CmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) gpa(device, "vkCmdSetDepthBounds"); + table->CmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) gpa(device, "vkCmdSetStencilCompareMask"); + table->CmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) gpa(device, "vkCmdSetStencilWriteMask"); + table->CmdSetStencilReference = (PFN_vkCmdSetStencilReference) gpa(device, "vkCmdSetStencilReference"); + table->CmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) gpa(device, "vkCmdBindDescriptorSets"); + table->CmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) gpa(device, "vkCmdBindIndexBuffer"); + table->CmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) gpa(device, "vkCmdBindVertexBuffers"); + table->CmdDraw = (PFN_vkCmdDraw) gpa(device, "vkCmdDraw"); + table->CmdDrawIndexed = (PFN_vkCmdDrawIndexed) gpa(device, "vkCmdDrawIndexed"); + table->CmdDrawIndirect = (PFN_vkCmdDrawIndirect) gpa(device, "vkCmdDrawIndirect"); + table->CmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) gpa(device, "vkCmdDrawIndexedIndirect"); + table->CmdDispatch = (PFN_vkCmdDispatch) gpa(device, "vkCmdDispatch"); + table->CmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) gpa(device, "vkCmdDispatchIndirect"); + table->CmdCopyBuffer = (PFN_vkCmdCopyBuffer) gpa(device, "vkCmdCopyBuffer"); + table->CmdCopyImage = (PFN_vkCmdCopyImage) gpa(device, "vkCmdCopyImage"); + table->CmdBlitImage = (PFN_vkCmdBlitImage) gpa(device, "vkCmdBlitImage"); + table->CmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) gpa(device, "vkCmdCopyBufferToImage"); + table->CmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) gpa(device, "vkCmdCopyImageToBuffer"); + table->CmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) gpa(device, "vkCmdUpdateBuffer"); + table->CmdFillBuffer = (PFN_vkCmdFillBuffer) gpa(device, "vkCmdFillBuffer"); + table->CmdClearColorImage = (PFN_vkCmdClearColorImage) gpa(device, "vkCmdClearColorImage"); + table->CmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) gpa(device, "vkCmdClearDepthStencilImage"); + table->CmdClearAttachments = (PFN_vkCmdClearAttachments) gpa(device, "vkCmdClearAttachments"); + table->CmdResolveImage = (PFN_vkCmdResolveImage) gpa(device, "vkCmdResolveImage"); + table->CmdSetEvent = (PFN_vkCmdSetEvent) gpa(device, "vkCmdSetEvent"); + table->CmdResetEvent = (PFN_vkCmdResetEvent) gpa(device, "vkCmdResetEvent"); + table->CmdWaitEvents = (PFN_vkCmdWaitEvents) gpa(device, "vkCmdWaitEvents"); + table->CmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) gpa(device, "vkCmdPipelineBarrier"); + table->CmdBeginQuery = (PFN_vkCmdBeginQuery) gpa(device, "vkCmdBeginQuery"); + table->CmdEndQuery = (PFN_vkCmdEndQuery) gpa(device, "vkCmdEndQuery"); + table->CmdResetQueryPool = (PFN_vkCmdResetQueryPool) gpa(device, "vkCmdResetQueryPool"); + table->CmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) gpa(device, "vkCmdWriteTimestamp"); + table->CmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) gpa(device, "vkCmdCopyQueryPoolResults"); + table->CmdPushConstants = (PFN_vkCmdPushConstants) gpa(device, "vkCmdPushConstants"); + table->CmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) gpa(device, "vkCmdBeginRenderPass"); + table->CmdNextSubpass = (PFN_vkCmdNextSubpass) gpa(device, "vkCmdNextSubpass"); + table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass) gpa(device, "vkCmdEndRenderPass"); + table->CmdExecuteCommands = (PFN_vkCmdExecuteCommands) gpa(device, "vkCmdExecuteCommands"); + table->BindBufferMemory2 = (PFN_vkBindBufferMemory2) gpa(device, "vkBindBufferMemory2"); + table->BindImageMemory2 = (PFN_vkBindImageMemory2) gpa(device, "vkBindImageMemory2"); + table->GetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) gpa(device, "vkGetDeviceGroupPeerMemoryFeatures"); + table->CmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) gpa(device, "vkCmdSetDeviceMask"); + table->CmdDispatchBase = (PFN_vkCmdDispatchBase) gpa(device, "vkCmdDispatchBase"); + table->GetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) gpa(device, "vkGetImageMemoryRequirements2"); + table->GetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) gpa(device, "vkGetBufferMemoryRequirements2"); + table->GetDeviceQueue2 = (PFN_vkGetDeviceQueue2) gpa(device, "vkGetDeviceQueue2"); + table->CreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) gpa(device, "vkCreateSamplerYcbcrConversion"); + table->DestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) gpa(device, "vkDestroySamplerYcbcrConversion"); + table->GetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) gpa(device, "vkGetDescriptorSetLayoutSupport"); + table->CmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount) gpa(device, "vkCmdDrawIndirectCount"); + table->CmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount) gpa(device, "vkCmdDrawIndexedIndirectCount"); + table->CreateRenderPass2 = (PFN_vkCreateRenderPass2) gpa(device, "vkCreateRenderPass2"); + table->CmdBeginRenderPass2 = (PFN_vkCmdBeginRenderPass2) gpa(device, "vkCmdBeginRenderPass2"); + table->CmdNextSubpass2 = (PFN_vkCmdNextSubpass2) gpa(device, "vkCmdNextSubpass2"); + table->CmdEndRenderPass2 = (PFN_vkCmdEndRenderPass2) gpa(device, "vkCmdEndRenderPass2"); + table->ResetQueryPool = (PFN_vkResetQueryPool) gpa(device, "vkResetQueryPool"); + table->GetSemaphoreCounterValue = (PFN_vkGetSemaphoreCounterValue) gpa(device, "vkGetSemaphoreCounterValue"); + table->WaitSemaphores = (PFN_vkWaitSemaphores) gpa(device, "vkWaitSemaphores"); + table->SignalSemaphore = (PFN_vkSignalSemaphore) gpa(device, "vkSignalSemaphore"); + table->GetBufferDeviceAddress = (PFN_vkGetBufferDeviceAddress) gpa(device, "vkGetBufferDeviceAddress"); + table->GetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress) gpa(device, "vkGetBufferOpaqueCaptureAddress"); + table->GetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress) gpa(device, "vkGetDeviceMemoryOpaqueCaptureAddress"); + table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(device, "vkCreateSwapchainKHR"); + table->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) gpa(device, "vkGetSwapchainImagesKHR"); + table->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(device, "vkAcquireNextImageKHR"); + table->QueuePresentKHR = (PFN_vkQueuePresentKHR) gpa(device, "vkQueuePresentKHR"); + table->GetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) gpa(device, "vkGetDeviceGroupPresentCapabilitiesKHR"); + table->GetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) gpa(device, "vkGetDeviceGroupSurfacePresentModesKHR"); + table->AcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) gpa(device, "vkAcquireNextImage2KHR"); + table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR) gpa(device, "vkCreateSharedSwapchainsKHR"); + table->GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR) gpa(device, "vkGetMemoryFdKHR"); + table->GetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHR) gpa(device, "vkGetMemoryFdPropertiesKHR"); + table->ImportSemaphoreFdKHR = (PFN_vkImportSemaphoreFdKHR) gpa(device, "vkImportSemaphoreFdKHR"); + table->GetSemaphoreFdKHR = (PFN_vkGetSemaphoreFdKHR) gpa(device, "vkGetSemaphoreFdKHR"); + table->GetSwapchainStatusKHR = (PFN_vkGetSwapchainStatusKHR) gpa(device, "vkGetSwapchainStatusKHR"); + table->ImportFenceFdKHR = (PFN_vkImportFenceFdKHR) gpa(device, "vkImportFenceFdKHR"); + table->GetFenceFdKHR = (PFN_vkGetFenceFdKHR) gpa(device, "vkGetFenceFdKHR"); + table->AcquireProfilingLockKHR = (PFN_vkAcquireProfilingLockKHR) gpa(device, "vkAcquireProfilingLockKHR"); + table->ReleaseProfilingLockKHR = (PFN_vkReleaseProfilingLockKHR) gpa(device, "vkReleaseProfilingLockKHR"); + table->CmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR) gpa(device, "vkCmdSetFragmentShadingRateKHR"); + table->CmdSetEvent2KHR = (PFN_vkCmdSetEvent2KHR) gpa(device, "vkCmdSetEvent2KHR"); + table->CmdResetEvent2KHR = (PFN_vkCmdResetEvent2KHR) gpa(device, "vkCmdResetEvent2KHR"); + table->CmdWaitEvents2KHR = (PFN_vkCmdWaitEvents2KHR) gpa(device, "vkCmdWaitEvents2KHR"); + table->CmdPipelineBarrier2KHR = (PFN_vkCmdPipelineBarrier2KHR) gpa(device, "vkCmdPipelineBarrier2KHR"); + table->CmdWriteTimestamp2KHR = (PFN_vkCmdWriteTimestamp2KHR) gpa(device, "vkCmdWriteTimestamp2KHR"); + table->QueueSubmit2KHR = (PFN_vkQueueSubmit2KHR) gpa(device, "vkQueueSubmit2KHR"); + table->CmdWriteBufferMarker2AMD = (PFN_vkCmdWriteBufferMarker2AMD) gpa(device, "vkCmdWriteBufferMarker2AMD"); + table->GetQueueCheckpointData2NV = (PFN_vkGetQueueCheckpointData2NV) gpa(device, "vkGetQueueCheckpointData2NV"); + table->CmdCopyBuffer2KHR = (PFN_vkCmdCopyBuffer2KHR) gpa(device, "vkCmdCopyBuffer2KHR"); + table->CmdCopyImage2KHR = (PFN_vkCmdCopyImage2KHR) gpa(device, "vkCmdCopyImage2KHR"); + table->CmdCopyBufferToImage2KHR = (PFN_vkCmdCopyBufferToImage2KHR) gpa(device, "vkCmdCopyBufferToImage2KHR"); + table->CmdCopyImageToBuffer2KHR = (PFN_vkCmdCopyImageToBuffer2KHR) gpa(device, "vkCmdCopyImageToBuffer2KHR"); + table->CmdBlitImage2KHR = (PFN_vkCmdBlitImage2KHR) gpa(device, "vkCmdBlitImage2KHR"); + table->CmdResolveImage2KHR = (PFN_vkCmdResolveImage2KHR) gpa(device, "vkCmdResolveImage2KHR"); + table->DisplayPowerControlEXT = (PFN_vkDisplayPowerControlEXT) gpa(device, "vkDisplayPowerControlEXT"); + table->RegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT) gpa(device, "vkRegisterDeviceEventEXT"); + table->RegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT) gpa(device, "vkRegisterDisplayEventEXT"); + table->GetSwapchainCounterEXT = (PFN_vkGetSwapchainCounterEXT) gpa(device, "vkGetSwapchainCounterEXT"); + table->CmdSetDiscardRectangleEXT = (PFN_vkCmdSetDiscardRectangleEXT) gpa(device, "vkCmdSetDiscardRectangleEXT"); + table->CmdSetDiscardRectangleEnableEXT = (PFN_vkCmdSetDiscardRectangleEnableEXT) gpa(device, "vkCmdSetDiscardRectangleEnableEXT"); + table->CmdSetDiscardRectangleModeEXT = (PFN_vkCmdSetDiscardRectangleModeEXT) gpa(device, "vkCmdSetDiscardRectangleModeEXT"); + table->SetHdrMetadataEXT = (PFN_vkSetHdrMetadataEXT) gpa(device, "vkSetHdrMetadataEXT"); + table->SetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT) gpa(device, "vkSetDebugUtilsObjectNameEXT"); + table->SetDebugUtilsObjectTagEXT = (PFN_vkSetDebugUtilsObjectTagEXT) gpa(device, "vkSetDebugUtilsObjectTagEXT"); + table->QueueBeginDebugUtilsLabelEXT = (PFN_vkQueueBeginDebugUtilsLabelEXT) gpa(device, "vkQueueBeginDebugUtilsLabelEXT"); + table->QueueEndDebugUtilsLabelEXT = (PFN_vkQueueEndDebugUtilsLabelEXT) gpa(device, "vkQueueEndDebugUtilsLabelEXT"); + table->QueueInsertDebugUtilsLabelEXT = (PFN_vkQueueInsertDebugUtilsLabelEXT) gpa(device, "vkQueueInsertDebugUtilsLabelEXT"); + table->CmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT) gpa(device, "vkCmdBeginDebugUtilsLabelEXT"); + table->CmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT) gpa(device, "vkCmdEndDebugUtilsLabelEXT"); + table->CmdInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT) gpa(device, "vkCmdInsertDebugUtilsLabelEXT"); + table->CmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT) gpa(device, "vkCmdSetSampleLocationsEXT"); + table->GetImageDrmFormatModifierPropertiesEXT = (PFN_vkGetImageDrmFormatModifierPropertiesEXT) gpa(device, "vkGetImageDrmFormatModifierPropertiesEXT"); + table->GetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT) gpa(device, "vkGetMemoryHostPointerPropertiesEXT"); + table->GetCalibratedTimestampsEXT = (PFN_vkGetCalibratedTimestampsEXT) gpa(device, "vkGetCalibratedTimestampsEXT"); + table->CmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT) gpa(device, "vkCmdSetLineStippleEXT"); + table->CmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT) gpa(device, "vkCmdSetCullModeEXT"); + table->CmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT) gpa(device, "vkCmdSetFrontFaceEXT"); + table->CmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT) gpa(device, "vkCmdSetPrimitiveTopologyEXT"); + table->CmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT) gpa(device, "vkCmdSetViewportWithCountEXT"); + table->CmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT) gpa(device, "vkCmdSetScissorWithCountEXT"); + table->CmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT) gpa(device, "vkCmdBindVertexBuffers2EXT"); + table->CmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT) gpa(device, "vkCmdSetDepthTestEnableEXT"); + table->CmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT) gpa(device, "vkCmdSetDepthWriteEnableEXT"); + table->CmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT) gpa(device, "vkCmdSetDepthCompareOpEXT"); + table->CmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT) gpa(device, "vkCmdSetDepthBoundsTestEnableEXT"); + table->CmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT) gpa(device, "vkCmdSetStencilTestEnableEXT"); + table->CmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT) gpa(device, "vkCmdSetStencilOpEXT"); + table->CmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT) gpa(device, "vkCmdSetVertexInputEXT"); + table->CmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT) gpa(device, "vkCmdSetPatchControlPointsEXT"); + table->CmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT) gpa(device, "vkCmdSetRasterizerDiscardEnableEXT"); + table->CmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT) gpa(device, "vkCmdSetDepthBiasEnableEXT"); + table->CmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT) gpa(device, "vkCmdSetLogicOpEXT"); + table->CmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT) gpa(device, "vkCmdSetPrimitiveRestartEnableEXT"); + table->CmdSetColorWriteEnableEXT = (PFN_vkCmdSetColorWriteEnableEXT) gpa(device, "vkCmdSetColorWriteEnableEXT"); +} + + +static inline void layer_init_instance_dispatch_table(VkInstance instance, VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa) { + memset(table, 0, sizeof(*table)); + + // Instance function pointers + table->DestroyInstance = (PFN_vkDestroyInstance) gpa(instance, "vkDestroyInstance"); + table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) gpa(instance, "vkEnumeratePhysicalDevices"); + table->GetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) gpa(instance, "vkGetPhysicalDeviceFeatures"); + table->GetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) gpa(instance, "vkGetPhysicalDeviceFormatProperties"); + table->GetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) gpa(instance, "vkGetPhysicalDeviceImageFormatProperties"); + table->GetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) gpa(instance, "vkGetPhysicalDeviceProperties"); + table->GetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) gpa(instance, "vkGetPhysicalDeviceQueueFamilyProperties"); + table->GetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) gpa(instance, "vkGetPhysicalDeviceMemoryProperties"); + table->GetInstanceProcAddr = gpa; + table->EnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) gpa(instance, "vkEnumerateDeviceExtensionProperties"); + table->EnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) gpa(instance, "vkEnumerateDeviceLayerProperties"); + table->EnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) gpa(instance, "vkEnumeratePhysicalDeviceGroups"); + table->GetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) gpa(instance, "vkGetPhysicalDeviceFeatures2"); + table->GetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) gpa(instance, "vkGetPhysicalDeviceProperties2"); + table->GetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) gpa(instance, "vkGetPhysicalDeviceFormatProperties2"); + table->GetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) gpa(instance, "vkGetPhysicalDeviceImageFormatProperties2"); + table->GetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) gpa(instance, "vkGetPhysicalDeviceQueueFamilyProperties2"); + table->GetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) gpa(instance, "vkGetPhysicalDeviceMemoryProperties2"); + table->GetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) gpa(instance, "vkGetPhysicalDeviceExternalBufferProperties"); + table->GetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) gpa(instance, "vkGetPhysicalDeviceExternalFenceProperties"); + table->GetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) gpa(instance, "vkGetPhysicalDeviceExternalSemaphoreProperties"); + table->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) gpa(instance, "vkDestroySurfaceKHR"); + table->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR"); + table->GetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); + table->GetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"); + table->GetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) gpa(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"); + table->GetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) gpa(instance, "vkGetPhysicalDevicePresentRectanglesKHR"); + table->GetPhysicalDeviceDisplayPropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR) gpa(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR"); + table->GetPhysicalDeviceDisplayPlanePropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR) gpa(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + table->GetDisplayPlaneSupportedDisplaysKHR = (PFN_vkGetDisplayPlaneSupportedDisplaysKHR) gpa(instance, "vkGetDisplayPlaneSupportedDisplaysKHR"); + table->GetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR) gpa(instance, "vkGetDisplayModePropertiesKHR"); + table->CreateDisplayModeKHR = (PFN_vkCreateDisplayModeKHR) gpa(instance, "vkCreateDisplayModeKHR"); + table->GetDisplayPlaneCapabilitiesKHR = (PFN_vkGetDisplayPlaneCapabilitiesKHR) gpa(instance, "vkGetDisplayPlaneCapabilitiesKHR"); + table->CreateDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR) gpa(instance, "vkCreateDisplayPlaneSurfaceKHR"); + table->EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR = (PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR) gpa(instance, "vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR"); + table->GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR = (PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR) gpa(instance, "vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR"); + table->GetPhysicalDeviceSurfaceCapabilities2KHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR) gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilities2KHR"); + table->GetPhysicalDeviceSurfaceFormats2KHR = (PFN_vkGetPhysicalDeviceSurfaceFormats2KHR) gpa(instance, "vkGetPhysicalDeviceSurfaceFormats2KHR"); + table->GetPhysicalDeviceDisplayProperties2KHR = (PFN_vkGetPhysicalDeviceDisplayProperties2KHR) gpa(instance, "vkGetPhysicalDeviceDisplayProperties2KHR"); + table->GetPhysicalDeviceDisplayPlaneProperties2KHR = (PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR) gpa(instance, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR"); + table->GetDisplayModeProperties2KHR = (PFN_vkGetDisplayModeProperties2KHR) gpa(instance, "vkGetDisplayModeProperties2KHR"); + table->GetDisplayPlaneCapabilities2KHR = (PFN_vkGetDisplayPlaneCapabilities2KHR) gpa(instance, "vkGetDisplayPlaneCapabilities2KHR"); + table->GetPhysicalDeviceFragmentShadingRatesKHR = (PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR) gpa(instance, "vkGetPhysicalDeviceFragmentShadingRatesKHR"); + table->ReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT) gpa(instance, "vkReleaseDisplayEXT"); + table->GetPhysicalDeviceSurfaceCapabilities2EXT = (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT) gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); + table->CreateDebugUtilsMessengerEXT = (PFN_vkCreateDebugUtilsMessengerEXT) gpa(instance, "vkCreateDebugUtilsMessengerEXT"); + table->DestroyDebugUtilsMessengerEXT = (PFN_vkDestroyDebugUtilsMessengerEXT) gpa(instance, "vkDestroyDebugUtilsMessengerEXT"); + table->SubmitDebugUtilsMessageEXT = (PFN_vkSubmitDebugUtilsMessageEXT) gpa(instance, "vkSubmitDebugUtilsMessageEXT"); + table->GetPhysicalDeviceMultisamplePropertiesEXT = (PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT) gpa(instance, "vkGetPhysicalDeviceMultisamplePropertiesEXT"); + table->GetPhysicalDeviceCalibrateableTimeDomainsEXT = (PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT) gpa(instance, "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT"); + table->CreateHeadlessSurfaceEXT = (PFN_vkCreateHeadlessSurfaceEXT) gpa(instance, "vkCreateHeadlessSurfaceEXT"); +} diff --git a/tests/framework/layer/wrap_objects.cpp b/tests/framework/layer/wrap_objects.cpp index 514f904a7..31ef6592f 100644 --- a/tests/framework/layer/wrap_objects.cpp +++ b/tests/framework/layer/wrap_objects.cpp @@ -28,7 +28,11 @@ #include #include "vulkan/vk_layer.h" +#ifdef VULKANSC +#include "vksc_dispatch_table_helper.h" +#else #include "vk_dispatch_table_helper.h" +#endif // VULKANSC #include "loader/vk_loader_layer.h" // Export full support of instance extension VK_EXT_direct_mode_display extension @@ -451,6 +455,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkEnumerateDeviceExtensionProperties(VkPhysi } ext_count = 0; +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 #if TEST_LAYER_EXPORT_MAINT_1 if (ext_count < count) { #if defined(_WIN32) @@ -463,6 +468,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkEnumerateDeviceExtensionProperties(VkPhysi ext_count++; } #endif +#endif // VULKANSC #if TEST_LAYER_EXPORT_PRESENT_IMAGE if (ext_count < count) { #if defined(_WIN32) @@ -529,19 +535,23 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateDevice(VkPhysicalDevice physicalDevi layer_init_device_dispatch_table(dev->obj, &dev->disp, pfn_get_dev_proc_addr); for (uint32_t ext = 0; ext < pCreateInfo->enabledExtensionCount; ++ext) { +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 if (!strcmp(pCreateInfo->ppEnabledExtensionNames[ext], VK_KHR_MAINTENANCE1_EXTENSION_NAME)) { #if TEST_LAYER_EXPORT_MAINT_1 dev->maintanence_1_enabled = true; #endif } +#endif // VULKANSC if (!strcmp(pCreateInfo->ppEnabledExtensionNames[ext], VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { #if TEST_LAYER_EXPORT_PRESENT_IMAGE dev->present_image_enabled = true; #endif } +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC if (!strcmp(pCreateInfo->ppEnabledExtensionNames[ext], VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { dev->debug_marker_enabled = true; } +#endif // VULKANSC } dev->debug_utils_enabled = phys_dev->inst->debug_utils_enabled; @@ -568,13 +578,16 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkGetPhysicalDeviceSurfaceCapabilities2EXT(V return VK_SUCCESS; } +#ifndef VULKANSC // vkTrimCommandPool is not supported in Vulkan SC // Fake device extension support VKAPI_ATTR void VKAPI_CALL wrap_vkTrimCommandPoolKHR(VkDevice, VkCommandPool, VkCommandPoolTrimFlags) {} +#endif // VULKANSC // Return an odd error so we can verify that this actually got called VKAPI_ATTR VkResult VKAPI_CALL wrap_vkGetSwapchainStatusKHR(VkDevice, VkSwapchainKHR) { return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; } // Debug utils & debug marker ext stubs +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC VKAPI_ATTR VkResult VKAPI_CALL wrap_vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) { VkDebugMarkerObjectTagInfoEXT new_info = *pTagInfo; wrapped_dev_obj *dev; @@ -622,6 +635,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkDebugMarkerSetObjectNameEXT(VkDevice devic // vkCmdDebugMarkerBeginEXT // vkCmdDebugMarkerEndEXT // vkCmdDebugMarkerInsertEXT +#endif // VULKANSC VKAPI_ATTR VkResult VKAPI_CALL wrap_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) { VkDebugUtilsObjectNameInfoEXT new_info = *pNameInfo; @@ -680,10 +694,13 @@ PFN_vkVoidFunction layer_intercept_device_proc(wrapped_dev_obj *dev, const char if (!strcmp(name, "CreateDevice")) return (PFN_vkVoidFunction)wrap_vkCreateDevice; if (!strcmp(name, "DestroyDevice")) return (PFN_vkVoidFunction)wrap_vkDestroyDevice; +#ifndef VULKANSC // vkTrimCommandPool is not supported in Vulkan SC if (dev->maintanence_1_enabled && !strcmp(name, "TrimCommandPoolKHR")) return (PFN_vkVoidFunction)wrap_vkTrimCommandPoolKHR; +#endif // VULKANSC if (dev->present_image_enabled && !strcmp(name, "GetSwapchainStatusKHR")) return (PFN_vkVoidFunction)wrap_vkGetSwapchainStatusKHR; +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC if (dev->debug_marker_enabled && !strcmp(name, "DebugMarkerSetObjectTagEXT")) return (PFN_vkVoidFunction)wrap_vkDebugMarkerSetObjectTagEXT; if (dev->debug_marker_enabled && !strcmp(name, "DebugMarkerSetObjectNameEXT")) @@ -692,6 +709,7 @@ PFN_vkVoidFunction layer_intercept_device_proc(wrapped_dev_obj *dev, const char return (PFN_vkVoidFunction)wrap_vkSetDebugUtilsObjectNameEXT; if (dev->debug_utils_enabled && !strcmp(name, "SetDebugUtilsObjectTagEXT")) return (PFN_vkVoidFunction)wrap_vkSetDebugUtilsObjectTagEXT; +#endif // VULKANSC return NULL; } @@ -784,11 +802,15 @@ PFN_vkVoidFunction layer_intercept_instance_proc(wrapped_inst_obj *inst, const c // instance_proc needs to be able to query device commands even if the extension isn't enabled (because it isn't known at this // time) +#ifndef VULKANSC // vkTrimCommandPool is not supported in Vulkan SC if (!strcmp(name, "TrimCommandPoolKHR")) return (PFN_vkVoidFunction)wrap_vkTrimCommandPoolKHR; +#endif // VULKANSC if (!strcmp(name, "GetSwapchainStatusKHR")) return (PFN_vkVoidFunction)wrap_vkGetSwapchainStatusKHR; +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) return (PFN_vkVoidFunction)wrap_vkDebugMarkerSetObjectTagEXT; if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) return (PFN_vkVoidFunction)wrap_vkDebugMarkerSetObjectNameEXT; +#endif // VULKANSC if (inst->debug_utils_enabled && !strcmp(name, "SetDebugUtilsObjectNameEXT")) return (PFN_vkVoidFunction)wrap_vkSetDebugUtilsObjectNameEXT; if (inst->debug_utils_enabled && !strcmp(name, "SetDebugUtilsObjectTagEXT")) diff --git a/tests/framework/shim/shim_common.cpp b/tests/framework/shim/shim_common.cpp index 4deb7fce9..6294baa37 100644 --- a/tests/framework/shim/shim_common.cpp +++ b/tests/framework/shim/shim_common.cpp @@ -2,6 +2,7 @@ * Copyright (c) 2021 The Khronos Group Inc. * Copyright (c) 2021 Valve Corporation * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -236,14 +237,22 @@ void PlatformShim::redirect_category(fs::path const& new_path, ManifestCategory for (auto& path : paths) { if (!path.empty()) { +#ifdef VULKANSC + redirect_path(fs::path(path) / "vulkansc" / category_path_name(category), new_path); +#else redirect_path(fs::path(path) / "vulkan" / category_path_name(category), new_path); +#endif // VULKANSC } } } void PlatformShim::set_fake_path(ManifestCategory category, fs::path const& path) { // use /etc as the 'redirection path' by default since its always searched +#ifdef VULKANSC + redirect_path(fs::path(SYSCONFDIR) / "vulkansc" / category_path_name(category), path); +#else redirect_path(fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category), path); +#endif // VULKANSC } void PlatformShim::redirect_dlopen_name(fs::path const& filename, fs::path const& actual_path) { @@ -253,6 +262,10 @@ void PlatformShim::redirect_dlopen_name(fs::path const& filename, fs::path const bool PlatformShim::is_dlopen_redirect_name(fs::path const& filename) { return dlopen_redirection_map.count(filename.str()) == 1; } fs::path PlatformShim::query_default_redirect_path(ManifestCategory category) { +#ifdef VULKANSC + return fs::path(SYSCONFDIR) / "vulkansc" / category_path_name(category); +#else return fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category); +#endif // VULKANSC } #endif diff --git a/tests/framework/test_environment.cpp b/tests/framework/test_environment.cpp index 60acbdc80..8b6db0b0c 100644 --- a/tests/framework/test_environment.cpp +++ b/tests/framework/test_environment.cpp @@ -2,6 +2,7 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -58,8 +59,10 @@ void init_vulkan_functions(VulkanFunctions& funcs) { funcs.vkGetPhysicalDeviceFormatProperties2 = GPA(vkGetPhysicalDeviceFormatProperties2); funcs.vkGetPhysicalDeviceImageFormatProperties = GPA(vkGetPhysicalDeviceImageFormatProperties); funcs.vkGetPhysicalDeviceImageFormatProperties2 = GPA(vkGetPhysicalDeviceImageFormatProperties2); +#ifndef VULKANSC // Sparse resources are not supported in Vulkan SC funcs.vkGetPhysicalDeviceSparseImageFormatProperties = GPA(vkGetPhysicalDeviceSparseImageFormatProperties); funcs.vkGetPhysicalDeviceSparseImageFormatProperties2 = GPA(vkGetPhysicalDeviceSparseImageFormatProperties2); +#endif // VULKANSC funcs.vkGetPhysicalDeviceProperties = GPA(vkGetPhysicalDeviceProperties); funcs.vkGetPhysicalDeviceProperties2 = GPA(vkGetPhysicalDeviceProperties2); funcs.vkGetPhysicalDeviceQueueFamilyProperties = GPA(vkGetPhysicalDeviceQueueFamilyProperties); @@ -96,6 +99,7 @@ void init_vulkan_functions(VulkanFunctions& funcs) { funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR = GPA(vkGetPhysicalDeviceSurfaceCapabilities2KHR); funcs.vkGetPhysicalDeviceSurfaceFormats2KHR = GPA(vkGetPhysicalDeviceSurfaceFormats2KHR); +#ifndef VULKANSC // Usual WSI platforms are not supported in Vulkan SC #if defined(VK_USE_PLATFORM_ANDROID_KHR) funcs.vkCreateAndroidSurfaceKHR = GPA(vkCreateAndroidSurfaceKHR); #endif // VK_USE_PLATFORM_ANDROID_KHR @@ -118,10 +122,12 @@ void init_vulkan_functions(VulkanFunctions& funcs) { #if defined(VK_USE_PLATFORM_METAL_EXT) funcs.vkCreateMetalSurfaceEXT = GPA(vkCreateMetalSurfaceEXT); #endif // VK_USE_PLATFORM_METAL_EXT +#endif // VULKANSC #if defined(VK_USE_PLATFORM_SCREEN_QNX) funcs.vkCreateScreenSurfaceQNX = GPA(vkCreateScreenSurfaceQNX); funcs.vkGetPhysicalDeviceScreenPresentationSupportQNX = GPA(vkGetPhysicalDeviceScreenPresentationSupportQNX); #endif // VK_USE_PLATFORM_SCREEN_QNX +#ifndef VULKANSC // Usual WSI platforms are not supported in Vulkan SC #if defined(VK_USE_PLATFORM_WAYLAND_KHR) funcs.vkCreateWaylandSurfaceKHR = GPA(vkCreateWaylandSurfaceKHR); funcs.vkGetPhysicalDeviceWaylandPresentationSupportKHR = GPA(vkGetPhysicalDeviceWaylandPresentationSupportKHR); @@ -138,6 +144,7 @@ void init_vulkan_functions(VulkanFunctions& funcs) { funcs.vkCreateWin32SurfaceKHR = GPA(vkCreateWin32SurfaceKHR); funcs.vkGetPhysicalDeviceWin32PresentationSupportKHR = GPA(vkGetPhysicalDeviceWin32PresentationSupportKHR); #endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VULKANSC funcs.vkDestroyDevice = GPA(vkDestroyDevice); funcs.vkGetDeviceQueue = GPA(vkGetDeviceQueue); @@ -159,10 +166,14 @@ DeviceFunctions::DeviceFunctions(const VulkanFunctions& vulkan_functions, VkDevi vkGetDeviceQueue = load(device, "vkGetDeviceQueue"); vkCreateCommandPool = load(device, "vkCreateCommandPool"); vkAllocateCommandBuffers = load(device, "vkAllocateCommandBuffers"); +#ifndef VULKANSC // vkDestroyCommandPool is not supported in Vulkan SC vkDestroyCommandPool = load(device, "vkDestroyCommandPool"); +#endif // VULKANSC vkCreateSwapchainKHR = load(device, "vkCreateSwapchainKHR"); vkGetSwapchainImagesKHR = load(device, "vkGetSwapchainImagesKHR"); +#ifndef VULKANSC // vkDestroySwapchainKHR is not supported in Vulkan SC vkDestroySwapchainKHR = load(device, "vkDestroySwapchainKHR"); +#endif // VULKANSC } InstWrapper::InstWrapper(VulkanFunctions& functions, VkAllocationCallbacks* callbacks) noexcept @@ -405,26 +416,47 @@ FrameworkEnvironment::FrameworkEnvironment(FrameworkSettings const& settings) no #if COMMON_UNIX_PLATFORMS auto home = get_env_var("HOME"); auto unsecured_location = get_folder(ManifestLocation::unsecured_location).location(); +#ifdef VULKANSC + platform_shim->redirect_path(home + "/.local/share/vulkansc/icd.d", unsecured_location); + platform_shim->redirect_path(home + "/.local/share/vulkansc/implicit_layer.d", unsecured_location); + platform_shim->redirect_path(home + "/.local/share/vulkansc/explicit_layer.d", unsecured_location); +#else platform_shim->redirect_path(home + "/.local/share/vulkan/icd.d", unsecured_location); platform_shim->redirect_path(home + "/.local/share/vulkan/implicit_layer.d", unsecured_location); platform_shim->redirect_path(home + "/.local/share/vulkan/explicit_layer.d", unsecured_location); +#endif // VULKANSC #endif } #if COMMON_UNIX_PLATFORMS +#ifdef VULKANSC + if (settings.secure_loader_settings) { + platform_shim->redirect_path("/etc/vulkansc/loader_settings.d", get_folder(ManifestLocation::settings_location).location()); + } else { + platform_shim->redirect_path(get_env_var("HOME") + "/.local/share/vulkansc/loader_settings.d", + get_folder(ManifestLocation::settings_location).location()); + } +#else if (settings.secure_loader_settings) { platform_shim->redirect_path("/etc/vulkan/loader_settings.d", get_folder(ManifestLocation::settings_location).location()); } else { platform_shim->redirect_path(get_env_var("HOME") + "/.local/share/vulkan/loader_settings.d", get_folder(ManifestLocation::settings_location).location()); } +#endif // VULKANSC #endif #if defined(__APPLE__) // Necessary since bundles look in sub folders for manifests, not the test framework folder itself auto bundle_location = get_folder(ManifestLocation::macos_bundle).location(); +#ifdef VULKANSC + platform_shim->redirect_path(bundle_location / "vulkansc/icd.d", bundle_location); + platform_shim->redirect_path(bundle_location / "vulkansc/explicit_layer.d", bundle_location); + platform_shim->redirect_path(bundle_location / "vulkansc/implicit_layer.d", bundle_location); +#else platform_shim->redirect_path(bundle_location / "vulkan/icd.d", bundle_location); platform_shim->redirect_path(bundle_location / "vulkan/explicit_layer.d", bundle_location); platform_shim->redirect_path(bundle_location / "vulkan/implicit_layer.d", bundle_location); +#endif #endif // only set the settings file if there are elements in the app_specific_settings vector if (!settings.loader_settings.app_specific_settings.empty()) { @@ -470,8 +502,13 @@ TestICD& FrameworkEnvironment::add_icd(TestICDDetails icd_details) noexcept { if (icd_details.library_path_type == LibraryPathType::default_search_paths) { platform_shim->redirect_dlopen_name(new_driver_name, new_driver_location); } else if (icd_details.library_path_type == LibraryPathType::relative) { +#ifdef VULKANSC + platform_shim->redirect_dlopen_name(fs::path(SYSCONFDIR) / "vulkansc" / "icd.d" / "." / new_driver_name, + new_driver_location); +#else platform_shim->redirect_dlopen_name(fs::path(SYSCONFDIR) / "vulkan" / "icd.d" / "." / new_driver_name, new_driver_location); +#endif // VULKANSC } #endif #if defined(WIN32) @@ -613,8 +650,13 @@ void FrameworkEnvironment::add_layer_impl(TestLayerDetails layer_details, Manife platform_shim->redirect_dlopen_name(layer_binary_name, new_layer_location); } if (layer_details.library_path_type == LibraryPathType::relative) { +#ifdef VULKANSC + platform_shim->redirect_dlopen_name( + fs::path(SYSCONFDIR) / "vulkansc" / category_path_name(category) / "." / layer_binary_name, new_layer_location); +#else platform_shim->redirect_dlopen_name( fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category) / "." / layer_binary_name, new_layer_location); +#endif // VULKANSC } #endif #if defined(WIN32) diff --git a/tests/framework/test_environment.h b/tests/framework/test_environment.h index be36c175d..757e12a3e 100644 --- a/tests/framework/test_environment.h +++ b/tests/framework/test_environment.h @@ -2,6 +2,7 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -147,8 +148,10 @@ struct VulkanFunctions { PFN_vkGetPhysicalDeviceFormatProperties2 vkGetPhysicalDeviceFormatProperties2 = nullptr; PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties = nullptr; PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2 = nullptr; +#ifndef VULKANSC // Sparse resources are not supported in Vulkan SC PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties = nullptr; PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 vkGetPhysicalDeviceSparseImageFormatProperties2 = nullptr; +#endif // VULKANSC PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties = nullptr; PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2 = nullptr; PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties = nullptr; @@ -252,10 +255,14 @@ struct DeviceFunctions { PFN_vkGetDeviceQueue vkGetDeviceQueue = nullptr; PFN_vkCreateCommandPool vkCreateCommandPool = nullptr; PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers = nullptr; +#ifndef VULKANSC // vkDestroyCommandPool is not supported in Vulkan SC PFN_vkDestroyCommandPool vkDestroyCommandPool = nullptr; +#endif // VULKANSC PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR = nullptr; PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR = nullptr; +#ifndef VULKANSC // vkDestroySwapchainKHR is not supported in Vulkan SC PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR = nullptr; +#endif // VULKANSC DeviceFunctions() = default; DeviceFunctions(const VulkanFunctions& vulkan_functions, VkDevice device); diff --git a/tests/framework/test_util.cpp b/tests/framework/test_util.cpp index 6952a480d..4b7ad56f9 100644 --- a/tests/framework/test_util.cpp +++ b/tests/framework/test_util.cpp @@ -2,6 +2,7 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -576,7 +577,12 @@ VkInstanceCreateInfo* InstanceCreateInfo::get() noexcept { return &instance_info; } InstanceCreateInfo& InstanceCreateInfo::set_api_version(uint32_t major, uint32_t minor, uint32_t patch) { +#ifdef VULKANSC + // Make sure to include Vulkan SC API variant in the requested API version + this->api_version = VK_MAKE_API_VERSION(VKSC_API_VARIANT, major, minor, patch); +#else this->api_version = VK_MAKE_API_VERSION(0, major, minor, patch); +#endif // VULKANSC return *this; } InstanceCreateInfo& InstanceCreateInfo::setup_WSI(const char* api_selection) { diff --git a/tests/framework/test_util.h b/tests/framework/test_util.h index 7bb423776..2a5bdf508 100644 --- a/tests/framework/test_util.h +++ b/tests/framework/test_util.h @@ -2,6 +2,8 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -86,7 +88,11 @@ #endif +#ifdef VULKANSC +#include +#else #include +#endif // VULKANSC #include #include @@ -490,14 +496,24 @@ inline std::ostream& operator<<(std::ostream& os, const VkResult& result) { return os << "VK_ERROR_OUT_OF_DATE_KHR"; case (VK_ERROR_INCOMPATIBLE_DISPLAY_KHR): return os << "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; +#ifndef VULKANSC case (VK_ERROR_VALIDATION_FAILED_EXT): return os << "VK_ERROR_VALIDATION_FAILED_EXT"; case (VK_ERROR_INVALID_SHADER_NV): return os << "VK_ERROR_INVALID_SHADER_NV"; +#else + case (VK_ERROR_NO_PIPELINE_MATCH): + return os << "VK_ERROR_NO_PIPELINE_MATCH"; + case (VK_ERROR_INVALID_PIPELINE_CACHE_DATA): + return os << "VK_ERROR_INVALID_PIPELINE_CACHE_DATA"; + case (VK_ERROR_VALIDATION_FAILED): + return os << "VK_ERROR_VALIDATION_FAILED"; +#endif // VULKANSC case (VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT): return os << "VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT"; case (VK_ERROR_NOT_PERMITTED_EXT): return os << "VK_ERROR_NOT_PERMITTED_EXT"; +#ifndef VULKANSC case (VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT): return os << "VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT"; case (VK_THREAD_IDLE_KHR): @@ -510,8 +526,10 @@ inline std::ostream& operator<<(std::ostream& os, const VkResult& result) { return os << "VK_OPERATION_NOT_DEFERRED_KHR"; case (VK_PIPELINE_COMPILE_REQUIRED_EXT): return os << "VK_PIPELINE_COMPILE_REQUIRED_EXT"; +#endif // VULKANSC case (VK_RESULT_MAX_ENUM): return os << "VK_RESULT_MAX_ENUM"; +#ifndef VULKANSC case (VK_ERROR_COMPRESSION_EXHAUSTED_EXT): return os << "VK_ERROR_COMPRESSION_EXHAUSTED_EXT"; case (VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR): @@ -530,6 +548,10 @@ inline std::ostream& operator<<(std::ostream& os, const VkResult& result) { return os << "VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR"; case (VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT): return os << "VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT"; +#else + default: + break; +#endif // VULKANSC } return os << static_cast(result); } @@ -687,7 +709,11 @@ struct InstanceCreateInfo { BUILDER_VALUE(InstanceCreateInfo, uint32_t, flags, 0) BUILDER_VALUE(InstanceCreateInfo, uint32_t, app_version, 0) BUILDER_VALUE(InstanceCreateInfo, uint32_t, engine_version, 0) +#ifdef VULKANSC + BUILDER_VALUE(InstanceCreateInfo, uint32_t, api_version, VKSC_API_VERSION_1_0) +#else BUILDER_VALUE(InstanceCreateInfo, uint32_t, api_version, VK_API_VERSION_1_0) +#endif // VULKANSC BUILDER_VECTOR(InstanceCreateInfo, const char*, enabled_layers, layer) BUILDER_VECTOR(InstanceCreateInfo, const char*, enabled_extensions, extension) // tell the get() function to not provide `application_info` diff --git a/tests/live_verification/macos_static_loader_build.cpp b/tests/live_verification/macos_static_loader_build.cpp index 4292fa5d8..ae5ca494d 100644 --- a/tests/live_verification/macos_static_loader_build.cpp +++ b/tests/live_verification/macos_static_loader_build.cpp @@ -30,7 +30,11 @@ #include #include +#ifdef VULKANSC +#include "vulkan/vulkan_sc.h" +#else #include "vulkan/vulkan.h" +#endif // VULKANSC static std::atomic_bool is_running; diff --git a/tests/loader_alloc_callback_tests.cpp b/tests/loader_alloc_callback_tests.cpp index 46cdc4c42..af87c9c78 100644 --- a/tests/loader_alloc_callback_tests.cpp +++ b/tests/loader_alloc_callback_tests.cpp @@ -2,6 +2,8 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -716,6 +718,7 @@ TEST(Allocation, CreateInstanceDeviceIntentionalAllocFail) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)); +#ifndef VULKANSC // VK_LUNARG_direct_driver_loading is not supported in Vulkan SC VkDirectDriverLoadingInfoLUNARG ddl_info{}; ddl_info.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_INFO_LUNARG; ddl_info.pfnGetInstanceProcAddr = env.icds.back().icd_library.get_symbol("vk_icdGetInstanceProcAddr"); @@ -725,6 +728,7 @@ TEST(Allocation, CreateInstanceDeviceIntentionalAllocFail) { ddl_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; ddl_list.driverCount = 1; ddl_list.pDrivers = &ddl_info; +#endif // VULKANSC const char* layer_name = "VK_LAYER_ImplicitAllocFail"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -757,8 +761,10 @@ TEST(Allocation, CreateInstanceDeviceIntentionalAllocFail) { VkInstance instance; InstanceCreateInfo inst_create_info{}; +#ifndef VULKANSC // VK_LUNARG_direct_driver_loading is not supported in Vulkan SC inst_create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); inst_create_info.instance_info.pNext = reinterpret_cast(&ddl_list); +#endif // VULKANSC result = env.vulkan_functions.vkCreateInstance(inst_create_info.get(), tracker.get(), &instance); if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { ASSERT_TRUE(tracker.empty()); diff --git a/tests/loader_debug_ext_tests.cpp b/tests/loader_debug_ext_tests.cpp index aa6b7f0e7..4e8245802 100644 --- a/tests/loader_debug_ext_tests.cpp +++ b/tests/loader_debug_ext_tests.cpp @@ -33,6 +33,7 @@ // ========================================= // +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC // Prototype declaration for callback so we can use it in class utility methods VkBool32 VKAPI_CALL test_DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, @@ -354,6 +355,7 @@ TEST_F(ManualReport, InfoMessage) { // Message should be found ASSERT_EQ(true, message_found); } +#endif // VULKANSC // // VK_EXT_debug_util specific tests @@ -509,6 +511,7 @@ TEST_F(CreateDestroyInstanceMessenger, WarnInCreateIgnored) { ASSERT_EQ(false, message_found); } +#ifndef VULKANSC // Does not apply to Vulkan SC // Test debug utils (error/warning) created in vkCreateInstance with warning in vkCreateInstance TEST_F(CreateDestroyInstanceMessenger, WarnInCreate) { expected_message = "The API Variant specified"; @@ -526,6 +529,7 @@ TEST_F(CreateDestroyInstanceMessenger, WarnInCreate) { ASSERT_EQ(true, message_found); } +#endif // VULKANSC // Test debug utils error created in vkCreateInstance with error in vkEnumeratePhysicalDevices. // This should not be logged because we have only defined the debug utils logging for vkCreateInstance @@ -856,7 +860,9 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ InstWrapper inst(env.vulkan_functions); if (enable_debug_extensions) { inst.create_info.add_extension("VK_EXT_debug_utils"); +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC inst.create_info.add_extension("VK_EXT_debug_report"); +#endif // VULKANSC } inst.create_info.setup_WSI(); ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); @@ -866,6 +872,10 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ DeviceWrapper dev{inst}; dev.create_info.add_extension("VK_KHR_swapchain"); dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); +#ifdef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC + (void)hardware_supports_debug_exts; + ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); +#else if (enable_debug_extensions) { dev.create_info.add_extension("VK_EXT_debug_marker"); } @@ -879,6 +889,7 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ } else { ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); } +#endif // VULKANSC DeviceFunctions dev_funcs{env.vulkan_functions, dev}; VkSurfaceKHR surface{}; @@ -895,12 +906,14 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ return use_GIPA ? inst.load(func_name) : dev.load(func_name); }; +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC // Debug marker PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT = load_function("vkDebugMarkerSetObjectTagEXT"); PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT = load_function("vkDebugMarkerSetObjectNameEXT"); PFN_vkCmdDebugMarkerBeginEXT CmdDebugMarkerBeginEXT = load_function("vkCmdDebugMarkerBeginEXT"); PFN_vkCmdDebugMarkerEndEXT CmdDebugMarkerEndEXT = load_function("vkCmdDebugMarkerEndEXT"); PFN_vkCmdDebugMarkerInsertEXT CmdDebugMarkerInsertEXT = load_function("vkCmdDebugMarkerInsertEXT"); +#endif // VULKANSC // Debug utils PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = load_function("vkSetDebugUtilsObjectNameEXT"); PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT = load_function("vkSetDebugUtilsObjectTagEXT"); @@ -911,6 +924,7 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT = load_function("vkCmdEndDebugUtilsLabelEXT"); PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT = load_function("vkCmdInsertDebugUtilsLabelEXT"); +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC // Debug marker functions - should always be found when using GIPA but when using GDPA found only when the extension is enabled if (use_GIPA) { ASSERT_TRUE(nullptr != DebugMarkerSetObjectTagEXT); @@ -925,6 +939,7 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ ASSERT_EQ(enable_debug_extensions, nullptr != CmdDebugMarkerEndEXT); ASSERT_EQ(enable_debug_extensions, nullptr != CmdDebugMarkerInsertEXT); } +#endif // VULKANSC // Debug utils functions - should only be found if the extension was enabled (because its instance level) ASSERT_EQ(enable_debug_extensions, nullptr != SetDebugUtilsObjectNameEXT); @@ -972,6 +987,7 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ utils_object_tag.objectType = VK_OBJECT_TYPE_SURFACE_KHR; ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(dev.dev, &utils_object_tag)); } +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC VkDebugMarkerObjectTagInfoEXT marker_object_tag{}; VkDebugMarkerObjectNameInfoEXT marker_object_name{}; if (use_GIPA && !enable_debug_extensions) { @@ -1014,6 +1030,7 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(dev.dev, &marker_object_name)); } } +#endif // VULKANSC VkQueue queue{}; dev.functions->vkGetDeviceQueue(dev.dev, 0, 0, &queue); VkDebugUtilsLabelEXT utils_label{}; @@ -1035,7 +1052,9 @@ void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_ if (CmdEndDebugUtilsLabelEXT) CmdEndDebugUtilsLabelEXT(cmd_buf); if (CmdInsertDebugUtilsLabelEXT) CmdInsertDebugUtilsLabelEXT(cmd_buf, &utils_label); +#ifndef VULKANSC // vkDestroySwapchainKHR is not supported in Vulkan SC dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); +#endif // VULKANSC env.vulkan_functions.vkDestroySurfaceKHR(inst.inst, surface, nullptr); } @@ -1055,9 +1074,12 @@ TEST(GetProcAddr, DebugFuncsWithTerminator) { ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, true, false)); // Now set the hardware to support the extensions and run the situations again +#ifdef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC + driver.add_instance_extensions({"VK_EXT_debug_utils"}); +#else driver.add_instance_extensions({"VK_EXT_debug_utils", "VK_EXT_debug_report"}); driver.physical_devices.at(0).add_extensions({"VK_EXT_debug_marker"}); - +#endif // VULKANSC // Use getDeviceProcAddr & vary enabling the debug extensions ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, false, true)); ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, true, true)); @@ -1087,9 +1109,13 @@ TEST(GetProcAddr, DebugFuncsWithTrampoline) { .set_name("VK_LAYER_test_layer") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_disable_environment("DISABLE_ME") +#ifdef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC + .add_instance_extension({VK_EXT_DEBUG_UTILS_EXTENSION_NAME})), +#else .add_instance_extensions({{VK_EXT_DEBUG_REPORT_EXTENSION_NAME}, {VK_EXT_DEBUG_UTILS_EXTENSION_NAME}}) .add_device_extension({VK_EXT_DEBUG_MARKER_EXTENSION_NAME})), +#endif // VULKANSC "test_layer.json"); // // Use getDeviceProcAddr & vary enabling the debug extensions @@ -1123,8 +1149,12 @@ TEST(GetProcAddr, DebugFuncsWithDebugExtsForceAdded) { .set_disable_environment("DISABLE_ME")), "test_layer.json"); env.get_test_layer() +#ifdef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC + .add_injected_instance_extension({VK_EXT_DEBUG_UTILS_EXTENSION_NAME}); +#else .add_injected_instance_extensions({{VK_EXT_DEBUG_REPORT_EXTENSION_NAME}, {VK_EXT_DEBUG_UTILS_EXTENSION_NAME}}) .add_injected_device_extension({VK_EXT_DEBUG_MARKER_EXTENSION_NAME}); +#endif // VULKANSC // Use getDeviceProcAddr & vary enabling the debug extensions ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, false, true)); @@ -1139,7 +1169,11 @@ TEST(DebugUtils, WrappingLayer) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) .set_min_icd_interface_version(5) +#ifdef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC + .add_physical_device(PhysicalDevice{}.finish()) +#else .add_physical_device(PhysicalDevice{}.add_extension(VK_EXT_DEBUG_MARKER_EXTENSION_NAME).finish()) +#endif // VULKANSC .add_instance_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); const char* wrap_objects_name = "VK_LAYER_LUNARG_wrap_objects"; @@ -1152,7 +1186,9 @@ TEST(DebugUtils, WrappingLayer) { InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC inst.create_info.add_extension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME); +#endif // VULKANSC inst.create_info.add_layer(wrap_objects_name); inst.CheckCreate(); DebugUtilsWrapper log{inst}; @@ -1160,7 +1196,9 @@ TEST(DebugUtils, WrappingLayer) { auto phys_dev = inst.GetPhysDev(); DeviceWrapper device{inst}; +#ifndef VULKANSC // VK_EXT_debug_marker is not supported in Vulkan SC device.create_info.add_extension(VK_EXT_DEBUG_MARKER_EXTENSION_NAME); +#endif // VULKANSC device.CheckCreate(phys_dev); { PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = inst.load("vkSetDebugUtilsObjectNameEXT"); @@ -1198,6 +1236,7 @@ TEST(DebugUtils, WrappingLayer) { info.objectHandle = (uint64_t)inst.inst; ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(device, &info)); } +#ifndef VULKANSC // Debug marker { PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT = inst.load("vkDebugMarkerSetObjectNameEXT"); @@ -1235,4 +1274,5 @@ TEST(DebugUtils, WrappingLayer) { info.object = (uint64_t)inst.inst; ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(device, &info)); } +#endif // VULKANSC } diff --git a/tests/loader_envvar_tests.cpp b/tests/loader_envvar_tests.cpp index 3bb7515e8..4c5d43156 100644 --- a/tests/loader_envvar_tests.cpp +++ b/tests/loader_envvar_tests.cpp @@ -2,6 +2,8 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -218,10 +220,17 @@ TEST(EnvVarICDOverrideSetup, XDG) { inst.CheckCreate(); auto check_paths = [](DebugUtilsLogger const& debug_log, ManifestCategory category) { +#ifdef VULKANSC + EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober/vulkansc") / category_path_name(category)).str())); + EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober2/vulkansc") / category_path_name(category)).str())); + EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober3/vulkansc") / category_path_name(category)).str())); + EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober4/with spaces/vulkansc") / category_path_name(category)).str())); +#else EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober/vulkan") / category_path_name(category)).str())); EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober2/vulkan") / category_path_name(category)).str())); EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober3/vulkan") / category_path_name(category)).str())); EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober4/with spaces/vulkan") / category_path_name(category)).str())); +#endif // VULKANSC }; check_paths(env.debug_log, ManifestCategory::icd); check_paths(env.debug_log, ManifestCategory::implicit_layer); @@ -384,6 +393,8 @@ TEST(EnvVarICDOverrideSetup, TestOnlyAddLayerEnvVar) { #endif +// TODO: Vulkan SC - This depends on Vulkan 1.3 for some reason +#ifndef VULKANSC // Test that the driver filter select will only enable driver manifest files that match the filter TEST(EnvVarICDOverrideSetup, FilterSelectDriver) { FrameworkEnvironment env{}; @@ -748,3 +759,4 @@ TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) { ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); } +#endif // VULKANSC diff --git a/tests/loader_get_proc_addr_tests.cpp b/tests/loader_get_proc_addr_tests.cpp index 6a167d160..be7e390ea 100644 --- a/tests/loader_get_proc_addr_tests.cpp +++ b/tests/loader_get_proc_addr_tests.cpp @@ -2,6 +2,8 @@ * Copyright (c) 2021-2022 The Khronos Group Inc. * Copyright (c) 2021-2022 Valve Corporation * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -33,7 +35,9 @@ TEST(GetProcAddr, VerifyGetInstanceProcAddr) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); { InstWrapper inst{env.vulkan_functions}; +#ifndef VULKANSC inst.create_info.set_api_version(VK_API_VERSION_1_1); +#endif // VULKANSC inst.CheckCreate(); // NOTE: The vulkan_functions are queried using the platform get proc addr from the loader. So we'll compare @@ -44,6 +48,7 @@ TEST(GetProcAddr, VerifyGetInstanceProcAddr) { ASSERT_EQ(gipa_loader, gipa_queried); } +#ifndef VULKANSC { InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(VK_API_VERSION_1_3); @@ -56,6 +61,7 @@ TEST(GetProcAddr, VerifyGetInstanceProcAddr) { env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetInstanceProcAddr")); ASSERT_EQ(gipa_loader, gipa_queried); } +#endif // VULKANSC } // Verify that the various ways to get vkGetDeviceProcAddr return the same value @@ -114,6 +120,7 @@ TEST(GetProcAddr, GlobalFunctions) { auto CreateInstance = reinterpret_cast(gipa(NULL, "vkCreateInstance")); handle_assert_has_value(CreateInstance); } +#ifndef VULKANSC // The following checks do not apply to Vulkan SC // Now create an instance and query the functions again - should work because the instance version is less than 1.2 for (int i = 0; i <= 2; i++) { InstWrapper inst{env.vulkan_functions}; @@ -144,10 +151,17 @@ TEST(GetProcAddr, GlobalFunctions) { PFN_vkCreateInstance CreateInstance = inst.load("vkCreateInstance"); handle_assert_has_value(CreateInstance); } +#endif // VULKANSC { +#ifdef VULKANSC + // Create a Vulkan SC 1.0 instance - now everything should return NULL + InstWrapper inst{env.vulkan_functions}; + inst.create_info.api_version = VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 0); +#else // Create a 1.3 instance - now everything should return NULL InstWrapper inst{env.vulkan_functions}; inst.create_info.api_version = VK_MAKE_API_VERSION(0, 1, 3, 0); +#endif // VULKANSC inst.CheckCreate(); PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties = @@ -222,6 +236,7 @@ TEST(GetDeviceProcAddr, SwapchainFuncsWithTerminator) { log.find("vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " "extension enabled?")); log.logger.clear(); +#ifndef VULKANSC // vkDestroySwapchainKHR is not supported in Vulkan SC if (dev_funcs.vkDestroySwapchainKHR) dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); // try to call the vkCreateSwapchainKHR acquired from the instance - this *should* abort due to not enabling the extension if (inst_CreateSwapchainKHR) { @@ -231,6 +246,7 @@ TEST(GetDeviceProcAddr, SwapchainFuncsWithTerminator) { } log.logger.clear(); if (dev_funcs.vkDestroySwapchainKHR) dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); +#endif // VULKANSC VkDeviceGroupPresentModeFlagsKHR modes{}; if (GetDeviceGroupSurfacePresentModesKHR) GetDeviceGroupSurfacePresentModesKHR(dev.dev, surface, &modes); @@ -264,6 +280,7 @@ TEST(GetDeviceProcAddr, SwapchainFuncsWithTerminator) { log.find("vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " "extension enabled?")); log.logger.clear(); +#ifndef VULKANSC // vkDestroySwapchainKHR is not supported in Vulkan SC if (dev_funcs.vkDestroySwapchainKHR) dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); if (inst_CreateSwapchainKHR) inst_CreateSwapchainKHR(dev.dev, &info, nullptr, &swapchain); ASSERT_FALSE( @@ -271,6 +288,7 @@ TEST(GetDeviceProcAddr, SwapchainFuncsWithTerminator) { "extension enabled?")); log.logger.clear(); if (dev_funcs.vkDestroySwapchainKHR) dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); +#endif // VULKANSC VkDeviceGroupPresentModeFlagsKHR modes{}; if (GetDeviceGroupSurfacePresentModesKHR) GetDeviceGroupSurfacePresentModesKHR(dev.dev, surface, &modes); @@ -301,6 +319,7 @@ TEST(GetProcAddr, PreserveLayerGettingVkCreateDeviceWithNullInstance) { dev.CheckCreate(phys_dev); } +#ifndef VULKANSC // VK_KHR_maintenance5 is not supported in Vulkan SC // The following tests - AppQueries11FunctionsWhileOnlyEnabling10, AppQueries12FunctionsWhileOnlyEnabling11, and // AppQueries13FunctionsWhileOnlyEnabling12 - check that vkGetDeviceProcAddr only returning functions from core versions up to // the apiVersion declared in VkApplicationInfo. Function querying should succeed if VK_KHR_maintenance_5 is not enabled, and they @@ -474,3 +493,4 @@ TEST(GetDeviceProcAddr, AppQueries13FunctionsWhileOnlyEnabling12) { } } } +#endif // VULKANSC diff --git a/tests/loader_handle_validation_tests.cpp b/tests/loader_handle_validation_tests.cpp index 24cb303be..504246668 100644 --- a/tests/loader_handle_validation_tests.cpp +++ b/tests/loader_handle_validation_tests.cpp @@ -588,6 +588,7 @@ TEST(LoaderHandleValidTests, BadPhysDevEnumDevLayerProps) { "\\[VUID-vkEnumerateDeviceLayerProperties-physicalDevice-parameter\\]"); } +#ifndef VULKANSC // Sparse resources are not supported in Vulkan SC TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) @@ -607,6 +608,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps) { "vkGetPhysicalDeviceSparseImageFormatProperties: Invalid physicalDevice " "\\[VUID-vkGetPhysicalDeviceSparseImageFormatProperties-physicalDevice-parameter\\]"); } +#endif // VULKANSC TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature2) { FrameworkEnvironment env{}; @@ -728,6 +730,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps2) { "\\[VUID-vkGetPhysicalDeviceMemoryProperties2-physicalDevice-parameter\\]"); } +#ifndef VULKANSC // Sparse resources are not supported in Vulkan SC TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps2) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) @@ -748,6 +751,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps2) { "vkGetPhysicalDeviceSparseImageFormatProperties2: Invalid physicalDevice " "\\[VUID-vkGetPhysicalDeviceSparseImageFormatProperties2-physicalDevice-parameter\\]"); } +#endif // VULKANSC TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternFenceProps) { FrameworkEnvironment env{}; @@ -803,7 +807,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternSemaphoreProps) { auto bad_physical_dev = get_bad_handle(); - VkPhysicalDeviceExternalSemaphoreInfoKHR info = {}; + VkPhysicalDeviceExternalSemaphoreInfo info = {}; info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO; info.pNext = nullptr; VkExternalSemaphoreProperties props = {}; @@ -1217,6 +1221,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevMSPropsEXT) { "\\[VUID-vkGetPhysicalDeviceMultisamplePropertiesEXT-physicalDevice-parameter\\]"); } +#ifndef VULKANSC // VK_EXT_acquire_drm_display is not supported in Vulkan SC TEST(LoaderHandleValidTests, BadPhysDevAcquireDrmDisplayEXT) { FrameworkEnvironment env{}; auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_EXT_acquire_drm_display"}); @@ -1250,6 +1255,7 @@ TEST(LoaderHandleValidTests, BadPhysDevReleaseDisplayEXT) { ASSERT_DEATH(pfn(bad_physical_dev, VK_NULL_HANDLE), "vkReleaseDisplayEXT: Invalid physicalDevice \\[VUID-vkReleaseDisplayEXT-physicalDevice-parameter\\]"); } +#endif // VULKANSC #if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) TEST(LoaderHandleValidTests, BadPhysDevAcquireXlibDisplayEXT) { @@ -1299,6 +1305,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModes2EXT) { } #endif // VK_USE_PLATFORM_WIN32_KHR +#ifndef VULKANSC // VK_EXT_tooling_info is not supported in Vulkan SC TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevToolPropertiesEXT) { FrameworkEnvironment env{}; auto instance = setup_BadPhysDev_env(env, {}); @@ -1311,6 +1318,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevToolPropertiesEXT) { "vkGetPhysicalDeviceToolPropertiesEXT: Invalid physicalDevice " "\\[VUID-vkGetPhysicalDeviceToolPropertiesEXT-physicalDevice-parameter\\]"); } +#endif // VULKANSC #if defined(VK_USE_PLATFORM_ANDROID_KHR) TEST(LoaderHandleValidTests, VerifyHandleWrappingAndroidSurface) { diff --git a/tests/loader_layer_tests.cpp b/tests/loader_layer_tests.cpp index b7c88171d..2b32167a6 100644 --- a/tests/loader_layer_tests.cpp +++ b/tests/loader_layer_tests.cpp @@ -2,6 +2,8 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -252,7 +254,7 @@ TEST(ImplicitLayers, OverrideGetInstanceProcAddr) { { InstWrapper inst1{env.vulkan_functions}; - inst1.CheckCreate(VK_ERROR_INVALID_SHADER_NV); + inst1.CheckCreate(VK_ERROR_FRAGMENTED_POOL); } { @@ -988,8 +990,13 @@ TEST(ImplicitLayers, DuplicateLayers) { #if defined(WIN32) env.platform_shim->add_manifest(ManifestCategory::implicit_layer, env.get_folder(ManifestLocation::override_layer).location()); #elif COMMON_UNIX_PLATFORMS +#ifdef VULKANSC + env.platform_shim->redirect_path(fs::path(USER_LOCAL_SHARE_DIR "/vulkansc/implicit_layer.d"), + env.get_folder(ManifestLocation::override_layer).location()); +#else env.platform_shim->redirect_path(fs::path(USER_LOCAL_SHARE_DIR "/vulkan/implicit_layer.d"), env.get_folder(ManifestLocation::override_layer).location()); +#endif // VULKANSC #endif auto layer_props = env.GetLayerProperties(2); @@ -1035,11 +1042,16 @@ TEST(MetaLayers, InvalidComponentLayer) { auto layer_props = env.GetLayerProperties(1); EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(meta_layer_name); @@ -1070,11 +1082,16 @@ TEST(MetaLayers, ExplicitMetaLayer) { auto layer_props = env.GetLayerProperties(2); EXPECT_TRUE(check_permutation({regular_layer_name, meta_layer_name}, layer_props)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC } { // don't enable the layer, shouldn't find any layers when calling vkEnumerateDeviceLayerProperties InstWrapper inst{env.vulkan_functions}; @@ -1114,11 +1131,16 @@ TEST(MetaLayers, MetaLayerNameInComponentLayers) { auto layer_props = env.GetLayerProperties(1); EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(meta_layer_name); @@ -1152,11 +1174,16 @@ TEST(MetaLayers, MetaLayerWhichAddsMetaLayer) { auto layer_props = env.GetLayerProperties(3); EXPECT_TRUE(check_permutation({regular_layer_name, meta_layer_name, meta_meta_layer_name}, layer_props)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(meta_layer_name); @@ -1280,6 +1307,7 @@ TEST(OverrideMetaLayer, OlderVersionThanInstance) { auto layer_props = env.GetLayerProperties(2); EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } +#ifndef VULKANSC { // 1.1 instance InstWrapper inst{env.vulkan_functions}; inst.create_info.api_version = VK_API_VERSION_1_1; @@ -1298,6 +1326,7 @@ TEST(OverrideMetaLayer, OlderVersionThanInstance) { ASSERT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); ASSERT_TRUE(string_eq(layer_props[1].layerName, lunarg_meta_layer_name)); } +#endif // VULKANSC } TEST(OverrideMetaLayer, OlderMetaLayerWithNewerInstanceVersion) { @@ -1900,7 +1929,11 @@ TEST(ExplicitLayers, OverridePreInstanceFunctions) { ASSERT_EQ(count, 2U); count = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + ASSERT_EQ(count, 1U); +#else ASSERT_EQ(count, 4U); +#endif // VULKANSC uint32_t version = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); @@ -1953,7 +1986,11 @@ TEST(ExplicitLayers, LayerSettingsPreInstanceFunctions) { ASSERT_EQ(count, 1U); count = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + ASSERT_EQ(count, 1U); +#else ASSERT_EQ(count, 4U); +#endif // VULKANSC uint32_t version = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); @@ -1997,7 +2034,11 @@ TEST(ExplicitLayers, ContainsPreInstanceFunctions) { ASSERT_EQ(count, 1U); count = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + ASSERT_EQ(count, 1U); +#else ASSERT_EQ(count, 4U); +#endif // VULKANSC uint32_t version = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); @@ -2052,6 +2093,7 @@ TEST(LayerCreateInstance, GetPhysicalDeviceProperties2) { inst.CheckCreate(); } +#ifndef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader TEST(LayerCreateInstance, GetPhysicalDeviceProperties2KHR) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)) @@ -2084,6 +2126,7 @@ TEST(LayerCreateInstance, GetPhysicalDeviceProperties2KHR) { inst.create_info.add_layer(regular_layer_name).add_extension("VK_KHR_get_physical_device_properties2"); inst.CheckCreate(); } +#endif // VULKANSC TEST(ExplicitLayers, MultipleLayersInSingleManifest) { FrameworkEnvironment env; @@ -2600,11 +2643,16 @@ TEST(LayerExtensions, ImplicitNoAdditionalInstanceExtension) { EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC // Make sure the extensions that are implemented only in the test layers is not present. ASSERT_FALSE(contains(extensions, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); @@ -2643,12 +2691,18 @@ TEST(LayerExtensions, ImplicitDirDispModeInstanceExtension) { EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(2); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); + EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(5); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(4).extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); +#endif // VULKANSC // Make sure the extensions that are implemented only in the test layers is not present. ASSERT_FALSE(contains(extensions, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); @@ -2687,12 +2741,18 @@ TEST(LayerExtensions, ImplicitDispSurfCountInstanceExtension) { EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(2); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); + EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(5); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(4).extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); +#endif // VULKANSC InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extension(VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME); @@ -2730,6 +2790,12 @@ TEST(LayerExtensions, ImplicitBothInstanceExtensions) { EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(3); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); + EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); + EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(6); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); @@ -2737,6 +2803,7 @@ TEST(LayerExtensions, ImplicitBothInstanceExtensions) { EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(4).extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(5).extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); +#endif // VULKANSC InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extension(VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME) @@ -2761,11 +2828,16 @@ TEST(LayerExtensions, ExplicitNoAdditionalInstanceExtension) { auto layers = env.GetLayerProperties(1); ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC // Now query by layer name. ASSERT_NO_FATAL_FAILURE(env.GetInstanceExtensions(0, explicit_layer_name)); @@ -2794,11 +2866,16 @@ TEST(LayerExtensions, ExplicitDirDispModeInstanceExtension) { auto layers = env.GetLayerProperties(1); ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC // Now query by layer name. auto layer_extensions = env.GetInstanceExtensions(1, explicit_layer_name); @@ -2837,11 +2914,16 @@ TEST(LayerExtensions, ExplicitDispSurfCountInstanceExtension) { auto layers = env.GetLayerProperties(1); ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC // Now query by layer name. auto layer_extensions = env.GetInstanceExtensions(1, explicit_layer_name); @@ -2882,11 +2964,16 @@ TEST(LayerExtensions, ExplicitBothInstanceExtensions) { auto layers = env.GetLayerProperties(1); ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC // Make sure the extensions still aren't present in this layer auto layer_extensions = env.GetInstanceExtensions(2, explicit_layer_name); @@ -2924,6 +3011,7 @@ TEST(LayerExtensions, ExplicitBothInstanceExtensions) { ASSERT_EQ(365U, surf_caps.maxImageArrayLayers); } +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 and vkTrimCommandPool is not supported TEST(LayerExtensions, ImplicitNoAdditionalDeviceExtension) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); @@ -3018,6 +3106,7 @@ TEST(LayerExtensions, ImplicitMaintenanceDeviceExtension) { handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR")); handle_assert_null(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); } +#endif // VULKANSC TEST(LayerExtensions, ImplicitPresentImageDeviceExtension) { FrameworkEnvironment env; @@ -3056,6 +3145,7 @@ TEST(LayerExtensions, ImplicitPresentImageDeviceExtension) { handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); } +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 and vkTrimCommandPool is not supported TEST(LayerExtensions, ImplicitBothDeviceExtensions) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); @@ -3093,6 +3183,7 @@ TEST(LayerExtensions, ImplicitBothDeviceExtensions) { handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR")); handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); } +#endif // VULKANSC TEST(LayerExtensions, ExplicitNoAdditionalDeviceExtension) { FrameworkEnvironment env; @@ -3124,6 +3215,7 @@ TEST(LayerExtensions, ExplicitNoAdditionalDeviceExtension) { handle_assert_null(dev->vkGetDeviceProcAddr(dev.dev, "vkSetDeviceMemoryPriorityEXT")); } +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 and vkTrimCommandPool is not supported TEST(LayerExtensions, ExplicitMaintenanceDeviceExtension) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); @@ -3157,6 +3249,7 @@ TEST(LayerExtensions, ExplicitMaintenanceDeviceExtension) { handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR")); handle_assert_null(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); } +#endif // VULKANSC TEST(LayerExtensions, ExplicitPresentImageDeviceExtension) { FrameworkEnvironment env; @@ -3193,6 +3286,7 @@ TEST(LayerExtensions, ExplicitPresentImageDeviceExtension) { handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); } +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 and vkTrimCommandPool is not supported TEST(LayerExtensions, ExplicitBothDeviceExtensions) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); @@ -3238,6 +3332,7 @@ TEST(LayerExtensions, ExplicitBothDeviceExtensions) { ASSERT_EQ(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, gipa_pfnGetSwapchainStatusKHR(dev.dev, VK_NULL_HANDLE)); ASSERT_EQ(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, gdpa_pfnGetSwapchainStatusKHR(dev.dev, VK_NULL_HANDLE)); } +#endif // VULKANSC TEST(TestLayers, ExplicitlyEnableImplicitLayer) { FrameworkEnvironment env; @@ -3371,6 +3466,7 @@ TEST(TestLayers, ImplicitLayerPre10APIVersion) { } } +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 and vkTrimCommandPool is not supported // Verify that VK_INSTANCE_LAYERS work. To test this, make sure that an explicit layer does not affect an instance until // it is set with VK_INSTANCE_LAYERS TEST(TestLayers, InstEnvironEnableExplicitLayer) { @@ -3432,6 +3528,7 @@ TEST(TestLayers, InstEnvironEnableExplicitLayer) { ASSERT_EQ(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, pfn_GetSwapchainStatusAfter(dev2.dev, VK_NULL_HANDLE)); } +#endif // VULKANSC // Verify that VK_LOADER_LAYERS_ENABLE work. To test this, make sure that an explicit layer does not affect an instance until // it is set with VK_LOADER_LAYERS_ENABLE @@ -4378,6 +4475,7 @@ TEST(TestLayers, OverrideBlacklistedLayerWithEnableFilter) { } } +#ifndef VULKANSC // VK_KHR_maintenance1 is included in core Vulkan SC 1.0 and vkTrimCommandPool is not supported // Add a device layer, should not work TEST(TestLayers, DoNotUseDeviceLayer) { FrameworkEnvironment env; @@ -4474,6 +4572,7 @@ TEST(TestLayers, InstanceAndDeviceLayer) { ASSERT_EQ(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, pfn_GetSwapchainStatusAfter(dev.dev, VK_NULL_HANDLE)); } +#endif // VULKANSC // Make sure loader does not throw an error for a device layer that is not present TEST(TestLayers, DeviceLayerNotPresent) { diff --git a/tests/loader_phys_dev_inst_ext_tests.cpp b/tests/loader_phys_dev_inst_ext_tests.cpp index 85d58bd25..744c044e4 100644 --- a/tests/loader_phys_dev_inst_ext_tests.cpp +++ b/tests/loader_phys_dev_inst_ext_tests.cpp @@ -56,6 +56,7 @@ void FillInRandomDeviceProps(VkPhysicalDeviceProperties& props, uint32_t api_ver // VK_KHR_get_physical_device_properties2 // +#ifndef VULKANSC // GPDP2 is included in core Vulkan SC 1.0 // Test vkGetPhysicalDeviceProperties2KHR where nothing supports it. TEST(LoaderInstPhysDevExts, PhysDevProps2KHRNoSupport) { FrameworkEnvironment env{}; @@ -3252,6 +3253,7 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFencePropsMixed) { } } } +#endif // VULKANSC // // VK_KHR_get_surface_capabilities2 @@ -5530,6 +5532,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRMixed) { // VK_EXT_acquire_drm_display // +#ifndef VULKANSC // VK_EXT_acquire_drm_display is not supported in Vulkan SC // Test vkAcquireDrmDisplayEXT where nothing supports it. TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTNoSupport) { FrameworkEnvironment env{}; @@ -5890,6 +5893,7 @@ TEST(LoaderInstPhysDevExts, DifferentInstanceExtensions) { GetPhysicalDeviceExternalFenceProperties(physical_devices[dev], &ext_fence_info, &ext_fence_props); } } +#endif // VULKANSC TEST(LoaderInstPhysDevExts, DifferentPhysicalDeviceExtensions) { FrameworkEnvironment env{}; diff --git a/tests/loader_regression_tests.cpp b/tests/loader_regression_tests.cpp index 560fd5656..f95472a38 100644 --- a/tests/loader_regression_tests.cpp +++ b/tests/loader_regression_tests.cpp @@ -2,6 +2,8 @@ * Copyright (c) 2021-2023 The Khronos Group Inc. * Copyright (c) 2021-2023 Valve Corporation * Copyright (c) 2021-2023 LunarG, Inc. + * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -210,6 +212,12 @@ TEST(EnumerateInstanceExtensionProperties, UsageChecks) { std::array extensions; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + ASSERT_EQ(extension_count, 3U); // default extensions + our two extensions + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, first_ext.extensionName.c_str())); + EXPECT_TRUE(string_eq(extensions.at(1).extensionName, second_ext.extensionName.c_str())); + EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else ASSERT_EQ(extension_count, 6U); // default extensions + our two extensions EXPECT_TRUE(string_eq(extensions.at(0).extensionName, first_ext.extensionName.c_str())); @@ -218,8 +226,16 @@ TEST(EnumerateInstanceExtensionProperties, UsageChecks) { EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(4).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(5).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC } { // Two Pass +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(3); + // loader always adds the debug utils extension + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, first_ext.extensionName.c_str())); + EXPECT_TRUE(string_eq(extensions.at(1).extensionName, second_ext.extensionName.c_str())); + EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(6); // loader always adds the debug report & debug utils extensions EXPECT_TRUE(string_eq(extensions.at(0).extensionName, first_ext.extensionName.c_str())); @@ -228,9 +244,11 @@ TEST(EnumerateInstanceExtensionProperties, UsageChecks) { EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(4).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(5).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC } } +#ifndef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader TEST(EnumerateInstanceExtensionProperties, PropertyCountLessThanAvailable) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); @@ -260,6 +278,7 @@ TEST(EnumerateInstanceExtensionProperties, PropertyCountLessThanAvailable) { ASSERT_TRUE(string_eq(extensions[0].extensionName, "VK_EXT_debug_report")); } } +#endif // VULKANSC TEST(EnumerateInstanceExtensionProperties, FilterUnkownInstanceExtensions) { FrameworkEnvironment env{}; @@ -269,16 +288,28 @@ TEST(EnumerateInstanceExtensionProperties, FilterUnkownInstanceExtensions) { Extension second_ext{"SecondTestExtension"}; env.reset_icd().add_instance_extensions({first_ext, second_ext}); { +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(1); + // loader always adds the debug utils extension + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(4); // loader always adds the debug report & debug utils extensions EXPECT_TRUE(string_eq(extensions.at(0).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC } { // Disable unknown instance extension filtering EnvVarWrapper disable_inst_ext_filter_env_var{"VK_LOADER_DISABLE_INST_EXT_FILTER", "1"}; +#ifdef VULKANSC // Only VK_EXT_debug_utils is added by the Vulkan SC loader + auto extensions = env.GetInstanceExtensions(3); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, first_ext.extensionName.c_str())); + EXPECT_TRUE(string_eq(extensions.at(1).extensionName, second_ext.extensionName.c_str())); + EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); +#else auto extensions = env.GetInstanceExtensions(6); EXPECT_TRUE(string_eq(extensions.at(0).extensionName, first_ext.extensionName.c_str())); EXPECT_TRUE(string_eq(extensions.at(1).extensionName, second_ext.extensionName.c_str())); @@ -286,6 +317,7 @@ TEST(EnumerateInstanceExtensionProperties, FilterUnkownInstanceExtensions) { EXPECT_TRUE(string_eq(extensions.at(3).extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(4).extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)); EXPECT_TRUE(string_eq(extensions.at(5).extensionName, VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME)); +#endif // VULKANSC } } @@ -683,8 +715,7 @@ TEST(EnumeratePhysicalDevices, OneCall) { TEST(EnumeratePhysicalDevices, TwoCall) { FrameworkEnvironment env{}; auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) - .set_min_icd_interface_version(5) - .add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + .set_min_icd_interface_version(5); const uint32_t real_device_count = 2; for (uint32_t i = 0; i < real_device_count; i++) { @@ -709,8 +740,7 @@ TEST(EnumeratePhysicalDevices, TwoCall) { TEST(EnumeratePhysicalDevices, MatchOneAndTwoCallNumbers) { FrameworkEnvironment env{}; auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) - .set_min_icd_interface_version(5) - .add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + .set_min_icd_interface_version(5); const uint32_t real_device_count = 3; for (uint32_t i = 0; i < real_device_count; i++) { @@ -745,8 +775,7 @@ TEST(EnumeratePhysicalDevices, MatchOneAndTwoCallNumbers) { TEST(EnumeratePhysicalDevices, TwoCallIncomplete) { FrameworkEnvironment env{}; auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) - .set_min_icd_interface_version(5) - .add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + .set_min_icd_interface_version(5); const uint32_t real_device_count = 2; for (uint32_t i = 0; i < real_device_count; i++) { @@ -1307,6 +1336,14 @@ TEST(CreateDevice, ConsecutiveCreateWithoutDestruction) { } } +// This test uses prebuilt binaries that must be rebuilt for +// non x86 platforms. Attempting to rebuild them by uncommenting lines +// in tests/framework/data/CMakeLists.txt can create further errors due to the +// use of "-m32" and "-m64" which are not available on certain cross compilers. +// As a result, separate 32 bit and 64 bit cross compilers are needed, which +// may be difficult to setup with current cmake infrastructure, so this test +// will be skipped for now when cross compiling. +#if !defined(CROSS_COMPILING) TEST(TryLoadWrongBinaries, WrongICD) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); @@ -1332,6 +1369,7 @@ TEST(TryLoadWrongBinaries, WrongICD) { ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDevices(inst, &driver_count, nullptr)); ASSERT_EQ(driver_count, 1U); } +#endif TEST(TryLoadWrongBinaries, WrongExplicit) { FrameworkEnvironment env{}; @@ -1589,6 +1627,7 @@ TEST(TryLoadWrongBinaries, WrongArchLayer) { ASSERT_TRUE(log.find("Layer library architecture doesn't match the current running architecture, skipping this layer")); } +#ifndef VULKANSC // GPDP2 is included in core Vulkan SC 1.0 TEST(EnumeratePhysicalDeviceGroups, OneCall) { FrameworkEnvironment env{}; auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) @@ -1642,7 +1681,7 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) { ASSERT_EQ(true, found[dev]); } for (auto& group : group_props) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -1660,7 +1699,7 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) { const VkBaseInStructure* pNext = reinterpret_cast(dev.create_info.dev.pNext); while (pNext != nullptr) { if (pNext->sType == VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO) { - ASSERT_EQ(&group_info, reinterpret_cast(pNext)); + ASSERT_EQ(&group_info, reinterpret_cast(pNext)); } if (pNext->sType == 100000) { ASSERT_EQ(&spacer_structure, pNext); @@ -1687,8 +1726,8 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) { uint32_t group_count = static_cast(driver.physical_device_groups.size()); uint32_t returned_group_count = group_count; - std::vector group_props{}; - group_props.resize(group_count, VkPhysicalDeviceGroupPropertiesKHR{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR}); + std::vector group_props{}; + group_props.resize(group_count, VkPhysicalDeviceGroupProperties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR}); ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data())); ASSERT_EQ(group_count, returned_group_count); @@ -1709,7 +1748,7 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) { ASSERT_EQ(true, found[dev]); } for (auto& group : group_props) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -1779,7 +1818,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) { ASSERT_EQ(true, found[dev]); } for (auto& group : group_props) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -1807,8 +1846,8 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) { ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, nullptr)); ASSERT_EQ(group_count, returned_group_count); - std::vector group_props{}; - group_props.resize(group_count, VkPhysicalDeviceGroupPropertiesKHR{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR}); + std::vector group_props{}; + group_props.resize(group_count, VkPhysicalDeviceGroupProperties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR}); ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data())); ASSERT_EQ(group_count, returned_group_count); @@ -1829,7 +1868,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) { ASSERT_EQ(true, found[dev]); } for (auto& group : group_props) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -1895,7 +1934,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) { ASSERT_EQ(true, found); } for (auto& group : group_props) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -1919,13 +1958,13 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) { ASSERT_EQ(group_count, returned_group_count); returned_group_count = 1; - std::array group_props{}; + std::array group_props{}; group_props[0].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; ASSERT_EQ(VK_INCOMPLETE, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data())); ASSERT_EQ(1U, returned_group_count); returned_group_count = 2; - std::array group_props_2{}; + std::array group_props_2{}; group_props_2[0].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; group_props_2[1].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props_2.data())); @@ -1945,7 +1984,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) { ASSERT_EQ(true, found); } for (auto& group : group_props) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -1985,7 +2024,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) { uint32_t core_group_count = 0; std::vector core_group_props{}; uint32_t ext_group_count = 0; - std::vector ext_group_props{}; + std::vector ext_group_props{}; InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 1, 0); @@ -2011,7 +2050,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) { ASSERT_EQ(ext_group_count, returned_group_count); ext_group_props.resize(returned_group_count, - VkPhysicalDeviceGroupPropertiesKHR{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR}); + VkPhysicalDeviceGroupProperties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR}); ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, ext_group_props.data())); ASSERT_EQ(ext_group_count, returned_group_count); @@ -2036,7 +2075,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) { } } for (auto& group : core_group_props) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -2045,6 +2084,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) { dev.CheckCreate(group.physicalDevices[0]); } } +#endif // VULKANSC // Start with 6 devices in 3 different groups, and then add a group, // querying vkEnumeratePhysicalDeviceGroups before and after the add. @@ -2131,7 +2171,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallThriceAddGroupInBetween) { } } for (auto& group : group_props_after) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -2218,7 +2258,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveGroupInBetween) { } } for (auto& group : group_props_after) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -2304,7 +2344,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceAddDeviceInBetween) { } } for (auto& group : group_props_after) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -2401,7 +2441,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveDeviceInBetween) { } } for (auto& group : group_props_after) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -2519,7 +2559,7 @@ TEST(EnumeratePhysicalDeviceGroups, MultipleAddRemoves) { ASSERT_EQ(group_props_after_add_device[group].physicalDeviceCount, after_add_dev_expected_counts[group]); } for (auto& group : group_props_after_add_device) { - VkDeviceGroupDeviceCreateInfoKHR group_info{}; + VkDeviceGroupDeviceCreateInfo group_info{}; group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; group_info.physicalDeviceCount = group.physicalDeviceCount; group_info.pPhysicalDevices = &group.physicalDevices[0]; @@ -2623,7 +2663,7 @@ TEST(EnumeratePhysicalDeviceGroups, FakePNext) { std::array physical_device_groups{}; for (uint32_t group = 0; group < max_phys_dev_groups; ++group) { physical_device_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; - fake_structs[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; + fake_structs[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT; physical_device_groups[group].pNext = &fake_structs[group]; } ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &group_count, physical_device_groups.data())); @@ -2635,6 +2675,7 @@ TEST(EnumeratePhysicalDeviceGroups, FakePNext) { } } +#ifndef VULKANSC // VK_EXT_tooling_info is not supported in Vulkan SC TEST(ExtensionManual, ToolingProperties) { VkPhysicalDeviceToolPropertiesEXT icd_tool_props{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT, nullptr, @@ -2706,6 +2747,7 @@ TEST(ExtensionManual, ToolingProperties) { string_eq(props.name, icd_tool_props.name); } } +#endif // VULKANSC TEST(CreateInstance, InstanceNullLayerPtr) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); @@ -2727,6 +2769,7 @@ TEST(CreateInstance, InstanceNullExtensionPtr) { ASSERT_EQ(env.vulkan_functions.vkCreateInstance(&info, VK_NULL_HANDLE, &inst), VK_ERROR_EXTENSION_NOT_PRESENT); } +#ifndef VULKANSC // Device sorting is not supported in Vulkan SC #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) // NOTE: Sort order only affects Linux TEST(SortedPhysicalDevices, DevicesSortEnabled10NoAppExt) { @@ -3558,7 +3601,9 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { } #endif // __linux__ || __FreeBSD__ || __OpenBSD__ || __GNU__ +#endif // VULKANSC +#ifndef VULKANSC // VK_KHR_portability_enumeration is not supported in Vulkan SC const char* portability_driver_warning = "vkCreateInstance: Found drivers that contain devices which support the portability subset, but " "the instance does not enumerate portability drivers! Applications that wish to enumerate portability " @@ -3787,6 +3832,7 @@ TEST(PortabilityICDConfiguration, PortabilityAndRegularICDPreInstanceFunctions) ASSERT_EQ(layer_count, 0U); } } +#endif // VULKANSC #if defined(_WIN32) TEST(AppPackageDriverDiscovery, AppPackageTest) { diff --git a/tests/loader_settings_tests.cpp b/tests/loader_settings_tests.cpp index 595ef0e45..59c4fa004 100644 --- a/tests/loader_settings_tests.cpp +++ b/tests/loader_settings_tests.cpp @@ -33,10 +33,17 @@ std::string get_settings_location_log_message([[maybe_unused]] FrameworkEnvironm #if defined(WIN32) return s + env.get_folder(ManifestLocation::settings_location).location().str() + "\\vk_loader_settings.json"; #elif COMMON_UNIX_PLATFORMS +#ifdef VULKANSC + if (use_secure) + return s + "/etc/vulkansc/loader_settings.d/vk_loader_settings.json"; + else + return s + "/home/fake_home/.local/share/vulkansc/loader_settings.d/vk_loader_settings.json"; +#else if (use_secure) return s + "/etc/vulkan/loader_settings.d/vk_loader_settings.json"; else return s + "/home/fake_home/.local/share/vulkan/loader_settings.d/vk_loader_settings.json"; +#endif // VULKANSC #endif } @@ -1333,7 +1340,11 @@ TEST(SettingsFile, PreInstanceFunctions) { layer.set_reported_extension_props(ext_props); count = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); +#ifdef VULKANSC + ASSERT_EQ(count, 1U); // Vulkan SC only supports VK_EXT_debug_utils +#else ASSERT_EQ(count, 4U); // dont use the intercepted count - use default count +#endif // VULKANSC // check version uint32_t layer_version = VK_MAKE_API_VERSION(1, 2, 3, 4); diff --git a/tests/loader_version_tests.cpp b/tests/loader_version_tests.cpp index 28191fc38..72c44aca9 100644 --- a/tests/loader_version_tests.cpp +++ b/tests/loader_version_tests.cpp @@ -96,6 +96,7 @@ TEST(ICDInterfaceVersion2Plus, l5_icd5) { // normal. } +#ifndef VULKANSC // EnumerateAdapterPhysicalDevices is not supported in Vulkan SC #if defined(WIN32) // This test makes sure that EnumerateAdapterPhysicalDevices on drivers found in the Khronos/Vulkan/Drivers registry TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, version_6_in_drivers_registry) { @@ -304,6 +305,8 @@ TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, VerifyGroupResults } #endif // defined(WIN32) +#endif // VULKANSC + TEST(ICDInterfaceVersion7, SingleDriver) { FrameworkEnvironment env{}; auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7_WITH_ADDITIONAL_EXPORTS)).add_physical_device({}); @@ -465,6 +468,7 @@ TEST(MultipleDriverConfig, DifferentICDsWithDevicesAndGroups) { ASSERT_EQ(group_count, returned_group_count); } +#ifndef VULKANSC // Device sorting is not supported in Vulkan SC #if defined(WIN32) // This is testing when there are drivers that support the Windows device adapter sorting mechanism by exporting // EnumerateAdapterPhysicalDevices and drivers that do not expose that functionality @@ -542,6 +546,7 @@ TEST(MultipleICDConfig, version_5_and_version_6) { } } #endif // defined(WIN32) +#endif // VULKANSC // shim function pointers for 1.3 // Should use autogen for this - it generates 'shim' functions for validation layers, maybe that could be used here. @@ -574,6 +579,7 @@ void test_vkCmdSetStencilTestEnable(VkCommandBuffer, VkBool32) {} void test_vkCmdSetViewportWithCount(VkCommandBuffer, uint32_t, const VkViewport*) {} void test_vkCmdWaitEvents2(VkCommandBuffer, uint32_t, const VkEvent*, const VkDependencyInfo*) {} void test_vkCmdWriteTimestamp2(VkCommandBuffer, VkPipelineStageFlags2, VkQueryPool, uint32_t) {} +#ifndef VULKANSC // VK_EXT_private_data is not supported in Vulkan SC VkResult test_vkCreatePrivateDataSlot(VkDevice, const VkPrivateDataSlotCreateInfo*, const VkAllocationCallbacks*, VkPrivateDataSlot*) { return VK_SUCCESS; @@ -841,6 +847,7 @@ TEST(LayerManifest, ExplicitNonVulkanVariant) { ASSERT_TRUE(log.find(std::string("Layer \"") + explicit_layer_name + "\" has an \'api_version\' field which contains a non-zero variant value of 1. Skipping Layer.")); } +#endif // VULKANSC TEST(DriverManifest, UnknownManifestVersion) { FrameworkEnvironment env{}; @@ -930,6 +937,7 @@ struct DriverInfo { bool expect_to_find = false; }; +#ifndef VULKANSC // VK_LUNARG_direct_driver_loading is not supported in Vulkan SC void CheckDirectDriverLoading(FrameworkEnvironment& env, std::vector const& normal_drivers, std::vector const& direct_drivers, bool exclusive) { std::vector ddl_infos; @@ -1368,6 +1376,7 @@ TEST(DirectDriverLoading, DriverDoesNotExportNegotiateFunction) { "VkDirectDriverLoadingInfoLUNARG structure at index 0, skipping.")); } } +#endif // VULKANSC TEST(DriverManifest, VersionMismatchWithEnumerateInstanceVersion) { FrameworkEnvironment env{}; diff --git a/tests/loader_wsi_tests.cpp b/tests/loader_wsi_tests.cpp index 99e8bcbc5..cafc478cd 100644 --- a/tests/loader_wsi_tests.cpp +++ b/tests/loader_wsi_tests.cpp @@ -801,7 +801,9 @@ TEST(WsiTests, SwapchainFunctional) { ASSERT_GT(count, 0U); std::array images; ASSERT_EQ(VK_SUCCESS, funcs.vkGetSwapchainImagesKHR(dev, swapchain, &count, images.data())); +#ifndef VULKANSC // vkDestroySwapchain is not supported in Vulkan SC funcs.vkDestroySwapchainKHR(dev, swapchain, nullptr); +#endif // VULKANSC } { // Use GIPA gotten functions DeviceWrapper dev{inst}; @@ -811,10 +813,14 @@ TEST(WsiTests, SwapchainFunctional) { PFN_vkCreateSwapchainKHR inst_CreateSwapchainKHR = inst.load("vkCreateSwapchainKHR"); PFN_vkGetSwapchainImagesKHR inst_GetSwapchainImagesKHR = inst.load("vkGetSwapchainImagesKHR"); +#ifndef VULKANSC // vkDestroySwapchain is not supported in Vulkan SC PFN_vkDestroySwapchainKHR inst_DestroySwapchainKHR = inst.load("vkDestroySwapchainKHR"); +#endif // VULKANSC ASSERT_TRUE(nullptr != inst_CreateSwapchainKHR); ASSERT_TRUE(nullptr != inst_GetSwapchainImagesKHR); +#ifndef VULKANSC // vkDestroySwapchain is not supported in Vulkan SC ASSERT_TRUE(nullptr != inst_DestroySwapchainKHR); +#endif // VULKANSC VkSwapchainKHR swapchain{}; VkSwapchainCreateInfoKHR swap_create_info{}; @@ -826,7 +832,9 @@ TEST(WsiTests, SwapchainFunctional) { ASSERT_GT(count, 0U); std::array images; ASSERT_EQ(VK_SUCCESS, inst_GetSwapchainImagesKHR(dev, swapchain, &count, images.data())); +#ifndef VULKANSC // vkDestroySwapchain is not supported in Vulkan SC inst_DestroySwapchainKHR(dev, swapchain, nullptr); +#endif // VULKANSC } { // forget to enable the extension DeviceWrapper dev{inst}; @@ -835,7 +843,9 @@ TEST(WsiTests, SwapchainFunctional) { DeviceFunctions funcs{*inst.functions, dev}; ASSERT_EQ(funcs.vkCreateSwapchainKHR, nullptr); ASSERT_EQ(funcs.vkGetSwapchainImagesKHR, nullptr); +#ifndef VULKANSC // vkDestroySwapchain is not supported in Vulkan SC ASSERT_EQ(funcs.vkDestroySwapchainKHR, nullptr); +#endif // VULKANSC } { // forget to set the surface DeviceWrapper dev{inst};