diff --git a/.cmake-format.py b/.cmake-format.py deleted file mode 100644 index 07d2f99d65585e1a756c326eefbe17ee57881938..0000000000000000000000000000000000000000 --- a/.cmake-format.py +++ /dev/null @@ -1,34 +0,0 @@ -# Configuration for cmake-format (v0.4.1, circa Jul 2018) -# https://github.com/cheshirekow/cmake_format - -# How wide to allow formatted cmake files -line_width = 132 - -# How many spaces to tab for indent -tab_size = 4 - -# If arglists are longer than this, break them always -max_subargs_per_line = 3 - -# If true, separate flow control names from their parentheses with a space -separate_ctrl_name_with_space = False - -# If true, separate function names from parentheses with a space -separate_fn_name_with_space = False - -# If a statement is wrapped to more than one line, than dangle the closing -# parenthesis on it's own line -dangle_parens = False - -# What character to use for bulleted lists -bullet_char = u'*' - -# What character to use as punctuation after numerals in an enumerated list -enum_char = u'.' - -# What style line endings to use in the output. -line_ending = u'unix' - -# Format command names consistently as 'lower' or 'upper' case -command_case = u'lower' - diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..46f1a60029570d7b9d8df1cd3aece0b3a0667b11 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 3 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a16570c9d69eaf316476bbb5aec64db5f5207f3c..df9146bbcc9bbf62bbf6fc3eee5ed01bc052175c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,5 @@ -# Copyright (c) 2021 Valve Corporation -# Copyright (c) 2021 LunarG, Inc. +# Copyright (c) 2021-2023 Valve Corporation +# Copyright (c) 2021-2023 LunarG, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,137 +14,380 @@ # limitations under the License. # # Author: Lenny Komow +# Author: Charles Giessen name: CI Build +# 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: - - master + push: + pull_request: + branches: + - main + +permissions: read-all jobs: linux: runs-on: ${{matrix.os}} - strategy: matrix: - cc: [ gcc, clang ] - cxx: [ g++, clang++ ] + compiler: [ {cc: gcc, cxx: g++}, {cc: clang, cxx: clang++} ] config: [ Debug, Release ] - os: [ ubuntu-18.04, ubuntu-20.04 ] - exclude: - - cc: gcc - cxx: clang++ - - cc: clang - cxx: g++ - + os: [ ubuntu-20.04, ubuntu-22.04 ] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.7' + - name: Test CMake min + # NOTE: The main users who benefit from an older CMake version + # are linux users stuck on older LTS releases. It's idiomatic best + # practice to try and support them so they don't have to install + # the CMake tarball. Ideally the minimum we use matches what the default + # package provided by Ubuntu via APT. + if: ${{ matrix.os == 'ubuntu-20.04' }} + uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.17.2 - run: sudo apt update - - run: sudo apt install libwayland-dev libxrandr-dev - - - name: Generate build files - run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} -DBUILD_TESTS=On -DUPDATE_DEPS=ON -DTEST_USE_ADDRESS_SANITIZER=ON - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - - - name: Build the loader - run: make -C build - - - 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/Vulkan-Headers/registry - - - 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 - - windows: - runs-on: ${{matrix.os}} - + - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev + - 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 BUILD_WERROR=ON \ + -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \ + -D CMAKE_C_COMPILER=${{ matrix.compiler.cc }} + - run: cmake --build build + - run: ctest --output-on-failure --test-dir build/ + - run: cmake --install build --prefix /tmp + + codegen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: scripts/update_deps.py --dir ext --no-build + - run: scripts/generate_source.py --verify ext/Vulkan-Headers/registry/ + + linux-no-asm: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - run: sudo apt update + - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -D USE_GAS=OFF \ + -D CMAKE_C_COMPILER=clang \ + -D CMAKE_CXX_COMPILER=clang++ + - run: cmake --build build + - run: cmake --install build --prefix /tmp + - run: ctest --output-on-failure -E UnknownFunction --test-dir build/ + + linux-32: + runs-on: ubuntu-22.04 strategy: matrix: - arch: [ Win32, x64 ] config: [ Debug, Release ] - os: [ windows-latest ] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.7' - - - name: Generate build files - run: cmake -S. -Bbuild -A${{matrix.arch}} -DBUILD_TESTS=On -DUPDATE_DEPS=ON - - - name: Build the loader - run: cmake --build ./build --config ${{matrix.config}} - - - 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/Vulkan-Headers/registry + - uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.17.2 + - name: Enable 32 bit + run: sudo dpkg --add-architecture i386 + - run: sudo apt-get update + - 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 + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -D SYSCONFDIR=/etc/not_vulkan \ + -G Ninja + env: + CFLAGS: -m32 + CXXFLAGS: -m32 + LDFLAGS: -m32 + ASFLAGS: --32 + - run: cmake --build build + - run: cmake --install build --prefix /tmp + - run: ctest --output-on-failure + working-directory: build/ + + linux-32-no-asm: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + 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 + - run: sudo apt-get update + - 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 + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -D USE_GAS=OFF \ + -G Ninja + env: + CFLAGS: -m32 + CXXFLAGS: -m32 + LDFLAGS: -m32 + ASFLAGS: --32 + - run: cmake --build build + - run: ctest --output-on-failure -E UnknownFunction + working-directory: build/ + + windows_vs: + runs-on: windows-latest + strategy: + matrix: + arch: [ Win32, x64 ] + config: [ Debug, Release ] + steps: + - uses: actions/checkout@v4 + - run: | + cmake -S. -B build ` + -D BUILD_TESTS=ON ` + -D UPDATE_DEPS=ON ` + -D CMAKE_BUILD_TYPE=${{matrix.config}} ` + -A ${{ matrix.arch }} ` + -D BUILD_WERROR=ON + - run: cmake --build build/ --config ${{matrix.config}} + - run: cmake --install build --prefix build/install --config ${{matrix.config}} + - run: ctest --output-on-failure -C ${{matrix.config}} --test-dir build/ + + windows_vs-no-asm: + runs-on: windows-latest + strategy: + matrix: + arch: [ Win32, x64 ] + steps: + - uses: actions/checkout@v4 + - run: | + cmake -S. -B build ` + -D BUILD_TESTS=ON ` + -D UPDATE_DEPS=ON ` + -D USE_MASM=OFF ` + -D CMAKE_BUILD_TYPE=Release ` + -A ${{ matrix.arch }} ` + -D BUILD_WERROR=ON + - run: cmake --build build/ --config Release + - run: ctest --output-on-failure -C Release -E UnknownFunction --test-dir build/ + + # Test both clang and clang-cl (Chromium project uses clang-cl) + windows_clang: + runs-on: windows-2022 + strategy: + matrix: + compiler: [ clang, clang-cl ] + config: [ Debug, Release ] + steps: + - uses: actions/checkout@v4 + - uses: ilammy/msvc-dev-cmd@v1 + - run: | + cmake -S. -B build ` + -D CMAKE_C_COMPILER=${{matrix.compiler}} ` + -D CMAKE_CXX_COMPILER=${{matrix.compiler}} ` + -D UPDATE_DEPS=ON ` + -D CMAKE_BUILD_TYPE=${{matrix.config}} ` + -D BUILD_WERROR=ON ` + -D BUILD_TESTS=ON ` + -G Ninja + - run: cmake --build build/ + - run: ctest --output-on-failure --test-dir build/ + - run: cmake --install build --prefix build/install mac: - runs-on: macos-latest - + runs-on: macos-11 strategy: matrix: config: [ Debug, Release ] - + static_build: [ APPLE_STATIC_LOADER=ON, APPLE_STATIC_LOADER=OFF ] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.7' - - - name: Generate build files - run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} -DBUILD_TESTS=On -DUPDATE_DEPS=ON -DTEST_USE_ADDRESS_SANITIZER=ON - - - name: Build the loader - run: make -C build - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure - - gn: - runs-on: ubuntu-18.04 - + - uses: lukka/get-cmake@latest + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ + -D ${{matrix.static_build}} \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -D LOADER_ENABLE_ADDRESS_SANITIZER=ON \ + -G Ninja + env: + # Prevents regression of KhronosGroup/Vulkan-Loader/issues/1332 + LDFLAGS: -Wl,-fatal_warnings + - run: cmake --build build + - run: cmake --install build --prefix /tmp + - run: ctest --output-on-failure --test-dir build/ + + apple-cross-compile: + name: ${{ matrix.CMAKE_SYSTEM_NAME }} + runs-on: macos-12 + strategy: + matrix: + CMAKE_SYSTEM_NAME: [ iOS, tvOS ] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + - run: | + cmake -S . -B build \ + -D CMAKE_SYSTEM_NAME=${{ matrix.CMAKE_SYSTEM_NAME }} \ + "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \ + -D CMAKE_BUILD_TYPE=Debug \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -G Ninja + env: + LDFLAGS: -Wl,-fatal_warnings + - run: cmake --build build + - run: cmake --install build --prefix /tmp + - name: Verify Universal Binary + run: | + vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture x86_64' + vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture arm64' + + # Building a universal binary disables assembly automatically + # Furthermore the Vulkan SDK ships universal binaries + mac-univeral: + name: "Universal Binary Testing (STATIC ${{ matrix.static }}) w/ ${{ matrix.generator }}" + runs-on: macos-latest strategy: matrix: - config: [ Debug, Release ] - + static: [ 'ON', 'OFF' ] + generator: [ Ninja, Xcode ] steps: - - uses: actions/checkout@v2 - - - name: Get depot tools + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D APPLE_STATIC_LOADER=${{matrix.static}} \ + "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -G ${{ matrix.generator }} + env: + LDFLAGS: -Wl,-fatal_warnings + - run: cmake --build build --config Release + - run: ctest --output-on-failure --build-config Release -E UnknownFunction --test-dir build/ + - run: cmake --install build --config Release --prefix /tmp + - name: Verify Universal Binary + if: ${{ matrix.static == 'OFF' }} run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools - echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH - - - name: Fetch and install headers - run: ./build-gn/update_deps.sh - - - name: Generate build files - run: gn gen out/${{matrix.config}} --args="is_debug=true" - if: matrix.config != 'Release' - - - name: Generate build files - run: gn gen out/${{matrix.config}} --args="is_debug=false" - if: matrix.config == 'Release' - - - name: Build the loader - run: ninja -C out/${{matrix.config}} + vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture x86_64' + vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture arm64' + + chromium: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: scripts/gn/gn.py + + mingw: + runs-on: windows-2022 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.8' + - uses: lukka/get-cmake@latest + - 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 -? + - run: | + cmake -S. -B build \ + -D UPDATE_DEPS=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_WERROR=ON \ + -G Ninja + - run: cmake --build build + - run: cmake --install build --prefix /tmp + + mingw-no-asm: + runs-on: windows-2022 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.8' + - uses: lukka/get-cmake@latest + # Make sure this doesn't fail even without explicitly setting '-D USE_MASM=OFF' and without uasm + - run: | + cmake -S. -B build \ + -D UPDATE_DEPS=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_WERROR=ON \ + -G Ninja + - run: cmake --build build + - run: cmake --install build --prefix /tmp + + mingw-no-asm-explicit: + runs-on: windows-2022 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + - uses: lukka/get-cmake@latest + - run: | + cmake -S. -B build \ + -D UPDATE_DEPS=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_WERROR=ON \ + -D USE_MASM=OFF \ + -G Ninja + - run: cmake --build build + - run: cmake --install build --prefix /tmp diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000000000000000000000000000000000..c4a12a4b89095e2df8458bdea58970b27e93bac2 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,101 @@ +# Copyright 2023 Google LLC +# +# 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: Joyce Brum + +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '26 7 * * 1' + +permissions: {} + +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: 'ubuntu-latest' + timeout-minutes: 360 + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp', 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually + - name: Autobuild + if: matrix.language == 'python' + uses: github/codeql-action/autobuild@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 + + - uses: actions/setup-python@v5 + if: matrix.language == 'cpp' + with: + python-version: '3.7' + - uses: lukka/get-cmake@latest + if: matrix.language == 'cpp' + with: + cmakeVersion: 3.17.2 + - name: Install Dependencies + if: matrix.language == 'cpp' + run: | + sudo apt update + sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev + + - name: Generate build files + if: matrix.language == 'cpp' + run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON + env: + CC: gcc + CXX: g++ + + - name: Build the loader + if: matrix.language == 'cpp' + run: cmake --build build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 + with: + category: "/language:${{matrix.language}}" diff --git a/loader/generated/loader_generated_header_version.cmake b/.github/workflows/format.yml similarity index 48% rename from loader/generated/loader_generated_header_version.cmake rename to .github/workflows/format.yml index 897103b8d33d85a79e1a09c957f698c4b5297505..4e7a2e087c93c23e654646a0f39a7b06e4082bb4 100644 --- a/loader/generated/loader_generated_header_version.cmake +++ b/.github/workflows/format.yml @@ -1,12 +1,5 @@ -# *** THIS FILE IS GENERATED - DO NOT EDIT *** -# See loader_versioning_generator.py for modifications - -############################################################################ -# -# Copyright (c) 2021 The Khronos Group Inc. -# Copyright (c) 2021 Valve Corporation -# Copyright (c) 2021 LunarG, Inc. -# Copyright (c) 2021 Google Inc. +# Copyright (c) 2023 Valve Corporation +# Copyright (c) 2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,10 +12,32 @@ # 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: Charles Giessen -# -############################################################################ -set(LOADER_GENERATED_HEADER_VERSION "1.3.231") +name: format + +on: + push: + pull_request: + branches: + - main + +permissions: + contents: read +jobs: + clang-format: + name: clang-format + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + path: + - 'loader' + - 'tests' + steps: + - uses: actions/checkout@v4 + - name: Run clang-format + uses: jidicula/clang-format-action@v4.11.0 + with: + clang-format-version: '16' + check-path: ${{ matrix.path }} diff --git a/.gitignore b/.gitignore index 1be5828babf126f497834e776dfd7700ca000ed9..69e409b96c09d68833bfb58984a6b68409c9ac0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# By default we install dependencies to the external directory +/external/* + +# Ignore any build directories +*build*/ + CMakeCache.txt CMakeLists.txt.user CMakeFiles/ @@ -5,12 +11,7 @@ cmake_install.cmake Makefile scripts/__pycache__ VKConfig.h -build -build32 -dbuild -external/* -!external/CMakeLists.txt -!external/README.md + *.so *.so.* *.pyc @@ -30,3 +31,16 @@ external/* _out64 out32/* out64/* + +# Chromium build artifacts +.cipd/ +.gn +.gclient +.gclient_entries +.gclient_previous_sync_commits +out/ +third_party/ +buildtools/ +depot_tools/ +testing/ +tools/ diff --git a/.gn b/.gn deleted file mode 100644 index e190259e705f2d60c80c039259277086645fee84..0000000000000000000000000000000000000000 --- a/.gn +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2019 LunarG, Inc. -# -# 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 -# -# https://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. - -buildconfig = "//build/config/BUILDCONFIG.gn" -secondary_source = "//build-gn/secondary/" - -default_args = { - clang_use_chrome_plugins = false - use_custom_libcxx = false -} - diff --git a/BUILD.gn b/BUILD.gn index 43d0c130c16278f0b9415cc2d11e175fd40aaec3..737677fc60dc5baf18ffa95eca524c9996a147f8 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,4 +1,6 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (C) 2018-2019 The ANGLE Project Authors. +# Copyright (C) 2019-2023 LunarG, Inc. +# Copyright (c) 2023-2024 Huawei Device Co., Ltd. # 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 @@ -18,14 +20,10 @@ import("//build/ohos.gni") ## Build libvulkan.so {{{ config("vulkan_internal_config") { - defines = [ - "VULKAN_NON_CMAKE_BUILD", - "VK_ENABLE_BETA_EXTENSIONS", - ] + defines = [ "VK_ENABLE_BETA_EXTENSIONS" ] cflags = [ "-Wno-conversion", "-Wno-extra-semi", - "-Wno-implicit-fallthrough", "-Wno-sign-compare", "-Wno-unreachable-code", "-Wno-unused-function", @@ -46,10 +44,7 @@ config("vulkan_loader_config") { "loader", "openharmony", ] - defines = [ - "API_NAME=\"Vulkan\"", - "USE_UNSAFE_FILE_SEARCH=1", - ] + defines = [ "LOADER_USE_UNSAFE_FILE_SEARCH=1" ] } ohos_shared_library("vulkan_loader") { @@ -67,16 +62,18 @@ ohos_shared_library("vulkan_loader") { "loader/generated/vk_layer_dispatch_table.h", "loader/generated/vk_loader_extensions.h", "loader/generated/vk_object_types.h", - "loader/get_environment.c", - "loader/get_environment.h", "loader/gpa_helper.c", "loader/gpa_helper.h", "loader/loader.c", "loader/loader.h", "loader/loader_common.h", + "loader/loader_environment.c", + "loader/loader_environment.h", "loader/log.c", "loader/log.h", "loader/phys_dev_ext.c", + "loader/settings.c", + "loader/settings.h", "loader/stack_allocation.h", "loader/terminator.c", "loader/trampoline.c", diff --git a/BUILD.md b/BUILD.md index c60c7c600caba47a1437b2a7e88a63e36364142f..6915392204626a351825804df2872a9ea3e1f23f 100644 --- a/BUILD.md +++ b/BUILD.md @@ -4,33 +4,58 @@ Instructions for building this repository on Linux, Windows, and MacOS. ## Table Of Contents -- [Contributing to the Repository](#contributing-to-the-repository) -- [Repository Content](#repository-content) - - [Installed Files](#installed-files) -- [Repository Set-Up](#repository-set-up) - - [Display Drivers](#display-drivers) - - [Download the Repository](#download-the-repository) - - [Repository Dependencies](#repository-dependencies) - - [Build and Install Directories](#build-and-install-directories) - - [Building Dependent Repositories with Known-Good Revisions](#building-dependent-repositories-with-known-good-revisions) - - [Generated source code](#generated-source-code) - - [Build Options](#build-options) -- [Building On Windows](#building-on-windows) - - [Windows Development Environment Requirements](#windows-development-environment-requirements) - - [Windows Build - Microsoft Visual Studio](#windows-build---microsoft-visual-studio) - - [Windows Notes](#windows-notes) - - [CMake Visual Studio Generators](#cmake-visual-studio-generators) - - [Using The Vulkan Loader Library in this Repository on Windows](#using-the-vulkan-loader-library-in-this-repository-on-windows) -- [Building On Linux](#building-on-linux) - - [Linux Development Environment Requirements](#linux-development-environment-requirements) - - [Linux Build](#linux-build) -- [Building on MacOS](#building-on-macos) - - [MacOS Development Environment Requirements](#macos-development-environment-requirements) - - [Clone the Repository](#clone-the-repository) - - [MacOS build](#macos-build) -- [Building on Fuchsia](#building-on-fuchsia) -- [Building on QNX](#building-on-qnx) - - [SDK Symbols](#sdk-symbols) +- [Build Instructions](#build-instructions) + - [Table Of Contents](#table-of-contents) + - [Contributing to the Repository](#contributing-to-the-repository) + - [Repository Content](#repository-content) + - [Installed Files](#installed-files) + - [Build Requirements](#build-requirements) + - [Test Requirements](#test-requirements) + - [Repository Set-Up](#repository-set-up) + - [Display Drivers](#display-drivers) + - [Repository Dependencies](#repository-dependencies) + - [Vulkan-Headers](#vulkan-headers) + - [Test Dependencies](#test-dependencies) + - [Build and Install Directory Locations](#build-and-install-directory-locations) + - [Building Dependent Repositories with Known-Good Revisions](#building-dependent-repositories-with-known-good-revisions) + - [Automatically](#automatically) + - [Manually](#manually) + - [Notes About the Manual Option](#notes-about-the-manual-option) + - [Generated source code](#generated-source-code) + - [Build Options](#build-options) + - [Building On Windows](#building-on-windows) + - [Windows Development Environment Requirements](#windows-development-environment-requirements) + - [Windows Build - Microsoft Visual Studio](#windows-build---microsoft-visual-studio) + - [Windows Quick Start](#windows-quick-start) + - [Use `CMake` to Create the Visual Studio Project Files](#use-cmake-to-create-the-visual-studio-project-files) + - [Build the Solution From the Command Line](#build-the-solution-from-the-command-line) + - [Build the Solution With Visual Studio](#build-the-solution-with-visual-studio) + - [Windows Install Target](#windows-install-target) + - [Building On Linux](#building-on-linux) + - [Linux Development Environment Requirements](#linux-development-environment-requirements) + - [Required Package List](#required-package-list) + - [Linux Build](#linux-build) + - [Linux Quick Start](#linux-quick-start) + - [Use CMake to Create the Make Files](#use-cmake-to-create-the-make-files) + - [Build the Project](#build-the-project) + - [Linux Notes](#linux-notes) + - [WSI Support Build Options](#wsi-support-build-options) + - [Linux Install to System Directories](#linux-install-to-system-directories) + - [Linux 32-bit support](#linux-32-bit-support) + - [Building on MacOS](#building-on-macos) + - [MacOS Development Environment Requirements](#macos-development-environment-requirements) + - [Clone the Repository](#clone-the-repository) + - [MacOS build](#macos-build) + - [Building with the Unix Makefiles Generator](#building-with-the-unix-makefiles-generator) + - [Building with the Xcode Generator](#building-with-the-xcode-generator) + - [Building on Fuchsia](#building-on-fuchsia) + - [SDK Symbols](#sdk-symbols) + - [Building on QNX](#building-on-qnx) + - [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) + - [Link Time Optimization](#link-time-optimization) + - [Tests](#tests) ## Contributing to the Repository @@ -53,8 +78,15 @@ indicated by *install_dir*: - *install_dir*`/lib` : The Vulkan loader library - *install_dir*`/bin` : The Vulkan loader library DLL (Windows) -The `uninstall` target can be used to remove the above files from the install -directory. +## Build Requirements + +1. `C99` capable compiler +2. `CMake` version 3.17.2 or greater +3. `Git` + +### Test Requirements + +1. `C++17` capable compiler ## Repository Set-Up @@ -64,20 +96,14 @@ This repository does not contain a Vulkan-capable driver. You will need to obtain and install a Vulkan driver from your graphics hardware vendor or from some other suitable source if you intend to run Vulkan applications. -### Download the Repository - -To create your local git repository: - - git clone https://github.com/KhronosGroup/Vulkan-Loader.git ### Repository Dependencies This repository attempts to resolve some of its dependencies by using components found from the following places, in this order: -1. CMake or Environment variable overrides (e.g., -DVULKAN_HEADERS_INSTALL_DIR) -1. LunarG Vulkan SDK, located by the `VULKAN_SDK` environment variable -1. System-installed packages, mostly applicable on Linux +1. CMake or Environment variable overrides (e.g., -D VULKAN_HEADERS_INSTALL_DIR) +2. System-installed packages, mostly applicable on Linux Dependencies that cannot be resolved by the SDK or installed packages must be resolved with the "install directory" override and are listed below. The @@ -87,24 +113,31 @@ version of that dependency. #### Vulkan-Headers This repository has a required dependency on the [Vulkan Headers repository](https://github.com/KhronosGroup/Vulkan-Headers). -You must clone the headers repository and build its `install` target before -building this repository. The Vulkan-Headers repository is required because it -contains the Vulkan API definition files (registry) that are required to build -the loader. You must also take note of the headers install directory and pass -it on the CMake command line for building this repository, as described below. +The Vulkan-Headers repository contains the Vulkan API definition files that are +required to build the loader. #### Test Dependencies The loader tests depend on the [Google Test](https://github.com/google/googletest) library and on Windows platforms depends on the [Microsoft Detours](https://github.com/microsoft/Detours) library. -To build the tests, pass the `-DUPDATE_DEPS=ON` and `-DBUILD_TESTS=ON` options when generating the project: +To build the tests, pass both `-D UPDATE_DEPS=ON` and `-D BUILD_TESTS=ON` options when generating the project: ```bash -cmake ... -DUPDATE_DEPS=ON -DBUILD_TESTS=ON ... +cmake ... -D UPDATE_DEPS=ON -D BUILD_TESTS=ON ... ``` This will ensure googletest and detours is downloaded and the appropriate version is used. -### Build and Install Directories +### Warnings as errors off by default! + +By default `BUILD_WERROR` is `OFF`. The idiom for open source projects is to NOT enable warnings as errors. + +System/language package managers have to build on multiple different platforms and compilers. + +By defaulting to `ON` we cause issues for package managers since there is no standard way to disable warnings. + +Add `-D BUILD_WERROR=ON` to your workflow + +### Build and Install Directory Locations A common convention is to place the `build` directory in the top directory of the repository and place the `install` directory as a child of the `build` @@ -115,11 +148,11 @@ although you can place these directories in any location. There is a Python utility script, `scripts/update_deps.py`, that you can use to gather and build the dependent repositories mentioned above. -This program also uses information stored in the `scripts/known-good.json` file +This program uses information stored in the `scripts/known-good.json` file 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 manually or automatically. +You can choose to do this automatically or manually. The first step to either is cloning the Vulkan-Loader repo and stepping into that newly cloned folder: @@ -128,6 +161,16 @@ that newly cloned folder: cd Vulkan-Loader ``` +#### Automatically + +On the other hand, if you choose to let the CMake scripts do all the +heavy-lifting, you may just trigger the following CMake commands: + +``` + cmake -S . -B build -D UPDATE_DEPS=On + cmake --build build +``` + #### Manually To manually update the dependencies you now must create the build folder, and @@ -136,7 +179,7 @@ run the update deps script followed by the necessary CMake build commands: ``` mkdir build cd build - ../scripts/update_deps.py + python ../scripts/update_deps.py cmake -C helper.cmake .. cmake --build . ``` @@ -146,22 +189,16 @@ run the update deps script followed by the necessary CMake build commands: - You may need to adjust some of the CMake options based on your platform. See the platform-specific sections later in this document. - The `update_deps.py` script fetches and builds the dependent repositories in - the current directory when it is invoked. In this case, they are built in - the `build` directory. -- The `build` directory is also being used to build this - (Vulkan-ValidationLayers) repository. But there shouldn't be any conflicts - inside the `build` directory between the dependent repositories and the - build files for this repository. + the current directory when it is invoked. - The `--dir` option for `update_deps.py` can be used to relocate the dependent repositories to another arbitrary directory using an absolute or relative path. - The `update_deps.py` script generates a file named `helper.cmake` and places - it in the same directory as the dependent repositories (`build` in this - case). This file contains CMake commands to set the CMake `*_INSTALL_DIR` - variables that are used to point to the install artifacts of the dependent - repositories. You can use this file with the `cmake -C` option to set these - variables when you generate your build files with CMake. This lets you avoid - entering several `*_INSTALL_DIR` variable settings on the CMake command line. + it in the same directory as the dependent repositories. + This file contains CMake commands to set the CMake `*_INSTALL_DIR` variables + that are used to point to the install artifacts of the dependent repositories. + The `-C helper.cmake` option is used to set these variables when you generate + the build files. - If using "MINGW" (Git For Windows), you may wish to run `winpty update_deps.py` in order to avoid buffering all of the script's "print" output until the end and to retain the ability to interrupt script @@ -169,69 +206,56 @@ run the update deps script followed by the necessary CMake build commands: - Please use `update_deps.py --help` to list additional options and read the internal documentation in `update_deps.py` for further information. - -#### Automatically - -On the other hand, if you choose to let the CMake scripts do all the -heavy-lifting, you may just trigger the following CMake commands: - -``` - cmake -S. -Bbuild -DUPDATE_DEPS=On - cmake --build build -``` - -##### Notes About the Automatic Option - -- You may need to adjust some of the CMake options based on your platform. See - the platform-specific sections later in this document. -- The `build` directory is also being used to build this - (Vulkan-ValidationLayers) repository. But there shouldn't be any conflicts - inside the `build` directory between the dependent repositories and the - build files for this repository. - - ### Generated source code This repository contains generated source code in the `loader/generated` -directory which is not intended to be modified directly. Instead, changes should be -made to the corresponding generator in the `scripts` directory. The source files can -then be regenerated using `scripts/generate_source.py`: +directory which is not intended to be modified directly. +Instead, changes should be made to the corresponding generator in the `scripts` directory. +The source files can then be regenerated using `scripts/generate_source.py`. - python3 scripts/generate_source.py PATH_TO_VULKAN_HEADERS_REGISTRY_DIR +Run `python scripts/generate_source.py --help` to see how to invoke it. -A helper CMake target `VulkanLoader_generated_source` is also provided to simplify -the invocation of `scripts/generate_source.py` from the build directory: +A helper CMake target `loader_codegen` is also provided to simplify the invocation of `scripts/generate_source.py`. - cmake --build . --target VulkanLoader_generated_source +Note: By default this helper target is disabled. To enable it, add `-D LOADER_CODEGEN=ON` +to CMake, as shown below. + +``` +cmake -S . -B build -D LOADER_CODEGEN=ON +cmake --build . --target loader_codegen +``` ### Build Options -When generating native platform build files through CMake, several options can -be specified to customize the build. Some of the options are binary on/off -options, while others take a string as input. The following is a table of all -on/off options currently supported by this repository: - -| Option | Platform | Default | Description | -| ---------------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 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. | -| 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_CCACHE | Linux | `OFF` | Enable caching with the CCache program. | -| 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 | -| BUILD_STATIC_LOADER | macOS | `OFF` | This allows the loader to be built as a static library on macOS. Not tested, use at your own risk. | +When generating build files through CMake, several options can be specified to +customize the build. +The following is a table of all on/off options currently supported by this repository: + +| Option | Platform | Default | Description | +| ------------------------------- | ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 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. | +| 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 | +| LOADER_ENABLE_ADDRESS_SANITIZER | Linux & macOS | `OFF` | Enables Address Sanitizer in the loader and tests. | +| LOADER_ENABLE_THREAD_SANITIZER | Linux & macOS | `OFF` | Enables Thread Sanitizer in the loader and tests. | +| LOADER_USE_UNSAFE_FILE_SEARCH | All | `OFF` | Disables security policies that prevent unsecure locations from being used when running with elevated permissions. | +| LOADER_CODEGEN | All | `OFF` | Creates a helper CMake target to generate code. | + +NOTE: `LOADER_USE_UNSAFE_FILE_SEARCH` should NOT be enabled except in very specific contexts (like isolated test environments)! + The following is a table of all string options currently supported by this repository: -| Option | Platform | Default | Description | -| --------------------------- | ----------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -| CMAKE_OSX_DEPLOYMENT_TARGET | MacOS | `10.12` | The minimum version of MacOS for loader deployment. | -| FALLBACK_CONFIG_DIRS | Linux/MacOS | `/etc/xdg` | Configuration path(s) to use instead of `XDG_CONFIG_DIRS` if that environment variable is unavailable. The default setting is freedesktop compliant. | -| FALLBACK_DATA_DIRS | Linux/MacOS | `/usr/local/share:/usr/share` | Configuration path(s) to use instead of `XDG_DATA_DIRS` if that environment variable is unavailable. The default setting is freedesktop compliant. | -| BUILD_DLL_VERSIONINFO | Windows | `""` (empty string) | Allows setting the Windows specific version information for the Loader DLL. Format is "major.minor.patch.build". | +| Option | Platform | Default | Description | +| --------------------- | ----------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| FALLBACK_CONFIG_DIRS | Linux/MacOS | `/etc/xdg` | Configuration path(s) to use instead of `XDG_CONFIG_DIRS` if that environment variable is unavailable. The default setting is freedesktop compliant. | +| FALLBACK_DATA_DIRS | Linux/MacOS | `/usr/local/share:/usr/share` | Configuration path(s) to use instead of `XDG_DATA_DIRS` if that environment variable is unavailable. The default setting is freedesktop compliant. | +| BUILD_DLL_VERSIONINFO | Windows | `""` (empty string) | Allows setting the Windows specific version information for the Loader DLL. Format is "major.minor.patch.build". | These variables should be set using the `-D` option when invoking CMake to generate the native platform files. @@ -243,12 +267,11 @@ These variables should be set using the `-D` option when invoking CMake to gener - Any Personal Computer version supported by Microsoft - Microsoft [Visual Studio](https://www.visualstudio.com/) - Versions - - [2015](https://www.visualstudio.com/vs/older-downloads/) - - [2017](https://www.visualstudio.com/vs/older-downloads/) - - [2019](https://www.visualstudio.com/vs/downloads/) + - [2022](https://www.visualstudio.com/vs/downloads/) + - [2019](https://www.visualstudio.com/vs/older-downloads/) - The Community Edition of each of the above versions is sufficient, as well as any more capable edition. -- [CMake 3.10.2](https://cmake.org/files/v3.10/cmake-3.10.2-win64-x64.zip) is recommended. +- [CMake 3.17.2](https://cmake.org/files/v3.17/cmake-3.17.2-win64-x64.zip) is recommended. - Use the installer option to add CMake to the system PATH - Git Client Support - [Git for Windows](http://git-scm.com/download/win) is a popular solution @@ -271,7 +294,7 @@ Open a developer command prompt and enter: cd Vulkan-Loader mkdir build cd build - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir .. + cmake -A x64 -D UPDATE_DEPS=ON .. cmake --build . The above commands instruct CMake to find and use the default Visual Studio @@ -279,10 +302,6 @@ installation to generate a Visual Studio solution and projects for the x64 architecture. The second CMake command builds the Debug (default) configuration of the solution. -Note that if you do not wish to use a developer command prompt, you may either -run either `vcvars64.bat` or `vcvars32.bat` to set the required environment -variables. - #### Use `CMake` to Create the Visual Studio Project Files Change your current directory to the top of the cloned repository directory, @@ -291,26 +310,24 @@ create a build directory and generate the Visual Studio project files: cd Vulkan-Loader mkdir build cd build - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir .. + cmake -D UPDATE_DEPS=ON -G "Visual Studio 16 2019" -A x64 .. > Note: The `..` parameter tells `cmake` the location of the top of the > repository. If you place your build directory someplace else, you'll need to -> specify the location of the repository top differently. - -The `-A` option is used to select either the "Win32" or "x64" architecture. +> specify the location of the repository differently. -If a generator for a specific version of Visual Studio is required, you can -specify it for Visual Studio 2015, for example, with: +The `-G` option is used to select the generator - 64-bit: -G "Visual Studio 14 2015 Win64" - 32-bit: -G "Visual Studio 14 2015" +Supported Visual Studio generators: +* `Visual Studio 17 2022` +* `Visual Studio 16 2019` -See this [list](#cmake-visual-studio-generators) of other possible generators -for Visual Studio. +The `-A` option is used to select either the "Win32", "x64", or "ARM64 architecture. When generating the project files, the absolute path to a Vulkan-Headers -install directory must be provided. This can be done by setting the -`VULKAN_HEADERS_INSTALL_DIR` environment variable or by setting the +install directory must be provided. This can be done automatically by the +`-D UPDATE_DEPS=ON` option, by directly setting the +`VULKAN_HEADERS_INSTALL_DIR` environment variable, or by setting the `VULKAN_HEADERS_INSTALL_DIR` CMake variable with the `-D` CMake option. In either case, the variable should point to the installation directory of a Vulkan-Headers repository built with the install target. @@ -347,8 +364,8 @@ the primary build artifacts to a specific location using a "bin, include, lib" style directory structure. This may be useful for collecting the artifacts and providing them to another project that is dependent on them. -The default location is `$CMAKE_BINARY_DIR\install`, but can be changed with -the `CMAKE_INSTALL_PREFIX` variable when first generating the project build +The default location is `$CMAKE_CURRENT_BINARY_DIR\install`, but can be changed +with the `CMAKE_INSTALL_PREFIX` variable when first generating the project build files with CMake. You can build the install target from the command line with: @@ -357,81 +374,15 @@ You can build the install target from the command line with: or build the `INSTALL` target from the Visual Studio solution explorer. -### Windows Tests - -The Vulkan-Loader repository contains some simple unit tests for the loader -but no other test clients. - -To run the loader test script, open a Powershell Console, change to the -`build\tests` directory, and run: - -For Release builds: - - .\run_all_tests.ps1 - -For Debug builds: - - .\run_all_tests.ps1 -Debug - -This script will run the following tests: - -- `vk_loader_validation_tests`: - Vulkan loader handle wrapping, allocation callback, and loader/layer interface tests - -You can also change to either `build\tests\Debug` or `build\tests\Release` -(depending on which one you built) and run the executable tests (`*.exe`) -files from there. - -### Windows Notes - -#### CMake Visual Studio Generators - -The chosen generator should match one of the Visual Studio versions that you -have installed. Generator strings that correspond to versions of Visual Studio -include: - -| Build Platform | 64-bit Generator | 32-bit Generator | -| ---------------------------- | ----------------------------- | ----------------------- | -| Microsoft Visual Studio 2015 | "Visual Studio 14 2015 Win64" | "Visual Studio 14 2015" | -| Microsoft Visual Studio 2017 | "Visual Studio 15 2017 Win64" | "Visual Studio 15 2017" | -| Microsoft Visual Studio 2019 | "Visual Studio 16 2019" | "Visual Studio 16 2019" | - -Note that with Visual Studio 2019, the architecture will need to be specified with the `-A` -flag for 64-bit builds. - -#### Using The Vulkan Loader Library in this Repository on Windows - -Vulkan programs must be able to find and use the Vulkan loader -(`vulkan-1.dll`) library as well as any other libraries the program requires. -One convenient way to do this is to copy the required libraries into the same -directory as the program. The projects in this solution copy the Vulkan loader -library and the "googletest" libraries to the `build\tests\Debug` or the -`build\tests\Release` directory, which is where the -`vk_loader_validation_test.exe` executable is found, depending on what -configuration you built. (The loader validation tests use the "googletest" -testing framework.) - -Other techniques include placing the library in a system folder -(C:\Windows\System32) or in a directory that appears in the `PATH` environment -variable. - -See the `LoaderAndLayerInterface` document in the `loader` folder in this -repository for more information on how the loader finds driver libraries and -layer libraries. The document also describes both how ICDs and layers should -be packaged, and how developers can point to ICDs and layers within their -builds. - ## Building On Linux ### Linux Development Environment Requirements This repository has been built and tested on the two most recent Ubuntu LTS -versions. Currently, the oldest supported version is Ubuntu 16.04, meaning -that the minimum officially supported C++11 compiler version is GCC 5.4.0, -although earlier versions may work. It should be straightforward to adapt this -repository to other Linux distributions. +versions, although earlier versions may work. +It is be straightforward to adapt this repository to other Linux distributions. -[CMake 3.10.2](https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz) is recommended. +[CMake 3.17.2](https://cmake.org/files/v3.17/cmake-3.17.2-Linux-x86_64.tar.gz) is recommended. #### Required Package List @@ -448,7 +399,7 @@ CMake with the `--build` option or `make` to build from the command line. cd Vulkan-Loader mkdir build cd build - cmake -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir .. + cmake -D UPDATE_DEPS=ON .. make See below for the details. @@ -461,21 +412,22 @@ create a build directory and generate the make files. cd Vulkan-Loader mkdir build cd build - cmake -DCMAKE_BUILD_TYPE=Debug \ - -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ - -DCMAKE_INSTALL_PREFIX=install .. + cmake -D CMAKE_BUILD_TYPE=Debug \ + -D VULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ + -D CMAKE_INSTALL_PREFIX=install .. > Note: The `..` parameter tells `cmake` the location of the top of the > repository. If you place your `build` directory someplace else, you'll need > to specify the location of the repository top differently. -Use `-DCMAKE_BUILD_TYPE` to specify a Debug or Release build. +Use `-D CMAKE_BUILD_TYPE` to specify a Debug or Release build. When generating the project files, the absolute path to a Vulkan-Headers -install directory must be provided. This can be done by setting the -`VULKAN_HEADERS_INSTALL_DIR` environment variable or by setting the -`VULKAN_HEADERS_INSTALL_DIR` CMake variable with the `-D` CMake option. In -either case, the variable should point to the installation directory of a +install directory must be provided. This can be done automatically by the +`-D UPDATE_DEPS=ON` option, by directly setting the `VULKAN_HEADERS_INSTALL_DIR` +environment variable, or by setting the `VULKAN_HEADERS_INSTALL_DIR` CMake +variable with the `-D` CMake option. +In either case, the variable should point to the installation directory of a Vulkan-Headers repository built with the install target. > Note: For Linux, the default value for `CMAKE_INSTALL_PREFIX` is @@ -496,25 +448,8 @@ You can also use cmake --build . -If your build system supports ccache, you can enable that via CMake option -`-DUSE_CCACHE=On` - ### Linux Notes -#### Using The Vulkan Loader Library in this Repository on Linux - -The `vk_loader_validation_tests` executable is linked with an RPATH setting to -allow it to find the Vulkan loader library in the repository's build -directory. This allows the test executable to run and find this Vulkan loader -library without installing the loader library to a directory searched by the -system loader or in the `LD_LIBRARY_PATH`. - -If you want to test a Vulkan application that is not built within this -repository with the loader you just built from this repository, you can direct -the application to load it from your build directory: - - export LD_LIBRARY_PATH=/build/loader - #### WSI Support Build Options By default, the Vulkan Loader is built with support for the Vulkan-defined WSI @@ -550,7 +485,7 @@ CMake variables to override their defaults. For example, if you would like to install to `/tmp/build` instead of `/usr/local`, on your CMake command line specify: - -DCMAKE_INSTALL_PREFIX=/tmp/build + -D CMAKE_INSTALL_PREFIX=/tmp/build Then run `make install` as before. The install step places the files in `/tmp/build`. This may be useful for collecting the artifacts and providing @@ -573,76 +508,43 @@ variables `CMAKE_INSTALL_SYSCONFDIR` to rename the `etc` directory and See the CMake documentation for more details on using these variables to further customize your installation. -Also see the `LoaderAndLayerInterface` document in the `loader` folder in this +Also see the `LoaderInterfaceArchitecture.md` document in the `docs` folder in this repository for more information about loader operation. -Note that some executables in this repository (e.g., -`vk_loader_validation_tests`) use the RPATH linker directive to load the -Vulkan loader from the build directory, `build` in this example. This means -that even after installing the loader to the system directories, these -executables still use the loader from the build directory. - -#### Linux Uninstall - -To uninstall the files from the system directories, you can execute: - - sudo make uninstall - -#### Linux Tests - -The Vulkan-Loader repository contains some simple unit tests for the loader -but no other test clients. - -To run the loader test script, change to the `build/tests` directory, and run: - - ./run_all_tests.sh - -This script will run the following tests: - -- `vk_loader_validation_tests`: Vulkan loader handle wrapping, allocation - callback, and loader/layer interface tests - #### Linux 32-bit support -Usage of this repository's contents in 32-bit Linux environments is not -officially supported. However, since this repository is supported on 32-bit -Windows, these modules should generally work on 32-bit Linux. - -Here are some notes for building 32-bit targets on a 64-bit Ubuntu "reference" -platform: +The loader supports building in 32-bit Linux environments. +However, it is not nearly as straightforward as it is for Windows. +Here are some notes for building this repo as 32-bit on a 64-bit Ubuntu +"reference" platform: If not already installed, install the following 32-bit development libraries: -`gcc-multilib g++-multilib libx11-dev:i386` +`gcc-multilib gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 libwayland-dev:i386 libxrandr-dev:i386` This list may vary depending on your distribution and which windowing systems you are building for. Set up your environment for building 32-bit targets: - export ASFLAGS=--32 export CFLAGS=-m32 export CXXFLAGS=-m32 - export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu + export LDFLAGS=-m32 + export ASFLAGS=--32 + +Your PKG_CONFIG configuration may be different, depending on your distribution. -Again, your PKG_CONFIG configuration may be different, depending on your -distribution. +Finally, build the repository normally as explained above. -Finally, rebuild the repository using `cmake` and `make`, as explained above. +These notes are taken from the Github Actions workflow `linux-32` which is run +regularly as a part of CI. ## Building on MacOS ### MacOS Development Environment Requirements -Tested on OSX version 10.12.6 - Setup Homebrew and components -- Follow instructions on [brew.sh](http://brew.sh) to get Homebrew installed. - - /usr/bin/ruby -e "$(curl -fsSL \ - https://raw.githubusercontent.com/Homebrew/install/master/install)" - - Ensure Homebrew is at the beginning of your PATH: export PATH=/usr/local/bin:$PATH @@ -653,37 +555,29 @@ Setup Homebrew and components ### Clone the Repository -Clone the Vulkan-ValidationLayers repository: +Clone the Vulkan-Loader repository: - git clone https://github.com/KhronosGroup/Vulkan-ValidationLayers.git + git clone https://github.com/KhronosGroup/Vulkan-Loader.git ### MacOS build -[CMake 3.10.2](https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz) is recommended. - -#### CMake Generators - -This repository uses CMake to generate build or project files that are then -used to build the repository. The CMake generators explicitly supported in -this repository are: - -- Unix Makefiles -- Xcode +[CMake 3.17.2](https://cmake.org/files/v3.17/cmake-3.17.2-Darwin-x86_64.tar.gz) is recommended. #### Building with the Unix Makefiles Generator This generator is the default generator. When generating the project files, the absolute path to a Vulkan-Headers -install directory must be provided. This can be done by setting the -`VULKAN_HEADERS_INSTALL_DIR` environment variable or by setting the +install directory must be provided. This can be done automatically by the +`-D UPDATE_DEPS=ON` option, by directly setting the +`VULKAN_HEADERS_INSTALL_DIR` environment variable, or by setting the `VULKAN_HEADERS_INSTALL_DIR` CMake variable with the `-D` CMake option. In either case, the variable should point to the installation directory of a Vulkan-Headers repository built with the install target. mkdir build cd build - cmake -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir -DCMAKE_BUILD_TYPE=Debug .. + cmake -D UPDATE_DEPS=ON -D VULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir -D CMAKE_BUILD_TYPE=Debug .. make To speed up the build on a multi-core machine, use the `-j` option for `make` @@ -703,44 +597,59 @@ To create and open an Xcode project: Within Xcode, you can select Debug or Release builds in the project's Build Settings. -### Using the new macOS loader +## Building on Fuchsia -If you want to test a Vulkan application with the loader you just built, you -can direct the application to load it from your build directory: +Fuchsia uses the project's GN build system to integrate with the Fuchsia platform build. - export DYLD_LIBRARY_PATH=/build/loader +### SDK Symbols -### MacOS Tests +The Vulkan Loader is a component of the Fuchsia SDK, so it must explicitly declare its exported symbols in +the file vulkan.symbols.api; see [SDK](https://fuchsia.dev/fuchsia-src/development/sdk). -The Vulkan-Loader repository contains some simple unit tests for the loader -but no other test clients. +## Building on QNX -Before you run these tests, you will need to clone and build the -[MoltenVK](https://github.com/KhronosGroup/MoltenVK) repository. +QNX is using its own build system. The proper build environment must be set +under the QNX host development system (Linux, Win64, MacOS) by invoking +the shell/batch script provided with QNX installation. -You will also need to direct your new loader to the MoltenVK ICD: +Then change working directory to the "scripts/qnx" in this project and type "make". +It will build the ICD loader for all CPU targets supported by QNX. - export VK_DRIVER_FILES=/Package/Latest/MoltenVK/macOS/MoltenVK_icd.json +## Cross Compilation -To run the loader test script, change to the `build/tests` directory in your -Vulkan-Loader repository, and run: +While this repo is capable of cross compilation, there are a handful of caveats. - ./vk_loader_validation_tests +### Unknown function handling which requires explicit assembly implementations -## Building on Fuchsia +Unknown function handling is only fully supported on select platforms due to the +need for assembly in the implementation. +Platforms not fully supported will have assembly disabled automatically, or +can be manually disabled by setting `USE_GAS` or `USE_MASM` to `OFF`. -Fuchsia uses the project's GN build system to integrate with the Fuchsia platform build. +#### Platforms which fully support unknown function handling -## Building on QNX +* 64 bit Windows (x64) +* 32 bit Windows (x86) +* 64 bit Linux (x64) +* 32 bit Linux (x86) +* 64 bit Arm (aarch64) -QNX is using its own build system. The proper build environment must be set -under the QNX host development system (Linux, Win64, MacOS) by invoking -the shell/batch script provided with QNX installation. +Platforms not listed will use a fallback C Code path that relies on tail-call optimization to work. +No guarantees are made about the use of the fallback code paths. -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. +### Link Time Optimization -### SDK Symbols +When cross compiling, the use of Link Time Optimization (LTO) and unknown function handling +is not supported. Either LTO needs to be turned off, or the assembly should be disabled. -The Vulkan Loader is a component of the Fuchsia SDK, so it must explicitly declare its exported symbols in -the file vulkan.symbols.api; see [SDK](https://fuchsia.dev/fuchsia-src/development/sdk). +## Tests + +To build tests, make sure that the `BUILD_TESTS` option is set to true. Using +the command line, this looks like `-D BUILD_TESTS=ON`. + +This project is configured to run with `ctest`, which makes it easy to run the +tests. To run the tests, change the directory to that of the build direction, and +execute `ctest`. + +More details can be found in the [README.md](./tests/README.md) for the tests +directory of this project. diff --git a/CMakeLists.txt b/CMakeLists.txt index 020b50fd758472b5115bf0061a9e37ec65860f13..3812871ff17656c62412caf8f82794580375e6d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ # ~~~ -# Copyright (c) 2014-2022 Valve Corporation -# Copyright (c) 2014-2022 LunarG, Inc. +# 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. @@ -14,89 +16,27 @@ # See the License for the specific language governing permissions and # limitations under the License. # ~~~ +cmake_minimum_required(VERSION 3.17.2) -cmake_minimum_required(VERSION 3.10.2) +project(VULKAN_LOADER VERSION 1.3.275 LANGUAGES C) -# Apple: Must be set before enable_language() or project() as it may influence configuration of the toolchain and flags. -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version") +# This variable enables downstream users to customize the target API +# variant (e.g. Vulkan SC) +set(API_TYPE "vulkan") -# If we are building in Visual Studio 2015 and with a CMake version 3.19 or greater, we need to set this variable -# so that CMake will choose a Windows SDK version higher than 10.0.14393.0, as dxgi1_6.h is only found in Windows SDK -# 10.0.17763 and higher. -set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM OFF) +add_subdirectory(scripts) -project(Vulkan-Loader) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) +set(CMAKE_C_VISIBILITY_PRESET "hidden") +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -if (UPDATE_DEPS) - find_package(PythonInterp 3 REQUIRED) - - if (CMAKE_GENERATOR_PLATFORM) - set(_target_arch ${CMAKE_GENERATOR_PLATFORM}) - else() - if (MSVC_IDE) - message(WARNING "CMAKE_GENERATOR_PLATFORM not set. Using x64 as target architecture.") - endif() - set(_target_arch x64) - endif() - - if (NOT CMAKE_BUILD_TYPE) - message(WARNING "CMAKE_BUILD_TYPE not set. Using Debug for dependency build type") - set(_build_type Debug) - else() - set(_build_type ${CMAKE_BUILD_TYPE}) - endif() - - set(_build_tests_arg "") - if (NOT BUILD_TESTS) - set(_build_tests_arg "--optional=tests") - endif() - - message("********************************************************************************") - message("* NOTE: Adding target vl_update_deps to run as needed for updating *") - message("* dependencies. *") - message("********************************************************************************") - - # Add a target so that update_deps.py will run when necessary - # NOTE: This is triggered off of the timestamps of known_good.json and helper.cmake - add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/external/helper.cmake - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/scripts/update_deps.py --dir ${CMAKE_CURRENT_LIST_DIR}/external --arch ${_target_arch} --config ${_build_type} --generator "${CMAKE_GENERATOR}" ${_build_tests_arg} - DEPENDS ${CMAKE_CURRENT_LIST_DIR}/scripts/known_good.json) - - add_custom_target(vl_update_deps DEPENDS ${CMAKE_CURRENT_LIST_DIR}/external/helper.cmake) - - # Check if update_deps.py needs to be run on first cmake run - if (${CMAKE_CURRENT_LIST_DIR}/scripts/known_good.json IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/external/helper.cmake) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/scripts/update_deps.py --dir ${CMAKE_CURRENT_LIST_DIR}/external --arch ${_target_arch} --config ${_build_type} --generator "${CMAKE_GENERATOR}" ${_build_tests_arg} - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - RESULT_VARIABLE _update_deps_result - ) - if (NOT (${_update_deps_result} EQUAL 0)) - message(FATAL_ERROR "Could not run update_deps.py which is necessary to download dependencies.") - endif() - endif() - include(${CMAKE_CURRENT_LIST_DIR}/external/helper.cmake) -else() - message("********************************************************************************") - message("* NOTE: Not adding target to run update_deps.py automatically. *") - message("********************************************************************************") - find_package(PythonInterp 3 QUIET) -endif() - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -find_package(PythonInterp 3 QUIET) - -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) - -option(BUILD_TESTS "Build Tests" OFF) - -if(BUILD_TESTS) - enable_testing() -endif() - -if(APPLE) - option(BUILD_STATIC_LOADER "Build a loader that can be statically linked" OFF) +# By default, loader & tests are built without sanitizers +# Use these options to force a specific sanitizer on the loader and test executables +if (UNIX) + option(LOADER_ENABLE_ADDRESS_SANITIZER "Linux & macOS only: Advanced memory checking" OFF) + option(LOADER_ENABLE_THREAD_SANITIZER "Linux & macOS only: Advanced thread checking" OFF) endif() if(WIN32) @@ -105,51 +45,10 @@ if(WIN32) set(BUILD_DLL_VERSIONINFO "" CACHE STRING "Set the version to be used in the loader.rc file. Default value is the currently generated header version") endif() -if(BUILD_STATIC_LOADER) - message(WARNING "The BUILD_STATIC_LOADER option has been set. Note that this will only work on MacOS and is not supported " - "or tested as part of the loader. Use it at your own risk.") -endif() - -if (TARGET Vulkan::Headers) - message(STATUS "Using Vulkan headers from Vulkan::Headers target") - get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) - get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) -else() - find_package(VulkanHeaders) - if(NOT ${VulkanHeaders_FOUND}) - message(FATAL_ERROR "Could not find Vulkan headers path. This can be fixed by setting VULKAN_HEADERS_INSTALL_DIR to an " - "installation of the Vulkan-Headers repository.") - endif() - if(NOT ${VulkanRegistry_FOUND}) - message(FATAL_ERROR "Could not find Vulkan registry path. This can be fixed by setting VULKAN_HEADERS_INSTALL_DIR to an " - "installation of the Vulkan-Headers repository.") - endif() - - # set up the Vulkan::Headers target for consistency - add_library(vulkan-headers INTERFACE) - target_include_directories(vulkan-headers SYSTEM INTERFACE "${VulkanHeaders_INCLUDE_DIRS}") - add_library(Vulkan::Headers ALIAS vulkan-headers) -endif() - -option(USE_CCACHE "Use ccache" OFF) -if(USE_CCACHE) - find_program(CCACHE_FOUND ccache) - if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - endif() -endif() +find_package(VulkanHeaders CONFIG QUIET) include(GNUInstallDirs) -if(UNIX AND NOT APPLE) # i.e.: Linux - include(FindPkgConfig) -endif() - -if(APPLE) - # CMake versions 3 or later need CMAKE_MACOSX_RPATH defined. This avoids the CMP0042 policy message. - set(CMAKE_MACOSX_RPATH 1) -endif() - set(GIT_BRANCH_NAME "--unknown--") set(GIT_TAG_INFO "--unknown--") find_package (Git) @@ -172,11 +71,6 @@ if (GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git/HEAD") endif() endif() -if(WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - # Windows: if install locations not set by user, set install prefix to "\install". - set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE) -endif() - # Enable IDE GUI folders. "Helper targets" that don't have interesting source code should set their FOLDER property to this set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(LOADER_HELPER_FOLDER "Helper Targets") @@ -190,145 +84,104 @@ if(UNIX) "System-wide search directory. If not set or empty, CMAKE_INSTALL_FULL_SYSCONFDIR and /etc are used.") endif() -# Because we use CMake 3.10.2, we can't use the policy which would disable adding /W3 by default. In the interim, replace the flags -# When this project is updated to 3.15 and above, use the following line. -# cmake_policy(SET CMP0092 NEW) -string(REGEX REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -string(REGEX REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - -# For MSVC/Windows, replace /GR with an empty string, this prevents warnings of /GR being overriden by /GR- -# Newer CMake versions (3.20) have better solutions for this through policy - using the old -# way while waiting for when updating can occur -string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - -if(UNIX AND NOT APPLE) # i.e.: Linux - option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) - option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) - option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON) - option(BUILD_WSI_DIRECTFB_SUPPORT "Build DirectFB WSI support" OFF) - option(BUILD_WSI_SCREEN_QNX_SUPPORT "Build QNX Screen WSI support" OFF) - - if(BUILD_WSI_XCB_SUPPORT) - find_package(XCB REQUIRED) - include_directories(SYSTEM ${XCB_INCLUDE_DIR}) - endif() - - if(BUILD_WSI_XLIB_SUPPORT) - find_package(X11 REQUIRED) - endif() - - if(BUILD_WSI_DIRECTFB_SUPPORT) - find_package(DirectFB REQUIRED) - include_directories(SYSTEM ${DIRECTFB_INCLUDE_DIR}) - endif() - - if(BUILD_WSI_SCREEN_QNX_SUPPORT) - # Part of OS, no additional include directories are required - endif() -endif() - if(WIN32) option(ENABLE_WIN10_ONECORE "Link the loader with OneCore umbrella libraries" OFF) endif() -add_library(platform_wsi_defines INTERFACE) +add_library(platform_wsi INTERFACE) if(WIN32) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_WIN32_KHR) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_WIN32_KHR) elseif(ANDROID) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_ANDROID_KHR) + message(FATAL_ERROR "Android build not supported!") elseif(APPLE) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_MACOS_MVK VK_USE_PLATFORM_METAL_EXT) -elseif(UNIX AND NOT APPLE) # i.e.: Linux + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_METAL_EXT) + if (IOS) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_IOS_MVK) + endif() + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK) + endif() +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) + option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON) + option(BUILD_WSI_DIRECTFB_SUPPORT "Build DirectFB WSI support" OFF) + + find_package(PkgConfig REQUIRED QUIET) # Use PkgConfig to find Linux system libraries + if(BUILD_WSI_XCB_SUPPORT) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_XCB_KHR) + pkg_check_modules(XCB REQUIRED QUIET IMPORTED_TARGET xcb) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_XCB_KHR) + target_link_libraries(platform_wsi INTERFACE PkgConfig::XCB) endif() if(BUILD_WSI_XLIB_SUPPORT) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_XLIB_KHR VK_USE_PLATFORM_XLIB_XRANDR_EXT) + pkg_check_modules(X11 REQUIRED QUIET IMPORTED_TARGET x11) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_XLIB_KHR VK_USE_PLATFORM_XLIB_XRANDR_EXT) + target_link_libraries(platform_wsi INTERFACE PkgConfig::X11) endif() if(BUILD_WSI_WAYLAND_SUPPORT) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_WAYLAND_KHR) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_WAYLAND_KHR) endif() if(BUILD_WSI_DIRECTFB_SUPPORT) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_DIRECTFB_EXT) - endif() - if(BUILD_WSI_SCREEN_QNX_SUPPORT) - target_compile_definitions(platform_wsi_defines INTERFACE VK_USE_PLATFORM_SCREEN_QNX) - endif() + pkg_check_modules(DirectFB QUIET REQUIRED IMPORTED_TARGET directfb) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_DIRECTFB_EXT) + target_link_libraries(platform_wsi INTERFACE PkgConfig::DirectFB) + endif() +elseif(CMAKE_SYSTEM_NAME MATCHES "QNX") + message(FATAL_ERROR "See BUILD.md for QNX build") +elseif(CMAKE_SYSTEM_NAME MATCHES "Fuchsia") + message(FATAL_ERROR "Fuchsia uses Chromium build. See BUILD.gn") else() message(FATAL_ERROR "Unsupported Platform!") endif() add_library(loader_common_options INTERFACE) -target_compile_definitions(loader_common_options INTERFACE API_NAME="Vulkan") -target_link_libraries(loader_common_options INTERFACE platform_wsi_defines) +target_link_libraries(loader_common_options INTERFACE platform_wsi) # Enable beta Vulkan extensions target_compile_definitions(loader_common_options INTERFACE VK_ENABLE_BETA_EXTENSIONS) -target_compile_features(loader_common_options INTERFACE c_std_99) -target_compile_features(loader_common_options INTERFACE cxx_std_11) -set(LOADER_STANDARD_C_PROPERTIES PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED YES C_EXTENSIONS OFF) -set(LOADER_STANDARD_CXX_PROPERTIES PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS OFF) - -option(ENABLE_WERROR "Enable warnings as errors" ON) +option(BUILD_WERROR "Enable warnings as errors") # Set warnings as errors and the main diagnostic flags # Must be set first so the warning silencing later on works properly # Note that clang-cl.exe should use MSVC flavor flags, not GNU -if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC")) - if (ENABLE_WERROR) +if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) + if (BUILD_WERROR) target_compile_options(loader_common_options INTERFACE /WX) endif() target_compile_options(loader_common_options INTERFACE /W4) -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +elseif(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") # using GCC or Clang with the regular front end - if (ENABLE_WERROR) + if (BUILD_WERROR) target_compile_options(loader_common_options INTERFACE -Werror) endif() target_compile_options(loader_common_options INTERFACE -Wall -Wextra) endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options(loader_common_options INTERFACE -Wno-unused-parameter -Wno-unused-function -Wno-missing-field-initializers) - - # need to prepend /clang: to compiler arguments when using clang-cl - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC") - target_compile_options(loader_common_options INTERFACE /clang:-fno-strict-aliasing /clang:-fno-builtin-memcmp) - else() - target_compile_options(loader_common_options INTERFACE -fno-strict-aliasing -fno-builtin-memcmp) - endif() +if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") + target_compile_options(loader_common_options INTERFACE -Wno-missing-field-initializers) - # For GCC version 7.1 or greater, we need to disable the implicit fallthrough warning since there's no consistent way to satisfy - # all compilers until they all accept the C++17 standard - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_C_COMPILER_ID STREQUAL "GNU") target_compile_options(loader_common_options INTERFACE -Wno-stringop-truncation -Wno-stringop-overflow) - if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 7.1) - target_compile_options(loader_common_options INTERFACE -Wimplicit-fallthrough=0) + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 7.1) + target_compile_options(loader_common_options INTERFACE -Wshadow=local) #only added in GCC 7 endif() endif() - if(UNIX) - target_compile_options(loader_common_options INTERFACE -fvisibility=hidden) - endif() - target_compile_options(loader_common_options INTERFACE -Wpointer-arith) endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC")) +if(CMAKE_C_COMPILER_ID MATCHES "MSVC" OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) + # /sdl: Enable additional security checks # /GR-: Disable RTTI # /guard:cf: Enable control flow guard - # /wd4100: Disable warning on unreferenced formal parameter # /wd4152: Disable warning on conversion of a function pointer to a data pointer # /wd4201: Disable warning on anonymous struct/unions - target_compile_options(loader_common_options INTERFACE /GR- /guard:cf /wd4100 /wd4152 /wd4201) + target_compile_options(loader_common_options INTERFACE /sdl /GR- /guard:cf /wd4152 /wd4201) # Enable control flow guard - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0") - target_link_options(loader_common_options INTERFACE "LINKER:/guard:cf") - else() - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf") - endif() + target_link_options(loader_common_options INTERFACE "LINKER:/guard:cf") # Prevent from polluting the code. guards against things like MIN and MAX target_compile_definitions(loader_common_options INTERFACE WIN32_LEAN_AND_MEAN) @@ -338,34 +191,34 @@ endif() # Add git branch and tag info in debug mode target_compile_definitions(loader_common_options INTERFACE $<$:DEBUG;GIT_BRANCH_NAME="${GIT_BRANCH_NAME}";GIT_TAG_INFO="${GIT_TAG_INFO}">) -# Check for the existance of the secure_getenv or __secure_getenv commands -include(CheckFunctionExists) -include(CheckIncludeFile) +if (NOT (WIN32 OR APPLE)) + # Check for the existance of the secure_getenv or __secure_getenv commands + include(CheckFunctionExists) -check_function_exists(secure_getenv HAVE_SECURE_GETENV) -check_function_exists(__secure_getenv HAVE___SECURE_GETENV) + check_function_exists(secure_getenv HAVE_SECURE_GETENV) + check_function_exists(__secure_getenv HAVE___SECURE_GETENV) -if (HAVE_SECURE_GETENV) - target_compile_definitions(loader_common_options INTERFACE HAVE_SECURE_GETENV) -endif() -if (HAVE___SECURE_GETENV) - target_compile_definitions(loader_common_options INTERFACE HAVE___SECURE_GETENV) -endif() -if(NOT MSVC AND NOT (HAVE_SECURE_GETENV OR HAVE___SECURE_GETENV)) - message(WARNING "Using non-secure environmental lookups. This loader will not properly disable environent variables when run with elevated permissions.") + if (HAVE_SECURE_GETENV) + target_compile_definitions(loader_common_options INTERFACE HAVE_SECURE_GETENV) + endif() + if (HAVE___SECURE_GETENV) + target_compile_definitions(loader_common_options INTERFACE HAVE___SECURE_GETENV) + endif() + if (NOT (HAVE_SECURE_GETENV OR HAVE___SECURE_GETENV)) + message(WARNING "Using non-secure environmental lookups. This loader will not properly disable environent variables when run with elevated permissions.") + endif() endif() -# Optional codegen target -if(PYTHONINTERP_FOUND) - add_custom_target(VulkanLoader_generated_source - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/generate_source.py - ${VulkanRegistry_DIR} --incremental - ) -else() - message("WARNING: VulkanLoader_generated_source target requires python 3") +option(LOADER_CODEGEN "Enable vulkan loader code generation") +if(LOADER_CODEGEN) + find_package(Python3 REQUIRED) + 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 --api ${API_TYPE} + ) endif() - if(UNIX) target_compile_definitions(loader_common_options INTERFACE FALLBACK_CONFIG_DIRS="${FALLBACK_CONFIG_DIRS}" FALLBACK_DATA_DIRS="${FALLBACK_DATA_DIRS}") @@ -382,120 +235,10 @@ if(UNIX) endif() endif() -# uninstall target -if(NOT TARGET uninstall) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE - @ONLY) - add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) - set_target_properties(uninstall PROPERTIES FOLDER ${LOADER_HELPER_FOLDER}) -endif() - add_subdirectory(loader) -if(BUILD_TESTS) - # Set gtest build configuration - # Attempt to enable if it is available. - if(TARGET gtest) - # Already enabled as a target (perhaps by a project enclosing this one) - message(STATUS "Vulkan-Loader/external: " "googletest already configured - using it") - elseif(IS_DIRECTORY "${GOOGLETEST_INSTALL_DIR}/googletest") - set(BUILD_GTEST ON CACHE BOOL "Builds the googletest subproject") - set(BUILD_GMOCK OFF CACHE BOOL "Builds the googlemock subproject") - set(gtest_force_shared_crt ON CACHE BOOL "Link gtest runtimes dynamically" FORCE) - set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") - # The googletest directory exists, so enable it as a target. - message(STATUS "Vulkan-Loader/external: " "googletest found - configuring it for tests") - add_subdirectory("${GOOGLETEST_INSTALL_DIR}") - else() - message(SEND_ERROR "Could not find googletest directory. Be sure to run update_deps.py with the --tests option to download the appropriate version of googletest") - set(BUILD_TESTS OFF) - endif() - if (WIN32) - if(TARGET detours) - # Already enabled as a target (perhaps by a project enclosing this one) - message(STATUS "Vulkan-Loader/external: " "detours already configured - using it") - else() - if(IS_DIRECTORY ${DETOURS_INSTALL_DIR}) - # The detours directory exists, so enable it as a target. - message(STATUS "Vulkan-Loader/external: " "detours found - configuring it for tests") - else() - message(SEND_ERROR "Could not find detours directory. Be sure to run update_deps.py with the --tests option to download the appropriate version of detours") - set(BUILD_TESTS OFF) - endif() - add_library(detours STATIC - ${DETOURS_INSTALL_DIR}/src/creatwth.cpp - ${DETOURS_INSTALL_DIR}/src/detours.cpp - ${DETOURS_INSTALL_DIR}/src/detours.h - ${DETOURS_INSTALL_DIR}/src/detver.h - ${DETOURS_INSTALL_DIR}/src/disasm.cpp - ${DETOURS_INSTALL_DIR}/src/disolarm.cpp - ${DETOURS_INSTALL_DIR}/src/disolarm64.cpp - ${DETOURS_INSTALL_DIR}/src/disolia64.cpp - ${DETOURS_INSTALL_DIR}/src/disolx64.cpp - ${DETOURS_INSTALL_DIR}/src/disolx86.cpp - ${DETOURS_INSTALL_DIR}/src/image.cpp - ${DETOURS_INSTALL_DIR}/src/modules.cpp - ) - target_include_directories(detours PUBLIC ${DETOURS_INSTALL_DIR}/src) - - macro(GET_WIN32_WINNT version) - if(WIN32 AND CMAKE_SYSTEM_VERSION) - set(ver ${CMAKE_SYSTEM_VERSION}) - string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver}) - string(REGEX MATCH "^([0-9]+)" verMajor ${ver}) - # Check for Windows 10, b/c we'll need to convert to hex 'A'. - if("${verMajor}" MATCHES "10") - set(verMajor "A") - string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver}) - endif("${verMajor}" MATCHES "10") - # Remove all remaining '.' characters. - string(REPLACE "." "" ver ${ver}) - # Prepend each digit with a zero. - string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver}) - set(${version} "0x${ver}") - endif() - endmacro() - - set(DETOURS_MAJOR_VERSION "4") - set(DETOURS_MINOR_VERSION "0") - set(DETOURS_PATCH_VERSION "1") - set(DETOURS_VERSION "${DETOURS_MAJOR_VERSION}.${DETOURS_MINOR_VERSION}.${DETOURS_PATCH_VERSION}") - - target_include_directories(detours PUBLIC ${DETOURS_INSTALL_DIR}/src) - - if(MSVC_VERSION GREATER_EQUAL 1700) - target_compile_definitions(detours PUBLIC DETOURS_CL_17_OR_NEWER) - endif(MSVC_VERSION GREATER_EQUAL 1700) - GET_WIN32_WINNT(ver) - if(ver EQUAL 0x0700) - target_compile_definitions(detours PUBLIC _USING_V110_SDK71_ DETOURS_WIN_7) - endif(ver EQUAL 0x0700) - target_compile_definitions(detours PUBLIC "_WIN32_WINNT=${ver}") - - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - target_compile_definitions(detours PUBLIC "DETOURS_TARGET_PROCESSOR=X64" DETOURS_X64 DETOURS_64BIT _AMD64_) - else("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - target_compile_definitions(detours PUBLIC "DETOURS_TARGET_PROCESSOR=X86" DETOURS_X86 _X86_) - endif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - - target_compile_definitions(detours PUBLIC "DETOURS_VERSION=0x4c0c1" WIN32_LEAN_AND_MEAN) - - if(MSVC) - target_compile_definitions(detours PUBLIC "_CRT_SECURE_NO_WARNINGS=1") - set_target_properties(detours PROPERTIES COMPILE_FLAGS /EHsc) - endif() - - # Silence errors found in clang-cl - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC") - target_compile_options(detours PRIVATE -Wno-sizeof-pointer-memaccess -Wno-microsoft-goto -Wno-microsoft-cast) - endif() - endif() - endif() - - if (BUILD_TESTS) - add_subdirectory(tests ${CMAKE_BINARY_DIR}/tests) - endif() - +option(BUILD_TESTS "Build Tests") +if (BUILD_TESTS) + enable_testing() + add_subdirectory(tests) endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6faaf8851e9743ec8d7f692fcb45d62385d931dd..8b826a02a2585638d9f1d04e999f59669fb53492 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,7 @@ current assignee. [submitting a pull request](https://help.github.com/articles/using-pull-requests/). * Please read and adhere to the style and process [guidelines](#coding-conventions-and-formatting) enumerated below. -* Please base your fixes on the master branch. +* Please base your fixes on the `main` branch. SDK branches are generally not updated except for critical fixes needed to repair an SDK release. * Provide one or more tests which show a failure for the issue before your changes @@ -74,7 +74,7 @@ current assignee. clang-format settings which are found and used automatically by clang-format. * **clang-format** binaries are available from the LLVM orginization, here: [LLVM](https://clang.llvm.org/). - Our CI system (Travis-CI) currently uses clang-format version 5.0.0 to + Our CI system currently uses clang-format version 16 to check that the lines of code you have changed are formatted properly. It is recommended that you use the same version to format your code prior to submission. @@ -107,7 +107,7 @@ Please ensure that the repository compiles and passes tests without error for each commit in your pull request. Note that to be accepted into the repository, the pull request must pass all tests on all supported platforms. -The automatic Github Travis and AppVeyor continuous integration features +The automatic Github continuous integration features will assist in enforcing this requirement.* #### Generated Source Code @@ -115,9 +115,8 @@ will assist in enforcing this requirement.* The `loader/generated` directory contains source code that is created by several generator scripts in the `scripts` directory. All changes to these scripts _must_ be submitted with the corresponding generated output to keep the repository self-consistent. This requirement is enforced by both -Travis CI and AppVeyor test configurations. Regenerate source files after modifying any of the generator -scripts and before building and testing your changes. More details can be found in -[BUILD.md](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/BUILD.md#generated-source-code). +GitHub actions. Regenerate source files after modifying any of the generator scripts and before building +and testing your changes. More details can be found in [BUILD.md](BUILD.md#generated-source-code). #### Testing Your Changes @@ -139,21 +138,6 @@ scripts and before building and testing your changes. More details can be found * The indent is 4 spaces. * CMake functions are lower-case. * Variable and keyword names are upper-case. -* The format is defined by - [cmake-format](https://github.com/cheshirekow/cmake_format) - using the `.cmake-format.py` file in the repository to define the settings. - See the cmake-format page for information about its simple markup for comments. -* Disable reformatting of a block of comment lines by inserting - a `# ~~~` comment line before and after that block. -* Disable any formatting of a block of lines by surrounding that block with - `# cmake-format: off` and `# cmake-format: on` comment lines. -* To install: `sudo pip install cmake_format` -* To run: `cmake-format --in-place $FILENAME` -* **IMPORTANT (June 2018)** cmake-format v0.3.6 has a - [bug]( https://github.com/cheshirekow/cmake_format/issues/50) - that can corrupt the formatting of comment lines in CMake files. - A workaround is to use the following command _before_ running cmake-format: - `sed --in-place='' 's/^ *#/#/' $FILENAME` ### Contributor License Agreement (CLA) diff --git a/README.md b/README.md index 8654da84ac9faa68b25693217682d4ca4c39414b..3f9193b045ec6e85fe7680c3dd6708a18376200d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ -# Vulkan Ecosystem Components +# Vulkan Loader -This project provides the Khronos official Vulkan ICD desktop loader for Windows, Linux, and MacOS. - -## CI Build Status - -[![Build Status](https://github.com/KhronosGroup/Vulkan-Loader/workflows/CI%20Build/badge.svg?branch=master)](https://github.com/KhronosGroup/Vulkan-Loader/actions) +This project provides the Khronos official Vulkan Loader for all platforms except [Android](https://android.googlesource.com/platform/frameworks/native/+/master/vulkan/) ## Introduction @@ -31,29 +27,25 @@ The following components are available in this repository: ## Information for Developing or Contributing Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file in this repository for more details. -Please see the [GOVERNANCE.md](GOVERNANCE.md) file in this repository for repository -management details. +Please see the [GOVERNANCE.md](GOVERNANCE.md) file in this repository for repository management details. ## How to Build and Run -[BUILD.md](BUILD.md) -Includes directions for building all components. +[BUILD.md](BUILD.md) includes directions for building all components. -Architecture and interface information for the loader is in -[docs/LoaderInterfaceArchitecture.md](docs/LoaderInterfaceArchitecture.md). +Architecture and interface information for the loader is in [docs/LoaderInterfaceArchitecture.md](docs/LoaderInterfaceArchitecture.md). ## Version Tagging Scheme -Updates to the `Vulkan-Loader` repository which correspond to a new Vulkan specification release are tagged using the following format: `v<`_`version`_`>` (e.g., `v1.1.96`). +Updates to this repository which correspond to a new Vulkan specification release are tagged using the following format: `v<`_`version`_`>` (e.g., `v1.3.266`). -**Note**: Marked version releases have undergone thorough testing but do not imply the same quality level as SDK tags. SDK tags follow the `sdk-<`_`version`_`>.<`_`patch`_`>` format (e.g., `sdk-1.1.92.0`). +**Note**: Marked version releases have undergone thorough testing but do not imply the same quality level as SDK tags. SDK tags follow the `vulkan-sdk-<`_`version`_`>.<`_`patch`_`>` format (e.g., `vulkan-sdk-1.3.266.0`). -This scheme was adopted following the 1.1.96 Vulkan specification release. +This scheme was adopted following the `1.3.266` Vulkan specification release. ## License -This work is released as open source under a Apache-style license from Khronos -including a Khronos copyright. +This work is released as open source under a Apache-style license from Khronos including a Khronos copyright. ## Acknowledgements diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..a421b2a2e613d70354e442ba218e08e2ff562df5 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +Security updates are applied only to the latest release. + +## Reporting a Vulnerability + +If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released. + +Please disclose it at [security advisory](https://github.com/KhronosGroup/Vulkan-Loader/security/advisories/new). + +This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure. diff --git a/build-gn/secondary/build_overrides/build.gni b/build-gn/secondary/build_overrides/build.gni deleted file mode 100644 index c6c11fa9b3bf6aba0a14b32f99c4b8701bfbeeb5..0000000000000000000000000000000000000000 --- a/build-gn/secondary/build_overrides/build.gni +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2019 LunarG, Inc. -# -# 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 -# -# https://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. - -build_with_chromium = false -ignore_elf32_limitations = true -linux_use_bundled_binutils_override = false -use_system_xcode = true diff --git a/build-gn/secondary/build_overrides/vulkan_headers.gni b/build-gn/secondary/build_overrides/vulkan_headers.gni deleted file mode 100644 index 0cd8307dcc6fdf4e20c97aafcec454ae1c9959ed..0000000000000000000000000000000000000000 --- a/build-gn/secondary/build_overrides/vulkan_headers.gni +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2020 LunarG, Inc. -# -# 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 -# -# https://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. - -vulkan_use_x11 = true diff --git a/build-gn/secondary/build_overrides/vulkan_loader.gni b/build-gn/secondary/build_overrides/vulkan_loader.gni deleted file mode 100644 index c826fc11286264b508af0e9240ad78b7e059ebbe..0000000000000000000000000000000000000000 --- a/build-gn/secondary/build_overrides/vulkan_loader.gni +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2019 LunarG, Inc. -# -# 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 -# -# https://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. - -# Paths to loader dependencies -vulkan_headers_dir = "//external/Vulkan-Headers" - -# Subdirectories for generated files -vulkan_gen_subdir = "" - -# Vulkan loader build options -vulkan_loader_shared = true - diff --git a/build-qnx/Makefile b/build-qnx/Makefile deleted file mode 100644 index 3beecfb7e606a8270be79fce837815fa84a5d132..0000000000000000000000000000000000000000 --- a/build-qnx/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -LIST=OS -include recurse.mk diff --git a/build-qnx/nto/Makefile b/build-qnx/nto/Makefile deleted file mode 100644 index 0cc5eae2d76802de001eb9f22558e2a76688c328..0000000000000000000000000000000000000000 --- a/build-qnx/nto/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LIST=CPU -ifndef QRECURSE -QRECURSE=recurse.mk -ifdef QCONFIG -QRDIR=$(dir $(QCONFIG)) -endif -endif -include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/nto/aarch64/Makefile b/build-qnx/nto/aarch64/Makefile deleted file mode 100644 index 0e22650c04c4e4ab46aeb02231f90cc4422ca3d2..0000000000000000000000000000000000000000 --- a/build-qnx/nto/aarch64/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LIST=VARIANT -ifndef QRECURSE -QRECURSE=recurse.mk -ifdef QCONFIG -QRDIR=$(dir $(QCONFIG)) -endif -endif -include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/nto/aarch64/so.le/Makefile b/build-qnx/nto/aarch64/so.le/Makefile deleted file mode 100644 index 0f9d7b9a906e5374f855b3a4b8a3bfbb1129c5e9..0000000000000000000000000000000000000000 --- a/build-qnx/nto/aarch64/so.le/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../../../common.mk diff --git a/build-qnx/nto/arm/Makefile b/build-qnx/nto/arm/Makefile deleted file mode 100644 index 0e22650c04c4e4ab46aeb02231f90cc4422ca3d2..0000000000000000000000000000000000000000 --- a/build-qnx/nto/arm/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LIST=VARIANT -ifndef QRECURSE -QRECURSE=recurse.mk -ifdef QCONFIG -QRDIR=$(dir $(QCONFIG)) -endif -endif -include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/nto/arm/so.le.v7/Makefile b/build-qnx/nto/arm/so.le.v7/Makefile deleted file mode 100644 index 0f9d7b9a906e5374f855b3a4b8a3bfbb1129c5e9..0000000000000000000000000000000000000000 --- a/build-qnx/nto/arm/so.le.v7/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../../../common.mk diff --git a/build-qnx/nto/x86_64/Makefile b/build-qnx/nto/x86_64/Makefile deleted file mode 100644 index 0e22650c04c4e4ab46aeb02231f90cc4422ca3d2..0000000000000000000000000000000000000000 --- a/build-qnx/nto/x86_64/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LIST=VARIANT -ifndef QRECURSE -QRECURSE=recurse.mk -ifdef QCONFIG -QRDIR=$(dir $(QCONFIG)) -endif -endif -include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/nto/x86_64/so/Makefile b/build-qnx/nto/x86_64/so/Makefile deleted file mode 100644 index 0f9d7b9a906e5374f855b3a4b8a3bfbb1129c5e9..0000000000000000000000000000000000000000 --- a/build-qnx/nto/x86_64/so/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../../../common.mk diff --git a/cmake/Copyright_cmake.txt b/cmake/Copyright_cmake.txt deleted file mode 100644 index 743c63418e391a04482ec8519783cd377b34fb35..0000000000000000000000000000000000000000 --- a/cmake/Copyright_cmake.txt +++ /dev/null @@ -1,126 +0,0 @@ -CMake - Cross Platform Makefile Generator -Copyright 2000-2018 Kitware, Inc. and Contributors -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name of Kitware, Inc. nor the names of Contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------------------------------------------- - -The following individuals and institutions are among the Contributors: - -* Aaron C. Meadows -* Adriaan de Groot -* Aleksey Avdeev -* Alexander Neundorf -* Alexander Smorkalov -* Alexey Sokolov -* Alex Turbov -* Andreas Pakulat -* Andreas Schneider -* André Rigland Brodtkorb -* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf -* Benjamin Eikel -* Bjoern Ricks -* Brad Hards -* Christopher Harvey -* Christoph Grüninger -* Clement Creusot -* Daniel Blezek -* Daniel Pfeifer -* Enrico Scholz -* Eran Ifrah -* Esben Mose Hansen, Ange Optimization ApS -* Geoffrey Viola -* Google Inc -* Gregor Jasny -* Helio Chissini de Castro -* Ilya Lavrenov -* Insight Software Consortium -* Jan Woetzel -* Kelly Thompson -* Konstantin Podsvirov -* Mario Bensi -* Mathieu Malaterre -* Matthaeus G. Chajdas -* Matthias Kretz -* Matthias Maennich -* Michael Stürmer -* Miguel A. Figueroa-Villanueva -* Mike Jackson -* Mike McQuaid -* Nicolas Bock -* Nicolas Despres -* Nikita Krupen'ko -* NVIDIA Corporation -* OpenGamma Ltd. -* Patrick Stotko -* Per Øyvind Karlsen -* Peter Collingbourne -* Petr Gotthard -* Philip Lowman -* Philippe Proulx -* Raffi Enficiaud, Max Planck Society -* Raumfeld -* Roger Leigh -* Rolf Eike Beer -* Roman Donchenko -* Roman Kharitonov -* Ruslan Baratov -* Sebastian Holtermann -* Stephen Kelly -* Sylvain Joubert -* Thomas Sondergaard -* Tobias Hunger -* Todd Gamblin -* Tristan Carel -* University of Dundee -* Vadim Zhukov -* Will Dicharry - -See version control history for details of individual contributions. - -The above copyright and license notice applies to distributions of -CMake in source and binary form. Third-party software packages supplied -with CMake under compatible licenses provide their own copyright notices -documented in corresponding subdirectories or source files. - ------------------------------------------------------------------------------- - -CMake was initially developed by Kitware with the following sponsorship: - - * National Library of Medicine at the National Institutes of Health - as part of the Insight Segmentation and Registration Toolkit (ITK). - - * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel - Visualization Initiative. - - * National Alliance for Medical Image Computing (NAMIC) is funded by the - National Institutes of Health through the NIH Roadmap for Medical Research, - Grant U54 EB005149. - - * Kitware, Inc. diff --git a/cmake/FindDirectFB.cmake b/cmake/FindDirectFB.cmake deleted file mode 100644 index 2c98b2acdc63aaca287114c728d141a6e5bc8ec5..0000000000000000000000000000000000000000 --- a/cmake/FindDirectFB.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Try to find DirectFB -# -# This will define: -# -# DIRECTFB_FOUND - True if DirectFB is found -# DIRECTFB_LIBRARIES - Link these to use DirectFB -# DIRECTFB_INCLUDE_DIR - Include directory for DirectFB -# DIRECTFB_DEFINITIONS - Compiler flags for using DirectFB -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -IF (NOT WIN32) - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PKG_DIRECTFB QUIET directfb) - - SET(DIRECTFB_DEFINITIONS ${PKG_DIRECTFB_CFLAGS}) - - FIND_PATH(DIRECTFB_INCLUDE_DIR NAMES directfb.h HINTS ${PKG_DIRECTFB_INCLUDE_DIRS}) - - FIND_LIBRARY(DIRECTFB_LIBRARIES NAMES directfb HINTS ${PKG_DIRECTFB_LIBRARY_DIRS}) - - include(FindPackageHandleStandardArgs) - - FIND_PACKAGE_HANDLE_STANDARD_ARGS(DIRECTFB DEFAULT_MSG DIRECTFB_LIBRARIES DIRECTFB_INCLUDE_DIR) - - MARK_AS_ADVANCED(DIRECTFB_INCLUDE_DIR DIRECTFB_LIBRARIES) -ENDIF () diff --git a/cmake/FindPCIAccess.cmake b/cmake/FindPCIAccess.cmake deleted file mode 100644 index 65f7d5c145df590b19c30500ac1d530ac8a909bf..0000000000000000000000000000000000000000 --- a/cmake/FindPCIAccess.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# - FindPCIAccess -# -# Copyright 2015 Valve Corporation - -find_package(PkgConfig) - -pkg_check_modules(PC_PCIACCESS QUIET pciaccess) - -find_path(PCIACCESS_INCLUDE_DIR NAMES pciaccess.h - HINTS - ${PC_PCIACCESS_INCLUDEDIR} - ${PC_PCIACCESS_INCLUDE_DIRS} - ) - -find_library(PCIACCESS_LIBRARY NAMES pciaccess - HINTS - ${PC_PCIACCESS_LIBDIR} - ${PC_PCIACCESS_LIBRARY_DIRS} - ) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PCIAccess DEFAULT_MSG - PCIACCESS_INCLUDE_DIR PCIACCESS_LIBRARY) - -mark_as_advanced(PCIACCESS_INCLUDE_DIR PCIACCESS_LIBRARY) - -set(PCIACCESS_INCLUDE_DIRS ${PCIACCESS_INCLUDE_DIR}) -set(PCIACCESS_LIBRARIES ${PCIACCESS_LIBRARY}) diff --git a/cmake/FindPthreadStubs.cmake b/cmake/FindPthreadStubs.cmake deleted file mode 100644 index 063bbe5160a2c36eb1b01ad14abdfe293fcbbf50..0000000000000000000000000000000000000000 --- a/cmake/FindPthreadStubs.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# - FindPthreadStubs -# -# Copyright (C) 2015 Valve Corporation - -find_package(PkgConfig) - -pkg_check_modules(PC_PTHREADSTUBS QUIET pthread-stubs) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PthreadStubs DEFAULT_MSG - PC_PTHREADSTUBS_FOUND) - -set(PTHREADSTUBS_INCLUDE_DIRS "") -set(PTHREADSTUBS_LIBRARIES "") diff --git a/cmake/FindUDev.cmake b/cmake/FindUDev.cmake deleted file mode 100644 index e3d16995dcbee4afaf5c8fa7192919dfaecfed30..0000000000000000000000000000000000000000 --- a/cmake/FindUDev.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# - FindUDev -# -# Copyright (C) 2015 Valve Corporation - -find_package(PkgConfig) - -pkg_check_modules(PC_LIBUDEV QUIET libudev) - -find_path(UDEV_INCLUDE_DIR NAMES libudev.h - HINTS - ${PC_LIBUDEV_INCLUDEDIR} - ${PC_LIBUDEV_INCLUDE_DIRS} - ) - -find_library(UDEV_LIBRARY NAMES udev - HINTS - ${PC_LIBUDEV_LIBDIR} - ${PC_LIBUDEV_LIBRARY_DIRS} - ) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(UDev DEFAULT_MSG - UDEV_INCLUDE_DIR UDEV_LIBRARY) - -mark_as_advanced(UDEV_INCLUDE_DIR UDEV_LIBRARY) - -set(UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR}) -set(UDEV_LIBRARIES ${UDEV_LIBRARY}) diff --git a/cmake/FindValgrind.cmake b/cmake/FindValgrind.cmake deleted file mode 100644 index 5c1fb5615755e57d156c68d6e5db22d8cd287c0b..0000000000000000000000000000000000000000 --- a/cmake/FindValgrind.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# - FindValgrind -# -# Copyright (C) 2015 Valve Corporation - -find_package(PkgConfig) - -pkg_check_modules(PC_VALGRIND QUIET valgrind) - -find_path(VALGRIND_INCLUDE_DIR NAMES valgrind.h memcheck.h - HINTS - ${PC_VALGRIND_INCLUDEDIR} - ${PC_VALGRIND_INCLUDE_DIRS} - ) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Valgrind DEFAULT_MSG - VALGRIND_INCLUDE_DIR) - -mark_as_advanced(VALGRIND_INCLUDE_DIR) - -set(VALGRIND_INCLUDE_DIRS ${VALGRIND_INCLUDE_DIR}) -set(VALGRIND_LIBRARIES "") diff --git a/cmake/FindVulkanHeaders.cmake b/cmake/FindVulkanHeaders.cmake deleted file mode 100644 index 0b4585d41b582731ba48705d6fc1f0a8e3d5c323..0000000000000000000000000000000000000000 --- a/cmake/FindVulkanHeaders.cmake +++ /dev/null @@ -1,154 +0,0 @@ -#.rst: -# FindVulkanHeaders -# ----------------- -# -# Try to find Vulkan Headers and Registry. -# -# This module is intended to be used by projects that build Vulkan -# "system" components such as the loader and layers. -# Vulkan applications should instead use the FindVulkan (or similar) -# find module that locates the headers and the loader library. -# -# When using this find module to locate the headers and registry -# in a Vulkan-Headers repository, the Vulkan-Headers repository -# should be built with 'install' target and the following environment -# or CMake variable set to the location of the install directory. -# -# VULKAN_HEADERS_INSTALL_DIR -# -# IMPORTED Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines no IMPORTED targets -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following variables:: -# -# VulkanHeaders_FOUND - True if VulkanHeaders was found -# VulkanHeaders_INCLUDE_DIRS - include directories for VulkanHeaders -# -# VulkanRegistry_FOUND - True if VulkanRegistry was found -# VulkanRegistry_DIRS - directories for VulkanRegistry -# -# VulkanHeaders_VERSION_MAJOR - The Major API version of the latest version -# contained in the Vulkan header -# VulkanHeaders_VERSION_MINOR - The Minor API version of the latest version -# contained in the Vulkan header -# VulkanHeaders_VERSION_PATCH - The Patch API version of the latest version -# contained in the Vulkan header -# -# The module will also define two cache variables:: -# -# VulkanHeaders_INCLUDE_DIR - the VulkanHeaders include directory -# VulkanRegistry_DIR - the VulkanRegistry directory -# - -# Probe command-line arguments and the environment to see if they specify the -# Vulkan headers installation path. -if(NOT DEFINED VULKAN_HEADERS_INSTALL_DIR) - if (DEFINED ENV{VULKAN_HEADERS_INSTALL_DIR}) - set(VULKAN_HEADERS_INSTALL_DIR "$ENV{VULKAN_HEADERS_INSTALL_DIR}") - elseif(DEFINED ENV{VULKAN_SDK}) - set(VULKAN_HEADERS_INSTALL_DIR "$ENV{VULKAN_SDK}/include") - endif() -endif() - -if(DEFINED VULKAN_HEADERS_INSTALL_DIR) - # When CMAKE_FIND_ROOT_PATH_INCLUDE is set to ONLY, the HINTS in find_path() - # are re-rooted, which prevents VULKAN_HEADERS_INSTALL_DIR to work as - # expected. So use NO_CMAKE_FIND_ROOT_PATH to avoid it. - - # Use HINTS instead of PATH to search these locations before - # searching system environment variables like $PATH that may - # contain SDK directories. - find_path(VulkanHeaders_INCLUDE_DIR - NAMES vulkan/vulkan.h - HINTS ${VULKAN_HEADERS_INSTALL_DIR}/include - NO_CMAKE_FIND_ROOT_PATH) - find_path(VulkanRegistry_DIR - NAMES vk.xml - HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry - NO_CMAKE_FIND_ROOT_PATH) -else() - # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, - # do a normal search without hints. - find_path(VulkanHeaders_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS "${CMAKE_CURRENT_SOURCE_DIR}/external/Vulkan-Headers/include" NO_CMAKE_FIND_ROOT_PATH) - get_filename_component(VULKAN_REGISTRY_PATH_HINT ${VulkanHeaders_INCLUDE_DIR} DIRECTORY) - find_path(VulkanRegistry_DIR NAMES vk.xml HINTS ${VULKAN_REGISTRY_PATH_HINT}/share/vulkan/registry - "${VULKAN_REGISTRY_PATH_HINT}/registry" NO_CMAKE_FIND_ROOT_PATH) -endif() - -set(VulkanHeaders_INCLUDE_DIRS ${VulkanHeaders_INCLUDE_DIR}) -set(VulkanRegistry_DIRS ${VulkanRegistry_DIR}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(VulkanHeaders - DEFAULT_MSG - VulkanHeaders_INCLUDE_DIR) -set(FPHSA_NAME_MISMATCHED TRUE) -find_package_handle_standard_args(VulkanRegistry - DEFAULT_MSG - VulkanRegistry_DIR) -unset(FPHSA_NAME_MISMATCHED) - -mark_as_advanced(VulkanHeaders_INCLUDE_DIR VulkanRegistry_DIR) - -# Determine the major/minor/patch version from the vulkan header -set(VulkanHeaders_VERSION_MAJOR "0") -set(VulkanHeaders_VERSION_MINOR "0") -set(VulkanHeaders_VERSION_PATCH "0") - -# First, determine which header we need to grab the version information from. -# Starting with Vulkan 1.1, we should use vulkan_core.h, but prior to that, -# the information was in vulkan.h. -if (EXISTS "${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_core.h") - set(VulkanHeaders_main_header ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_core.h) -else() - set(VulkanHeaders_main_header ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.h) -endif() - -# Find all lines in the header file that contain any version we may be interested in -# NOTE: They start with #define and then have other keywords -file(STRINGS - ${VulkanHeaders_main_header} - VulkanHeaders_lines - REGEX "^#define VK_HEADER_VERSION(_COMPLETE)? ") - -foreach(VulkanHeaders_line ${VulkanHeaders_lines}) - - # First, handle the case where we have a major/minor version - # Format is: - # #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, X, Y, VK_HEADER_VERSION) - # We grab the major version (X) and minor version (Y) out of the parentheses - string(REGEX MATCH "VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION\\(.*\\)" VulkanHeaders_out ${VulkanHeaders_line}) - string(REGEX MATCHALL "[0-9]+" VulkanHeaders_MAJOR_MINOR "${VulkanHeaders_out}") - if (VulkanHeaders_MAJOR_MINOR) - list (GET VulkanHeaders_MAJOR_MINOR 1 VulkanHeaders_cur_major) - list (GET VulkanHeaders_MAJOR_MINOR 2 VulkanHeaders_cur_minor) - if (${VulkanHeaders_cur_major} GREATER ${VulkanHeaders_VERSION_MAJOR}) - set(VulkanHeaders_VERSION_MAJOR ${VulkanHeaders_cur_major}) - set(VulkanHeaders_VERSION_MINOR ${VulkanHeaders_cur_minor}) - endif() - if (${VulkanHeaders_cur_major} EQUAL ${VulkanHeaders_VERSION_MAJOR} AND - ${VulkanHeaders_cur_minor} GREATER ${VulkanHeaders_VERSION_MINOR}) - set(VulkanHeaders_VERSION_MINOR ${VulkanHeaders_cur_minor}) - endif() - endif() - - # Second, handle the case where we have the patch version - # Format is: - # #define VK_HEADER_VERSION Z - # Where Z is the patch version which we just grab off the end - string(REGEX MATCH "define.*VK_HEADER_VERSION[^_].*[0-9]+" VulkanHeaders_out ${VulkanHeaders_line}) - list(LENGTH VulkanHeaders_out VulkanHeaders_len) - if (VulkanHeaders_len) - string(REGEX MATCH "[0-9]+" VulkanHeaders_VERSION_PATCH "${VulkanHeaders_out}") - endif() - -endforeach() -MESSAGE(STATUS - "Detected Vulkan Version ${VulkanHeaders_VERSION_MAJOR}." - "${VulkanHeaders_VERSION_MINOR}." - "${VulkanHeaders_VERSION_PATCH}") diff --git a/cmake/FindX11_XCB.cmake b/cmake/FindX11_XCB.cmake deleted file mode 100644 index 956bf89d7715fdc9c25354ea693c90c47053f31c..0000000000000000000000000000000000000000 --- a/cmake/FindX11_XCB.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# - Try to find libX11-xcb -# Once done this will define -# -# X11_XCB_FOUND - system has libX11-xcb -# X11_XCB_LIBRARIES - Link these to use libX11-xcb -# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir -# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb - -# Copyright (c) 2011 Fredrik Höglund -# Copyright (c) 2008 Helio Chissini de Castro, -# Copyright (c) 2007 Matthias Kretz, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -IF (NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb) - - SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS}) - - FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS}) - FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS}) - - include(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR) - - MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES) -ENDIF (NOT WIN32) - diff --git a/cmake/FindXCB.cmake b/cmake/FindXCB.cmake deleted file mode 100644 index 91127c7e7cfd172a25f7c4a91e6cc9b68cc2ae78..0000000000000000000000000000000000000000 --- a/cmake/FindXCB.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# - FindXCB -# -# Copyright (C) 2015 Valve Corporation - -find_package(PkgConfig) - -if(NOT XCB_FIND_COMPONENTS) - set(XCB_FIND_COMPONENTS xcb) -endif() - -include(FindPackageHandleStandardArgs) -set(XCB_FOUND true) -set(XCB_INCLUDE_DIRS "") -set(XCB_LIBRARIES "") -foreach(comp ${XCB_FIND_COMPONENTS}) - # component name - string(TOUPPER ${comp} compname) - string(REPLACE "-" "_" compname ${compname}) - # header name - string(REPLACE "xcb-" "" headername xcb/${comp}.h) - # library name - set(libname ${comp}) - - pkg_check_modules(PC_${comp} QUIET ${comp}) - - find_path(${compname}_INCLUDE_DIR NAMES ${headername} - HINTS - ${PC_${comp}_INCLUDEDIR} - ${PC_${comp}_INCLUDE_DIRS} - ) - - find_library(${compname}_LIBRARY NAMES ${libname} - HINTS - ${PC_${comp}_LIBDIR} - ${PC_${comp}_LIBRARY_DIRS} - ) - - set(FPHSA_NAME_MISMATCHED TRUE) - find_package_handle_standard_args(${comp} - FOUND_VAR ${comp}_FOUND - REQUIRED_VARS ${compname}_INCLUDE_DIR ${compname}_LIBRARY) - unset(FPHSA_NAME_MISMATCHED) - - mark_as_advanced(${compname}_INCLUDE_DIR ${compname}_LIBRARY) - - list(APPEND XCB_INCLUDE_DIRS ${${compname}_INCLUDE_DIR}) - list(APPEND XCB_LIBRARIES ${${compname}_LIBRARY}) - - if(NOT ${comp}_FOUND) - set(XCB_FOUND false) - endif() -endforeach() - -list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in deleted file mode 100644 index 2037e365393a13dd840848fc2aed0b818f1f75a4..0000000000000000000000000000000000000000 --- a/cmake/cmake_uninstall.cmake.in +++ /dev/null @@ -1,21 +0,0 @@ -if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") -endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - -file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -string(REGEX REPLACE "\n" ";" files "${files}") -foreach(file ${files}) - message(STATUS "Uninstalling $ENV{DESTDIR}${file}") - if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif(NOT "${rm_retval}" STREQUAL 0) - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") -endforeach(file) diff --git a/docs/LoaderApplicationInterface.md b/docs/LoaderApplicationInterface.md index c9af0343ada7d95dfe6053e95afc6b28653c77b8..d8454f1fb02c89d18df9ceab0813b2e0dab92a3f 100644 --- a/docs/LoaderApplicationInterface.md +++ b/docs/LoaderApplicationInterface.md @@ -4,15 +4,15 @@ [1]: https://vulkan.lunarg.com/img/Vulkan_100px_Dec16.png "https://www.khronos.org/vulkan/" [2]: https://www.khronos.org/vulkan/ -# Application Interface to Loader +# Application Interface to Loader [![Creative Commons][3]][4] - + [3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License" [4]: https://creativecommons.org/licenses/by-nd/4.0/ -## Table of Contents +## Table of Contents - [Overview](#overview) - [Interfacing with Vulkan Functions](#interfacing-with-vulkan-functions) @@ -36,9 +36,6 @@ - [Forcing Layers to be Enabled on Windows, Linux and macOS](#forcing-layers-to-be-enabled-on-windows-linux-and-macos) - [Overall Layer Ordering](#overall-layer-ordering) - [Debugging Possible Layer Issues](#debugging-possible-layer-issues) - - [Enable Loader Debug Layer Output](#enable-loader-debug-layer-output) - - [Disable All Layers](#disable-all-layers) - - [Enable More Loader Debug Output](#enable-more-loader-debug-output) - [Application Usage of Extensions](#application-usage-of-extensions) - [Instance and Device Extensions](#instance-and-device-extensions) - [WSI Extensions](#wsi-extensions) @@ -376,7 +373,7 @@ layer, dropping the need for meta layers. While not necessary for validation anymore, VkConfig does use meta layers to group layers together based on user's preferences. More can be found out about this functionality through both the -[VkConfig documentation](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md) +[VkConfig documentation](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/README.md) and the section later on the [Override Layer](#override-layer). Meta-layers are detailed more in the @@ -411,7 +408,7 @@ On Desktop platforms (Windows, Linux, and macOS), these enable/disable settings are defined in the layer's JSON file. Discovery of system-installed implicit and explicit layers is described later -in the [Layer discovery](LoaderLayerInterface#layer-discovery) +in the [Layer discovery](LoaderLayerInterface.md#layer-discovery) section in the [LoaderLayerInterface.md](LoaderLayerInterface.md) document. @@ -449,7 +446,7 @@ The table below details more information: #### Override Layer The "Override Layer" is a special implicit meta-layer created by the -[VkConfig](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md) +[VkConfig](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/README.md) tool and available by default when the tool is running. Once VkConfig exits, the override layer is removed, and the system should return to standard Vulkan behavior. @@ -472,9 +469,9 @@ the system-installed layers. This can be accomplished in one of two ways: 1. Selecting specific layer paths using the -[VkConfig](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md) +[VkConfig](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/README.md) tool shipped with the Vulkan SDK. - 2. Directing the loader to look for layers in specific folders by using the + 2. Directing the loader to look for layers in specific files and/or folders by using the `VK_LAYER_PATH` environment variable. The `VK_LAYER_PATH` environment variable can contain multiple paths separated by @@ -482,7 +479,7 @@ the operating-system specific path separator. On Windows, this is a semicolon (`;`), while on Linux and macOS it is a colon (`:`). -If `VK_LAYER_PATH` exists, the folders listed in it will be scanned for explicit +If `VK_LAYER_PATH` exists, the files and/or folders listed will be scanned for explicit layer manifest files. Implicit layer discovery is unaffected by this environment variable. Each directory listed should be the full pathname of a folder containing layer @@ -515,7 +512,7 @@ application they are using. This can be also be accomplished in one of two ways: 1. Selecting specific layers using the -[VkConfig](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md) +[VkConfig](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/README.md) tool shipped with the Vulkan SDK. 2. Directing the loader to look for additional layers by name using the `VK_INSTANCE_LAYERS` environment variable. @@ -572,140 +569,10 @@ make to function. ### Debugging Possible Layer Issues If it is possible that a layer is causing issues, there are several things that -can be tried. - - -#### Enable Loader Debug Layer Output - -First, enable the "layer" debug output option (`VK_LOADER_DEBUG`) in the loader, -See the -[Table of Debug Environment Variables](LoaderInterfaceArchitecture.md##table-of-debug-environment-variables) -for more info. - -When enabled, the loader will output information on: - * Where it looks for implicit layers - * Where it looks for explicit layers - * What manifest files it finds - * Which layer manifest files are loaded - * What libraries are associated with a layer - * What the layer callstack looks like for both the instance and device chain - -For example, the layer output for searching for implicit layers on Linux may -look like: - -``` -LAYER: Searching for layer manifest files -LAYER: In following folders: -LAYER: /home/linust/.config/vulkan/implicit_layer.d -LAYER: /etc/xdg/vulkan/implicit_layer.d -LAYER: /usr/local/etc/vulkan/implicit_layer.d -LAYER: /etc/vulkan/implicit_layer.d -LAYER: /home/linust/.local/share/vulkan/implicit_layer.d -LAYER: /home/linust/.local/share/flatpak/exports/share/vulkan/implicit_layer.d -LAYER: /var/lib/flatpak/exports/share/vulkan/implicit_layer.d -LAYER: /usr/local/share/vulkan/implicit_layer.d -LAYER: /usr/share/vulkan/implicit_layer.d -LAYER: Found the following files: -LAYER: /home/linust/.local/share/vulkan/implicit_layer.d/renderdoc_capture.json -LAYER: /home/linust/.local/share/vulkan/implicit_layer.d/steamfossilize_i386.json -LAYER: /home/linust/.local/share/vulkan/implicit_layer.d/steamfossilize_x86_64.json -LAYER: /home/linust/.local/share/vulkan/implicit_layer.d/steamoverlay_i386.json -LAYER: /home/linust/.local/share/vulkan/implicit_layer.d/steamoverlay_x86_64.json -LAYER: /usr/share/vulkan/implicit_layer.d/nvidia_layers.json -LAYER: /usr/share/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json -``` - -In the above scenario, seven implicit layers were discovered in two different -folders. -Just because they were found does not mean that they will be loaded, but this -information can be used to make sure a layer JSON file was properly discovered. - -When the loader actually loads a layer, the messages may look like the -following: - -``` -LAYER | DEBUG: Loading layer library libVkLayer_khronos_validation.so -LAYER | INFO: Insert instance layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so) -LAYER | DEBUG: Loading layer library libVkLayer_MESA_device_select.so -LAYER | INFO: Insert instance layer VK_LAYER_MESA_device_select (libVkLayer_MESA_device_select.so) -``` - -This information does not indicate the order the layers are used in. -That information is displayed later showing all the callstack during both -`vkCreateInstance` and `vkCreateDevice`. -In the same sample above, the callstack for `vkCreateInstance` looks like the -following: - -``` -LAYER: vkCreateInstance layer callstack setup to: -LAYER: -LAYER: || -LAYER: -LAYER: || -LAYER: VK_LAYER_MESA_device_select -LAYER: Type: Implicit -LAYER: Disable Env Var: NODEVICE_SELECT -LAYER: Manifest: /usr/share/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json -LAYER: Library: libVkLayer_MESA_device_select.so -LAYER: || -LAYER: VK_LAYER_KHRONOS_validation -LAYER: Type: Explicit -LAYER: Manifest: /usr/share/vulkan/explicit_layer.d/VkLayer_khronos_validation.json -LAYER: Library: libVkLayer_khronos_validation.so -LAYER: || -LAYER: -``` - -In this scenario, two layers were used (the same two that were loaded earlier): -* `VK_LAYER_MESA_device_select` -* `VK_LAYER_KHRONOS_validation` - -This information now shows us that the `VK_LAYER_MESA_device_select` is loaded -first, followed by `VK_LAYER_KHRONOS_validation` which will then continue into -any available drivers. -It also shows that `VK_LAYER_MESA_device_select` is an implicit layer which -implies that it wasn't directly enabled by the application. -On the other hand, `VK_LAYER_KHRONOS_validation` is shown as an explicit layer -which indicates that it was likely enabled by the application. - -Sometimes, implicit layers can cause issues with an application. -Because of this, the next step is to try to disable one or more of the listed -implicit layers. -This can be done by defining the disable environment variable for that layer. -Each layer has it's own disable environment variable as mentioned in the -[Layer Manifest File Format](LoaderLayerInterface.md#layer-manifest-file-format). -However, it can be difficult to find this variable in the manifest files, so -the loader now outputs it as part of the callstack information. -Looking at the above `vkCreateInstance` callstack output, under the -section for `VK_LAYER_MESA_device_select` exists a section listed as -"Disable Env Var:". -This is the disable environment variable that can be used to disable the -`VK_LAYER_MESA_device_select` layer from being loaded by the loader. -In the above output, the disable environment variable is listed as -"NODEVICE_SELECT" which can be defined to a non-zero value to cause the loader -to ignore this layer. - - -#### Disable All Layers - -Because implicit layers are virtually unknown to the application, it is best to -next try to disable each one of them. -Using the above debug output, define each environment variable to disable the -corresponding implicit layer that was used. - -Once all are disabled, re-run the application again. - -If the failure still occurs, try disabling all explicit layers loaded by the -application by modifying the application or using a tool such as -[VkConfig](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md). - - -#### Enable More Loader Debug Output - -If the failure continues after disabling all layers, then enable all loader -debug warnings and errors by setting `VK_LOADER_DEBUG` to "error,warn" or -even "all". -This will output any other issues that the loader has encountered. +can be tried which are documented in the +[Debugging Possible Layer Issues](LoaderDebugging.md#debugging-possible-layer-issues) +section of the [LoaderDebugging.mg](LoaderDebugging.md) document in the docs +folder. ## Application Usage of Extensions diff --git a/docs/LoaderDebugging.md b/docs/LoaderDebugging.md new file mode 100644 index 0000000000000000000000000000000000000000..47d5ae2ed69cc9fe17dc42304376124d1fafe332 --- /dev/null +++ b/docs/LoaderDebugging.md @@ -0,0 +1,361 @@ + +[![Khronos Vulkan][1]][2] + +[1]: https://vulkan.lunarg.com/img/Vulkan_100px_Dec16.png "https://www.khronos.org/vulkan/" +[2]: https://www.khronos.org/vulkan/ + +# Debugging The Vulkan Desktop Loader +[![Creative Commons][3]][4] + + + +[3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License" +[4]: https://creativecommons.org/licenses/by-nd/4.0/ +## Table of Contents + +- [Debugging Issues](#debugging-issues) +- [Loader Logging](#loader-logging) +- [Debugging Possible Layer Issues](#debugging-possible-layer-issues) + - [Enable Layer Logging](#enable-layer-logging) + - [Disable Layers](#disable-layers) + - [Selectively Re-enable Layers](#selectively-re-enable-layers) +- [Allow specific layers to be ignored by VK\_LOADER\_LAYERS\_DISABLE](#allow-specific-layers-to-be-ignored-by-vk_loader_layers_disable) +- [Debugging Possible Driver Issues](#debugging-possible-driver-issues) + - [Enable Driver Logging](#enable-driver-logging) + - [Selectively Enable Specific Drivers](#selectively-enable-specific-drivers) + +## Debugging Issues + +If your application is crashing or behaving weirdly, the loader provides +several mechanisms for you to debug the issues. + +**NOTE**: This functionality is all specific to the desktop Vulkan loader and +does not work for the Android loader. + +## Loader Logging + +The Vulkan desktop loader has added logging functionality that can be enabled by +using the `VK_LOADER_DEBUG` environment variable. +The results will be output to the standard output, but will also be passed to +any `VK_EXT_debug_utils` messengers present as well. +The variable can be set to a comma-delimited list of debug level options which +include: + + * error      Report any errors encountered by + the loader + * warn      Report any warnings encountered by + the loader + * info        Report info-level + messages generated by the loader + * debug    Report debug-level messages generated by the + loader + * layer      Report all layer-specific messages + generated by the loader + * driver     Report all driver-specific messages + generated by the loader + * all          Report all + messages generated by the loader (includes all of the above) + +If you're not sure where the issue comes from, at least set it to output all +messages through the "info" level: + +``` +set VK_LOADER_DEBUG=error,warn,info +``` + +Then, you can search the list for any errors or warnings that might provide a +hint at why you're seeing issues. + +For more info on enabling loader logging, refer to the +[Enable Loader Debug Layer Output](LoaderApplicationInterface.md#enable-loader-debug-layer-output) +and the +[Table of Debug Environment Variables](LoaderInterfaceArchitecture.md#table-of-debug-environment-variables) +below. + +## Debugging Possible Layer Issues + +### Enable Layer Logging + +If you suspect a layer issue, set the loader logging to specifically output +layer messages in addition to warnings and errors: + +``` +set VK_LOADER_DEBUG=error,warn,layer +``` + +Most important layer messages should go out with error or warning levels set, +but this will provide more layer-specific info as well such as: + * What layers are found + * Where they were found + * If they are implicit, what environment variables can be used to disable them + * If there is any incompatibility with a given layer, this could include: + * The layer library file (.so/.dll) wasn't found + * The layer library is the wrong bit-depth for the executing application + (i.e. 32-bit vs 64-bit) + * The layer itself doesn't support the application desired version of Vulkan + * If any environment variables are disabling any layers + +For example, the output of the loader looking for implicit layers may look like +the following: + +``` +LAYER: Searching for layer manifest files +LAYER: In following locations: +LAYER: /home/${USER}/.config/vulkan/implicit_layer.d +LAYER: /etc/xdg/vulkan/implicit_layer.d +LAYER: /usr/local/etc/vulkan/implicit_layer.d +LAYER: /etc/vulkan/implicit_layer.d +LAYER: /home/${USER}/.local/share/vulkan/implicit_layer.d +LAYER: /home/${USER}/.local/share/flatpak/exports/share/vulkan/implicit_layer.d +LAYER: /var/lib/flatpak/exports/share/vulkan/implicit_layer.d +LAYER: /usr/local/share/vulkan/implicit_layer.d +LAYER: /usr/share/vulkan/implicit_layer.d +LAYER: Found the following files: +LAYER: /home/${USER}/.local/share/vulkan/implicit_layer.d/renderdoc_capture.json +LAYER: /home/${USER}/.local/share/vulkan/implicit_layer.d/steamfossilize_i386.json +LAYER: /home/${USER}/.local/share/vulkan/implicit_layer.d/steamfossilize_x86_64.json +LAYER: /home/${USER}/.local/share/vulkan/implicit_layer.d/steamoverlay_i386.json +LAYER: /home/${USER}/.local/share/vulkan/implicit_layer.d/steamoverlay_x86_64.json +LAYER: /usr/share/vulkan/implicit_layer.d/nvidia_layers.json +LAYER: /usr/share/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json +``` + +Then, the loading of layer libraries is reported similar to this: + +``` +LAYER | DEBUG: Loading layer library libVkLayer_khronos_validation.so +LAYER | INFO: Insert instance layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so) +LAYER | DEBUG: Loading layer library libVkLayer_MESA_device_select.so +LAYER | INFO: Insert instance layer VK_LAYER_MESA_device_select (libVkLayer_MESA_device_select.so) +``` + +Finally, when the Vulkan instance is created, you can see the full instance +call-chain from a functional standpoint with output like this: + +``` +LAYER: vkCreateInstance layer callstack setup to: +LAYER: +LAYER: || +LAYER: +LAYER: || +LAYER: VK_LAYER_MESA_device_select +LAYER: Type: Implicit +LAYER: Disable Env Var: NODEVICE_SELECT +LAYER: Manifest: /usr/share/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json +LAYER: Library: libVkLayer_MESA_device_select.so +LAYER: || +LAYER: VK_LAYER_KHRONOS_validation +LAYER: Type: Explicit +LAYER: Manifest: /usr/share/vulkan/explicit_layer.d/VkLayer_khronos_validation.json +LAYER: Library: libVkLayer_khronos_validation.so +LAYER: || +LAYER: +``` + +In this scenario, two layers were used (the same two that were loaded earlier): +* `VK_LAYER_MESA_device_select` +* `VK_LAYER_KHRONOS_validation` + +This information now shows us that the `VK_LAYER_MESA_device_select` is loaded +first, followed by `VK_LAYER_KHRONOS_validation` which will then continue into +any available drivers. +It also shows that `VK_LAYER_MESA_device_select` is an implicit layer which +implies that it wasn't directly enabled by the application. +On the other hand, `VK_LAYER_KHRONOS_validation` is shown as an explicit layer +which indicates that it was likely enabled by the application. + +### Disable Layers + +**NOTE:** This functionality is only available with Loaders built with version +1.3.234 of the Vulkan headers and later. + +Sometimes, implicit layers can cause issues with an application. +Because of this, the next step is to try to disable one or more of the listed +implicit layers. +You can use the filtering environment variables +(`VK_LOADER_LAYERS_ENABLE` and `VK_LOADER_LAYERS_DISABLE`) to selectively enable +or disable various layers. +If you're not sure what to do, try disabling all implicit layers manually by +setting `VK_LOADER_LAYERS_DISABLE` to `~implicit~`. + +``` + set VK_LOADER_LAYERS_DISABLE=~implicit~ +``` + +This will disable all implicit layers and the loader will report any disabled +layers to the logging output when layer logging is enabled in the following way: + +``` +WARNING | LAYER: Implicit layer "VK_LAYER_MESA_device_select" forced disabled because name matches filter of env var 'VK_LOADER_LAYERS_DISABLE'. +WARNING | LAYER: Implicit layer "VK_LAYER_AMD_switchable_graphics_64" forced disabled because name matches filter of env var 'VK_LOADER_LAYERS_DISABLE'. +WARNING | LAYER: Implicit layer "VK_LAYER_Twitch_Overlay" forced disabled because name matches filter of env var 'VK_LOADER_LAYERS_DISABLE'. +``` + +### Selectively Re-enable Layers + +**NOTE:** This functionality is only available with Loaders built with version +1.3.234 of the Vulkan headers and later. + +When trying to diagnose problems caused by layers, it is useful to first disable +all layers and re-enable each layer individually. +If the problem reappears, then it is immediately clear which layer is the source +of the issue. + +For example, from the above given list of disabled layers, let’s selectively +re-enable one: + +``` +set VK_LOADER_LAYERS_DISABLE=~implicit~ +set VK_LOADER_LAYERS_ENABLE=*AMD* +``` + +This would keep both the "VK_LAYER_MESA_device_select" and +"VK_LAYER_Twitch_Overlay" layers disabled, while enabling the +"VK_LAYER_AMD_switchable_graphics_64" layer. +If everything continues to work, then the evidence seems to suggest the issue is +likely not related to the AMD layer. +This would lead to enabling one other layer and trying again: + +``` +set VK_LOADER_LAYERS_DISABLE=~implicit~ +set VK_LOADER_LAYERS_ENABLE=*AMD*,*twitch* +``` + +And so forth. + +For more info on how to use the filtering environment variables, refer to the +[Layer Filtering](LoaderLayerInterface.md#layer-filtering) section of the +[LoaderLayerInterface](LoaderLayerInterface.md) document. + +## Allow specific layers to be ignored by VK_LOADER_LAYERS_DISABLE + +**NOTE:** VK_LOADER_LAYERS_DISABLE is only available with Loaders built with version +1.3.262 of the Vulkan headers and later. + +When using `VK_LOADER_LAYERS_DISABLE` to disable implicit layers, it is possible +to allow specific layers to be enabled using `VK_LOADER_LAYERS_ENABLE`. +However, this has the effect of *forcing* layers to be enabled, which is not +always desired. +Implicit layers have the ability to only be enabled when a layer specified +environment variable is set, allow for context dependent enablement. +`VK_LOADER_LAYERS_ENABLE` ignores that context. + +Thus, a different environment variable is needed: `VK_LOADER_LAYERS_ALLOW` + +The behavior of `VK_LOADER_LAYERS_ALLOW` is similar to `VK_LOADER_LAYERS_ENABLE` +except that it does not force a layer to be enabled. +The way to think about this environment variable is that every layer matching +`VK_LOADER_LAYERS_ALLOW` is excluded from being forcibly disabled by +`VK_LOADER_LAYERS_DISABLE`. +this allows for implicit layers that are context dependent to be enabled +depending on the relevant context instead of force enabling them. + +Example: Disable all implicit layers except for any layers that have steam or +mesa in their name. +``` +set VK_LOADER_LAYERS_DISABLE=~implicit~ +set VK_LOADER_LAYERS_ALLOW=*steam*,*Mesa* +``` + +## Debugging Possible Driver Issues + +### Enable Driver Logging + +**NOTE:** This functionality is only available with Loaders built with version +1.3.234 of the Vulkan headers and later. + +If you suspect a driver issue, set the loader logging to specifically output +driver messages: + +``` +set VK_LOADER_DEBUG=error,warn,driver +``` + +Most important driver messages should go out with error or warning levels set, +but this will provide more driver-specific info as well such as: + * What drivers are found + * Where they were found + * If there is any incompatibility with a given driver + * If any environment variables are disabling any of the drivers + +For example, the output of the loader looking for drivers on a Linux system may +look like the following (NOTE: additional spaces have been removed from the +output for easier reading): + +``` +DRIVER: Searching for driver manifest files +DRIVER: In following folders: +DRIVER: /home/$(USER)/.config/vulkan/icd.d +DRIVER: /etc/xdg/vulkan/icd.d +DRIVER: /etc/vulkan/icd.d +DRIVER: /home/$(USER)/.local/share/vulkan/icd.d +DRIVER: /home/$(USER)/.local/share/flatpak/exports/share/vulkan/icd.d +DRIVER: /var/lib/flatpak/exports/share/vulkan/icd.d +DRIVER: /usr/local/share/vulkan/icd.d +DRIVER: /usr/share/vulkan/icd.d +DRIVER: Found the following files: +DRIVER: /usr/share/vulkan/icd.d/intel_icd.x86_64.json +DRIVER: /usr/share/vulkan/icd.d/lvp_icd.x86_64.json +DRIVER: /usr/share/vulkan/icd.d/radeon_icd.x86_64.json +DRIVER: /usr/share/vulkan/icd.d/lvp_icd.i686.json +DRIVER: /usr/share/vulkan/icd.d/radeon_icd.i686.json +DRIVER: /usr/share/vulkan/icd.d/intel_icd.i686.json +DRIVER: /usr/share/vulkan/icd.d/nvidia_icd.json +DRIVER: Found ICD manifest file /usr/share/vulkan/icd.d/intel_icd.x86_64.json, version "1.0.0" +DRIVER: Found ICD manifest file /usr/share/vulkan/icd.d/lvp_icd.x86_64.json, version "1.0.0" +DRIVER: Found ICD manifest file /usr/share/vulkan/icd.d/radeon_icd.x86_64.json, version "1.0.0" +DRIVER: Found ICD manifest file /usr/share/vulkan/icd.d/lvp_icd.i686.json, version "1.0.0" +DRIVER: Requested driver /usr/lib/libvulkan_lvp.so was wrong bit-type. Ignoring this JSON +DRIVER: Found ICD manifest file /usr/share/vulkan/icd.d/radeon_icd.i686.json, version "1.0.0" +DRIVER: Requested driver /usr/lib/libvulkan_radeon.so was wrong bit-type. Ignoring this JSON +DRIVER: Found ICD manifest file /usr/share/vulkan/icd.d/intel_icd.i686.json, version "1.0.0" +DRIVER: Requested driver /usr/lib/libvulkan_intel.so was wrong bit-type. Ignoring this JSON +DRIVER: Found ICD manifest file /usr/share/vulkan/icd.d/nvidia_icd.json, version "1.0.0" +``` + +Then when the application selects the device to use, you will see the Vulkan +device call chain reported in the following way (NOTE: additional spaces have +been removed from the output for easier reading): + +``` +DRIVER: vkCreateDevice layer callstack setup to: +DRIVER: +DRIVER: || +DRIVER: +DRIVER: || +DRIVER: +DRIVER: Using "Intel(R) UHD Graphics 630 (CFL GT2)" with driver: "/usr/lib64/libvulkan_intel.so" +``` + + +### Selectively Enable Specific Drivers + +**NOTE:** This functionality is only available with Loaders built with version +1.3.234 of the Vulkan headers and later. + +You can now use the filtering environment variables +(`VK_LOADER_DRIVERS_SELECT` and `VK_LOADER_DRIVERS_DISABLE`) to control what +drivers the loader will attempt to load. +For drivers, the string globs passed into the above environment variables will +be compared against the driver JSON file name since there is no driver name +known to the loader until much later in the Vulkan initialization process. + +For example, to disable all drivers except Nvidia you could do the following: + +``` +set VK_LOADER_DRIVERS_DISABLE=* +set VK_LOADER_DRIVERS_SELECT=*nvidia* +``` + +The loader outputs messages like the following when the environment variables +are used: + +``` +WARNING | DRIVER: Driver "intel_icd.x86_64.json" ignored because not selected by env var 'VK_LOADER_DRIVERS_SELECT' +WARNING | DRIVER: Driver "radeon_icd.x86_64.json" ignored because it was disabled by env var 'VK_LOADER_DRIVERS_DISABLE' +``` + +For more info on how to use the filtering environment variables, refer to the +[Driver Filtering](LoaderDriverInterface.md#driver-filtering) section of the +[LoaderDriverInterface](LoaderDriverInterface.md) document. + diff --git a/docs/LoaderDriverInterface.md b/docs/LoaderDriverInterface.md index 40430fbd83263afbca888cf7b85a4e12646eac34..c8e1872fe71f711bc94bbb62a3e918a4041b8753 100644 --- a/docs/LoaderDriverInterface.md +++ b/docs/LoaderDriverInterface.md @@ -4,22 +4,25 @@ [1]: https://vulkan.lunarg.com/img/Vulkan_100px_Dec16.png "https://www.khronos.org/vulkan/" [2]: https://www.khronos.org/vulkan/ -# Driver interface to the Vulkan Loader +# Driver interface to the Vulkan Loader [![Creative Commons][3]][4] - + [3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License" [4]: https://creativecommons.org/licenses/by-nd/4.0/ -## Table of Contents +## Table of Contents - [Overview](#overview) - [Driver Discovery](#driver-discovery) - [Overriding the Default Driver Discovery](#overriding-the-default-driver-discovery) - [Additional Driver Discovery](#additional-driver-discovery) - - [Exception for Elevated Privileges](#exception-for-elevated-privileges) + - [Driver Filtering](#driver-filtering) + - [Driver Select Filtering](#driver-select-filtering) + - [Driver Disable Filtering](#driver-disable-filtering) + - [Exception for Elevated Privileges](#exception-for-elevated-privileges) - [Examples](#examples) - [On Windows](#on-windows) - [On Linux](#on-linux) @@ -32,10 +35,14 @@ - [Driver Discovery on macOS](#driver-discovery-on-macos) - [Example macOS Driver Search Path](#example-macos-driver-search-path) - [Additional Settings For Driver Debugging](#additional-settings-for-driver-debugging) + - [Driver Discovery using the`VK_LUNARG_direct_driver_loading` extension](#driver-discovery-using-thevk_lunarg_direct_driver_loading-extension) + - [How to use `VK_LUNARG_direct_driver_loading`](#how-to-use-vk_lunarg_direct_driver_loading) + - [Interactions with other driver discovery mechanisms](#interactions-with-other-driver-discovery-mechanisms) + - [Limitations of `VK_LUNARG_direct_driver_loading`](#limitations-of-vk_lunarg_direct_driver_loading) - [Using Pre-Production ICDs or Software Drivers](#using-pre-production-icds-or-software-drivers) - [Driver Discovery on Android](#driver-discovery-on-android) - [Driver Manifest File Format](#driver-manifest-file-format) - - [Driver Manifest File Versions](#driver-manifest-file-versions) + - [Driver Manifest File Versions](#driver-manifest-file-versions) - [Driver Manifest File Version 1.0.0](#driver-manifest-file-version-100) - [Driver Manifest File Version 1.0.1](#driver-manifest-file-version-101) - [Driver Vulkan Entry Point Discovery](#driver-vulkan-entry-point-discovery) @@ -50,18 +57,19 @@ - [Handling KHR Surface Objects in WSI Extensions](#handling-khr-surface-objects-in-wsi-extensions) - [Loader and Driver Interface Negotiation](#loader-and-driver-interface-negotiation) - [Windows, Linux and macOS Driver Negotiation](#windows-linux-and-macos-driver-negotiation) - - [Version Negotiation Between Loader and Drivers](#version-negotiation-between-loader-and-drivers) + - [Version Negotiation Between the Loader and Drivers](#version-negotiation-between-the-loader-and-drivers) - [Interfacing With Legacy Drivers or Loaders](#interfacing-with-legacy-drivers-or-loaders) - - [Loader Version 6 Interface Requirements](#loader-version-6-interface-requirements) - - [Loader Version 5 Interface Requirements](#loader-version-5-interface-requirements) - - [Loader Version 4 Interface Requirements](#loader-version-4-interface-requirements) - - [Loader Version 3 Interface Requirements](#loader-version-3-interface-requirements) - - [Loader Version 2 Interface Requirements](#loader-version-2-interface-requirements) - - [Loader Version 1 Interface Requirements](#loader-version-1-interface-requirements) - - [Loader Version 0 Interface Requirements](#loader-version-0-interface-requirements) + - [Loader and Driver Interface Version 7 Requirements](#loader-and-driver-interface-version-7-requirements) + - [Loader and Driver Interface Version 6 Requirements](#loader-and-driver-interface-version-6-requirements) + - [Loader and Driver Interface Version 5 Requirements](#loader-and-driver-interface-version-5-requirements) + - [Loader and Driver Interface Version 4 Requirements](#loader-and-driver-interface-version-4-requirements) + - [Loader and Driver Interface Version 3 Requirements](#loader-and-driver-interface-version-3-requirements) + - [Loader and Driver Interface Version 2 Requirements](#loader-and-driver-interface-version-2-requirements) + - [Loader and Driver Interface Version 1 Requirements](#loader-and-driver-interface-version-1-requirements) + - [Loader and Driver Interface Version 0 Requirements](#loader-and-driver-interface-version-0-requirements) - [Additional Interface Notes:](#additional-interface-notes) - [Android Driver Negotiation](#android-driver-negotiation) -- [Loader implementation of VK_KHR_portability_enumeration](#loader-implementation-of-vk_khr_portability_enumeration) +- [Loader implementation of VK\_KHR\_portability\_enumeration](#loader-implementation-of-vk_khr_portability_enumeration) - [Loader and Driver Policy](#loader-and-driver-policy) - [Number Format](#number-format) - [Android Differences](#android-differences) @@ -112,8 +120,9 @@ If both `VK_DRIVER_FILES` and `VK_ICD_FILENAMES` environment variables are present, then the newer `VK_DRIVER_FILES` will be used, and the values in `VK_ICD_FILENAMES` will be ignored. -The `VK_DRIVER_FILES` environment variable is a list of Driver Manifest -files, containing the full path to the driver JSON Manifest file. +The `VK_DRIVER_FILES` environment variable is a list of paths to Driver Manifest +files, containing the full path to the driver JSON Manifest file, and/or paths +to folders containing Driver Manifest files. This list is colon-separated on Linux and macOS, and semicolon-separated on Windows. Typically, `VK_DRIVER_FILES` will only contain a full pathname to one info @@ -126,7 +135,8 @@ There may be times that a developer wishes to force the loader to use a specific Driver in addition to the standard drivers (without replacing the standard search paths. The `VK_ADD_DRIVER_FILES` environment variable can be used to add a list of -Driver Manifest files, containing the full path to the driver JSON Manifest file. +Driver Manifest files, containing the full path to the driver JSON Manifest +file, and/or paths to folders containing Driver Manifest files. This list is colon-separated on Linux and macOS, and semicolon-separated on Windows. It will be added prior to the standard driver search files. @@ -134,11 +144,65 @@ If `VK_DRIVER_FILES` or `VK_ICD_FILENAMES` is present, then `VK_ADD_DRIVER_FILES` will not be used by the loader and any values will be ignored. -#### Exception for Elevated Privileges +### Driver Filtering -For security reasons, `VK_ICD_FILENAMES`, `VK_DRIVER_FILES` and -`VK_ADD_DRIVER_FILES` are all ignored if running the Vulkan application with -elevated privileges. +**NOTE:** This functionality is only available with Loaders built with version +1.3.234 of the Vulkan headers and later. + +The loader supports filter environment variables which can forcibly select and +disable known drivers. +Known driver manifests are those files that are already found by the loader +taking into account default search paths and other environment variables (like +`VK_ICD_FILENAMES` or `VK_ADD_DRIVER_FILES`). + +The filter variables will be compared against the driver's manifest filename. + +The filters must also follow the behaviors define in the +[Filter Environment Variable Behaviors](LoaderInterfaceArchitecture.md#filter-environment-variable-behaviors) +section of the [LoaderLayerInterface](LoaderLayerInterface.md) document. + +#### Driver Select Filtering + +The driver select environment variable `VK_LOADER_DRIVERS_SELECT` is a +comma-delimited list of globs to search for in known drivers. + +If a driver is not selected when using the `VK_LOADER_DRIVERS_SELECT` filter, +and loader logging is set to emit either warnings or driver messages, then a +message will show for each driver that has been ignored. +This message will look like the following: + +``` +WARNING | DRIVER: Driver "intel_icd.x86_64.json" ignored because not selected by env var 'VK_LOADER_DRIVERS_SELECT' +``` + +If no drivers are found with a manifest filename that matches any of the +provided globs, then no driver is enabled and may result in failures for +any Vulkan application that is run. + +#### Driver Disable Filtering + +The driver disable environment variable `VK_LOADER_DRIVERS_DISABLE` is a +comma-delimited list of globs to search for in known drivers. + +When a driver is disabled using the `VK_LOADER_DRIVERS_DISABLE` filter, and +loader logging is set to emit either warnings or driver messages, then a message +will show for each driver that has been forcibly disabled. +This message will look like the following: + +``` +WARNING | DRIVER: Driver "radeon_icd.x86_64.json" ignored because it was disabled by env var 'VK_LOADER_DRIVERS_DISABLE' +``` + +If no drivers are found with a manifest filename that matches any of the +provided globs, then no driver is disabled. + +### Exception for Elevated Privileges + +For security reasons, `VK_ICD_FILENAMES`, `VK_DRIVER_FILES`, and +`VK_ADD_DRIVER_FILES` are all ignored if running the Vulkan application +with elevated privileges. +This is because they may insert new libraries into the executable process that +are not normally found by the loader. Because of this, these environment variables can only be used for applications that do not use elevated privileges. @@ -292,9 +356,10 @@ middle. This is because the value of 1 for vendor_b_vk.json disables the driver. Additionally, the Vulkan loader will scan the system for well-known Windows -AppX/MSIX packages. If a package is found, the loader will scan the root directory -of this installed package for JSON manifest files. At this time, the only package -that is known is Microsoft's +AppX/MSIX packages. +If a package is found, the loader will scan the root directory of this installed +package for JSON manifest files. At this time, the only package that is known is +Microsoft's [OpenCL™ and OpenGL® Compatibility Pack](https://apps.microsoft.com/store/detail/9NQPSL29BFFF?hl=en-us&gl=US). The Vulkan loader will open each enabled manifest file found to obtain the name @@ -386,7 +451,7 @@ The loader then selects each path, and applies the "/vulkan/icd.d" suffix onto each and looks in that specific folder for manifest files. The Vulkan loader will open each manifest file found to obtain the name or -pathname of a driver's shared library (".dylib") file. +pathname of a driver's shared library (".so") file. **NOTE** While the order of folders searched for manifest files is well defined, the order contents are read by the loader in each directory is @@ -447,6 +512,17 @@ The order is similar to the search path on Linux with the exception that the application's bundle resources are searched first: `(bundle)/Contents/Resources/`. +System installed drivers will be ignored if drivers are found inside of the app +bundle. +This is because there is not a standard mechanism in which to distinguish drivers +that happen to be duplicates. +For example, MoltenVK is commonly placed inside application bundles. +If there exists a system installed MoltenVK, the loader will load both the app +bundled and the system installed MoltenVK, leading to potential issues or crashes. +Drivers found through environment variables, such as `VK_DRIVER_FILES`, will be +used regardless of whether there are bundled drivers present or not. + + #### Example macOS Driver Search Path For a fictional user "Me" the Driver Manifest search path might look @@ -475,6 +551,117 @@ will expose it and cause the Vulkan loader to fail on loading the driver. It is recommended that `LD_BIND_NOW` along with `VK_LOADER_DEBUG=error,warn` to expose any issues. +### Driver Discovery using the`VK_LUNARG_direct_driver_loading` extension + +The `VK_LUNARG_direct_driver_loading` extension allows for applications to +provide a driver or drivers to the Loader during vkCreateInstance. +This allows drivers to be included with an application without requiring +installation and is capable of being used in any execution environment, such as +a process running with elevated privileges. + +When calling `vkEnumeratePhysicalDevices` with the +`VK_LUNARG_direct_driver_loading` extension enabled, the `VkPhysicalDevice`s +from system installed drivers and environment variable specified drivers will +appear before any `VkPhysicalDevice`s that originate from drivers from the +`VkDirectDriverLoadingListLUNARG::pDrivers` list. + +#### How to use `VK_LUNARG_direct_driver_loading` + +To use this extension, it must first be enabled on the VkInstance. +This requires enabling the `VK_LUNARG_direct_driver_loading` extension through +the `enabledExtensionCount` and `ppEnabledExtensionNames`members of +`VkInstanceCreateInfo`. + +```c +const char* extensions[] = {VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME, }; +VkInstanceCreateInfo instance_create_info = {}; +instance_create_info.enabledExtensionCount = ; +instance_create_info.ppEnabledExtensionNames = extensions; +``` + +The `VkDirectDriverLoadingInfoLUNARG` structure contains a +`VkDirectDriverLoadingFlagsLUNARG` member (reserved for future use) and a +`PFN_vkGetInstanceProcAddrLUNARG` member which provides the loader with the +function pointer for the driver's `vkGetInstanceProcAddr`. + +The `VkDirectDriverLoadingListLUNARG` structure contains a count and pointer +members which provide the size of and pointer to an application provided array of +`VkDirectDriverLoadingInfoLUNARG` structures. + +Creating those structures looks like the following +```c +VkDirectDriverLoadingInfoLUNARG direct_loading_info = {}; +direct_loading_info.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_INFO_LUNARG +direct_loading_info.pfnGetInstanceProcAddr = + +VkDirectDriverLoadingListLUNARG direct_driver_list = {}; +direct_driver_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; +direct_driver_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; // or VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG +direct_driver_list.driverCount = 1; +direct_driver_list.pDrivers = &direct_loading_info; // can include multiple drivers here if so desired +``` + +The `VkDirectDriverLoadingListLUNARG` structure contains the enum +`VkDirectDriverLoadingModeLUNARG`. +There are two modes: +* `VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG` - specifies that the only drivers +to be loaded will come from the `VkDirectDriverLoadingListLUNARG` structure. +* `VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG` - specifies that drivers +from the `VkDirectDriverLoadingModeLUNARG` structure will be used in addition to +any system installed drivers and environment variable specified drivers. + + + +Then, the `VkDirectDriverLoadingListLUNARG` structure *must* be appended to the +`pNext` chain of `VkInstanceCreateInfo`. + +```c +instance_create_info.pNext = (const void*)&direct_driver_list; +``` + +Finally, create the instance like normal. + +#### Interactions with other driver discovery mechanisms + +If the `VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG` mode is specified in the +`VkDirectDriverLoadingListLUNARG` structure, then no system installed drivers +are loaded. +This applies equally to all platforms. +Additionally, the following environment variables have no effect: + +* `VK_DRIVER_FILES` +* `VK_ICD_FILENAMES` +* `VK_ADD_DRIVER_FILES` +* `VK_LOADER_DRIVERS_SELECT` +* `VK_LOADER_DRIVERS_DISABLE` + +Exclusive mode will also disable MacOS bundle manifest discovery of drivers. + +#### Limitations of `VK_LUNARG_direct_driver_loading` + +Because `VkDirectDriverLoadingListLUNARG` is provided to the loader at instance +creation, there is no mechanism for the loader to query the list of instance +extensions that originate from `VkDirectDriverLoadingListLUNARG` drivers during +`vkEnumerateInstanceExtensionProperties`. +Applications can instead manually load the `vkEnumerateInstanceExtensionProperties` +function pointer directly from the drivers the application provides to the loader +using the `pfnGetInstanceProcAddrLUNARG` for each driver. +Then the application can call each driver's +`vkEnumerateInstanceExtensionProperties` and append non-duplicate entriees to the +list from the loader's `vkEnumerateInstanceExtensionProperties` to get the full +list of supported instance extensions. +Alternatively, because the Application is providing drivers, it is reasonable for +the application to already know which instance extensions are available with the +provided drivers, preventing the need to manually query them. + +However, there are limitations. +If there are any active implicit layers which intercept +`vkEnumerateInstanceExtensionProperties` to remove unsupported extensions, then +those layers will not be able to remove unsupported extensions from drivers that +are provided by the application. +This is due to `vkEnumerateInstanceExtensionProperties` not having a mechanism +to extend it. + ### Using Pre-Production ICDs or Software Drivers @@ -510,7 +697,8 @@ The loader will load the driver via `hw_get_module` with the ID of "vulkan". ## Driver Manifest File Format -The following section discusses the details of the Driver Manifest JSON file format. +The following section discusses the details of the Driver Manifest JSON file +format. The JSON file itself does not have any requirements for naming. The only requirement is that the extension suffix of the file is ".json". @@ -569,18 +757,18 @@ Here is an example driver JSON Manifest file: "api_version" The major.minor.patch version number of the maximum Vulkan API supported by the driver. - However, just because the driver supports the specific Vulkan API version, - it does not guarantee that the hardware on a user's system can support - that version. + However, just because the driver supports the specific Vulkan API + version, it does not guarantee that the hardware on a user's system can + support that version. Information on what the underlying physical device can support must be - queried by the user using the vkGetPhysicalDeviceProperties API call. -
+ queried by the user using the vkGetPhysicalDeviceProperties API + call.
For example: 1.0.33. "is_portability_driver" - Defines whether the driver contains any VkPhysicalDevices which implement - the VK_KHR_portability_subset extension.
+ Defines whether the driver contains any VkPhysicalDevices which + implement the VK_KHR_portability_subset extension.
@@ -742,11 +930,17 @@ missing support for this extension. ## Driver Unknown Physical Device Extensions Drivers that implement entrypoints which take a `VkPhysicalDevice` as the first -parameter *should* support `vk_icdGetPhysicalDeviceProcAddr`. This function -is added to the Driver Interface Version 4 and allows the loader to distinguish -between entrypoints which take `VkDevice` and `VkPhysicalDevice` as the first -parameter. This allows the loader to properly support entrypoints that are -unknown to it gracefully. +parameter *should* support `vk_icdGetPhysicalDeviceProcAddr`. +This function is added to the Loader and Driver Driver Interface Version 4, +allowing the loader to distinguish between entrypoints which take `VkDevice` +and `VkPhysicalDevice` as the first parameter. +This allows the loader to properly support entrypoints that are unknown to it +gracefully. +This entry point is not a part of the Vulkan API itself, only a private +interface between the loader and drivers. +Note: Loader and Driver Interface Version 7 makes exporting +`vk_icdGetPhysicalDeviceProcAddr` optional. +Instead, drivers *must* expose it through `vk_icdGetInstanceProcAddr`. ```cpp PFN_vkVoidFunction @@ -762,13 +956,13 @@ In this way, it compares "pName" to every physical device function supported in the driver. Implementations of the function should have the following behavior: -* If `pName` is the name of a Vulkan API entrypoint that takes a `VkPhysicalDevice` - as its primary dispatch handle, and the driver supports the entrypoint, then - the driver **must** return the valid function pointer to the driver's - implementation of that entrypoint. -* If `pName` is the name of a Vulkan API entrypoint that takes something other than - a `VkPhysicalDevice` as its primary dispatch handle, then the driver **must** - return `NULL`. +* If `pName` is the name of a Vulkan API entrypoint that takes a + `VkPhysicalDevice` as its primary dispatch handle, and the driver supports the + entrypoint, then the driver **must** return the valid function pointer to the + driver's implementation of that entrypoint. +* If `pName` is the name of a Vulkan API entrypoint that takes something other + than a `VkPhysicalDevice` as its primary dispatch handle, then the driver + **must** return `NULL`. * If the driver is unaware of any entrypoint with the name `pName`, it **must** return `NULL`. @@ -782,7 +976,9 @@ function. If a driver does implement this support, it must export the function from the driver library using the name `vk_icdGetPhysicalDeviceProcAddr` so that the -symbol can be located through the platform's dynamic linking utilities. +symbol can be located through the platform's dynamic linking utilities, or if +the driver supports Loader and Driver Interface Version 7, exposed through +`vk_icdGetInstanceProcAddr` instead. The behavior of the loader's `vkGetInstanceProcAddr` with support for the `vk_icdGetPhysicalDeviceProcAddr` function is as follows: @@ -848,10 +1044,15 @@ preference will be listed first. This mechanism does not force an application to use any particular GPU — it merely changes the order in which they are presented. -This mechanism requires that a driver provide version 6 of the loader/driver -interface. -Version 6 of this interface defines a new exported function that the driver may -provide on Windows: +This mechanism requires that a driver provide The Loader and Driver Interface +Version 6. +This version defines a new exported function, `vk_icdEnumerateAdapterPhysicalDevices`, +detailed below, that Drivers may provide on Windows. +This entry point is not a part of the Vulkan API itself, only a private +interface between the loader and drivers. +Note: Loader and Driver Interface Version 7 makes exporting +`vk_icdEnumerateAdapterPhysicalDevices` optional. +Instead, drivers *must* expose it through `vk_icdGetInstanceProcAddr`. ```c VKAPI_ATTR VkResult VKAPI_CALL @@ -862,6 +1063,7 @@ VKAPI_ATTR VkResult VKAPI_CALL VkPhysicalDevice* pPhysicalDevices); ``` + This function takes an adapter LUID as input, and enumerates all Vulkan physical devices that are associated with that LUID. This works in the same way as other Vulkan enumerations — if @@ -886,6 +1088,14 @@ of Windows 10 that support GPU selection through the OS. Other platforms may be included in the future, but they will require separate platform-specific interfaces. +A requirement of `vk_icdEnumerateAdapterPhysicalDevices` is that it *must* +return the same `VkPhysicalDevice` handle values for the same physical +devices that are returned by `vkEnumeratePhysicalDevices`. +This is because the loader calls both functions on the driver then +de-duplicates the physical devices using the `VkPhysicalDevice` handles. +Since not all physical devices in a driver will have a LUID, such as for +software implementations, this step is necessary to allow drivers to +enumerate all available physical devices. ## Driver Dispatchable Object Creation @@ -966,8 +1176,8 @@ appropriate `VkIcdSurfaceXXX` structure. The driver may choose to handle `VkSurfaceKHR` object creation instead. If a driver desires to handle creating and destroying it must do the following: - 1. Support version 3 or newer of the loader/driver interface. - 2. Export and handle all functions that take in a `VkSurfaceKHR` object, + 1. Support Loader and Driver Interface Version 3 or newer. + 2. Expose and handle all functions that take in a `VkSurfaceKHR` object, including: * `vkCreateXXXSurfaceKHR` * `vkGetPhysicalDeviceSurfaceSupportKHR` @@ -1010,13 +1220,16 @@ These additional requirements are versioned to allow flexibility in the future. ### Windows, Linux and macOS Driver Negotiation -#### Version Negotiation Between Loader and Drivers +#### Version Negotiation Between the Loader and Drivers -All drivers (supporting interface version 2 or higher) must export the -following function that is used for determination of the interface version that -will be used. +All drivers supporting Loader and Driver Interface Version 2 or higher must +export the following function that is used for determination of the interface +version that will be used. This entry point is not a part of the Vulkan API itself, only a private interface between the loader and drivers. +Note: Loader and Driver Interface Version 7 makes exporting +`vk_icdNegotiateLoaderICDInterfaceVersion` optional. +Instead, drivers *must* expose it through `vk_icdGetInstanceProcAddr`. ```cpp VKAPI_ATTR VkResult VKAPI_CALL @@ -1060,19 +1273,50 @@ during enumeration. #### Interfacing With Legacy Drivers or Loaders -If a loader sees that a driver does not export the +If a loader sees that a driver does not export or expose the `vk_icdNegotiateLoaderICDInterfaceVersion` function, then the loader assumes the corresponding driver only supports either interface version 0 or 1. From the other side of the interface, if a driver sees a call to `vk_icdGetInstanceProcAddr` before a call to -`vk_icdNegotiateLoaderICDInterfaceVersion`, then it knows that loader making the -calls is a legacy loader supporting version 0 or 1. -If the loader calls `vk_icdGetInstanceProcAddr` first, it supports at least -version 1. +`vk_icdNegotiateLoaderICDInterfaceVersion`, then the loader is either a legacy +loader with only support for interface version 0 or 1, or the loader is using +interface version 7 or newer. + +If the first call to `vk_icdGetInstanceProcAddr` is to query for +`vk_icdNegotiateLoaderICDInterfaceVersion`, then that means the loader is using +interface version 7. +This only occurs when the driver does not export +`vk_icdNegotiateLoaderICDInterfaceVersion`. +Drivers which export `vk_icdNegotiateLoaderICDInterfaceVersion` will have it +called first. + +If the first call to `vk_icdGetInstanceProcAddr` is **not** querying for +`vk_icdNegotiateLoaderICDInterfaceVersion`, then loader is a legacy loader only +which supports version 0 or 1. +In this case, if the loader calls `vk_icdGetInstanceProcAddr` first, it supports +at least interface version 1. Otherwise, the loader only supports version 0. -#### Loader Version 6 Interface Requirements +#### Loader and Driver Interface Version 7 Requirements + +Version 7 relaxes the requirement that Loader and Driver Interface functions +must be exported. +Instead, it only requires that those functions be queryable through +`vk_icdGetInstanceProcAddr`. +The functions are: + `vk_icdNegotiateLoaderICDInterfaceVersion` + `vk_icdGetPhysicalDeviceProcAddr` + `vk_icdEnumerateAdapterPhysicalDevices` (Windows only) +These functions are considered global for the purposes of retrieval, so the +`VkInstance` parameter of `vk_icdGetInstanceProcAddr` will be **NULL**. +While exporting these functions is no longer a requirement, drivers may still +export them for compatibility with older loaders. +The changes in this version allow drivers provided through the +`VK_LUNARG_direct_driver_loading` extension to support the entire Loader and +Driver Interface. + +#### Loader and Driver Interface Version 6 Requirements Version 6 provides a mechanism to allow the loader to sort physical devices. The loader will only attempt to sort physical devices on a driver if version 6 @@ -1080,9 +1324,9 @@ of the interface is supported. This version provides the `vk_icdEnumerateAdapterPhysicalDevices` function defined earlier in this document. -#### Loader Version 5 Interface Requirements +#### Loader and Driver Interface Version 5 Requirements -Version 5 of the loader/driver interface has no changes to the actual interface. +This interface version has no changes to the actual interface. If the loader requests interface version 5 or greater, it is simply an indication to drivers that the loader is now evaluating whether the API Version info passed into vkCreateInstance is a valid version for the loader. @@ -1139,10 +1383,9 @@ Here is a table of the expected behaviors: -#### Loader Version 4 Interface Requirements +#### Loader and Driver Interface Version 4 Requirements -The major change to version 4 of the loader/driver interface is the -support of +The major change to version 4 of this interface version is the support of [Unknown Physical Device Extensions](#driver-unknown-physical-device-extensions) using the `vk_icdGetPhysicalDeviceProcAddr` function. This function is purely optional. @@ -1152,16 +1395,16 @@ Otherwise, the loader will continue to treat any unknown functions as VkDevice functions and cause invalid behavior. -#### Loader Version 3 Interface Requirements +#### Loader and Driver Interface Version 3 Requirements -The primary change that occurred in version 3 of the loader/driver interface was -to allow a driver to handle creation/destruction of their own KHR_surfaces. +The primary change that occurred in this interface version is to allow a driver +to handle creation and destruction of their own KHR_surfaces. Up until this point, the loader created a surface object that was used by all drivers. -However, some drivers may want to provide their own surface handles. -If a driver chooses to enable this support, it must export support for version 3 -of the loader/driver interface, as well as any Vulkan function that uses a -KHR_surface handle, such as: +However, some drivers *may* want to provide their own surface handles. +If a driver chooses to enable this support, it must support Loader and Driver +Interface Version 3, as well as any Vulkan function that uses a `VkSurfaceKHR` +handle, such as: - `vkCreateXXXSurfaceKHR` (where XXX is the platform-specific identifier [i.e. `vkCreateWin32SurfaceKHR` for Windows]) - `vkDestroySurfaceKHR` @@ -1171,25 +1414,24 @@ KHR_surface handle, such as: - `vkGetPhysicalDeviceSurfaceFormatsKHR` - `vkGetPhysicalDeviceSurfacePresentModesKHR` -A driver can still choose to not take advantage of this functionality -by simply not exposing the above `vkCreateXXXSurfaceKHR` and +A driver which does not participate in this functionality can opt out by +simply not exposing the above `vkCreateXXXSurfaceKHR` and `vkDestroySurfaceKHR` functions. -#### Loader Version 2 Interface Requirements +#### Loader and Driver Interface Version 2 Requirements -Version 2 interface is the first to implement the new -`vk_icdNegotiateLoaderICDInterfaceVersion` functionality, see -[Version Negotiation Between Loader and Drivers](#version-negotiation-between-loader-and-drivers) for more details -on that function. +Interface Version 2 requires that drivers export +`vk_icdNegotiateLoaderICDInterfaceVersion`. +For more information, see [Version Negotiation Between Loader and Drivers](#version-negotiation-between-loader-and-drivers). -Additional, version 2 was the first to define that Vulkan dispatchable objects -created by drivers must now be created in accordance to the +Additional, version 2 requires that Vulkan dispatchable objects created by +drivers must be created in accordance to the [Driver Dispatchable Object Creation](#driver-dispatchable-object-creation) section. -#### Loader Version 1 Interface Requirements +#### Loader and Driver Interface Version 1 Requirements Version 1 of the interface added the driver-specific entry-point `vk_icdGetInstanceProcAddr`. @@ -1204,14 +1446,14 @@ No other entry-points need to be exported by the driver as the loader will query the appropriate function pointers using that. -#### Loader Version 0 Interface Requirements +#### Loader and Driver Interface Version 0 Requirements -Version 0 interface does not support either `vk_icdGetInstanceProcAddr` or +Version 0 does not support either `vk_icdGetInstanceProcAddr` or `vk_icdNegotiateLoaderICDInterfaceVersion`. Because of this, the loader will assume the driver supports only version 0 of the interface unless one of those functions exists. -Additionally, for version 0, the driver must expose at least the following core +Additionally, for Version 0, the driver must expose at least the following core Vulkan entry-points so the loader may build up the interface to the driver: - The function `vkGetInstanceProcAddr` **must be exported** in the driver @@ -1257,12 +1499,13 @@ manifest files used by the Windows, Linux and macOS loaders. The loader implements the `VK_KHR_portability_enumeration` instance extension, which filters out any drivers that report support for the portability subset device extension. Unless the application explicitly requests enumeration of -portability devices by setting the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR -bit in the VkInstanceCreateInfo::flags, the loader does not load any drivers -that declare themselves to be portability drivers. +portability devices by setting the +`VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` bit in the +VkInstanceCreateInfo::flags, the loader does not load any drivers that declare +themselves to be portability drivers. -Drivers declare whether they are portability drivers or not in the Driver Manifest -Json file, with the `is_portability_driver` boolean field. +Drivers declare whether they are portability drivers or not in the Driver +Manifest Json file, with the `is_portability_driver` boolean field. [More information here](#driver-manifest-file-version-101) The initial support for this extension only reported errors when an application @@ -1292,8 +1535,8 @@ best experience to end-users and developers. ### Number Format -Loader/Driver policy items start with the prefix `LDP_` (short for -Loader/Driver Policy) which is followed by an identifier based on what +Loader and Driver policy items start with the prefix `LDP_` (short for +Loader and Driver Policy) which is followed by an identifier based on what component the policy is targeted against. In this case there are only two possible components: - Drivers: which will have the string `DRIVER_` as part of the policy number. @@ -1355,7 +1598,7 @@ Android Vulkan documentation. LDP_DRIVER_3 A driver must be able to negotiate a supported version of the - loader/driver interface with the loader in accordance with the stated + Loader and Driver Interface with the loader in accordance with the stated negotiation process. The driver will not be loaded. @@ -1397,14 +1640,15 @@ Android Vulkan documentation. possibly including crashes or corruption. - + Vulkan CTS Documentation LDP_DRIVER_6 - Removed - See Removed Driver Policies + Removed - See + Removed Driver Policies - - @@ -1414,7 +1658,7 @@ Android Vulkan documentation. LDP_DRIVER_7 If a driver desires to support Vulkan API 1.1 or newer, it must - expose support of Vulkan loader/driver interface 5 or newer. + expose support for Loader and Driver Interface Version 5 or newer. The driver will be used when it shouldn't be and will cause undefined behavior possibly including crashes or corruption. @@ -1429,7 +1673,7 @@ Android Vulkan documentation. LDP_DRIVER_8 If a driver wishes to handle its own VkSurfaceKHR object - creation, it must implement loader/driver interface version 3 or + creation, it must implement the Loader and Driver Interface Version 3 or newer and support querying all the relevant surface functions via vk_icdGetInstanceProcAddr. @@ -1443,15 +1687,15 @@ Android Vulkan documentation. LDP_DRIVER_9 - If a driver negotiation results in it using loader/driver interface - version 4 or earlier, the driver must verify that the Vulkan API - version passed into vkCreateInstance (through + If version negotiation results in a driver using the Loader + and Driver Interface Version 4 or earlier, the driver must verify + that the Vulkan API version passed into vkCreateInstance (through VkInstanceCreateInfo’s VkApplicationInfo's apiVersion) is supported. If the requested Vulkan API version can not be supported by the driver, it must return VK_ERROR_INCOMPATIBLE_DRIVER.
This is not required if the interface version is 5 or newer because the - responsibility for this check then falls on the loader. + loader is responsible for this check. The behavior is undefined and may result in crashes or corruption. No @@ -1463,11 +1707,13 @@ Android Vulkan documentation. LDP_DRIVER_10 - If a driver negotiation results in it using loader/driver interface - version 5 or newer, the driver must ignore the Vulkan API version + If version negotiation results in a driver using the Loader and Driver Interface + Version 5 or newer, the driver must not return + VK_ERROR_INCOMPATIBLE_DRIVER if the Vulkan API version passed into vkCreateInstance (through VkInstanceCreateInfo’s VkApplicationInfo's - apiVersion). + apiVersion) is not supported by the driver. This check is performed + by the loader on the drivers behalf. The behavior is undefined and may result in crashes or corruption. No @@ -1515,7 +1761,8 @@ Android Vulkan documentation. #### Removed Driver Policies -These policies were in the loader source at some point but later removed. They are documented here for reference. +These policies were in the loader source at some point but later removed. +They are documented here for reference. @@ -1525,7 +1772,7 @@ These policies were in the loader source at some point but later removed. They a - - diff --git a/docs/LoaderInterfaceArchitecture.md b/docs/LoaderInterfaceArchitecture.md index 66d38e65831860b0c395edb3cd05c76002d07b6f..dc9347b990ba3dc3a4ddf8df3aa8e403b2bf178a 100644 --- a/docs/LoaderInterfaceArchitecture.md +++ b/docs/LoaderInterfaceArchitecture.md @@ -4,14 +4,14 @@ [1]: https://vulkan.lunarg.com/img/Vulkan_100px_Dec16.png "https://www.khronos.org/vulkan/" [2]: https://www.khronos.org/vulkan/ -# Architecture of the Vulkan Loader Interfaces +# Architecture of the Vulkan Loader Interfaces [![Creative Commons][3]][4] - + [3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License" [4]: https://creativecommons.org/licenses/by-nd/4.0/ -## Table of Contents +## Table of Contents - [Overview](#overview) - [Who Should Read This Document](#who-should-read-this-document) @@ -38,8 +38,17 @@ - [Application Interface to the Loader](#application-interface-to-the-loader) - [Layer Interface with the Loader](#layer-interface-with-the-loader) - [Driver Interface With the Loader](#driver-interface-with-the-loader) +- [Debugging Issues](#debugging-issues) - [Loader Policies](#loader-policies) +- [Filter Environment Variable Behaviors](#filter-environment-variable-behaviors) + - [Comparison Strings](#comparison-strings) + - [Comma-Delimited Lists](#comma-delimited-lists) + - [Globs](#globs) + - [Case-Insensitive](#case-insensitive) + - [Environment Variable Priority](#environment-variable-priority) - [Table of Debug Environment Variables](#table-of-debug-environment-variables) + - [Active Environment Variables](#active-environment-variables) + - [Deprecated Environment Variables](#deprecated-environment-variables) - [Glossary of Terms](#glossary-of-terms) ## Overview @@ -217,7 +226,7 @@ In the future, VkConfig may have additional interactions with the Vulkan loader. More details on VkConfig can be found in its -[GitHub documentation](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md). +[GitHub documentation](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/README.md).

@@ -374,7 +383,7 @@ layers to marshall the appropriate information to all available drivers. For example, the diagram below represents what happens in the call chain for `vkCreateInstance`. After initializing the chain, the loader calls into the first layer's -`vkCreateInstance`, which will call the next layer's `vkCreateInstance +`vkCreateInstance`, which will call the next layer's `vkCreateInstance` before finally terminating in the loader again where it will call every driver's `vkCreateInstance`. This allows every enabled layer in the chain to set up what it needs based on @@ -458,6 +467,17 @@ directory as this file.
+## Debugging Issues + + +If your application is crashing or behaving weirdly, the loader provides +several mechanisms for you to debug the issues. +These are detailed in the [LoaderDebugging.md](LoaderDebugging.md) document +found in the same directory as this file. +
+
+ + ## Loader Policies Loader policies with regards to the loader interaction with drivers and layers @@ -478,6 +498,62 @@ sections listed below:

+## Filter Environment Variable Behaviors + +The filter environment variables provided in certain areas have some common +restrictions and behaviors that should be listed. + +### Comparison Strings + +The filter variables will be compared against the appropriate strings for either +drivers or layers. +The appropriate string for layers is the layer name provided in the layer's +manifest file. +Since drivers don’t have a name like layers, this substring is used to compare +against the driver manifest's filename. + +### Comma-Delimited Lists + +All of the filter environment variables accept comma-delimited input. +Therefore, you can chain multiple strings together and it will use the strings +to individually enable or disable the appropriate item in the current list of +available items. + +### Globs + +To provide enough flexibility to limit name searches to only those wanted by the +developer, the loader uses a limited glob format for strings. +Acceptable globs are: + - Prefixes: `"string*"` + - Suffixes: `"*string"` + - Substrings: `"*string*"` + - Whole strings: `"string"` + - In the case of whole strings, the string will be compared against each + layer or driver file name in its entirety. + - Because of this, it will only match the specific target such as: + `VK_LAYER_KHRONOS_validation` will match the layer name + `VK_LAYER_KHRONOS_validation`, but **not** a layer named + `VK_LAYER_KHRONOS_validation2` (not that there is such a layer). + +This is especially useful because it is difficult sometimes to determine the +full name of a driver manifest file or even some commonly used layers +such as `VK_LAYER_KHRONOS_validation`. + +### Case-Insensitive + +All of the filter environment variables assume the strings inside of the glob +are not case-sensitive. +Therefore, “Bob”, “bob”, and “BOB” all amount to the same thing. + +### Environment Variable Priority + +The values from the *disable* environment variable will be considered +**before** the *enable* or *select* environment variable. +Because of this, it is possible to disable a layer/driver using the *disable* +environment variable, only to have it be re-enabled by the *enable*/*select* +environment variable. +This is useful if you disable all layers/drivers with the intent of only +enabling a smaller subset of specific layers/drivers for issue triaging. ## Table of Debug Environment Variables @@ -556,14 +632,15 @@ discovery. + VK_LAYER_PATH + VK_LOADER_DEBUG + @@ -679,30 +761,179 @@ discovery. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LDP_DRIVER_6A driver supporting loader/driver interface version 1 or newer must + A driver supporting Loader and Driver Interface Version 1 or newer must not directly export standard Vulkan entry-points.
Instead, it must export only the loader interface functions @@ -1611,7 +1858,7 @@ These policies were in the loader source at some point but later removed. They a
LDP_LOADER_5 A loader must ignore any driver for which a compatible - loader/driver interface version can not be negotiated. + Loader and Driver Interface Version can not be negotiated. The loader would load a driver improperly resulting in undefined behavior possibly including crashes or corruption. @@ -1624,16 +1871,16 @@ These policies were in the loader source at some point but later removed. They a
LDP_LOADER_6If a driver negotiation results in it using loader/driver interface - version 5 or newer, a loader must verify that the Vulkan API - version passed into vkCreateInstance (through + If a driver negotiation results in the loader using Loader and Driver + Interface Version 5 or newer, a loader must verify that the Vulkan + API version passed into vkCreateInstance (through VkInstanceCreateInfo’s VkApplicationInfo's apiVersion) is supported by at least one driver. If the requested Vulkan API version can not be supported by any driver, the loader must return VK_ERROR_INCOMPATIBLE_DRIVER.
- This is not required if the interface version is 4 or earlier because - the responsibility for this check then falls on the drivers. + This is not required if the Loader and Driver Interface Version is 4 or + earlier because the responsibility for this check falls on the drivers.
The behavior is undefined and may result in crashes or corruption. No Force the loader to use the specific driver JSON files. The value contains a list of delimited full path listings to - driver JSON Manifest files.
+ driver JSON Manifest files and/or + paths to folders containing driver JSON files.

This has replaced the older deprecated environment variable VK_ICD_FILENAMES, however the older environment variable will - continue to work for some time. + continue to work.
- If a global path to the JSON file is not used, issues may be encountered. + If a relative path not used, issues may be encountered.

Ignored when running Vulkan application with elevated privileges. @@ -582,46 +659,51 @@ discovery.
- VK_INSTANCE_LAYERS - - Force the loader to add the given layers to the list of Enabled layers - normally passed into vkCreateInstance. - These layers are added first, and the loader will remove any duplicate - layers that appear in both this list as well as that passed into - ppEnabledLayerNames. + Override the loader's standard Layer library search folders and use the + provided delimited file and/or folders to locate explicit layer manifest files. - None + + Ignored when running Vulkan application with elevated privileges. + export
-   VK_INSTANCE_LAYERS=
-      <layer_a>:<layer_b>

+   VK_LAYER_PATH=
+      <path_a>:<path_b>

set
-   VK_INSTANCE_LAYERS=
-      <layer_a>;<layer_b> +   VK_LAYER_PATH=
+      <path_a>;<path_b>
- VK_LAYER_PATH - Override the loader's standard Layer library search folders and use the - provided delimited folders to search for explicit layer manifest files. + Enable loader debug messages using a comma-delimited list of level + options. These options are:
+   * error (only errors)
+   * warn (only warnings)
+   * info (only info)
+   * debug (only debug)
+   * layer (layer-specific output)
+   * driver (driver-specific output)
+   * all (report out all messages)

+ To enable multiple options (outside of "all") like info, warning and + error messages, set the value to "error,warn,info".
- - Ignored when running Vulkan application with elevated privileges. - + None export
-   VK_LAYER_PATH=
-      <path_a>:<path_b>

+   VK_LOADER_DEBUG=all
+
set
-   VK_LAYER_PATH=
-      <path_a>;<path_b> +   VK_LOADER_DEBUG=warn
- VK_LOADER_DEBUG + VK_LOADER_DRIVERS_SELECT - Enable loader debug messages using a comma-delimited list of level - options. These options are:
-   * error (only errors)
-   * warn (only warnings)
-   * info (only info)
-   * debug (only debug)
-   * layer (layer-specific output)
-   * driver (driver-specific output)
-   * all (report out all messages)

- To enable multiple options (outside of "all") like info, warning and - error messages, set the value to "error,warn,info". + A comma-delimited list of globs to search for in known drivers and + used to select only the drivers whose manifest file names match one or + more of the provided globs.
+ Since drivers don’t have a name like layers, this glob is used to + compare against the manifest filename. + Known driver manifests being those files that are already found by the + loader taking into account default search paths and other environment + variables (like VK_ICD_FILENAMES or VK_ADD_DRIVER_FILES).
- None + This functionality is only available with Loaders built with version + 1.3.234 of the Vulkan headers and later.
+ If no drivers are found with a manifest filename that matches any of the + provided globs, then no driver is enabled and it may result + in Vulkan applications failing to run properly.
export
-   VK_LOADER_DEBUG=all
+   VK_LOADER_DRIVERS_SELECT=nvidia*

set
-   VK_LOADER_DEBUG=warn +   VK_LOADER_DRIVERS_SELECT=nvidia*

+ The above would select only the Nvidia driver if it was present on the + system and already visible to the loader. +
+ VK_LOADER_DRIVERS_DISABLE + + A comma-delimited list of globs to search for in known drivers and + used to disable only the drivers whose manifest file names match one or + more of the provided globs.
+ Since drivers don’t have a name like layers, this glob is used to + compare against the manifest filename. + Known driver manifests being those files that are already found by the + loader taking into account default search paths and other environment + variables (like VK_ICD_FILENAMES or VK_ADD_DRIVER_FILES). +
+ This functionality is only available with Loaders built with version + 1.3.234 of the Vulkan headers and later.
+ If all available drivers are disabled using this environment variable, + then no drivers will be found by the loader and will result + in Vulkan applications failing to run properly.
+ This is also checked before other driver environment variables (such as + VK_LOADER_DRIVERS_SELECT) so that a user may easily disable all + drivers and then selectively re-enable individual drivers using the + enable environment variable. +
+ export
+   VK_LOADER_DRIVERS_DISABLE=*amd*,*intel*
+
+ set
+   VK_LOADER_DRIVERS_DISABLE=*amd*,*intel*

+ The above would disable both Intel and AMD drivers if both were present + on the system and already visible to the loader. +
+ VK_LOADER_LAYERS_ENABLE + + A comma-delimited list of globs to search for in known layers and + used to select only the layers whose layer name matches one or more of + the provided globs.
+ Known layers are those which are found by the loader taking into account + default search paths and other environment variables + (like VK_LAYER_PATH). +
+ This has replaced the older deprecated environment variable + VK_INSTANCE_LAYERS +
+ This functionality is only available with Loaders built with version + 1.3.234 of the Vulkan headers and later. + + export
+   VK_LOADER_LAYERS_ENABLE=*validation,*recon*
+
+ set
+   VK_LOADER_LAYERS_ENABLE=*validation,*recon*

+ The above would enable the Khronos validation layer and the + GfxReconstruct layer, if both were present on the system and already + visible to the loader. +
+ VK_LOADER_LAYERS_DISABLE + + A comma-delimited list of globs to search for in known layers and + used to disable only the layers whose layer name matches one or more of + the provided globs.
+ Known layers are those which are found by the loader taking into account + default search paths and other environment variables + (like VK_LAYER_PATH). +
+ This functionality is only available with Loaders built with version + 1.3.234 of the Vulkan headers and later.
+ Disabling a layer that an application intentionally enables as an + explicit layer may cause the application to not function + properly.
+ This is also checked before other layer environment variables (such as + VK_LOADER_LAYERS_ENABLE) so that a user may easily disable all + layers and then selectively re-enable individual layers using the + enable environment variable. +
+ export
+   VK_LOADER_LAYERS_DISABLE=*MESA*,~implicit~
+
+ set
+   VK_LOADER_LAYERS_DISABLE=*MESA*,~implicit~

+ The above would disable any Mesa layer and all other implicit layers + that would normally be enabled on the system. +
+ VK_LOADER_LAYERS_ALLOW + + A comma-delimited list of globs to search for in known layers and + used to prevent layers whose layer name matches one or more of + the provided globs from being disabled by VK_LOADER_LAYERS_DISABLE.
+ Known layers are those which are found by the loader taking into account + default search paths and other environment variables + (like VK_LAYER_PATH). +
+ This functionality is only available with Loaders built with version + 1.3.262 of the Vulkan headers and later.
+ This will not cause layers to be enabled if the normal mechanism to + enable them +
+ export
+   VK_LOADER_LAYERS_ALLOW=*validation*,*recon*
+
+ set
+   VK_LOADER_LAYERS_ALLOW=*validation*,*recon*

+ The above would allow any layer whose name is validation or recon to be + enabled regardless of the value of VK_LOADER_LAYERS_DISABLE. +
+ VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING + + If set to "1", causes the loader to not unload dynamic libraries during vkDestroyInstance. + This option allows leak sanitizers to have full stack traces. + + This functionality is only available with Loaders built with version + 1.3.259 of the Vulkan headers and later.
+
+ export
+   VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING=1
+
+ set
+   VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING=1

@@ -750,6 +981,34 @@ may be removed in a future loader release.      \nvidia.json;\mesa.json + + + VK_INSTANCE_LAYERS + + + Force the loader to add the given layers to the list of Enabled layers + normally passed into vkCreateInstance. + These layers are added first, and the loader will remove any duplicate + layers that appear in both this list as well as that passed into + ppEnabledLayerNames. + + + This has been deprecated by VK_LOADER_LAYERS_ENABLE. + It also overrides any layers disabled with + VK_LOADER_LAYERS_DISABLE. + + + None + + + export
+   VK_INSTANCE_LAYERS=
+      <layer_a>;<layer_b>

+ set
+   VK_INSTANCE_LAYERS=
+      <layer_a>;<layer_b> +
+

@@ -814,8 +1073,8 @@ may be removed in a future loader release. Discovery The process of the loader searching for driver and layer files to set up the internal list of Vulkan objects available.
- On Windows/Linux/macOS, the discovery process typically focuses on - searching for Manifest files.
+ On Windows/Linux/macOS, the discovery process typically focuses + on searching for Manifest files.
On Android, the process focuses on searching for library files. @@ -982,4 +1241,31 @@ may be removed in a future loader release. for more information. + + Exported Function + A function which is intended to be obtained through the platform specific + dynamic linker, specifically from a Driver or a Layer library. + Functions that are required to be exported are primarily the very first + functions the Loader calls on a Layer or Driver library.
+ + + + Exposed Function + A function which is intended to be obtained through a Querying Function, such as + `vkGetInstanceProcAddr`. + The exact Querying Function required for a specific exposed function varies + between Layers and Drivers, as well as between interface versions.
+ + + + Querying Functions + These are functions which allow the Loader to query other functions from + drivers and layers. These functions may be in the Vulkan API but also may be + from the private Loader and Driver Interface or the Loader and Layer Interface.
+ These functions are: + `vkGetInstanceProcAddr`, `vkGetDeviceProcAddr`, + `vk_icdGetInstanceProcAddr`, `vk_icdGetPhysicalDeviceProcAddr`, and + `vk_layerGetPhysicalDeviceProcAddr`. + + diff --git a/docs/LoaderLayerInterface.md b/docs/LoaderLayerInterface.md index bd6266a609b2c60fa77092bdb439d75890584067..2ee6144197860f8580064de7389689d68804ee14 100644 --- a/docs/LoaderLayerInterface.md +++ b/docs/LoaderLayerInterface.md @@ -4,16 +4,16 @@ [1]: https://vulkan.lunarg.com/img/Vulkan_100px_Dec16.png "https://www.khronos.org/vulkan/" [2]: https://www.khronos.org/vulkan/ -# Layer Interface to the Loader +# Layer Interface to the Loader [![Creative Commons][3]][4] - + [3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License" [4]: https://creativecommons.org/licenses/by-nd/4.0/ -## Table of Contents +## Table of Contents - [Overview](#overview) - [Layer Discovery](#layer-discovery) @@ -25,6 +25,13 @@ - [Fuchsia Layer Discovery](#fuchsia-layer-discovery) - [macOS Layer Discovery](#macos-layer-discovery) - [Example macOS Implicit Layer Search Path](#example-macos-implicit-layer-search-path) + - [Layer Filtering](#layer-filtering) + - [Layer Enable Filtering](#layer-enable-filtering) + - [Layer Disable Filtering](#layer-disable-filtering) + - [Layer Special Case Disable](#layer-special-case-disable) + - [Layer Disable Warning](#layer-disable-warning) + - [Allow certain Layers to ignore Layer Disabling](#allow-certain-layers-to-ignore-layer-disabling) + - [`VK_INSTANCE_LAYERS`](#vk_instance_layers) - [Exception for Elevated Privileges](#exception-for-elevated-privileges) - [Layer Version Negotiation](#layer-version-negotiation) - [Layer Call Chains and Distributed Dispatch](#layer-call-chains-and-distributed-dispatch) @@ -48,6 +55,7 @@ - [Versioning and Activation Interactions](#versioning-and-activation-interactions) - [Layer Manifest File Format](#layer-manifest-file-format) - [Layer Manifest File Version History](#layer-manifest-file-version-history) + - [Layer Manifest File Version 1.2.1](#layer-manifest-file-version-121) - [Layer Manifest File Version 1.2.0](#layer-manifest-file-version-120) - [Layer Manifest File Version 1.1.2](#layer-manifest-file-version-112) - [Layer Manifest File Version 1.1.1](#layer-manifest-file-version-111) @@ -335,6 +343,9 @@ provided by the standard explicit layer paths mentioned above. The paths provided by `VK_ADD_LAYER_PATH` are added before the standard list of search folders and will therefore be searched first. +If `VK_LAYER_PATH` is present, then `VK_ADD_LAYER_PATH` will not be used by the +loader and any values will be ignored. + For security reasons, both `VK_LAYER_PATH` and `VK_ADD_LAYER_PATH` are ignored if running with elevated privileges. See [Exception for Elevated Privileges](#exception-for-elevated-privileges) @@ -412,14 +423,130 @@ following: /usr/share/vulkan/implicit_layer.d ``` +### Layer Filtering + +**NOTE:** This functionality is only available with Loaders built with version +1.3.234 of the Vulkan headers and later. + +The loader supports filter environment variables which can forcibly enable and +disable known layers. +Known layers are those that are already found by the loader taking into account +default search paths and other environment variables +(like `VK_LAYER_PATH` or `VK_ADD_LAYER_PATH`). + +The filter variables will be compared against the layer name provided in the +layer's manifest file. + +The filters must also follow the behaviors define in the +[Filter Environment Variable Behaviors](LoaderInterfaceArchitecture.md#filter-environment-variable-behaviors) +section of the [LoaderLayerInterface](LoaderLayerInterface.md) document. + +#### Layer Enable Filtering + +The layer enable environment variable `VK_LOADER_LAYERS_ENABLE` is a +comma-delimited list of globs to search for in known layers. +The layer names are compared against the globs listed in the environment +variable, and if they match, they will automatically be added to the enabled +layer list in the loader for each application. +These layers are enabled after implicit layers but before other explicit layers. + +When a layer is enabled using the `VK_LOADER_LAYERS_ENABLE` filter, and +loader logging is set to emit either warnings or layer messages, then a message +will show for each layer that has been forced on. +This message will look like the following: + +``` +WARNING | LAYER: Layer "VK_LAYER_LUNARG_wrap_objects" force enabled due to env var 'VK_LOADER_LAYERS_ENABLE' +``` + +#### Layer Disable Filtering + +The layer disable environment variable `VK_LOADER_LAYERS_DISABLE` is a +comma-delimited list of globs to search for in known layers. +The layer names are compared against the globs listed in the environment +variable, and if they match, they will automatically be disabled (whether or not +the layer is Implicit or Explicit). +This means that they will not be added to the enabled layer list in the loader +for each application. +This could mean that layers requested by an application are also not enabled +such as `VK_KHRONOS_LAYER_synchronization2` which could cause some applications +to misbehave. + +When a layer is disabled using the `VK_LOADER_LAYERS_DISABLE` filter, and +loader logging is set to emit either warnings or layer messages, then a message +will show for each layer that has been forcibly disabled. +This message will look like the following: + +``` +WARNING | LAYER: Layer "VK_LAYER_LUNARG_wrap_objects" disabled because name matches filter of env var 'VK_LOADER_LAYERS_DISABLE' +``` + +#### Layer Special Case Disable + +Because there are different types of layers, there are 3 additional special +disable options available when using the `VK_LOADER_LAYERS_DISABLE` environment +variable. + +These are: + + * `~all~` + * `~implicit~` + * `~explicit~` + +`~all~` will effectively disable every layer. +This enables a developer to disable all layers on the system. +`~implicit~` will effectively disable every implicit layer (leaving explicit +layers still present in the application call chain). +`~explicit~` will effectively disable every explicit layer (leaving implicit +layers still present in the application call chain). + +#### Layer Disable Warning + +Disabling layers, whether just through normal usage of +`VK_LOADER_LAYERS_DISABLE` or by evoking one of the special disable options like +`~all~` or `~explicit~` could cause application breakage if the application is +relying on features provided by one or more explicit layers. + +#### Allow certain Layers to ignore Layer Disabling + +**NOTE:** VK_LOADER_LAYERS_DISABLE is only available with Loaders built with version +1.3.262 of the Vulkan headers and later. + +The layer allow environment variable `VK_LOADER_LAYERS_ALLOW` is a +comma-delimited list of globs to search for in known layers. +The layer names are compared against the globs listed in the environment +variable, and if they match, they will not be able to be disabled by +`VK_LOADER_LAYERS_DISABLE`. + +Implicit layers have the ability to only be enabled when a layer specified +environment variable is set, allow for context dependent enablement. +`VK_LOADER_LAYERS_ENABLE` ignores that context. +`VK_LOADER_LAYERS_ALLOW` behaves similar to `VK_LOADER_LAYERS_ENABLE` while +also respecting the context which is normally used to determine whether an +implicit layer should be enabled. + +`VK_LOADER_LAYERS_ALLOW` effectively negates the behavior of +`VK_LOADER_LAYERS_DISABLE`. +Explicit layers listed by `VK_LOADER_LAYERS_ALLOW` will not be enabled. +Implicit layers listed by ``VK_LOADER_LAYERS_ALLOW` which are always active, +i.e. they do not require any external context to be enabled, will be enabled. + +##### `VK_INSTANCE_LAYERS` + +The original `VK_INSTANCE_LAYERS` can be viewed as a special case of the new +`VK_LOADER_LAYERS_ENABLE`. +Because of this, any layers enabled via `VK_INSTANCE_LAYERS` will be treated the +same as layers enabled with `VK_LOADER_LAYERS_ENABLE` and will therefore +override any disables supplied in `VK_LOADER_LAYERS_DISABLE`. + ### Exception for Elevated Privileges -There is an exception to when either `VK_LAYER_PATH` or `VK_ADD_LAYER_PATH` are -available for use. -For security reasons, both `VK_LAYER_PATH` and `VK_ADD_LAYER_PATH` are ignored -if running the Vulkan application with elevated privileges. -Because of this, both `VK_LAYER_PATH` and `VK_ADD_LAYER_PATH` can only be used -for applications that do not use elevated privileges. +For security reasons, `VK_LAYER_PATH` and `VK_ADD_LAYER_PATH` are ignored if +running the Vulkan application with elevated privileges. +This is because they may insert new libraries into the executable process that +are not normally found by the loader. +Because of this, these environment variables can only be used for applications +that do not use elevated privileges. For more information see [Elevated Privilege Caveats](LoaderInterfaceArchitecture.md#elevated-privilege-caveats) @@ -630,7 +757,8 @@ chain_info->u.pLayerInfo->pfnNextGetPhysicalDeviceProcAddr `vk_layerGetPhysicalDeviceProcAddr`. If a layer intends to support functions that take VkPhysicalDevice as the -dispatchable parameter, then layer should support `vk_layerGetPhysicalDeviceProcAddr`. +dispatchable parameter, then layer should support +`vk_layerGetPhysicalDeviceProcAddr`. This is because if these functions aren't known to the loader, such as those from unreleased extensions or because the loader is an older build thus doesn't know about them _yet_, the loader won't be able to distinguish whether this is @@ -658,8 +786,8 @@ function, and set up a generic terminator which will pass it to the proper driver. 4. Call down using `GetInstanceProcAddr` - If it returns non-NULL, treat it as an unknown logical device command. -This means setting up a generic trampoline function that takes in a `VkDevice` as -the first parameter and adjusting the dispatch table to call the +This means setting up a generic trampoline function that takes in a `VkDevice` +as the first parameter and adjusting the dispatch table to call the driver/layer's function after getting the dispatch table from the `VkDevice`. Then, return the pointer to corresponding trampoline function. 5. Return NULL @@ -714,7 +842,8 @@ function. corresponding Vulkan function in the next entity. * The common behavior for a layer is to intercept a call, perform some behavior, then pass it down to the next entity. - * If a layer doesn't pass the information down, undefined behavior may occur. + * If a layer doesn't pass the information down, undefined behavior may + occur. * This is because the function will not be received by layers further down the chain, or any drivers. * One function that **must never call down the chain** is: @@ -1074,7 +1203,7 @@ If any component layer is not present in the provided override paths, the meta layer is disabled. The override meta-layer is primarily enabled when using the -[VkConfig](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md) +[VkConfig](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/README.md) tool included in the Vulkan SDK. It is typically only available while the VkConfig tool is actually executing. Please refer to that documentation for more information. @@ -1083,8 +1212,8 @@ Please refer to that documentation for more information. Vulkan includes a small number of functions which are called without any dispatchable object. -Most layers do not intercept these functions, as layers are enabled when an -instance is created. +Most layers do not intercept these functions, as layers are enabled when +an instance is created. However, under certain conditions it is possible for a layer to intercept these functions. @@ -1411,7 +1540,8 @@ are in the blacklist will not be enabled. * The `app_keys` member of the override meta layer will make a meta layer apply to only applications found in this list. -If there are any items in the app keys list, the meta layer isn't enabled for any application except those found in the list. +If there are any items in the app keys list, the meta layer isn't enabled for +any application except those found in the list. * The `override_paths` member of the override meta layer, if present, will replace the search paths the loader uses to find component layers. @@ -1539,7 +1669,7 @@ Here's an example of a meta-layer manifest file: supports. It does not require the application to make use of that API version. It simply is an indication that the layer can support Vulkan API - instance and device functions up to and including that API version.
+ instance and device functions up to and including that API version.
For example: 1.0.33. None @@ -1792,7 +1922,7 @@ application. #### Layer Manifest File Version 1.2.0 The ability to define the layer settings as defined by the -[layer manifest schema](https://github.com/LunarG/VulkanTools/blob/master/vkconfig_core/layers/layers_schema.json). +[layer manifest schema](https://github.com/LunarG/VulkanTools/blob/main/vkconfig_core/layers/layers_schema.json). The ability to briefly document the layer thanks to the fields: * "introduction": Presentation of the purpose of the layer in a paragraph. @@ -1802,7 +1932,7 @@ The ability to briefly document the layer thanks to the fields: These changes were made to enable third-party layers to expose their features within -[Vulkan Configurator](https://github.com/LunarG/VulkanTools/blob/master/vkconfig/README.md) +[Vulkan Configurator](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/README.md) or other tools. #### Layer Manifest File Version 1.1.2 @@ -1837,8 +1967,8 @@ loader needs to query using OS-specific calls. - NOTE: This is an optional field and, as the two previous fields, only needed if the layer requires changing the name of the function for some reason. -The layer manifest file does not need to to be updated if the names of any listed -functions has not changed. +The layer manifest file does not need to to be updated if the names of any +listed functions has not changed. #### Layer Manifest File Version 1.0.1 @@ -1878,7 +2008,7 @@ The following sections detail the differences between the various versions. ### Layer Interface Version 2 Introduced the concept of -[loader and layer interface](#layer-version-negotiation) using the new +[loader and layer interface](#layer-version-negotiation) using the `vkNegotiateLoaderLayerInterfaceVersion` function. Additionally, it introduced the concept of [Layer Unknown Physical Device Extensions](#layer-unknown-physical-device-extensions) @@ -1891,7 +2021,7 @@ Note: If a layer wraps the VkInstance handle, support for ### Layer Interface Version 1 A layer supporting interface version 1 had the following behavior: - 1. `GetInstanceProcAddr` and `GetDeviceProcAddr` were directly exported + 1. `vkGetInstanceProcAddr` and `vkGetDeviceProcAddr` were directly exported 2. The layer manifest file was able to override the names of the `GetInstanceProcAddr` and `GetDeviceProcAddr`functions. @@ -2090,7 +2220,7 @@ Android Vulkan documentation. A layer must have a valid JSON manifest file for the loader to process that ends with the ".json" suffix. It is recommended validating the layer manifest file against - + the layer schema prior to publication.
The only exception is on Android which determines layer functionality through the introspection functions defined in @@ -2168,7 +2298,7 @@ Android Vulkan documentation. Yes No - + Vulkan CTS Documentation @@ -2370,6 +2500,22 @@ Android Vulkan documentation. Yes N/A + + LLP_LAYER_22 + During vkCreateDevice, a layer must not modify the + pDevice pointer during prior to calling down to the lower + layers.
+ This is because the loader passes information in this pointer that is + necessary for the initialization code in the loader's terminator + function.
+ Instead, if the layer is overriding the pDevice pointer, it + must do so only after the call to the lower layers returns. + + The loader will likely crash. + No + Yes + N/A + diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index bf4308702442b71eba42cf0ba010874e454563e4..622937b2a46300d19507cac7b75cb9a84149336f 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -1,8 +1,9 @@ # ~~~ -# Copyright (c) 2014-2021 The Khronos Group Inc. -# Copyright (c) 2014-2021 Valve Corporation -# Copyright (c) 2014-2021 LunarG, Inc. +# Copyright (c) 2014-2023 The Khronos Group Inc. +# 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. @@ -16,45 +17,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # ~~~ - -# Get version of the API the generated code used and put it into a cmake variable LOADER_GENERATED_HEADER_VERSION -include(generated/loader_generated_header_version.cmake) +include(CheckIncludeFile) 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(WIN32) - if(MSVC) - # Use static MSVCRT libraries - foreach(configuration - in - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_MINSIZEREL - CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_MINSIZEREL - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${configuration} MATCHES "/MD") - string(REGEX - REPLACE "/MD" - "/MT" - ${configuration} - "${${configuration}}") - endif() - endforeach() - endif() if(ENABLE_WIN10_ONECORE) # Note: When linking your app or driver to OneCore.lib, be sure to remove any links to non-umbrella libs (such as # kernel32.lib). - set(CMAKE_CXX_STANDARD_LIBRARIES " ") # space is intentional - set(CMAKE_C_STANDARD_LIBRARIES ${CMAKE_CXX_STANDARD_LIBRARIES}) + set(CMAKE_C_STANDARD_LIBRARIES " ") # space is intentional endif() - target_compile_options(loader_specific_options INTERFACE -D_CRT_SECURE_NO_WARNINGS) # ~~~ # Build dev_ext_trampoline.c and unknown_ext_chain.c with /O2 to allow tail-call optimization. # Setup two CMake targets (loader-norm and loader-opt) for the different compilation flags. @@ -68,27 +44,24 @@ if(WIN32) separate_arguments(MODIFIED_C_FLAGS_DEBUG WINDOWS_COMMAND ${MODIFIED_C_FLAGS_DEBUG}) # ~~~ - # Setup the loader.rc flie to contain the correct info - # Optionally uses the BUILD_DLL_VERSIONINFO build option to allow setting the exact build version - # Adds "Dev Build" to any build without the BUILD_DLL_VERSIONINFO option set + # Only generate the loader.rc file with CMake if BUILD_DLL_VERSIONINFO was set. + # This feature is for the Vulkan Runtime build + # Otherwise rely on the checked in loader.rc from the python script # ~~~ - if ("$CACHE{BUILD_DLL_VERSIONINFO}" STREQUAL "") - # default case - use 0 as the BUILDNO - set(LOADER_RC_VERSION "1.0.1111.2222") - set(LOADER_VER_FILE_VERSION_STR "\"${LOADER_RC_VERSION}.Dev Build\"") - set(LOADER_VER_FILE_DESCRIPTION_STR "\"Vulkan Loader - Dev Build\"") - else() + if (NOT "$CACHE{BUILD_DLL_VERSIONINFO}" STREQUAL "") + string(TIMESTAMP CURRENT_YEAR "%Y") + set(LOADER_CUR_COPYRIGHT_YEAR "${CURRENT_YEAR}") set(LOADER_RC_VERSION "$CACHE{BUILD_DLL_VERSIONINFO}") set(LOADER_VER_FILE_VERSION_STR "\"${LOADER_RC_VERSION}\"") set(LOADER_VER_FILE_DESCRIPTION_STR "\"Vulkan Loader\"") - endif() - # RC file wants the value of FILEVERSION to separated by commas - string(REPLACE "." ", " LOADER_VER_FILE_VERSION "${LOADER_RC_VERSION}") + # RC file wants the value of FILEVERSION to separated by commas + string(REPLACE "." ", " LOADER_VER_FILE_VERSION "${LOADER_RC_VERSION}") - # Configure the file to include the versioning info - # Place it in the current directory for check-in - so the GN build has up to date info - configure_file(loader.rc.in ${CMAKE_CURRENT_LIST_DIR}/loader.rc) + # Configure the file to include the versioning info + # Place it in the build directory - the GN build will use the checked in file + configure_file(loader.rc.in ${CMAKE_CURRENT_BINARY_DIR}/loader.rc) + endif() else() # Used to make alloca() and secure_getenv() available target_compile_definitions(loader_specific_options INTERFACE _GNU_SOURCE) @@ -103,26 +76,46 @@ endif() set(NORMAL_LOADER_SRCS allocation.c + allocation.h cJSON.c + cJSON.h debug_utils.c + debug_utils.h extension_manual.c - get_environment.c + extension_manual.h + loader_environment.c + loader_environment.h gpa_helper.c + gpa_helper.h loader.c + loader.h log.c + log.h + settings.c + settings.h terminator.c trampoline.c unknown_function_handling.c + unknown_function_handling.h wsi.c + wsi.h ) if(WIN32) list(APPEND NORMAL_LOADER_SRCS loader_windows.c dirent_on_windows.c) -elseif(UNIX AND NOT APPLE) # i.e.: Linux +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU") list(APPEND NORMAL_LOADER_SRCS loader_linux.c) target_compile_definitions(loader_specific_options INTERFACE LOADER_ENABLE_LINUX_SORT) endif() +if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES ";") + set(APPLE_UNIVERSAL_BINARY ON) + + # When building a universal binary we cannot enable USE_GAS + # Since USE_GAS assumes only 1 architecture (arm64, x64, etc). + set(USE_GAS OFF) +endif() + set(OPT_LOADER_SRCS dev_ext_trampoline.c phys_dev_ext.c) # Check for assembler support @@ -130,9 +123,13 @@ set(ASM_FAILURE_MSG "The build will fall back on building with C code\n") set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG}Note that this may be unsafe, as the C code requires tail-call optimizations to remove") set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG} the stack frame for certain calls. If the compiler does not do this, then unknown device") set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG} extensions will suffer from a corrupted stack.") -if(WIN32) - if(MINGW) - find_program(JWASM_FOUND jwasm) + +if (APPLE_UNIVERSAL_BINARY) + set(USE_ASSEMBLY_FALLBACK ON) +elseif(WIN32) + option(USE_MASM "Use MASM" ON) + if(USE_MASM AND MINGW) + find_program(JWASM_FOUND NAMES jwasm uasm) if (JWASM_FOUND) set(CMAKE_ASM_MASM_COMPILER ${JWASM_FOUND}) execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE COMPILER_VERSION_OUTPUT) @@ -140,57 +137,101 @@ if(WIN32) if (COMPILER_VERSION_OUTPUT MATCHES "x86_64") set(JWASM_FLAGS -win64) else() - set(JWASM_FLAGS -coff) + # jwasm requires setting the cpu to at least 386 for setting a flat model + set(JWASM_FLAGS -3 -coff) endif() endif() endif() endif() - option(USE_MASM "Use MASM" ON) if (USE_MASM) - enable_language(ASM_MASM) + enable_language(ASM_MASM) + endif() + # Test if the detected compiler actually works. + # Unfortunately, CMake's detection of ASM_MASM is not reliable, so we need to do this ourselves. + if (CMAKE_SIZEOF_VOID_P EQUAL 4) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/masm_check.asm [=[ +.model flat +.code +extrn _start:near + xor eax, eax + ret +end +]=]) + else() + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/masm_check.asm [=[ +.code +extrn start:near + xor rax, rax + ret +end +]=]) endif () - if(CMAKE_ASM_MASM_COMPILER_WORKS OR JWASM_FOUND) - if(MINGW) - set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} ${JWASM_FLAGS}) - elseif(NOT CMAKE_CL_64 AND NOT JWASM_FOUND) - set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} /safeseh) - endif() - + if(MINGW) + set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} ${JWASM_FLAGS}) + elseif(NOT CMAKE_CL_64 AND NOT JWASM_FOUND) + set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} /safeseh) + endif() + # try_compile does not work here due to the same reasons as static above. + execute_process(COMMAND ${CMAKE_ASM_MASM_COMPILER} ${CMAKE_ASM_MASM_FLAGS} -c -Fo ${CMAKE_CURRENT_BINARY_DIR}/masm_check.obj ${CMAKE_CURRENT_BINARY_DIR}/masm_check.asm + RESULT_VARIABLE CMAKE_ASM_MASM_COMPILER_WORKS + OUTPUT_QUIET ERROR_QUIET) + # Convert the return code to a boolean + if(CMAKE_ASM_MASM_COMPILER_WORKS EQUAL 0) + set(CMAKE_ASM_MASM_COMPILER_WORKS true) + else() + set(CMAKE_ASM_MASM_COMPILER_WORKS false) + endif() + if(CMAKE_ASM_MASM_COMPILER_WORKS) add_executable(asm_offset asm_offset.c) - target_link_libraries(asm_offset loader_specific_options) - add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM) + target_link_libraries(asm_offset PRIVATE loader_specific_options) + # If am emulator is provided (Like Wine), or running on native, run asm_offset to generate gen_defines.asm + if (CMAKE_CROSSCOMPILING_EMULATOR OR NOT CMAKE_CROSSCOMPILING) + add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE "/Fa$/asm_offset.asm" /FA) + # Force off optimization so that the output assembly includes all the necessary info - optimizer would get rid of it otherwise. + target_compile_options(asm_offset PRIVATE /Od) + + find_package(Python3 REQUIRED QUIET) + # Run parse_asm_values.py on asm_offset's assembly file to generate the gen_defines.asm, which the asm code depends on + add_custom_command(TARGET asm_offset POST_BUILD + COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/parse_asm_values.py "${CMAKE_CURRENT_BINARY_DIR}/gen_defines.asm" + "$/asm_offset.asm" "MASM" "${CMAKE_C_COMPILER_ID}" "${CMAKE_SYSTEM_PROCESSOR}" + BYPRODUCTS gen_defines.asm + ) + endif() add_custom_target(loader_asm_gen_files DEPENDS gen_defines.asm) set_target_properties(loader_asm_gen_files PROPERTIES FOLDER ${LOADER_HELPER_FOLDER}) + add_library(loader-unknown-chain OBJECT unknown_ext_chain_masm.asm) target_link_libraries(loader-unknown-chain Vulkan::Headers) - target_include_directories(loader-unknown-chain PUBLIC $) + target_include_directories(loader-unknown-chain PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) add_dependencies(loader-unknown-chain loader_asm_gen_files) else() + set(USE_ASSEMBLY_FALLBACK ON) message(WARNING "Could not find working MASM assembler\n${ASM_FAILURE_MSG}") - add_custom_target(loader_asm_gen_files) - add_library(loader-unknown-chain OBJECT unknown_ext_chain.c) - target_link_libraries(loader-unknown-chain loader_specific_options) - set_target_properties(loader-unknown-chain PROPERTIES CMAKE_C_FLAGS_DEBUG "${MODIFIED_C_FLAGS_DEBUG}") endif() -elseif(APPLE) - # For MacOS, use the C code and force the compiler's tail-call optimization instead of using assembly code. - set(OPT_LOADER_SRCS ${OPT_LOADER_SRCS} unknown_ext_chain.c) - set_source_files_properties(${OPT_LOADER_SRCS} PROPERTIES COMPILE_FLAGS -O) - add_custom_target(loader_asm_gen_files) # This causes no assembly files to be generated. -else() # i.e.: Linux +elseif(UNIX) # i.e.: Linux & Apple + option(USE_GAS "Use GAS" ON) if(USE_GAS) + if (APPLE_UNIVERSAL_BINARY) + message(FATAL_ERROR "USE_GAS cannot be used when compiling a universal binary!") + endif() + enable_language(ASM) set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}") set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) - if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") + if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64|arm64") try_compile(ASSEMBLER_WORKS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/asm_test_aarch64.S) if(ASSEMBLER_WORKS) set(OPT_LOADER_SRCS ${OPT_LOADER_SRCS} unknown_ext_chain_gas_aarch64.S) endif() - elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$") + # Covers x86_64, amd64, x86, i386, i686, I386, I686 + elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64|86") check_include_file("cet.h" HAVE_CET_H) if(HAVE_CET_H) target_compile_definitions(loader_specific_options INTERFACE HAVE_CET_H) @@ -203,19 +244,70 @@ else() # i.e.: Linux endif() endif() + # When compiling for x86 on x64, we can't use CMAKE_SYSTEM_PROCESSOR to determine which architecture to use, + # Instead, check the size of void* and if its 4, set ASM_OFFSET_SYSTEM_PROCESSOR to x86 + # Note - there is no 32 bit arm assembly code, so this only applies to x86 currently. + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(ASM_OFFSET_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) # x86_64 or aarch64/arm64 + else() + set(ASM_OFFSET_SYSTEM_PROCESSOR "x86") + endif() + if(ASSEMBLER_WORKS) add_executable(asm_offset asm_offset.c) target_link_libraries(asm_offset loader_specific_options) - add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS) + # If not cross compiling, run asm_offset to generage gen_defines.asm + if (NOT CMAKE_CROSSCOMPILING) + add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE -save-temps=obj) + if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + set(ASM_OFFSET_EXECUTABLE_LOCATION "$/gen_defines.asm") + set(ASM_OFFSET_INTERMEDIATE_LOCATION "$/CMakeFiles/asm_offset.dir/asm_offset.c.s") + elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(ASM_OFFSET_EXECUTABLE_LOCATION "$/gen_defines.asm") + set(ASM_OFFSET_INTERMEDIATE_LOCATION "$/CMakeFiles/asm_offset.dir/asm_offset.s") + elseif(CMAKE_C_COMPILER_ID STREQUAL "AppleClang") + # Need to use the current binary dir since the asm_offset.s file is in that folder rather than the bundle + set(ASM_OFFSET_EXECUTABLE_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/gen_defines.asm") + set(ASM_OFFSET_INTERMEDIATE_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/asm_offset.dir/asm_offset.s") + else() + message(FATAL_ERROR "C_COMPILER_ID not supported!") + endif() + + find_package(Python3 REQUIRED QUIET) + # Run parse_asm_values.py on asm_offset's assembly file to generate the gen_defines.asm, which the asm code depends on + add_custom_command(TARGET asm_offset POST_BUILD + COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/parse_asm_values.py "${ASM_OFFSET_EXECUTABLE_LOCATION}" + "${ASM_OFFSET_INTERMEDIATE_LOCATION}" "GAS" "${CMAKE_C_COMPILER_ID}" "${ASM_OFFSET_SYSTEM_PROCESSOR}" + BYPRODUCTS gen_defines.asm + ) + endif() add_custom_target(loader_asm_gen_files DEPENDS gen_defines.asm) + + if (APPLE) + set(MODIFY_UNKNOWN_FUNCTION_DECLS ON) + endif() else() + set(USE_ASSEMBLY_FALLBACK ON) if(USE_GAS) - message(WARNING "Could not find working ${CMAKE_SYSTEM_PROCESSOR} GAS assembler\n${ASM_FAILURE_MSG}") + message(WARNING "Could not find working ${ASM_OFFSET_SYSTEM_PROCESSOR} GAS assembler\n${ASM_FAILURE_MSG}") else() message(WARNING "Assembly sources have been disabled\n${ASM_FAILURE_MSG}") endif() + endif() +endif() + +if(USE_ASSEMBLY_FALLBACK) + add_custom_target(loader_asm_gen_files) + if (MSVC) + add_library(loader-unknown-chain OBJECT unknown_ext_chain.c) + target_link_libraries(loader-unknown-chain loader_specific_options) + set_target_properties(loader-unknown-chain PROPERTIES CMAKE_C_FLAGS_DEBUG "${MODIFIED_C_FLAGS_DEBUG}") + else() set(OPT_LOADER_SRCS ${OPT_LOADER_SRCS} unknown_ext_chain.c) - add_custom_target(loader_asm_gen_files) + set_source_files_properties(${OPT_LOADER_SRCS} PROPERTIES COMPILE_FLAGS -O) endif() endif() @@ -225,25 +317,29 @@ if(WIN32) add_dependencies(loader-opt loader_asm_gen_files) set_target_properties(loader-opt PROPERTIES CMAKE_C_FLAGS_DEBUG "${MODIFIED_C_FLAGS_DEBUG}") + # If BUILD_DLL_VERSIONINFO was set, use the loader.rc in the build dir, otherwise use the checked in file + set(RC_FILE_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/loader.rc) + if (NOT "$CACHE{BUILD_DLL_VERSIONINFO}" STREQUAL "") + set(RC_FILE_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/loader.rc) + endif() + + set(LOADER_UNKNOWN_CHAIN_LIBRARY $<$:$>) + add_library(vulkan SHARED ${NORMAL_LOADER_SRCS} - $ - ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1.def - ${CMAKE_CURRENT_LIST_DIR}/loader.rc) + ${LOADER_UNKNOWN_CHAIN_LIBRARY} + ${CMAKE_CURRENT_SOURCE_DIR}/${API_TYPE}-1.def + ${RC_FILE_LOCATION}) target_link_libraries(vulkan PRIVATE loader_specific_options loader-opt) - if (UPDATE_DEPS) - add_dependencies(vulkan vl_update_deps) - endif() - # when adding the suffix the import and runtime library names must be consistent # mingw: libvulkan-1.dll.a / vulkan-1.dll # 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 @@ -261,20 +357,48 @@ if(WIN32) add_dependencies(vulkan loader_asm_gen_files) else() - if(APPLE AND BUILD_STATIC_LOADER) - add_library(vulkan STATIC ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS}) - target_compile_definitions(vulkan PRIVATE BUILD_STATIC_LOADER) + if(APPLE) + option(APPLE_STATIC_LOADER "Build a loader that can be statically linked. Intended for Chromium usage/testing.") + mark_as_advanced(APPLE_STATIC_LOADER) + endif() + + if(APPLE_STATIC_LOADER) + add_library(vulkan STATIC) + target_compile_definitions(vulkan PRIVATE APPLE_STATIC_LOADER) + + message(WARNING "The APPLE_STATIC_LOADER option has been set. Note that this will only work on MacOS and is not supported " + "or tested as part of the loader. Use it at your own risk.") else() - add_library(vulkan SHARED ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS}) + add_library(vulkan SHARED) endif() + + target_sources(vulkan PRIVATE ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS}) + add_dependencies(vulkan loader_asm_gen_files) - # set version based on LOADER_GENERATED_HEADER_VERSION used to generate the code - set_target_properties(vulkan - PROPERTIES SOVERSION "1" - VERSION ${LOADER_GENERATED_HEADER_VERSION}) - target_link_libraries(vulkan PRIVATE ${CMAKE_DL_LIBS} m) - if (NOT ANDROID) - target_link_libraries(vulkan PRIVATE Threads::Threads) + + set_target_properties(vulkan PROPERTIES + SOVERSION "1" + VERSION "${VULKAN_LOADER_VERSION}" + ) + + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + + target_link_libraries(vulkan PRIVATE ${CMAKE_DL_LIBS} m Threads::Threads) + + set_target_properties(vulkan PROPERTIES OUTPUT_NAME ${API_TYPE}) + + if (LOADER_ENABLE_ADDRESS_SANITIZER) + target_compile_options(vulkan PUBLIC -fsanitize=address) + target_link_options(vulkan PUBLIC -fsanitize=address) + endif() + if (LOADER_ENABLE_THREAD_SANITIZER) + target_compile_options(vulkan PUBLIC -fsanitize=thread) + target_link_options(vulkan PUBLIC -fsanitize=thread) + endif() + if (LOADER_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER) + target_compile_options(vulkan PUBLIC -fsanitize=undefined) + target_link_options(vulkan PUBLIC -fsanitize=undefined) endif() if(APPLE) @@ -284,83 +408,106 @@ else() # Build vulkan.framework # Use GLOB_RECURSE to find all the header files and populate the vulkan.framework headers with them # Use CONFIGURE_DEPENDS to ensure that if the header files are updated, this list is also updated - # Note: CONFIGURE_DEPENDS is a 3.12 feature - gate it for now and remove when CMake minimum version is higher - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0") - file(GLOB_RECURSE CONFIGURE_DEPENDS FRAMEWORK_HEADERS ${VulkanHeaders_INCLUDE_DIRS}) - else() - file(GLOB_RECURSE FRAMEWORK_HEADERS ${VulkanHeaders_INCLUDE_DIRS}) - endif() - if(BUILD_STATIC_LOADER) - add_library(vulkan-framework STATIC ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS} ${FRAMEWORK_HEADERS}) - else() - add_library(vulkan-framework SHARED ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS} ${FRAMEWORK_HEADERS}) - endif() + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + file(GLOB_RECURSE CONFIGURE_DEPENDS FRAMEWORK_HEADERS ${VulkanHeaders_INCLUDE_DIRS}) + + add_library(vulkan-framework SHARED) + target_sources(vulkan-framework PRIVATE ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS} ${FRAMEWORK_HEADERS}) + add_dependencies(vulkan-framework loader_asm_gen_files) target_link_libraries(vulkan-framework ${CMAKE_DL_LIBS} Threads::Threads -lm "-framework CoreFoundation") target_link_libraries(vulkan-framework loader_specific_options) + if (MODIFY_UNKNOWN_FUNCTION_DECLS) + # Modifies the names of functions as they appearin the assembly code so that the + # unknown function handling will work + target_compile_definitions(vulkan PRIVATE MODIFY_UNKNOWN_FUNCTION_DECLS) + target_compile_definitions(vulkan-framework PRIVATE MODIFY_UNKNOWN_FUNCTION_DECLS) + endif() + # The FRAMEWORK_VERSION needs to be "A" here so that Xcode code-signing works when a user adds their framework to an Xcode # project and does "Sign on Copy". It would have been nicer to use "1" to denote Vulkan 1. Although Apple docs say that a # framework version does not have to be "A", this part of the Apple toolchain expects it. # https://forums.developer.apple.com/thread/65963 -# cmake-format: off set_target_properties(vulkan-framework PROPERTIES OUTPUT_NAME vulkan FRAMEWORK TRUE FRAMEWORK_VERSION A - VERSION "${LOADER_GENERATED_HEADER_VERSION}" # "current version" - SOVERSION "1.0.0" # "compatibility version" + VERSION "${VULKAN_LOADER_VERSION}" + SOVERSION "1.0.0" MACOSX_FRAMEWORK_IDENTIFIER com.lunarg.vulkanFramework PUBLIC_HEADER "${FRAMEWORK_HEADERS}" ) + + # Workaround linker warning: https://github.com/KhronosGroup/Vulkan-Loader/issues/1332 + # + # MACHO_CURRENT_VERSION specifically applies to the -current_version linker option which is the + # linker warning we are trying to address. + set(APPLE_VULKAN_LOADER_VERSION "${VULKAN_LOADER_VERSION_MAJOR}.${VULKAN_LOADER_VERSION_MINOR}.0") + set_target_properties(vulkan PROPERTIES MACHO_CURRENT_VERSION "${APPLE_VULKAN_LOADER_VERSION}") + set_target_properties(vulkan-framework PROPERTIES MACHO_CURRENT_VERSION "${APPLE_VULKAN_LOADER_VERSION}") + install(TARGETS vulkan-framework PUBLIC_HEADER DESTINATION vulkan FRAMEWORK DESTINATION loader ) -# cmake-format: on endif() endif() +option(LOADER_USE_UNSAFE_FILE_SEARCH "Allows the loader to search in unsafe locations") +if (LOADER_USE_UNSAFE_FILE_SEARCH) + target_compile_definitions(vulkan PRIVATE LOADER_USE_UNSAFE_FILE_SEARCH) +endif() + # common attributes of the vulkan library target_link_libraries(vulkan PRIVATE loader_specific_options) -set_target_properties(vulkan ${LOADER_STANDARD_C_PROPERTIES}) -if (TARGET asm_offset) - set_target_properties(asm_offset ${LOADER_STANDARD_C_PROPERTIES}) +target_link_libraries(vulkan PRIVATE Vulkan::Headers) +add_library(Vulkan::Loader ALIAS vulkan) + +if (APPLE_STATIC_LOADER) + # TLDR: This feature only exists at the request of Google for Chromium. No other project should use this! + message(NOTICE "Apple STATIC lib: it will be built but not installed, and vulkan.pc and VulkanLoaderConfig.cmake won't be generated!") + return() endif() -# Generate pkg-config file. -include(FindPkgConfig QUIET) -if(PKG_CONFIG_FOUND) - set(VK_API_VERSION "${LOADER_GENERATED_HEADER_VERSION}") - foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS}) - set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}") - endforeach() +# Generate CMake Configuration File (IE: VulkanLoaderConfig.cmake) +install(TARGETS vulkan EXPORT VulkanLoaderConfig) +set_target_properties(vulkan PROPERTIES EXPORT_NAME "Loader") +install(EXPORT VulkanLoaderConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanLoader NAMESPACE Vulkan::) + +# Generate CMake Version File (IE: VulkanLoaderConfigVersion.cmake) +include(CMakePackageConfigHelpers) + +set(version_config "${CMAKE_CURRENT_BINARY_DIR}/generated/VulkanLoaderConfigVersion.cmake") +write_basic_package_version_file("${version_config}" COMPATIBILITY SameMajorVersion) +install(FILES "${version_config}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanLoader) + +# Generate PkgConfig File (IE: vulkan.pc) +# NOTE: Hopefully in the future CMake can generate .pc files natively. +# https://gitlab.kitware.com/cmake/cmake/-/issues/22621 +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) if(WIN32) if(MINGW) set(VULKAN_LIB_SUFFIX "-1.dll") else() set(VULKAN_LIB_SUFFIX "-1") endif() - # Set libdir path as in cmake's FindVulkan.cmake - # https://github.com/KhronosGroup/Vulkan-Loader/issues/668 - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - string(REPLACE "lib" "Lib" CMAKE_INSTALL_FULL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR}) - else() - string(REPLACE "lib" "Lib32" CMAKE_INSTALL_FULL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR}) - endif() + endif() + + # BUG: The following code will NOT work well with `cmake --install ... --prefix ` + # due to this code relying on CMAKE_INSTALL_PREFIX being defined at configure time. + # + # NOTE: vulkan.pc essentially cover both Vulkan-Loader and Vulkan-Headers for legacy reasons. + if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "") + set(CMAKE_INSTALL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR}) + set(CMAKE_INSTALL_INCLUDEDIR_PC ${CMAKE_INSTALL_FULL_INCLUDEDIR}) else() - set(CMAKE_INSTALL_FULL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR}) - endif () + file(RELATIVE_PATH CMAKE_INSTALL_LIBDIR_PC ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_LIBDIR}) + 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() - -target_link_libraries(vulkan PRIVATE Vulkan::Headers) -add_library(Vulkan::Vulkan ALIAS vulkan) - -install(TARGETS vulkan - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/loader/adapters.h b/loader/adapters.h index 39e905d73f87ab5638112a3a911e081f507b881b..56480e108d27b05fe60d2a7f9205cd76606afbe2 100644 --- a/loader/adapters.h +++ b/loader/adapters.h @@ -28,7 +28,7 @@ typedef struct LoaderEnumAdapters2 { LUID luid; ULONG source_count; BOOL present_move_regions_preferred; - } * adapters; + } *adapters; } LoaderEnumAdapters2; typedef _Check_return_ NTSTATUS(APIENTRY *PFN_LoaderEnumAdapters2)(const LoaderEnumAdapters2 *); diff --git a/loader/asm_offset.c b/loader/asm_offset.c index 80b71065cd7e1bdca0e3aa8ed5dcc1253124b342..f99ff56a0453d2c7d14fc80dc205e20f2063fe71 100644 --- a/loader/asm_offset.c +++ b/loader/asm_offset.c @@ -22,14 +22,54 @@ // This code generates an assembly file which provides offsets to get struct members from assembly code. +// __USE_MINGW_ANSI_STDIO is needed to use the %zu format specifier with mingw-w64. +// Otherwise the compiler will complain about an unknown format specifier. +#if defined(__MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO) +#define __USE_MINGW_ANSI_STDIO 1 +#endif + #include #include "loader_common.h" #include "log.h" +#if defined(__GNUC__) || defined(__clang__) +void produce_asm_define() { + // GCC and clang make it easy to print easy to regex for values + __asm__("# VULKAN_LOADER_ERROR_BIT = %c0" : : "i"(VULKAN_LOADER_ERROR_BIT)); + __asm__("# PTR_SIZE = %c0" : : "i"(sizeof(void *))); + __asm__("# CHAR_PTR_SIZE = %c0" : : "i"(sizeof(char *))); + __asm__("# FUNCTION_OFFSET_INSTANCE = %c0" : : "i"(offsetof(struct loader_instance, phys_dev_ext_disp_functions))); + __asm__("# PHYS_DEV_OFFSET_INST_DISPATCH = %c0" : : "i"(offsetof(struct loader_instance_dispatch_table, phys_dev_ext))); + __asm__("# PHYS_DEV_OFFSET_PHYS_DEV_TRAMP = %c0" : : "i"(offsetof(struct loader_physical_device_tramp, phys_dev))); + __asm__("# ICD_TERM_OFFSET_PHYS_DEV_TERM = %c0" : : "i"(offsetof(struct loader_physical_device_term, this_icd_term))); + __asm__("# PHYS_DEV_OFFSET_PHYS_DEV_TERM = %c0" : : "i"(offsetof(struct loader_physical_device_term, phys_dev))); + __asm__("# INSTANCE_OFFSET_ICD_TERM = %c0" : : "i"(offsetof(struct loader_icd_term, this_instance))); + __asm__("# DISPATCH_OFFSET_ICD_TERM = %c0" : : "i"(offsetof(struct loader_icd_term, phys_dev_ext))); + __asm__("# EXT_OFFSET_DEVICE_DISPATCH = %c0" : : "i"(offsetof(struct loader_dev_dispatch_table, ext_dispatch))); +} +#elif defined(_WIN32) +// MSVC will print the name of the value and the value in hex +// Must disable optimization for this translation unit, otherwise the compiler strips out the variables +static const uint32_t PTR_SIZE = sizeof(void *); +static const uint32_t CHAR_PTR_SIZE = sizeof(char *); +static const uint32_t FUNCTION_OFFSET_INSTANCE = offsetof(struct loader_instance, phys_dev_ext_disp_functions); +static const uint32_t PHYS_DEV_OFFSET_INST_DISPATCH = offsetof(struct loader_instance_dispatch_table, phys_dev_ext); +static const uint32_t PHYS_DEV_OFFSET_PHYS_DEV_TRAMP = offsetof(struct loader_physical_device_tramp, phys_dev); +static const uint32_t ICD_TERM_OFFSET_PHYS_DEV_TERM = offsetof(struct loader_physical_device_term, this_icd_term); +static const uint32_t PHYS_DEV_OFFSET_PHYS_DEV_TERM = offsetof(struct loader_physical_device_term, phys_dev); +static const uint32_t INSTANCE_OFFSET_ICD_TERM = offsetof(struct loader_icd_term, this_instance); +static const uint32_t DISPATCH_OFFSET_ICD_TERM = offsetof(struct loader_icd_term, phys_dev_ext); +static const uint32_t EXT_OFFSET_DEVICE_DISPATCH = offsetof(struct loader_dev_dispatch_table, ext_dispatch); +#else +#warning asm_offset.c variable declarations need to be defined for this platform +#endif + #if !defined(_MSC_VER) || (_MSC_VER >= 1900) #define SIZE_T_FMT "%-8zu" -#else +#elif defined(__GNUC__) || defined(__clang__) #define SIZE_T_FMT "%-8lu" +#else +#warning asm_offset.c SIZE_T_FMT must be defined for this platform #endif struct ValueInfo { @@ -38,6 +78,8 @@ struct ValueInfo { const char *comment; }; +// This file can both be executed to produce gen_defines.asm and contains all the relevant data which +// the parse_asm_values.py script needs to write gen_defines.asm, necessary for cross compilation int main(int argc, char **argv) { const char *assembler = NULL; for (int i = 0; i < argc; ++i) { @@ -78,7 +120,7 @@ int main(int argc, char **argv) { // clang-format on }; - FILE *file = fopen("gen_defines.asm", "w"); + FILE *file = loader_fopen("gen_defines.asm", "w"); fprintf(file, "\n"); if (!strcmp(assembler, "MASM")) { for (size_t i = 0; i < sizeof(values) / sizeof(values[0]); ++i) { diff --git a/loader/cJSON.c b/loader/cJSON.c index 40adcb464d06dfb8bd3084e940fbc1b5a07f09ed..b07d9518a1909701393b33c597e55a84d011944f 100644 --- a/loader/cJSON.c +++ b/loader/cJSON.c @@ -37,18 +37,27 @@ #include "cJSON.h" #include "allocation.h" +#include "loader.h" +#include "log.h" -void *cJSON_malloc(const VkAllocationCallbacks *pAllocator, size_t size) { - return loader_alloc(pAllocator, size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); +static void *cJSON_malloc(const VkAllocationCallbacks *pAllocator, size_t size) { + return loader_calloc(pAllocator, size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); } -void cJSON_Free(const VkAllocationCallbacks *pAllocator, void *pMemory) { loader_free(pAllocator, pMemory); } +static void *cJSON_malloc_instance_scope(const VkAllocationCallbacks *pAllocator, size_t size) { + return loader_calloc(pAllocator, size, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); +} + +static void cJSON_Free(const VkAllocationCallbacks *pAllocator, void *pMemory) { loader_free(pAllocator, pMemory); } +/* +// commented out as it is unused - static error code channel requires external locks to be used. static const char *ep; const char *cJSON_GetErrorPtr(void) { return ep; } +*/ -char *cJSON_strdup(const VkAllocationCallbacks *pAllocator, const char *str) { +static char *cJSON_strdup(const VkAllocationCallbacks *pAllocator, const char *str) { size_t len; char *copy; @@ -60,7 +69,7 @@ char *cJSON_strdup(const VkAllocationCallbacks *pAllocator, const char *str) { } /* Internal constructor. */ -cJSON *cJSON_New_Item(const VkAllocationCallbacks *pAllocator) { +static cJSON *cJSON_New_Item(const VkAllocationCallbacks *pAllocator) { cJSON *node = (cJSON *)cJSON_malloc(pAllocator, sizeof(cJSON)); if (node) { memset(node, 0, sizeof(cJSON)); @@ -70,11 +79,11 @@ cJSON *cJSON_New_Item(const VkAllocationCallbacks *pAllocator) { } /* Delete a cJSON structure. */ -void cJSON_Delete(cJSON *c) { +void loader_cJSON_Delete(cJSON *c) { cJSON *next; while (c) { next = c->next; - if (!(c->type & cJSON_IsReference) && c->child) cJSON_Delete(c->child); + if (!(c->type & cJSON_IsReference) && c->child) loader_cJSON_Delete(c->child); if (!(c->type & cJSON_IsReference) && c->valuestring) cJSON_Free(c->pAllocator, c->valuestring); if (!(c->type & cJSON_StringIsConst) && c->string) cJSON_Free(c->pAllocator, c->string); cJSON_Free(c->pAllocator, c); @@ -84,7 +93,7 @@ void cJSON_Delete(cJSON *c) { /* Parse the input text to generate a number, and populate the result into item. */ -const char *parse_number(cJSON *item, const char *num) { +static const char *parse_number(cJSON *item, const char *num) { double n = 0, sign = 1, scale = 0; int subscale = 0, signsubscale = 1; @@ -118,7 +127,7 @@ const char *parse_number(cJSON *item, const char *num) { return num; } -size_t pow2gt(size_t x) { +static size_t pow2gt(size_t x) { --x; x |= x >> 1; x |= x >> 2; @@ -134,7 +143,7 @@ typedef struct { size_t offset; } printbuffer; -char *ensure(const VkAllocationCallbacks *pAllocator, printbuffer *p, size_t needed) { +static char *ensure(const VkAllocationCallbacks *pAllocator, printbuffer *p, size_t needed) { char *newbuffer; size_t newsize; if (!p || !p->buffer) return 0; @@ -155,7 +164,7 @@ char *ensure(const VkAllocationCallbacks *pAllocator, printbuffer *p, size_t nee return newbuffer + p->offset; } -size_t cJSON_update(printbuffer *p) { +static size_t cJSON_update(printbuffer *p) { char *str; if (!p || !p->buffer) return 0; str = p->buffer + p->offset; @@ -163,39 +172,43 @@ size_t cJSON_update(printbuffer *p) { } /* Render the number nicely from the given item into a string. */ -char *print_number(cJSON *item, printbuffer *p) { +static char *print_number(cJSON *item, printbuffer *p) { char *str = 0; + size_t str_buf_size; double d = item->valuedouble; if (d == 0) { + str_buf_size = 2; /* special case for 0. */ if (p) - str = ensure(item->pAllocator, p, 2); + str = ensure(item->pAllocator, p, str_buf_size); else - str = (char *)cJSON_malloc(item->pAllocator, 2); /* special case for 0. */ - if (str) strcpy(str, "0"); + str = (char *)cJSON_malloc(item->pAllocator, str_buf_size); + if (str) loader_strncpy(str, str_buf_size, "0", 2); } else if (fabs(((double)item->valueint) - d) <= DBL_EPSILON && d <= INT_MAX && d >= INT_MIN) { + str_buf_size = 21; /* 2^64+1 can be represented in 21 chars. */ if (p) - str = ensure(item->pAllocator, p, 21); + str = ensure(item->pAllocator, p, str_buf_size); else - str = (char *)cJSON_malloc(item->pAllocator, 21); /* 2^64+1 can be represented in 21 chars. */ - if (str) sprintf(str, "%d", item->valueint); + str = (char *)cJSON_malloc(item->pAllocator, str_buf_size); + if (str) snprintf(str, str_buf_size, "%d", item->valueint); } else { + str_buf_size = 64; /* This is a nice tradeoff. */ if (p) - str = ensure(item->pAllocator, p, 64); + str = ensure(item->pAllocator, p, str_buf_size); else - str = (char *)cJSON_malloc(item->pAllocator, 64); /* This is a nice tradeoff. */ + str = (char *)cJSON_malloc(item->pAllocator, str_buf_size); if (str) { if (fabs(floor(d) - d) <= DBL_EPSILON && fabs(d) < 1.0e60) - sprintf(str, "%.0f", d); + snprintf(str, str_buf_size, "%.0f", d); else if (fabs(d) < 1.0e-6 || fabs(d) > 1.0e9) - sprintf(str, "%e", d); + snprintf(str, str_buf_size, "%e", d); else - sprintf(str, "%f", d); + snprintf(str, str_buf_size, "%f", d); } } return str; } -unsigned parse_hex4(const char *str) { +static unsigned parse_hex4(const char *str) { unsigned h = 0; if (*str >= '0' && *str <= '9') h += (*str) - '0'; @@ -240,14 +253,14 @@ unsigned parse_hex4(const char *str) { /* Parse the input text into an unescaped cstring, and populate item. */ static const unsigned char firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; -const char *parse_string(cJSON *item, const char *str) { +static const char *parse_string(cJSON *item, const char *str, bool *out_of_memory) { const char *ptr = str + 1; char *ptr2; char *out; int len = 0; unsigned uc, uc2; if (*str != '\"') { - ep = str; + // ep = str; // commented out as it is unused return 0; } /* not a string! */ @@ -255,7 +268,10 @@ const char *parse_string(cJSON *item, const char *str) { if (*ptr++ == '\\') ptr++; /* Skip escaped quotes. */ out = (char *)cJSON_malloc(item->pAllocator, len + 1); /* This is how long we need for the string, roughly. */ - if (!out) return 0; + if (!out) { + *out_of_memory = true; + return 0; + } ptr = str + 1; ptr2 = out; @@ -304,21 +320,13 @@ const char *parse_string(cJSON *item, const char *str) { len = 3; ptr2 += len; - switch (len) { - case 4: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - // fall through - case 3: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - // fall through - case 2: + for (size_t i = len; i > 0; i--) { + if (i == 1) { + *--ptr2 = ((unsigned char)uc | firstByteMark[len]); + } else if (i >= 2) { *--ptr2 = ((uc | 0x80) & 0xBF); uc >>= 6; - // fall through - case 1: - *--ptr2 = ((unsigned char)uc | firstByteMark[len]); + } } ptr2 += len; break; @@ -337,36 +345,39 @@ const char *parse_string(cJSON *item, const char *str) { } /* Render the cstring provided to an escaped version that can be printed. */ -char *print_string_ptr(const VkAllocationCallbacks *pAllocator, const char *str, printbuffer *p) { +static char *print_string_ptr(const VkAllocationCallbacks *pAllocator, const char *str, printbuffer *p) { const char *ptr; char *ptr2; char *out; - size_t len = 0, flag = 0; + size_t out_buf_size, len = 0, flag = 0; unsigned char token; for (ptr = str; *ptr; ptr++) flag |= ((*ptr > 0 && *ptr < 32) || (*ptr == '\"') || (*ptr == '\\')) ? 1 : 0; if (!flag) { len = ptr - str; + out_buf_size = len + 1; + // out_buf_size = len + 3; // Modified to not put quotes around the string if (p) - out = ensure(pAllocator, p, len + 3); + out = ensure(pAllocator, p, out_buf_size); else - out = (char *)cJSON_malloc(pAllocator, len + 3); + out = (char *)cJSON_malloc_instance_scope(pAllocator, out_buf_size); if (!out) return 0; ptr2 = out; - *ptr2++ = '\"'; - strcpy(ptr2, str); - ptr2[len] = '\"'; - ptr2[len + 1] = 0; + // *ptr2++ = '\"'; // Modified to not put quotes around the string + loader_strncpy(ptr2, out_buf_size, str, out_buf_size); + // ptr2[len] = '\"'; // Modified to not put quotes around the string + ptr2[len] = 0; // ptr2[len + 1] = 0; // Modified to not put quotes around the string return out; } if (!str) { + out_buf_size = 3; if (p) - out = ensure(pAllocator, p, 3); + out = ensure(pAllocator, p, out_buf_size); else - out = (char *)cJSON_malloc(pAllocator, 3); + out = (char *)cJSON_malloc_instance_scope(pAllocator, out_buf_size); if (!out) return 0; - strcpy(out, "\"\""); + loader_strncpy(out, out_buf_size, "\"\"", 3); return out; } ptr = str; @@ -380,15 +391,17 @@ char *print_string_ptr(const VkAllocationCallbacks *pAllocator, const char *str, token = *ptr; } + out_buf_size = len + 1; + // out_buf_size = len + 3; // Modified to not put quotes around the string if (p) - out = ensure(pAllocator, p, len + 3); + out = ensure(pAllocator, p, out_buf_size); else - out = (char *)cJSON_malloc(pAllocator, len + 3); + out = (char *)cJSON_malloc_instance_scope(pAllocator, out_buf_size); if (!out) return 0; ptr2 = out; ptr = str; - *ptr2++ = '\"'; + // *ptr2++ = '\"'; // Modified to not put quotes around the string while (*ptr) { if ((unsigned char)*ptr > 31 && *ptr != '\"' && *ptr != '\\') *ptr2++ = *ptr++; @@ -416,44 +429,47 @@ char *print_string_ptr(const VkAllocationCallbacks *pAllocator, const char *str, *ptr2++ = '\t'; break; default: - sprintf(ptr2, "u%04x", token); + snprintf(ptr2, out_buf_size - (ptr2 - out), "u%04x", token); ptr2 += 5; break; /* escape and print */ } } } - *ptr2++ = '\"'; + // *ptr2++ = '\"'; // Modified to not put quotes around the string *ptr2++ = 0; return out; } /* Invoke print_string_ptr (which is useful) on an item. */ -char *print_string(cJSON *item, printbuffer *p) { return print_string_ptr(item->pAllocator, item->valuestring, p); } +static char *print_string(cJSON *item, printbuffer *p) { return print_string_ptr(item->pAllocator, item->valuestring, p); } -/* Predeclare these prototypes. */ -const char *parse_value(cJSON *item, const char *value); -char *print_value(cJSON *item, int depth, int fmt, printbuffer *p); -const char *parse_array(cJSON *item, const char *value); -char *print_array(cJSON *item, int depth, int fmt, printbuffer *p); -const char *parse_object(cJSON *item, const char *value); -char *print_object(cJSON *item, int depth, int fmt, printbuffer *p); +/* Declare these prototypes. */ +static const char *parse_value(cJSON *item, const char *value, bool *out_of_memory); +static char *print_value(cJSON *item, int depth, int fmt, printbuffer *p); +static const char *parse_array(cJSON *item, const char *value, bool *out_of_memory); +static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p); +static const char *parse_object(cJSON *item, const char *value, bool *out_of_memory); +static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p); /* Utility to jump whitespace and cr/lf */ -const char *skip(const char *in) { +static const char *skip(const char *in) { while (in && *in && (unsigned char)*in <= 32) in++; return in; } /* Parse an object - create a new root, and populate. */ -cJSON *cJSON_ParseWithOpts(const VkAllocationCallbacks *pAllocator, const char *value, const char **return_parse_end, - int require_null_terminated) { +static cJSON *cJSON_ParseWithOpts(const VkAllocationCallbacks *pAllocator, const char *value, const char **return_parse_end, + int require_null_terminated, bool *out_of_memory) { const char *end = 0; cJSON *c = cJSON_New_Item(pAllocator); - ep = 0; - if (!c) return 0; /* memory fail */ + // ep = 0; // commented out as it is unused + if (!c) { + *out_of_memory = true; + return 0; /* memory fail */ + } - end = parse_value(c, skip(value)); + end = parse_value(c, skip(value), out_of_memory); if (!end) { - cJSON_Delete(c); + loader_cJSON_Delete(c); return 0; } /* parse failure. ep is set. */ @@ -462,8 +478,8 @@ cJSON *cJSON_ParseWithOpts(const VkAllocationCallbacks *pAllocator, const char * if (require_null_terminated) { end = skip(end); if (*end) { - cJSON_Delete(c); - ep = end; + loader_cJSON_Delete(c); + // ep = end; // commented out as it is unused return 0; } } @@ -471,24 +487,16 @@ cJSON *cJSON_ParseWithOpts(const VkAllocationCallbacks *pAllocator, const char * return c; } /* Default options for cJSON_Parse */ -cJSON *cJSON_Parse(const VkAllocationCallbacks *pAllocator, const char *value) { - return cJSON_ParseWithOpts(pAllocator, value, 0, 0); +static cJSON *cJSON_Parse(const VkAllocationCallbacks *pAllocator, const char *value, bool *out_of_memory) { + return cJSON_ParseWithOpts(pAllocator, value, 0, 0, out_of_memory); } /* Render a cJSON item/entity/structure to text. */ -char *cJSON_Print(cJSON *item) { return print_value(item, 0, 1, 0); } -char *cJSON_PrintUnformatted(cJSON *item) { return print_value(item, 0, 0, 0); } - -char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt) { - printbuffer p; - p.buffer = (char *)cJSON_malloc(item->pAllocator, prebuffer); - p.length = prebuffer; - p.offset = 0; - return print_value(item, 0, fmt, &p); -} +char *loader_cJSON_Print(cJSON *item) { return print_value(item, 0, 1, 0); } +char *loader_cJSON_PrintUnformatted(cJSON *item) { return print_value(item, 0, 0, 0); } /* Parser core - when encountering text, process appropriately. */ -const char *parse_value(cJSON *item, const char *value) { +static const char *parse_value(cJSON *item, const char *value, bool *out_of_memory) { if (!value) return 0; /* Fail on null. */ if (!strncmp(value, "null", 4)) { item->type = cJSON_NULL; @@ -504,41 +512,41 @@ const char *parse_value(cJSON *item, const char *value) { return value + 4; } if (*value == '\"') { - return parse_string(item, value); + return parse_string(item, value, out_of_memory); } if (*value == '-' || (*value >= '0' && *value <= '9')) { return parse_number(item, value); } if (*value == '[') { - return parse_array(item, value); + return parse_array(item, value, out_of_memory); } if (*value == '{') { - return parse_object(item, value); + return parse_object(item, value, out_of_memory); } - ep = value; + // ep = value; // commented out as it is unused return 0; /* failure. */ } /* Render a value to text. */ -char *print_value(cJSON *item, int depth, int fmt, printbuffer *p) { +static char *print_value(cJSON *item, int depth, int fmt, printbuffer *p) { char *out = 0; if (!item) return 0; if (p) { switch ((item->type) & 255) { case cJSON_NULL: { out = ensure(item->pAllocator, p, 5); - if (out) strcpy(out, "null"); + if (out) loader_strncpy(out, 5, "null", 5); break; } case cJSON_False: { out = ensure(item->pAllocator, p, 6); - if (out) strcpy(out, "false"); + if (out) loader_strncpy(out, 6, "false", 6); break; } case cJSON_True: { out = ensure(item->pAllocator, p, 5); - if (out) strcpy(out, "true"); + if (out) loader_strncpy(out, 5, "true", 5); break; } case cJSON_Number: @@ -583,10 +591,10 @@ char *print_value(cJSON *item, int depth, int fmt, printbuffer *p) { } /* Build an array from input text. */ -const char *parse_array(cJSON *item, const char *value) { +static const char *parse_array(cJSON *item, const char *value, bool *out_of_memory) { cJSON *child; if (*value != '[') { - ep = value; + // ep = value; // commented out as it is unused return 0; } /* not an array! */ @@ -595,28 +603,34 @@ const char *parse_array(cJSON *item, const char *value) { if (*value == ']') return value + 1; /* empty array. */ item->child = child = cJSON_New_Item(item->pAllocator); - if (!item->child) return 0; /* memory fail */ - value = skip(parse_value(child, skip(value))); /* skip any spacing, get the value. */ + if (!item->child) { + *out_of_memory = true; + return 0; /* memory fail */ + } + value = skip(parse_value(child, skip(value), out_of_memory)); /* skip any spacing, get the value. */ if (!value) return 0; while (*value == ',') { cJSON *new_item; new_item = cJSON_New_Item(item->pAllocator); - if (!new_item) return 0; /* memory fail */ + if (!new_item) { + *out_of_memory = true; + return 0; /* memory fail */ + } child->next = new_item; new_item->prev = child; child = new_item; - value = skip(parse_value(child, skip(value + 1))); + value = skip(parse_value(child, skip(value + 1), out_of_memory)); if (!value) return 0; /* memory fail */ } if (*value == ']') return value + 1; /* end of array */ - ep = value; + // ep = value; // commented out as it is unused return 0; /* malformed. */ } /* Render an array to text */ -char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { +static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { char **entries; char *out = 0, *ptr, *ret; size_t len = 5; @@ -632,7 +646,7 @@ char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { out = ensure(item->pAllocator, p, 3); else out = (char *)cJSON_malloc(item->pAllocator, 3); - if (out) strcpy(out, "[]"); + if (out) loader_strncpy(out, 3, "[]", 3); return out; } @@ -716,10 +730,10 @@ char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { } /* Build an object from the text. */ -const char *parse_object(cJSON *item, const char *value) { +static const char *parse_object(cJSON *item, const char *value, bool *out_of_memory) { cJSON *child; if (*value != '{') { - ep = value; + // ep = value; // commented out as it is unused return 0; } /* not an object! */ @@ -728,44 +742,50 @@ const char *parse_object(cJSON *item, const char *value) { if (*value == '}') return value + 1; /* empty array. */ item->child = child = cJSON_New_Item(item->pAllocator); - if (!item->child) return 0; - value = skip(parse_string(child, skip(value))); + if (!item->child) { + *out_of_memory = true; + return 0; + } + value = skip(parse_string(child, skip(value), out_of_memory)); if (!value) return 0; child->string = child->valuestring; child->valuestring = 0; if (*value != ':') { - ep = value; + // ep = value; // commented out as it is unused return 0; - } /* fail! */ - value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ + } /* fail! */ + value = skip(parse_value(child, skip(value + 1), out_of_memory)); /* skip any spacing, get the value. */ if (!value) return 0; while (*value == ',') { cJSON *new_item; new_item = cJSON_New_Item(item->pAllocator); - if (!new_item) return 0; /* memory fail */ + if (!new_item) { + *out_of_memory = true; + return 0; /* memory fail */ + } child->next = new_item; new_item->prev = child; child = new_item; - value = skip(parse_string(child, skip(value + 1))); + value = skip(parse_string(child, skip(value + 1), out_of_memory)); if (!value) return 0; child->string = child->valuestring; child->valuestring = 0; if (*value != ':') { - ep = value; + // ep = value; // commented out as it is unused return 0; - } /* fail! */ - value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ + } /* fail! */ + value = skip(parse_value(child, skip(value + 1), out_of_memory)); /* skip any spacing, get the value. */ if (!value) return 0; } if (*value == '}') return value + 1; /* end of array */ - ep = value; + // ep = value; // commented out as it is unused return 0; /* malformed. */ } /* Render an object to text. */ -char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { +static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { char **entries = 0, **names = 0; char *out = 0, *ptr, *ret, *str; int j; @@ -893,8 +913,9 @@ char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { ptr += tmplen; *ptr++ = ':'; if (fmt) *ptr++ = '\t'; - strcpy(ptr, entries[j]); - ptr += strlen(entries[j]); + size_t entries_size = strlen(entries[j]); + loader_strncpy(ptr, len - (ptr - out), entries[j], entries_size); + ptr += entries_size; if (j != numentries - 1) *ptr++ = ','; if (fmt) *ptr++ = '\n'; *ptr = 0; @@ -913,306 +934,180 @@ char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { } /* Get Array size/item / object item. */ -int cJSON_GetArraySize(cJSON *array) { +int loader_cJSON_GetArraySize(cJSON *array) { cJSON *c = array->child; int i = 0; while (c) i++, c = c->next; return i; } -cJSON *cJSON_GetArrayItem(cJSON *array, int item) { +cJSON *loader_cJSON_GetArrayItem(cJSON *array, int item) { cJSON *c = array->child; while (c && item > 0) item--, c = c->next; return c; } -cJSON *cJSON_GetObjectItem(cJSON *object, const char *string) { +cJSON *loader_cJSON_GetObjectItem(cJSON *object, const char *string) { cJSON *c = object->child; while (c && strcmp(c->string, string)) c = c->next; return c; } -/* Utility for array list handling. */ -void suffix_object(cJSON *prev, cJSON *item) { - prev->next = item; - item->prev = prev; -} -/* Utility for handling references. */ -cJSON *create_reference(cJSON *item) { - cJSON *ref = cJSON_New_Item(item->pAllocator); - if (!ref) return 0; - memcpy(ref, item, sizeof(cJSON)); - ref->string = 0; - ref->type |= cJSON_IsReference; - ref->next = ref->prev = 0; - return ref; -} +VkResult loader_get_json(const struct loader_instance *inst, const char *filename, cJSON **json) { + FILE *file = NULL; + char *json_buf = NULL; + size_t len; + VkResult res = VK_SUCCESS; -/* Add item to array/object. */ -void cJSON_AddItemToArray(cJSON *array, cJSON *item) { - cJSON *c = array->child; - if (!item) return; - if (!c) { - array->child = item; - } else { - while (c && c->next) c = c->next; - suffix_object(c, item); + assert(json != NULL); + + *json = NULL; + +#if defined(_WIN32) + int filename_utf16_size = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0); + if (filename_utf16_size > 0) { + wchar_t *filename_utf16 = (wchar_t *)loader_stack_alloc(filename_utf16_size * sizeof(wchar_t)); + if (MultiByteToWideChar(CP_UTF8, 0, filename, -1, filename_utf16, filename_utf16_size) == filename_utf16_size) { + errno_t wfopen_error = _wfopen_s(&file, filename_utf16, L"rb"); + if (0 != wfopen_error) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_json: Failed to open JSON file %s", filename); + } + } } -} -void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) { - if (!item) return; - if (item->string) cJSON_Free(object->pAllocator, item->string); - item->string = cJSON_strdup(object->pAllocator, string); - cJSON_AddItemToArray(object, item); -} -void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) { - if (!item) return; - if (!(item->type & cJSON_StringIsConst) && item->string) cJSON_Free(object->pAllocator, item->string); - item->string = (char *)string; - item->type |= cJSON_StringIsConst; - cJSON_AddItemToArray(object, item); -} -void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) { cJSON_AddItemToArray(array, create_reference(item)); } -void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) { - cJSON_AddItemToObject(object, string, create_reference(item)); -} +#elif COMMON_UNIX_PLATFORMS + file = fopen(filename, "rb"); +#else +#warning fopen not available on this platform +#endif + + if (!file) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_json: Failed to open JSON file %s", filename); + res = VK_ERROR_INITIALIZATION_FAILED; + goto out; + } + // NOTE: We can't just use fseek(file, 0, SEEK_END) because that isn't guaranteed to be supported on all systems + size_t fread_ret_count = 0; + do { + char buffer[256]; + fread_ret_count = fread(buffer, 1, 256, file); + } while (fread_ret_count == 256 && !feof(file)); + len = ftell(file); + fseek(file, 0, SEEK_SET); + json_buf = (char *)loader_instance_heap_calloc(inst, len + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (json_buf == NULL) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_get_json: Failed to allocate space for JSON file %s buffer of length %lu", filename, len); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + if (fread(json_buf, sizeof(char), len, file) != len) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_json: Failed to read JSON file %s.", filename); + res = VK_ERROR_INITIALIZATION_FAILED; + goto out; + } + json_buf[len] = '\0'; -cJSON *cJSON_DetachItemFromArray(cJSON *array, int which) { - cJSON *c = array->child; - while (c && which > 0) c = c->next, which--; - if (!c) return 0; - if (c->prev) c->prev->next = c->next; - if (c->next) c->next->prev = c->prev; - if (c == array->child) array->child = c->next; - c->prev = c->next = 0; - return c; -} -void cJSON_DeleteItemFromArray(cJSON *array, int which) { cJSON_Delete(cJSON_DetachItemFromArray(array, which)); } -cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string) { - int i = 0; - cJSON *c = object->child; - while (c && strcmp(c->string, string)) i++, c = c->next; - if (c) return cJSON_DetachItemFromArray(object, i); - return 0; -} -void cJSON_DeleteItemFromObject(cJSON *object, const char *string) { cJSON_Delete(cJSON_DetachItemFromObject(object, string)); } + // Can't be a valid json if the string is of length zero + if (len == 0) { + res = VK_ERROR_INITIALIZATION_FAILED; + goto out; + } + // Parse text from file + bool out_of_memory = false; + *json = cJSON_Parse(inst ? &inst->alloc_callbacks : NULL, json_buf, &out_of_memory); + if (out_of_memory) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_json: Out of Memory error occurred while parsing JSON file %s.", + filename); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } else if (*json == NULL) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_json: Invalid JSON file %s.", filename); + goto out; + } -/* Replace array/object items with new ones. */ -void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) { - cJSON *c = array->child; - while (c && which > 0) c = c->next, which--; - if (!c) { - cJSON_AddItemToArray(array, newitem); - return; +out: + loader_instance_heap_free(inst, json_buf); + if (NULL != file) { + fclose(file); } - newitem->next = c; - newitem->prev = c->prev; - c->prev = newitem; - if (c == array->child) - array->child = newitem; - else - newitem->prev->next = newitem; -} -void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) { - cJSON *c = array->child; - while (c && which > 0) c = c->next, which--; - if (!c) return; - newitem->next = c->next; - newitem->prev = c->prev; - if (newitem->next) newitem->next->prev = newitem; - if (c == array->child) - array->child = newitem; - else - newitem->prev->next = newitem; - c->next = c->prev = 0; - cJSON_Delete(c); -} -void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) { - int i = 0; - cJSON *c = object->child; - while (c && strcmp(c->string, string)) i++, c = c->next; - if (c) { - newitem->string = cJSON_strdup(object->pAllocator, string); - cJSON_ReplaceItemInArray(object, i, newitem); + if (res != VK_SUCCESS && *json != NULL) { + loader_cJSON_Delete(*json); + *json = NULL; } -} -/* Create basic types: */ -cJSON *cJSON_CreateNull(const VkAllocationCallbacks *pAllocator) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) item->type = cJSON_NULL; - return item; + return res; } -cJSON *cJSON_CreateTrue(const VkAllocationCallbacks *pAllocator) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) item->type = cJSON_True; - return item; -} -cJSON *cJSON_CreateFalse(const VkAllocationCallbacks *pAllocator) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) item->type = cJSON_False; - return item; -} -cJSON *cJSON_CreateBool(const VkAllocationCallbacks *pAllocator, int b) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) item->type = b ? cJSON_True : cJSON_False; - return item; -} -cJSON *cJSON_CreateNumber(const VkAllocationCallbacks *pAllocator, double num) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) { - item->type = cJSON_Number; - item->valuedouble = num; - item->valueint = (int)num; + +VkResult loader_parse_json_string_to_existing_str(const struct loader_instance *inst, cJSON *object, const char *key, + size_t out_str_len, char *out_string) { + cJSON *item = loader_cJSON_GetObjectItem(object, key); + if (NULL == item) { + return VK_ERROR_INITIALIZATION_FAILED; } - return item; -} -cJSON *cJSON_CreateString(const VkAllocationCallbacks *pAllocator, const char *string) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) { - item->type = cJSON_String; - item->valuestring = cJSON_strdup(pAllocator, string); + + char *str = loader_cJSON_Print(item); + if (str == NULL) { + return VK_ERROR_OUT_OF_HOST_MEMORY; } - return item; -} -cJSON *cJSON_CreateArray(const VkAllocationCallbacks *pAllocator) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) item->type = cJSON_Array; - return item; -} -cJSON *cJSON_CreateObject(const VkAllocationCallbacks *pAllocator) { - cJSON *item = cJSON_New_Item(pAllocator); - if (item) item->type = cJSON_Object; - return item; + if (NULL != out_string) { + loader_strncpy(out_string, out_str_len, str, out_str_len); + if (out_str_len > 0) { + out_string[out_str_len - 1] = '\0'; + } + } + loader_instance_heap_free(inst, str); + return VK_SUCCESS; } -/* Create Arrays: */ -cJSON *cJSON_CreateIntArray(const VkAllocationCallbacks *pAllocator, const int *numbers, int count) { - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(pAllocator); - for (i = 0; a && i < count; i++) { - n = cJSON_CreateNumber(pAllocator, numbers[i]); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; +VkResult loader_parse_json_string(cJSON *object, const char *key, char **out_string) { + cJSON *item = loader_cJSON_GetObjectItem(object, key); + if (NULL == item) { + return VK_ERROR_INITIALIZATION_FAILED; } - return a; -} -cJSON *cJSON_CreateFloatArray(const VkAllocationCallbacks *pAllocator, const float *numbers, int count) { - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(pAllocator); - for (i = 0; a && i < count; i++) { - n = cJSON_CreateNumber(pAllocator, numbers[i]); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; + + char *str = loader_cJSON_Print(item); + if (str == NULL) { + return VK_ERROR_OUT_OF_HOST_MEMORY; } - return a; -} -cJSON *cJSON_CreateDoubleArray(const VkAllocationCallbacks *pAllocator, const double *numbers, int count) { - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(pAllocator); - for (i = 0; a && i < count; i++) { - n = cJSON_CreateNumber(pAllocator, numbers[i]); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; + if (NULL != out_string) { + *out_string = str; } - return a; + return VK_SUCCESS; } -cJSON *cJSON_CreateStringArray(const VkAllocationCallbacks *pAllocator, const char **strings, int count) { - int i; - cJSON *n = 0, *p = 0, *a = cJSON_CreateArray(pAllocator); - for (i = 0; a && i < count; i++) { - n = cJSON_CreateString(pAllocator, strings[i]); - if (!i) - a->child = n; - else - suffix_object(p, n); - p = n; +VkResult loader_parse_json_array_of_strings(const struct loader_instance *inst, cJSON *object, const char *key, + struct loader_string_list *string_list) { + VkResult res = VK_SUCCESS; + cJSON *item = loader_cJSON_GetObjectItem(object, key); + if (NULL == item) { + return VK_ERROR_INITIALIZATION_FAILED; } - return a; -} -/* Duplication */ -cJSON *cJSON_Duplicate(cJSON *item, int recurse) { - cJSON *newitem, *cptr, *nptr = 0, *newchild; - /* Bail on bad ptr */ - if (!item) return 0; - /* Create new item */ - newitem = cJSON_New_Item(item->pAllocator); - if (!newitem) return 0; - /* Copy over all vars */ - newitem->type = item->type & (~cJSON_IsReference), newitem->valueint = item->valueint, newitem->valuedouble = item->valuedouble; - if (item->valuestring) { - newitem->valuestring = cJSON_strdup(item->pAllocator, item->valuestring); - if (!newitem->valuestring) { - cJSON_Delete(newitem); - return 0; - } + uint32_t count = loader_cJSON_GetArraySize(item); + if (count == 0) { + return VK_SUCCESS; } - if (item->string) { - newitem->string = cJSON_strdup(item->pAllocator, item->string); - if (!newitem->string) { - cJSON_Delete(newitem); - return 0; - } + + res = create_string_list(inst, count, string_list); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + goto out; } - /* If non-recursive, then we're done! */ - if (!recurse) return newitem; - /* Walk the ->next chain for the child. */ - cptr = item->child; - while (cptr) { - newchild = cJSON_Duplicate(cptr, 1); /* Duplicate (with recurse) each item in the ->next chain */ - if (!newchild) { - cJSON_Delete(newitem); - return 0; + for (uint32_t i = 0; i < count; i++) { + cJSON *element = loader_cJSON_GetArrayItem(item, i); + if (element == NULL) { + return VK_ERROR_INITIALIZATION_FAILED; + } + char *out_data = loader_cJSON_Print(element); + if (out_data == NULL) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + res = append_str_to_string_list(inst, string_list, out_data); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + goto out; } - if (nptr) { - nptr->next = newchild, newchild->prev = nptr; - nptr = newchild; - } /* If newitem->child already set, then crosswire ->prev and ->next and - move on */ - else { - newitem->child = newchild; - nptr = newchild; - } /* Set newitem->child and move to it */ - cptr = cptr->next; } - return newitem; -} - -void cJSON_Minify(char *json) { - char *into = json; - while (*json) { - if (*json == ' ') - json++; - else if (*json == '\t') - json++; /* Whitespace characters. */ - else if (*json == '\r') - json++; - else if (*json == '\n') - json++; - else if (*json == '/' && json[1] == '/') - while (*json && *json != '\n') json++; /* double-slash comments, to end of line. */ - else if (*json == '/' && json[1] == '*') { - while (*json && !(*json == '*' && json[1] == '/')) json++; - json += 2; - } /* multiline comments. */ - else if (*json == '\"') { - *into++ = *json++; - while (*json && *json != '\"') { - if (*json == '\\') *into++ = *json++; - *into++ = *json++; - } - *into++ = *json++; - } /* string literals, which are \" sensitive. */ - else - *into++ = *json++; /* All other characters. */ +out: + if (res == VK_ERROR_OUT_OF_HOST_MEMORY && NULL != string_list->list) { + free_string_list(inst, string_list); } - *into = 0; /* and null-terminate. */ + + return res; } diff --git a/loader/cJSON.h b/loader/cJSON.h index 9379cf84f9ef3c1084dd31ed340e5edc8bb70c03..e02af8a71839e559e1e72cb6fc28a7a531124d36 100644 --- a/loader/cJSON.h +++ b/loader/cJSON.h @@ -25,11 +25,9 @@ #pragma once -#include "loader_common.h" +#include -#ifdef __cplusplus -extern "C" { -#endif +#include /* cJSON Types: */ #define cJSON_False 0 @@ -64,96 +62,50 @@ typedef struct cJSON { VkAllocationCallbacks *pAllocator; } cJSON; -/* Supply a block of JSON, and this returns a cJSON object you can interrogate. - * Call cJSON_Delete when finished. */ -cJSON *cJSON_Parse(const VkAllocationCallbacks *pAllocator, const char *value); /* Render a cJSON entity to text for transfer/storage. Free the char* when * finished. */ -char *cJSON_Print(cJSON *item); +char *loader_cJSON_Print(cJSON *item); /* Render a cJSON entity to text for transfer/storage without any formatting. * Free the char* when finished. */ -char *cJSON_PrintUnformatted(cJSON *item); -/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess - * at the final size. guessing well reduces reallocation. fmt=0 gives - * unformatted, =1 gives formatted */ -char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt); +char *loader_cJSON_PrintUnformatted(cJSON *item); /* Delete a cJSON entity and all subentities. */ -void cJSON_Delete(cJSON *c); -/* Delete an item allocated inside the JSON parser*/ -void cJSON_Free(const VkAllocationCallbacks *pAllocator, void *p); +void loader_cJSON_Delete(cJSON *c); /* Returns the number of items in an array (or object). */ -int cJSON_GetArraySize(cJSON *array); +int loader_cJSON_GetArraySize(cJSON *array); /* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */ -cJSON *cJSON_GetArrayItem(cJSON *array, int item); +cJSON *loader_cJSON_GetArrayItem(cJSON *array, int item); /* Get item "string" from object. Case insensitive. */ -cJSON *cJSON_GetObjectItem(cJSON *object, const char *string); - -/* For analysing failed parses. This returns a pointer to the parse error. - * You'll probably need to look a few chars back to make sense of it. Defined - * when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ -const char *cJSON_GetErrorPtr(void); - -/* These calls create a cJSON item of the appropriate type. */ -cJSON *cJSON_CreateNull(const VkAllocationCallbacks *pAllocator); -cJSON *cJSON_CreateTrue(const VkAllocationCallbacks *pAllocator); -cJSON *cJSON_CreateFalse(const VkAllocationCallbacks *pAllocator); -cJSON *cJSON_CreateBool(const VkAllocationCallbacks *pAllocator, int b); -cJSON *cJSON_CreateNumber(const VkAllocationCallbacks *pAllocator, double num); -cJSON *cJSON_CreateString(const VkAllocationCallbacks *pAllocator, const char *string); -cJSON *cJSON_CreateArray(const VkAllocationCallbacks *pAllocator); -cJSON *cJSON_CreateObject(const VkAllocationCallbacks *pAllocator); - -/* These utilities create an Array of count items. */ -cJSON *cJSON_CreateIntArray(const VkAllocationCallbacks *pAllocator, const int *numbers, int count); -cJSON *cJSON_CreateFloatArray(const VkAllocationCallbacks *pAllocator, const float *numbers, int count); -cJSON *cJSON_CreateDoubleArray(const VkAllocationCallbacks *pAllocator, const double *numbers, int count); -cJSON *cJSON_CreateStringArray(const VkAllocationCallbacks *pAllocator, const char **strings, int count); - -/* Append item to the specified array/object. */ -void cJSON_AddItemToArray(cJSON *array, cJSON *item); -void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); -/* Use this when string is definitely const (i.e. a literal, or as good as), and - * will definitely survive the cJSON object */ -void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); -/* Append reference to item to the specified array/object. Use this when you - * want to add an existing cJSON to a new cJSON, but don't want to corrupt your - * existing cJSON. */ -void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); -void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); - -/* Remove/Detach items from Arrays/Objects. */ -cJSON *cJSON_DetachItemFromArray(cJSON *array, int which); -void cJSON_DeleteItemFromArray(cJSON *array, int which); -cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string); -void cJSON_DeleteItemFromObject(cJSON *object, const char *string); - -/* Update array items. */ -void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ -void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); -void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem); - -/* Duplicate a cJSON item */ -cJSON *cJSON_Duplicate(cJSON *item, int recurse); -/* Duplicate will create a new, identical cJSON item to the one you pass, in new -memory that will -need to be released. With recurse!=0, it will duplicate any children connected -to the item. -The item->next and ->prev pointers are always zero on return from Duplicate. */ - -/* ParseWithOpts allows you to require (and check) that the JSON is null - * terminated, and to retrieve the pointer to the final byte parsed. */ -cJSON *cJSON_ParseWithOpts(const VkAllocationCallbacks *pAllocator, const char *value, const char **return_parse_end, - int require_null_terminated); - -void cJSON_Minify(char *json); +cJSON *loader_cJSON_GetObjectItem(cJSON *object, const char *string); /* When assigning an integer value, it needs to be propagated to valuedouble * too. */ #define cJSON_SetIntValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) #define cJSON_SetNumberValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) -#ifdef __cplusplus -} -#endif +// Helper functions to using JSON + +struct loader_instance; +struct loader_string_list; + +// Read a JSON file into a buffer. +// +// @return - A pointer to a cJSON object representing the JSON parse tree. +// This returned buffer should be freed by caller. +VkResult loader_get_json(const struct loader_instance *inst, const char *filename, cJSON **json); + +// Given a cJSON object, find the string associated with the key and puts an pre-allocated string into out_string. +// Length is given by out_str_len, and this function truncates the string with a null terminator if it the provided space isn't +// large enough. +VkResult loader_parse_json_string_to_existing_str(const struct loader_instance *inst, cJSON *object, const char *key, + size_t out_str_len, char *out_string); + +// Given a cJSON object, find the string associated with the key and puts an allocated string into out_string. +// It is the callers responsibility to free out_string. +VkResult loader_parse_json_string(cJSON *object, const char *key, char **out_string); + +// Given a cJSON object, find the array of strings associated with they key and writes the count into out_count and data into +// out_array_of_strings. It is the callers responsibility to free out_array_of_strings. +VkResult loader_parse_json_array_of_strings(const struct loader_instance *inst, cJSON *object, const char *key, + struct loader_string_list *string_list); diff --git a/loader/debug_utils.c b/loader/debug_utils.c index fc3f9e01f1b0e87036014280d420d384114164c7..341dbb1b4d76937ae0f9fd2f1bc9de59f63b130b 100644 --- a/loader/debug_utils.c +++ b/loader/debug_utils.c @@ -27,9 +27,8 @@ #include #include #include -#ifndef WIN32 +#if !defined(WIN32) #include -#else #endif #include "vulkan/vk_layer.h" @@ -45,30 +44,32 @@ VkResult util_CreateDebugUtilsMessenger(struct loader_instance *inst, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT messenger) { - VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; + VkLayerDbgFunctionNode *new_dbg_function_node = NULL; - pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( + new_dbg_function_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (!pNewDbgFuncNode) { + if (!new_dbg_function_node) { return VK_ERROR_OUT_OF_HOST_MEMORY; } - pNewDbgFuncNode->is_messenger = true; - pNewDbgFuncNode->messenger.messenger = messenger; - pNewDbgFuncNode->messenger.pfnUserCallback = pCreateInfo->pfnUserCallback; - pNewDbgFuncNode->messenger.messageSeverity = pCreateInfo->messageSeverity; - pNewDbgFuncNode->messenger.messageType = pCreateInfo->messageType; - pNewDbgFuncNode->pUserData = pCreateInfo->pUserData; - pNewDbgFuncNode->pNext = inst->DbgFunctionHead; - inst->DbgFunctionHead = pNewDbgFuncNode; + new_dbg_function_node->is_messenger = true; + new_dbg_function_node->messenger.messenger = messenger; + new_dbg_function_node->messenger.pfnUserCallback = pCreateInfo->pfnUserCallback; + new_dbg_function_node->messenger.messageSeverity = pCreateInfo->messageSeverity; + new_dbg_function_node->messenger.messageType = pCreateInfo->messageType; + new_dbg_function_node->pUserData = pCreateInfo->pUserData; + new_dbg_function_node->pNext = inst->instance_only_dbg_function_head; + inst->instance_only_dbg_function_head = new_dbg_function_node; + inst->current_dbg_function_head = inst->instance_only_dbg_function_head; return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL -debug_utils_CreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger) { +VKAPI_ATTR VkResult VKAPI_CALL debug_utils_CreateDebugUtilsMessengerEXT(VkInstance instance, + const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDebugUtilsMessengerEXT *pMessenger) { struct loader_instance *inst = loader_get_instance(instance); loader_platform_thread_lock_mutex(&loader_lock); VkResult result = inst->disp->layer_inst_disp.CreateDebugUtilsMessengerEXT(inst->instance, pCreateInfo, pAllocator, pMessenger); @@ -82,7 +83,7 @@ VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkD VkBool32 bail = false; if (NULL != pCallbackData) { - VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; + VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; VkDebugReportObjectTypeEXT object_type = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT; VkDebugReportFlagsEXT object_flags = 0; uint64_t object_handle = 0; @@ -115,13 +116,14 @@ VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkD void util_DestroyDebugUtilsMessenger(struct loader_instance *inst, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks *pAllocator) { - VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; + VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; VkLayerDbgFunctionNode *pPrev = pTrav; while (pTrav) { if (pTrav->is_messenger && pTrav->messenger.messenger == messenger) { pPrev->pNext = pTrav->pNext; - if (inst->DbgFunctionHead == pTrav) inst->DbgFunctionHead = pTrav->pNext; + if (inst->current_dbg_function_head == pTrav) inst->current_dbg_function_head = pTrav->pNext; + if (inst->instance_only_dbg_function_head == pTrav) inst->instance_only_dbg_function_head = pTrav->pNext; loader_free_with_instance_fallback(pAllocator, inst, pTrav); break; } @@ -149,16 +151,17 @@ VkResult util_CreateDebugUtilsMessengers(struct loader_instance *inst, const voi return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL debug_utils_SubmitDebugUtilsMessageEXT( - VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, - const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) { +VKAPI_ATTR void VKAPI_CALL debug_utils_SubmitDebugUtilsMessageEXT(VkInstance instance, + VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT messageTypes, + const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) { struct loader_instance *inst = loader_get_instance(instance); inst->disp->layer_inst_disp.SubmitDebugUtilsMessageEXT(inst->instance, messageSeverity, messageTypes, pCallbackData); } -static VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, + const VkAllocationCallbacks *pAllocator) { struct loader_instance *inst = loader_get_instance(instance); loader_platform_thread_lock_mutex(&loader_lock); @@ -177,7 +180,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstanc struct loader_instance *inst = (struct loader_instance *)instance; VkResult res = VK_SUCCESS; uint32_t storage_idx; - VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; + VkLayerDbgFunctionNode *new_dbg_func_node = NULL; icd_info = (VkDebugUtilsMessengerEXT *)loader_calloc_with_instance_fallback( pAllocator, inst, inst->total_icd_count * sizeof(VkDebugUtilsMessengerEXT), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); @@ -204,23 +207,23 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstanc // Setup the debug report callback in the terminator since a layer may want // to grab the information itself (RenderDoc) and then return back to the // user callback a sub-set of the messages. - pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( + new_dbg_func_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (!pNewDbgFuncNode) { + if (!new_dbg_func_node) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - pNewDbgFuncNode->is_messenger = true; - pNewDbgFuncNode->messenger.pfnUserCallback = pCreateInfo->pfnUserCallback; - pNewDbgFuncNode->messenger.messageSeverity = pCreateInfo->messageSeverity; - pNewDbgFuncNode->messenger.messageType = pCreateInfo->messageType; - pNewDbgFuncNode->pUserData = pCreateInfo->pUserData; - pNewDbgFuncNode->pNext = inst->DbgFunctionHead; - inst->DbgFunctionHead = pNewDbgFuncNode; + new_dbg_func_node->is_messenger = true; + new_dbg_func_node->messenger.pfnUserCallback = pCreateInfo->pfnUserCallback; + new_dbg_func_node->messenger.messageSeverity = pCreateInfo->messageSeverity; + new_dbg_func_node->messenger.messageType = pCreateInfo->messageType; + new_dbg_func_node->pUserData = pCreateInfo->pUserData; + new_dbg_func_node->pNext = inst->current_dbg_function_head; + inst->current_dbg_function_head = new_dbg_func_node; - *(VkDebugUtilsMessengerEXT **)pMessenger = icd_info; - pNewDbgFuncNode->messenger.messenger = *pMessenger; + *pMessenger = (VkDebugUtilsMessengerEXT)(uintptr_t)icd_info; + new_dbg_func_node->messenger.messenger = *pMessenger; out: @@ -237,8 +240,8 @@ out: } storage_idx++; } - loader_free(pAllocator, pNewDbgFuncNode); - loader_free(pAllocator, icd_info); + loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node); + loader_free_with_instance_fallback(pAllocator, inst, icd_info); } return res; @@ -252,7 +255,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugUtilsMessengerEXT(VkInstance i const struct loader_icd_term *icd_term; struct loader_instance *inst = (struct loader_instance *)instance; - icd_info = *(VkDebugUtilsMessengerEXT **)&messenger; + icd_info = (VkDebugUtilsMessengerEXT *)(uintptr_t)messenger; storage_idx = 0; for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { if (NULL == icd_term->dispatch.DestroyDebugUtilsMessengerEXT) { @@ -267,7 +270,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugUtilsMessengerEXT(VkInstance i util_DestroyDebugUtilsMessenger(inst, messenger, pAllocator); - loader_free(pAllocator, icd_info); + loader_free_with_instance_fallback(pAllocator, inst, icd_info); } // This is the instance chain terminator function for SubmitDebugUtilsMessageEXT @@ -289,28 +292,30 @@ VKAPI_ATTR void VKAPI_CALL terminator_SubmitDebugUtilsMessageEXT(VkInstance inst VkResult util_CreateDebugReportCallback(struct loader_instance *inst, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback) { - VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; + VkLayerDbgFunctionNode *new_dbg_func_node = NULL; - pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( + new_dbg_func_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (!pNewDbgFuncNode) { + if (!new_dbg_func_node) { return VK_ERROR_OUT_OF_HOST_MEMORY; } - pNewDbgFuncNode->is_messenger = false; - pNewDbgFuncNode->report.msgCallback = callback; - pNewDbgFuncNode->report.pfnMsgCallback = pCreateInfo->pfnCallback; - pNewDbgFuncNode->report.msgFlags = pCreateInfo->flags; - pNewDbgFuncNode->pUserData = pCreateInfo->pUserData; - pNewDbgFuncNode->pNext = inst->DbgFunctionHead; - inst->DbgFunctionHead = pNewDbgFuncNode; + new_dbg_func_node->is_messenger = false; + new_dbg_func_node->report.msgCallback = callback; + new_dbg_func_node->report.pfnMsgCallback = pCreateInfo->pfnCallback; + new_dbg_func_node->report.msgFlags = pCreateInfo->flags; + new_dbg_func_node->pUserData = pCreateInfo->pUserData; + new_dbg_func_node->pNext = inst->instance_only_dbg_function_head; + inst->instance_only_dbg_function_head = new_dbg_func_node; + inst->current_dbg_function_head = inst->instance_only_dbg_function_head; return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL -debug_utils_CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) { +VKAPI_ATTR VkResult VKAPI_CALL debug_utils_CreateDebugReportCallbackEXT(VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDebugReportCallbackEXT *pCallback) { struct loader_instance *inst = loader_get_instance(instance); loader_platform_thread_lock_mutex(&loader_lock); VkResult result = inst->disp->layer_inst_disp.CreateDebugReportCallbackEXT(inst->instance, pCreateInfo, pAllocator, pCallback); @@ -322,7 +327,7 @@ debug_utils_CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugRepor 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) { VkBool32 bail = false; - VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; + VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; VkDebugUtilsMessageSeverityFlagBitsEXT severity; VkDebugUtilsMessageTypeFlagsEXT types; VkDebugUtilsMessengerCallbackDataEXT callback_data; @@ -365,13 +370,15 @@ VkBool32 util_DebugReportMessage(const struct loader_instance *inst, VkFlags msg void util_DestroyDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator) { - VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; + VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; VkLayerDbgFunctionNode *pPrev = pTrav; while (pTrav) { if (!pTrav->is_messenger && pTrav->report.msgCallback == callback) { pPrev->pNext = pTrav->pNext; - if (inst->DbgFunctionHead == pTrav) inst->DbgFunctionHead = pTrav->pNext; + if (inst->current_dbg_function_head == pTrav) inst->current_dbg_function_head = pTrav->pNext; + if (inst->instance_only_dbg_function_head == pTrav) inst->instance_only_dbg_function_head = pTrav->pNext; + if (inst->current_dbg_function_head == pTrav) inst->current_dbg_function_head = pTrav->pNext; loader_free_with_instance_fallback(pAllocator, inst, pTrav); break; } @@ -399,8 +406,8 @@ VkResult util_CreateDebugReportCallbacks(struct loader_instance *inst, const voi return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks *pAllocator) { struct loader_instance *inst = loader_get_instance(instance); loader_platform_thread_lock_mutex(&loader_lock); @@ -409,10 +416,9 @@ static VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugReportCallbackEXT(VkIn loader_platform_thread_unlock_mutex(&loader_lock); } -static VKAPI_ATTR void VKAPI_CALL debug_utils_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objType, uint64_t object, - size_t location, int32_t msgCode, const char *pLayerPrefix, - const char *pMsg) { +VKAPI_ATTR void VKAPI_CALL debug_utils_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, + int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { struct loader_instance *inst = loader_get_instance(instance); inst->disp->layer_inst_disp.DebugReportMessageEXT(inst->instance, flags, objType, object, location, msgCode, pLayerPrefix, @@ -430,10 +436,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstanc struct loader_instance *inst = (struct loader_instance *)instance; VkResult res = VK_SUCCESS; uint32_t storage_idx; - VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; + VkLayerDbgFunctionNode *new_dbg_func_node = NULL; - icd_info = ((VkDebugReportCallbackEXT *)loader_calloc(pAllocator, inst->total_icd_count * sizeof(VkDebugReportCallbackEXT), - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); + icd_info = ((VkDebugReportCallbackEXT *)loader_calloc_with_instance_fallback( + pAllocator, inst, inst->total_icd_count * sizeof(VkDebugReportCallbackEXT), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); if (!icd_info) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -456,23 +462,23 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstanc // Setup the debug report callback in the terminator since a layer may want // to grab the information itself (RenderDoc) and then return back to the // user callback a sub-set of the messages. - pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( + new_dbg_func_node = (VkLayerDbgFunctionNode *)loader_calloc_with_instance_fallback( pAllocator, inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (!pNewDbgFuncNode) { + if (!new_dbg_func_node) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - pNewDbgFuncNode->is_messenger = false; - pNewDbgFuncNode->report.pfnMsgCallback = pCreateInfo->pfnCallback; - pNewDbgFuncNode->report.msgFlags = pCreateInfo->flags; - pNewDbgFuncNode->pUserData = pCreateInfo->pUserData; - pNewDbgFuncNode->pNext = inst->DbgFunctionHead; - inst->DbgFunctionHead = pNewDbgFuncNode; + new_dbg_func_node->is_messenger = false; + new_dbg_func_node->report.pfnMsgCallback = pCreateInfo->pfnCallback; + new_dbg_func_node->report.msgFlags = pCreateInfo->flags; + new_dbg_func_node->pUserData = pCreateInfo->pUserData; + new_dbg_func_node->pNext = inst->current_dbg_function_head; + inst->current_dbg_function_head = new_dbg_func_node; - *(VkDebugReportCallbackEXT **)pCallback = icd_info; - pNewDbgFuncNode->report.msgCallback = *pCallback; + *pCallback = (VkDebugReportCallbackEXT)(uintptr_t)icd_info; + new_dbg_func_node->report.msgCallback = *pCallback; out: @@ -489,8 +495,8 @@ out: } storage_idx++; } - loader_free(pAllocator, pNewDbgFuncNode); - loader_free(pAllocator, icd_info); + loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node); + loader_free_with_instance_fallback(pAllocator, inst, icd_info); } return res; @@ -504,7 +510,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance i const struct loader_icd_term *icd_term; struct loader_instance *inst = (struct loader_instance *)instance; - icd_info = *(VkDebugReportCallbackEXT **)&callback; + icd_info = (VkDebugReportCallbackEXT *)(uintptr_t)callback; storage_idx = 0; for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { if (NULL == icd_term->dispatch.DestroyDebugReportCallbackEXT) { @@ -519,7 +525,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance i util_DestroyDebugReportCallback(inst, callback, pAllocator); - loader_free(pAllocator, icd_info); + loader_free_with_instance_fallback(pAllocator, inst, icd_info); } // This is the instance chain terminator function for DebugReportMessage @@ -548,25 +554,25 @@ VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(VkInstance instance, // General utilities -static const VkExtensionProperties debug_utils_extension_info[] = { +const VkExtensionProperties debug_utils_extension_info[] = { {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}, {VK_EXT_DEBUG_UTILS_EXTENSION_NAME, VK_EXT_DEBUG_UTILS_SPEC_VERSION}, }; void destroy_debug_callbacks_chain(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator) { - VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; + VkLayerDbgFunctionNode *pTrav = inst->current_dbg_function_head; VkLayerDbgFunctionNode *pNext = NULL; while (pTrav) { pNext = pTrav->pNext; loader_free_with_instance_fallback(pAllocator, inst, pTrav); pTrav = pNext; } - inst->DbgFunctionHead = NULL; + inst->current_dbg_function_head = NULL; } -void add_debug_extensions_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list) { - loader_add_to_ext_list(inst, ext_list, sizeof(debug_utils_extension_info) / sizeof(VkExtensionProperties), - debug_utils_extension_info); +VkResult add_debug_extensions_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list) { + return loader_add_to_ext_list(inst, ext_list, sizeof(debug_utils_extension_info) / sizeof(VkExtensionProperties), + debug_utils_extension_info); } void check_for_enabled_debug_extensions(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { diff --git a/loader/debug_utils.h b/loader/debug_utils.h index dec1108f1afc88822cd4dceabae25ba789200580..9472ef94744485464918a51631f04990b7eba708 100644 --- a/loader/debug_utils.h +++ b/loader/debug_utils.h @@ -28,7 +28,7 @@ // General utilities -void add_debug_extensions_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list); +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); bool debug_utils_ReportFlagsToAnnotFlags(VkDebugReportFlagsEXT dr_flags, bool default_flag_is_spec, diff --git a/loader/dev_ext_trampoline.c b/loader/dev_ext_trampoline.c index 9605c13fd9679c1803bee84940daadd2bb952687..ae284671366770dfc340ae657956febc36f7f699 100644 --- a/loader/dev_ext_trampoline.c +++ b/loader/dev_ext_trampoline.c @@ -24,259 +24,266 @@ #pragma GCC optimize(3) // force gcc to use tail-calls #endif +// The asm declaration prevents name mangling which is necessary for macOS +#if defined(MODIFY_UNKNOWN_FUNCTION_DECLS) +#define ASM_NAME(name) __asm(name) +#else +#define ASM_NAME(name) +#endif + // Clang-format does not understand macros. // clang-format off -VKAPI_ATTR void VKAPI_CALL vkdev_ext0(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext1(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext2(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext3(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext4(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext5(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext6(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext7(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext8(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext9(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext10(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext11(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext12(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext13(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext14(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext15(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext16(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext17(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext18(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext19(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext20(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext21(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext22(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext23(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext24(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext25(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext26(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext27(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext28(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext29(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext30(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext31(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext32(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext33(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext34(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext35(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext36(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext37(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext38(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext39(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext40(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext41(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext42(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext43(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext44(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext45(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext46(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext47(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext48(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext49(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext50(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext51(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext52(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext53(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext54(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext55(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext56(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext57(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext58(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext59(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext60(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext61(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext62(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext63(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext64(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext65(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext66(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext67(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext68(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext69(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext70(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext71(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext72(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext73(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext74(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext75(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext76(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext77(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext78(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext79(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext80(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext81(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext82(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext83(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext84(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext85(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext86(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext87(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext88(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext89(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext90(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext91(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext92(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext93(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext94(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext95(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext96(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext97(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext98(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext99(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext100(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext101(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext102(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext103(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext104(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext105(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext106(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext107(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext108(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext109(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext110(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext111(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext112(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext113(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext114(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext115(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext116(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext117(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext118(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext119(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext120(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext121(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext122(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext123(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext124(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext125(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext126(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext127(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext128(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext129(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext130(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext131(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext132(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext133(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext134(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext135(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext136(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext137(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext138(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext139(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext140(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext141(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext142(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext143(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext144(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext145(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext146(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext147(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext148(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext149(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext150(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext151(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext152(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext153(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext154(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext155(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext156(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext157(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext158(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext159(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext160(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext161(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext162(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext163(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext164(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext165(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext166(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext167(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext168(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext169(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext170(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext171(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext172(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext173(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext174(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext175(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext176(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext177(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext178(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext179(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext180(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext181(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext182(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext183(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext184(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext185(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext186(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext187(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext188(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext189(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext190(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext191(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext192(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext193(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext194(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext195(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext196(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext197(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext198(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext199(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext200(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext201(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext202(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext203(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext204(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext205(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext206(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext207(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext208(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext209(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext210(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext211(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext212(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext213(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext214(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext215(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext216(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext217(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext218(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext219(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext220(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext221(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext222(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext223(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext224(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext225(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext226(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext227(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext228(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext229(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext230(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext231(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext232(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext233(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext234(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext235(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext236(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext237(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext238(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext239(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext240(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext241(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext242(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext243(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext244(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext245(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext246(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext247(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext248(VkDevice device); -VKAPI_ATTR void VKAPI_CALL vkdev_ext249(VkDevice device); +VKAPI_ATTR void VKAPI_CALL vkdev_ext0(VkDevice device) ASM_NAME("vkdev_ext0"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext1(VkDevice device) ASM_NAME("vkdev_ext1"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext2(VkDevice device) ASM_NAME("vkdev_ext2"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext3(VkDevice device) ASM_NAME("vkdev_ext3"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext4(VkDevice device) ASM_NAME("vkdev_ext4"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext5(VkDevice device) ASM_NAME("vkdev_ext5"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext6(VkDevice device) ASM_NAME("vkdev_ext6"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext7(VkDevice device) ASM_NAME("vkdev_ext7"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext8(VkDevice device) ASM_NAME("vkdev_ext8"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext9(VkDevice device) ASM_NAME("vkdev_ext9"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext10(VkDevice device) ASM_NAME("vkdev_ext10"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext11(VkDevice device) ASM_NAME("vkdev_ext11"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext12(VkDevice device) ASM_NAME("vkdev_ext12"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext13(VkDevice device) ASM_NAME("vkdev_ext13"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext14(VkDevice device) ASM_NAME("vkdev_ext14"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext15(VkDevice device) ASM_NAME("vkdev_ext15"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext16(VkDevice device) ASM_NAME("vkdev_ext16"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext17(VkDevice device) ASM_NAME("vkdev_ext17"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext18(VkDevice device) ASM_NAME("vkdev_ext18"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext19(VkDevice device) ASM_NAME("vkdev_ext19"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext20(VkDevice device) ASM_NAME("vkdev_ext20"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext21(VkDevice device) ASM_NAME("vkdev_ext21"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext22(VkDevice device) ASM_NAME("vkdev_ext22"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext23(VkDevice device) ASM_NAME("vkdev_ext23"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext24(VkDevice device) ASM_NAME("vkdev_ext24"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext25(VkDevice device) ASM_NAME("vkdev_ext25"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext26(VkDevice device) ASM_NAME("vkdev_ext26"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext27(VkDevice device) ASM_NAME("vkdev_ext27"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext28(VkDevice device) ASM_NAME("vkdev_ext28"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext29(VkDevice device) ASM_NAME("vkdev_ext29"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext30(VkDevice device) ASM_NAME("vkdev_ext30"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext31(VkDevice device) ASM_NAME("vkdev_ext31"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext32(VkDevice device) ASM_NAME("vkdev_ext32"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext33(VkDevice device) ASM_NAME("vkdev_ext33"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext34(VkDevice device) ASM_NAME("vkdev_ext34"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext35(VkDevice device) ASM_NAME("vkdev_ext35"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext36(VkDevice device) ASM_NAME("vkdev_ext36"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext37(VkDevice device) ASM_NAME("vkdev_ext37"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext38(VkDevice device) ASM_NAME("vkdev_ext38"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext39(VkDevice device) ASM_NAME("vkdev_ext39"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext40(VkDevice device) ASM_NAME("vkdev_ext40"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext41(VkDevice device) ASM_NAME("vkdev_ext41"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext42(VkDevice device) ASM_NAME("vkdev_ext42"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext43(VkDevice device) ASM_NAME("vkdev_ext43"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext44(VkDevice device) ASM_NAME("vkdev_ext44"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext45(VkDevice device) ASM_NAME("vkdev_ext45"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext46(VkDevice device) ASM_NAME("vkdev_ext46"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext47(VkDevice device) ASM_NAME("vkdev_ext47"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext48(VkDevice device) ASM_NAME("vkdev_ext48"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext49(VkDevice device) ASM_NAME("vkdev_ext49"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext50(VkDevice device) ASM_NAME("vkdev_ext50"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext51(VkDevice device) ASM_NAME("vkdev_ext51"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext52(VkDevice device) ASM_NAME("vkdev_ext52"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext53(VkDevice device) ASM_NAME("vkdev_ext53"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext54(VkDevice device) ASM_NAME("vkdev_ext54"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext55(VkDevice device) ASM_NAME("vkdev_ext55"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext56(VkDevice device) ASM_NAME("vkdev_ext56"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext57(VkDevice device) ASM_NAME("vkdev_ext57"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext58(VkDevice device) ASM_NAME("vkdev_ext58"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext59(VkDevice device) ASM_NAME("vkdev_ext59"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext60(VkDevice device) ASM_NAME("vkdev_ext60"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext61(VkDevice device) ASM_NAME("vkdev_ext61"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext62(VkDevice device) ASM_NAME("vkdev_ext62"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext63(VkDevice device) ASM_NAME("vkdev_ext63"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext64(VkDevice device) ASM_NAME("vkdev_ext64"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext65(VkDevice device) ASM_NAME("vkdev_ext65"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext66(VkDevice device) ASM_NAME("vkdev_ext66"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext67(VkDevice device) ASM_NAME("vkdev_ext67"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext68(VkDevice device) ASM_NAME("vkdev_ext68"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext69(VkDevice device) ASM_NAME("vkdev_ext69"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext70(VkDevice device) ASM_NAME("vkdev_ext70"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext71(VkDevice device) ASM_NAME("vkdev_ext71"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext72(VkDevice device) ASM_NAME("vkdev_ext72"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext73(VkDevice device) ASM_NAME("vkdev_ext73"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext74(VkDevice device) ASM_NAME("vkdev_ext74"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext75(VkDevice device) ASM_NAME("vkdev_ext75"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext76(VkDevice device) ASM_NAME("vkdev_ext76"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext77(VkDevice device) ASM_NAME("vkdev_ext77"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext78(VkDevice device) ASM_NAME("vkdev_ext78"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext79(VkDevice device) ASM_NAME("vkdev_ext79"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext80(VkDevice device) ASM_NAME("vkdev_ext80"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext81(VkDevice device) ASM_NAME("vkdev_ext81"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext82(VkDevice device) ASM_NAME("vkdev_ext82"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext83(VkDevice device) ASM_NAME("vkdev_ext83"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext84(VkDevice device) ASM_NAME("vkdev_ext84"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext85(VkDevice device) ASM_NAME("vkdev_ext85"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext86(VkDevice device) ASM_NAME("vkdev_ext86"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext87(VkDevice device) ASM_NAME("vkdev_ext87"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext88(VkDevice device) ASM_NAME("vkdev_ext88"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext89(VkDevice device) ASM_NAME("vkdev_ext89"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext90(VkDevice device) ASM_NAME("vkdev_ext90"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext91(VkDevice device) ASM_NAME("vkdev_ext91"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext92(VkDevice device) ASM_NAME("vkdev_ext92"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext93(VkDevice device) ASM_NAME("vkdev_ext93"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext94(VkDevice device) ASM_NAME("vkdev_ext94"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext95(VkDevice device) ASM_NAME("vkdev_ext95"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext96(VkDevice device) ASM_NAME("vkdev_ext96"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext97(VkDevice device) ASM_NAME("vkdev_ext97"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext98(VkDevice device) ASM_NAME("vkdev_ext98"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext99(VkDevice device) ASM_NAME("vkdev_ext99"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext100(VkDevice device) ASM_NAME("vkdev_ext100"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext101(VkDevice device) ASM_NAME("vkdev_ext101"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext102(VkDevice device) ASM_NAME("vkdev_ext102"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext103(VkDevice device) ASM_NAME("vkdev_ext103"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext104(VkDevice device) ASM_NAME("vkdev_ext104"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext105(VkDevice device) ASM_NAME("vkdev_ext105"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext106(VkDevice device) ASM_NAME("vkdev_ext106"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext107(VkDevice device) ASM_NAME("vkdev_ext107"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext108(VkDevice device) ASM_NAME("vkdev_ext108"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext109(VkDevice device) ASM_NAME("vkdev_ext109"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext110(VkDevice device) ASM_NAME("vkdev_ext110"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext111(VkDevice device) ASM_NAME("vkdev_ext111"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext112(VkDevice device) ASM_NAME("vkdev_ext112"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext113(VkDevice device) ASM_NAME("vkdev_ext113"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext114(VkDevice device) ASM_NAME("vkdev_ext114"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext115(VkDevice device) ASM_NAME("vkdev_ext115"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext116(VkDevice device) ASM_NAME("vkdev_ext116"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext117(VkDevice device) ASM_NAME("vkdev_ext117"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext118(VkDevice device) ASM_NAME("vkdev_ext118"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext119(VkDevice device) ASM_NAME("vkdev_ext119"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext120(VkDevice device) ASM_NAME("vkdev_ext120"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext121(VkDevice device) ASM_NAME("vkdev_ext121"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext122(VkDevice device) ASM_NAME("vkdev_ext122"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext123(VkDevice device) ASM_NAME("vkdev_ext123"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext124(VkDevice device) ASM_NAME("vkdev_ext124"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext125(VkDevice device) ASM_NAME("vkdev_ext125"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext126(VkDevice device) ASM_NAME("vkdev_ext126"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext127(VkDevice device) ASM_NAME("vkdev_ext127"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext128(VkDevice device) ASM_NAME("vkdev_ext128"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext129(VkDevice device) ASM_NAME("vkdev_ext129"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext130(VkDevice device) ASM_NAME("vkdev_ext130"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext131(VkDevice device) ASM_NAME("vkdev_ext131"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext132(VkDevice device) ASM_NAME("vkdev_ext132"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext133(VkDevice device) ASM_NAME("vkdev_ext133"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext134(VkDevice device) ASM_NAME("vkdev_ext134"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext135(VkDevice device) ASM_NAME("vkdev_ext135"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext136(VkDevice device) ASM_NAME("vkdev_ext136"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext137(VkDevice device) ASM_NAME("vkdev_ext137"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext138(VkDevice device) ASM_NAME("vkdev_ext138"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext139(VkDevice device) ASM_NAME("vkdev_ext139"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext140(VkDevice device) ASM_NAME("vkdev_ext140"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext141(VkDevice device) ASM_NAME("vkdev_ext141"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext142(VkDevice device) ASM_NAME("vkdev_ext142"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext143(VkDevice device) ASM_NAME("vkdev_ext143"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext144(VkDevice device) ASM_NAME("vkdev_ext144"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext145(VkDevice device) ASM_NAME("vkdev_ext145"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext146(VkDevice device) ASM_NAME("vkdev_ext146"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext147(VkDevice device) ASM_NAME("vkdev_ext147"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext148(VkDevice device) ASM_NAME("vkdev_ext148"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext149(VkDevice device) ASM_NAME("vkdev_ext149"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext150(VkDevice device) ASM_NAME("vkdev_ext150"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext151(VkDevice device) ASM_NAME("vkdev_ext151"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext152(VkDevice device) ASM_NAME("vkdev_ext152"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext153(VkDevice device) ASM_NAME("vkdev_ext153"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext154(VkDevice device) ASM_NAME("vkdev_ext154"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext155(VkDevice device) ASM_NAME("vkdev_ext155"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext156(VkDevice device) ASM_NAME("vkdev_ext156"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext157(VkDevice device) ASM_NAME("vkdev_ext157"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext158(VkDevice device) ASM_NAME("vkdev_ext158"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext159(VkDevice device) ASM_NAME("vkdev_ext159"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext160(VkDevice device) ASM_NAME("vkdev_ext160"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext161(VkDevice device) ASM_NAME("vkdev_ext161"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext162(VkDevice device) ASM_NAME("vkdev_ext162"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext163(VkDevice device) ASM_NAME("vkdev_ext163"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext164(VkDevice device) ASM_NAME("vkdev_ext164"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext165(VkDevice device) ASM_NAME("vkdev_ext165"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext166(VkDevice device) ASM_NAME("vkdev_ext166"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext167(VkDevice device) ASM_NAME("vkdev_ext167"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext168(VkDevice device) ASM_NAME("vkdev_ext168"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext169(VkDevice device) ASM_NAME("vkdev_ext169"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext170(VkDevice device) ASM_NAME("vkdev_ext170"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext171(VkDevice device) ASM_NAME("vkdev_ext171"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext172(VkDevice device) ASM_NAME("vkdev_ext172"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext173(VkDevice device) ASM_NAME("vkdev_ext173"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext174(VkDevice device) ASM_NAME("vkdev_ext174"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext175(VkDevice device) ASM_NAME("vkdev_ext175"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext176(VkDevice device) ASM_NAME("vkdev_ext176"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext177(VkDevice device) ASM_NAME("vkdev_ext177"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext178(VkDevice device) ASM_NAME("vkdev_ext178"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext179(VkDevice device) ASM_NAME("vkdev_ext179"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext180(VkDevice device) ASM_NAME("vkdev_ext180"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext181(VkDevice device) ASM_NAME("vkdev_ext181"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext182(VkDevice device) ASM_NAME("vkdev_ext182"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext183(VkDevice device) ASM_NAME("vkdev_ext183"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext184(VkDevice device) ASM_NAME("vkdev_ext184"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext185(VkDevice device) ASM_NAME("vkdev_ext185"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext186(VkDevice device) ASM_NAME("vkdev_ext186"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext187(VkDevice device) ASM_NAME("vkdev_ext187"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext188(VkDevice device) ASM_NAME("vkdev_ext188"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext189(VkDevice device) ASM_NAME("vkdev_ext189"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext190(VkDevice device) ASM_NAME("vkdev_ext190"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext191(VkDevice device) ASM_NAME("vkdev_ext191"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext192(VkDevice device) ASM_NAME("vkdev_ext192"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext193(VkDevice device) ASM_NAME("vkdev_ext193"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext194(VkDevice device) ASM_NAME("vkdev_ext194"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext195(VkDevice device) ASM_NAME("vkdev_ext195"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext196(VkDevice device) ASM_NAME("vkdev_ext196"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext197(VkDevice device) ASM_NAME("vkdev_ext197"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext198(VkDevice device) ASM_NAME("vkdev_ext198"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext199(VkDevice device) ASM_NAME("vkdev_ext199"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext200(VkDevice device) ASM_NAME("vkdev_ext200"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext201(VkDevice device) ASM_NAME("vkdev_ext201"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext202(VkDevice device) ASM_NAME("vkdev_ext202"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext203(VkDevice device) ASM_NAME("vkdev_ext203"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext204(VkDevice device) ASM_NAME("vkdev_ext204"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext205(VkDevice device) ASM_NAME("vkdev_ext205"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext206(VkDevice device) ASM_NAME("vkdev_ext206"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext207(VkDevice device) ASM_NAME("vkdev_ext207"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext208(VkDevice device) ASM_NAME("vkdev_ext208"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext209(VkDevice device) ASM_NAME("vkdev_ext209"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext210(VkDevice device) ASM_NAME("vkdev_ext210"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext211(VkDevice device) ASM_NAME("vkdev_ext211"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext212(VkDevice device) ASM_NAME("vkdev_ext212"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext213(VkDevice device) ASM_NAME("vkdev_ext213"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext214(VkDevice device) ASM_NAME("vkdev_ext214"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext215(VkDevice device) ASM_NAME("vkdev_ext215"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext216(VkDevice device) ASM_NAME("vkdev_ext216"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext217(VkDevice device) ASM_NAME("vkdev_ext217"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext218(VkDevice device) ASM_NAME("vkdev_ext218"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext219(VkDevice device) ASM_NAME("vkdev_ext219"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext220(VkDevice device) ASM_NAME("vkdev_ext220"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext221(VkDevice device) ASM_NAME("vkdev_ext221"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext222(VkDevice device) ASM_NAME("vkdev_ext222"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext223(VkDevice device) ASM_NAME("vkdev_ext223"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext224(VkDevice device) ASM_NAME("vkdev_ext224"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext225(VkDevice device) ASM_NAME("vkdev_ext225"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext226(VkDevice device) ASM_NAME("vkdev_ext226"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext227(VkDevice device) ASM_NAME("vkdev_ext227"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext228(VkDevice device) ASM_NAME("vkdev_ext228"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext229(VkDevice device) ASM_NAME("vkdev_ext229"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext230(VkDevice device) ASM_NAME("vkdev_ext230"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext231(VkDevice device) ASM_NAME("vkdev_ext231"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext232(VkDevice device) ASM_NAME("vkdev_ext232"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext233(VkDevice device) ASM_NAME("vkdev_ext233"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext234(VkDevice device) ASM_NAME("vkdev_ext234"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext235(VkDevice device) ASM_NAME("vkdev_ext235"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext236(VkDevice device) ASM_NAME("vkdev_ext236"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext237(VkDevice device) ASM_NAME("vkdev_ext237"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext238(VkDevice device) ASM_NAME("vkdev_ext238"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext239(VkDevice device) ASM_NAME("vkdev_ext239"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext240(VkDevice device) ASM_NAME("vkdev_ext240"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext241(VkDevice device) ASM_NAME("vkdev_ext241"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext242(VkDevice device) ASM_NAME("vkdev_ext242"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext243(VkDevice device) ASM_NAME("vkdev_ext243"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext244(VkDevice device) ASM_NAME("vkdev_ext244"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext245(VkDevice device) ASM_NAME("vkdev_ext245"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext246(VkDevice device) ASM_NAME("vkdev_ext246"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext247(VkDevice device) ASM_NAME("vkdev_ext247"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext248(VkDevice device) ASM_NAME("vkdev_ext248"); +VKAPI_ATTR void VKAPI_CALL vkdev_ext249(VkDevice device) ASM_NAME("vkdev_ext249"); void *loader_get_dev_ext_trampoline(uint32_t index) { switch (index) { diff --git a/loader/dirent_on_windows.c b/loader/dirent_on_windows.c index 779291aaeb007d4255b9ec5cda696a44a07bbdf0..82309cb2edfdf02129557209a1a0e17e06facfee 100644 --- a/loader/dirent_on_windows.c +++ b/loader/dirent_on_windows.c @@ -16,7 +16,7 @@ #include "allocation.h" -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif @@ -36,11 +36,12 @@ DIR *opendir(const VkAllocationCallbacks *pAllocator, const char *name) { size_t base_length = strlen(name); const char *all = /* search pattern must end with suitable wildcard */ strchr("/\\", name[base_length - 1]) ? "*" : "/*"; + size_t full_length = base_length + strlen(all) + 1; if ((dir = (DIR *)loader_alloc(pAllocator, sizeof *dir, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND)) != 0 && - (dir->name = (char *)loader_alloc(pAllocator, base_length + strlen(all) + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND)) != - 0) { - strcat(strcpy(dir->name, name), all); + (dir->name = (char *)loader_calloc(pAllocator, full_length, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND)) != 0) { + loader_strncpy(dir->name, full_length, name, base_length); + loader_strncat(dir->name, full_length, all, strlen(all)); if ((dir->handle = (handle_type)_findfirst(dir->name, &dir->info)) != -1) { dir->result.d_name = 0; @@ -108,7 +109,7 @@ void rewinddir(DIR *dir) { } } -#ifdef __cplusplus +#if defined(__cplusplus) } #endif diff --git a/loader/dirent_on_windows.h b/loader/dirent_on_windows.h index d11a2d4683592d49c0f3286bc44534b1acc2816c..cf55d614c397246f70e8f09ab96a1e1a94a06cc5 100644 --- a/loader/dirent_on_windows.h +++ b/loader/dirent_on_windows.h @@ -12,7 +12,7 @@ #include -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif @@ -46,6 +46,6 @@ void rewinddir(DIR *); */ -#ifdef __cplusplus +#if defined(__cplusplus) } #endif diff --git a/fuchsia/dlopen_fuchsia.c b/loader/dlopen_fuchsia.c similarity index 100% rename from fuchsia/dlopen_fuchsia.c rename to loader/dlopen_fuchsia.c diff --git a/fuchsia/dlopen_fuchsia.h b/loader/dlopen_fuchsia.h similarity index 100% rename from fuchsia/dlopen_fuchsia.h rename to loader/dlopen_fuchsia.h diff --git a/loader/extension_manual.c b/loader/extension_manual.c index 196df20b1cb7e28b395d54ddcb08aa177093fe63..b8ed8a33eb41ad784349f7002ac9ef8606e5e1c6 100644 --- a/loader/extension_manual.c +++ b/loader/extension_manual.c @@ -46,7 +46,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceExternalImageFormatPropertiesNV-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -92,7 +92,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysic const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfaceCapabilities2EXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -157,7 +157,7 @@ VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkReleaseDisplayEXT: Invalid physicalDevice [VUID-vkReleaseDisplayEXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -170,7 +170,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice phy struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (icd_term->dispatch.ReleaseDisplayEXT == NULL) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD \"%s\" associated with VkPhysicalDevice does not support vkReleaseDisplayEXT - Consequently, the call is " "invalid because it should not be possible to acquire a display on this device", icd_term->scanned_icd->lib_name); @@ -181,12 +181,12 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice phy // ---- VK_EXT_acquire_xlib_display extension trampoline/terminators -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAcquireXlibDisplayEXT: Invalid physicalDevice [VUID-vkAcquireXlibDisplayEXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -217,7 +217,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetRandROutputDisplayEXT(VkPhysicalDevice physica const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetRandROutputDisplayEXT: Invalid physicalDevice [VUID-vkGetRandROutputDisplayEXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -247,7 +247,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDev #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModes2EXT(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pPresentModeCount, @@ -255,7 +255,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModes2EXT(VkPhysic const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSurfacePresentModes2EXT: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfacePresentModes2EXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -270,7 +270,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModes2E 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.GetPhysicalDeviceSurfacePresentModes2EXT) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceSurfacePresentModes2EXT"); abort(); } @@ -293,7 +293,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModes2EXT(VkDevice de VkDeviceGroupPresentModeFlagsKHR *pModes) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceGroupSurfacePresentModes2EXT: Invalid device " "[VUID-vkGetDeviceGroupSurfacePresentModes2EXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -307,18 +307,30 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModes2EXT( 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 != icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pSurfaceInfo->surface; - if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) { - VkPhysicalDeviceSurfaceInfo2KHR surface_info_copy; - surface_info_copy.sType = pSurfaceInfo->sType; - surface_info_copy.pNext = pSurfaceInfo->pNext; - surface_info_copy.surface = icd_surface->real_icd_surfaces[icd_index]; - return icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, &surface_info_copy, pModes); - } - return icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, pSurfaceInfo, pModes); + if (NULL == icd_term || NULL == dev || + NULL == dev->loader_dispatch.extension_terminator_dispatch.GetDeviceGroupSurfacePresentModes2EXT) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetDeviceGroupSurfacePresentModes2EXT Terminator: Invalid device handle. This is likely the result of a " + "layer wrapping device handles and failing to unwrap them in all functions. " + "[VUID-vkGetDeviceGroupSurfacePresentModes2EXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (NULL == pSurfaceInfo) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetDeviceGroupSurfacePresentModes2EXT: Invalid pSurfaceInfo pointer " + "[VUID-vkGetDeviceGroupSurfacePresentModes2EXT-pSurfaceInfo-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pSurfaceInfo->surface; + if (NULL != icd_surface->real_icd_surfaces && NULL != (void *)(uintptr_t)icd_surface->real_icd_surfaces[icd_index]) { + VkPhysicalDeviceSurfaceInfo2KHR surface_info_copy; + surface_info_copy.sType = pSurfaceInfo->sType; + surface_info_copy.pNext = pSurfaceInfo->pNext; + surface_info_copy.surface = icd_surface->real_icd_surfaces[icd_index]; + return dev->loader_dispatch.extension_terminator_dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, &surface_info_copy, + pModes); } - return VK_SUCCESS; + return dev->loader_dispatch.extension_terminator_dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, pSurfaceInfo, pModes); } #endif // VK_USE_PLATFORM_WIN32_KHR @@ -330,7 +342,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevi const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceToolPropertiesEXT: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceToolPropertiesEXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ diff --git a/loader/extension_manual.h b/loader/extension_manual.h index 5c6906e73f4a40f691377703e71e8f8f5c0e1892..0ba63ef1fa8133d9e4985c0e13d7e5a90c37e07f 100644 --- a/loader/extension_manual.h +++ b/loader/extension_manual.h @@ -49,7 +49,7 @@ VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display); -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, @@ -62,7 +62,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDev VkDisplayKHR* pDisplay); #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModes2EXT(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pPresentModeCount, diff --git a/loader/generated/.clang-format b/loader/generated/.clang-format deleted file mode 100644 index 3bb983a45f43d95adca6aae8fdb4d4509bf1ec87..0000000000000000000000000000000000000000 --- a/loader/generated/.clang-format +++ /dev/null @@ -1,5 +0,0 @@ ---- -# Disable clang-format for generated code -DisableFormat: true -SortIncludes: false -... diff --git a/loader/generated/vk_dispatch_table_helper.h b/loader/generated/vk_dispatch_table_helper.h index 223147bdd1e5f9aee023d8a67e1172ad6c48893d..a2329a66e4bcd67a0519ecffcf370e8f53373f36 100644 --- a/loader/generated/vk_dispatch_table_helper.h +++ b/loader/generated/vk_dispatch_table_helper.h @@ -29,1300 +29,720 @@ #include #include "vk_layer_dispatch_table.h" -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR* pModes) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR* pAcquireInfo, uint32_t* pImageIndex) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains) { return VK_SUCCESS; } -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateVideoSessionKHR(VkDevice device, const VkVideoSessionCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionKHR* pVideoSession) { return VK_SUCCESS; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubDestroyVideoSessionKHR(VkDevice device, VkVideoSessionKHR videoSession, const VkAllocationCallbacks* pAllocator) { } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR VkResult VKAPI_CALL StubGetVideoSessionMemoryRequirementsKHR(VkDevice device, VkVideoSessionKHR videoSession, uint32_t* pMemoryRequirementsCount, VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements) { return VK_SUCCESS; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR VkResult VKAPI_CALL StubBindVideoSessionMemoryKHR(VkDevice device, VkVideoSessionKHR videoSession, uint32_t bindSessionMemoryInfoCount, const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos) { return VK_SUCCESS; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateVideoSessionParametersKHR(VkDevice device, const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionParametersKHR* pVideoSessionParameters) { return VK_SUCCESS; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR VkResult VKAPI_CALL StubUpdateVideoSessionParametersKHR(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo) { return VK_SUCCESS; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubDestroyVideoSessionParametersKHR(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkAllocationCallbacks* pAllocator) { } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubCmdBeginVideoCodingKHR(VkCommandBuffer commandBuffer, const VkVideoBeginCodingInfoKHR* pBeginInfo) { } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubCmdEndVideoCodingKHR(VkCommandBuffer commandBuffer, const VkVideoEndCodingInfoKHR* pEndCodingInfo) { } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubCmdControlVideoCodingKHR(VkCommandBuffer commandBuffer, const VkVideoCodingControlInfoKHR* pCodingControlInfo) { } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubCmdDecodeVideoKHR(VkCommandBuffer commandBuffer, const VkVideoDecodeInfoKHR* pDecodeInfo) { } -#endif // VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubCmdBeginRenderingKHR(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdEndRenderingKHR(VkCommandBuffer commandBuffer) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDeviceGroupPeerMemoryFeaturesKHR(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDeviceMaskKHR(VkCommandBuffer commandBuffer, uint32_t deviceMask) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) { } -static VKAPI_ATTR void VKAPI_CALL StubTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) { } -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryFdKHR(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryFdPropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties) { return VK_SUCCESS; } -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubImportSemaphoreWin32HandleKHR(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSemaphoreWin32HandleKHR(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubImportSemaphoreFdKHR(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSemaphoreFdKHR(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateDescriptorUpdateTemplateKHR(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR void VKAPI_CALL StubUpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdNextSubpass2KHR(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSwapchainStatusKHR(VkDevice device, VkSwapchainKHR swapchain) { return VK_SUCCESS; } -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubImportFenceWin32HandleKHR(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetFenceWin32HandleKHR(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubImportFenceFdKHR(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetFenceFdKHR(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubAcquireProfilingLockKHR(VkDevice device, const VkAcquireProfilingLockInfoKHR* pInfo) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubReleaseProfilingLockKHR(VkDevice device) { } -static VKAPI_ATTR void VKAPI_CALL StubGetImageMemoryRequirements2KHR(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) { } -static VKAPI_ATTR void VKAPI_CALL StubGetBufferMemoryRequirements2KHR(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) { } -static VKAPI_ATTR void VKAPI_CALL StubGetImageSparseMemoryRequirements2KHR(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateSamplerYcbcrConversionKHR(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroySamplerYcbcrConversionKHR(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubBindBufferMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubBindImageMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubGetDescriptorSetLayoutSupportKHR(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSemaphoreCounterValueKHR(VkDevice device, VkSemaphore semaphore, uint64_t* pValue) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubWaitSemaphoresKHR(VkDevice device, const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubSignalSemaphoreKHR(VkDevice device, const VkSemaphoreSignalInfo* pSignalInfo) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetFragmentShadingRateKHR(VkCommandBuffer commandBuffer, const VkExtent2D* pFragmentSize, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubWaitForPresentKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t presentId, uint64_t timeout) { return VK_SUCCESS; } -static VKAPI_ATTR VkDeviceAddress VKAPI_CALL StubGetBufferDeviceAddressKHR(VkDevice device, const VkBufferDeviceAddressInfo* pInfo) { return 0L; } -static VKAPI_ATTR uint64_t VKAPI_CALL StubGetBufferOpaqueCaptureAddressKHR(VkDevice device, const VkBufferDeviceAddressInfo* pInfo) { return 0L; } -static VKAPI_ATTR uint64_t VKAPI_CALL StubGetDeviceMemoryOpaqueCaptureAddressKHR(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo) { return 0L; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateDeferredOperationKHR(VkDevice device, const VkAllocationCallbacks* pAllocator, VkDeferredOperationKHR* pDeferredOperation) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyDeferredOperationKHR(VkDevice device, VkDeferredOperationKHR operation, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR uint32_t VKAPI_CALL StubGetDeferredOperationMaxConcurrencyKHR(VkDevice device, VkDeferredOperationKHR operation) { return 0; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetDeferredOperationResultKHR(VkDevice device, VkDeferredOperationKHR operation) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubDeferredOperationJoinKHR(VkDevice device, VkDeferredOperationKHR operation) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetPipelineExecutablePropertiesKHR(VkDevice device, const VkPipelineInfoKHR* pPipelineInfo, uint32_t* pExecutableCount, VkPipelineExecutablePropertiesKHR* pProperties) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetPipelineExecutableStatisticsKHR(VkDevice device, const VkPipelineExecutableInfoKHR* pExecutableInfo, uint32_t* pStatisticCount, VkPipelineExecutableStatisticKHR* pStatistics) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetPipelineExecutableInternalRepresentationsKHR(VkDevice device, const VkPipelineExecutableInfoKHR* pExecutableInfo, uint32_t* pInternalRepresentationCount, VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations) { return VK_SUCCESS; } -#ifdef VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubCmdEncodeVideoKHR(VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo) { } -#endif // VK_ENABLE_BETA_EXTENSIONS -static VKAPI_ATTR void VKAPI_CALL StubCmdSetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo* pDependencyInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdResetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdWaitEvents2KHR(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, const VkDependencyInfo* pDependencyInfos) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdPipelineBarrier2KHR(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdWriteTimestamp2KHR(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubQueueSubmit2KHR(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdWriteBufferMarker2AMD(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker) { } -static VKAPI_ATTR void VKAPI_CALL StubGetQueueCheckpointData2NV(VkQueue queue, uint32_t* pCheckpointDataCount, VkCheckpointData2NV* pCheckpointData) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2* pCopyBufferInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyImage2KHR(VkCommandBuffer commandBuffer, const VkCopyImageInfo2* pCopyImageInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyBufferToImage2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyImageToBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBlitImage2KHR(VkCommandBuffer commandBuffer, const VkBlitImageInfo2* pBlitImageInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdResolveImage2KHR(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdTraceRaysIndirect2KHR(VkCommandBuffer commandBuffer, VkDeviceAddress indirectDeviceAddress) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDeviceBufferMemoryRequirementsKHR(VkDevice device, const VkDeviceBufferMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDeviceImageMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDeviceImageSparseMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer* pCounterBuffers, const VkDeviceSize* pCounterBufferOffsets) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer* pCounterBuffers, const VkDeviceSize* pCounterBufferOffsets) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBeginQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags, uint32_t index) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdEndQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, uint32_t index) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance, VkBuffer counterBuffer, VkDeviceSize counterBufferOffset, uint32_t counterOffset, uint32_t vertexStride) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateCuModuleNVX(VkDevice device, const VkCuModuleCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCuModuleNVX* pModule) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateCuFunctionNVX(VkDevice device, const VkCuFunctionCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCuFunctionNVX* pFunction) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyCuModuleNVX(VkDevice device, VkCuModuleNVX module, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR void VKAPI_CALL StubDestroyCuFunctionNVX(VkDevice device, VkCuFunctionNVX function, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCuLaunchKernelNVX(VkCommandBuffer commandBuffer, const VkCuLaunchInfoNVX* pLaunchInfo) { } -static VKAPI_ATTR uint32_t VKAPI_CALL StubGetImageViewHandleNVX(VkDevice device, const VkImageViewHandleInfoNVX* pInfo) { return 0; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetImageViewAddressNVX(VkDevice device, VkImageView imageView, VkImageViewAddressPropertiesNVX* pProperties) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetShaderInfoAMD(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBits shaderStage, VkShaderInfoTypeAMD infoType, size_t* pInfoSize, void* pInfo) { return VK_SUCCESS; } -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR void VKAPI_CALL StubCmdBeginConditionalRenderingEXT(VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffer) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV* pViewportWScalings) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubDisplayPowerControlEXT(VkDevice device, VkDisplayKHR display, const VkDisplayPowerInfoEXT* pDisplayPowerInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubRegisterDeviceEventEXT(VkDevice device, const VkDeviceEventInfoEXT* pDeviceEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubRegisterDisplayEventEXT(VkDevice device, VkDisplayKHR display, const VkDisplayEventInfoEXT* pDisplayEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSwapchainCounterEXT(VkDevice device, VkSwapchainKHR swapchain, VkSurfaceCounterFlagBitsEXT counter, uint64_t* pCounterValue) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetRefreshCycleDurationGOOGLE(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetPastPresentationTimingGOOGLE(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles) { } -static VKAPI_ATTR void VKAPI_CALL StubSetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata) { } -#ifdef VK_USE_PLATFORM_ANDROID_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetAndroidHardwareBufferPropertiesANDROID(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryAndroidHardwareBufferANDROID(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_ANDROID_KHR -static VKAPI_ATTR void VKAPI_CALL StubCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer, const VkSampleLocationsInfoEXT* pSampleLocationsInfo) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetImageDrmFormatModifierPropertiesEXT(VkDevice device, VkImage image, VkImageDrmFormatModifierPropertiesEXT* pProperties) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateValidationCacheEXT(VkDevice device, const VkValidationCacheCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkValidationCacheEXT* pValidationCache) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyValidationCacheEXT(VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubMergeValidationCachesEXT(VkDevice device, VkValidationCacheEXT dstCache, uint32_t srcCacheCount, const VkValidationCacheEXT* pSrcCaches) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetValidationCacheDataEXT(VkDevice device, VkValidationCacheEXT validationCache, size_t* pDataSize, void* pData) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdBindShadingRateImageNV(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkShadingRatePaletteNV* pShadingRatePalettes) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const VkCoarseSampleOrderCustomNV* pCustomSampleOrders) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateAccelerationStructureNV(VkDevice device, const VkAccelerationStructureCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureNV* pAccelerationStructure) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyAccelerationStructureNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR void VKAPI_CALL StubGetAccelerationStructureMemoryRequirementsNV(VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNV* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubBindAccelerationStructureMemoryNV(VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNV* pBindInfos) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV* pInfo, VkBuffer instanceData, VkDeviceSize instanceOffset, VkBool32 update, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkBuffer scratch, VkDeviceSize scratchOffset) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyAccelerationStructureNV(VkCommandBuffer commandBuffer, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkCopyAccelerationStructureModeKHR mode) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer, VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, uint32_t width, uint32_t height, uint32_t depth) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoNV* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetRayTracingShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetRayTracingShaderGroupHandlesNV(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, size_t dataSize, void* pData) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureNV* pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCompileDeferredNV(VkDevice device, VkPipeline pipeline, uint32_t shader) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryHostPointerPropertiesEXT(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdWriteBufferMarkerAMD(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D* pExclusiveScissors) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCheckpointNV(VkCommandBuffer commandBuffer, const void* pCheckpointMarker) { } -static VKAPI_ATTR void VKAPI_CALL StubGetQueueCheckpointDataNV(VkQueue queue, uint32_t* pCheckpointDataCount, VkCheckpointDataNV* pCheckpointData) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubInitializePerformanceApiINTEL(VkDevice device, const VkInitializePerformanceApiInfoINTEL* pInitializeInfo) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubUninitializePerformanceApiINTEL(VkDevice device) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCmdSetPerformanceMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceMarkerInfoINTEL* pMarkerInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCmdSetPerformanceStreamMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceStreamMarkerInfoINTEL* pMarkerInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCmdSetPerformanceOverrideINTEL(VkCommandBuffer commandBuffer, const VkPerformanceOverrideInfoINTEL* pOverrideInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubAcquirePerformanceConfigurationINTEL(VkDevice device, const VkPerformanceConfigurationAcquireInfoINTEL* pAcquireInfo, VkPerformanceConfigurationINTEL* pConfiguration) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubReleasePerformanceConfigurationINTEL(VkDevice device, VkPerformanceConfigurationINTEL configuration) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubQueueSetPerformanceConfigurationINTEL(VkQueue queue, VkPerformanceConfigurationINTEL configuration) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetPerformanceParameterINTEL(VkDevice device, VkPerformanceParameterTypeINTEL parameter, VkPerformanceValueINTEL* pValue) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubSetLocalDimmingAMD(VkDevice device, VkSwapchainKHR swapChain, VkBool32 localDimmingEnable) { } -static VKAPI_ATTR VkDeviceAddress VKAPI_CALL StubGetBufferDeviceAddressEXT(VkDevice device, const VkBufferDeviceAddressInfo* pInfo) { return 0L; } -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubAcquireFullScreenExclusiveModeEXT(VkDevice device, VkSwapchainKHR swapchain) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubReleaseFullScreenExclusiveModeEXT(VkDevice device, VkSwapchainKHR swapchain) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR VkResult VKAPI_CALL StubGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkDeviceGroupPresentModeFlagsKHR* pModes) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_WIN32_KHR -static VKAPI_ATTR void VKAPI_CALL StubCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern) { } -static VKAPI_ATTR void VKAPI_CALL StubResetQueryPoolEXT(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, VkFrontFace frontFace) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp) { } -static VKAPI_ATTR void VKAPI_CALL StubGetGeneratedCommandsMemoryRequirementsNV(VkDevice device, const VkGeneratedCommandsMemoryRequirementsInfoNV* pInfo, VkMemoryRequirements2* pMemoryRequirements) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdPreprocessGeneratedCommandsNV(VkCommandBuffer commandBuffer, const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdExecuteGeneratedCommandsNV(VkCommandBuffer commandBuffer, VkBool32 isPreprocessed, const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBindPipelineShaderGroupNV(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline, uint32_t groupIndex) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateIndirectCommandsLayoutNV(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkIndirectCommandsLayoutNV* pIndirectCommandsLayout) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyIndirectCommandsLayoutNV(VkDevice device, VkIndirectCommandsLayoutNV indirectCommandsLayout, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyPrivateDataSlotEXT(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubSetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData) { } -#ifdef VK_USE_PLATFORM_METAL_EXT -static VKAPI_ATTR void VKAPI_CALL StubExportMetalObjectsEXT(VkDevice device, VkExportMetalObjectsInfoEXT* pMetalObjectsInfo) { } -#endif // VK_USE_PLATFORM_METAL_EXT -static VKAPI_ATTR void VKAPI_CALL StubCmdSetFragmentShadingRateEnumNV(VkCommandBuffer commandBuffer, VkFragmentShadingRateNV shadingRate, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]) { } -static VKAPI_ATTR void VKAPI_CALL StubGetImageSubresourceLayout2EXT(VkDevice device, VkImage image, const VkImageSubresource2EXT* pSubresource, VkSubresourceLayout2EXT* pLayout) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetDeviceFaultInfoEXT(VkDevice device, VkDeviceFaultCountsEXT* pFaultCounts, VkDeviceFaultInfoEXT* pFaultInfo) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetVertexInputEXT(VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount, const VkVertexInputBindingDescription2EXT* pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount, const VkVertexInputAttributeDescription2EXT* pVertexAttributeDescriptions) { } -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryZirconHandleFUCHSIA(VkDevice device, const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryZirconHandlePropertiesFUCHSIA(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, zx_handle_t zirconHandle, VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubImportSemaphoreZirconHandleFUCHSIA(VkDevice device, const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSemaphoreZirconHandleFUCHSIA(VkDevice device, const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateBufferCollectionFUCHSIA(VkDevice device, const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferCollectionFUCHSIA* pCollection) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubSetBufferCollectionImageConstraintsFUCHSIA(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubSetBufferCollectionBufferConstraintsFUCHSIA(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR void VKAPI_CALL StubDestroyBufferCollectionFUCHSIA(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkAllocationCallbacks* pAllocator) { } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubGetBufferCollectionPropertiesFUCHSIA(VkDevice device, VkBufferCollectionFUCHSIA collection, VkBufferCollectionPropertiesFUCHSIA* pProperties) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_FUCHSIA -static VKAPI_ATTR VkResult VKAPI_CALL StubGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI(VkDevice device, VkRenderPass renderpass, VkExtent2D* pMaxWorkgroupSize) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdSubpassShadingHUAWEI(VkCommandBuffer commandBuffer) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBindInvocationMaskHUAWEI(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryRemoteAddressNV(VkDevice device, const VkMemoryGetRemoteAddressInfoNV* pMemoryGetRemoteAddressInfo, VkRemoteAddressNV* pAddress) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetPipelinePropertiesEXT(VkDevice device, const VkPipelineInfoEXT* pPipelineInfo, VkBaseOutStructure* pPipelineProperties) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetPatchControlPointsEXT(VkCommandBuffer commandBuffer, uint32_t patchControlPoints) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetRasterizerDiscardEnableEXT(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthBiasEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetLogicOpEXT(VkCommandBuffer commandBuffer, VkLogicOp logicOp) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetPrimitiveRestartEnableEXT(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetColorWriteEnableEXT(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkBool32* pColorWriteEnables) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawInfoEXT* pVertexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawIndexedInfoEXT* pIndexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride, const int32_t* pVertexOffset) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateMicromapEXT(VkDevice device, const VkMicromapCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkMicromapEXT* pMicromap) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyMicromapEXT(VkDevice device, VkMicromapEXT micromap, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBuildMicromapsEXT(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkMicromapBuildInfoEXT* pInfos) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubBuildMicromapsEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkMicromapBuildInfoEXT* pInfos) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCopyMicromapEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapInfoEXT* pInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCopyMicromapToMemoryEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapToMemoryInfoEXT* pInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCopyMemoryToMicromapEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToMicromapInfoEXT* pInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubWriteMicromapsPropertiesEXT(VkDevice device, uint32_t micromapCount, const VkMicromapEXT* pMicromaps, VkQueryType queryType, size_t dataSize, void* pData, size_t stride) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyMicromapEXT(VkCommandBuffer commandBuffer, const VkCopyMicromapInfoEXT* pInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyMicromapToMemoryEXT(VkCommandBuffer commandBuffer, const VkCopyMicromapToMemoryInfoEXT* pInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyMemoryToMicromapEXT(VkCommandBuffer commandBuffer, const VkCopyMemoryToMicromapInfoEXT* pInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdWriteMicromapsPropertiesEXT(VkCommandBuffer commandBuffer, uint32_t micromapCount, const VkMicromapEXT* pMicromaps, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDeviceMicromapCompatibilityEXT(VkDevice device, const VkMicromapVersionInfoEXT* pVersionInfo, VkAccelerationStructureCompatibilityKHR* pCompatibility) { } -static VKAPI_ATTR void VKAPI_CALL StubGetMicromapBuildSizesEXT(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkMicromapBuildInfoEXT* pBuildInfo, VkMicromapBuildSizesInfoEXT* pSizeInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubSetDeviceMemoryPriorityEXT(VkDevice device, VkDeviceMemory memory, float priority) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDescriptorSetLayoutHostMappingInfoVALVE(VkDevice device, const VkDescriptorSetBindingReferenceVALVE* pBindingReference, VkDescriptorSetLayoutHostMappingInfoVALVE* pHostMapping) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDescriptorSetHostMappingVALVE(VkDevice device, VkDescriptorSet descriptorSet, void** ppData) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetTessellationDomainOriginEXT(VkCommandBuffer commandBuffer, VkTessellationDomainOrigin domainOrigin) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthClampEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClampEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetPolygonModeEXT(VkCommandBuffer commandBuffer, VkPolygonMode polygonMode) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetRasterizationSamplesEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits rasterizationSamples) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetSampleMaskEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits samples, const VkSampleMask* pSampleMask) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetAlphaToCoverageEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToCoverageEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetAlphaToOneEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToOneEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetLogicOpEnableEXT(VkCommandBuffer commandBuffer, VkBool32 logicOpEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetColorBlendEnableEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkBool32* pColorBlendEnables) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetColorBlendEquationEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendEquationEXT* pColorBlendEquations) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetColorWriteMaskEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorComponentFlags* pColorWriteMasks) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetRasterizationStreamEXT(VkCommandBuffer commandBuffer, uint32_t rasterizationStream) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetConservativeRasterizationModeEXT(VkCommandBuffer commandBuffer, VkConservativeRasterizationModeEXT conservativeRasterizationMode) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetExtraPrimitiveOverestimationSizeEXT(VkCommandBuffer commandBuffer, float extraPrimitiveOverestimationSize) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthClipEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClipEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetSampleLocationsEnableEXT(VkCommandBuffer commandBuffer, VkBool32 sampleLocationsEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetColorBlendAdvancedEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendAdvancedEXT* pColorBlendAdvanced) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetProvokingVertexModeEXT(VkCommandBuffer commandBuffer, VkProvokingVertexModeEXT provokingVertexMode) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetLineRasterizationModeEXT(VkCommandBuffer commandBuffer, VkLineRasterizationModeEXT lineRasterizationMode) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetLineStippleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stippledLineEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetDepthClipNegativeOneToOneEXT(VkCommandBuffer commandBuffer, VkBool32 negativeOneToOne) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetViewportWScalingEnableNV(VkCommandBuffer commandBuffer, VkBool32 viewportWScalingEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetViewportSwizzleNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportSwizzleNV* pViewportSwizzles) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCoverageToColorEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageToColorEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCoverageToColorLocationNV(VkCommandBuffer commandBuffer, uint32_t coverageToColorLocation) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCoverageModulationModeNV(VkCommandBuffer commandBuffer, VkCoverageModulationModeNV coverageModulationMode) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCoverageModulationTableEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageModulationTableEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCoverageModulationTableNV(VkCommandBuffer commandBuffer, uint32_t coverageModulationTableCount, const float* pCoverageModulationTable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetShadingRateImageEnableNV(VkCommandBuffer commandBuffer, VkBool32 shadingRateImageEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetRepresentativeFragmentTestEnableNV(VkCommandBuffer commandBuffer, VkBool32 representativeFragmentTestEnable) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetCoverageReductionModeNV(VkCommandBuffer commandBuffer, VkCoverageReductionModeNV coverageReductionMode) { } -static VKAPI_ATTR void VKAPI_CALL StubGetShaderModuleIdentifierEXT(VkDevice device, VkShaderModule shaderModule, VkShaderModuleIdentifierEXT* pIdentifier) { } -static VKAPI_ATTR void VKAPI_CALL StubGetShaderModuleCreateInfoIdentifierEXT(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, VkShaderModuleIdentifierEXT* pIdentifier) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateOpticalFlowSessionNV(VkDevice device, const VkOpticalFlowSessionCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkOpticalFlowSessionNV* pSession) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyOpticalFlowSessionNV(VkDevice device, VkOpticalFlowSessionNV session, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubBindOpticalFlowSessionImageNV(VkDevice device, VkOpticalFlowSessionNV session, VkOpticalFlowSessionBindingPointNV bindingPoint, VkImageView view, VkImageLayout layout) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdOpticalFlowExecuteNV(VkCommandBuffer commandBuffer, VkOpticalFlowSessionNV session, const VkOpticalFlowExecuteInfoNV* pExecuteInfo) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetFramebufferTilePropertiesQCOM(VkDevice device, VkFramebuffer framebuffer, uint32_t* pPropertiesCount, VkTilePropertiesQCOM* pProperties) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetDynamicRenderingTilePropertiesQCOM(VkDevice device, const VkRenderingInfo* pRenderingInfo, VkTilePropertiesQCOM* pProperties) { return VK_SUCCESS; } -#ifdef VK_USE_PLATFORM_OHOS -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSwapchainGrallocUsageOHOS(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t* grallocUsage) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS -static VKAPI_ATTR VkResult VKAPI_CALL StubAcquireImageOHOS(VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS -static VKAPI_ATTR VkResult VKAPI_CALL StubQueueSignalReleaseImageOHOS(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS -static VKAPI_ATTR VkResult VKAPI_CALL StubGetNativeBufferPropertiesOHOS(VkDevice device, const struct OH_NativeBuffer* buffer, VkNativeBufferPropertiesOHOS* pProperties) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryNativeBufferOHOS(VkDevice device, const VkMemoryGetNativeBufferInfoOHOS* pInfo, struct OH_NativeBuffer** pBuffer) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateAccelerationStructureKHR(VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureKHR* pAccelerationStructure) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubDestroyAccelerationStructureKHR(VkDevice device, VkAccelerationStructureKHR accelerationStructure, const VkAllocationCallbacks* pAllocator) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBuildAccelerationStructuresKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, const VkDeviceAddress* pIndirectDeviceAddresses, const uint32_t* pIndirectStrides, const uint32_t* const* ppMaxPrimitiveCounts) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubBuildAccelerationStructuresKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureInfoKHR* pInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR* pAccelerationStructures, VkQueryType queryType, size_t dataSize, void* pData, size_t stride) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureInfoKHR* pInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyAccelerationStructureToMemoryKHR(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdCopyMemoryToAccelerationStructureKHR(VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo) { } -static VKAPI_ATTR VkDeviceAddress VKAPI_CALL StubGetAccelerationStructureDeviceAddressKHR(VkDevice device, const VkAccelerationStructureDeviceAddressInfoKHR* pInfo) { return 0L; } -static VKAPI_ATTR void VKAPI_CALL StubCmdWriteAccelerationStructuresPropertiesKHR(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR* pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) { } -static VKAPI_ATTR void VKAPI_CALL StubGetDeviceAccelerationStructureCompatibilityKHR(VkDevice device, const VkAccelerationStructureVersionInfoKHR* pVersionInfo, VkAccelerationStructureCompatibilityKHR* pCompatibility) { } -static VKAPI_ATTR void VKAPI_CALL StubGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkAccelerationStructureBuildGeometryInfoKHR* pBuildInfo, const uint32_t* pMaxPrimitiveCounts, VkAccelerationStructureBuildSizesInfoKHR* pSizeInfo) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdTraceRaysKHR(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, uint32_t width, uint32_t height, uint32_t depth) { } -static VKAPI_ATTR VkResult VKAPI_CALL StubCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) { return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL StubGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData) { return VK_SUCCESS; } -static VKAPI_ATTR void VKAPI_CALL StubCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, VkDeviceAddress indirectDeviceAddress) { } -static VKAPI_ATTR VkDeviceSize VKAPI_CALL StubGetRayTracingShaderGroupStackSizeKHR(VkDevice device, VkPipeline pipeline, uint32_t group, VkShaderGroupShaderKHR groupShader) { return 0L; } -static VKAPI_ATTR void VKAPI_CALL StubCmdSetRayTracingPipelineStackSizeKHR(VkCommandBuffer commandBuffer, uint32_t pipelineStackSize) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksEXT(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksIndirectEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { } -static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksIndirectCountEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { } - - - 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->FreeMemory = (PFN_vkFreeMemory) gpa(device, "vkFreeMemory"); - 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->GetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) gpa(device, "vkGetImageSparseMemoryRequirements"); - table->QueueBindSparse = (PFN_vkQueueBindSparse) gpa(device, "vkQueueBindSparse"); - 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->DestroyQueryPool = (PFN_vkDestroyQueryPool) gpa(device, "vkDestroyQueryPool"); - 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->CreateShaderModule = (PFN_vkCreateShaderModule) gpa(device, "vkCreateShaderModule"); - table->DestroyShaderModule = (PFN_vkDestroyShaderModule) gpa(device, "vkDestroyShaderModule"); - table->CreatePipelineCache = (PFN_vkCreatePipelineCache) gpa(device, "vkCreatePipelineCache"); - table->DestroyPipelineCache = (PFN_vkDestroyPipelineCache) gpa(device, "vkDestroyPipelineCache"); - table->GetPipelineCacheData = (PFN_vkGetPipelineCacheData) gpa(device, "vkGetPipelineCacheData"); - table->MergePipelineCaches = (PFN_vkMergePipelineCaches) gpa(device, "vkMergePipelineCaches"); - 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->DestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) gpa(device, "vkDestroyDescriptorPool"); - 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->DestroyCommandPool = (PFN_vkDestroyCommandPool) gpa(device, "vkDestroyCommandPool"); - 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->GetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) gpa(device, "vkGetImageSparseMemoryRequirements2"); - table->TrimCommandPool = (PFN_vkTrimCommandPool) gpa(device, "vkTrimCommandPool"); - table->GetDeviceQueue2 = (PFN_vkGetDeviceQueue2) gpa(device, "vkGetDeviceQueue2"); - table->CreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) gpa(device, "vkCreateSamplerYcbcrConversion"); - table->DestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) gpa(device, "vkDestroySamplerYcbcrConversion"); - table->CreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) gpa(device, "vkCreateDescriptorUpdateTemplate"); - table->DestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) gpa(device, "vkDestroyDescriptorUpdateTemplate"); - table->UpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) gpa(device, "vkUpdateDescriptorSetWithTemplate"); - 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->CreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot) gpa(device, "vkCreatePrivateDataSlot"); - table->DestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot) gpa(device, "vkDestroyPrivateDataSlot"); - table->SetPrivateData = (PFN_vkSetPrivateData) gpa(device, "vkSetPrivateData"); - table->GetPrivateData = (PFN_vkGetPrivateData) gpa(device, "vkGetPrivateData"); - table->CmdSetEvent2 = (PFN_vkCmdSetEvent2) gpa(device, "vkCmdSetEvent2"); - table->CmdResetEvent2 = (PFN_vkCmdResetEvent2) gpa(device, "vkCmdResetEvent2"); - table->CmdWaitEvents2 = (PFN_vkCmdWaitEvents2) gpa(device, "vkCmdWaitEvents2"); - table->CmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2) gpa(device, "vkCmdPipelineBarrier2"); - table->CmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2) gpa(device, "vkCmdWriteTimestamp2"); - table->QueueSubmit2 = (PFN_vkQueueSubmit2) gpa(device, "vkQueueSubmit2"); - table->CmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2) gpa(device, "vkCmdCopyBuffer2"); - table->CmdCopyImage2 = (PFN_vkCmdCopyImage2) gpa(device, "vkCmdCopyImage2"); - table->CmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2) gpa(device, "vkCmdCopyBufferToImage2"); - table->CmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2) gpa(device, "vkCmdCopyImageToBuffer2"); - table->CmdBlitImage2 = (PFN_vkCmdBlitImage2) gpa(device, "vkCmdBlitImage2"); - table->CmdResolveImage2 = (PFN_vkCmdResolveImage2) gpa(device, "vkCmdResolveImage2"); - table->CmdBeginRendering = (PFN_vkCmdBeginRendering) gpa(device, "vkCmdBeginRendering"); - table->CmdEndRendering = (PFN_vkCmdEndRendering) gpa(device, "vkCmdEndRendering"); - table->CmdSetCullMode = (PFN_vkCmdSetCullMode) gpa(device, "vkCmdSetCullMode"); - table->CmdSetFrontFace = (PFN_vkCmdSetFrontFace) gpa(device, "vkCmdSetFrontFace"); - table->CmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology) gpa(device, "vkCmdSetPrimitiveTopology"); - table->CmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount) gpa(device, "vkCmdSetViewportWithCount"); - table->CmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount) gpa(device, "vkCmdSetScissorWithCount"); - table->CmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2) gpa(device, "vkCmdBindVertexBuffers2"); - table->CmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable) gpa(device, "vkCmdSetDepthTestEnable"); - table->CmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable) gpa(device, "vkCmdSetDepthWriteEnable"); - table->CmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp) gpa(device, "vkCmdSetDepthCompareOp"); - table->CmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable) gpa(device, "vkCmdSetDepthBoundsTestEnable"); - table->CmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable) gpa(device, "vkCmdSetStencilTestEnable"); - table->CmdSetStencilOp = (PFN_vkCmdSetStencilOp) gpa(device, "vkCmdSetStencilOp"); - table->CmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable) gpa(device, "vkCmdSetRasterizerDiscardEnable"); - table->CmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable) gpa(device, "vkCmdSetDepthBiasEnable"); - table->CmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable) gpa(device, "vkCmdSetPrimitiveRestartEnable"); - table->GetDeviceBufferMemoryRequirements = (PFN_vkGetDeviceBufferMemoryRequirements) gpa(device, "vkGetDeviceBufferMemoryRequirements"); - table->GetDeviceImageMemoryRequirements = (PFN_vkGetDeviceImageMemoryRequirements) gpa(device, "vkGetDeviceImageMemoryRequirements"); - table->GetDeviceImageSparseMemoryRequirements = (PFN_vkGetDeviceImageSparseMemoryRequirements) gpa(device, "vkGetDeviceImageSparseMemoryRequirements"); - table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(device, "vkCreateSwapchainKHR"); - if (table->CreateSwapchainKHR == nullptr) { table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)StubCreateSwapchainKHR; } - table->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) gpa(device, "vkDestroySwapchainKHR"); - if (table->DestroySwapchainKHR == nullptr) { table->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)StubDestroySwapchainKHR; } - table->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) gpa(device, "vkGetSwapchainImagesKHR"); - if (table->GetSwapchainImagesKHR == nullptr) { table->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)StubGetSwapchainImagesKHR; } - table->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(device, "vkAcquireNextImageKHR"); - if (table->AcquireNextImageKHR == nullptr) { table->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)StubAcquireNextImageKHR; } - table->QueuePresentKHR = (PFN_vkQueuePresentKHR) gpa(device, "vkQueuePresentKHR"); - if (table->QueuePresentKHR == nullptr) { table->QueuePresentKHR = (PFN_vkQueuePresentKHR)StubQueuePresentKHR; } - table->GetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) gpa(device, "vkGetDeviceGroupPresentCapabilitiesKHR"); - if (table->GetDeviceGroupPresentCapabilitiesKHR == nullptr) { table->GetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR)StubGetDeviceGroupPresentCapabilitiesKHR; } - table->GetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) gpa(device, "vkGetDeviceGroupSurfacePresentModesKHR"); - if (table->GetDeviceGroupSurfacePresentModesKHR == nullptr) { table->GetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR)StubGetDeviceGroupSurfacePresentModesKHR; } - table->AcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) gpa(device, "vkAcquireNextImage2KHR"); - if (table->AcquireNextImage2KHR == nullptr) { table->AcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR)StubAcquireNextImage2KHR; } - table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR) gpa(device, "vkCreateSharedSwapchainsKHR"); - if (table->CreateSharedSwapchainsKHR == nullptr) { table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)StubCreateSharedSwapchainsKHR; } -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->CreateVideoSessionKHR = (PFN_vkCreateVideoSessionKHR) gpa(device, "vkCreateVideoSessionKHR"); - if (table->CreateVideoSessionKHR == nullptr) { table->CreateVideoSessionKHR = (PFN_vkCreateVideoSessionKHR)StubCreateVideoSessionKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->DestroyVideoSessionKHR = (PFN_vkDestroyVideoSessionKHR) gpa(device, "vkDestroyVideoSessionKHR"); - if (table->DestroyVideoSessionKHR == nullptr) { table->DestroyVideoSessionKHR = (PFN_vkDestroyVideoSessionKHR)StubDestroyVideoSessionKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->GetVideoSessionMemoryRequirementsKHR = (PFN_vkGetVideoSessionMemoryRequirementsKHR) gpa(device, "vkGetVideoSessionMemoryRequirementsKHR"); - if (table->GetVideoSessionMemoryRequirementsKHR == nullptr) { table->GetVideoSessionMemoryRequirementsKHR = (PFN_vkGetVideoSessionMemoryRequirementsKHR)StubGetVideoSessionMemoryRequirementsKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->BindVideoSessionMemoryKHR = (PFN_vkBindVideoSessionMemoryKHR) gpa(device, "vkBindVideoSessionMemoryKHR"); - if (table->BindVideoSessionMemoryKHR == nullptr) { table->BindVideoSessionMemoryKHR = (PFN_vkBindVideoSessionMemoryKHR)StubBindVideoSessionMemoryKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->CreateVideoSessionParametersKHR = (PFN_vkCreateVideoSessionParametersKHR) gpa(device, "vkCreateVideoSessionParametersKHR"); - if (table->CreateVideoSessionParametersKHR == nullptr) { table->CreateVideoSessionParametersKHR = (PFN_vkCreateVideoSessionParametersKHR)StubCreateVideoSessionParametersKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->UpdateVideoSessionParametersKHR = (PFN_vkUpdateVideoSessionParametersKHR) gpa(device, "vkUpdateVideoSessionParametersKHR"); - if (table->UpdateVideoSessionParametersKHR == nullptr) { table->UpdateVideoSessionParametersKHR = (PFN_vkUpdateVideoSessionParametersKHR)StubUpdateVideoSessionParametersKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->DestroyVideoSessionParametersKHR = (PFN_vkDestroyVideoSessionParametersKHR) gpa(device, "vkDestroyVideoSessionParametersKHR"); - if (table->DestroyVideoSessionParametersKHR == nullptr) { table->DestroyVideoSessionParametersKHR = (PFN_vkDestroyVideoSessionParametersKHR)StubDestroyVideoSessionParametersKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->CmdBeginVideoCodingKHR = (PFN_vkCmdBeginVideoCodingKHR) gpa(device, "vkCmdBeginVideoCodingKHR"); - if (table->CmdBeginVideoCodingKHR == nullptr) { table->CmdBeginVideoCodingKHR = (PFN_vkCmdBeginVideoCodingKHR)StubCmdBeginVideoCodingKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->CmdEndVideoCodingKHR = (PFN_vkCmdEndVideoCodingKHR) gpa(device, "vkCmdEndVideoCodingKHR"); - if (table->CmdEndVideoCodingKHR == nullptr) { table->CmdEndVideoCodingKHR = (PFN_vkCmdEndVideoCodingKHR)StubCmdEndVideoCodingKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->CmdControlVideoCodingKHR = (PFN_vkCmdControlVideoCodingKHR) gpa(device, "vkCmdControlVideoCodingKHR"); - if (table->CmdControlVideoCodingKHR == nullptr) { table->CmdControlVideoCodingKHR = (PFN_vkCmdControlVideoCodingKHR)StubCmdControlVideoCodingKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->CmdDecodeVideoKHR = (PFN_vkCmdDecodeVideoKHR) gpa(device, "vkCmdDecodeVideoKHR"); - if (table->CmdDecodeVideoKHR == nullptr) { table->CmdDecodeVideoKHR = (PFN_vkCmdDecodeVideoKHR)StubCmdDecodeVideoKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS - table->CmdBeginRenderingKHR = (PFN_vkCmdBeginRenderingKHR) gpa(device, "vkCmdBeginRenderingKHR"); - if (table->CmdBeginRenderingKHR == nullptr) { table->CmdBeginRenderingKHR = (PFN_vkCmdBeginRenderingKHR)StubCmdBeginRenderingKHR; } - table->CmdEndRenderingKHR = (PFN_vkCmdEndRenderingKHR) gpa(device, "vkCmdEndRenderingKHR"); - if (table->CmdEndRenderingKHR == nullptr) { table->CmdEndRenderingKHR = (PFN_vkCmdEndRenderingKHR)StubCmdEndRenderingKHR; } - table->GetDeviceGroupPeerMemoryFeaturesKHR = (PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR) gpa(device, "vkGetDeviceGroupPeerMemoryFeaturesKHR"); - if (table->GetDeviceGroupPeerMemoryFeaturesKHR == nullptr) { table->GetDeviceGroupPeerMemoryFeaturesKHR = (PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR)StubGetDeviceGroupPeerMemoryFeaturesKHR; } - table->CmdSetDeviceMaskKHR = (PFN_vkCmdSetDeviceMaskKHR) gpa(device, "vkCmdSetDeviceMaskKHR"); - if (table->CmdSetDeviceMaskKHR == nullptr) { table->CmdSetDeviceMaskKHR = (PFN_vkCmdSetDeviceMaskKHR)StubCmdSetDeviceMaskKHR; } - table->CmdDispatchBaseKHR = (PFN_vkCmdDispatchBaseKHR) gpa(device, "vkCmdDispatchBaseKHR"); - if (table->CmdDispatchBaseKHR == nullptr) { table->CmdDispatchBaseKHR = (PFN_vkCmdDispatchBaseKHR)StubCmdDispatchBaseKHR; } - table->TrimCommandPoolKHR = (PFN_vkTrimCommandPoolKHR) gpa(device, "vkTrimCommandPoolKHR"); - if (table->TrimCommandPoolKHR == nullptr) { table->TrimCommandPoolKHR = (PFN_vkTrimCommandPoolKHR)StubTrimCommandPoolKHR; } -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetMemoryWin32HandleKHR = (PFN_vkGetMemoryWin32HandleKHR) gpa(device, "vkGetMemoryWin32HandleKHR"); - if (table->GetMemoryWin32HandleKHR == nullptr) { table->GetMemoryWin32HandleKHR = (PFN_vkGetMemoryWin32HandleKHR)StubGetMemoryWin32HandleKHR; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetMemoryWin32HandlePropertiesKHR = (PFN_vkGetMemoryWin32HandlePropertiesKHR) gpa(device, "vkGetMemoryWin32HandlePropertiesKHR"); - if (table->GetMemoryWin32HandlePropertiesKHR == nullptr) { table->GetMemoryWin32HandlePropertiesKHR = (PFN_vkGetMemoryWin32HandlePropertiesKHR)StubGetMemoryWin32HandlePropertiesKHR; } -#endif // VK_USE_PLATFORM_WIN32_KHR - table->GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR) gpa(device, "vkGetMemoryFdKHR"); - if (table->GetMemoryFdKHR == nullptr) { table->GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)StubGetMemoryFdKHR; } - table->GetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHR) gpa(device, "vkGetMemoryFdPropertiesKHR"); - if (table->GetMemoryFdPropertiesKHR == nullptr) { table->GetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHR)StubGetMemoryFdPropertiesKHR; } -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->ImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR) gpa(device, "vkImportSemaphoreWin32HandleKHR"); - if (table->ImportSemaphoreWin32HandleKHR == nullptr) { table->ImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR)StubImportSemaphoreWin32HandleKHR; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetSemaphoreWin32HandleKHR = (PFN_vkGetSemaphoreWin32HandleKHR) gpa(device, "vkGetSemaphoreWin32HandleKHR"); - if (table->GetSemaphoreWin32HandleKHR == nullptr) { table->GetSemaphoreWin32HandleKHR = (PFN_vkGetSemaphoreWin32HandleKHR)StubGetSemaphoreWin32HandleKHR; } -#endif // VK_USE_PLATFORM_WIN32_KHR - table->ImportSemaphoreFdKHR = (PFN_vkImportSemaphoreFdKHR) gpa(device, "vkImportSemaphoreFdKHR"); - if (table->ImportSemaphoreFdKHR == nullptr) { table->ImportSemaphoreFdKHR = (PFN_vkImportSemaphoreFdKHR)StubImportSemaphoreFdKHR; } - table->GetSemaphoreFdKHR = (PFN_vkGetSemaphoreFdKHR) gpa(device, "vkGetSemaphoreFdKHR"); - if (table->GetSemaphoreFdKHR == nullptr) { table->GetSemaphoreFdKHR = (PFN_vkGetSemaphoreFdKHR)StubGetSemaphoreFdKHR; } - table->CmdPushDescriptorSetKHR = (PFN_vkCmdPushDescriptorSetKHR) gpa(device, "vkCmdPushDescriptorSetKHR"); - if (table->CmdPushDescriptorSetKHR == nullptr) { table->CmdPushDescriptorSetKHR = (PFN_vkCmdPushDescriptorSetKHR)StubCmdPushDescriptorSetKHR; } - table->CmdPushDescriptorSetWithTemplateKHR = (PFN_vkCmdPushDescriptorSetWithTemplateKHR) gpa(device, "vkCmdPushDescriptorSetWithTemplateKHR"); - if (table->CmdPushDescriptorSetWithTemplateKHR == nullptr) { table->CmdPushDescriptorSetWithTemplateKHR = (PFN_vkCmdPushDescriptorSetWithTemplateKHR)StubCmdPushDescriptorSetWithTemplateKHR; } - table->CreateDescriptorUpdateTemplateKHR = (PFN_vkCreateDescriptorUpdateTemplateKHR) gpa(device, "vkCreateDescriptorUpdateTemplateKHR"); - if (table->CreateDescriptorUpdateTemplateKHR == nullptr) { table->CreateDescriptorUpdateTemplateKHR = (PFN_vkCreateDescriptorUpdateTemplateKHR)StubCreateDescriptorUpdateTemplateKHR; } - table->DestroyDescriptorUpdateTemplateKHR = (PFN_vkDestroyDescriptorUpdateTemplateKHR) gpa(device, "vkDestroyDescriptorUpdateTemplateKHR"); - if (table->DestroyDescriptorUpdateTemplateKHR == nullptr) { table->DestroyDescriptorUpdateTemplateKHR = (PFN_vkDestroyDescriptorUpdateTemplateKHR)StubDestroyDescriptorUpdateTemplateKHR; } - table->UpdateDescriptorSetWithTemplateKHR = (PFN_vkUpdateDescriptorSetWithTemplateKHR) gpa(device, "vkUpdateDescriptorSetWithTemplateKHR"); - if (table->UpdateDescriptorSetWithTemplateKHR == nullptr) { table->UpdateDescriptorSetWithTemplateKHR = (PFN_vkUpdateDescriptorSetWithTemplateKHR)StubUpdateDescriptorSetWithTemplateKHR; } - table->CreateRenderPass2KHR = (PFN_vkCreateRenderPass2KHR) gpa(device, "vkCreateRenderPass2KHR"); - if (table->CreateRenderPass2KHR == nullptr) { table->CreateRenderPass2KHR = (PFN_vkCreateRenderPass2KHR)StubCreateRenderPass2KHR; } - table->CmdBeginRenderPass2KHR = (PFN_vkCmdBeginRenderPass2KHR) gpa(device, "vkCmdBeginRenderPass2KHR"); - if (table->CmdBeginRenderPass2KHR == nullptr) { table->CmdBeginRenderPass2KHR = (PFN_vkCmdBeginRenderPass2KHR)StubCmdBeginRenderPass2KHR; } - table->CmdNextSubpass2KHR = (PFN_vkCmdNextSubpass2KHR) gpa(device, "vkCmdNextSubpass2KHR"); - if (table->CmdNextSubpass2KHR == nullptr) { table->CmdNextSubpass2KHR = (PFN_vkCmdNextSubpass2KHR)StubCmdNextSubpass2KHR; } - table->CmdEndRenderPass2KHR = (PFN_vkCmdEndRenderPass2KHR) gpa(device, "vkCmdEndRenderPass2KHR"); - if (table->CmdEndRenderPass2KHR == nullptr) { table->CmdEndRenderPass2KHR = (PFN_vkCmdEndRenderPass2KHR)StubCmdEndRenderPass2KHR; } - table->GetSwapchainStatusKHR = (PFN_vkGetSwapchainStatusKHR) gpa(device, "vkGetSwapchainStatusKHR"); - if (table->GetSwapchainStatusKHR == nullptr) { table->GetSwapchainStatusKHR = (PFN_vkGetSwapchainStatusKHR)StubGetSwapchainStatusKHR; } -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->ImportFenceWin32HandleKHR = (PFN_vkImportFenceWin32HandleKHR) gpa(device, "vkImportFenceWin32HandleKHR"); - if (table->ImportFenceWin32HandleKHR == nullptr) { table->ImportFenceWin32HandleKHR = (PFN_vkImportFenceWin32HandleKHR)StubImportFenceWin32HandleKHR; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetFenceWin32HandleKHR = (PFN_vkGetFenceWin32HandleKHR) gpa(device, "vkGetFenceWin32HandleKHR"); - if (table->GetFenceWin32HandleKHR == nullptr) { table->GetFenceWin32HandleKHR = (PFN_vkGetFenceWin32HandleKHR)StubGetFenceWin32HandleKHR; } -#endif // VK_USE_PLATFORM_WIN32_KHR - table->ImportFenceFdKHR = (PFN_vkImportFenceFdKHR) gpa(device, "vkImportFenceFdKHR"); - if (table->ImportFenceFdKHR == nullptr) { table->ImportFenceFdKHR = (PFN_vkImportFenceFdKHR)StubImportFenceFdKHR; } - table->GetFenceFdKHR = (PFN_vkGetFenceFdKHR) gpa(device, "vkGetFenceFdKHR"); - if (table->GetFenceFdKHR == nullptr) { table->GetFenceFdKHR = (PFN_vkGetFenceFdKHR)StubGetFenceFdKHR; } - table->AcquireProfilingLockKHR = (PFN_vkAcquireProfilingLockKHR) gpa(device, "vkAcquireProfilingLockKHR"); - if (table->AcquireProfilingLockKHR == nullptr) { table->AcquireProfilingLockKHR = (PFN_vkAcquireProfilingLockKHR)StubAcquireProfilingLockKHR; } - table->ReleaseProfilingLockKHR = (PFN_vkReleaseProfilingLockKHR) gpa(device, "vkReleaseProfilingLockKHR"); - if (table->ReleaseProfilingLockKHR == nullptr) { table->ReleaseProfilingLockKHR = (PFN_vkReleaseProfilingLockKHR)StubReleaseProfilingLockKHR; } - table->GetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2KHR) gpa(device, "vkGetImageMemoryRequirements2KHR"); - if (table->GetImageMemoryRequirements2KHR == nullptr) { table->GetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2KHR)StubGetImageMemoryRequirements2KHR; } - table->GetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2KHR) gpa(device, "vkGetBufferMemoryRequirements2KHR"); - if (table->GetBufferMemoryRequirements2KHR == nullptr) { table->GetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2KHR)StubGetBufferMemoryRequirements2KHR; } - table->GetImageSparseMemoryRequirements2KHR = (PFN_vkGetImageSparseMemoryRequirements2KHR) gpa(device, "vkGetImageSparseMemoryRequirements2KHR"); - if (table->GetImageSparseMemoryRequirements2KHR == nullptr) { table->GetImageSparseMemoryRequirements2KHR = (PFN_vkGetImageSparseMemoryRequirements2KHR)StubGetImageSparseMemoryRequirements2KHR; } - table->CreateSamplerYcbcrConversionKHR = (PFN_vkCreateSamplerYcbcrConversionKHR) gpa(device, "vkCreateSamplerYcbcrConversionKHR"); - if (table->CreateSamplerYcbcrConversionKHR == nullptr) { table->CreateSamplerYcbcrConversionKHR = (PFN_vkCreateSamplerYcbcrConversionKHR)StubCreateSamplerYcbcrConversionKHR; } - table->DestroySamplerYcbcrConversionKHR = (PFN_vkDestroySamplerYcbcrConversionKHR) gpa(device, "vkDestroySamplerYcbcrConversionKHR"); - if (table->DestroySamplerYcbcrConversionKHR == nullptr) { table->DestroySamplerYcbcrConversionKHR = (PFN_vkDestroySamplerYcbcrConversionKHR)StubDestroySamplerYcbcrConversionKHR; } - table->BindBufferMemory2KHR = (PFN_vkBindBufferMemory2KHR) gpa(device, "vkBindBufferMemory2KHR"); - if (table->BindBufferMemory2KHR == nullptr) { table->BindBufferMemory2KHR = (PFN_vkBindBufferMemory2KHR)StubBindBufferMemory2KHR; } - table->BindImageMemory2KHR = (PFN_vkBindImageMemory2KHR) gpa(device, "vkBindImageMemory2KHR"); - if (table->BindImageMemory2KHR == nullptr) { table->BindImageMemory2KHR = (PFN_vkBindImageMemory2KHR)StubBindImageMemory2KHR; } - table->GetDescriptorSetLayoutSupportKHR = (PFN_vkGetDescriptorSetLayoutSupportKHR) gpa(device, "vkGetDescriptorSetLayoutSupportKHR"); - if (table->GetDescriptorSetLayoutSupportKHR == nullptr) { table->GetDescriptorSetLayoutSupportKHR = (PFN_vkGetDescriptorSetLayoutSupportKHR)StubGetDescriptorSetLayoutSupportKHR; } - table->CmdDrawIndirectCountKHR = (PFN_vkCmdDrawIndirectCountKHR) gpa(device, "vkCmdDrawIndirectCountKHR"); - if (table->CmdDrawIndirectCountKHR == nullptr) { table->CmdDrawIndirectCountKHR = (PFN_vkCmdDrawIndirectCountKHR)StubCmdDrawIndirectCountKHR; } - table->CmdDrawIndexedIndirectCountKHR = (PFN_vkCmdDrawIndexedIndirectCountKHR) gpa(device, "vkCmdDrawIndexedIndirectCountKHR"); - if (table->CmdDrawIndexedIndirectCountKHR == nullptr) { table->CmdDrawIndexedIndirectCountKHR = (PFN_vkCmdDrawIndexedIndirectCountKHR)StubCmdDrawIndexedIndirectCountKHR; } - table->GetSemaphoreCounterValueKHR = (PFN_vkGetSemaphoreCounterValueKHR) gpa(device, "vkGetSemaphoreCounterValueKHR"); - if (table->GetSemaphoreCounterValueKHR == nullptr) { table->GetSemaphoreCounterValueKHR = (PFN_vkGetSemaphoreCounterValueKHR)StubGetSemaphoreCounterValueKHR; } - table->WaitSemaphoresKHR = (PFN_vkWaitSemaphoresKHR) gpa(device, "vkWaitSemaphoresKHR"); - if (table->WaitSemaphoresKHR == nullptr) { table->WaitSemaphoresKHR = (PFN_vkWaitSemaphoresKHR)StubWaitSemaphoresKHR; } - table->SignalSemaphoreKHR = (PFN_vkSignalSemaphoreKHR) gpa(device, "vkSignalSemaphoreKHR"); - if (table->SignalSemaphoreKHR == nullptr) { table->SignalSemaphoreKHR = (PFN_vkSignalSemaphoreKHR)StubSignalSemaphoreKHR; } - table->CmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR) gpa(device, "vkCmdSetFragmentShadingRateKHR"); - if (table->CmdSetFragmentShadingRateKHR == nullptr) { table->CmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR)StubCmdSetFragmentShadingRateKHR; } - table->WaitForPresentKHR = (PFN_vkWaitForPresentKHR) gpa(device, "vkWaitForPresentKHR"); - if (table->WaitForPresentKHR == nullptr) { table->WaitForPresentKHR = (PFN_vkWaitForPresentKHR)StubWaitForPresentKHR; } - table->GetBufferDeviceAddressKHR = (PFN_vkGetBufferDeviceAddressKHR) gpa(device, "vkGetBufferDeviceAddressKHR"); - if (table->GetBufferDeviceAddressKHR == nullptr) { table->GetBufferDeviceAddressKHR = (PFN_vkGetBufferDeviceAddressKHR)StubGetBufferDeviceAddressKHR; } - table->GetBufferOpaqueCaptureAddressKHR = (PFN_vkGetBufferOpaqueCaptureAddressKHR) gpa(device, "vkGetBufferOpaqueCaptureAddressKHR"); - if (table->GetBufferOpaqueCaptureAddressKHR == nullptr) { table->GetBufferOpaqueCaptureAddressKHR = (PFN_vkGetBufferOpaqueCaptureAddressKHR)StubGetBufferOpaqueCaptureAddressKHR; } - table->GetDeviceMemoryOpaqueCaptureAddressKHR = (PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR) gpa(device, "vkGetDeviceMemoryOpaqueCaptureAddressKHR"); - if (table->GetDeviceMemoryOpaqueCaptureAddressKHR == nullptr) { table->GetDeviceMemoryOpaqueCaptureAddressKHR = (PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR)StubGetDeviceMemoryOpaqueCaptureAddressKHR; } - table->CreateDeferredOperationKHR = (PFN_vkCreateDeferredOperationKHR) gpa(device, "vkCreateDeferredOperationKHR"); - if (table->CreateDeferredOperationKHR == nullptr) { table->CreateDeferredOperationKHR = (PFN_vkCreateDeferredOperationKHR)StubCreateDeferredOperationKHR; } - table->DestroyDeferredOperationKHR = (PFN_vkDestroyDeferredOperationKHR) gpa(device, "vkDestroyDeferredOperationKHR"); - if (table->DestroyDeferredOperationKHR == nullptr) { table->DestroyDeferredOperationKHR = (PFN_vkDestroyDeferredOperationKHR)StubDestroyDeferredOperationKHR; } - table->GetDeferredOperationMaxConcurrencyKHR = (PFN_vkGetDeferredOperationMaxConcurrencyKHR) gpa(device, "vkGetDeferredOperationMaxConcurrencyKHR"); - if (table->GetDeferredOperationMaxConcurrencyKHR == nullptr) { table->GetDeferredOperationMaxConcurrencyKHR = (PFN_vkGetDeferredOperationMaxConcurrencyKHR)StubGetDeferredOperationMaxConcurrencyKHR; } - table->GetDeferredOperationResultKHR = (PFN_vkGetDeferredOperationResultKHR) gpa(device, "vkGetDeferredOperationResultKHR"); - if (table->GetDeferredOperationResultKHR == nullptr) { table->GetDeferredOperationResultKHR = (PFN_vkGetDeferredOperationResultKHR)StubGetDeferredOperationResultKHR; } - table->DeferredOperationJoinKHR = (PFN_vkDeferredOperationJoinKHR) gpa(device, "vkDeferredOperationJoinKHR"); - if (table->DeferredOperationJoinKHR == nullptr) { table->DeferredOperationJoinKHR = (PFN_vkDeferredOperationJoinKHR)StubDeferredOperationJoinKHR; } - table->GetPipelineExecutablePropertiesKHR = (PFN_vkGetPipelineExecutablePropertiesKHR) gpa(device, "vkGetPipelineExecutablePropertiesKHR"); - if (table->GetPipelineExecutablePropertiesKHR == nullptr) { table->GetPipelineExecutablePropertiesKHR = (PFN_vkGetPipelineExecutablePropertiesKHR)StubGetPipelineExecutablePropertiesKHR; } - table->GetPipelineExecutableStatisticsKHR = (PFN_vkGetPipelineExecutableStatisticsKHR) gpa(device, "vkGetPipelineExecutableStatisticsKHR"); - if (table->GetPipelineExecutableStatisticsKHR == nullptr) { table->GetPipelineExecutableStatisticsKHR = (PFN_vkGetPipelineExecutableStatisticsKHR)StubGetPipelineExecutableStatisticsKHR; } - table->GetPipelineExecutableInternalRepresentationsKHR = (PFN_vkGetPipelineExecutableInternalRepresentationsKHR) gpa(device, "vkGetPipelineExecutableInternalRepresentationsKHR"); - if (table->GetPipelineExecutableInternalRepresentationsKHR == nullptr) { table->GetPipelineExecutableInternalRepresentationsKHR = (PFN_vkGetPipelineExecutableInternalRepresentationsKHR)StubGetPipelineExecutableInternalRepresentationsKHR; } -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->CmdEncodeVideoKHR = (PFN_vkCmdEncodeVideoKHR) gpa(device, "vkCmdEncodeVideoKHR"); - if (table->CmdEncodeVideoKHR == nullptr) { table->CmdEncodeVideoKHR = (PFN_vkCmdEncodeVideoKHR)StubCmdEncodeVideoKHR; } -#endif // VK_ENABLE_BETA_EXTENSIONS - table->CmdSetEvent2KHR = (PFN_vkCmdSetEvent2KHR) gpa(device, "vkCmdSetEvent2KHR"); - if (table->CmdSetEvent2KHR == nullptr) { table->CmdSetEvent2KHR = (PFN_vkCmdSetEvent2KHR)StubCmdSetEvent2KHR; } - table->CmdResetEvent2KHR = (PFN_vkCmdResetEvent2KHR) gpa(device, "vkCmdResetEvent2KHR"); - if (table->CmdResetEvent2KHR == nullptr) { table->CmdResetEvent2KHR = (PFN_vkCmdResetEvent2KHR)StubCmdResetEvent2KHR; } - table->CmdWaitEvents2KHR = (PFN_vkCmdWaitEvents2KHR) gpa(device, "vkCmdWaitEvents2KHR"); - if (table->CmdWaitEvents2KHR == nullptr) { table->CmdWaitEvents2KHR = (PFN_vkCmdWaitEvents2KHR)StubCmdWaitEvents2KHR; } - table->CmdPipelineBarrier2KHR = (PFN_vkCmdPipelineBarrier2KHR) gpa(device, "vkCmdPipelineBarrier2KHR"); - if (table->CmdPipelineBarrier2KHR == nullptr) { table->CmdPipelineBarrier2KHR = (PFN_vkCmdPipelineBarrier2KHR)StubCmdPipelineBarrier2KHR; } - table->CmdWriteTimestamp2KHR = (PFN_vkCmdWriteTimestamp2KHR) gpa(device, "vkCmdWriteTimestamp2KHR"); - if (table->CmdWriteTimestamp2KHR == nullptr) { table->CmdWriteTimestamp2KHR = (PFN_vkCmdWriteTimestamp2KHR)StubCmdWriteTimestamp2KHR; } - table->QueueSubmit2KHR = (PFN_vkQueueSubmit2KHR) gpa(device, "vkQueueSubmit2KHR"); - if (table->QueueSubmit2KHR == nullptr) { table->QueueSubmit2KHR = (PFN_vkQueueSubmit2KHR)StubQueueSubmit2KHR; } - table->CmdWriteBufferMarker2AMD = (PFN_vkCmdWriteBufferMarker2AMD) gpa(device, "vkCmdWriteBufferMarker2AMD"); - if (table->CmdWriteBufferMarker2AMD == nullptr) { table->CmdWriteBufferMarker2AMD = (PFN_vkCmdWriteBufferMarker2AMD)StubCmdWriteBufferMarker2AMD; } - table->GetQueueCheckpointData2NV = (PFN_vkGetQueueCheckpointData2NV) gpa(device, "vkGetQueueCheckpointData2NV"); - if (table->GetQueueCheckpointData2NV == nullptr) { table->GetQueueCheckpointData2NV = (PFN_vkGetQueueCheckpointData2NV)StubGetQueueCheckpointData2NV; } - table->CmdCopyBuffer2KHR = (PFN_vkCmdCopyBuffer2KHR) gpa(device, "vkCmdCopyBuffer2KHR"); - if (table->CmdCopyBuffer2KHR == nullptr) { table->CmdCopyBuffer2KHR = (PFN_vkCmdCopyBuffer2KHR)StubCmdCopyBuffer2KHR; } - table->CmdCopyImage2KHR = (PFN_vkCmdCopyImage2KHR) gpa(device, "vkCmdCopyImage2KHR"); - if (table->CmdCopyImage2KHR == nullptr) { table->CmdCopyImage2KHR = (PFN_vkCmdCopyImage2KHR)StubCmdCopyImage2KHR; } - table->CmdCopyBufferToImage2KHR = (PFN_vkCmdCopyBufferToImage2KHR) gpa(device, "vkCmdCopyBufferToImage2KHR"); - if (table->CmdCopyBufferToImage2KHR == nullptr) { table->CmdCopyBufferToImage2KHR = (PFN_vkCmdCopyBufferToImage2KHR)StubCmdCopyBufferToImage2KHR; } - table->CmdCopyImageToBuffer2KHR = (PFN_vkCmdCopyImageToBuffer2KHR) gpa(device, "vkCmdCopyImageToBuffer2KHR"); - if (table->CmdCopyImageToBuffer2KHR == nullptr) { table->CmdCopyImageToBuffer2KHR = (PFN_vkCmdCopyImageToBuffer2KHR)StubCmdCopyImageToBuffer2KHR; } - table->CmdBlitImage2KHR = (PFN_vkCmdBlitImage2KHR) gpa(device, "vkCmdBlitImage2KHR"); - if (table->CmdBlitImage2KHR == nullptr) { table->CmdBlitImage2KHR = (PFN_vkCmdBlitImage2KHR)StubCmdBlitImage2KHR; } - table->CmdResolveImage2KHR = (PFN_vkCmdResolveImage2KHR) gpa(device, "vkCmdResolveImage2KHR"); - if (table->CmdResolveImage2KHR == nullptr) { table->CmdResolveImage2KHR = (PFN_vkCmdResolveImage2KHR)StubCmdResolveImage2KHR; } - table->CmdTraceRaysIndirect2KHR = (PFN_vkCmdTraceRaysIndirect2KHR) gpa(device, "vkCmdTraceRaysIndirect2KHR"); - if (table->CmdTraceRaysIndirect2KHR == nullptr) { table->CmdTraceRaysIndirect2KHR = (PFN_vkCmdTraceRaysIndirect2KHR)StubCmdTraceRaysIndirect2KHR; } - table->GetDeviceBufferMemoryRequirementsKHR = (PFN_vkGetDeviceBufferMemoryRequirementsKHR) gpa(device, "vkGetDeviceBufferMemoryRequirementsKHR"); - if (table->GetDeviceBufferMemoryRequirementsKHR == nullptr) { table->GetDeviceBufferMemoryRequirementsKHR = (PFN_vkGetDeviceBufferMemoryRequirementsKHR)StubGetDeviceBufferMemoryRequirementsKHR; } - table->GetDeviceImageMemoryRequirementsKHR = (PFN_vkGetDeviceImageMemoryRequirementsKHR) gpa(device, "vkGetDeviceImageMemoryRequirementsKHR"); - if (table->GetDeviceImageMemoryRequirementsKHR == nullptr) { table->GetDeviceImageMemoryRequirementsKHR = (PFN_vkGetDeviceImageMemoryRequirementsKHR)StubGetDeviceImageMemoryRequirementsKHR; } - table->GetDeviceImageSparseMemoryRequirementsKHR = (PFN_vkGetDeviceImageSparseMemoryRequirementsKHR) gpa(device, "vkGetDeviceImageSparseMemoryRequirementsKHR"); - if (table->GetDeviceImageSparseMemoryRequirementsKHR == nullptr) { table->GetDeviceImageSparseMemoryRequirementsKHR = (PFN_vkGetDeviceImageSparseMemoryRequirementsKHR)StubGetDeviceImageSparseMemoryRequirementsKHR; } - table->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT) gpa(device, "vkDebugMarkerSetObjectTagEXT"); - if (table->DebugMarkerSetObjectTagEXT == nullptr) { table->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)StubDebugMarkerSetObjectTagEXT; } - table->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT) gpa(device, "vkDebugMarkerSetObjectNameEXT"); - if (table->DebugMarkerSetObjectNameEXT == nullptr) { table->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)StubDebugMarkerSetObjectNameEXT; } - table->CmdDebugMarkerBeginEXT = (PFN_vkCmdDebugMarkerBeginEXT) gpa(device, "vkCmdDebugMarkerBeginEXT"); - if (table->CmdDebugMarkerBeginEXT == nullptr) { table->CmdDebugMarkerBeginEXT = (PFN_vkCmdDebugMarkerBeginEXT)StubCmdDebugMarkerBeginEXT; } - table->CmdDebugMarkerEndEXT = (PFN_vkCmdDebugMarkerEndEXT) gpa(device, "vkCmdDebugMarkerEndEXT"); - if (table->CmdDebugMarkerEndEXT == nullptr) { table->CmdDebugMarkerEndEXT = (PFN_vkCmdDebugMarkerEndEXT)StubCmdDebugMarkerEndEXT; } - table->CmdDebugMarkerInsertEXT = (PFN_vkCmdDebugMarkerInsertEXT) gpa(device, "vkCmdDebugMarkerInsertEXT"); - if (table->CmdDebugMarkerInsertEXT == nullptr) { table->CmdDebugMarkerInsertEXT = (PFN_vkCmdDebugMarkerInsertEXT)StubCmdDebugMarkerInsertEXT; } - table->CmdBindTransformFeedbackBuffersEXT = (PFN_vkCmdBindTransformFeedbackBuffersEXT) gpa(device, "vkCmdBindTransformFeedbackBuffersEXT"); - if (table->CmdBindTransformFeedbackBuffersEXT == nullptr) { table->CmdBindTransformFeedbackBuffersEXT = (PFN_vkCmdBindTransformFeedbackBuffersEXT)StubCmdBindTransformFeedbackBuffersEXT; } - table->CmdBeginTransformFeedbackEXT = (PFN_vkCmdBeginTransformFeedbackEXT) gpa(device, "vkCmdBeginTransformFeedbackEXT"); - if (table->CmdBeginTransformFeedbackEXT == nullptr) { table->CmdBeginTransformFeedbackEXT = (PFN_vkCmdBeginTransformFeedbackEXT)StubCmdBeginTransformFeedbackEXT; } - table->CmdEndTransformFeedbackEXT = (PFN_vkCmdEndTransformFeedbackEXT) gpa(device, "vkCmdEndTransformFeedbackEXT"); - if (table->CmdEndTransformFeedbackEXT == nullptr) { table->CmdEndTransformFeedbackEXT = (PFN_vkCmdEndTransformFeedbackEXT)StubCmdEndTransformFeedbackEXT; } - table->CmdBeginQueryIndexedEXT = (PFN_vkCmdBeginQueryIndexedEXT) gpa(device, "vkCmdBeginQueryIndexedEXT"); - if (table->CmdBeginQueryIndexedEXT == nullptr) { table->CmdBeginQueryIndexedEXT = (PFN_vkCmdBeginQueryIndexedEXT)StubCmdBeginQueryIndexedEXT; } - table->CmdEndQueryIndexedEXT = (PFN_vkCmdEndQueryIndexedEXT) gpa(device, "vkCmdEndQueryIndexedEXT"); - if (table->CmdEndQueryIndexedEXT == nullptr) { table->CmdEndQueryIndexedEXT = (PFN_vkCmdEndQueryIndexedEXT)StubCmdEndQueryIndexedEXT; } - table->CmdDrawIndirectByteCountEXT = (PFN_vkCmdDrawIndirectByteCountEXT) gpa(device, "vkCmdDrawIndirectByteCountEXT"); - if (table->CmdDrawIndirectByteCountEXT == nullptr) { table->CmdDrawIndirectByteCountEXT = (PFN_vkCmdDrawIndirectByteCountEXT)StubCmdDrawIndirectByteCountEXT; } - table->CreateCuModuleNVX = (PFN_vkCreateCuModuleNVX) gpa(device, "vkCreateCuModuleNVX"); - if (table->CreateCuModuleNVX == nullptr) { table->CreateCuModuleNVX = (PFN_vkCreateCuModuleNVX)StubCreateCuModuleNVX; } - table->CreateCuFunctionNVX = (PFN_vkCreateCuFunctionNVX) gpa(device, "vkCreateCuFunctionNVX"); - if (table->CreateCuFunctionNVX == nullptr) { table->CreateCuFunctionNVX = (PFN_vkCreateCuFunctionNVX)StubCreateCuFunctionNVX; } - table->DestroyCuModuleNVX = (PFN_vkDestroyCuModuleNVX) gpa(device, "vkDestroyCuModuleNVX"); - if (table->DestroyCuModuleNVX == nullptr) { table->DestroyCuModuleNVX = (PFN_vkDestroyCuModuleNVX)StubDestroyCuModuleNVX; } - table->DestroyCuFunctionNVX = (PFN_vkDestroyCuFunctionNVX) gpa(device, "vkDestroyCuFunctionNVX"); - if (table->DestroyCuFunctionNVX == nullptr) { table->DestroyCuFunctionNVX = (PFN_vkDestroyCuFunctionNVX)StubDestroyCuFunctionNVX; } - table->CmdCuLaunchKernelNVX = (PFN_vkCmdCuLaunchKernelNVX) gpa(device, "vkCmdCuLaunchKernelNVX"); - if (table->CmdCuLaunchKernelNVX == nullptr) { table->CmdCuLaunchKernelNVX = (PFN_vkCmdCuLaunchKernelNVX)StubCmdCuLaunchKernelNVX; } - table->GetImageViewHandleNVX = (PFN_vkGetImageViewHandleNVX) gpa(device, "vkGetImageViewHandleNVX"); - if (table->GetImageViewHandleNVX == nullptr) { table->GetImageViewHandleNVX = (PFN_vkGetImageViewHandleNVX)StubGetImageViewHandleNVX; } - table->GetImageViewAddressNVX = (PFN_vkGetImageViewAddressNVX) gpa(device, "vkGetImageViewAddressNVX"); - if (table->GetImageViewAddressNVX == nullptr) { table->GetImageViewAddressNVX = (PFN_vkGetImageViewAddressNVX)StubGetImageViewAddressNVX; } - table->CmdDrawIndirectCountAMD = (PFN_vkCmdDrawIndirectCountAMD) gpa(device, "vkCmdDrawIndirectCountAMD"); - if (table->CmdDrawIndirectCountAMD == nullptr) { table->CmdDrawIndirectCountAMD = (PFN_vkCmdDrawIndirectCountAMD)StubCmdDrawIndirectCountAMD; } - table->CmdDrawIndexedIndirectCountAMD = (PFN_vkCmdDrawIndexedIndirectCountAMD) gpa(device, "vkCmdDrawIndexedIndirectCountAMD"); - if (table->CmdDrawIndexedIndirectCountAMD == nullptr) { table->CmdDrawIndexedIndirectCountAMD = (PFN_vkCmdDrawIndexedIndirectCountAMD)StubCmdDrawIndexedIndirectCountAMD; } - table->GetShaderInfoAMD = (PFN_vkGetShaderInfoAMD) gpa(device, "vkGetShaderInfoAMD"); - if (table->GetShaderInfoAMD == nullptr) { table->GetShaderInfoAMD = (PFN_vkGetShaderInfoAMD)StubGetShaderInfoAMD; } -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV) gpa(device, "vkGetMemoryWin32HandleNV"); - if (table->GetMemoryWin32HandleNV == nullptr) { table->GetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)StubGetMemoryWin32HandleNV; } -#endif // VK_USE_PLATFORM_WIN32_KHR - table->CmdBeginConditionalRenderingEXT = (PFN_vkCmdBeginConditionalRenderingEXT) gpa(device, "vkCmdBeginConditionalRenderingEXT"); - if (table->CmdBeginConditionalRenderingEXT == nullptr) { table->CmdBeginConditionalRenderingEXT = (PFN_vkCmdBeginConditionalRenderingEXT)StubCmdBeginConditionalRenderingEXT; } - table->CmdEndConditionalRenderingEXT = (PFN_vkCmdEndConditionalRenderingEXT) gpa(device, "vkCmdEndConditionalRenderingEXT"); - if (table->CmdEndConditionalRenderingEXT == nullptr) { table->CmdEndConditionalRenderingEXT = (PFN_vkCmdEndConditionalRenderingEXT)StubCmdEndConditionalRenderingEXT; } - table->CmdSetViewportWScalingNV = (PFN_vkCmdSetViewportWScalingNV) gpa(device, "vkCmdSetViewportWScalingNV"); - if (table->CmdSetViewportWScalingNV == nullptr) { table->CmdSetViewportWScalingNV = (PFN_vkCmdSetViewportWScalingNV)StubCmdSetViewportWScalingNV; } - table->DisplayPowerControlEXT = (PFN_vkDisplayPowerControlEXT) gpa(device, "vkDisplayPowerControlEXT"); - if (table->DisplayPowerControlEXT == nullptr) { table->DisplayPowerControlEXT = (PFN_vkDisplayPowerControlEXT)StubDisplayPowerControlEXT; } - table->RegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT) gpa(device, "vkRegisterDeviceEventEXT"); - if (table->RegisterDeviceEventEXT == nullptr) { table->RegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT)StubRegisterDeviceEventEXT; } - table->RegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT) gpa(device, "vkRegisterDisplayEventEXT"); - if (table->RegisterDisplayEventEXT == nullptr) { table->RegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT)StubRegisterDisplayEventEXT; } - table->GetSwapchainCounterEXT = (PFN_vkGetSwapchainCounterEXT) gpa(device, "vkGetSwapchainCounterEXT"); - if (table->GetSwapchainCounterEXT == nullptr) { table->GetSwapchainCounterEXT = (PFN_vkGetSwapchainCounterEXT)StubGetSwapchainCounterEXT; } - table->GetRefreshCycleDurationGOOGLE = (PFN_vkGetRefreshCycleDurationGOOGLE) gpa(device, "vkGetRefreshCycleDurationGOOGLE"); - if (table->GetRefreshCycleDurationGOOGLE == nullptr) { table->GetRefreshCycleDurationGOOGLE = (PFN_vkGetRefreshCycleDurationGOOGLE)StubGetRefreshCycleDurationGOOGLE; } - table->GetPastPresentationTimingGOOGLE = (PFN_vkGetPastPresentationTimingGOOGLE) gpa(device, "vkGetPastPresentationTimingGOOGLE"); - if (table->GetPastPresentationTimingGOOGLE == nullptr) { table->GetPastPresentationTimingGOOGLE = (PFN_vkGetPastPresentationTimingGOOGLE)StubGetPastPresentationTimingGOOGLE; } - table->CmdSetDiscardRectangleEXT = (PFN_vkCmdSetDiscardRectangleEXT) gpa(device, "vkCmdSetDiscardRectangleEXT"); - if (table->CmdSetDiscardRectangleEXT == nullptr) { table->CmdSetDiscardRectangleEXT = (PFN_vkCmdSetDiscardRectangleEXT)StubCmdSetDiscardRectangleEXT; } - table->SetHdrMetadataEXT = (PFN_vkSetHdrMetadataEXT) gpa(device, "vkSetHdrMetadataEXT"); - if (table->SetHdrMetadataEXT == nullptr) { table->SetHdrMetadataEXT = (PFN_vkSetHdrMetadataEXT)StubSetHdrMetadataEXT; } - 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"); -#ifdef VK_USE_PLATFORM_ANDROID_KHR - table->GetAndroidHardwareBufferPropertiesANDROID = (PFN_vkGetAndroidHardwareBufferPropertiesANDROID) gpa(device, "vkGetAndroidHardwareBufferPropertiesANDROID"); - if (table->GetAndroidHardwareBufferPropertiesANDROID == nullptr) { table->GetAndroidHardwareBufferPropertiesANDROID = (PFN_vkGetAndroidHardwareBufferPropertiesANDROID)StubGetAndroidHardwareBufferPropertiesANDROID; } -#endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR - table->GetMemoryAndroidHardwareBufferANDROID = (PFN_vkGetMemoryAndroidHardwareBufferANDROID) gpa(device, "vkGetMemoryAndroidHardwareBufferANDROID"); - if (table->GetMemoryAndroidHardwareBufferANDROID == nullptr) { table->GetMemoryAndroidHardwareBufferANDROID = (PFN_vkGetMemoryAndroidHardwareBufferANDROID)StubGetMemoryAndroidHardwareBufferANDROID; } -#endif // VK_USE_PLATFORM_ANDROID_KHR - table->CmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT) gpa(device, "vkCmdSetSampleLocationsEXT"); - if (table->CmdSetSampleLocationsEXT == nullptr) { table->CmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)StubCmdSetSampleLocationsEXT; } - table->GetImageDrmFormatModifierPropertiesEXT = (PFN_vkGetImageDrmFormatModifierPropertiesEXT) gpa(device, "vkGetImageDrmFormatModifierPropertiesEXT"); - if (table->GetImageDrmFormatModifierPropertiesEXT == nullptr) { table->GetImageDrmFormatModifierPropertiesEXT = (PFN_vkGetImageDrmFormatModifierPropertiesEXT)StubGetImageDrmFormatModifierPropertiesEXT; } - table->CreateValidationCacheEXT = (PFN_vkCreateValidationCacheEXT) gpa(device, "vkCreateValidationCacheEXT"); - if (table->CreateValidationCacheEXT == nullptr) { table->CreateValidationCacheEXT = (PFN_vkCreateValidationCacheEXT)StubCreateValidationCacheEXT; } - table->DestroyValidationCacheEXT = (PFN_vkDestroyValidationCacheEXT) gpa(device, "vkDestroyValidationCacheEXT"); - if (table->DestroyValidationCacheEXT == nullptr) { table->DestroyValidationCacheEXT = (PFN_vkDestroyValidationCacheEXT)StubDestroyValidationCacheEXT; } - table->MergeValidationCachesEXT = (PFN_vkMergeValidationCachesEXT) gpa(device, "vkMergeValidationCachesEXT"); - if (table->MergeValidationCachesEXT == nullptr) { table->MergeValidationCachesEXT = (PFN_vkMergeValidationCachesEXT)StubMergeValidationCachesEXT; } - table->GetValidationCacheDataEXT = (PFN_vkGetValidationCacheDataEXT) gpa(device, "vkGetValidationCacheDataEXT"); - if (table->GetValidationCacheDataEXT == nullptr) { table->GetValidationCacheDataEXT = (PFN_vkGetValidationCacheDataEXT)StubGetValidationCacheDataEXT; } - table->CmdBindShadingRateImageNV = (PFN_vkCmdBindShadingRateImageNV) gpa(device, "vkCmdBindShadingRateImageNV"); - if (table->CmdBindShadingRateImageNV == nullptr) { table->CmdBindShadingRateImageNV = (PFN_vkCmdBindShadingRateImageNV)StubCmdBindShadingRateImageNV; } - table->CmdSetViewportShadingRatePaletteNV = (PFN_vkCmdSetViewportShadingRatePaletteNV) gpa(device, "vkCmdSetViewportShadingRatePaletteNV"); - if (table->CmdSetViewportShadingRatePaletteNV == nullptr) { table->CmdSetViewportShadingRatePaletteNV = (PFN_vkCmdSetViewportShadingRatePaletteNV)StubCmdSetViewportShadingRatePaletteNV; } - table->CmdSetCoarseSampleOrderNV = (PFN_vkCmdSetCoarseSampleOrderNV) gpa(device, "vkCmdSetCoarseSampleOrderNV"); - if (table->CmdSetCoarseSampleOrderNV == nullptr) { table->CmdSetCoarseSampleOrderNV = (PFN_vkCmdSetCoarseSampleOrderNV)StubCmdSetCoarseSampleOrderNV; } - table->CreateAccelerationStructureNV = (PFN_vkCreateAccelerationStructureNV) gpa(device, "vkCreateAccelerationStructureNV"); - if (table->CreateAccelerationStructureNV == nullptr) { table->CreateAccelerationStructureNV = (PFN_vkCreateAccelerationStructureNV)StubCreateAccelerationStructureNV; } - table->DestroyAccelerationStructureNV = (PFN_vkDestroyAccelerationStructureNV) gpa(device, "vkDestroyAccelerationStructureNV"); - if (table->DestroyAccelerationStructureNV == nullptr) { table->DestroyAccelerationStructureNV = (PFN_vkDestroyAccelerationStructureNV)StubDestroyAccelerationStructureNV; } - table->GetAccelerationStructureMemoryRequirementsNV = (PFN_vkGetAccelerationStructureMemoryRequirementsNV) gpa(device, "vkGetAccelerationStructureMemoryRequirementsNV"); - if (table->GetAccelerationStructureMemoryRequirementsNV == nullptr) { table->GetAccelerationStructureMemoryRequirementsNV = (PFN_vkGetAccelerationStructureMemoryRequirementsNV)StubGetAccelerationStructureMemoryRequirementsNV; } - table->BindAccelerationStructureMemoryNV = (PFN_vkBindAccelerationStructureMemoryNV) gpa(device, "vkBindAccelerationStructureMemoryNV"); - if (table->BindAccelerationStructureMemoryNV == nullptr) { table->BindAccelerationStructureMemoryNV = (PFN_vkBindAccelerationStructureMemoryNV)StubBindAccelerationStructureMemoryNV; } - table->CmdBuildAccelerationStructureNV = (PFN_vkCmdBuildAccelerationStructureNV) gpa(device, "vkCmdBuildAccelerationStructureNV"); - if (table->CmdBuildAccelerationStructureNV == nullptr) { table->CmdBuildAccelerationStructureNV = (PFN_vkCmdBuildAccelerationStructureNV)StubCmdBuildAccelerationStructureNV; } - table->CmdCopyAccelerationStructureNV = (PFN_vkCmdCopyAccelerationStructureNV) gpa(device, "vkCmdCopyAccelerationStructureNV"); - if (table->CmdCopyAccelerationStructureNV == nullptr) { table->CmdCopyAccelerationStructureNV = (PFN_vkCmdCopyAccelerationStructureNV)StubCmdCopyAccelerationStructureNV; } - table->CmdTraceRaysNV = (PFN_vkCmdTraceRaysNV) gpa(device, "vkCmdTraceRaysNV"); - if (table->CmdTraceRaysNV == nullptr) { table->CmdTraceRaysNV = (PFN_vkCmdTraceRaysNV)StubCmdTraceRaysNV; } - table->CreateRayTracingPipelinesNV = (PFN_vkCreateRayTracingPipelinesNV) gpa(device, "vkCreateRayTracingPipelinesNV"); - if (table->CreateRayTracingPipelinesNV == nullptr) { table->CreateRayTracingPipelinesNV = (PFN_vkCreateRayTracingPipelinesNV)StubCreateRayTracingPipelinesNV; } - table->GetRayTracingShaderGroupHandlesKHR = (PFN_vkGetRayTracingShaderGroupHandlesKHR) gpa(device, "vkGetRayTracingShaderGroupHandlesKHR"); - if (table->GetRayTracingShaderGroupHandlesKHR == nullptr) { table->GetRayTracingShaderGroupHandlesKHR = (PFN_vkGetRayTracingShaderGroupHandlesKHR)StubGetRayTracingShaderGroupHandlesKHR; } - table->GetRayTracingShaderGroupHandlesNV = (PFN_vkGetRayTracingShaderGroupHandlesNV) gpa(device, "vkGetRayTracingShaderGroupHandlesNV"); - if (table->GetRayTracingShaderGroupHandlesNV == nullptr) { table->GetRayTracingShaderGroupHandlesNV = (PFN_vkGetRayTracingShaderGroupHandlesNV)StubGetRayTracingShaderGroupHandlesNV; } - table->GetAccelerationStructureHandleNV = (PFN_vkGetAccelerationStructureHandleNV) gpa(device, "vkGetAccelerationStructureHandleNV"); - if (table->GetAccelerationStructureHandleNV == nullptr) { table->GetAccelerationStructureHandleNV = (PFN_vkGetAccelerationStructureHandleNV)StubGetAccelerationStructureHandleNV; } - table->CmdWriteAccelerationStructuresPropertiesNV = (PFN_vkCmdWriteAccelerationStructuresPropertiesNV) gpa(device, "vkCmdWriteAccelerationStructuresPropertiesNV"); - if (table->CmdWriteAccelerationStructuresPropertiesNV == nullptr) { table->CmdWriteAccelerationStructuresPropertiesNV = (PFN_vkCmdWriteAccelerationStructuresPropertiesNV)StubCmdWriteAccelerationStructuresPropertiesNV; } - table->CompileDeferredNV = (PFN_vkCompileDeferredNV) gpa(device, "vkCompileDeferredNV"); - if (table->CompileDeferredNV == nullptr) { table->CompileDeferredNV = (PFN_vkCompileDeferredNV)StubCompileDeferredNV; } - table->GetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT) gpa(device, "vkGetMemoryHostPointerPropertiesEXT"); - if (table->GetMemoryHostPointerPropertiesEXT == nullptr) { table->GetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT)StubGetMemoryHostPointerPropertiesEXT; } - table->CmdWriteBufferMarkerAMD = (PFN_vkCmdWriteBufferMarkerAMD) gpa(device, "vkCmdWriteBufferMarkerAMD"); - if (table->CmdWriteBufferMarkerAMD == nullptr) { table->CmdWriteBufferMarkerAMD = (PFN_vkCmdWriteBufferMarkerAMD)StubCmdWriteBufferMarkerAMD; } - table->GetCalibratedTimestampsEXT = (PFN_vkGetCalibratedTimestampsEXT) gpa(device, "vkGetCalibratedTimestampsEXT"); - if (table->GetCalibratedTimestampsEXT == nullptr) { table->GetCalibratedTimestampsEXT = (PFN_vkGetCalibratedTimestampsEXT)StubGetCalibratedTimestampsEXT; } - table->CmdDrawMeshTasksNV = (PFN_vkCmdDrawMeshTasksNV) gpa(device, "vkCmdDrawMeshTasksNV"); - if (table->CmdDrawMeshTasksNV == nullptr) { table->CmdDrawMeshTasksNV = (PFN_vkCmdDrawMeshTasksNV)StubCmdDrawMeshTasksNV; } - table->CmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV) gpa(device, "vkCmdDrawMeshTasksIndirectNV"); - if (table->CmdDrawMeshTasksIndirectNV == nullptr) { table->CmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV)StubCmdDrawMeshTasksIndirectNV; } - table->CmdDrawMeshTasksIndirectCountNV = (PFN_vkCmdDrawMeshTasksIndirectCountNV) gpa(device, "vkCmdDrawMeshTasksIndirectCountNV"); - if (table->CmdDrawMeshTasksIndirectCountNV == nullptr) { table->CmdDrawMeshTasksIndirectCountNV = (PFN_vkCmdDrawMeshTasksIndirectCountNV)StubCmdDrawMeshTasksIndirectCountNV; } - table->CmdSetExclusiveScissorNV = (PFN_vkCmdSetExclusiveScissorNV) gpa(device, "vkCmdSetExclusiveScissorNV"); - if (table->CmdSetExclusiveScissorNV == nullptr) { table->CmdSetExclusiveScissorNV = (PFN_vkCmdSetExclusiveScissorNV)StubCmdSetExclusiveScissorNV; } - table->CmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV) gpa(device, "vkCmdSetCheckpointNV"); - if (table->CmdSetCheckpointNV == nullptr) { table->CmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV)StubCmdSetCheckpointNV; } - table->GetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV) gpa(device, "vkGetQueueCheckpointDataNV"); - if (table->GetQueueCheckpointDataNV == nullptr) { table->GetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV)StubGetQueueCheckpointDataNV; } - table->InitializePerformanceApiINTEL = (PFN_vkInitializePerformanceApiINTEL) gpa(device, "vkInitializePerformanceApiINTEL"); - if (table->InitializePerformanceApiINTEL == nullptr) { table->InitializePerformanceApiINTEL = (PFN_vkInitializePerformanceApiINTEL)StubInitializePerformanceApiINTEL; } - table->UninitializePerformanceApiINTEL = (PFN_vkUninitializePerformanceApiINTEL) gpa(device, "vkUninitializePerformanceApiINTEL"); - if (table->UninitializePerformanceApiINTEL == nullptr) { table->UninitializePerformanceApiINTEL = (PFN_vkUninitializePerformanceApiINTEL)StubUninitializePerformanceApiINTEL; } - table->CmdSetPerformanceMarkerINTEL = (PFN_vkCmdSetPerformanceMarkerINTEL) gpa(device, "vkCmdSetPerformanceMarkerINTEL"); - if (table->CmdSetPerformanceMarkerINTEL == nullptr) { table->CmdSetPerformanceMarkerINTEL = (PFN_vkCmdSetPerformanceMarkerINTEL)StubCmdSetPerformanceMarkerINTEL; } - table->CmdSetPerformanceStreamMarkerINTEL = (PFN_vkCmdSetPerformanceStreamMarkerINTEL) gpa(device, "vkCmdSetPerformanceStreamMarkerINTEL"); - if (table->CmdSetPerformanceStreamMarkerINTEL == nullptr) { table->CmdSetPerformanceStreamMarkerINTEL = (PFN_vkCmdSetPerformanceStreamMarkerINTEL)StubCmdSetPerformanceStreamMarkerINTEL; } - table->CmdSetPerformanceOverrideINTEL = (PFN_vkCmdSetPerformanceOverrideINTEL) gpa(device, "vkCmdSetPerformanceOverrideINTEL"); - if (table->CmdSetPerformanceOverrideINTEL == nullptr) { table->CmdSetPerformanceOverrideINTEL = (PFN_vkCmdSetPerformanceOverrideINTEL)StubCmdSetPerformanceOverrideINTEL; } - table->AcquirePerformanceConfigurationINTEL = (PFN_vkAcquirePerformanceConfigurationINTEL) gpa(device, "vkAcquirePerformanceConfigurationINTEL"); - if (table->AcquirePerformanceConfigurationINTEL == nullptr) { table->AcquirePerformanceConfigurationINTEL = (PFN_vkAcquirePerformanceConfigurationINTEL)StubAcquirePerformanceConfigurationINTEL; } - table->ReleasePerformanceConfigurationINTEL = (PFN_vkReleasePerformanceConfigurationINTEL) gpa(device, "vkReleasePerformanceConfigurationINTEL"); - if (table->ReleasePerformanceConfigurationINTEL == nullptr) { table->ReleasePerformanceConfigurationINTEL = (PFN_vkReleasePerformanceConfigurationINTEL)StubReleasePerformanceConfigurationINTEL; } - table->QueueSetPerformanceConfigurationINTEL = (PFN_vkQueueSetPerformanceConfigurationINTEL) gpa(device, "vkQueueSetPerformanceConfigurationINTEL"); - if (table->QueueSetPerformanceConfigurationINTEL == nullptr) { table->QueueSetPerformanceConfigurationINTEL = (PFN_vkQueueSetPerformanceConfigurationINTEL)StubQueueSetPerformanceConfigurationINTEL; } - table->GetPerformanceParameterINTEL = (PFN_vkGetPerformanceParameterINTEL) gpa(device, "vkGetPerformanceParameterINTEL"); - if (table->GetPerformanceParameterINTEL == nullptr) { table->GetPerformanceParameterINTEL = (PFN_vkGetPerformanceParameterINTEL)StubGetPerformanceParameterINTEL; } - table->SetLocalDimmingAMD = (PFN_vkSetLocalDimmingAMD) gpa(device, "vkSetLocalDimmingAMD"); - if (table->SetLocalDimmingAMD == nullptr) { table->SetLocalDimmingAMD = (PFN_vkSetLocalDimmingAMD)StubSetLocalDimmingAMD; } - table->GetBufferDeviceAddressEXT = (PFN_vkGetBufferDeviceAddressEXT) gpa(device, "vkGetBufferDeviceAddressEXT"); - if (table->GetBufferDeviceAddressEXT == nullptr) { table->GetBufferDeviceAddressEXT = (PFN_vkGetBufferDeviceAddressEXT)StubGetBufferDeviceAddressEXT; } -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->AcquireFullScreenExclusiveModeEXT = (PFN_vkAcquireFullScreenExclusiveModeEXT) gpa(device, "vkAcquireFullScreenExclusiveModeEXT"); - if (table->AcquireFullScreenExclusiveModeEXT == nullptr) { table->AcquireFullScreenExclusiveModeEXT = (PFN_vkAcquireFullScreenExclusiveModeEXT)StubAcquireFullScreenExclusiveModeEXT; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->ReleaseFullScreenExclusiveModeEXT = (PFN_vkReleaseFullScreenExclusiveModeEXT) gpa(device, "vkReleaseFullScreenExclusiveModeEXT"); - if (table->ReleaseFullScreenExclusiveModeEXT == nullptr) { table->ReleaseFullScreenExclusiveModeEXT = (PFN_vkReleaseFullScreenExclusiveModeEXT)StubReleaseFullScreenExclusiveModeEXT; } -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT) gpa(device, "vkGetDeviceGroupSurfacePresentModes2EXT"); - if (table->GetDeviceGroupSurfacePresentModes2EXT == nullptr) { table->GetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)StubGetDeviceGroupSurfacePresentModes2EXT; } -#endif // VK_USE_PLATFORM_WIN32_KHR - table->CmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT) gpa(device, "vkCmdSetLineStippleEXT"); - if (table->CmdSetLineStippleEXT == nullptr) { table->CmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)StubCmdSetLineStippleEXT; } - table->ResetQueryPoolEXT = (PFN_vkResetQueryPoolEXT) gpa(device, "vkResetQueryPoolEXT"); - if (table->ResetQueryPoolEXT == nullptr) { table->ResetQueryPoolEXT = (PFN_vkResetQueryPoolEXT)StubResetQueryPoolEXT; } - table->CmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT) gpa(device, "vkCmdSetCullModeEXT"); - if (table->CmdSetCullModeEXT == nullptr) { table->CmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)StubCmdSetCullModeEXT; } - table->CmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT) gpa(device, "vkCmdSetFrontFaceEXT"); - if (table->CmdSetFrontFaceEXT == nullptr) { table->CmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)StubCmdSetFrontFaceEXT; } - table->CmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT) gpa(device, "vkCmdSetPrimitiveTopologyEXT"); - if (table->CmdSetPrimitiveTopologyEXT == nullptr) { table->CmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)StubCmdSetPrimitiveTopologyEXT; } - table->CmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT) gpa(device, "vkCmdSetViewportWithCountEXT"); - if (table->CmdSetViewportWithCountEXT == nullptr) { table->CmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)StubCmdSetViewportWithCountEXT; } - table->CmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT) gpa(device, "vkCmdSetScissorWithCountEXT"); - if (table->CmdSetScissorWithCountEXT == nullptr) { table->CmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)StubCmdSetScissorWithCountEXT; } - table->CmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT) gpa(device, "vkCmdBindVertexBuffers2EXT"); - if (table->CmdBindVertexBuffers2EXT == nullptr) { table->CmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)StubCmdBindVertexBuffers2EXT; } - table->CmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT) gpa(device, "vkCmdSetDepthTestEnableEXT"); - if (table->CmdSetDepthTestEnableEXT == nullptr) { table->CmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)StubCmdSetDepthTestEnableEXT; } - table->CmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT) gpa(device, "vkCmdSetDepthWriteEnableEXT"); - if (table->CmdSetDepthWriteEnableEXT == nullptr) { table->CmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)StubCmdSetDepthWriteEnableEXT; } - table->CmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT) gpa(device, "vkCmdSetDepthCompareOpEXT"); - if (table->CmdSetDepthCompareOpEXT == nullptr) { table->CmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)StubCmdSetDepthCompareOpEXT; } - table->CmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT) gpa(device, "vkCmdSetDepthBoundsTestEnableEXT"); - if (table->CmdSetDepthBoundsTestEnableEXT == nullptr) { table->CmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)StubCmdSetDepthBoundsTestEnableEXT; } - table->CmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT) gpa(device, "vkCmdSetStencilTestEnableEXT"); - if (table->CmdSetStencilTestEnableEXT == nullptr) { table->CmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)StubCmdSetStencilTestEnableEXT; } - table->CmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT) gpa(device, "vkCmdSetStencilOpEXT"); - if (table->CmdSetStencilOpEXT == nullptr) { table->CmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)StubCmdSetStencilOpEXT; } - table->GetGeneratedCommandsMemoryRequirementsNV = (PFN_vkGetGeneratedCommandsMemoryRequirementsNV) gpa(device, "vkGetGeneratedCommandsMemoryRequirementsNV"); - if (table->GetGeneratedCommandsMemoryRequirementsNV == nullptr) { table->GetGeneratedCommandsMemoryRequirementsNV = (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)StubGetGeneratedCommandsMemoryRequirementsNV; } - table->CmdPreprocessGeneratedCommandsNV = (PFN_vkCmdPreprocessGeneratedCommandsNV) gpa(device, "vkCmdPreprocessGeneratedCommandsNV"); - if (table->CmdPreprocessGeneratedCommandsNV == nullptr) { table->CmdPreprocessGeneratedCommandsNV = (PFN_vkCmdPreprocessGeneratedCommandsNV)StubCmdPreprocessGeneratedCommandsNV; } - table->CmdExecuteGeneratedCommandsNV = (PFN_vkCmdExecuteGeneratedCommandsNV) gpa(device, "vkCmdExecuteGeneratedCommandsNV"); - if (table->CmdExecuteGeneratedCommandsNV == nullptr) { table->CmdExecuteGeneratedCommandsNV = (PFN_vkCmdExecuteGeneratedCommandsNV)StubCmdExecuteGeneratedCommandsNV; } - table->CmdBindPipelineShaderGroupNV = (PFN_vkCmdBindPipelineShaderGroupNV) gpa(device, "vkCmdBindPipelineShaderGroupNV"); - if (table->CmdBindPipelineShaderGroupNV == nullptr) { table->CmdBindPipelineShaderGroupNV = (PFN_vkCmdBindPipelineShaderGroupNV)StubCmdBindPipelineShaderGroupNV; } - table->CreateIndirectCommandsLayoutNV = (PFN_vkCreateIndirectCommandsLayoutNV) gpa(device, "vkCreateIndirectCommandsLayoutNV"); - if (table->CreateIndirectCommandsLayoutNV == nullptr) { table->CreateIndirectCommandsLayoutNV = (PFN_vkCreateIndirectCommandsLayoutNV)StubCreateIndirectCommandsLayoutNV; } - table->DestroyIndirectCommandsLayoutNV = (PFN_vkDestroyIndirectCommandsLayoutNV) gpa(device, "vkDestroyIndirectCommandsLayoutNV"); - if (table->DestroyIndirectCommandsLayoutNV == nullptr) { table->DestroyIndirectCommandsLayoutNV = (PFN_vkDestroyIndirectCommandsLayoutNV)StubDestroyIndirectCommandsLayoutNV; } - table->CreatePrivateDataSlotEXT = (PFN_vkCreatePrivateDataSlotEXT) gpa(device, "vkCreatePrivateDataSlotEXT"); - if (table->CreatePrivateDataSlotEXT == nullptr) { table->CreatePrivateDataSlotEXT = (PFN_vkCreatePrivateDataSlotEXT)StubCreatePrivateDataSlotEXT; } - table->DestroyPrivateDataSlotEXT = (PFN_vkDestroyPrivateDataSlotEXT) gpa(device, "vkDestroyPrivateDataSlotEXT"); - if (table->DestroyPrivateDataSlotEXT == nullptr) { table->DestroyPrivateDataSlotEXT = (PFN_vkDestroyPrivateDataSlotEXT)StubDestroyPrivateDataSlotEXT; } - table->SetPrivateDataEXT = (PFN_vkSetPrivateDataEXT) gpa(device, "vkSetPrivateDataEXT"); - if (table->SetPrivateDataEXT == nullptr) { table->SetPrivateDataEXT = (PFN_vkSetPrivateDataEXT)StubSetPrivateDataEXT; } - table->GetPrivateDataEXT = (PFN_vkGetPrivateDataEXT) gpa(device, "vkGetPrivateDataEXT"); - if (table->GetPrivateDataEXT == nullptr) { table->GetPrivateDataEXT = (PFN_vkGetPrivateDataEXT)StubGetPrivateDataEXT; } -#ifdef VK_USE_PLATFORM_METAL_EXT - table->ExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT) gpa(device, "vkExportMetalObjectsEXT"); - if (table->ExportMetalObjectsEXT == nullptr) { table->ExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT)StubExportMetalObjectsEXT; } -#endif // VK_USE_PLATFORM_METAL_EXT - table->CmdSetFragmentShadingRateEnumNV = (PFN_vkCmdSetFragmentShadingRateEnumNV) gpa(device, "vkCmdSetFragmentShadingRateEnumNV"); - if (table->CmdSetFragmentShadingRateEnumNV == nullptr) { table->CmdSetFragmentShadingRateEnumNV = (PFN_vkCmdSetFragmentShadingRateEnumNV)StubCmdSetFragmentShadingRateEnumNV; } - table->GetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT) gpa(device, "vkGetImageSubresourceLayout2EXT"); - if (table->GetImageSubresourceLayout2EXT == nullptr) { table->GetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)StubGetImageSubresourceLayout2EXT; } - table->GetDeviceFaultInfoEXT = (PFN_vkGetDeviceFaultInfoEXT) gpa(device, "vkGetDeviceFaultInfoEXT"); - if (table->GetDeviceFaultInfoEXT == nullptr) { table->GetDeviceFaultInfoEXT = (PFN_vkGetDeviceFaultInfoEXT)StubGetDeviceFaultInfoEXT; } - table->CmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT) gpa(device, "vkCmdSetVertexInputEXT"); - if (table->CmdSetVertexInputEXT == nullptr) { table->CmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)StubCmdSetVertexInputEXT; } -#ifdef VK_USE_PLATFORM_FUCHSIA - table->GetMemoryZirconHandleFUCHSIA = (PFN_vkGetMemoryZirconHandleFUCHSIA) gpa(device, "vkGetMemoryZirconHandleFUCHSIA"); - if (table->GetMemoryZirconHandleFUCHSIA == nullptr) { table->GetMemoryZirconHandleFUCHSIA = (PFN_vkGetMemoryZirconHandleFUCHSIA)StubGetMemoryZirconHandleFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->GetMemoryZirconHandlePropertiesFUCHSIA = (PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA) gpa(device, "vkGetMemoryZirconHandlePropertiesFUCHSIA"); - if (table->GetMemoryZirconHandlePropertiesFUCHSIA == nullptr) { table->GetMemoryZirconHandlePropertiesFUCHSIA = (PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)StubGetMemoryZirconHandlePropertiesFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->ImportSemaphoreZirconHandleFUCHSIA = (PFN_vkImportSemaphoreZirconHandleFUCHSIA) gpa(device, "vkImportSemaphoreZirconHandleFUCHSIA"); - if (table->ImportSemaphoreZirconHandleFUCHSIA == nullptr) { table->ImportSemaphoreZirconHandleFUCHSIA = (PFN_vkImportSemaphoreZirconHandleFUCHSIA)StubImportSemaphoreZirconHandleFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->GetSemaphoreZirconHandleFUCHSIA = (PFN_vkGetSemaphoreZirconHandleFUCHSIA) gpa(device, "vkGetSemaphoreZirconHandleFUCHSIA"); - if (table->GetSemaphoreZirconHandleFUCHSIA == nullptr) { table->GetSemaphoreZirconHandleFUCHSIA = (PFN_vkGetSemaphoreZirconHandleFUCHSIA)StubGetSemaphoreZirconHandleFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->CreateBufferCollectionFUCHSIA = (PFN_vkCreateBufferCollectionFUCHSIA) gpa(device, "vkCreateBufferCollectionFUCHSIA"); - if (table->CreateBufferCollectionFUCHSIA == nullptr) { table->CreateBufferCollectionFUCHSIA = (PFN_vkCreateBufferCollectionFUCHSIA)StubCreateBufferCollectionFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->SetBufferCollectionImageConstraintsFUCHSIA = (PFN_vkSetBufferCollectionImageConstraintsFUCHSIA) gpa(device, "vkSetBufferCollectionImageConstraintsFUCHSIA"); - if (table->SetBufferCollectionImageConstraintsFUCHSIA == nullptr) { table->SetBufferCollectionImageConstraintsFUCHSIA = (PFN_vkSetBufferCollectionImageConstraintsFUCHSIA)StubSetBufferCollectionImageConstraintsFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->SetBufferCollectionBufferConstraintsFUCHSIA = (PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA) gpa(device, "vkSetBufferCollectionBufferConstraintsFUCHSIA"); - if (table->SetBufferCollectionBufferConstraintsFUCHSIA == nullptr) { table->SetBufferCollectionBufferConstraintsFUCHSIA = (PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA)StubSetBufferCollectionBufferConstraintsFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->DestroyBufferCollectionFUCHSIA = (PFN_vkDestroyBufferCollectionFUCHSIA) gpa(device, "vkDestroyBufferCollectionFUCHSIA"); - if (table->DestroyBufferCollectionFUCHSIA == nullptr) { table->DestroyBufferCollectionFUCHSIA = (PFN_vkDestroyBufferCollectionFUCHSIA)StubDestroyBufferCollectionFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA - table->GetBufferCollectionPropertiesFUCHSIA = (PFN_vkGetBufferCollectionPropertiesFUCHSIA) gpa(device, "vkGetBufferCollectionPropertiesFUCHSIA"); - if (table->GetBufferCollectionPropertiesFUCHSIA == nullptr) { table->GetBufferCollectionPropertiesFUCHSIA = (PFN_vkGetBufferCollectionPropertiesFUCHSIA)StubGetBufferCollectionPropertiesFUCHSIA; } -#endif // VK_USE_PLATFORM_FUCHSIA - table->GetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI = (PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI) gpa(device, "vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI"); - if (table->GetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI == nullptr) { table->GetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI = (PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI)StubGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI; } - table->CmdSubpassShadingHUAWEI = (PFN_vkCmdSubpassShadingHUAWEI) gpa(device, "vkCmdSubpassShadingHUAWEI"); - if (table->CmdSubpassShadingHUAWEI == nullptr) { table->CmdSubpassShadingHUAWEI = (PFN_vkCmdSubpassShadingHUAWEI)StubCmdSubpassShadingHUAWEI; } - table->CmdBindInvocationMaskHUAWEI = (PFN_vkCmdBindInvocationMaskHUAWEI) gpa(device, "vkCmdBindInvocationMaskHUAWEI"); - if (table->CmdBindInvocationMaskHUAWEI == nullptr) { table->CmdBindInvocationMaskHUAWEI = (PFN_vkCmdBindInvocationMaskHUAWEI)StubCmdBindInvocationMaskHUAWEI; } - table->GetMemoryRemoteAddressNV = (PFN_vkGetMemoryRemoteAddressNV) gpa(device, "vkGetMemoryRemoteAddressNV"); - if (table->GetMemoryRemoteAddressNV == nullptr) { table->GetMemoryRemoteAddressNV = (PFN_vkGetMemoryRemoteAddressNV)StubGetMemoryRemoteAddressNV; } - table->GetPipelinePropertiesEXT = (PFN_vkGetPipelinePropertiesEXT) gpa(device, "vkGetPipelinePropertiesEXT"); - if (table->GetPipelinePropertiesEXT == nullptr) { table->GetPipelinePropertiesEXT = (PFN_vkGetPipelinePropertiesEXT)StubGetPipelinePropertiesEXT; } - table->CmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT) gpa(device, "vkCmdSetPatchControlPointsEXT"); - if (table->CmdSetPatchControlPointsEXT == nullptr) { table->CmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT)StubCmdSetPatchControlPointsEXT; } - table->CmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT) gpa(device, "vkCmdSetRasterizerDiscardEnableEXT"); - if (table->CmdSetRasterizerDiscardEnableEXT == nullptr) { table->CmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT)StubCmdSetRasterizerDiscardEnableEXT; } - table->CmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT) gpa(device, "vkCmdSetDepthBiasEnableEXT"); - if (table->CmdSetDepthBiasEnableEXT == nullptr) { table->CmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT)StubCmdSetDepthBiasEnableEXT; } - table->CmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT) gpa(device, "vkCmdSetLogicOpEXT"); - if (table->CmdSetLogicOpEXT == nullptr) { table->CmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT)StubCmdSetLogicOpEXT; } - table->CmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT) gpa(device, "vkCmdSetPrimitiveRestartEnableEXT"); - if (table->CmdSetPrimitiveRestartEnableEXT == nullptr) { table->CmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT)StubCmdSetPrimitiveRestartEnableEXT; } - table->CmdSetColorWriteEnableEXT = (PFN_vkCmdSetColorWriteEnableEXT) gpa(device, "vkCmdSetColorWriteEnableEXT"); - if (table->CmdSetColorWriteEnableEXT == nullptr) { table->CmdSetColorWriteEnableEXT = (PFN_vkCmdSetColorWriteEnableEXT)StubCmdSetColorWriteEnableEXT; } - table->CmdDrawMultiEXT = (PFN_vkCmdDrawMultiEXT) gpa(device, "vkCmdDrawMultiEXT"); - if (table->CmdDrawMultiEXT == nullptr) { table->CmdDrawMultiEXT = (PFN_vkCmdDrawMultiEXT)StubCmdDrawMultiEXT; } - table->CmdDrawMultiIndexedEXT = (PFN_vkCmdDrawMultiIndexedEXT) gpa(device, "vkCmdDrawMultiIndexedEXT"); - if (table->CmdDrawMultiIndexedEXT == nullptr) { table->CmdDrawMultiIndexedEXT = (PFN_vkCmdDrawMultiIndexedEXT)StubCmdDrawMultiIndexedEXT; } - table->CreateMicromapEXT = (PFN_vkCreateMicromapEXT) gpa(device, "vkCreateMicromapEXT"); - if (table->CreateMicromapEXT == nullptr) { table->CreateMicromapEXT = (PFN_vkCreateMicromapEXT)StubCreateMicromapEXT; } - table->DestroyMicromapEXT = (PFN_vkDestroyMicromapEXT) gpa(device, "vkDestroyMicromapEXT"); - if (table->DestroyMicromapEXT == nullptr) { table->DestroyMicromapEXT = (PFN_vkDestroyMicromapEXT)StubDestroyMicromapEXT; } - table->CmdBuildMicromapsEXT = (PFN_vkCmdBuildMicromapsEXT) gpa(device, "vkCmdBuildMicromapsEXT"); - if (table->CmdBuildMicromapsEXT == nullptr) { table->CmdBuildMicromapsEXT = (PFN_vkCmdBuildMicromapsEXT)StubCmdBuildMicromapsEXT; } - table->BuildMicromapsEXT = (PFN_vkBuildMicromapsEXT) gpa(device, "vkBuildMicromapsEXT"); - if (table->BuildMicromapsEXT == nullptr) { table->BuildMicromapsEXT = (PFN_vkBuildMicromapsEXT)StubBuildMicromapsEXT; } - table->CopyMicromapEXT = (PFN_vkCopyMicromapEXT) gpa(device, "vkCopyMicromapEXT"); - if (table->CopyMicromapEXT == nullptr) { table->CopyMicromapEXT = (PFN_vkCopyMicromapEXT)StubCopyMicromapEXT; } - table->CopyMicromapToMemoryEXT = (PFN_vkCopyMicromapToMemoryEXT) gpa(device, "vkCopyMicromapToMemoryEXT"); - if (table->CopyMicromapToMemoryEXT == nullptr) { table->CopyMicromapToMemoryEXT = (PFN_vkCopyMicromapToMemoryEXT)StubCopyMicromapToMemoryEXT; } - table->CopyMemoryToMicromapEXT = (PFN_vkCopyMemoryToMicromapEXT) gpa(device, "vkCopyMemoryToMicromapEXT"); - if (table->CopyMemoryToMicromapEXT == nullptr) { table->CopyMemoryToMicromapEXT = (PFN_vkCopyMemoryToMicromapEXT)StubCopyMemoryToMicromapEXT; } - table->WriteMicromapsPropertiesEXT = (PFN_vkWriteMicromapsPropertiesEXT) gpa(device, "vkWriteMicromapsPropertiesEXT"); - if (table->WriteMicromapsPropertiesEXT == nullptr) { table->WriteMicromapsPropertiesEXT = (PFN_vkWriteMicromapsPropertiesEXT)StubWriteMicromapsPropertiesEXT; } - table->CmdCopyMicromapEXT = (PFN_vkCmdCopyMicromapEXT) gpa(device, "vkCmdCopyMicromapEXT"); - if (table->CmdCopyMicromapEXT == nullptr) { table->CmdCopyMicromapEXT = (PFN_vkCmdCopyMicromapEXT)StubCmdCopyMicromapEXT; } - table->CmdCopyMicromapToMemoryEXT = (PFN_vkCmdCopyMicromapToMemoryEXT) gpa(device, "vkCmdCopyMicromapToMemoryEXT"); - if (table->CmdCopyMicromapToMemoryEXT == nullptr) { table->CmdCopyMicromapToMemoryEXT = (PFN_vkCmdCopyMicromapToMemoryEXT)StubCmdCopyMicromapToMemoryEXT; } - table->CmdCopyMemoryToMicromapEXT = (PFN_vkCmdCopyMemoryToMicromapEXT) gpa(device, "vkCmdCopyMemoryToMicromapEXT"); - if (table->CmdCopyMemoryToMicromapEXT == nullptr) { table->CmdCopyMemoryToMicromapEXT = (PFN_vkCmdCopyMemoryToMicromapEXT)StubCmdCopyMemoryToMicromapEXT; } - table->CmdWriteMicromapsPropertiesEXT = (PFN_vkCmdWriteMicromapsPropertiesEXT) gpa(device, "vkCmdWriteMicromapsPropertiesEXT"); - if (table->CmdWriteMicromapsPropertiesEXT == nullptr) { table->CmdWriteMicromapsPropertiesEXT = (PFN_vkCmdWriteMicromapsPropertiesEXT)StubCmdWriteMicromapsPropertiesEXT; } - table->GetDeviceMicromapCompatibilityEXT = (PFN_vkGetDeviceMicromapCompatibilityEXT) gpa(device, "vkGetDeviceMicromapCompatibilityEXT"); - if (table->GetDeviceMicromapCompatibilityEXT == nullptr) { table->GetDeviceMicromapCompatibilityEXT = (PFN_vkGetDeviceMicromapCompatibilityEXT)StubGetDeviceMicromapCompatibilityEXT; } - table->GetMicromapBuildSizesEXT = (PFN_vkGetMicromapBuildSizesEXT) gpa(device, "vkGetMicromapBuildSizesEXT"); - if (table->GetMicromapBuildSizesEXT == nullptr) { table->GetMicromapBuildSizesEXT = (PFN_vkGetMicromapBuildSizesEXT)StubGetMicromapBuildSizesEXT; } - table->SetDeviceMemoryPriorityEXT = (PFN_vkSetDeviceMemoryPriorityEXT) gpa(device, "vkSetDeviceMemoryPriorityEXT"); - if (table->SetDeviceMemoryPriorityEXT == nullptr) { table->SetDeviceMemoryPriorityEXT = (PFN_vkSetDeviceMemoryPriorityEXT)StubSetDeviceMemoryPriorityEXT; } - table->GetDescriptorSetLayoutHostMappingInfoVALVE = (PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE) gpa(device, "vkGetDescriptorSetLayoutHostMappingInfoVALVE"); - if (table->GetDescriptorSetLayoutHostMappingInfoVALVE == nullptr) { table->GetDescriptorSetLayoutHostMappingInfoVALVE = (PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE)StubGetDescriptorSetLayoutHostMappingInfoVALVE; } - table->GetDescriptorSetHostMappingVALVE = (PFN_vkGetDescriptorSetHostMappingVALVE) gpa(device, "vkGetDescriptorSetHostMappingVALVE"); - if (table->GetDescriptorSetHostMappingVALVE == nullptr) { table->GetDescriptorSetHostMappingVALVE = (PFN_vkGetDescriptorSetHostMappingVALVE)StubGetDescriptorSetHostMappingVALVE; } - table->CmdSetTessellationDomainOriginEXT = (PFN_vkCmdSetTessellationDomainOriginEXT) gpa(device, "vkCmdSetTessellationDomainOriginEXT"); - if (table->CmdSetTessellationDomainOriginEXT == nullptr) { table->CmdSetTessellationDomainOriginEXT = (PFN_vkCmdSetTessellationDomainOriginEXT)StubCmdSetTessellationDomainOriginEXT; } - table->CmdSetDepthClampEnableEXT = (PFN_vkCmdSetDepthClampEnableEXT) gpa(device, "vkCmdSetDepthClampEnableEXT"); - if (table->CmdSetDepthClampEnableEXT == nullptr) { table->CmdSetDepthClampEnableEXT = (PFN_vkCmdSetDepthClampEnableEXT)StubCmdSetDepthClampEnableEXT; } - table->CmdSetPolygonModeEXT = (PFN_vkCmdSetPolygonModeEXT) gpa(device, "vkCmdSetPolygonModeEXT"); - if (table->CmdSetPolygonModeEXT == nullptr) { table->CmdSetPolygonModeEXT = (PFN_vkCmdSetPolygonModeEXT)StubCmdSetPolygonModeEXT; } - table->CmdSetRasterizationSamplesEXT = (PFN_vkCmdSetRasterizationSamplesEXT) gpa(device, "vkCmdSetRasterizationSamplesEXT"); - if (table->CmdSetRasterizationSamplesEXT == nullptr) { table->CmdSetRasterizationSamplesEXT = (PFN_vkCmdSetRasterizationSamplesEXT)StubCmdSetRasterizationSamplesEXT; } - table->CmdSetSampleMaskEXT = (PFN_vkCmdSetSampleMaskEXT) gpa(device, "vkCmdSetSampleMaskEXT"); - if (table->CmdSetSampleMaskEXT == nullptr) { table->CmdSetSampleMaskEXT = (PFN_vkCmdSetSampleMaskEXT)StubCmdSetSampleMaskEXT; } - table->CmdSetAlphaToCoverageEnableEXT = (PFN_vkCmdSetAlphaToCoverageEnableEXT) gpa(device, "vkCmdSetAlphaToCoverageEnableEXT"); - if (table->CmdSetAlphaToCoverageEnableEXT == nullptr) { table->CmdSetAlphaToCoverageEnableEXT = (PFN_vkCmdSetAlphaToCoverageEnableEXT)StubCmdSetAlphaToCoverageEnableEXT; } - table->CmdSetAlphaToOneEnableEXT = (PFN_vkCmdSetAlphaToOneEnableEXT) gpa(device, "vkCmdSetAlphaToOneEnableEXT"); - if (table->CmdSetAlphaToOneEnableEXT == nullptr) { table->CmdSetAlphaToOneEnableEXT = (PFN_vkCmdSetAlphaToOneEnableEXT)StubCmdSetAlphaToOneEnableEXT; } - table->CmdSetLogicOpEnableEXT = (PFN_vkCmdSetLogicOpEnableEXT) gpa(device, "vkCmdSetLogicOpEnableEXT"); - if (table->CmdSetLogicOpEnableEXT == nullptr) { table->CmdSetLogicOpEnableEXT = (PFN_vkCmdSetLogicOpEnableEXT)StubCmdSetLogicOpEnableEXT; } - table->CmdSetColorBlendEnableEXT = (PFN_vkCmdSetColorBlendEnableEXT) gpa(device, "vkCmdSetColorBlendEnableEXT"); - if (table->CmdSetColorBlendEnableEXT == nullptr) { table->CmdSetColorBlendEnableEXT = (PFN_vkCmdSetColorBlendEnableEXT)StubCmdSetColorBlendEnableEXT; } - table->CmdSetColorBlendEquationEXT = (PFN_vkCmdSetColorBlendEquationEXT) gpa(device, "vkCmdSetColorBlendEquationEXT"); - if (table->CmdSetColorBlendEquationEXT == nullptr) { table->CmdSetColorBlendEquationEXT = (PFN_vkCmdSetColorBlendEquationEXT)StubCmdSetColorBlendEquationEXT; } - table->CmdSetColorWriteMaskEXT = (PFN_vkCmdSetColorWriteMaskEXT) gpa(device, "vkCmdSetColorWriteMaskEXT"); - if (table->CmdSetColorWriteMaskEXT == nullptr) { table->CmdSetColorWriteMaskEXT = (PFN_vkCmdSetColorWriteMaskEXT)StubCmdSetColorWriteMaskEXT; } - table->CmdSetRasterizationStreamEXT = (PFN_vkCmdSetRasterizationStreamEXT) gpa(device, "vkCmdSetRasterizationStreamEXT"); - if (table->CmdSetRasterizationStreamEXT == nullptr) { table->CmdSetRasterizationStreamEXT = (PFN_vkCmdSetRasterizationStreamEXT)StubCmdSetRasterizationStreamEXT; } - table->CmdSetConservativeRasterizationModeEXT = (PFN_vkCmdSetConservativeRasterizationModeEXT) gpa(device, "vkCmdSetConservativeRasterizationModeEXT"); - if (table->CmdSetConservativeRasterizationModeEXT == nullptr) { table->CmdSetConservativeRasterizationModeEXT = (PFN_vkCmdSetConservativeRasterizationModeEXT)StubCmdSetConservativeRasterizationModeEXT; } - table->CmdSetExtraPrimitiveOverestimationSizeEXT = (PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT) gpa(device, "vkCmdSetExtraPrimitiveOverestimationSizeEXT"); - if (table->CmdSetExtraPrimitiveOverestimationSizeEXT == nullptr) { table->CmdSetExtraPrimitiveOverestimationSizeEXT = (PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT)StubCmdSetExtraPrimitiveOverestimationSizeEXT; } - table->CmdSetDepthClipEnableEXT = (PFN_vkCmdSetDepthClipEnableEXT) gpa(device, "vkCmdSetDepthClipEnableEXT"); - if (table->CmdSetDepthClipEnableEXT == nullptr) { table->CmdSetDepthClipEnableEXT = (PFN_vkCmdSetDepthClipEnableEXT)StubCmdSetDepthClipEnableEXT; } - table->CmdSetSampleLocationsEnableEXT = (PFN_vkCmdSetSampleLocationsEnableEXT) gpa(device, "vkCmdSetSampleLocationsEnableEXT"); - if (table->CmdSetSampleLocationsEnableEXT == nullptr) { table->CmdSetSampleLocationsEnableEXT = (PFN_vkCmdSetSampleLocationsEnableEXT)StubCmdSetSampleLocationsEnableEXT; } - table->CmdSetColorBlendAdvancedEXT = (PFN_vkCmdSetColorBlendAdvancedEXT) gpa(device, "vkCmdSetColorBlendAdvancedEXT"); - if (table->CmdSetColorBlendAdvancedEXT == nullptr) { table->CmdSetColorBlendAdvancedEXT = (PFN_vkCmdSetColorBlendAdvancedEXT)StubCmdSetColorBlendAdvancedEXT; } - table->CmdSetProvokingVertexModeEXT = (PFN_vkCmdSetProvokingVertexModeEXT) gpa(device, "vkCmdSetProvokingVertexModeEXT"); - if (table->CmdSetProvokingVertexModeEXT == nullptr) { table->CmdSetProvokingVertexModeEXT = (PFN_vkCmdSetProvokingVertexModeEXT)StubCmdSetProvokingVertexModeEXT; } - table->CmdSetLineRasterizationModeEXT = (PFN_vkCmdSetLineRasterizationModeEXT) gpa(device, "vkCmdSetLineRasterizationModeEXT"); - if (table->CmdSetLineRasterizationModeEXT == nullptr) { table->CmdSetLineRasterizationModeEXT = (PFN_vkCmdSetLineRasterizationModeEXT)StubCmdSetLineRasterizationModeEXT; } - table->CmdSetLineStippleEnableEXT = (PFN_vkCmdSetLineStippleEnableEXT) gpa(device, "vkCmdSetLineStippleEnableEXT"); - if (table->CmdSetLineStippleEnableEXT == nullptr) { table->CmdSetLineStippleEnableEXT = (PFN_vkCmdSetLineStippleEnableEXT)StubCmdSetLineStippleEnableEXT; } - table->CmdSetDepthClipNegativeOneToOneEXT = (PFN_vkCmdSetDepthClipNegativeOneToOneEXT) gpa(device, "vkCmdSetDepthClipNegativeOneToOneEXT"); - if (table->CmdSetDepthClipNegativeOneToOneEXT == nullptr) { table->CmdSetDepthClipNegativeOneToOneEXT = (PFN_vkCmdSetDepthClipNegativeOneToOneEXT)StubCmdSetDepthClipNegativeOneToOneEXT; } - table->CmdSetViewportWScalingEnableNV = (PFN_vkCmdSetViewportWScalingEnableNV) gpa(device, "vkCmdSetViewportWScalingEnableNV"); - if (table->CmdSetViewportWScalingEnableNV == nullptr) { table->CmdSetViewportWScalingEnableNV = (PFN_vkCmdSetViewportWScalingEnableNV)StubCmdSetViewportWScalingEnableNV; } - table->CmdSetViewportSwizzleNV = (PFN_vkCmdSetViewportSwizzleNV) gpa(device, "vkCmdSetViewportSwizzleNV"); - if (table->CmdSetViewportSwizzleNV == nullptr) { table->CmdSetViewportSwizzleNV = (PFN_vkCmdSetViewportSwizzleNV)StubCmdSetViewportSwizzleNV; } - table->CmdSetCoverageToColorEnableNV = (PFN_vkCmdSetCoverageToColorEnableNV) gpa(device, "vkCmdSetCoverageToColorEnableNV"); - if (table->CmdSetCoverageToColorEnableNV == nullptr) { table->CmdSetCoverageToColorEnableNV = (PFN_vkCmdSetCoverageToColorEnableNV)StubCmdSetCoverageToColorEnableNV; } - table->CmdSetCoverageToColorLocationNV = (PFN_vkCmdSetCoverageToColorLocationNV) gpa(device, "vkCmdSetCoverageToColorLocationNV"); - if (table->CmdSetCoverageToColorLocationNV == nullptr) { table->CmdSetCoverageToColorLocationNV = (PFN_vkCmdSetCoverageToColorLocationNV)StubCmdSetCoverageToColorLocationNV; } - table->CmdSetCoverageModulationModeNV = (PFN_vkCmdSetCoverageModulationModeNV) gpa(device, "vkCmdSetCoverageModulationModeNV"); - if (table->CmdSetCoverageModulationModeNV == nullptr) { table->CmdSetCoverageModulationModeNV = (PFN_vkCmdSetCoverageModulationModeNV)StubCmdSetCoverageModulationModeNV; } - table->CmdSetCoverageModulationTableEnableNV = (PFN_vkCmdSetCoverageModulationTableEnableNV) gpa(device, "vkCmdSetCoverageModulationTableEnableNV"); - if (table->CmdSetCoverageModulationTableEnableNV == nullptr) { table->CmdSetCoverageModulationTableEnableNV = (PFN_vkCmdSetCoverageModulationTableEnableNV)StubCmdSetCoverageModulationTableEnableNV; } - table->CmdSetCoverageModulationTableNV = (PFN_vkCmdSetCoverageModulationTableNV) gpa(device, "vkCmdSetCoverageModulationTableNV"); - if (table->CmdSetCoverageModulationTableNV == nullptr) { table->CmdSetCoverageModulationTableNV = (PFN_vkCmdSetCoverageModulationTableNV)StubCmdSetCoverageModulationTableNV; } - table->CmdSetShadingRateImageEnableNV = (PFN_vkCmdSetShadingRateImageEnableNV) gpa(device, "vkCmdSetShadingRateImageEnableNV"); - if (table->CmdSetShadingRateImageEnableNV == nullptr) { table->CmdSetShadingRateImageEnableNV = (PFN_vkCmdSetShadingRateImageEnableNV)StubCmdSetShadingRateImageEnableNV; } - table->CmdSetRepresentativeFragmentTestEnableNV = (PFN_vkCmdSetRepresentativeFragmentTestEnableNV) gpa(device, "vkCmdSetRepresentativeFragmentTestEnableNV"); - if (table->CmdSetRepresentativeFragmentTestEnableNV == nullptr) { table->CmdSetRepresentativeFragmentTestEnableNV = (PFN_vkCmdSetRepresentativeFragmentTestEnableNV)StubCmdSetRepresentativeFragmentTestEnableNV; } - table->CmdSetCoverageReductionModeNV = (PFN_vkCmdSetCoverageReductionModeNV) gpa(device, "vkCmdSetCoverageReductionModeNV"); - if (table->CmdSetCoverageReductionModeNV == nullptr) { table->CmdSetCoverageReductionModeNV = (PFN_vkCmdSetCoverageReductionModeNV)StubCmdSetCoverageReductionModeNV; } - table->GetShaderModuleIdentifierEXT = (PFN_vkGetShaderModuleIdentifierEXT) gpa(device, "vkGetShaderModuleIdentifierEXT"); - if (table->GetShaderModuleIdentifierEXT == nullptr) { table->GetShaderModuleIdentifierEXT = (PFN_vkGetShaderModuleIdentifierEXT)StubGetShaderModuleIdentifierEXT; } - table->GetShaderModuleCreateInfoIdentifierEXT = (PFN_vkGetShaderModuleCreateInfoIdentifierEXT) gpa(device, "vkGetShaderModuleCreateInfoIdentifierEXT"); - if (table->GetShaderModuleCreateInfoIdentifierEXT == nullptr) { table->GetShaderModuleCreateInfoIdentifierEXT = (PFN_vkGetShaderModuleCreateInfoIdentifierEXT)StubGetShaderModuleCreateInfoIdentifierEXT; } - table->CreateOpticalFlowSessionNV = (PFN_vkCreateOpticalFlowSessionNV) gpa(device, "vkCreateOpticalFlowSessionNV"); - if (table->CreateOpticalFlowSessionNV == nullptr) { table->CreateOpticalFlowSessionNV = (PFN_vkCreateOpticalFlowSessionNV)StubCreateOpticalFlowSessionNV; } - table->DestroyOpticalFlowSessionNV = (PFN_vkDestroyOpticalFlowSessionNV) gpa(device, "vkDestroyOpticalFlowSessionNV"); - if (table->DestroyOpticalFlowSessionNV == nullptr) { table->DestroyOpticalFlowSessionNV = (PFN_vkDestroyOpticalFlowSessionNV)StubDestroyOpticalFlowSessionNV; } - table->BindOpticalFlowSessionImageNV = (PFN_vkBindOpticalFlowSessionImageNV) gpa(device, "vkBindOpticalFlowSessionImageNV"); - if (table->BindOpticalFlowSessionImageNV == nullptr) { table->BindOpticalFlowSessionImageNV = (PFN_vkBindOpticalFlowSessionImageNV)StubBindOpticalFlowSessionImageNV; } - table->CmdOpticalFlowExecuteNV = (PFN_vkCmdOpticalFlowExecuteNV) gpa(device, "vkCmdOpticalFlowExecuteNV"); - if (table->CmdOpticalFlowExecuteNV == nullptr) { table->CmdOpticalFlowExecuteNV = (PFN_vkCmdOpticalFlowExecuteNV)StubCmdOpticalFlowExecuteNV; } - table->GetFramebufferTilePropertiesQCOM = (PFN_vkGetFramebufferTilePropertiesQCOM) gpa(device, "vkGetFramebufferTilePropertiesQCOM"); - if (table->GetFramebufferTilePropertiesQCOM == nullptr) { table->GetFramebufferTilePropertiesQCOM = (PFN_vkGetFramebufferTilePropertiesQCOM)StubGetFramebufferTilePropertiesQCOM; } - table->GetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM) gpa(device, "vkGetDynamicRenderingTilePropertiesQCOM"); - if (table->GetDynamicRenderingTilePropertiesQCOM == nullptr) { table->GetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM)StubGetDynamicRenderingTilePropertiesQCOM; } + 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->FreeMemory = (PFN_vkFreeMemory)gpa(device, "vkFreeMemory"); + 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->GetImageSparseMemoryRequirements = + (PFN_vkGetImageSparseMemoryRequirements)gpa(device, "vkGetImageSparseMemoryRequirements"); + table->QueueBindSparse = (PFN_vkQueueBindSparse)gpa(device, "vkQueueBindSparse"); + 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->DestroyQueryPool = (PFN_vkDestroyQueryPool)gpa(device, "vkDestroyQueryPool"); + 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->CreateShaderModule = (PFN_vkCreateShaderModule)gpa(device, "vkCreateShaderModule"); + table->DestroyShaderModule = (PFN_vkDestroyShaderModule)gpa(device, "vkDestroyShaderModule"); + table->CreatePipelineCache = (PFN_vkCreatePipelineCache)gpa(device, "vkCreatePipelineCache"); + table->DestroyPipelineCache = (PFN_vkDestroyPipelineCache)gpa(device, "vkDestroyPipelineCache"); + table->GetPipelineCacheData = (PFN_vkGetPipelineCacheData)gpa(device, "vkGetPipelineCacheData"); + table->MergePipelineCaches = (PFN_vkMergePipelineCaches)gpa(device, "vkMergePipelineCaches"); + 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->DestroyDescriptorPool = (PFN_vkDestroyDescriptorPool)gpa(device, "vkDestroyDescriptorPool"); + 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->DestroyCommandPool = (PFN_vkDestroyCommandPool)gpa(device, "vkDestroyCommandPool"); + 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->GetImageSparseMemoryRequirements2 = + (PFN_vkGetImageSparseMemoryRequirements2)gpa(device, "vkGetImageSparseMemoryRequirements2"); + table->TrimCommandPool = (PFN_vkTrimCommandPool)gpa(device, "vkTrimCommandPool"); + table->GetDeviceQueue2 = (PFN_vkGetDeviceQueue2)gpa(device, "vkGetDeviceQueue2"); + table->CreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion)gpa(device, "vkCreateSamplerYcbcrConversion"); + table->DestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion)gpa(device, "vkDestroySamplerYcbcrConversion"); + table->CreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate)gpa(device, "vkCreateDescriptorUpdateTemplate"); + table->DestroyDescriptorUpdateTemplate = + (PFN_vkDestroyDescriptorUpdateTemplate)gpa(device, "vkDestroyDescriptorUpdateTemplate"); + table->UpdateDescriptorSetWithTemplate = + (PFN_vkUpdateDescriptorSetWithTemplate)gpa(device, "vkUpdateDescriptorSetWithTemplate"); + 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->CreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot)gpa(device, "vkCreatePrivateDataSlot"); + table->DestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot)gpa(device, "vkDestroyPrivateDataSlot"); + table->SetPrivateData = (PFN_vkSetPrivateData)gpa(device, "vkSetPrivateData"); + table->GetPrivateData = (PFN_vkGetPrivateData)gpa(device, "vkGetPrivateData"); + table->CmdSetEvent2 = (PFN_vkCmdSetEvent2)gpa(device, "vkCmdSetEvent2"); + table->CmdResetEvent2 = (PFN_vkCmdResetEvent2)gpa(device, "vkCmdResetEvent2"); + table->CmdWaitEvents2 = (PFN_vkCmdWaitEvents2)gpa(device, "vkCmdWaitEvents2"); + table->CmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2)gpa(device, "vkCmdPipelineBarrier2"); + table->CmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2)gpa(device, "vkCmdWriteTimestamp2"); + table->QueueSubmit2 = (PFN_vkQueueSubmit2)gpa(device, "vkQueueSubmit2"); + table->CmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2)gpa(device, "vkCmdCopyBuffer2"); + table->CmdCopyImage2 = (PFN_vkCmdCopyImage2)gpa(device, "vkCmdCopyImage2"); + table->CmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2)gpa(device, "vkCmdCopyBufferToImage2"); + table->CmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2)gpa(device, "vkCmdCopyImageToBuffer2"); + table->CmdBlitImage2 = (PFN_vkCmdBlitImage2)gpa(device, "vkCmdBlitImage2"); + table->CmdResolveImage2 = (PFN_vkCmdResolveImage2)gpa(device, "vkCmdResolveImage2"); + table->CmdBeginRendering = (PFN_vkCmdBeginRendering)gpa(device, "vkCmdBeginRendering"); + table->CmdEndRendering = (PFN_vkCmdEndRendering)gpa(device, "vkCmdEndRendering"); + table->CmdSetCullMode = (PFN_vkCmdSetCullMode)gpa(device, "vkCmdSetCullMode"); + table->CmdSetFrontFace = (PFN_vkCmdSetFrontFace)gpa(device, "vkCmdSetFrontFace"); + table->CmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology)gpa(device, "vkCmdSetPrimitiveTopology"); + table->CmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount)gpa(device, "vkCmdSetViewportWithCount"); + table->CmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount)gpa(device, "vkCmdSetScissorWithCount"); + table->CmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2)gpa(device, "vkCmdBindVertexBuffers2"); + table->CmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable)gpa(device, "vkCmdSetDepthTestEnable"); + table->CmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable)gpa(device, "vkCmdSetDepthWriteEnable"); + table->CmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp)gpa(device, "vkCmdSetDepthCompareOp"); + table->CmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable)gpa(device, "vkCmdSetDepthBoundsTestEnable"); + table->CmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable)gpa(device, "vkCmdSetStencilTestEnable"); + table->CmdSetStencilOp = (PFN_vkCmdSetStencilOp)gpa(device, "vkCmdSetStencilOp"); + table->CmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable)gpa(device, "vkCmdSetRasterizerDiscardEnable"); + table->CmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable)gpa(device, "vkCmdSetDepthBiasEnable"); + table->CmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable)gpa(device, "vkCmdSetPrimitiveRestartEnable"); + table->GetDeviceBufferMemoryRequirements = + (PFN_vkGetDeviceBufferMemoryRequirements)gpa(device, "vkGetDeviceBufferMemoryRequirements"); + table->GetDeviceImageMemoryRequirements = + (PFN_vkGetDeviceImageMemoryRequirements)gpa(device, "vkGetDeviceImageMemoryRequirements"); + table->GetDeviceImageSparseMemoryRequirements = + (PFN_vkGetDeviceImageSparseMemoryRequirements)gpa(device, "vkGetDeviceImageSparseMemoryRequirements"); + table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR"); + table->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR"); + 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->CreateVideoSessionKHR = (PFN_vkCreateVideoSessionKHR)gpa(device, "vkCreateVideoSessionKHR"); + table->DestroyVideoSessionKHR = (PFN_vkDestroyVideoSessionKHR)gpa(device, "vkDestroyVideoSessionKHR"); + table->GetVideoSessionMemoryRequirementsKHR = + (PFN_vkGetVideoSessionMemoryRequirementsKHR)gpa(device, "vkGetVideoSessionMemoryRequirementsKHR"); + table->BindVideoSessionMemoryKHR = (PFN_vkBindVideoSessionMemoryKHR)gpa(device, "vkBindVideoSessionMemoryKHR"); + table->CreateVideoSessionParametersKHR = + (PFN_vkCreateVideoSessionParametersKHR)gpa(device, "vkCreateVideoSessionParametersKHR"); + table->UpdateVideoSessionParametersKHR = + (PFN_vkUpdateVideoSessionParametersKHR)gpa(device, "vkUpdateVideoSessionParametersKHR"); + table->DestroyVideoSessionParametersKHR = + (PFN_vkDestroyVideoSessionParametersKHR)gpa(device, "vkDestroyVideoSessionParametersKHR"); + table->CmdBeginVideoCodingKHR = (PFN_vkCmdBeginVideoCodingKHR)gpa(device, "vkCmdBeginVideoCodingKHR"); + table->CmdEndVideoCodingKHR = (PFN_vkCmdEndVideoCodingKHR)gpa(device, "vkCmdEndVideoCodingKHR"); + table->CmdControlVideoCodingKHR = (PFN_vkCmdControlVideoCodingKHR)gpa(device, "vkCmdControlVideoCodingKHR"); + table->CmdDecodeVideoKHR = (PFN_vkCmdDecodeVideoKHR)gpa(device, "vkCmdDecodeVideoKHR"); + table->CmdBeginRenderingKHR = (PFN_vkCmdBeginRenderingKHR)gpa(device, "vkCmdBeginRenderingKHR"); + table->CmdEndRenderingKHR = (PFN_vkCmdEndRenderingKHR)gpa(device, "vkCmdEndRenderingKHR"); + table->GetDeviceGroupPeerMemoryFeaturesKHR = + (PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR)gpa(device, "vkGetDeviceGroupPeerMemoryFeaturesKHR"); + table->CmdSetDeviceMaskKHR = (PFN_vkCmdSetDeviceMaskKHR)gpa(device, "vkCmdSetDeviceMaskKHR"); + table->CmdDispatchBaseKHR = (PFN_vkCmdDispatchBaseKHR)gpa(device, "vkCmdDispatchBaseKHR"); + table->TrimCommandPoolKHR = (PFN_vkTrimCommandPoolKHR)gpa(device, "vkTrimCommandPoolKHR"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetMemoryWin32HandleKHR = (PFN_vkGetMemoryWin32HandleKHR)gpa(device, "vkGetMemoryWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetMemoryWin32HandlePropertiesKHR = + (PFN_vkGetMemoryWin32HandlePropertiesKHR)gpa(device, "vkGetMemoryWin32HandlePropertiesKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)gpa(device, "vkGetMemoryFdKHR"); + table->GetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHR)gpa(device, "vkGetMemoryFdPropertiesKHR"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->ImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR)gpa(device, "vkImportSemaphoreWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetSemaphoreWin32HandleKHR = (PFN_vkGetSemaphoreWin32HandleKHR)gpa(device, "vkGetSemaphoreWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->ImportSemaphoreFdKHR = (PFN_vkImportSemaphoreFdKHR)gpa(device, "vkImportSemaphoreFdKHR"); + table->GetSemaphoreFdKHR = (PFN_vkGetSemaphoreFdKHR)gpa(device, "vkGetSemaphoreFdKHR"); + table->CmdPushDescriptorSetKHR = (PFN_vkCmdPushDescriptorSetKHR)gpa(device, "vkCmdPushDescriptorSetKHR"); + table->CmdPushDescriptorSetWithTemplateKHR = + (PFN_vkCmdPushDescriptorSetWithTemplateKHR)gpa(device, "vkCmdPushDescriptorSetWithTemplateKHR"); + table->CreateDescriptorUpdateTemplateKHR = + (PFN_vkCreateDescriptorUpdateTemplateKHR)gpa(device, "vkCreateDescriptorUpdateTemplateKHR"); + table->DestroyDescriptorUpdateTemplateKHR = + (PFN_vkDestroyDescriptorUpdateTemplateKHR)gpa(device, "vkDestroyDescriptorUpdateTemplateKHR"); + table->UpdateDescriptorSetWithTemplateKHR = + (PFN_vkUpdateDescriptorSetWithTemplateKHR)gpa(device, "vkUpdateDescriptorSetWithTemplateKHR"); + table->CreateRenderPass2KHR = (PFN_vkCreateRenderPass2KHR)gpa(device, "vkCreateRenderPass2KHR"); + table->CmdBeginRenderPass2KHR = (PFN_vkCmdBeginRenderPass2KHR)gpa(device, "vkCmdBeginRenderPass2KHR"); + table->CmdNextSubpass2KHR = (PFN_vkCmdNextSubpass2KHR)gpa(device, "vkCmdNextSubpass2KHR"); + table->CmdEndRenderPass2KHR = (PFN_vkCmdEndRenderPass2KHR)gpa(device, "vkCmdEndRenderPass2KHR"); + table->GetSwapchainStatusKHR = (PFN_vkGetSwapchainStatusKHR)gpa(device, "vkGetSwapchainStatusKHR"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->ImportFenceWin32HandleKHR = (PFN_vkImportFenceWin32HandleKHR)gpa(device, "vkImportFenceWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetFenceWin32HandleKHR = (PFN_vkGetFenceWin32HandleKHR)gpa(device, "vkGetFenceWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + 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->GetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2KHR)gpa(device, "vkGetImageMemoryRequirements2KHR"); + table->GetBufferMemoryRequirements2KHR = + (PFN_vkGetBufferMemoryRequirements2KHR)gpa(device, "vkGetBufferMemoryRequirements2KHR"); + table->GetImageSparseMemoryRequirements2KHR = + (PFN_vkGetImageSparseMemoryRequirements2KHR)gpa(device, "vkGetImageSparseMemoryRequirements2KHR"); + table->CreateSamplerYcbcrConversionKHR = + (PFN_vkCreateSamplerYcbcrConversionKHR)gpa(device, "vkCreateSamplerYcbcrConversionKHR"); + table->DestroySamplerYcbcrConversionKHR = + (PFN_vkDestroySamplerYcbcrConversionKHR)gpa(device, "vkDestroySamplerYcbcrConversionKHR"); + table->BindBufferMemory2KHR = (PFN_vkBindBufferMemory2KHR)gpa(device, "vkBindBufferMemory2KHR"); + table->BindImageMemory2KHR = (PFN_vkBindImageMemory2KHR)gpa(device, "vkBindImageMemory2KHR"); + table->GetDescriptorSetLayoutSupportKHR = + (PFN_vkGetDescriptorSetLayoutSupportKHR)gpa(device, "vkGetDescriptorSetLayoutSupportKHR"); + table->CmdDrawIndirectCountKHR = (PFN_vkCmdDrawIndirectCountKHR)gpa(device, "vkCmdDrawIndirectCountKHR"); + table->CmdDrawIndexedIndirectCountKHR = (PFN_vkCmdDrawIndexedIndirectCountKHR)gpa(device, "vkCmdDrawIndexedIndirectCountKHR"); + table->GetSemaphoreCounterValueKHR = (PFN_vkGetSemaphoreCounterValueKHR)gpa(device, "vkGetSemaphoreCounterValueKHR"); + table->WaitSemaphoresKHR = (PFN_vkWaitSemaphoresKHR)gpa(device, "vkWaitSemaphoresKHR"); + table->SignalSemaphoreKHR = (PFN_vkSignalSemaphoreKHR)gpa(device, "vkSignalSemaphoreKHR"); + table->CmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR)gpa(device, "vkCmdSetFragmentShadingRateKHR"); + table->WaitForPresentKHR = (PFN_vkWaitForPresentKHR)gpa(device, "vkWaitForPresentKHR"); + table->GetBufferDeviceAddressKHR = (PFN_vkGetBufferDeviceAddressKHR)gpa(device, "vkGetBufferDeviceAddressKHR"); + table->GetBufferOpaqueCaptureAddressKHR = + (PFN_vkGetBufferOpaqueCaptureAddressKHR)gpa(device, "vkGetBufferOpaqueCaptureAddressKHR"); + table->GetDeviceMemoryOpaqueCaptureAddressKHR = + (PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR)gpa(device, "vkGetDeviceMemoryOpaqueCaptureAddressKHR"); + table->CreateDeferredOperationKHR = (PFN_vkCreateDeferredOperationKHR)gpa(device, "vkCreateDeferredOperationKHR"); + table->DestroyDeferredOperationKHR = (PFN_vkDestroyDeferredOperationKHR)gpa(device, "vkDestroyDeferredOperationKHR"); + table->GetDeferredOperationMaxConcurrencyKHR = + (PFN_vkGetDeferredOperationMaxConcurrencyKHR)gpa(device, "vkGetDeferredOperationMaxConcurrencyKHR"); + table->GetDeferredOperationResultKHR = (PFN_vkGetDeferredOperationResultKHR)gpa(device, "vkGetDeferredOperationResultKHR"); + table->DeferredOperationJoinKHR = (PFN_vkDeferredOperationJoinKHR)gpa(device, "vkDeferredOperationJoinKHR"); + table->GetPipelineExecutablePropertiesKHR = + (PFN_vkGetPipelineExecutablePropertiesKHR)gpa(device, "vkGetPipelineExecutablePropertiesKHR"); + table->GetPipelineExecutableStatisticsKHR = + (PFN_vkGetPipelineExecutableStatisticsKHR)gpa(device, "vkGetPipelineExecutableStatisticsKHR"); + table->GetPipelineExecutableInternalRepresentationsKHR = + (PFN_vkGetPipelineExecutableInternalRepresentationsKHR)gpa(device, "vkGetPipelineExecutableInternalRepresentationsKHR"); + table->MapMemory2KHR = (PFN_vkMapMemory2KHR)gpa(device, "vkMapMemory2KHR"); + table->UnmapMemory2KHR = (PFN_vkUnmapMemory2KHR)gpa(device, "vkUnmapMemory2KHR"); +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->GetEncodedVideoSessionParametersKHR = + (PFN_vkGetEncodedVideoSessionParametersKHR)gpa(device, "vkGetEncodedVideoSessionParametersKHR"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->CmdEncodeVideoKHR = (PFN_vkCmdEncodeVideoKHR)gpa(device, "vkCmdEncodeVideoKHR"); +#endif // VK_ENABLE_BETA_EXTENSIONS + 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->CmdTraceRaysIndirect2KHR = (PFN_vkCmdTraceRaysIndirect2KHR)gpa(device, "vkCmdTraceRaysIndirect2KHR"); + table->GetDeviceBufferMemoryRequirementsKHR = + (PFN_vkGetDeviceBufferMemoryRequirementsKHR)gpa(device, "vkGetDeviceBufferMemoryRequirementsKHR"); + table->GetDeviceImageMemoryRequirementsKHR = + (PFN_vkGetDeviceImageMemoryRequirementsKHR)gpa(device, "vkGetDeviceImageMemoryRequirementsKHR"); + table->GetDeviceImageSparseMemoryRequirementsKHR = + (PFN_vkGetDeviceImageSparseMemoryRequirementsKHR)gpa(device, "vkGetDeviceImageSparseMemoryRequirementsKHR"); + table->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)gpa(device, "vkDebugMarkerSetObjectTagEXT"); + table->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)gpa(device, "vkDebugMarkerSetObjectNameEXT"); + table->CmdDebugMarkerBeginEXT = (PFN_vkCmdDebugMarkerBeginEXT)gpa(device, "vkCmdDebugMarkerBeginEXT"); + table->CmdDebugMarkerEndEXT = (PFN_vkCmdDebugMarkerEndEXT)gpa(device, "vkCmdDebugMarkerEndEXT"); + table->CmdDebugMarkerInsertEXT = (PFN_vkCmdDebugMarkerInsertEXT)gpa(device, "vkCmdDebugMarkerInsertEXT"); + table->CmdBindTransformFeedbackBuffersEXT = + (PFN_vkCmdBindTransformFeedbackBuffersEXT)gpa(device, "vkCmdBindTransformFeedbackBuffersEXT"); + table->CmdBeginTransformFeedbackEXT = (PFN_vkCmdBeginTransformFeedbackEXT)gpa(device, "vkCmdBeginTransformFeedbackEXT"); + table->CmdEndTransformFeedbackEXT = (PFN_vkCmdEndTransformFeedbackEXT)gpa(device, "vkCmdEndTransformFeedbackEXT"); + table->CmdBeginQueryIndexedEXT = (PFN_vkCmdBeginQueryIndexedEXT)gpa(device, "vkCmdBeginQueryIndexedEXT"); + table->CmdEndQueryIndexedEXT = (PFN_vkCmdEndQueryIndexedEXT)gpa(device, "vkCmdEndQueryIndexedEXT"); + table->CmdDrawIndirectByteCountEXT = (PFN_vkCmdDrawIndirectByteCountEXT)gpa(device, "vkCmdDrawIndirectByteCountEXT"); + table->CreateCuModuleNVX = (PFN_vkCreateCuModuleNVX)gpa(device, "vkCreateCuModuleNVX"); + table->CreateCuFunctionNVX = (PFN_vkCreateCuFunctionNVX)gpa(device, "vkCreateCuFunctionNVX"); + table->DestroyCuModuleNVX = (PFN_vkDestroyCuModuleNVX)gpa(device, "vkDestroyCuModuleNVX"); + table->DestroyCuFunctionNVX = (PFN_vkDestroyCuFunctionNVX)gpa(device, "vkDestroyCuFunctionNVX"); + table->CmdCuLaunchKernelNVX = (PFN_vkCmdCuLaunchKernelNVX)gpa(device, "vkCmdCuLaunchKernelNVX"); + table->GetImageViewHandleNVX = (PFN_vkGetImageViewHandleNVX)gpa(device, "vkGetImageViewHandleNVX"); + table->GetImageViewAddressNVX = (PFN_vkGetImageViewAddressNVX)gpa(device, "vkGetImageViewAddressNVX"); + table->CmdDrawIndirectCountAMD = (PFN_vkCmdDrawIndirectCountAMD)gpa(device, "vkCmdDrawIndirectCountAMD"); + table->CmdDrawIndexedIndirectCountAMD = (PFN_vkCmdDrawIndexedIndirectCountAMD)gpa(device, "vkCmdDrawIndexedIndirectCountAMD"); + table->GetShaderInfoAMD = (PFN_vkGetShaderInfoAMD)gpa(device, "vkGetShaderInfoAMD"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)gpa(device, "vkGetMemoryWin32HandleNV"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->CmdBeginConditionalRenderingEXT = + (PFN_vkCmdBeginConditionalRenderingEXT)gpa(device, "vkCmdBeginConditionalRenderingEXT"); + table->CmdEndConditionalRenderingEXT = (PFN_vkCmdEndConditionalRenderingEXT)gpa(device, "vkCmdEndConditionalRenderingEXT"); + table->CmdSetViewportWScalingNV = (PFN_vkCmdSetViewportWScalingNV)gpa(device, "vkCmdSetViewportWScalingNV"); + 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->GetRefreshCycleDurationGOOGLE = (PFN_vkGetRefreshCycleDurationGOOGLE)gpa(device, "vkGetRefreshCycleDurationGOOGLE"); + table->GetPastPresentationTimingGOOGLE = + (PFN_vkGetPastPresentationTimingGOOGLE)gpa(device, "vkGetPastPresentationTimingGOOGLE"); + 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"); +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + table->GetAndroidHardwareBufferPropertiesANDROID = + (PFN_vkGetAndroidHardwareBufferPropertiesANDROID)gpa(device, "vkGetAndroidHardwareBufferPropertiesANDROID"); +#endif // VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + table->GetMemoryAndroidHardwareBufferANDROID = + (PFN_vkGetMemoryAndroidHardwareBufferANDROID)gpa(device, "vkGetMemoryAndroidHardwareBufferANDROID"); +#endif // VK_USE_PLATFORM_ANDROID_KHR + table->CmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)gpa(device, "vkCmdSetSampleLocationsEXT"); + table->GetImageDrmFormatModifierPropertiesEXT = + (PFN_vkGetImageDrmFormatModifierPropertiesEXT)gpa(device, "vkGetImageDrmFormatModifierPropertiesEXT"); + table->CreateValidationCacheEXT = (PFN_vkCreateValidationCacheEXT)gpa(device, "vkCreateValidationCacheEXT"); + table->DestroyValidationCacheEXT = (PFN_vkDestroyValidationCacheEXT)gpa(device, "vkDestroyValidationCacheEXT"); + table->MergeValidationCachesEXT = (PFN_vkMergeValidationCachesEXT)gpa(device, "vkMergeValidationCachesEXT"); + table->GetValidationCacheDataEXT = (PFN_vkGetValidationCacheDataEXT)gpa(device, "vkGetValidationCacheDataEXT"); + table->CmdBindShadingRateImageNV = (PFN_vkCmdBindShadingRateImageNV)gpa(device, "vkCmdBindShadingRateImageNV"); + table->CmdSetViewportShadingRatePaletteNV = + (PFN_vkCmdSetViewportShadingRatePaletteNV)gpa(device, "vkCmdSetViewportShadingRatePaletteNV"); + table->CmdSetCoarseSampleOrderNV = (PFN_vkCmdSetCoarseSampleOrderNV)gpa(device, "vkCmdSetCoarseSampleOrderNV"); + table->CreateAccelerationStructureNV = (PFN_vkCreateAccelerationStructureNV)gpa(device, "vkCreateAccelerationStructureNV"); + table->DestroyAccelerationStructureNV = (PFN_vkDestroyAccelerationStructureNV)gpa(device, "vkDestroyAccelerationStructureNV"); + table->GetAccelerationStructureMemoryRequirementsNV = + (PFN_vkGetAccelerationStructureMemoryRequirementsNV)gpa(device, "vkGetAccelerationStructureMemoryRequirementsNV"); + table->BindAccelerationStructureMemoryNV = + (PFN_vkBindAccelerationStructureMemoryNV)gpa(device, "vkBindAccelerationStructureMemoryNV"); + table->CmdBuildAccelerationStructureNV = + (PFN_vkCmdBuildAccelerationStructureNV)gpa(device, "vkCmdBuildAccelerationStructureNV"); + table->CmdCopyAccelerationStructureNV = (PFN_vkCmdCopyAccelerationStructureNV)gpa(device, "vkCmdCopyAccelerationStructureNV"); + table->CmdTraceRaysNV = (PFN_vkCmdTraceRaysNV)gpa(device, "vkCmdTraceRaysNV"); + table->CreateRayTracingPipelinesNV = (PFN_vkCreateRayTracingPipelinesNV)gpa(device, "vkCreateRayTracingPipelinesNV"); + table->GetRayTracingShaderGroupHandlesKHR = + (PFN_vkGetRayTracingShaderGroupHandlesKHR)gpa(device, "vkGetRayTracingShaderGroupHandlesKHR"); + table->GetRayTracingShaderGroupHandlesNV = + (PFN_vkGetRayTracingShaderGroupHandlesNV)gpa(device, "vkGetRayTracingShaderGroupHandlesNV"); + table->GetAccelerationStructureHandleNV = + (PFN_vkGetAccelerationStructureHandleNV)gpa(device, "vkGetAccelerationStructureHandleNV"); + table->CmdWriteAccelerationStructuresPropertiesNV = + (PFN_vkCmdWriteAccelerationStructuresPropertiesNV)gpa(device, "vkCmdWriteAccelerationStructuresPropertiesNV"); + table->CompileDeferredNV = (PFN_vkCompileDeferredNV)gpa(device, "vkCompileDeferredNV"); + table->GetMemoryHostPointerPropertiesEXT = + (PFN_vkGetMemoryHostPointerPropertiesEXT)gpa(device, "vkGetMemoryHostPointerPropertiesEXT"); + table->CmdWriteBufferMarkerAMD = (PFN_vkCmdWriteBufferMarkerAMD)gpa(device, "vkCmdWriteBufferMarkerAMD"); + table->GetCalibratedTimestampsEXT = (PFN_vkGetCalibratedTimestampsEXT)gpa(device, "vkGetCalibratedTimestampsEXT"); + table->CmdDrawMeshTasksNV = (PFN_vkCmdDrawMeshTasksNV)gpa(device, "vkCmdDrawMeshTasksNV"); + table->CmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV)gpa(device, "vkCmdDrawMeshTasksIndirectNV"); + table->CmdDrawMeshTasksIndirectCountNV = + (PFN_vkCmdDrawMeshTasksIndirectCountNV)gpa(device, "vkCmdDrawMeshTasksIndirectCountNV"); + table->CmdSetExclusiveScissorEnableNV = (PFN_vkCmdSetExclusiveScissorEnableNV)gpa(device, "vkCmdSetExclusiveScissorEnableNV"); + table->CmdSetExclusiveScissorNV = (PFN_vkCmdSetExclusiveScissorNV)gpa(device, "vkCmdSetExclusiveScissorNV"); + table->CmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV)gpa(device, "vkCmdSetCheckpointNV"); + table->GetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV)gpa(device, "vkGetQueueCheckpointDataNV"); + table->InitializePerformanceApiINTEL = (PFN_vkInitializePerformanceApiINTEL)gpa(device, "vkInitializePerformanceApiINTEL"); + table->UninitializePerformanceApiINTEL = + (PFN_vkUninitializePerformanceApiINTEL)gpa(device, "vkUninitializePerformanceApiINTEL"); + table->CmdSetPerformanceMarkerINTEL = (PFN_vkCmdSetPerformanceMarkerINTEL)gpa(device, "vkCmdSetPerformanceMarkerINTEL"); + table->CmdSetPerformanceStreamMarkerINTEL = + (PFN_vkCmdSetPerformanceStreamMarkerINTEL)gpa(device, "vkCmdSetPerformanceStreamMarkerINTEL"); + table->CmdSetPerformanceOverrideINTEL = (PFN_vkCmdSetPerformanceOverrideINTEL)gpa(device, "vkCmdSetPerformanceOverrideINTEL"); + table->AcquirePerformanceConfigurationINTEL = + (PFN_vkAcquirePerformanceConfigurationINTEL)gpa(device, "vkAcquirePerformanceConfigurationINTEL"); + table->ReleasePerformanceConfigurationINTEL = + (PFN_vkReleasePerformanceConfigurationINTEL)gpa(device, "vkReleasePerformanceConfigurationINTEL"); + table->QueueSetPerformanceConfigurationINTEL = + (PFN_vkQueueSetPerformanceConfigurationINTEL)gpa(device, "vkQueueSetPerformanceConfigurationINTEL"); + table->GetPerformanceParameterINTEL = (PFN_vkGetPerformanceParameterINTEL)gpa(device, "vkGetPerformanceParameterINTEL"); + table->SetLocalDimmingAMD = (PFN_vkSetLocalDimmingAMD)gpa(device, "vkSetLocalDimmingAMD"); + table->GetBufferDeviceAddressEXT = (PFN_vkGetBufferDeviceAddressEXT)gpa(device, "vkGetBufferDeviceAddressEXT"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->AcquireFullScreenExclusiveModeEXT = + (PFN_vkAcquireFullScreenExclusiveModeEXT)gpa(device, "vkAcquireFullScreenExclusiveModeEXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->ReleaseFullScreenExclusiveModeEXT = + (PFN_vkReleaseFullScreenExclusiveModeEXT)gpa(device, "vkReleaseFullScreenExclusiveModeEXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetDeviceGroupSurfacePresentModes2EXT = + (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)gpa(device, "vkGetDeviceGroupSurfacePresentModes2EXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->CmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)gpa(device, "vkCmdSetLineStippleEXT"); + table->ResetQueryPoolEXT = (PFN_vkResetQueryPoolEXT)gpa(device, "vkResetQueryPoolEXT"); + 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->ReleaseSwapchainImagesEXT = (PFN_vkReleaseSwapchainImagesEXT)gpa(device, "vkReleaseSwapchainImagesEXT"); + table->GetGeneratedCommandsMemoryRequirementsNV = + (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)gpa(device, "vkGetGeneratedCommandsMemoryRequirementsNV"); + table->CmdPreprocessGeneratedCommandsNV = + (PFN_vkCmdPreprocessGeneratedCommandsNV)gpa(device, "vkCmdPreprocessGeneratedCommandsNV"); + table->CmdExecuteGeneratedCommandsNV = (PFN_vkCmdExecuteGeneratedCommandsNV)gpa(device, "vkCmdExecuteGeneratedCommandsNV"); + table->CmdBindPipelineShaderGroupNV = (PFN_vkCmdBindPipelineShaderGroupNV)gpa(device, "vkCmdBindPipelineShaderGroupNV"); + table->CreateIndirectCommandsLayoutNV = (PFN_vkCreateIndirectCommandsLayoutNV)gpa(device, "vkCreateIndirectCommandsLayoutNV"); + table->DestroyIndirectCommandsLayoutNV = + (PFN_vkDestroyIndirectCommandsLayoutNV)gpa(device, "vkDestroyIndirectCommandsLayoutNV"); + table->CreatePrivateDataSlotEXT = (PFN_vkCreatePrivateDataSlotEXT)gpa(device, "vkCreatePrivateDataSlotEXT"); + table->DestroyPrivateDataSlotEXT = (PFN_vkDestroyPrivateDataSlotEXT)gpa(device, "vkDestroyPrivateDataSlotEXT"); + table->SetPrivateDataEXT = (PFN_vkSetPrivateDataEXT)gpa(device, "vkSetPrivateDataEXT"); + table->GetPrivateDataEXT = (PFN_vkGetPrivateDataEXT)gpa(device, "vkGetPrivateDataEXT"); +#if defined(VK_USE_PLATFORM_METAL_EXT) + table->ExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT)gpa(device, "vkExportMetalObjectsEXT"); +#endif // VK_USE_PLATFORM_METAL_EXT + table->GetDescriptorSetLayoutSizeEXT = (PFN_vkGetDescriptorSetLayoutSizeEXT)gpa(device, "vkGetDescriptorSetLayoutSizeEXT"); + table->GetDescriptorSetLayoutBindingOffsetEXT = + (PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)gpa(device, "vkGetDescriptorSetLayoutBindingOffsetEXT"); + table->GetDescriptorEXT = (PFN_vkGetDescriptorEXT)gpa(device, "vkGetDescriptorEXT"); + table->CmdBindDescriptorBuffersEXT = (PFN_vkCmdBindDescriptorBuffersEXT)gpa(device, "vkCmdBindDescriptorBuffersEXT"); + table->CmdSetDescriptorBufferOffsetsEXT = + (PFN_vkCmdSetDescriptorBufferOffsetsEXT)gpa(device, "vkCmdSetDescriptorBufferOffsetsEXT"); + table->CmdBindDescriptorBufferEmbeddedSamplersEXT = + (PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)gpa(device, "vkCmdBindDescriptorBufferEmbeddedSamplersEXT"); + table->GetBufferOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetBufferOpaqueCaptureDescriptorDataEXT"); + table->GetImageOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetImageOpaqueCaptureDescriptorDataEXT"); + table->GetImageViewOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetImageViewOpaqueCaptureDescriptorDataEXT"); + table->GetSamplerOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetSamplerOpaqueCaptureDescriptorDataEXT"); + table->GetAccelerationStructureOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)gpa( + device, "vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT"); + table->CmdSetFragmentShadingRateEnumNV = + (PFN_vkCmdSetFragmentShadingRateEnumNV)gpa(device, "vkCmdSetFragmentShadingRateEnumNV"); + table->GetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)gpa(device, "vkGetImageSubresourceLayout2EXT"); + table->GetDeviceFaultInfoEXT = (PFN_vkGetDeviceFaultInfoEXT)gpa(device, "vkGetDeviceFaultInfoEXT"); + table->CmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)gpa(device, "vkCmdSetVertexInputEXT"); +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetMemoryZirconHandleFUCHSIA = (PFN_vkGetMemoryZirconHandleFUCHSIA)gpa(device, "vkGetMemoryZirconHandleFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetMemoryZirconHandlePropertiesFUCHSIA = + (PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)gpa(device, "vkGetMemoryZirconHandlePropertiesFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->ImportSemaphoreZirconHandleFUCHSIA = + (PFN_vkImportSemaphoreZirconHandleFUCHSIA)gpa(device, "vkImportSemaphoreZirconHandleFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetSemaphoreZirconHandleFUCHSIA = + (PFN_vkGetSemaphoreZirconHandleFUCHSIA)gpa(device, "vkGetSemaphoreZirconHandleFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->CreateBufferCollectionFUCHSIA = (PFN_vkCreateBufferCollectionFUCHSIA)gpa(device, "vkCreateBufferCollectionFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->SetBufferCollectionImageConstraintsFUCHSIA = + (PFN_vkSetBufferCollectionImageConstraintsFUCHSIA)gpa(device, "vkSetBufferCollectionImageConstraintsFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->SetBufferCollectionBufferConstraintsFUCHSIA = + (PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA)gpa(device, "vkSetBufferCollectionBufferConstraintsFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->DestroyBufferCollectionFUCHSIA = (PFN_vkDestroyBufferCollectionFUCHSIA)gpa(device, "vkDestroyBufferCollectionFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetBufferCollectionPropertiesFUCHSIA = + (PFN_vkGetBufferCollectionPropertiesFUCHSIA)gpa(device, "vkGetBufferCollectionPropertiesFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA + table->GetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI = + (PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI)gpa(device, "vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI"); + table->CmdSubpassShadingHUAWEI = (PFN_vkCmdSubpassShadingHUAWEI)gpa(device, "vkCmdSubpassShadingHUAWEI"); + table->CmdBindInvocationMaskHUAWEI = (PFN_vkCmdBindInvocationMaskHUAWEI)gpa(device, "vkCmdBindInvocationMaskHUAWEI"); + table->GetMemoryRemoteAddressNV = (PFN_vkGetMemoryRemoteAddressNV)gpa(device, "vkGetMemoryRemoteAddressNV"); + table->GetPipelinePropertiesEXT = (PFN_vkGetPipelinePropertiesEXT)gpa(device, "vkGetPipelinePropertiesEXT"); + 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"); + table->CmdDrawMultiEXT = (PFN_vkCmdDrawMultiEXT)gpa(device, "vkCmdDrawMultiEXT"); + table->CmdDrawMultiIndexedEXT = (PFN_vkCmdDrawMultiIndexedEXT)gpa(device, "vkCmdDrawMultiIndexedEXT"); + table->CreateMicromapEXT = (PFN_vkCreateMicromapEXT)gpa(device, "vkCreateMicromapEXT"); + table->DestroyMicromapEXT = (PFN_vkDestroyMicromapEXT)gpa(device, "vkDestroyMicromapEXT"); + table->CmdBuildMicromapsEXT = (PFN_vkCmdBuildMicromapsEXT)gpa(device, "vkCmdBuildMicromapsEXT"); + table->BuildMicromapsEXT = (PFN_vkBuildMicromapsEXT)gpa(device, "vkBuildMicromapsEXT"); + table->CopyMicromapEXT = (PFN_vkCopyMicromapEXT)gpa(device, "vkCopyMicromapEXT"); + table->CopyMicromapToMemoryEXT = (PFN_vkCopyMicromapToMemoryEXT)gpa(device, "vkCopyMicromapToMemoryEXT"); + table->CopyMemoryToMicromapEXT = (PFN_vkCopyMemoryToMicromapEXT)gpa(device, "vkCopyMemoryToMicromapEXT"); + table->WriteMicromapsPropertiesEXT = (PFN_vkWriteMicromapsPropertiesEXT)gpa(device, "vkWriteMicromapsPropertiesEXT"); + table->CmdCopyMicromapEXT = (PFN_vkCmdCopyMicromapEXT)gpa(device, "vkCmdCopyMicromapEXT"); + table->CmdCopyMicromapToMemoryEXT = (PFN_vkCmdCopyMicromapToMemoryEXT)gpa(device, "vkCmdCopyMicromapToMemoryEXT"); + table->CmdCopyMemoryToMicromapEXT = (PFN_vkCmdCopyMemoryToMicromapEXT)gpa(device, "vkCmdCopyMemoryToMicromapEXT"); + table->CmdWriteMicromapsPropertiesEXT = (PFN_vkCmdWriteMicromapsPropertiesEXT)gpa(device, "vkCmdWriteMicromapsPropertiesEXT"); + table->GetDeviceMicromapCompatibilityEXT = + (PFN_vkGetDeviceMicromapCompatibilityEXT)gpa(device, "vkGetDeviceMicromapCompatibilityEXT"); + table->GetMicromapBuildSizesEXT = (PFN_vkGetMicromapBuildSizesEXT)gpa(device, "vkGetMicromapBuildSizesEXT"); + table->CmdDrawClusterHUAWEI = (PFN_vkCmdDrawClusterHUAWEI)gpa(device, "vkCmdDrawClusterHUAWEI"); + table->CmdDrawClusterIndirectHUAWEI = (PFN_vkCmdDrawClusterIndirectHUAWEI)gpa(device, "vkCmdDrawClusterIndirectHUAWEI"); + table->SetDeviceMemoryPriorityEXT = (PFN_vkSetDeviceMemoryPriorityEXT)gpa(device, "vkSetDeviceMemoryPriorityEXT"); + table->GetDescriptorSetLayoutHostMappingInfoVALVE = + (PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE)gpa(device, "vkGetDescriptorSetLayoutHostMappingInfoVALVE"); + table->GetDescriptorSetHostMappingVALVE = + (PFN_vkGetDescriptorSetHostMappingVALVE)gpa(device, "vkGetDescriptorSetHostMappingVALVE"); + table->CmdCopyMemoryIndirectNV = (PFN_vkCmdCopyMemoryIndirectNV)gpa(device, "vkCmdCopyMemoryIndirectNV"); + table->CmdCopyMemoryToImageIndirectNV = (PFN_vkCmdCopyMemoryToImageIndirectNV)gpa(device, "vkCmdCopyMemoryToImageIndirectNV"); + table->CmdDecompressMemoryNV = (PFN_vkCmdDecompressMemoryNV)gpa(device, "vkCmdDecompressMemoryNV"); + table->CmdDecompressMemoryIndirectCountNV = + (PFN_vkCmdDecompressMemoryIndirectCountNV)gpa(device, "vkCmdDecompressMemoryIndirectCountNV"); + table->CmdSetTessellationDomainOriginEXT = + (PFN_vkCmdSetTessellationDomainOriginEXT)gpa(device, "vkCmdSetTessellationDomainOriginEXT"); + table->CmdSetDepthClampEnableEXT = (PFN_vkCmdSetDepthClampEnableEXT)gpa(device, "vkCmdSetDepthClampEnableEXT"); + table->CmdSetPolygonModeEXT = (PFN_vkCmdSetPolygonModeEXT)gpa(device, "vkCmdSetPolygonModeEXT"); + table->CmdSetRasterizationSamplesEXT = (PFN_vkCmdSetRasterizationSamplesEXT)gpa(device, "vkCmdSetRasterizationSamplesEXT"); + table->CmdSetSampleMaskEXT = (PFN_vkCmdSetSampleMaskEXT)gpa(device, "vkCmdSetSampleMaskEXT"); + table->CmdSetAlphaToCoverageEnableEXT = (PFN_vkCmdSetAlphaToCoverageEnableEXT)gpa(device, "vkCmdSetAlphaToCoverageEnableEXT"); + table->CmdSetAlphaToOneEnableEXT = (PFN_vkCmdSetAlphaToOneEnableEXT)gpa(device, "vkCmdSetAlphaToOneEnableEXT"); + table->CmdSetLogicOpEnableEXT = (PFN_vkCmdSetLogicOpEnableEXT)gpa(device, "vkCmdSetLogicOpEnableEXT"); + table->CmdSetColorBlendEnableEXT = (PFN_vkCmdSetColorBlendEnableEXT)gpa(device, "vkCmdSetColorBlendEnableEXT"); + table->CmdSetColorBlendEquationEXT = (PFN_vkCmdSetColorBlendEquationEXT)gpa(device, "vkCmdSetColorBlendEquationEXT"); + table->CmdSetColorWriteMaskEXT = (PFN_vkCmdSetColorWriteMaskEXT)gpa(device, "vkCmdSetColorWriteMaskEXT"); + table->CmdSetRasterizationStreamEXT = (PFN_vkCmdSetRasterizationStreamEXT)gpa(device, "vkCmdSetRasterizationStreamEXT"); + table->CmdSetConservativeRasterizationModeEXT = + (PFN_vkCmdSetConservativeRasterizationModeEXT)gpa(device, "vkCmdSetConservativeRasterizationModeEXT"); + table->CmdSetExtraPrimitiveOverestimationSizeEXT = + (PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT)gpa(device, "vkCmdSetExtraPrimitiveOverestimationSizeEXT"); + table->CmdSetDepthClipEnableEXT = (PFN_vkCmdSetDepthClipEnableEXT)gpa(device, "vkCmdSetDepthClipEnableEXT"); + table->CmdSetSampleLocationsEnableEXT = (PFN_vkCmdSetSampleLocationsEnableEXT)gpa(device, "vkCmdSetSampleLocationsEnableEXT"); + table->CmdSetColorBlendAdvancedEXT = (PFN_vkCmdSetColorBlendAdvancedEXT)gpa(device, "vkCmdSetColorBlendAdvancedEXT"); + table->CmdSetProvokingVertexModeEXT = (PFN_vkCmdSetProvokingVertexModeEXT)gpa(device, "vkCmdSetProvokingVertexModeEXT"); + table->CmdSetLineRasterizationModeEXT = (PFN_vkCmdSetLineRasterizationModeEXT)gpa(device, "vkCmdSetLineRasterizationModeEXT"); + table->CmdSetLineStippleEnableEXT = (PFN_vkCmdSetLineStippleEnableEXT)gpa(device, "vkCmdSetLineStippleEnableEXT"); + table->CmdSetDepthClipNegativeOneToOneEXT = + (PFN_vkCmdSetDepthClipNegativeOneToOneEXT)gpa(device, "vkCmdSetDepthClipNegativeOneToOneEXT"); + table->CmdSetViewportWScalingEnableNV = (PFN_vkCmdSetViewportWScalingEnableNV)gpa(device, "vkCmdSetViewportWScalingEnableNV"); + table->CmdSetViewportSwizzleNV = (PFN_vkCmdSetViewportSwizzleNV)gpa(device, "vkCmdSetViewportSwizzleNV"); + table->CmdSetCoverageToColorEnableNV = (PFN_vkCmdSetCoverageToColorEnableNV)gpa(device, "vkCmdSetCoverageToColorEnableNV"); + table->CmdSetCoverageToColorLocationNV = + (PFN_vkCmdSetCoverageToColorLocationNV)gpa(device, "vkCmdSetCoverageToColorLocationNV"); + table->CmdSetCoverageModulationModeNV = (PFN_vkCmdSetCoverageModulationModeNV)gpa(device, "vkCmdSetCoverageModulationModeNV"); + table->CmdSetCoverageModulationTableEnableNV = + (PFN_vkCmdSetCoverageModulationTableEnableNV)gpa(device, "vkCmdSetCoverageModulationTableEnableNV"); + table->CmdSetCoverageModulationTableNV = + (PFN_vkCmdSetCoverageModulationTableNV)gpa(device, "vkCmdSetCoverageModulationTableNV"); + table->CmdSetShadingRateImageEnableNV = (PFN_vkCmdSetShadingRateImageEnableNV)gpa(device, "vkCmdSetShadingRateImageEnableNV"); + table->CmdSetRepresentativeFragmentTestEnableNV = + (PFN_vkCmdSetRepresentativeFragmentTestEnableNV)gpa(device, "vkCmdSetRepresentativeFragmentTestEnableNV"); + table->CmdSetCoverageReductionModeNV = (PFN_vkCmdSetCoverageReductionModeNV)gpa(device, "vkCmdSetCoverageReductionModeNV"); + table->GetShaderModuleIdentifierEXT = (PFN_vkGetShaderModuleIdentifierEXT)gpa(device, "vkGetShaderModuleIdentifierEXT"); + table->GetShaderModuleCreateInfoIdentifierEXT = + (PFN_vkGetShaderModuleCreateInfoIdentifierEXT)gpa(device, "vkGetShaderModuleCreateInfoIdentifierEXT"); + table->CreateOpticalFlowSessionNV = (PFN_vkCreateOpticalFlowSessionNV)gpa(device, "vkCreateOpticalFlowSessionNV"); + table->DestroyOpticalFlowSessionNV = (PFN_vkDestroyOpticalFlowSessionNV)gpa(device, "vkDestroyOpticalFlowSessionNV"); + table->BindOpticalFlowSessionImageNV = (PFN_vkBindOpticalFlowSessionImageNV)gpa(device, "vkBindOpticalFlowSessionImageNV"); + table->CmdOpticalFlowExecuteNV = (PFN_vkCmdOpticalFlowExecuteNV)gpa(device, "vkCmdOpticalFlowExecuteNV"); + table->CreateShadersEXT = (PFN_vkCreateShadersEXT)gpa(device, "vkCreateShadersEXT"); + table->DestroyShaderEXT = (PFN_vkDestroyShaderEXT)gpa(device, "vkDestroyShaderEXT"); + table->GetShaderBinaryDataEXT = (PFN_vkGetShaderBinaryDataEXT)gpa(device, "vkGetShaderBinaryDataEXT"); + table->CmdBindShadersEXT = (PFN_vkCmdBindShadersEXT)gpa(device, "vkCmdBindShadersEXT"); + table->GetFramebufferTilePropertiesQCOM = + (PFN_vkGetFramebufferTilePropertiesQCOM)gpa(device, "vkGetFramebufferTilePropertiesQCOM"); + table->GetDynamicRenderingTilePropertiesQCOM = + (PFN_vkGetDynamicRenderingTilePropertiesQCOM)gpa(device, "vkGetDynamicRenderingTilePropertiesQCOM"); + table->CmdSetAttachmentFeedbackLoopEnableEXT = + (PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)gpa(device, "vkCmdSetAttachmentFeedbackLoopEnableEXT"); + table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)gpa(device, "vkCreateAccelerationStructureKHR"); + table->DestroyAccelerationStructureKHR = + (PFN_vkDestroyAccelerationStructureKHR)gpa(device, "vkDestroyAccelerationStructureKHR"); + table->CmdBuildAccelerationStructuresKHR = + (PFN_vkCmdBuildAccelerationStructuresKHR)gpa(device, "vkCmdBuildAccelerationStructuresKHR"); + table->CmdBuildAccelerationStructuresIndirectKHR = + (PFN_vkCmdBuildAccelerationStructuresIndirectKHR)gpa(device, "vkCmdBuildAccelerationStructuresIndirectKHR"); + table->BuildAccelerationStructuresKHR = (PFN_vkBuildAccelerationStructuresKHR)gpa(device, "vkBuildAccelerationStructuresKHR"); + table->CopyAccelerationStructureKHR = (PFN_vkCopyAccelerationStructureKHR)gpa(device, "vkCopyAccelerationStructureKHR"); + table->CopyAccelerationStructureToMemoryKHR = + (PFN_vkCopyAccelerationStructureToMemoryKHR)gpa(device, "vkCopyAccelerationStructureToMemoryKHR"); + table->CopyMemoryToAccelerationStructureKHR = + (PFN_vkCopyMemoryToAccelerationStructureKHR)gpa(device, "vkCopyMemoryToAccelerationStructureKHR"); + table->WriteAccelerationStructuresPropertiesKHR = + (PFN_vkWriteAccelerationStructuresPropertiesKHR)gpa(device, "vkWriteAccelerationStructuresPropertiesKHR"); + table->CmdCopyAccelerationStructureKHR = + (PFN_vkCmdCopyAccelerationStructureKHR)gpa(device, "vkCmdCopyAccelerationStructureKHR"); + table->CmdCopyAccelerationStructureToMemoryKHR = + (PFN_vkCmdCopyAccelerationStructureToMemoryKHR)gpa(device, "vkCmdCopyAccelerationStructureToMemoryKHR"); + table->CmdCopyMemoryToAccelerationStructureKHR = + (PFN_vkCmdCopyMemoryToAccelerationStructureKHR)gpa(device, "vkCmdCopyMemoryToAccelerationStructureKHR"); + table->GetAccelerationStructureDeviceAddressKHR = + (PFN_vkGetAccelerationStructureDeviceAddressKHR)gpa(device, "vkGetAccelerationStructureDeviceAddressKHR"); + table->CmdWriteAccelerationStructuresPropertiesKHR = + (PFN_vkCmdWriteAccelerationStructuresPropertiesKHR)gpa(device, "vkCmdWriteAccelerationStructuresPropertiesKHR"); + table->GetDeviceAccelerationStructureCompatibilityKHR = + (PFN_vkGetDeviceAccelerationStructureCompatibilityKHR)gpa(device, "vkGetDeviceAccelerationStructureCompatibilityKHR"); + table->GetAccelerationStructureBuildSizesKHR = + (PFN_vkGetAccelerationStructureBuildSizesKHR)gpa(device, "vkGetAccelerationStructureBuildSizesKHR"); + table->CmdTraceRaysKHR = (PFN_vkCmdTraceRaysKHR)gpa(device, "vkCmdTraceRaysKHR"); + table->CreateRayTracingPipelinesKHR = (PFN_vkCreateRayTracingPipelinesKHR)gpa(device, "vkCreateRayTracingPipelinesKHR"); + table->GetRayTracingCaptureReplayShaderGroupHandlesKHR = + (PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)gpa(device, "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR"); + table->CmdTraceRaysIndirectKHR = (PFN_vkCmdTraceRaysIndirectKHR)gpa(device, "vkCmdTraceRaysIndirectKHR"); + table->GetRayTracingShaderGroupStackSizeKHR = + (PFN_vkGetRayTracingShaderGroupStackSizeKHR)gpa(device, "vkGetRayTracingShaderGroupStackSizeKHR"); + table->CmdSetRayTracingPipelineStackSizeKHR = + (PFN_vkCmdSetRayTracingPipelineStackSizeKHR)gpa(device, "vkCmdSetRayTracingPipelineStackSizeKHR"); + table->CmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT)gpa(device, "vkCmdDrawMeshTasksEXT"); + table->CmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)gpa(device, "vkCmdDrawMeshTasksIndirectEXT"); + table->CmdDrawMeshTasksIndirectCountEXT = + (PFN_vkCmdDrawMeshTasksIndirectCountEXT)gpa(device, "vkCmdDrawMeshTasksIndirectCountEXT"); #ifdef VK_USE_PLATFORM_OHOS table->GetSwapchainGrallocUsageOHOS = (PFN_vkGetSwapchainGrallocUsageOHOS) gpa(device, "vkGetSwapchainGrallocUsageOHOS"); - if (table->GetSwapchainGrallocUsageOHOS == nullptr) { table->GetSwapchainGrallocUsageOHOS = (PFN_vkGetSwapchainGrallocUsageOHOS)StubGetSwapchainGrallocUsageOHOS; } #endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS +#if defined (VK_USE_PLATFORM_OHOS) table->AcquireImageOHOS = (PFN_vkAcquireImageOHOS) gpa(device, "vkAcquireImageOHOS"); - if (table->AcquireImageOHOS == nullptr) { table->AcquireImageOHOS = (PFN_vkAcquireImageOHOS)StubAcquireImageOHOS; } #endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS +#if defined (VK_USE_PLATFORM_OHOS) table->QueueSignalReleaseImageOHOS = (PFN_vkQueueSignalReleaseImageOHOS) gpa(device, "vkQueueSignalReleaseImageOHOS"); - if (table->QueueSignalReleaseImageOHOS == nullptr) { table->QueueSignalReleaseImageOHOS = (PFN_vkQueueSignalReleaseImageOHOS)StubQueueSignalReleaseImageOHOS; } #endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS +#if defined (VK_USE_PLATFORM_OHOS) table->GetNativeBufferPropertiesOHOS = (PFN_vkGetNativeBufferPropertiesOHOS) gpa(device, "vkGetNativeBufferPropertiesOHOS"); - if (table->GetNativeBufferPropertiesOHOS == nullptr) { table->GetNativeBufferPropertiesOHOS = (PFN_vkGetNativeBufferPropertiesOHOS)StubGetNativeBufferPropertiesOHOS; } #endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS +#if defined (VK_USE_PLATFORM_OHOS) table->GetMemoryNativeBufferOHOS = (PFN_vkGetMemoryNativeBufferOHOS) gpa(device, "vkGetMemoryNativeBufferOHOS"); - if (table->GetMemoryNativeBufferOHOS == nullptr) { table->GetMemoryNativeBufferOHOS = (PFN_vkGetMemoryNativeBufferOHOS)StubGetMemoryNativeBufferOHOS; } #endif // VK_USE_PLATFORM_OHOS - table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR) gpa(device, "vkCreateAccelerationStructureKHR"); - if (table->CreateAccelerationStructureKHR == nullptr) { table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)StubCreateAccelerationStructureKHR; } - table->DestroyAccelerationStructureKHR = (PFN_vkDestroyAccelerationStructureKHR) gpa(device, "vkDestroyAccelerationStructureKHR"); - if (table->DestroyAccelerationStructureKHR == nullptr) { table->DestroyAccelerationStructureKHR = (PFN_vkDestroyAccelerationStructureKHR)StubDestroyAccelerationStructureKHR; } - table->CmdBuildAccelerationStructuresKHR = (PFN_vkCmdBuildAccelerationStructuresKHR) gpa(device, "vkCmdBuildAccelerationStructuresKHR"); - if (table->CmdBuildAccelerationStructuresKHR == nullptr) { table->CmdBuildAccelerationStructuresKHR = (PFN_vkCmdBuildAccelerationStructuresKHR)StubCmdBuildAccelerationStructuresKHR; } - table->CmdBuildAccelerationStructuresIndirectKHR = (PFN_vkCmdBuildAccelerationStructuresIndirectKHR) gpa(device, "vkCmdBuildAccelerationStructuresIndirectKHR"); - if (table->CmdBuildAccelerationStructuresIndirectKHR == nullptr) { table->CmdBuildAccelerationStructuresIndirectKHR = (PFN_vkCmdBuildAccelerationStructuresIndirectKHR)StubCmdBuildAccelerationStructuresIndirectKHR; } - table->BuildAccelerationStructuresKHR = (PFN_vkBuildAccelerationStructuresKHR) gpa(device, "vkBuildAccelerationStructuresKHR"); - if (table->BuildAccelerationStructuresKHR == nullptr) { table->BuildAccelerationStructuresKHR = (PFN_vkBuildAccelerationStructuresKHR)StubBuildAccelerationStructuresKHR; } - table->CopyAccelerationStructureKHR = (PFN_vkCopyAccelerationStructureKHR) gpa(device, "vkCopyAccelerationStructureKHR"); - if (table->CopyAccelerationStructureKHR == nullptr) { table->CopyAccelerationStructureKHR = (PFN_vkCopyAccelerationStructureKHR)StubCopyAccelerationStructureKHR; } - table->CopyAccelerationStructureToMemoryKHR = (PFN_vkCopyAccelerationStructureToMemoryKHR) gpa(device, "vkCopyAccelerationStructureToMemoryKHR"); - if (table->CopyAccelerationStructureToMemoryKHR == nullptr) { table->CopyAccelerationStructureToMemoryKHR = (PFN_vkCopyAccelerationStructureToMemoryKHR)StubCopyAccelerationStructureToMemoryKHR; } - table->CopyMemoryToAccelerationStructureKHR = (PFN_vkCopyMemoryToAccelerationStructureKHR) gpa(device, "vkCopyMemoryToAccelerationStructureKHR"); - if (table->CopyMemoryToAccelerationStructureKHR == nullptr) { table->CopyMemoryToAccelerationStructureKHR = (PFN_vkCopyMemoryToAccelerationStructureKHR)StubCopyMemoryToAccelerationStructureKHR; } - table->WriteAccelerationStructuresPropertiesKHR = (PFN_vkWriteAccelerationStructuresPropertiesKHR) gpa(device, "vkWriteAccelerationStructuresPropertiesKHR"); - if (table->WriteAccelerationStructuresPropertiesKHR == nullptr) { table->WriteAccelerationStructuresPropertiesKHR = (PFN_vkWriteAccelerationStructuresPropertiesKHR)StubWriteAccelerationStructuresPropertiesKHR; } - table->CmdCopyAccelerationStructureKHR = (PFN_vkCmdCopyAccelerationStructureKHR) gpa(device, "vkCmdCopyAccelerationStructureKHR"); - if (table->CmdCopyAccelerationStructureKHR == nullptr) { table->CmdCopyAccelerationStructureKHR = (PFN_vkCmdCopyAccelerationStructureKHR)StubCmdCopyAccelerationStructureKHR; } - table->CmdCopyAccelerationStructureToMemoryKHR = (PFN_vkCmdCopyAccelerationStructureToMemoryKHR) gpa(device, "vkCmdCopyAccelerationStructureToMemoryKHR"); - if (table->CmdCopyAccelerationStructureToMemoryKHR == nullptr) { table->CmdCopyAccelerationStructureToMemoryKHR = (PFN_vkCmdCopyAccelerationStructureToMemoryKHR)StubCmdCopyAccelerationStructureToMemoryKHR; } - table->CmdCopyMemoryToAccelerationStructureKHR = (PFN_vkCmdCopyMemoryToAccelerationStructureKHR) gpa(device, "vkCmdCopyMemoryToAccelerationStructureKHR"); - if (table->CmdCopyMemoryToAccelerationStructureKHR == nullptr) { table->CmdCopyMemoryToAccelerationStructureKHR = (PFN_vkCmdCopyMemoryToAccelerationStructureKHR)StubCmdCopyMemoryToAccelerationStructureKHR; } - table->GetAccelerationStructureDeviceAddressKHR = (PFN_vkGetAccelerationStructureDeviceAddressKHR) gpa(device, "vkGetAccelerationStructureDeviceAddressKHR"); - if (table->GetAccelerationStructureDeviceAddressKHR == nullptr) { table->GetAccelerationStructureDeviceAddressKHR = (PFN_vkGetAccelerationStructureDeviceAddressKHR)StubGetAccelerationStructureDeviceAddressKHR; } - table->CmdWriteAccelerationStructuresPropertiesKHR = (PFN_vkCmdWriteAccelerationStructuresPropertiesKHR) gpa(device, "vkCmdWriteAccelerationStructuresPropertiesKHR"); - if (table->CmdWriteAccelerationStructuresPropertiesKHR == nullptr) { table->CmdWriteAccelerationStructuresPropertiesKHR = (PFN_vkCmdWriteAccelerationStructuresPropertiesKHR)StubCmdWriteAccelerationStructuresPropertiesKHR; } - table->GetDeviceAccelerationStructureCompatibilityKHR = (PFN_vkGetDeviceAccelerationStructureCompatibilityKHR) gpa(device, "vkGetDeviceAccelerationStructureCompatibilityKHR"); - if (table->GetDeviceAccelerationStructureCompatibilityKHR == nullptr) { table->GetDeviceAccelerationStructureCompatibilityKHR = (PFN_vkGetDeviceAccelerationStructureCompatibilityKHR)StubGetDeviceAccelerationStructureCompatibilityKHR; } - table->GetAccelerationStructureBuildSizesKHR = (PFN_vkGetAccelerationStructureBuildSizesKHR) gpa(device, "vkGetAccelerationStructureBuildSizesKHR"); - if (table->GetAccelerationStructureBuildSizesKHR == nullptr) { table->GetAccelerationStructureBuildSizesKHR = (PFN_vkGetAccelerationStructureBuildSizesKHR)StubGetAccelerationStructureBuildSizesKHR; } - table->CmdTraceRaysKHR = (PFN_vkCmdTraceRaysKHR) gpa(device, "vkCmdTraceRaysKHR"); - if (table->CmdTraceRaysKHR == nullptr) { table->CmdTraceRaysKHR = (PFN_vkCmdTraceRaysKHR)StubCmdTraceRaysKHR; } - table->CreateRayTracingPipelinesKHR = (PFN_vkCreateRayTracingPipelinesKHR) gpa(device, "vkCreateRayTracingPipelinesKHR"); - if (table->CreateRayTracingPipelinesKHR == nullptr) { table->CreateRayTracingPipelinesKHR = (PFN_vkCreateRayTracingPipelinesKHR)StubCreateRayTracingPipelinesKHR; } - table->GetRayTracingCaptureReplayShaderGroupHandlesKHR = (PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR) gpa(device, "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR"); - if (table->GetRayTracingCaptureReplayShaderGroupHandlesKHR == nullptr) { table->GetRayTracingCaptureReplayShaderGroupHandlesKHR = (PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)StubGetRayTracingCaptureReplayShaderGroupHandlesKHR; } - table->CmdTraceRaysIndirectKHR = (PFN_vkCmdTraceRaysIndirectKHR) gpa(device, "vkCmdTraceRaysIndirectKHR"); - if (table->CmdTraceRaysIndirectKHR == nullptr) { table->CmdTraceRaysIndirectKHR = (PFN_vkCmdTraceRaysIndirectKHR)StubCmdTraceRaysIndirectKHR; } - table->GetRayTracingShaderGroupStackSizeKHR = (PFN_vkGetRayTracingShaderGroupStackSizeKHR) gpa(device, "vkGetRayTracingShaderGroupStackSizeKHR"); - if (table->GetRayTracingShaderGroupStackSizeKHR == nullptr) { table->GetRayTracingShaderGroupStackSizeKHR = (PFN_vkGetRayTracingShaderGroupStackSizeKHR)StubGetRayTracingShaderGroupStackSizeKHR; } - table->CmdSetRayTracingPipelineStackSizeKHR = (PFN_vkCmdSetRayTracingPipelineStackSizeKHR) gpa(device, "vkCmdSetRayTracingPipelineStackSizeKHR"); - if (table->CmdSetRayTracingPipelineStackSizeKHR == nullptr) { table->CmdSetRayTracingPipelineStackSizeKHR = (PFN_vkCmdSetRayTracingPipelineStackSizeKHR)StubCmdSetRayTracingPipelineStackSizeKHR; } - table->CmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT) gpa(device, "vkCmdDrawMeshTasksEXT"); - if (table->CmdDrawMeshTasksEXT == nullptr) { table->CmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT)StubCmdDrawMeshTasksEXT; } - table->CmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT) gpa(device, "vkCmdDrawMeshTasksIndirectEXT"); - if (table->CmdDrawMeshTasksIndirectEXT == nullptr) { table->CmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)StubCmdDrawMeshTasksIndirectEXT; } - table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT) gpa(device, "vkCmdDrawMeshTasksIndirectCountEXT"); - if (table->CmdDrawMeshTasksIndirectCountEXT == nullptr) { table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)StubCmdDrawMeshTasksIndirectCountEXT; } } @@ -1330,159 +750,220 @@ static inline void layer_init_instance_dispatch_table(VkInstance instance, VkLay 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->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->GetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties"); - 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->GetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2"); - table->GetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) gpa(instance, "vkGetPhysicalDeviceExternalBufferProperties"); - table->GetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) gpa(instance, "vkGetPhysicalDeviceExternalFenceProperties"); - table->GetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) gpa(instance, "vkGetPhysicalDeviceExternalSemaphoreProperties"); - table->GetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties) gpa(instance, "vkGetPhysicalDeviceToolProperties"); - 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"); -#ifdef VK_USE_PLATFORM_XLIB_KHR - table->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR) gpa(instance, "vkCreateXlibSurfaceKHR"); -#endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR - table->GetPhysicalDeviceXlibPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); -#endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR - table->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR) gpa(instance, "vkCreateXcbSurfaceKHR"); -#endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR - table->GetPhysicalDeviceXcbPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); -#endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - table->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR) gpa(instance, "vkCreateWaylandSurfaceKHR"); -#endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - table->GetPhysicalDeviceWaylandPresentationSupportKHR = (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); -#endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR - table->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR) gpa(instance, "vkCreateAndroidSurfaceKHR"); -#endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR) gpa(instance, "vkCreateWin32SurfaceKHR"); -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetPhysicalDeviceWin32PresentationSupportKHR = (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->GetPhysicalDeviceVideoCapabilitiesKHR = (PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR) gpa(instance, "vkGetPhysicalDeviceVideoCapabilitiesKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - table->GetPhysicalDeviceVideoFormatPropertiesKHR = (PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR) gpa(instance, "vkGetPhysicalDeviceVideoFormatPropertiesKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS - table->GetPhysicalDeviceFeatures2KHR = (PFN_vkGetPhysicalDeviceFeatures2KHR) gpa(instance, "vkGetPhysicalDeviceFeatures2KHR"); - table->GetPhysicalDeviceProperties2KHR = (PFN_vkGetPhysicalDeviceProperties2KHR) gpa(instance, "vkGetPhysicalDeviceProperties2KHR"); - table->GetPhysicalDeviceFormatProperties2KHR = (PFN_vkGetPhysicalDeviceFormatProperties2KHR) gpa(instance, "vkGetPhysicalDeviceFormatProperties2KHR"); - table->GetPhysicalDeviceImageFormatProperties2KHR = (PFN_vkGetPhysicalDeviceImageFormatProperties2KHR) gpa(instance, "vkGetPhysicalDeviceImageFormatProperties2KHR"); - table->GetPhysicalDeviceQueueFamilyProperties2KHR = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR) gpa(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); - table->GetPhysicalDeviceMemoryProperties2KHR = (PFN_vkGetPhysicalDeviceMemoryProperties2KHR) gpa(instance, "vkGetPhysicalDeviceMemoryProperties2KHR"); - table->GetPhysicalDeviceSparseImageFormatProperties2KHR = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR) gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); - table->EnumeratePhysicalDeviceGroupsKHR = (PFN_vkEnumeratePhysicalDeviceGroupsKHR) gpa(instance, "vkEnumeratePhysicalDeviceGroupsKHR"); - table->GetPhysicalDeviceExternalBufferPropertiesKHR = (PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR) gpa(instance, "vkGetPhysicalDeviceExternalBufferPropertiesKHR"); - table->GetPhysicalDeviceExternalSemaphorePropertiesKHR = (PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR) gpa(instance, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); - table->GetPhysicalDeviceExternalFencePropertiesKHR = (PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR) gpa(instance, "vkGetPhysicalDeviceExternalFencePropertiesKHR"); - 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->CreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) gpa(instance, "vkCreateDebugReportCallbackEXT"); - table->DestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) gpa(instance, "vkDestroyDebugReportCallbackEXT"); - table->DebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) gpa(instance, "vkDebugReportMessageEXT"); -#ifdef VK_USE_PLATFORM_GGP - table->CreateStreamDescriptorSurfaceGGP = (PFN_vkCreateStreamDescriptorSurfaceGGP) gpa(instance, "vkCreateStreamDescriptorSurfaceGGP"); -#endif // VK_USE_PLATFORM_GGP - table->GetPhysicalDeviceExternalImageFormatPropertiesNV = (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV) gpa(instance, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"); -#ifdef VK_USE_PLATFORM_VI_NN - table->CreateViSurfaceNN = (PFN_vkCreateViSurfaceNN) gpa(instance, "vkCreateViSurfaceNN"); -#endif // VK_USE_PLATFORM_VI_NN - table->ReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT) gpa(instance, "vkReleaseDisplayEXT"); -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT - table->AcquireXlibDisplayEXT = (PFN_vkAcquireXlibDisplayEXT) gpa(instance, "vkAcquireXlibDisplayEXT"); -#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT - table->GetRandROutputDisplayEXT = (PFN_vkGetRandROutputDisplayEXT) gpa(instance, "vkGetRandROutputDisplayEXT"); -#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT - table->GetPhysicalDeviceSurfaceCapabilities2EXT = (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT) gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); -#ifdef VK_USE_PLATFORM_IOS_MVK - table->CreateIOSSurfaceMVK = (PFN_vkCreateIOSSurfaceMVK) gpa(instance, "vkCreateIOSSurfaceMVK"); -#endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_MACOS_MVK - table->CreateMacOSSurfaceMVK = (PFN_vkCreateMacOSSurfaceMVK) gpa(instance, "vkCreateMacOSSurfaceMVK"); -#endif // VK_USE_PLATFORM_MACOS_MVK - 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"); -#ifdef VK_USE_PLATFORM_FUCHSIA - table->CreateImagePipeSurfaceFUCHSIA = (PFN_vkCreateImagePipeSurfaceFUCHSIA) gpa(instance, "vkCreateImagePipeSurfaceFUCHSIA"); -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_METAL_EXT - table->CreateMetalSurfaceEXT = (PFN_vkCreateMetalSurfaceEXT) gpa(instance, "vkCreateMetalSurfaceEXT"); -#endif // VK_USE_PLATFORM_METAL_EXT - table->GetPhysicalDeviceToolPropertiesEXT = (PFN_vkGetPhysicalDeviceToolPropertiesEXT) gpa(instance, "vkGetPhysicalDeviceToolPropertiesEXT"); - table->GetPhysicalDeviceCooperativeMatrixPropertiesNV = (PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV) gpa(instance, "vkGetPhysicalDeviceCooperativeMatrixPropertiesNV"); - table->GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV = (PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV) gpa(instance, "vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV"); -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetPhysicalDeviceSurfacePresentModes2EXT = (PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT) gpa(instance, "vkGetPhysicalDeviceSurfacePresentModes2EXT"); -#endif // VK_USE_PLATFORM_WIN32_KHR - table->CreateHeadlessSurfaceEXT = (PFN_vkCreateHeadlessSurfaceEXT) gpa(instance, "vkCreateHeadlessSurfaceEXT"); - table->AcquireDrmDisplayEXT = (PFN_vkAcquireDrmDisplayEXT) gpa(instance, "vkAcquireDrmDisplayEXT"); - table->GetDrmDisplayEXT = (PFN_vkGetDrmDisplayEXT) gpa(instance, "vkGetDrmDisplayEXT"); -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->AcquireWinrtDisplayNV = (PFN_vkAcquireWinrtDisplayNV) gpa(instance, "vkAcquireWinrtDisplayNV"); -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - table->GetWinrtDisplayNV = (PFN_vkGetWinrtDisplayNV) gpa(instance, "vkGetWinrtDisplayNV"); -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - table->CreateDirectFBSurfaceEXT = (PFN_vkCreateDirectFBSurfaceEXT) gpa(instance, "vkCreateDirectFBSurfaceEXT"); -#endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - table->GetPhysicalDeviceDirectFBPresentationSupportEXT = (PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT) gpa(instance, "vkGetPhysicalDeviceDirectFBPresentationSupportEXT"); -#endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX - table->CreateScreenSurfaceQNX = (PFN_vkCreateScreenSurfaceQNX) gpa(instance, "vkCreateScreenSurfaceQNX"); -#endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_SCREEN_QNX - table->GetPhysicalDeviceScreenPresentationSupportQNX = (PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX) gpa(instance, "vkGetPhysicalDeviceScreenPresentationSupportQNX"); -#endif // VK_USE_PLATFORM_SCREEN_QNX - table->GetPhysicalDeviceOpticalFlowImageFormatsNV = (PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV) gpa(instance, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); + table->EnumerateDeviceExtensionProperties = + (PFN_vkEnumerateDeviceExtensionProperties)gpa(instance, "vkEnumerateDeviceExtensionProperties"); + table->EnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties)gpa(instance, "vkEnumerateDeviceLayerProperties"); + table->GetPhysicalDeviceSparseImageFormatProperties = + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties)gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties"); + 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->GetPhysicalDeviceSparseImageFormatProperties2 = + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2)gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2"); + table->GetPhysicalDeviceExternalBufferProperties = + (PFN_vkGetPhysicalDeviceExternalBufferProperties)gpa(instance, "vkGetPhysicalDeviceExternalBufferProperties"); + table->GetPhysicalDeviceExternalFenceProperties = + (PFN_vkGetPhysicalDeviceExternalFenceProperties)gpa(instance, "vkGetPhysicalDeviceExternalFenceProperties"); + table->GetPhysicalDeviceExternalSemaphoreProperties = + (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)gpa(instance, "vkGetPhysicalDeviceExternalSemaphoreProperties"); + table->GetPhysicalDeviceToolProperties = + (PFN_vkGetPhysicalDeviceToolProperties)gpa(instance, "vkGetPhysicalDeviceToolProperties"); + 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"); +#if defined(VK_USE_PLATFORM_XLIB_KHR) + table->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR"); +#endif // VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) + table->GetPhysicalDeviceXlibPresentationSupportKHR = + (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); +#endif // VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) + table->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR"); +#endif // VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) + table->GetPhysicalDeviceXcbPresentationSupportKHR = + (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); +#endif // VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + table->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(instance, "vkCreateWaylandSurfaceKHR"); +#endif // VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + table->GetPhysicalDeviceWaylandPresentationSupportKHR = + (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); +#endif // VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + table->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa(instance, "vkCreateAndroidSurfaceKHR"); +#endif // VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetPhysicalDeviceWin32PresentationSupportKHR = + (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->GetPhysicalDeviceVideoCapabilitiesKHR = + (PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)gpa(instance, "vkGetPhysicalDeviceVideoCapabilitiesKHR"); + table->GetPhysicalDeviceVideoFormatPropertiesKHR = + (PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)gpa(instance, "vkGetPhysicalDeviceVideoFormatPropertiesKHR"); + table->GetPhysicalDeviceFeatures2KHR = (PFN_vkGetPhysicalDeviceFeatures2KHR)gpa(instance, "vkGetPhysicalDeviceFeatures2KHR"); + table->GetPhysicalDeviceProperties2KHR = + (PFN_vkGetPhysicalDeviceProperties2KHR)gpa(instance, "vkGetPhysicalDeviceProperties2KHR"); + table->GetPhysicalDeviceFormatProperties2KHR = + (PFN_vkGetPhysicalDeviceFormatProperties2KHR)gpa(instance, "vkGetPhysicalDeviceFormatProperties2KHR"); + table->GetPhysicalDeviceImageFormatProperties2KHR = + (PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)gpa(instance, "vkGetPhysicalDeviceImageFormatProperties2KHR"); + table->GetPhysicalDeviceQueueFamilyProperties2KHR = + (PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)gpa(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); + table->GetPhysicalDeviceMemoryProperties2KHR = + (PFN_vkGetPhysicalDeviceMemoryProperties2KHR)gpa(instance, "vkGetPhysicalDeviceMemoryProperties2KHR"); + table->GetPhysicalDeviceSparseImageFormatProperties2KHR = + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); + table->EnumeratePhysicalDeviceGroupsKHR = + (PFN_vkEnumeratePhysicalDeviceGroupsKHR)gpa(instance, "vkEnumeratePhysicalDeviceGroupsKHR"); + table->GetPhysicalDeviceExternalBufferPropertiesKHR = + (PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)gpa(instance, "vkGetPhysicalDeviceExternalBufferPropertiesKHR"); + table->GetPhysicalDeviceExternalSemaphorePropertiesKHR = + (PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)gpa(instance, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); + table->GetPhysicalDeviceExternalFencePropertiesKHR = + (PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)gpa(instance, "vkGetPhysicalDeviceExternalFencePropertiesKHR"); + 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"); +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR = (PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR)gpa( + instance, "vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR"); +#endif // VK_ENABLE_BETA_EXTENSIONS + table->CreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)gpa(instance, "vkCreateDebugReportCallbackEXT"); + table->DestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)gpa(instance, "vkDestroyDebugReportCallbackEXT"); + table->DebugReportMessageEXT = (PFN_vkDebugReportMessageEXT)gpa(instance, "vkDebugReportMessageEXT"); +#if defined(VK_USE_PLATFORM_GGP) + table->CreateStreamDescriptorSurfaceGGP = + (PFN_vkCreateStreamDescriptorSurfaceGGP)gpa(instance, "vkCreateStreamDescriptorSurfaceGGP"); +#endif // VK_USE_PLATFORM_GGP + table->GetPhysicalDeviceExternalImageFormatPropertiesNV = + (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)gpa(instance, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"); +#if defined(VK_USE_PLATFORM_VI_NN) + table->CreateViSurfaceNN = (PFN_vkCreateViSurfaceNN)gpa(instance, "vkCreateViSurfaceNN"); +#endif // VK_USE_PLATFORM_VI_NN + table->ReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT)gpa(instance, "vkReleaseDisplayEXT"); +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) + table->AcquireXlibDisplayEXT = (PFN_vkAcquireXlibDisplayEXT)gpa(instance, "vkAcquireXlibDisplayEXT"); +#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) + table->GetRandROutputDisplayEXT = (PFN_vkGetRandROutputDisplayEXT)gpa(instance, "vkGetRandROutputDisplayEXT"); +#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT + table->GetPhysicalDeviceSurfaceCapabilities2EXT = + (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); +#if defined(VK_USE_PLATFORM_IOS_MVK) + table->CreateIOSSurfaceMVK = (PFN_vkCreateIOSSurfaceMVK)gpa(instance, "vkCreateIOSSurfaceMVK"); +#endif // VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) + table->CreateMacOSSurfaceMVK = (PFN_vkCreateMacOSSurfaceMVK)gpa(instance, "vkCreateMacOSSurfaceMVK"); +#endif // VK_USE_PLATFORM_MACOS_MVK + 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"); +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->CreateImagePipeSurfaceFUCHSIA = (PFN_vkCreateImagePipeSurfaceFUCHSIA)gpa(instance, "vkCreateImagePipeSurfaceFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_METAL_EXT) + table->CreateMetalSurfaceEXT = (PFN_vkCreateMetalSurfaceEXT)gpa(instance, "vkCreateMetalSurfaceEXT"); +#endif // VK_USE_PLATFORM_METAL_EXT + table->GetPhysicalDeviceToolPropertiesEXT = + (PFN_vkGetPhysicalDeviceToolPropertiesEXT)gpa(instance, "vkGetPhysicalDeviceToolPropertiesEXT"); + table->GetPhysicalDeviceCooperativeMatrixPropertiesNV = + (PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV)gpa(instance, "vkGetPhysicalDeviceCooperativeMatrixPropertiesNV"); + table->GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV = + (PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)gpa( + instance, "vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetPhysicalDeviceSurfacePresentModes2EXT = + (PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT)gpa(instance, "vkGetPhysicalDeviceSurfacePresentModes2EXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->CreateHeadlessSurfaceEXT = (PFN_vkCreateHeadlessSurfaceEXT)gpa(instance, "vkCreateHeadlessSurfaceEXT"); + table->AcquireDrmDisplayEXT = (PFN_vkAcquireDrmDisplayEXT)gpa(instance, "vkAcquireDrmDisplayEXT"); + table->GetDrmDisplayEXT = (PFN_vkGetDrmDisplayEXT)gpa(instance, "vkGetDrmDisplayEXT"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->AcquireWinrtDisplayNV = (PFN_vkAcquireWinrtDisplayNV)gpa(instance, "vkAcquireWinrtDisplayNV"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetWinrtDisplayNV = (PFN_vkGetWinrtDisplayNV)gpa(instance, "vkGetWinrtDisplayNV"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + table->CreateDirectFBSurfaceEXT = (PFN_vkCreateDirectFBSurfaceEXT)gpa(instance, "vkCreateDirectFBSurfaceEXT"); +#endif // VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + table->GetPhysicalDeviceDirectFBPresentationSupportEXT = + (PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)gpa(instance, "vkGetPhysicalDeviceDirectFBPresentationSupportEXT"); +#endif // VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + table->CreateScreenSurfaceQNX = (PFN_vkCreateScreenSurfaceQNX)gpa(instance, "vkCreateScreenSurfaceQNX"); +#endif // VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + table->GetPhysicalDeviceScreenPresentationSupportQNX = + (PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)gpa(instance, "vkGetPhysicalDeviceScreenPresentationSupportQNX"); +#endif // VK_USE_PLATFORM_SCREEN_QNX + table->GetPhysicalDeviceOpticalFlowImageFormatsNV = + (PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)gpa(instance, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); #ifdef VK_USE_PLATFORM_OHOS table->CreateSurfaceOHOS = (PFN_vkCreateSurfaceOHOS) gpa(instance, "vkCreateSurfaceOHOS"); #endif // VK_USE_PLATFORM_OHOS diff --git a/loader/generated/vk_layer_dispatch_table.h b/loader/generated/vk_layer_dispatch_table.h index ee395095e7a994d75ec7f6469c63ffcecbcdb9d0..e5e51630e4724b9958122436c2d756622440ef98 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. @@ -22,16 +24,19 @@ * Author: Mark Young */ +// clang-format off #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 1_0 commands + // ---- Core Vulkan 1.0 commands PFN_vkCreateInstance CreateInstance; PFN_vkDestroyInstance DestroyInstance; PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; @@ -49,7 +54,7 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties; PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties; - // ---- Core 1_1 commands + // ---- Core Vulkan 1.1 commands PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion; PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups; PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2; @@ -63,7 +68,7 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties; PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties; - // ---- Core 1_3 commands + // ---- Core Vulkan 1.3 commands PFN_vkGetPhysicalDeviceToolProperties GetPhysicalDeviceToolProperties; // ---- VK_KHR_surface extension commands @@ -86,49 +91,45 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR; // ---- VK_KHR_xlib_surface extension commands -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR; #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR; #endif // VK_USE_PLATFORM_XLIB_KHR // ---- VK_KHR_xcb_surface extension commands -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR; #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR; #endif // VK_USE_PLATFORM_XCB_KHR // ---- VK_KHR_wayland_surface extension commands -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR; #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR; #endif // VK_USE_PLATFORM_WAYLAND_KHR // ---- VK_KHR_android_surface extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR; #endif // VK_USE_PLATFORM_ANDROID_KHR // ---- VK_KHR_win32_surface extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR; #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR GetPhysicalDeviceVideoCapabilitiesKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR GetPhysicalDeviceVideoFormatPropertiesKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_get_physical_device_properties2 extension commands PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR; @@ -168,13 +169,22 @@ typedef struct VkLayerInstanceDispatchTable_ { // ---- VK_KHR_fragment_shading_rate extension commands PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR GetPhysicalDeviceFragmentShadingRatesKHR; + // ---- VK_KHR_video_encode_queue extension commands + PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR; + + // ---- VK_KHR_cooperative_matrix extension commands + PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR GetPhysicalDeviceCooperativeMatrixPropertiesKHR; + + // ---- VK_KHR_calibrated_timestamps extension commands + PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR GetPhysicalDeviceCalibrateableTimeDomainsKHR; + // ---- VK_EXT_debug_report extension commands PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT; PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT; PFN_vkDebugReportMessageEXT DebugReportMessageEXT; // ---- VK_GGP_stream_descriptor_surface extension commands -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) PFN_vkCreateStreamDescriptorSurfaceGGP CreateStreamDescriptorSurfaceGGP; #endif // VK_USE_PLATFORM_GGP @@ -182,7 +192,7 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV GetPhysicalDeviceExternalImageFormatPropertiesNV; // ---- VK_NN_vi_surface extension commands -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) PFN_vkCreateViSurfaceNN CreateViSurfaceNN; #endif // VK_USE_PLATFORM_VI_NN @@ -190,10 +200,10 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkReleaseDisplayEXT ReleaseDisplayEXT; // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) PFN_vkAcquireXlibDisplayEXT AcquireXlibDisplayEXT; #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) PFN_vkGetRandROutputDisplayEXT GetRandROutputDisplayEXT; #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT @@ -201,12 +211,12 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT; // ---- VK_MVK_ios_surface extension commands -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) PFN_vkCreateIOSSurfaceMVK CreateIOSSurfaceMVK; #endif // VK_USE_PLATFORM_IOS_MVK // ---- VK_MVK_macos_surface extension commands -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) PFN_vkCreateMacOSSurfaceMVK CreateMacOSSurfaceMVK; #endif // VK_USE_PLATFORM_MACOS_MVK @@ -222,12 +232,12 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT; // ---- VK_FUCHSIA_imagepipe_surface extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkCreateImagePipeSurfaceFUCHSIA CreateImagePipeSurfaceFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_EXT_metal_surface extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) PFN_vkCreateMetalSurfaceEXT CreateMetalSurfaceEXT; #endif // VK_USE_PLATFORM_METAL_EXT @@ -241,7 +251,7 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV; // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT GetPhysicalDeviceSurfacePresentModes2EXT; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -253,26 +263,26 @@ typedef struct VkLayerInstanceDispatchTable_ { PFN_vkGetDrmDisplayEXT GetDrmDisplayEXT; // ---- VK_NV_acquire_winrt_display extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkAcquireWinrtDisplayNV AcquireWinrtDisplayNV; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetWinrtDisplayNV GetWinrtDisplayNV; #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_directfb_surface extension commands -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) PFN_vkCreateDirectFBSurfaceEXT CreateDirectFBSurfaceEXT; #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT GetPhysicalDeviceDirectFBPresentationSupportEXT; #endif // VK_USE_PLATFORM_DIRECTFB_EXT // ---- VK_QNX_screen_surface extension commands -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) PFN_vkCreateScreenSurfaceQNX CreateScreenSurfaceQNX; #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX GetPhysicalDeviceScreenPresentationSupportQNX; #endif // VK_USE_PLATFORM_SCREEN_QNX @@ -290,7 +300,7 @@ typedef struct VkLayerInstanceDispatchTable_ { typedef struct VkLayerDispatchTable_ { uint64_t magic; // Should be DEVICE_DISP_TABLE_MAGIC_NUMBER - // ---- Core 1_0 commands + // ---- Core Vulkan 1.0 commands PFN_vkGetDeviceProcAddr GetDeviceProcAddr; PFN_vkDestroyDevice DestroyDevice; PFN_vkGetDeviceQueue GetDeviceQueue; @@ -413,7 +423,7 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCmdEndRenderPass CmdEndRenderPass; PFN_vkCmdExecuteCommands CmdExecuteCommands; - // ---- Core 1_1 commands + // ---- Core Vulkan 1.1 commands PFN_vkBindBufferMemory2 BindBufferMemory2; PFN_vkBindImageMemory2 BindImageMemory2; PFN_vkGetDeviceGroupPeerMemoryFeatures GetDeviceGroupPeerMemoryFeatures; @@ -431,7 +441,7 @@ typedef struct VkLayerDispatchTable_ { PFN_vkUpdateDescriptorSetWithTemplate UpdateDescriptorSetWithTemplate; PFN_vkGetDescriptorSetLayoutSupport GetDescriptorSetLayoutSupport; - // ---- Core 1_2 commands + // ---- Core Vulkan 1.2 commands PFN_vkCmdDrawIndirectCount CmdDrawIndirectCount; PFN_vkCmdDrawIndexedIndirectCount CmdDrawIndexedIndirectCount; PFN_vkCreateRenderPass2 CreateRenderPass2; @@ -446,7 +456,7 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetBufferOpaqueCaptureAddress GetBufferOpaqueCaptureAddress; PFN_vkGetDeviceMemoryOpaqueCaptureAddress GetDeviceMemoryOpaqueCaptureAddress; - // ---- Core 1_3 commands + // ---- Core Vulkan 1.3 commands PFN_vkCreatePrivateDataSlot CreatePrivateDataSlot; PFN_vkDestroyPrivateDataSlot DestroyPrivateDataSlot; PFN_vkSetPrivateData SetPrivateData; @@ -498,41 +508,19 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR; // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkCreateVideoSessionKHR CreateVideoSessionKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkDestroyVideoSessionKHR DestroyVideoSessionKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkGetVideoSessionMemoryRequirementsKHR GetVideoSessionMemoryRequirementsKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkBindVideoSessionMemoryKHR BindVideoSessionMemoryKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkCreateVideoSessionParametersKHR CreateVideoSessionParametersKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkUpdateVideoSessionParametersKHR UpdateVideoSessionParametersKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkDestroyVideoSessionParametersKHR DestroyVideoSessionParametersKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkCmdBeginVideoCodingKHR CmdBeginVideoCodingKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkCmdEndVideoCodingKHR CmdEndVideoCodingKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkCmdControlVideoCodingKHR CmdControlVideoCodingKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_video_decode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkCmdDecodeVideoKHR CmdDecodeVideoKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_dynamic_rendering extension commands PFN_vkCmdBeginRenderingKHR CmdBeginRenderingKHR; @@ -547,10 +535,10 @@ typedef struct VkLayerDispatchTable_ { PFN_vkTrimCommandPoolKHR TrimCommandPoolKHR; // ---- VK_KHR_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetMemoryWin32HandleKHR GetMemoryWin32HandleKHR; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetMemoryWin32HandlePropertiesKHR GetMemoryWin32HandlePropertiesKHR; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -559,10 +547,10 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetMemoryFdPropertiesKHR GetMemoryFdPropertiesKHR; // ---- VK_KHR_external_semaphore_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkImportSemaphoreWin32HandleKHR ImportSemaphoreWin32HandleKHR; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetSemaphoreWin32HandleKHR GetSemaphoreWin32HandleKHR; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -589,10 +577,10 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetSwapchainStatusKHR GetSwapchainStatusKHR; // ---- VK_KHR_external_fence_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkImportFenceWin32HandleKHR ImportFenceWin32HandleKHR; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetFenceWin32HandleKHR GetFenceWin32HandleKHR; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -652,10 +640,13 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetPipelineExecutableStatisticsKHR GetPipelineExecutableStatisticsKHR; PFN_vkGetPipelineExecutableInternalRepresentationsKHR GetPipelineExecutableInternalRepresentationsKHR; + // ---- VK_KHR_map_memory2 extension commands + PFN_vkMapMemory2KHR MapMemory2KHR; + PFN_vkUnmapMemory2KHR UnmapMemory2KHR; + // ---- VK_KHR_video_encode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS + PFN_vkGetEncodedVideoSessionParametersKHR GetEncodedVideoSessionParametersKHR; PFN_vkCmdEncodeVideoKHR CmdEncodeVideoKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_synchronization2 extension commands PFN_vkCmdSetEvent2KHR CmdSetEvent2KHR; @@ -683,6 +674,23 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetDeviceImageMemoryRequirementsKHR GetDeviceImageMemoryRequirementsKHR; PFN_vkGetDeviceImageSparseMemoryRequirementsKHR GetDeviceImageSparseMemoryRequirementsKHR; + // ---- VK_KHR_maintenance5 extension commands + PFN_vkCmdBindIndexBuffer2KHR CmdBindIndexBuffer2KHR; + PFN_vkGetRenderingAreaGranularityKHR GetRenderingAreaGranularityKHR; + PFN_vkGetDeviceImageSubresourceLayoutKHR GetDeviceImageSubresourceLayoutKHR; + PFN_vkGetImageSubresourceLayout2KHR GetImageSubresourceLayout2KHR; + + // ---- VK_KHR_calibrated_timestamps extension commands + PFN_vkGetCalibratedTimestampsKHR GetCalibratedTimestampsKHR; + + // ---- VK_KHR_maintenance6 extension commands + PFN_vkCmdBindDescriptorSets2KHR CmdBindDescriptorSets2KHR; + PFN_vkCmdPushConstants2KHR CmdPushConstants2KHR; + PFN_vkCmdPushDescriptorSet2KHR CmdPushDescriptorSet2KHR; + PFN_vkCmdPushDescriptorSetWithTemplate2KHR CmdPushDescriptorSetWithTemplate2KHR; + PFN_vkCmdSetDescriptorBufferOffsets2EXT CmdSetDescriptorBufferOffsets2EXT; + PFN_vkCmdBindDescriptorBufferEmbeddedSamplers2EXT CmdBindDescriptorBufferEmbeddedSamplers2EXT; + // ---- VK_EXT_debug_marker extension commands PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT; PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT; @@ -717,7 +725,7 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetShaderInfoAMD GetShaderInfoAMD; // ---- VK_NV_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetMemoryWin32HandleNV GetMemoryWin32HandleNV; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -740,6 +748,8 @@ typedef struct VkLayerDispatchTable_ { // ---- VK_EXT_discard_rectangles extension commands PFN_vkCmdSetDiscardRectangleEXT CmdSetDiscardRectangleEXT; + PFN_vkCmdSetDiscardRectangleEnableEXT CmdSetDiscardRectangleEnableEXT; + PFN_vkCmdSetDiscardRectangleModeEXT CmdSetDiscardRectangleModeEXT; // ---- VK_EXT_hdr_metadata extension commands PFN_vkSetHdrMetadataEXT SetHdrMetadataEXT; @@ -755,13 +765,36 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT; // ---- VK_ANDROID_external_memory_android_hardware_buffer extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) PFN_vkGetAndroidHardwareBufferPropertiesANDROID GetAndroidHardwareBufferPropertiesANDROID; #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) PFN_vkGetMemoryAndroidHardwareBufferANDROID GetMemoryAndroidHardwareBufferANDROID; #endif // VK_USE_PLATFORM_ANDROID_KHR + // ---- VK_AMDX_shader_enqueue extension commands +#if defined(VK_ENABLE_BETA_EXTENSIONS) + PFN_vkCreateExecutionGraphPipelinesAMDX CreateExecutionGraphPipelinesAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + PFN_vkGetExecutionGraphPipelineScratchSizeAMDX GetExecutionGraphPipelineScratchSizeAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + PFN_vkGetExecutionGraphPipelineNodeIndexAMDX GetExecutionGraphPipelineNodeIndexAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + PFN_vkCmdInitializeGraphScratchMemoryAMDX CmdInitializeGraphScratchMemoryAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + PFN_vkCmdDispatchGraphAMDX CmdDispatchGraphAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + PFN_vkCmdDispatchGraphIndirectAMDX CmdDispatchGraphIndirectAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + PFN_vkCmdDispatchGraphIndirectCountAMDX CmdDispatchGraphIndirectCountAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS + // ---- VK_EXT_sample_locations extension commands PFN_vkCmdSetSampleLocationsEXT CmdSetSampleLocationsEXT; @@ -809,6 +842,7 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCmdDrawMeshTasksIndirectCountNV CmdDrawMeshTasksIndirectCountNV; // ---- VK_NV_scissor_exclusive extension commands + PFN_vkCmdSetExclusiveScissorEnableNV CmdSetExclusiveScissorEnableNV; PFN_vkCmdSetExclusiveScissorNV CmdSetExclusiveScissorNV; // ---- VK_NV_device_diagnostic_checkpoints extension commands @@ -833,13 +867,13 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetBufferDeviceAddressEXT GetBufferDeviceAddressEXT; // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkAcquireFullScreenExclusiveModeEXT AcquireFullScreenExclusiveModeEXT; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkReleaseFullScreenExclusiveModeEXT ReleaseFullScreenExclusiveModeEXT; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetDeviceGroupSurfacePresentModes2EXT GetDeviceGroupSurfacePresentModes2EXT; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -863,6 +897,16 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCmdSetStencilTestEnableEXT CmdSetStencilTestEnableEXT; PFN_vkCmdSetStencilOpEXT CmdSetStencilOpEXT; + // ---- VK_EXT_host_image_copy extension commands + PFN_vkCopyMemoryToImageEXT CopyMemoryToImageEXT; + PFN_vkCopyImageToMemoryEXT CopyImageToMemoryEXT; + PFN_vkCopyImageToImageEXT CopyImageToImageEXT; + PFN_vkTransitionImageLayoutEXT TransitionImageLayoutEXT; + PFN_vkGetImageSubresourceLayout2EXT GetImageSubresourceLayout2EXT; + + // ---- VK_EXT_swapchain_maintenance1 extension commands + PFN_vkReleaseSwapchainImagesEXT ReleaseSwapchainImagesEXT; + // ---- VK_NV_device_generated_commands extension commands PFN_vkGetGeneratedCommandsMemoryRequirementsNV GetGeneratedCommandsMemoryRequirementsNV; PFN_vkCmdPreprocessGeneratedCommandsNV CmdPreprocessGeneratedCommandsNV; @@ -871,23 +915,44 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCreateIndirectCommandsLayoutNV CreateIndirectCommandsLayoutNV; PFN_vkDestroyIndirectCommandsLayoutNV DestroyIndirectCommandsLayoutNV; + // ---- VK_EXT_depth_bias_control extension commands + PFN_vkCmdSetDepthBias2EXT CmdSetDepthBias2EXT; + // ---- VK_EXT_private_data extension commands PFN_vkCreatePrivateDataSlotEXT CreatePrivateDataSlotEXT; PFN_vkDestroyPrivateDataSlotEXT DestroyPrivateDataSlotEXT; PFN_vkSetPrivateDataEXT SetPrivateDataEXT; PFN_vkGetPrivateDataEXT GetPrivateDataEXT; + // ---- VK_NV_cuda_kernel_launch extension commands + PFN_vkCreateCudaModuleNV CreateCudaModuleNV; + PFN_vkGetCudaModuleCacheNV GetCudaModuleCacheNV; + PFN_vkCreateCudaFunctionNV CreateCudaFunctionNV; + PFN_vkDestroyCudaModuleNV DestroyCudaModuleNV; + PFN_vkDestroyCudaFunctionNV DestroyCudaFunctionNV; + PFN_vkCmdCudaLaunchKernelNV CmdCudaLaunchKernelNV; + // ---- VK_EXT_metal_objects extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) PFN_vkExportMetalObjectsEXT ExportMetalObjectsEXT; #endif // VK_USE_PLATFORM_METAL_EXT + // ---- VK_EXT_descriptor_buffer extension commands + PFN_vkGetDescriptorSetLayoutSizeEXT GetDescriptorSetLayoutSizeEXT; + PFN_vkGetDescriptorSetLayoutBindingOffsetEXT GetDescriptorSetLayoutBindingOffsetEXT; + PFN_vkGetDescriptorEXT GetDescriptorEXT; + PFN_vkCmdBindDescriptorBuffersEXT CmdBindDescriptorBuffersEXT; + PFN_vkCmdSetDescriptorBufferOffsetsEXT CmdSetDescriptorBufferOffsetsEXT; + PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT CmdBindDescriptorBufferEmbeddedSamplersEXT; + PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT GetBufferOpaqueCaptureDescriptorDataEXT; + PFN_vkGetImageOpaqueCaptureDescriptorDataEXT GetImageOpaqueCaptureDescriptorDataEXT; + PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT GetImageViewOpaqueCaptureDescriptorDataEXT; + PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT GetSamplerOpaqueCaptureDescriptorDataEXT; + PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT GetAccelerationStructureOpaqueCaptureDescriptorDataEXT; + // ---- VK_NV_fragment_shading_rate_enums extension commands PFN_vkCmdSetFragmentShadingRateEnumNV CmdSetFragmentShadingRateEnumNV; - // ---- VK_EXT_image_compression_control extension commands - PFN_vkGetImageSubresourceLayout2EXT GetImageSubresourceLayout2EXT; - // ---- VK_EXT_device_fault extension commands PFN_vkGetDeviceFaultInfoEXT GetDeviceFaultInfoEXT; @@ -895,35 +960,35 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCmdSetVertexInputEXT CmdSetVertexInputEXT; // ---- VK_FUCHSIA_external_memory extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkGetMemoryZirconHandleFUCHSIA GetMemoryZirconHandleFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA GetMemoryZirconHandlePropertiesFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_external_semaphore extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkImportSemaphoreZirconHandleFUCHSIA ImportSemaphoreZirconHandleFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkGetSemaphoreZirconHandleFUCHSIA GetSemaphoreZirconHandleFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_buffer_collection extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkCreateBufferCollectionFUCHSIA CreateBufferCollectionFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkSetBufferCollectionImageConstraintsFUCHSIA SetBufferCollectionImageConstraintsFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA SetBufferCollectionBufferConstraintsFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkDestroyBufferCollectionFUCHSIA DestroyBufferCollectionFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkGetBufferCollectionPropertiesFUCHSIA GetBufferCollectionPropertiesFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA @@ -970,6 +1035,10 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetDeviceMicromapCompatibilityEXT GetDeviceMicromapCompatibilityEXT; PFN_vkGetMicromapBuildSizesEXT GetMicromapBuildSizesEXT; + // ---- VK_HUAWEI_cluster_culling_shader extension commands + PFN_vkCmdDrawClusterHUAWEI CmdDrawClusterHUAWEI; + PFN_vkCmdDrawClusterIndirectHUAWEI CmdDrawClusterIndirectHUAWEI; + // ---- VK_EXT_pageable_device_local_memory extension commands PFN_vkSetDeviceMemoryPriorityEXT SetDeviceMemoryPriorityEXT; @@ -977,6 +1046,19 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE GetDescriptorSetLayoutHostMappingInfoVALVE; PFN_vkGetDescriptorSetHostMappingVALVE GetDescriptorSetHostMappingVALVE; + // ---- VK_NV_copy_memory_indirect extension commands + PFN_vkCmdCopyMemoryIndirectNV CmdCopyMemoryIndirectNV; + PFN_vkCmdCopyMemoryToImageIndirectNV CmdCopyMemoryToImageIndirectNV; + + // ---- VK_NV_memory_decompression extension commands + PFN_vkCmdDecompressMemoryNV CmdDecompressMemoryNV; + PFN_vkCmdDecompressMemoryIndirectCountNV CmdDecompressMemoryIndirectCountNV; + + // ---- VK_NV_device_generated_commands_compute extension commands + PFN_vkGetPipelineIndirectMemoryRequirementsNV GetPipelineIndirectMemoryRequirementsNV; + PFN_vkCmdUpdatePipelineIndirectBufferNV CmdUpdatePipelineIndirectBufferNV; + PFN_vkGetPipelineIndirectDeviceAddressNV GetPipelineIndirectDeviceAddressNV; + // ---- VK_EXT_extended_dynamic_state3 extension commands PFN_vkCmdSetTessellationDomainOriginEXT CmdSetTessellationDomainOriginEXT; PFN_vkCmdSetDepthClampEnableEXT CmdSetDepthClampEnableEXT; @@ -1020,28 +1102,30 @@ typedef struct VkLayerDispatchTable_ { PFN_vkBindOpticalFlowSessionImageNV BindOpticalFlowSessionImageNV; PFN_vkCmdOpticalFlowExecuteNV CmdOpticalFlowExecuteNV; + // ---- VK_EXT_shader_object extension commands + PFN_vkCreateShadersEXT CreateShadersEXT; + PFN_vkDestroyShaderEXT DestroyShaderEXT; + PFN_vkGetShaderBinaryDataEXT GetShaderBinaryDataEXT; + PFN_vkCmdBindShadersEXT CmdBindShadersEXT; + // ---- VK_QCOM_tile_properties extension commands PFN_vkGetFramebufferTilePropertiesQCOM GetFramebufferTilePropertiesQCOM; PFN_vkGetDynamicRenderingTilePropertiesQCOM GetDynamicRenderingTilePropertiesQCOM; - // ---- VK_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS - PFN_vkGetSwapchainGrallocUsageOHOS GetSwapchainGrallocUsageOHOS; -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - PFN_vkAcquireImageOHOS AcquireImageOHOS; -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - PFN_vkQueueSignalReleaseImageOHOS QueueSignalReleaseImageOHOS; -#endif // VK_USE_PLATFORM_OHOS + // ---- VK_NV_low_latency2 extension commands + PFN_vkSetLatencySleepModeNV SetLatencySleepModeNV; + PFN_vkLatencySleepNV LatencySleepNV; + PFN_vkSetLatencyMarkerNV SetLatencyMarkerNV; + PFN_vkGetLatencyTimingsNV GetLatencyTimingsNV; + PFN_vkQueueNotifyOutOfBandNV QueueNotifyOutOfBandNV; - // ---- VK_OHOS_external_memory extension commands -#ifdef VK_USE_PLATFORM_OHOS - PFN_vkGetNativeBufferPropertiesOHOS GetNativeBufferPropertiesOHOS; -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - PFN_vkGetMemoryNativeBufferOHOS GetMemoryNativeBufferOHOS; -#endif // VK_USE_PLATFORM_OHOS + // ---- VK_EXT_attachment_feedback_loop_dynamic_state extension commands + PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT CmdSetAttachmentFeedbackLoopEnableEXT; + + // ---- VK_QNX_external_memory_screen_buffer extension commands +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + PFN_vkGetScreenBufferPropertiesQNX GetScreenBufferPropertiesQNX; +#endif // VK_USE_PLATFORM_SCREEN_QNX // ---- VK_KHR_acceleration_structure extension commands PFN_vkCreateAccelerationStructureKHR CreateAccelerationStructureKHR; @@ -1073,6 +1157,25 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCmdDrawMeshTasksEXT CmdDrawMeshTasksEXT; PFN_vkCmdDrawMeshTasksIndirectEXT CmdDrawMeshTasksIndirectEXT; PFN_vkCmdDrawMeshTasksIndirectCountEXT CmdDrawMeshTasksIndirectCountEXT; -} VkLayerDispatchTable; + // ---- VK_OHOS_native_buffer extension commands +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkGetSwapchainGrallocUsageOHOS GetSwapchainGrallocUsageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkAcquireImageOHOS AcquireImageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkQueueSignalReleaseImageOHOS QueueSignalReleaseImageOHOS; +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkGetNativeBufferPropertiesOHOS GetNativeBufferPropertiesOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkGetMemoryNativeBufferOHOS GetMemoryNativeBufferOHOS; +#endif // VK_USE_PLATFORM_OHOS +} VkLayerDispatchTable; +// clang-format on diff --git a/loader/generated/vk_loader_extensions.c b/loader/generated/vk_loader_extensions.c index 063d7ac0b71baaf1716bdfde40d10dfee9cdd368..62e0f7c0298aad203f05673d6cec0c33ae40a286 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. @@ -22,6 +24,7 @@ * Author: Mark Young */ +// clang-format off #include #include #include @@ -46,288 +49,276 @@ VKAPI_ATTR VkResult VKAPI_CALL vkDevExtError(VkDevice dev) { 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) { +VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_instance* inst, struct loader_icd_term *icd_term) { + const PFN_vkGetInstanceProcAddr fp_gipa = icd_term->scanned_icd->GetInstanceProcAddr; -#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; \ - } \ +#define LOOKUP_GIPA(func) icd_term->dispatch.func = (PFN_vk##func)fp_gipa(icd_term->instance, "vk" #func); + +#define LOOKUP_REQUIRED_GIPA(func) \ + do { \ + LOOKUP_GIPA(func); \ + if (!icd_term->dispatch.func) { \ + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Unable to load %s from ICD %s",\ + "vk"#func, icd_term->scanned_icd->lib_name); \ + return false; \ + } \ } while (0) - // ---- Core 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(GetPhysicalDeviceSparseImageFormatProperties, true); - - // ---- Core 1_1 - LOOKUP_GIPA(EnumeratePhysicalDeviceGroups, false); - LOOKUP_GIPA(GetPhysicalDeviceFeatures2, false); - LOOKUP_GIPA(GetPhysicalDeviceProperties2, false); - LOOKUP_GIPA(GetPhysicalDeviceFormatProperties2, false); - LOOKUP_GIPA(GetPhysicalDeviceImageFormatProperties2, false); - LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyProperties2, false); - LOOKUP_GIPA(GetPhysicalDeviceMemoryProperties2, false); - LOOKUP_GIPA(GetPhysicalDeviceSparseImageFormatProperties2, false); - LOOKUP_GIPA(GetPhysicalDeviceExternalBufferProperties, false); - LOOKUP_GIPA(GetPhysicalDeviceExternalFenceProperties, false); - LOOKUP_GIPA(GetPhysicalDeviceExternalSemaphoreProperties, false); - - // ---- Core 1_3 - LOOKUP_GIPA(GetPhysicalDeviceToolProperties, false); + // ---- Core Vulkan 1.0 + LOOKUP_REQUIRED_GIPA(DestroyInstance); + LOOKUP_REQUIRED_GIPA(EnumeratePhysicalDevices); + LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceFeatures); + LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceFormatProperties); + LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceImageFormatProperties); + LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceProperties); + LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceQueueFamilyProperties); + LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceMemoryProperties); + LOOKUP_REQUIRED_GIPA(GetDeviceProcAddr); + LOOKUP_REQUIRED_GIPA(CreateDevice); + LOOKUP_REQUIRED_GIPA(EnumerateDeviceExtensionProperties); + LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceSparseImageFormatProperties); + + // ---- Core Vulkan 1.1 + LOOKUP_GIPA(EnumeratePhysicalDeviceGroups); + LOOKUP_GIPA(GetPhysicalDeviceFeatures2); + LOOKUP_GIPA(GetPhysicalDeviceProperties2); + LOOKUP_GIPA(GetPhysicalDeviceFormatProperties2); + LOOKUP_GIPA(GetPhysicalDeviceImageFormatProperties2); + LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyProperties2); + LOOKUP_GIPA(GetPhysicalDeviceMemoryProperties2); + LOOKUP_GIPA(GetPhysicalDeviceSparseImageFormatProperties2); + LOOKUP_GIPA(GetPhysicalDeviceExternalBufferProperties); + LOOKUP_GIPA(GetPhysicalDeviceExternalFenceProperties); + LOOKUP_GIPA(GetPhysicalDeviceExternalSemaphoreProperties); + + // ---- Core Vulkan 1.3 + LOOKUP_GIPA(GetPhysicalDeviceToolProperties); // ---- 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); + LOOKUP_GIPA(DestroySurfaceKHR); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceSupportKHR); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilitiesKHR); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceFormatsKHR); + LOOKUP_GIPA(GetPhysicalDeviceSurfacePresentModesKHR); // ---- VK_KHR_swapchain extension commands - LOOKUP_GIPA(CreateSwapchainKHR, false); - LOOKUP_GIPA(GetDeviceGroupSurfacePresentModesKHR, false); - LOOKUP_GIPA(GetPhysicalDevicePresentRectanglesKHR, false); + LOOKUP_GIPA(GetPhysicalDevicePresentRectanglesKHR); // ---- 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_display_swapchain extension commands - LOOKUP_GIPA(CreateSharedSwapchainsKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceDisplayPropertiesKHR); + LOOKUP_GIPA(GetPhysicalDeviceDisplayPlanePropertiesKHR); + LOOKUP_GIPA(GetDisplayPlaneSupportedDisplaysKHR); + LOOKUP_GIPA(GetDisplayModePropertiesKHR); + LOOKUP_GIPA(CreateDisplayModeKHR); + LOOKUP_GIPA(GetDisplayPlaneCapabilitiesKHR); + LOOKUP_GIPA(CreateDisplayPlaneSurfaceKHR); // ---- VK_KHR_xlib_surface extension commands -#ifdef VK_USE_PLATFORM_XLIB_KHR - LOOKUP_GIPA(CreateXlibSurfaceKHR, false); +#if defined(VK_USE_PLATFORM_XLIB_KHR) + LOOKUP_GIPA(CreateXlibSurfaceKHR); #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR - LOOKUP_GIPA(GetPhysicalDeviceXlibPresentationSupportKHR, false); +#if defined(VK_USE_PLATFORM_XLIB_KHR) + LOOKUP_GIPA(GetPhysicalDeviceXlibPresentationSupportKHR); #endif // VK_USE_PLATFORM_XLIB_KHR // ---- VK_KHR_xcb_surface extension commands -#ifdef VK_USE_PLATFORM_XCB_KHR - LOOKUP_GIPA(CreateXcbSurfaceKHR, false); +#if defined(VK_USE_PLATFORM_XCB_KHR) + LOOKUP_GIPA(CreateXcbSurfaceKHR); #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR - LOOKUP_GIPA(GetPhysicalDeviceXcbPresentationSupportKHR, false); +#if defined(VK_USE_PLATFORM_XCB_KHR) + LOOKUP_GIPA(GetPhysicalDeviceXcbPresentationSupportKHR); #endif // VK_USE_PLATFORM_XCB_KHR // ---- VK_KHR_wayland_surface extension commands -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - LOOKUP_GIPA(CreateWaylandSurfaceKHR, false); +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + LOOKUP_GIPA(CreateWaylandSurfaceKHR); #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - LOOKUP_GIPA(GetPhysicalDeviceWaylandPresentationSupportKHR, false); +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + LOOKUP_GIPA(GetPhysicalDeviceWaylandPresentationSupportKHR); #endif // VK_USE_PLATFORM_WAYLAND_KHR // ---- VK_KHR_android_surface extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR - LOOKUP_GIPA(CreateAndroidSurfaceKHR, false); +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + LOOKUP_GIPA(CreateAndroidSurfaceKHR); #endif // VK_USE_PLATFORM_ANDROID_KHR // ---- VK_KHR_win32_surface extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR - LOOKUP_GIPA(CreateWin32SurfaceKHR, false); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + LOOKUP_GIPA(CreateWin32SurfaceKHR); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - LOOKUP_GIPA(GetPhysicalDeviceWin32PresentationSupportKHR, false); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + LOOKUP_GIPA(GetPhysicalDeviceWin32PresentationSupportKHR); #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS - LOOKUP_GIPA(GetPhysicalDeviceVideoCapabilitiesKHR, false); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - LOOKUP_GIPA(GetPhysicalDeviceVideoFormatPropertiesKHR, false); -#endif // VK_ENABLE_BETA_EXTENSIONS + LOOKUP_GIPA(GetPhysicalDeviceVideoCapabilitiesKHR); + LOOKUP_GIPA(GetPhysicalDeviceVideoFormatPropertiesKHR); // ---- VK_KHR_get_physical_device_properties2 extension commands - LOOKUP_GIPA(GetPhysicalDeviceFeatures2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceProperties2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceFormatProperties2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceImageFormatProperties2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyProperties2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceMemoryProperties2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceSparseImageFormatProperties2KHR, false); + LOOKUP_GIPA(GetPhysicalDeviceFeatures2KHR); + LOOKUP_GIPA(GetPhysicalDeviceProperties2KHR); + LOOKUP_GIPA(GetPhysicalDeviceFormatProperties2KHR); + LOOKUP_GIPA(GetPhysicalDeviceImageFormatProperties2KHR); + LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyProperties2KHR); + LOOKUP_GIPA(GetPhysicalDeviceMemoryProperties2KHR); + LOOKUP_GIPA(GetPhysicalDeviceSparseImageFormatProperties2KHR); // ---- VK_KHR_device_group_creation extension commands - LOOKUP_GIPA(EnumeratePhysicalDeviceGroupsKHR, false); + LOOKUP_GIPA(EnumeratePhysicalDeviceGroupsKHR); // ---- VK_KHR_external_memory_capabilities extension commands - LOOKUP_GIPA(GetPhysicalDeviceExternalBufferPropertiesKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceExternalBufferPropertiesKHR); // ---- VK_KHR_external_semaphore_capabilities extension commands - LOOKUP_GIPA(GetPhysicalDeviceExternalSemaphorePropertiesKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceExternalSemaphorePropertiesKHR); // ---- VK_KHR_external_fence_capabilities extension commands - LOOKUP_GIPA(GetPhysicalDeviceExternalFencePropertiesKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceExternalFencePropertiesKHR); // ---- VK_KHR_performance_query extension commands - LOOKUP_GIPA(EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR, false); - LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR, false); + LOOKUP_GIPA(EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR); + LOOKUP_GIPA(GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR); // ---- VK_KHR_get_surface_capabilities2 extension commands - LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilities2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceSurfaceFormats2KHR, false); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilities2KHR); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceFormats2KHR); // ---- VK_KHR_get_display_properties2 extension commands - LOOKUP_GIPA(GetPhysicalDeviceDisplayProperties2KHR, false); - LOOKUP_GIPA(GetPhysicalDeviceDisplayPlaneProperties2KHR, false); - LOOKUP_GIPA(GetDisplayModeProperties2KHR, false); - LOOKUP_GIPA(GetDisplayPlaneCapabilities2KHR, false); + LOOKUP_GIPA(GetPhysicalDeviceDisplayProperties2KHR); + LOOKUP_GIPA(GetPhysicalDeviceDisplayPlaneProperties2KHR); + LOOKUP_GIPA(GetDisplayModeProperties2KHR); + LOOKUP_GIPA(GetDisplayPlaneCapabilities2KHR); // ---- VK_KHR_fragment_shading_rate extension commands - LOOKUP_GIPA(GetPhysicalDeviceFragmentShadingRatesKHR, false); + LOOKUP_GIPA(GetPhysicalDeviceFragmentShadingRatesKHR); - // ---- VK_EXT_debug_report extension commands - LOOKUP_GIPA(CreateDebugReportCallbackEXT, false); - LOOKUP_GIPA(DestroyDebugReportCallbackEXT, false); - LOOKUP_GIPA(DebugReportMessageEXT, false); + // ---- VK_KHR_video_encode_queue extension commands + LOOKUP_GIPA(GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR); - // ---- VK_EXT_debug_marker extension commands - LOOKUP_GIPA(DebugMarkerSetObjectTagEXT, false); - LOOKUP_GIPA(DebugMarkerSetObjectNameEXT, false); + // ---- VK_KHR_cooperative_matrix extension commands + LOOKUP_GIPA(GetPhysicalDeviceCooperativeMatrixPropertiesKHR); + + // ---- VK_KHR_calibrated_timestamps extension commands + LOOKUP_GIPA(GetPhysicalDeviceCalibrateableTimeDomainsKHR); + + // ---- VK_EXT_debug_report extension commands + LOOKUP_GIPA(CreateDebugReportCallbackEXT); + LOOKUP_GIPA(DestroyDebugReportCallbackEXT); + LOOKUP_GIPA(DebugReportMessageEXT); // ---- VK_GGP_stream_descriptor_surface extension commands -#ifdef VK_USE_PLATFORM_GGP - LOOKUP_GIPA(CreateStreamDescriptorSurfaceGGP, false); +#if defined(VK_USE_PLATFORM_GGP) + LOOKUP_GIPA(CreateStreamDescriptorSurfaceGGP); #endif // VK_USE_PLATFORM_GGP // ---- VK_NV_external_memory_capabilities extension commands - LOOKUP_GIPA(GetPhysicalDeviceExternalImageFormatPropertiesNV, false); + LOOKUP_GIPA(GetPhysicalDeviceExternalImageFormatPropertiesNV); // ---- VK_NN_vi_surface extension commands -#ifdef VK_USE_PLATFORM_VI_NN - LOOKUP_GIPA(CreateViSurfaceNN, false); +#if defined(VK_USE_PLATFORM_VI_NN) + LOOKUP_GIPA(CreateViSurfaceNN); #endif // VK_USE_PLATFORM_VI_NN // ---- VK_EXT_direct_mode_display extension commands - LOOKUP_GIPA(ReleaseDisplayEXT, false); + LOOKUP_GIPA(ReleaseDisplayEXT); // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT - LOOKUP_GIPA(AcquireXlibDisplayEXT, false); +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) + LOOKUP_GIPA(AcquireXlibDisplayEXT); #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT - LOOKUP_GIPA(GetRandROutputDisplayEXT, false); +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) + LOOKUP_GIPA(GetRandROutputDisplayEXT); #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT // ---- VK_EXT_display_surface_counter extension commands - LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilities2EXT, false); + LOOKUP_GIPA(GetPhysicalDeviceSurfaceCapabilities2EXT); // ---- VK_MVK_ios_surface extension commands -#ifdef VK_USE_PLATFORM_IOS_MVK - LOOKUP_GIPA(CreateIOSSurfaceMVK, false); +#if defined(VK_USE_PLATFORM_IOS_MVK) + LOOKUP_GIPA(CreateIOSSurfaceMVK); #endif // VK_USE_PLATFORM_IOS_MVK // ---- VK_MVK_macos_surface extension commands -#ifdef VK_USE_PLATFORM_MACOS_MVK - LOOKUP_GIPA(CreateMacOSSurfaceMVK, false); +#if defined(VK_USE_PLATFORM_MACOS_MVK) + LOOKUP_GIPA(CreateMacOSSurfaceMVK); #endif // VK_USE_PLATFORM_MACOS_MVK // ---- VK_EXT_debug_utils extension commands - LOOKUP_GIPA(SetDebugUtilsObjectNameEXT, false); - LOOKUP_GIPA(SetDebugUtilsObjectTagEXT, false); - LOOKUP_GIPA(QueueBeginDebugUtilsLabelEXT, false); - LOOKUP_GIPA(QueueEndDebugUtilsLabelEXT, false); - LOOKUP_GIPA(QueueInsertDebugUtilsLabelEXT, false); - LOOKUP_GIPA(CmdBeginDebugUtilsLabelEXT, false); - LOOKUP_GIPA(CmdEndDebugUtilsLabelEXT, false); - LOOKUP_GIPA(CmdInsertDebugUtilsLabelEXT, false); - LOOKUP_GIPA(CreateDebugUtilsMessengerEXT, false); - LOOKUP_GIPA(DestroyDebugUtilsMessengerEXT, false); - LOOKUP_GIPA(SubmitDebugUtilsMessageEXT, false); + LOOKUP_GIPA(CreateDebugUtilsMessengerEXT); + LOOKUP_GIPA(DestroyDebugUtilsMessengerEXT); + LOOKUP_GIPA(SubmitDebugUtilsMessageEXT); // ---- VK_EXT_sample_locations extension commands - LOOKUP_GIPA(GetPhysicalDeviceMultisamplePropertiesEXT, false); + LOOKUP_GIPA(GetPhysicalDeviceMultisamplePropertiesEXT); // ---- VK_EXT_calibrated_timestamps extension commands - LOOKUP_GIPA(GetPhysicalDeviceCalibrateableTimeDomainsEXT, false); + LOOKUP_GIPA(GetPhysicalDeviceCalibrateableTimeDomainsEXT); // ---- VK_FUCHSIA_imagepipe_surface extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA - LOOKUP_GIPA(CreateImagePipeSurfaceFUCHSIA, false); +#if defined(VK_USE_PLATFORM_FUCHSIA) + LOOKUP_GIPA(CreateImagePipeSurfaceFUCHSIA); #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_EXT_metal_surface extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT - LOOKUP_GIPA(CreateMetalSurfaceEXT, false); +#if defined(VK_USE_PLATFORM_METAL_EXT) + LOOKUP_GIPA(CreateMetalSurfaceEXT); #endif // VK_USE_PLATFORM_METAL_EXT // ---- VK_EXT_tooling_info extension commands - LOOKUP_GIPA(GetPhysicalDeviceToolPropertiesEXT, false); + LOOKUP_GIPA(GetPhysicalDeviceToolPropertiesEXT); // ---- VK_NV_cooperative_matrix extension commands - LOOKUP_GIPA(GetPhysicalDeviceCooperativeMatrixPropertiesNV, false); + LOOKUP_GIPA(GetPhysicalDeviceCooperativeMatrixPropertiesNV); // ---- VK_NV_coverage_reduction_mode extension commands - LOOKUP_GIPA(GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV, false); + LOOKUP_GIPA(GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV); // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR - LOOKUP_GIPA(GetPhysicalDeviceSurfacePresentModes2EXT, false); -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - LOOKUP_GIPA(GetDeviceGroupSurfacePresentModes2EXT, false); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + LOOKUP_GIPA(GetPhysicalDeviceSurfacePresentModes2EXT); #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_headless_surface extension commands - LOOKUP_GIPA(CreateHeadlessSurfaceEXT, false); + LOOKUP_GIPA(CreateHeadlessSurfaceEXT); // ---- VK_EXT_acquire_drm_display extension commands - LOOKUP_GIPA(AcquireDrmDisplayEXT, false); - LOOKUP_GIPA(GetDrmDisplayEXT, false); + LOOKUP_GIPA(AcquireDrmDisplayEXT); + LOOKUP_GIPA(GetDrmDisplayEXT); // ---- VK_NV_acquire_winrt_display extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR - LOOKUP_GIPA(AcquireWinrtDisplayNV, false); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + LOOKUP_GIPA(AcquireWinrtDisplayNV); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - LOOKUP_GIPA(GetWinrtDisplayNV, false); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + LOOKUP_GIPA(GetWinrtDisplayNV); #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_directfb_surface extension commands -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - LOOKUP_GIPA(CreateDirectFBSurfaceEXT, false); +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + LOOKUP_GIPA(CreateDirectFBSurfaceEXT); #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - LOOKUP_GIPA(GetPhysicalDeviceDirectFBPresentationSupportEXT, false); +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + LOOKUP_GIPA(GetPhysicalDeviceDirectFBPresentationSupportEXT); #endif // VK_USE_PLATFORM_DIRECTFB_EXT // ---- VK_QNX_screen_surface extension commands -#ifdef VK_USE_PLATFORM_SCREEN_QNX - LOOKUP_GIPA(CreateScreenSurfaceQNX, false); +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + LOOKUP_GIPA(CreateScreenSurfaceQNX); #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_SCREEN_QNX - LOOKUP_GIPA(GetPhysicalDeviceScreenPresentationSupportQNX, false); +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + LOOKUP_GIPA(GetPhysicalDeviceScreenPresentationSupportQNX); #endif // VK_USE_PLATFORM_SCREEN_QNX // ---- VK_NV_optical_flow extension commands - LOOKUP_GIPA(GetPhysicalDeviceOpticalFlowImageFormatsNV, false); + LOOKUP_GIPA(GetPhysicalDeviceOpticalFlowImageFormatsNV); // ---- VK_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS - LOOKUP_GIPA(CreateSurfaceOHOS, false); +#if defined(VK_USE_PLATFORM_OHOS) + LOOKUP_GIPA(CreateSurfaceOHOS); #endif // VK_USE_PLATFORM_OHOS +#undef LOOKUP_REQUIRED_GIPA #undef LOOKUP_GIPA return true; @@ -337,10 +328,10 @@ VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_t 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; - table->magic = DEVICE_DISP_TABLE_MAGIC_NUMBER; + 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 1_0 commands + // ---- Core Vulkan 1.0 commands table->GetDeviceProcAddr = gpa; table->DestroyDevice = (PFN_vkDestroyDevice)gpa(dev, "vkDestroyDevice"); table->GetDeviceQueue = (PFN_vkGetDeviceQueue)gpa(dev, "vkGetDeviceQueue"); @@ -463,7 +454,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_d table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass)gpa(dev, "vkCmdEndRenderPass"); table->CmdExecuteCommands = (PFN_vkCmdExecuteCommands)gpa(dev, "vkCmdExecuteCommands"); - // ---- Core 1_1 commands + // ---- Core Vulkan 1.1 commands table->BindBufferMemory2 = (PFN_vkBindBufferMemory2)gpa(dev, "vkBindBufferMemory2"); table->BindImageMemory2 = (PFN_vkBindImageMemory2)gpa(dev, "vkBindImageMemory2"); table->GetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures)gpa(dev, "vkGetDeviceGroupPeerMemoryFeatures"); @@ -481,7 +472,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_d table->UpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate)gpa(dev, "vkUpdateDescriptorSetWithTemplate"); table->GetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport)gpa(dev, "vkGetDescriptorSetLayoutSupport"); - // ---- Core 1_2 commands + // ---- Core Vulkan 1.2 commands table->CmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount)gpa(dev, "vkCmdDrawIndirectCount"); table->CmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount)gpa(dev, "vkCmdDrawIndexedIndirectCount"); table->CreateRenderPass2 = (PFN_vkCreateRenderPass2)gpa(dev, "vkCreateRenderPass2"); @@ -496,7 +487,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_d table->GetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress)gpa(dev, "vkGetBufferOpaqueCaptureAddress"); table->GetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress)gpa(dev, "vkGetDeviceMemoryOpaqueCaptureAddress"); - // ---- Core 1_3 commands + // ---- Core Vulkan 1.3 commands table->CreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot)gpa(dev, "vkCreatePrivateDataSlot"); table->DestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot)gpa(dev, "vkDestroyPrivateDataSlot"); table->SetPrivateData = (PFN_vkSetPrivateData)gpa(dev, "vkSetPrivateData"); @@ -558,41 +549,19 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gdpa(dev, "vkCreateSharedSwapchainsKHR"); // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS table->CreateVideoSessionKHR = (PFN_vkCreateVideoSessionKHR)gdpa(dev, "vkCreateVideoSessionKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->DestroyVideoSessionKHR = (PFN_vkDestroyVideoSessionKHR)gdpa(dev, "vkDestroyVideoSessionKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->GetVideoSessionMemoryRequirementsKHR = (PFN_vkGetVideoSessionMemoryRequirementsKHR)gdpa(dev, "vkGetVideoSessionMemoryRequirementsKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->BindVideoSessionMemoryKHR = (PFN_vkBindVideoSessionMemoryKHR)gdpa(dev, "vkBindVideoSessionMemoryKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->CreateVideoSessionParametersKHR = (PFN_vkCreateVideoSessionParametersKHR)gdpa(dev, "vkCreateVideoSessionParametersKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->UpdateVideoSessionParametersKHR = (PFN_vkUpdateVideoSessionParametersKHR)gdpa(dev, "vkUpdateVideoSessionParametersKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->DestroyVideoSessionParametersKHR = (PFN_vkDestroyVideoSessionParametersKHR)gdpa(dev, "vkDestroyVideoSessionParametersKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->CmdBeginVideoCodingKHR = (PFN_vkCmdBeginVideoCodingKHR)gdpa(dev, "vkCmdBeginVideoCodingKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->CmdEndVideoCodingKHR = (PFN_vkCmdEndVideoCodingKHR)gdpa(dev, "vkCmdEndVideoCodingKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->CmdControlVideoCodingKHR = (PFN_vkCmdControlVideoCodingKHR)gdpa(dev, "vkCmdControlVideoCodingKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_video_decode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS table->CmdDecodeVideoKHR = (PFN_vkCmdDecodeVideoKHR)gdpa(dev, "vkCmdDecodeVideoKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_dynamic_rendering extension commands table->CmdBeginRenderingKHR = (PFN_vkCmdBeginRenderingKHR)gdpa(dev, "vkCmdBeginRenderingKHR"); @@ -607,10 +576,10 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->TrimCommandPoolKHR = (PFN_vkTrimCommandPoolKHR)gdpa(dev, "vkTrimCommandPoolKHR"); // ---- VK_KHR_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetMemoryWin32HandleKHR = (PFN_vkGetMemoryWin32HandleKHR)gdpa(dev, "vkGetMemoryWin32HandleKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetMemoryWin32HandlePropertiesKHR = (PFN_vkGetMemoryWin32HandlePropertiesKHR)gdpa(dev, "vkGetMemoryWin32HandlePropertiesKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR @@ -619,10 +588,10 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHR)gdpa(dev, "vkGetMemoryFdPropertiesKHR"); // ---- VK_KHR_external_semaphore_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->ImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR)gdpa(dev, "vkImportSemaphoreWin32HandleKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetSemaphoreWin32HandleKHR = (PFN_vkGetSemaphoreWin32HandleKHR)gdpa(dev, "vkGetSemaphoreWin32HandleKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR @@ -649,10 +618,10 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetSwapchainStatusKHR = (PFN_vkGetSwapchainStatusKHR)gdpa(dev, "vkGetSwapchainStatusKHR"); // ---- VK_KHR_external_fence_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->ImportFenceWin32HandleKHR = (PFN_vkImportFenceWin32HandleKHR)gdpa(dev, "vkImportFenceWin32HandleKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetFenceWin32HandleKHR = (PFN_vkGetFenceWin32HandleKHR)gdpa(dev, "vkGetFenceWin32HandleKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR @@ -712,10 +681,13 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetPipelineExecutableStatisticsKHR = (PFN_vkGetPipelineExecutableStatisticsKHR)gdpa(dev, "vkGetPipelineExecutableStatisticsKHR"); table->GetPipelineExecutableInternalRepresentationsKHR = (PFN_vkGetPipelineExecutableInternalRepresentationsKHR)gdpa(dev, "vkGetPipelineExecutableInternalRepresentationsKHR"); + // ---- VK_KHR_map_memory2 extension commands + table->MapMemory2KHR = (PFN_vkMapMemory2KHR)gdpa(dev, "vkMapMemory2KHR"); + table->UnmapMemory2KHR = (PFN_vkUnmapMemory2KHR)gdpa(dev, "vkUnmapMemory2KHR"); + // ---- VK_KHR_video_encode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS + table->GetEncodedVideoSessionParametersKHR = (PFN_vkGetEncodedVideoSessionParametersKHR)gdpa(dev, "vkGetEncodedVideoSessionParametersKHR"); table->CmdEncodeVideoKHR = (PFN_vkCmdEncodeVideoKHR)gdpa(dev, "vkCmdEncodeVideoKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_synchronization2 extension commands table->CmdSetEvent2KHR = (PFN_vkCmdSetEvent2KHR)gdpa(dev, "vkCmdSetEvent2KHR"); @@ -743,6 +715,23 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetDeviceImageMemoryRequirementsKHR = (PFN_vkGetDeviceImageMemoryRequirementsKHR)gdpa(dev, "vkGetDeviceImageMemoryRequirementsKHR"); table->GetDeviceImageSparseMemoryRequirementsKHR = (PFN_vkGetDeviceImageSparseMemoryRequirementsKHR)gdpa(dev, "vkGetDeviceImageSparseMemoryRequirementsKHR"); + // ---- VK_KHR_maintenance5 extension commands + table->CmdBindIndexBuffer2KHR = (PFN_vkCmdBindIndexBuffer2KHR)gdpa(dev, "vkCmdBindIndexBuffer2KHR"); + table->GetRenderingAreaGranularityKHR = (PFN_vkGetRenderingAreaGranularityKHR)gdpa(dev, "vkGetRenderingAreaGranularityKHR"); + table->GetDeviceImageSubresourceLayoutKHR = (PFN_vkGetDeviceImageSubresourceLayoutKHR)gdpa(dev, "vkGetDeviceImageSubresourceLayoutKHR"); + table->GetImageSubresourceLayout2KHR = (PFN_vkGetImageSubresourceLayout2KHR)gdpa(dev, "vkGetImageSubresourceLayout2KHR"); + + // ---- VK_KHR_calibrated_timestamps extension commands + table->GetCalibratedTimestampsKHR = (PFN_vkGetCalibratedTimestampsKHR)gdpa(dev, "vkGetCalibratedTimestampsKHR"); + + // ---- VK_KHR_maintenance6 extension commands + table->CmdBindDescriptorSets2KHR = (PFN_vkCmdBindDescriptorSets2KHR)gdpa(dev, "vkCmdBindDescriptorSets2KHR"); + table->CmdPushConstants2KHR = (PFN_vkCmdPushConstants2KHR)gdpa(dev, "vkCmdPushConstants2KHR"); + table->CmdPushDescriptorSet2KHR = (PFN_vkCmdPushDescriptorSet2KHR)gdpa(dev, "vkCmdPushDescriptorSet2KHR"); + table->CmdPushDescriptorSetWithTemplate2KHR = (PFN_vkCmdPushDescriptorSetWithTemplate2KHR)gdpa(dev, "vkCmdPushDescriptorSetWithTemplate2KHR"); + table->CmdSetDescriptorBufferOffsets2EXT = (PFN_vkCmdSetDescriptorBufferOffsets2EXT)gdpa(dev, "vkCmdSetDescriptorBufferOffsets2EXT"); + table->CmdBindDescriptorBufferEmbeddedSamplers2EXT = (PFN_vkCmdBindDescriptorBufferEmbeddedSamplers2EXT)gdpa(dev, "vkCmdBindDescriptorBufferEmbeddedSamplers2EXT"); + // ---- VK_EXT_debug_marker extension commands table->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)gdpa(dev, "vkDebugMarkerSetObjectTagEXT"); table->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)gdpa(dev, "vkDebugMarkerSetObjectNameEXT"); @@ -777,7 +766,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetShaderInfoAMD = (PFN_vkGetShaderInfoAMD)gdpa(dev, "vkGetShaderInfoAMD"); // ---- VK_NV_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)gdpa(dev, "vkGetMemoryWin32HandleNV"); #endif // VK_USE_PLATFORM_WIN32_KHR @@ -800,6 +789,8 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo // ---- 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"); @@ -815,13 +806,36 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CmdInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT)gipa(inst, "vkCmdInsertDebugUtilsLabelEXT"); // ---- VK_ANDROID_external_memory_android_hardware_buffer extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) table->GetAndroidHardwareBufferPropertiesANDROID = (PFN_vkGetAndroidHardwareBufferPropertiesANDROID)gdpa(dev, "vkGetAndroidHardwareBufferPropertiesANDROID"); #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) table->GetMemoryAndroidHardwareBufferANDROID = (PFN_vkGetMemoryAndroidHardwareBufferANDROID)gdpa(dev, "vkGetMemoryAndroidHardwareBufferANDROID"); #endif // VK_USE_PLATFORM_ANDROID_KHR + // ---- VK_AMDX_shader_enqueue extension commands +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->CreateExecutionGraphPipelinesAMDX = (PFN_vkCreateExecutionGraphPipelinesAMDX)gdpa(dev, "vkCreateExecutionGraphPipelinesAMDX"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->GetExecutionGraphPipelineScratchSizeAMDX = (PFN_vkGetExecutionGraphPipelineScratchSizeAMDX)gdpa(dev, "vkGetExecutionGraphPipelineScratchSizeAMDX"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->GetExecutionGraphPipelineNodeIndexAMDX = (PFN_vkGetExecutionGraphPipelineNodeIndexAMDX)gdpa(dev, "vkGetExecutionGraphPipelineNodeIndexAMDX"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->CmdInitializeGraphScratchMemoryAMDX = (PFN_vkCmdInitializeGraphScratchMemoryAMDX)gdpa(dev, "vkCmdInitializeGraphScratchMemoryAMDX"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->CmdDispatchGraphAMDX = (PFN_vkCmdDispatchGraphAMDX)gdpa(dev, "vkCmdDispatchGraphAMDX"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->CmdDispatchGraphIndirectAMDX = (PFN_vkCmdDispatchGraphIndirectAMDX)gdpa(dev, "vkCmdDispatchGraphIndirectAMDX"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->CmdDispatchGraphIndirectCountAMDX = (PFN_vkCmdDispatchGraphIndirectCountAMDX)gdpa(dev, "vkCmdDispatchGraphIndirectCountAMDX"); +#endif // VK_ENABLE_BETA_EXTENSIONS + // ---- VK_EXT_sample_locations extension commands table->CmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)gdpa(dev, "vkCmdSetSampleLocationsEXT"); @@ -869,6 +883,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CmdDrawMeshTasksIndirectCountNV = (PFN_vkCmdDrawMeshTasksIndirectCountNV)gdpa(dev, "vkCmdDrawMeshTasksIndirectCountNV"); // ---- VK_NV_scissor_exclusive extension commands + table->CmdSetExclusiveScissorEnableNV = (PFN_vkCmdSetExclusiveScissorEnableNV)gdpa(dev, "vkCmdSetExclusiveScissorEnableNV"); table->CmdSetExclusiveScissorNV = (PFN_vkCmdSetExclusiveScissorNV)gdpa(dev, "vkCmdSetExclusiveScissorNV"); // ---- VK_NV_device_diagnostic_checkpoints extension commands @@ -893,13 +908,13 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetBufferDeviceAddressEXT = (PFN_vkGetBufferDeviceAddressEXT)gdpa(dev, "vkGetBufferDeviceAddressEXT"); // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->AcquireFullScreenExclusiveModeEXT = (PFN_vkAcquireFullScreenExclusiveModeEXT)gdpa(dev, "vkAcquireFullScreenExclusiveModeEXT"); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->ReleaseFullScreenExclusiveModeEXT = (PFN_vkReleaseFullScreenExclusiveModeEXT)gdpa(dev, "vkReleaseFullScreenExclusiveModeEXT"); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)gdpa(dev, "vkGetDeviceGroupSurfacePresentModes2EXT"); #endif // VK_USE_PLATFORM_WIN32_KHR @@ -923,6 +938,16 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)gdpa(dev, "vkCmdSetStencilTestEnableEXT"); table->CmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)gdpa(dev, "vkCmdSetStencilOpEXT"); + // ---- VK_EXT_host_image_copy extension commands + table->CopyMemoryToImageEXT = (PFN_vkCopyMemoryToImageEXT)gdpa(dev, "vkCopyMemoryToImageEXT"); + table->CopyImageToMemoryEXT = (PFN_vkCopyImageToMemoryEXT)gdpa(dev, "vkCopyImageToMemoryEXT"); + table->CopyImageToImageEXT = (PFN_vkCopyImageToImageEXT)gdpa(dev, "vkCopyImageToImageEXT"); + table->TransitionImageLayoutEXT = (PFN_vkTransitionImageLayoutEXT)gdpa(dev, "vkTransitionImageLayoutEXT"); + table->GetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)gdpa(dev, "vkGetImageSubresourceLayout2EXT"); + + // ---- VK_EXT_swapchain_maintenance1 extension commands + table->ReleaseSwapchainImagesEXT = (PFN_vkReleaseSwapchainImagesEXT)gdpa(dev, "vkReleaseSwapchainImagesEXT"); + // ---- VK_NV_device_generated_commands extension commands table->GetGeneratedCommandsMemoryRequirementsNV = (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)gdpa(dev, "vkGetGeneratedCommandsMemoryRequirementsNV"); table->CmdPreprocessGeneratedCommandsNV = (PFN_vkCmdPreprocessGeneratedCommandsNV)gdpa(dev, "vkCmdPreprocessGeneratedCommandsNV"); @@ -931,23 +956,44 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CreateIndirectCommandsLayoutNV = (PFN_vkCreateIndirectCommandsLayoutNV)gdpa(dev, "vkCreateIndirectCommandsLayoutNV"); table->DestroyIndirectCommandsLayoutNV = (PFN_vkDestroyIndirectCommandsLayoutNV)gdpa(dev, "vkDestroyIndirectCommandsLayoutNV"); + // ---- VK_EXT_depth_bias_control extension commands + table->CmdSetDepthBias2EXT = (PFN_vkCmdSetDepthBias2EXT)gdpa(dev, "vkCmdSetDepthBias2EXT"); + // ---- VK_EXT_private_data extension commands table->CreatePrivateDataSlotEXT = (PFN_vkCreatePrivateDataSlotEXT)gdpa(dev, "vkCreatePrivateDataSlotEXT"); table->DestroyPrivateDataSlotEXT = (PFN_vkDestroyPrivateDataSlotEXT)gdpa(dev, "vkDestroyPrivateDataSlotEXT"); table->SetPrivateDataEXT = (PFN_vkSetPrivateDataEXT)gdpa(dev, "vkSetPrivateDataEXT"); table->GetPrivateDataEXT = (PFN_vkGetPrivateDataEXT)gdpa(dev, "vkGetPrivateDataEXT"); + // ---- VK_NV_cuda_kernel_launch extension commands + table->CreateCudaModuleNV = (PFN_vkCreateCudaModuleNV)gdpa(dev, "vkCreateCudaModuleNV"); + table->GetCudaModuleCacheNV = (PFN_vkGetCudaModuleCacheNV)gdpa(dev, "vkGetCudaModuleCacheNV"); + table->CreateCudaFunctionNV = (PFN_vkCreateCudaFunctionNV)gdpa(dev, "vkCreateCudaFunctionNV"); + table->DestroyCudaModuleNV = (PFN_vkDestroyCudaModuleNV)gdpa(dev, "vkDestroyCudaModuleNV"); + table->DestroyCudaFunctionNV = (PFN_vkDestroyCudaFunctionNV)gdpa(dev, "vkDestroyCudaFunctionNV"); + table->CmdCudaLaunchKernelNV = (PFN_vkCmdCudaLaunchKernelNV)gdpa(dev, "vkCmdCudaLaunchKernelNV"); + // ---- VK_EXT_metal_objects extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) table->ExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT)gdpa(dev, "vkExportMetalObjectsEXT"); #endif // VK_USE_PLATFORM_METAL_EXT + // ---- VK_EXT_descriptor_buffer extension commands + table->GetDescriptorSetLayoutSizeEXT = (PFN_vkGetDescriptorSetLayoutSizeEXT)gdpa(dev, "vkGetDescriptorSetLayoutSizeEXT"); + table->GetDescriptorSetLayoutBindingOffsetEXT = (PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)gdpa(dev, "vkGetDescriptorSetLayoutBindingOffsetEXT"); + table->GetDescriptorEXT = (PFN_vkGetDescriptorEXT)gdpa(dev, "vkGetDescriptorEXT"); + table->CmdBindDescriptorBuffersEXT = (PFN_vkCmdBindDescriptorBuffersEXT)gdpa(dev, "vkCmdBindDescriptorBuffersEXT"); + table->CmdSetDescriptorBufferOffsetsEXT = (PFN_vkCmdSetDescriptorBufferOffsetsEXT)gdpa(dev, "vkCmdSetDescriptorBufferOffsetsEXT"); + table->CmdBindDescriptorBufferEmbeddedSamplersEXT = (PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)gdpa(dev, "vkCmdBindDescriptorBufferEmbeddedSamplersEXT"); + table->GetBufferOpaqueCaptureDescriptorDataEXT = (PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)gdpa(dev, "vkGetBufferOpaqueCaptureDescriptorDataEXT"); + table->GetImageOpaqueCaptureDescriptorDataEXT = (PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)gdpa(dev, "vkGetImageOpaqueCaptureDescriptorDataEXT"); + table->GetImageViewOpaqueCaptureDescriptorDataEXT = (PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)gdpa(dev, "vkGetImageViewOpaqueCaptureDescriptorDataEXT"); + table->GetSamplerOpaqueCaptureDescriptorDataEXT = (PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)gdpa(dev, "vkGetSamplerOpaqueCaptureDescriptorDataEXT"); + table->GetAccelerationStructureOpaqueCaptureDescriptorDataEXT = (PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)gdpa(dev, "vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT"); + // ---- VK_NV_fragment_shading_rate_enums extension commands table->CmdSetFragmentShadingRateEnumNV = (PFN_vkCmdSetFragmentShadingRateEnumNV)gdpa(dev, "vkCmdSetFragmentShadingRateEnumNV"); - // ---- VK_EXT_image_compression_control extension commands - table->GetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)gdpa(dev, "vkGetImageSubresourceLayout2EXT"); - // ---- VK_EXT_device_fault extension commands table->GetDeviceFaultInfoEXT = (PFN_vkGetDeviceFaultInfoEXT)gdpa(dev, "vkGetDeviceFaultInfoEXT"); @@ -955,35 +1001,35 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)gdpa(dev, "vkCmdSetVertexInputEXT"); // ---- VK_FUCHSIA_external_memory extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->GetMemoryZirconHandleFUCHSIA = (PFN_vkGetMemoryZirconHandleFUCHSIA)gdpa(dev, "vkGetMemoryZirconHandleFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->GetMemoryZirconHandlePropertiesFUCHSIA = (PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)gdpa(dev, "vkGetMemoryZirconHandlePropertiesFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_external_semaphore extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->ImportSemaphoreZirconHandleFUCHSIA = (PFN_vkImportSemaphoreZirconHandleFUCHSIA)gdpa(dev, "vkImportSemaphoreZirconHandleFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->GetSemaphoreZirconHandleFUCHSIA = (PFN_vkGetSemaphoreZirconHandleFUCHSIA)gdpa(dev, "vkGetSemaphoreZirconHandleFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_buffer_collection extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->CreateBufferCollectionFUCHSIA = (PFN_vkCreateBufferCollectionFUCHSIA)gdpa(dev, "vkCreateBufferCollectionFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->SetBufferCollectionImageConstraintsFUCHSIA = (PFN_vkSetBufferCollectionImageConstraintsFUCHSIA)gdpa(dev, "vkSetBufferCollectionImageConstraintsFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->SetBufferCollectionBufferConstraintsFUCHSIA = (PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA)gdpa(dev, "vkSetBufferCollectionBufferConstraintsFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->DestroyBufferCollectionFUCHSIA = (PFN_vkDestroyBufferCollectionFUCHSIA)gdpa(dev, "vkDestroyBufferCollectionFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->GetBufferCollectionPropertiesFUCHSIA = (PFN_vkGetBufferCollectionPropertiesFUCHSIA)gdpa(dev, "vkGetBufferCollectionPropertiesFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA @@ -1030,6 +1076,10 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetDeviceMicromapCompatibilityEXT = (PFN_vkGetDeviceMicromapCompatibilityEXT)gdpa(dev, "vkGetDeviceMicromapCompatibilityEXT"); table->GetMicromapBuildSizesEXT = (PFN_vkGetMicromapBuildSizesEXT)gdpa(dev, "vkGetMicromapBuildSizesEXT"); + // ---- VK_HUAWEI_cluster_culling_shader extension commands + table->CmdDrawClusterHUAWEI = (PFN_vkCmdDrawClusterHUAWEI)gdpa(dev, "vkCmdDrawClusterHUAWEI"); + table->CmdDrawClusterIndirectHUAWEI = (PFN_vkCmdDrawClusterIndirectHUAWEI)gdpa(dev, "vkCmdDrawClusterIndirectHUAWEI"); + // ---- VK_EXT_pageable_device_local_memory extension commands table->SetDeviceMemoryPriorityEXT = (PFN_vkSetDeviceMemoryPriorityEXT)gdpa(dev, "vkSetDeviceMemoryPriorityEXT"); @@ -1037,6 +1087,19 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetDescriptorSetLayoutHostMappingInfoVALVE = (PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE)gdpa(dev, "vkGetDescriptorSetLayoutHostMappingInfoVALVE"); table->GetDescriptorSetHostMappingVALVE = (PFN_vkGetDescriptorSetHostMappingVALVE)gdpa(dev, "vkGetDescriptorSetHostMappingVALVE"); + // ---- VK_NV_copy_memory_indirect extension commands + table->CmdCopyMemoryIndirectNV = (PFN_vkCmdCopyMemoryIndirectNV)gdpa(dev, "vkCmdCopyMemoryIndirectNV"); + table->CmdCopyMemoryToImageIndirectNV = (PFN_vkCmdCopyMemoryToImageIndirectNV)gdpa(dev, "vkCmdCopyMemoryToImageIndirectNV"); + + // ---- VK_NV_memory_decompression extension commands + table->CmdDecompressMemoryNV = (PFN_vkCmdDecompressMemoryNV)gdpa(dev, "vkCmdDecompressMemoryNV"); + table->CmdDecompressMemoryIndirectCountNV = (PFN_vkCmdDecompressMemoryIndirectCountNV)gdpa(dev, "vkCmdDecompressMemoryIndirectCountNV"); + + // ---- VK_NV_device_generated_commands_compute extension commands + table->GetPipelineIndirectMemoryRequirementsNV = (PFN_vkGetPipelineIndirectMemoryRequirementsNV)gdpa(dev, "vkGetPipelineIndirectMemoryRequirementsNV"); + table->CmdUpdatePipelineIndirectBufferNV = (PFN_vkCmdUpdatePipelineIndirectBufferNV)gdpa(dev, "vkCmdUpdatePipelineIndirectBufferNV"); + table->GetPipelineIndirectDeviceAddressNV = (PFN_vkGetPipelineIndirectDeviceAddressNV)gdpa(dev, "vkGetPipelineIndirectDeviceAddressNV"); + // ---- VK_EXT_extended_dynamic_state3 extension commands table->CmdSetTessellationDomainOriginEXT = (PFN_vkCmdSetTessellationDomainOriginEXT)gdpa(dev, "vkCmdSetTessellationDomainOriginEXT"); table->CmdSetDepthClampEnableEXT = (PFN_vkCmdSetDepthClampEnableEXT)gdpa(dev, "vkCmdSetDepthClampEnableEXT"); @@ -1080,28 +1143,30 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->BindOpticalFlowSessionImageNV = (PFN_vkBindOpticalFlowSessionImageNV)gdpa(dev, "vkBindOpticalFlowSessionImageNV"); table->CmdOpticalFlowExecuteNV = (PFN_vkCmdOpticalFlowExecuteNV)gdpa(dev, "vkCmdOpticalFlowExecuteNV"); + // ---- VK_EXT_shader_object extension commands + table->CreateShadersEXT = (PFN_vkCreateShadersEXT)gdpa(dev, "vkCreateShadersEXT"); + table->DestroyShaderEXT = (PFN_vkDestroyShaderEXT)gdpa(dev, "vkDestroyShaderEXT"); + table->GetShaderBinaryDataEXT = (PFN_vkGetShaderBinaryDataEXT)gdpa(dev, "vkGetShaderBinaryDataEXT"); + table->CmdBindShadersEXT = (PFN_vkCmdBindShadersEXT)gdpa(dev, "vkCmdBindShadersEXT"); + // ---- VK_QCOM_tile_properties extension commands table->GetFramebufferTilePropertiesQCOM = (PFN_vkGetFramebufferTilePropertiesQCOM)gdpa(dev, "vkGetFramebufferTilePropertiesQCOM"); table->GetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM)gdpa(dev, "vkGetDynamicRenderingTilePropertiesQCOM"); - // ---- VK_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS - table->GetSwapchainGrallocUsageOHOS = (PFN_vkGetSwapchainGrallocUsageOHOS)gdpa(dev, "vkGetSwapchainGrallocUsageOHOS"); -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - table->AcquireImageOHOS = (PFN_vkAcquireImageOHOS)gdpa(dev, "vkAcquireImageOHOS"); -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - table->QueueSignalReleaseImageOHOS = (PFN_vkQueueSignalReleaseImageOHOS)gdpa(dev, "vkQueueSignalReleaseImageOHOS"); -#endif // VK_USE_PLATFORM_OHOS + // ---- VK_NV_low_latency2 extension commands + table->SetLatencySleepModeNV = (PFN_vkSetLatencySleepModeNV)gdpa(dev, "vkSetLatencySleepModeNV"); + table->LatencySleepNV = (PFN_vkLatencySleepNV)gdpa(dev, "vkLatencySleepNV"); + table->SetLatencyMarkerNV = (PFN_vkSetLatencyMarkerNV)gdpa(dev, "vkSetLatencyMarkerNV"); + table->GetLatencyTimingsNV = (PFN_vkGetLatencyTimingsNV)gdpa(dev, "vkGetLatencyTimingsNV"); + table->QueueNotifyOutOfBandNV = (PFN_vkQueueNotifyOutOfBandNV)gdpa(dev, "vkQueueNotifyOutOfBandNV"); - // ---- VK_OHOS_external_memory extension commands -#ifdef VK_USE_PLATFORM_OHOS - table->GetNativeBufferPropertiesOHOS = (PFN_vkGetNativeBufferPropertiesOHOS)gdpa(dev, "vkGetNativeBufferPropertiesOHOS"); -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - table->GetMemoryNativeBufferOHOS = (PFN_vkGetMemoryNativeBufferOHOS)gdpa(dev, "vkGetMemoryNativeBufferOHOS"); -#endif // VK_USE_PLATFORM_OHOS + // ---- VK_EXT_attachment_feedback_loop_dynamic_state extension commands + table->CmdSetAttachmentFeedbackLoopEnableEXT = (PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)gdpa(dev, "vkCmdSetAttachmentFeedbackLoopEnableEXT"); + + // ---- 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 // ---- VK_KHR_acceleration_structure extension commands table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)gdpa(dev, "vkCreateAccelerationStructureKHR"); @@ -1133,13 +1198,32 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT)gdpa(dev, "vkCmdDrawMeshTasksEXT"); table->CmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)gdpa(dev, "vkCmdDrawMeshTasksIndirectEXT"); table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)gdpa(dev, "vkCmdDrawMeshTasksIndirectCountEXT"); + + // ---- VK_OHOS_native_buffer extension commands +#if defined(VK_USE_PLATFORM_OHOS) + table->GetSwapchainGrallocUsageOHOS = (PFN_vkGetSwapchainGrallocUsageOHOS)gdpa(dev, "vkGetSwapchainGrallocUsageOHOS"); +#endif // VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) + table->AcquireImageOHOS = (PFN_vkAcquireImageOHOS)gdpa(dev, "vkAcquireImageOHOS"); +#endif // VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) + table->QueueSignalReleaseImageOHOS = (PFN_vkQueueSignalReleaseImageOHOS)gdpa(dev, "vkQueueSignalReleaseImageOHOS"); +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#if defined(VK_USE_PLATFORM_OHOS) + table->GetNativeBufferPropertiesOHOS = (PFN_vkGetNativeBufferPropertiesOHOS)gdpa(dev, "vkGetNativeBufferPropertiesOHOS"); +#endif // VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) + table->GetMemoryNativeBufferOHOS = (PFN_vkGetMemoryNativeBufferOHOS)gdpa(dev, "vkGetMemoryNativeBufferOHOS"); +#endif // VK_USE_PLATFORM_OHOS } // 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 1_0 commands + // ---- Core Vulkan 1.0 commands table->DestroyInstance = (PFN_vkDestroyInstance)gpa(inst, "vkDestroyInstance"); table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices)gpa(inst, "vkEnumeratePhysicalDevices"); table->GetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures)gpa(inst, "vkGetPhysicalDeviceFeatures"); @@ -1153,7 +1237,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInsta table->EnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties)gpa(inst, "vkEnumerateDeviceLayerProperties"); table->GetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties)gpa(inst, "vkGetPhysicalDeviceSparseImageFormatProperties"); - // ---- Core 1_1 commands + // ---- Core Vulkan 1.1 commands table->EnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups)gpa(inst, "vkEnumeratePhysicalDeviceGroups"); table->GetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2)gpa(inst, "vkGetPhysicalDeviceFeatures2"); table->GetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2)gpa(inst, "vkGetPhysicalDeviceProperties2"); @@ -1166,7 +1250,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInsta table->GetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties)gpa(inst, "vkGetPhysicalDeviceExternalFenceProperties"); table->GetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)gpa(inst, "vkGetPhysicalDeviceExternalSemaphoreProperties"); - // ---- Core 1_3 commands + // ---- Core Vulkan 1.3 commands table->GetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties)gpa(inst, "vkGetPhysicalDeviceToolProperties"); } @@ -1194,49 +1278,45 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->CreateDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR)gpa(inst, "vkCreateDisplayPlaneSurfaceKHR"); // ---- VK_KHR_xlib_surface extension commands -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) table->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(inst, "vkCreateXlibSurfaceKHR"); #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) table->GetPhysicalDeviceXlibPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); #endif // VK_USE_PLATFORM_XLIB_KHR // ---- VK_KHR_xcb_surface extension commands -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) table->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(inst, "vkCreateXcbSurfaceKHR"); #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) table->GetPhysicalDeviceXcbPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); #endif // VK_USE_PLATFORM_XCB_KHR // ---- VK_KHR_wayland_surface extension commands -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) table->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(inst, "vkCreateWaylandSurfaceKHR"); #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) table->GetPhysicalDeviceWaylandPresentationSupportKHR = (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); #endif // VK_USE_PLATFORM_WAYLAND_KHR // ---- VK_KHR_android_surface extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) table->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa(inst, "vkCreateAndroidSurfaceKHR"); #endif // VK_USE_PLATFORM_ANDROID_KHR // ---- VK_KHR_win32_surface extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(inst, "vkCreateWin32SurfaceKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetPhysicalDeviceWin32PresentationSupportKHR = (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS table->GetPhysicalDeviceVideoCapabilitiesKHR = (PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)gpa(inst, "vkGetPhysicalDeviceVideoCapabilitiesKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS table->GetPhysicalDeviceVideoFormatPropertiesKHR = (PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)gpa(inst, "vkGetPhysicalDeviceVideoFormatPropertiesKHR"); -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_get_physical_device_properties2 extension commands table->GetPhysicalDeviceFeatures2KHR = (PFN_vkGetPhysicalDeviceFeatures2KHR)gpa(inst, "vkGetPhysicalDeviceFeatures2KHR"); @@ -1276,13 +1356,22 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer // ---- VK_KHR_fragment_shading_rate extension commands table->GetPhysicalDeviceFragmentShadingRatesKHR = (PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR)gpa(inst, "vkGetPhysicalDeviceFragmentShadingRatesKHR"); + // ---- VK_KHR_video_encode_queue extension commands + table->GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR = (PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR)gpa(inst, "vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR"); + + // ---- VK_KHR_cooperative_matrix extension commands + table->GetPhysicalDeviceCooperativeMatrixPropertiesKHR = (PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR)gpa(inst, "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR"); + + // ---- VK_KHR_calibrated_timestamps extension commands + table->GetPhysicalDeviceCalibrateableTimeDomainsKHR = (PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR)gpa(inst, "vkGetPhysicalDeviceCalibrateableTimeDomainsKHR"); + // ---- VK_EXT_debug_report extension commands table->CreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)gpa(inst, "vkCreateDebugReportCallbackEXT"); table->DestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)gpa(inst, "vkDestroyDebugReportCallbackEXT"); table->DebugReportMessageEXT = (PFN_vkDebugReportMessageEXT)gpa(inst, "vkDebugReportMessageEXT"); // ---- VK_GGP_stream_descriptor_surface extension commands -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) table->CreateStreamDescriptorSurfaceGGP = (PFN_vkCreateStreamDescriptorSurfaceGGP)gpa(inst, "vkCreateStreamDescriptorSurfaceGGP"); #endif // VK_USE_PLATFORM_GGP @@ -1290,7 +1379,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->GetPhysicalDeviceExternalImageFormatPropertiesNV = (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)gpa(inst, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"); // ---- VK_NN_vi_surface extension commands -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) table->CreateViSurfaceNN = (PFN_vkCreateViSurfaceNN)gpa(inst, "vkCreateViSurfaceNN"); #endif // VK_USE_PLATFORM_VI_NN @@ -1298,10 +1387,10 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->ReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT)gpa(inst, "vkReleaseDisplayEXT"); // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) table->AcquireXlibDisplayEXT = (PFN_vkAcquireXlibDisplayEXT)gpa(inst, "vkAcquireXlibDisplayEXT"); #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) table->GetRandROutputDisplayEXT = (PFN_vkGetRandROutputDisplayEXT)gpa(inst, "vkGetRandROutputDisplayEXT"); #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT @@ -1309,12 +1398,12 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->GetPhysicalDeviceSurfaceCapabilities2EXT = (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)gpa(inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); // ---- VK_MVK_ios_surface extension commands -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) table->CreateIOSSurfaceMVK = (PFN_vkCreateIOSSurfaceMVK)gpa(inst, "vkCreateIOSSurfaceMVK"); #endif // VK_USE_PLATFORM_IOS_MVK // ---- VK_MVK_macos_surface extension commands -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) table->CreateMacOSSurfaceMVK = (PFN_vkCreateMacOSSurfaceMVK)gpa(inst, "vkCreateMacOSSurfaceMVK"); #endif // VK_USE_PLATFORM_MACOS_MVK @@ -1330,12 +1419,12 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->GetPhysicalDeviceCalibrateableTimeDomainsEXT = (PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT)gpa(inst, "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT"); // ---- VK_FUCHSIA_imagepipe_surface extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) table->CreateImagePipeSurfaceFUCHSIA = (PFN_vkCreateImagePipeSurfaceFUCHSIA)gpa(inst, "vkCreateImagePipeSurfaceFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_EXT_metal_surface extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) table->CreateMetalSurfaceEXT = (PFN_vkCreateMetalSurfaceEXT)gpa(inst, "vkCreateMetalSurfaceEXT"); #endif // VK_USE_PLATFORM_METAL_EXT @@ -1349,7 +1438,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV = (PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)gpa(inst, "vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV"); // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetPhysicalDeviceSurfacePresentModes2EXT = (PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT)gpa(inst, "vkGetPhysicalDeviceSurfacePresentModes2EXT"); #endif // VK_USE_PLATFORM_WIN32_KHR @@ -1361,410 +1450,1015 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->GetDrmDisplayEXT = (PFN_vkGetDrmDisplayEXT)gpa(inst, "vkGetDrmDisplayEXT"); // ---- VK_NV_acquire_winrt_display extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->AcquireWinrtDisplayNV = (PFN_vkAcquireWinrtDisplayNV)gpa(inst, "vkAcquireWinrtDisplayNV"); #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) table->GetWinrtDisplayNV = (PFN_vkGetWinrtDisplayNV)gpa(inst, "vkGetWinrtDisplayNV"); #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_directfb_surface extension commands -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) table->CreateDirectFBSurfaceEXT = (PFN_vkCreateDirectFBSurfaceEXT)gpa(inst, "vkCreateDirectFBSurfaceEXT"); #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) table->GetPhysicalDeviceDirectFBPresentationSupportEXT = (PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)gpa(inst, "vkGetPhysicalDeviceDirectFBPresentationSupportEXT"); #endif // VK_USE_PLATFORM_DIRECTFB_EXT // ---- VK_QNX_screen_surface extension commands -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) table->CreateScreenSurfaceQNX = (PFN_vkCreateScreenSurfaceQNX)gpa(inst, "vkCreateScreenSurfaceQNX"); #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) table->GetPhysicalDeviceScreenPresentationSupportQNX = (PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)gpa(inst, "vkGetPhysicalDeviceScreenPresentationSupportQNX"); #endif // VK_USE_PLATFORM_SCREEN_QNX // ---- VK_NV_optical_flow extension commands table->GetPhysicalDeviceOpticalFlowImageFormatsNV = (PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)gpa(inst, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); - // ---- VK_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) table->CreateSurfaceOHOS = (PFN_vkCreateSurfaceOHOS)gpa(inst, "vkCreateSurfaceOHOS"); #endif // VK_USE_PLATFORM_OHOS } -// Device command lookup function -VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name) { - if (!name || name[0] != 'v' || name[1] != 'k') return NULL; - - name += 2; - - // ---- Core 1_0 commands - if (!strcmp(name, "GetDeviceProcAddr")) return (void *)table->GetDeviceProcAddr; - if (!strcmp(name, "DestroyDevice")) return (void *)table->DestroyDevice; - if (!strcmp(name, "GetDeviceQueue")) return (void *)table->GetDeviceQueue; - if (!strcmp(name, "QueueSubmit")) return (void *)table->QueueSubmit; - if (!strcmp(name, "QueueWaitIdle")) return (void *)table->QueueWaitIdle; - if (!strcmp(name, "DeviceWaitIdle")) return (void *)table->DeviceWaitIdle; - if (!strcmp(name, "AllocateMemory")) return (void *)table->AllocateMemory; - if (!strcmp(name, "FreeMemory")) return (void *)table->FreeMemory; - if (!strcmp(name, "MapMemory")) return (void *)table->MapMemory; - if (!strcmp(name, "UnmapMemory")) return (void *)table->UnmapMemory; - if (!strcmp(name, "FlushMappedMemoryRanges")) return (void *)table->FlushMappedMemoryRanges; - if (!strcmp(name, "InvalidateMappedMemoryRanges")) return (void *)table->InvalidateMappedMemoryRanges; - if (!strcmp(name, "GetDeviceMemoryCommitment")) return (void *)table->GetDeviceMemoryCommitment; - if (!strcmp(name, "BindBufferMemory")) return (void *)table->BindBufferMemory; - if (!strcmp(name, "BindImageMemory")) return (void *)table->BindImageMemory; - if (!strcmp(name, "GetBufferMemoryRequirements")) return (void *)table->GetBufferMemoryRequirements; - if (!strcmp(name, "GetImageMemoryRequirements")) return (void *)table->GetImageMemoryRequirements; - if (!strcmp(name, "GetImageSparseMemoryRequirements")) return (void *)table->GetImageSparseMemoryRequirements; - if (!strcmp(name, "QueueBindSparse")) return (void *)table->QueueBindSparse; - if (!strcmp(name, "CreateFence")) return (void *)table->CreateFence; - if (!strcmp(name, "DestroyFence")) return (void *)table->DestroyFence; - if (!strcmp(name, "ResetFences")) return (void *)table->ResetFences; - if (!strcmp(name, "GetFenceStatus")) return (void *)table->GetFenceStatus; - if (!strcmp(name, "WaitForFences")) return (void *)table->WaitForFences; - if (!strcmp(name, "CreateSemaphore")) return (void *)table->CreateSemaphore; - if (!strcmp(name, "DestroySemaphore")) return (void *)table->DestroySemaphore; - if (!strcmp(name, "CreateEvent")) return (void *)table->CreateEvent; - if (!strcmp(name, "DestroyEvent")) return (void *)table->DestroyEvent; - if (!strcmp(name, "GetEventStatus")) return (void *)table->GetEventStatus; - if (!strcmp(name, "SetEvent")) return (void *)table->SetEvent; - if (!strcmp(name, "ResetEvent")) return (void *)table->ResetEvent; - if (!strcmp(name, "CreateQueryPool")) return (void *)table->CreateQueryPool; - if (!strcmp(name, "DestroyQueryPool")) return (void *)table->DestroyQueryPool; - if (!strcmp(name, "GetQueryPoolResults")) return (void *)table->GetQueryPoolResults; - if (!strcmp(name, "CreateBuffer")) return (void *)table->CreateBuffer; - if (!strcmp(name, "DestroyBuffer")) return (void *)table->DestroyBuffer; - if (!strcmp(name, "CreateBufferView")) return (void *)table->CreateBufferView; - if (!strcmp(name, "DestroyBufferView")) return (void *)table->DestroyBufferView; - if (!strcmp(name, "CreateImage")) return (void *)table->CreateImage; - if (!strcmp(name, "DestroyImage")) return (void *)table->DestroyImage; - if (!strcmp(name, "GetImageSubresourceLayout")) return (void *)table->GetImageSubresourceLayout; - if (!strcmp(name, "CreateImageView")) return (void *)table->CreateImageView; - if (!strcmp(name, "DestroyImageView")) return (void *)table->DestroyImageView; - if (!strcmp(name, "CreateShaderModule")) return (void *)table->CreateShaderModule; - if (!strcmp(name, "DestroyShaderModule")) return (void *)table->DestroyShaderModule; - if (!strcmp(name, "CreatePipelineCache")) return (void *)table->CreatePipelineCache; - if (!strcmp(name, "DestroyPipelineCache")) return (void *)table->DestroyPipelineCache; - if (!strcmp(name, "GetPipelineCacheData")) return (void *)table->GetPipelineCacheData; - if (!strcmp(name, "MergePipelineCaches")) return (void *)table->MergePipelineCaches; - if (!strcmp(name, "CreateGraphicsPipelines")) return (void *)table->CreateGraphicsPipelines; - if (!strcmp(name, "CreateComputePipelines")) return (void *)table->CreateComputePipelines; - if (!strcmp(name, "DestroyPipeline")) return (void *)table->DestroyPipeline; - if (!strcmp(name, "CreatePipelineLayout")) return (void *)table->CreatePipelineLayout; - if (!strcmp(name, "DestroyPipelineLayout")) return (void *)table->DestroyPipelineLayout; - if (!strcmp(name, "CreateSampler")) return (void *)table->CreateSampler; - if (!strcmp(name, "DestroySampler")) return (void *)table->DestroySampler; - if (!strcmp(name, "CreateDescriptorSetLayout")) return (void *)table->CreateDescriptorSetLayout; - if (!strcmp(name, "DestroyDescriptorSetLayout")) return (void *)table->DestroyDescriptorSetLayout; - if (!strcmp(name, "CreateDescriptorPool")) return (void *)table->CreateDescriptorPool; - if (!strcmp(name, "DestroyDescriptorPool")) return (void *)table->DestroyDescriptorPool; - if (!strcmp(name, "ResetDescriptorPool")) return (void *)table->ResetDescriptorPool; - if (!strcmp(name, "AllocateDescriptorSets")) return (void *)table->AllocateDescriptorSets; - if (!strcmp(name, "FreeDescriptorSets")) return (void *)table->FreeDescriptorSets; - if (!strcmp(name, "UpdateDescriptorSets")) return (void *)table->UpdateDescriptorSets; - if (!strcmp(name, "CreateFramebuffer")) return (void *)table->CreateFramebuffer; - if (!strcmp(name, "DestroyFramebuffer")) return (void *)table->DestroyFramebuffer; - if (!strcmp(name, "CreateRenderPass")) return (void *)table->CreateRenderPass; - if (!strcmp(name, "DestroyRenderPass")) return (void *)table->DestroyRenderPass; - if (!strcmp(name, "GetRenderAreaGranularity")) return (void *)table->GetRenderAreaGranularity; - if (!strcmp(name, "CreateCommandPool")) return (void *)table->CreateCommandPool; - if (!strcmp(name, "DestroyCommandPool")) return (void *)table->DestroyCommandPool; - if (!strcmp(name, "ResetCommandPool")) return (void *)table->ResetCommandPool; - if (!strcmp(name, "AllocateCommandBuffers")) return (void *)table->AllocateCommandBuffers; - if (!strcmp(name, "FreeCommandBuffers")) return (void *)table->FreeCommandBuffers; - if (!strcmp(name, "BeginCommandBuffer")) return (void *)table->BeginCommandBuffer; - if (!strcmp(name, "EndCommandBuffer")) return (void *)table->EndCommandBuffer; - if (!strcmp(name, "ResetCommandBuffer")) return (void *)table->ResetCommandBuffer; - if (!strcmp(name, "CmdBindPipeline")) return (void *)table->CmdBindPipeline; - if (!strcmp(name, "CmdSetViewport")) return (void *)table->CmdSetViewport; - if (!strcmp(name, "CmdSetScissor")) return (void *)table->CmdSetScissor; - if (!strcmp(name, "CmdSetLineWidth")) return (void *)table->CmdSetLineWidth; - if (!strcmp(name, "CmdSetDepthBias")) return (void *)table->CmdSetDepthBias; - if (!strcmp(name, "CmdSetBlendConstants")) return (void *)table->CmdSetBlendConstants; - if (!strcmp(name, "CmdSetDepthBounds")) return (void *)table->CmdSetDepthBounds; - if (!strcmp(name, "CmdSetStencilCompareMask")) return (void *)table->CmdSetStencilCompareMask; - if (!strcmp(name, "CmdSetStencilWriteMask")) return (void *)table->CmdSetStencilWriteMask; - if (!strcmp(name, "CmdSetStencilReference")) return (void *)table->CmdSetStencilReference; - if (!strcmp(name, "CmdBindDescriptorSets")) return (void *)table->CmdBindDescriptorSets; - if (!strcmp(name, "CmdBindIndexBuffer")) return (void *)table->CmdBindIndexBuffer; - if (!strcmp(name, "CmdBindVertexBuffers")) return (void *)table->CmdBindVertexBuffers; - if (!strcmp(name, "CmdDraw")) return (void *)table->CmdDraw; - if (!strcmp(name, "CmdDrawIndexed")) return (void *)table->CmdDrawIndexed; - if (!strcmp(name, "CmdDrawIndirect")) return (void *)table->CmdDrawIndirect; - if (!strcmp(name, "CmdDrawIndexedIndirect")) return (void *)table->CmdDrawIndexedIndirect; - if (!strcmp(name, "CmdDispatch")) return (void *)table->CmdDispatch; - if (!strcmp(name, "CmdDispatchIndirect")) return (void *)table->CmdDispatchIndirect; - if (!strcmp(name, "CmdCopyBuffer")) return (void *)table->CmdCopyBuffer; - if (!strcmp(name, "CmdCopyImage")) return (void *)table->CmdCopyImage; - if (!strcmp(name, "CmdBlitImage")) return (void *)table->CmdBlitImage; - if (!strcmp(name, "CmdCopyBufferToImage")) return (void *)table->CmdCopyBufferToImage; - if (!strcmp(name, "CmdCopyImageToBuffer")) return (void *)table->CmdCopyImageToBuffer; - if (!strcmp(name, "CmdUpdateBuffer")) return (void *)table->CmdUpdateBuffer; - if (!strcmp(name, "CmdFillBuffer")) return (void *)table->CmdFillBuffer; - if (!strcmp(name, "CmdClearColorImage")) return (void *)table->CmdClearColorImage; - if (!strcmp(name, "CmdClearDepthStencilImage")) return (void *)table->CmdClearDepthStencilImage; - if (!strcmp(name, "CmdClearAttachments")) return (void *)table->CmdClearAttachments; - if (!strcmp(name, "CmdResolveImage")) return (void *)table->CmdResolveImage; - if (!strcmp(name, "CmdSetEvent")) return (void *)table->CmdSetEvent; - if (!strcmp(name, "CmdResetEvent")) return (void *)table->CmdResetEvent; - if (!strcmp(name, "CmdWaitEvents")) return (void *)table->CmdWaitEvents; - if (!strcmp(name, "CmdPipelineBarrier")) return (void *)table->CmdPipelineBarrier; - if (!strcmp(name, "CmdBeginQuery")) return (void *)table->CmdBeginQuery; - if (!strcmp(name, "CmdEndQuery")) return (void *)table->CmdEndQuery; - if (!strcmp(name, "CmdResetQueryPool")) return (void *)table->CmdResetQueryPool; - if (!strcmp(name, "CmdWriteTimestamp")) return (void *)table->CmdWriteTimestamp; - if (!strcmp(name, "CmdCopyQueryPoolResults")) return (void *)table->CmdCopyQueryPoolResults; - if (!strcmp(name, "CmdPushConstants")) return (void *)table->CmdPushConstants; - if (!strcmp(name, "CmdBeginRenderPass")) return (void *)table->CmdBeginRenderPass; - if (!strcmp(name, "CmdNextSubpass")) return (void *)table->CmdNextSubpass; - if (!strcmp(name, "CmdEndRenderPass")) return (void *)table->CmdEndRenderPass; - if (!strcmp(name, "CmdExecuteCommands")) return (void *)table->CmdExecuteCommands; - - // ---- Core 1_1 commands - if (!strcmp(name, "BindBufferMemory2")) return (void *)table->BindBufferMemory2; - if (!strcmp(name, "BindImageMemory2")) return (void *)table->BindImageMemory2; - if (!strcmp(name, "GetDeviceGroupPeerMemoryFeatures")) return (void *)table->GetDeviceGroupPeerMemoryFeatures; - if (!strcmp(name, "CmdSetDeviceMask")) return (void *)table->CmdSetDeviceMask; - if (!strcmp(name, "CmdDispatchBase")) return (void *)table->CmdDispatchBase; - if (!strcmp(name, "GetImageMemoryRequirements2")) return (void *)table->GetImageMemoryRequirements2; - if (!strcmp(name, "GetBufferMemoryRequirements2")) return (void *)table->GetBufferMemoryRequirements2; - if (!strcmp(name, "GetImageSparseMemoryRequirements2")) return (void *)table->GetImageSparseMemoryRequirements2; - if (!strcmp(name, "TrimCommandPool")) return (void *)table->TrimCommandPool; - if (!strcmp(name, "GetDeviceQueue2")) return (void *)table->GetDeviceQueue2; - if (!strcmp(name, "CreateSamplerYcbcrConversion")) return (void *)table->CreateSamplerYcbcrConversion; - if (!strcmp(name, "DestroySamplerYcbcrConversion")) return (void *)table->DestroySamplerYcbcrConversion; - if (!strcmp(name, "CreateDescriptorUpdateTemplate")) return (void *)table->CreateDescriptorUpdateTemplate; - if (!strcmp(name, "DestroyDescriptorUpdateTemplate")) return (void *)table->DestroyDescriptorUpdateTemplate; - if (!strcmp(name, "UpdateDescriptorSetWithTemplate")) return (void *)table->UpdateDescriptorSetWithTemplate; - if (!strcmp(name, "GetDescriptorSetLayoutSupport")) return (void *)table->GetDescriptorSetLayoutSupport; - - // ---- Core 1_2 commands - if (!strcmp(name, "CmdDrawIndirectCount")) return (void *)table->CmdDrawIndirectCount; - if (!strcmp(name, "CmdDrawIndexedIndirectCount")) return (void *)table->CmdDrawIndexedIndirectCount; - if (!strcmp(name, "CreateRenderPass2")) return (void *)table->CreateRenderPass2; - if (!strcmp(name, "CmdBeginRenderPass2")) return (void *)table->CmdBeginRenderPass2; - if (!strcmp(name, "CmdNextSubpass2")) return (void *)table->CmdNextSubpass2; - if (!strcmp(name, "CmdEndRenderPass2")) return (void *)table->CmdEndRenderPass2; - if (!strcmp(name, "ResetQueryPool")) return (void *)table->ResetQueryPool; - if (!strcmp(name, "GetSemaphoreCounterValue")) return (void *)table->GetSemaphoreCounterValue; - if (!strcmp(name, "WaitSemaphores")) return (void *)table->WaitSemaphores; - if (!strcmp(name, "SignalSemaphore")) return (void *)table->SignalSemaphore; - if (!strcmp(name, "GetBufferDeviceAddress")) return (void *)table->GetBufferDeviceAddress; - if (!strcmp(name, "GetBufferOpaqueCaptureAddress")) return (void *)table->GetBufferOpaqueCaptureAddress; - if (!strcmp(name, "GetDeviceMemoryOpaqueCaptureAddress")) return (void *)table->GetDeviceMemoryOpaqueCaptureAddress; - - // ---- Core 1_3 commands - if (!strcmp(name, "CreatePrivateDataSlot")) return (void *)table->CreatePrivateDataSlot; - if (!strcmp(name, "DestroyPrivateDataSlot")) return (void *)table->DestroyPrivateDataSlot; - if (!strcmp(name, "SetPrivateData")) return (void *)table->SetPrivateData; - if (!strcmp(name, "GetPrivateData")) return (void *)table->GetPrivateData; - if (!strcmp(name, "CmdSetEvent2")) return (void *)table->CmdSetEvent2; - if (!strcmp(name, "CmdResetEvent2")) return (void *)table->CmdResetEvent2; - if (!strcmp(name, "CmdWaitEvents2")) return (void *)table->CmdWaitEvents2; - if (!strcmp(name, "CmdPipelineBarrier2")) return (void *)table->CmdPipelineBarrier2; - if (!strcmp(name, "CmdWriteTimestamp2")) return (void *)table->CmdWriteTimestamp2; - if (!strcmp(name, "QueueSubmit2")) return (void *)table->QueueSubmit2; - if (!strcmp(name, "CmdCopyBuffer2")) return (void *)table->CmdCopyBuffer2; - if (!strcmp(name, "CmdCopyImage2")) return (void *)table->CmdCopyImage2; - if (!strcmp(name, "CmdCopyBufferToImage2")) return (void *)table->CmdCopyBufferToImage2; - if (!strcmp(name, "CmdCopyImageToBuffer2")) return (void *)table->CmdCopyImageToBuffer2; - if (!strcmp(name, "CmdBlitImage2")) return (void *)table->CmdBlitImage2; - if (!strcmp(name, "CmdResolveImage2")) return (void *)table->CmdResolveImage2; - if (!strcmp(name, "CmdBeginRendering")) return (void *)table->CmdBeginRendering; - if (!strcmp(name, "CmdEndRendering")) return (void *)table->CmdEndRendering; - if (!strcmp(name, "CmdSetCullMode")) return (void *)table->CmdSetCullMode; - if (!strcmp(name, "CmdSetFrontFace")) return (void *)table->CmdSetFrontFace; - if (!strcmp(name, "CmdSetPrimitiveTopology")) return (void *)table->CmdSetPrimitiveTopology; - if (!strcmp(name, "CmdSetViewportWithCount")) return (void *)table->CmdSetViewportWithCount; - if (!strcmp(name, "CmdSetScissorWithCount")) return (void *)table->CmdSetScissorWithCount; - if (!strcmp(name, "CmdBindVertexBuffers2")) return (void *)table->CmdBindVertexBuffers2; - if (!strcmp(name, "CmdSetDepthTestEnable")) return (void *)table->CmdSetDepthTestEnable; - if (!strcmp(name, "CmdSetDepthWriteEnable")) return (void *)table->CmdSetDepthWriteEnable; - if (!strcmp(name, "CmdSetDepthCompareOp")) return (void *)table->CmdSetDepthCompareOp; - if (!strcmp(name, "CmdSetDepthBoundsTestEnable")) return (void *)table->CmdSetDepthBoundsTestEnable; - if (!strcmp(name, "CmdSetStencilTestEnable")) return (void *)table->CmdSetStencilTestEnable; - if (!strcmp(name, "CmdSetStencilOp")) return (void *)table->CmdSetStencilOp; - if (!strcmp(name, "CmdSetRasterizerDiscardEnable")) return (void *)table->CmdSetRasterizerDiscardEnable; - if (!strcmp(name, "CmdSetDepthBiasEnable")) return (void *)table->CmdSetDepthBiasEnable; - if (!strcmp(name, "CmdSetPrimitiveRestartEnable")) return (void *)table->CmdSetPrimitiveRestartEnable; - if (!strcmp(name, "GetDeviceBufferMemoryRequirements")) return (void *)table->GetDeviceBufferMemoryRequirements; - if (!strcmp(name, "GetDeviceImageMemoryRequirements")) return (void *)table->GetDeviceImageMemoryRequirements; - if (!strcmp(name, "GetDeviceImageSparseMemoryRequirements")) return (void *)table->GetDeviceImageSparseMemoryRequirements; - +// 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 (!strcmp(name, "CreateSwapchainKHR")) return (void *)table->CreateSwapchainKHR; - if (!strcmp(name, "DestroySwapchainKHR")) return (void *)table->DestroySwapchainKHR; - 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; - + 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 (!strcmp(name, "CreateSharedSwapchainsKHR")) return (void *)table->CreateSharedSwapchainsKHR; - - // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "CreateVideoSessionKHR")) return (void *)table->CreateVideoSessionKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "DestroyVideoSessionKHR")) return (void *)table->DestroyVideoSessionKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "GetVideoSessionMemoryRequirementsKHR")) return (void *)table->GetVideoSessionMemoryRequirementsKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "BindVideoSessionMemoryKHR")) return (void *)table->BindVideoSessionMemoryKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "CreateVideoSessionParametersKHR")) return (void *)table->CreateVideoSessionParametersKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "UpdateVideoSessionParametersKHR")) return (void *)table->UpdateVideoSessionParametersKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "DestroyVideoSessionParametersKHR")) return (void *)table->DestroyVideoSessionParametersKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "CmdBeginVideoCodingKHR")) return (void *)table->CmdBeginVideoCodingKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "CmdEndVideoCodingKHR")) return (void *)table->CmdEndVideoCodingKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "CmdControlVideoCodingKHR")) return (void *)table->CmdControlVideoCodingKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS - - // ---- VK_KHR_video_decode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS - if (!strcmp(name, "CmdDecodeVideoKHR")) return (void *)table->CmdDecodeVideoKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS - - // ---- VK_KHR_dynamic_rendering extension commands - if (!strcmp(name, "CmdBeginRenderingKHR")) return (void *)table->CmdBeginRenderingKHR; - if (!strcmp(name, "CmdEndRenderingKHR")) return (void *)table->CmdEndRenderingKHR; - - // ---- VK_KHR_device_group extension commands - if (!strcmp(name, "GetDeviceGroupPeerMemoryFeaturesKHR")) return (void *)table->GetDeviceGroupPeerMemoryFeaturesKHR; - if (!strcmp(name, "CmdSetDeviceMaskKHR")) return (void *)table->CmdSetDeviceMaskKHR; - if (!strcmp(name, "CmdDispatchBaseKHR")) return (void *)table->CmdDispatchBaseKHR; - - // ---- VK_KHR_maintenance1 extension commands - if (!strcmp(name, "TrimCommandPoolKHR")) return (void *)table->TrimCommandPoolKHR; - - // ---- VK_KHR_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR - if (!strcmp(name, "GetMemoryWin32HandleKHR")) return (void *)table->GetMemoryWin32HandleKHR; -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - if (!strcmp(name, "GetMemoryWin32HandlePropertiesKHR")) return (void *)table->GetMemoryWin32HandlePropertiesKHR; -#endif // VK_USE_PLATFORM_WIN32_KHR - - // ---- 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_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR - if (!strcmp(name, "ImportSemaphoreWin32HandleKHR")) return (void *)table->ImportSemaphoreWin32HandleKHR; -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - if (!strcmp(name, "GetSemaphoreWin32HandleKHR")) return (void *)table->GetSemaphoreWin32HandleKHR; -#endif // VK_USE_PLATFORM_WIN32_KHR - - // ---- 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_push_descriptor extension commands - if (!strcmp(name, "CmdPushDescriptorSetKHR")) return (void *)table->CmdPushDescriptorSetKHR; - if (!strcmp(name, "CmdPushDescriptorSetWithTemplateKHR")) return (void *)table->CmdPushDescriptorSetWithTemplateKHR; - - // ---- VK_KHR_descriptor_update_template extension commands - if (!strcmp(name, "CreateDescriptorUpdateTemplateKHR")) return (void *)table->CreateDescriptorUpdateTemplateKHR; - if (!strcmp(name, "DestroyDescriptorUpdateTemplateKHR")) return (void *)table->DestroyDescriptorUpdateTemplateKHR; - if (!strcmp(name, "UpdateDescriptorSetWithTemplateKHR")) return (void *)table->UpdateDescriptorSetWithTemplateKHR; - - // ---- VK_KHR_create_renderpass2 extension commands - if (!strcmp(name, "CreateRenderPass2KHR")) return (void *)table->CreateRenderPass2KHR; - if (!strcmp(name, "CmdBeginRenderPass2KHR")) return (void *)table->CmdBeginRenderPass2KHR; - if (!strcmp(name, "CmdNextSubpass2KHR")) return (void *)table->CmdNextSubpass2KHR; - if (!strcmp(name, "CmdEndRenderPass2KHR")) return (void *)table->CmdEndRenderPass2KHR; - - // ---- VK_KHR_shared_presentable_image extension commands - if (!strcmp(name, "GetSwapchainStatusKHR")) return (void *)table->GetSwapchainStatusKHR; - - // ---- VK_KHR_external_fence_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR - if (!strcmp(name, "ImportFenceWin32HandleKHR")) return (void *)table->ImportFenceWin32HandleKHR; -#endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - if (!strcmp(name, "GetFenceWin32HandleKHR")) return (void *)table->GetFenceWin32HandleKHR; + if (dev->driver_extensions.khr_display_swapchain_enabled) + dispatch->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gpda(dev->icd_device, "vkCreateSharedSwapchainsKHR"); + // ---- VK_EXT_debug_marker extension commands + if (dev->driver_extensions.ext_debug_marker_enabled) + dispatch->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)gpda(dev->icd_device, "vkDebugMarkerSetObjectTagEXT"); + if (dev->driver_extensions.ext_debug_marker_enabled) + dispatch->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)gpda(dev->icd_device, "vkDebugMarkerSetObjectNameEXT"); + // ---- 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"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + // ---- VK_EXT_full_screen_exclusive extension commands + if (dev->driver_extensions.ext_full_screen_exclusive_enabled && dev->driver_extensions.khr_device_group_enabled) + dispatch->GetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)gpda(dev->icd_device, "vkGetDeviceGroupSurfacePresentModes2EXT"); #endif // VK_USE_PLATFORM_WIN32_KHR +} - // ---- 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_get_memory_requirements2 extension commands - if (!strcmp(name, "GetImageMemoryRequirements2KHR")) return (void *)table->GetImageMemoryRequirements2KHR; - if (!strcmp(name, "GetBufferMemoryRequirements2KHR")) return (void *)table->GetBufferMemoryRequirements2KHR; - if (!strcmp(name, "GetImageSparseMemoryRequirements2KHR")) return (void *)table->GetImageSparseMemoryRequirements2KHR; - - // ---- VK_KHR_sampler_ycbcr_conversion extension commands - if (!strcmp(name, "CreateSamplerYcbcrConversionKHR")) return (void *)table->CreateSamplerYcbcrConversionKHR; - if (!strcmp(name, "DestroySamplerYcbcrConversionKHR")) return (void *)table->DestroySamplerYcbcrConversionKHR; - - // ---- VK_KHR_bind_memory2 extension commands - if (!strcmp(name, "BindBufferMemory2KHR")) return (void *)table->BindBufferMemory2KHR; - if (!strcmp(name, "BindImageMemory2KHR")) return (void *)table->BindImageMemory2KHR; - - // ---- VK_KHR_maintenance3 extension commands - if (!strcmp(name, "GetDescriptorSetLayoutSupportKHR")) return (void *)table->GetDescriptorSetLayoutSupportKHR; - - // ---- VK_KHR_draw_indirect_count extension commands - if (!strcmp(name, "CmdDrawIndirectCountKHR")) return (void *)table->CmdDrawIndirectCountKHR; - if (!strcmp(name, "CmdDrawIndexedIndirectCountKHR")) return (void *)table->CmdDrawIndexedIndirectCountKHR; - - // ---- VK_KHR_timeline_semaphore extension commands - if (!strcmp(name, "GetSemaphoreCounterValueKHR")) return (void *)table->GetSemaphoreCounterValueKHR; - if (!strcmp(name, "WaitSemaphoresKHR")) return (void *)table->WaitSemaphoresKHR; - if (!strcmp(name, "SignalSemaphoreKHR")) return (void *)table->SignalSemaphoreKHR; - - // ---- VK_KHR_fragment_shading_rate extension commands - if (!strcmp(name, "CmdSetFragmentShadingRateKHR")) return (void *)table->CmdSetFragmentShadingRateKHR; +// 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_marker extension commands +VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT( + VkDevice device, + const VkDebugMarkerObjectTagInfoEXT* pTagInfo); +VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT( + VkDevice device, + const VkDebugMarkerObjectNameInfoEXT* pNameInfo); + // ---- 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); - // ---- VK_KHR_present_wait extension commands - if (!strcmp(name, "WaitForPresentKHR")) return (void *)table->WaitForPresentKHR; +// 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; + } - // ---- VK_KHR_buffer_device_address extension commands - if (!strcmp(name, "GetBufferDeviceAddressKHR")) return (void *)table->GetBufferDeviceAddressKHR; - if (!strcmp(name, "GetBufferOpaqueCaptureAddressKHR")) return (void *)table->GetBufferOpaqueCaptureAddressKHR; - if (!strcmp(name, "GetDeviceMemoryOpaqueCaptureAddressKHR")) return (void *)table->GetDeviceMemoryOpaqueCaptureAddressKHR; + 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); - // ---- VK_KHR_deferred_host_operations extension commands - if (!strcmp(name, "CreateDeferredOperationKHR")) return (void *)table->CreateDeferredOperationKHR; - if (!strcmp(name, "DestroyDeferredOperationKHR")) return (void *)table->DestroyDeferredOperationKHR; - if (!strcmp(name, "GetDeferredOperationMaxConcurrencyKHR")) return (void *)table->GetDeferredOperationMaxConcurrencyKHR; - if (!strcmp(name, "GetDeferredOperationResultKHR")) return (void *)table->GetDeferredOperationResultKHR; - if (!strcmp(name, "DeferredOperationJoinKHR")) return (void *)table->DeferredOperationJoinKHR; + + // ---- Core Vulkan 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, "FreeMemory")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->FreeMemory; + } + 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, "GetImageSparseMemoryRequirements")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetImageSparseMemoryRequirements; + } + if (!strcmp(name, "QueueBindSparse")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->QueueBindSparse; + } + 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, "DestroyQueryPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyQueryPool; + } + 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, "CreateShaderModule")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->CreateShaderModule; + } + if (!strcmp(name, "DestroyShaderModule")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyShaderModule; + } + 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, "GetPipelineCacheData")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->GetPipelineCacheData; + } + if (!strcmp(name, "MergePipelineCaches")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->MergePipelineCaches; + } + 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, "DestroyDescriptorPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyDescriptorPool; + } + 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, "DestroyCommandPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL; + return (void *)table->DestroyCommandPool; + } + 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; + } + + // ---- Core Vulkan 1.1 commands + if (!strcmp(name, "BindBufferMemory2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) 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_1) 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_1) 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_1) 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_1) 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_1) 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_1) return NULL; + return (void *)table->GetBufferMemoryRequirements2; + } + if (!strcmp(name, "GetImageSparseMemoryRequirements2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) return NULL; + return (void *)table->GetImageSparseMemoryRequirements2; + } + if (!strcmp(name, "TrimCommandPool")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) return NULL; + return (void *)table->TrimCommandPool; + } + if (!strcmp(name, "GetDeviceQueue2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) 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_1) 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_1) return NULL; + return (void *)table->DestroySamplerYcbcrConversion; + } + if (!strcmp(name, "CreateDescriptorUpdateTemplate")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) return NULL; + return (void *)table->CreateDescriptorUpdateTemplate; + } + if (!strcmp(name, "DestroyDescriptorUpdateTemplate")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) return NULL; + return (void *)table->DestroyDescriptorUpdateTemplate; + } + if (!strcmp(name, "UpdateDescriptorSetWithTemplate")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) return NULL; + return (void *)table->UpdateDescriptorSetWithTemplate; + } + if (!strcmp(name, "GetDescriptorSetLayoutSupport")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) return NULL; + return (void *)table->GetDescriptorSetLayoutSupport; + } + + // ---- Core Vulkan 1.2 commands + if (!strcmp(name, "CmdDrawIndirectCount")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_2) 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_2) 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_2) 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_2) 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_2) 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_2) 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_2) 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_2) 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_2) 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_2) 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_2) 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_2) 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_2) return NULL; + return (void *)table->GetDeviceMemoryOpaqueCaptureAddress; + } + + // ---- Core Vulkan 1.3 commands + if (!strcmp(name, "CreatePrivateDataSlot")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CreatePrivateDataSlot; + } + if (!strcmp(name, "DestroyPrivateDataSlot")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->DestroyPrivateDataSlot; + } + if (!strcmp(name, "SetPrivateData")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->SetPrivateData; + } + if (!strcmp(name, "GetPrivateData")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->GetPrivateData; + } + if (!strcmp(name, "CmdSetEvent2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetEvent2; + } + if (!strcmp(name, "CmdResetEvent2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdResetEvent2; + } + if (!strcmp(name, "CmdWaitEvents2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdWaitEvents2; + } + if (!strcmp(name, "CmdPipelineBarrier2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdPipelineBarrier2; + } + if (!strcmp(name, "CmdWriteTimestamp2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdWriteTimestamp2; + } + if (!strcmp(name, "QueueSubmit2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->QueueSubmit2; + } + if (!strcmp(name, "CmdCopyBuffer2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdCopyBuffer2; + } + if (!strcmp(name, "CmdCopyImage2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdCopyImage2; + } + if (!strcmp(name, "CmdCopyBufferToImage2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdCopyBufferToImage2; + } + if (!strcmp(name, "CmdCopyImageToBuffer2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdCopyImageToBuffer2; + } + if (!strcmp(name, "CmdBlitImage2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdBlitImage2; + } + if (!strcmp(name, "CmdResolveImage2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdResolveImage2; + } + if (!strcmp(name, "CmdBeginRendering")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdBeginRendering; + } + if (!strcmp(name, "CmdEndRendering")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdEndRendering; + } + if (!strcmp(name, "CmdSetCullMode")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetCullMode; + } + if (!strcmp(name, "CmdSetFrontFace")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetFrontFace; + } + if (!strcmp(name, "CmdSetPrimitiveTopology")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetPrimitiveTopology; + } + if (!strcmp(name, "CmdSetViewportWithCount")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetViewportWithCount; + } + if (!strcmp(name, "CmdSetScissorWithCount")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetScissorWithCount; + } + if (!strcmp(name, "CmdBindVertexBuffers2")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdBindVertexBuffers2; + } + if (!strcmp(name, "CmdSetDepthTestEnable")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetDepthTestEnable; + } + if (!strcmp(name, "CmdSetDepthWriteEnable")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetDepthWriteEnable; + } + if (!strcmp(name, "CmdSetDepthCompareOp")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetDepthCompareOp; + } + if (!strcmp(name, "CmdSetDepthBoundsTestEnable")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetDepthBoundsTestEnable; + } + if (!strcmp(name, "CmdSetStencilTestEnable")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetStencilTestEnable; + } + if (!strcmp(name, "CmdSetStencilOp")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetStencilOp; + } + if (!strcmp(name, "CmdSetRasterizerDiscardEnable")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetRasterizerDiscardEnable; + } + if (!strcmp(name, "CmdSetDepthBiasEnable")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetDepthBiasEnable; + } + if (!strcmp(name, "CmdSetPrimitiveRestartEnable")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->CmdSetPrimitiveRestartEnable; + } + if (!strcmp(name, "GetDeviceBufferMemoryRequirements")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->GetDeviceBufferMemoryRequirements; + } + if (!strcmp(name, "GetDeviceImageMemoryRequirements")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->GetDeviceImageMemoryRequirements; + } + if (!strcmp(name, "GetDeviceImageSparseMemoryRequirements")) { + if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL; + return (void *)table->GetDeviceImageSparseMemoryRequirements; + } + + // ---- VK_KHR_swapchain extension commands + if (!strcmp(name, "CreateSwapchainKHR")) return (void *)table->CreateSwapchainKHR; + if (!strcmp(name, "DestroySwapchainKHR")) return (void *)table->DestroySwapchainKHR; + 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_video_queue extension commands + if (!strcmp(name, "CreateVideoSessionKHR")) return (void *)table->CreateVideoSessionKHR; + if (!strcmp(name, "DestroyVideoSessionKHR")) return (void *)table->DestroyVideoSessionKHR; + if (!strcmp(name, "GetVideoSessionMemoryRequirementsKHR")) return (void *)table->GetVideoSessionMemoryRequirementsKHR; + if (!strcmp(name, "BindVideoSessionMemoryKHR")) return (void *)table->BindVideoSessionMemoryKHR; + if (!strcmp(name, "CreateVideoSessionParametersKHR")) return (void *)table->CreateVideoSessionParametersKHR; + if (!strcmp(name, "UpdateVideoSessionParametersKHR")) return (void *)table->UpdateVideoSessionParametersKHR; + if (!strcmp(name, "DestroyVideoSessionParametersKHR")) return (void *)table->DestroyVideoSessionParametersKHR; + if (!strcmp(name, "CmdBeginVideoCodingKHR")) return (void *)table->CmdBeginVideoCodingKHR; + if (!strcmp(name, "CmdEndVideoCodingKHR")) return (void *)table->CmdEndVideoCodingKHR; + if (!strcmp(name, "CmdControlVideoCodingKHR")) return (void *)table->CmdControlVideoCodingKHR; + + // ---- VK_KHR_video_decode_queue extension commands + if (!strcmp(name, "CmdDecodeVideoKHR")) return (void *)table->CmdDecodeVideoKHR; + + // ---- VK_KHR_dynamic_rendering extension commands + if (!strcmp(name, "CmdBeginRenderingKHR")) return (void *)table->CmdBeginRenderingKHR; + if (!strcmp(name, "CmdEndRenderingKHR")) return (void *)table->CmdEndRenderingKHR; + + // ---- VK_KHR_device_group extension commands + if (!strcmp(name, "GetDeviceGroupPeerMemoryFeaturesKHR")) return (void *)table->GetDeviceGroupPeerMemoryFeaturesKHR; + if (!strcmp(name, "CmdSetDeviceMaskKHR")) return (void *)table->CmdSetDeviceMaskKHR; + if (!strcmp(name, "CmdDispatchBaseKHR")) return (void *)table->CmdDispatchBaseKHR; + + // ---- VK_KHR_maintenance1 extension commands + if (!strcmp(name, "TrimCommandPoolKHR")) return (void *)table->TrimCommandPoolKHR; + + // ---- VK_KHR_external_memory_win32 extension commands +#if defined(VK_USE_PLATFORM_WIN32_KHR) + if (!strcmp(name, "GetMemoryWin32HandleKHR")) return (void *)table->GetMemoryWin32HandleKHR; +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + if (!strcmp(name, "GetMemoryWin32HandlePropertiesKHR")) return (void *)table->GetMemoryWin32HandlePropertiesKHR; +#endif // VK_USE_PLATFORM_WIN32_KHR + + // ---- 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_win32 extension commands +#if defined(VK_USE_PLATFORM_WIN32_KHR) + if (!strcmp(name, "ImportSemaphoreWin32HandleKHR")) return (void *)table->ImportSemaphoreWin32HandleKHR; +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + if (!strcmp(name, "GetSemaphoreWin32HandleKHR")) return (void *)table->GetSemaphoreWin32HandleKHR; +#endif // VK_USE_PLATFORM_WIN32_KHR + + // ---- 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_push_descriptor extension commands + if (!strcmp(name, "CmdPushDescriptorSetKHR")) return (void *)table->CmdPushDescriptorSetKHR; + if (!strcmp(name, "CmdPushDescriptorSetWithTemplateKHR")) return (void *)table->CmdPushDescriptorSetWithTemplateKHR; + + // ---- VK_KHR_descriptor_update_template extension commands + if (!strcmp(name, "CreateDescriptorUpdateTemplateKHR")) return (void *)table->CreateDescriptorUpdateTemplateKHR; + if (!strcmp(name, "DestroyDescriptorUpdateTemplateKHR")) return (void *)table->DestroyDescriptorUpdateTemplateKHR; + if (!strcmp(name, "UpdateDescriptorSetWithTemplateKHR")) return (void *)table->UpdateDescriptorSetWithTemplateKHR; + + // ---- VK_KHR_create_renderpass2 extension commands + if (!strcmp(name, "CreateRenderPass2KHR")) return (void *)table->CreateRenderPass2KHR; + if (!strcmp(name, "CmdBeginRenderPass2KHR")) return (void *)table->CmdBeginRenderPass2KHR; + if (!strcmp(name, "CmdNextSubpass2KHR")) return (void *)table->CmdNextSubpass2KHR; + if (!strcmp(name, "CmdEndRenderPass2KHR")) return (void *)table->CmdEndRenderPass2KHR; + + // ---- VK_KHR_shared_presentable_image extension commands + if (!strcmp(name, "GetSwapchainStatusKHR")) return (void *)table->GetSwapchainStatusKHR; + + // ---- VK_KHR_external_fence_win32 extension commands +#if defined(VK_USE_PLATFORM_WIN32_KHR) + if (!strcmp(name, "ImportFenceWin32HandleKHR")) return (void *)table->ImportFenceWin32HandleKHR; +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + if (!strcmp(name, "GetFenceWin32HandleKHR")) return (void *)table->GetFenceWin32HandleKHR; +#endif // VK_USE_PLATFORM_WIN32_KHR + + // ---- 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_get_memory_requirements2 extension commands + if (!strcmp(name, "GetImageMemoryRequirements2KHR")) return (void *)table->GetImageMemoryRequirements2KHR; + if (!strcmp(name, "GetBufferMemoryRequirements2KHR")) return (void *)table->GetBufferMemoryRequirements2KHR; + if (!strcmp(name, "GetImageSparseMemoryRequirements2KHR")) return (void *)table->GetImageSparseMemoryRequirements2KHR; + + // ---- VK_KHR_sampler_ycbcr_conversion extension commands + if (!strcmp(name, "CreateSamplerYcbcrConversionKHR")) return (void *)table->CreateSamplerYcbcrConversionKHR; + if (!strcmp(name, "DestroySamplerYcbcrConversionKHR")) return (void *)table->DestroySamplerYcbcrConversionKHR; + + // ---- VK_KHR_bind_memory2 extension commands + if (!strcmp(name, "BindBufferMemory2KHR")) return (void *)table->BindBufferMemory2KHR; + if (!strcmp(name, "BindImageMemory2KHR")) return (void *)table->BindImageMemory2KHR; + + // ---- VK_KHR_maintenance3 extension commands + if (!strcmp(name, "GetDescriptorSetLayoutSupportKHR")) return (void *)table->GetDescriptorSetLayoutSupportKHR; + + // ---- VK_KHR_draw_indirect_count extension commands + if (!strcmp(name, "CmdDrawIndirectCountKHR")) return (void *)table->CmdDrawIndirectCountKHR; + if (!strcmp(name, "CmdDrawIndexedIndirectCountKHR")) return (void *)table->CmdDrawIndexedIndirectCountKHR; + + // ---- VK_KHR_timeline_semaphore extension commands + if (!strcmp(name, "GetSemaphoreCounterValueKHR")) return (void *)table->GetSemaphoreCounterValueKHR; + if (!strcmp(name, "WaitSemaphoresKHR")) return (void *)table->WaitSemaphoresKHR; + if (!strcmp(name, "SignalSemaphoreKHR")) return (void *)table->SignalSemaphoreKHR; + + // ---- VK_KHR_fragment_shading_rate extension commands + if (!strcmp(name, "CmdSetFragmentShadingRateKHR")) return (void *)table->CmdSetFragmentShadingRateKHR; + + // ---- VK_KHR_present_wait extension commands + if (!strcmp(name, "WaitForPresentKHR")) return (void *)table->WaitForPresentKHR; + + // ---- VK_KHR_buffer_device_address extension commands + if (!strcmp(name, "GetBufferDeviceAddressKHR")) return (void *)table->GetBufferDeviceAddressKHR; + if (!strcmp(name, "GetBufferOpaqueCaptureAddressKHR")) return (void *)table->GetBufferOpaqueCaptureAddressKHR; + if (!strcmp(name, "GetDeviceMemoryOpaqueCaptureAddressKHR")) return (void *)table->GetDeviceMemoryOpaqueCaptureAddressKHR; + + // ---- VK_KHR_deferred_host_operations extension commands + if (!strcmp(name, "CreateDeferredOperationKHR")) return (void *)table->CreateDeferredOperationKHR; + if (!strcmp(name, "DestroyDeferredOperationKHR")) return (void *)table->DestroyDeferredOperationKHR; + if (!strcmp(name, "GetDeferredOperationMaxConcurrencyKHR")) return (void *)table->GetDeferredOperationMaxConcurrencyKHR; + if (!strcmp(name, "GetDeferredOperationResultKHR")) return (void *)table->GetDeferredOperationResultKHR; + if (!strcmp(name, "DeferredOperationJoinKHR")) return (void *)table->DeferredOperationJoinKHR; // ---- VK_KHR_pipeline_executable_properties extension commands if (!strcmp(name, "GetPipelineExecutablePropertiesKHR")) return (void *)table->GetPipelineExecutablePropertiesKHR; if (!strcmp(name, "GetPipelineExecutableStatisticsKHR")) return (void *)table->GetPipelineExecutableStatisticsKHR; if (!strcmp(name, "GetPipelineExecutableInternalRepresentationsKHR")) return (void *)table->GetPipelineExecutableInternalRepresentationsKHR; + // ---- VK_KHR_map_memory2 extension commands + if (!strcmp(name, "MapMemory2KHR")) return (void *)table->MapMemory2KHR; + if (!strcmp(name, "UnmapMemory2KHR")) return (void *)table->UnmapMemory2KHR; + // ---- VK_KHR_video_encode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS + if (!strcmp(name, "GetEncodedVideoSessionParametersKHR")) return (void *)table->GetEncodedVideoSessionParametersKHR; if (!strcmp(name, "CmdEncodeVideoKHR")) return (void *)table->CmdEncodeVideoKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_synchronization2 extension commands if (!strcmp(name, "CmdSetEvent2KHR")) return (void *)table->CmdSetEvent2KHR; @@ -1792,9 +2486,26 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "GetDeviceImageMemoryRequirementsKHR")) return (void *)table->GetDeviceImageMemoryRequirementsKHR; if (!strcmp(name, "GetDeviceImageSparseMemoryRequirementsKHR")) return (void *)table->GetDeviceImageSparseMemoryRequirementsKHR; + // ---- VK_KHR_maintenance5 extension commands + if (!strcmp(name, "CmdBindIndexBuffer2KHR")) return (void *)table->CmdBindIndexBuffer2KHR; + if (!strcmp(name, "GetRenderingAreaGranularityKHR")) return (void *)table->GetRenderingAreaGranularityKHR; + if (!strcmp(name, "GetDeviceImageSubresourceLayoutKHR")) return (void *)table->GetDeviceImageSubresourceLayoutKHR; + if (!strcmp(name, "GetImageSubresourceLayout2KHR")) return (void *)table->GetImageSubresourceLayout2KHR; + + // ---- VK_KHR_calibrated_timestamps extension commands + if (!strcmp(name, "GetCalibratedTimestampsKHR")) return (void *)table->GetCalibratedTimestampsKHR; + + // ---- VK_KHR_maintenance6 extension commands + if (!strcmp(name, "CmdBindDescriptorSets2KHR")) return (void *)table->CmdBindDescriptorSets2KHR; + if (!strcmp(name, "CmdPushConstants2KHR")) return (void *)table->CmdPushConstants2KHR; + if (!strcmp(name, "CmdPushDescriptorSet2KHR")) return (void *)table->CmdPushDescriptorSet2KHR; + if (!strcmp(name, "CmdPushDescriptorSetWithTemplate2KHR")) return (void *)table->CmdPushDescriptorSetWithTemplate2KHR; + if (!strcmp(name, "CmdSetDescriptorBufferOffsets2EXT")) return (void *)table->CmdSetDescriptorBufferOffsets2EXT; + if (!strcmp(name, "CmdBindDescriptorBufferEmbeddedSamplers2EXT")) return (void *)table->CmdBindDescriptorBufferEmbeddedSamplers2EXT; + // ---- VK_EXT_debug_marker extension commands - if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) return (void *)table->DebugMarkerSetObjectTagEXT; - if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) return (void *)table->DebugMarkerSetObjectNameEXT; + if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) return dev->layer_extensions.ext_debug_marker_enabled ? (void *)DebugMarkerSetObjectTagEXT : NULL; + if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) return dev->layer_extensions.ext_debug_marker_enabled ? (void *)DebugMarkerSetObjectNameEXT : NULL; if (!strcmp(name, "CmdDebugMarkerBeginEXT")) return (void *)table->CmdDebugMarkerBeginEXT; if (!strcmp(name, "CmdDebugMarkerEndEXT")) return (void *)table->CmdDebugMarkerEndEXT; if (!strcmp(name, "CmdDebugMarkerInsertEXT")) return (void *)table->CmdDebugMarkerInsertEXT; @@ -1826,7 +2537,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "GetShaderInfoAMD")) return (void *)table->GetShaderInfoAMD; // ---- VK_NV_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "GetMemoryWin32HandleNV")) return (void *)table->GetMemoryWin32HandleNV; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -1849,13 +2560,15 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis // ---- 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 (void *)table->SetDebugUtilsObjectNameEXT; - if (!strcmp(name, "SetDebugUtilsObjectTagEXT")) return (void *)table->SetDebugUtilsObjectTagEXT; + 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; @@ -1864,13 +2577,36 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "CmdInsertDebugUtilsLabelEXT")) return (void *)table->CmdInsertDebugUtilsLabelEXT; // ---- VK_ANDROID_external_memory_android_hardware_buffer extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (!strcmp(name, "GetAndroidHardwareBufferPropertiesANDROID")) return (void *)table->GetAndroidHardwareBufferPropertiesANDROID; #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (!strcmp(name, "GetMemoryAndroidHardwareBufferANDROID")) return (void *)table->GetMemoryAndroidHardwareBufferANDROID; #endif // VK_USE_PLATFORM_ANDROID_KHR + // ---- VK_AMDX_shader_enqueue extension commands +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp(name, "CreateExecutionGraphPipelinesAMDX")) return (void *)table->CreateExecutionGraphPipelinesAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp(name, "GetExecutionGraphPipelineScratchSizeAMDX")) return (void *)table->GetExecutionGraphPipelineScratchSizeAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp(name, "GetExecutionGraphPipelineNodeIndexAMDX")) return (void *)table->GetExecutionGraphPipelineNodeIndexAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp(name, "CmdInitializeGraphScratchMemoryAMDX")) return (void *)table->CmdInitializeGraphScratchMemoryAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp(name, "CmdDispatchGraphAMDX")) return (void *)table->CmdDispatchGraphAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp(name, "CmdDispatchGraphIndirectAMDX")) return (void *)table->CmdDispatchGraphIndirectAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp(name, "CmdDispatchGraphIndirectCountAMDX")) return (void *)table->CmdDispatchGraphIndirectCountAMDX; +#endif // VK_ENABLE_BETA_EXTENSIONS + // ---- VK_EXT_sample_locations extension commands if (!strcmp(name, "CmdSetSampleLocationsEXT")) return (void *)table->CmdSetSampleLocationsEXT; @@ -1918,6 +2654,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "CmdDrawMeshTasksIndirectCountNV")) return (void *)table->CmdDrawMeshTasksIndirectCountNV; // ---- VK_NV_scissor_exclusive extension commands + if (!strcmp(name, "CmdSetExclusiveScissorEnableNV")) return (void *)table->CmdSetExclusiveScissorEnableNV; if (!strcmp(name, "CmdSetExclusiveScissorNV")) return (void *)table->CmdSetExclusiveScissorNV; // ---- VK_NV_device_diagnostic_checkpoints extension commands @@ -1942,13 +2679,13 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "GetBufferDeviceAddressEXT")) return (void *)table->GetBufferDeviceAddressEXT; // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "AcquireFullScreenExclusiveModeEXT")) return (void *)table->AcquireFullScreenExclusiveModeEXT; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "ReleaseFullScreenExclusiveModeEXT")) return (void *)table->ReleaseFullScreenExclusiveModeEXT; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "GetDeviceGroupSurfacePresentModes2EXT")) return (void *)table->GetDeviceGroupSurfacePresentModes2EXT; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -1972,6 +2709,16 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "CmdSetStencilTestEnableEXT")) return (void *)table->CmdSetStencilTestEnableEXT; if (!strcmp(name, "CmdSetStencilOpEXT")) return (void *)table->CmdSetStencilOpEXT; + // ---- VK_EXT_host_image_copy extension commands + if (!strcmp(name, "CopyMemoryToImageEXT")) return (void *)table->CopyMemoryToImageEXT; + if (!strcmp(name, "CopyImageToMemoryEXT")) return (void *)table->CopyImageToMemoryEXT; + if (!strcmp(name, "CopyImageToImageEXT")) return (void *)table->CopyImageToImageEXT; + if (!strcmp(name, "TransitionImageLayoutEXT")) return (void *)table->TransitionImageLayoutEXT; + if (!strcmp(name, "GetImageSubresourceLayout2EXT")) return (void *)table->GetImageSubresourceLayout2EXT; + + // ---- VK_EXT_swapchain_maintenance1 extension commands + if (!strcmp(name, "ReleaseSwapchainImagesEXT")) return (void *)table->ReleaseSwapchainImagesEXT; + // ---- VK_NV_device_generated_commands extension commands if (!strcmp(name, "GetGeneratedCommandsMemoryRequirementsNV")) return (void *)table->GetGeneratedCommandsMemoryRequirementsNV; if (!strcmp(name, "CmdPreprocessGeneratedCommandsNV")) return (void *)table->CmdPreprocessGeneratedCommandsNV; @@ -1980,23 +2727,44 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "CreateIndirectCommandsLayoutNV")) return (void *)table->CreateIndirectCommandsLayoutNV; if (!strcmp(name, "DestroyIndirectCommandsLayoutNV")) return (void *)table->DestroyIndirectCommandsLayoutNV; + // ---- VK_EXT_depth_bias_control extension commands + if (!strcmp(name, "CmdSetDepthBias2EXT")) return (void *)table->CmdSetDepthBias2EXT; + // ---- VK_EXT_private_data extension commands if (!strcmp(name, "CreatePrivateDataSlotEXT")) return (void *)table->CreatePrivateDataSlotEXT; if (!strcmp(name, "DestroyPrivateDataSlotEXT")) return (void *)table->DestroyPrivateDataSlotEXT; if (!strcmp(name, "SetPrivateDataEXT")) return (void *)table->SetPrivateDataEXT; if (!strcmp(name, "GetPrivateDataEXT")) return (void *)table->GetPrivateDataEXT; + // ---- VK_NV_cuda_kernel_launch extension commands + if (!strcmp(name, "CreateCudaModuleNV")) return (void *)table->CreateCudaModuleNV; + if (!strcmp(name, "GetCudaModuleCacheNV")) return (void *)table->GetCudaModuleCacheNV; + if (!strcmp(name, "CreateCudaFunctionNV")) return (void *)table->CreateCudaFunctionNV; + if (!strcmp(name, "DestroyCudaModuleNV")) return (void *)table->DestroyCudaModuleNV; + if (!strcmp(name, "DestroyCudaFunctionNV")) return (void *)table->DestroyCudaFunctionNV; + if (!strcmp(name, "CmdCudaLaunchKernelNV")) return (void *)table->CmdCudaLaunchKernelNV; + // ---- VK_EXT_metal_objects extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) if (!strcmp(name, "ExportMetalObjectsEXT")) return (void *)table->ExportMetalObjectsEXT; #endif // VK_USE_PLATFORM_METAL_EXT + // ---- VK_EXT_descriptor_buffer extension commands + if (!strcmp(name, "GetDescriptorSetLayoutSizeEXT")) return (void *)table->GetDescriptorSetLayoutSizeEXT; + if (!strcmp(name, "GetDescriptorSetLayoutBindingOffsetEXT")) return (void *)table->GetDescriptorSetLayoutBindingOffsetEXT; + if (!strcmp(name, "GetDescriptorEXT")) return (void *)table->GetDescriptorEXT; + if (!strcmp(name, "CmdBindDescriptorBuffersEXT")) return (void *)table->CmdBindDescriptorBuffersEXT; + if (!strcmp(name, "CmdSetDescriptorBufferOffsetsEXT")) return (void *)table->CmdSetDescriptorBufferOffsetsEXT; + if (!strcmp(name, "CmdBindDescriptorBufferEmbeddedSamplersEXT")) return (void *)table->CmdBindDescriptorBufferEmbeddedSamplersEXT; + if (!strcmp(name, "GetBufferOpaqueCaptureDescriptorDataEXT")) return (void *)table->GetBufferOpaqueCaptureDescriptorDataEXT; + if (!strcmp(name, "GetImageOpaqueCaptureDescriptorDataEXT")) return (void *)table->GetImageOpaqueCaptureDescriptorDataEXT; + if (!strcmp(name, "GetImageViewOpaqueCaptureDescriptorDataEXT")) return (void *)table->GetImageViewOpaqueCaptureDescriptorDataEXT; + if (!strcmp(name, "GetSamplerOpaqueCaptureDescriptorDataEXT")) return (void *)table->GetSamplerOpaqueCaptureDescriptorDataEXT; + if (!strcmp(name, "GetAccelerationStructureOpaqueCaptureDescriptorDataEXT")) return (void *)table->GetAccelerationStructureOpaqueCaptureDescriptorDataEXT; + // ---- VK_NV_fragment_shading_rate_enums extension commands if (!strcmp(name, "CmdSetFragmentShadingRateEnumNV")) return (void *)table->CmdSetFragmentShadingRateEnumNV; - // ---- VK_EXT_image_compression_control extension commands - if (!strcmp(name, "GetImageSubresourceLayout2EXT")) return (void *)table->GetImageSubresourceLayout2EXT; - // ---- VK_EXT_device_fault extension commands if (!strcmp(name, "GetDeviceFaultInfoEXT")) return (void *)table->GetDeviceFaultInfoEXT; @@ -2004,35 +2772,35 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "CmdSetVertexInputEXT")) return (void *)table->CmdSetVertexInputEXT; // ---- VK_FUCHSIA_external_memory extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "GetMemoryZirconHandleFUCHSIA")) return (void *)table->GetMemoryZirconHandleFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "GetMemoryZirconHandlePropertiesFUCHSIA")) return (void *)table->GetMemoryZirconHandlePropertiesFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_external_semaphore extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "ImportSemaphoreZirconHandleFUCHSIA")) return (void *)table->ImportSemaphoreZirconHandleFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "GetSemaphoreZirconHandleFUCHSIA")) return (void *)table->GetSemaphoreZirconHandleFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_buffer_collection extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "CreateBufferCollectionFUCHSIA")) return (void *)table->CreateBufferCollectionFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "SetBufferCollectionImageConstraintsFUCHSIA")) return (void *)table->SetBufferCollectionImageConstraintsFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "SetBufferCollectionBufferConstraintsFUCHSIA")) return (void *)table->SetBufferCollectionBufferConstraintsFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "DestroyBufferCollectionFUCHSIA")) return (void *)table->DestroyBufferCollectionFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "GetBufferCollectionPropertiesFUCHSIA")) return (void *)table->GetBufferCollectionPropertiesFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA @@ -2079,6 +2847,10 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "GetDeviceMicromapCompatibilityEXT")) return (void *)table->GetDeviceMicromapCompatibilityEXT; if (!strcmp(name, "GetMicromapBuildSizesEXT")) return (void *)table->GetMicromapBuildSizesEXT; + // ---- VK_HUAWEI_cluster_culling_shader extension commands + if (!strcmp(name, "CmdDrawClusterHUAWEI")) return (void *)table->CmdDrawClusterHUAWEI; + if (!strcmp(name, "CmdDrawClusterIndirectHUAWEI")) return (void *)table->CmdDrawClusterIndirectHUAWEI; + // ---- VK_EXT_pageable_device_local_memory extension commands if (!strcmp(name, "SetDeviceMemoryPriorityEXT")) return (void *)table->SetDeviceMemoryPriorityEXT; @@ -2086,6 +2858,19 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "GetDescriptorSetLayoutHostMappingInfoVALVE")) return (void *)table->GetDescriptorSetLayoutHostMappingInfoVALVE; if (!strcmp(name, "GetDescriptorSetHostMappingVALVE")) return (void *)table->GetDescriptorSetHostMappingVALVE; + // ---- VK_NV_copy_memory_indirect extension commands + if (!strcmp(name, "CmdCopyMemoryIndirectNV")) return (void *)table->CmdCopyMemoryIndirectNV; + if (!strcmp(name, "CmdCopyMemoryToImageIndirectNV")) return (void *)table->CmdCopyMemoryToImageIndirectNV; + + // ---- VK_NV_memory_decompression extension commands + if (!strcmp(name, "CmdDecompressMemoryNV")) return (void *)table->CmdDecompressMemoryNV; + if (!strcmp(name, "CmdDecompressMemoryIndirectCountNV")) return (void *)table->CmdDecompressMemoryIndirectCountNV; + + // ---- VK_NV_device_generated_commands_compute extension commands + if (!strcmp(name, "GetPipelineIndirectMemoryRequirementsNV")) return (void *)table->GetPipelineIndirectMemoryRequirementsNV; + if (!strcmp(name, "CmdUpdatePipelineIndirectBufferNV")) return (void *)table->CmdUpdatePipelineIndirectBufferNV; + if (!strcmp(name, "GetPipelineIndirectDeviceAddressNV")) return (void *)table->GetPipelineIndirectDeviceAddressNV; + // ---- VK_EXT_extended_dynamic_state3 extension commands if (!strcmp(name, "CmdSetTessellationDomainOriginEXT")) return (void *)table->CmdSetTessellationDomainOriginEXT; if (!strcmp(name, "CmdSetDepthClampEnableEXT")) return (void *)table->CmdSetDepthClampEnableEXT; @@ -2129,28 +2914,30 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "BindOpticalFlowSessionImageNV")) return (void *)table->BindOpticalFlowSessionImageNV; if (!strcmp(name, "CmdOpticalFlowExecuteNV")) return (void *)table->CmdOpticalFlowExecuteNV; + // ---- VK_EXT_shader_object extension commands + if (!strcmp(name, "CreateShadersEXT")) return (void *)table->CreateShadersEXT; + if (!strcmp(name, "DestroyShaderEXT")) return (void *)table->DestroyShaderEXT; + if (!strcmp(name, "GetShaderBinaryDataEXT")) return (void *)table->GetShaderBinaryDataEXT; + if (!strcmp(name, "CmdBindShadersEXT")) return (void *)table->CmdBindShadersEXT; + // ---- VK_QCOM_tile_properties extension commands if (!strcmp(name, "GetFramebufferTilePropertiesQCOM")) return (void *)table->GetFramebufferTilePropertiesQCOM; if (!strcmp(name, "GetDynamicRenderingTilePropertiesQCOM")) return (void *)table->GetDynamicRenderingTilePropertiesQCOM; - // ---- VK_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp(name, "GetSwapchainGrallocUsageOHOS")) return (void *)table->GetSwapchainGrallocUsageOHOS; -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp(name, "AcquireImageOHOS")) return (void *)table->AcquireImageOHOS; -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp(name, "QueueSignalReleaseImageOHOS")) return (void *)table->QueueSignalReleaseImageOHOS; -#endif // VK_USE_PLATFORM_OHOS + // ---- VK_NV_low_latency2 extension commands + if (!strcmp(name, "SetLatencySleepModeNV")) return (void *)table->SetLatencySleepModeNV; + if (!strcmp(name, "LatencySleepNV")) return (void *)table->LatencySleepNV; + if (!strcmp(name, "SetLatencyMarkerNV")) return (void *)table->SetLatencyMarkerNV; + if (!strcmp(name, "GetLatencyTimingsNV")) return (void *)table->GetLatencyTimingsNV; + if (!strcmp(name, "QueueNotifyOutOfBandNV")) return (void *)table->QueueNotifyOutOfBandNV; - // ---- VK_OHOS_external_memory extension commands -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp(name, "GetNativeBufferPropertiesOHOS")) return (void *)table->GetNativeBufferPropertiesOHOS; -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp(name, "GetMemoryNativeBufferOHOS")) return (void *)table->GetMemoryNativeBufferOHOS; -#endif // VK_USE_PLATFORM_OHOS + // ---- VK_EXT_attachment_feedback_loop_dynamic_state extension commands + if (!strcmp(name, "CmdSetAttachmentFeedbackLoopEnableEXT")) return (void *)table->CmdSetAttachmentFeedbackLoopEnableEXT; + + // ---- 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 // ---- VK_KHR_acceleration_structure extension commands if (!strcmp(name, "CreateAccelerationStructureKHR")) return (void *)table->CreateAccelerationStructureKHR; @@ -2183,6 +2970,26 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "CmdDrawMeshTasksIndirectEXT")) return (void *)table->CmdDrawMeshTasksIndirectEXT; if (!strcmp(name, "CmdDrawMeshTasksIndirectCountEXT")) return (void *)table->CmdDrawMeshTasksIndirectCountEXT; + // ---- VK_OHOS_native_buffer extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "GetSwapchainGrallocUsageOHOS")) return (void *)table->GetSwapchainGrallocUsageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "AcquireImageOHOS")) return (void *)table->AcquireImageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "QueueSignalReleaseImageOHOS")) return (void *)table->QueueSignalReleaseImageOHOS; +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "GetNativeBufferPropertiesOHOS")) return (void *)table->GetNativeBufferPropertiesOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "GetMemoryNativeBufferOHOS")) return (void *)table->GetMemoryNativeBufferOHOS; +#endif // VK_USE_PLATFORM_OHOS + + *found_name = false; return NULL; } @@ -2197,7 +3004,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI *found_name = true; name += 2; - // ---- Core 1_0 commands + // ---- Core Vulkan 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; @@ -2211,7 +3018,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "EnumerateDeviceLayerProperties")) return (void *)table->EnumerateDeviceLayerProperties; if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties")) return (void *)table->GetPhysicalDeviceSparseImageFormatProperties; - // ---- Core 1_1 commands + // ---- Core Vulkan 1.1 commands if (!strcmp(name, "EnumeratePhysicalDeviceGroups")) return (void *)table->EnumeratePhysicalDeviceGroups; if (!strcmp(name, "GetPhysicalDeviceFeatures2")) return (void *)table->GetPhysicalDeviceFeatures2; if (!strcmp(name, "GetPhysicalDeviceProperties2")) return (void *)table->GetPhysicalDeviceProperties2; @@ -2224,7 +3031,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "GetPhysicalDeviceExternalFenceProperties")) return (void *)table->GetPhysicalDeviceExternalFenceProperties; if (!strcmp(name, "GetPhysicalDeviceExternalSemaphoreProperties")) return (void *)table->GetPhysicalDeviceExternalSemaphoreProperties; - // ---- Core 1_3 commands + // ---- Core Vulkan 1.3 commands if (!strcmp(name, "GetPhysicalDeviceToolProperties")) return (void *)table->GetPhysicalDeviceToolProperties; // ---- VK_KHR_surface extension commands @@ -2247,49 +3054,45 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "CreateDisplayPlaneSurfaceKHR")) return (void *)table->CreateDisplayPlaneSurfaceKHR; // ---- VK_KHR_xlib_surface extension commands -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) if (!strcmp(name, "CreateXlibSurfaceKHR")) return (void *)table->CreateXlibSurfaceKHR; #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) if (!strcmp(name, "GetPhysicalDeviceXlibPresentationSupportKHR")) return (void *)table->GetPhysicalDeviceXlibPresentationSupportKHR; #endif // VK_USE_PLATFORM_XLIB_KHR // ---- VK_KHR_xcb_surface extension commands -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) if (!strcmp(name, "CreateXcbSurfaceKHR")) return (void *)table->CreateXcbSurfaceKHR; #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) if (!strcmp(name, "GetPhysicalDeviceXcbPresentationSupportKHR")) return (void *)table->GetPhysicalDeviceXcbPresentationSupportKHR; #endif // VK_USE_PLATFORM_XCB_KHR // ---- VK_KHR_wayland_surface extension commands -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) if (!strcmp(name, "CreateWaylandSurfaceKHR")) return (void *)table->CreateWaylandSurfaceKHR; #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) if (!strcmp(name, "GetPhysicalDeviceWaylandPresentationSupportKHR")) return (void *)table->GetPhysicalDeviceWaylandPresentationSupportKHR; #endif // VK_USE_PLATFORM_WAYLAND_KHR // ---- VK_KHR_android_surface extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (!strcmp(name, "CreateAndroidSurfaceKHR")) return (void *)table->CreateAndroidSurfaceKHR; #endif // VK_USE_PLATFORM_ANDROID_KHR // ---- VK_KHR_win32_surface extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "CreateWin32SurfaceKHR")) return (void *)table->CreateWin32SurfaceKHR; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "GetPhysicalDeviceWin32PresentationSupportKHR")) return (void *)table->GetPhysicalDeviceWin32PresentationSupportKHR; #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp(name, "GetPhysicalDeviceVideoCapabilitiesKHR")) return (void *)table->GetPhysicalDeviceVideoCapabilitiesKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp(name, "GetPhysicalDeviceVideoFormatPropertiesKHR")) return (void *)table->GetPhysicalDeviceVideoFormatPropertiesKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_get_physical_device_properties2 extension commands if (!strcmp(name, "GetPhysicalDeviceFeatures2KHR")) return (void *)table->GetPhysicalDeviceFeatures2KHR; @@ -2329,13 +3132,22 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI // ---- VK_KHR_fragment_shading_rate extension commands if (!strcmp(name, "GetPhysicalDeviceFragmentShadingRatesKHR")) return (void *)table->GetPhysicalDeviceFragmentShadingRatesKHR; + // ---- VK_KHR_video_encode_queue extension commands + if (!strcmp(name, "GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR")) return (void *)table->GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR; + + // ---- VK_KHR_cooperative_matrix extension commands + if (!strcmp(name, "GetPhysicalDeviceCooperativeMatrixPropertiesKHR")) return (void *)table->GetPhysicalDeviceCooperativeMatrixPropertiesKHR; + + // ---- VK_KHR_calibrated_timestamps extension commands + if (!strcmp(name, "GetPhysicalDeviceCalibrateableTimeDomainsKHR")) return (void *)table->GetPhysicalDeviceCalibrateableTimeDomainsKHR; + // ---- VK_EXT_debug_report extension commands if (!strcmp(name, "CreateDebugReportCallbackEXT")) return (void *)table->CreateDebugReportCallbackEXT; if (!strcmp(name, "DestroyDebugReportCallbackEXT")) return (void *)table->DestroyDebugReportCallbackEXT; if (!strcmp(name, "DebugReportMessageEXT")) return (void *)table->DebugReportMessageEXT; // ---- VK_GGP_stream_descriptor_surface extension commands -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) if (!strcmp(name, "CreateStreamDescriptorSurfaceGGP")) return (void *)table->CreateStreamDescriptorSurfaceGGP; #endif // VK_USE_PLATFORM_GGP @@ -2343,7 +3155,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "GetPhysicalDeviceExternalImageFormatPropertiesNV")) return (void *)table->GetPhysicalDeviceExternalImageFormatPropertiesNV; // ---- VK_NN_vi_surface extension commands -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) if (!strcmp(name, "CreateViSurfaceNN")) return (void *)table->CreateViSurfaceNN; #endif // VK_USE_PLATFORM_VI_NN @@ -2351,10 +3163,10 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "ReleaseDisplayEXT")) return (void *)table->ReleaseDisplayEXT; // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) if (!strcmp(name, "AcquireXlibDisplayEXT")) return (void *)table->AcquireXlibDisplayEXT; #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) if (!strcmp(name, "GetRandROutputDisplayEXT")) return (void *)table->GetRandROutputDisplayEXT; #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT @@ -2362,12 +3174,12 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2EXT")) return (void *)table->GetPhysicalDeviceSurfaceCapabilities2EXT; // ---- VK_MVK_ios_surface extension commands -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) if (!strcmp(name, "CreateIOSSurfaceMVK")) return (void *)table->CreateIOSSurfaceMVK; #endif // VK_USE_PLATFORM_IOS_MVK // ---- VK_MVK_macos_surface extension commands -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) if (!strcmp(name, "CreateMacOSSurfaceMVK")) return (void *)table->CreateMacOSSurfaceMVK; #endif // VK_USE_PLATFORM_MACOS_MVK @@ -2383,12 +3195,12 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "GetPhysicalDeviceCalibrateableTimeDomainsEXT")) return (void *)table->GetPhysicalDeviceCalibrateableTimeDomainsEXT; // ---- VK_FUCHSIA_imagepipe_surface extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp(name, "CreateImagePipeSurfaceFUCHSIA")) return (void *)table->CreateImagePipeSurfaceFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_EXT_metal_surface extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) if (!strcmp(name, "CreateMetalSurfaceEXT")) return (void *)table->CreateMetalSurfaceEXT; #endif // VK_USE_PLATFORM_METAL_EXT @@ -2402,7 +3214,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV")) return (void *)table->GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV; // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModes2EXT")) return (void *)table->GetPhysicalDeviceSurfacePresentModes2EXT; #endif // VK_USE_PLATFORM_WIN32_KHR @@ -2414,26 +3226,26 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "GetDrmDisplayEXT")) return (void *)table->GetDrmDisplayEXT; // ---- VK_NV_acquire_winrt_display extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "AcquireWinrtDisplayNV")) return (void *)table->AcquireWinrtDisplayNV; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "GetWinrtDisplayNV")) return (void *)table->GetWinrtDisplayNV; #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_directfb_surface extension commands -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) if (!strcmp(name, "CreateDirectFBSurfaceEXT")) return (void *)table->CreateDirectFBSurfaceEXT; #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) if (!strcmp(name, "GetPhysicalDeviceDirectFBPresentationSupportEXT")) return (void *)table->GetPhysicalDeviceDirectFBPresentationSupportEXT; #endif // VK_USE_PLATFORM_DIRECTFB_EXT // ---- VK_QNX_screen_surface extension commands -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) if (!strcmp(name, "CreateScreenSurfaceQNX")) return (void *)table->CreateScreenSurfaceQNX; #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) if (!strcmp(name, "GetPhysicalDeviceScreenPresentationSupportQNX")) return (void *)table->GetPhysicalDeviceScreenPresentationSupportQNX; #endif // VK_USE_PLATFORM_SCREEN_QNX @@ -2452,7 +3264,6 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI // ---- VK_KHR_video_queue extension trampoline/terminators -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceVideoCapabilitiesKHR( VkPhysicalDevice physicalDevice, const VkVideoProfileInfoKHR* pVideoProfile, @@ -2460,7 +3271,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceVideoCapabilitiesKHR( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceVideoCapabilitiesKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2476,15 +3287,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceVideoCapabilitiesKHR( 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.GetPhysicalDeviceVideoCapabilitiesKHR) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceVideoCapabilitiesKHR"); abort(); /* Intentionally fail so user can correct issue. */ } return icd_term->dispatch.GetPhysicalDeviceVideoCapabilitiesKHR(phys_dev_term->phys_dev, pVideoProfile, pCapabilities); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceVideoFormatPropertiesKHR( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, @@ -2493,7 +3302,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceVideoFormatPropertiesKHR( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceVideoFormatPropertiesKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2510,15 +3319,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceVideoFormatProperties 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.GetPhysicalDeviceVideoFormatPropertiesKHR) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceVideoFormatPropertiesKHR"); abort(); /* Intentionally fail so user can correct issue. */ } return icd_term->dispatch.GetPhysicalDeviceVideoFormatPropertiesKHR(phys_dev_term->phys_dev, pVideoFormatInfo, pVideoFormatPropertyCount, pVideoFormatProperties); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionKHR( VkDevice device, const VkVideoSessionCreateInfoKHR* pCreateInfo, @@ -2526,7 +3333,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionKHR( VkVideoSessionKHR* pVideoSession) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateVideoSessionKHR: Invalid device " "[VUID-vkCreateVideoSessionKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2534,15 +3341,13 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionKHR( return disp->CreateVideoSessionKHR(device, pCreateInfo, pAllocator, pVideoSession); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR void VKAPI_CALL DestroyVideoSessionKHR( VkDevice device, VkVideoSessionKHR videoSession, const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyVideoSessionKHR: Invalid device " "[VUID-vkDestroyVideoSessionKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2550,8 +3355,6 @@ VKAPI_ATTR void VKAPI_CALL DestroyVideoSessionKHR( disp->DestroyVideoSessionKHR(device, videoSession, pAllocator); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR VkResult VKAPI_CALL GetVideoSessionMemoryRequirementsKHR( VkDevice device, VkVideoSessionKHR videoSession, @@ -2559,7 +3362,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetVideoSessionMemoryRequirementsKHR( VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetVideoSessionMemoryRequirementsKHR: Invalid device " "[VUID-vkGetVideoSessionMemoryRequirementsKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2567,8 +3370,6 @@ VKAPI_ATTR VkResult VKAPI_CALL GetVideoSessionMemoryRequirementsKHR( return disp->GetVideoSessionMemoryRequirementsKHR(device, videoSession, pMemoryRequirementsCount, pMemoryRequirements); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR VkResult VKAPI_CALL BindVideoSessionMemoryKHR( VkDevice device, VkVideoSessionKHR videoSession, @@ -2576,7 +3377,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BindVideoSessionMemoryKHR( const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindVideoSessionMemoryKHR: Invalid device " "[VUID-vkBindVideoSessionMemoryKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2584,8 +3385,6 @@ VKAPI_ATTR VkResult VKAPI_CALL BindVideoSessionMemoryKHR( return disp->BindVideoSessionMemoryKHR(device, videoSession, bindSessionMemoryInfoCount, pBindSessionMemoryInfos); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionParametersKHR( VkDevice device, const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, @@ -2593,7 +3392,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionParametersKHR( VkVideoSessionParametersKHR* pVideoSessionParameters) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateVideoSessionParametersKHR: Invalid device " "[VUID-vkCreateVideoSessionParametersKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2601,15 +3400,13 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionParametersKHR( return disp->CreateVideoSessionParametersKHR(device, pCreateInfo, pAllocator, pVideoSessionParameters); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR VkResult VKAPI_CALL UpdateVideoSessionParametersKHR( VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkUpdateVideoSessionParametersKHR: Invalid device " "[VUID-vkUpdateVideoSessionParametersKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2617,15 +3414,13 @@ VKAPI_ATTR VkResult VKAPI_CALL UpdateVideoSessionParametersKHR( return disp->UpdateVideoSessionParametersKHR(device, videoSessionParameters, pUpdateInfo); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR void VKAPI_CALL DestroyVideoSessionParametersKHR( VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyVideoSessionParametersKHR: Invalid device " "[VUID-vkDestroyVideoSessionParametersKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2633,14 +3428,12 @@ VKAPI_ATTR void VKAPI_CALL DestroyVideoSessionParametersKHR( disp->DestroyVideoSessionParametersKHR(device, videoSessionParameters, pAllocator); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR void VKAPI_CALL CmdBeginVideoCodingKHR( VkCommandBuffer commandBuffer, const VkVideoBeginCodingInfoKHR* pBeginInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginVideoCodingKHR: Invalid commandBuffer " "[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2648,14 +3441,12 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginVideoCodingKHR( disp->CmdBeginVideoCodingKHR(commandBuffer, pBeginInfo); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR void VKAPI_CALL CmdEndVideoCodingKHR( VkCommandBuffer commandBuffer, const VkVideoEndCodingInfoKHR* pEndCodingInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndVideoCodingKHR: Invalid commandBuffer " "[VUID-vkCmdEndVideoCodingKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2663,14 +3454,12 @@ VKAPI_ATTR void VKAPI_CALL CmdEndVideoCodingKHR( disp->CmdEndVideoCodingKHR(commandBuffer, pEndCodingInfo); } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR void VKAPI_CALL CmdControlVideoCodingKHR( VkCommandBuffer commandBuffer, const VkVideoCodingControlInfoKHR* pCodingControlInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdControlVideoCodingKHR: Invalid commandBuffer " "[VUID-vkCmdControlVideoCodingKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2678,17 +3467,15 @@ VKAPI_ATTR void VKAPI_CALL CmdControlVideoCodingKHR( disp->CmdControlVideoCodingKHR(commandBuffer, pCodingControlInfo); } -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_video_decode_queue extension trampoline/terminators -#ifdef VK_ENABLE_BETA_EXTENSIONS VKAPI_ATTR void VKAPI_CALL CmdDecodeVideoKHR( VkCommandBuffer commandBuffer, const VkVideoDecodeInfoKHR* pDecodeInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDecodeVideoKHR: Invalid commandBuffer " "[VUID-vkCmdDecodeVideoKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2696,7 +3483,6 @@ VKAPI_ATTR void VKAPI_CALL CmdDecodeVideoKHR( disp->CmdDecodeVideoKHR(commandBuffer, pDecodeInfo); } -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_dynamic_rendering extension trampoline/terminators @@ -2705,7 +3491,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginRenderingKHR( const VkRenderingInfo* pRenderingInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginRenderingKHR: Invalid commandBuffer " "[VUID-vkCmdBeginRenderingKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2717,7 +3503,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderingKHR( VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndRenderingKHR: Invalid commandBuffer " "[VUID-vkCmdEndRenderingKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2736,7 +3522,7 @@ VKAPI_ATTR void VKAPI_CALL GetDeviceGroupPeerMemoryFeaturesKHR( VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceGroupPeerMemoryFeaturesKHR: Invalid device " "[VUID-vkGetDeviceGroupPeerMemoryFeaturesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2749,7 +3535,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDeviceMaskKHR( uint32_t deviceMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetDeviceMaskKHR: Invalid commandBuffer " "[VUID-vkCmdSetDeviceMaskKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2767,7 +3553,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDispatchBaseKHR( uint32_t groupCountZ) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDispatchBaseKHR: Invalid commandBuffer " "[VUID-vkCmdDispatchBaseKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2784,7 +3570,7 @@ VKAPI_ATTR void VKAPI_CALL TrimCommandPoolKHR( VkCommandPoolTrimFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkTrimCommandPoolKHR: Invalid device " "[VUID-vkTrimCommandPoolKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2795,14 +3581,14 @@ VKAPI_ATTR void VKAPI_CALL TrimCommandPoolKHR( // ---- VK_KHR_external_memory_win32 extension trampoline/terminators -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleKHR( VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMemoryWin32HandleKHR: Invalid device " "[VUID-vkGetMemoryWin32HandleKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2811,7 +3597,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleKHR( } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandlePropertiesKHR( VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, @@ -2819,7 +3605,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandlePropertiesKHR( VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMemoryWin32HandlePropertiesKHR: Invalid device " "[VUID-vkGetMemoryWin32HandlePropertiesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2837,7 +3623,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdKHR( int* pFd) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -2852,7 +3638,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdPropertiesKHR( VkMemoryFdPropertiesKHR* pMemoryFdProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -2863,13 +3649,13 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdPropertiesKHR( // ---- VK_KHR_external_semaphore_win32 extension trampoline/terminators -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreWin32HandleKHR( VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkImportSemaphoreWin32HandleKHR: Invalid device " "[VUID-vkImportSemaphoreWin32HandleKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2878,14 +3664,14 @@ VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreWin32HandleKHR( } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreWin32HandleKHR( VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetSemaphoreWin32HandleKHR: Invalid device " "[VUID-vkGetSemaphoreWin32HandleKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2902,7 +3688,7 @@ VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreFdKHR( const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -2916,7 +3702,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreFdKHR( int* pFd) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -2936,7 +3722,7 @@ VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetKHR( const VkWriteDescriptorSet* pDescriptorWrites) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdPushDescriptorSetKHR: Invalid commandBuffer " "[VUID-vkCmdPushDescriptorSetKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2952,7 +3738,7 @@ VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplateKHR( const void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdPushDescriptorSetWithTemplateKHR: Invalid commandBuffer " "[VUID-vkCmdPushDescriptorSetWithTemplateKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2970,7 +3756,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplateKHR( VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDescriptorUpdateTemplateKHR: Invalid device " "[VUID-vkCreateDescriptorUpdateTemplateKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2984,7 +3770,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyDescriptorUpdateTemplateKHR( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyDescriptorUpdateTemplateKHR: Invalid device " "[VUID-vkDestroyDescriptorUpdateTemplateKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2999,7 +3785,7 @@ VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSetWithTemplateKHR( const void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkUpdateDescriptorSetWithTemplateKHR: Invalid device " "[VUID-vkUpdateDescriptorSetWithTemplateKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3017,7 +3803,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass2KHR( VkRenderPass* pRenderPass) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateRenderPass2KHR: Invalid device " "[VUID-vkCreateRenderPass2KHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3031,7 +3817,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass2KHR( const VkSubpassBeginInfo* pSubpassBeginInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginRenderPass2KHR: Invalid commandBuffer " "[VUID-vkCmdBeginRenderPass2KHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3045,7 +3831,7 @@ VKAPI_ATTR void VKAPI_CALL CmdNextSubpass2KHR( const VkSubpassEndInfo* pSubpassEndInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdNextSubpass2KHR: Invalid commandBuffer " "[VUID-vkCmdNextSubpass2KHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3058,7 +3844,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass2KHR( const VkSubpassEndInfo* pSubpassEndInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndRenderPass2KHR: Invalid commandBuffer " "[VUID-vkCmdEndRenderPass2KHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3074,7 +3860,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainStatusKHR( VkSwapchainKHR swapchain) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3085,13 +3871,13 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainStatusKHR( // ---- VK_KHR_external_fence_win32 extension trampoline/terminators -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL ImportFenceWin32HandleKHR( VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkImportFenceWin32HandleKHR: Invalid device " "[VUID-vkImportFenceWin32HandleKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3100,14 +3886,14 @@ VKAPI_ATTR VkResult VKAPI_CALL ImportFenceWin32HandleKHR( } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetFenceWin32HandleKHR( VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetFenceWin32HandleKHR: Invalid device " "[VUID-vkGetFenceWin32HandleKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3124,7 +3910,7 @@ VKAPI_ATTR VkResult VKAPI_CALL ImportFenceFdKHR( const VkImportFenceFdInfoKHR* pImportFenceFdInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3138,7 +3924,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetFenceFdKHR( int* pFd) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3158,7 +3944,7 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceQueueFamilyPerformanceQuer const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3176,7 +3962,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceQueueFamilyPerf 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_ERROR_BIT, 0, + 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. */ } @@ -3190,7 +3976,7 @@ VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3206,7 +3992,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyPerformanceQue 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_ERROR_BIT, 0, + 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. */ } @@ -3218,7 +4004,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireProfilingLockKHR( const VkAcquireProfilingLockInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3230,7 +4016,7 @@ VKAPI_ATTR void VKAPI_CALL ReleaseProfilingLockKHR( VkDevice device) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3247,7 +4033,7 @@ VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements2KHR( VkMemoryRequirements2* pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageMemoryRequirements2KHR: Invalid device " "[VUID-vkGetImageMemoryRequirements2KHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3261,7 +4047,7 @@ VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements2KHR( VkMemoryRequirements2* pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferMemoryRequirements2KHR: Invalid device " "[VUID-vkGetBufferMemoryRequirements2KHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3276,7 +4062,7 @@ VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements2KHR( VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageSparseMemoryRequirements2KHR: Invalid device " "[VUID-vkGetImageSparseMemoryRequirements2KHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3294,7 +4080,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSamplerYcbcrConversionKHR( VkSamplerYcbcrConversion* pYcbcrConversion) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateSamplerYcbcrConversionKHR: Invalid device " "[VUID-vkCreateSamplerYcbcrConversionKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3308,7 +4094,7 @@ VKAPI_ATTR void VKAPI_CALL DestroySamplerYcbcrConversionKHR( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroySamplerYcbcrConversionKHR: Invalid device " "[VUID-vkDestroySamplerYcbcrConversionKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3325,7 +4111,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory2KHR( const VkBindBufferMemoryInfo* pBindInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindBufferMemory2KHR: Invalid device " "[VUID-vkBindBufferMemory2KHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3339,7 +4125,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory2KHR( const VkBindImageMemoryInfo* pBindInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindImageMemory2KHR: Invalid device " "[VUID-vkBindImageMemory2KHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3356,7 +4142,7 @@ VKAPI_ATTR void VKAPI_CALL GetDescriptorSetLayoutSupportKHR( VkDescriptorSetLayoutSupport* pSupport) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDescriptorSetLayoutSupportKHR: Invalid device " "[VUID-vkGetDescriptorSetLayoutSupportKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3377,7 +4163,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectCountKHR( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndirectCountKHR: Invalid commandBuffer " "[VUID-vkCmdDrawIndirectCountKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3395,7 +4181,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirectCountKHR( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndexedIndirectCountKHR: Invalid commandBuffer " "[VUID-vkCmdDrawIndexedIndirectCountKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3412,7 +4198,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreCounterValueKHR( uint64_t* pValue) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetSemaphoreCounterValueKHR: Invalid device " "[VUID-vkGetSemaphoreCounterValueKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3426,7 +4212,7 @@ VKAPI_ATTR VkResult VKAPI_CALL WaitSemaphoresKHR( uint64_t timeout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkWaitSemaphoresKHR: Invalid device " "[VUID-vkWaitSemaphoresKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3439,7 +4225,7 @@ VKAPI_ATTR VkResult VKAPI_CALL SignalSemaphoreKHR( const VkSemaphoreSignalInfo* pSignalInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkSignalSemaphoreKHR: Invalid device " "[VUID-vkSignalSemaphoreKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3457,7 +4243,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceFragmentShadingRatesKHR( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3473,7 +4259,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceFragmentShadingRatesK 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_ERROR_BIT, 0, + 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. */ } @@ -3486,7 +4272,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateKHR( const VkFragmentShadingRateCombinerOpKHR combinerOps[2]) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3504,7 +4290,7 @@ VKAPI_ATTR VkResult VKAPI_CALL WaitForPresentKHR( uint64_t timeout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkWaitForPresentKHR: Invalid device " "[VUID-vkWaitForPresentKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3520,7 +4306,7 @@ VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetBufferDeviceAddressKHR( const VkBufferDeviceAddressInfo* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferDeviceAddressKHR: Invalid device " "[VUID-vkGetBufferDeviceAddressKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3533,7 +4319,7 @@ VKAPI_ATTR uint64_t VKAPI_CALL GetBufferOpaqueCaptureAddressKHR( const VkBufferDeviceAddressInfo* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferOpaqueCaptureAddressKHR: Invalid device " "[VUID-vkGetBufferOpaqueCaptureAddressKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3546,7 +4332,7 @@ VKAPI_ATTR uint64_t VKAPI_CALL GetDeviceMemoryOpaqueCaptureAddressKHR( const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceMemoryOpaqueCaptureAddressKHR: Invalid device " "[VUID-vkGetDeviceMemoryOpaqueCaptureAddressKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3563,7 +4349,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDeferredOperationKHR( VkDeferredOperationKHR* pDeferredOperation) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDeferredOperationKHR: Invalid device " "[VUID-vkCreateDeferredOperationKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3577,7 +4363,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyDeferredOperationKHR( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyDeferredOperationKHR: Invalid device " "[VUID-vkDestroyDeferredOperationKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3590,7 +4376,7 @@ VKAPI_ATTR uint32_t VKAPI_CALL GetDeferredOperationMaxConcurrencyKHR( VkDeferredOperationKHR operation) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeferredOperationMaxConcurrencyKHR: Invalid device " "[VUID-vkGetDeferredOperationMaxConcurrencyKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3603,7 +4389,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDeferredOperationResultKHR( VkDeferredOperationKHR operation) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeferredOperationResultKHR: Invalid device " "[VUID-vkGetDeferredOperationResultKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3616,7 +4402,7 @@ VKAPI_ATTR VkResult VKAPI_CALL DeferredOperationJoinKHR( VkDeferredOperationKHR operation) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDeferredOperationJoinKHR: Invalid device " "[VUID-vkDeferredOperationJoinKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3634,7 +4420,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPipelineExecutablePropertiesKHR( VkPipelineExecutablePropertiesKHR* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPipelineExecutablePropertiesKHR: Invalid device " "[VUID-vkGetPipelineExecutablePropertiesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3649,7 +4435,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPipelineExecutableStatisticsKHR( VkPipelineExecutableStatisticKHR* pStatistics) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPipelineExecutableStatisticsKHR: Invalid device " "[VUID-vkGetPipelineExecutableStatisticsKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3664,7 +4450,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPipelineExecutableInternalRepresentationsKHR( VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPipelineExecutableInternalRepresentationsKHR: Invalid device " "[VUID-vkGetPipelineExecutableInternalRepresentationsKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3673,15 +4459,90 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPipelineExecutableInternalRepresentationsKHR( } +// ---- VK_KHR_map_memory2 extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL MapMemory2KHR( + VkDevice device, + const VkMemoryMapInfoKHR* pMemoryMapInfo, + void** ppData) { + 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, + "vkMapMemory2KHR: Invalid device " + "[VUID-vkMapMemory2KHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->MapMemory2KHR(device, pMemoryMapInfo, ppData); +} + +VKAPI_ATTR VkResult VKAPI_CALL UnmapMemory2KHR( + VkDevice device, + const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo) { + 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, + "vkUnmapMemory2KHR: Invalid device " + "[VUID-vkUnmapMemory2KHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->UnmapMemory2KHR(device, pMemoryUnmapInfo); +} + + // ---- VK_KHR_video_encode_queue extension trampoline/terminators -#ifdef VK_ENABLE_BETA_EXTENSIONS +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR* pQualityLevelInfo, + VkVideoEncodeQualityLevelPropertiesKHR* pQualityLevelProperties) { + 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, + "vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR(unwrapped_phys_dev, pQualityLevelInfo, pQualityLevelProperties); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR* pQualityLevelInfo, + VkVideoEncodeQualityLevelPropertiesKHR* pQualityLevelProperties) { + 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.GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR(phys_dev_term->phys_dev, pQualityLevelInfo, pQualityLevelProperties); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetEncodedVideoSessionParametersKHR( + VkDevice device, + const VkVideoEncodeSessionParametersGetInfoKHR* pVideoSessionParametersInfo, + VkVideoEncodeSessionParametersFeedbackInfoKHR* pFeedbackInfo, + size_t* pDataSize, + void* pData) { + 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, + "vkGetEncodedVideoSessionParametersKHR: Invalid device " + "[VUID-vkGetEncodedVideoSessionParametersKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetEncodedVideoSessionParametersKHR(device, pVideoSessionParametersInfo, pFeedbackInfo, pDataSize, pData); +} + VKAPI_ATTR void VKAPI_CALL CmdEncodeVideoKHR( VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEncodeVideoKHR: Invalid commandBuffer " "[VUID-vkCmdEncodeVideoKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3689,7 +4550,6 @@ VKAPI_ATTR void VKAPI_CALL CmdEncodeVideoKHR( disp->CmdEncodeVideoKHR(commandBuffer, pEncodeInfo); } -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_synchronization2 extension trampoline/terminators @@ -3699,7 +4559,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetEvent2KHR( const VkDependencyInfo* pDependencyInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3713,7 +4573,7 @@ VKAPI_ATTR void VKAPI_CALL CmdResetEvent2KHR( VkPipelineStageFlags2 stageMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3728,7 +4588,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWaitEvents2KHR( const VkDependencyInfo* pDependencyInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3741,7 +4601,7 @@ VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier2KHR( const VkDependencyInfo* pDependencyInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3756,7 +4616,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp2KHR( uint32_t query) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3771,7 +4631,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit2KHR( VkFence fence) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3787,7 +4647,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteBufferMarker2AMD( uint32_t marker) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3801,7 +4661,7 @@ VKAPI_ATTR void VKAPI_CALL GetQueueCheckpointData2NV( VkCheckpointData2NV* pCheckpointData) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3817,7 +4677,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer2KHR( const VkCopyBufferInfo2* pCopyBufferInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3830,7 +4690,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyImage2KHR( const VkCopyImageInfo2* pCopyImageInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3843,7 +4703,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage2KHR( const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3856,7 +4716,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer2KHR( const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3869,7 +4729,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBlitImage2KHR( const VkBlitImageInfo2* pBlitImageInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3882,7 +4742,7 @@ VKAPI_ATTR void VKAPI_CALL CmdResolveImage2KHR( const VkResolveImageInfo2* pResolveImageInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -3898,7 +4758,7 @@ VKAPI_ATTR void VKAPI_CALL CmdTraceRaysIndirect2KHR( VkDeviceAddress indirectDeviceAddress) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdTraceRaysIndirect2KHR: Invalid commandBuffer " "[VUID-vkCmdTraceRaysIndirect2KHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3915,7 +4775,7 @@ VKAPI_ATTR void VKAPI_CALL GetDeviceBufferMemoryRequirementsKHR( VkMemoryRequirements2* pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceBufferMemoryRequirementsKHR: Invalid device " "[VUID-vkGetDeviceBufferMemoryRequirementsKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3929,27 +4789,252 @@ VKAPI_ATTR void VKAPI_CALL GetDeviceImageMemoryRequirementsKHR( VkMemoryRequirements2* pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceImageMemoryRequirementsKHR: Invalid device " "[VUID-vkGetDeviceImageMemoryRequirementsKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - disp->GetDeviceImageMemoryRequirementsKHR(device, pInfo, pMemoryRequirements); + disp->GetDeviceImageMemoryRequirementsKHR(device, pInfo, pMemoryRequirements); +} + +VKAPI_ATTR void VKAPI_CALL GetDeviceImageSparseMemoryRequirementsKHR( + VkDevice device, + const VkDeviceImageMemoryRequirements* pInfo, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { + 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, + "vkGetDeviceImageSparseMemoryRequirementsKHR: Invalid device " + "[VUID-vkGetDeviceImageSparseMemoryRequirementsKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetDeviceImageSparseMemoryRequirementsKHR(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); +} + + +// ---- VK_KHR_maintenance5 extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer2KHR( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType) { + 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, + "vkCmdBindIndexBuffer2KHR: Invalid commandBuffer " + "[VUID-vkCmdBindIndexBuffer2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdBindIndexBuffer2KHR(commandBuffer, buffer, offset, size, indexType); +} + +VKAPI_ATTR void VKAPI_CALL GetRenderingAreaGranularityKHR( + VkDevice device, + const VkRenderingAreaInfoKHR* pRenderingAreaInfo, + VkExtent2D* pGranularity) { + 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, + "vkGetRenderingAreaGranularityKHR: Invalid device " + "[VUID-vkGetRenderingAreaGranularityKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetRenderingAreaGranularityKHR(device, pRenderingAreaInfo, pGranularity); +} + +VKAPI_ATTR void VKAPI_CALL GetDeviceImageSubresourceLayoutKHR( + VkDevice device, + const VkDeviceImageSubresourceInfoKHR* pInfo, + VkSubresourceLayout2KHR* pLayout) { + 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, + "vkGetDeviceImageSubresourceLayoutKHR: Invalid device " + "[VUID-vkGetDeviceImageSubresourceLayoutKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetDeviceImageSubresourceLayoutKHR(device, pInfo, pLayout); +} + +VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2KHR( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout) { + 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, + "vkGetImageSubresourceLayout2KHR: Invalid device " + "[VUID-vkGetImageSubresourceLayout2KHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetImageSubresourceLayout2KHR(device, image, pSubresource, pLayout); +} + + +// ---- VK_KHR_cooperative_matrix extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkCooperativeMatrixPropertiesKHR* pProperties) { + 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, + "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceCooperativeMatrixPropertiesKHR(unwrapped_phys_dev, pPropertyCount, pProperties); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceCooperativeMatrixPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkCooperativeMatrixPropertiesKHR* 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; + if (NULL == icd_term->dispatch.GetPhysicalDeviceCooperativeMatrixPropertiesKHR) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceCooperativeMatrixPropertiesKHR"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceCooperativeMatrixPropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, pProperties); +} + + +// ---- VK_KHR_calibrated_timestamps extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCalibrateableTimeDomainsKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pTimeDomainCount, + VkTimeDomainKHR* 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, + "vkGetPhysicalDeviceCalibrateableTimeDomainsKHR: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceCalibrateableTimeDomainsKHR-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetPhysicalDeviceCalibrateableTimeDomainsKHR(unwrapped_phys_dev, pTimeDomainCount, pTimeDomains); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceCalibrateableTimeDomainsKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pTimeDomainCount, + VkTimeDomainKHR* 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.GetPhysicalDeviceCalibrateableTimeDomainsKHR) { + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceCalibrateableTimeDomainsKHR"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return icd_term->dispatch.GetPhysicalDeviceCalibrateableTimeDomainsKHR(phys_dev_term->phys_dev, pTimeDomainCount, pTimeDomains); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetCalibratedTimestampsKHR( + VkDevice device, + uint32_t timestampCount, + const VkCalibratedTimestampInfoKHR* 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, + "vkGetCalibratedTimestampsKHR: Invalid device " + "[VUID-vkGetCalibratedTimestampsKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetCalibratedTimestampsKHR(device, timestampCount, pTimestampInfos, pTimestamps, pMaxDeviation); +} + + +// ---- VK_KHR_maintenance6 extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets2KHR( + VkCommandBuffer commandBuffer, + const VkBindDescriptorSetsInfoKHR* pBindDescriptorSetsInfo) { + 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, + "vkCmdBindDescriptorSets2KHR: Invalid commandBuffer " + "[VUID-vkCmdBindDescriptorSets2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdBindDescriptorSets2KHR(commandBuffer, pBindDescriptorSetsInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdPushConstants2KHR( + VkCommandBuffer commandBuffer, + const VkPushConstantsInfoKHR* pPushConstantsInfo) { + 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, + "vkCmdPushConstants2KHR: Invalid commandBuffer " + "[VUID-vkCmdPushConstants2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdPushConstants2KHR(commandBuffer, pPushConstantsInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSet2KHR( + VkCommandBuffer commandBuffer, + const VkPushDescriptorSetInfoKHR* pPushDescriptorSetInfo) { + 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, + "vkCmdPushDescriptorSet2KHR: Invalid commandBuffer " + "[VUID-vkCmdPushDescriptorSet2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdPushDescriptorSet2KHR(commandBuffer, pPushDescriptorSetInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplate2KHR( + VkCommandBuffer commandBuffer, + const VkPushDescriptorSetWithTemplateInfoKHR* pPushDescriptorSetWithTemplateInfo) { + 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, + "vkCmdPushDescriptorSetWithTemplate2KHR: Invalid commandBuffer " + "[VUID-vkCmdPushDescriptorSetWithTemplate2KHR-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdPushDescriptorSetWithTemplate2KHR(commandBuffer, pPushDescriptorSetWithTemplateInfo); +} + +VKAPI_ATTR void VKAPI_CALL CmdSetDescriptorBufferOffsets2EXT( + VkCommandBuffer commandBuffer, + const VkSetDescriptorBufferOffsetsInfoEXT* pSetDescriptorBufferOffsetsInfo) { + 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, + "vkCmdSetDescriptorBufferOffsets2EXT: Invalid commandBuffer " + "[VUID-vkCmdSetDescriptorBufferOffsets2EXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDescriptorBufferOffsets2EXT(commandBuffer, pSetDescriptorBufferOffsetsInfo); } -VKAPI_ATTR void VKAPI_CALL GetDeviceImageSparseMemoryRequirementsKHR( - VkDevice device, - const VkDeviceImageMemoryRequirements* pInfo, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { - const VkLayerDispatchTable *disp = loader_get_dispatch(device); +VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorBufferEmbeddedSamplers2EXT( + VkCommandBuffer commandBuffer, + const VkBindDescriptorBufferEmbeddedSamplersInfoEXT* pBindDescriptorBufferEmbeddedSamplersInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetDeviceImageSparseMemoryRequirementsKHR: Invalid device " - "[VUID-vkGetDeviceImageSparseMemoryRequirementsKHR-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdBindDescriptorBufferEmbeddedSamplers2EXT: Invalid commandBuffer " + "[VUID-vkCmdBindDescriptorBufferEmbeddedSamplers2EXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - disp->GetDeviceImageSparseMemoryRequirementsKHR(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); + disp->CmdBindDescriptorBufferEmbeddedSamplers2EXT(commandBuffer, pBindDescriptorBufferEmbeddedSamplersInfo); } @@ -3960,7 +5045,7 @@ VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT( const VkDebugMarkerObjectTagInfoEXT* pTagInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDebugMarkerSetObjectTagEXT: Invalid device " "[VUID-vkDebugMarkerSetObjectTagEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -3972,6 +5057,10 @@ VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT( struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->object; local_tag_info.object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev; } + if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pTagInfo->object; + local_tag_info.object = (uint64_t)(uintptr_t)instance->instance; + } return disp->DebugMarkerSetObjectTagEXT(device, &local_tag_info); } @@ -3981,26 +5070,33 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT( 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 != icd_term->dispatch.DebugMarkerSetObjectTagEXT) { - VkDebugMarkerObjectTagInfoEXT local_tag_info; - memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugMarkerObjectTagInfoEXT)); - // If this is a physical device, we have to replace it with the proper one for the next call. - if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pTagInfo->object; - local_tag_info.object = (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_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { - if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pTagInfo->object; - if (NULL != icd_surface->real_icd_surfaces) { - local_tag_info.object = (uint64_t)icd_surface->real_icd_surfaces[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, "DebugMarkerSetObjectTagEXT: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkDebugMarkerObjectTagInfoEXT local_tag_info; + memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugMarkerObjectTagInfoEXT)); + // If this is a physical device, we have to replace it with the proper one for the next call. + if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pTagInfo->object; + local_tag_info.object = (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_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + if (NULL != dev && NULL != dev->loader_dispatch.core_dispatch.CreateSwapchainKHR) { + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pTagInfo->object; + if (NULL != icd_surface->real_icd_surfaces) { + local_tag_info.object = (uint64_t)icd_surface->real_icd_surfaces[icd_index]; } } - return icd_term->dispatch.DebugMarkerSetObjectTagEXT(device, &local_tag_info); - } else { - return VK_SUCCESS; + // If this is an instance we have to replace it with the proper one for the next call. + } else if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + local_tag_info.object = (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.DebugMarkerSetObjectTagEXT) + return VK_SUCCESS; + return dev->loader_dispatch.extension_terminator_dispatch.DebugMarkerSetObjectTagEXT(device, &local_tag_info); } VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT( @@ -4008,7 +5104,7 @@ VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT( const VkDebugMarkerObjectNameInfoEXT* pNameInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDebugMarkerSetObjectNameEXT: Invalid device " "[VUID-vkDebugMarkerSetObjectNameEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4020,6 +5116,10 @@ VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT( struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->object; local_name_info.object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev; } + if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pNameInfo->object; + local_name_info.object = (uint64_t)(uintptr_t)instance->instance; + } return disp->DebugMarkerSetObjectNameEXT(device, &local_name_info); } @@ -4029,26 +5129,33 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT( 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 != icd_term->dispatch.DebugMarkerSetObjectNameEXT) { - VkDebugMarkerObjectNameInfoEXT local_name_info; - memcpy(&local_name_info, pNameInfo, sizeof(VkDebugMarkerObjectNameInfoEXT)); - // If this is a physical device, we have to replace it with the proper one for the next call. - if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pNameInfo->object; - local_name_info.object = (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_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { - if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pNameInfo->object; - if (NULL != icd_surface->real_icd_surfaces) { - local_name_info.object = (uint64_t)icd_surface->real_icd_surfaces[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, "DebugMarkerSetObjectNameEXT: Invalid device handle"); + abort(); /* Intentionally fail so user can correct issue. */ + } + VkDebugMarkerObjectNameInfoEXT local_name_info; + memcpy(&local_name_info, pNameInfo, sizeof(VkDebugMarkerObjectNameInfoEXT)); + // If this is a physical device, we have to replace it with the proper one for the next call. + if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pNameInfo->object; + local_name_info.object = (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_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + if (NULL != dev && NULL != dev->loader_dispatch.core_dispatch.CreateSwapchainKHR) { + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pNameInfo->object; + if (NULL != icd_surface->real_icd_surfaces) { + local_name_info.object = (uint64_t)icd_surface->real_icd_surfaces[icd_index]; } } - return icd_term->dispatch.DebugMarkerSetObjectNameEXT(device, &local_name_info); - } else { - return VK_SUCCESS; + // If this is an instance we have to replace it with the proper one for the next call. + } else if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + local_name_info.object = (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.DebugMarkerSetObjectNameEXT) + return VK_SUCCESS; + return dev->loader_dispatch.extension_terminator_dispatch.DebugMarkerSetObjectNameEXT(device, &local_name_info); } VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT( @@ -4056,7 +5163,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT( const VkDebugMarkerMarkerInfoEXT* pMarkerInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDebugMarkerBeginEXT: Invalid commandBuffer " "[VUID-vkCmdDebugMarkerBeginEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4068,7 +5175,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerEndEXT( VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDebugMarkerEndEXT: Invalid commandBuffer " "[VUID-vkCmdDebugMarkerEndEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4081,7 +5188,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT( const VkDebugMarkerMarkerInfoEXT* pMarkerInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDebugMarkerInsertEXT: Invalid commandBuffer " "[VUID-vkCmdDebugMarkerInsertEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4101,7 +5208,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindTransformFeedbackBuffersEXT( const VkDeviceSize* pSizes) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindTransformFeedbackBuffersEXT: Invalid commandBuffer " "[VUID-vkCmdBindTransformFeedbackBuffersEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4117,7 +5224,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginTransformFeedbackEXT( const VkDeviceSize* pCounterBufferOffsets) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginTransformFeedbackEXT: Invalid commandBuffer " "[VUID-vkCmdBeginTransformFeedbackEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4133,7 +5240,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndTransformFeedbackEXT( const VkDeviceSize* pCounterBufferOffsets) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndTransformFeedbackEXT: Invalid commandBuffer " "[VUID-vkCmdEndTransformFeedbackEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4149,7 +5256,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginQueryIndexedEXT( uint32_t index) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginQueryIndexedEXT: Invalid commandBuffer " "[VUID-vkCmdBeginQueryIndexedEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4164,7 +5271,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndQueryIndexedEXT( uint32_t index) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndQueryIndexedEXT: Invalid commandBuffer " "[VUID-vkCmdEndQueryIndexedEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4182,7 +5289,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectByteCountEXT( uint32_t vertexStride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndirectByteCountEXT: Invalid commandBuffer " "[VUID-vkCmdDrawIndirectByteCountEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4200,7 +5307,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateCuModuleNVX( VkCuModuleNVX* pModule) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateCuModuleNVX: Invalid device " "[VUID-vkCreateCuModuleNVX-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4215,7 +5322,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateCuFunctionNVX( VkCuFunctionNVX* pFunction) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateCuFunctionNVX: Invalid device " "[VUID-vkCreateCuFunctionNVX-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4229,7 +5336,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyCuModuleNVX( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyCuModuleNVX: Invalid device " "[VUID-vkDestroyCuModuleNVX-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4243,7 +5350,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyCuFunctionNVX( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyCuFunctionNVX: Invalid device " "[VUID-vkDestroyCuFunctionNVX-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4256,7 +5363,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCuLaunchKernelNVX( const VkCuLaunchInfoNVX* pLaunchInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCuLaunchKernelNVX: Invalid commandBuffer " "[VUID-vkCmdCuLaunchKernelNVX-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4272,7 +5379,7 @@ VKAPI_ATTR uint32_t VKAPI_CALL GetImageViewHandleNVX( const VkImageViewHandleInfoNVX* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageViewHandleNVX: Invalid device " "[VUID-vkGetImageViewHandleNVX-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4286,7 +5393,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetImageViewAddressNVX( VkImageViewAddressPropertiesNVX* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageViewAddressNVX: Invalid device " "[VUID-vkGetImageViewAddressNVX-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4307,7 +5414,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectCountAMD( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndirectCountAMD: Invalid commandBuffer " "[VUID-vkCmdDrawIndirectCountAMD-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4325,7 +5432,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirectCountAMD( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndexedIndirectCountAMD: Invalid commandBuffer " "[VUID-vkCmdDrawIndexedIndirectCountAMD-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4345,7 +5452,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetShaderInfoAMD( void* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetShaderInfoAMD: Invalid device " "[VUID-vkGetShaderInfoAMD-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4356,7 +5463,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetShaderInfoAMD( // ---- VK_NV_external_memory_win32 extension trampoline/terminators -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV( VkDevice device, VkDeviceMemory memory, @@ -4364,7 +5471,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV( HANDLE* pHandle) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMemoryWin32HandleNV: Invalid device " "[VUID-vkGetMemoryWin32HandleNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4381,7 +5488,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginConditionalRenderingEXT( const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginConditionalRenderingEXT: Invalid commandBuffer " "[VUID-vkCmdBeginConditionalRenderingEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4393,7 +5500,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndConditionalRenderingEXT( VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndConditionalRenderingEXT: Invalid commandBuffer " "[VUID-vkCmdEndConditionalRenderingEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4411,7 +5518,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetViewportWScalingNV( const VkViewportWScalingNV* pViewportWScalings) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetViewportWScalingNV: Invalid commandBuffer " "[VUID-vkCmdSetViewportWScalingNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4428,7 +5535,7 @@ VKAPI_ATTR VkResult VKAPI_CALL DisplayPowerControlEXT( const VkDisplayPowerInfoEXT* pDisplayPowerInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4443,7 +5550,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RegisterDeviceEventEXT( VkFence* pFence) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4459,7 +5566,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RegisterDisplayEventEXT( VkFence* pFence) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4474,7 +5581,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainCounterEXT( uint64_t* pCounterValue) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4491,7 +5598,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetRefreshCycleDurationGOOGLE( VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetRefreshCycleDurationGOOGLE: Invalid device " "[VUID-vkGetRefreshCycleDurationGOOGLE-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4506,7 +5613,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPastPresentationTimingGOOGLE( VkPastPresentationTimingGOOGLE* pPresentationTimings) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPastPresentationTimingGOOGLE: Invalid device " "[VUID-vkGetPastPresentationTimingGOOGLE-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4524,7 +5631,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleEXT( const VkRect2D* pDiscardRectangles) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4532,6 +5639,32 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleEXT( 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 @@ -4542,7 +5675,7 @@ VKAPI_ATTR void VKAPI_CALL SetHdrMetadataEXT( const VkHdrMetadataEXT* pMetadata) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4558,7 +5691,7 @@ VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectNameEXT( const VkDebugUtilsObjectNameInfoEXT* pNameInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4570,6 +5703,10 @@ VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectNameEXT( 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 { @@ -4583,26 +5720,33 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_SetDebugUtilsObjectNameEXT( 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 != icd_term->dispatch.SetDebugUtilsObjectNameEXT) { - 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 != icd_term && NULL != icd_term->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 (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]; } } - return icd_term->dispatch.SetDebugUtilsObjectNameEXT(device, &local_name_info); - } else { - return VK_SUCCESS; + // 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( @@ -4610,7 +5754,7 @@ VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectTagEXT( const VkDebugUtilsObjectTagInfoEXT* pTagInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4622,6 +5766,10 @@ VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectTagEXT( 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 { @@ -4635,26 +5783,33 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_SetDebugUtilsObjectTagEXT( 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 != icd_term->dispatch.SetDebugUtilsObjectTagEXT) { - 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 != icd_term && NULL != icd_term->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 (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]; } } - return icd_term->dispatch.SetDebugUtilsObjectTagEXT(device, &local_tag_info); - } else { - return VK_SUCCESS; + // 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( @@ -4662,7 +5817,7 @@ VKAPI_ATTR void VKAPI_CALL QueueBeginDebugUtilsLabelEXT( const VkDebugUtilsLabelEXT* pLabelInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4675,19 +5830,21 @@ VKAPI_ATTR void VKAPI_CALL QueueBeginDebugUtilsLabelEXT( VKAPI_ATTR void VKAPI_CALL terminator_QueueBeginDebugUtilsLabelEXT( VkQueue queue, const VkDebugUtilsLabelEXT* pLabelInfo) { - uint32_t icd_index = 0; - struct loader_device *dev; - struct loader_icd_term *icd_term = loader_get_icd_and_device(queue, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.QueueBeginDebugUtilsLabelEXT) { - icd_term->dispatch.QueueBeginDebugUtilsLabelEXT(queue, 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_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4699,12 +5856,14 @@ VKAPI_ATTR void VKAPI_CALL QueueEndDebugUtilsLabelEXT( VKAPI_ATTR void VKAPI_CALL terminator_QueueEndDebugUtilsLabelEXT( VkQueue queue) { - uint32_t icd_index = 0; - struct loader_device *dev; - struct loader_icd_term *icd_term = loader_get_icd_and_device(queue, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.QueueEndDebugUtilsLabelEXT) { - icd_term->dispatch.QueueEndDebugUtilsLabelEXT(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( @@ -4712,7 +5871,7 @@ VKAPI_ATTR void VKAPI_CALL QueueInsertDebugUtilsLabelEXT( const VkDebugUtilsLabelEXT* pLabelInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4725,12 +5884,14 @@ VKAPI_ATTR void VKAPI_CALL QueueInsertDebugUtilsLabelEXT( VKAPI_ATTR void VKAPI_CALL terminator_QueueInsertDebugUtilsLabelEXT( VkQueue queue, const VkDebugUtilsLabelEXT* pLabelInfo) { - uint32_t icd_index = 0; - struct loader_device *dev; - struct loader_icd_term *icd_term = loader_get_icd_and_device(queue, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.QueueInsertDebugUtilsLabelEXT) { - icd_term->dispatch.QueueInsertDebugUtilsLabelEXT(queue, 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( @@ -4738,7 +5899,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginDebugUtilsLabelEXT( const VkDebugUtilsLabelEXT* pLabelInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4751,19 +5912,21 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginDebugUtilsLabelEXT( VKAPI_ATTR void VKAPI_CALL terminator_CmdBeginDebugUtilsLabelEXT( VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo) { - uint32_t icd_index = 0; - struct loader_device *dev; - struct loader_icd_term *icd_term = loader_get_icd_and_device(commandBuffer, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.CmdBeginDebugUtilsLabelEXT) { - icd_term->dispatch.CmdBeginDebugUtilsLabelEXT(commandBuffer, 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_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4775,12 +5938,14 @@ VKAPI_ATTR void VKAPI_CALL CmdEndDebugUtilsLabelEXT( VKAPI_ATTR void VKAPI_CALL terminator_CmdEndDebugUtilsLabelEXT( VkCommandBuffer commandBuffer) { - uint32_t icd_index = 0; - struct loader_device *dev; - struct loader_icd_term *icd_term = loader_get_icd_and_device(commandBuffer, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.CmdEndDebugUtilsLabelEXT) { - icd_term->dispatch.CmdEndDebugUtilsLabelEXT(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( @@ -4788,7 +5953,7 @@ VKAPI_ATTR void VKAPI_CALL CmdInsertDebugUtilsLabelEXT( const VkDebugUtilsLabelEXT* pLabelInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4801,25 +5966,27 @@ VKAPI_ATTR void VKAPI_CALL CmdInsertDebugUtilsLabelEXT( VKAPI_ATTR void VKAPI_CALL terminator_CmdInsertDebugUtilsLabelEXT( VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo) { - uint32_t icd_index = 0; - struct loader_device *dev; - struct loader_icd_term *icd_term = loader_get_icd_and_device(commandBuffer, &dev, &icd_index); - if (NULL != icd_term && NULL != icd_term->dispatch.CmdInsertDebugUtilsLabelEXT) { - icd_term->dispatch.CmdInsertDebugUtilsLabelEXT(commandBuffer, 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_ANDROID_external_memory_android_hardware_buffer extension trampoline/terminators -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetAndroidHardwareBufferPropertiesANDROID( VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetAndroidHardwareBufferPropertiesANDROID: Invalid device " "[VUID-vkGetAndroidHardwareBufferPropertiesANDROID-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4828,14 +5995,14 @@ VKAPI_ATTR VkResult VKAPI_CALL GetAndroidHardwareBufferPropertiesANDROID( } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetMemoryAndroidHardwareBufferANDROID( VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMemoryAndroidHardwareBufferANDROID: Invalid device " "[VUID-vkGetMemoryAndroidHardwareBufferANDROID-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4845,6 +6012,124 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryAndroidHardwareBufferANDROID( #endif // VK_USE_PLATFORM_ANDROID_KHR +// ---- VK_AMDX_shader_enqueue extension trampoline/terminators + +#if defined(VK_ENABLE_BETA_EXTENSIONS) +VKAPI_ATTR VkResult VKAPI_CALL CreateExecutionGraphPipelinesAMDX( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines) { + 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, + "vkCreateExecutionGraphPipelinesAMDX: Invalid device " + "[VUID-vkCreateExecutionGraphPipelinesAMDX-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreateExecutionGraphPipelinesAMDX(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); +} + +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) +VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineScratchSizeAMDX( + VkDevice device, + VkPipeline executionGraph, + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo) { + 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, + "vkGetExecutionGraphPipelineScratchSizeAMDX: Invalid device " + "[VUID-vkGetExecutionGraphPipelineScratchSizeAMDX-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetExecutionGraphPipelineScratchSizeAMDX(device, executionGraph, pSizeInfo); +} + +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) +VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineNodeIndexAMDX( + VkDevice device, + VkPipeline executionGraph, + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, + uint32_t* pNodeIndex) { + 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, + "vkGetExecutionGraphPipelineNodeIndexAMDX: Invalid device " + "[VUID-vkGetExecutionGraphPipelineNodeIndexAMDX-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetExecutionGraphPipelineNodeIndexAMDX(device, executionGraph, pNodeInfo, pNodeIndex); +} + +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) +VKAPI_ATTR void VKAPI_CALL CmdInitializeGraphScratchMemoryAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch) { + 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, + "vkCmdInitializeGraphScratchMemoryAMDX: Invalid commandBuffer " + "[VUID-vkCmdInitializeGraphScratchMemoryAMDX-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdInitializeGraphScratchMemoryAMDX(commandBuffer, scratch); +} + +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) +VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo) { + 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, + "vkCmdDispatchGraphAMDX: Invalid commandBuffer " + "[VUID-vkCmdDispatchGraphAMDX-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdDispatchGraphAMDX(commandBuffer, scratch, pCountInfo); +} + +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) +VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo) { + 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, + "vkCmdDispatchGraphIndirectAMDX: Invalid commandBuffer " + "[VUID-vkCmdDispatchGraphIndirectAMDX-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdDispatchGraphIndirectAMDX(commandBuffer, scratch, pCountInfo); +} + +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) +VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectCountAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + VkDeviceAddress countInfo) { + 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, + "vkCmdDispatchGraphIndirectCountAMDX: Invalid commandBuffer " + "[VUID-vkCmdDispatchGraphIndirectCountAMDX-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdDispatchGraphIndirectCountAMDX(commandBuffer, scratch, countInfo); +} + +#endif // VK_ENABLE_BETA_EXTENSIONS + // ---- VK_EXT_sample_locations extension trampoline/terminators VKAPI_ATTR void VKAPI_CALL CmdSetSampleLocationsEXT( @@ -4852,7 +6137,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetSampleLocationsEXT( const VkSampleLocationsInfoEXT* pSampleLocationsInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4867,7 +6152,7 @@ VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMultisamplePropertiesEXT( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4883,7 +6168,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMultisamplePropertiesEXT( 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_ERROR_BIT, 0, + 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. */ } @@ -4899,7 +6184,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetImageDrmFormatModifierPropertiesEXT( VkImageDrmFormatModifierPropertiesEXT* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -4917,7 +6202,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateValidationCacheEXT( VkValidationCacheEXT* pValidationCache) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateValidationCacheEXT: Invalid device " "[VUID-vkCreateValidationCacheEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4931,7 +6216,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyValidationCacheEXT( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyValidationCacheEXT: Invalid device " "[VUID-vkDestroyValidationCacheEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4946,7 +6231,7 @@ VKAPI_ATTR VkResult VKAPI_CALL MergeValidationCachesEXT( const VkValidationCacheEXT* pSrcCaches) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkMergeValidationCachesEXT: Invalid device " "[VUID-vkMergeValidationCachesEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4961,7 +6246,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetValidationCacheDataEXT( void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetValidationCacheDataEXT: Invalid device " "[VUID-vkGetValidationCacheDataEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4978,7 +6263,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindShadingRateImageNV( VkImageLayout imageLayout) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindShadingRateImageNV: Invalid commandBuffer " "[VUID-vkCmdBindShadingRateImageNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -4993,7 +6278,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetViewportShadingRatePaletteNV( const VkShadingRatePaletteNV* pShadingRatePalettes) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetViewportShadingRatePaletteNV: Invalid commandBuffer " "[VUID-vkCmdSetViewportShadingRatePaletteNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5008,7 +6293,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCoarseSampleOrderNV( const VkCoarseSampleOrderCustomNV* pCustomSampleOrders) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCoarseSampleOrderNV: Invalid commandBuffer " "[VUID-vkCmdSetCoarseSampleOrderNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5026,7 +6311,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureNV( VkAccelerationStructureNV* pAccelerationStructure) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateAccelerationStructureNV: Invalid device " "[VUID-vkCreateAccelerationStructureNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5040,7 +6325,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyAccelerationStructureNV( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyAccelerationStructureNV: Invalid device " "[VUID-vkDestroyAccelerationStructureNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5054,7 +6339,7 @@ VKAPI_ATTR void VKAPI_CALL GetAccelerationStructureMemoryRequirementsNV( VkMemoryRequirements2KHR* pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetAccelerationStructureMemoryRequirementsNV: Invalid device " "[VUID-vkGetAccelerationStructureMemoryRequirementsNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5068,7 +6353,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BindAccelerationStructureMemoryNV( const VkBindAccelerationStructureMemoryInfoNV* pBindInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindAccelerationStructureMemoryNV: Invalid device " "[VUID-vkBindAccelerationStructureMemoryNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5088,7 +6373,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBuildAccelerationStructureNV( VkDeviceSize scratchOffset) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBuildAccelerationStructureNV: Invalid commandBuffer " "[VUID-vkCmdBuildAccelerationStructureNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5103,7 +6388,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyAccelerationStructureNV( VkCopyAccelerationStructureModeKHR mode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyAccelerationStructureNV: Invalid commandBuffer " "[VUID-vkCmdCopyAccelerationStructureNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5129,7 +6414,7 @@ VKAPI_ATTR void VKAPI_CALL CmdTraceRaysNV( uint32_t depth) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdTraceRaysNV: Invalid commandBuffer " "[VUID-vkCmdTraceRaysNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5146,7 +6431,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesNV( VkPipeline* pPipelines) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateRayTracingPipelinesNV: Invalid device " "[VUID-vkCreateRayTracingPipelinesNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5163,7 +6448,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetRayTracingShaderGroupHandlesKHR( void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetRayTracingShaderGroupHandlesKHR: Invalid device " "[VUID-vkGetRayTracingShaderGroupHandlesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5180,7 +6465,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetRayTracingShaderGroupHandlesNV( void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetRayTracingShaderGroupHandlesNV: Invalid device " "[VUID-vkGetRayTracingShaderGroupHandlesNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5195,7 +6480,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetAccelerationStructureHandleNV( void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetAccelerationStructureHandleNV: Invalid device " "[VUID-vkGetAccelerationStructureHandleNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5212,7 +6497,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteAccelerationStructuresPropertiesNV( uint32_t firstQuery) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdWriteAccelerationStructuresPropertiesNV: Invalid commandBuffer " "[VUID-vkCmdWriteAccelerationStructuresPropertiesNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5226,7 +6511,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CompileDeferredNV( uint32_t shader) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCompileDeferredNV: Invalid device " "[VUID-vkCompileDeferredNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5244,7 +6529,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryHostPointerPropertiesEXT( VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5263,7 +6548,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteBufferMarkerAMD( uint32_t marker) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdWriteBufferMarkerAMD: Invalid commandBuffer " "[VUID-vkCmdWriteBufferMarkerAMD-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5277,11 +6562,11 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteBufferMarkerAMD( VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCalibrateableTimeDomainsEXT( VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, - VkTimeDomainEXT* pTimeDomains) { + VkTimeDomainKHR* 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_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5293,11 +6578,11 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCalibrateableTimeDomainsEXT( VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceCalibrateableTimeDomainsEXT( VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, - VkTimeDomainEXT* pTimeDomains) { + VkTimeDomainKHR* 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_ERROR_BIT, 0, + 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. */ } @@ -5307,12 +6592,12 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceCalibrateableTimeDoma VKAPI_ATTR VkResult VKAPI_CALL GetCalibratedTimestampsEXT( VkDevice device, uint32_t timestampCount, - const VkCalibratedTimestampInfoEXT* pTimestampInfos, + const VkCalibratedTimestampInfoKHR* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5329,7 +6614,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksNV( uint32_t firstTask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMeshTasksNV: Invalid commandBuffer " "[VUID-vkCmdDrawMeshTasksNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5345,7 +6630,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectNV( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMeshTasksIndirectNV: Invalid commandBuffer " "[VUID-vkCmdDrawMeshTasksIndirectNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5363,7 +6648,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectCountNV( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMeshTasksIndirectCountNV: Invalid commandBuffer " "[VUID-vkCmdDrawMeshTasksIndirectCountNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5374,6 +6659,21 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectCountNV( // ---- VK_NV_scissor_exclusive extension trampoline/terminators +VKAPI_ATTR void VKAPI_CALL CmdSetExclusiveScissorEnableNV( + VkCommandBuffer commandBuffer, + uint32_t firstExclusiveScissor, + uint32_t exclusiveScissorCount, + const VkBool32* pExclusiveScissorEnables) { + 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, + "vkCmdSetExclusiveScissorEnableNV: Invalid commandBuffer " + "[VUID-vkCmdSetExclusiveScissorEnableNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetExclusiveScissorEnableNV(commandBuffer, firstExclusiveScissor, exclusiveScissorCount, pExclusiveScissorEnables); +} + VKAPI_ATTR void VKAPI_CALL CmdSetExclusiveScissorNV( VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, @@ -5381,7 +6681,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetExclusiveScissorNV( const VkRect2D* pExclusiveScissors) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetExclusiveScissorNV: Invalid commandBuffer " "[VUID-vkCmdSetExclusiveScissorNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5397,7 +6697,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCheckpointNV( const void* pCheckpointMarker) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCheckpointNV: Invalid commandBuffer " "[VUID-vkCmdSetCheckpointNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5411,7 +6711,7 @@ VKAPI_ATTR void VKAPI_CALL GetQueueCheckpointDataNV( VkCheckpointDataNV* pCheckpointData) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetQueueCheckpointDataNV: Invalid queue " "[VUID-vkGetQueueCheckpointDataNV-queue-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5427,7 +6727,7 @@ VKAPI_ATTR VkResult VKAPI_CALL InitializePerformanceApiINTEL( const VkInitializePerformanceApiInfoINTEL* pInitializeInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkInitializePerformanceApiINTEL: Invalid device " "[VUID-vkInitializePerformanceApiINTEL-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5439,7 +6739,7 @@ VKAPI_ATTR void VKAPI_CALL UninitializePerformanceApiINTEL( VkDevice device) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkUninitializePerformanceApiINTEL: Invalid device " "[VUID-vkUninitializePerformanceApiINTEL-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5452,7 +6752,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CmdSetPerformanceMarkerINTEL( const VkPerformanceMarkerInfoINTEL* pMarkerInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetPerformanceMarkerINTEL: Invalid commandBuffer " "[VUID-vkCmdSetPerformanceMarkerINTEL-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5465,7 +6765,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CmdSetPerformanceStreamMarkerINTEL( const VkPerformanceStreamMarkerInfoINTEL* pMarkerInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetPerformanceStreamMarkerINTEL: Invalid commandBuffer " "[VUID-vkCmdSetPerformanceStreamMarkerINTEL-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5478,7 +6778,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CmdSetPerformanceOverrideINTEL( const VkPerformanceOverrideInfoINTEL* pOverrideInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetPerformanceOverrideINTEL: Invalid commandBuffer " "[VUID-vkCmdSetPerformanceOverrideINTEL-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5492,7 +6792,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquirePerformanceConfigurationINTEL( VkPerformanceConfigurationINTEL* pConfiguration) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAcquirePerformanceConfigurationINTEL: Invalid device " "[VUID-vkAcquirePerformanceConfigurationINTEL-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5505,7 +6805,7 @@ VKAPI_ATTR VkResult VKAPI_CALL ReleasePerformanceConfigurationINTEL( VkPerformanceConfigurationINTEL configuration) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkReleasePerformanceConfigurationINTEL: Invalid device " "[VUID-vkReleasePerformanceConfigurationINTEL-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5518,7 +6818,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueSetPerformanceConfigurationINTEL( VkPerformanceConfigurationINTEL configuration) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkQueueSetPerformanceConfigurationINTEL: Invalid queue " "[VUID-vkQueueSetPerformanceConfigurationINTEL-queue-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5532,7 +6832,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPerformanceParameterINTEL( VkPerformanceValueINTEL* pValue) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPerformanceParameterINTEL: Invalid device " "[VUID-vkGetPerformanceParameterINTEL-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5549,7 +6849,7 @@ VKAPI_ATTR void VKAPI_CALL SetLocalDimmingAMD( VkBool32 localDimmingEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkSetLocalDimmingAMD: Invalid device " "[VUID-vkSetLocalDimmingAMD-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5565,7 +6865,7 @@ VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetBufferDeviceAddressEXT( const VkBufferDeviceAddressInfo* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferDeviceAddressEXT: Invalid device " "[VUID-vkGetBufferDeviceAddressEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5583,7 +6883,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixPropertiesNV( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceCooperativeMatrixPropertiesNV: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceCooperativeMatrixPropertiesNV-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5599,7 +6899,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceCooperativeMatrixProp 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.GetPhysicalDeviceCooperativeMatrixPropertiesNV) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceCooperativeMatrixPropertiesNV"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -5616,7 +6916,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSupportedFramebufferMixedSamples const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5632,7 +6932,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSupportedFramebufferM 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.GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -5642,13 +6942,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSupportedFramebufferM // ---- VK_EXT_full_screen_exclusive extension trampoline/terminators -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL AcquireFullScreenExclusiveModeEXT( VkDevice device, VkSwapchainKHR swapchain) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAcquireFullScreenExclusiveModeEXT: Invalid device " "[VUID-vkAcquireFullScreenExclusiveModeEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5657,13 +6957,13 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireFullScreenExclusiveModeEXT( } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL ReleaseFullScreenExclusiveModeEXT( VkDevice device, VkSwapchainKHR swapchain) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkReleaseFullScreenExclusiveModeEXT: Invalid device " "[VUID-vkReleaseFullScreenExclusiveModeEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5681,7 +6981,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetLineStippleEXT( uint16_t lineStipplePattern) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5699,7 +6999,7 @@ VKAPI_ATTR void VKAPI_CALL ResetQueryPoolEXT( uint32_t queryCount) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkResetQueryPoolEXT: Invalid device " "[VUID-vkResetQueryPoolEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5715,7 +7015,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCullModeEXT( VkCullModeFlags cullMode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5728,7 +7028,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetFrontFaceEXT( VkFrontFace frontFace) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5741,7 +7041,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetPrimitiveTopologyEXT( VkPrimitiveTopology primitiveTopology) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5755,7 +7055,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetViewportWithCountEXT( const VkViewport* pViewports) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5769,7 +7069,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetScissorWithCountEXT( const VkRect2D* pScissors) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5787,7 +7087,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers2EXT( const VkDeviceSize* pStrides) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5800,7 +7100,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthTestEnableEXT( VkBool32 depthTestEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5813,7 +7113,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthWriteEnableEXT( VkBool32 depthWriteEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5826,7 +7126,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthCompareOpEXT( VkCompareOp depthCompareOp) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5839,7 +7139,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthBoundsTestEnableEXT( VkBool32 depthBoundsTestEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5852,7 +7152,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetStencilTestEnableEXT( VkBool32 stencilTestEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5869,7 +7169,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetStencilOpEXT( VkCompareOp compareOp) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -5878,6 +7178,93 @@ VKAPI_ATTR void VKAPI_CALL CmdSetStencilOpEXT( } +// ---- VK_EXT_host_image_copy extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL CopyMemoryToImageEXT( + VkDevice device, + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo) { + 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, + "vkCopyMemoryToImageEXT: Invalid device " + "[VUID-vkCopyMemoryToImageEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CopyMemoryToImageEXT(device, pCopyMemoryToImageInfo); +} + +VKAPI_ATTR VkResult VKAPI_CALL CopyImageToMemoryEXT( + VkDevice device, + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo) { + 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, + "vkCopyImageToMemoryEXT: Invalid device " + "[VUID-vkCopyImageToMemoryEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CopyImageToMemoryEXT(device, pCopyImageToMemoryInfo); +} + +VKAPI_ATTR VkResult VKAPI_CALL CopyImageToImageEXT( + VkDevice device, + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo) { + 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, + "vkCopyImageToImageEXT: Invalid device " + "[VUID-vkCopyImageToImageEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CopyImageToImageEXT(device, pCopyImageToImageInfo); +} + +VKAPI_ATTR VkResult VKAPI_CALL TransitionImageLayoutEXT( + VkDevice device, + uint32_t transitionCount, + const VkHostImageLayoutTransitionInfoEXT* pTransitions) { + 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, + "vkTransitionImageLayoutEXT: Invalid device " + "[VUID-vkTransitionImageLayoutEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->TransitionImageLayoutEXT(device, transitionCount, pTransitions); +} + +VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout) { + 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, + "vkGetImageSubresourceLayout2EXT: Invalid device " + "[VUID-vkGetImageSubresourceLayout2EXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetImageSubresourceLayout2EXT(device, image, pSubresource, pLayout); +} + + +// ---- VK_EXT_swapchain_maintenance1 extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL ReleaseSwapchainImagesEXT( + VkDevice device, + const VkReleaseSwapchainImagesInfoEXT* pReleaseInfo) { + 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, + "vkReleaseSwapchainImagesEXT: Invalid device " + "[VUID-vkReleaseSwapchainImagesEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->ReleaseSwapchainImagesEXT(device, pReleaseInfo); +} + + // ---- VK_NV_device_generated_commands extension trampoline/terminators VKAPI_ATTR void VKAPI_CALL GetGeneratedCommandsMemoryRequirementsNV( @@ -5886,7 +7273,7 @@ VKAPI_ATTR void VKAPI_CALL GetGeneratedCommandsMemoryRequirementsNV( VkMemoryRequirements2* pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetGeneratedCommandsMemoryRequirementsNV: Invalid device " "[VUID-vkGetGeneratedCommandsMemoryRequirementsNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5899,7 +7286,7 @@ VKAPI_ATTR void VKAPI_CALL CmdPreprocessGeneratedCommandsNV( const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdPreprocessGeneratedCommandsNV: Invalid commandBuffer " "[VUID-vkCmdPreprocessGeneratedCommandsNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5913,7 +7300,7 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteGeneratedCommandsNV( const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdExecuteGeneratedCommandsNV: Invalid commandBuffer " "[VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5928,7 +7315,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindPipelineShaderGroupNV( uint32_t groupIndex) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindPipelineShaderGroupNV: Invalid commandBuffer " "[VUID-vkCmdBindPipelineShaderGroupNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5943,7 +7330,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateIndirectCommandsLayoutNV( VkIndirectCommandsLayoutNV* pIndirectCommandsLayout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateIndirectCommandsLayoutNV: Invalid device " "[VUID-vkCreateIndirectCommandsLayoutNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5957,7 +7344,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyIndirectCommandsLayoutNV( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyIndirectCommandsLayoutNV: Invalid device " "[VUID-vkDestroyIndirectCommandsLayoutNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5966,6 +7353,22 @@ VKAPI_ATTR void VKAPI_CALL DestroyIndirectCommandsLayoutNV( } +// ---- VK_EXT_depth_bias_control extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias2EXT( + VkCommandBuffer commandBuffer, + const VkDepthBiasInfoEXT* pDepthBiasInfo) { + 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, + "vkCmdSetDepthBias2EXT: Invalid commandBuffer " + "[VUID-vkCmdSetDepthBias2EXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdSetDepthBias2EXT(commandBuffer, pDepthBiasInfo); +} + + // ---- VK_EXT_acquire_drm_display extension trampoline/terminators VKAPI_ATTR VkResult VKAPI_CALL AcquireDrmDisplayEXT( @@ -5975,7 +7378,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireDrmDisplayEXT( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAcquireDrmDisplayEXT: Invalid physicalDevice " "[VUID-vkAcquireDrmDisplayEXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -5993,125 +7396,378 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireDrmDisplayEXT( if (NULL == icd_term->dispatch.AcquireDrmDisplayEXT) { loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support AcquireDrmDisplayEXT"); - return VK_ERROR_INITIALIZATION_FAILED; + return VK_ERROR_EXTENSION_NOT_PRESENT; + } + return icd_term->dispatch.AcquireDrmDisplayEXT(phys_dev_term->phys_dev, drmFd, display); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetDrmDisplayEXT( + VkPhysicalDevice physicalDevice, + int32_t drmFd, + uint32_t connectorId, + VkDisplayKHR* display) { + 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, + "vkGetDrmDisplayEXT: Invalid physicalDevice " + "[VUID-vkGetDrmDisplayEXT-physicalDevice-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp = loader_get_instance_layer_dispatch(physicalDevice); + return disp->GetDrmDisplayEXT(unwrapped_phys_dev, drmFd, connectorId, display); +} + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDrmDisplayEXT( + VkPhysicalDevice physicalDevice, + int32_t drmFd, + uint32_t connectorId, + VkDisplayKHR* display) { + 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.GetDrmDisplayEXT) { + loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + "ICD associated with VkPhysicalDevice does not support GetDrmDisplayEXT"); + return VK_ERROR_EXTENSION_NOT_PRESENT; + } + return icd_term->dispatch.GetDrmDisplayEXT(phys_dev_term->phys_dev, drmFd, connectorId, display); +} + + +// ---- VK_EXT_private_data extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL CreatePrivateDataSlotEXT( + VkDevice device, + const VkPrivateDataSlotCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPrivateDataSlot* pPrivateDataSlot) { + 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, + "vkCreatePrivateDataSlotEXT: Invalid device " + "[VUID-vkCreatePrivateDataSlotEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreatePrivateDataSlotEXT(device, pCreateInfo, pAllocator, pPrivateDataSlot); +} + +VKAPI_ATTR void VKAPI_CALL DestroyPrivateDataSlotEXT( + VkDevice device, + VkPrivateDataSlot privateDataSlot, + const VkAllocationCallbacks* pAllocator) { + 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, + "vkDestroyPrivateDataSlotEXT: Invalid device " + "[VUID-vkDestroyPrivateDataSlotEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->DestroyPrivateDataSlotEXT(device, privateDataSlot, pAllocator); +} + +VKAPI_ATTR VkResult VKAPI_CALL SetPrivateDataEXT( + VkDevice device, + VkObjectType objectType, + uint64_t objectHandle, + VkPrivateDataSlot privateDataSlot, + uint64_t data) { + 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, + "vkSetPrivateDataEXT: Invalid device " + "[VUID-vkSetPrivateDataEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->SetPrivateDataEXT(device, objectType, objectHandle, privateDataSlot, data); +} + +VKAPI_ATTR void VKAPI_CALL GetPrivateDataEXT( + VkDevice device, + VkObjectType objectType, + uint64_t objectHandle, + VkPrivateDataSlot privateDataSlot, + uint64_t* pData) { + 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, + "vkGetPrivateDataEXT: Invalid device " + "[VUID-vkGetPrivateDataEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetPrivateDataEXT(device, objectType, objectHandle, privateDataSlot, pData); +} + + +// ---- VK_NV_cuda_kernel_launch extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL CreateCudaModuleNV( + VkDevice device, + const VkCudaModuleCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCudaModuleNV* pModule) { + 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, + "vkCreateCudaModuleNV: Invalid device " + "[VUID-vkCreateCudaModuleNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreateCudaModuleNV(device, pCreateInfo, pAllocator, pModule); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetCudaModuleCacheNV( + VkDevice device, + VkCudaModuleNV module, + size_t* pCacheSize, + void* pCacheData) { + 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, + "vkGetCudaModuleCacheNV: Invalid device " + "[VUID-vkGetCudaModuleCacheNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetCudaModuleCacheNV(device, module, pCacheSize, pCacheData); +} + +VKAPI_ATTR VkResult VKAPI_CALL CreateCudaFunctionNV( + VkDevice device, + const VkCudaFunctionCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCudaFunctionNV* pFunction) { + 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, + "vkCreateCudaFunctionNV: Invalid device " + "[VUID-vkCreateCudaFunctionNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreateCudaFunctionNV(device, pCreateInfo, pAllocator, pFunction); +} + +VKAPI_ATTR void VKAPI_CALL DestroyCudaModuleNV( + VkDevice device, + VkCudaModuleNV module, + const VkAllocationCallbacks* pAllocator) { + 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, + "vkDestroyCudaModuleNV: Invalid device " + "[VUID-vkDestroyCudaModuleNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->DestroyCudaModuleNV(device, module, pAllocator); +} + +VKAPI_ATTR void VKAPI_CALL DestroyCudaFunctionNV( + VkDevice device, + VkCudaFunctionNV function, + const VkAllocationCallbacks* pAllocator) { + 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, + "vkDestroyCudaFunctionNV: Invalid device " + "[VUID-vkDestroyCudaFunctionNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->DestroyCudaFunctionNV(device, function, pAllocator); +} + +VKAPI_ATTR void VKAPI_CALL CmdCudaLaunchKernelNV( + VkCommandBuffer commandBuffer, + const VkCudaLaunchInfoNV* pLaunchInfo) { + 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, + "vkCmdCudaLaunchKernelNV: Invalid commandBuffer " + "[VUID-vkCmdCudaLaunchKernelNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCudaLaunchKernelNV(commandBuffer, pLaunchInfo); +} + + +// ---- VK_EXT_metal_objects extension trampoline/terminators + +#if defined(VK_USE_PLATFORM_METAL_EXT) +VKAPI_ATTR void VKAPI_CALL ExportMetalObjectsEXT( + VkDevice device, + VkExportMetalObjectsInfoEXT* pMetalObjectsInfo) { + 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, + "vkExportMetalObjectsEXT: Invalid device " + "[VUID-vkExportMetalObjectsEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->ExportMetalObjectsEXT(device, pMetalObjectsInfo); +} + +#endif // VK_USE_PLATFORM_METAL_EXT + +// ---- VK_EXT_descriptor_buffer extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL GetDescriptorSetLayoutSizeEXT( + VkDevice device, + VkDescriptorSetLayout layout, + VkDeviceSize* pLayoutSizeInBytes) { + 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, + "vkGetDescriptorSetLayoutSizeEXT: Invalid device " + "[VUID-vkGetDescriptorSetLayoutSizeEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetDescriptorSetLayoutSizeEXT(device, layout, pLayoutSizeInBytes); +} + +VKAPI_ATTR void VKAPI_CALL GetDescriptorSetLayoutBindingOffsetEXT( + VkDevice device, + VkDescriptorSetLayout layout, + uint32_t binding, + VkDeviceSize* pOffset) { + 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, + "vkGetDescriptorSetLayoutBindingOffsetEXT: Invalid device " + "[VUID-vkGetDescriptorSetLayoutBindingOffsetEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetDescriptorSetLayoutBindingOffsetEXT(device, layout, binding, pOffset); +} + +VKAPI_ATTR void VKAPI_CALL GetDescriptorEXT( + VkDevice device, + const VkDescriptorGetInfoEXT* pDescriptorInfo, + size_t dataSize, + void* pDescriptor) { + 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, + "vkGetDescriptorEXT: Invalid device " + "[VUID-vkGetDescriptorEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ } - return icd_term->dispatch.AcquireDrmDisplayEXT(phys_dev_term->phys_dev, drmFd, display); + disp->GetDescriptorEXT(device, pDescriptorInfo, dataSize, pDescriptor); } -VKAPI_ATTR VkResult VKAPI_CALL GetDrmDisplayEXT( - VkPhysicalDevice physicalDevice, - int32_t drmFd, - uint32_t connectorId, - VkDisplayKHR* display) { - const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); - if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetDrmDisplayEXT: Invalid physicalDevice " - "[VUID-vkGetDrmDisplayEXT-physicalDevice-parameter]"); +VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorBuffersEXT( + VkCommandBuffer commandBuffer, + uint32_t bufferCount, + const VkDescriptorBufferBindingInfoEXT* pBindingInfos) { + 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, + "vkCmdBindDescriptorBuffersEXT: Invalid commandBuffer " + "[VUID-vkCmdBindDescriptorBuffersEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - disp = loader_get_instance_layer_dispatch(physicalDevice); - return disp->GetDrmDisplayEXT(unwrapped_phys_dev, drmFd, connectorId, display); + disp->CmdBindDescriptorBuffersEXT(commandBuffer, bufferCount, pBindingInfos); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDrmDisplayEXT( - VkPhysicalDevice physicalDevice, - int32_t drmFd, - uint32_t connectorId, - VkDisplayKHR* display) { - 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.GetDrmDisplayEXT) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, - "ICD associated with VkPhysicalDevice does not support GetDrmDisplayEXT"); - return VK_ERROR_INITIALIZATION_FAILED; +VKAPI_ATTR void VKAPI_CALL CmdSetDescriptorBufferOffsetsEXT( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t firstSet, + uint32_t setCount, + const uint32_t* pBufferIndices, + const VkDeviceSize* pOffsets) { + 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, + "vkCmdSetDescriptorBufferOffsetsEXT: Invalid commandBuffer " + "[VUID-vkCmdSetDescriptorBufferOffsetsEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ } - return icd_term->dispatch.GetDrmDisplayEXT(phys_dev_term->phys_dev, drmFd, connectorId, display); + disp->CmdSetDescriptorBufferOffsetsEXT(commandBuffer, pipelineBindPoint, layout, firstSet, setCount, pBufferIndices, pOffsets); } +VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorBufferEmbeddedSamplersEXT( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t set) { + 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, + "vkCmdBindDescriptorBufferEmbeddedSamplersEXT: Invalid commandBuffer " + "[VUID-vkCmdBindDescriptorBufferEmbeddedSamplersEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdBindDescriptorBufferEmbeddedSamplersEXT(commandBuffer, pipelineBindPoint, layout, set); +} -// ---- VK_EXT_private_data extension trampoline/terminators - -VKAPI_ATTR VkResult VKAPI_CALL CreatePrivateDataSlotEXT( +VKAPI_ATTR VkResult VKAPI_CALL GetBufferOpaqueCaptureDescriptorDataEXT( VkDevice device, - const VkPrivateDataSlotCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkPrivateDataSlot* pPrivateDataSlot) { + const VkBufferCaptureDescriptorDataInfoEXT* pInfo, + void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkCreatePrivateDataSlotEXT: Invalid device " - "[VUID-vkCreatePrivateDataSlotEXT-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetBufferOpaqueCaptureDescriptorDataEXT: Invalid device " + "[VUID-vkGetBufferOpaqueCaptureDescriptorDataEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - return disp->CreatePrivateDataSlotEXT(device, pCreateInfo, pAllocator, pPrivateDataSlot); + return disp->GetBufferOpaqueCaptureDescriptorDataEXT(device, pInfo, pData); } -VKAPI_ATTR void VKAPI_CALL DestroyPrivateDataSlotEXT( +VKAPI_ATTR VkResult VKAPI_CALL GetImageOpaqueCaptureDescriptorDataEXT( VkDevice device, - VkPrivateDataSlot privateDataSlot, - const VkAllocationCallbacks* pAllocator) { + const VkImageCaptureDescriptorDataInfoEXT* pInfo, + void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkDestroyPrivateDataSlotEXT: Invalid device " - "[VUID-vkDestroyPrivateDataSlotEXT-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetImageOpaqueCaptureDescriptorDataEXT: Invalid device " + "[VUID-vkGetImageOpaqueCaptureDescriptorDataEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - disp->DestroyPrivateDataSlotEXT(device, privateDataSlot, pAllocator); + return disp->GetImageOpaqueCaptureDescriptorDataEXT(device, pInfo, pData); } -VKAPI_ATTR VkResult VKAPI_CALL SetPrivateDataEXT( +VKAPI_ATTR VkResult VKAPI_CALL GetImageViewOpaqueCaptureDescriptorDataEXT( VkDevice device, - VkObjectType objectType, - uint64_t objectHandle, - VkPrivateDataSlot privateDataSlot, - uint64_t data) { + const VkImageViewCaptureDescriptorDataInfoEXT* pInfo, + void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkSetPrivateDataEXT: Invalid device " - "[VUID-vkSetPrivateDataEXT-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetImageViewOpaqueCaptureDescriptorDataEXT: Invalid device " + "[VUID-vkGetImageViewOpaqueCaptureDescriptorDataEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - return disp->SetPrivateDataEXT(device, objectType, objectHandle, privateDataSlot, data); + return disp->GetImageViewOpaqueCaptureDescriptorDataEXT(device, pInfo, pData); } -VKAPI_ATTR void VKAPI_CALL GetPrivateDataEXT( +VKAPI_ATTR VkResult VKAPI_CALL GetSamplerOpaqueCaptureDescriptorDataEXT( VkDevice device, - VkObjectType objectType, - uint64_t objectHandle, - VkPrivateDataSlot privateDataSlot, - uint64_t* pData) { + const VkSamplerCaptureDescriptorDataInfoEXT* pInfo, + void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetPrivateDataEXT: Invalid device " - "[VUID-vkGetPrivateDataEXT-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetSamplerOpaqueCaptureDescriptorDataEXT: Invalid device " + "[VUID-vkGetSamplerOpaqueCaptureDescriptorDataEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - disp->GetPrivateDataEXT(device, objectType, objectHandle, privateDataSlot, pData); + return disp->GetSamplerOpaqueCaptureDescriptorDataEXT(device, pInfo, pData); } - -// ---- VK_EXT_metal_objects extension trampoline/terminators - -#ifdef VK_USE_PLATFORM_METAL_EXT -VKAPI_ATTR void VKAPI_CALL ExportMetalObjectsEXT( +VKAPI_ATTR VkResult VKAPI_CALL GetAccelerationStructureOpaqueCaptureDescriptorDataEXT( VkDevice device, - VkExportMetalObjectsInfoEXT* pMetalObjectsInfo) { + const VkAccelerationStructureCaptureDescriptorDataInfoEXT* pInfo, + void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkExportMetalObjectsEXT: Invalid device " - "[VUID-vkExportMetalObjectsEXT-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT: Invalid device " + "[VUID-vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - disp->ExportMetalObjectsEXT(device, pMetalObjectsInfo); + return disp->GetAccelerationStructureOpaqueCaptureDescriptorDataEXT(device, pInfo, pData); } -#endif // VK_USE_PLATFORM_METAL_EXT // ---- VK_NV_fragment_shading_rate_enums extension trampoline/terminators @@ -6121,7 +7777,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateEnumNV( const VkFragmentShadingRateCombinerOpKHR combinerOps[2]) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetFragmentShadingRateEnumNV: Invalid commandBuffer " "[VUID-vkCmdSetFragmentShadingRateEnumNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6130,24 +7786,6 @@ VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateEnumNV( } -// ---- VK_EXT_image_compression_control extension trampoline/terminators - -VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( - VkDevice device, - VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout) { - const VkLayerDispatchTable *disp = loader_get_dispatch(device); - if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetImageSubresourceLayout2EXT: Invalid device " - "[VUID-vkGetImageSubresourceLayout2EXT-device-parameter]"); - abort(); /* Intentionally fail so user can correct issue. */ - } - disp->GetImageSubresourceLayout2EXT(device, image, pSubresource, pLayout); -} - - // ---- VK_EXT_device_fault extension trampoline/terminators VKAPI_ATTR VkResult VKAPI_CALL GetDeviceFaultInfoEXT( @@ -6156,7 +7794,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDeviceFaultInfoEXT( VkDeviceFaultInfoEXT* pFaultInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceFaultInfoEXT: Invalid device " "[VUID-vkGetDeviceFaultInfoEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6167,14 +7805,14 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDeviceFaultInfoEXT( // ---- VK_NV_acquire_winrt_display extension trampoline/terminators -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL AcquireWinrtDisplayNV( VkPhysicalDevice physicalDevice, VkDisplayKHR display) { const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAcquireWinrtDisplayNV: Invalid physicalDevice " "[VUID-vkAcquireWinrtDisplayNV-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6189,7 +7827,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireWinrtDisplayNV( 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.AcquireWinrtDisplayNV) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support AcquireWinrtDisplayNV"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -6197,7 +7835,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireWinrtDisplayNV( } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL GetWinrtDisplayNV( VkPhysicalDevice physicalDevice, uint32_t deviceRelativeId, @@ -6205,7 +7843,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetWinrtDisplayNV( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetWinrtDisplayNV: Invalid physicalDevice " "[VUID-vkGetWinrtDisplayNV-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6221,7 +7859,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetWinrtDisplayNV( 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.GetWinrtDisplayNV) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support GetWinrtDisplayNV"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -6240,7 +7878,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetVertexInputEXT( const VkVertexInputAttributeDescription2EXT* pVertexAttributeDescriptions) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -6251,14 +7889,14 @@ VKAPI_ATTR void VKAPI_CALL CmdSetVertexInputEXT( // ---- VK_FUCHSIA_external_memory extension trampoline/terminators -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL GetMemoryZirconHandleFUCHSIA( VkDevice device, const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMemoryZirconHandleFUCHSIA: Invalid device " "[VUID-vkGetMemoryZirconHandleFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6267,7 +7905,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryZirconHandleFUCHSIA( } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL GetMemoryZirconHandlePropertiesFUCHSIA( VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, @@ -6275,7 +7913,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryZirconHandlePropertiesFUCHSIA( VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMemoryZirconHandlePropertiesFUCHSIA: Invalid device " "[VUID-vkGetMemoryZirconHandlePropertiesFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6287,13 +7925,13 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryZirconHandlePropertiesFUCHSIA( // ---- VK_FUCHSIA_external_semaphore extension trampoline/terminators -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreZirconHandleFUCHSIA( VkDevice device, const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkImportSemaphoreZirconHandleFUCHSIA: Invalid device " "[VUID-vkImportSemaphoreZirconHandleFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6302,14 +7940,14 @@ VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreZirconHandleFUCHSIA( } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreZirconHandleFUCHSIA( VkDevice device, const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetSemaphoreZirconHandleFUCHSIA: Invalid device " "[VUID-vkGetSemaphoreZirconHandleFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6321,7 +7959,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreZirconHandleFUCHSIA( // ---- VK_FUCHSIA_buffer_collection extension trampoline/terminators -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL CreateBufferCollectionFUCHSIA( VkDevice device, const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo, @@ -6329,7 +7967,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateBufferCollectionFUCHSIA( VkBufferCollectionFUCHSIA* pCollection) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateBufferCollectionFUCHSIA: Invalid device " "[VUID-vkCreateBufferCollectionFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6338,14 +7976,14 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateBufferCollectionFUCHSIA( } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL SetBufferCollectionImageConstraintsFUCHSIA( VkDevice device, VkBufferCollectionFUCHSIA collection, const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkSetBufferCollectionImageConstraintsFUCHSIA: Invalid device " "[VUID-vkSetBufferCollectionImageConstraintsFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6354,14 +7992,14 @@ VKAPI_ATTR VkResult VKAPI_CALL SetBufferCollectionImageConstraintsFUCHSIA( } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL SetBufferCollectionBufferConstraintsFUCHSIA( VkDevice device, VkBufferCollectionFUCHSIA collection, const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkSetBufferCollectionBufferConstraintsFUCHSIA: Invalid device " "[VUID-vkSetBufferCollectionBufferConstraintsFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6370,14 +8008,14 @@ VKAPI_ATTR VkResult VKAPI_CALL SetBufferCollectionBufferConstraintsFUCHSIA( } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR void VKAPI_CALL DestroyBufferCollectionFUCHSIA( VkDevice device, VkBufferCollectionFUCHSIA collection, const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyBufferCollectionFUCHSIA: Invalid device " "[VUID-vkDestroyBufferCollectionFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6386,14 +8024,14 @@ VKAPI_ATTR void VKAPI_CALL DestroyBufferCollectionFUCHSIA( } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL GetBufferCollectionPropertiesFUCHSIA( VkDevice device, VkBufferCollectionFUCHSIA collection, VkBufferCollectionPropertiesFUCHSIA* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferCollectionPropertiesFUCHSIA: Invalid device " "[VUID-vkGetBufferCollectionPropertiesFUCHSIA-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6411,7 +8049,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI( VkExtent2D* pMaxWorkgroupSize) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI: Invalid device " "[VUID-vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6423,7 +8061,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSubpassShadingHUAWEI( VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSubpassShadingHUAWEI: Invalid commandBuffer " "[VUID-vkCmdSubpassShadingHUAWEI-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6440,7 +8078,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindInvocationMaskHUAWEI( VkImageLayout imageLayout) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindInvocationMaskHUAWEI: Invalid commandBuffer " "[VUID-vkCmdBindInvocationMaskHUAWEI-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6457,7 +8095,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetMemoryRemoteAddressNV( VkRemoteAddressNV* pAddress) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMemoryRemoteAddressNV: Invalid device " "[VUID-vkGetMemoryRemoteAddressNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6474,7 +8112,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPipelinePropertiesEXT( VkBaseOutStructure* pPipelineProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPipelinePropertiesEXT: Invalid device " "[VUID-vkGetPipelinePropertiesEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6490,7 +8128,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetPatchControlPointsEXT( uint32_t patchControlPoints) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -6503,7 +8141,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetRasterizerDiscardEnableEXT( VkBool32 rasterizerDiscardEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -6516,7 +8154,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthBiasEnableEXT( VkBool32 depthBiasEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -6529,7 +8167,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetLogicOpEXT( VkLogicOp logicOp) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -6542,7 +8180,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetPrimitiveRestartEnableEXT( VkBool32 primitiveRestartEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -6559,7 +8197,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetColorWriteEn const VkBool32* pColorWriteEnables) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + 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. */ @@ -6579,7 +8217,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMultiEXT( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMultiEXT: Invalid commandBuffer " "[VUID-vkCmdDrawMultiEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6597,7 +8235,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMultiIndexedEXT( const int32_t* pVertexOffset) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMultiIndexedEXT: Invalid commandBuffer " "[VUID-vkCmdDrawMultiIndexedEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6615,7 +8253,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateMicromapEXT( VkMicromapEXT* pMicromap) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateMicromapEXT: Invalid device " "[VUID-vkCreateMicromapEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6629,7 +8267,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyMicromapEXT( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyMicromapEXT: Invalid device " "[VUID-vkDestroyMicromapEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6643,7 +8281,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBuildMicromapsEXT( const VkMicromapBuildInfoEXT* pInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBuildMicromapsEXT: Invalid commandBuffer " "[VUID-vkCmdBuildMicromapsEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6658,7 +8296,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BuildMicromapsEXT( const VkMicromapBuildInfoEXT* pInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBuildMicromapsEXT: Invalid device " "[VUID-vkBuildMicromapsEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6672,7 +8310,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CopyMicromapEXT( const VkCopyMicromapInfoEXT* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCopyMicromapEXT: Invalid device " "[VUID-vkCopyMicromapEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6686,7 +8324,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CopyMicromapToMemoryEXT( const VkCopyMicromapToMemoryInfoEXT* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCopyMicromapToMemoryEXT: Invalid device " "[VUID-vkCopyMicromapToMemoryEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6700,7 +8338,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CopyMemoryToMicromapEXT( const VkCopyMemoryToMicromapInfoEXT* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCopyMemoryToMicromapEXT: Invalid device " "[VUID-vkCopyMemoryToMicromapEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6718,7 +8356,7 @@ VKAPI_ATTR VkResult VKAPI_CALL WriteMicromapsPropertiesEXT( size_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkWriteMicromapsPropertiesEXT: Invalid device " "[VUID-vkWriteMicromapsPropertiesEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6731,7 +8369,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyMicromapEXT( const VkCopyMicromapInfoEXT* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyMicromapEXT: Invalid commandBuffer " "[VUID-vkCmdCopyMicromapEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6744,7 +8382,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyMicromapToMemoryEXT( const VkCopyMicromapToMemoryInfoEXT* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyMicromapToMemoryEXT: Invalid commandBuffer " "[VUID-vkCmdCopyMicromapToMemoryEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6757,7 +8395,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyMemoryToMicromapEXT( const VkCopyMemoryToMicromapInfoEXT* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyMemoryToMicromapEXT: Invalid commandBuffer " "[VUID-vkCmdCopyMemoryToMicromapEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6774,7 +8412,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteMicromapsPropertiesEXT( uint32_t firstQuery) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdWriteMicromapsPropertiesEXT: Invalid commandBuffer " "[VUID-vkCmdWriteMicromapsPropertiesEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6788,7 +8426,7 @@ VKAPI_ATTR void VKAPI_CALL GetDeviceMicromapCompatibilityEXT( VkAccelerationStructureCompatibilityKHR* pCompatibility) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceMicromapCompatibilityEXT: Invalid device " "[VUID-vkGetDeviceMicromapCompatibilityEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6803,7 +8441,7 @@ VKAPI_ATTR void VKAPI_CALL GetMicromapBuildSizesEXT( VkMicromapBuildSizesInfoEXT* pSizeInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetMicromapBuildSizesEXT: Invalid device " "[VUID-vkGetMicromapBuildSizesEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6812,6 +8450,38 @@ VKAPI_ATTR void VKAPI_CALL GetMicromapBuildSizesEXT( } +// ---- VK_HUAWEI_cluster_culling_shader extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdDrawClusterHUAWEI( + VkCommandBuffer commandBuffer, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ) { + 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, + "vkCmdDrawClusterHUAWEI: Invalid commandBuffer " + "[VUID-vkCmdDrawClusterHUAWEI-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdDrawClusterHUAWEI(commandBuffer, groupCountX, groupCountY, groupCountZ); +} + +VKAPI_ATTR void VKAPI_CALL CmdDrawClusterIndirectHUAWEI( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset) { + 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, + "vkCmdDrawClusterIndirectHUAWEI: Invalid commandBuffer " + "[VUID-vkCmdDrawClusterIndirectHUAWEI-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdDrawClusterIndirectHUAWEI(commandBuffer, buffer, offset); +} + + // ---- VK_EXT_pageable_device_local_memory extension trampoline/terminators VKAPI_ATTR void VKAPI_CALL SetDeviceMemoryPriorityEXT( @@ -6820,7 +8490,7 @@ VKAPI_ATTR void VKAPI_CALL SetDeviceMemoryPriorityEXT( float priority) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkSetDeviceMemoryPriorityEXT: Invalid device " "[VUID-vkSetDeviceMemoryPriorityEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6837,7 +8507,7 @@ VKAPI_ATTR void VKAPI_CALL GetDescriptorSetLayoutHostMappingInfoVALVE( VkDescriptorSetLayoutHostMappingInfoVALVE* pHostMapping) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDescriptorSetLayoutHostMappingInfoVALVE: Invalid device " "[VUID-vkGetDescriptorSetLayoutHostMappingInfoVALVE-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6851,7 +8521,7 @@ VKAPI_ATTR void VKAPI_CALL GetDescriptorSetHostMappingVALVE( void** ppData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDescriptorSetHostMappingVALVE: Invalid device " "[VUID-vkGetDescriptorSetHostMappingVALVE-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6860,6 +8530,118 @@ VKAPI_ATTR void VKAPI_CALL GetDescriptorSetHostMappingVALVE( } +// ---- VK_NV_copy_memory_indirect extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdCopyMemoryIndirectNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress copyBufferAddress, + uint32_t copyCount, + uint32_t stride) { + 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, + "vkCmdCopyMemoryIndirectNV: Invalid commandBuffer " + "[VUID-vkCmdCopyMemoryIndirectNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCopyMemoryIndirectNV(commandBuffer, copyBufferAddress, copyCount, stride); +} + +VKAPI_ATTR void VKAPI_CALL CmdCopyMemoryToImageIndirectNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress copyBufferAddress, + uint32_t copyCount, + uint32_t stride, + VkImage dstImage, + VkImageLayout dstImageLayout, + const VkImageSubresourceLayers* pImageSubresources) { + 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, + "vkCmdCopyMemoryToImageIndirectNV: Invalid commandBuffer " + "[VUID-vkCmdCopyMemoryToImageIndirectNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCopyMemoryToImageIndirectNV(commandBuffer, copyBufferAddress, copyCount, stride, dstImage, dstImageLayout, pImageSubresources); +} + + +// ---- VK_NV_memory_decompression extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL CmdDecompressMemoryNV( + VkCommandBuffer commandBuffer, + uint32_t decompressRegionCount, + const VkDecompressMemoryRegionNV* pDecompressMemoryRegions) { + 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, + "vkCmdDecompressMemoryNV: Invalid commandBuffer " + "[VUID-vkCmdDecompressMemoryNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdDecompressMemoryNV(commandBuffer, decompressRegionCount, pDecompressMemoryRegions); +} + +VKAPI_ATTR void VKAPI_CALL CmdDecompressMemoryIndirectCountNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress indirectCommandsAddress, + VkDeviceAddress indirectCommandsCountAddress, + uint32_t stride) { + 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, + "vkCmdDecompressMemoryIndirectCountNV: Invalid commandBuffer " + "[VUID-vkCmdDecompressMemoryIndirectCountNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdDecompressMemoryIndirectCountNV(commandBuffer, indirectCommandsAddress, indirectCommandsCountAddress, stride); +} + + +// ---- VK_NV_device_generated_commands_compute extension trampoline/terminators + +VKAPI_ATTR void VKAPI_CALL GetPipelineIndirectMemoryRequirementsNV( + VkDevice device, + const VkComputePipelineCreateInfo* pCreateInfo, + VkMemoryRequirements2* pMemoryRequirements) { + 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, + "vkGetPipelineIndirectMemoryRequirementsNV: Invalid device " + "[VUID-vkGetPipelineIndirectMemoryRequirementsNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetPipelineIndirectMemoryRequirementsNV(device, pCreateInfo, pMemoryRequirements); +} + +VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBufferNV( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline) { + 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, + "vkCmdUpdatePipelineIndirectBufferNV: Invalid commandBuffer " + "[VUID-vkCmdUpdatePipelineIndirectBufferNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdUpdatePipelineIndirectBufferNV(commandBuffer, pipelineBindPoint, pipeline); +} + +VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetPipelineIndirectDeviceAddressNV( + VkDevice device, + const VkPipelineIndirectDeviceAddressInfoNV* 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, + "vkGetPipelineIndirectDeviceAddressNV: Invalid device " + "[VUID-vkGetPipelineIndirectDeviceAddressNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetPipelineIndirectDeviceAddressNV(device, pInfo); +} + + // ---- VK_EXT_extended_dynamic_state3 extension trampoline/terminators VKAPI_ATTR void VKAPI_CALL CmdSetTessellationDomainOriginEXT( @@ -6867,7 +8649,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetTessellationDomainOriginEXT( VkTessellationDomainOrigin domainOrigin) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetTessellationDomainOriginEXT: Invalid commandBuffer " "[VUID-vkCmdSetTessellationDomainOriginEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6880,7 +8662,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthClampEnableEXT( VkBool32 depthClampEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetDepthClampEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetDepthClampEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6893,7 +8675,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetPolygonModeEXT( VkPolygonMode polygonMode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetPolygonModeEXT: Invalid commandBuffer " "[VUID-vkCmdSetPolygonModeEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6906,7 +8688,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetRasterizationSamplesEXT( VkSampleCountFlagBits rasterizationSamples) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetRasterizationSamplesEXT: Invalid commandBuffer " "[VUID-vkCmdSetRasterizationSamplesEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6920,7 +8702,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetSampleMaskEXT( const VkSampleMask* pSampleMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetSampleMaskEXT: Invalid commandBuffer " "[VUID-vkCmdSetSampleMaskEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6933,7 +8715,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetAlphaToCoverageEnableEXT( VkBool32 alphaToCoverageEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetAlphaToCoverageEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetAlphaToCoverageEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6946,7 +8728,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetAlphaToOneEnableEXT( VkBool32 alphaToOneEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetAlphaToOneEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetAlphaToOneEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6959,7 +8741,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetLogicOpEnableEXT( VkBool32 logicOpEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetLogicOpEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetLogicOpEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6974,7 +8756,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetColorBlendEnableEXT( const VkBool32* pColorBlendEnables) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetColorBlendEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetColorBlendEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -6989,7 +8771,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetColorBlendEquationEXT( const VkColorBlendEquationEXT* pColorBlendEquations) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetColorBlendEquationEXT: Invalid commandBuffer " "[VUID-vkCmdSetColorBlendEquationEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7004,7 +8786,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetColorWriteMaskEXT( const VkColorComponentFlags* pColorWriteMasks) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetColorWriteMaskEXT: Invalid commandBuffer " "[VUID-vkCmdSetColorWriteMaskEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7017,7 +8799,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetRasterizationStreamEXT( uint32_t rasterizationStream) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetRasterizationStreamEXT: Invalid commandBuffer " "[VUID-vkCmdSetRasterizationStreamEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7030,7 +8812,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetConservativeRasterizationModeEXT( VkConservativeRasterizationModeEXT conservativeRasterizationMode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetConservativeRasterizationModeEXT: Invalid commandBuffer " "[VUID-vkCmdSetConservativeRasterizationModeEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7043,7 +8825,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetExtraPrimitiveOverestimationSizeEXT( float extraPrimitiveOverestimationSize) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetExtraPrimitiveOverestimationSizeEXT: Invalid commandBuffer " "[VUID-vkCmdSetExtraPrimitiveOverestimationSizeEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7056,7 +8838,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthClipEnableEXT( VkBool32 depthClipEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetDepthClipEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetDepthClipEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7069,7 +8851,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetSampleLocationsEnableEXT( VkBool32 sampleLocationsEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetSampleLocationsEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetSampleLocationsEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7084,7 +8866,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetColorBlendAdvancedEXT( const VkColorBlendAdvancedEXT* pColorBlendAdvanced) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetColorBlendAdvancedEXT: Invalid commandBuffer " "[VUID-vkCmdSetColorBlendAdvancedEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7097,7 +8879,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetProvokingVertexModeEXT( VkProvokingVertexModeEXT provokingVertexMode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetProvokingVertexModeEXT: Invalid commandBuffer " "[VUID-vkCmdSetProvokingVertexModeEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7110,7 +8892,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetLineRasterizationModeEXT( VkLineRasterizationModeEXT lineRasterizationMode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetLineRasterizationModeEXT: Invalid commandBuffer " "[VUID-vkCmdSetLineRasterizationModeEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7123,7 +8905,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetLineStippleEnableEXT( VkBool32 stippledLineEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetLineStippleEnableEXT: Invalid commandBuffer " "[VUID-vkCmdSetLineStippleEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7136,7 +8918,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthClipNegativeOneToOneEXT( VkBool32 negativeOneToOne) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetDepthClipNegativeOneToOneEXT: Invalid commandBuffer " "[VUID-vkCmdSetDepthClipNegativeOneToOneEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7149,7 +8931,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetViewportWScalingEnableNV( VkBool32 viewportWScalingEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetViewportWScalingEnableNV: Invalid commandBuffer " "[VUID-vkCmdSetViewportWScalingEnableNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7164,7 +8946,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetViewportSwizzleNV( const VkViewportSwizzleNV* pViewportSwizzles) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetViewportSwizzleNV: Invalid commandBuffer " "[VUID-vkCmdSetViewportSwizzleNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7177,7 +8959,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCoverageToColorEnableNV( VkBool32 coverageToColorEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCoverageToColorEnableNV: Invalid commandBuffer " "[VUID-vkCmdSetCoverageToColorEnableNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7190,7 +8972,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCoverageToColorLocationNV( uint32_t coverageToColorLocation) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCoverageToColorLocationNV: Invalid commandBuffer " "[VUID-vkCmdSetCoverageToColorLocationNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7203,7 +8985,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCoverageModulationModeNV( VkCoverageModulationModeNV coverageModulationMode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCoverageModulationModeNV: Invalid commandBuffer " "[VUID-vkCmdSetCoverageModulationModeNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7216,7 +8998,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCoverageModulationTableEnableNV( VkBool32 coverageModulationTableEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCoverageModulationTableEnableNV: Invalid commandBuffer " "[VUID-vkCmdSetCoverageModulationTableEnableNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7230,7 +9012,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCoverageModulationTableNV( const float* pCoverageModulationTable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCoverageModulationTableNV: Invalid commandBuffer " "[VUID-vkCmdSetCoverageModulationTableNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7243,7 +9025,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetShadingRateImageEnableNV( VkBool32 shadingRateImageEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetShadingRateImageEnableNV: Invalid commandBuffer " "[VUID-vkCmdSetShadingRateImageEnableNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7256,7 +9038,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetRepresentativeFragmentTestEnableNV( VkBool32 representativeFragmentTestEnable) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetRepresentativeFragmentTestEnableNV: Invalid commandBuffer " "[VUID-vkCmdSetRepresentativeFragmentTestEnableNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7269,7 +9051,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetCoverageReductionModeNV( VkCoverageReductionModeNV coverageReductionMode) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetCoverageReductionModeNV: Invalid commandBuffer " "[VUID-vkCmdSetCoverageReductionModeNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7286,7 +9068,7 @@ VKAPI_ATTR void VKAPI_CALL GetShaderModuleIdentifierEXT( VkShaderModuleIdentifierEXT* pIdentifier) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetShaderModuleIdentifierEXT: Invalid device " "[VUID-vkGetShaderModuleIdentifierEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7300,7 +9082,7 @@ VKAPI_ATTR void VKAPI_CALL GetShaderModuleCreateInfoIdentifierEXT( VkShaderModuleIdentifierEXT* pIdentifier) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetShaderModuleCreateInfoIdentifierEXT: Invalid device " "[VUID-vkGetShaderModuleCreateInfoIdentifierEXT-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7319,7 +9101,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceOpticalFlowImageFormatsNV( const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceOpticalFlowImageFormatsNV-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7336,7 +9118,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceOpticalFlowImageForma 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.GetPhysicalDeviceOpticalFlowImageFormatsNV) { - loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, + loader_log(icd_term->this_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceOpticalFlowImageFormatsNV"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -7350,7 +9132,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateOpticalFlowSessionNV( VkOpticalFlowSessionNV* pSession) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateOpticalFlowSessionNV: Invalid device " "[VUID-vkCreateOpticalFlowSessionNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7364,7 +9146,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyOpticalFlowSessionNV( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyOpticalFlowSessionNV: Invalid device " "[VUID-vkDestroyOpticalFlowSessionNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7380,7 +9162,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BindOpticalFlowSessionImageNV( VkImageLayout layout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindOpticalFlowSessionImageNV: Invalid device " "[VUID-vkBindOpticalFlowSessionImageNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7394,7 +9176,7 @@ VKAPI_ATTR void VKAPI_CALL CmdOpticalFlowExecuteNV( const VkOpticalFlowExecuteInfoNV* pExecuteInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdOpticalFlowExecuteNV: Invalid commandBuffer " "[VUID-vkCmdOpticalFlowExecuteNV-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7403,6 +9185,69 @@ VKAPI_ATTR void VKAPI_CALL CmdOpticalFlowExecuteNV( } +// ---- VK_EXT_shader_object extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL CreateShadersEXT( + VkDevice device, + uint32_t createInfoCount, + const VkShaderCreateInfoEXT* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkShaderEXT* pShaders) { + 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, + "vkCreateShadersEXT: Invalid device " + "[VUID-vkCreateShadersEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreateShadersEXT(device, createInfoCount, pCreateInfos, pAllocator, pShaders); +} + +VKAPI_ATTR void VKAPI_CALL DestroyShaderEXT( + VkDevice device, + VkShaderEXT shader, + const VkAllocationCallbacks* pAllocator) { + 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, + "vkDestroyShaderEXT: Invalid device " + "[VUID-vkDestroyShaderEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->DestroyShaderEXT(device, shader, pAllocator); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetShaderBinaryDataEXT( + VkDevice device, + VkShaderEXT shader, + size_t* pDataSize, + void* pData) { + 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, + "vkGetShaderBinaryDataEXT: Invalid device " + "[VUID-vkGetShaderBinaryDataEXT-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetShaderBinaryDataEXT(device, shader, pDataSize, pData); +} + +VKAPI_ATTR void VKAPI_CALL CmdBindShadersEXT( + VkCommandBuffer commandBuffer, + uint32_t stageCount, + const VkShaderStageFlagBits* pStages, + const VkShaderEXT* pShaders) { + 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, + "vkCmdBindShadersEXT: Invalid commandBuffer " + "[VUID-vkCmdBindShadersEXT-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdBindShadersEXT(commandBuffer, stageCount, pStages, pShaders); +} + + // ---- VK_QCOM_tile_properties extension trampoline/terminators VKAPI_ATTR VkResult VKAPI_CALL GetFramebufferTilePropertiesQCOM( @@ -7412,7 +9257,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetFramebufferTilePropertiesQCOM( VkTilePropertiesQCOM* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetFramebufferTilePropertiesQCOM: Invalid device " "[VUID-vkGetFramebufferTilePropertiesQCOM-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7426,7 +9271,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( VkTilePropertiesQCOM* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDynamicRenderingTilePropertiesQCOM: Invalid device " "[VUID-vkGetDynamicRenderingTilePropertiesQCOM-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7435,96 +9280,112 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( } -// ---- VK_OHOS_native_buffer extension trampoline/terminators +// ---- VK_NV_low_latency2 extension trampoline/terminators -#ifdef VK_USE_PLATFORM_OHOS -VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainGrallocUsageOHOS( +VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( VkDevice device, - VkFormat format, - VkImageUsageFlags imageUsage, - uint64_t* grallocUsage) { + VkSwapchainKHR swapchain, + const VkLatencySleepModeInfoNV* pSleepModeInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetSwapchainGrallocUsageOHOS: Invalid device " - "[VUID-vkGetSwapchainGrallocUsageOHOS-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkSetLatencySleepModeNV: Invalid device " + "[VUID-vkSetLatencySleepModeNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - return disp->GetSwapchainGrallocUsageOHOS(device, format, imageUsage, grallocUsage); + return disp->SetLatencySleepModeNV(device, swapchain, pSleepModeInfo); } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS -VKAPI_ATTR VkResult VKAPI_CALL AcquireImageOHOS( +VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( VkDevice device, - VkImage image, - int32_t nativeFenceFd, - VkSemaphore semaphore, - VkFence fence) { + VkSwapchainKHR swapchain, + const VkLatencySleepInfoNV* pSleepInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkAcquireImageOHOS: Invalid device " - "[VUID-vkAcquireImageOHOS-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkLatencySleepNV: Invalid device " + "[VUID-vkLatencySleepNV-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - return disp->AcquireImageOHOS(device, image, nativeFenceFd, semaphore, fence); + return disp->LatencySleepNV(device, swapchain, pSleepInfo); } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS -VKAPI_ATTR VkResult VKAPI_CALL QueueSignalReleaseImageOHOS( +VKAPI_ATTR void VKAPI_CALL SetLatencyMarkerNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo) { + 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, + "vkSetLatencyMarkerNV: Invalid device " + "[VUID-vkSetLatencyMarkerNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->SetLatencyMarkerNV(device, swapchain, pLatencyMarkerInfo); +} + +VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo) { + 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, + "vkGetLatencyTimingsNV: Invalid device " + "[VUID-vkGetLatencyTimingsNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->GetLatencyTimingsNV(device, swapchain, pLatencyMarkerInfo); +} + +VKAPI_ATTR void VKAPI_CALL QueueNotifyOutOfBandNV( VkQueue queue, - uint32_t waitSemaphoreCount, - const VkSemaphore* pWaitSemaphores, - VkImage image, - int32_t* pNativeFenceFd) { + const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkQueueSignalReleaseImageOHOS: Invalid queue " - "[VUID-vkQueueSignalReleaseImageOHOS-queue-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkQueueNotifyOutOfBandNV: Invalid queue " + "[VUID-vkQueueNotifyOutOfBandNV-queue-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - return disp->QueueSignalReleaseImageOHOS(queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd); + disp->QueueNotifyOutOfBandNV(queue, pQueueTypeInfo); } -#endif // VK_USE_PLATFORM_OHOS -// ---- VK_OHOS_external_memory extension trampoline/terminators +// ---- VK_EXT_attachment_feedback_loop_dynamic_state extension trampoline/terminators -#ifdef VK_USE_PLATFORM_OHOS -VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS( - VkDevice device, - const struct OH_NativeBuffer* buffer, - VkNativeBufferPropertiesOHOS* pProperties) { - const VkLayerDispatchTable *disp = loader_get_dispatch(device); +VKAPI_ATTR void VKAPI_CALL CmdSetAttachmentFeedbackLoopEnableEXT( + VkCommandBuffer commandBuffer, + VkImageAspectFlags aspectMask) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetNativeBufferPropertiesOHOS: Invalid device " - "[VUID-vkGetNativeBufferPropertiesOHOS-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdSetAttachmentFeedbackLoopEnableEXT: Invalid commandBuffer " + "[VUID-vkCmdSetAttachmentFeedbackLoopEnableEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } - return disp->GetNativeBufferPropertiesOHOS(device, buffer, pProperties); + disp->CmdSetAttachmentFeedbackLoopEnableEXT(commandBuffer, aspectMask); } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS( + +// ---- 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 VkMemoryGetNativeBufferInfoOHOS* pInfo, - struct OH_NativeBuffer** pBuffer) { + const struct _screen_buffer* buffer, + VkScreenBufferPropertiesQNX* pProperties) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetMemoryNativeBufferOHOS: Invalid device " - "[VUID-vkGetMemoryNativeBufferOHOS-device-parameter]"); + 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->GetMemoryNativeBufferOHOS(device, pInfo, pBuffer); + return disp->GetScreenBufferPropertiesQNX(device, buffer, pProperties); } -#endif // VK_USE_PLATFORM_OHOS +#endif // VK_USE_PLATFORM_SCREEN_QNX // ---- VK_KHR_acceleration_structure extension trampoline/terminators @@ -7535,7 +9396,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( VkAccelerationStructureKHR* pAccelerationStructure) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateAccelerationStructureKHR: Invalid device " "[VUID-vkCreateAccelerationStructureKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7549,7 +9410,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyAccelerationStructureKHR( const VkAllocationCallbacks* pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyAccelerationStructureKHR: Invalid device " "[VUID-vkDestroyAccelerationStructureKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7564,7 +9425,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBuildAccelerationStructuresKHR( const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBuildAccelerationStructuresKHR: Invalid commandBuffer " "[VUID-vkCmdBuildAccelerationStructuresKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7581,7 +9442,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBuildAccelerationStructuresIndirectKHR( const uint32_t* const* ppMaxPrimitiveCounts) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBuildAccelerationStructuresIndirectKHR: Invalid commandBuffer " "[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7597,7 +9458,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BuildAccelerationStructuresKHR( const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBuildAccelerationStructuresKHR: Invalid device " "[VUID-vkBuildAccelerationStructuresKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7611,7 +9472,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CopyAccelerationStructureKHR( const VkCopyAccelerationStructureInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCopyAccelerationStructureKHR: Invalid device " "[VUID-vkCopyAccelerationStructureKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7625,7 +9486,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CopyAccelerationStructureToMemoryKHR( const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCopyAccelerationStructureToMemoryKHR: Invalid device " "[VUID-vkCopyAccelerationStructureToMemoryKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7639,7 +9500,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CopyMemoryToAccelerationStructureKHR( const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCopyMemoryToAccelerationStructureKHR: Invalid device " "[VUID-vkCopyMemoryToAccelerationStructureKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7657,7 +9518,7 @@ VKAPI_ATTR VkResult VKAPI_CALL WriteAccelerationStructuresPropertiesKHR( size_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkWriteAccelerationStructuresPropertiesKHR: Invalid device " "[VUID-vkWriteAccelerationStructuresPropertiesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7670,7 +9531,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyAccelerationStructureKHR( const VkCopyAccelerationStructureInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyAccelerationStructureKHR: Invalid commandBuffer " "[VUID-vkCmdCopyAccelerationStructureKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7683,7 +9544,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyAccelerationStructureToMemoryKHR( const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyAccelerationStructureToMemoryKHR: Invalid commandBuffer " "[VUID-vkCmdCopyAccelerationStructureToMemoryKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7696,7 +9557,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyMemoryToAccelerationStructureKHR( const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyMemoryToAccelerationStructureKHR: Invalid commandBuffer " "[VUID-vkCmdCopyMemoryToAccelerationStructureKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7709,7 +9570,7 @@ VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetAccelerationStructureDeviceAddressKHR( const VkAccelerationStructureDeviceAddressInfoKHR* pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetAccelerationStructureDeviceAddressKHR: Invalid device " "[VUID-vkGetAccelerationStructureDeviceAddressKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7726,7 +9587,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWriteAccelerationStructuresPropertiesKHR( uint32_t firstQuery) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdWriteAccelerationStructuresPropertiesKHR: Invalid commandBuffer " "[VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7740,7 +9601,7 @@ VKAPI_ATTR void VKAPI_CALL GetDeviceAccelerationStructureCompatibilityKHR( VkAccelerationStructureCompatibilityKHR* pCompatibility) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceAccelerationStructureCompatibilityKHR: Invalid device " "[VUID-vkGetDeviceAccelerationStructureCompatibilityKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7756,7 +9617,7 @@ VKAPI_ATTR void VKAPI_CALL GetAccelerationStructureBuildSizesKHR( VkAccelerationStructureBuildSizesInfoKHR* pSizeInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetAccelerationStructureBuildSizesKHR: Invalid device " "[VUID-vkGetAccelerationStructureBuildSizesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7778,7 +9639,7 @@ VKAPI_ATTR void VKAPI_CALL CmdTraceRaysKHR( uint32_t depth) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdTraceRaysKHR: Invalid commandBuffer " "[VUID-vkCmdTraceRaysKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7796,7 +9657,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesKHR( VkPipeline* pPipelines) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateRayTracingPipelinesKHR: Invalid device " "[VUID-vkCreateRayTracingPipelinesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7813,7 +9674,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetRayTracingCaptureReplayShaderGroupHandlesKHR( void* pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR: Invalid device " "[VUID-vkGetRayTracingCaptureReplayShaderGroupHandlesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7830,7 +9691,7 @@ VKAPI_ATTR void VKAPI_CALL CmdTraceRaysIndirectKHR( VkDeviceAddress indirectDeviceAddress) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdTraceRaysIndirectKHR: Invalid commandBuffer " "[VUID-vkCmdTraceRaysIndirectKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7845,7 +9706,7 @@ VKAPI_ATTR VkDeviceSize VKAPI_CALL GetRayTracingShaderGroupStackSizeKHR( VkShaderGroupShaderKHR groupShader) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetRayTracingShaderGroupStackSizeKHR: Invalid device " "[VUID-vkGetRayTracingShaderGroupStackSizeKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7858,7 +9719,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetRayTracingPipelineStackSizeKHR( uint32_t pipelineStackSize) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetRayTracingPipelineStackSizeKHR: Invalid commandBuffer " "[VUID-vkCmdSetRayTracingPipelineStackSizeKHR-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7876,7 +9737,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksEXT( uint32_t groupCountZ) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMeshTasksEXT: Invalid commandBuffer " "[VUID-vkCmdDrawMeshTasksEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7892,7 +9753,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectEXT( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMeshTasksIndirectEXT: Invalid commandBuffer " "[VUID-vkCmdDrawMeshTasksIndirectEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7910,7 +9771,7 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectCountEXT( uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawMeshTasksIndirectCountEXT: Invalid commandBuffer " "[VUID-vkCmdDrawMeshTasksIndirectCountEXT-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -7918,92 +9779,157 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectCountEXT( disp->CmdDrawMeshTasksIndirectCountEXT(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); } +// ---- VK_OHOS_native_buffer extension trampoline/terminators + +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainGrallocUsageOHOS( + VkDevice device, + VkFormat format, + VkImageUsageFlags imageUsage, + uint64_t* grallocUsage) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetSwapchainGrallocUsageOHOS: Invalid device " + "[VUID-vkGetSwapchainGrallocUsageOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetSwapchainGrallocUsageOHOS(device, format, imageUsage, grallocUsage); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL AcquireImageOHOS( + VkDevice device, + VkImage image, + int32_t nativeFenceFd, + VkSemaphore semaphore, + VkFence fence) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkAcquireImageOHOS: Invalid device " + "[VUID-vkAcquireImageOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->AcquireImageOHOS(device, image, nativeFenceFd, semaphore, fence); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL QueueSignalReleaseImageOHOS( + VkQueue queue, + uint32_t waitSemaphoreCount, + const VkSemaphore* pWaitSemaphores, + VkImage image, + int32_t* pNativeFenceFd) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkQueueSignalReleaseImageOHOS: Invalid queue " + "[VUID-vkQueueSignalReleaseImageOHOS-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->QueueSignalReleaseImageOHOS(queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd); +} + +#endif // VK_USE_PLATFORM_OHOS + +// ---- VK_OHOS_external_memory extension trampoline/terminators + +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS( + VkDevice device, + const struct OH_NativeBuffer* buffer, + VkNativeBufferPropertiesOHOS* pProperties) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetNativeBufferPropertiesOHOS: Invalid device " + "[VUID-vkGetNativeBufferPropertiesOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetNativeBufferPropertiesOHOS(device, buffer, pProperties); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS( + VkDevice device, + const VkMemoryGetNativeBufferInfoOHOS* pInfo, + struct OH_NativeBuffer** pBuffer) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetMemoryNativeBufferOHOS: Invalid device " + "[VUID-vkGetMemoryNativeBufferOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetMemoryNativeBufferOHOS(device, pInfo, pBuffer); +} + +#endif // VK_USE_PLATFORM_OHOS + // GPA helpers for extensions bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { *addr = NULL; // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkGetPhysicalDeviceVideoCapabilitiesKHR", name)) { *addr = (void *)GetPhysicalDeviceVideoCapabilitiesKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkGetPhysicalDeviceVideoFormatPropertiesKHR", name)) { *addr = (void *)GetPhysicalDeviceVideoFormatPropertiesKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkCreateVideoSessionKHR", name)) { *addr = (void *)CreateVideoSessionKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkDestroyVideoSessionKHR", name)) { *addr = (void *)DestroyVideoSessionKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkGetVideoSessionMemoryRequirementsKHR", name)) { *addr = (void *)GetVideoSessionMemoryRequirementsKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkBindVideoSessionMemoryKHR", name)) { *addr = (void *)BindVideoSessionMemoryKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkCreateVideoSessionParametersKHR", name)) { *addr = (void *)CreateVideoSessionParametersKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkUpdateVideoSessionParametersKHR", name)) { *addr = (void *)UpdateVideoSessionParametersKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkDestroyVideoSessionParametersKHR", name)) { *addr = (void *)DestroyVideoSessionParametersKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkCmdBeginVideoCodingKHR", name)) { *addr = (void *)CmdBeginVideoCodingKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkCmdEndVideoCodingKHR", name)) { *addr = (void *)CmdEndVideoCodingKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkCmdControlVideoCodingKHR", name)) { *addr = (void *)CmdControlVideoCodingKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_video_decode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS if (!strcmp("vkCmdDecodeVideoKHR", name)) { *addr = (void *)CmdDecodeVideoKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_dynamic_rendering extension commands if (!strcmp("vkCmdBeginRenderingKHR", name)) { @@ -8096,13 +10022,13 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_KHR_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetMemoryWin32HandleKHR", name)) { *addr = (void *)GetMemoryWin32HandleKHR; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetMemoryWin32HandlePropertiesKHR", name)) { *addr = (void *)GetMemoryWin32HandlePropertiesKHR; return true; @@ -8128,13 +10054,13 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_KHR_external_semaphore_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkImportSemaphoreWin32HandleKHR", name)) { *addr = (void *)ImportSemaphoreWin32HandleKHR; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetSemaphoreWin32HandleKHR", name)) { *addr = (void *)GetSemaphoreWin32HandleKHR; return true; @@ -8208,13 +10134,13 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_KHR_external_fence_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkImportFenceWin32HandleKHR", name)) { *addr = (void *)ImportFenceWin32HandleKHR; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetFenceWin32HandleKHR", name)) { *addr = (void *)GetFenceWin32HandleKHR; return true; @@ -8379,13 +10305,29 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_KHR_map_memory2 extension commands + if (!strcmp("vkMapMemory2KHR", name)) { + *addr = (void *)MapMemory2KHR; + return true; + } + if (!strcmp("vkUnmapMemory2KHR", name)) { + *addr = (void *)UnmapMemory2KHR; + return true; + } + // ---- VK_KHR_video_encode_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS + if (!strcmp("vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR", name)) { + *addr = (void *)GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR; + return true; + } + if (!strcmp("vkGetEncodedVideoSessionParametersKHR", name)) { + *addr = (void *)GetEncodedVideoSessionParametersKHR; + return true; + } if (!strcmp("vkCmdEncodeVideoKHR", name)) { *addr = (void *)CmdEncodeVideoKHR; return true; } -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_synchronization2 extension commands if (!strcmp("vkCmdSetEvent2KHR", name)) { @@ -8467,6 +10409,66 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_KHR_maintenance5 extension commands + if (!strcmp("vkCmdBindIndexBuffer2KHR", name)) { + *addr = (void *)CmdBindIndexBuffer2KHR; + return true; + } + if (!strcmp("vkGetRenderingAreaGranularityKHR", name)) { + *addr = (void *)GetRenderingAreaGranularityKHR; + return true; + } + if (!strcmp("vkGetDeviceImageSubresourceLayoutKHR", name)) { + *addr = (void *)GetDeviceImageSubresourceLayoutKHR; + return true; + } + if (!strcmp("vkGetImageSubresourceLayout2KHR", name)) { + *addr = (void *)GetImageSubresourceLayout2KHR; + return true; + } + + // ---- VK_KHR_cooperative_matrix extension commands + if (!strcmp("vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR", name)) { + *addr = (void *)GetPhysicalDeviceCooperativeMatrixPropertiesKHR; + return true; + } + + // ---- VK_KHR_calibrated_timestamps extension commands + if (!strcmp("vkGetPhysicalDeviceCalibrateableTimeDomainsKHR", name)) { + *addr = (void *)GetPhysicalDeviceCalibrateableTimeDomainsKHR; + return true; + } + if (!strcmp("vkGetCalibratedTimestampsKHR", name)) { + *addr = (void *)GetCalibratedTimestampsKHR; + return true; + } + + // ---- VK_KHR_maintenance6 extension commands + if (!strcmp("vkCmdBindDescriptorSets2KHR", name)) { + *addr = (void *)CmdBindDescriptorSets2KHR; + return true; + } + if (!strcmp("vkCmdPushConstants2KHR", name)) { + *addr = (void *)CmdPushConstants2KHR; + return true; + } + if (!strcmp("vkCmdPushDescriptorSet2KHR", name)) { + *addr = (void *)CmdPushDescriptorSet2KHR; + return true; + } + if (!strcmp("vkCmdPushDescriptorSetWithTemplate2KHR", name)) { + *addr = (void *)CmdPushDescriptorSetWithTemplate2KHR; + return true; + } + if (!strcmp("vkCmdSetDescriptorBufferOffsets2EXT", name)) { + *addr = (void *)CmdSetDescriptorBufferOffsets2EXT; + return true; + } + if (!strcmp("vkCmdBindDescriptorBufferEmbeddedSamplers2EXT", name)) { + *addr = (void *)CmdBindDescriptorBufferEmbeddedSamplers2EXT; + return true; + } + // ---- VK_EXT_debug_marker extension commands if (!strcmp("vkDebugMarkerSetObjectTagEXT", name)) { *addr = (void *)DebugMarkerSetObjectTagEXT; @@ -8572,7 +10574,7 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_NV_external_memory_win32 extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetMemoryWin32HandleNV", name)) { *addr = (void *)GetMemoryWin32HandleNV; return true; @@ -8604,7 +10606,7 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) if (!strcmp("vkAcquireXlibDisplayEXT", name)) { *addr = (ptr_instance->enabled_known_extensions.ext_acquire_xlib_display == 1) ? (void *)AcquireXlibDisplayEXT @@ -8612,7 +10614,7 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) if (!strcmp("vkGetRandROutputDisplayEXT", name)) { *addr = (ptr_instance->enabled_known_extensions.ext_acquire_xlib_display == 1) ? (void *)GetRandROutputDisplayEXT @@ -8662,6 +10664,14 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na *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)) { @@ -8720,19 +10730,63 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_ANDROID_external_memory_android_hardware_buffer extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (!strcmp("vkGetAndroidHardwareBufferPropertiesANDROID", name)) { *addr = (void *)GetAndroidHardwareBufferPropertiesANDROID; return true; } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (!strcmp("vkGetMemoryAndroidHardwareBufferANDROID", name)) { *addr = (void *)GetMemoryAndroidHardwareBufferANDROID; return true; } #endif // VK_USE_PLATFORM_ANDROID_KHR + // ---- VK_AMDX_shader_enqueue extension commands +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp("vkCreateExecutionGraphPipelinesAMDX", name)) { + *addr = (void *)CreateExecutionGraphPipelinesAMDX; + return true; + } +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp("vkGetExecutionGraphPipelineScratchSizeAMDX", name)) { + *addr = (void *)GetExecutionGraphPipelineScratchSizeAMDX; + return true; + } +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp("vkGetExecutionGraphPipelineNodeIndexAMDX", name)) { + *addr = (void *)GetExecutionGraphPipelineNodeIndexAMDX; + return true; + } +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp("vkCmdInitializeGraphScratchMemoryAMDX", name)) { + *addr = (void *)CmdInitializeGraphScratchMemoryAMDX; + return true; + } +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp("vkCmdDispatchGraphAMDX", name)) { + *addr = (void *)CmdDispatchGraphAMDX; + return true; + } +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp("vkCmdDispatchGraphIndirectAMDX", name)) { + *addr = (void *)CmdDispatchGraphIndirectAMDX; + return true; + } +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + if (!strcmp("vkCmdDispatchGraphIndirectCountAMDX", name)) { + *addr = (void *)CmdDispatchGraphIndirectCountAMDX; + return true; + } +#endif // VK_ENABLE_BETA_EXTENSIONS + // ---- VK_EXT_sample_locations extension commands if (!strcmp("vkCmdSetSampleLocationsEXT", name)) { *addr = (void *)CmdSetSampleLocationsEXT; @@ -8872,6 +10926,10 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_NV_scissor_exclusive extension commands + if (!strcmp("vkCmdSetExclusiveScissorEnableNV", name)) { + *addr = (void *)CmdSetExclusiveScissorEnableNV; + return true; + } if (!strcmp("vkCmdSetExclusiveScissorNV", name)) { *addr = (void *)CmdSetExclusiveScissorNV; return true; @@ -8956,25 +11014,25 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetPhysicalDeviceSurfacePresentModes2EXT", name)) { *addr = (void *)GetPhysicalDeviceSurfacePresentModes2EXT; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkAcquireFullScreenExclusiveModeEXT", name)) { *addr = (void *)AcquireFullScreenExclusiveModeEXT; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkReleaseFullScreenExclusiveModeEXT", name)) { *addr = (void *)ReleaseFullScreenExclusiveModeEXT; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetDeviceGroupSurfacePresentModes2EXT", name)) { *addr = (void *)GetDeviceGroupSurfacePresentModes2EXT; return true; @@ -9043,6 +11101,34 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_EXT_host_image_copy extension commands + if (!strcmp("vkCopyMemoryToImageEXT", name)) { + *addr = (void *)CopyMemoryToImageEXT; + return true; + } + if (!strcmp("vkCopyImageToMemoryEXT", name)) { + *addr = (void *)CopyImageToMemoryEXT; + return true; + } + if (!strcmp("vkCopyImageToImageEXT", name)) { + *addr = (void *)CopyImageToImageEXT; + return true; + } + if (!strcmp("vkTransitionImageLayoutEXT", name)) { + *addr = (void *)TransitionImageLayoutEXT; + return true; + } + if (!strcmp("vkGetImageSubresourceLayout2EXT", name)) { + *addr = (void *)GetImageSubresourceLayout2EXT; + return true; + } + + // ---- VK_EXT_swapchain_maintenance1 extension commands + if (!strcmp("vkReleaseSwapchainImagesEXT", name)) { + *addr = (void *)ReleaseSwapchainImagesEXT; + return true; + } + // ---- VK_NV_device_generated_commands extension commands if (!strcmp("vkGetGeneratedCommandsMemoryRequirementsNV", name)) { *addr = (void *)GetGeneratedCommandsMemoryRequirementsNV; @@ -9069,6 +11155,12 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_EXT_depth_bias_control extension commands + if (!strcmp("vkCmdSetDepthBias2EXT", name)) { + *addr = (void *)CmdSetDepthBias2EXT; + return true; + } + // ---- VK_EXT_acquire_drm_display extension commands if (!strcmp("vkAcquireDrmDisplayEXT", name)) { *addr = (ptr_instance->enabled_known_extensions.ext_acquire_drm_display == 1) @@ -9101,23 +11193,89 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_NV_cuda_kernel_launch extension commands + if (!strcmp("vkCreateCudaModuleNV", name)) { + *addr = (void *)CreateCudaModuleNV; + return true; + } + if (!strcmp("vkGetCudaModuleCacheNV", name)) { + *addr = (void *)GetCudaModuleCacheNV; + return true; + } + if (!strcmp("vkCreateCudaFunctionNV", name)) { + *addr = (void *)CreateCudaFunctionNV; + return true; + } + if (!strcmp("vkDestroyCudaModuleNV", name)) { + *addr = (void *)DestroyCudaModuleNV; + return true; + } + if (!strcmp("vkDestroyCudaFunctionNV", name)) { + *addr = (void *)DestroyCudaFunctionNV; + return true; + } + if (!strcmp("vkCmdCudaLaunchKernelNV", name)) { + *addr = (void *)CmdCudaLaunchKernelNV; + return true; + } + // ---- VK_EXT_metal_objects extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) if (!strcmp("vkExportMetalObjectsEXT", name)) { *addr = (void *)ExportMetalObjectsEXT; return true; } #endif // VK_USE_PLATFORM_METAL_EXT - // ---- VK_NV_fragment_shading_rate_enums extension commands - if (!strcmp("vkCmdSetFragmentShadingRateEnumNV", name)) { - *addr = (void *)CmdSetFragmentShadingRateEnumNV; + // ---- VK_EXT_descriptor_buffer extension commands + if (!strcmp("vkGetDescriptorSetLayoutSizeEXT", name)) { + *addr = (void *)GetDescriptorSetLayoutSizeEXT; + return true; + } + if (!strcmp("vkGetDescriptorSetLayoutBindingOffsetEXT", name)) { + *addr = (void *)GetDescriptorSetLayoutBindingOffsetEXT; + return true; + } + if (!strcmp("vkGetDescriptorEXT", name)) { + *addr = (void *)GetDescriptorEXT; + return true; + } + if (!strcmp("vkCmdBindDescriptorBuffersEXT", name)) { + *addr = (void *)CmdBindDescriptorBuffersEXT; + return true; + } + if (!strcmp("vkCmdSetDescriptorBufferOffsetsEXT", name)) { + *addr = (void *)CmdSetDescriptorBufferOffsetsEXT; + return true; + } + if (!strcmp("vkCmdBindDescriptorBufferEmbeddedSamplersEXT", name)) { + *addr = (void *)CmdBindDescriptorBufferEmbeddedSamplersEXT; + return true; + } + if (!strcmp("vkGetBufferOpaqueCaptureDescriptorDataEXT", name)) { + *addr = (void *)GetBufferOpaqueCaptureDescriptorDataEXT; + return true; + } + if (!strcmp("vkGetImageOpaqueCaptureDescriptorDataEXT", name)) { + *addr = (void *)GetImageOpaqueCaptureDescriptorDataEXT; + return true; + } + if (!strcmp("vkGetImageViewOpaqueCaptureDescriptorDataEXT", name)) { + *addr = (void *)GetImageViewOpaqueCaptureDescriptorDataEXT; + return true; + } + if (!strcmp("vkGetSamplerOpaqueCaptureDescriptorDataEXT", name)) { + *addr = (void *)GetSamplerOpaqueCaptureDescriptorDataEXT; + return true; + } + if (!strcmp("vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT", name)) { + *addr = (void *)GetAccelerationStructureOpaqueCaptureDescriptorDataEXT; return true; } - // ---- VK_EXT_image_compression_control extension commands - if (!strcmp("vkGetImageSubresourceLayout2EXT", name)) { - *addr = (void *)GetImageSubresourceLayout2EXT; + // ---- VK_NV_fragment_shading_rate_enums extension commands + if (!strcmp("vkCmdSetFragmentShadingRateEnumNV", name)) { + *addr = (void *)CmdSetFragmentShadingRateEnumNV; return true; } @@ -9128,13 +11286,13 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_NV_acquire_winrt_display extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkAcquireWinrtDisplayNV", name)) { *addr = (void *)AcquireWinrtDisplayNV; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp("vkGetWinrtDisplayNV", name)) { *addr = (void *)GetWinrtDisplayNV; return true; @@ -9148,13 +11306,13 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na } // ---- VK_FUCHSIA_external_memory extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkGetMemoryZirconHandleFUCHSIA", name)) { *addr = (void *)GetMemoryZirconHandleFUCHSIA; return true; } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkGetMemoryZirconHandlePropertiesFUCHSIA", name)) { *addr = (void *)GetMemoryZirconHandlePropertiesFUCHSIA; return true; @@ -9162,13 +11320,13 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_external_semaphore extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkImportSemaphoreZirconHandleFUCHSIA", name)) { *addr = (void *)ImportSemaphoreZirconHandleFUCHSIA; return true; } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkGetSemaphoreZirconHandleFUCHSIA", name)) { *addr = (void *)GetSemaphoreZirconHandleFUCHSIA; return true; @@ -9176,31 +11334,31 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_FUCHSIA_buffer_collection extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkCreateBufferCollectionFUCHSIA", name)) { *addr = (void *)CreateBufferCollectionFUCHSIA; return true; } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkSetBufferCollectionImageConstraintsFUCHSIA", name)) { *addr = (void *)SetBufferCollectionImageConstraintsFUCHSIA; return true; } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkSetBufferCollectionBufferConstraintsFUCHSIA", name)) { *addr = (void *)SetBufferCollectionBufferConstraintsFUCHSIA; return true; } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkDestroyBufferCollectionFUCHSIA", name)) { *addr = (void *)DestroyBufferCollectionFUCHSIA; return true; } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (!strcmp("vkGetBufferCollectionPropertiesFUCHSIA", name)) { *addr = (void *)GetBufferCollectionPropertiesFUCHSIA; return true; @@ -9331,6 +11489,16 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_HUAWEI_cluster_culling_shader extension commands + if (!strcmp("vkCmdDrawClusterHUAWEI", name)) { + *addr = (void *)CmdDrawClusterHUAWEI; + return true; + } + if (!strcmp("vkCmdDrawClusterIndirectHUAWEI", name)) { + *addr = (void *)CmdDrawClusterIndirectHUAWEI; + return true; + } + // ---- VK_EXT_pageable_device_local_memory extension commands if (!strcmp("vkSetDeviceMemoryPriorityEXT", name)) { *addr = (void *)SetDeviceMemoryPriorityEXT; @@ -9347,6 +11515,40 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_NV_copy_memory_indirect extension commands + if (!strcmp("vkCmdCopyMemoryIndirectNV", name)) { + *addr = (void *)CmdCopyMemoryIndirectNV; + return true; + } + if (!strcmp("vkCmdCopyMemoryToImageIndirectNV", name)) { + *addr = (void *)CmdCopyMemoryToImageIndirectNV; + return true; + } + + // ---- VK_NV_memory_decompression extension commands + if (!strcmp("vkCmdDecompressMemoryNV", name)) { + *addr = (void *)CmdDecompressMemoryNV; + return true; + } + if (!strcmp("vkCmdDecompressMemoryIndirectCountNV", name)) { + *addr = (void *)CmdDecompressMemoryIndirectCountNV; + return true; + } + + // ---- VK_NV_device_generated_commands_compute extension commands + if (!strcmp("vkGetPipelineIndirectMemoryRequirementsNV", name)) { + *addr = (void *)GetPipelineIndirectMemoryRequirementsNV; + return true; + } + if (!strcmp("vkCmdUpdatePipelineIndirectBufferNV", name)) { + *addr = (void *)CmdUpdatePipelineIndirectBufferNV; + return true; + } + if (!strcmp("vkGetPipelineIndirectDeviceAddressNV", name)) { + *addr = (void *)GetPipelineIndirectDeviceAddressNV; + return true; + } + // ---- VK_EXT_extended_dynamic_state3 extension commands if (!strcmp("vkCmdSetTessellationDomainOriginEXT", name)) { *addr = (void *)CmdSetTessellationDomainOriginEXT; @@ -9505,6 +11707,24 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_EXT_shader_object extension commands + if (!strcmp("vkCreateShadersEXT", name)) { + *addr = (void *)CreateShadersEXT; + return true; + } + if (!strcmp("vkDestroyShaderEXT", name)) { + *addr = (void *)DestroyShaderEXT; + return true; + } + if (!strcmp("vkGetShaderBinaryDataEXT", name)) { + *addr = (void *)GetShaderBinaryDataEXT; + return true; + } + if (!strcmp("vkCmdBindShadersEXT", name)) { + *addr = (void *)CmdBindShadersEXT; + return true; + } + // ---- VK_QCOM_tile_properties extension commands if (!strcmp("vkGetFramebufferTilePropertiesQCOM", name)) { *addr = (void *)GetFramebufferTilePropertiesQCOM; @@ -9515,39 +11735,41 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } - // ---- VK_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp("vkGetSwapchainGrallocUsageOHOS", name)) { - *addr = (void *)GetSwapchainGrallocUsageOHOS; + // ---- VK_NV_low_latency2 extension commands + if (!strcmp("vkSetLatencySleepModeNV", name)) { + *addr = (void *)SetLatencySleepModeNV; return true; } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp("vkAcquireImageOHOS", name)) { - *addr = (void *)AcquireImageOHOS; + if (!strcmp("vkLatencySleepNV", name)) { + *addr = (void *)LatencySleepNV; return true; } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp("vkQueueSignalReleaseImageOHOS", name)) { - *addr = (void *)QueueSignalReleaseImageOHOS; + if (!strcmp("vkSetLatencyMarkerNV", name)) { + *addr = (void *)SetLatencyMarkerNV; + return true; + } + if (!strcmp("vkGetLatencyTimingsNV", name)) { + *addr = (void *)GetLatencyTimingsNV; + return true; + } + if (!strcmp("vkQueueNotifyOutOfBandNV", name)) { + *addr = (void *)QueueNotifyOutOfBandNV; return true; } -#endif // VK_USE_PLATFORM_OHOS - // ---- VK_OHOS_external_memory extension commands -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp("vkGetNativeBufferPropertiesOHOS", name)) { - *addr = (void *)vkGetNativeBufferPropertiesOHOS; + // ---- VK_EXT_attachment_feedback_loop_dynamic_state extension commands + if (!strcmp("vkCmdSetAttachmentFeedbackLoopEnableEXT", name)) { + *addr = (void *)CmdSetAttachmentFeedbackLoopEnableEXT; return true; } -#endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_OHOS - if (!strcmp("vkGetMemoryNativeBufferOHOS", name)) { - *addr = (void *)vkGetMemoryNativeBufferOHOS; + + // ---- 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_OHOS +#endif // VK_USE_PLATFORM_SCREEN_QNX // ---- VK_KHR_acceleration_structure extension commands if (!strcmp("vkCreateAccelerationStructureKHR", name)) { @@ -9654,7 +11876,42 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na *addr = (void *)CmdDrawMeshTasksIndirectCountEXT; return true; } - return false; + + // ---- VK_OHOS_native_buffer extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkGetSwapchainGrallocUsageOHOS", name)) { + *addr = (void *)GetSwapchainGrallocUsageOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkAcquireImageOHOS", name)) { + *addr = (void *)AcquireImageOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkQueueSignalReleaseImageOHOS", name)) { + *addr = (void *)QueueSignalReleaseImageOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkGetNativeBufferPropertiesOHOS", name)) { + *addr = (void *)vkGetNativeBufferPropertiesOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkGetMemoryNativeBufferOHOS", name)) { + *addr = (void *)vkGetMemoryNativeBufferOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS + + return false; } // A function that can be used to query enabled extensions during a vkCreateInstance call @@ -9690,7 +11947,7 @@ void extensions_create_instance(struct loader_instance *ptr_instance, const VkIn ptr_instance->enabled_known_extensions.ext_direct_mode_display = 1; // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME)) { ptr_instance->enabled_known_extensions.ext_acquire_xlib_display = 1; #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT @@ -9713,64 +11970,90 @@ void extensions_create_instance(struct loader_instance *ptr_instance, const VkIn // 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 *pName) { - PFN_vkVoidFunction addr = NULL; - +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 (dev->extensions.khr_swapchain_enabled) { - if(!strcmp(pName, "vkCreateSwapchainKHR")) { - addr = (PFN_vkVoidFunction)terminator_CreateSwapchainKHR; - } else if(!strcmp(pName, "vkGetDeviceGroupSurfacePresentModesKHR")) { - addr = (PFN_vkVoidFunction)terminator_GetDeviceGroupSurfacePresentModesKHR; - } + 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 (dev->extensions.khr_display_swapchain_enabled) { - if(!strcmp(pName, "vkCreateSharedSwapchainsKHR")) { - addr = (PFN_vkVoidFunction)terminator_CreateSharedSwapchainsKHR; - } + if (!strcmp(name, "CreateSharedSwapchainsKHR")) { + *found_name = true; + return dev->driver_extensions.khr_display_swapchain_enabled ? + (PFN_vkVoidFunction)terminator_CreateSharedSwapchainsKHR : NULL; } - // ---- VK_EXT_debug_marker extension commands - if (dev->extensions.ext_debug_marker_enabled) { - if(!strcmp(pName, "vkDebugMarkerSetObjectTagEXT")) { - addr = (PFN_vkVoidFunction)terminator_DebugMarkerSetObjectTagEXT; - } else if(!strcmp(pName, "vkDebugMarkerSetObjectNameEXT")) { - addr = (PFN_vkVoidFunction)terminator_DebugMarkerSetObjectNameEXT; - } + if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_marker_enabled ? + (PFN_vkVoidFunction)terminator_DebugMarkerSetObjectTagEXT : NULL; } - - // ---- VK_EXT_debug_utils extension commands - if (dev->extensions.ext_debug_utils_enabled) { - if(!strcmp(pName, "vkSetDebugUtilsObjectNameEXT")) { - addr = (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectNameEXT; - } else if(!strcmp(pName, "vkSetDebugUtilsObjectTagEXT")) { - addr = (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectTagEXT; - } else if(!strcmp(pName, "vkQueueBeginDebugUtilsLabelEXT")) { - addr = (PFN_vkVoidFunction)terminator_QueueBeginDebugUtilsLabelEXT; - } else if(!strcmp(pName, "vkQueueEndDebugUtilsLabelEXT")) { - addr = (PFN_vkVoidFunction)terminator_QueueEndDebugUtilsLabelEXT; - } else if(!strcmp(pName, "vkQueueInsertDebugUtilsLabelEXT")) { - addr = (PFN_vkVoidFunction)terminator_QueueInsertDebugUtilsLabelEXT; - } else if(!strcmp(pName, "vkCmdBeginDebugUtilsLabelEXT")) { - addr = (PFN_vkVoidFunction)terminator_CmdBeginDebugUtilsLabelEXT; - } else if(!strcmp(pName, "vkCmdEndDebugUtilsLabelEXT")) { - addr = (PFN_vkVoidFunction)terminator_CmdEndDebugUtilsLabelEXT; - } else if(!strcmp(pName, "vkCmdInsertDebugUtilsLabelEXT")) { - addr = (PFN_vkVoidFunction)terminator_CmdInsertDebugUtilsLabelEXT; - } + if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) { + *found_name = true; + return dev->driver_extensions.ext_debug_marker_enabled ? + (PFN_vkVoidFunction)terminator_DebugMarkerSetObjectNameEXT : NULL; } -#ifdef VK_USE_PLATFORM_WIN32_KHR - + // ---- 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; + } +#if defined(VK_USE_PLATFORM_WIN32_KHR) // ---- VK_EXT_full_screen_exclusive extension commands - if (dev->extensions.ext_full_screen_exclusive_enabled && dev->extensions.khr_device_group_enabled) { - if(!strcmp(pName, "vkGetDeviceGroupSurfacePresentModes2EXT")) { - addr = (PFN_vkVoidFunction)terminator_GetDeviceGroupSurfacePresentModes2EXT; - } + if (!strcmp(name, "GetDeviceGroupSurfacePresentModes2EXT")) { + *found_name = true; + return dev->driver_extensions.ext_full_screen_exclusive_enabled && dev->driver_extensions.khr_device_group_enabled ? + (PFN_vkVoidFunction)terminator_GetDeviceGroupSurfacePresentModes2EXT : NULL; } -#endif // None - return addr; +#endif // VK_USE_PLATFORM_WIN32_KHR + return NULL; } // This table contains the loader's instance dispatch table, which contains @@ -9778,7 +12061,7 @@ PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *de // pointers to "terminator functions". const VkLayerInstanceDispatchTable instance_disp = { - // ---- Core 1_0 commands + // ---- Core Vulkan 1.0 commands .DestroyInstance = terminator_DestroyInstance, .EnumeratePhysicalDevices = terminator_EnumeratePhysicalDevices, .GetPhysicalDeviceFeatures = terminator_GetPhysicalDeviceFeatures, @@ -9792,7 +12075,7 @@ const VkLayerInstanceDispatchTable instance_disp = { .EnumerateDeviceLayerProperties = terminator_EnumerateDeviceLayerProperties, .GetPhysicalDeviceSparseImageFormatProperties = terminator_GetPhysicalDeviceSparseImageFormatProperties, - // ---- Core 1_1 commands + // ---- Core Vulkan 1.1 commands .EnumeratePhysicalDeviceGroups = terminator_EnumeratePhysicalDeviceGroups, .GetPhysicalDeviceFeatures2 = terminator_GetPhysicalDeviceFeatures2, .GetPhysicalDeviceProperties2 = terminator_GetPhysicalDeviceProperties2, @@ -9805,7 +12088,7 @@ const VkLayerInstanceDispatchTable instance_disp = { .GetPhysicalDeviceExternalFenceProperties = terminator_GetPhysicalDeviceExternalFenceProperties, .GetPhysicalDeviceExternalSemaphoreProperties = terminator_GetPhysicalDeviceExternalSemaphoreProperties, - // ---- Core 1_3 commands + // ---- Core Vulkan 1.3 commands .GetPhysicalDeviceToolProperties = terminator_GetPhysicalDeviceToolProperties, // ---- VK_KHR_surface extension commands @@ -9828,49 +12111,45 @@ const VkLayerInstanceDispatchTable instance_disp = { .CreateDisplayPlaneSurfaceKHR = terminator_CreateDisplayPlaneSurfaceKHR, // ---- VK_KHR_xlib_surface extension commands -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) .CreateXlibSurfaceKHR = terminator_CreateXlibSurfaceKHR, #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) .GetPhysicalDeviceXlibPresentationSupportKHR = terminator_GetPhysicalDeviceXlibPresentationSupportKHR, #endif // VK_USE_PLATFORM_XLIB_KHR // ---- VK_KHR_xcb_surface extension commands -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) .CreateXcbSurfaceKHR = terminator_CreateXcbSurfaceKHR, #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) .GetPhysicalDeviceXcbPresentationSupportKHR = terminator_GetPhysicalDeviceXcbPresentationSupportKHR, #endif // VK_USE_PLATFORM_XCB_KHR // ---- VK_KHR_wayland_surface extension commands -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) .CreateWaylandSurfaceKHR = terminator_CreateWaylandSurfaceKHR, #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) .GetPhysicalDeviceWaylandPresentationSupportKHR = terminator_GetPhysicalDeviceWaylandPresentationSupportKHR, #endif // VK_USE_PLATFORM_WAYLAND_KHR // ---- VK_KHR_android_surface extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) .CreateAndroidSurfaceKHR = terminator_CreateAndroidSurfaceKHR, #endif // VK_USE_PLATFORM_ANDROID_KHR // ---- VK_KHR_win32_surface extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) .CreateWin32SurfaceKHR = terminator_CreateWin32SurfaceKHR, #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) .GetPhysicalDeviceWin32PresentationSupportKHR = terminator_GetPhysicalDeviceWin32PresentationSupportKHR, #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS .GetPhysicalDeviceVideoCapabilitiesKHR = terminator_GetPhysicalDeviceVideoCapabilitiesKHR, -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS .GetPhysicalDeviceVideoFormatPropertiesKHR = terminator_GetPhysicalDeviceVideoFormatPropertiesKHR, -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_get_physical_device_properties2 extension commands .GetPhysicalDeviceFeatures2KHR = terminator_GetPhysicalDeviceFeatures2, @@ -9910,13 +12189,22 @@ const VkLayerInstanceDispatchTable instance_disp = { // ---- VK_KHR_fragment_shading_rate extension commands .GetPhysicalDeviceFragmentShadingRatesKHR = terminator_GetPhysicalDeviceFragmentShadingRatesKHR, + // ---- VK_KHR_video_encode_queue extension commands + .GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR = terminator_GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR, + + // ---- VK_KHR_cooperative_matrix extension commands + .GetPhysicalDeviceCooperativeMatrixPropertiesKHR = terminator_GetPhysicalDeviceCooperativeMatrixPropertiesKHR, + + // ---- VK_KHR_calibrated_timestamps extension commands + .GetPhysicalDeviceCalibrateableTimeDomainsKHR = terminator_GetPhysicalDeviceCalibrateableTimeDomainsKHR, + // ---- VK_EXT_debug_report extension commands .CreateDebugReportCallbackEXT = terminator_CreateDebugReportCallbackEXT, .DestroyDebugReportCallbackEXT = terminator_DestroyDebugReportCallbackEXT, .DebugReportMessageEXT = terminator_DebugReportMessageEXT, // ---- VK_GGP_stream_descriptor_surface extension commands -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) .CreateStreamDescriptorSurfaceGGP = terminator_CreateStreamDescriptorSurfaceGGP, #endif // VK_USE_PLATFORM_GGP @@ -9924,7 +12212,7 @@ const VkLayerInstanceDispatchTable instance_disp = { .GetPhysicalDeviceExternalImageFormatPropertiesNV = terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV, // ---- VK_NN_vi_surface extension commands -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) .CreateViSurfaceNN = terminator_CreateViSurfaceNN, #endif // VK_USE_PLATFORM_VI_NN @@ -9932,10 +12220,10 @@ const VkLayerInstanceDispatchTable instance_disp = { .ReleaseDisplayEXT = terminator_ReleaseDisplayEXT, // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) .AcquireXlibDisplayEXT = terminator_AcquireXlibDisplayEXT, #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) .GetRandROutputDisplayEXT = terminator_GetRandROutputDisplayEXT, #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT @@ -9943,12 +12231,12 @@ const VkLayerInstanceDispatchTable instance_disp = { .GetPhysicalDeviceSurfaceCapabilities2EXT = terminator_GetPhysicalDeviceSurfaceCapabilities2EXT, // ---- VK_MVK_ios_surface extension commands -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) .CreateIOSSurfaceMVK = terminator_CreateIOSSurfaceMVK, #endif // VK_USE_PLATFORM_IOS_MVK // ---- VK_MVK_macos_surface extension commands -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) .CreateMacOSSurfaceMVK = terminator_CreateMacOSSurfaceMVK, #endif // VK_USE_PLATFORM_MACOS_MVK @@ -9964,12 +12252,12 @@ const VkLayerInstanceDispatchTable instance_disp = { .GetPhysicalDeviceCalibrateableTimeDomainsEXT = terminator_GetPhysicalDeviceCalibrateableTimeDomainsEXT, // ---- VK_FUCHSIA_imagepipe_surface extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) .CreateImagePipeSurfaceFUCHSIA = terminator_CreateImagePipeSurfaceFUCHSIA, #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_EXT_metal_surface extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) .CreateMetalSurfaceEXT = terminator_CreateMetalSurfaceEXT, #endif // VK_USE_PLATFORM_METAL_EXT @@ -9983,7 +12271,7 @@ const VkLayerInstanceDispatchTable instance_disp = { .GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV = terminator_GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV, // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) .GetPhysicalDeviceSurfacePresentModes2EXT = terminator_GetPhysicalDeviceSurfacePresentModes2EXT, #endif // VK_USE_PLATFORM_WIN32_KHR @@ -9995,34 +12283,33 @@ const VkLayerInstanceDispatchTable instance_disp = { .GetDrmDisplayEXT = terminator_GetDrmDisplayEXT, // ---- VK_NV_acquire_winrt_display extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) .AcquireWinrtDisplayNV = terminator_AcquireWinrtDisplayNV, #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) .GetWinrtDisplayNV = terminator_GetWinrtDisplayNV, #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_directfb_surface extension commands -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) .CreateDirectFBSurfaceEXT = terminator_CreateDirectFBSurfaceEXT, #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) .GetPhysicalDeviceDirectFBPresentationSupportEXT = terminator_GetPhysicalDeviceDirectFBPresentationSupportEXT, #endif // VK_USE_PLATFORM_DIRECTFB_EXT // ---- VK_QNX_screen_surface extension commands -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) .CreateScreenSurfaceQNX = terminator_CreateScreenSurfaceQNX, #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) .GetPhysicalDeviceScreenPresentationSupportQNX = terminator_GetPhysicalDeviceScreenPresentationSupportQNX, #endif // VK_USE_PLATFORM_SCREEN_QNX // ---- VK_NV_optical_flow extension commands .GetPhysicalDeviceOpticalFlowImageFormatsNV = terminator_GetPhysicalDeviceOpticalFlowImageFormatsNV, - // ---- VK_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) .CreateSurfaceOHOS = terminator_CreateSurfaceOHOS, #endif // VK_USE_PLATFORM_OHOS }; @@ -10034,16 +12321,16 @@ const VkLayerInstanceDispatchTable instance_disp = { const char *const LOADER_INSTANCE_EXTENSIONS[] = { VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) VK_KHR_XLIB_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) VK_KHR_XCB_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VK_KHR_WIN32_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_WIN32_KHR VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, @@ -10056,45 +12343,48 @@ const char *const LOADER_INSTANCE_EXTENSIONS[] = { VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_GGP VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) VK_NN_VI_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_VI_NN VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME, #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) VK_MVK_IOS_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) VK_MVK_MACOS_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_MACOS_MVK VK_EXT_DEBUG_UTILS_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) VK_EXT_METAL_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_METAL_EXT VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME, VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, + VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME, VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) VK_QNX_SCREEN_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_SCREEN_QNX VK_GOOGLE_SURFACELESS_QUERY_EXTENSION_NAME, -#ifdef VK_USE_PLATFORM_OHOS + VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME, + VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, +#if defined(VK_USE_PLATFORM_OHOS) VK_OHOS_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_OHOS NULL }; - +// clang-format on diff --git a/loader/generated/vk_loader_extensions.h b/loader/generated/vk_loader_extensions.h index 51b894c56790c13e137a1ef6f3825f3e4326dcfa..2a1d1ad44601ec5c054438ed022ba651dfe96392 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. @@ -22,6 +24,7 @@ * Author: Mark Young */ +// clang-format off #pragma once // Structures defined externally, but used here @@ -45,7 +48,7 @@ void extensions_create_instance(struct loader_instance *ptr_instance, const VkIn // 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 *pName); +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. @@ -54,8 +57,7 @@ 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); +VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_instance* inst, struct loader_icd_term *icd_term); // 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, @@ -77,7 +79,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer VkInstance inst); // Device command lookup function -VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name); +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, @@ -208,7 +210,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolProperties( // ICD function pointer dispatch table struct loader_icd_term_dispatch { - // ---- Core 1_0 commands + // ---- Core Vulkan 1.0 commands PFN_vkCreateInstance CreateInstance; PFN_vkDestroyInstance DestroyInstance; PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; @@ -225,7 +227,7 @@ struct loader_icd_term_dispatch { PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties; PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties; - // ---- Core 1_1 commands + // ---- Core Vulkan 1.1 commands PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion; PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups; PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2; @@ -239,7 +241,7 @@ struct loader_icd_term_dispatch { PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties; PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties; - // ---- Core 1_3 commands + // ---- Core Vulkan 1.3 commands PFN_vkGetPhysicalDeviceToolProperties GetPhysicalDeviceToolProperties; // ---- VK_KHR_surface extension commands @@ -250,8 +252,6 @@ struct loader_icd_term_dispatch { PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR; // ---- VK_KHR_swapchain extension commands - PFN_vkCreateSwapchainKHR CreateSwapchainKHR; - PFN_vkGetDeviceGroupSurfacePresentModesKHR GetDeviceGroupSurfacePresentModesKHR; PFN_vkGetPhysicalDevicePresentRectanglesKHR GetPhysicalDevicePresentRectanglesKHR; // ---- VK_KHR_display extension commands @@ -263,53 +263,46 @@ struct loader_icd_term_dispatch { PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR; PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR; - // ---- VK_KHR_display_swapchain extension commands - PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR; - // ---- VK_KHR_xlib_surface extension commands -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR; #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR; #endif // VK_USE_PLATFORM_XLIB_KHR // ---- VK_KHR_xcb_surface extension commands -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR; #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR; #endif // VK_USE_PLATFORM_XCB_KHR // ---- VK_KHR_wayland_surface extension commands -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR; #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR; #endif // VK_USE_PLATFORM_WAYLAND_KHR // ---- VK_KHR_android_surface extension commands -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR; #endif // VK_USE_PLATFORM_ANDROID_KHR // ---- VK_KHR_win32_surface extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR; #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_KHR_video_queue extension commands -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR GetPhysicalDeviceVideoCapabilitiesKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS -#ifdef VK_ENABLE_BETA_EXTENSIONS PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR GetPhysicalDeviceVideoFormatPropertiesKHR; -#endif // VK_ENABLE_BETA_EXTENSIONS // ---- VK_KHR_get_physical_device_properties2 extension commands PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR; @@ -349,17 +342,22 @@ struct loader_icd_term_dispatch { // ---- VK_KHR_fragment_shading_rate extension commands PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR GetPhysicalDeviceFragmentShadingRatesKHR; + // ---- VK_KHR_video_encode_queue extension commands + PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR; + + // ---- VK_KHR_cooperative_matrix extension commands + PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR GetPhysicalDeviceCooperativeMatrixPropertiesKHR; + + // ---- VK_KHR_calibrated_timestamps extension commands + PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR GetPhysicalDeviceCalibrateableTimeDomainsKHR; + // ---- VK_EXT_debug_report extension commands PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT; PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT; PFN_vkDebugReportMessageEXT DebugReportMessageEXT; - // ---- VK_EXT_debug_marker extension commands - PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT; - PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT; - // ---- VK_GGP_stream_descriptor_surface extension commands -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) PFN_vkCreateStreamDescriptorSurfaceGGP CreateStreamDescriptorSurfaceGGP; #endif // VK_USE_PLATFORM_GGP @@ -367,7 +365,7 @@ struct loader_icd_term_dispatch { PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV GetPhysicalDeviceExternalImageFormatPropertiesNV; // ---- VK_NN_vi_surface extension commands -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) PFN_vkCreateViSurfaceNN CreateViSurfaceNN; #endif // VK_USE_PLATFORM_VI_NN @@ -375,10 +373,10 @@ struct loader_icd_term_dispatch { PFN_vkReleaseDisplayEXT ReleaseDisplayEXT; // ---- VK_EXT_acquire_xlib_display extension commands -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) PFN_vkAcquireXlibDisplayEXT AcquireXlibDisplayEXT; #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) PFN_vkGetRandROutputDisplayEXT GetRandROutputDisplayEXT; #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT @@ -386,24 +384,16 @@ struct loader_icd_term_dispatch { PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT; // ---- VK_MVK_ios_surface extension commands -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) PFN_vkCreateIOSSurfaceMVK CreateIOSSurfaceMVK; #endif // VK_USE_PLATFORM_IOS_MVK // ---- VK_MVK_macos_surface extension commands -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) PFN_vkCreateMacOSSurfaceMVK CreateMacOSSurfaceMVK; #endif // VK_USE_PLATFORM_MACOS_MVK // ---- 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; PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT; PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT; PFN_vkSubmitDebugUtilsMessageEXT SubmitDebugUtilsMessageEXT; @@ -415,12 +405,12 @@ struct loader_icd_term_dispatch { PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT; // ---- VK_FUCHSIA_imagepipe_surface extension commands -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) PFN_vkCreateImagePipeSurfaceFUCHSIA CreateImagePipeSurfaceFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA // ---- VK_EXT_metal_surface extension commands -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) PFN_vkCreateMetalSurfaceEXT CreateMetalSurfaceEXT; #endif // VK_USE_PLATFORM_METAL_EXT @@ -434,12 +424,9 @@ struct loader_icd_term_dispatch { PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV; // ---- VK_EXT_full_screen_exclusive extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT GetPhysicalDeviceSurfacePresentModes2EXT; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - PFN_vkGetDeviceGroupSurfacePresentModes2EXT GetDeviceGroupSurfacePresentModes2EXT; -#endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_headless_surface extension commands PFN_vkCreateHeadlessSurfaceEXT CreateHeadlessSurfaceEXT; @@ -449,26 +436,26 @@ struct loader_icd_term_dispatch { PFN_vkGetDrmDisplayEXT GetDrmDisplayEXT; // ---- VK_NV_acquire_winrt_display extension commands -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkAcquireWinrtDisplayNV AcquireWinrtDisplayNV; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vkGetWinrtDisplayNV GetWinrtDisplayNV; #endif // VK_USE_PLATFORM_WIN32_KHR // ---- VK_EXT_directfb_surface extension commands -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) PFN_vkCreateDirectFBSurfaceEXT CreateDirectFBSurfaceEXT; #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT GetPhysicalDeviceDirectFBPresentationSupportEXT; #endif // VK_USE_PLATFORM_DIRECTFB_EXT // ---- VK_QNX_screen_surface extension commands -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) PFN_vkCreateScreenSurfaceQNX CreateScreenSurfaceQNX; #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX GetPhysicalDeviceScreenPresentationSupportQNX; #endif // VK_USE_PLATFORM_SCREEN_QNX @@ -496,4 +483,30 @@ struct loader_instance_extension_enables { uint8_t ext_acquire_drm_display; }; +// 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_marker extension commands + PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT; + PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT; + // ---- 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; +#if defined(VK_USE_PLATFORM_WIN32_KHR) + // ---- VK_EXT_full_screen_exclusive extension commands + PFN_vkGetDeviceGroupSurfacePresentModes2EXT GetDeviceGroupSurfacePresentModes2EXT; +#endif // VK_USE_PLATFORM_WIN32_KHR +}; +// clang-format on diff --git a/loader/generated/vk_object_types.h b/loader/generated/vk_object_types.h index 5c18a2ca2b54ce0be1bf663490ed23116dcc2255..08f3bef7891d0aa3446c9f198f73674d61c8cba7 100644 --- a/loader/generated/vk_object_types.h +++ b/loader/generated/vk_object_types.h @@ -1,3 +1,4 @@ +// clang-format off // *** THIS FILE IS GENERATED - DO NOT EDIT *** // See helper_file_generator.py for modifications @@ -80,11 +81,14 @@ typedef enum VulkanObjectType { kVulkanObjectTypeAccelerationStructureNV = 41, kVulkanObjectTypePerformanceConfigurationINTEL = 42, kVulkanObjectTypeIndirectCommandsLayoutNV = 43, - kVulkanObjectTypeBufferCollectionFUCHSIA = 44, - kVulkanObjectTypeMicromapEXT = 45, - kVulkanObjectTypeOpticalFlowSessionNV = 46, - kVulkanObjectTypeAccelerationStructureKHR = 47, - kVulkanObjectTypeMax = 48, + kVulkanObjectTypeCudaModuleNV = 44, + kVulkanObjectTypeCudaFunctionNV = 45, + kVulkanObjectTypeAccelerationStructureKHR = 46, + kVulkanObjectTypeBufferCollectionFUCHSIA = 47, + kVulkanObjectTypeMicromapEXT = 48, + kVulkanObjectTypeOpticalFlowSessionNV = 49, + kVulkanObjectTypeShaderEXT = 50, + kVulkanObjectTypeMax = 51, // Aliases for backwards compatibilty of "promoted" types kVulkanObjectTypeDescriptorUpdateTemplateKHR = kVulkanObjectTypeDescriptorUpdateTemplate, kVulkanObjectTypeSamplerYcbcrConversionKHR = kVulkanObjectTypeSamplerYcbcrConversion, @@ -137,10 +141,13 @@ static const char * const object_string[kVulkanObjectTypeMax] = { "AccelerationStructureNV", "PerformanceConfigurationINTEL", "IndirectCommandsLayoutNV", + "CudaModuleNV", + "CudaFunctionNV", + "AccelerationStructureKHR", "BufferCollectionFUCHSIA", "MicromapEXT", "OpticalFlowSessionNV", - "AccelerationStructureKHR", + "ShaderEXT", }; // Helper array to get Vulkan VK_EXT_debug_report object type enum from the internal layers version @@ -189,10 +196,13 @@ const VkDebugReportObjectTypeEXT get_debug_report_enum[] = { VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, // kVulkanObjectTypeAccelerationStructureNV VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypePerformanceConfigurationINTEL VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeIndirectCommandsLayoutNV + VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_MODULE_NV_EXT, // kVulkanObjectTypeCudaModuleNV + VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_FUNCTION_NV_EXT, // kVulkanObjectTypeCudaFunctionNV + VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT, // kVulkanObjectTypeAccelerationStructureKHR VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA_EXT, // kVulkanObjectTypeBufferCollectionFUCHSIA VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeMicromapEXT VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeOpticalFlowSessionNV - VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT, // kVulkanObjectTypeAccelerationStructureKHR + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeShaderEXT }; // Helper array to get Official Vulkan VkObjectType enum from the internal layers version @@ -241,10 +251,13 @@ const VkObjectType get_object_type_enum[] = { VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV, // kVulkanObjectTypeAccelerationStructureNV VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL, // kVulkanObjectTypePerformanceConfigurationINTEL VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV, // kVulkanObjectTypeIndirectCommandsLayoutNV + VK_OBJECT_TYPE_CUDA_MODULE_NV, // kVulkanObjectTypeCudaModuleNV + VK_OBJECT_TYPE_CUDA_FUNCTION_NV, // kVulkanObjectTypeCudaFunctionNV + VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR, // kVulkanObjectTypeAccelerationStructureKHR VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA, // kVulkanObjectTypeBufferCollectionFUCHSIA VK_OBJECT_TYPE_MICROMAP_EXT, // kVulkanObjectTypeMicromapEXT VK_OBJECT_TYPE_OPTICAL_FLOW_SESSION_NV, // kVulkanObjectTypeOpticalFlowSessionNV - VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR, // kVulkanObjectTypeAccelerationStructureKHR + VK_OBJECT_TYPE_SHADER_EXT, // kVulkanObjectTypeShaderEXT }; // Helper function to convert from VkDebugReportObjectTypeEXT to VkObjectType @@ -331,6 +344,10 @@ static inline VkObjectType convertDebugReportObjectToCoreObject(VkDebugReportObj return VK_OBJECT_TYPE_VALIDATION_CACHE_EXT; } else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT) { return VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV; + } else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_MODULE_NV_EXT) { + return VK_OBJECT_TYPE_CUDA_MODULE_NV; + } else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_FUNCTION_NV_EXT) { + return VK_OBJECT_TYPE_CUDA_FUNCTION_NV; } else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA_EXT) { return VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA; } @@ -421,8 +438,13 @@ static inline VkDebugReportObjectTypeEXT convertCoreObjectToDebugReportObject(Vk return VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT; } else if (core_report_obj == VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV) { return VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT; + } else if (core_report_obj == VK_OBJECT_TYPE_CUDA_MODULE_NV) { + return VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_MODULE_NV_EXT; + } else if (core_report_obj == VK_OBJECT_TYPE_CUDA_FUNCTION_NV) { + return VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_FUNCTION_NV_EXT; } else if (core_report_obj == VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA) { return VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA_EXT; } return VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT; } +// clang-format on diff --git a/loader/get_environment.c b/loader/get_environment.c deleted file mode 100644 index 0352f075f42ecf64583fa864c83d41a51cc47ccd..0000000000000000000000000000000000000000 --- a/loader/get_environment.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * - * Copyright (c) 2014-2021 The Khronos Group Inc. - * Copyright (c) 2014-2021 Valve Corporation - * Copyright (c) 2014-2021 LunarG, Inc. - * - * 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: Jon Ashburn - * Author: Courtney Goeltzenleuchter - * Author: Chia-I Wu - * Author: Chia-I Wu - * Author: Mark Lobodzinski - * Author: Lenny Komow - * Author: Charles Giessen - * - */ - -#include "get_environment.h" - -#include "allocation.h" -#include "log.h" -#include "param/sys_param.h" - -// Environment variables -#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__) - -bool is_high_integrity() { return geteuid() != getuid() || getegid() != getgid(); } - -char *loader_getenv(const char *name, const struct loader_instance *inst) { -#ifdef __OHOS__ - CachedHandle g_Handle = CachedParameterCreate(name, ""); - int changed = 0; - const char *res = CachedParameterGetChanged(g_Handle, &changed); - loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_INFO_BIT, 0, "loader_getenv name:%s, res:%s", name, res); - if (res == NULL || res[0] == '\0') { - return NULL; - } - return (char *)res; -#else - // No allocation of memory necessary for Linux, but we should at least touch - // the inst pointer to get rid of compiler warnings. - (void)inst; - return getenv(name); -#endif -} - -char *loader_secure_getenv(const char *name, const struct loader_instance *inst) { -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) - // Apple does not appear to have a secure getenv implementation. - // The main difference between secure getenv and getenv is that secure getenv - // returns NULL if the process is being run with elevated privileges by a normal user. - // The idea is to prevent the reading of malicious environment variables by a process - // that can do damage. - // This algorithm is derived from glibc code that sets an internal - // variable (__libc_enable_secure) if the process is running under setuid or setgid. - return is_high_integrity() ? NULL : loader_getenv(name, inst); -#elif defined(__Fuchsia__) - return loader_getenv(name, inst); -#else - // Linux - char *out; -#if defined(HAVE_SECURE_GETENV) && !defined(USE_UNSAFE_FILE_SEARCH) - (void)inst; - out = secure_getenv(name); -#elif defined(HAVE___SECURE_GETENV) && !defined(USE_UNSAFE_FILE_SEARCH) - (void)inst; - out = __secure_getenv(name); -#else - out = loader_getenv(name, inst); -#if !defined(USE_UNSAFE_FILE_SEARCH) - loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "Loader is using non-secure environment variable lookup for %s", name); -#endif -#endif - return out; -#endif -} - -void loader_free_getenv(char *val, const struct loader_instance *inst) { - // No freeing of memory necessary for Linux, but we should at least touch - // the val and inst pointers to get rid of compiler warnings. - (void)val; - (void)inst; -} - -#elif defined(WIN32) - -bool is_high_integrity() { - HANDLE process_token; - if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_QUERY_SOURCE, &process_token)) { - // Maximum possible size of SID_AND_ATTRIBUTES is maximum size of a SID + size of attributes DWORD. - uint8_t mandatory_label_buffer[SECURITY_MAX_SID_SIZE + sizeof(DWORD)]; - DWORD buffer_size; - if (GetTokenInformation(process_token, TokenIntegrityLevel, mandatory_label_buffer, sizeof(mandatory_label_buffer), - &buffer_size) != 0) { - const TOKEN_MANDATORY_LABEL *mandatory_label = (const TOKEN_MANDATORY_LABEL *)mandatory_label_buffer; - const DWORD sub_authority_count = *GetSidSubAuthorityCount(mandatory_label->Label.Sid); - const DWORD integrity_level = *GetSidSubAuthority(mandatory_label->Label.Sid, sub_authority_count - 1); - - CloseHandle(process_token); - return integrity_level > SECURITY_MANDATORY_MEDIUM_RID; - } - - CloseHandle(process_token); - } - - return false; -} - -char *loader_getenv(const char *name, const struct loader_instance *inst) { - int name_utf16_size = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); - if (name_utf16_size <= 0) { - return NULL; - } - wchar_t *name_utf16 = (wchar_t *)loader_stack_alloc(name_utf16_size * sizeof(wchar_t)); - if (MultiByteToWideChar(CP_UTF8, 0, name, -1, name_utf16, name_utf16_size) != name_utf16_size) { - return NULL; - } - - DWORD val_size = GetEnvironmentVariableW(name_utf16, NULL, 0); - // val_size DOES include the null terminator, so for any set variable - // will always be at least 1. If it's 0, the variable wasn't set. - if (val_size == 0) { - return NULL; - } - - wchar_t *val = (wchar_t *)loader_stack_alloc(val_size * sizeof(wchar_t)); - if (GetEnvironmentVariableW(name_utf16, val, val_size) != val_size - 1) { - return NULL; - } - - int val_utf8_size = WideCharToMultiByte(CP_UTF8, 0, val, -1, NULL, 0, NULL, NULL); - if (val_utf8_size <= 0) { - return NULL; - } - char *val_utf8 = (char *)loader_instance_heap_alloc(inst, val_utf8_size * sizeof(char), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (val_utf8 == NULL) { - return NULL; - } - if (WideCharToMultiByte(CP_UTF8, 0, val, -1, val_utf8, val_utf8_size, NULL, NULL) != val_utf8_size) { - loader_instance_heap_free(inst, val_utf8); - return NULL; - } - return val_utf8; -} - -char *loader_secure_getenv(const char *name, const struct loader_instance *inst) { -#if !defined(USE_UNSAFE_FILE_SEARCH) - if (is_high_integrity()) { - loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, - "Loader is running with elevated permissions. Environment variable %s will be ignored", name); - return NULL; - } -#endif - - return loader_getenv(name, inst); -} - -void loader_free_getenv(char *val, const struct loader_instance *inst) { loader_instance_heap_free(inst, (void *)val); } - -#else - -char *loader_getenv(const char *name, const struct loader_instance *inst) { - // stub func - (void)inst; - (void)name; - return NULL; -} -void loader_free_getenv(char *val, const struct loader_instance *inst) { - // stub func - (void)val; - (void)inst; -} - -#endif diff --git a/loader/gpa_helper.c b/loader/gpa_helper.c index 2dea285fbfedd0691eff13603804af8fe9170565..b0aeb5c3c75204523542b69a3eff73fecb50c184 100644 --- a/loader/gpa_helper.c +++ b/loader/gpa_helper.c @@ -278,17 +278,3 @@ void *globalGetProcAddr(const char *name) { return NULL; } - -void *loader_non_passthrough_gdpa(const char *name) { - if (!name || name[0] != 'v' || name[1] != 'k') return NULL; - - name += 2; - - if (!strcmp(name, "GetDeviceProcAddr")) return vkGetDeviceProcAddr; - if (!strcmp(name, "DestroyDevice")) return vkDestroyDevice; - if (!strcmp(name, "GetDeviceQueue")) return vkGetDeviceQueue; - if (!strcmp(name, "GetDeviceQueue2")) return vkGetDeviceQueue2; - if (!strcmp(name, "AllocateCommandBuffers")) return vkAllocateCommandBuffers; - - return NULL; -} diff --git a/loader/gpa_helper.h b/loader/gpa_helper.h index ecc5ec3a0aeb5480b84548340bc8095b89b795cc..12f1d6a137685f03f81fda4a71bc4d10f4f27330 100644 --- a/loader/gpa_helper.h +++ b/loader/gpa_helper.h @@ -27,5 +27,3 @@ void *trampoline_get_proc_addr(struct loader_instance *inst, const char *funcName); void *globalGetProcAddr(const char *name); - -void *loader_non_passthrough_gdpa(const char *name); \ No newline at end of file diff --git a/loader/loader.aps b/loader/loader.aps deleted file mode 100644 index 1ba7f2114369e36f65325c489d7d629848f926e2..0000000000000000000000000000000000000000 Binary files a/loader/loader.aps and /dev/null differ diff --git a/loader/loader.c b/loader/loader.c index f5af60657a6eea2ea1de8fed9ed377d3bb83273c..8b49f3b0d867ddeb7183b4d68171e5929d47dcfb 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1,9 +1,11 @@ /* * - * Copyright (c) 2014-2022 The Khronos Group Inc. - * Copyright (c) 2014-2022 Valve Corporation - * Copyright (c) 2014-2022 LunarG, Inc. + * Copyright (c) 2014-2023 The Khronos Group Inc. + * 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. @@ -28,6 +30,7 @@ #include "loader.h" +#include #include #include #include @@ -41,20 +44,19 @@ #include #endif -// Time related functions -#include - #include #if defined(_WIN32) #include "dirent_on_windows.h" -#else // _WIN32 +#elif COMMON_UNIX_PLATFORMS #include +#else +#warning dirent.h not available on this platform #endif // _WIN32 #include "allocation.h" #include "cJSON.h" #include "debug_utils.h" -#include "get_environment.h" +#include "loader_environment.h" #include "gpa_helper.h" #include "log.h" #include "unknown_function_handling.h" @@ -64,7 +66,7 @@ #if defined(WIN32) #include "loader_windows.h" #endif -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) // This header is currently only used when sorting Linux devices, so don't include it otherwise. #include "loader_linux.h" #endif // LOADER_ENABLE_LINUX_SORT @@ -86,7 +88,6 @@ struct activated_layer_info { // all entrypoints on the instance chain need to be locked except GPA // additionally CreateDevice and DestroyDevice needs to be locked loader_platform_thread_mutex loader_lock; -loader_platform_thread_mutex loader_json_lock; loader_platform_thread_mutex loader_preload_icd_lock; loader_platform_thread_mutex loader_global_instance_list_lock; @@ -95,7 +96,11 @@ loader_platform_thread_mutex loader_global_instance_list_lock; // functionality, but the fact that the libraries already been loaded causes any call that needs to load ICD libraries to speed up // significantly. This can have a huge impact when making repeated calls to vkEnumerateInstanceExtensionProperties and // vkCreateInstance. -static struct loader_icd_tramp_list scanned_icds; +struct loader_icd_tramp_list scanned_icds; + +// controls whether loader_platform_close_library() closes the libraries or not - controlled by an environment +// variables - this is just the definition of the variable, usage is in vk_loader_platform.h +bool loader_disable_dynamic_library_unloading; LOADER_PLATFORM_THREAD_ONCE_DECLARATION(once_init); @@ -129,7 +134,7 @@ loader_api_version loader_combine_version(uint32_t major, uint32_t minor, uint32 bool loader_check_version_meets_required(loader_api_version required, loader_api_version version) { // major version is satisfied return (version.major > required.major) || - // major version is equal, minor version is patch version is gerater to minimum minor + // major version is equal, minor version is patch version is greater to minimum minor (version.major == required.major && version.minor > required.minor) || // major and minor version are equal, patch version is greater or equal to minimum patch (version.major == required.major && version.minor == required.minor && version.patch >= required.patch); @@ -140,19 +145,25 @@ bool loader_check_version_meets_required(loader_api_version required, loader_api DIR *loader_opendir(const struct loader_instance *instance, const char *name) { #if defined(_WIN32) return opendir(instance ? &instance->alloc_callbacks : NULL, name); -#else // _WIN32 +#elif COMMON_UNIX_PLATFORMS + (void)instance; return opendir(name); +#else +#warning dirent.h - opendir not available on this platform #endif // _WIN32 } int loader_closedir(const struct loader_instance *instance, DIR *dir) { #if defined(_WIN32) return closedir(instance ? &instance->alloc_callbacks : NULL, dir); -#else // _WIN32 +#elif COMMON_UNIX_PLATFORMS + (void)instance; return closedir(dir); +#else +#warning dirent.h - closedir not available on this platform #endif // _WIN32 } -static bool is_json(const char *path, size_t len) { +bool is_json(const char *path, size_t len) { if (len < 5) { return false; } @@ -172,6 +183,14 @@ void loader_handle_load_library_error(const struct loader_instance *inst, const if (NULL != lib_status) { *lib_status = LOADER_LAYER_LIB_ERROR_WRONG_BIT_TYPE; } + } + // Check if the error is due to lack of memory + // "with error 8" is the windows error code for OOM cases, aka ERROR_NOT_ENOUGH_MEMORY + // Linux doesn't have such a nice error message - only if there are reported issues should this be called + else if (strstr(error_message, " with error 8") != NULL) { + if (NULL != lib_status) { + *lib_status = LOADER_LAYER_LIB_ERROR_OUT_OF_MEMORY; + } } else if (NULL != lib_status) { *lib_status = LOADER_LAYER_LIB_ERROR_FAILED_TO_LOAD; } @@ -192,7 +211,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkSetDeviceDispatch(VkDevice device, void *object struct loader_device *dev; struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, NULL); - if (NULL == icd_term) { + if (NULL == icd_term || NULL == dev) { return VK_ERROR_INITIALIZATION_FAILED; } loader_set_dispatch(object, &dev->loader_dispatch); @@ -200,95 +219,138 @@ VKAPI_ATTR VkResult VKAPI_CALL vkSetDeviceDispatch(VkDevice device, void *object } void loader_free_layer_properties(const struct loader_instance *inst, struct loader_layer_properties *layer_properties) { - loader_instance_heap_free(inst, layer_properties->component_layer_names); - loader_instance_heap_free(inst, layer_properties->override_paths); - loader_instance_heap_free(inst, layer_properties->blacklist_layer_names); - loader_instance_heap_free(inst, layer_properties->app_key_paths); - + loader_instance_heap_free(inst, layer_properties->manifest_file_name); + loader_instance_heap_free(inst, layer_properties->lib_name); + loader_instance_heap_free(inst, layer_properties->functions.str_gipa); + loader_instance_heap_free(inst, layer_properties->functions.str_gdpa); + loader_instance_heap_free(inst, layer_properties->functions.str_negotiate_interface); loader_destroy_generic_list(inst, (struct loader_generic_list *)&layer_properties->instance_extension_list); - if (layer_properties->device_extension_list.capacity > 0 && NULL != layer_properties->device_extension_list.list) { for (uint32_t i = 0; i < layer_properties->device_extension_list.count; i++) { - struct loader_dev_ext_props *ext_props = &layer_properties->device_extension_list.list[i]; - if (ext_props->entrypoint_count > 0) { - for (uint32_t j = 0; j < ext_props->entrypoint_count; j++) { - loader_instance_heap_free(inst, ext_props->entrypoints[j]); - } - loader_instance_heap_free(inst, ext_props->entrypoints); - } + free_string_list(inst, &layer_properties->device_extension_list.list[i].entrypoints); } } loader_destroy_generic_list(inst, (struct loader_generic_list *)&layer_properties->device_extension_list); + loader_instance_heap_free(inst, layer_properties->disable_env_var.name); + loader_instance_heap_free(inst, layer_properties->disable_env_var.value); + loader_instance_heap_free(inst, layer_properties->enable_env_var.name); + loader_instance_heap_free(inst, layer_properties->enable_env_var.value); + free_string_list(inst, &layer_properties->component_layer_names); + loader_instance_heap_free(inst, layer_properties->pre_instance_functions.enumerate_instance_extension_properties); + loader_instance_heap_free(inst, layer_properties->pre_instance_functions.enumerate_instance_layer_properties); + loader_instance_heap_free(inst, layer_properties->pre_instance_functions.enumerate_instance_version); + free_string_list(inst, &layer_properties->override_paths); + free_string_list(inst, &layer_properties->blacklist_layer_names); + free_string_list(inst, &layer_properties->app_key_paths); // Make sure to clear out the removed layer, in case new layers are added in the previous location memset(layer_properties, 0, sizeof(struct loader_layer_properties)); } -// Combine path elements, separating each element with the platform-specific -// directory separator, and save the combined string to a destination buffer, -// not exceeding the given length. Path elements are given as variable args, -// with a NULL element terminating the list. -// -// \returns the total length of the combined string, not including an ASCII -// NUL termination character. This length may exceed the available storage: -// in this case, the written string will be truncated to avoid a buffer -// overrun, and the return value will greater than or equal to the storage -// size. A NULL argument may be provided as the destination buffer in order -// to determine the required string length without actually writing a string. -static size_t loader_platform_combine_path(char *dest, size_t len, ...) { - size_t required_len = 0; - va_list ap; - const char *component; - - va_start(ap, len); - component = va_arg(ap, const char *); - while (component) { - if (required_len > 0) { - // This path element is not the first non-empty element; prepend - // a directory separator if space allows - if (dest && required_len + 1 < len) { - (void)snprintf(dest + required_len, len - required_len, "%c", DIRECTORY_SYMBOL); - } - required_len++; +VkResult loader_init_library_list(struct loader_layer_list *instance_layers, loader_platform_dl_handle **libs) { + if (instance_layers->count > 0) { + *libs = loader_calloc(NULL, sizeof(loader_platform_dl_handle) * instance_layers->count, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (*libs == NULL) { + return VK_ERROR_OUT_OF_HOST_MEMORY; } + } + return VK_SUCCESS; +} - if (dest && required_len < len) { - strncpy(dest + required_len, component, len - required_len); - } - required_len += strlen(component); - component = va_arg(ap, const char *); +VkResult loader_copy_to_new_str(const struct loader_instance *inst, const char *source_str, char **dest_str) { + assert(source_str && dest_str); + size_t str_len = strlen(source_str) + 1; + *dest_str = loader_instance_heap_calloc(inst, str_len, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == *dest_str) return VK_ERROR_OUT_OF_HOST_MEMORY; + loader_strncpy(*dest_str, str_len, source_str, str_len); + (*dest_str)[str_len - 1] = 0; + return VK_SUCCESS; +} + +VkResult create_string_list(const struct loader_instance *inst, uint32_t allocated_count, struct loader_string_list *string_list) { + assert(string_list); + string_list->list = loader_instance_heap_calloc(inst, sizeof(char *) * allocated_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == string_list->list) { + return VK_ERROR_OUT_OF_HOST_MEMORY; } + string_list->allocated_count = allocated_count; + string_list->count = 0; + return VK_SUCCESS; +} - va_end(ap); +VkResult append_str_to_string_list(const struct loader_instance *inst, struct loader_string_list *string_list, char *str) { + assert(string_list && str); + if (string_list->allocated_count == 0) { + string_list->allocated_count = 32; + string_list->list = + loader_instance_heap_calloc(inst, sizeof(char *) * string_list->allocated_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == string_list->list) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } else if (string_list->count + 1 > string_list->allocated_count) { + uint32_t new_allocated_count = string_list->allocated_count * 2; + string_list->list = loader_instance_heap_realloc(inst, string_list->list, sizeof(char *) * string_list->allocated_count, + sizeof(char *) * new_allocated_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == string_list->list) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + // Null out the new space + memset(string_list->list + string_list->allocated_count, 0, string_list->allocated_count); + string_list->allocated_count *= 2; + } + string_list->list[string_list->count++] = str; + return VK_SUCCESS; +} - // strncpy(3) won't add a NUL terminating byte in the event of truncation. - if (dest && required_len >= len) { - dest[len - 1] = '\0'; +VkResult copy_str_to_string_list(const struct loader_instance *inst, struct loader_string_list *string_list, const char *str, + size_t str_len) { + assert(string_list && str); + char *new_str = loader_instance_heap_calloc(inst, sizeof(char *) * str_len + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == new_str) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + loader_strncpy(new_str, sizeof(char *) * str_len + 1, str, str_len); + new_str[str_len] = '\0'; + VkResult res = append_str_to_string_list(inst, string_list, new_str); + if (res != VK_SUCCESS) { + // Cleanup new_str if the append failed - as append_str_to_string_list takes ownership but not if the function fails + loader_instance_heap_free(inst, new_str); } + return res; +} - return required_len; +void free_string_list(const struct loader_instance *inst, struct loader_string_list *string_list) { + assert(string_list); + if (string_list->list) { + for (uint32_t i = 0; i < string_list->count; i++) { + loader_instance_heap_free(inst, string_list->list[i]); + string_list->list[i] = NULL; + } + loader_instance_heap_free(inst, string_list->list); + } + memset(string_list, 0, sizeof(struct loader_string_list)); } // Given string of three part form "maj.min.pat" convert to a vulkan version number. // Also can understand four part form "variant.major.minor.patch" if provided. -static uint32_t loader_parse_version_string(char *vers_str) { +uint32_t loader_parse_version_string(char *vers_str) { uint32_t variant = 0, major = 0, minor = 0, patch = 0; char *vers_tok; - + char *context = NULL; if (!vers_str) { return 0; } - vers_tok = strtok(vers_str, ".\"\n\r"); + vers_tok = thread_safe_strtok(vers_str, ".\"\n\r", &context); if (NULL != vers_tok) { major = (uint16_t)atoi(vers_tok); - vers_tok = strtok(NULL, ".\"\n\r"); + vers_tok = thread_safe_strtok(NULL, ".\"\n\r", &context); if (NULL != vers_tok) { minor = (uint16_t)atoi(vers_tok); - vers_tok = strtok(NULL, ".\"\n\r"); + vers_tok = thread_safe_strtok(NULL, ".\"\n\r", &context); if (NULL != vers_tok) { patch = (uint16_t)atoi(vers_tok); - vers_tok = strtok(NULL, ".\"\n\r"); + vers_tok = thread_safe_strtok(NULL, ".\"\n\r", &context); // check that we are using a 4 part version string if (NULL != vers_tok) { // if we are, move the values over into the correct place @@ -333,18 +395,14 @@ bool has_vk_dev_ext_property(const VkExtensionProperties *ext_prop, const struct return false; } -// Get the next unused layer property in the list. Init the property to zero. -static struct loader_layer_properties *loader_get_next_layer_property_slot(const struct loader_instance *inst, - struct loader_layer_list *layer_list) { +VkResult loader_append_layer_property(const struct loader_instance *inst, struct loader_layer_list *layer_list, + struct loader_layer_properties *layer_property) { + VkResult res = VK_SUCCESS; if (layer_list->capacity == 0) { - layer_list->list = - loader_instance_heap_calloc(inst, sizeof(struct loader_layer_properties) * 64, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (layer_list->list == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_get_next_layer_property_slot: Out of memory can not add any layer properties to list"); - return NULL; + res = loader_init_generic_list(inst, (struct loader_generic_list *)layer_list, sizeof(struct loader_layer_properties)); + if (VK_SUCCESS != res) { + goto out; } - layer_list->capacity = sizeof(struct loader_layer_properties) * 64; } // Ensure enough room to add an entry @@ -352,20 +410,26 @@ static struct loader_layer_properties *loader_get_next_layer_property_slot(const void *new_ptr = loader_instance_heap_realloc(inst, layer_list->list, layer_list->capacity, layer_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_ptr) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_next_layer_property_slot: realloc failed for layer list"); - return NULL; + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_append_layer_property: realloc failed for layer list"); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; } layer_list->list = new_ptr; memset((uint8_t *)layer_list->list + layer_list->capacity, 0, layer_list->capacity); layer_list->capacity *= 2; } - + memcpy(&layer_list->list[layer_list->count], layer_property, sizeof(struct loader_layer_properties)); layer_list->count++; - return &(layer_list->list[layer_list->count - 1]); + memset(layer_property, 0, sizeof(struct loader_layer_properties)); +out: + if (res != VK_SUCCESS) { + loader_free_layer_properties(inst, layer_property); + } + return res; } // Search the given layer list for a layer property matching the given layer name -static struct loader_layer_properties *loader_find_layer_property(const char *name, const struct loader_layer_list *layer_list) { +struct loader_layer_properties *loader_find_layer_property(const char *name, const struct loader_layer_list *layer_list) { for (uint32_t i = 0; i < layer_list->count; i++) { const VkLayerProperties *item = &layer_list->list[i].info; if (strcmp(name, item->layerName) == 0) return &layer_list->list[i]; @@ -373,27 +437,35 @@ static struct loader_layer_properties *loader_find_layer_property(const char *na return NULL; } +struct loader_layer_properties *loader_find_pointer_layer_property(const char *name, + const struct loader_pointer_layer_list *layer_list) { + for (uint32_t i = 0; i < layer_list->count; i++) { + const VkLayerProperties *item = &layer_list->list[i]->info; + if (strcmp(name, item->layerName) == 0) return layer_list->list[i]; + } + return NULL; +} + // Search the given layer list for a layer matching the given layer name -static bool loader_find_layer_name_in_list(const char *name, const struct loader_layer_list *layer_list) { +bool loader_find_layer_name_in_list(const char *name, const struct loader_pointer_layer_list *layer_list) { if (NULL == layer_list) { return false; } - if (NULL != loader_find_layer_property(name, layer_list)) { + if (NULL != loader_find_pointer_layer_property(name, layer_list)) { return true; } return false; } // Search the given meta-layer's component list for a layer matching the given layer name -static bool loader_find_layer_name_in_meta_layer(const struct loader_instance *inst, const char *layer_name, - struct loader_layer_list *layer_list, - struct loader_layer_properties *meta_layer_props) { - for (uint32_t comp_layer = 0; comp_layer < meta_layer_props->num_component_layers; comp_layer++) { - if (!strcmp(meta_layer_props->component_layer_names[comp_layer], layer_name)) { +bool loader_find_layer_name_in_meta_layer(const struct loader_instance *inst, const char *layer_name, + struct loader_layer_list *layer_list, struct loader_layer_properties *meta_layer_props) { + for (uint32_t comp_layer = 0; comp_layer < meta_layer_props->component_layer_names.count; comp_layer++) { + if (!strcmp(meta_layer_props->component_layer_names.list[comp_layer], layer_name)) { return true; } struct loader_layer_properties *comp_layer_props = - loader_find_layer_property(meta_layer_props->component_layer_names[comp_layer], layer_list); + loader_find_layer_property(meta_layer_props->component_layer_names.list[comp_layer], layer_list); if (comp_layer_props->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) { return loader_find_layer_name_in_meta_layer(inst, layer_name, layer_list, comp_layer_props); } @@ -402,11 +474,9 @@ static bool loader_find_layer_name_in_meta_layer(const struct loader_instance *i } // Search the override layer's blacklist for a layer matching the given layer name -static bool loader_find_layer_name_in_blacklist(const struct loader_instance *inst, const char *layer_name, - struct loader_layer_list *layer_list, - struct loader_layer_properties *meta_layer_props) { - for (uint32_t black_layer = 0; black_layer < meta_layer_props->num_blacklist_layers; ++black_layer) { - if (!strcmp(meta_layer_props->blacklist_layer_names[black_layer], layer_name)) { +bool loader_find_layer_name_in_blacklist(const char *layer_name, struct loader_layer_properties *meta_layer_props) { + for (uint32_t black_layer = 0; black_layer < meta_layer_props->blacklist_layer_names.count; ++black_layer) { + if (!strcmp(meta_layer_props->blacklist_layer_names.list[black_layer], layer_name)) { return true; } } @@ -419,6 +489,12 @@ void loader_delete_layer_list_and_properties(const struct loader_instance *inst, if (!layer_list) return; for (i = 0; i < layer_list->count; i++) { + if (layer_list->list[i].lib_handle) { + loader_platform_close_library(layer_list->list[i].lib_handle); + loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Unloading layer library %s", + layer_list->list[i].lib_name); + layer_list->list[i].lib_handle = NULL; + } loader_free_layer_properties(inst, &(layer_list->list[i])); } layer_list->count = 0; @@ -427,6 +503,7 @@ void loader_delete_layer_list_and_properties(const struct loader_instance *inst, layer_list->capacity = 0; loader_instance_heap_free(inst, layer_list->list); } + memset(layer_list, 0, sizeof(struct loader_layer_list)); } void loader_remove_layer_in_list(const struct loader_instance *inst, struct loader_layer_list *layer_list, @@ -464,7 +541,7 @@ void loader_remove_layers_in_blacklist(const struct loader_instance *inst, struc } // If found in the override layer's blacklist, remove it - if (loader_find_layer_name_in_blacklist(inst, cur_layer_name, layer_list, override_prop)) { + if (loader_find_layer_name_in_blacklist(cur_layer_name, override_prop)) { loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "loader_remove_layers_in_blacklist: Override layer is active and layer %s is in the blacklist inside of it. " "Removing that layer from current layer list.", @@ -527,9 +604,9 @@ void loader_remove_layers_not_in_implicit_meta_layers(const struct loader_instan } } -static VkResult loader_add_instance_extensions(const struct loader_instance *inst, - const PFN_vkEnumerateInstanceExtensionProperties fp_get_props, const char *lib_name, - struct loader_extension_list *ext_list) { +VkResult loader_add_instance_extensions(const struct loader_instance *inst, + const PFN_vkEnumerateInstanceExtensionProperties fp_get_props, const char *lib_name, + struct loader_extension_list *ext_list) { uint32_t i, count = 0; VkExtensionProperties *ext_props; VkResult res = VK_SUCCESS; @@ -539,6 +616,15 @@ static VkResult loader_add_instance_extensions(const struct loader_instance *ins goto out; } + // Make sure we never call ourself by accident, this should never happen outside of error paths + if (fp_get_props == vkEnumerateInstanceExtensionProperties) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_add_instance_extensions: %s's vkEnumerateInstanceExtensionProperties points to the loader, this would " + "lead to infinite recursion.", + lib_name); + goto out; + } + res = fp_get_props(NULL, &count, NULL); if (res != VK_SUCCESS) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, @@ -578,27 +664,6 @@ out: return res; } -// Initialize ext_list with the physical device extensions. -// The extension properties are passed as inputs in count and ext_props. -static VkResult loader_init_device_extensions(const struct loader_instance *inst, struct loader_physical_device_term *phys_dev_term, - uint32_t count, VkExtensionProperties *ext_props, - struct loader_extension_list *ext_list) { - VkResult res; - uint32_t i; - - res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, sizeof(VkExtensionProperties)); - if (VK_SUCCESS != res) { - return res; - } - - for (i = 0; i < count; i++) { - res = loader_add_to_ext_list(inst, ext_list, 1, &ext_props[i]); - if (res != VK_SUCCESS) return res; - } - - return VK_SUCCESS; -} - VkResult loader_add_device_extensions(const struct loader_instance *inst, PFN_vkEnumerateDeviceExtensionProperties fpEnumerateDeviceExtensionProperties, VkPhysicalDevice physical_device, const char *lib_name, @@ -651,17 +716,13 @@ VkResult loader_init_generic_list(const struct loader_instance *inst, struct loa void loader_destroy_generic_list(const struct loader_instance *inst, struct loader_generic_list *list) { loader_instance_heap_free(inst, list->list); - list->count = 0; - list->capacity = 0; + memset(list, 0, sizeof(struct loader_generic_list)); } // Append non-duplicate extension properties defined in props to the given ext_list. // Return - Vk_SUCCESS on success VkResult loader_add_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list, uint32_t prop_list_count, const VkExtensionProperties *props) { - uint32_t i; - const VkExtensionProperties *cur_ext; - if (ext_list->list == NULL || ext_list->capacity == 0) { VkResult res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, sizeof(VkExtensionProperties)); if (VK_SUCCESS != res) { @@ -669,8 +730,8 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst, struct loade } } - for (i = 0; i < prop_list_count; i++) { - cur_ext = &props[i]; + for (uint32_t i = 0; i < prop_list_count; i++) { + const VkExtensionProperties *cur_ext = &props[i]; // look for duplicates if (has_vk_extension_property(cur_ext, ext_list)) { @@ -701,23 +762,25 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst, struct loade // Append one extension property defined in props with entrypoints defined in entries to the given // ext_list. Do not append if a duplicate. -// Return - Vk_SUCCESS on success +// If this is a duplicate, this function free's the passed in entries - as in it takes ownership over that list (if it is not +// NULL) Return - Vk_SUCCESS on success VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct loader_device_extension_list *ext_list, - const VkExtensionProperties *props, uint32_t entry_count, char **entrys) { - uint32_t idx; + const VkExtensionProperties *props, struct loader_string_list *entrys) { + VkResult res = VK_SUCCESS; + bool should_free_entrys = true; if (ext_list->list == NULL || ext_list->capacity == 0) { - VkResult res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, sizeof(struct loader_dev_ext_props)); + res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, sizeof(struct loader_dev_ext_props)); if (VK_SUCCESS != res) { - return res; + goto out; } } // look for duplicates if (has_vk_dev_ext_property(props, ext_list)) { - return VK_SUCCESS; + goto out; } - idx = ext_list->count; + uint32_t idx = ext_list->count; // add to list at end // check for enough capacity if (idx * sizeof(struct loader_dev_ext_props) >= ext_list->capacity) { @@ -727,7 +790,8 @@ VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct l if (NULL == new_ptr) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_add_to_dev_ext_list: Failed to reallocate space for device extension list"); - return VK_ERROR_OUT_OF_HOST_MEMORY; + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; } ext_list->list = new_ptr; @@ -736,48 +800,21 @@ VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct l } memcpy(&ext_list->list[idx].props, props, sizeof(*props)); - ext_list->list[idx].entrypoint_count = entry_count; - if (entry_count == 0) { - ext_list->list[idx].entrypoints = NULL; - } else { - ext_list->list[idx].entrypoints = - loader_instance_heap_alloc(inst, sizeof(char *) * entry_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (ext_list->list[idx].entrypoints == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_add_to_dev_ext_list: Failed to allocate space for device extension entrypoint list in list %d", idx); - ext_list->list[idx].entrypoint_count = 0; - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - for (uint32_t i = 0; i < entry_count; i++) { - ext_list->list[idx].entrypoints[i] = - loader_instance_heap_alloc(inst, strlen(entrys[i]) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (ext_list->list[idx].entrypoints[i] == NULL) { - for (uint32_t j = 0; j < i; j++) { - loader_instance_heap_free(inst, ext_list->list[idx].entrypoints[j]); - } - loader_instance_heap_free(inst, ext_list->list[idx].entrypoints); - ext_list->list[idx].entrypoint_count = 0; - ext_list->list[idx].entrypoints = NULL; - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_add_to_dev_ext_list: Failed to allocate space for device extension entrypoint %d name", i); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - strcpy(ext_list->list[idx].entrypoints[i], entrys[i]); - } + if (entrys) { + ext_list->list[idx].entrypoints = *entrys; + should_free_entrys = false; } ext_list->count++; - - return VK_SUCCESS; +out: + if (NULL != entrys && should_free_entrys) { + free_string_list(inst, entrys); + } + return res; } -// Prototypes needed. -bool loader_add_meta_layer(const struct loader_instance *inst, const struct loader_layer_properties *prop, - struct loader_layer_list *target_list, struct loader_layer_list *expanded_target_list, - const struct loader_layer_list *source_list); - -// Manage lists of VkLayerProperties -static bool loader_init_layer_list(const struct loader_instance *inst, struct loader_layer_list *list) { - list->capacity = 32 * sizeof(struct loader_layer_properties); +// Create storage for pointers to loader_layer_properties +bool loader_init_pointer_layer_list(const struct loader_instance *inst, struct loader_pointer_layer_list *list) { + list->capacity = 32 * sizeof(void *); list->list = loader_instance_heap_calloc(inst, list->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->list == NULL) { return false; @@ -797,70 +834,76 @@ bool loader_names_array_has_layer_property(const VkLayerProperties *vk_layer_pro return false; } -void loader_destroy_layer_list(const struct loader_instance *inst, struct loader_device *device, - struct loader_layer_list *layer_list) { - if (device) { - loader_device_heap_free(device, layer_list->list); - } else { - loader_instance_heap_free(inst, layer_list->list); - } - layer_list->count = 0; - layer_list->capacity = 0; - layer_list->list = NULL; +void loader_destroy_pointer_layer_list(const struct loader_instance *inst, struct loader_pointer_layer_list *layer_list) { + loader_instance_heap_free(inst, layer_list->list); + memset(layer_list, 0, sizeof(struct loader_pointer_layer_list)); } // Append layer properties defined in prop_list to the given layer_info list -VkResult loader_add_layer_properties_to_list(const struct loader_instance *inst, struct loader_layer_list *list, - uint32_t prop_list_count, const struct loader_layer_properties *props) { - uint32_t i; - struct loader_layer_properties *layer; - +VkResult loader_add_layer_properties_to_list(const struct loader_instance *inst, struct loader_pointer_layer_list *list, + struct loader_layer_properties *props) { if (list->list == NULL || list->capacity == 0) { - if (!loader_init_layer_list(inst, list)) { + if (!loader_init_pointer_layer_list(inst, list)) { return VK_ERROR_OUT_OF_HOST_MEMORY; } } - if (list->list == NULL) return VK_SUCCESS; - - for (i = 0; i < prop_list_count; i++) { - layer = (struct loader_layer_properties *)&props[i]; - - // Check for enough capacity - if (((list->count + 1) * sizeof(struct loader_layer_properties)) >= list->capacity) { - size_t new_capacity = list->capacity * 2; - void *new_ptr = - loader_instance_heap_realloc(inst, list->list, list->capacity, new_capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (NULL == new_ptr) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_add_layer_properties_to_list: Realloc failed for when attempting to add new layer"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - list->list = new_ptr; - list->capacity = new_capacity; + // Check for enough capacity + if (((list->count + 1) * sizeof(struct loader_layer_properties)) >= list->capacity) { + size_t new_capacity = list->capacity * 2; + void *new_ptr = + loader_instance_heap_realloc(inst, list->list, list->capacity, new_capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == new_ptr) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_add_layer_properties_to_list: Realloc failed for when attempting to add new layer"); + return VK_ERROR_OUT_OF_HOST_MEMORY; } - - memcpy(&list->list[list->count], layer, sizeof(struct loader_layer_properties)); - list->count++; + list->list = new_ptr; + list->capacity = new_capacity; } + list->list[list->count++] = props; return VK_SUCCESS; } +// Determine if the provided explicit layer should be available by querying the appropriate environmental variables. +bool loader_layer_is_available(const struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + const struct loader_layer_properties *prop) { + bool available = true; + bool is_implicit = (0 == (prop->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER)); + bool disabled_by_type = + (is_implicit) ? (filters->disable_filter.disable_all_implicit) : (filters->disable_filter.disable_all_explicit); + if ((filters->disable_filter.disable_all || disabled_by_type || + check_name_matches_filter_environment_var(prop->info.layerName, &filters->disable_filter.additional_filters)) && + !check_name_matches_filter_environment_var(prop->info.layerName, &filters->allow_filter)) { + available = false; + } + if (check_name_matches_filter_environment_var(prop->info.layerName, &filters->enable_filter)) { + available = true; + } else if (!available) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Layer \"%s\" forced disabled because name matches filter of env var \'%s\'.", prop->info.layerName, + VK_LAYERS_DISABLE_ENV_VAR); + } + + return available; +} + // Search the given search_list for any layers in the props list. Add these to the // output layer_list. -static VkResult loader_add_layer_names_to_list(const struct loader_instance *inst, struct loader_layer_list *output_list, - struct loader_layer_list *expanded_output_list, uint32_t name_count, - const char *const *names, const struct loader_layer_list *source_list) { - struct loader_layer_properties *layer_prop; +VkResult loader_add_layer_names_to_list(const struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + struct loader_pointer_layer_list *output_list, + struct loader_pointer_layer_list *expanded_output_list, uint32_t name_count, + const char *const *names, const struct loader_layer_list *source_list) { VkResult err = VK_SUCCESS; for (uint32_t i = 0; i < name_count; i++) { const char *source_name = names[i]; - layer_prop = loader_find_layer_property(source_name, source_list); + + struct loader_layer_properties *layer_prop = loader_find_layer_property(source_name, source_list); if (NULL == layer_prop) { loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_add_layer_names_to_list: Unable to find layer %s", source_name); + "loader_add_layer_names_to_list: Unable to find layer \"%s\"", source_name); err = VK_ERROR_LAYER_NOT_PRESENT; continue; } @@ -870,65 +913,84 @@ static VkResult loader_add_layer_names_to_list(const struct loader_instance *ins continue; } + if (!loader_layer_is_available(inst, filters, layer_prop)) { + continue; + } + // If not a meta-layer, simply add it. if (0 == (layer_prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER)) { - loader_add_layer_properties_to_list(inst, output_list, 1, layer_prop); - loader_add_layer_properties_to_list(inst, expanded_output_list, 1, layer_prop); + err = loader_add_layer_properties_to_list(inst, output_list, layer_prop); + if (err == VK_ERROR_OUT_OF_HOST_MEMORY) return err; + err = loader_add_layer_properties_to_list(inst, expanded_output_list, layer_prop); + if (err == VK_ERROR_OUT_OF_HOST_MEMORY) return err; } else { - loader_add_meta_layer(inst, layer_prop, output_list, expanded_output_list, source_list); + err = loader_add_meta_layer(inst, filters, layer_prop, output_list, expanded_output_list, source_list, NULL); + if (err == VK_ERROR_OUT_OF_HOST_MEMORY) return err; } } return err; } -static bool check_expiration(const struct loader_instance *inst, const struct loader_layer_properties *prop) { - time_t current = time(NULL); - struct tm tm_current = *localtime(¤t); - - struct tm tm_expiration; - tm_expiration.tm_sec = 0; - tm_expiration.tm_min = prop->expiration.minute; - tm_expiration.tm_hour = prop->expiration.hour; - tm_expiration.tm_mday = prop->expiration.day; - tm_expiration.tm_mon = prop->expiration.month - 1; - tm_expiration.tm_year = prop->expiration.year - 1900; - tm_expiration.tm_isdst = tm_current.tm_isdst; - // wday and yday are ignored by mktime - time_t expiration = mktime(&tm_expiration); - - return current < expiration; -} - // Determine if the provided implicit layer should be enabled by querying the appropriate environmental variables. // For an implicit layer, at least a disable environment variable is required. -bool loader_implicit_layer_is_enabled(const struct loader_instance *inst, const struct loader_layer_properties *prop) { +bool loader_implicit_layer_is_enabled(const struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + const struct loader_layer_properties *prop) { bool enable = false; - char *env_value = NULL; + bool forced_disabled = false; + bool forced_enabled = false; + + if ((filters->disable_filter.disable_all || filters->disable_filter.disable_all_implicit || + check_name_matches_filter_environment_var(prop->info.layerName, &filters->disable_filter.additional_filters)) && + !check_name_matches_filter_environment_var(prop->info.layerName, &filters->allow_filter)) { + forced_disabled = true; + } + if (check_name_matches_filter_environment_var(prop->info.layerName, &filters->enable_filter)) { + forced_enabled = true; + } // If no enable_environment variable is specified, this implicit layer is always be enabled by default. - if (prop->enable_env_var.name[0] == 0) { + if (NULL == prop->enable_env_var.name) { enable = true; } else { - // Otherwise, only enable this layer if the enable environment variable is defined - env_value = loader_getenv(prop->enable_env_var.name, inst); + char *env_value = loader_getenv(prop->enable_env_var.name, inst); if (env_value && !strcmp(prop->enable_env_var.value, env_value)) { enable = true; } + + // Otherwise, only enable this layer if the enable environment variable is defined loader_free_getenv(env_value, inst); } - // The disable_environment has priority over everything else. If it is defined, the layer is always - // disabled. - env_value = loader_getenv(prop->disable_env_var.name, inst); - if (NULL != env_value) { + if (forced_enabled) { + // Only report a message that we've forced on a layer if it wouldn't have been enabled + // normally. + if (!enable) { + enable = true; + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Implicit layer \"%s\" forced enabled due to env var \'%s\'.", prop->info.layerName, + VK_LAYERS_ENABLE_ENV_VAR); + } + } else if (enable && forced_disabled) { enable = false; + // Report a message that we've forced off a layer if it would have been enabled normally. + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Implicit layer \"%s\" forced disabled because name matches filter of env var \'%s\'.", prop->info.layerName, + VK_LAYERS_DISABLE_ENV_VAR); + return enable; } - loader_free_getenv(env_value, inst); - // If this layer has an expiration, check it to determine if this layer has expired. - if (prop->has_expiration) { - enable = check_expiration(inst, prop); + // The disable_environment has priority over everything else. If it is defined, the layer is always + // disabled. + if (NULL != prop->disable_env_var.name) { + char *env_value = loader_getenv(prop->disable_env_var.name, inst); + if (NULL != env_value) { + enable = false; + } + loader_free_getenv(env_value, inst); + } else if ((prop->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER) == 0) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Implicit layer \"%s\" missing disabled environment variable!", prop->info.layerName, VK_LAYERS_DISABLE_ENV_VAR); } // Enable this layer if it is included in the override layer @@ -941,8 +1003,8 @@ bool loader_implicit_layer_is_enabled(const struct loader_instance *inst, const } } if (override != NULL) { - for (uint32_t i = 0; i < override->num_component_layers; ++i) { - if (strcmp(override->component_layer_names[i], prop->info.layerName) == 0) { + for (uint32_t i = 0; i < override->component_layer_names.count; ++i) { + if (strcmp(override->component_layer_names.list[i], prop->info.layerName) == 0) { enable = true; break; } @@ -954,118 +1016,110 @@ bool loader_implicit_layer_is_enabled(const struct loader_instance *inst, const } // Check the individual implicit layer for the enable/disable environment variable settings. Only add it after -// every check has passed indicating it should be used. -static void loader_add_implicit_layer(const struct loader_instance *inst, const struct loader_layer_properties *prop, - struct loader_layer_list *target_list, struct loader_layer_list *expanded_target_list, - const struct loader_layer_list *source_list) { - if (loader_implicit_layer_is_enabled(inst, prop)) { +// every check has passed indicating it should be used, including making sure a layer of the same name hasn't already been +// added. +VkResult loader_add_implicit_layer(const struct loader_instance *inst, struct loader_layer_properties *prop, + const struct loader_envvar_all_filters *filters, struct loader_pointer_layer_list *target_list, + struct loader_pointer_layer_list *expanded_target_list, + const struct loader_layer_list *source_list) { + VkResult result = VK_SUCCESS; + if (loader_implicit_layer_is_enabled(inst, filters, prop)) { if (0 == (prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER)) { - loader_add_layer_properties_to_list(inst, target_list, 1, prop); + // Make sure the layer isn't already in the output_list, skip adding it if it is. + if (loader_find_layer_name_in_list(&prop->info.layerName[0], target_list)) { + return result; + } + + result = loader_add_layer_properties_to_list(inst, target_list, prop); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) return result; if (NULL != expanded_target_list) { - loader_add_layer_properties_to_list(inst, expanded_target_list, 1, prop); + result = loader_add_layer_properties_to_list(inst, expanded_target_list, prop); } } else { - loader_add_meta_layer(inst, prop, target_list, expanded_target_list, source_list); + result = loader_add_meta_layer(inst, filters, prop, target_list, expanded_target_list, source_list, NULL); } } + return result; } // Add the component layers of a meta-layer to the active list of layers -bool loader_add_meta_layer(const struct loader_instance *inst, const struct loader_layer_properties *prop, - struct loader_layer_list *target_list, struct loader_layer_list *expanded_target_list, - const struct loader_layer_list *source_list) { - bool found = true; +VkResult loader_add_meta_layer(const struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + struct loader_layer_properties *prop, struct loader_pointer_layer_list *target_list, + struct loader_pointer_layer_list *expanded_target_list, const struct loader_layer_list *source_list, + bool *out_found_all_component_layers) { + VkResult result = VK_SUCCESS; + bool found_all_component_layers = true; // We need to add all the individual component layers loader_api_version meta_layer_api_version = loader_make_version(prop->info.specVersion); - for (uint32_t comp_layer = 0; comp_layer < prop->num_component_layers; comp_layer++) { - const struct loader_layer_properties *search_prop = - loader_find_layer_property(prop->component_layer_names[comp_layer], source_list); + for (uint32_t comp_layer = 0; comp_layer < prop->component_layer_names.count; comp_layer++) { + struct loader_layer_properties *search_prop = + loader_find_layer_property(prop->component_layer_names.list[comp_layer], source_list); if (search_prop != NULL) { loader_api_version search_prop_version = loader_make_version(prop->info.specVersion); if (!loader_check_version_meets_required(meta_layer_api_version, search_prop_version)) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_add_meta_layer: Meta-layer API version %u.%u, component layer %s version %u.%u, may have " + "Meta-layer \"%s\" API version %u.%u, component layer \"%s\" version %u.%u, may have " "incompatibilities (Policy #LLP_LAYER_8)!", - meta_layer_api_version.major, meta_layer_api_version.minor, search_prop->info.layerName, - search_prop_version.major, search_prop_version.minor); + prop->info.layerName, meta_layer_api_version.major, meta_layer_api_version.minor, + search_prop->info.layerName, search_prop_version.major, search_prop_version.minor); + } + + if (!loader_layer_is_available(inst, filters, search_prop)) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Meta Layer \"%s\" component layer \"%s\" disabled.", prop->info.layerName, search_prop->info.layerName); + continue; } // If the component layer is itself an implicit layer, we need to do the implicit layer enable // checks if (0 == (search_prop->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER)) { - loader_add_implicit_layer(inst, search_prop, target_list, expanded_target_list, source_list); + result = loader_add_implicit_layer(inst, search_prop, filters, target_list, expanded_target_list, source_list); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) return result; } else { if (0 != (search_prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER)) { - found = loader_add_meta_layer(inst, search_prop, target_list, expanded_target_list, source_list); - } else { - loader_add_layer_properties_to_list(inst, target_list, 1, search_prop); + bool found_layers_in_component_meta_layer = true; + result = loader_add_meta_layer(inst, filters, search_prop, target_list, expanded_target_list, source_list, + &found_layers_in_component_meta_layer); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) return result; + if (!found_layers_in_component_meta_layer) found_all_component_layers = false; + } else if (!loader_find_layer_name_in_list(&search_prop->info.layerName[0], target_list)) { + // Make sure the layer isn't already in the output_list, skip adding it if it is. + result = loader_add_layer_properties_to_list(inst, target_list, search_prop); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) return result; if (NULL != expanded_target_list) { - loader_add_layer_properties_to_list(inst, expanded_target_list, 1, search_prop); + result = loader_add_layer_properties_to_list(inst, expanded_target_list, search_prop); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) return result; } } } } else { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_add_meta_layer: Failed to find layer name %s component layer %s to activate (Policy #LLP_LAYER_7)", - prop->component_layer_names[comp_layer], prop->component_layer_names[comp_layer]); - found = false; + "Failed to find layer name \"%s\" component layer \"%s\" to activate (Policy #LLP_LAYER_7)", + prop->component_layer_names.list[comp_layer], prop->component_layer_names.list[comp_layer]); + found_all_component_layers = false; } } // Add this layer to the overall target list (not the expanded one) - if (found) { - loader_add_layer_properties_to_list(inst, target_list, 1, prop); + if (found_all_component_layers) { + result = loader_add_layer_properties_to_list(inst, target_list, prop); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) return result; + // Write the result to out_found_all_component_layers in case this function is being recursed + if (out_found_all_component_layers) *out_found_all_component_layers = found_all_component_layers; } - return found; -} - -// Search the source_list for any layer with a name that matches the given name and a type -// that matches the given type. Add all matching layers to the target_list. -VkResult loader_add_layer_name_to_list(const struct loader_instance *inst, const char *name, const enum layer_type_flags type_flags, - const struct loader_layer_list *source_list, struct loader_layer_list *target_list, - struct loader_layer_list *expanded_target_list) { - VkResult res = VK_SUCCESS; - bool found = false; - for (uint32_t i = 0; i < source_list->count; i++) { - struct loader_layer_properties *source_prop = &source_list->list[i]; - if (0 == strcmp(source_prop->info.layerName, name) && (source_prop->type_flags & type_flags) == type_flags) { - // If not a meta-layer, simply add it. - if (0 == (source_prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER)) { - if (VK_SUCCESS == loader_add_layer_properties_to_list(inst, target_list, 1, source_prop)) { - found = true; - } - if (VK_SUCCESS == loader_add_layer_properties_to_list(inst, expanded_target_list, 1, source_prop)) { - found = true; - } - } else { - found = loader_add_meta_layer(inst, source_prop, target_list, expanded_target_list, source_list); - } - } - } - if (!found) { - if (strcmp(name, "VK_LAYER_LUNARG_standard_validation")) { - loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_add_layer_name_to_list: Failed to find layer name %s to activate", name); - } else { - res = VK_ERROR_LAYER_NOT_PRESENT; - loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "Layer VK_LAYER_LUNARG_standard_validation has been changed to VK_LAYER_KHRONOS_validation. Please use the " - "new version of the layer."); - } - } - return res; + return result; } -static VkExtensionProperties *get_extension_property(const char *name, const struct loader_extension_list *list) { +VkExtensionProperties *get_extension_property(const char *name, const struct loader_extension_list *list) { for (uint32_t i = 0; i < list->count; i++) { if (strcmp(name, list->list[i].extensionName) == 0) return &list->list[i]; } return NULL; } -static VkExtensionProperties *get_dev_extension_property(const char *name, const struct loader_device_extension_list *list) { +VkExtensionProperties *get_dev_extension_property(const char *name, const struct loader_device_extension_list *list) { for (uint32_t i = 0; i < list->count; i++) { if (strcmp(name, list->list[i].props.extensionName) == 0) return &list->list[i].props; } @@ -1098,8 +1152,6 @@ VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance char *env_value; bool filter_extensions = true; - loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Build ICD instance extension list"); - // Check if a user wants to disable the instance extension filtering behavior env_value = loader_getenv("VK_LOADER_DISABLE_INST_EXT_FILTER", inst); if (NULL != env_value && atoi(env_value) != 0) { @@ -1148,30 +1200,50 @@ VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance }; // Traverse loader's extensions, adding non-duplicate extensions to the list - add_debug_extensions_to_ext_list(inst, inst_exts); - - static const VkExtensionProperties portability_enumeration_extension_info[] = { + res = add_debug_extensions_to_ext_list(inst, inst_exts); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + goto out; + } + const VkExtensionProperties portability_enumeration_extension_info[] = { {VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION}}; // Add VK_KHR_portability_subset - loader_add_to_ext_list(inst, inst_exts, sizeof(portability_enumeration_extension_info) / sizeof(VkExtensionProperties), - portability_enumeration_extension_info); + res = loader_add_to_ext_list(inst, inst_exts, sizeof(portability_enumeration_extension_info) / sizeof(VkExtensionProperties), + portability_enumeration_extension_info); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + goto out; + } + + const VkExtensionProperties direct_driver_loading_extension_info[] = { + {VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME, VK_LUNARG_DIRECT_DRIVER_LOADING_SPEC_VERSION}}; + + // Add VK_LUNARG_direct_driver_loading + res = loader_add_to_ext_list(inst, inst_exts, sizeof(direct_driver_loading_extension_info) / sizeof(VkExtensionProperties), + direct_driver_loading_extension_info); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + goto out; + } out: return res; } struct loader_icd_term *loader_get_icd_and_device(const void *device, struct loader_device **found_dev, uint32_t *icd_index) { + VkLayerDispatchTable *dispatch_table_device = loader_get_dispatch(device); + if (NULL == dispatch_table_device) { + *found_dev = NULL; + return NULL; + } loader_platform_thread_lock_mutex(&loader_global_instance_list_lock); *found_dev = NULL; + for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) { uint32_t index = 0; for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { - for (struct loader_device *dev = icd_term->logical_device_list; dev; dev = dev->next) + for (struct loader_device *dev = icd_term->logical_device_list; dev; dev = dev->next) { // Value comparison of device prevents object wrapping by layers - if (loader_get_dispatch(dev->icd_device) == loader_get_dispatch(device) || - (dev->chain_device != VK_NULL_HANDLE && - loader_get_dispatch(dev->chain_device) == loader_get_dispatch(device))) { + if (loader_get_dispatch(dev->icd_device) == dispatch_table_device || + (dev->chain_device != VK_NULL_HANDLE && loader_get_dispatch(dev->chain_device) == dispatch_table_device)) { *found_dev = dev; if (NULL != icd_index) { *icd_index = index; @@ -1179,6 +1251,7 @@ struct loader_icd_term *loader_get_icd_and_device(const void *device, struct loa loader_platform_thread_unlock_mutex(&loader_global_instance_list_lock); return icd_term; } + } index++; } } @@ -1186,13 +1259,10 @@ struct loader_icd_term *loader_get_icd_and_device(const void *device, struct loa return NULL; } -void loader_destroy_logical_device(const struct loader_instance *inst, struct loader_device *dev, - const VkAllocationCallbacks *pAllocator) { +void loader_destroy_logical_device(struct loader_device *dev, const VkAllocationCallbacks *pAllocator) { if (pAllocator) { dev->alloc_callbacks = *pAllocator; } - loader_destroy_layer_list(inst, dev, &dev->expanded_activated_layer_list); - loader_destroy_layer_list(inst, dev, &dev->app_activated_layer_list); loader_device_heap_free(dev, dev); } @@ -1205,6 +1275,8 @@ struct loader_device *loader_create_logical_device(const struct loader_instance return NULL; } + new_dev->loader_dispatch.core_dispatch.magic = DEVICE_DISP_TABLE_MAGIC_NUMBER; + if (pAllocator) { new_dev->alloc_callbacks = *pAllocator; } @@ -1212,13 +1284,13 @@ struct loader_device *loader_create_logical_device(const struct loader_instance return new_dev; } -void loader_add_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, struct loader_device *dev) { +void loader_add_logical_device(struct loader_icd_term *icd_term, struct loader_device *dev) { dev->next = icd_term->logical_device_list; icd_term->logical_device_list = dev; } -void loader_remove_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, - struct loader_device *found_dev, const VkAllocationCallbacks *pAllocator) { +void loader_remove_logical_device(struct loader_icd_term *icd_term, struct loader_device *found_dev, + const VkAllocationCallbacks *pAllocator) { struct loader_device *dev, *prev_dev; if (!icd_term || !found_dev) return; @@ -1234,7 +1306,7 @@ void loader_remove_logical_device(const struct loader_instance *inst, struct loa prev_dev->next = found_dev->next; else icd_term->logical_device_list = found_dev->next; - loader_destroy_logical_device(inst, found_dev, pAllocator); + loader_destroy_logical_device(found_dev, pAllocator); } void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term, @@ -1242,14 +1314,14 @@ void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term ptr_inst->total_icd_count--; for (struct loader_device *dev = icd_term->logical_device_list; dev;) { struct loader_device *next_dev = dev->next; - loader_destroy_logical_device(ptr_inst, dev, pAllocator); + loader_destroy_logical_device(dev, pAllocator); dev = next_dev; } loader_instance_heap_free(ptr_inst, icd_term); } -static struct loader_icd_term *loader_icd_add(struct loader_instance *ptr_inst, const struct loader_scanned_icd *scanned_icd) { +struct loader_icd_term *loader_icd_add(struct loader_instance *ptr_inst, const struct loader_scanned_icd *scanned_icd) { struct loader_icd_term *icd_term; icd_term = loader_instance_heap_calloc(ptr_inst, sizeof(struct loader_icd_term), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); @@ -1303,109 +1375,362 @@ bool loader_get_icd_interface_version(PFN_vkNegotiateLoaderICDInterfaceVersion f } void loader_scanned_icd_clear(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list) { - if (0 != icd_tramp_list->capacity) { + if (0 != icd_tramp_list->capacity && icd_tramp_list->scanned_list) { for (uint32_t i = 0; i < icd_tramp_list->count; i++) { - loader_platform_close_library(icd_tramp_list->scanned_list[i].handle); + if (icd_tramp_list->scanned_list[i].handle) { + loader_platform_close_library(icd_tramp_list->scanned_list[i].handle); + icd_tramp_list->scanned_list[i].handle = NULL; + } loader_instance_heap_free(inst, icd_tramp_list->scanned_list[i].lib_name); } loader_instance_heap_free(inst, icd_tramp_list->scanned_list); - icd_tramp_list->capacity = 0; - icd_tramp_list->count = 0; - icd_tramp_list->scanned_list = NULL; } + memset(icd_tramp_list, 0, sizeof(struct loader_icd_tramp_list)); } -static VkResult loader_scanned_icd_init(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list) { - VkResult err = VK_SUCCESS; +VkResult loader_scanned_icd_init(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list) { + VkResult res = VK_SUCCESS; loader_scanned_icd_clear(inst, icd_tramp_list); icd_tramp_list->capacity = 8 * sizeof(struct loader_scanned_icd); icd_tramp_list->scanned_list = loader_instance_heap_alloc(inst, icd_tramp_list->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == icd_tramp_list->scanned_list) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_scanned_icd_init: Realloc failed for layer list when attempting to add new layer"); - err = VK_ERROR_OUT_OF_HOST_MEMORY; + res = VK_ERROR_OUT_OF_HOST_MEMORY; } - return err; + return res; } -static 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) { - loader_platform_dl_handle handle; - PFN_vkCreateInstance fp_create_inst; - PFN_vkEnumerateInstanceExtensionProperties fp_get_inst_ext_props; - PFN_vkGetInstanceProcAddr fp_get_proc_addr; +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 + // of VkDirectDriverLoadingInfoLUNARG structures is non-null. + if (NULL == pDriver->pfnGetInstanceProcAddr) { + loader_log( + inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_add_direct_driver: VkDirectDriverLoadingInfoLUNARG structure at index %d contains a NULL pointer for the " + "pfnGetInstanceProcAddr member, skipping.", + index); + return VK_ERROR_INITIALIZATION_FAILED; + } + + PFN_vkGetInstanceProcAddr fp_get_proc_addr = pDriver->pfnGetInstanceProcAddr; + PFN_vkCreateInstance fp_create_inst = NULL; + PFN_vkEnumerateInstanceExtensionProperties fp_get_inst_ext_props = NULL; PFN_GetPhysicalDeviceProcAddr fp_get_phys_dev_proc_addr = NULL; - PFN_vkNegotiateLoaderICDInterfaceVersion fp_negotiate_icd_version; + PFN_vkNegotiateLoaderICDInterfaceVersion fp_negotiate_icd_version = NULL; #if defined(VK_USE_PLATFORM_WIN32_KHR) PFN_vk_icdEnumerateAdapterPhysicalDevices fp_enum_dxgi_adapter_phys_devs = NULL; #endif struct loader_scanned_icd *new_scanned_icd; - uint32_t interface_vers; - VkResult res = VK_SUCCESS; + uint32_t interface_version = 0; + + // Try to get the negotiate ICD interface version function + fp_negotiate_icd_version = (PFN_vk_icdNegotiateLoaderICDInterfaceVersion)pDriver->pfnGetInstanceProcAddr( + NULL, "vk_icdNegotiateLoaderICDInterfaceVersion"); + + if (NULL == fp_negotiate_icd_version) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_add_direct_driver: Could not get 'vk_icdNegotiateLoaderICDInterfaceVersion' from " + "VkDirectDriverLoadingInfoLUNARG structure at " + "index %d, skipping.", + index); + return VK_ERROR_INITIALIZATION_FAILED; + } - // TODO implement smarter opening/closing of libraries. For now this - // function leaves libraries open and the scanned_icd_clear closes them -#if defined(__Fuchsia__) - handle = loader_platform_open_driver(filename); -#else - handle = loader_platform_open_library(filename); -#endif - if (NULL == handle) { - loader_handle_load_library_error(inst, filename, lib_status); - res = VK_ERROR_INCOMPATIBLE_DRIVER; - goto out; + if (!loader_get_icd_interface_version(fp_negotiate_icd_version, &interface_version)) { + loader_log( + inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_add_direct_driver: VkDirectDriverLoadingInfoLUNARG structure at index %d supports interface version %d, " + "which is incompatible with the Loader Driver Interface version that supports the VK_LUNARG_direct_driver_loading " + "extension, skipping.", + index, interface_version); + return VK_ERROR_INITIALIZATION_FAILED; } - // Get and settle on an ICD interface version - fp_negotiate_icd_version = loader_platform_get_proc_address(handle, "vk_icdNegotiateLoaderICDInterfaceVersion"); + if (interface_version < 7) { + loader_log( + inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_add_direct_driver: VkDirectDriverLoadingInfoLUNARG structure at index %d supports interface version %d, " + "which is incompatible with the Loader Driver Interface version that supports the VK_LUNARG_direct_driver_loading " + "extension, skipping.", + index, interface_version); + return VK_ERROR_INITIALIZATION_FAILED; + } - if (!loader_get_icd_interface_version(fp_negotiate_icd_version, &interface_vers)) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_scanned_icd_add: ICD %s doesn't support interface version compatible with loader, skip this ICD.", - filename); - goto out; + fp_create_inst = (PFN_vkCreateInstance)pDriver->pfnGetInstanceProcAddr(NULL, "vkCreateInstance"); + if (NULL == fp_create_inst) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_add_direct_driver: Could not get 'vkCreateInstance' from VkDirectDriverLoadingInfoLUNARG structure at " + "index %d, skipping.", + index); + return VK_ERROR_INITIALIZATION_FAILED; + } + fp_get_inst_ext_props = + (PFN_vkEnumerateInstanceExtensionProperties)pDriver->pfnGetInstanceProcAddr(NULL, "vkEnumerateInstanceExtensionProperties"); + if (NULL == fp_get_inst_ext_props) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_add_direct_driver: Could not get 'vkEnumerateInstanceExtensionProperties' from " + "VkDirectDriverLoadingInfoLUNARG structure at index %d, skipping.", + index); + return VK_ERROR_INITIALIZATION_FAILED; } - fp_get_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetInstanceProcAddr"); - if (NULL == fp_get_proc_addr) { - if (interface_vers != 0) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_scanned_icd_add: ICD %s reports an interface version of %d but doesn't export " - "vk_icdGetInstanceProcAddr, skip " - "this ICD.", - filename, interface_vers); - goto out; - } - // Use deprecated interface from version 0 - fp_get_proc_addr = loader_platform_get_proc_address(handle, "vkGetInstanceProcAddr"); - if (NULL == fp_get_proc_addr) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_scanned_icd_add: Attempt to retrieve either \'vkGetInstanceProcAddr\' or " - "\'vk_icdGetInstanceProcAddr\' from ICD %s failed.", - filename); - goto out; - } else { - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, - "loader_scanned_icd_add: Using deprecated ICD interface of \'vkGetInstanceProcAddr\' instead of " - "\'vk_icdGetInstanceProcAddr\' for ICD %s", - filename); - } - fp_create_inst = loader_platform_get_proc_address(handle, "vkCreateInstance"); - if (NULL == fp_create_inst) { + fp_get_phys_dev_proc_addr = + (PFN_vk_icdGetPhysicalDeviceProcAddr)pDriver->pfnGetInstanceProcAddr(NULL, "vk_icdGetPhysicalDeviceProcAddr"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + // Query "vk_icdEnumerateAdapterPhysicalDevices" with vk_icdGetInstanceProcAddr if the library reports interface version + // 7 or greater, otherwise fallback to loading it from the platform dynamic linker + fp_enum_dxgi_adapter_phys_devs = + (PFN_vk_icdEnumerateAdapterPhysicalDevices)pDriver->pfnGetInstanceProcAddr(NULL, "vk_icdEnumerateAdapterPhysicalDevices"); +#endif + + // check for enough capacity + if ((icd_tramp_list->count * sizeof(struct loader_scanned_icd)) >= icd_tramp_list->capacity) { + void *new_ptr = loader_instance_heap_realloc(inst, icd_tramp_list->scanned_list, icd_tramp_list->capacity, + icd_tramp_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == new_ptr) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_scanned_icd_add: Failed querying \'vkCreateInstance\' via dlsym/loadlibrary for ICD %s", filename); - goto out; + "loader_add_direct_driver: Realloc failed on icd library list for ICD index %u", index); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + icd_tramp_list->scanned_list = new_ptr; + + // double capacity + icd_tramp_list->capacity *= 2; + } + + // Driver must be 1.1 to support version 7 + uint32_t api_version = VK_API_VERSION_1_1; + PFN_vkEnumerateInstanceVersion icd_enumerate_instance_version = + (PFN_vkEnumerateInstanceVersion)pDriver->pfnGetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion"); + + if (icd_enumerate_instance_version) { + VkResult res = icd_enumerate_instance_version(&api_version); + if (res != VK_SUCCESS) { + return res; + } + } + + new_scanned_icd = &(icd_tramp_list->scanned_list[icd_tramp_list->count]); + new_scanned_icd->handle = NULL; + new_scanned_icd->api_version = api_version; + new_scanned_icd->GetInstanceProcAddr = fp_get_proc_addr; + new_scanned_icd->GetPhysicalDeviceProcAddr = fp_get_phys_dev_proc_addr; + new_scanned_icd->EnumerateInstanceExtensionProperties = fp_get_inst_ext_props; + new_scanned_icd->CreateInstance = fp_create_inst; +#if defined(VK_USE_PLATFORM_WIN32_KHR) + new_scanned_icd->EnumerateAdapterPhysicalDevices = fp_enum_dxgi_adapter_phys_devs; +#endif + new_scanned_icd->interface_version = interface_version; + + new_scanned_icd->lib_name = NULL; + icd_tramp_list->count++; + + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_add_direct_driver: Adding driver found in index %d of " + "VkDirectDriverLoadingListLUNARG::pDrivers structure. pfnGetInstanceProcAddr was set to %p", + index, pDriver->pfnGetInstanceProcAddr); + + return VK_SUCCESS; +} + +// Search through VkInstanceCreateInfo's pNext chain for any drivers from the direct driver loading extension and load them. +VkResult loader_scan_for_direct_drivers(const struct loader_instance *inst, const VkInstanceCreateInfo *pCreateInfo, + struct loader_icd_tramp_list *icd_tramp_list, bool *direct_driver_loading_exclusive_mode) { + if (NULL == pCreateInfo) { + // Don't do this logic unless we are being called from vkCreateInstance, when pCreateInfo will be non-null + return VK_SUCCESS; + } + bool direct_driver_loading_enabled = false; + // Try to if VK_LUNARG_direct_driver_loading is enabled and if we are using it exclusively + // Skip this step if inst is NULL, aka when this function is being called before instance creation + if (inst != NULL && pCreateInfo->ppEnabledExtensionNames && pCreateInfo->enabledExtensionCount > 0) { + // Look through the enabled extension list, make sure VK_LUNARG_direct_driver_loading is present + for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME) == 0) { + direct_driver_loading_enabled = true; + break; + } + } + } + const VkDirectDriverLoadingListLUNARG *ddl_list = NULL; + // Find the VkDirectDriverLoadingListLUNARG struct in the pNext chain of vkInstanceCreateInfo + const VkBaseOutStructure *chain = pCreateInfo->pNext; + while (chain) { + if (chain->sType == VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG) { + ddl_list = (VkDirectDriverLoadingListLUNARG *)chain; + break; + } + chain = (const VkBaseOutStructure *)chain->pNext; + } + if (NULL == ddl_list) { + if (direct_driver_loading_enabled) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_scan_for_direct_drivers: The VK_LUNARG_direct_driver_loading extension was enabled but the " + "pNext chain of " + "VkInstanceCreateInfo did not contain the " + "VkDirectDriverLoadingListLUNARG structure."); + } + // Always want to exit early if there was no VkDirectDriverLoadingListLUNARG in the pNext chain + return VK_SUCCESS; + } + + if (!direct_driver_loading_enabled) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_scan_for_direct_drivers: The pNext chain of VkInstanceCreateInfo contained the " + "VkDirectDriverLoadingListLUNARG structure, but the VK_LUNARG_direct_driver_loading extension was " + "not enabled."); + return VK_SUCCESS; + } + // If we are using exclusive mode, skip looking for any more drivers from system or environment variables + if (ddl_list->mode == VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG) { + *direct_driver_loading_exclusive_mode = true; + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_scan_for_direct_drivers: The VK_LUNARG_direct_driver_loading extension is active and specified " + "VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG, skipping system and environment " + "variable driver search mechanisms."); + } + if (NULL == ddl_list->pDrivers) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_scan_for_direct_drivers: The VkDirectDriverLoadingListLUNARG structure in the pNext chain of " + "VkInstanceCreateInfo has a NULL pDrivers member."); + return VK_SUCCESS; + } + if (ddl_list->driverCount == 0) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "loader_scan_for_direct_drivers: The VkDirectDriverLoadingListLUNARG structure in the pNext chain of " + "VkInstanceCreateInfo has a non-null pDrivers member but a driverCount member with a value " + "of zero."); + return VK_SUCCESS; + } + // Go through all VkDirectDriverLoadingInfoLUNARG entries and add each driver + // Because icd_tramp's are prepended, this will result in the drivers appearing at the end + for (uint32_t i = 0; i < ddl_list->driverCount; i++) { + VkResult res = loader_add_direct_driver(inst, i, &ddl_list->pDrivers[i], icd_tramp_list); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + return res; + } + } + + return VK_SUCCESS; +} + +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) { + loader_platform_dl_handle handle = NULL; + PFN_vkCreateInstance fp_create_inst = NULL; + PFN_vkEnumerateInstanceExtensionProperties fp_get_inst_ext_props = NULL; + PFN_vkGetInstanceProcAddr fp_get_proc_addr = NULL; + PFN_GetPhysicalDeviceProcAddr fp_get_phys_dev_proc_addr = NULL; + PFN_vkNegotiateLoaderICDInterfaceVersion fp_negotiate_icd_version = NULL; +#if defined(VK_USE_PLATFORM_WIN32_KHR) + PFN_vk_icdEnumerateAdapterPhysicalDevices fp_enum_dxgi_adapter_phys_devs = NULL; +#endif + struct loader_scanned_icd *new_scanned_icd = NULL; + uint32_t interface_vers; + VkResult res = VK_SUCCESS; + + // This shouldn't happen, but the check is necessary because dlopen returns a handle to the main program when + // filename is NULL + if (filename == NULL) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_scanned_icd_add: A NULL filename was used, skipping this ICD", + filename); + res = VK_ERROR_INCOMPATIBLE_DRIVER; + goto out; + } + +// TODO implement smarter opening/closing of libraries. For now this +// function leaves libraries open and the scanned_icd_clear closes them +#if defined(__Fuchsia__) + handle = loader_platform_open_driver(filename); +#else + handle = loader_platform_open_library(filename); +#endif + if (NULL == handle) { + loader_handle_load_library_error(inst, filename, lib_status); + if (lib_status && *lib_status == LOADER_LAYER_LIB_ERROR_OUT_OF_MEMORY) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + } else { + res = VK_ERROR_INCOMPATIBLE_DRIVER; + } + goto out; + } + + // Try to load the driver's exported vk_icdNegotiateLoaderICDInterfaceVersion + fp_negotiate_icd_version = loader_platform_get_proc_address(handle, "vk_icdNegotiateLoaderICDInterfaceVersion"); + + // If it isn't exported, we are dealing with either a v0, v1, or a v7 and up driver + if (NULL == fp_negotiate_icd_version) { + // Try to load the driver's exported vk_icdGetInstanceProcAddr - if this is a v7 or up driver, we can use it to get + // the driver's vk_icdNegotiateLoaderICDInterfaceVersion function + fp_get_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetInstanceProcAddr"); + + // If we successfully loaded vk_icdGetInstanceProcAddr, try to get vk_icdNegotiateLoaderICDInterfaceVersion + if (fp_get_proc_addr) { + fp_negotiate_icd_version = + (PFN_vk_icdNegotiateLoaderICDInterfaceVersion)fp_get_proc_addr(NULL, "vk_icdNegotiateLoaderICDInterfaceVersion"); + } + } + + // Try to negotiate the Loader and Driver Interface Versions + // loader_get_icd_interface_version will check if fp_negotiate_icd_version is NULL, so we don't have to. + // If it *is* NULL, that means this driver uses interface version 0 or 1 + if (!loader_get_icd_interface_version(fp_negotiate_icd_version, &interface_vers)) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_scanned_icd_add: ICD %s doesn't support interface version compatible with loader, skip this ICD.", + filename); + goto out; + } + + // If we didn't already query vk_icdGetInstanceProcAddr, try now + if (NULL == fp_get_proc_addr) { + fp_get_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetInstanceProcAddr"); + } + + // If vk_icdGetInstanceProcAddr is NULL, this ICD is using version 0 and so we should respond accordingly. + if (NULL == fp_get_proc_addr) { + // Exporting vk_icdNegotiateLoaderICDInterfaceVersion but not vk_icdGetInstanceProcAddr violates Version 2's + // requirements, as for Version 2 to be supported Version 1 must also be supported + if (interface_vers != 0) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_scanned_icd_add: ICD %s reports an interface version of %d but doesn't export " + "vk_icdGetInstanceProcAddr, skip this ICD.", + filename, interface_vers); + goto out; + } + // Use deprecated interface from version 0 + fp_get_proc_addr = loader_platform_get_proc_address(handle, "vkGetInstanceProcAddr"); + if (NULL == fp_get_proc_addr) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_scanned_icd_add: Attempt to retrieve either \'vkGetInstanceProcAddr\' or " + "\'vk_icdGetInstanceProcAddr\' from ICD %s failed.", + filename); + goto out; + } else { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "loader_scanned_icd_add: Using deprecated ICD interface of \'vkGetInstanceProcAddr\' instead of " + "\'vk_icdGetInstanceProcAddr\' for ICD %s", + filename); + } + fp_create_inst = loader_platform_get_proc_address(handle, "vkCreateInstance"); + if (NULL == fp_create_inst) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_scanned_icd_add: Failed querying \'vkCreateInstance\' via dlsym/LoadLibrary for ICD %s", filename); + goto out; } fp_get_inst_ext_props = loader_platform_get_proc_address(handle, "vkEnumerateInstanceExtensionProperties"); if (NULL == fp_get_inst_ext_props) { - loader_log( - inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_scanned_icd_add: Could not get \'vkEnumerateInstanceExtensionProperties\' via dlsym/loadlibrary for ICD %s", - filename); + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_scanned_icd_add: Could not get \'vkEnumerateInstanceExtensionProperties\' via dlsym/LoadLibrary " + "for ICD %s", + filename); goto out; } } else { - // Use newer interface version 1 or later + // vk_icdGetInstanceProcAddr was successfully found, we can assume the version is at least one + // If vk_icdNegotiateLoaderICDInterfaceVersion was also found, interface_vers must be 2 or greater, so this check is + // fine if (interface_vers == 0) { interface_vers = 1; } @@ -1426,9 +1751,23 @@ static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struc filename); goto out; } - fp_get_phys_dev_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetPhysicalDeviceProcAddr"); + // Query "vk_icdGetPhysicalDeviceProcAddr" with vk_icdGetInstanceProcAddr if the library reports interface version 7 or + // greater, otherwise fallback to loading it from the platform dynamic linker + if (interface_vers >= 7) { + fp_get_phys_dev_proc_addr = + (PFN_vk_icdGetPhysicalDeviceProcAddr)fp_get_proc_addr(NULL, "vk_icdGetPhysicalDeviceProcAddr"); + } + if (NULL == fp_get_phys_dev_proc_addr && interface_vers >= 3) { + fp_get_phys_dev_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetPhysicalDeviceProcAddr"); + } #if defined(VK_USE_PLATFORM_WIN32_KHR) - if (interface_vers >= 6) { + // Query "vk_icdEnumerateAdapterPhysicalDevices" with vk_icdGetInstanceProcAddr if the library reports interface version + // 7 or greater, otherwise fallback to loading it from the platform dynamic linker + if (interface_vers >= 7) { + fp_enum_dxgi_adapter_phys_devs = + (PFN_vk_icdEnumerateAdapterPhysicalDevices)fp_get_proc_addr(NULL, "vk_icdEnumerateAdapterPhysicalDevices"); + } + if (NULL == fp_enum_dxgi_adapter_phys_devs && interface_vers >= 6) { fp_enum_dxgi_adapter_phys_devs = loader_platform_get_proc_address(handle, "vk_icdEnumerateAdapterPhysicalDevices"); } #endif @@ -1470,13 +1809,11 @@ static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struc #endif new_scanned_icd->interface_version = interface_vers; - new_scanned_icd->lib_name = (char *)loader_instance_heap_alloc(inst, strlen(filename) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (NULL == new_scanned_icd->lib_name) { + res = loader_copy_to_new_str(inst, filename, &new_scanned_icd->lib_name); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_scanned_icd_add: Out of memory can't add ICD %s", filename); - res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - strcpy(new_scanned_icd->lib_name, filename); icd_tramp_list->count++; out: @@ -1487,12 +1824,12 @@ out: void loader_initialize(void) { // initialize mutexes loader_platform_thread_create_mutex(&loader_lock); - loader_platform_thread_create_mutex(&loader_json_lock); loader_platform_thread_create_mutex(&loader_preload_icd_lock); loader_platform_thread_create_mutex(&loader_global_instance_list_lock); + init_global_loader_settings(); // initialize logging - loader_debug_init(); + loader_init_global_debug_level(); #if defined(_WIN32) windows_initialization(); #endif @@ -1503,6 +1840,19 @@ void loader_initialize(void) { #if defined(GIT_BRANCH_NAME) && defined(GIT_TAG_INFO) loader_log(NULL, VULKAN_LOADER_INFO_BIT, 0, "[Vulkan Loader Git - Tag: " GIT_BRANCH_NAME ", Branch/Commit: " GIT_TAG_INFO "]"); #endif + + char *loader_disable_dynamic_library_unloading_env_var = loader_getenv("VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING", NULL); + if (loader_disable_dynamic_library_unloading_env_var && + 0 == strncmp(loader_disable_dynamic_library_unloading_env_var, "1", 2)) { + loader_disable_dynamic_library_unloading = true; + loader_log(NULL, VULKAN_LOADER_WARN_BIT, 0, "Vulkan Loader: library unloading is disabled"); + } else { + loader_disable_dynamic_library_unloading = false; + } + loader_free_getenv(loader_disable_dynamic_library_unloading_env_var, NULL); +#if defined(LOADER_USE_UNSAFE_FILE_SEARCH) + loader_log(NULL, VULKAN_LOADER_WARN_BIT, 0, "Vulkan Loader: unsafe searching is enabled"); +#endif } void loader_release() { @@ -1510,8 +1860,8 @@ void loader_release() { loader_unload_preloaded_icds(); // release mutexes + teardown_global_loader_settings(); loader_platform_thread_delete_mutex(&loader_lock); - loader_platform_thread_delete_mutex(&loader_json_lock); loader_platform_thread_delete_mutex(&loader_preload_icd_lock); loader_platform_thread_delete_mutex(&loader_global_instance_list_lock); } @@ -1526,8 +1876,7 @@ void loader_preload_icds(void) { return; } - memset(&scanned_icds, 0, sizeof(scanned_icds)); - VkResult result = loader_icd_scan(NULL, &scanned_icds, NULL); + VkResult result = loader_icd_scan(NULL, &scanned_icds, NULL, NULL); if (result != VK_SUCCESS) { loader_scanned_icd_clear(NULL, &scanned_icds); } @@ -1542,9 +1891,9 @@ void loader_unload_preloaded_icds(void) { } #if !defined(_WIN32) -__attribute__((constructor)) void loader_init_library() { loader_initialize(); } +__attribute__((constructor)) void loader_init_library(void) { loader_initialize(); } -__attribute__((destructor)) void loader_free_library() { loader_release(); } +__attribute__((destructor)) void loader_free_library(void) { loader_release(); } #endif // Get next file or dirname given a string list or registry key path @@ -1570,37 +1919,90 @@ char *loader_get_next_path(char *path) { return next; } -// Given a path which is absolute or relative, expand the path if relative or -// leave the path unmodified if absolute. The base path to prepend to relative -// paths is given in rel_base. -// -// @return - A string in out_fullpath of the full absolute path -static void loader_expand_path(const char *path, const char *rel_base, size_t out_size, char *out_fullpath) { - if (loader_platform_is_path_absolute(path)) { - // do not prepend a base to an absolute path - rel_base = ""; +/* Processes a json manifest's library_path and the location of the json manifest to create the path of the library + * The output is stored in out_fullpath by allocating a string - so its the caller's responsibility to free it + * The output is the combination of the base path of manifest_file_path concatenated with library path + * If library_path is an absolute path, we do not prepend the base path of manifest_file_path + * + * This function takes ownership of library_path - caller does not need to worry about freeing it. + */ +VkResult combine_manifest_directory_and_library_path(const struct loader_instance *inst, char *library_path, + const char *manifest_file_path, char **out_fullpath) { + assert(library_path && manifest_file_path && out_fullpath); + if (loader_platform_is_path_absolute(library_path)) { + *out_fullpath = library_path; + return VK_SUCCESS; } + VkResult res = VK_SUCCESS; - loader_platform_combine_path(out_fullpath, out_size, rel_base, path, NULL); + size_t library_path_len = strlen(library_path); + size_t manifest_file_path_str_len = strlen(manifest_file_path); + bool library_path_contains_directory_symbol = false; + for (size_t i = 0; i < library_path_len; i++) { + if (library_path[i] == DIRECTORY_SYMBOL) { + library_path_contains_directory_symbol = true; + break; + } + } + // Means that the library_path is neither absolute nor relative - thus we should not modify it at all + if (!library_path_contains_directory_symbol) { + *out_fullpath = library_path; + return VK_SUCCESS; + } + // must include both a directory symbol and the null terminator + size_t new_str_len = library_path_len + manifest_file_path_str_len + 1 + 1; + + *out_fullpath = loader_instance_heap_calloc(inst, new_str_len, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == *out_fullpath) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + size_t cur_loc_in_out_fullpath = 0; + // look for the last occurrence of DIRECTORY_SYMBOL in manifest_file_path + size_t last_directory_symbol = 0; + bool found_directory_symbol = false; + for (size_t i = 0; i < manifest_file_path_str_len; i++) { + if (manifest_file_path[i] == DIRECTORY_SYMBOL) { + last_directory_symbol = i + 1; // we want to include the symbol + found_directory_symbol = true; + // dont break because we want to find the last occurrence + } + } + // Add manifest_file_path up to the last directory symbol + if (found_directory_symbol) { + loader_strncpy(*out_fullpath, new_str_len, manifest_file_path, last_directory_symbol); + cur_loc_in_out_fullpath += last_directory_symbol; + } + loader_strncpy(&(*out_fullpath)[cur_loc_in_out_fullpath], new_str_len - cur_loc_in_out_fullpath, library_path, + library_path_len); + cur_loc_in_out_fullpath += library_path_len + 1; + (*out_fullpath)[cur_loc_in_out_fullpath] = '\0'; + +out: + loader_instance_heap_free(inst, library_path); + + return res; } -// Given a filename (file) and a list of paths (dir), try to find an existing +// Given a filename (file) and a list of paths (in_dirs), try to find an existing // file in the paths. If filename already is a path then no searching in the given paths. // // @return - A string in out_fullpath of either the full path or file. -static void loader_get_fullpath(const char *file, const char *in_dirs, size_t out_size, char *out_fullpath) { +void loader_get_fullpath(const char *file, const char *in_dirs, size_t out_size, char *out_fullpath) { if (!loader_platform_is_path(file) && *in_dirs) { - char *dirs_copy, *dir, *next_dir; - - dirs_copy = loader_stack_alloc(strlen(in_dirs) + 1); - strcpy(dirs_copy, in_dirs); + size_t dirs_copy_len = strlen(in_dirs) + 1; + char *dirs_copy = loader_stack_alloc(dirs_copy_len); + loader_strncpy(dirs_copy, dirs_copy_len, in_dirs, dirs_copy_len); // find if file exists after prepending paths in given list // for (dir = dirs_copy; *dir && (next_dir = loader_get_next_path(dir)); dir = next_dir) { - dir = dirs_copy; - next_dir = loader_get_next_path(dir); + char *dir = dirs_copy; + char *next_dir = loader_get_next_path(dir); while (*dir && next_dir) { - loader_platform_combine_path(out_fullpath, out_size, dir, file, NULL); + int path_concat_ret = snprintf(out_fullpath, out_size, "%s%c%s", dir, DIRECTORY_SYMBOL, file); + if (path_concat_ret < 0) { + continue; + } if (loader_platform_file_exists(out_fullpath)) { return; } @@ -1612,99 +2014,21 @@ static void loader_get_fullpath(const char *file, const char *in_dirs, size_t ou (void)snprintf(out_fullpath, out_size, "%s", file); } -// Read a JSON file into a buffer. -// -// @return - A pointer to a cJSON object representing the JSON parse tree. -// This returned buffer should be freed by caller. -static VkResult loader_get_json(const struct loader_instance *inst, const char *filename, cJSON **json) { - FILE *file = NULL; - char *json_buf = NULL; - size_t len; - VkResult res = VK_SUCCESS; - - assert(json != NULL); - - *json = NULL; - -#if defined(_WIN32) - int filename_utf16_size = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0); - if (filename_utf16_size > 0) { - wchar_t *filename_utf16 = (wchar_t *)loader_stack_alloc(filename_utf16_size * sizeof(wchar_t)); - if (MultiByteToWideChar(CP_UTF8, 0, filename, -1, filename_utf16, filename_utf16_size) == filename_utf16_size) { - file = _wfopen(filename_utf16, L"rb"); - } - } -#else - file = fopen(filename, "rb"); -#endif - - if (!file) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_json: Failed to open JSON file %s", filename); - res = VK_ERROR_INITIALIZATION_FAILED; - goto out; - } - // NOTE: We can't just use fseek(file, 0, SEEK_END) because that isn't guaranteed to be supported on all systems - size_t fread_ret_count = 0; - do { - char buffer[256]; - fread_ret_count = fread(buffer, 1, 256, file); - } while (fread_ret_count == 256 && !feof(file)); - len = ftell(file); - fseek(file, 0, SEEK_SET); - json_buf = (char *)loader_instance_heap_alloc(inst, len + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (json_buf == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_get_json: Failed to allocate space for JSON file %s buffer of length %d", filename, len); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - if (fread(json_buf, sizeof(char), len, file) != len) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_get_json: Failed to read JSON file %s.", filename); - res = VK_ERROR_INITIALIZATION_FAILED; - goto out; - } - json_buf[len] = '\0'; - - // Can't be a valid json if the string is of length zero - if (len == 0) { - res = VK_ERROR_INITIALIZATION_FAILED; - goto out; - } - // Parse text from file - *json = cJSON_Parse(inst ? &inst->alloc_callbacks : NULL, json_buf); - if (*json == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_get_json: Failed to parse JSON file %s, this is usually because something ran out of memory.", filename); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - -out: - loader_instance_heap_free(inst, json_buf); - if (NULL != file) { - fclose(file); - } - - return res; -} - // Verify that all component layers in a meta-layer are valid. -static bool verify_meta_layer_component_layers(const struct loader_instance *inst, struct loader_layer_properties *prop, - struct loader_layer_list *instance_layers) { - bool success = true; +bool verify_meta_layer_component_layers(const struct loader_instance *inst, struct loader_layer_properties *prop, + struct loader_layer_list *instance_layers) { loader_api_version meta_layer_version = loader_make_version(prop->info.specVersion); - for (uint32_t comp_layer = 0; comp_layer < prop->num_component_layers; comp_layer++) { + for (uint32_t comp_layer = 0; comp_layer < prop->component_layer_names.count; comp_layer++) { struct loader_layer_properties *comp_prop = - loader_find_layer_property(prop->component_layer_names[comp_layer], instance_layers); + loader_find_layer_property(prop->component_layer_names.list[comp_layer], instance_layers); if (comp_prop == NULL) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "verify_meta_layer_component_layers: Meta-layer %s can't find component layer %s at index %d." " Skipping this layer.", - prop->info.layerName, prop->component_layer_names[comp_layer], comp_layer); + prop->info.layerName, prop->component_layer_names.list[comp_layer], comp_layer); - success = false; - break; + return false; } // Check the version of each layer, they need to be at least MAJOR and MINOR @@ -1716,19 +2040,17 @@ static bool verify_meta_layer_component_layers(const struct loader_instance *ins meta_layer_version.major, meta_layer_version.minor, comp_layer, comp_prop_version.major, comp_prop_version.minor); - success = false; - break; + return false; } // Make sure the layer isn't using it's own name - if (!strcmp(prop->info.layerName, prop->component_layer_names[comp_layer])) { + if (!strcmp(prop->info.layerName, prop->component_layer_names.list[comp_layer])) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "verify_meta_layer_component_layers: Meta-layer %s lists itself in its component layer " "list at index %d. Skipping this layer.", prop->info.layerName, comp_layer); - success = false; - break; + return false; } if (comp_prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) { loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, @@ -1740,86 +2062,109 @@ static bool verify_meta_layer_component_layers(const struct loader_instance *ins loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Meta-layer %s component layer %s can not find all component layers." " Skipping this layer.", - prop->info.layerName, prop->component_layer_names[comp_layer]); - success = false; - break; - } - } - - // Add any instance and device extensions from component layers to this layer - // list, so that anyone querying extensions will only need to look at the meta-layer - for (uint32_t ext = 0; ext < comp_prop->instance_extension_list.count; ext++) { - loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Meta-layer %s component layer %s adding instance extension %s", - prop->info.layerName, prop->component_layer_names[comp_layer], - comp_prop->instance_extension_list.list[ext].extensionName); - - if (!has_vk_extension_property(&comp_prop->instance_extension_list.list[ext], &prop->instance_extension_list)) { - loader_add_to_ext_list(inst, &prop->instance_extension_list, 1, &comp_prop->instance_extension_list.list[ext]); + prop->info.layerName, prop->component_layer_names.list[comp_layer]); + return false; } } + } + // Didn't exit early so that means it passed all checks + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Meta-layer \"%s\" all %d component layers appear to be valid.", prop->info.layerName, + prop->component_layer_names.count); - for (uint32_t ext = 0; ext < comp_prop->device_extension_list.count; ext++) { - loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Meta-layer %s component layer %s adding device extension %s", - prop->info.layerName, prop->component_layer_names[comp_layer], - comp_prop->device_extension_list.list[ext].props.extensionName); + // If layer logging is on, list the internals included in the meta-layer + for (uint32_t comp_layer = 0; comp_layer < prop->component_layer_names.count; comp_layer++) { + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " [%d] %s", comp_layer, prop->component_layer_names.list[comp_layer]); + } + return true; +} - if (!has_vk_dev_ext_property(&comp_prop->device_extension_list.list[ext].props, &prop->device_extension_list)) { - loader_add_to_dev_ext_list(inst, &prop->device_extension_list, &comp_prop->device_extension_list.list[ext].props, 0, - NULL); +// Add any instance and device extensions from component layers to this layer +// list, so that anyone querying extensions will only need to look at the meta-layer +bool update_meta_layer_extensions_from_component_layers(const struct loader_instance *inst, struct loader_layer_properties *prop, + struct loader_layer_list *instance_layers) { + VkResult res = VK_SUCCESS; + for (uint32_t comp_layer = 0; comp_layer < prop->component_layer_names.count; comp_layer++) { + struct loader_layer_properties *comp_prop = + loader_find_layer_property(prop->component_layer_names.list[comp_layer], instance_layers); + + if (NULL != comp_prop->instance_extension_list.list) { + for (uint32_t ext = 0; ext < comp_prop->instance_extension_list.count; ext++) { + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Meta-layer %s component layer %s adding instance extension %s", + prop->info.layerName, prop->component_layer_names.list[comp_layer], + comp_prop->instance_extension_list.list[ext].extensionName); + + if (!has_vk_extension_property(&comp_prop->instance_extension_list.list[ext], &prop->instance_extension_list)) { + res = loader_add_to_ext_list(inst, &prop->instance_extension_list, 1, + &comp_prop->instance_extension_list.list[ext]); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + return res; + } + } } } - } - if (success) { - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "Meta-layer %s all %d component layers appear to be valid.", prop->info.layerName, prop->num_component_layers); + if (NULL != comp_prop->device_extension_list.list) { + for (uint32_t ext = 0; ext < comp_prop->device_extension_list.count; ext++) { + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Meta-layer %s component layer %s adding device extension %s", + prop->info.layerName, prop->component_layer_names.list[comp_layer], + comp_prop->device_extension_list.list[ext].props.extensionName); - // If layer logging is on, list the internals included in the meta-layer - if ((loader_get_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) { - for (uint32_t comp_layer = 0; comp_layer < prop->num_component_layers; comp_layer++) { - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " [%d] %s", comp_layer, prop->component_layer_names[comp_layer]); + if (!has_vk_dev_ext_property(&comp_prop->device_extension_list.list[ext].props, &prop->device_extension_list)) { + loader_add_to_dev_ext_list(inst, &prop->device_extension_list, + &comp_prop->device_extension_list.list[ext].props, NULL); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + return res; + } + } } } } - return success; + return res; } // Verify that all meta-layers in a layer list are valid. -static void verify_all_meta_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers, - bool *override_layer_present) { +VkResult verify_all_meta_layers(struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + struct loader_layer_list *instance_layers, bool *override_layer_present) { + VkResult res = VK_SUCCESS; *override_layer_present = false; for (int32_t i = 0; i < (int32_t)instance_layers->count; i++) { struct loader_layer_properties *prop = &instance_layers->list[i]; // If this is a meta-layer, make sure it is valid - if ((prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) && - !verify_meta_layer_component_layers(inst, prop, instance_layers)) { - loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, - "Removing meta-layer %s from instance layer list since it appears invalid.", prop->info.layerName); - - loader_remove_layer_in_list(inst, instance_layers, i); - i--; + if (prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) { + if (verify_meta_layer_component_layers(inst, prop, instance_layers)) { + // If any meta layer is valid, update its extension list to include the extensions from its component layers. + res = update_meta_layer_extensions_from_component_layers(inst, prop, instance_layers); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + return res; + } + if (prop->is_override && loader_implicit_layer_is_enabled(inst, filters, prop)) { + *override_layer_present = true; + } + } else { + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, + "Removing meta-layer %s from instance layer list since it appears invalid.", prop->info.layerName); - } else if (prop->is_override && loader_implicit_layer_is_enabled(inst, prop)) { - *override_layer_present = true; + loader_remove_layer_in_list(inst, instance_layers, i); + i--; + } } } + return res; } // If the current working directory matches any app_key_path of the layers, remove all other override layers. // Otherwise if no matching app_key was found, remove all but the global override layer, which has no app_key_path. -static void remove_all_non_valid_override_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers) { +void remove_all_non_valid_override_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers) { if (instance_layers == NULL) { return; } - char cur_path[MAX_STRING_SIZE]; - char *ret = loader_platform_executable_path(cur_path, sizeof(cur_path)); - if (ret == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "remove_all_non_valid_override_layers: Failed to get executable path and name"); + char cur_path[1024]; + char *ret = loader_platform_executable_path(cur_path, 1024); + if (NULL == ret) { return; } - // Find out if there is an override layer with same the app_key_path as the path to the current executable. // If more than one is found, remove it and use the first layer // Remove any layers which aren't global and do not have the same app_key_path as the path to the current executable. @@ -1828,16 +2173,16 @@ static void remove_all_non_valid_override_layers(struct loader_instance *inst, s for (uint32_t i = 0; i < instance_layers->count; i++) { struct loader_layer_properties *props = &instance_layers->list[i]; if (strcmp(props->info.layerName, VK_OVERRIDE_LAYER_NAME) == 0) { - if (props->num_app_key_paths > 0) { // not the global layer - for (uint32_t j = 0; j < props->num_app_key_paths; j++) { - if (strcmp(props->app_key_paths[j], cur_path) == 0) { + if (props->app_key_paths.count > 0) { // not the global layer + for (uint32_t j = 0; j < props->app_key_paths.count; j++) { + if (strcmp(props->app_key_paths.list[j], cur_path) == 0) { if (!found_active_override_layer) { found_active_override_layer = true; } else { - loader_log( - inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "remove_all_non_valid_override_layers: Multiple override layers where the same path in app_keys " - "was found. Using the first layer found"); + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "remove_all_non_valid_override_layers: Multiple override layers where the same path in " + "app_keys " + "was found. Using the first layer found"); // Remove duplicate active override layers that have the same app_key_path loader_remove_layer_in_list(inst, instance_layers, i); @@ -1879,439 +2224,263 @@ static void remove_all_non_valid_override_layers(struct loader_instance *inst, s } } -static VkResult loader_read_layer_json(const struct loader_instance *inst, struct loader_layer_list *layer_instance_list, - cJSON *layer_node, loader_api_version version, cJSON *item, bool is_implicit, - char *filename) { - char *temp; - char *name, *type, *library_path_str, *api_version; - char *implementation_version, *description; - cJSON *ext_item; - cJSON *library_path; - cJSON *component_layers; - cJSON *override_paths; - cJSON *blacklisted_layers; - cJSON *disable_environment = NULL; - VkExtensionProperties ext_prop; - VkResult result = VK_ERROR_INITIALIZATION_FAILED; - struct loader_layer_properties *props = NULL; - uint32_t props_index = 0; - int i, j; +/* The following are required in the "layer" object: + * "name" + * "type" + * (for non-meta layers) "library_path" + * (for meta layers) "component_layers" + * "api_version" + * "implementation_version" + * "description" + * (for implicit layers) "disable_environment" + */ + +VkResult loader_read_layer_json(const struct loader_instance *inst, struct loader_layer_list *layer_instance_list, + cJSON *layer_node, loader_api_version version, bool is_implicit, char *filename) { + assert(layer_instance_list); + char *type = NULL; + char *api_version = NULL; + char *implementation_version = NULL; + VkResult result = VK_SUCCESS; + struct loader_layer_properties props = {0}; -// The following are required in the "layer" object: -// (required) "name" -// (required) "type" -// (required) "library_path" -// (required) "api_version" -// (required) "implementation_version" -// (required) "description" -// (required for implicit layers) "disable_environment" -#define GET_JSON_OBJECT(node, var) \ - { \ - var = cJSON_GetObjectItem(node, #var); \ - if (var == NULL) { \ - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, \ - "Didn't find required layer object %s in manifest " \ - "JSON file, skipping this layer", \ - #var); \ - goto out; \ - } \ - } -#define GET_JSON_ITEM(inst, node, var) \ - { \ - item = cJSON_GetObjectItem(node, #var); \ - if (item == NULL) { \ - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, \ - "Didn't find required layer value %s in manifest JSON " \ - "file, skipping this layer", \ - #var); \ - goto out; \ - } \ - temp = cJSON_Print(item); \ - if (temp == NULL) { \ - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, \ - "Problem accessing layer value %s in manifest JSON " \ - "file, skipping this layer", \ - #var); \ - result = VK_ERROR_OUT_OF_HOST_MEMORY; \ - goto out; \ - } \ - temp[strlen(temp) - 1] = '\0'; \ - var = loader_stack_alloc(strlen(temp) + 1); \ - strcpy(var, &temp[1]); \ - loader_instance_heap_free(inst, temp); \ - } - GET_JSON_ITEM(inst, layer_node, name) - GET_JSON_ITEM(inst, layer_node, type) - GET_JSON_ITEM(inst, layer_node, api_version) - GET_JSON_ITEM(inst, layer_node, implementation_version) - GET_JSON_ITEM(inst, layer_node, description) + // Parse name + + result = loader_parse_json_string_to_existing_str(inst, layer_node, "name", VK_MAX_EXTENSION_NAME_SIZE, props.info.layerName); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) goto out; + if (VK_ERROR_INITIALIZATION_FAILED == result) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "Layer located at %s didn't find required layer value \"name\" in manifest JSON file, skipping this layer", + filename); + goto out; + } + + // Check if this layer's name matches the override layer name, set is_override to true if so. + if (!strcmp(props.info.layerName, VK_OVERRIDE_LAYER_NAME)) { + props.is_override = true; + } + + if (0 != strncmp(props.info.layerName, "VK_LAYER_", 9)) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Layer name %s does not conform to naming standard (Policy #LLP_LAYER_3)", + props.info.layerName); + } + + // Parse type + + result = loader_parse_json_string(layer_node, "type", &type); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) goto out; + if (VK_ERROR_INITIALIZATION_FAILED == result) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "Layer located at %s didn't find required layer value \"type\" in manifest JSON file, skipping this layer", + filename); + goto out; + } // Add list entry if (!strcmp(type, "DEVICE")) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Device layers are deprecated. Skipping this layer"); + result = VK_ERROR_INITIALIZATION_FAILED; goto out; } - // Allow either GLOBAL or INSTANCE type interchangeably to handle - // layers that must work with older loaders + // Allow either GLOBAL or INSTANCE type interchangeably to handle layers that must work with older loaders if (!strcmp(type, "INSTANCE") || !strcmp(type, "GLOBAL")) { - if (layer_instance_list == NULL) { - goto out; - } - props = loader_get_next_layer_property_slot(inst, layer_instance_list); - if (NULL == props) { - // Error already triggered in loader_get_next_layer_property_slot. - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - props_index = layer_instance_list->count - 1; - props->type_flags = VK_LAYER_TYPE_FLAG_INSTANCE_LAYER; + props.type_flags = VK_LAYER_TYPE_FLAG_INSTANCE_LAYER; if (!is_implicit) { - props->type_flags |= VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER; + props.type_flags |= VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER; } } else { + result = VK_ERROR_INITIALIZATION_FAILED; goto out; } - // Expiration date for override layer. Field starte with JSON file 1.1.2 and - // is completely optional. So, no check put in place. - if (!strcmp(name, VK_OVERRIDE_LAYER_NAME)) { - cJSON *expiration; - if (!loader_check_version_meets_required(loader_combine_version(1, 1, 2), version)) { - loader_log( - inst, VULKAN_LOADER_WARN_BIT, 0, - "Override layer expiration date not added until version 1.1.2. Please update JSON file version appropriately."); - } + // Parse api_version - props->is_override = true; - expiration = cJSON_GetObjectItem(layer_node, "expiration_date"); - if (NULL != expiration) { - char date_copy[32]; - uint8_t cur_item = 0; + result = loader_parse_json_string(layer_node, "api_version", &api_version); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) goto out; + if (VK_ERROR_INITIALIZATION_FAILED == result) { + loader_log( + inst, VULKAN_LOADER_WARN_BIT, 0, + "Layer located at %s didn't find required layer value \"api_version\" in manifest JSON file, skipping this layer", + filename); + goto out; + } - // Get the string for the current item - temp = cJSON_Print(expiration); - if (temp == NULL) { - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, - "Problem accessing layer value 'expiration_date' in manifest JSON file, skipping this layer"); - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - temp[strlen(temp) - 1] = '\0'; - strcpy(date_copy, &temp[1]); - loader_instance_heap_free(inst, temp); - - if (strlen(date_copy) == 16) { - char *cur_start = &date_copy[0]; - char *next_dash = strchr(date_copy, '-'); - if (NULL != next_dash) { - while (cur_item < 5 && strlen(cur_start)) { - if (next_dash != NULL) { - *next_dash = '\0'; - } - switch (cur_item) { - case 0: // Year - props->expiration.year = (uint16_t)atoi(cur_start); - break; - case 1: // Month - props->expiration.month = (uint8_t)atoi(cur_start); - break; - case 2: // Day - props->expiration.day = (uint8_t)atoi(cur_start); - break; - case 3: // Hour - props->expiration.hour = (uint8_t)atoi(cur_start); - break; - case 4: // Minute - props->expiration.minute = (uint8_t)atoi(cur_start); - props->has_expiration = true; - break; - default: // Ignore - break; - } - if (next_dash != NULL) { - cur_start = next_dash + 1; - next_dash = strchr(cur_start, '-'); - } - cur_item++; - } - } - } - } + props.info.specVersion = loader_parse_version_string(api_version); + + // Make sure the layer's manifest doesn't contain a non zero variant value + if (VK_API_VERSION_VARIANT(props.info.specVersion) != 0) { + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Layer \"%s\" has an \'api_version\' field which contains a non-zero variant value of %d. " + " Skipping Layer.", + props.info.layerName, VK_API_VERSION_VARIANT(props.info.specVersion)); + result = VK_ERROR_INITIALIZATION_FAILED; + goto out; } + // Parse implementation_version + + result = loader_parse_json_string(layer_node, "implementation_version", &implementation_version); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) goto out; + if (VK_ERROR_INITIALIZATION_FAILED == result) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "Layer located at %s didn't find required layer value \"implementation_version\" in manifest JSON file, " + "skipping this layer", + filename); + goto out; + } + props.info.implementationVersion = atoi(implementation_version); + + // Parse description + + result = loader_parse_json_string_to_existing_str(inst, layer_node, "description", VK_MAX_EXTENSION_NAME_SIZE, + props.info.description); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) goto out; + if (VK_ERROR_INITIALIZATION_FAILED == result) { + loader_log( + inst, VULKAN_LOADER_WARN_BIT, 0, + "Layer located at %s didn't find required layer value \"description\" in manifest JSON file, skipping this layer", + filename); + goto out; + } + + // Parse library_path + // Library path no longer required unless component_layers is also not defined - library_path = cJSON_GetObjectItem(layer_node, "library_path"); - component_layers = cJSON_GetObjectItem(layer_node, "component_layers"); + cJSON *library_path = loader_cJSON_GetObjectItem(layer_node, "library_path"); + if (NULL != library_path) { - if (NULL != component_layers) { + if (NULL != loader_cJSON_GetObjectItem(layer_node, "component_layers")) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Indicating meta-layer-specific component_layers, but also defining layer library path. Both are not " "compatible, so skipping this layer"); + result = VK_ERROR_INITIALIZATION_FAILED; goto out; } - props->num_component_layers = 0; - props->component_layer_names = NULL; - temp = cJSON_Print(library_path); - if (NULL == temp) { + result = loader_copy_to_new_str(inst, filename, &props.manifest_file_name); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + + char *library_path_str = loader_cJSON_Print(library_path); + if (NULL == library_path_str) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, - "Problem accessing layer value library_path in manifest JSON file, skipping this layer"); + "Skipping layer due to problem accessing the library_path value in manifest JSON file %s", filename); result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - temp[strlen(temp) - 1] = '\0'; - library_path_str = loader_stack_alloc(strlen(temp) + 1); - strcpy(library_path_str, &temp[1]); - loader_instance_heap_free(inst, temp); - - strncpy(props->manifest_file_name, filename, MAX_STRING_SIZE); - char *fullpath = props->lib_name; - char *rel_base; - if (NULL != library_path_str) { - if (loader_platform_is_path(library_path_str)) { - // A relative or absolute path - char *name_copy = loader_stack_alloc(strlen(filename) + 1); - strcpy(name_copy, filename); - rel_base = loader_platform_dirname(name_copy); - loader_expand_path(library_path_str, rel_base, MAX_STRING_SIZE, fullpath); - } else { - // A filename which is assumed in a system directory - loader_get_fullpath(library_path_str, "", MAX_STRING_SIZE, fullpath); - } - } - } else if (NULL != component_layers) { + + // This function takes ownership of library_path_str - so we don't need to clean it up + result = combine_manifest_directory_and_library_path(inst, library_path_str, filename, &props.lib_name); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + } + + // Parse component_layers + + if (NULL == library_path) { 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."); } - int count = cJSON_GetArraySize(component_layers); - props->num_component_layers = count; - // Allocate buffer for layer names - props->component_layer_names = - loader_instance_heap_alloc(inst, sizeof(char[MAX_STRING_SIZE]) * count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (NULL == props->component_layer_names && count > 0) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; + result = loader_parse_json_array_of_strings(inst, layer_node, "component_layers", &(props.component_layer_names)); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) { goto out; } - - // Copy the component layers into the array - for (i = 0; i < count; i++) { - cJSON *comp_layer = cJSON_GetArrayItem(component_layers, i); - if (NULL != comp_layer) { - temp = cJSON_Print(comp_layer); - if (NULL == temp) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - temp[strlen(temp) - 1] = '\0'; - strncpy(props->component_layer_names[i], temp + 1, MAX_STRING_SIZE - 1); - props->component_layer_names[i][MAX_STRING_SIZE - 1] = '\0'; - loader_instance_heap_free(inst, temp); - } + if (VK_ERROR_INITIALIZATION_FAILED == result) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "Layer missing both library_path and component_layers fields. One or the other MUST be defined. Skipping " + "this layer"); + goto out; } - // This is now, officially, a meta-layer - props->type_flags |= VK_LAYER_TYPE_FLAG_META_LAYER; - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Encountered meta-layer %s", name); - - // Make sure we set up other things so we head down the correct branches below - library_path_str = NULL; - } else { - loader_log( - inst, VULKAN_LOADER_WARN_BIT, 0, - "Layer missing both library_path and component_layers fields. One or the other MUST be defined. Skipping this layer"); - goto out; + props.type_flags |= VK_LAYER_TYPE_FLAG_META_LAYER; + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Encountered meta-layer \"%s\"", + props.info.layerName); } - props->num_blacklist_layers = 0; - props->blacklist_layer_names = NULL; - blacklisted_layers = cJSON_GetObjectItem(layer_node, "blacklisted_layers"); - if (blacklisted_layers != NULL) { - if (strcmp(name, VK_OVERRIDE_LAYER_NAME)) { - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, - "Layer %s contains a blacklist, but a blacklist can only be provided by the override metalayer. This " - "blacklist will be ignored.", - name); - } else { - props->num_blacklist_layers = cJSON_GetArraySize(blacklisted_layers); - if (props->num_blacklist_layers > 0) { - // Allocate the blacklist array - props->blacklist_layer_names = loader_instance_heap_alloc( - inst, sizeof(char[MAX_STRING_SIZE]) * props->num_blacklist_layers, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (props->blacklist_layer_names == NULL && props->num_blacklist_layers > 0) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } + // Parse blacklisted_layers - // Copy the blacklisted layers into the array - for (i = 0; i < (int)props->num_blacklist_layers; ++i) { - cJSON *black_layer = cJSON_GetArrayItem(blacklisted_layers, i); - if (black_layer == NULL) { - continue; - } - temp = cJSON_Print(black_layer); - if (temp == NULL) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - temp[strlen(temp) - 1] = '\0'; - strncpy(props->blacklist_layer_names[i], temp + 1, MAX_STRING_SIZE - 1); - props->blacklist_layer_names[i][MAX_STRING_SIZE - 1] = '\0'; - loader_instance_heap_free(inst, temp); - } - } + if (props.is_override) { + result = loader_parse_json_array_of_strings(inst, layer_node, "blacklisted_layers", &(props.blacklist_layer_names)); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) { + goto out; } } - override_paths = cJSON_GetObjectItem(layer_node, "override_paths"); - if (NULL != override_paths) { - if (!loader_check_version_meets_required(loader_combine_version(1, 1, 0), version)) { - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, - "Indicating meta-layer-specific override paths, but using older JSON file version."); - } - int count = cJSON_GetArraySize(override_paths); - props->num_override_paths = count; - if (count > 0) { - // Allocate buffer for override paths - props->override_paths = - loader_instance_heap_alloc(inst, sizeof(char[MAX_STRING_SIZE]) * count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (NULL == props->override_paths && count > 0) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } + // Parse override_paths - // Copy the override paths into the array - for (i = 0; i < count; i++) { - cJSON *override_path = cJSON_GetArrayItem(override_paths, i); - if (NULL != override_path) { - temp = cJSON_Print(override_path); - if (NULL == temp) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - temp[strlen(temp) - 1] = '\0'; - strncpy(props->override_paths[i], temp + 1, MAX_STRING_SIZE - 1); - props->override_paths[i][MAX_STRING_SIZE - 1] = '\0'; - loader_instance_heap_free(inst, temp); - } - } - } + result = loader_parse_json_array_of_strings(inst, layer_node, "override_paths", &(props.override_paths)); + if (VK_ERROR_OUT_OF_HOST_MEMORY == result) { + goto out; } - - if (is_implicit) { - GET_JSON_OBJECT(layer_node, disable_environment) + if (NULL != props.override_paths.list && !loader_check_version_meets_required(loader_combine_version(1, 1, 0), version)) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "Indicating meta-layer-specific override paths, but using older JSON file version."); } -#undef GET_JSON_ITEM -#undef GET_JSON_OBJECT - strncpy(props->info.layerName, name, sizeof(props->info.layerName)); - props->info.layerName[sizeof(props->info.layerName) - 1] = '\0'; - if (0 != strncmp(props->info.layerName, "VK_LAYER_", 9)) { - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Layer name %s does not conform to naming standard (Policy #LLP_LAYER_3)", - props->info.layerName); - } - props->info.specVersion = loader_parse_version_string(api_version); - props->info.implementationVersion = atoi(implementation_version); - strncpy((char *)props->info.description, description, sizeof(props->info.description)); - props->info.description[sizeof(props->info.description) - 1] = '\0'; + // Parse disable_environment + if (is_implicit) { - if (!disable_environment || !disable_environment->child) { + cJSON *disable_environment = loader_cJSON_GetObjectItem(layer_node, "disable_environment"); + if (disable_environment == NULL) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "Didn't find required layer object disable_environment in manifest JSON file, skipping this layer"); + result = VK_ERROR_INITIALIZATION_FAILED; + goto out; + } + + if (!disable_environment->child || disable_environment->child->type != cJSON_String) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Didn't find required layer child value disable_environment in manifest JSON file, skipping this layer " "(Policy #LLP_LAYER_9)"); + result = VK_ERROR_INITIALIZATION_FAILED; goto out; } - strncpy(props->disable_env_var.name, disable_environment->child->string, sizeof(props->disable_env_var.name)); - props->disable_env_var.name[sizeof(props->disable_env_var.name) - 1] = '\0'; - strncpy(props->disable_env_var.value, disable_environment->child->valuestring, sizeof(props->disable_env_var.value)); - props->disable_env_var.value[sizeof(props->disable_env_var.value) - 1] = '\0'; + result = loader_copy_to_new_str(inst, disable_environment->child->string, &(props.disable_env_var.name)); + if (VK_SUCCESS != result) goto out; + result = loader_copy_to_new_str(inst, disable_environment->child->valuestring, &(props.disable_env_var.value)); + if (VK_SUCCESS != result) goto out; } - // Make sure the layer's manifest doesn't contain a non zero variant value - if (VK_API_VERSION_VARIANT(props->info.specVersion) != 0) { - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "Layer %s has an \'api_version\' field which contains a non-zero variant value of %d. " - " Skipping Layer.", - props->info.layerName, VK_API_VERSION_VARIANT(props->info.specVersion)); - goto out; - } - -// Now get all optional items and objects and put in list: -// functions -// instance_extensions -// device_extensions -// enable_environment (implicit layers only) -// library_arch -#define GET_JSON_OBJECT(node, var) \ - { var = cJSON_GetObjectItem(node, #var); } -#define GET_JSON_ITEM(inst, node, var) \ - { \ - item = cJSON_GetObjectItem(node, #var); \ - if (item != NULL) { \ - temp = cJSON_Print(item); \ - if (temp != NULL) { \ - temp[strlen(temp) - 1] = '\0'; \ - var = loader_stack_alloc(strlen(temp) + 1); \ - strcpy(var, &temp[1]); \ - loader_instance_heap_free(inst, temp); \ - } else { \ - result = VK_ERROR_OUT_OF_HOST_MEMORY; \ - goto out; \ - } \ - } \ - } - - cJSON *instance_extensions, *device_extensions, *functions, *enable_environment; - cJSON *entrypoints = NULL; - char *vkGetInstanceProcAddr = NULL; - char *vkGetDeviceProcAddr = NULL; - char *vkNegotiateLoaderLayerInterfaceVersion = NULL; - char *spec_version = NULL; - char **entry_array = NULL; - char *library_arch = NULL; - cJSON *app_keys = NULL; + // Now get all optional items and objects and put in list: + // functions + // instance_extensions + // device_extensions + // enable_environment (implicit layers only) + // library_arch // Layer interface functions // vkGetInstanceProcAddr // vkGetDeviceProcAddr // vkNegotiateLoaderLayerInterfaceVersion (starting with JSON file 1.1.0) - GET_JSON_OBJECT(layer_node, functions) + cJSON *functions = loader_cJSON_GetObjectItem(layer_node, "functions"); if (functions != NULL) { if (loader_check_version_meets_required(loader_combine_version(1, 1, 0), version)) { - GET_JSON_ITEM(inst, functions, vkNegotiateLoaderLayerInterfaceVersion) - if (vkNegotiateLoaderLayerInterfaceVersion != NULL) - strncpy(props->functions.str_negotiate_interface, vkNegotiateLoaderLayerInterfaceVersion, - sizeof(props->functions.str_negotiate_interface)); - props->functions.str_negotiate_interface[sizeof(props->functions.str_negotiate_interface) - 1] = '\0'; - } else { - props->functions.str_negotiate_interface[0] = '\0'; + result = loader_parse_json_string(functions, "vkNegotiateLoaderLayerInterfaceVersion", + &props.functions.str_negotiate_interface); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; } - GET_JSON_ITEM(inst, functions, vkGetInstanceProcAddr) - GET_JSON_ITEM(inst, functions, vkGetDeviceProcAddr) - if (vkGetInstanceProcAddr != NULL) { - strncpy(props->functions.str_gipa, vkGetInstanceProcAddr, sizeof(props->functions.str_gipa)); - if (loader_check_version_meets_required(loader_combine_version(1, 1, 0), version)) { - loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, - "Layer \"%s\" using deprecated \'vkGetInstanceProcAddr\' tag which was deprecated starting with JSON " - "file version 1.1.0. The new vkNegotiateLoaderLayerInterfaceVersion function is preferred, though for " - "compatibility reasons it may be desirable to continue using the deprecated tag.", - name); - } + result = loader_parse_json_string(functions, "vkGetInstanceProcAddr", &props.functions.str_gipa); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + + if (props.functions.str_gipa && loader_check_version_meets_required(loader_combine_version(1, 1, 0), version)) { + loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, + "Layer \"%s\" using deprecated \'vkGetInstanceProcAddr\' tag which was deprecated starting with JSON " + "file version 1.1.0. The new vkNegotiateLoaderLayerInterfaceVersion function is preferred, though for " + "compatibility reasons it may be desirable to continue using the deprecated tag.", + props.info.layerName); } - props->functions.str_gipa[sizeof(props->functions.str_gipa) - 1] = '\0'; - if (vkGetDeviceProcAddr != NULL) { - strncpy(props->functions.str_gdpa, vkGetDeviceProcAddr, sizeof(props->functions.str_gdpa)); - if (loader_check_version_meets_required(loader_combine_version(1, 1, 0), version)) { - loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, - "Layer \"%s\" using deprecated \'vkGetDeviceProcAddr\' tag which was deprecated starting with JSON " - "file version 1.1.0. The new vkNegotiateLoaderLayerInterfaceVersion function is preferred, though for " - "compatibility reasons it may be desirable to continue using the deprecated tag.", - name); - } + + result = loader_parse_json_string(functions, "vkGetDeviceProcAddr", &props.functions.str_gdpa); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + + if (props.functions.str_gdpa && loader_check_version_meets_required(loader_combine_version(1, 1, 0), version)) { + loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, + "Layer \"%s\" using deprecated \'vkGetDeviceProcAddr\' tag which was deprecated starting with JSON " + "file version 1.1.0. The new vkNegotiateLoaderLayerInterfaceVersion function is preferred, though for " + "compatibility reasons it may be desirable to continue using the deprecated tag.", + props.info.layerName); } - props->functions.str_gdpa[sizeof(props->functions.str_gdpa) - 1] = '\0'; } // instance_extensions @@ -2319,25 +2488,27 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc // name // spec_version // } - GET_JSON_OBJECT(layer_node, instance_extensions) + + cJSON *instance_extensions = loader_cJSON_GetObjectItem(layer_node, "instance_extensions"); if (instance_extensions != NULL) { - int count = cJSON_GetArraySize(instance_extensions); - for (i = 0; i < count; i++) { - ext_item = cJSON_GetArrayItem(instance_extensions, i); - GET_JSON_ITEM(inst, ext_item, name) - if (name != NULL) { - strncpy(ext_prop.extensionName, name, sizeof(ext_prop.extensionName)); - ext_prop.extensionName[sizeof(ext_prop.extensionName) - 1] = '\0'; - } - GET_JSON_ITEM(inst, ext_item, spec_version) + int count = loader_cJSON_GetArraySize(instance_extensions); + for (int i = 0; i < count; i++) { + VkExtensionProperties ext_prop = {0}; + cJSON *ext_item = loader_cJSON_GetArrayItem(instance_extensions, i); + result = loader_parse_json_string_to_existing_str(inst, ext_item, "name", VK_MAX_EXTENSION_NAME_SIZE, + ext_prop.extensionName); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + if (result == VK_ERROR_INITIALIZATION_FAILED) continue; + char *spec_version = NULL; + result = loader_parse_json_string(ext_item, "spec_version", &spec_version); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; if (NULL != spec_version) { ext_prop.specVersion = atoi(spec_version); - } else { - ext_prop.specVersion = 0; } + loader_instance_heap_free(inst, spec_version); bool ext_unsupported = wsi_unsupported_instance_extension(&ext_prop); if (!ext_unsupported) { - loader_add_to_ext_list(inst, &props->instance_extension_list, 1, &ext_prop); + loader_add_to_ext_list(inst, &props.instance_extension_list, 1, &ext_prop); } } } @@ -2348,65 +2519,54 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc // spec_version // entrypoints // } - GET_JSON_OBJECT(layer_node, device_extensions) + cJSON *device_extensions = loader_cJSON_GetObjectItem(layer_node, "device_extensions"); if (device_extensions != NULL) { - int count = cJSON_GetArraySize(device_extensions); - for (i = 0; i < count; i++) { - ext_item = cJSON_GetArrayItem(device_extensions, i); - GET_JSON_ITEM(inst, ext_item, name) - GET_JSON_ITEM(inst, ext_item, spec_version) - if (name != NULL) { - strncpy(ext_prop.extensionName, name, sizeof(ext_prop.extensionName)); - ext_prop.extensionName[sizeof(ext_prop.extensionName) - 1] = '\0'; - } + int count = loader_cJSON_GetArraySize(device_extensions); + for (int i = 0; i < count; i++) { + VkExtensionProperties ext_prop = {0}; + + cJSON *ext_item = loader_cJSON_GetArrayItem(device_extensions, i); + + result = loader_parse_json_string_to_existing_str(inst, ext_item, "name", VK_MAX_EXTENSION_NAME_SIZE, + ext_prop.extensionName); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + + char *spec_version = NULL; + result = loader_parse_json_string(ext_item, "spec_version", &spec_version); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; if (NULL != spec_version) { ext_prop.specVersion = atoi(spec_version); - } else { - ext_prop.specVersion = 0; } - // entrypoints = cJSON_GetObjectItem(ext_item, "entrypoints"); - GET_JSON_OBJECT(ext_item, entrypoints) - int entry_count; + loader_instance_heap_free(inst, spec_version); + + cJSON *entrypoints = loader_cJSON_GetObjectItem(ext_item, "entrypoints"); if (entrypoints == NULL) { - loader_add_to_dev_ext_list(inst, &props->device_extension_list, &ext_prop, 0, NULL); + result = loader_add_to_dev_ext_list(inst, &props.device_extension_list, &ext_prop, NULL); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; continue; } - entry_count = cJSON_GetArraySize(entrypoints); - if (entry_count) { - entry_array = (char **)loader_stack_alloc(sizeof(char *) * entry_count); - } - for (j = 0; j < entry_count; j++) { - ext_item = cJSON_GetArrayItem(entrypoints, j); - if (ext_item != NULL) { - temp = cJSON_Print(ext_item); - if (NULL == temp) { - entry_array[j] = NULL; - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - temp[strlen(temp) - 1] = '\0'; - entry_array[j] = loader_stack_alloc(strlen(temp) + 1); - strcpy(entry_array[j], &temp[1]); - loader_instance_heap_free(inst, temp); - } - } - loader_add_to_dev_ext_list(inst, &props->device_extension_list, &ext_prop, entry_count, entry_array); + + struct loader_string_list entrys = {0}; + result = loader_parse_json_array_of_strings(inst, ext_item, "entrypoints", &entrys); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + result = loader_add_to_dev_ext_list(inst, &props.device_extension_list, &ext_prop, &entrys); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; } } if (is_implicit) { - GET_JSON_OBJECT(layer_node, enable_environment) + cJSON *enable_environment = loader_cJSON_GetObjectItem(layer_node, "enable_environment"); // enable_environment is optional - if (enable_environment) { - strncpy(props->enable_env_var.name, enable_environment->child->string, sizeof(props->enable_env_var.name)); - props->enable_env_var.name[sizeof(props->enable_env_var.name) - 1] = '\0'; - strncpy(props->enable_env_var.value, enable_environment->child->valuestring, sizeof(props->enable_env_var.value)); - props->enable_env_var.value[sizeof(props->enable_env_var.value) - 1] = '\0'; + if (enable_environment && enable_environment->child && enable_environment->child->type == cJSON_String) { + result = loader_copy_to_new_str(inst, enable_environment->child->string, &(props.enable_env_var.name)); + if (VK_SUCCESS != result) goto out; + result = loader_copy_to_new_str(inst, enable_environment->child->valuestring, &(props.enable_env_var.value)); + if (VK_SUCCESS != result) goto out; } } // Read in the pre-instance stuff - cJSON *pre_instance = cJSON_GetObjectItem(layer_node, "pre_instance_functions"); + cJSON *pre_instance = loader_cJSON_GetObjectItem(layer_node, "pre_instance_functions"); if (NULL != pre_instance) { // Supported versions started in 1.1.2, so anything newer if (!loader_check_version_meets_required(loader_combine_version(1, 1, 2), version)) { @@ -2420,111 +2580,65 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc "layers. The section will be ignored", filename); } else { - cJSON *inst_ext_json = cJSON_GetObjectItem(pre_instance, "vkEnumerateInstanceExtensionProperties"); - if (NULL != inst_ext_json) { - char *inst_ext_name = cJSON_Print(inst_ext_json); - if (NULL == inst_ext_name) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - size_t len = strlen(inst_ext_name) >= MAX_STRING_SIZE ? MAX_STRING_SIZE - 3 : strlen(inst_ext_name) - 2; - strncpy(props->pre_instance_functions.enumerate_instance_extension_properties, inst_ext_name + 1, len); - props->pre_instance_functions.enumerate_instance_extension_properties[len] = '\0'; - loader_instance_heap_free(inst, inst_ext_name); - } + result = loader_parse_json_string(pre_instance, "vkEnumerateInstanceExtensionProperties", + &props.pre_instance_functions.enumerate_instance_extension_properties); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; - cJSON *inst_layer_json = cJSON_GetObjectItem(pre_instance, "vkEnumerateInstanceLayerProperties"); - if (NULL != inst_layer_json) { - char *inst_layer_name = cJSON_Print(inst_layer_json); - if (NULL == inst_layer_name) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - size_t len = strlen(inst_layer_name) >= MAX_STRING_SIZE ? MAX_STRING_SIZE - 3 : strlen(inst_layer_name) - 2; - strncpy(props->pre_instance_functions.enumerate_instance_layer_properties, inst_layer_name + 1, len); - props->pre_instance_functions.enumerate_instance_layer_properties[len] = '\0'; - loader_instance_heap_free(inst, inst_layer_name); - } + result = loader_parse_json_string(pre_instance, "vkEnumerateInstanceLayerProperties", + &props.pre_instance_functions.enumerate_instance_layer_properties); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; - cJSON *inst_version_json = cJSON_GetObjectItem(pre_instance, "vkEnumerateInstanceVersion"); - if (NULL != inst_version_json) { - char *inst_version_name = cJSON_Print(inst_version_json); - if (NULL == inst_version_name) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - size_t len = strlen(inst_version_name) >= MAX_STRING_SIZE ? MAX_STRING_SIZE - 3 : strlen(inst_version_name) - 2; - strncpy(props->pre_instance_functions.enumerate_instance_version, inst_version_name + 1, len); - props->pre_instance_functions.enumerate_instance_version[len] = '\0'; - loader_instance_heap_free(inst, inst_version_name); - } + result = loader_parse_json_string(pre_instance, "vkEnumerateInstanceVersion", + &props.pre_instance_functions.enumerate_instance_version); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; } } - props->num_app_key_paths = 0; - props->app_key_paths = NULL; - app_keys = cJSON_GetObjectItem(layer_node, "app_keys"); - if (app_keys != NULL) { - if (strcmp(name, VK_OVERRIDE_LAYER_NAME)) { + if (loader_cJSON_GetObjectItem(layer_node, "app_keys")) { + if (!props.is_override) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "Layer %s contains app_keys, but any app_keys can only be provided by the override metalayer. " + "Layer %s contains app_keys, but any app_keys can only be provided by the override meta layer. " "These will be ignored.", - name); - } else { - props->num_app_key_paths = cJSON_GetArraySize(app_keys); - - // Allocate the blacklist array - props->app_key_paths = loader_instance_heap_alloc(inst, sizeof(char[MAX_STRING_SIZE]) * props->num_app_key_paths, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (props->app_key_paths == NULL) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - - // Copy the app_key_paths into the array - for (i = 0; i < (int)props->num_app_key_paths; ++i) { - cJSON *app_key_path = cJSON_GetArrayItem(app_keys, i); - if (app_key_path == NULL) { - continue; - } - temp = cJSON_Print(app_key_path); - if (temp == NULL) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - temp[strlen(temp) - 1] = '\0'; - strncpy(props->app_key_paths[i], temp + 1, MAX_STRING_SIZE - 1); - props->app_key_paths[i][MAX_STRING_SIZE - 1] = '\0'; - loader_instance_heap_free(inst, temp); - } + props.info.layerName); } + + result = loader_parse_json_array_of_strings(inst, layer_node, "app_keys", &props.app_key_paths); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; } - GET_JSON_ITEM(inst, layer_node, library_arch) + char *library_arch = NULL; + result = loader_parse_json_string(layer_node, "library_arch", &library_arch); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; if (library_arch != NULL) { if ((strncmp(library_arch, "32", 2) == 0 && sizeof(void *) != 4) || (strncmp(library_arch, "64", 2) == 0 && sizeof(void *) != 8)) { loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "Layer library architecture doesn't match the current running architecture, skipping this layer"); + loader_instance_heap_free(inst, library_arch); + result = VK_ERROR_INITIALIZATION_FAILED; goto out; } + loader_instance_heap_free(inst, library_arch); } result = VK_SUCCESS; out: -#undef GET_JSON_ITEM -#undef GET_JSON_OBJECT - - if (VK_SUCCESS != result && NULL != props) { - // Make sure to free anything that was allocated - loader_remove_layer_in_list(inst, layer_instance_list, props_index); + // Try to append the layer property + if (VK_SUCCESS == result) { + result = loader_append_layer_property(inst, layer_instance_list, &props); } - + // If appending fails - free all the memory allocated in it + if (VK_SUCCESS != result) { + loader_free_layer_properties(inst, &props); + } + loader_instance_heap_free(inst, type); + loader_instance_heap_free(inst, api_version); + loader_instance_heap_free(inst, implementation_version); return result; } -static inline bool is_valid_layer_json_version(const loader_api_version *layer_json) { +bool is_valid_layer_json_version(const loader_api_version *layer_json) { // Supported versions are: 1.0.0, 1.0.1, 1.1.0 - 1.1.2, and 1.2.0 - 1.2.1. if ((layer_json->major == 1 && layer_json->minor == 2 && layer_json->patch < 2) || (layer_json->major == 1 && layer_json->minor == 1 && layer_json->patch < 3) || @@ -2543,8 +2657,8 @@ static inline bool is_valid_layer_json_version(const loader_api_version *layer_j // layer_list has a new entry and initialized accordingly. // If the json input object does not have all the required fields no entry // is added to the list. -static VkResult loader_add_layer_properties(const struct loader_instance *inst, struct loader_layer_list *layer_instance_list, - cJSON *json, bool is_implicit, char *filename) { +VkResult loader_add_layer_properties(const struct loader_instance *inst, struct loader_layer_list *layer_instance_list, cJSON *json, + bool is_implicit, char *filename) { // The following Fields in layer manifest file that are required: // - "file_format_version" // - If more than one "layer" object are used, then the "layers" array is @@ -2557,12 +2671,13 @@ static VkResult loader_add_layer_properties(const struct loader_instance *inst, if (!json || json->type != 6) { goto out; } - item = cJSON_GetObjectItem(json, "file_format_version"); + item = loader_cJSON_GetObjectItem(json, "file_format_version"); if (item == NULL) { goto out; } - file_vers = cJSON_PrintUnformatted(item); + file_vers = loader_cJSON_PrintUnformatted(item); if (NULL == file_vers) { + result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "Found manifest file %s (file version %s)", filename, file_vers); @@ -2576,9 +2691,9 @@ static VkResult loader_add_layer_properties(const struct loader_instance *inst, } // If "layers" is present, read in the array of layer objects - layers_node = cJSON_GetObjectItem(json, "layers"); + layers_node = loader_cJSON_GetObjectItem(json, "layers"); if (layers_node != NULL) { - int numItems = cJSON_GetArraySize(layers_node); + int numItems = loader_cJSON_GetArraySize(layers_node); // Supported versions started in 1.0.1, so anything newer if (!loader_check_version_meets_required(loader_combine_version(1, 0, 1), json_version)) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, @@ -2587,7 +2702,7 @@ static VkResult loader_add_layer_properties(const struct loader_instance *inst, filename, file_vers); } for (int curLayer = 0; curLayer < numItems; curLayer++) { - layer_node = cJSON_GetArrayItem(layers_node, curLayer); + layer_node = loader_cJSON_GetArrayItem(layers_node, curLayer); if (layer_node == NULL) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "loader_add_layer_properties: Can not find 'layers' array element %d object in manifest JSON file %s. " @@ -2595,11 +2710,11 @@ static VkResult loader_add_layer_properties(const struct loader_instance *inst, curLayer, filename); goto out; } - result = loader_read_layer_json(inst, layer_instance_list, layer_node, json_version, item, is_implicit, filename); + result = loader_read_layer_json(inst, layer_instance_list, layer_node, json_version, is_implicit, filename); } } else { // Otherwise, try to read in individual layers - layer_node = cJSON_GetObjectItem(json, "layer"); + layer_node = loader_cJSON_GetObjectItem(json, "layer"); if (layer_node == NULL) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "loader_add_layer_properties: Can not find 'layer' object in manifest JSON file %s. Skipping this file.", @@ -2625,7 +2740,7 @@ static VkResult loader_add_layer_properties(const struct loader_instance *inst, filename); } else { do { - result = loader_read_layer_json(inst, layer_instance_list, layer_node, json_version, item, is_implicit, filename); + result = loader_read_layer_json(inst, layer_instance_list, layer_node, json_version, is_implicit, filename); layer_node = layer_node->next; } while (layer_node != NULL); } @@ -2637,7 +2752,7 @@ out: return result; } -static inline size_t determine_data_file_path_size(const char *cur_path, size_t relative_path_size) { +size_t determine_data_file_path_size(const char *cur_path, size_t relative_path_size) { size_t path_size = 0; if (NULL != cur_path) { @@ -2656,8 +2771,7 @@ static inline size_t determine_data_file_path_size(const char *cur_path, size_t return path_size; } -static inline void copy_data_file_info(const char *cur_path, const char *relative_path, size_t relative_path_size, - char **output_path) { +void copy_data_file_info(const char *cur_path, const char *relative_path, size_t relative_path_size, char **output_path) { if (NULL != cur_path) { uint32_t start = 0; uint32_t stop = 0; @@ -2698,60 +2812,8 @@ static inline void copy_data_file_info(const char *cur_path, const char *relativ } } -// Check to see if there's enough space in the data file list. If not, add some. -static inline VkResult check_and_adjust_data_file_list(const struct loader_instance *inst, struct loader_data_files *out_files) { - if (out_files->count == 0) { - out_files->filename_list = loader_instance_heap_alloc(inst, 64 * sizeof(char *), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (NULL == out_files->filename_list) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "check_and_adjust_data_file_list: Failed to allocate space for manifest file name list"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - out_files->alloc_count = 64; - } else if (out_files->count == out_files->alloc_count) { - size_t new_size = out_files->alloc_count * sizeof(char *) * 2; - void *new_ptr = loader_instance_heap_realloc(inst, out_files->filename_list, out_files->alloc_count * sizeof(char *), - new_size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (NULL == new_ptr) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "check_and_adjust_data_file_list: Failed to reallocate space for manifest file name list"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - out_files->filename_list = new_ptr; - out_files->alloc_count *= 2; - } - - return VK_SUCCESS; -} - -// add file_name to the out_files manifest list. Assumes its a valid manifest file name -static VkResult add_manifest_file(const struct loader_instance *inst, const char *file_name, struct loader_data_files *out_files) { - VkResult vk_result = VK_SUCCESS; - - // Check and allocate space in the manifest list if necessary - vk_result = check_and_adjust_data_file_list(inst, out_files); - if (VK_SUCCESS != vk_result) { - goto out; - } - - out_files->filename_list[out_files->count] = - loader_instance_heap_alloc(inst, strlen(file_name) + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (out_files->filename_list[out_files->count] == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "add_manifest_file: Failed to allocate space for manifest file %d list", - out_files->count); - vk_result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - - strcpy(out_files->filename_list[out_files->count++], file_name); - -out: - return vk_result; -} - // If the file found is a manifest file name, add it to the out_files manifest list. -static VkResult add_if_manifest_file(const struct loader_instance *inst, const char *file_name, - struct loader_data_files *out_files) { +VkResult add_if_manifest_file(const struct loader_instance *inst, const char *file_name, struct loader_string_list *out_files) { VkResult vk_result = VK_SUCCESS; assert(NULL != file_name && "add_if_manifest_file: Received NULL pointer for file_name"); @@ -2766,7 +2828,7 @@ static VkResult add_if_manifest_file(const struct loader_instance *inst, const c goto out; } - vk_result = add_manifest_file(inst, file_name, out_files); + vk_result = copy_str_to_string_list(inst, out_files, file_name, name_len); out: @@ -2775,7 +2837,7 @@ out: // Add any files found in the search_path. If any path in the search path points to a specific JSON, attempt to // only open that one JSON. Otherwise, if the path is a folder, search the folder for JSON files. -VkResult add_data_files(const struct loader_instance *inst, char *search_path, struct loader_data_files *out_files, +VkResult add_data_files(const struct loader_instance *inst, char *search_path, struct loader_string_list *out_files, bool use_first_found_manifest) { VkResult vk_result = VK_SUCCESS; DIR *dir_stream = NULL; @@ -2784,7 +2846,7 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s char *next_file; char *name; char full_path[2048]; -#ifndef _WIN32 +#if !defined(_WIN32) char temp_path[2048]; #endif @@ -2798,9 +2860,9 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s // Is this a JSON file, then try to open it. size_t len = strlen(cur_file); if (is_json(cur_file + len - 5, len)) { -#ifdef _WIN32 +#if defined(_WIN32) name = cur_file; -#else +#elif COMMON_UNIX_PLATFORMS // Only Linux has relative paths, make a copy of location so it isn't modified size_t str_len; if (NULL != next_file) { @@ -2809,11 +2871,13 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s str_len = strlen(cur_file) + 1; } if (str_len > sizeof(temp_path)) { - loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "add_data_files: Path to %s too long\n", cur_file); + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "add_data_files: Path to %s too long", cur_file); continue; } - strcpy(temp_path, cur_file); + strncpy(temp_path, cur_file, str_len); name = temp_path; +#else +#warning add_data_files must define relative path copy for this platform #endif loader_get_fullpath(cur_file, name, sizeof(full_path), full_path); name = full_path; @@ -2871,31 +2935,30 @@ out: // Look for data files in the provided paths, but first check the environment override to determine if we should use that // instead. -static VkResult read_data_files_in_search_paths(const struct loader_instance *inst, enum loader_data_files_type manifest_type, - const char *path_override, bool *override_active, - struct loader_data_files *out_files) { +VkResult read_data_files_in_search_paths(const struct loader_instance *inst, enum loader_data_files_type manifest_type, + const char *path_override, bool *override_active, struct loader_string_list *out_files) { VkResult vk_result = VK_SUCCESS; char *override_env = NULL; const char *override_path = NULL; - char *relative_location = NULL; char *additional_env = NULL; size_t search_path_size = 0; char *search_path = NULL; char *cur_path_ptr = NULL; bool use_first_found_manifest = false; -#ifndef _WIN32 - size_t rel_size = 0; // unused in windows, dont declare so no compiler warnings are generated +#if COMMON_UNIX_PLATFORMS + char *relative_location = NULL; // Only used on unix platforms + size_t rel_size = 0; // unused in windows, dont declare so no compiler warnings are generated #endif #if defined(_WIN32) char *package_path = NULL; -#else +#elif COMMON_UNIX_PLATFORMS // Determine how much space is needed to generate the full search path // for the current manifest files. char *xdg_config_home = loader_secure_getenv("XDG_CONFIG_HOME", inst); char *xdg_config_dirs = loader_secure_getenv("XDG_CONFIG_DIRS", inst); -#if !defined(__Fuchsia__) && !defined(__QNXNTO__) && !defined(__OHOS__) +#if !defined(__Fuchsia__) && !defined(__QNX__) && !defined(__OHOS__) if (NULL == xdg_config_dirs || '\0' == xdg_config_dirs[0]) { xdg_config_dirs = FALLBACK_CONFIG_DIRS; } @@ -2904,7 +2967,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in char *xdg_data_home = loader_secure_getenv("XDG_DATA_HOME", inst); char *xdg_data_dirs = loader_secure_getenv("XDG_DATA_DIRS", inst); -#if !defined(__Fuchsia__) && !defined(__QNXNTO__) && !defined(__OHOS__) +#if !defined(__Fuchsia__) && !defined(__QNX__) && !defined(__OHOS__) if (NULL == xdg_data_dirs || '\0' == xdg_data_dirs[0]) { xdg_data_dirs = FALLBACK_DATA_DIRS; } @@ -2921,25 +2984,25 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in if (home != NULL) { if (NULL == xdg_config_home || '\0' == xdg_config_home[0]) { const char config_suffix[] = "/.config"; - default_config_home = - loader_instance_heap_alloc(inst, strlen(home) + strlen(config_suffix) + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + size_t default_config_home_len = strlen(home) + sizeof(config_suffix) + 1; + default_config_home = loader_instance_heap_calloc(inst, default_config_home_len, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (default_config_home == NULL) { vk_result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - strcpy(default_config_home, home); - strcat(default_config_home, config_suffix); + strncpy(default_config_home, home, default_config_home_len); + strncat(default_config_home, config_suffix, default_config_home_len); } if (NULL == xdg_data_home || '\0' == xdg_data_home[0]) { const char data_suffix[] = "/.local/share"; - default_data_home = - loader_instance_heap_alloc(inst, strlen(home) + strlen(data_suffix) + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + size_t default_data_home_len = strlen(home) + sizeof(data_suffix) + 1; + default_data_home = loader_instance_heap_calloc(inst, default_data_home_len, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (default_data_home == NULL) { vk_result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - strcpy(default_data_home, home); - strcat(default_data_home, data_suffix); + strncpy(default_data_home, home, default_data_home_len); + strncat(default_data_home, data_suffix, default_data_home_len); } } @@ -2953,7 +3016,9 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in } else { home_data_dir = xdg_data_home; } -#endif // !_WIN32 +#else +#warning read_data_files_in_search_paths unsupported platform +#endif switch (manifest_type) { case LOADER_DATA_FILE_MANIFEST_DRIVER: @@ -2963,24 +3028,38 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in override_env = loader_secure_getenv(VK_ICD_FILENAMES_ENV_VAR, inst); } additional_env = loader_secure_getenv(VK_ADDITIONAL_DRIVER_FILES_ENV_VAR, inst); +#if COMMON_UNIX_PLATFORMS relative_location = VK_DRIVERS_INFO_RELATIVE_DIR; +#endif #if defined(_WIN32) package_path = windows_get_app_package_manifest_path(inst); #endif break; case LOADER_DATA_FILE_MANIFEST_IMPLICIT_LAYER: +#if COMMON_UNIX_PLATFORMS relative_location = VK_ILAYERS_INFO_RELATIVE_DIR; +#endif break; case LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER: override_env = loader_secure_getenv(VK_LAYER_PATH_ENV_VAR, inst); additional_env = loader_secure_getenv(VK_ADDITIONAL_LAYER_PATH_ENV_VAR, inst); +#if COMMON_UNIX_PLATFORMS relative_location = VK_ELAYERS_INFO_RELATIVE_DIR; +#endif break; default: assert(false && "Shouldn't get here!"); break; } + // Log a message when VK_LAYER_PATH is set but the override layer paths take priority + if (manifest_type == LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER && NULL != override_env && NULL != path_override) { + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Ignoring VK_LAYER_PATH. The Override layer is active and has override paths set, which takes priority. " + "VK_LAYER_PATH is set to %s", + override_env); + } + if (path_override != NULL) { override_path = path_override; } else if (override_env != NULL) { @@ -3006,7 +3085,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in if (search_path_size == 2) { goto out; } -#else // !_WIN32 +#elif COMMON_UNIX_PLATFORMS } // Add the general search folders (with the appropriate relative folder added) @@ -3030,7 +3109,9 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in } search_path_size += determine_data_file_path_size(xdg_data_dirs, rel_size); } -#endif // !_WIN32 +#else +#warning read_data_files_in_search_paths unsupported platform +#endif } // Allocate the required space @@ -3047,8 +3128,9 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in // Add the remaining paths to the list if (NULL != override_path) { - strcpy(cur_path_ptr, override_path); - cur_path_ptr += strlen(override_path); + size_t override_path_len = strlen(override_path); + loader_strncpy(cur_path_ptr, search_path_size, override_path, override_path_len); + cur_path_ptr += override_path_len; } else { // Add any additional search paths defined in the additive environment variable if (NULL != additional_env) { @@ -3059,11 +3141,13 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in if (NULL != package_path) { copy_data_file_info(package_path, NULL, 0, &cur_path_ptr); } -#else +#elif COMMON_UNIX_PLATFORMS if (rel_size > 0) { #if defined(__APPLE__) // Add the bundle's Resources dir to the beginning of the search path. // Looks for manifests in the bundle first, before any system directories. + // This also appears to work unmodified for iOS, it finds the app bundle on the devices + // file system. (RSW) CFBundleRef main_bundle = CFBundleGetMainBundle(); if (NULL != main_bundle) { CFURLRef ref = CFBundleCopyResourcesDirectoryURL(main_bundle); @@ -3074,8 +3158,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in memcpy(cur_path_ptr, relative_location, rel_size); cur_path_ptr += rel_size; *cur_path_ptr++ = PATH_SEPARATOR; - // only for ICD manifests - if (override_env != NULL && manifest_type == LOADER_DATA_FILE_MANIFEST_DRIVER) { + if (manifest_type == LOADER_DATA_FILE_MANIFEST_DRIVER) { use_first_found_manifest = true; } } @@ -3106,7 +3189,9 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in assert(cur_path_ptr - search_path < (ptrdiff_t)search_path_size); *cur_path_ptr = '\0'; -#endif // !_WIN32 +#else +#warning read_data_files_in_search_paths unsupported platform +#endif } // Remove duplicate paths, or it would result in duplicate extensions, duplicate devices, etc. @@ -3147,16 +3232,17 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in if (search_path_size > 0) { char *tmp_search_path = loader_instance_heap_alloc(inst, search_path_size + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (NULL != tmp_search_path) { - strncpy(tmp_search_path, search_path, search_path_size); + loader_strncpy(tmp_search_path, search_path_size + 1, search_path, search_path_size); tmp_search_path[search_path_size] = '\0'; if (manifest_type == LOADER_DATA_FILE_MANIFEST_DRIVER) { log_flags = VULKAN_LOADER_DRIVER_BIT; loader_log(inst, VULKAN_LOADER_DRIVER_BIT, 0, "Searching for driver manifest files"); } else { log_flags = VULKAN_LOADER_LAYER_BIT; - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "Searching for layer manifest files"); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "Searching for %s layer manifest files", + manifest_type == LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER ? "explicit" : "implicit"); } - loader_log(inst, log_flags, 0, " In following folders:"); + loader_log(inst, log_flags, 0, " In following locations:"); char *cur_file; char *next_file = tmp_search_path; while (NULL != next_file && *next_file != '\0') { @@ -3174,7 +3260,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in if (log_flags != 0 && out_files->count > 0) { loader_log(inst, log_flags, 0, " Found the following files:"); for (uint32_t cur_file = 0; cur_file < out_files->count; ++cur_file) { - loader_log(inst, log_flags, 0, " %s", out_files->filename_list[cur_file]); + loader_log(inst, log_flags, 0, " %s", out_files->list[cur_file]); } } else { loader_log(inst, log_flags, 0, " Found no files"); @@ -3192,7 +3278,7 @@ out: loader_free_getenv(override_env, inst); #if defined(_WIN32) loader_instance_heap_free(inst, package_path); -#else +#elif COMMON_UNIX_PLATFORMS loader_free_getenv(xdg_config_home, inst); loader_free_getenv(xdg_config_dirs, inst); loader_free_getenv(xdg_data_home, inst); @@ -3201,6 +3287,8 @@ out: loader_free_getenv(home, inst); loader_instance_heap_free(inst, default_data_home); loader_instance_heap_free(inst, default_config_home); +#else +#warning read_data_files_in_search_paths unsupported platform #endif loader_instance_heap_free(inst, search_path); @@ -3232,30 +3320,19 @@ out: // Linux Layer| dirs | dirs VkResult loader_get_data_files(const struct loader_instance *inst, enum loader_data_files_type manifest_type, - const char *path_override, struct loader_data_files *out_files) { + const char *path_override, struct loader_string_list *out_files) { VkResult res = VK_SUCCESS; bool override_active = false; // Free and init the out_files information so there's no false data left from uninitialized variables. - if (out_files->filename_list != NULL) { - for (uint32_t i = 0; i < out_files->count; i++) { - if (NULL != out_files->filename_list[i]) { - loader_instance_heap_free(inst, out_files->filename_list[i]); - out_files->filename_list[i] = NULL; - } - } - loader_instance_heap_free(inst, out_files->filename_list); - } - out_files->count = 0; - out_files->alloc_count = 0; - out_files->filename_list = NULL; + free_string_list(inst, out_files); res = read_data_files_in_search_paths(inst, manifest_type, path_override, &override_active, out_files); if (VK_SUCCESS != res) { goto out; } -#ifdef _WIN32 +#if defined(_WIN32) // Read the registry if the override wasn't active. if (!override_active) { bool warn_if_not_present = false; @@ -3288,32 +3365,25 @@ VkResult loader_get_data_files(const struct loader_instance *inst, enum loader_d out: - if (VK_SUCCESS != res && NULL != out_files->filename_list) { - for (uint32_t remove = 0; remove < out_files->count; remove++) { - loader_instance_heap_free(inst, out_files->filename_list[remove]); - } - loader_instance_heap_free(inst, out_files->filename_list); - out_files->count = 0; - out_files->alloc_count = 0; - out_files->filename_list = NULL; + if (VK_SUCCESS != res) { + free_string_list(inst, out_files); } return res; } struct ICDManifestInfo { - char full_library_path[MAX_STRING_SIZE]; + char *full_library_path; uint32_t version; }; +// Takes a json file, opens, reads, and parses an ICD Manifest out of it. +// Should only return VK_SUCCESS, VK_ERROR_INCOMPATIBLE_DRIVER, or VK_ERROR_OUT_OF_HOST_MEMORY VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *file_str, struct ICDManifestInfo *icd, bool *skipped_portability_drivers) { VkResult res = VK_SUCCESS; cJSON *json = NULL; - cJSON *item = NULL, *itemICD = NULL; - char *file_vers_str = NULL; - char *library_path = NULL; char *library_arch_str = NULL; char *version_str = NULL; @@ -3322,11 +3392,15 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil } res = loader_get_json(inst, file_str, &json); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + goto out; + } if (res != VK_SUCCESS || NULL == json) { + res = VK_ERROR_INCOMPATIBLE_DRIVER; goto out; } - item = cJSON_GetObjectItem(json, "file_format_version"); + cJSON *item = loader_cJSON_GetObjectItem(json, "file_format_version"); if (item == NULL) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "loader_parse_icd_manifest: ICD JSON %s does not have a \'file_format_version\' field. Skipping ICD JSON.", @@ -3335,7 +3409,7 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil goto out; } - file_vers_str = cJSON_Print(item); + file_vers_str = loader_cJSON_Print(item); if (NULL == file_vers_str) { // Only reason the print can fail is if there was an allocation issue loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, @@ -3356,7 +3430,7 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil json_file_version.major, json_file_version.minor, json_file_version.patch); } - itemICD = cJSON_GetObjectItem(json, "ICD"); + cJSON *itemICD = loader_cJSON_GetObjectItem(json, "ICD"); if (itemICD == NULL) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "loader_parse_icd_manifest: Can not find \'ICD\' object in ICD JSON file %s. Skipping ICD JSON", file_str); @@ -3364,7 +3438,7 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil goto out; } - item = cJSON_GetObjectItem(itemICD, "library_path"); + item = loader_cJSON_GetObjectItem(itemICD, "library_path"); if (item == NULL) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "loader_parse_icd_manifest: Failed to find \'library_path\' object in ICD JSON file %s. Skipping ICD JSON.", @@ -3372,19 +3446,13 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil res = VK_ERROR_INCOMPATIBLE_DRIVER; goto out; } - library_path = cJSON_Print(item); - if (!library_path || strlen(library_path) == 0) { + char *library_path = loader_cJSON_Print(item); + if (!library_path) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "loader_parse_icd_manifest: Failed retrieving ICD JSON %s \'library_path\' field. Skipping ICD JSON.", file_str); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - size_t library_path_len = strlen(library_path); - // cJSON prints everything with quotes so they need to be removed. - // move every char forward one, so the leading quote is replaced. - memmove(library_path, &library_path[1], library_path_len - 2); - // replace end quote with null terminator - library_path[library_path_len - 2] = '\0'; if (strlen(library_path) == 0) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, @@ -3394,31 +3462,21 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil } // Print out the paths being searched if debugging is enabled - loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Searching for ICD drivers named %s", library_path); - if (loader_platform_is_path(library_path)) { - // a relative or absolute path - char *name_copy = loader_stack_alloc(strlen(file_str) + 1); - char *rel_base; - strcpy(name_copy, file_str); - rel_base = loader_platform_dirname(name_copy); - loader_expand_path(library_path, rel_base, MAX_STRING_SIZE, &icd->full_library_path[0]); - } else { -// a filename which is assumed in a system directory -#if defined(DEFAULT_VK_DRIVERS_PATH) - loader_get_fullpath(library_path, DEFAULT_VK_DRIVERS_PATH, MAX_STRING_SIZE, &icd->full_library_path[0]); -#else - loader_get_fullpath(library_path, "", MAX_STRING_SIZE, &icd->full_library_path[0]); -#endif + loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "Searching for ICD drivers named %s", library_path); + // This function takes ownership of library_path - so we don't need to clean it up + res = combine_manifest_directory_and_library_path(inst, library_path, file_str, &icd->full_library_path); + if (VK_SUCCESS != res) { + goto out; } - item = cJSON_GetObjectItem(itemICD, "api_version"); + item = loader_cJSON_GetObjectItem(itemICD, "api_version"); if (item == NULL) { loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "loader_parse_icd_manifest: ICD JSON %s does not have an \'api_version\' field. Skipping ICD JSON.", file_str); res = VK_ERROR_INCOMPATIBLE_DRIVER; goto out; } - version_str = cJSON_Print(item); + version_str = loader_cJSON_Print(item); if (NULL == version_str) { // Only reason the print can fail is if there was an allocation issue loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, @@ -3440,7 +3498,7 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil // Skip over ICD's which contain a true "is_portability_driver" value whenever the application doesn't enable // portability enumeration. - item = cJSON_GetObjectItem(itemICD, "is_portability_driver"); + item = loader_cJSON_GetObjectItem(itemICD, "is_portability_driver"); if (item != NULL && item->type == cJSON_True && inst && !inst->portability_enumeration_enabled) { if (skipped_portability_drivers) { *skipped_portability_drivers = true; @@ -3449,25 +3507,27 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil goto out; } - item = cJSON_GetObjectItem(itemICD, "library_arch"); + item = loader_cJSON_GetObjectItem(itemICD, "library_arch"); if (item != NULL) { - library_arch_str = cJSON_Print(item); + library_arch_str = loader_cJSON_Print(item); if (NULL != library_arch_str) { // cJSON includes the quotes by default, so we need to look for those here - if ((strncmp(library_arch_str, "\"32\"", 4) == 0 && sizeof(void *) != 4) || - (strncmp(library_arch_str, "\"64\"", 4) == 0 && sizeof(void *) != 8)) { + if ((strncmp(library_arch_str, "32", 4) == 0 && sizeof(void *) != 4) || + (strncmp(library_arch_str, "64", 4) == 0 && sizeof(void *) != 8)) { loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "loader_parse_icd_manifest: Driver library architecture doesn't match the current running " "architecture, skipping this driver"); res = VK_ERROR_INCOMPATIBLE_DRIVER; goto out; } + } else { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; } } out: - cJSON_Delete(json); + loader_cJSON_Delete(json); loader_instance_heap_free(inst, file_vers_str); - loader_instance_heap_free(inst, library_path); loader_instance_heap_free(inst, version_str); loader_instance_heap_free(inst, library_arch_str); return res; @@ -3488,31 +3548,57 @@ out: // Vulkan result // (on result == VK_SUCCESS) a list of icds that were discovered VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, - bool *skipped_portability_drivers) { - struct loader_data_files manifest_files; + const VkInstanceCreateInfo *pCreateInfo, bool *skipped_portability_drivers) { VkResult res = VK_SUCCESS; - bool lockedMutex = false; - - memset(&manifest_files, 0, sizeof(struct loader_data_files)); + struct loader_string_list manifest_files = {0}; + struct loader_envvar_filter select_filter = {0}; + struct loader_envvar_filter disable_filter = {0}; + struct ICDManifestInfo *icd_details = NULL; + // Set up the ICD Trampoline list so elements can be written into it. res = loader_scanned_icd_init(inst, icd_tramp_list); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + return res; + } + + 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) { + goto out; + } + if (direct_driver_loading_exclusive_mode) { + // Make sure to jump over the system & env-var driver discovery mechanisms if exclusive mode is set, even if no drivers + // were successfully found through the direct driver loading mechanism + goto out; + } + + // 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); + if (VK_SUCCESS != res) { + goto out; + } + res = parse_generic_filter_environment_var(inst, VK_DRIVERS_DISABLE_ENV_VAR, &disable_filter); if (VK_SUCCESS != res) { goto out; } // Get a list of manifest files for ICDs res = loader_get_data_files(inst, LOADER_DATA_FILE_MANIFEST_DRIVER, NULL, &manifest_files); - if (VK_SUCCESS != res || manifest_files.count == 0) { + if (VK_SUCCESS != res) { + goto out; + } + + icd_details = loader_stack_alloc(sizeof(struct ICDManifestInfo) * manifest_files.count); + if (NULL == icd_details) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } + memset(icd_details, 0, sizeof(struct ICDManifestInfo) * manifest_files.count); - loader_platform_thread_lock_mutex(&loader_json_lock); - lockedMutex = true; for (uint32_t i = 0; i < manifest_files.count; i++) { VkResult icd_res = VK_SUCCESS; - struct ICDManifestInfo icd; - memset(&icd, 0, sizeof(struct ICDManifestInfo)); - icd_res = loader_parse_icd_manifest(inst, manifest_files.filename_list[i], &icd, skipped_portability_drivers); + + icd_res = loader_parse_icd_manifest(inst, manifest_files.list[i], &icd_details[i], skipped_portability_drivers); if (VK_ERROR_OUT_OF_HOST_MEMORY == icd_res) { res = icd_res; goto out; @@ -3520,8 +3606,39 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t continue; } + if (select_filter.count > 0 || disable_filter.count > 0) { + // Get only the filename for comparing to the filters + char *just_filename_str = strrchr(manifest_files.list[i], DIRECTORY_SYMBOL); + + // No directory symbol, just the filename + if (NULL == just_filename_str) { + just_filename_str = manifest_files.list[i]; + } else { + just_filename_str++; + } + + bool name_matches_select = + (select_filter.count > 0 && check_name_matches_filter_environment_var(just_filename_str, &select_filter)); + bool name_matches_disable = + (disable_filter.count > 0 && check_name_matches_filter_environment_var(just_filename_str, &disable_filter)); + + if (name_matches_disable && !name_matches_select) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "Driver \"%s\" ignored because it was disabled by env var \'%s\'", just_filename_str, + VK_DRIVERS_DISABLE_ENV_VAR); + continue; + } + if (select_filter.count != 0 && !name_matches_select) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "Driver \"%s\" ignored because not selected by env var \'%s\'", just_filename_str, + VK_DRIVERS_SELECT_ENV_VAR); + continue; + } + } + enum loader_layer_library_status lib_status; - icd_res = loader_scanned_icd_add(inst, icd_tramp_list, icd.full_library_path, icd.version, &lib_status); + icd_res = + loader_scanned_icd_add(inst, icd_tramp_list, icd_details[i].full_library_path, icd_details[i].version, &lib_status); if (VK_ERROR_OUT_OF_HOST_MEMORY == icd_res) { res = icd_res; goto out; @@ -3531,247 +3648,230 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t case LOADER_LAYER_LIB_ERROR_FAILED_TO_LOAD: loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "loader_icd_scan: Failed loading library associated with ICD JSON %s. Ignoring this JSON", - icd.full_library_path); + icd_details[i].full_library_path); break; case LOADER_LAYER_LIB_ERROR_WRONG_BIT_TYPE: { - loader_log(inst, VULKAN_LOADER_DRIVER_BIT, 0, "Requested layer %s was wrong bit-type. Ignoring this JSON", - icd.full_library_path); + loader_log(inst, VULKAN_LOADER_DRIVER_BIT, 0, "Requested ICD %s was wrong bit-type. Ignoring this JSON", + icd_details[i].full_library_path); break; } case LOADER_LAYER_LIB_SUCCESS_LOADED: + case LOADER_LAYER_LIB_ERROR_OUT_OF_MEMORY: // Shouldn't be able to reach this but if it is, best to report a debug loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "Shouldn't reach this. A valid version of requested ICD %s was loaded but something bad " "happened afterwards.", - icd.full_library_path); + icd_details[i].full_library_path); break; } } } out: - if (NULL != manifest_files.filename_list) { + if (NULL != icd_details) { + // Successfully got the icd_details structure, which means we need to free the paths contained within for (uint32_t i = 0; i < manifest_files.count; i++) { - loader_instance_heap_free(inst, manifest_files.filename_list[i]); + loader_instance_heap_free(inst, icd_details[i].full_library_path); } - loader_instance_heap_free(inst, manifest_files.filename_list); } - if (lockedMutex) { - loader_platform_thread_unlock_mutex(&loader_json_lock); - } - + free_string_list(inst, &manifest_files); return res; } -void loader_scan_for_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers) { - char *file_str; - struct loader_data_files manifest_files; - cJSON *json; - bool override_layer_valid = false; - char *override_paths = NULL; - uint32_t total_count = 0; - - memset(&manifest_files, 0, sizeof(struct loader_data_files)); - - // Cleanup any previously scanned libraries - loader_delete_layer_list_and_properties(inst, instance_layers); - - loader_platform_thread_lock_mutex(&loader_json_lock); +// Gets the layer data files corresponding to manifest_type & path_override, then parses the resulting json objects +// into instance_layers +// Manifest type must be either implicit or explicit +VkResult loader_parse_instance_layers(struct loader_instance *inst, enum loader_data_files_type manifest_type, + const char *path_override, struct loader_layer_list *instance_layers) { + assert(manifest_type == LOADER_DATA_FILE_MANIFEST_IMPLICIT_LAYER || manifest_type == LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER); + VkResult res = VK_SUCCESS; + struct loader_string_list manifest_files = {0}; - // Get a list of manifest files for any implicit layers - if (VK_SUCCESS != loader_get_data_files(inst, LOADER_DATA_FILE_MANIFEST_IMPLICIT_LAYER, NULL, &manifest_files)) { + res = loader_get_data_files(inst, manifest_type, path_override, &manifest_files); + if (VK_SUCCESS != res) { goto out; } - if (manifest_files.count != 0) { - total_count += manifest_files.count; - for (uint32_t i = 0; i < manifest_files.count; i++) { - file_str = manifest_files.filename_list[i]; - if (file_str == NULL) { - continue; - } + for (uint32_t i = 0; i < manifest_files.count; i++) { + char *file_str = manifest_files.list[i]; + if (file_str == NULL) { + continue; + } - // Parse file into JSON struct - VkResult res = loader_get_json(inst, file_str, &json); - if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { - goto out; - } else if (VK_SUCCESS != res || NULL == json) { - continue; - } + // Parse file into JSON struct + cJSON *json = NULL; + VkResult local_res = loader_get_json(inst, file_str, &json); + if (VK_ERROR_OUT_OF_HOST_MEMORY == local_res) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } else if (VK_SUCCESS != local_res || NULL == json) { + continue; + } - VkResult local_res = loader_add_layer_properties(inst, instance_layers, json, true, file_str); - cJSON_Delete(json); + local_res = loader_add_layer_properties(inst, instance_layers, json, + manifest_type == LOADER_DATA_FILE_MANIFEST_IMPLICIT_LAYER, file_str); + loader_cJSON_Delete(json); - // If the error is anything other than out of memory we still want to try to load the other layers - if (VK_ERROR_OUT_OF_HOST_MEMORY == local_res) { - goto out; - } + // If the error is anything other than out of memory we still want to try to load the other layers + if (VK_ERROR_OUT_OF_HOST_MEMORY == local_res) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; } } +out: + free_string_list(inst, &manifest_files); - // Remove any extraneous override layers. - remove_all_non_valid_override_layers(inst, instance_layers); + return res; +} - // Check to see if the override layer is present, and use it's override paths. - for (int32_t i = 0; i < (int32_t)instance_layers->count; i++) { - struct loader_layer_properties *prop = &instance_layers->list[i]; - if (prop->is_override && loader_implicit_layer_is_enabled(inst, prop) && prop->num_override_paths > 0) { - char *cur_write_ptr = NULL; - size_t override_path_size = 0; - for (uint32_t j = 0; j < prop->num_override_paths; j++) { - override_path_size += determine_data_file_path_size(prop->override_paths[j], 0); - } - override_paths = loader_instance_heap_alloc(inst, override_path_size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (override_paths == NULL) { - goto out; - } - cur_write_ptr = &override_paths[0]; - for (uint32_t j = 0; j < prop->num_override_paths; j++) { - copy_data_file_info(prop->override_paths[j], NULL, 0, &cur_write_ptr); - } - // Remove the last path separator - --cur_write_ptr; - assert(cur_write_ptr - override_paths < (ptrdiff_t)override_path_size); - *cur_write_ptr = '\0'; - loader_log(NULL, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_scan_for_layers: Override layer has override paths set to %s", override_paths); +// Given a loader_layer_properties struct that is a valid override layer, concatenate the properties override paths and put them +// into the output parameter override_paths +VkResult get_override_layer_override_paths(struct loader_instance *inst, struct loader_layer_properties *prop, + char **override_paths) { + if (prop->override_paths.count > 0) { + char *cur_write_ptr = NULL; + size_t override_path_size = 0; + for (uint32_t j = 0; j < prop->override_paths.count; j++) { + override_path_size += determine_data_file_path_size(prop->override_paths.list[j], 0); + } + *override_paths = loader_instance_heap_alloc(inst, override_path_size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (*override_paths == NULL) { + return VK_ERROR_OUT_OF_HOST_MEMORY; } + cur_write_ptr = &(*override_paths)[0]; + for (uint32_t j = 0; j < prop->override_paths.count; j++) { + copy_data_file_info(prop->override_paths.list[j], NULL, 0, &cur_write_ptr); + } + // Remove the last path separator + --cur_write_ptr; + assert(cur_write_ptr - (*override_paths) < (ptrdiff_t)override_path_size); + *cur_write_ptr = '\0'; + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Override layer has override paths set to %s", + *override_paths); } + return VK_SUCCESS; +} - // Get a list of manifest files for explicit layers - if (VK_SUCCESS != loader_get_data_files(inst, LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER, override_paths, &manifest_files)) { +VkResult loader_scan_for_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers, + const struct loader_envvar_all_filters *filters) { + VkResult res = VK_SUCCESS; + struct loader_layer_list settings_layers = {0}; + struct loader_layer_list regular_instance_layers = {0}; + bool override_layer_valid = false; + char *override_paths = NULL; + + bool should_search_for_other_layers = true; + res = get_settings_layers(inst, &settings_layers, &should_search_for_other_layers); + if (VK_SUCCESS != res) { goto out; } - // Make sure we have at least one layer, if not, go ahead and return - if (manifest_files.count == 0 && total_count == 0) { + // If we should not look for layers using other mechanisms, assign settings_layers to instance_layers and jump to the + // output + if (!should_search_for_other_layers) { + *instance_layers = settings_layers; + memset(&settings_layers, 0, sizeof(struct loader_layer_list)); goto out; - } else { - for (uint32_t i = 0; i < manifest_files.count; i++) { - file_str = manifest_files.filename_list[i]; - if (file_str == NULL) { - continue; - } + } - // Parse file into JSON struct - VkResult res = loader_get_json(inst, file_str, &json); - if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { - goto out; - } else if (VK_SUCCESS != res || NULL == json) { - continue; - } + res = loader_parse_instance_layers(inst, LOADER_DATA_FILE_MANIFEST_IMPLICIT_LAYER, NULL, ®ular_instance_layers); + if (VK_SUCCESS != res) { + goto out; + } - VkResult local_res = loader_add_layer_properties(inst, instance_layers, json, false, file_str); - cJSON_Delete(json); + // Remove any extraneous override layers. + remove_all_non_valid_override_layers(inst, ®ular_instance_layers); - // If the error is anything other than out of memory we still want to try to load the other layers - if (VK_ERROR_OUT_OF_HOST_MEMORY == local_res) { + // Check to see if the override layer is present, and use it's override paths. + for (uint32_t i = 0; i < regular_instance_layers.count; i++) { + struct loader_layer_properties *prop = ®ular_instance_layers.list[i]; + if (prop->is_override && loader_implicit_layer_is_enabled(inst, filters, prop) && prop->override_paths.count > 0) { + res = get_override_layer_override_paths(inst, prop, &override_paths); + if (VK_SUCCESS != res) { goto out; } + break; } } + // Get a list of manifest files for explicit layers + res = loader_parse_instance_layers(inst, LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER, override_paths, ®ular_instance_layers); + if (VK_SUCCESS != res) { + goto out; + } + // Verify any meta-layers in the list are valid and all the component layers are // actually present in the available layer list - verify_all_meta_layers(inst, instance_layers, &override_layer_valid); + res = verify_all_meta_layers(inst, filters, ®ular_instance_layers, &override_layer_valid); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + return res; + } if (override_layer_valid) { - loader_remove_layers_in_blacklist(inst, instance_layers); + loader_remove_layers_in_blacklist(inst, ®ular_instance_layers); if (NULL != inst) { inst->override_layer_present = true; } } + // Remove disabled layers + for (uint32_t i = 0; i < regular_instance_layers.count; ++i) { + if (!loader_layer_is_available(inst, filters, ®ular_instance_layers.list[i])) { + loader_remove_layer_in_list(inst, ®ular_instance_layers, i); + i--; + } + } + + res = combine_settings_layers_with_regular_layers(inst, &settings_layers, ®ular_instance_layers, instance_layers); + out: + loader_delete_layer_list_and_properties(inst, &settings_layers); + loader_delete_layer_list_and_properties(inst, ®ular_instance_layers); loader_instance_heap_free(inst, override_paths); - if (NULL != manifest_files.filename_list) { - for (uint32_t i = 0; i < manifest_files.count; i++) { - loader_instance_heap_free(inst, manifest_files.filename_list[i]); - } - loader_instance_heap_free(inst, manifest_files.filename_list); - } - loader_platform_thread_unlock_mutex(&loader_json_lock); + return res; } -void loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers) { - char *file_str; - struct loader_data_files manifest_files; - cJSON *json; +VkResult loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers, + const struct loader_envvar_all_filters *layer_filters) { + VkResult res = VK_SUCCESS; + struct loader_layer_list settings_layers = {0}; + struct loader_layer_list regular_instance_layers = {0}; bool override_layer_valid = false; char *override_paths = NULL; bool implicit_metalayer_present = false; - bool have_json_lock = false; - // Before we begin anything, init manifest_files to avoid a delete of garbage memory if - // a failure occurs before allocating the manifest filename_list. - memset(&manifest_files, 0, sizeof(struct loader_data_files)); - - VkResult res = loader_get_data_files(inst, LOADER_DATA_FILE_MANIFEST_IMPLICIT_LAYER, NULL, &manifest_files); - if (VK_SUCCESS != res || manifest_files.count == 0) { + bool should_search_for_other_layers = true; + res = get_settings_layers(inst, &settings_layers, &should_search_for_other_layers); + if (VK_SUCCESS != res) { goto out; } - // Cleanup any previously scanned libraries - loader_delete_layer_list_and_properties(inst, instance_layers); - - loader_platform_thread_lock_mutex(&loader_json_lock); - have_json_lock = true; - - for (uint32_t i = 0; i < manifest_files.count; i++) { - file_str = manifest_files.filename_list[i]; - if (file_str == NULL) { - continue; - } - - // parse file into JSON struct - res = loader_get_json(inst, file_str, &json); - if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { - goto out; - } else if (VK_SUCCESS != res || NULL == json) { - continue; - } - - res = loader_add_layer_properties(inst, instance_layers, json, true, file_str); - - loader_instance_heap_free(inst, file_str); - manifest_files.filename_list[i] = NULL; - cJSON_Delete(json); + // If we should not look for layers using other mechanisms, assign settings_layers to instance_layers and jump to the + // output + if (!should_search_for_other_layers) { + *instance_layers = settings_layers; + memset(&settings_layers, 0, sizeof(struct loader_layer_list)); + goto out; + } - if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { - goto out; - } + res = loader_parse_instance_layers(inst, LOADER_DATA_FILE_MANIFEST_IMPLICIT_LAYER, NULL, ®ular_instance_layers); + if (VK_SUCCESS != res) { + goto out; } // Remove any extraneous override layers. - remove_all_non_valid_override_layers(inst, instance_layers); + remove_all_non_valid_override_layers(inst, ®ular_instance_layers); // Check to see if either the override layer is present, or another implicit meta-layer. // Each of these may require explicit layers to be enabled at this time. - for (int32_t i = 0; i < (int32_t)instance_layers->count; i++) { - struct loader_layer_properties *prop = &instance_layers->list[i]; - if (prop->is_override && loader_implicit_layer_is_enabled(inst, prop)) { + for (uint32_t i = 0; i < regular_instance_layers.count; i++) { + struct loader_layer_properties *prop = ®ular_instance_layers.list[i]; + if (prop->is_override && loader_implicit_layer_is_enabled(inst, layer_filters, prop)) { override_layer_valid = true; - if (prop->num_override_paths > 0) { - char *cur_write_ptr = NULL; - size_t override_path_size = 0; - for (uint32_t j = 0; j < prop->num_override_paths; j++) { - override_path_size += determine_data_file_path_size(prop->override_paths[j], 0); - } - override_paths = loader_instance_heap_alloc(inst, override_path_size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (override_paths == NULL) { - goto out; - } - cur_write_ptr = &override_paths[0]; - for (uint32_t j = 0; j < prop->num_override_paths; j++) { - copy_data_file_info(prop->override_paths[j], NULL, 0, &cur_write_ptr); - } - // Remove the last path separator - --cur_write_ptr; - assert(cur_write_ptr - override_paths < (ptrdiff_t)override_path_size); - *cur_write_ptr = '\0'; - loader_log(NULL, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_scan_for_implicit_layers: Override layer has override paths set to %s", override_paths); + res = get_override_layer_override_paths(inst, prop, &override_paths); + if (VK_SUCCESS != res) { + goto out; } } else if (!prop->is_override && prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) { implicit_metalayer_present = true; @@ -3782,72 +3882,63 @@ void loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader // explicit layer info as well. Not to worry, though, all explicit layers not included // in the override layer will be removed below in loader_remove_layers_in_blacklist(). if (override_layer_valid || implicit_metalayer_present) { - if (VK_SUCCESS != loader_get_data_files(inst, LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER, override_paths, &manifest_files)) { + res = + loader_parse_instance_layers(inst, LOADER_DATA_FILE_MANIFEST_EXPLICIT_LAYER, override_paths, ®ular_instance_layers); + if (VK_SUCCESS != res) { goto out; } - - for (uint32_t i = 0; i < manifest_files.count; i++) { - file_str = manifest_files.filename_list[i]; - if (file_str == NULL) { - continue; - } - - // parse file into JSON struct - res = loader_get_json(inst, file_str, &json); - if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { - goto out; - } else if (VK_SUCCESS != res || NULL == json) { - continue; - } - - res = loader_add_layer_properties(inst, instance_layers, json, false, file_str); - - loader_instance_heap_free(inst, file_str); - manifest_files.filename_list[i] = NULL; - cJSON_Delete(json); - - if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { - goto out; - } - } } // Verify any meta-layers in the list are valid and all the component layers are // actually present in the available layer list - verify_all_meta_layers(inst, instance_layers, &override_layer_valid); + res = verify_all_meta_layers(inst, layer_filters, ®ular_instance_layers, &override_layer_valid); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + return res; + } if (override_layer_valid || implicit_metalayer_present) { - loader_remove_layers_not_in_implicit_meta_layers(inst, instance_layers); + loader_remove_layers_not_in_implicit_meta_layers(inst, ®ular_instance_layers); if (override_layer_valid && inst != NULL) { inst->override_layer_present = true; } } + // Remove disabled layers + for (uint32_t i = 0; i < regular_instance_layers.count; ++i) { + if (!loader_implicit_layer_is_enabled(inst, layer_filters, ®ular_instance_layers.list[i])) { + loader_remove_layer_in_list(inst, ®ular_instance_layers, i); + i--; + } + } + + res = combine_settings_layers_with_regular_layers(inst, &settings_layers, ®ular_instance_layers, instance_layers); + out: + loader_delete_layer_list_and_properties(inst, &settings_layers); + loader_delete_layer_list_and_properties(inst, ®ular_instance_layers); loader_instance_heap_free(inst, override_paths); - for (uint32_t i = 0; i < manifest_files.count; i++) { - loader_instance_heap_free(inst, manifest_files.filename_list[i]); - } - loader_instance_heap_free(inst, manifest_files.filename_list); - - if (have_json_lock) { - loader_platform_thread_unlock_mutex(&loader_json_lock); - } + return res; } -static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_terminator(VkInstance inst, const char *pName) { +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_terminator(VkInstance inst, const char *pName) { // inst is not wrapped if (inst == VK_NULL_HANDLE) { return NULL; } + VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; - void *addr; if (disp_table == NULL) return NULL; + struct loader_instance *loader_inst = loader_get_instance(inst); + + if (loader_inst->instance_finished_creation) { + disp_table = &loader_inst->terminator_dispatch; + } + bool found_name; - addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); + void *addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); if (found_name) { return addr; } @@ -3861,7 +3952,8 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_terminator return NULL; } -static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_instance_terminator(VkInstance inst, const char *pName) { +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_instance_terminator(VkInstance inst, const char *pName) { + // Global functions - Do not need a valid instance handle to query if (!strcmp(pName, "vkGetInstanceProcAddr")) { return (PFN_vkVoidFunction)loader_gpa_instance_terminator; } @@ -3871,47 +3963,70 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_instance_terminator(V if (!strcmp(pName, "vkCreateInstance")) { return (PFN_vkVoidFunction)terminator_CreateInstance; } + + // While the spec is very clear that querying vkCreateDevice requires a valid VkInstance, because the loader allowed querying + // with a NULL VkInstance handle for a long enough time, it is impractical to fix this bug in the loader + + // As such, this is a bug to maintain compatibility for the RTSS layer (Riva Tuner Statistics Server) but may + // be depended upon by other layers out in the wild. if (!strcmp(pName, "vkCreateDevice")) { return (PFN_vkVoidFunction)terminator_CreateDevice; } - // The VK_EXT_debug_utils functions need a special case here so the terminators can still be found from vkGetInstanceProcAddr + // inst is not wrapped + if (inst == VK_NULL_HANDLE) { + return NULL; + } + VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; + + if (disp_table == NULL) return NULL; + + struct loader_instance *loader_inst = loader_get_instance(inst); + + // The VK_EXT_debug_utils functions need a special case here so the terminators can still be found from + // vkGetInstanceProcAddr This is because VK_EXT_debug_utils is an instance level extension with device level functions, and + // is 'supported' by the loader. + // These functions need a terminator to handle the case of a driver not supporting VK_EXT_debug_utils when there are layers + // present which not check for NULL before calling the function. if (!strcmp(pName, "vkSetDebugUtilsObjectNameEXT")) { - return (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectNameEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectNameEXT + : NULL; } if (!strcmp(pName, "vkSetDebugUtilsObjectTagEXT")) { - return (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectTagEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_SetDebugUtilsObjectTagEXT + : NULL; } if (!strcmp(pName, "vkQueueBeginDebugUtilsLabelEXT")) { - return (PFN_vkVoidFunction)terminator_QueueBeginDebugUtilsLabelEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_QueueBeginDebugUtilsLabelEXT + : NULL; } if (!strcmp(pName, "vkQueueEndDebugUtilsLabelEXT")) { - return (PFN_vkVoidFunction)terminator_QueueEndDebugUtilsLabelEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_QueueEndDebugUtilsLabelEXT + : NULL; } if (!strcmp(pName, "vkQueueInsertDebugUtilsLabelEXT")) { - return (PFN_vkVoidFunction)terminator_QueueInsertDebugUtilsLabelEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_QueueInsertDebugUtilsLabelEXT + : NULL; } if (!strcmp(pName, "vkCmdBeginDebugUtilsLabelEXT")) { - return (PFN_vkVoidFunction)terminator_CmdBeginDebugUtilsLabelEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_CmdBeginDebugUtilsLabelEXT + : NULL; } if (!strcmp(pName, "vkCmdEndDebugUtilsLabelEXT")) { - return (PFN_vkVoidFunction)terminator_CmdEndDebugUtilsLabelEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_CmdEndDebugUtilsLabelEXT + : NULL; } if (!strcmp(pName, "vkCmdInsertDebugUtilsLabelEXT")) { - return (PFN_vkVoidFunction)terminator_CmdInsertDebugUtilsLabelEXT; + return loader_inst->enabled_known_extensions.ext_debug_utils ? (PFN_vkVoidFunction)terminator_CmdInsertDebugUtilsLabelEXT + : NULL; } - // inst is not wrapped - if (inst == VK_NULL_HANDLE) { - return NULL; + if (loader_inst->instance_finished_creation) { + disp_table = &loader_inst->terminator_dispatch; } - VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; - void *addr; - - if (disp_table == NULL) return NULL; bool found_name; - addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); + void *addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); if (found_name) { return addr; } @@ -3951,9 +4066,19 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_device_terminator(VkDevice d // object before passing the appropriate info along to the ICD. // This is why we also have to override the direct ICD call to // vkGetDeviceProcAddr to intercept those calls. - PFN_vkVoidFunction addr = get_extension_device_proc_terminator(dev, pName); - if (NULL != addr) { - return addr; + // If the pName is for a 'known' function but isn't available, due to + // the corresponding extension/feature not being enabled, we need to + // return NULL and not call down to the driver's GetDeviceProcAddr. + if (NULL != dev) { + bool found_name = false; + PFN_vkVoidFunction addr = get_extension_device_proc_terminator(dev, pName, &found_name); + if (found_name) { + return addr; + } + } + + if (icd_term == NULL) { + return NULL; } return icd_term->dispatch.GetDeviceProcAddr(device, pName); @@ -3981,7 +4106,7 @@ struct loader_instance *loader_get_instance(const VkInstance instance) { return ptr_instance; } -static loader_platform_dl_handle loader_open_layer_file(const struct loader_instance *inst, struct loader_layer_properties *prop) { +loader_platform_dl_handle loader_open_layer_file(const struct loader_instance *inst, struct loader_layer_properties *prop) { if ((prop->lib_handle = loader_platform_open_library(prop->lib_name)) == NULL) { loader_handle_load_library_error(inst, prop->lib_name, &prop->lib_status); } else { @@ -3992,123 +4117,89 @@ static loader_platform_dl_handle loader_open_layer_file(const struct loader_inst return prop->lib_handle; } -static void loader_close_layer_file(const struct loader_instance *inst, struct loader_layer_properties *prop) { - if (prop->lib_handle) { - loader_platform_close_library(prop->lib_handle); - loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Unloading layer library %s", prop->lib_name); - prop->lib_handle = NULL; - } -} - -void loader_deactivate_layers(const struct loader_instance *instance, struct loader_device *device, - struct loader_layer_list *list) { - // Delete instance list of enabled layers and close any layer libraries - for (uint32_t i = 0; i < list->count; i++) { - struct loader_layer_properties *layer_prop = &list->list[i]; - - loader_close_layer_file(instance, layer_prop); - } - loader_destroy_layer_list(instance, device, list); -} - // Go through the search_list and find any layers which match type. If layer // type match is found in then add it to ext_list. -static void loader_add_implicit_layers(const struct loader_instance *inst, struct loader_layer_list *target_list, - struct loader_layer_list *expanded_target_list, - const struct loader_layer_list *source_list) { +VkResult loader_add_implicit_layers(const struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + struct loader_pointer_layer_list *target_list, + struct loader_pointer_layer_list *expanded_target_list, + const struct loader_layer_list *source_list) { for (uint32_t src_layer = 0; src_layer < source_list->count; src_layer++) { - const struct loader_layer_properties *prop = &source_list->list[src_layer]; + struct loader_layer_properties *prop = &source_list->list[src_layer]; if (0 == (prop->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER)) { - loader_add_implicit_layer(inst, prop, target_list, expanded_target_list, source_list); + VkResult result = loader_add_implicit_layer(inst, prop, filters, target_list, expanded_target_list, source_list); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) return result; } } + return VK_SUCCESS; } -// Get the layer name(s) from the env_name environment variable. If layer is found in -// search_list then add it to layer_list. But only add it to layer_list if type_flags matches. -static VkResult loader_add_environment_layers(struct loader_instance *inst, const enum layer_type_flags type_flags, - const char *env_name, struct loader_layer_list *target_list, - struct loader_layer_list *expanded_target_list, - const struct loader_layer_list *source_list) { - VkResult res = VK_SUCCESS; - char *next, *name; - char *layer_env = loader_getenv(env_name, inst); - if (layer_env == NULL) { - goto out; - } - name = loader_stack_alloc(strlen(layer_env) + 1); - if (name == NULL) { - goto out; - } - strcpy(name, layer_env); - - loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_add_environment_layers: Env Var %s defined and adding layers %s", env_name, name); - - while (name && *name) { - next = loader_get_next_path(name); - res = loader_add_layer_name_to_list(inst, name, type_flags, source_list, target_list, expanded_target_list); - if (res != VK_SUCCESS) { - goto out; +void warn_if_layers_are_older_than_application(struct loader_instance *inst) { + for (uint32_t i = 0; i < inst->expanded_activated_layer_list.count; i++) { + // Verify that the layer api version is at least that of the application's request, if not, throw a warning since + // undefined behavior could occur. + struct loader_layer_properties *prop = inst->expanded_activated_layer_list.list[i]; + loader_api_version prop_spec_version = loader_make_version(prop->info.specVersion); + if (!loader_check_version_meets_required(inst->app_api_version, prop_spec_version)) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Layer %s uses API version %u.%u which is older than the application specified " + "API version of %u.%u. May cause issues.", + prop->info.layerName, prop_spec_version.major, prop_spec_version.minor, inst->app_api_version.major, + inst->app_api_version.minor); } - name = next; - } - -out: - - if (layer_env != NULL) { - loader_free_getenv(layer_env, inst); - } - - return res; + } } VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkInstanceCreateInfo *pCreateInfo, - const struct loader_layer_list *instance_layers) { + const struct loader_layer_list *instance_layers, + const struct loader_envvar_all_filters *layer_filters) { + VkResult res = VK_SUCCESS; + assert(inst && "Cannot have null instance"); - if (!loader_init_layer_list(inst, &inst->app_activated_layer_list)) { + if (!loader_init_pointer_layer_list(inst, &inst->app_activated_layer_list)) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_enable_instance_layers: Failed to initialize application version of the layer list"); - return VK_ERROR_OUT_OF_HOST_MEMORY; + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; } - if (!loader_init_layer_list(inst, &inst->expanded_activated_layer_list)) { + if (!loader_init_pointer_layer_list(inst, &inst->expanded_activated_layer_list)) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_enable_instance_layers: Failed to initialize expanded version of the layer list"); - return VK_ERROR_OUT_OF_HOST_MEMORY; + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + + if (inst->settings.settings_active) { + res = enable_correct_layers_from_settings(inst, layer_filters, pCreateInfo->enabledLayerCount, + pCreateInfo->ppEnabledLayerNames, &inst->instance_layer_list, + &inst->app_activated_layer_list, &inst->expanded_activated_layer_list); + warn_if_layers_are_older_than_application(inst); + + goto out; } // Add any implicit layers first - loader_add_implicit_layers(inst, &inst->app_activated_layer_list, &inst->expanded_activated_layer_list, instance_layers); + res = loader_add_implicit_layers(inst, layer_filters, &inst->app_activated_layer_list, &inst->expanded_activated_layer_list, + instance_layers); + if (res != VK_SUCCESS) { + goto out; + } // Add any layers specified via environment variable next - VkResult err = - loader_add_environment_layers(inst, VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER, "VK_INSTANCE_LAYERS", - &inst->app_activated_layer_list, &inst->expanded_activated_layer_list, instance_layers); - if (err != VK_SUCCESS) { - return err; + res = loader_add_environment_layers(inst, VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER, layer_filters, &inst->app_activated_layer_list, + &inst->expanded_activated_layer_list, instance_layers); + if (res != VK_SUCCESS) { + goto out; } // Add layers specified by the application - err = loader_add_layer_names_to_list(inst, &inst->app_activated_layer_list, &inst->expanded_activated_layer_list, + res = loader_add_layer_names_to_list(inst, layer_filters, &inst->app_activated_layer_list, &inst->expanded_activated_layer_list, pCreateInfo->enabledLayerCount, pCreateInfo->ppEnabledLayerNames, instance_layers); - for (uint32_t i = 0; i < inst->expanded_activated_layer_list.count; i++) { - // Verify that the layer api version is at least that of the application's request, if not, throw a warning since - // undefined behavior could occur. - struct loader_layer_properties *prop = inst->expanded_activated_layer_list.list + i; - loader_api_version prop_spec_version = loader_make_version(prop->info.specVersion); - if (!loader_check_version_meets_required(inst->app_api_version, prop_spec_version)) { - loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "Layer %s uses API version %u.%u which is older than the application specified " - "API version of %u.%u. May cause issues.", - prop->info.layerName, prop_spec_version.major, prop_spec_version.minor, inst->app_api_version.major, - inst->app_api_version.minor); - } - } - - return err; + warn_if_layers_are_older_than_application(inst); +out: + return res; } // Determine the layer interface version to use. @@ -4141,6 +4232,33 @@ bool loader_get_layer_interface_version(PFN_vkNegotiateLoaderLayerInterfaceVersi return true; } +// 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, + const struct loader_extension_list *icd_exts, + const VkDeviceCreateInfo *pCreateInfo) { + // Can only setup debug marker as debug utils is an instance extensions. + for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) { + if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { + // Check if its supported by the driver + for (uint32_t j = 0; j < icd_exts->count; ++j) { + if (!strcmp(icd_exts->list[j].extensionName, VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { + dev->layer_extensions.ext_debug_marker_enabled = true; + } + } + // also check if any layers support it. + for (uint32_t j = 0; j < inst->app_activated_layer_list.count; j++) { + struct loader_layer_properties *layer = inst->app_activated_layer_list.list[j]; + for (uint32_t k = 0; k < layer->device_extension_list.count; k++) { + if (!strcmp(layer->device_extension_list.list[k].props.extensionName, VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { + dev->layer_extensions.ext_debug_marker_enabled = true; + } + } + } + } + } +} + VKAPI_ATTR VkResult VKAPI_CALL loader_layer_create_device(VkInstance instance, VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, @@ -4160,7 +4278,7 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_layer_create_device(VkInstance instance, V } // Get the physical device (ICD) extensions - struct loader_extension_list icd_exts; + struct loader_extension_list icd_exts = {0}; icd_exts.list = NULL; res = loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties)); if (VK_SUCCESS != res) { @@ -4194,47 +4312,7 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_layer_create_device(VkInstance instance, V goto out; } - // Copy the application enabled instance layer list into the device - if (NULL != inst->app_activated_layer_list.list) { - dev->app_activated_layer_list.capacity = inst->app_activated_layer_list.capacity; - dev->app_activated_layer_list.count = inst->app_activated_layer_list.count; - dev->app_activated_layer_list.list = - loader_device_heap_alloc(dev, inst->app_activated_layer_list.capacity, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); - if (dev->app_activated_layer_list.list == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "vkCreateDevice: Failed to allocate application activated layer list of size %d.", - inst->app_activated_layer_list.capacity); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - memcpy(dev->app_activated_layer_list.list, inst->app_activated_layer_list.list, - sizeof(*dev->app_activated_layer_list.list) * dev->app_activated_layer_list.count); - } else { - dev->app_activated_layer_list.capacity = 0; - dev->app_activated_layer_list.count = 0; - dev->app_activated_layer_list.list = NULL; - } - - // Copy the expanded enabled instance layer list into the device - if (NULL != inst->expanded_activated_layer_list.list) { - dev->expanded_activated_layer_list.capacity = inst->expanded_activated_layer_list.capacity; - dev->expanded_activated_layer_list.count = inst->expanded_activated_layer_list.count; - dev->expanded_activated_layer_list.list = - loader_device_heap_alloc(dev, inst->expanded_activated_layer_list.capacity, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); - if (dev->expanded_activated_layer_list.list == NULL) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "vkCreateDevice: Failed to allocate expanded activated layer list of size %d.", - inst->expanded_activated_layer_list.capacity); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } - memcpy(dev->expanded_activated_layer_list.list, inst->expanded_activated_layer_list.list, - sizeof(*dev->expanded_activated_layer_list.list) * dev->expanded_activated_layer_list.count); - } else { - dev->expanded_activated_layer_list.capacity = 0; - dev->expanded_activated_layer_list.count = 0; - dev->expanded_activated_layer_list.list = NULL; - } + setup_logical_device_enabled_layer_extensions(inst, dev, &icd_exts, pCreateInfo); res = loader_create_device_chain(internal_device, pCreateInfo, pAllocator, inst, dev, layerGIPA, nextGDPA); if (res != VK_SUCCESS) { @@ -4283,7 +4361,7 @@ out: icd_term = icd_term->next; } // Now destroy the device and the allocations associated with it. - loader_destroy_logical_device(inst, dev, pAllocator); + loader_destroy_logical_device(dev, pAllocator); } } @@ -4302,12 +4380,13 @@ VKAPI_ATTR void VKAPI_CALL loader_layer_destroy_device(VkDevice device, const Vk } struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, NULL); - const struct loader_instance *inst = icd_term->this_instance; destroyFunction(device, pAllocator); - dev->chain_device = NULL; - dev->icd_device = NULL; - loader_remove_logical_device(inst, icd_term, dev, pAllocator); + if (NULL != dev) { + dev->chain_device = NULL; + dev->icd_device = NULL; + loader_remove_logical_device(icd_term, dev, pAllocator); + } } // Given the list of layers to activate in the loader_instance @@ -4366,7 +4445,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c // Create instance chain of enabled layers for (int32_t i = inst->expanded_activated_layer_list.count - 1; i >= 0; i--) { - struct loader_layer_properties *layer_prop = &inst->expanded_activated_layer_list.list[i]; + struct loader_layer_properties *layer_prop = inst->expanded_activated_layer_list.list[i]; loader_platform_dl_handle lib_handle; // Skip it if a Layer with the same name has been already successfully activated @@ -4375,6 +4454,9 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c } lib_handle = loader_open_layer_file(inst, layer_prop); + if (layer_prop->lib_status == LOADER_LAYER_LIB_ERROR_OUT_OF_MEMORY) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } if (!lib_handle) { continue; } @@ -4382,7 +4464,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c if (NULL == layer_prop->functions.negotiate_layer_interface) { PFN_vkNegotiateLoaderLayerInterfaceVersion negotiate_interface = NULL; bool functions_in_interface = false; - if (strlen(layer_prop->functions.str_negotiate_interface) == 0) { + if (!layer_prop->functions.str_negotiate_interface || strlen(layer_prop->functions.str_negotiate_interface) == 0) { negotiate_interface = (PFN_vkNegotiateLoaderLayerInterfaceVersion)loader_platform_get_proc_address( lib_handle, "vkNegotiateLoaderLayerInterfaceVersion"); } else { @@ -4423,14 +4505,14 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c if (!functions_in_interface) { if ((cur_gipa = layer_prop->functions.get_instance_proc_addr) == NULL) { - if (strlen(layer_prop->functions.str_gipa) == 0) { + if (layer_prop->functions.str_gipa == NULL || strlen(layer_prop->functions.str_gipa) == 0) { cur_gipa = (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, "vkGetInstanceProcAddr"); layer_prop->functions.get_instance_proc_addr = cur_gipa; if (NULL == cur_gipa) { loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_create_instance_chain: Failed to find \'vkGetInstanceProcAddr\' in layer %s", + "loader_create_instance_chain: Failed to find \'vkGetInstanceProcAddr\' in layer \"%s\"", layer_prop->lib_name); continue; } @@ -4440,7 +4522,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c if (NULL == cur_gipa) { loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_create_instance_chain: Failed to find \'%s\' in layer %s", + "loader_create_instance_chain: Failed to find \'%s\' in layer \"%s\"", layer_prop->functions.str_gipa, layer_prop->lib_name); continue; } @@ -4474,7 +4556,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c activated_layers[num_activated_layers].disable_env = layer_prop->disable_env_var.name; } - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Insert instance layer %s (%s)", + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Insert instance layer \"%s\" (%s)", layer_prop->info.layerName, layer_prop->lib_name); num_activated_layers++; @@ -4483,7 +4565,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c // Make sure each layer requested by the application was actually loaded for (uint32_t exp = 0; exp < inst->expanded_activated_layer_list.count; ++exp) { - struct loader_layer_properties *exp_layer_prop = &inst->expanded_activated_layer_list.list[exp]; + struct loader_layer_properties *exp_layer_prop = inst->expanded_activated_layer_list.list[exp]; bool found = false; for (uint32_t act = 0; act < num_activated_layers; ++act) { if (!strcmp(activated_layers[act].name, exp_layer_prop->info.layerName)) { @@ -4511,17 +4593,20 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c } switch (exp_layer_prop->lib_status) { case LOADER_LAYER_LIB_NOT_LOADED: - loader_log(inst, log_flag, 0, "Requested layer %s was not loaded%c", exp_layer_prop->info.layerName, ending); + loader_log(inst, log_flag, 0, "Requested layer \"%s\" was not loaded%c", exp_layer_prop->info.layerName, + ending); break; case LOADER_LAYER_LIB_ERROR_WRONG_BIT_TYPE: { - loader_log(inst, log_flag, 0, "Requested layer %s was wrong bit-type%c", exp_layer_prop->info.layerName, + loader_log(inst, log_flag, 0, "Requested layer \"%s\" was wrong bit-type%c", exp_layer_prop->info.layerName, ending); break; } case LOADER_LAYER_LIB_ERROR_FAILED_TO_LOAD: - loader_log(inst, log_flag, 0, "Requested layer %s failed to load%c", exp_layer_prop->info.layerName, ending); + loader_log(inst, log_flag, 0, "Requested layer \"%s\" failed to load%c", exp_layer_prop->info.layerName, + ending); break; case LOADER_LAYER_LIB_SUCCESS_LOADED: + case LOADER_LAYER_LIB_ERROR_OUT_OF_MEMORY: // Shouldn't be able to reach this but if it is, best to report a debug loader_log(inst, log_flag, 0, "Shouldn't reach this. A valid version of requested layer %s was loaded but was not found in the " @@ -4565,27 +4650,25 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c // If layer debugging is enabled, let's print out the full callstack with layers in their // defined order. - if ((loader_get_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) { - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "vkCreateInstance layer callstack setup to:"); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " "); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " ||"); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " "); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "vkCreateInstance layer callstack setup to:"); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " "); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " ||"); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " "); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " ||"); + for (uint32_t cur_layer = 0; cur_layer < num_activated_layers; ++cur_layer) { + uint32_t index = num_activated_layers - cur_layer - 1; + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " %s", activated_layers[index].name); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Type: %s", + activated_layers[index].is_implicit ? "Implicit" : "Explicit"); + if (activated_layers[index].is_implicit) { + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Disable Env Var: %s", + activated_layers[index].disable_env); + } + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Manifest: %s", activated_layers[index].manifest); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Library: %s", activated_layers[index].library); loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " ||"); - for (uint32_t cur_layer = 0; cur_layer < num_activated_layers; ++cur_layer) { - uint32_t index = num_activated_layers - cur_layer - 1; - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " %s", activated_layers[index].name); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Type: %s", - activated_layers[index].is_implicit ? "Implicit" : "Explicit"); - if (activated_layers[index].is_implicit) { - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Disable Env Var: %s", - activated_layers[index].disable_env); - } - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Manifest: %s", activated_layers[index].manifest); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Library: %s", activated_layers[index].library); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " ||"); - } - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " \n"); } + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " "); res = fpCreateInstance(&loader_create_info, pAllocator, created_instance); } else { @@ -4595,8 +4678,24 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c } if (res == VK_SUCCESS) { + // Copy the current disp table into the terminator_dispatch table so we can use it in loader_gpa_instance_terminator() + memcpy(&inst->terminator_dispatch, &inst->disp->layer_inst_disp, sizeof(VkLayerInstanceDispatchTable)); + 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; + } + + 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; + } + } } return res; @@ -4607,16 +4706,23 @@ void loader_activate_instance_layer_extensions(struct loader_instance *inst, VkI created_inst); } +#if defined(__APPLE__) +VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, const struct loader_instance *inst, + struct loader_device *dev, PFN_vkGetInstanceProcAddr callingLayer, + PFN_vkGetDeviceProcAddr *layerNextGDPA) __attribute__((optnone)) { +#else VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, const struct loader_instance *inst, struct loader_device *dev, PFN_vkGetInstanceProcAddr callingLayer, PFN_vkGetDeviceProcAddr *layerNextGDPA) { +#endif uint32_t num_activated_layers = 0; struct activated_layer_info *activated_layers = NULL; 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; @@ -4624,8 +4730,36 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre memcpy(&loader_create_info, pCreateInfo, sizeof(VkDeviceCreateInfo)); + if (loader_create_info.enabledLayerCount > 0 && loader_create_info.ppEnabledLayerNames != NULL) { + bool invalid_device_layer_usage = false; + + if (loader_create_info.enabledLayerCount != inst->enabled_layer_names.count && loader_create_info.enabledLayerCount > 0) { + invalid_device_layer_usage = true; + } else if (loader_create_info.enabledLayerCount > 0 && loader_create_info.ppEnabledLayerNames == NULL) { + invalid_device_layer_usage = true; + } else if (loader_create_info.enabledLayerCount == 0 && loader_create_info.ppEnabledLayerNames != NULL) { + invalid_device_layer_usage = true; + } else if (inst->enabled_layer_names.list != NULL) { + for (uint32_t i = 0; i < loader_create_info.enabledLayerCount; i++) { + const char *device_layer_names = loader_create_info.ppEnabledLayerNames[i]; + + if (strcmp(device_layer_names, inst->enabled_layer_names.list[i]) != 0) { + invalid_device_layer_usage = true; + break; + } + } + } + + if (invalid_device_layer_usage) { + loader_log( + inst, VULKAN_LOADER_WARN_BIT, 0, + "loader_create_device_chain: Using deprecated and ignored 'ppEnabledLayerNames' member of 'VkDeviceCreateInfo' " + "when creating a Vulkan device."); + } + } + // Before we continue, we need to find out if the KHR_device_group extension is in the enabled list. If it is, we then - // need to look for the corresponding VkDeviceGroupDeviceCreateInfoKHR struct in the device list. This is because we + // need to look for the corresponding VkDeviceGroupDeviceCreateInfo struct in the device list. This is because we // need to replace all the incoming physical device values (which are really loader trampoline physical device values) // with the layer/ICD version. { @@ -4633,14 +4767,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; @@ -4655,7 +4789,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; @@ -4667,8 +4801,8 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre pNext = pNext->pNext; } } - if (dev->expanded_activated_layer_list.count > 0) { - layer_device_link_info = loader_stack_alloc(sizeof(VkLayerDeviceLink) * dev->expanded_activated_layer_list.count); + if (inst->expanded_activated_layer_list.count > 0) { + layer_device_link_info = loader_stack_alloc(sizeof(VkLayerDeviceLink) * inst->expanded_activated_layer_list.count); if (!layer_device_link_info) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "loader_create_device_chain: Failed to alloc Device objects for layer. Skipping Layer."); @@ -4689,8 +4823,8 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre loader_create_info.pNext = &chain_info; // Create instance chain of enabled layers - for (int32_t i = dev->expanded_activated_layer_list.count - 1; i >= 0; i--) { - struct loader_layer_properties *layer_prop = &dev->expanded_activated_layer_list.list[i]; + for (int32_t i = inst->expanded_activated_layer_list.count - 1; i >= 0; i--) { + struct loader_layer_properties *layer_prop = inst->expanded_activated_layer_list.list[i]; loader_platform_dl_handle lib_handle = layer_prop->lib_handle; // Skip it if a Layer with the same name has been already successfully activated @@ -4698,8 +4832,8 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre continue; } - // Skip the layer if the handle is NULL - this is likely because the library failed to load but wasn't removed from the - // list. + // Skip the layer if the handle is NULL - this is likely because the library failed to load but wasn't removed from + // the list. if (!lib_handle) { continue; } @@ -4707,7 +4841,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre // The Get*ProcAddr pointers will already be filled in if they were received from either the json file or the // version negotiation if ((fpGIPA = layer_prop->functions.get_instance_proc_addr) == NULL) { - if (strlen(layer_prop->functions.str_gipa) == 0) { + if (layer_prop->functions.str_gipa == NULL || strlen(layer_prop->functions.str_gipa) == 0) { fpGIPA = (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, "vkGetInstanceProcAddr"); layer_prop->functions.get_instance_proc_addr = fpGIPA; } else @@ -4715,7 +4849,8 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, layer_prop->functions.str_gipa); if (!fpGIPA) { loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "loader_create_device_chain: Failed to find \'vkGetInstanceProcAddr\' in layer %s. Skipping layer.", + "loader_create_device_chain: Failed to find \'vkGetInstanceProcAddr\' in layer \"%s\". " + "Skipping layer.", layer_prop->lib_name); continue; } @@ -4725,20 +4860,20 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre if (layerNextGDPA != NULL) { *layerNextGDPA = nextGDPA; } - // Break here because if fpGIPA is the same as callingLayer, that means a layer is trying to create a device, and - // once we don't want to continue any further as the next layer will be the calling layer + // Break here because if fpGIPA is the same as callingLayer, that means a layer is trying to create a device, + // and once we don't want to continue any further as the next layer will be the calling layer break; } if ((fpGDPA = layer_prop->functions.get_device_proc_addr) == NULL) { - if (strlen(layer_prop->functions.str_gdpa) == 0) { + if (layer_prop->functions.str_gdpa == NULL || strlen(layer_prop->functions.str_gdpa) == 0) { fpGDPA = (PFN_vkGetDeviceProcAddr)loader_platform_get_proc_address(lib_handle, "vkGetDeviceProcAddr"); layer_prop->functions.get_device_proc_addr = fpGDPA; } else fpGDPA = (PFN_vkGetDeviceProcAddr)loader_platform_get_proc_address(lib_handle, layer_prop->functions.str_gdpa); if (!fpGDPA) { loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, - "Failed to find vkGetDeviceProcAddr in layer %s", layer_prop->lib_name); + "Failed to find vkGetDeviceProcAddr in layer \"%s\"", layer_prop->lib_name); continue; } } @@ -4758,7 +4893,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre activated_layers[num_activated_layers].disable_env = layer_prop->disable_env_var.name; } - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Inserted device layer %s (%s)", + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Inserted device layer \"%s\" (%s)", layer_prop->info.layerName, layer_prop->lib_name); num_activated_layers++; @@ -4778,29 +4913,25 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre // If layer debugging is enabled, let's print out the full callstack with layers in their // defined order. uint32_t layer_driver_bits = VULKAN_LOADER_LAYER_BIT | VULKAN_LOADER_DRIVER_BIT; - if ((loader_get_debug_level() & layer_driver_bits) != 0) { - loader_log(inst, layer_driver_bits, 0, "vkCreateDevice layer callstack setup to:"); - loader_log(inst, layer_driver_bits, 0, " "); - loader_log(inst, layer_driver_bits, 0, " ||"); - loader_log(inst, layer_driver_bits, 0, " "); - loader_log(inst, layer_driver_bits, 0, " ||"); - if ((loader_get_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) { - for (uint32_t cur_layer = 0; cur_layer < num_activated_layers; ++cur_layer) { - uint32_t index = num_activated_layers - cur_layer - 1; - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " %s", activated_layers[index].name); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Type: %s", - activated_layers[index].is_implicit ? "Implicit" : "Explicit"); - if (activated_layers[index].is_implicit) { - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Disable Env Var: %s", - activated_layers[index].disable_env); - } - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Manifest: %s", activated_layers[index].manifest); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Library: %s", activated_layers[index].library); - loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " ||"); - } - } - loader_log(inst, layer_driver_bits, 0, " "); + loader_log(inst, layer_driver_bits, 0, "vkCreateDevice layer callstack setup to:"); + loader_log(inst, layer_driver_bits, 0, " "); + loader_log(inst, layer_driver_bits, 0, " ||"); + loader_log(inst, layer_driver_bits, 0, " "); + loader_log(inst, layer_driver_bits, 0, " ||"); + for (uint32_t cur_layer = 0; cur_layer < num_activated_layers; ++cur_layer) { + uint32_t index = num_activated_layers - cur_layer - 1; + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " %s", activated_layers[index].name); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Type: %s", + activated_layers[index].is_implicit ? "Implicit" : "Explicit"); + if (activated_layers[index].is_implicit) { + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Disable Env Var: %s", + activated_layers[index].disable_env); + } + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Manifest: %s", activated_layers[index].manifest); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " Library: %s", activated_layers[index].library); + loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, " ||"); } + loader_log(inst, layer_driver_bits, 0, " "); create_info_disp.pNext = loader_create_info.pNext; loader_create_info.pNext = &create_info_disp; res = fpCreateDevice(pd, &loader_create_info, pAllocator, &created_device); @@ -4809,13 +4940,13 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre } dev->chain_device = created_device; - // Because we changed the pNext chain to use our own VkDeviceGroupDeviceCreateInfoKHR, we need to fixup the chain to point - // back at the original VkDeviceGroupDeviceCreateInfoKHR. + // Because we changed the pNext chain to use our own VkDeviceGroupDeviceCreateInfo, we need to fixup the chain to + // point back at the original VkDeviceGroupDeviceCreateInfo. VkBaseOutStructure *pNext = (VkBaseOutStructure *)loader_create_info.pNext; 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; } @@ -4835,6 +4966,9 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre // Initialize device dispatch table loader_init_device_dispatch_table(&dev->loader_dispatch, nextGDPA, dev->chain_device); + // Initialize the dispatch table to functions which need terminators + // These functions point directly to the driver, not the terminator functions + init_extension_device_proc_terminator_dispatch(dev); return res; } @@ -4845,7 +4979,7 @@ VkResult loader_validate_layers(const struct loader_instance *inst, const uint32 if (layer_count > 0 && ppEnabledLayerNames == NULL) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_validate_instance_layers: ppEnabledLayerNames is NULL but enabledLayerCount is greater than zero"); + "loader_validate_layers: ppEnabledLayerNames is NULL but enabledLayerCount is greater than zero"); return VK_ERROR_LAYER_NOT_PRESENT; } @@ -4863,22 +4997,28 @@ VkResult loader_validate_layers(const struct loader_instance *inst, const uint32 "loader_validate_layers: Layer %d does not exist in the list of available layers", i); return VK_ERROR_LAYER_NOT_PRESENT; } + if (inst->settings.settings_active && prop->settings_control_value != LOADER_SETTINGS_LAYER_CONTROL_ON && + prop->settings_control_value != LOADER_SETTINGS_LAYER_CONTROL_DEFAULT) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_validate_layers: Layer %d was explicitly prevented from being enabled by the loader settings file", + i); + return VK_ERROR_LAYER_NOT_PRESENT; + } } return VK_SUCCESS; } VkResult loader_validate_instance_extensions(struct loader_instance *inst, const struct loader_extension_list *icd_exts, const struct loader_layer_list *instance_layers, + const struct loader_envvar_all_filters *layer_filters, const VkInstanceCreateInfo *pCreateInfo) { VkExtensionProperties *extension_prop; char *env_value; bool check_if_known = true; VkResult res = VK_SUCCESS; - struct loader_layer_list active_layers; - struct loader_layer_list expanded_layers; - memset(&active_layers, 0, sizeof(active_layers)); - memset(&expanded_layers, 0, sizeof(expanded_layers)); + struct loader_pointer_layer_list active_layers = {0}; + struct loader_pointer_layer_list expanded_layers = {0}; if (pCreateInfo->enabledExtensionCount > 0 && pCreateInfo->ppEnabledExtensionNames == NULL) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, @@ -4886,29 +5026,40 @@ VkResult loader_validate_instance_extensions(struct loader_instance *inst, const "greater than zero"); return VK_ERROR_EXTENSION_NOT_PRESENT; } - if (!loader_init_layer_list(inst, &active_layers)) { + if (!loader_init_pointer_layer_list(inst, &active_layers)) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - if (!loader_init_layer_list(inst, &expanded_layers)) { + if (!loader_init_pointer_layer_list(inst, &expanded_layers)) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - // Build the lists of active layers (including metalayers) and expanded layers (with metalayers resolved to their - // components) - loader_add_implicit_layers(inst, &active_layers, &expanded_layers, instance_layers); - res = loader_add_environment_layers(inst, VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER, ENABLED_LAYERS_ENV, &active_layers, - &expanded_layers, instance_layers); - if (res != VK_SUCCESS) { - goto out; - } - res = loader_add_layer_names_to_list(inst, &active_layers, &expanded_layers, pCreateInfo->enabledLayerCount, - pCreateInfo->ppEnabledLayerNames, instance_layers); - if (VK_SUCCESS != res) { - goto out; + if (inst->settings.settings_active) { + res = enable_correct_layers_from_settings(inst, layer_filters, pCreateInfo->enabledLayerCount, + pCreateInfo->ppEnabledLayerNames, instance_layers, &active_layers, + &expanded_layers); + if (res != VK_SUCCESS) { + goto out; + } + } else { + // Build the lists of active layers (including meta layers) and expanded layers (with meta layers resolved to their + // components) + res = loader_add_implicit_layers(inst, layer_filters, &active_layers, &expanded_layers, instance_layers); + if (res != VK_SUCCESS) { + goto out; + } + res = loader_add_environment_layers(inst, VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER, layer_filters, &active_layers, + &expanded_layers, instance_layers); + if (res != VK_SUCCESS) { + goto out; + } + res = loader_add_layer_names_to_list(inst, layer_filters, &active_layers, &expanded_layers, pCreateInfo->enabledLayerCount, + pCreateInfo->ppEnabledLayerNames, instance_layers); + if (VK_SUCCESS != res) { + goto out; + } } - for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); if (result != VK_STRING_ERROR_NONE) { @@ -4955,16 +5106,16 @@ VkResult loader_validate_instance_extensions(struct loader_instance *inst, const extension_prop = NULL; // Not in global list, search layer extension lists - struct loader_layer_properties *layer_prop = NULL; for (uint32_t j = 0; NULL == extension_prop && j < expanded_layers.count; ++j) { extension_prop = - get_extension_property(pCreateInfo->ppEnabledExtensionNames[i], &expanded_layers.list[j].instance_extension_list); + get_extension_property(pCreateInfo->ppEnabledExtensionNames[i], &expanded_layers.list[j]->instance_extension_list); if (extension_prop) { // Found the extension in one of the layers enabled by the app. break; } - layer_prop = loader_find_layer_property(expanded_layers.list[j].info.layerName, instance_layers); + struct loader_layer_properties *layer_prop = + loader_find_layer_property(expanded_layers.list[j]->info.layerName, instance_layers); if (NULL == layer_prop) { // Should NOT get here, loader_validate_layers should have already filtered this case out. continue; @@ -4983,17 +5134,14 @@ VkResult loader_validate_instance_extensions(struct loader_instance *inst, const } out: - loader_destroy_layer_list(inst, NULL, &active_layers); - loader_destroy_layer_list(inst, NULL, &expanded_layers); + loader_destroy_pointer_layer_list(inst, &active_layers); + loader_destroy_pointer_layer_list(inst, &expanded_layers); return res; } VkResult loader_validate_device_extensions(struct loader_instance *this_instance, - const struct loader_layer_list *activated_device_layers, + const struct loader_pointer_layer_list *activated_device_layers, const struct loader_extension_list *icd_exts, const VkDeviceCreateInfo *pCreateInfo) { - VkExtensionProperties *extension_prop; - struct loader_layer_properties *layer_prop; - for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); if (result != VK_STRING_ERROR_NONE) { @@ -5004,7 +5152,7 @@ VkResult loader_validate_device_extensions(struct loader_instance *this_instance } const char *extension_name = pCreateInfo->ppEnabledExtensionNames[i]; - extension_prop = get_extension_property(extension_name, icd_exts); + VkExtensionProperties *extension_prop = get_extension_property(extension_name, icd_exts); if (extension_prop) { continue; @@ -5012,7 +5160,7 @@ VkResult loader_validate_device_extensions(struct loader_instance *this_instance // Not in global list, search activated layer extension lists for (uint32_t j = 0; j < activated_device_layers->count; j++) { - layer_prop = &activated_device_layers->list[j]; + struct loader_layer_properties *layer_prop = activated_device_layers->list[j]; extension_prop = get_dev_extension_property(extension_name, &layer_prop->device_extension_list); if (extension_prop) { @@ -5051,9 +5199,19 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI "#LLP_LAYER_21)"); } else if (LOADER_MAGIC_NUMBER != ptr_instance->magic) { loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0, - "terminator_CreateInstance: Instance pointer (%p) has invalid MAGIC value 0x%08x. Instance value possibly " + "terminator_CreateInstance: Instance pointer (%p) has invalid MAGIC value 0x%08lx. Instance value possibly " "corrupted by active layer (Policy #LLP_LAYER_21). ", - ptr_instance->magic); + ptr_instance, ptr_instance->magic); + } + + // Save the application version if it has been modified - layers sometimes needs features in newer API versions than + // what the application requested, and thus will increase the instance version to a level that suites their needs. + if (pCreateInfo->pApplicationInfo && pCreateInfo->pApplicationInfo->apiVersion) { + loader_api_version altered_version = loader_make_version(pCreateInfo->pApplicationInfo->apiVersion); + if (altered_version.major != ptr_instance->app_api_version.major || + altered_version.minor != ptr_instance->app_api_version.minor) { + ptr_instance->app_api_version = altered_version; + } } memcpy(&icd_create_info, pCreateInfo, sizeof(icd_create_info)); @@ -5066,7 +5224,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI // support a layer, but it would be independent of the actual ICD, // just in the same library. uint32_t extension_count = pCreateInfo->enabledExtensionCount; -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) extension_count += 1; #endif // LOADER_ENABLE_LINUX_SORT filtered_extension_names = loader_stack_alloc(extension_count * sizeof(char *)); @@ -5105,9 +5263,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI // Make sure that we reset the pApplicationInfo so we don't get an old pointer icd_create_info.pApplicationInfo = pCreateInfo->pApplicationInfo; icd_create_info.enabledExtensionCount = 0; - struct loader_extension_list icd_exts; + struct loader_extension_list icd_exts = {0}; - loader_log(ptr_instance, VULKAN_LOADER_DEBUG_BIT, 0, "Build ICD instance extension list"); // traverse scanned icd list adding non-duplicate extensions to the list res = loader_init_generic_list(ptr_instance, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties)); if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { @@ -5145,7 +5302,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI icd_create_info.enabledExtensionCount++; } } -#ifdef LOADER_ENABLE_LINUX_SORT +#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 // the core version of vkGetPhysicalDeviceProperties2 entrypoint. @@ -5192,7 +5349,17 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI "terminator_CreateInstance: ICD \"%s\" vkEnumerateInstanceVersion returned error. The ICD will be " "treated as a 1.0 ICD", icd_term->scanned_icd->lib_name); + } else if (VK_API_VERSION_MINOR(icd_version) == 0) { + loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "terminator_CreateInstance: Manifest ICD for \"%s\" contained a 1.1 or greater API version, but " + "vkEnumerateInstanceVersion returned 1.0, treating as a 1.0 ICD", + icd_term->scanned_icd->lib_name); } + } else { + loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "terminator_CreateInstance: Manifest ICD for \"%s\" contained a 1.1 or greater API version, but does " + "not support vkEnumerateInstanceVersion, treating as a 1.0 ICD", + icd_term->scanned_icd->lib_name); } } @@ -5213,12 +5380,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI // Create an instance, substituting the version to 1.0 if necessary VkApplicationInfo icd_app_info; + const uint32_t api_variant = 0; + const uint32_t api_version_1_0 = VK_API_VERSION_1_0; 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 { @@ -5235,17 +5404,19 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI goto out; } else if (VK_SUCCESS != icd_result) { loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0, - "terminator_CreateInstance: Failed to CreateInstance in ICD %d. Skipping ICD.", i); + "terminator_CreateInstance: Received return code %i from call to vkCreateInstance in ICD %s. Skipping " + "this driver.", + icd_result, icd_term->scanned_icd->lib_name); ptr_instance->icd_terms = icd_term->next; icd_term->next = NULL; loader_icd_destroy(ptr_instance, icd_term, pAllocator); continue; } - if (!loader_icd_init_entries(icd_term, icd_term->instance, - ptr_instance->icd_tramp_list.scanned_list[i].GetInstanceProcAddr)) { + if (!loader_icd_init_entries(ptr_instance, icd_term)) { loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0, - "terminator_CreateInstance: Failed to CreateInstance and find entrypoints with ICD. Skipping ICD."); + "terminator_CreateInstance: Failed to find required entrypoints in ICD %s. Skipping this driver.", + icd_term->scanned_icd->lib_name); ptr_instance->icd_terms = icd_term->next; icd_term->next = NULL; loader_icd_destroy(ptr_instance, icd_term, pAllocator); @@ -5254,22 +5425,22 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI if (ptr_instance->icd_tramp_list.scanned_list[i].interface_version < 3 && ( -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) NULL != icd_term->dispatch.CreateXlibSurfaceKHR || #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) NULL != icd_term->dispatch.CreateXcbSurfaceKHR || #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) NULL != icd_term->dispatch.CreateWaylandSurfaceKHR || #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) NULL != icd_term->dispatch.CreateAndroidSurfaceKHR || #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) NULL != icd_term->dispatch.CreateSurfaceOHOS || #endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) NULL != icd_term->dispatch.CreateWin32SurfaceKHR || #endif // VK_USE_PLATFORM_WIN32_KHR NULL != icd_term->dispatch.DestroySurfaceKHR)) { @@ -5379,7 +5550,6 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance(VkInstance instance, const icd_terms = next_icd_term; } - loader_delete_layer_list_and_properties(ptr_instance, &ptr_instance->instance_layer_list); loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_tramp_list); loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&ptr_instance->ext_list); if (NULL != ptr_instance->phys_devs_term) { @@ -5403,6 +5573,8 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance(VkInstance instance, const } loader_free_dev_ext_table(ptr_instance); loader_free_phys_dev_ext_table(ptr_instance); + + free_string_list(ptr_instance, &ptr_instance->enabled_layer_names); } VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, @@ -5417,7 +5589,19 @@ 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, + "terminator_CreateDevice: Loader device pointer null encountered. Possibly set by active layer. (Policy " + "#LLP_LAYER_22)"); + } else if (DEVICE_DISP_TABLE_MAGIC_NUMBER != dev->loader_dispatch.core_dispatch.magic) { + loader_log(icd_term->this_instance, VULKAN_LOADER_WARN_BIT, 0, + "terminator_CreateDevice: Device pointer (%p) has invalid MAGIC value 0x%08lx. The expected value is " + "0x10ADED040410ADED. Device value possibly " + "corrupted by active layer (Policy #LLP_LAYER_22). ", + dev, dev->loader_dispatch.core_dispatch.magic); + } dev->phys_dev_term = phys_dev_term; @@ -5556,7 +5740,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) { @@ -5593,33 +5777,61 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical } } + VkBool32 maintenance5_feature_enabled = false; + // Look for the VkPhysicalDeviceMaintenance5FeaturesKHR struct to see if the feature was enabled + { + const void *pNext = localCreateInfo.pNext; + while (pNext != NULL) { + switch (*(VkStructureType *)pNext) { + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR: { + const VkPhysicalDeviceMaintenance5FeaturesKHR *maintenance_features = pNext; + if (maintenance_features->maintenance5 == VK_TRUE) { + maintenance5_feature_enabled = true; + } + pNext = maintenance_features->pNext; + break; + } + + default: { + const VkBaseInStructure *header = pNext; + pNext = header->pNext; + break; + } + } + } + } + // 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 for (uint32_t i = 0; i < localCreateInfo.enabledExtensionCount; ++i) { if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME)) { - dev->extensions.khr_swapchain_enabled = true; + dev->driver_extensions.khr_swapchain_enabled = true; } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME)) { - dev->extensions.khr_display_swapchain_enabled = true; + dev->driver_extensions.khr_display_swapchain_enabled = true; } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_DEVICE_GROUP_EXTENSION_NAME)) { - dev->extensions.khr_device_group_enabled = true; + dev->driver_extensions.khr_device_group_enabled = true; } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { - dev->extensions.ext_debug_marker_enabled = true; + dev->driver_extensions.ext_debug_marker_enabled = true; } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], "VK_EXT_full_screen_exclusive")) { - dev->extensions.ext_full_screen_exclusive_enabled = true; + dev->driver_extensions.ext_full_screen_exclusive_enabled = true; + } else if (!strcmp(localCreateInfo.ppEnabledExtensionNames[i], VK_KHR_MAINTENANCE_5_EXTENSION_NAME) && + maintenance5_feature_enabled) { + dev->should_ignore_device_commands_from_newer_version = true; } } - dev->extensions.ext_debug_utils_enabled = icd_term->this_instance->enabled_known_extensions.ext_debug_utils; + dev->layer_extensions.ext_debug_utils_enabled = icd_term->this_instance->enabled_known_extensions.ext_debug_utils; + dev->driver_extensions.ext_debug_utils_enabled = icd_term->this_instance->enabled_known_extensions.ext_debug_utils; VkPhysicalDeviceProperties properties; icd_term->dispatch.GetPhysicalDeviceProperties(phys_dev_term->phys_dev, &properties); - if (!dev->extensions.khr_device_group_enabled) { + if (!dev->driver_extensions.khr_device_group_enabled) { if (properties.apiVersion >= VK_API_VERSION_1_1) { - dev->extensions.khr_device_group_enabled = true; + dev->driver_extensions.khr_device_group_enabled = true; } } loader_log(icd_term->this_instance, VULKAN_LOADER_LAYER_BIT | VULKAN_LOADER_DRIVER_BIT, 0, - " Using \"%s\" with driver: \"%s\"\n", properties.deviceName, icd_term->scanned_icd->lib_name); + " Using \"%s\" with driver: \"%s\"", properties.deviceName, icd_term->scanned_icd->lib_name); res = fpCreateDevice(phys_dev_term->phys_dev, &localCreateInfo, pAllocator, &dev->icd_device); if (res != VK_SUCCESS) { @@ -5629,7 +5841,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical } *pDevice = dev->icd_device; - loader_add_logical_device(icd_term->this_instance, icd_term, dev); + loader_add_logical_device(icd_term, dev); // Init dispatch pointer in new device object loader_init_dispatch(*pDevice, &dev->loader_dispatch); @@ -5639,7 +5851,7 @@ out: loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&icd_exts); } - // Restore pNext pointer to old VkDeviceGroupDeviceCreateInfoKHX + // Restore pNext pointer to old VkDeviceGroupDeviceCreateInfo // in the chain to maintain consistency for the caller. if (caller_dgci_container != NULL) { caller_dgci_container->pNext = (VkBaseOutStructure *)caller_dgci; @@ -5827,7 +6039,7 @@ out: return res; } -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) bool is_linux_sort_enabled(struct loader_instance *inst) { bool sort_items = inst->supports_get_dev_prop_2; char *env_value = loader_getenv("VK_LOADER_DISABLE_SELECT", inst); @@ -5842,36 +6054,59 @@ bool is_linux_sort_enabled(struct loader_instance *inst) { } #endif // LOADER_ENABLE_LINUX_SORT -// Check if this physical device is already in the old buffer -void check_if_phys_dev_already_present(struct loader_instance *inst, VkPhysicalDevice physical_device, uint32_t idx, - struct loader_physical_device_term **new_phys_devs) { - if (NULL != inst->phys_devs_term) { - for (uint32_t old_idx = 0; old_idx < inst->phys_dev_count_term; old_idx++) { - if (physical_device == inst->phys_devs_term[old_idx]->phys_dev) { - new_phys_devs[idx] = inst->phys_devs_term[old_idx]; - break; - } +// Look for physical_device in the provided phys_devs list, return true if found and put the index into out_idx, otherwise +// return false +bool find_phys_dev(VkPhysicalDevice physical_device, uint32_t phys_devs_count, struct loader_physical_device_term **phys_devs, + uint32_t *out_idx) { + if (NULL == phys_devs) return false; + for (uint32_t idx = 0; idx < phys_devs_count; idx++) { + if (NULL != phys_devs[idx] && physical_device == phys_devs[idx]->phys_dev) { + *out_idx = idx; + return true; } } + return false; } -VkResult allocate_new_phys_dev_at_idx(struct loader_instance *inst, VkPhysicalDevice physical_device, - struct loader_phys_dev_per_icd *dev_array, uint32_t idx, - struct loader_physical_device_term **new_phys_devs) { - if (NULL == new_phys_devs[idx]) { - new_phys_devs[idx] = - loader_instance_heap_alloc(inst, sizeof(struct loader_physical_device_term), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - if (NULL == new_phys_devs[idx]) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "allocate_new_phys_dev_at_idx: Failed to allocate physical device terminator object %d", idx); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } +// Add physical_device to new_phys_devs +VkResult check_and_add_to_new_phys_devs(struct loader_instance *inst, VkPhysicalDevice physical_device, + struct loader_icd_physical_devices *dev_array, uint32_t *cur_new_phys_dev_count, + struct loader_physical_device_term **new_phys_devs) { + uint32_t out_idx = 0; + uint32_t idx = *cur_new_phys_dev_count; + // Check if the physical_device already exists in the new_phys_devs buffer, that means it was found from both + // EnumerateAdapterPhysicalDevices and EnumeratePhysicalDevices and we need to skip it. + if (find_phys_dev(physical_device, idx, new_phys_devs, &out_idx)) { + return VK_SUCCESS; + } + // Check if it was found in a previous call to vkEnumeratePhysicalDevices, we can just copy over the old data. + if (find_phys_dev(physical_device, inst->phys_dev_count_term, inst->phys_devs_term, &out_idx)) { + new_phys_devs[idx] = inst->phys_devs_term[out_idx]; + (*cur_new_phys_dev_count)++; + return VK_SUCCESS; + } - loader_set_dispatch((void *)new_phys_devs[idx], inst->disp); - new_phys_devs[idx]->this_icd_term = dev_array->icd_term; - new_phys_devs[idx]->icd_index = (uint8_t)(dev_array->icd_index); - new_phys_devs[idx]->phys_dev = physical_device; + // Exit in case something is already present - this shouldn't happen but better to be safe than overwrite existing data + // since this code has been refactored a half dozen times. + if (NULL != new_phys_devs[idx]) { + return VK_SUCCESS; + } + // If this physical device is new, we need to allocate space for it. + new_phys_devs[idx] = + loader_instance_heap_alloc(inst, sizeof(struct loader_physical_device_term), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == new_phys_devs[idx]) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "check_and_add_to_new_phys_devs: Failed to allocate physical device terminator object %d", idx); + return VK_ERROR_OUT_OF_HOST_MEMORY; } + + loader_set_dispatch((void *)new_phys_devs[idx], inst->disp); + new_phys_devs[idx]->this_icd_term = dev_array->icd_term; + new_phys_devs[idx]->icd_index = (uint8_t)(dev_array->icd_index); + new_phys_devs[idx]->phys_dev = physical_device; + + // Increment the count of new physical devices + (*cur_new_phys_dev_count)++; return VK_SUCCESS; } @@ -5891,9 +6126,10 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst) { struct loader_icd_term *icd_term; uint32_t icd_idx = 0; uint32_t windows_sorted_devices_count = 0; - struct loader_phys_dev_per_icd *windows_sorted_devices_array = NULL; + struct loader_icd_physical_devices *windows_sorted_devices_array = NULL; uint32_t icd_count = 0; - struct loader_phys_dev_per_icd *icd_phys_dev_array = NULL; + struct loader_icd_physical_devices *icd_phys_dev_array = NULL; + uint32_t new_phys_devs_capacity = 0; uint32_t new_phys_devs_count = 0; struct loader_physical_device_term **new_phys_devs = NULL; @@ -5908,7 +6144,8 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst) { icd_count = inst->total_icd_count; // Allocate something to store the physical device characteristics that we read from each ICD. - icd_phys_dev_array = (struct loader_phys_dev_per_icd *)loader_stack_alloc(sizeof(struct loader_phys_dev_per_icd) * icd_count); + icd_phys_dev_array = + (struct loader_icd_physical_devices *)loader_stack_alloc(sizeof(struct loader_icd_physical_devices) * icd_count); if (NULL == icd_phys_dev_array) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "setup_loader_term_phys_devs: Failed to allocate temporary ICD Physical device info array of size %d", @@ -5916,22 +6153,12 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - memset(icd_phys_dev_array, 0, sizeof(struct loader_phys_dev_per_icd) * icd_count); + memset(icd_phys_dev_array, 0, sizeof(struct loader_icd_physical_devices) * icd_count); // For each ICD, query the number of physical devices, and then get an // internal value for those physical devices. icd_term = inst->icd_terms; while (NULL != icd_term) { - // This is the legacy behavior which should be skipped if EnumerateAdapterPhysicalDevices is available - // and we successfully enumerated sorted adapters using windows_read_sorted_physical_devices. -#if defined(VK_USE_PLATFORM_WIN32_KHR) - if (icd_term->scanned_icd->EnumerateAdapterPhysicalDevices != NULL) { - icd_term = icd_term->next; - ++icd_idx; - continue; - } -#endif - res = icd_term->dispatch.EnumeratePhysicalDevices(icd_term->instance, &icd_phys_dev_array[icd_idx].device_count, NULL); if (VK_SUCCESS != res) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, @@ -5963,52 +6190,47 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst) { // Add up both the windows sorted and non windows found physical device counts for (uint32_t i = 0; i < windows_sorted_devices_count; ++i) { - new_phys_devs_count += windows_sorted_devices_array[i].device_count; + new_phys_devs_capacity += windows_sorted_devices_array[i].device_count; } for (uint32_t i = 0; i < icd_count; ++i) { - new_phys_devs_count += icd_phys_dev_array[i].device_count; + new_phys_devs_capacity += icd_phys_dev_array[i].device_count; } // Bail out if there are no physical devices reported - if (0 == new_phys_devs_count) { + if (0 == new_phys_devs_capacity) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "setup_loader_term_phys_devs: Failed to detect any valid GPUs in the current config"); res = VK_ERROR_INITIALIZATION_FAILED; goto out; } - // Create an allocation large enough to hold both the windows sorting enumeration and non-windows physical device enumeration - new_phys_devs = loader_instance_heap_calloc(inst, sizeof(struct loader_physical_device_term *) * new_phys_devs_count, + // Create an allocation large enough to hold both the windows sorting enumeration and non-windows physical device + // enumeration + new_phys_devs = loader_instance_heap_calloc(inst, sizeof(struct loader_physical_device_term *) * new_phys_devs_capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "setup_loader_term_phys_devs: Failed to allocate new physical device array of size %d", new_phys_devs_count); + "setup_loader_term_phys_devs: Failed to allocate new physical device array of size %d", new_phys_devs_capacity); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - // Current index into the new_phys_devs array - increment whenever we've written in. - uint32_t idx = 0; - // Copy over everything found through sorted enumeration for (uint32_t i = 0; i < windows_sorted_devices_count; ++i) { for (uint32_t j = 0; j < windows_sorted_devices_array[i].device_count; ++j) { - check_if_phys_dev_already_present(inst, windows_sorted_devices_array[i].physical_devices[j], idx, new_phys_devs); - - res = allocate_new_phys_dev_at_idx(inst, windows_sorted_devices_array[i].physical_devices[j], - &windows_sorted_devices_array[i], idx, new_phys_devs); + res = check_and_add_to_new_phys_devs(inst, windows_sorted_devices_array[i].physical_devices[j], + &windows_sorted_devices_array[i], &new_phys_devs_count, new_phys_devs); if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { goto out; } - // Increment the count of new physical devices - idx++; } } - // Now go through the rest of the physical devices and add them to new_phys_devs -#ifdef LOADER_ENABLE_LINUX_SORT +// Now go through the rest of the physical devices and add them to new_phys_devs +#if defined(LOADER_ENABLE_LINUX_SORT) + if (is_linux_sort_enabled(inst)) { - for (uint32_t dev = idx; dev < new_phys_devs_count; ++dev) { + for (uint32_t dev = new_phys_devs_count; dev < new_phys_devs_capacity; ++dev) { new_phys_devs[dev] = loader_instance_heap_alloc(inst, sizeof(struct loader_physical_device_term), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs[dev]) { @@ -6022,13 +6244,13 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst) { // Get the physical devices supported by platform sorting mechanism into a separate list // Pass in a sublist to the function so it only operates on the correct elements. This means passing in a pointer to the // current next element in new_phys_devs and passing in a `count` of currently unwritten elements - res = - linux_read_sorted_physical_devices(inst, icd_count, icd_phys_dev_array, new_phys_devs_count - idx, &new_phys_devs[idx]); + res = linux_read_sorted_physical_devices(inst, icd_count, icd_phys_dev_array, new_phys_devs_capacity - new_phys_devs_count, + &new_phys_devs[new_phys_devs_count]); if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { goto out; } // Keep previously allocated physical device info since apps may already be using that! - for (uint32_t new_idx = idx; new_idx < new_phys_devs_count; new_idx++) { + for (uint32_t new_idx = new_phys_devs_count; new_idx < new_phys_devs_capacity; new_idx++) { for (uint32_t old_idx = 0; old_idx < inst->phys_dev_count_term; old_idx++) { if (new_phys_devs[new_idx]->phys_dev == inst->phys_devs_term[old_idx]->phys_dev) { loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_DRIVER_BIT, 0, @@ -6040,6 +6262,8 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst) { } } } + // now set the count to the capacity, as now the list is filled in + new_phys_devs_count = new_phys_devs_capacity; // We want the following code to run if either linux sorting is disabled at compile time or runtime } else { #endif // LOADER_ENABLE_LINUX_SORT @@ -6047,19 +6271,14 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst) { // Copy over everything found through the non-sorted means. for (uint32_t i = 0; i < icd_count; ++i) { for (uint32_t j = 0; j < icd_phys_dev_array[i].device_count; ++j) { - check_if_phys_dev_already_present(inst, icd_phys_dev_array[i].physical_devices[j], idx, new_phys_devs); - - // If this physical device isn't in the old buffer, then we need to create it. - res = allocate_new_phys_dev_at_idx(inst, icd_phys_dev_array[i].physical_devices[j], &icd_phys_dev_array[i], idx, - new_phys_devs); + res = check_and_add_to_new_phys_devs(inst, icd_phys_dev_array[i].physical_devices[j], &icd_phys_dev_array[i], + &new_phys_devs_count, new_phys_devs); if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { goto out; } - // Increment the count of new physical devices - idx++; } } -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) } #endif // LOADER_ENABLE_LINUX_SORT out: @@ -6067,7 +6286,10 @@ out: if (VK_SUCCESS != res) { if (NULL != new_phys_devs) { // We've encountered an error, so we should free the new buffers. - for (uint32_t i = 0; i < new_phys_devs_count; i++) { + for (uint32_t i = 0; i < new_phys_devs_capacity; i++) { + // May not have allocated this far, skip it if we hadn't. + if (new_phys_devs[i] == NULL) continue; + // If an OOM occurred inside the copying of the new physical devices into the existing array // will leave some of the old physical devices in the array which may have been copied into // the new array, leading to them being freed twice. To avoid this we just make sure to not @@ -6208,11 +6430,11 @@ out: VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) { - struct loader_physical_device_term *phys_dev_term; + if (NULL == pPropertyCount) { + return VK_INCOMPLETE; + } - struct loader_layer_list implicit_layer_list = {0}; - struct loader_extension_list all_exts = {0}; - struct loader_extension_list icd_exts = {0}; + struct loader_physical_device_term *phys_dev_term; // Any layer or trampoline wrapping should be removed at this point in time can just cast to the expected // type for VkPhysicalDevice. @@ -6261,99 +6483,91 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties(VkP return VK_SUCCESS; } - // This case is during the call down the instance chain with pLayerName == NULL - struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - uint32_t icd_ext_count = *pPropertyCount; - VkExtensionProperties *icd_props_list = pProperties; - VkResult res; - - if (NULL == icd_props_list) { - // We need to find the count without duplicates. This requires querying the driver for the names of the extensions. - // A small amount of storage is then needed to facilitate the de-duplication. - res = icd_term->dispatch.EnumerateDeviceExtensionProperties(phys_dev_term->phys_dev, NULL, &icd_ext_count, NULL); + // user is querying driver extensions and has supplied their own storage - just fill it out + else if (pProperties) { + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + uint32_t written_count = *pPropertyCount; + VkResult res = + icd_term->dispatch.EnumerateDeviceExtensionProperties(phys_dev_term->phys_dev, NULL, &written_count, pProperties); if (res != VK_SUCCESS) { - goto out; + return res; } - if (icd_ext_count > 0) { - icd_props_list = loader_instance_heap_alloc(icd_term->this_instance, sizeof(VkExtensionProperties) * icd_ext_count, - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (NULL == icd_props_list) { - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; + + // Iterate over active layers, if they are an implicit layer, add their device extensions + // After calling into the driver, written_count contains the amount of device extensions written. We can therefore write + // layer extensions starting at that point in pProperties + for (uint32_t i = 0; i < icd_term->this_instance->expanded_activated_layer_list.count; i++) { + struct loader_layer_properties *layer_props = icd_term->this_instance->expanded_activated_layer_list.list[i]; + if (0 == (layer_props->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER)) { + struct loader_device_extension_list *layer_ext_list = &layer_props->device_extension_list; + for (uint32_t j = 0; j < layer_ext_list->count; j++) { + struct loader_dev_ext_props *cur_ext_props = &layer_ext_list->list[j]; + // look for duplicates + if (has_vk_extension_property_array(&cur_ext_props->props, written_count, pProperties)) { + continue; + } + + if (*pPropertyCount <= written_count) { + return VK_INCOMPLETE; + } + + memcpy(&pProperties[written_count], &cur_ext_props->props, sizeof(VkExtensionProperties)); + written_count++; + } } } + // Make sure we update the pPropertyCount with the how many were written + *pPropertyCount = written_count; + return res; } + // Use `goto out;` for rest of this function - // Get the available device extension count, and if pProperties is not NULL, the extensions as well - res = icd_term->dispatch.EnumerateDeviceExtensionProperties(phys_dev_term->phys_dev, NULL, &icd_ext_count, icd_props_list); + // This case is during the call down the instance chain with pLayerName == NULL and pProperties == NULL + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; + struct loader_extension_list all_exts = {0}; + VkResult res; + + // We need to find the count without duplicates. This requires querying the driver for the names of the extensions. + res = icd_term->dispatch.EnumerateDeviceExtensionProperties(phys_dev_term->phys_dev, NULL, &all_exts.count, NULL); if (res != VK_SUCCESS) { goto out; } - - if (!loader_init_layer_list(icd_term->this_instance, &implicit_layer_list)) { + // Then allocate memory to store the physical device extension list + the extensions layers provide + // all_exts.count currently is the number of driver extensions + all_exts.capacity = sizeof(VkExtensionProperties) * (all_exts.count + 20); + all_exts.list = loader_instance_heap_alloc(icd_term->this_instance, all_exts.capacity, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (NULL == all_exts.list) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - loader_add_implicit_layers(icd_term->this_instance, &implicit_layer_list, NULL, &icd_term->this_instance->instance_layer_list); - - // Initialize dev_extension list within the physicalDevice object - res = loader_init_device_extensions(icd_term->this_instance, phys_dev_term, icd_ext_count, icd_props_list, &icd_exts); - if (res != VK_SUCCESS) { - goto out; - } - - // We need to determine which implicit layers are active, and then add their extensions. This can't be cached as - // it depends on results of environment variables (which can change). - res = loader_add_to_ext_list(icd_term->this_instance, &all_exts, icd_exts.count, icd_exts.list); + // Get the available device extensions and put them in all_exts.list + res = icd_term->dispatch.EnumerateDeviceExtensionProperties(phys_dev_term->phys_dev, NULL, &all_exts.count, all_exts.list); if (res != VK_SUCCESS) { goto out; } - loader_add_implicit_layers(icd_term->this_instance, &implicit_layer_list, NULL, &icd_term->this_instance->instance_layer_list); - - for (uint32_t i = 0; i < implicit_layer_list.count; i++) { - for (uint32_t j = 0; j < implicit_layer_list.list[i].device_extension_list.count; j++) { - res = loader_add_to_ext_list(icd_term->this_instance, &all_exts, 1, - &implicit_layer_list.list[i].device_extension_list.list[j].props); - if (res != VK_SUCCESS) { - goto out; + // Iterate over active layers, if they are an implicit layer, add their device extensions to all_exts.list + for (uint32_t i = 0; i < icd_term->this_instance->expanded_activated_layer_list.count; i++) { + struct loader_layer_properties *layer_props = icd_term->this_instance->expanded_activated_layer_list.list[i]; + if (0 == (layer_props->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER)) { + struct loader_device_extension_list *layer_ext_list = &layer_props->device_extension_list; + for (uint32_t j = 0; j < layer_ext_list->count; j++) { + res = loader_add_to_ext_list(icd_term->this_instance, &all_exts, 1, &layer_ext_list->list[j].props); + if (res != VK_SUCCESS) { + goto out; + } } } } - uint32_t capacity = *pPropertyCount; - VkExtensionProperties *props = pProperties; + // Write out the final de-duplicated count to pPropertyCount + *pPropertyCount = all_exts.count; res = VK_SUCCESS; - if (NULL != pProperties) { - for (uint32_t i = 0; i < all_exts.count && i < capacity; i++) { - props[i] = all_exts.list[i]; - } - - // Wasn't enough space for the extensions, we did partial copy now return VK_INCOMPLETE - if (capacity < all_exts.count) { - res = VK_INCOMPLETE; - } else { - *pPropertyCount = all_exts.count; - } - } else { - *pPropertyCount = all_exts.count; - } out: - if (NULL != implicit_layer_list.list) { - loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&implicit_layer_list); - } - if (NULL != all_exts.list) { - loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&all_exts); - } - if (NULL != icd_exts.list) { - loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&icd_exts); - } - if (NULL == pProperties && NULL != icd_props_list) { - loader_instance_heap_free(icd_term->this_instance, icd_props_list); - } + loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&all_exts); return res; } @@ -6400,6 +6614,7 @@ VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8) { VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceVersion(const VkEnumerateInstanceVersionChain *chain, uint32_t *pApiVersion) { + (void)chain; // NOTE: The Vulkan WG doesn't want us checking pApiVersion for NULL, but instead // prefers us crashing. *pApiVersion = VK_HEADER_VERSION_COMPLETE; @@ -6409,17 +6624,24 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceVersion(const VkEnume VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceExtensionProperties(const VkEnumerateInstanceExtensionPropertiesChain *chain, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) { + (void)chain; struct loader_extension_list *global_ext_list = NULL; struct loader_layer_list instance_layers; struct loader_extension_list local_ext_list; struct loader_icd_tramp_list icd_tramp_list; uint32_t copy_size; VkResult res = VK_SUCCESS; + struct loader_envvar_all_filters layer_filters = {0}; memset(&local_ext_list, 0, sizeof(local_ext_list)); memset(&instance_layers, 0, sizeof(instance_layers)); memset(&icd_tramp_list, 0, sizeof(icd_tramp_list)); + res = parse_layer_environment_var_filters(NULL, &layer_filters); + if (VK_SUCCESS != res) { + goto out; + } + // Get layer libraries if needed if (pLayerName && strlen(pLayerName) != 0) { if (vk_string_validate(MaxLoaderStringLength, pLayerName) != VK_STRING_ERROR_NONE) { @@ -6428,7 +6650,10 @@ terminator_EnumerateInstanceExtensionProperties(const VkEnumerateInstanceExtensi goto out; } - loader_scan_for_layers(NULL, &instance_layers); + res = loader_scan_for_layers(NULL, &instance_layers, &layer_filters); + if (VK_SUCCESS != res) { + goto out; + } for (uint32_t i = 0; i < instance_layers.count; i++) { struct loader_layer_properties *props = &instance_layers.list[i]; if (strcmp(props->info.layerName, pLayerName) == 0) { @@ -6441,7 +6666,7 @@ terminator_EnumerateInstanceExtensionProperties(const VkEnumerateInstanceExtensi loader_preload_icds(); // Scan/discover all ICD libraries - res = loader_icd_scan(NULL, &icd_tramp_list, NULL); + res = loader_icd_scan(NULL, &icd_tramp_list, NULL, NULL); // EnumerateInstanceExtensionProperties can't return anything other than OOM or VK_ERROR_LAYER_NOT_PRESENT if ((VK_SUCCESS != res && icd_tramp_list.count > 0) || res == VK_ERROR_OUT_OF_HOST_MEMORY) { goto out; @@ -6454,11 +6679,11 @@ terminator_EnumerateInstanceExtensionProperties(const VkEnumerateInstanceExtensi loader_scanned_icd_clear(NULL, &icd_tramp_list); // Append enabled implicit layers. - loader_scan_for_implicit_layers(NULL, &instance_layers); + res = loader_scan_for_implicit_layers(NULL, &instance_layers, &layer_filters); + if (VK_SUCCESS != res) { + goto out; + } for (uint32_t i = 0; i < instance_layers.count; i++) { - if (!loader_implicit_layer_is_enabled(NULL, &instance_layers.list[i])) { - continue; - } struct loader_extension_list *ext_list = &instance_layers.list[i].instance_extension_list; loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count, ext_list->list); } @@ -6497,25 +6722,48 @@ out: VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceLayerProperties(const VkEnumerateInstanceLayerPropertiesChain *chain, uint32_t *pPropertyCount, VkLayerProperties *pProperties) { + (void)chain; VkResult result = VK_SUCCESS; struct loader_layer_list instance_layer_list; + struct loader_envvar_all_filters layer_filters = {0}; LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize); uint32_t copy_size; + result = parse_layer_environment_var_filters(NULL, &layer_filters); + if (VK_SUCCESS != result) { + goto out; + } + // Get layer libraries memset(&instance_layer_list, 0, sizeof(instance_layer_list)); - loader_scan_for_layers(NULL, &instance_layer_list); + result = loader_scan_for_layers(NULL, &instance_layer_list, &layer_filters); + if (VK_SUCCESS != result) { + goto out; + } + + uint32_t active_layer_count = 0; + for (uint32_t i = 0; i < instance_layer_list.count; i++) { + if (instance_layer_list.list[i].settings_control_value == LOADER_SETTINGS_LAYER_CONTROL_ON || + instance_layer_list.list[i].settings_control_value == LOADER_SETTINGS_LAYER_CONTROL_DEFAULT) { + active_layer_count++; + } + } if (pProperties == NULL) { - *pPropertyCount = instance_layer_list.count; + *pPropertyCount = active_layer_count; goto out; } - copy_size = (*pPropertyCount < instance_layer_list.count) ? *pPropertyCount : instance_layer_list.count; + copy_size = (*pPropertyCount < active_layer_count) ? *pPropertyCount : active_layer_count; + uint32_t output_properties_index = 0; for (uint32_t i = 0; i < copy_size; i++) { - memcpy(&pProperties[i], &instance_layer_list.list[i].info, sizeof(VkLayerProperties)); + if (instance_layer_list.list[i].settings_control_value == LOADER_SETTINGS_LAYER_CONTROL_ON || + instance_layer_list.list[i].settings_control_value == LOADER_SETTINGS_LAYER_CONTROL_DEFAULT) { + memcpy(&pProperties[output_properties_index], &instance_layer_list.list[i].info, sizeof(VkLayerProperties)); + output_properties_index++; + } } *pPropertyCount = copy_size; @@ -6541,16 +6789,18 @@ 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; + struct loader_icd_physical_devices *sorted_phys_dev_array = NULL; uint32_t sorted_count = 0; // For each ICD, query the number of physical device groups, and then get an // 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; + // 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; @@ -6558,7 +6808,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); @@ -6696,7 +6945,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; @@ -6733,7 +6982,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups( cur_icd_group_count += count_this_time; } -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) if (is_linux_sort_enabled(inst)) { // Get the physical devices supported by platform sorting mechanism into a separate list res = linux_sort_physical_device_groups(inst, total_count, local_phys_dev_groups); @@ -6818,18 +7067,18 @@ 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 object %d", - idx); + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "terminator_EnumeratePhysicalDeviceGroups: Failed to allocate physical device group Terminator " + "object %d", + idx); total_count = idx; 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; @@ -6843,10 +7092,10 @@ out: if (NULL != new_phys_dev_groups) { // We've encountered an error, so we should free the new buffers. for (uint32_t i = 0; i < total_count; i++) { - // If an OOM occurred inside the copying of the new physical device groups into the existing array will leave - // some of the old physical device groups in the array which may have been copied into the new array, leading to - // them being freed twice. To avoid this we just make sure to not delete physical device groups which were - // copied. + // If an OOM occurred inside the copying of the new physical device groups into the existing array will + // leave some of the old physical device groups in the array which may have been copied into the new array, + // leading to them being freed twice. To avoid this we just make sure to not delete physical device groups + // which were copied. bool found = false; if (NULL != inst->phys_devs_term) { for (uint32_t old_idx = 0; old_idx < inst->phys_dev_group_count_term; old_idx++) { diff --git a/loader/loader.h b/loader/loader.h index 3022096b78f6008565a621fb099952cda25fdbce..93346a9d71a088e5fcf9838f0ee4881113de3ed7 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -1,8 +1,8 @@ /* * - * Copyright (c) 2014-2022 The Khronos Group Inc. - * Copyright (c) 2014-2022 Valve Corporation - * Copyright (c) 2014-2022 LunarG, Inc. + * Copyright (c) 2014-2023 The Khronos Group Inc. + * Copyright (c) 2014-2023 Valve Corporation + * Copyright (c) 2014-2023 LunarG, Inc. * Copyright (C) 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,7 @@ #pragma once #include "loader_common.h" +#include "cJSON.h" // Declare the once_init variable LOADER_PLATFORM_THREAD_ONCE_EXTERN_DEFINITION(once_init) @@ -68,7 +69,7 @@ static inline struct loader_instance_dispatch_table *loader_get_instance_dispatc } static inline void loader_init_dispatch(void *obj, const void *data) { -#ifdef DEBUG +#if defined(DEBUG) assert(valid_loader_magic_value(obj) && "Incompatible ICD, first dword must be initialized to " "ICD_LOADER_MAGIC. See loader/README.md for details."); @@ -80,7 +81,6 @@ static inline void loader_init_dispatch(void *obj, const void *data) { // Global variables used across files extern struct loader_struct loader; extern loader_platform_thread_mutex loader_lock; -extern loader_platform_thread_mutex loader_json_lock; extern loader_platform_thread_mutex loader_preload_icd_lock; extern loader_platform_thread_mutex loader_global_instance_list_lock; @@ -91,58 +91,89 @@ VkResult loader_validate_layers(const struct loader_instance *inst, const uint32 VkResult loader_validate_instance_extensions(struct loader_instance *inst, const struct loader_extension_list *icd_exts, const struct loader_layer_list *instance_layer, + const struct loader_envvar_all_filters *layer_filters, const VkInstanceCreateInfo *pCreateInfo); void loader_initialize(void); void loader_release(void); void loader_preload_icds(void); void loader_unload_preloaded_icds(void); +VkResult loader_init_library_list(struct loader_layer_list *instance_layers, loader_platform_dl_handle **libs); + +// Allocate a new string able to hold source_str and place it in dest_str +VkResult loader_copy_to_new_str(const struct loader_instance *inst, const char *source_str, char **dest_str); + +// Allocate a loader_string_list with enough space for allocated_count strings inside of it +VkResult create_string_list(const struct loader_instance *inst, uint32_t allocated_count, struct loader_string_list *string_list); +// Resize if there isn't enough space, then add the string str to the end of the loader_string_list +// This function takes ownership of the str passed in - but only when it succeeds +VkResult append_str_to_string_list(const struct loader_instance *inst, struct loader_string_list *string_list, char *str); +// Resize if there isn't enough space, then copy the string str to a new string the end of the loader_string_list +// This function does not take ownership of the string, it merely copies it. +// This function appends a null terminator to the string automatically +// The str_len parameter does not include the null terminator +VkResult copy_str_to_string_list(const struct loader_instance *inst, struct loader_string_list *string_list, const char *str, + size_t str_len); + +// Free any string inside of loader_string_list and then free the list itself +void free_string_list(const struct loader_instance *inst, struct loader_string_list *string_list); + +VkResult loader_init_generic_list(const struct loader_instance *inst, struct loader_generic_list *list_info, size_t element_size); bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, const uint32_t count, const VkExtensionProperties *ext_array); bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, const struct loader_extension_list *ext_list); - +// This function takes ownership of layer_property in the case that allocation fails +VkResult loader_append_layer_property(const struct loader_instance *inst, struct loader_layer_list *layer_list, + struct loader_layer_properties *layer_property); +VkResult loader_add_layer_properties(const struct loader_instance *inst, struct loader_layer_list *layer_instance_list, cJSON *json, + bool is_implicit, char *filename); +bool loader_find_layer_name_in_list(const char *name, const struct loader_pointer_layer_list *layer_list); +VkResult loader_add_layer_properties_to_list(const struct loader_instance *inst, struct loader_pointer_layer_list *list, + struct loader_layer_properties *props); void loader_free_layer_properties(const struct loader_instance *inst, struct loader_layer_properties *layer_properties); +bool loader_implicit_layer_is_enabled(const struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + const struct loader_layer_properties *prop); +VkResult loader_add_meta_layer(const struct loader_instance *inst, const struct loader_envvar_all_filters *filters, + struct loader_layer_properties *prop, struct loader_pointer_layer_list *target_list, + struct loader_pointer_layer_list *expanded_target_list, const struct loader_layer_list *source_list, + bool *out_found_all_component_layers); VkResult loader_add_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list, uint32_t prop_list_count, const VkExtensionProperties *props); -VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct loader_device_extension_list *ext_list, - const VkExtensionProperties *props, uint32_t entry_count, char **entrys); VkResult loader_add_device_extensions(const struct loader_instance *inst, PFN_vkEnumerateDeviceExtensionProperties fpEnumerateDeviceExtensionProperties, VkPhysicalDevice physical_device, const char *lib_name, struct loader_extension_list *ext_list); VkResult loader_init_generic_list(const struct loader_instance *inst, struct loader_generic_list *list_info, size_t element_size); void loader_destroy_generic_list(const struct loader_instance *inst, struct loader_generic_list *list); -void loader_destroy_layer_list(const struct loader_instance *inst, struct loader_device *device, - struct loader_layer_list *layer_list); +void loader_destroy_pointer_layer_list(const struct loader_instance *inst, struct loader_pointer_layer_list *layer_list); void loader_delete_layer_list_and_properties(const struct loader_instance *inst, struct loader_layer_list *layer_list); -VkResult loader_add_layer_name_to_list(const struct loader_instance *inst, const char *name, const enum layer_type_flags type_flags, - const struct loader_layer_list *source_list, struct loader_layer_list *target_list, - struct loader_layer_list *expanded_target_list); -void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term, - const VkAllocationCallbacks *pAllocator); +void loader_remove_layer_in_list(const struct loader_instance *inst, struct loader_layer_list *layer_list, + uint32_t layer_to_remove); +VkResult loader_scanned_icd_init(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list); void loader_scanned_icd_clear(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list); VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, - bool *skipped_portability_drivers); -void loader_scan_for_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers); -void loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers); -bool loader_implicit_layer_is_enabled(const struct loader_instance *inst, const struct loader_layer_properties *prop); + const VkInstanceCreateInfo *pCreateInfo, bool *skipped_portability_drivers); +void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term, + const VkAllocationCallbacks *pAllocator); +VkResult loader_scan_for_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers, + const struct loader_envvar_all_filters *layer_filters); +VkResult loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers, + const struct loader_envvar_all_filters *layer_filters); VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, struct loader_extension_list *inst_exts); struct loader_icd_term *loader_get_icd_and_device(const void *device, struct loader_device **found_dev, uint32_t *icd_index); struct loader_instance *loader_get_instance(const VkInstance instance); -void loader_deactivate_layers(const struct loader_instance *instance, struct loader_device *device, struct loader_layer_list *list); struct loader_device *loader_create_logical_device(const struct loader_instance *inst, const VkAllocationCallbacks *pAllocator); -void loader_add_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, - struct loader_device *found_dev); -void loader_remove_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, - struct loader_device *found_dev, const VkAllocationCallbacks *pAllocator); +void loader_add_logical_device(struct loader_icd_term *icd_term, struct loader_device *found_dev); +void loader_remove_logical_device(struct loader_icd_term *icd_term, struct loader_device *found_dev, + const VkAllocationCallbacks *pAllocator); // NOTE: Outside of loader, this entry-point is only provided for error // cleanup. -void loader_destroy_logical_device(const struct loader_instance *inst, struct loader_device *dev, - const VkAllocationCallbacks *pAllocator); +void loader_destroy_logical_device(struct loader_device *dev, const VkAllocationCallbacks *pAllocator); VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkInstanceCreateInfo *pCreateInfo, - const struct loader_layer_list *instance_layers); + const struct loader_layer_list *instance_layers, + const struct loader_envvar_all_filters *layer_filters); VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, struct loader_instance *inst, VkInstance *created_instance); @@ -162,7 +193,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre PFN_vkGetDeviceProcAddr *layerNextGDPA); VkResult loader_validate_device_extensions(struct loader_instance *this_instance, - const struct loader_layer_list *activated_device_layers, + const struct loader_pointer_layer_list *activated_device_layers, const struct loader_extension_list *icd_exts, const VkDeviceCreateInfo *pCreateInfo); VkResult setup_loader_tramp_phys_devs(struct loader_instance *inst, uint32_t phys_dev_count, VkPhysicalDevice *phys_devs); @@ -171,7 +202,7 @@ VkResult setup_loader_tramp_phys_dev_groups(struct loader_instance *inst, uint32 VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array); char *loader_get_next_path(char *path); -VkResult add_data_files(const struct loader_instance *inst, char *search_path, struct loader_data_files *out_files, +VkResult add_data_files(const struct loader_instance *inst, char *search_path, struct loader_string_list *out_files, bool use_first_found_manifest); loader_api_version loader_make_version(uint32_t version); @@ -181,10 +212,10 @@ loader_api_version loader_combine_version(uint32_t major, uint32_t minor, uint32 bool loader_check_version_meets_required(loader_api_version required, loader_api_version version); // Convenience macros for common versions -#ifndef LOADER_VERSION_1_0_0 +#if !defined(LOADER_VERSION_1_0_0) #define LOADER_VERSION_1_0_0 loader_combine_version(1, 0, 0) #endif -#ifndef LOADER_VERSION_1_1_0 +#if !defined(LOADER_VERSION_1_1_0) #define LOADER_VERSION_1_1_0 loader_combine_version(1, 1, 0) #endif diff --git a/loader/loader.rc b/loader/loader.rc index 996d9c5e9fa70fbc548a127c9bcfd17aab050418..bf1280b1d9203cd456b180e172d139507f1806f1 100644 --- a/loader/loader.rc +++ b/loader/loader.rc @@ -1,7 +1,7 @@ // -// Copyright (c) 2014-2022 The Khronos Group Inc. -// Copyright (c) 2014-2022 Valve Corporation -// Copyright (c) 2014-2022 LunarG, Inc. +// Copyright (c) 2014-2024 The Khronos Group Inc. +// Copyright (c) 2014-2024 Valve Corporation +// Copyright (c) 2014-2024 LunarG, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,9 +22,10 @@ #include "winres.h" // All set through CMake -#define VER_FILE_VERSION 1, 0, 1111, 2222 -#define VER_FILE_DESCRIPTION_STR "Vulkan Loader - Dev Build" -#define VER_FILE_VERSION_STR "1.0.1111.2222.Dev Build" +#define VER_FILE_VERSION 1, 3, 275, 0 +#define VER_FILE_DESCRIPTION_STR "1.3.275.Dev Build" +#define VER_FILE_VERSION_STR "Vulkan Loader - Dev Build" +#define VER_COPYRIGHT_STR "Copyright (C) 2015-2024" VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILE_VERSION @@ -46,7 +47,7 @@ BEGIN BEGIN VALUE "FileDescription", VER_FILE_DESCRIPTION_STR VALUE "FileVersion", VER_FILE_VERSION_STR - VALUE "LegalCopyright", "Copyright (C) 2015-2022" + VALUE "LegalCopyright", VER_COPYRIGHT_STR VALUE "ProductName", "Vulkan Runtime" VALUE "ProductVersion", VER_FILE_VERSION_STR END diff --git a/loader/loader.rc.in b/loader/loader.rc.in index 23010f53d21126534135b57de6651c4efe7499c0..0dc4227da250d774fb2a0ed4eb3532568b4c1ca7 100644 --- a/loader/loader.rc.in +++ b/loader/loader.rc.in @@ -1,7 +1,7 @@ // -// Copyright (c) 2014-2022 The Khronos Group Inc. -// Copyright (c) 2014-2022 Valve Corporation -// Copyright (c) 2014-2022 LunarG, Inc. +// Copyright (c) 2014-${LOADER_CUR_COPYRIGHT_YEAR} The Khronos Group Inc. +// Copyright (c) 2014-${LOADER_CUR_COPYRIGHT_YEAR} Valve Corporation +// Copyright (c) 2014-${LOADER_CUR_COPYRIGHT_YEAR} LunarG, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #define VER_FILE_VERSION ${LOADER_VER_FILE_VERSION} #define VER_FILE_DESCRIPTION_STR ${LOADER_VER_FILE_DESCRIPTION_STR} #define VER_FILE_VERSION_STR ${LOADER_VER_FILE_VERSION_STR} +#define VER_COPYRIGHT_STR "Copyright (C) 2015-${LOADER_CUR_COPYRIGHT_YEAR}" VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILE_VERSION @@ -46,7 +47,7 @@ BEGIN BEGIN VALUE "FileDescription", VER_FILE_DESCRIPTION_STR VALUE "FileVersion", VER_FILE_VERSION_STR - VALUE "LegalCopyright", "Copyright (C) 2015-2022" + VALUE "LegalCopyright", VER_COPYRIGHT_STR VALUE "ProductName", "Vulkan Runtime" VALUE "ProductVersion", VER_FILE_VERSION_STR END diff --git a/loader/loader_common.h b/loader/loader_common.h index 929ae41df37971d18ed1b6dd0f98733f8e07ef5b..da6e28e3a96e942152f933341e288fcafc8262a5 100644 --- a/loader/loader_common.h +++ b/loader/loader_common.h @@ -39,6 +39,8 @@ #include "vk_layer_dispatch_table.h" #include "vk_loader_extensions.h" +#include "settings.h" + typedef enum VkStringErrorFlagBits { VK_STRING_ERROR_NONE = 0x00000000, VK_STRING_ERROR_LENGTH = 0x00000001, @@ -65,6 +67,12 @@ struct loader_generic_list { void *list; }; +struct loader_string_list { + uint32_t allocated_count; + uint32_t count; + char **list; +}; + struct loader_extension_list { size_t capacity; uint32_t count; @@ -73,8 +81,7 @@ struct loader_extension_list { struct loader_dev_ext_props { VkExtensionProperties props; - uint32_t entrypoint_count; - char **entrypoints; + struct loader_string_list entrypoints; }; struct loader_device_extension_list { @@ -84,28 +91,20 @@ struct loader_device_extension_list { }; struct loader_name_value { - char name[MAX_STRING_SIZE]; - char value[MAX_STRING_SIZE]; + char *name; + char *value; }; struct loader_layer_functions { - char str_gipa[MAX_STRING_SIZE]; - char str_gdpa[MAX_STRING_SIZE]; - char str_negotiate_interface[MAX_STRING_SIZE]; + char *str_gipa; + char *str_gdpa; + char *str_negotiate_interface; PFN_vkNegotiateLoaderLayerInterfaceVersion negotiate_layer_interface; PFN_vkGetInstanceProcAddr get_instance_proc_addr; PFN_vkGetDeviceProcAddr get_device_proc_addr; PFN_GetPhysicalDeviceProcAddr get_physical_device_proc_addr; }; -struct loader_override_expiration { - uint16_t year; - uint8_t month; - uint8_t day; - uint8_t hour; - uint8_t minute; -}; - // This structure is used to store the json file version in a more manageable way. typedef struct { uint16_t major; @@ -121,6 +120,7 @@ enum loader_layer_library_status { LOADER_LAYER_LIB_ERROR_WRONG_BIT_TYPE = 20, LOADER_LAYER_LIB_ERROR_FAILED_TO_LOAD = 21, + LOADER_LAYER_LIB_ERROR_OUT_OF_MEMORY = 22, }; enum layer_type_flags { @@ -132,9 +132,11 @@ enum layer_type_flags { struct loader_layer_properties { VkLayerProperties info; enum layer_type_flags type_flags; + enum loader_settings_layer_control settings_control_value; + uint32_t interface_version; // PFN_vkNegotiateLoaderLayerInterfaceVersion - char manifest_file_name[MAX_STRING_SIZE]; - char lib_name[MAX_STRING_SIZE]; + char *manifest_file_name; + char *lib_name; enum loader_layer_library_status lib_status; loader_platform_dl_handle lib_handle; struct loader_layer_functions functions; @@ -142,36 +144,40 @@ struct loader_layer_properties { struct loader_device_extension_list device_extension_list; struct loader_name_value disable_env_var; struct loader_name_value enable_env_var; - uint32_t num_component_layers; - char (*component_layer_names)[MAX_STRING_SIZE]; + struct loader_string_list component_layer_names; struct { - char enumerate_instance_extension_properties[MAX_STRING_SIZE]; - char enumerate_instance_layer_properties[MAX_STRING_SIZE]; - char enumerate_instance_version[MAX_STRING_SIZE]; + char *enumerate_instance_extension_properties; + char *enumerate_instance_layer_properties; + char *enumerate_instance_version; } pre_instance_functions; - uint32_t num_override_paths; - char (*override_paths)[MAX_STRING_SIZE]; + struct loader_string_list override_paths; bool is_override; - bool has_expiration; - struct loader_override_expiration expiration; bool keep; - uint32_t num_blacklist_layers; - char (*blacklist_layer_names)[MAX_STRING_SIZE]; - uint32_t num_app_key_paths; - char (*app_key_paths)[MAX_STRING_SIZE]; + struct loader_string_list blacklist_layer_names; + struct loader_string_list app_key_paths; }; +// Stores a list of loader_layer_properties struct loader_layer_list { size_t capacity; uint32_t count; struct loader_layer_properties *list; }; +// Stores a list of pointers to loader_layer_properties +// Used for app_activated_layer_list and expanded_activated_layer_list +struct loader_pointer_layer_list { + size_t capacity; + uint32_t count; + struct loader_layer_properties **list; +}; + typedef VkResult(VKAPI_PTR *PFN_vkDevExt)(VkDevice device); struct loader_dev_dispatch_table { VkLayerDispatchTable core_dispatch; PFN_vkDevExt ext_dispatch[MAX_NUM_UNKNOWN_EXTS]; + struct loader_device_terminator_dispatch extension_terminator_dispatch; }; // per CreateDevice structure @@ -181,16 +187,16 @@ struct loader_device { VkDevice icd_device; // device object from the icd struct loader_physical_device_term *phys_dev_term; - // List of activated layers. - // app_ is the version based on exactly what the application asked for. - // This is what must be returned to the application on Enumerate calls. - // expanded_ is the version based on expanding meta-layers into their - // individual component layers. This is what is used internally. - struct loader_layer_list app_activated_layer_list; - struct loader_layer_list expanded_activated_layer_list; - VkAllocationCallbacks alloc_callbacks; + // List of activated device extensions that layers support (but not necessarily the driver which have functions that require + // trampolines to work correctly. EX - vkDebugMarkerSetObjectNameEXT can name wrapped handles like instance, physical device, + // or surface + struct { + bool ext_debug_marker_enabled; + bool ext_debug_utils_enabled; + } layer_extensions; + // List of activated device extensions that have terminators implemented in the loader struct { bool khr_swapchain_enabled; @@ -199,9 +205,13 @@ struct loader_device { bool ext_debug_marker_enabled; bool ext_debug_utils_enabled; bool ext_full_screen_exclusive_enabled; - } extensions; + } driver_extensions; struct loader_device *next; + + // Makes vkGetDeviceProcAddr check if core functions are supported by the current app_api_version. + // Only set to true if VK_KHR_maintenance5 is enabled. + bool should_ignore_device_commands_from_newer_version; }; // Per ICD information @@ -243,6 +253,9 @@ struct loader_instance { struct loader_instance_dispatch_table *disp; // must be first entry in structure uint64_t magic; // Should be LOADER_MAGIC_NUMBER + // Store all the terminators for instance functions in case a layer queries one *after* vkCreateInstance + VkLayerInstanceDispatchTable terminator_dispatch; + // Vulkan API version the app is intending to use. loader_api_version app_api_version; @@ -267,6 +280,8 @@ struct loader_instance { struct loader_icd_term *icd_terms; struct loader_icd_tramp_list icd_tramp_list; + // Must store the strings inside loader_instance directly - since the asm code will offset into + // loader_instance to get the function name uint32_t dev_ext_disp_function_count; char *dev_ext_disp_functions[MAX_NUM_UNKNOWN_EXTS]; uint32_t phys_dev_ext_disp_function_count; @@ -274,6 +289,8 @@ struct loader_instance { struct loader_msg_callback_map_entry *icd_msg_callback_map; + struct loader_string_list enabled_layer_names; + struct loader_layer_list instance_layer_list; bool override_layer_present; @@ -282,68 +299,71 @@ struct loader_instance { // This is what must be returned to the application on Enumerate calls. // expanded_ is the version based on expanding meta-layers into their // individual component layers. This is what is used internally. - struct loader_layer_list app_activated_layer_list; - struct loader_layer_list expanded_activated_layer_list; + struct loader_pointer_layer_list app_activated_layer_list; + struct loader_pointer_layer_list expanded_activated_layer_list; VkInstance instance; // layers/ICD instance returned to trampoline struct loader_extension_list ext_list; // icds and loaders extensions struct loader_instance_extension_enables enabled_known_extensions; - // Stores debug callbacks - used in the log - VkLayerDbgFunctionNode *DbgFunctionHead; - - // Stores the debug callbacks set during instance creation - // These are kept separate because they aren't to be used outside of instance creation and destruction - // So they are swapped out at the end of instance creation and swapped in at instance destruction - VkLayerDbgFunctionNode *InstanceCreationDeletionDebugFunctionHead; + // Stores debug callbacks - used in the log. + VkLayerDbgFunctionNode *current_dbg_function_head; // Current head + VkLayerDbgFunctionNode *instance_only_dbg_function_head; // Only used for instance create/destroy VkAllocationCallbacks alloc_callbacks; + // Set to true after vkCreateInstance has returned - necessary for loader_gpa_instance_terminator() + bool instance_finished_creation; + + loader_settings settings; + bool portability_enumeration_enabled; + bool portability_enumeration_flag_bit_set; + bool portability_enumeration_extension_enabled; bool wsi_surface_enabled; -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) bool wsi_win32_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) bool wsi_wayland_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) bool wsi_xcb_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) bool wsi_xlib_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) bool wsi_directfb_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) bool wsi_android_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) bool wsi_ohos_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) bool wsi_macos_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) bool wsi_ios_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) bool wsi_ggp_surface_enabled; #endif bool wsi_headless_surface_enabled; #if defined(VK_USE_PLATFORM_METAL_EXT) bool wsi_metal_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) bool wsi_imagepipe_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) bool wsi_screen_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) bool wsi_vi_surface_enabled; #endif bool wsi_display_enabled; @@ -384,9 +404,9 @@ struct loader_physical_device_term { VkPhysicalDevice phys_dev; // object from ICD }; -#ifdef LOADER_ENABLE_LINUX_SORT -// Structure for storing the relevent device information for selecting a device. -// NOTE: Needs to be defined here so we can store this content in the term structrue +#if defined(LOADER_ENABLE_LINUX_SORT) +// Structure for storing the relevant device information for selecting a device. +// NOTE: Needs to be defined here so we can store this content in the term structure // for quicker sorting. struct LinuxSortedDeviceInfo { // Associated Vulkan Physical Device @@ -417,7 +437,7 @@ struct loader_physical_device_group_term { struct loader_icd_term *this_icd_term; uint8_t icd_index; VkPhysicalDeviceGroupProperties group_props; -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) struct LinuxSortedDeviceInfo internal_device_info[VK_MAX_DEVICE_GROUP_SIZE]; #endif // LOADER_ENABLE_LINUX_SORT }; @@ -447,20 +467,49 @@ enum loader_data_files_type { LOADER_DATA_FILE_NUM_TYPES // Not a real field, used for possible loop terminator }; -struct loader_data_files { - uint32_t count; - uint32_t alloc_count; - char **filename_list; -}; - -struct loader_phys_dev_per_icd { +struct loader_icd_physical_devices { uint32_t device_count; VkPhysicalDevice *physical_devices; uint32_t icd_index; struct loader_icd_term *icd_term; +#if defined(WIN32) + LUID windows_adapter_luid; +#endif }; struct loader_msg_callback_map_entry { VkDebugReportCallbackEXT icd_obj; VkDebugReportCallbackEXT loader_obj; }; + +typedef enum loader_filter_string_type { + FILTER_STRING_FULLNAME = 0, + FILTER_STRING_SUBSTRING, + FILTER_STRING_PREFIX, + FILTER_STRING_SUFFIX, + FILTER_STRING_SPECIAL, +} loader_filter_string_type; + +struct loader_envvar_filter_value { + char value[VK_MAX_EXTENSION_NAME_SIZE]; + size_t length; + loader_filter_string_type type; +}; + +#define MAX_ADDITIONAL_FILTERS 16 +struct loader_envvar_filter { + uint32_t count; + struct loader_envvar_filter_value filters[MAX_ADDITIONAL_FILTERS]; +}; +struct loader_envvar_disable_layers_filter { + struct loader_envvar_filter additional_filters; + bool disable_all; + bool disable_all_implicit; + bool disable_all_explicit; +}; + +struct loader_envvar_all_filters { + struct loader_envvar_filter enable_filter; + struct loader_envvar_disable_layers_filter disable_filter; + struct loader_envvar_filter allow_filter; +}; diff --git a/loader/loader_environment.c b/loader/loader_environment.c new file mode 100644 index 0000000000000000000000000000000000000000..90aad168441e19838b082f0e1e8eca8ce26c5082 --- /dev/null +++ b/loader/loader_environment.c @@ -0,0 +1,577 @@ +/* + * + * Copyright (c) 2014-2023 The Khronos Group Inc. + * Copyright (c) 2014-2023 Valve Corporation + * Copyright (c) 2014-2023 LunarG, Inc. + * + * 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: Jon Ashburn + * Author: Courtney Goeltzenleuchter + * Author: Chia-I Wu + * Author: Chia-I Wu + * Author: Mark Lobodzinski + * Author: Lenny Komow + * Author: Charles Giessen + * + */ + +#include "loader_environment.h" + +#include "allocation.h" +#include "loader.h" +#include "log.h" + +#include +#include "param/sys_param.h" + +// Environment variables +#if COMMON_UNIX_PLATFORMS + +bool is_high_integrity() { return geteuid() != getuid() || getegid() != getgid(); } + +char *loader_getenv(const char *name, const struct loader_instance *inst) { + if (NULL == name) return NULL; +#if defined(__OHOS__) + CachedHandle g_Handle = CachedParameterCreate(name, ""); + int changed = 0; + const char *res = CachedParameterGetChanged(g_Handle, &changed); + loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_INFO_BIT, 0, "loader_getenv name:%s, res:%s", name, res); + if (res == NULL || res[0] == '\0') { + return NULL; + } + return (char *)res; +#else + // No allocation of memory necessary for Linux, but we should at least touch + // the inst pointer to get rid of compiler warnings. + (void)inst; + return getenv(name); +#endif +} + +char *loader_secure_getenv(const char *name, const struct loader_instance *inst) { +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) + // Apple does not appear to have a secure getenv implementation. + // The main difference between secure getenv and getenv is that secure getenv + // returns NULL if the process is being run with elevated privileges by a normal user. + // The idea is to prevent the reading of malicious environment variables by a process + // that can do damage. + // This algorithm is derived from glibc code that sets an internal + // variable (__libc_enable_secure) if the process is running under setuid or setgid. + return is_high_integrity() ? NULL : loader_getenv(name, inst); +#elif defined(__Fuchsia__) + return loader_getenv(name, inst); +#else + // Linux + char *out; +#if defined(HAVE_SECURE_GETENV) && !defined(LOADER_USE_UNSAFE_FILE_SEARCH) + (void)inst; + out = secure_getenv(name); +#elif defined(HAVE___SECURE_GETENV) && !defined(LOADER_USE_UNSAFE_FILE_SEARCH) + (void)inst; + out = __secure_getenv(name); +#else + out = loader_getenv(name, inst); +#if !defined(LOADER_USE_UNSAFE_FILE_SEARCH) + loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "Loader is using non-secure environment variable lookup for %s", name); +#endif +#endif + return out; +#endif +} + +void loader_free_getenv(char *val, const struct loader_instance *inst) { + // No freeing of memory necessary for Linux, but we should at least touch + // the val and inst pointers to get rid of compiler warnings. + (void)val; + (void)inst; +} + +#elif defined(WIN32) + +bool is_high_integrity() { + HANDLE process_token; + if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_QUERY_SOURCE, &process_token)) { + // Maximum possible size of SID_AND_ATTRIBUTES is maximum size of a SID + size of attributes DWORD. + uint8_t mandatory_label_buffer[SECURITY_MAX_SID_SIZE + sizeof(DWORD)]; + DWORD buffer_size; + if (GetTokenInformation(process_token, TokenIntegrityLevel, mandatory_label_buffer, sizeof(mandatory_label_buffer), + &buffer_size) != 0) { + const TOKEN_MANDATORY_LABEL *mandatory_label = (const TOKEN_MANDATORY_LABEL *)mandatory_label_buffer; + const DWORD sub_authority_count = *GetSidSubAuthorityCount(mandatory_label->Label.Sid); + const DWORD integrity_level = *GetSidSubAuthority(mandatory_label->Label.Sid, sub_authority_count - 1); + + CloseHandle(process_token); + return integrity_level >= SECURITY_MANDATORY_HIGH_RID; + } + + CloseHandle(process_token); + } + + return false; +} + +char *loader_getenv(const char *name, const struct loader_instance *inst) { + int name_utf16_size = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); + if (name_utf16_size <= 0) { + return NULL; + } + wchar_t *name_utf16 = (wchar_t *)loader_stack_alloc(name_utf16_size * sizeof(wchar_t)); + if (MultiByteToWideChar(CP_UTF8, 0, name, -1, name_utf16, name_utf16_size) != name_utf16_size) { + return NULL; + } + + DWORD val_size = GetEnvironmentVariableW(name_utf16, NULL, 0); + // val_size DOES include the null terminator, so for any set variable + // will always be at least 1. If it's 0, the variable wasn't set. + if (val_size == 0) { + return NULL; + } + + wchar_t *val = (wchar_t *)loader_stack_alloc(val_size * sizeof(wchar_t)); + if (GetEnvironmentVariableW(name_utf16, val, val_size) != val_size - 1) { + return NULL; + } + + int val_utf8_size = WideCharToMultiByte(CP_UTF8, 0, val, -1, NULL, 0, NULL, NULL); + if (val_utf8_size <= 0) { + return NULL; + } + char *val_utf8 = (char *)loader_instance_heap_alloc(inst, val_utf8_size * sizeof(char), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (val_utf8 == NULL) { + return NULL; + } + if (WideCharToMultiByte(CP_UTF8, 0, val, -1, val_utf8, val_utf8_size, NULL, NULL) != val_utf8_size) { + loader_instance_heap_free(inst, val_utf8); + return NULL; + } + return val_utf8; +} + +char *loader_secure_getenv(const char *name, const struct loader_instance *inst) { + if (NULL == name) return NULL; +#if !defined(LOADER_USE_UNSAFE_FILE_SEARCH) + if (is_high_integrity()) { + loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, + "Loader is running with elevated permissions. Environment variable %s will be ignored", name); + return NULL; + } +#endif + + return loader_getenv(name, inst); +} + +void loader_free_getenv(char *val, const struct loader_instance *inst) { loader_instance_heap_free(inst, (void *)val); } + +#else + +#warning \ + "This platform does not support environment variables! If this is not intended, please implement the stubs functions loader_getenv and loader_free_getenv" + +char *loader_getenv(const char *name, const struct loader_instance *inst) { + // stub func + (void)inst; + (void)name; + return NULL; +} +void loader_free_getenv(char *val, const struct loader_instance *inst) { + // stub func + (void)val; + (void)inst; +} + +#endif + +// Determine the type of filter string based on the contents of it. +// This will properly check against: +// - substrings "*string*" +// - prefixes "string*" +// - suffixes "*string" +// - full string names "string" +// It will also return the correct start and finish to remove any star '*' characters for the actual string compare +void determine_filter_type(const char *filter_string, enum loader_filter_string_type *filter_type, const char **new_start, + size_t *new_length) { + size_t filter_length = strlen(filter_string); + bool star_begin = false; + bool star_end = false; + if ('~' == filter_string[0]) { + // One of the special identifiers like: ~all~, ~implicit~, or ~explicit~ + *filter_type = FILTER_STRING_SPECIAL; + *new_start = filter_string; + *new_length = filter_length; + } else { + if ('*' == filter_string[0]) { + // Only the * means everything + if (filter_length == 1) { + *filter_type = FILTER_STRING_SPECIAL; + *new_start = filter_string; + *new_length = filter_length; + } else { + star_begin = true; + } + } + if ('*' == filter_string[filter_length - 1]) { + // Not really valid, but just catch this case so if someone accidentally types "**" it will also mean everything + if (filter_length == 2) { + *filter_type = FILTER_STRING_SPECIAL; + *new_start = filter_string; + *new_length = filter_length; + } else { + star_end = true; + } + } + if (star_begin && star_end) { + *filter_type = FILTER_STRING_SUBSTRING; + *new_start = &filter_string[1]; + *new_length = filter_length - 2; + } else if (star_begin) { + *new_start = &filter_string[1]; + *new_length = filter_length - 1; + *filter_type = FILTER_STRING_SUFFIX; + } else if (star_end) { + *filter_type = FILTER_STRING_PREFIX; + *new_start = filter_string; + *new_length = filter_length - 1; + } else { + *filter_type = FILTER_STRING_FULLNAME; + *new_start = filter_string; + *new_length = filter_length; + } + } +} + +// Parse the provided filter string provided by the envrionment variable into the appropriate filter +// struct variable. +VkResult parse_generic_filter_environment_var(const struct loader_instance *inst, const char *env_var_name, + struct loader_envvar_filter *filter_struct) { + VkResult result = VK_SUCCESS; + memset(filter_struct, 0, sizeof(struct loader_envvar_filter)); + char *parsing_string = NULL; + char *env_var_value = loader_secure_getenv(env_var_name, inst); + if (NULL == env_var_value) { + return result; + } + const size_t env_var_len = strlen(env_var_value); + if (env_var_len == 0) { + goto out; + } + // Allocate a separate string since scan_for_next_comma modifies the original string + parsing_string = loader_instance_heap_calloc(inst, env_var_len + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == parsing_string) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "parse_generic_filter_environment_var: Failed to allocate space for parsing env var \'%s\'", env_var_name); + result = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + + for (uint32_t iii = 0; iii < env_var_len; ++iii) { + parsing_string[iii] = (char)tolower(env_var_value[iii]); + } + parsing_string[env_var_len] = '\0'; + + char *context = NULL; + char *token = thread_safe_strtok(parsing_string, ",", &context); + while (NULL != token) { + enum loader_filter_string_type cur_filter_type; + const char *actual_start; + size_t actual_len; + determine_filter_type(token, &cur_filter_type, &actual_start, &actual_len); + if (actual_len > VK_MAX_EXTENSION_NAME_SIZE) { + loader_strncpy(filter_struct->filters[filter_struct->count].value, VK_MAX_EXTENSION_NAME_SIZE, actual_start, + VK_MAX_EXTENSION_NAME_SIZE); + } else { + loader_strncpy(filter_struct->filters[filter_struct->count].value, VK_MAX_EXTENSION_NAME_SIZE, actual_start, + actual_len); + } + filter_struct->filters[filter_struct->count].length = actual_len; + filter_struct->filters[filter_struct->count++].type = cur_filter_type; + if (filter_struct->count >= MAX_ADDITIONAL_FILTERS) { + break; + } + token = thread_safe_strtok(NULL, ",", &context); + } + +out: + + loader_instance_heap_free(inst, parsing_string); + loader_free_getenv(env_var_value, inst); + return result; +} + +// Parse the disable layer string. The layer disable has some special behavior because we allow it to disable +// all layers (either with "~all~", "*", or "**"), all implicit layers (with "~implicit~"), and all explicit layers +// (with "~explicit~"), in addition to the other layer filtering behavior. +VkResult parse_layers_disable_filter_environment_var(const struct loader_instance *inst, + struct loader_envvar_disable_layers_filter *disable_struct) { + VkResult result = VK_SUCCESS; + memset(disable_struct, 0, sizeof(struct loader_envvar_disable_layers_filter)); + char *parsing_string = NULL; + char *env_var_value = loader_secure_getenv(VK_LAYERS_DISABLE_ENV_VAR, inst); + if (NULL == env_var_value) { + goto out; + } + const size_t env_var_len = strlen(env_var_value); + if (env_var_len == 0) { + goto out; + } + // Allocate a separate string since scan_for_next_comma modifies the original string + parsing_string = loader_instance_heap_calloc(inst, env_var_len + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == parsing_string) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "parse_layers_disable_filter_environment_var: Failed to allocate space for parsing env var " + "\'VK_LAYERS_DISABLE_ENV_VAR\'"); + result = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + + for (uint32_t iii = 0; iii < env_var_len; ++iii) { + parsing_string[iii] = (char)tolower(env_var_value[iii]); + } + parsing_string[env_var_len] = '\0'; + + char *context = NULL; + char *token = thread_safe_strtok(parsing_string, ",", &context); + while (NULL != token) { + uint32_t cur_count = disable_struct->additional_filters.count; + enum loader_filter_string_type cur_filter_type; + const char *actual_start; + size_t actual_len; + determine_filter_type(token, &cur_filter_type, &actual_start, &actual_len); + if (cur_filter_type == FILTER_STRING_SPECIAL) { + if (!strcmp(VK_LOADER_DISABLE_ALL_LAYERS_VAR_1, token) || !strcmp(VK_LOADER_DISABLE_ALL_LAYERS_VAR_2, token) || + !strcmp(VK_LOADER_DISABLE_ALL_LAYERS_VAR_3, token)) { + disable_struct->disable_all = true; + } else if (!strcmp(VK_LOADER_DISABLE_IMPLICIT_LAYERS_VAR, token)) { + disable_struct->disable_all_implicit = true; + } else if (!strcmp(VK_LOADER_DISABLE_EXPLICIT_LAYERS_VAR, token)) { + disable_struct->disable_all_explicit = true; + } + } else { + if (actual_len > VK_MAX_EXTENSION_NAME_SIZE) { + loader_strncpy(disable_struct->additional_filters.filters[cur_count].value, VK_MAX_EXTENSION_NAME_SIZE, + actual_start, VK_MAX_EXTENSION_NAME_SIZE); + } else { + loader_strncpy(disable_struct->additional_filters.filters[cur_count].value, VK_MAX_EXTENSION_NAME_SIZE, + actual_start, actual_len); + } + disable_struct->additional_filters.filters[cur_count].length = actual_len; + disable_struct->additional_filters.filters[cur_count].type = cur_filter_type; + disable_struct->additional_filters.count++; + if (disable_struct->additional_filters.count >= MAX_ADDITIONAL_FILTERS) { + break; + } + } + token = thread_safe_strtok(NULL, ",", &context); + } +out: + loader_instance_heap_free(inst, parsing_string); + loader_free_getenv(env_var_value, inst); + return result; +} + +// Parses the filter environment variables to determine if we have any special behavior +VkResult parse_layer_environment_var_filters(const struct loader_instance *inst, struct loader_envvar_all_filters *layer_filters) { + VkResult res = parse_generic_filter_environment_var(inst, VK_LAYERS_ENABLE_ENV_VAR, &layer_filters->enable_filter); + if (VK_SUCCESS != res) { + return res; + } + res = parse_layers_disable_filter_environment_var(inst, &layer_filters->disable_filter); + if (VK_SUCCESS != res) { + return res; + } + res = parse_generic_filter_environment_var(inst, VK_LAYERS_ALLOW_ENV_VAR, &layer_filters->allow_filter); + if (VK_SUCCESS != res) { + return res; + } + return res; +} + +// Check to see if the provided layer name matches any of the filter strings. +// This will properly check against: +// - substrings "*string*" +// - prefixes "string*" +// - suffixes "*string" +// - full string names "string" +bool check_name_matches_filter_environment_var(const char *name, const struct loader_envvar_filter *filter_struct) { + bool ret_value = false; + const size_t name_len = strlen(name); + char lower_name[VK_MAX_EXTENSION_NAME_SIZE]; + for (uint32_t iii = 0; iii < name_len; ++iii) { + lower_name[iii] = (char)tolower(name[iii]); + } + lower_name[name_len] = '\0'; + for (uint32_t filt = 0; filt < filter_struct->count; ++filt) { + // Check if the filter name is longer (this is with all special characters removed), and if it is + // continue since it can't match. + if (filter_struct->filters[filt].length > name_len) { + continue; + } + switch (filter_struct->filters[filt].type) { + case FILTER_STRING_SPECIAL: + if (!strcmp(VK_LOADER_DISABLE_ALL_LAYERS_VAR_1, filter_struct->filters[filt].value) || + !strcmp(VK_LOADER_DISABLE_ALL_LAYERS_VAR_2, filter_struct->filters[filt].value) || + !strcmp(VK_LOADER_DISABLE_ALL_LAYERS_VAR_3, filter_struct->filters[filt].value)) { + ret_value = true; + } + break; + + case FILTER_STRING_SUBSTRING: + if (NULL != strstr(lower_name, filter_struct->filters[filt].value)) { + ret_value = true; + } + break; + + case FILTER_STRING_SUFFIX: + if (0 == strncmp(lower_name + name_len - filter_struct->filters[filt].length, filter_struct->filters[filt].value, + filter_struct->filters[filt].length)) { + ret_value = true; + } + break; + + case FILTER_STRING_PREFIX: + if (0 == strncmp(lower_name, filter_struct->filters[filt].value, filter_struct->filters[filt].length)) { + ret_value = true; + } + break; + + case FILTER_STRING_FULLNAME: + if (0 == strncmp(lower_name, filter_struct->filters[filt].value, name_len)) { + ret_value = true; + } + break; + } + if (ret_value) { + break; + } + } + return ret_value; +} + +// Get the layer name(s) from the env_name environment variable. If layer is found in +// search_list then add it to layer_list. But only add it to layer_list if type_flags matches. +VkResult loader_add_environment_layers(struct loader_instance *inst, const enum layer_type_flags type_flags, + const struct loader_envvar_all_filters *filters, + struct loader_pointer_layer_list *target_list, + struct loader_pointer_layer_list *expanded_target_list, + const struct loader_layer_list *source_list) { + VkResult res = VK_SUCCESS; + char *layer_env = loader_getenv(ENABLED_LAYERS_ENV, inst); + + // If the layer environment variable is present (i.e. VK_INSTANCE_LAYERS), we will always add it to the layer list. + if (layer_env != NULL) { + size_t layer_env_len = strlen(layer_env) + 1; + char *name = loader_stack_alloc(layer_env_len); + if (name != NULL) { + loader_strncpy(name, layer_env_len, layer_env, layer_env_len); + + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "env var \'%s\' defined and adding layers \"%s\"", + ENABLED_LAYERS_ENV, name); + + // First look for the old-fashion layers forced on with VK_INSTANCE_LAYERS + while (name && *name) { + char *next = loader_get_next_path(name); + + if (strlen(name) > 0) { + bool found = false; + for (uint32_t i = 0; i < source_list->count; i++) { + struct loader_layer_properties *source_prop = &source_list->list[i]; + + if (0 == strcmp(name, source_prop->info.layerName)) { + found = true; + // Only add it if it doesn't already appear in the layer list + if (!loader_find_layer_name_in_list(source_prop->info.layerName, target_list)) { + if (0 == (source_prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER)) { + res = loader_add_layer_properties_to_list(inst, target_list, source_prop); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + res = loader_add_layer_properties_to_list(inst, expanded_target_list, source_prop); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + } else { + res = loader_add_meta_layer(inst, filters, source_prop, target_list, expanded_target_list, + source_list, NULL); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + } + break; + } + } + } + if (!found) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Layer \"%s\" was not found but was requested by env var VK_INSTANCE_LAYERS!", name); + } + } + name = next; + } + } + } + + // Loop through all the layers and check the enable/disable filters + for (uint32_t i = 0; i < source_list->count; i++) { + struct loader_layer_properties *source_prop = &source_list->list[i]; + + // If it doesn't match the type, or the name isn't what we're looking for, just continue + if ((source_prop->type_flags & type_flags) != type_flags) { + continue; + } + + // We found a layer we're interested in, but has it been disabled... + bool adding = true; + bool is_implicit = (0 == (source_prop->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER)); + bool disabled_by_type = + (is_implicit) ? (filters->disable_filter.disable_all_implicit) : (filters->disable_filter.disable_all_explicit); + if ((filters->disable_filter.disable_all || disabled_by_type || + check_name_matches_filter_environment_var(source_prop->info.layerName, &filters->disable_filter.additional_filters)) && + !check_name_matches_filter_environment_var(source_prop->info.layerName, &filters->allow_filter)) { + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Layer \"%s\" ignored because it has been disabled by env var \'%s\'", source_prop->info.layerName, + VK_LAYERS_DISABLE_ENV_VAR); + adding = false; + } + + // If we are supposed to filter through all layers, we need to compare the layer name against the filter. + // This can override the disable above, so we want to do it second. + // Also make sure the layer isn't already in the output_list, skip adding it if it is. + if (check_name_matches_filter_environment_var(source_prop->info.layerName, &filters->enable_filter) && + !loader_find_layer_name_in_list(source_prop->info.layerName, target_list)) { + adding = true; + // Only way is_substring is true is if there are enable variables. If that's the case, and we're past the + // above, we should indicate that it was forced on in this way. + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, + "Layer \"%s\" forced enabled due to env var \'%s\'", source_prop->info.layerName, VK_LAYERS_ENABLE_ENV_VAR); + } else { + adding = false; + } + + if (!adding) { + continue; + } + + // If not a meta-layer, simply add it. + if (0 == (source_prop->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER)) { + res = loader_add_layer_properties_to_list(inst, target_list, source_prop); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + res = loader_add_layer_properties_to_list(inst, expanded_target_list, source_prop); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + } else { + res = loader_add_meta_layer(inst, filters, source_prop, target_list, expanded_target_list, source_list, NULL); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + } + } + +out: + + if (layer_env != NULL) { + loader_free_getenv(layer_env, inst); + } + + return res; +} diff --git a/loader/get_environment.h b/loader/loader_environment.h similarity index 55% rename from loader/get_environment.h rename to loader/loader_environment.h index 2b1663b41289f64dc792058f1acf8d3c473b6bee..15474a3aba4b77d33a7a7a547eceb7fcd6ec4fc7 100644 --- a/loader/get_environment.h +++ b/loader/loader_environment.h @@ -35,10 +35,22 @@ char *loader_getenv(const char *name, const struct loader_instance *inst); void loader_free_getenv(char *val, const struct loader_instance *inst); -#if defined(WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(WIN32) || COMMON_UNIX_PLATFORMS bool is_high_integrity(); char *loader_secure_getenv(const char *name, const struct loader_instance *inst); #endif + +VkResult parse_generic_filter_environment_var(const struct loader_instance *inst, const char *env_var_name, + struct loader_envvar_filter *filter_struct); +VkResult parse_layers_disable_filter_environment_var(const struct loader_instance *inst, + struct loader_envvar_disable_layers_filter *disable_struct); +VkResult parse_layer_environment_var_filters(const struct loader_instance *inst, struct loader_envvar_all_filters *layer_filters); +bool check_name_matches_filter_environment_var(const char *name, const struct loader_envvar_filter *filter_struct); +VkResult loader_add_environment_layers(struct loader_instance *inst, const enum layer_type_flags type_flags, + const struct loader_envvar_all_filters *filters, + struct loader_pointer_layer_list *target_list, + struct loader_pointer_layer_list *expanded_target_list, + const struct loader_layer_list *source_list); diff --git a/loader/loader_linux.c b/loader/loader_linux.c index 4a31da6237d2beaea828335d3ac790b0485a9244..e0b3db81b20126b53e0d0b7fb279a84429b591e5 100644 --- a/loader/loader_linux.c +++ b/loader/loader_linux.c @@ -22,7 +22,7 @@ // Non-windows and non-apple only header file, guard it so that accidental // inclusion doesn't cause unknown header include errors -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) #include #include @@ -30,12 +30,12 @@ #include "loader_linux.h" #include "allocation.h" -#include "get_environment.h" +#include "loader_environment.h" #include "loader.h" #include "log.h" // Determine a priority based on device type with the higher value being higher priority. -static uint32_t determine_priority_type_value(VkPhysicalDeviceType type) { +uint32_t determine_priority_type_value(VkPhysicalDeviceType type) { switch (type) { case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: return 10; @@ -55,7 +55,7 @@ static uint32_t determine_priority_type_value(VkPhysicalDeviceType type) { // Compare the two device types. // This behaves similar to a qsort compare. -static int32_t device_type_compare(VkPhysicalDeviceType a, VkPhysicalDeviceType b) { +int32_t device_type_compare(VkPhysicalDeviceType a, VkPhysicalDeviceType b) { uint32_t a_value = determine_priority_type_value(a); uint32_t b_value = determine_priority_type_value(b); if (a_value > b_value) { @@ -204,12 +204,12 @@ int32_t compare_device_groups(const void *a, const void *b) { } // Search for the default device using the loader environment variable. -static void linux_env_var_default_device(struct loader_instance *inst, uint32_t device_count, - struct LinuxSortedDeviceInfo *sorted_device_info) { +void linux_env_var_default_device(struct loader_instance *inst, uint32_t device_count, + struct LinuxSortedDeviceInfo *sorted_device_info) { char *selection = loader_getenv("VK_LOADER_DEVICE_SELECT", inst); if (NULL != selection) { loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_DRIVER_BIT, 0, - "linux_env_var_default_device: Found VK_LOADER_DEVICE_SELECT set to %s", selection); + "linux_env_var_default_device: Found \'VK_LOADER_DEVICE_SELECT\' set to %s", selection); // The environment variable exists, so grab the vendor ID and device ID of the // selected default device @@ -233,7 +233,7 @@ static void linux_env_var_default_device(struct loader_instance *inst, uint32_t // This function allocates an array in sorted_devices which must be freed by the caller if not null VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32_t icd_count, - struct loader_phys_dev_per_icd *icd_devices, uint32_t phys_dev_count, + struct loader_icd_physical_devices *icd_devices, uint32_t phys_dev_count, struct loader_physical_device_term **sorted_device_term) { VkResult res = VK_SUCCESS; bool app_is_vulkan_1_1 = loader_check_version_meets_required(LOADER_VERSION_1_1_0, inst->app_api_version); @@ -269,7 +269,7 @@ VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32 bool device_is_1_1_capable = loader_check_version_meets_required(LOADER_VERSION_1_1_0, loader_make_version(dev_props.apiVersion)); if (!sorted_device_info[index].has_pci_bus_info) { - uint32_t ext_count; + uint32_t ext_count = 0; icd_term->dispatch.EnumerateDeviceExtensionProperties(sorted_device_info[index].physical_device, NULL, &ext_count, NULL); if (ext_count > 0) { @@ -437,16 +437,14 @@ VkResult linux_sort_physical_device_groups(struct loader_instance *inst, uint32_ // Sort device groups by PCI info qsort(sorted_group_term, group_count, sizeof(struct loader_physical_device_group_term), compare_device_groups); - if (loader_get_debug_level() & (VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT)) { - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "linux_sort_physical_device_groups: Sorted order:"); - for (uint32_t group = 0; group < group_count; ++group) { - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, " Group %u", group); - for (uint32_t gpu = 0; gpu < sorted_group_term[group].group_props.physicalDeviceCount; ++gpu) { - loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, " [%u] %s %p %s", gpu, - sorted_group_term[group].internal_device_info[gpu].device_name, - sorted_group_term[group].internal_device_info[gpu].physical_device, - (sorted_group_term[group].internal_device_info[gpu].default_device ? "[default]" : "")); - } + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "linux_sort_physical_device_groups: Sorted order:"); + for (uint32_t group = 0; group < group_count; ++group) { + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, " Group %u", group); + for (uint32_t gpu = 0; gpu < sorted_group_term[group].group_props.physicalDeviceCount; ++gpu) { + loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, " [%u] %s %p %s", gpu, + sorted_group_term[group].internal_device_info[gpu].device_name, + sorted_group_term[group].internal_device_info[gpu].physical_device, + (sorted_group_term[group].internal_device_info[gpu].default_device ? "[default]" : "")); } } diff --git a/loader/loader_linux.h b/loader/loader_linux.h index 5515953e8de3b00bf57d2c1c1e4b9958b513c570..794ea24aa6645ed8ce7cad662f26cd52775d48c6 100644 --- a/loader/loader_linux.h +++ b/loader/loader_linux.h @@ -22,17 +22,17 @@ #pragma once -#ifdef LOADER_ENABLE_LINUX_SORT +#if defined(LOADER_ENABLE_LINUX_SORT) #include "loader_common.h" // This function allocates an array in sorted_devices which must be freed by the caller if not null VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32_t icd_count, - struct loader_phys_dev_per_icd *icd_devices, uint32_t phys_dev_count, + struct loader_icd_physical_devices *icd_devices, uint32_t phys_dev_count, struct loader_physical_device_term **sorted_device_term); // This function sorts an array in physical device groups VkResult linux_sort_physical_device_groups(struct loader_instance *inst, uint32_t group_count, struct loader_physical_device_group_term *sorted_group_term); -#endif // LOADER_ENABLE_LINUX_SORT \ No newline at end of file +#endif // LOADER_ENABLE_LINUX_SORT diff --git a/loader/loader_windows.c b/loader/loader_windows.c index 4015acbb8f71541335785ec1562d0a9f5026baa5..5b0dfb0dab70fae51f5f87d1ccfaf2d8e5eb5ea4 100644 --- a/loader/loader_windows.c +++ b/loader/loader_windows.c @@ -27,7 +27,7 @@ * */ // Windows only header file, guard it so that accidental inclusion doesn't cause unknown header include errors -#ifdef _WIN32 +#if defined(_WIN32) // This needs to be defined first, or else we'll get redefinitions on NTSTATUS values #define UMDF_USING_NTSTATUS @@ -36,7 +36,7 @@ #include "loader_windows.h" #include "allocation.h" -#include "get_environment.h" +#include "loader_environment.h" #include "loader.h" #include "log.h" @@ -45,13 +45,13 @@ #include #include #include -#ifdef __MINGW32__ -#undef strcpy // fix error with redfined strcpy when building with MinGW-w64 +#if defined(__MINGW32__) +#undef strcpy // fix error with redefined strcpy when building with MinGW-w64 #endif #include #include "adapters.h" -#ifndef __MINGW32__ +#if !defined(__MINGW32__) // not yet available with MinGW-w64 stable #include #endif @@ -61,7 +61,10 @@ #endif typedef HRESULT(APIENTRY *PFN_CreateDXGIFactory1)(REFIID riid, void **ppFactory); -static PFN_CreateDXGIFactory1 fpCreateDXGIFactory1; +PFN_CreateDXGIFactory1 fpCreateDXGIFactory1; + +// Empty function just so windows_initialization can find the current module location +void function_for_finding_the_current_module(void) {} void windows_initialization(void) { char dll_location[MAX_PATH]; @@ -69,7 +72,7 @@ void windows_initialization(void) { // Get a module handle to a static function inside of this source if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, - (LPCSTR)&loader_debug_init, &module_handle) != 0 && + (LPCSTR)&function_for_finding_the_current_module, &module_handle) != 0 && GetModuleFileName(module_handle, dll_location, sizeof(dll_location)) != 0) { loader_log(NULL, VULKAN_LOADER_INFO_BIT, 0, "Using Vulkan Loader %s", dll_location); } @@ -82,7 +85,8 @@ void windows_initialization(void) { GetSystemDirectoryW(systemPath, MAX_PATH); StringCchCatW(systemPath, MAX_PATH, L"\\dxgi.dll"); HMODULE dxgi_module = LoadLibraryW(systemPath); - fpCreateDXGIFactory1 = dxgi_module == NULL ? NULL : (PFN_CreateDXGIFactory1)GetProcAddress(dxgi_module, "CreateDXGIFactory1"); + fpCreateDXGIFactory1 = + dxgi_module == NULL ? NULL : (PFN_CreateDXGIFactory1)(void *)GetProcAddress(dxgi_module, "CreateDXGIFactory1"); #if !defined(NDEBUG) _set_error_mode(_OUT_TO_STDERR); @@ -92,6 +96,7 @@ void windows_initialization(void) { } BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) { + (void)hinst; switch (reason) { case DLL_PROCESS_ATTACH: loader_initialize(); @@ -227,9 +232,9 @@ out: VkResult windows_get_device_registry_files(const struct loader_instance *inst, uint32_t log_target_flag, char **reg_data, PDWORD reg_data_size, LPCSTR value_name) { - static const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}"; - static const wchar_t *displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}"; -#ifdef CM_GETIDLIST_FILTER_PRESENT + const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}"; + const wchar_t *displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}"; +#if defined(CM_GETIDLIST_FILTER_PRESENT) const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; #else const ULONG flags = 0x300; @@ -348,7 +353,7 @@ VkResult windows_get_registry_files(const struct loader_instance *inst, char *lo PDWORD reg_data_size) { // This list contains all of the allowed ICDs. This allows us to verify that a device is actually present from the vendor // specified. This does disallow other vendors, but any new driver should use the device-specific registries anyway. - static const struct { + const struct { const char *filename; unsigned int vendor_id; } known_drivers[] = { @@ -525,8 +530,8 @@ VkResult windows_get_registry_files(const struct loader_instance *inst, char *lo foundDuplicate = true; } } - - if (foundDuplicate == false) { + // Only skip if we are adding a driver and a duplicate was found + if (!is_driver || (is_driver && foundDuplicate == false)) { // Add the new entry to the list. (void)snprintf(*reg_data + strlen(*reg_data), name_size + 2, "%c%s", PATH_SEPARATOR, name); found = true; @@ -553,7 +558,8 @@ VkResult windows_get_registry_files(const struct loader_instance *inst, char *lo } if (!found && result != VK_ERROR_OUT_OF_HOST_MEMORY) { - loader_log(inst, log_target_flag, 0, "Found no registry files in %s", location); + loader_log(inst, log_target_flag, 0, "Found no registry files in %s\\%s", + (hive == DEFAULT_VK_REGISTRY_HIVE) ? DEFAULT_VK_REGISTRY_HIVE_STR : SECONDARY_VK_REGISTRY_HIVE_STR, location); result = VK_ERROR_INCOMPATIBLE_DRIVER; } @@ -581,9 +587,10 @@ VkResult windows_read_manifest_from_d3d_adapters(const struct loader_instance *i goto out; } - PFN_LoaderEnumAdapters2 fpLoaderEnumAdapters2 = (PFN_LoaderEnumAdapters2)GetProcAddress(gdi32_dll, "D3DKMTEnumAdapters2"); + PFN_LoaderEnumAdapters2 fpLoaderEnumAdapters2 = + (PFN_LoaderEnumAdapters2)(void *)GetProcAddress(gdi32_dll, "D3DKMTEnumAdapters2"); PFN_LoaderQueryAdapterInfo fpLoaderQueryAdapterInfo = - (PFN_LoaderQueryAdapterInfo)GetProcAddress(gdi32_dll, "D3DKMTQueryAdapterInfo"); + (PFN_LoaderQueryAdapterInfo)(void *)GetProcAddress(gdi32_dll, "D3DKMTQueryAdapterInfo"); if (fpLoaderEnumAdapters2 == NULL || fpLoaderQueryAdapterInfo == NULL) { result = VK_ERROR_INCOMPATIBLE_DRIVER; goto out; @@ -615,7 +622,8 @@ VkResult windows_read_manifest_from_d3d_adapters(const struct loader_instance *i .value_type = REG_MULTI_SZ, .physical_adapter_index = 0, }; - wcsncpy(filename_info.value_name, value_name, sizeof(filename_info.value_name) / sizeof(WCHAR)); + size_t value_name_size = wcslen(value_name); + wcsncpy_s(filename_info.value_name, MAX_PATH, value_name, value_name_size); LoaderQueryAdapterInfo query_info; query_info.handle = adapters.adapters[i].handle; query_info.type = LOADER_QUERY_TYPE_REGISTRY; @@ -680,7 +688,7 @@ VkResult windows_read_manifest_from_d3d_adapters(const struct loader_instance *i goto out; } - // If this is a string and not a multi-string, we don't want to go throught the loop more than once + // If this is a string and not a multi-string, we don't want to go through the loop more than once if (full_info->value_type == REG_SZ) { break; } @@ -698,17 +706,19 @@ out: // Look for data files in the registry. VkResult windows_read_data_files_in_registry(const struct loader_instance *inst, enum loader_data_files_type data_file_type, bool warn_if_not_present, char *registry_location, - struct loader_data_files *out_files) { + struct loader_string_list *out_files) { VkResult vk_result = VK_SUCCESS; char *search_path = NULL; uint32_t log_target_flag = 0; if (data_file_type == LOADER_DATA_FILE_MANIFEST_DRIVER) { log_target_flag = VULKAN_LOADER_DRIVER_BIT; - loader_log(inst, log_target_flag, 0, "Checking for Driver Manifest files in Registry at %s", registry_location); + loader_log(inst, log_target_flag, 0, "Checking for Driver Manifest files in Registry at %s\\%s", + DEFAULT_VK_REGISTRY_HIVE_STR, registry_location); } else { log_target_flag = VULKAN_LOADER_LAYER_BIT; - loader_log(inst, log_target_flag, 0, "Checking for Layer Manifest files in Registry at %s", registry_location); + loader_log(inst, log_target_flag, 0, "Checking for Layer Manifest files in Registry at %s\\%s", + DEFAULT_VK_REGISTRY_HIVE_STR, registry_location); } // These calls look at the PNP/Device section of the registry. @@ -783,12 +793,141 @@ out: return vk_result; } -// This function allocates an array in sorted_devices which must be freed by the caller if not null -VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint32_t *sorted_devices_count, - struct loader_phys_dev_per_icd **sorted_devices) { +VkResult enumerate_adapter_physical_devices(struct loader_instance *inst, struct loader_icd_term *icd_term, uint32_t icd_idx, + LUID luid, uint32_t *icd_phys_devs_array_count, + struct loader_icd_physical_devices *icd_phys_devs_array) { + uint32_t count = 0; + VkResult res = icd_term->scanned_icd->EnumerateAdapterPhysicalDevices(icd_term->instance, luid, &count, NULL); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + return res; + } else if (res == VK_ERROR_INCOMPATIBLE_DRIVER) { + return VK_SUCCESS; // This driver doesn't support the adapter + } else if (res != VK_SUCCESS) { + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, + "Failed to convert DXGI adapter into Vulkan physical device with unexpected error code"); + return res; + } else if (0 == count) { + return VK_SUCCESS; // This driver doesn't support the adapter + } + + // Take a pointer to the last element of icd_phys_devs_array to simplify usage + struct loader_icd_physical_devices *next_icd_phys_devs = &icd_phys_devs_array[*icd_phys_devs_array_count]; + + // Get the actual physical devices + do { + next_icd_phys_devs->physical_devices = loader_instance_heap_realloc( + inst, next_icd_phys_devs->physical_devices, next_icd_phys_devs->device_count * sizeof(VkPhysicalDevice), + count * sizeof(VkPhysicalDevice), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (next_icd_phys_devs->physical_devices == NULL) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + next_icd_phys_devs->device_count = count; + } while ((res = icd_term->scanned_icd->EnumerateAdapterPhysicalDevices(icd_term->instance, luid, &count, + next_icd_phys_devs->physical_devices)) == VK_INCOMPLETE); + + if (res != VK_SUCCESS) { + loader_instance_heap_free(inst, next_icd_phys_devs->physical_devices); + next_icd_phys_devs->physical_devices = NULL; + // Unless OOHM occurs, only return VK_SUCCESS + if (res != VK_ERROR_OUT_OF_HOST_MEMORY) { + res = VK_SUCCESS; + loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Failed to convert DXGI adapter into Vulkan physical device"); + } + return res; + } + + // Because the loader calls EnumerateAdapterPhysicalDevices on all drivers with each DXGI Adapter, if there are multiple drivers + // that share a luid the physical device will get queried multiple times. We can prevent that by not adding them if the + // enumerated physical devices have already been added. + bool already_enumerated = false; + for (uint32_t j = 0; j < *icd_phys_devs_array_count; j++) { + if (count == icd_phys_devs_array[j].device_count) { + bool matches = true; + for (uint32_t k = 0; k < icd_phys_devs_array[j].device_count; k++) { + if (icd_phys_devs_array[j].physical_devices[k] != next_icd_phys_devs->physical_devices[k]) { + matches = false; + break; + } + } + if (matches) { + already_enumerated = true; + } + } + } + if (!already_enumerated) { + next_icd_phys_devs->device_count = count; + next_icd_phys_devs->icd_index = icd_idx; + next_icd_phys_devs->icd_term = icd_term; + next_icd_phys_devs->windows_adapter_luid = luid; + (*icd_phys_devs_array_count)++; + } + + return VK_SUCCESS; +} + +// Whenever there are multiple drivers for the same hardware and one of the drivers is an implementation layered on top of another +// API (such as the Dozen driver which converts vulkan to Dx12), we want to make sure the layered driver appears after the 'native' +// driver. This function iterates over all physical devices and make sure any with matching LUID's are sorted such that drivers with +// a underlyingAPI of VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT are ordered after drivers without it. +void sort_physical_devices_with_same_luid(struct loader_instance *inst, uint32_t icd_phys_devs_array_count, + struct loader_icd_physical_devices *icd_phys_devs_array) { + bool app_is_vulkan_1_1 = loader_check_version_meets_required(LOADER_VERSION_1_1_0, inst->app_api_version); + + for (uint32_t i = 0; icd_phys_devs_array_count > 1 && i < icd_phys_devs_array_count - 1; i++) { + for (uint32_t j = i + 1; j < icd_phys_devs_array_count; j++) { + // Only want to reorder physical devices if their ICD's LUID's match + if ((icd_phys_devs_array[i].windows_adapter_luid.HighPart != icd_phys_devs_array[j].windows_adapter_luid.HighPart) || + (icd_phys_devs_array[i].windows_adapter_luid.LowPart != icd_phys_devs_array[j].windows_adapter_luid.LowPart)) { + continue; + } + + VkLayeredDriverUnderlyingApiMSFT underlyingAPI = VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT; + VkPhysicalDeviceLayeredDriverPropertiesMSFT layered_driver_properties_msft = {0}; + layered_driver_properties_msft.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; + VkPhysicalDeviceProperties2 props2 = {0}; + props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + props2.pNext = (void *)&layered_driver_properties_msft; + + // Because there may be multiple physical devices associated with each ICD, we need to check each physical device + // whether it is layered + for (uint32_t k = 0; k < icd_phys_devs_array[i].device_count; k++) { + VkPhysicalDeviceProperties dev_props = {0}; + icd_phys_devs_array[i].icd_term->dispatch.GetPhysicalDeviceProperties(icd_phys_devs_array[i].physical_devices[k], + &dev_props); + + bool device_is_1_1_capable = + loader_check_version_meets_required(LOADER_VERSION_1_1_0, loader_make_version(dev_props.apiVersion)); + + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = NULL; + if (app_is_vulkan_1_1 && device_is_1_1_capable) { + GetPhysDevProps2 = icd_phys_devs_array[i].icd_term->dispatch.GetPhysicalDeviceProperties2; + } else { + GetPhysDevProps2 = (PFN_vkGetPhysicalDeviceProperties2)icd_phys_devs_array[i] + .icd_term->dispatch.GetPhysicalDeviceProperties2KHR; + } + if (GetPhysDevProps2) { + GetPhysDevProps2(icd_phys_devs_array[i].physical_devices[k], &props2); + if (layered_driver_properties_msft.underlyingAPI != VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT) { + underlyingAPI = layered_driver_properties_msft.underlyingAPI; + break; + } + } + } + if (underlyingAPI == VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT) { + struct loader_icd_physical_devices swap_icd = icd_phys_devs_array[i]; + icd_phys_devs_array[i] = icd_phys_devs_array[j]; + icd_phys_devs_array[j] = swap_icd; + } + } + } +} + +// This function allocates icd_phys_devs_array which must be freed by the caller if not null +VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint32_t *icd_phys_devs_array_count, + struct loader_icd_physical_devices **icd_phys_devs_array) { VkResult res = VK_SUCCESS; - uint32_t sorted_alloc = 0; + uint32_t icd_phys_devs_array_size = 0; struct loader_icd_term *icd_term = NULL; IDXGIFactory6 *dxgi_factory = NULL; HRESULT hres = fpCreateDXGIFactory1(&IID_IDXGIFactory6, (void **)&dxgi_factory); @@ -796,10 +935,10 @@ VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "Failed to create DXGI factory 6. Physical devices will not be sorted"); goto out; } - sorted_alloc = 16; - *sorted_devices = loader_instance_heap_calloc(inst, sorted_alloc * sizeof(struct loader_phys_dev_per_icd), - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (*sorted_devices == NULL) { + icd_phys_devs_array_size = 16; + *icd_phys_devs_array = loader_instance_heap_calloc(inst, icd_phys_devs_array_size * sizeof(struct loader_icd_physical_devices), + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (*icd_phys_devs_array == NULL) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -823,20 +962,19 @@ VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint continue; } - if (sorted_alloc <= i) { - uint32_t old_size = sorted_alloc * sizeof(struct loader_phys_dev_per_icd); - *sorted_devices = - loader_instance_heap_realloc(inst, *sorted_devices, old_size, 2 * old_size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (*sorted_devices == NULL) { + if (icd_phys_devs_array_size <= i) { + uint32_t old_size = icd_phys_devs_array_size * sizeof(struct loader_icd_physical_devices); + *icd_phys_devs_array = loader_instance_heap_realloc(inst, *icd_phys_devs_array, old_size, 2 * old_size, + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (*icd_phys_devs_array == NULL) { adapter->lpVtbl->Release(adapter); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - sorted_alloc *= 2; + icd_phys_devs_array_size *= 2; } - struct loader_phys_dev_per_icd *sorted_array = *sorted_devices; - sorted_array[*sorted_devices_count].device_count = 0; - sorted_array[*sorted_devices_count].physical_devices = NULL; + (*icd_phys_devs_array)[*icd_phys_devs_array_count].device_count = 0; + (*icd_phys_devs_array)[*icd_phys_devs_array_count].physical_devices = NULL; icd_term = inst->icd_terms; for (uint32_t icd_idx = 0; NULL != icd_term; icd_term = icd_term->next, icd_idx++) { @@ -845,52 +983,12 @@ VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint continue; } - uint32_t count = 0; - VkResult vkres = - icd_term->scanned_icd->EnumerateAdapterPhysicalDevices(icd_term->instance, description.AdapterLuid, &count, NULL); - if (vkres == VK_ERROR_INCOMPATIBLE_DRIVER) { - continue; // This driver doesn't support the adapter - } else if (vkres == VK_ERROR_OUT_OF_HOST_MEMORY) { - res = VK_ERROR_OUT_OF_HOST_MEMORY; + res = enumerate_adapter_physical_devices(inst, icd_term, icd_idx, description.AdapterLuid, icd_phys_devs_array_count, + *icd_phys_devs_array); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + adapter->lpVtbl->Release(adapter); goto out; - } else if (vkres != VK_SUCCESS) { - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, - "Failed to convert DXGI adapter into Vulkan physical device with unexpected error code"); - continue; - } - - // Get the actual physical devices - if (0 != count) { - do { - sorted_array[*sorted_devices_count].physical_devices = - loader_instance_heap_realloc(inst, sorted_array[*sorted_devices_count].physical_devices, - sorted_array[*sorted_devices_count].device_count * sizeof(VkPhysicalDevice), - count * sizeof(VkPhysicalDevice), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (sorted_array[*sorted_devices_count].physical_devices == NULL) { - res = VK_ERROR_OUT_OF_HOST_MEMORY; - break; - } - sorted_array[*sorted_devices_count].device_count = count; - } while ((vkres = icd_term->scanned_icd->EnumerateAdapterPhysicalDevices( - icd_term->instance, description.AdapterLuid, &count, - sorted_array[*sorted_devices_count].physical_devices)) == VK_INCOMPLETE); } - - if (vkres != VK_SUCCESS) { - loader_instance_heap_free(inst, sorted_array[*sorted_devices_count].physical_devices); - sorted_array[*sorted_devices_count].physical_devices = NULL; - if (vkres == VK_ERROR_OUT_OF_HOST_MEMORY) { - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto out; - } else { - loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Failed to convert DXGI adapter into Vulkan physical device"); - continue; - } - } - sorted_array[*sorted_devices_count].device_count = count; - sorted_array[*sorted_devices_count].icd_index = icd_idx; - sorted_array[*sorted_devices_count].icd_term = icd_term; - (*sorted_devices_count)++; } adapter->lpVtbl->Release(adapter); @@ -898,13 +996,13 @@ VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint dxgi_factory->lpVtbl->Release(dxgi_factory); + sort_physical_devices_with_same_luid(inst, *icd_phys_devs_array_count, *icd_phys_devs_array); + out: - if (*sorted_devices_count == 0 && *sorted_devices != NULL) { - loader_instance_heap_free(inst, *sorted_devices); - *sorted_devices = NULL; + if (*icd_phys_devs_array_count == 0 && *icd_phys_devs_array != NULL) { + loader_instance_heap_free(inst, *icd_phys_devs_array); + *icd_phys_devs_array = NULL; } - *sorted_devices_count = *sorted_devices_count; - *sorted_devices = *sorted_devices; return res; } @@ -923,7 +1021,7 @@ VkLoaderFeatureFlags windows_initialize_dxgi(void) { // Multiple groups could have devices out of the same sorted list, however, a single group's devices must all come // from the same sorted list. void windows_sort_devices_in_group(struct loader_instance *inst, struct VkPhysicalDeviceGroupProperties *group_props, - struct loader_phys_dev_per_icd *icd_sorted_list) { + struct loader_icd_physical_devices *icd_sorted_list) { uint32_t cur_index = 0; for (uint32_t dev = 0; dev < icd_sorted_list->device_count; ++dev) { for (uint32_t grp_dev = cur_index; grp_dev < group_props->physicalDeviceCount; ++grp_dev) { @@ -948,7 +1046,7 @@ void windows_sort_devices_in_group(struct loader_instance *inst, struct VkPhysic VkResult windows_sort_physical_device_groups(struct loader_instance *inst, const uint32_t group_count, struct loader_physical_device_group_term *sorted_group_term, const uint32_t sorted_device_count, - struct loader_phys_dev_per_icd *sorted_phys_dev_array) { + struct loader_icd_physical_devices *sorted_phys_dev_array) { if (0 == group_count || NULL == sorted_group_term) { loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "windows_sort_physical_device_groups: Called with invalid information (Group count %d, Sorted Info %p)", @@ -993,13 +1091,13 @@ char *windows_get_app_package_manifest_path(const struct loader_instance *inst) // These functions are only available on Windows 8 and above, load them dynamically for compatibility with Windows 7 typedef LONG(WINAPI * PFN_GetPackagesByPackageFamily)(PCWSTR, UINT32 *, PWSTR *, UINT32 *, WCHAR *); PFN_GetPackagesByPackageFamily fpGetPackagesByPackageFamily = - (PFN_GetPackagesByPackageFamily)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetPackagesByPackageFamily"); + (PFN_GetPackagesByPackageFamily)(void *)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetPackagesByPackageFamily"); if (!fpGetPackagesByPackageFamily) { return NULL; } typedef LONG(WINAPI * PFN_GetPackagePathByFullName)(PCWSTR, UINT32 *, PWSTR); PFN_GetPackagePathByFullName fpGetPackagePathByFullName = - (PFN_GetPackagePathByFullName)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetPackagePathByFullName"); + (PFN_GetPackagePathByFullName)(void *)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetPackagePathByFullName"); if (!fpGetPackagePathByFullName) { return NULL; } @@ -1013,7 +1111,7 @@ char *windows_get_app_package_manifest_path(const struct loader_instance *inst) if (ERROR_INSUFFICIENT_BUFFER != fpGetPackagesByPackageFamily(familyName, &numPackages, NULL, &bufferLength, NULL) || numPackages == 0 || bufferLength == 0) { loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, - "windows_get_app_package_manifest_path: Failed to find mapping layers packages by family name\n"); + "windows_get_app_package_manifest_path: Failed to find mapping layers packages by family name"); return NULL; } @@ -1022,13 +1120,13 @@ char *windows_get_app_package_manifest_path(const struct loader_instance *inst) PWSTR *packages = loader_instance_heap_alloc(inst, sizeof(PWSTR) * numPackages, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (!buffer || !packages) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "windows_get_app_package_manifest_path: Failed to allocate memory for package names\n"); + "windows_get_app_package_manifest_path: Failed to allocate memory for package names"); goto cleanup; } if (ERROR_SUCCESS != fpGetPackagesByPackageFamily(familyName, &numPackages, packages, &bufferLength, buffer)) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "windows_get_app_package_manifest_path: Failed to mapping layers package full names\n"); + "windows_get_app_package_manifest_path: Failed to mapping layers package full names"); goto cleanup; } @@ -1038,20 +1136,20 @@ char *windows_get_app_package_manifest_path(const struct loader_instance *inst) if (ERROR_INSUFFICIENT_BUFFER != fpGetPackagePathByFullName(packages[0], &pathLength, NULL) || pathLength > MAX_PATH || ERROR_SUCCESS != fpGetPackagePathByFullName(packages[0], &pathLength, path)) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "windows_get_app_package_manifest_path: Failed to get mapping layers package path\n"); + "windows_get_app_package_manifest_path: Failed to get mapping layers package path"); goto cleanup; } int narrowPathLength = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL); if (narrowPathLength == 0) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "windows_get_app_package_manifest_path: Failed to convert path from wide to narrow\n"); + "windows_get_app_package_manifest_path: Failed to convert path from wide to narrow"); goto cleanup; } ret = loader_instance_heap_alloc(inst, narrowPathLength, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (!ret) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "windows_get_app_package_manifest_path: Failed to allocate path\n"); + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "windows_get_app_package_manifest_path: Failed to allocate path"); goto cleanup; } @@ -1063,4 +1161,99 @@ cleanup: loader_instance_heap_free(inst, packages); return ret; } + +VkResult get_settings_path_if_exists_in_registry_key(const struct loader_instance *inst, char **out_path, HKEY key) { + VkResult result = VK_ERROR_INITIALIZATION_FAILED; + + char name[MAX_STRING_SIZE] = {0}; + DWORD name_size = sizeof(name); + + *out_path = NULL; + + LONG rtn_value = ERROR_SUCCESS; + for (DWORD idx = 0; rtn_value == ERROR_SUCCESS; idx++) { + DWORD value = 0; + DWORD value_size = sizeof(value); + rtn_value = RegEnumValue(key, idx, name, &name_size, NULL, NULL, (LPBYTE)&value, &value_size); + + if (ERROR_SUCCESS != rtn_value) { + break; + } + + uint32_t start_of_path_filename = 0; + for (uint32_t last_char = name_size; last_char > 0; last_char--) { + if (name[last_char] == '\\') { + start_of_path_filename = last_char + 1; + break; + } + } + + // Make sure the path exists first + if (*out_path && !loader_platform_file_exists(name)) { + return VK_ERROR_INITIALIZATION_FAILED; + } + + if (strcmp(VK_LOADER_SETTINGS_FILENAME, &(name[start_of_path_filename])) == 0) { + *out_path = loader_instance_heap_calloc(inst, name_size + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (*out_path == NULL) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + loader_strncpy(*out_path, name_size + 1, name, name_size); + (*out_path)[name_size] = '\0'; + result = VK_SUCCESS; + break; + } + } + + return result; +} + +VkResult windows_get_loader_settings_file_path(const struct loader_instance *inst, char **out_path) { + VkResult result = VK_SUCCESS; + DWORD access_flags = KEY_QUERY_VALUE; + HKEY key = NULL; + + *out_path = NULL; + + // if we are running with admin privileges, only check HKEY_LOCAL_MACHINE. + // Otherwise check HKEY_CURRENT_USER, and if nothing is there, look in HKEY_LOCAL_MACHINE + + if (is_high_integrity()) { + LONG rtn_value = RegOpenKeyEx(HKEY_LOCAL_MACHINE, VK_SETTINGS_INFO_REGISTRY_LOC, 0, access_flags, &key); + if (ERROR_SUCCESS != rtn_value) { + result = VK_ERROR_FEATURE_NOT_PRESENT; + goto out; + } + result = get_settings_path_if_exists_in_registry_key(inst, out_path, key); + } else { + LONG rtn_value = RegOpenKeyEx(HKEY_CURRENT_USER, VK_SETTINGS_INFO_REGISTRY_LOC, 0, access_flags, &key); + if (ERROR_SUCCESS == rtn_value) { + result = get_settings_path_if_exists_in_registry_key(inst, out_path, key); + RegCloseKey(key); + // Either we got OOM and *must* exit or we successfully found the settings file and can exit + if (result == VK_ERROR_OUT_OF_HOST_MEMORY || result == VK_SUCCESS) { + goto out; + } + } + + rtn_value = RegOpenKeyEx(HKEY_LOCAL_MACHINE, VK_SETTINGS_INFO_REGISTRY_LOC, 0, access_flags, &key); + if (ERROR_SUCCESS != rtn_value) { + result = VK_ERROR_FEATURE_NOT_PRESENT; + goto out; + } + + result = get_settings_path_if_exists_in_registry_key(inst, out_path, key); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { + goto out; + } + } + +out: + if (NULL != key) { + RegCloseKey(key); + } + + return result; +} + #endif // _WIN32 diff --git a/loader/loader_windows.h b/loader/loader_windows.h index 80ba6ebe1418cc8c37430d4903c360a276f8eaee..b783909ca50929658cdc9b0229aa7527abe7ad5b 100644 --- a/loader/loader_windows.h +++ b/loader/loader_windows.h @@ -97,17 +97,17 @@ VkResult windows_read_manifest_from_d3d_adapters(const struct loader_instance *i // Look for data files in the registry. VkResult windows_read_data_files_in_registry(const struct loader_instance *inst, enum loader_data_files_type data_file_type, bool warn_if_not_present, char *registry_location, - struct loader_data_files *out_files); + struct loader_string_list *out_files); // This function allocates an array in sorted_devices which must be freed by the caller if not null -VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint32_t *sorted_devices_count, - struct loader_phys_dev_per_icd **sorted_devices); +VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint32_t *icd_phys_devs_array_count, + struct loader_icd_physical_devices **icd_phys_devs_array); // This function sorts an array in physical device groups based on the sorted physical device information VkResult windows_sort_physical_device_groups(struct loader_instance *inst, const uint32_t group_count, struct loader_physical_device_group_term *sorted_group_term, const uint32_t sorted_device_count, - struct loader_phys_dev_per_icd *sorted_phys_dev_array); + struct loader_icd_physical_devices *sorted_phys_dev_array); // Creates a DXGI factory // Returns VkLoaderFeatureFlags containing VK_LOADER_FEATURE_PHYSICAL_DEVICE_SORTING if successful, otherwise 0 @@ -116,4 +116,10 @@ VkLoaderFeatureFlags windows_initialize_dxgi(void); // Retrieve a path to an installed app package that contains Vulkan manifests. // When done using the returned string, the caller should free the pointer. char *windows_get_app_package_manifest_path(const struct loader_instance *inst); + +// Gets the path to the loader settings file, if it exists. If it doesn't exists, writes NULL to out_path. +// The path is located through the registry as an entry in HKEY_CURRENT_USER/SOFTWARE/Khronos/Vulkan/LoaderSettings +// and if nothing is there, will try to look in HKEY_LOCAL_MACHINE/SOFTWARE/Khronos/Vulkan/LoaderSettings. +// If running with elevated privileges, this function only looks in HKEY_LOCAL_MACHINE. +VkResult windows_get_loader_settings_file_path(const struct loader_instance *inst, char **out_path); #endif // WIN32 diff --git a/loader/log.c b/loader/log.c index 2ccacb5d737f226c9a5f3fcff91e22aa357b7734..e92978768e0e88fbbfac3ad20a86adc217bb0803 100644 --- a/loader/log.c +++ b/loader/log.c @@ -32,14 +32,17 @@ #include #include "debug_utils.h" -#include "get_environment.h" +#include "loader_common.h" +#include "loader_environment.h" +#include "settings.h" +#include "vk_loader_platform.h" #ifdef VK_USE_PLATFORM_OHOS #include "loader_hilog.h" #endif uint32_t g_loader_debug = ~0u; -void loader_debug_init(void) { +void loader_init_global_debug_level(void) { char *env, *orig; if (g_loader_debug > 0) return; @@ -86,18 +89,15 @@ void loader_debug_init(void) { loader_free_getenv(orig, NULL); } -uint32_t loader_get_debug_level(void) { return g_loader_debug; } +void loader_set_global_debug_level(uint32_t new_loader_debug) { g_loader_debug = new_loader_debug; } void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, const char *format, ...) { - char msg[512]; - char cmd_line_msg[512]; - size_t cmd_line_size = sizeof(cmd_line_msg); - size_t num_used = 0; - va_list ap; - int ret; + (void)msg_code; + char msg[512] = {0}; + va_list ap; va_start(ap, format); - ret = vsnprintf(msg, sizeof(msg), format, ap); + int ret = vsnprintf(msg, sizeof(msg), format, ap); if ((ret >= (int)sizeof(msg)) || ret < 0) { msg[sizeof(msg) - 1] = '\0'; } @@ -105,9 +105,9 @@ void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t ms if (inst) { VkDebugUtilsMessageSeverityFlagBitsEXT severity = 0; - VkDebugUtilsMessageTypeFlagsEXT type; - VkDebugUtilsMessengerCallbackDataEXT callback_data; - VkDebugUtilsObjectNameInfoEXT object_name; + VkDebugUtilsMessageTypeFlagsEXT type = 0; + VkDebugUtilsMessengerCallbackDataEXT callback_data = {0}; + VkDebugUtilsObjectNameInfoEXT object_name = {0}; if ((msg_type & VULKAN_LOADER_INFO_BIT) != 0) { severity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT; @@ -133,106 +133,107 @@ void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t ms } callback_data.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT; - callback_data.pNext = NULL; - callback_data.flags = 0; callback_data.pMessageIdName = "Loader Message"; - callback_data.messageIdNumber = 0; callback_data.pMessage = msg; - callback_data.queueLabelCount = 0; - callback_data.pQueueLabels = NULL; - callback_data.cmdBufLabelCount = 0; - callback_data.pCmdBufLabels = NULL; callback_data.objectCount = 1; callback_data.pObjects = &object_name; object_name.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; - object_name.pNext = NULL; object_name.objectType = VK_OBJECT_TYPE_INSTANCE; object_name.objectHandle = (uint64_t)(uintptr_t)inst; - object_name.pObjectName = NULL; util_SubmitDebugUtilsMessageEXT(inst, severity, type, &callback_data); } - uint32_t filtered_msg_type = (msg_type & g_loader_debug); - if (0 == filtered_msg_type) { - return; + // Always log to stderr if this is a fatal error + if (0 == (msg_type & VULKAN_LOADER_FATAL_ERROR_BIT)) { + // Exit early if the current instance settings do not ask for logging to stderr + if (inst && inst->settings.settings_active && 0 == (msg_type & inst->settings.debug_level)) { + return; + // Check the global settings and if that doesn't say to skip, check the environment variable + } else if (0 == (msg_type & g_loader_debug)) { + return; + } } + // Only need enough space to create the filter description header for log messages + // Also use the same header for all output + char cmd_line_msg[64]; + size_t cmd_line_size = sizeof(cmd_line_msg); + size_t num_used = 0; + cmd_line_msg[0] = '\0'; - cmd_line_size -= 1; - num_used = 1; + +// Helper macro which strncat's the given string literal, then updates num_used & cmd_line_end +// Assumes that we haven't used the entire buffer - must manually check this when adding new filter types +// We concat at the end of cmd_line_msg, so that strncat isn't a victim of Schlemiel the Painter +// We write to the end - 1 of cmd_line_msg, as the end is actually a null terminator +#define STRNCAT_TO_BUFFER(string_literal_to_cat) \ + loader_strncat(cmd_line_msg + num_used, cmd_line_size - num_used, string_literal_to_cat, sizeof(string_literal_to_cat)); \ + num_used += sizeof(string_literal_to_cat) - 1; // subtract one to remove the null terminator in the string literal if ((msg_type & VULKAN_LOADER_ERROR_BIT) != 0) { - strncat(cmd_line_msg, "ERROR", cmd_line_size - num_used); - num_used += 5; + STRNCAT_TO_BUFFER("ERROR"); } else if ((msg_type & VULKAN_LOADER_WARN_BIT) != 0) { - strncat(cmd_line_msg, "WARNING", cmd_line_size - num_used); - num_used += 7; + STRNCAT_TO_BUFFER("WARNING"); } else if ((msg_type & VULKAN_LOADER_INFO_BIT) != 0) { - strncat(cmd_line_msg, "INFO", cmd_line_size - num_used); - num_used += 4; + STRNCAT_TO_BUFFER("INFO"); } else if ((msg_type & VULKAN_LOADER_DEBUG_BIT) != 0) { - strncat(cmd_line_msg, "DEBUG", cmd_line_size - num_used); - num_used += 5; + STRNCAT_TO_BUFFER("DEBUG"); } - // For the remaining messages, we only want to add any tags that are - // explicitly enabled by the tools. - if ((filtered_msg_type & VULKAN_LOADER_PERF_BIT) != 0) { + + if ((msg_type & VULKAN_LOADER_PERF_BIT) != 0) { if (num_used > 1) { - strncat(cmd_line_msg, " | ", cmd_line_size - num_used); - num_used += 3; + STRNCAT_TO_BUFFER(" | "); } - strncat(cmd_line_msg, "PERF", cmd_line_size - num_used); - num_used += 4; + STRNCAT_TO_BUFFER("PERF"); } - if ((filtered_msg_type & VULKAN_LOADER_DRIVER_BIT) != 0) { + if ((msg_type & VULKAN_LOADER_DRIVER_BIT) != 0) { if (num_used > 1) { - strncat(cmd_line_msg, " | ", cmd_line_size - num_used); - num_used += 3; + STRNCAT_TO_BUFFER(" | "); } - strncat(cmd_line_msg, "DRIVER", cmd_line_size - num_used); - num_used += 6; + STRNCAT_TO_BUFFER("DRIVER"); } - if ((filtered_msg_type & VULKAN_LOADER_LAYER_BIT) != 0) { + if ((msg_type & VULKAN_LOADER_LAYER_BIT) != 0) { if (num_used > 1) { - strncat(cmd_line_msg, " | ", cmd_line_size - num_used); - num_used += 3; + STRNCAT_TO_BUFFER(" | "); } - strncat(cmd_line_msg, "LAYER", cmd_line_size - num_used); - num_used += 5; - } - // Add any preceeding spaces so we can have clean output - if (num_used > 1) { - strncat(cmd_line_msg, ": ", cmd_line_size - num_used); - num_used += 2; - } - while (num_used < 19) { - strncat(cmd_line_msg, " ", cmd_line_size - num_used); - num_used++; + STRNCAT_TO_BUFFER("LAYER"); } - size_t available_space = cmd_line_size - num_used; - if (available_space > 0) { - // If the message is too long, trim it down - if (strlen(msg) > available_space) { - msg[available_space - 1] = '\0'; - } - strncat(cmd_line_msg, msg, cmd_line_size); + // Add a ": " to separate the filters from the message + STRNCAT_TO_BUFFER(": "); +#undef STRNCAT_TO_BUFFER + // Justifies the output to at least 19 spaces + if (num_used < 19) { + const char *space_buffer = " "; + // Only write (19 - num_used) spaces + loader_strncat(cmd_line_msg + num_used, cmd_line_size - num_used, space_buffer, 19 - num_used); + num_used += sizeof(space_buffer) - 1 - num_used; + } + // Assert that we didn't write more than what is available in cmd_line_msg + assert(cmd_line_size > num_used); + +#if !defined (__OHOS__) + fputs(cmd_line_msg, stderr); + fputs(msg, stderr); + fputc('\n', stderr); +#endif #if defined(WIN32) - OutputDebugString(cmd_line_msg); - OutputDebugString("\n"); + OutputDebugString(cmd_line_msg); + OutputDebugString(msg); + OutputDebugString("\n"); #endif -#if defined(VK_USE_PLATFORM_OHOS) - OpenHarmonyLog(msg_type, cmd_line_msg); +#if defined(__OHOS__) + char result[512 + 64]; + strcpy(result, cmd_line_msg); + strcat(result, msg); + OpenHarmonyLog(msg_type, result); #endif +} - fputs(cmd_line_msg, stderr); - fputc('\n', stderr); - } else { - // Shouldn't get here, but check to make sure if we've already overrun - // the string boundary - assert(false); - } +void loader_log_asm_function_not_supported(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, + const char *func_name) { + loader_log(inst, msg_type, msg_code, "Function %s not supported for this physical device", func_name); } diff --git a/loader/log.h b/loader/log.h index 84bf6e1991e71ffa281065a51643577694986a5c..c64cd5afd2cd1a56a9883311079069ac10303dea 100644 --- a/loader/log.h +++ b/loader/log.h @@ -26,7 +26,14 @@ * */ -#include "loader_common.h" +#pragma once + +#include +#include + +#include "vulkan/vulkan_core.h" + +struct loader_instance; enum vulkan_loader_debug_flags { VULKAN_LOADER_INFO_BIT = 0x01, @@ -37,15 +44,31 @@ enum vulkan_loader_debug_flags { VULKAN_LOADER_LAYER_BIT = 0x20, VULKAN_LOADER_DRIVER_BIT = 0x40, VULKAN_LOADER_VALIDATION_BIT = 0x80, + VULKAN_LOADER_FATAL_ERROR_BIT = 0x100, // only forces the output to be printed to stderr, has no other effect }; // Checks for the environment variable VK_LOADER_DEBUG and sets up the current debug level accordingly // This should be called before any Vulkan API calls, eg in the initialization of the .dll or .so -void loader_debug_init(void); +void loader_init_global_debug_level(void); -// Returns a bitmask that indicates the current flags that should be output -uint32_t loader_get_debug_level(void); +// Sets the global debug level - used by global settings files +void loader_set_global_debug_level(uint32_t new_loader_debug); + +// The asm declaration prevents name mangling which is necessary for macOS +#if defined(MODIFY_UNKNOWN_FUNCTION_DECLS) +#define ASM_NAME(name) __asm(name) +#else +#define ASM_NAME(name) +#endif // Logs a message to stderr // May output to DebugUtils if the instance isn't null and the extension is enabled. -void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, const char *format, ...); +void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, const char *format, ...) + ASM_NAME("loader_log"); + +// Used for the assembly code to emit an specific error message +// This is a work around for linux 32 bit error handling not passing relocatable strings correctly +void loader_log_asm_function_not_supported(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, + const char *func_name) ASM_NAME("loader_log_asm_function_not_supported"); + +#undef ASM_NAME diff --git a/loader/phys_dev_ext.c b/loader/phys_dev_ext.c index 5e840ebabbd044c9e416ff9737be7230e65c343d..1bcfa5767b56ae7011ad2bcb4c1c8f8eb3dde775 100644 --- a/loader/phys_dev_ext.c +++ b/loader/phys_dev_ext.c @@ -34,511 +34,518 @@ #pragma GCC optimize(3) // force gcc to use tail-calls #endif +// The asm declaration prevents name mangling which is necessary for macOS +#if defined(MODIFY_UNKNOWN_FUNCTION_DECLS) +#define ASM_NAME(name) __asm(name) +#else +#define ASM_NAME(name) +#endif + // Declarations for the trampoline -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp0(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp1(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp2(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp3(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp4(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp5(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp6(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp7(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp8(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp9(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp10(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp11(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp12(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp13(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp14(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp15(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp16(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp17(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp18(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp19(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp20(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp21(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp22(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp23(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp24(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp25(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp26(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp27(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp28(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp29(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp30(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp31(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp32(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp33(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp34(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp35(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp36(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp37(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp38(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp39(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp40(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp41(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp42(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp43(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp44(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp45(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp46(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp47(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp48(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp49(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp50(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp51(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp52(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp53(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp54(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp55(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp56(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp57(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp58(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp59(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp60(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp61(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp62(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp63(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp64(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp65(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp66(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp67(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp68(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp69(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp70(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp71(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp72(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp73(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp74(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp75(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp76(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp77(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp78(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp79(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp80(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp81(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp82(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp83(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp84(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp85(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp86(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp87(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp88(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp89(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp90(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp91(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp92(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp93(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp94(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp95(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp96(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp97(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp98(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp99(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp100(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp101(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp102(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp103(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp104(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp105(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp106(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp107(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp108(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp109(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp110(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp111(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp112(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp113(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp114(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp115(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp116(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp117(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp118(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp119(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp120(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp121(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp122(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp123(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp124(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp125(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp126(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp127(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp128(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp129(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp130(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp131(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp132(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp133(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp134(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp135(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp136(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp137(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp138(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp139(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp140(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp141(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp142(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp143(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp144(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp145(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp146(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp147(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp148(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp149(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp150(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp151(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp152(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp153(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp154(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp155(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp156(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp157(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp158(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp159(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp160(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp161(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp162(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp163(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp164(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp165(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp166(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp167(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp168(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp169(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp170(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp171(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp172(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp173(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp174(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp175(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp176(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp177(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp178(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp179(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp180(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp181(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp182(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp183(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp184(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp185(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp186(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp187(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp188(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp189(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp190(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp191(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp192(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp193(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp194(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp195(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp196(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp197(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp198(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp199(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp200(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp201(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp202(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp203(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp204(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp205(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp206(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp207(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp208(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp209(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp210(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp211(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp212(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp213(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp214(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp215(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp216(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp217(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp218(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp219(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp220(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp221(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp222(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp223(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp224(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp225(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp226(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp227(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp228(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp229(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp230(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp231(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp232(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp233(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp234(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp235(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp236(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp237(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp238(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp239(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp240(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp241(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp242(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp243(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp244(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp245(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp246(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp247(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp248(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp249(VkPhysicalDevice); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp0(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp0"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp1(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp1"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp2(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp2"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp3(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp3"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp4(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp4"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp5(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp5"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp6(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp6"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp7(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp7"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp8(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp8"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp9(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp9"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp10(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp10"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp11(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp11"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp12(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp12"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp13(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp13"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp14(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp14"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp15(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp15"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp16(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp16"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp17(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp17"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp18(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp18"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp19(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp19"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp20(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp20"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp21(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp21"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp22(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp22"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp23(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp23"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp24(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp24"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp25(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp25"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp26(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp26"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp27(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp27"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp28(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp28"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp29(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp29"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp30(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp30"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp31(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp31"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp32(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp32"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp33(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp33"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp34(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp34"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp35(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp35"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp36(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp36"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp37(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp37"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp38(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp38"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp39(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp39"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp40(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp40"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp41(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp41"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp42(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp42"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp43(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp43"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp44(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp44"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp45(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp45"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp46(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp46"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp47(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp47"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp48(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp48"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp49(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp49"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp50(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp50"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp51(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp51"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp52(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp52"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp53(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp53"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp54(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp54"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp55(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp55"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp56(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp56"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp57(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp57"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp58(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp58"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp59(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp59"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp60(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp60"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp61(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp61"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp62(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp62"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp63(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp63"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp64(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp64"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp65(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp65"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp66(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp66"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp67(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp67"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp68(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp68"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp69(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp69"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp70(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp70"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp71(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp71"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp72(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp72"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp73(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp73"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp74(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp74"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp75(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp75"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp76(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp76"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp77(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp77"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp78(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp78"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp79(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp79"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp80(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp80"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp81(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp81"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp82(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp82"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp83(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp83"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp84(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp84"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp85(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp85"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp86(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp86"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp87(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp87"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp88(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp88"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp89(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp89"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp90(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp90"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp91(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp91"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp92(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp92"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp93(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp93"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp94(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp94"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp95(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp95"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp96(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp96"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp97(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp97"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp98(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp98"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp99(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp99"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp100(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp100"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp101(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp101"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp102(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp102"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp103(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp103"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp104(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp104"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp105(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp105"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp106(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp106"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp107(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp107"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp108(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp108"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp109(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp109"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp110(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp110"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp111(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp111"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp112(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp112"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp113(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp113"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp114(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp114"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp115(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp115"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp116(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp116"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp117(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp117"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp118(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp118"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp119(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp119"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp120(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp120"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp121(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp121"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp122(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp122"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp123(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp123"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp124(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp124"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp125(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp125"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp126(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp126"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp127(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp127"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp128(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp128"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp129(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp129"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp130(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp130"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp131(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp131"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp132(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp132"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp133(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp133"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp134(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp134"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp135(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp135"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp136(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp136"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp137(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp137"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp138(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp138"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp139(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp139"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp140(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp140"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp141(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp141"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp142(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp142"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp143(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp143"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp144(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp144"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp145(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp145"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp146(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp146"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp147(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp147"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp148(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp148"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp149(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp149"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp150(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp150"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp151(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp151"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp152(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp152"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp153(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp153"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp154(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp154"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp155(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp155"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp156(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp156"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp157(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp157"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp158(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp158"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp159(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp159"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp160(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp160"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp161(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp161"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp162(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp162"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp163(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp163"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp164(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp164"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp165(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp165"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp166(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp166"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp167(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp167"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp168(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp168"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp169(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp169"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp170(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp170"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp171(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp171"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp172(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp172"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp173(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp173"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp174(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp174"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp175(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp175"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp176(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp176"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp177(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp177"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp178(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp178"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp179(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp179"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp180(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp180"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp181(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp181"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp182(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp182"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp183(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp183"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp184(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp184"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp185(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp185"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp186(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp186"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp187(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp187"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp188(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp188"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp189(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp189"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp190(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp190"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp191(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp191"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp192(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp192"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp193(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp193"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp194(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp194"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp195(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp195"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp196(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp196"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp197(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp197"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp198(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp198"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp199(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp199"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp200(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp200"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp201(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp201"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp202(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp202"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp203(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp203"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp204(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp204"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp205(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp205"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp206(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp206"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp207(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp207"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp208(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp208"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp209(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp209"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp210(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp210"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp211(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp211"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp212(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp212"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp213(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp213"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp214(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp214"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp215(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp215"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp216(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp216"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp217(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp217"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp218(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp218"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp219(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp219"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp220(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp220"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp221(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp221"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp222(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp222"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp223(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp223"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp224(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp224"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp225(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp225"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp226(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp226"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp227(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp227"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp228(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp228"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp229(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp229"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp230(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp230"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp231(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp231"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp232(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp232"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp233(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp233"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp234(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp234"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp235(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp235"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp236(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp236"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp237(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp237"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp238(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp238"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp239(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp239"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp240(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp240"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp241(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp241"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp242(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp242"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp243(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp243"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp244(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp244"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp245(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp245"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp246(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp246"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp247(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp247"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp248(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp248"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp249(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTramp249"); // Disable clang-format for lists of macros // clang-format off -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin0(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin1(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin2(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin3(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin4(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin5(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin6(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin7(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin8(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin9(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin10(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin11(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin12(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin13(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin14(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin15(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin16(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin17(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin18(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin19(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin20(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin21(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin22(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin23(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin24(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin25(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin26(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin27(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin28(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin29(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin30(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin31(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin32(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin33(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin34(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin35(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin36(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin37(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin38(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin39(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin40(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin41(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin42(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin43(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin44(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin45(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin46(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin47(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin48(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin49(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin50(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin51(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin52(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin53(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin54(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin55(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin56(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin57(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin58(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin59(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin60(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin61(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin62(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin63(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin64(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin65(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin66(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin67(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin68(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin69(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin70(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin71(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin72(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin73(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin74(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin75(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin76(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin77(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin78(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin79(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin80(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin81(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin82(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin83(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin84(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin85(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin86(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin87(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin88(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin89(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin90(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin91(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin92(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin93(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin94(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin95(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin96(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin97(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin98(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin99(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin100(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin101(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin102(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin103(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin104(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin105(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin106(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin107(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin108(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin109(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin110(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin111(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin112(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin113(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin114(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin115(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin116(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin117(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin118(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin119(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin120(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin121(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin122(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin123(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin124(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin125(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin126(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin127(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin128(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin129(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin130(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin131(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin132(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin133(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin134(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin135(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin136(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin137(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin138(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin139(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin140(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin141(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin142(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin143(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin144(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin145(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin146(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin147(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin148(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin149(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin150(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin151(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin152(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin153(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin154(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin155(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin156(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin157(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin158(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin159(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin160(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin161(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin162(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin163(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin164(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin165(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin166(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin167(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin168(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin169(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin170(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin171(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin172(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin173(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin174(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin175(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin176(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin177(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin178(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin179(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin180(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin181(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin182(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin183(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin184(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin185(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin186(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin187(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin188(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin189(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin190(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin191(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin192(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin193(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin194(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin195(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin196(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin197(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin198(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin199(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin200(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin201(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin202(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin203(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin204(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin205(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin206(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin207(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin208(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin209(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin210(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin211(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin212(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin213(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin214(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin215(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin216(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin217(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin218(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin219(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin220(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin221(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin222(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin223(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin224(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin225(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin226(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin227(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin228(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin229(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin230(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin231(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin232(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin233(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin234(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin235(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin236(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin237(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin238(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin239(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin240(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin241(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin242(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin243(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin244(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin245(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin246(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin247(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin248(VkPhysicalDevice); -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin249(VkPhysicalDevice); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin0(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin0"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin1(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin1"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin2(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin2"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin3(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin3"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin4(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin4"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin5(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin5"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin6(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin6"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin7(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin7"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin8(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin8"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin9(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin9"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin10(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin10"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin11(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin11"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin12(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin12"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin13(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin13"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin14(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin14"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin15(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin15"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin16(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin16"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin17(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin17"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin18(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin18"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin19(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin19"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin20(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin20"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin21(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin21"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin22(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin22"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin23(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin23"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin24(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin24"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin25(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin25"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin26(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin26"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin27(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin27"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin28(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin28"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin29(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin29"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin30(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin30"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin31(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin31"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin32(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin32"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin33(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin33"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin34(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin34"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin35(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin35"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin36(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin36"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin37(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin37"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin38(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin38"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin39(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin39"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin40(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin40"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin41(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin41"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin42(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin42"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin43(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin43"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin44(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin44"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin45(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin45"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin46(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin46"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin47(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin47"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin48(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin48"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin49(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin49"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin50(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin50"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin51(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin51"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin52(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin52"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin53(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin53"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin54(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin54"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin55(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin55"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin56(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin56"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin57(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin57"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin58(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin58"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin59(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin59"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin60(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin60"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin61(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin61"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin62(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin62"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin63(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin63"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin64(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin64"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin65(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin65"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin66(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin66"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin67(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin67"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin68(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin68"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin69(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin69"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin70(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin70"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin71(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin71"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin72(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin72"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin73(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin73"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin74(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin74"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin75(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin75"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin76(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin76"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin77(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin77"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin78(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin78"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin79(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin79"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin80(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin80"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin81(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin81"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin82(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin82"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin83(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin83"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin84(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin84"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin85(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin85"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin86(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin86"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin87(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin87"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin88(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin88"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin89(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin89"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin90(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin90"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin91(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin91"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin92(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin92"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin93(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin93"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin94(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin94"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin95(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin95"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin96(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin96"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin97(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin97"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin98(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin98"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin99(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin99"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin100(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin100"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin101(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin101"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin102(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin102"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin103(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin103"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin104(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin104"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin105(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin105"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin106(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin106"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin107(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin107"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin108(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin108"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin109(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin109"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin110(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin110"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin111(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin111"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin112(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin112"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin113(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin113"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin114(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin114"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin115(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin115"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin116(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin116"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin117(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin117"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin118(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin118"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin119(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin119"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin120(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin120"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin121(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin121"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin122(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin122"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin123(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin123"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin124(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin124"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin125(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin125"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin126(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin126"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin127(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin127"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin128(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin128"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin129(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin129"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin130(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin130"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin131(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin131"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin132(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin132"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin133(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin133"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin134(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin134"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin135(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin135"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin136(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin136"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin137(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin137"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin138(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin138"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin139(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin139"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin140(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin140"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin141(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin141"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin142(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin142"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin143(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin143"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin144(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin144"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin145(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin145"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin146(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin146"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin147(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin147"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin148(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin148"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin149(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin149"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin150(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin150"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin151(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin151"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin152(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin152"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin153(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin153"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin154(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin154"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin155(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin155"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin156(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin156"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin157(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin157"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin158(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin158"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin159(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin159"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin160(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin160"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin161(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin161"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin162(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin162"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin163(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin163"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin164(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin164"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin165(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin165"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin166(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin166"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin167(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin167"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin168(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin168"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin169(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin169"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin170(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin170"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin171(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin171"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin172(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin172"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin173(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin173"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin174(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin174"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin175(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin175"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin176(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin176"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin177(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin177"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin178(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin178"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin179(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin179"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin180(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin180"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin181(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin181"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin182(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin182"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin183(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin183"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin184(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin184"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin185(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin185"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin186(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin186"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin187(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin187"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin188(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin188"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin189(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin189"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin190(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin190"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin191(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin191"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin192(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin192"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin193(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin193"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin194(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin194"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin195(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin195"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin196(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin196"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin197(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin197"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin198(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin198"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin199(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin199"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin200(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin200"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin201(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin201"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin202(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin202"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin203(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin203"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin204(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin204"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin205(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin205"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin206(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin206"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin207(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin207"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin208(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin208"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin209(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin209"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin210(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin210"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin211(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin211"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin212(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin212"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin213(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin213"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin214(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin214"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin215(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin215"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin216(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin216"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin217(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin217"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin218(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin218"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin219(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin219"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin220(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin220"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin221(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin221"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin222(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin222"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin223(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin223"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin224(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin224"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin225(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin225"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin226(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin226"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin227(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin227"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin228(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin228"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin229(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin229"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin230(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin230"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin231(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin231"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin232(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin232"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin233(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin233"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin234(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin234"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin235(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin235"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin236(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin236"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin237(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin237"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin238(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin238"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin239(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin239"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin240(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin240"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin241(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin241"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin242(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin242"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin243(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin243"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin244(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin244"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin245(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin245"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin246(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin246"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin247(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin247"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin248(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin248"); +VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin249(VkPhysicalDevice) ASM_NAME("vkPhysDevExtTermin249"); void *loader_get_phys_dev_ext_tramp(uint32_t index) { diff --git a/loader/settings.c b/loader/settings.c new file mode 100644 index 0000000000000000000000000000000000000000..4e037bce71e85883a6f55407e349718d047c3639 --- /dev/null +++ b/loader/settings.c @@ -0,0 +1,807 @@ +/* + * + * Copyright (c) 2023 The Khronos Group Inc. + * Copyright (c) 2023 Valve Corporation + * Copyright (c) 2023 LunarG, Inc. + * + * 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: Charles Giessen + * + */ + +#include "settings.h" + +#include "allocation.h" +#include "cJSON.h" +#include "loader.h" +#include "loader_environment.h" +#include "loader_windows.h" +#include "log.h" +#include "stack_allocation.h" +#include "vk_loader_platform.h" + +loader_platform_thread_mutex global_loader_settings_lock; +loader_settings global_loader_settings; + +void free_layer_configuration(const struct loader_instance* inst, loader_settings_layer_configuration* layer_configuration) { + loader_instance_heap_free(inst, layer_configuration->name); + loader_instance_heap_free(inst, layer_configuration->path); + memset(layer_configuration, 0, sizeof(loader_settings_layer_configuration)); +} + +void free_loader_settings(const struct loader_instance* inst, loader_settings* settings) { + if (NULL != settings->layer_configurations) { + for (uint32_t i = 0; i < settings->layer_configuration_count; i++) { + free_layer_configuration(inst, &settings->layer_configurations[i]); + } + } + loader_instance_heap_free(inst, settings->layer_configurations); + loader_instance_heap_free(inst, settings->settings_file_path); + memset(settings, 0, sizeof(loader_settings)); +} + +loader_settings_layer_control parse_control_string(char* control_string) { + loader_settings_layer_control layer_control = LOADER_SETTINGS_LAYER_CONTROL_DEFAULT; + if (strcmp(control_string, "auto") == 0) + layer_control = LOADER_SETTINGS_LAYER_CONTROL_DEFAULT; + else if (strcmp(control_string, "on") == 0) + layer_control = LOADER_SETTINGS_LAYER_CONTROL_ON; + else if (strcmp(control_string, "off") == 0) + layer_control = LOADER_SETTINGS_LAYER_CONTROL_OFF; + else if (strcmp(control_string, "unordered_layer_location") == 0) + layer_control = LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION; + return layer_control; +} + +const char* loader_settings_layer_control_to_string(loader_settings_layer_control control) { + switch (control) { + case (LOADER_SETTINGS_LAYER_CONTROL_DEFAULT): + return "auto"; + case (LOADER_SETTINGS_LAYER_CONTROL_ON): + return "on"; + case (LOADER_SETTINGS_LAYER_CONTROL_OFF): + return "off"; + case (LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION): + return "unordered_layer_location"; + default: + return "UNKNOWN_LAYER_CONTROl"; + } +} + +uint32_t parse_log_filters_from_strings(struct loader_string_list* log_filters) { + uint32_t filters = 0; + for (uint32_t i = 0; i < log_filters->count; i++) { + if (strcmp(log_filters->list[i], "all") == 0) + filters |= VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_PERF_BIT | VULKAN_LOADER_ERROR_BIT | + VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_LAYER_BIT | VULKAN_LOADER_DRIVER_BIT | VULKAN_LOADER_VALIDATION_BIT; + else if (strcmp(log_filters->list[i], "info") == 0) + filters |= VULKAN_LOADER_INFO_BIT; + else if (strcmp(log_filters->list[i], "warn") == 0) + filters |= VULKAN_LOADER_WARN_BIT; + else if (strcmp(log_filters->list[i], "perf") == 0) + filters |= VULKAN_LOADER_PERF_BIT; + else if (strcmp(log_filters->list[i], "error") == 0) + filters |= VULKAN_LOADER_ERROR_BIT; + else if (strcmp(log_filters->list[i], "debug") == 0) + filters |= VULKAN_LOADER_DEBUG_BIT; + else if (strcmp(log_filters->list[i], "layer") == 0) + filters |= VULKAN_LOADER_LAYER_BIT; + else if (strcmp(log_filters->list[i], "driver") == 0) + filters |= VULKAN_LOADER_DRIVER_BIT; + else if (strcmp(log_filters->list[i], "validation") == 0) + filters |= VULKAN_LOADER_VALIDATION_BIT; + } + return filters; +} + +bool parse_json_enable_disable_option(const struct loader_instance* inst, cJSON* object, const char* key) { + char* str = NULL; + VkResult res = loader_parse_json_string(object, key, &str); + if (res != VK_SUCCESS || NULL == str) { + return false; + } + bool enable = false; + if (strcmp(str, "enabled") == 0) { + enable = true; + } + loader_instance_heap_free(inst, str); + return enable; +} + +VkResult parse_layer_configuration(const struct loader_instance* inst, cJSON* layer_configuration_json, + loader_settings_layer_configuration* layer_configuration) { + char* control_string = NULL; + VkResult res = loader_parse_json_string(layer_configuration_json, "control", &control_string); + if (res != VK_SUCCESS) { + goto out; + } + layer_configuration->control = parse_control_string(control_string); + loader_instance_heap_free(inst, control_string); + + // If that is the only value - do no further parsing + if (layer_configuration->control == LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION) { + goto out; + } + + res = loader_parse_json_string(layer_configuration_json, "name", &(layer_configuration->name)); + if (res != VK_SUCCESS) { + goto out; + } + + res = loader_parse_json_string(layer_configuration_json, "path", &(layer_configuration->path)); + if (res != VK_SUCCESS) { + goto out; + } + + cJSON* treat_as_implicit_manifest = loader_cJSON_GetObjectItem(layer_configuration_json, "treat_as_implicit_manifest"); + if (treat_as_implicit_manifest && treat_as_implicit_manifest->type == cJSON_True) { + layer_configuration->treat_as_implicit_manifest = true; + } +out: + if (VK_SUCCESS != res) { + free_layer_configuration(inst, layer_configuration); + } + return res; +} + +VkResult parse_layer_configurations(const struct loader_instance* inst, cJSON* settings_object, loader_settings* loader_settings) { + VkResult res = VK_SUCCESS; + + cJSON* layer_configurations = loader_cJSON_GetObjectItem(settings_object, "layers"); + if (NULL == layer_configurations) { + return VK_ERROR_INITIALIZATION_FAILED; + } + + uint32_t layer_configurations_count = loader_cJSON_GetArraySize(layer_configurations); + if (layer_configurations_count == 0) { + return VK_SUCCESS; + } + + loader_settings->layer_configuration_count = layer_configurations_count; + + loader_settings->layer_configurations = loader_instance_heap_calloc( + inst, sizeof(loader_settings_layer_configuration) * layer_configurations_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if (NULL == loader_settings->layer_configurations) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + + for (uint32_t i = 0; i < layer_configurations_count; i++) { + cJSON* layer = loader_cJSON_GetArrayItem(layer_configurations, i); + if (NULL == layer) { + res = VK_ERROR_INITIALIZATION_FAILED; + goto out; + } + res = parse_layer_configuration(inst, layer, &(loader_settings->layer_configurations[i])); + if (VK_SUCCESS != res) { + goto out; + } + } +out: + if (res != VK_SUCCESS) { + if (loader_settings->layer_configurations) { + for (uint32_t i = 0; i < loader_settings->layer_configuration_count; i++) { + free_layer_configuration(inst, &(loader_settings->layer_configurations[i])); + } + loader_settings->layer_configuration_count = 0; + loader_instance_heap_free(inst, loader_settings->layer_configurations); + loader_settings->layer_configurations = NULL; + } + } + + return res; +} + +VkResult check_if_settings_path_exists(const struct loader_instance* inst, char* base, char* suffix, char** settings_file_path) { + if (NULL == base || NULL == suffix) { + return VK_ERROR_INITIALIZATION_FAILED; + } + size_t base_len = strlen(base); + size_t suffix_len = strlen(suffix); + size_t path_len = base_len + suffix_len + 1; + *settings_file_path = loader_instance_heap_calloc(inst, path_len, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + if (NULL == *settings_file_path) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + loader_strncpy(*settings_file_path, path_len, base, base_len); + loader_strncat(*settings_file_path, path_len, suffix, suffix_len); + + if (!loader_platform_file_exists(*settings_file_path)) { + loader_instance_heap_free(inst, *settings_file_path); + *settings_file_path = NULL; + return VK_ERROR_INITIALIZATION_FAILED; + } + return VK_SUCCESS; +} +VkResult get_unix_settings_path(const struct loader_instance* inst, char** settings_file_path) { + 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); + 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), + "/vulkan/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", "/vulkan/loader_settings.d/" VK_LOADER_SETTINGS_FILENAME, + settings_file_path); +} + +bool check_if_settings_are_equal(loader_settings* a, loader_settings* b) { + // If either pointer is null, return true + if (NULL == a || NULL == b) return false; + bool are_equal = true; + are_equal &= a->settings_active == b->settings_active; + are_equal &= a->has_unordered_layer_location == b->has_unordered_layer_location; + are_equal &= a->debug_level == b->debug_level; + are_equal &= a->layer_configuration_count == b->layer_configuration_count; + if (!are_equal) return false; + for (uint32_t i = 0; i < a->layer_configuration_count && i < b->layer_configuration_count; i++) { + if (a->layer_configurations[i].name && b->layer_configurations[i].name) { + are_equal &= 0 == strcmp(a->layer_configurations[i].name, b->layer_configurations[i].name); + } else { + are_equal = false; + } + if (a->layer_configurations[i].path && b->layer_configurations[i].path) { + are_equal &= 0 == strcmp(a->layer_configurations[i].path, b->layer_configurations[i].path); + } else { + are_equal = false; + } + are_equal &= a->layer_configurations[i].control == b->layer_configurations[i].control; + } + return are_equal; +} + +void log_settings(const struct loader_instance* inst, loader_settings* settings) { + if (settings == NULL) { + return; + } + loader_log(inst, VULKAN_LOADER_INFO_BIT, 0, "Using layer configurations found in loader settings from %s", + settings->settings_file_path); + + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Layer Configurations count = %d", settings->layer_configuration_count); + for (uint32_t i = 0; i < settings->layer_configuration_count; i++) { + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "---- Layer Configuration [%d] ----", i); + if (settings->layer_configurations[i].control != LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION) { + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Name: %s", settings->layer_configurations[i].name); + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Path: %s", settings->layer_configurations[i].path); + } + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "Control: %s", + loader_settings_layer_control_to_string(settings->layer_configurations[i].control)); + } + loader_log(inst, VULKAN_LOADER_DEBUG_BIT, 0, "---------------------------------"); +} + +// Loads the vk_loader_settings.json file +// Returns VK_SUCCESS if it was found & was successfully parsed. Otherwise, it returns VK_ERROR_INITIALIZATION_FAILED if it +// wasn't found or failed to parse, and returns VK_ERROR_OUT_OF_HOST_MEMORY if it was unable to allocate enough memory. +VkResult get_loader_settings(const struct loader_instance* inst, loader_settings* loader_settings) { + VkResult res = VK_SUCCESS; + cJSON* json = NULL; + char* file_format_version_string = NULL; + char* settings_file_path = NULL; +#if defined(WIN32) + res = windows_get_loader_settings_file_path(inst, &settings_file_path); + if (res != VK_SUCCESS) { + goto out; + } + +#elif COMMON_UNIX_PLATFORMS + res = get_unix_settings_path(inst, &settings_file_path); + if (res != VK_SUCCESS) { + goto out; + } +#else +#warning "Unsupported platform - must specify platform specific location for vk_loader_settings.json" +#endif + + res = loader_get_json(inst, settings_file_path, &json); + // Make sure sure the top level json value is an object + if (res != VK_SUCCESS || NULL == json || json->type != 6) { + goto out; + } + + res = loader_parse_json_string(json, "file_format_version", &file_format_version_string); + if (res != VK_SUCCESS) { + goto out; + } + uint32_t settings_array_count = 0; + bool has_multi_setting_file = false; + cJSON* settings_array = loader_cJSON_GetObjectItem(json, "settings_array"); + cJSON* single_settings_object = loader_cJSON_GetObjectItem(json, "settings"); + if (NULL != settings_array) { + has_multi_setting_file = true; + settings_array_count = loader_cJSON_GetArraySize(settings_array); + } else if (NULL != single_settings_object) { + settings_array_count = 1; + } + + // Corresponds to the settings object that has no app keys + int global_settings_index = -1; + // Corresponds to the settings object which has a matching app key + int index_to_use = -1; + + char current_process_path[1024]; + bool valid_exe_path = NULL != loader_platform_executable_path(current_process_path, 1024); + + for (int i = 0; i < (int)settings_array_count; i++) { + if (has_multi_setting_file) { + single_settings_object = loader_cJSON_GetArrayItem(settings_array, i); + } + cJSON* app_keys = loader_cJSON_GetObjectItem(single_settings_object, "app_keys"); + if (NULL == app_keys) { + if (global_settings_index == -1) { + global_settings_index = i; // use the first 'global' settings that has no app keys as the global one + } + continue; + } else if (valid_exe_path) { + int app_key_count = loader_cJSON_GetArraySize(app_keys); + if (app_key_count == 0) { + continue; // empty array + } + for (int j = 0; j < app_key_count; j++) { + cJSON* app_key_json = loader_cJSON_GetArrayItem(app_keys, j); + if (NULL == app_key_json) { + continue; + } + char* app_key = loader_cJSON_Print(app_key_json); + if (NULL == app_key) { + continue; + } + + if (strcmp(current_process_path, app_key) == 0) { + index_to_use = i; + } + loader_instance_heap_free(inst, app_key); + if (index_to_use == i) { + break; // break only after freeing the app key + } + } + } + } + + // No app specific settings match - either use global settings or exit + if (index_to_use == -1) { + if (global_settings_index == -1) { + goto out; // No global settings were found - exit + } else { + index_to_use = global_settings_index; // Global settings are present - use it + } + } + + // Now get the actual settings object to use - already have it if there is only one settings object + // If there are multiple settings, just need to set single_settings_object to the desired settings object + if (has_multi_setting_file) { + single_settings_object = loader_cJSON_GetArrayItem(settings_array, index_to_use); + if (NULL == single_settings_object) { + res = VK_ERROR_INITIALIZATION_FAILED; + goto out; + } + } + + // optional + cJSON* stderr_filter = loader_cJSON_GetObjectItem(single_settings_object, "stderr_log"); + if (NULL != stderr_filter) { + struct loader_string_list stderr_log = {0}; + res = loader_parse_json_array_of_strings(inst, single_settings_object, "stderr_log", &stderr_log); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + goto out; + } + loader_settings->debug_level = parse_log_filters_from_strings(&stderr_log); + free_string_list(inst, &stderr_log); + } + + // optional + cJSON* logs_to_use = loader_cJSON_GetObjectItem(single_settings_object, "log_locations"); + if (NULL != logs_to_use) { + int log_count = loader_cJSON_GetArraySize(logs_to_use); + for (int i = 0; i < log_count; i++) { + cJSON* log_element = loader_cJSON_GetArrayItem(logs_to_use, i); + // bool is_valid = true; + if (NULL != log_element) { + struct loader_string_list log_destinations = {0}; + res = loader_parse_json_array_of_strings(inst, log_element, "destinations", &log_destinations); + if (res != VK_SUCCESS) { + // is_valid = false; + } + free_string_list(inst, &log_destinations); + struct loader_string_list log_filters = {0}; + res = loader_parse_json_array_of_strings(inst, log_element, "filters", &log_filters); + if (res != VK_SUCCESS) { + // is_valid = false; + } + free_string_list(inst, &log_filters); + } + } + } + + res = parse_layer_configurations(inst, single_settings_object, loader_settings); + if (res != VK_SUCCESS) { + goto out; + } + + // Determine if there exists a layer configuration indicating where to put layers not contained in the settings file + // LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION + for (uint32_t i = 0; i < loader_settings->layer_configuration_count; i++) { + if (loader_settings->layer_configurations[i].control == LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION) { + loader_settings->has_unordered_layer_location = true; + break; + } + } + + loader_settings->settings_file_path = settings_file_path; + settings_file_path = NULL; + loader_settings->settings_active = true; +out: + if (NULL != json) { + loader_cJSON_Delete(json); + } + + loader_instance_heap_free(inst, settings_file_path); + + loader_instance_heap_free(inst, file_format_version_string); + return res; +} + +VkResult update_global_loader_settings(void) { + loader_settings settings = {0}; + VkResult res = get_loader_settings(NULL, &settings); + loader_platform_thread_lock_mutex(&global_loader_settings_lock); + + free_loader_settings(NULL, &global_loader_settings); + if (res == VK_SUCCESS) { + if (!check_if_settings_are_equal(&settings, &global_loader_settings)) { + log_settings(NULL, &settings); + } + + memcpy(&global_loader_settings, &settings, sizeof(loader_settings)); + if (global_loader_settings.settings_active) { + loader_set_global_debug_level(global_loader_settings.debug_level); + } + } + loader_platform_thread_unlock_mutex(&global_loader_settings_lock); + return res; +} + +void init_global_loader_settings(void) { + loader_platform_thread_create_mutex(&global_loader_settings_lock); + // Free out the global settings in case the process was loaded & unloaded + free_loader_settings(NULL, &global_loader_settings); +} +void teardown_global_loader_settings(void) { + free_loader_settings(NULL, &global_loader_settings); + loader_platform_thread_delete_mutex(&global_loader_settings_lock); +} + +bool should_skip_logging_global_messages(VkFlags msg_type) { + loader_platform_thread_lock_mutex(&global_loader_settings_lock); + bool should_skip = global_loader_settings.settings_active && 0 != (msg_type & global_loader_settings.debug_level); + loader_platform_thread_unlock_mutex(&global_loader_settings_lock); + return should_skip; +} + +// Use this function to get the correct settings to use based on the context +// If inst is NULL - use the global settings and lock the mutex +// Else return the settings local to the instance - but do nto lock the mutex +const loader_settings* get_current_settings_and_lock(const struct loader_instance* inst) { + if (inst) { + return &inst->settings; + } + loader_platform_thread_lock_mutex(&global_loader_settings_lock); + return &global_loader_settings; +} +// Release the global settings lock if we are using the global settings - aka if inst is NULL +void release_current_settings_lock(const struct loader_instance* inst) { + if (inst == NULL) { + loader_platform_thread_unlock_mutex(&global_loader_settings_lock); + } +} + +VkResult get_settings_layers(const struct loader_instance* inst, struct loader_layer_list* settings_layers, + bool* should_search_for_other_layers) { + VkResult res = VK_SUCCESS; + *should_search_for_other_layers = true; // default to true + + const loader_settings* settings = get_current_settings_and_lock(inst); + + if (NULL == settings || !settings->settings_active) { + goto out; + } + + // Assume the list doesn't contain LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION at first + *should_search_for_other_layers = false; + + for (uint32_t i = 0; i < settings->layer_configuration_count; i++) { + loader_settings_layer_configuration* layer_config = &settings->layer_configurations[i]; + + // If we encountered a layer that should be forced off, we add it to the settings_layers list but only + // with the data required to compare it with layers not in the settings file (aka name and manifest path) + if (layer_config->control == LOADER_SETTINGS_LAYER_CONTROL_OFF) { + struct loader_layer_properties props = {0}; + props.settings_control_value = LOADER_SETTINGS_LAYER_CONTROL_OFF; + loader_strncpy(props.info.layerName, VK_MAX_EXTENSION_NAME_SIZE, layer_config->name, VK_MAX_EXTENSION_NAME_SIZE); + props.info.layerName[VK_MAX_EXTENSION_NAME_SIZE - 1] = '\0'; + res = loader_copy_to_new_str(inst, layer_config->path, &props.manifest_file_name); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + goto out; + } + res = loader_append_layer_property(inst, settings_layers, &props); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + loader_free_layer_properties(inst, &props); + goto out; + } + continue; + } + + // The special layer location that indicates where unordered layers should go only should have the + // settings_control_value set - everything else should be NULL + if (layer_config->control == LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION) { + struct loader_layer_properties props = {0}; + props.settings_control_value = LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION; + res = loader_append_layer_property(inst, settings_layers, &props); + if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { + loader_free_layer_properties(inst, &props); + goto out; + } + *should_search_for_other_layers = true; + continue; + } + + if (layer_config->path == NULL) { + continue; + } + + cJSON* json = NULL; + VkResult local_res = loader_get_json(inst, layer_config->path, &json); + if (VK_ERROR_OUT_OF_HOST_MEMORY == local_res) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } else if (VK_SUCCESS != local_res || NULL == json) { + continue; + } + + local_res = + loader_add_layer_properties(inst, settings_layers, json, layer_config->treat_as_implicit_manifest, layer_config->path); + loader_cJSON_Delete(json); + + // If the error is anything other than out of memory we still want to try to load the other layers + if (VK_ERROR_OUT_OF_HOST_MEMORY == local_res) { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto out; + } + struct loader_layer_properties* newly_added_layer = &settings_layers->list[settings_layers->count - 1]; + newly_added_layer->settings_control_value = layer_config->control; + // If the manifest file found has a name that differs from the one in the settings, remove this layer from consideration + bool should_remove = false; + if (strncmp(newly_added_layer->info.layerName, layer_config->name, VK_MAX_EXTENSION_NAME_SIZE) != 0) { + should_remove = true; + loader_remove_layer_in_list(inst, settings_layers, settings_layers->count - 1); + } + // Make sure the layer isn't already in the list + for (uint32_t j = 0; settings_layers->count > 0 && j < settings_layers->count - 1; j++) { + if (0 == + strncmp(settings_layers->list[j].info.layerName, newly_added_layer->info.layerName, VK_MAX_EXTENSION_NAME_SIZE)) { + if (0 == (newly_added_layer->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) && + strcmp(settings_layers->list[j].lib_name, newly_added_layer->lib_name) == 0) { + should_remove = true; + break; + } + } + } + if (should_remove) { + loader_remove_layer_in_list(inst, settings_layers, settings_layers->count - 1); + } + } + +out: + release_current_settings_lock(inst); + return res; +} + +// Check if layers has an element with the same name. +// If layer_property is a regular layer, check if the lib_path is the same. +// If layer_property is a meta layer, just use the layerName +bool check_if_layer_is_in_list(struct loader_layer_list* layer_list, struct loader_layer_properties* layer_property) { + // If the layer is a meta layer, just check against the name + for (uint32_t i = 0; i < layer_list->count; i++) { + if (0 == strncmp(layer_list->list[i].info.layerName, layer_property->info.layerName, VK_MAX_EXTENSION_NAME_SIZE)) { + if (0 == (layer_property->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) && + strcmp(layer_list->list[i].lib_name, layer_property->lib_name) == 0) { + return true; + } + } + } + return false; +} + +VkResult combine_settings_layers_with_regular_layers(const struct loader_instance* inst, struct loader_layer_list* settings_layers, + struct loader_layer_list* regular_layers, + struct loader_layer_list* output_layers) { + VkResult res = VK_SUCCESS; + bool has_unordered_layer_location = false; + uint32_t unordered_layer_location_index = 0; + // Location to put layers that aren't known to the settings file + // Find it here so we dont have to pass in a loader_settings struct + for (uint32_t i = 0; i < settings_layers->count; i++) { + if (settings_layers->list[i].settings_control_value == LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION) { + has_unordered_layer_location = true; + unordered_layer_location_index = i; + break; + } + } + + if (settings_layers->count == 0 && regular_layers->count == 0) { + // No layers to combine + goto out; + } else if (settings_layers->count == 0) { + // No settings layers - just copy regular to output_layers - memset regular layers to prevent double frees + *output_layers = *regular_layers; + memset(regular_layers, 0, sizeof(struct loader_layer_list)); + goto out; + } else if (regular_layers->count == 0 || !has_unordered_layer_location) { + // No regular layers or has_unordered_layer_location is false - just copy settings to output_layers - + // memset settings layers to prevent double frees + *output_layers = *settings_layers; + memset(settings_layers, 0, sizeof(struct loader_layer_list)); + goto out; + } + + res = loader_init_generic_list(inst, (struct loader_generic_list*)output_layers, + (settings_layers->count + regular_layers->count) * sizeof(struct loader_layer_properties)); + if (VK_SUCCESS != res) { + goto out; + } + + // Insert the settings layers into output_layers up to unordered_layer_index + for (uint32_t i = 0; i < unordered_layer_location_index; i++) { + if (!check_if_layer_is_in_list(output_layers, &settings_layers->list[i])) { + res = loader_append_layer_property(inst, output_layers, &settings_layers->list[i]); + if (VK_SUCCESS != res) { + goto out; + } + } + } + + for (uint32_t i = 0; i < regular_layers->count; i++) { + // Check if its already been put in the output_layers list as well as the remaining settings_layers + bool regular_layer_is_ordered = check_if_layer_is_in_list(output_layers, ®ular_layers->list[i]) || + check_if_layer_is_in_list(settings_layers, ®ular_layers->list[i]); + // If it isn't found, add it + if (!regular_layer_is_ordered) { + res = loader_append_layer_property(inst, output_layers, ®ular_layers->list[i]); + if (VK_SUCCESS != res) { + goto out; + } + } else { + // layer is already ordered and can be safely freed + loader_free_layer_properties(inst, ®ular_layers->list[i]); + } + } + + // Insert the rest of the settings layers into combined_layers from unordered_layer_index to the end + // start at one after the unordered_layer_index + for (uint32_t i = unordered_layer_location_index + 1; i < settings_layers->count; i++) { + res = loader_append_layer_property(inst, output_layers, &settings_layers->list[i]); + if (VK_SUCCESS != res) { + goto out; + } + } + +out: + if (res != VK_SUCCESS) { + loader_delete_layer_list_and_properties(inst, output_layers); + } + + return res; +} + +VkResult enable_correct_layers_from_settings(const struct loader_instance* inst, const struct loader_envvar_all_filters* filters, + uint32_t app_enabled_name_count, const char* const* app_enabled_names, + const struct loader_layer_list* instance_layers, + struct loader_pointer_layer_list* target_layer_list, + struct loader_pointer_layer_list* activated_layer_list) { + VkResult res = VK_SUCCESS; + char* vk_instance_layers_env = loader_getenv(ENABLED_LAYERS_ENV, inst); + size_t vk_instance_layers_env_len = 0; + char* vk_instance_layers_env_copy = NULL; + if (vk_instance_layers_env != NULL) { + vk_instance_layers_env_len = strlen(vk_instance_layers_env) + 1; + vk_instance_layers_env_copy = loader_stack_alloc(vk_instance_layers_env_len); + + loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "env var \'%s\' defined and adding layers: %s", + ENABLED_LAYERS_ENV, vk_instance_layers_env); + } + for (uint32_t i = 0; i < instance_layers->count; i++) { + bool enable_layer = false; + struct loader_layer_properties* props = &instance_layers->list[i]; + + // Do not enable the layer if the settings have it set as off + if (props->settings_control_value == LOADER_SETTINGS_LAYER_CONTROL_OFF) { + continue; + } + // Force enable it based on settings + if (props->settings_control_value == LOADER_SETTINGS_LAYER_CONTROL_ON) { + enable_layer = true; + } + + // Check if disable filter needs to skip the layer + if ((filters->disable_filter.disable_all || filters->disable_filter.disable_all_implicit || + check_name_matches_filter_environment_var(props->info.layerName, &filters->disable_filter.additional_filters)) && + !check_name_matches_filter_environment_var(props->info.layerName, &filters->allow_filter)) { + continue; + } + // Check the enable filter + if (!enable_layer && check_name_matches_filter_environment_var(props->info.layerName, &filters->enable_filter)) { + enable_layer = true; + } + + // First look for the old-fashion layers forced on with VK_INSTANCE_LAYERS + if (!enable_layer && vk_instance_layers_env && vk_instance_layers_env_copy && vk_instance_layers_env_len > 0) { + // Copy the env-var on each iteration, so that loader_get_next_path can correctly find the separators + // This solution only needs one stack allocation ahead of time rather than an allocation per layer in the env-var + loader_strncpy(vk_instance_layers_env_copy, vk_instance_layers_env_len, vk_instance_layers_env, + vk_instance_layers_env_len); + + while (vk_instance_layers_env_copy && *vk_instance_layers_env_copy) { + char* next = loader_get_next_path(vk_instance_layers_env_copy); + if (0 == strcmp(vk_instance_layers_env_copy, props->info.layerName)) { + enable_layer = true; + break; + } + vk_instance_layers_env_copy = next; + } + } + + // Check if it should be enabled by the application + if (!enable_layer) { + for (uint32_t j = 0; j < app_enabled_name_count; j++) { + if (strcmp(props->info.layerName, app_enabled_names[j]) == 0) { + enable_layer = true; + break; + } + } + } + + // Check if its an implicit layers and thus enabled by default + if (!enable_layer && (0 == (props->type_flags & VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER)) && + loader_implicit_layer_is_enabled(inst, filters, props)) { + enable_layer = true; + } + + if (enable_layer) { + // Check if the layer is a meta layer reuse the existing function to add the meta layer + if (props->type_flags & VK_LAYER_TYPE_FLAG_META_LAYER) { + res = loader_add_meta_layer(inst, filters, props, target_layer_list, activated_layer_list, instance_layers, NULL); + if (res == VK_ERROR_OUT_OF_HOST_MEMORY) goto out; + } else { + res = loader_add_layer_properties_to_list(inst, target_layer_list, props); + if (res != VK_SUCCESS) { + goto out; + } + res = loader_add_layer_properties_to_list(inst, activated_layer_list, props); + if (res != VK_SUCCESS) { + goto out; + } + } + } + } +out: + return res; +} diff --git a/loader/settings.h b/loader/settings.h new file mode 100644 index 0000000000000000000000000000000000000000..e0ffe3a6e28a041167dfef58d88034cce012f847 --- /dev/null +++ b/loader/settings.h @@ -0,0 +1,114 @@ +/* + * + * Copyright (c) 2023 The Khronos Group Inc. + * Copyright (c) 2023 Valve Corporation + * Copyright (c) 2023 LunarG, Inc. + * + * 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: Charles Giessen + * + */ + +#pragma once + +#include +#include +#include +#include + +#include "vulkan/vulkan_core.h" + +#include "log.h" + +struct loader_instance; +struct loader_layer_list; +struct loader_pointer_layer_list; +struct loader_envvar_all_filters; +typedef struct log_configuration log_configuration; + +typedef enum loader_settings_layer_control { + LOADER_SETTINGS_LAYER_CONTROL_DEFAULT, // layer is not enabled by settings file but can be enabled through other means + LOADER_SETTINGS_LAYER_CONTROL_ON, // layer is enabled by settings file + LOADER_SETTINGS_LAYER_CONTROL_OFF, // layer is prevented from being enabled + LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION // special control indicating unspecified layers should go here. If this is not + // in the settings file, then the loader assume no other layers should be + // searched & loaded. +} loader_settings_layer_control; + +// If a loader_settings_layer_configuration has a name of loader_settings_unknown_layers_location, then it specifies that the +// layer configuration it was found in shall be the location all layers not listed in the settings file that are enabled. +#define LOADER_SETTINGS_UNKNOWN_LAYERS_LOCATION "loader_settings_unknown_layers_location" + +#define LOADER_SETTINGS_MAX_NAME_SIZE 256U; + +typedef struct loader_settings_layer_configuration { + char* name; + char* path; + loader_settings_layer_control control; + bool treat_as_implicit_manifest; // whether or not the layer should be parsed as if it is implicit + +} loader_settings_layer_configuration; + +typedef struct loader_settings { + bool settings_active; + bool has_unordered_layer_location; + enum vulkan_loader_debug_flags debug_level; + + uint32_t layer_configuration_count; + loader_settings_layer_configuration* layer_configurations; + + char* settings_file_path; +} loader_settings; + +// Call this function to get the current settings that the loader should use. +// It will open up the current loader settings file and return a loader_settings in out_loader_settings if it. +// It should be called on every call to the global functions excluding vkGetInstanceProcAddr +// Caller is responsible for cleaning up by calling free_loader_settings() +VkResult get_loader_settings(const struct loader_instance* inst, loader_settings* out_loader_settings); + +void free_loader_settings(const struct loader_instance* inst, loader_settings* loader_settings); + +// Log the settings to the console +void log_settings(const struct loader_instance* inst, loader_settings* settings); + +// Every global function needs to call this at startup to insure that +VkResult update_global_loader_settings(void); + +// Needs to be called during startup - +void init_global_loader_settings(void); +void teardown_global_loader_settings(void); + +// Check the global settings and return true if msg_type does not correspond to the active global loader settings +bool should_skip_logging_global_messages(VkFlags msg_type); + +// Query the current settings (either global or per-instance) and return the list of layers contained within. +// should_search_for_other_layers tells the caller if the settings file should be used exclusively for layer searching or not +VkResult get_settings_layers(const struct loader_instance* inst, struct loader_layer_list* settings_layers, + bool* should_search_for_other_layers); + +// Take the provided list of settings_layers and add in the layers from regular search paths +// Only adds layers that aren't already present in the settings_layers and in the location of the +// layer configuration with LOADER_SETTINGS_LAYER_UNORDERED_LAYER_LOCATION set +VkResult combine_settings_layers_with_regular_layers(const struct loader_instance* inst, struct loader_layer_list* settings_layers, + struct loader_layer_list* regular_layers, + struct loader_layer_list* output_layers); + +// Fill out activated_layer_list with the layers that should be activated, based on environment variables, VkInstanceCreateInfo, and +// the settings +VkResult enable_correct_layers_from_settings(const struct loader_instance* inst, const struct loader_envvar_all_filters* filters, + uint32_t app_enabled_name_count, const char* const* app_enabled_names, + const struct loader_layer_list* instance_layers, + struct loader_pointer_layer_list* target_layer_list, + struct loader_pointer_layer_list* activated_layer_list); diff --git a/loader/stack_allocation.h b/loader/stack_allocation.h index d1958fbdccc906d56b143d0be082b1e3c83ef81c..0a2bbaa650e425aa5eb778377283529db2e91ddd 100644 --- a/loader/stack_allocation.h +++ b/loader/stack_allocation.h @@ -36,8 +36,10 @@ #include #endif -#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if COMMON_UNIX_PLATFORMS #define loader_stack_alloc(size) alloca(size) #elif defined(_WIN32) #define loader_stack_alloc(size) _alloca(size) +#else +#warning "alloca not available on this platform!" #endif // defined(_WIN32) diff --git a/loader/terminator.c b/loader/terminator.c index 0f768c32d0c8acad73e0ed3bb3692dc953ddf7d1..2218289a8d6a10242142ef410e897f07041a0b07 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. @@ -113,6 +115,8 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperti VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties) { + (void)pPropertyCount; + (void)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; loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0, @@ -280,8 +284,8 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2(VkPhysi } 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; const struct loader_instance *inst = icd_term->this_instance; @@ -321,7 +325,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties 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; const struct loader_instance *inst = icd_term->this_instance; diff --git a/loader/trampoline.c b/loader/trampoline.c index fa07218dabcbe5a77cd6415f58344560d72c8f09..f8e24a77ce937943014a5931ca3b05abe5ca7d70 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -1,9 +1,11 @@ /* * - * Copyright (c) 2015-2022 The Khronos Group Inc. - * Copyright (c) 2015-2022 Valve Corporation - * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2015-2023 The Khronos Group Inc. + * 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. @@ -31,14 +33,16 @@ #include "debug_utils.h" #include "gpa_helper.h" #include "loader.h" +#include "loader_environment.h" #include "log.h" +#include "settings.h" #include "vk_loader_extensions.h" #include "vk_loader_platform.h" #include "wsi.h" // Trampoline entrypoints are in this file for core Vulkan commands -/* vkGetInstanceProcAddr: Get global level or instance level entrypoint addressess. +/* vkGetInstanceProcAddr: Get global level or instance level entrypoint addresses. * @param instance * @param pName * @return @@ -55,7 +59,7 @@ * * Note: * Vulkan header updated 1.2.193 changed the behavior of vkGetInstanceProcAddr for global entrypoints. They used to always be - * returned regardless of the value of the instance paramtere. The spec was amended in this version to only allow querying global + * returned regardless of the value of the instance parameter. The spec was amended in this version to only allow querying global * level entrypoints with a NULL instance. However, as to not break old applications, the new behavior is only applied if the * instance passed in is both valid and minor version is greater than 1.2, which was when this change in behavior occurred. Only * instances with a newer version will get the new behavior. @@ -95,7 +99,7 @@ LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkI struct loader_instance *ptr_instance = loader_get_instance(instance); // If we've gotten here and the pointer is NULL, it's invalid if (ptr_instance == NULL) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetInstanceProcAddr: Invalid instance [VUID-vkGetInstanceProcAddr-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -115,25 +119,44 @@ LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkI // entry points both core and extensions. // Device relative means call down the device chain. LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName) { - void *addr; + if (!pName || pName[0] != 'v' || pName[1] != 'k') return NULL; // For entrypoints that loader must handle (ie non-dispatchable or create object) // make sure the loader entrypoint is returned - addr = loader_non_passthrough_gdpa(pName); - if (addr) { - return addr; - } + const char *name = pName; + name += 2; + if (!strcmp(name, "GetDeviceProcAddr")) return (PFN_vkVoidFunction)vkGetDeviceProcAddr; + if (!strcmp(name, "DestroyDevice")) return (PFN_vkVoidFunction)vkDestroyDevice; + if (!strcmp(name, "GetDeviceQueue")) return (PFN_vkVoidFunction)vkGetDeviceQueue; + if (!strcmp(name, "AllocateCommandBuffers")) return (PFN_vkVoidFunction)vkAllocateCommandBuffers; // Although CreateDevice is on device chain it's dispatchable object isn't // a VkDevice or child of VkDevice so return NULL. if (!strcmp(pName, "CreateDevice")) return NULL; + // Because vkGetDeviceQueue2 is a 1.1 entry point, we need to check if the apiVersion provided during instance creation is + // sufficient + if (!strcmp(name, "GetDeviceQueue2")) { + struct loader_device *dev = NULL; + uint32_t index = 0; + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &index); + if (NULL != icd_term && dev != NULL) { + const struct loader_instance *inst = 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); + return (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) + ? NULL + : (PFN_vkVoidFunction)vkGetDeviceQueue2; + } + return NULL; + } // Return the dispatch table entrypoint for the fastest case - const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device; + const VkLayerDispatchTable *disp_table = loader_get_dispatch(device); if (disp_table == NULL) return NULL; - addr = loader_lookup_device_dispatch_table(disp_table, pName); - if (addr) return addr; + bool found_name = false; + void *addr = loader_lookup_device_dispatch_table(disp_table, pName, &found_name); + if (found_name) return addr; if (disp_table->GetDeviceProcAddr == NULL) return NULL; return disp_table->GetDeviceProcAddr(device, pName); @@ -144,6 +167,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionPropert VkExtensionProperties *pProperties) { LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize); + update_global_loader_settings(); + // We know we need to call at least the terminator VkResult res = VK_SUCCESS; VkEnumerateInstanceExtensionPropertiesChain chain_tail = { @@ -159,22 +184,31 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionPropert VkEnumerateInstanceExtensionPropertiesChain *chain_head = &chain_tail; // Get the implicit layers - struct loader_layer_list layers; + struct loader_layer_list layers = {0}; + loader_platform_dl_handle *libs = NULL; + size_t lib_count = 0; memset(&layers, 0, sizeof(layers)); - loader_scan_for_implicit_layers(NULL, &layers); + struct loader_envvar_all_filters layer_filters = {0}; - // We'll need to save the dl handles so we can close them later - loader_platform_dl_handle *libs = - loader_calloc(NULL, sizeof(loader_platform_dl_handle) * layers.count, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (libs == NULL && layers.count > 0) { - return VK_ERROR_OUT_OF_HOST_MEMORY; + res = parse_layer_environment_var_filters(NULL, &layer_filters); + if (VK_SUCCESS != res) { + return res; + } + + res = loader_scan_for_implicit_layers(NULL, &layers, &layer_filters); + if (VK_SUCCESS != res) { + return res; + } + + res = loader_init_library_list(&layers, &libs); + if (VK_SUCCESS != res) { + return res; } - size_t lib_count = 0; // Prepend layers onto the chain if they implement this entry point for (uint32_t i = 0; i < layers.count; ++i) { - if (!loader_implicit_layer_is_enabled(NULL, layers.list + i) || - layers.list[i].pre_instance_functions.enumerate_instance_extension_properties[0] == '\0') { + // Skip this layer if it doesn't expose the entry-point + if (NULL == layers.list[i].pre_instance_functions.enumerate_instance_extension_properties) { continue; } @@ -239,6 +273,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( VkLayerProperties *pProperties) { LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize); + update_global_loader_settings(); + // We know we need to call at least the terminator VkResult res = VK_SUCCESS; VkEnumerateInstanceLayerPropertiesChain chain_tail = { @@ -255,21 +291,30 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( // Get the implicit layers struct loader_layer_list layers; + loader_platform_dl_handle *libs = NULL; + size_t lib_count = 0; memset(&layers, 0, sizeof(layers)); - loader_scan_for_implicit_layers(NULL, &layers); + struct loader_envvar_all_filters layer_filters = {0}; - // We'll need to save the dl handles so we can close them later - loader_platform_dl_handle *libs = - loader_calloc(NULL, sizeof(loader_platform_dl_handle) * layers.count, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (libs == NULL && layers.count > 0) { - return VK_ERROR_OUT_OF_HOST_MEMORY; + res = parse_layer_environment_var_filters(NULL, &layer_filters); + if (VK_SUCCESS != res) { + return res; + } + + res = loader_scan_for_implicit_layers(NULL, &layers, &layer_filters); + if (VK_SUCCESS != res) { + return res; + } + + res = loader_init_library_list(&layers, &libs); + if (VK_SUCCESS != res) { + return res; } - size_t lib_count = 0; // Prepend layers onto the chain if they implement this entry point for (uint32_t i = 0; i < layers.count; ++i) { - if (!loader_implicit_layer_is_enabled(NULL, layers.list + i) || - layers.list[i].pre_instance_functions.enumerate_instance_layer_properties[0] == '\0') { + // Skip this layer if it doesn't expose the entry-point + if (NULL == layers.list[i].pre_instance_functions.enumerate_instance_layer_properties) { continue; } @@ -333,8 +378,10 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t *pApiVersion) { LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize); + update_global_loader_settings(); + if (NULL == pApiVersion) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkEnumerateInstanceVersion: \'pApiVersion\' must not be NULL " "(VUID-vkEnumerateInstanceVersion-pApiVersion-parameter"); // NOTE: This seems silly, but it's the only allowable failure @@ -357,21 +404,30 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t // Get the implicit layers struct loader_layer_list layers; + loader_platform_dl_handle *libs = NULL; + size_t lib_count = 0; memset(&layers, 0, sizeof(layers)); - loader_scan_for_implicit_layers(NULL, &layers); + struct loader_envvar_all_filters layer_filters = {0}; - // We'll need to save the dl handles so we can close them later - loader_platform_dl_handle *libs = - loader_calloc(NULL, sizeof(loader_platform_dl_handle) * layers.count, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); - if (libs == NULL && layers.count > 0) { - return VK_ERROR_OUT_OF_HOST_MEMORY; + res = parse_layer_environment_var_filters(NULL, &layer_filters); + if (VK_SUCCESS != res) { + return res; + } + + res = loader_scan_for_implicit_layers(NULL, &layers, &layer_filters); + if (VK_SUCCESS != res) { + return res; + } + + res = loader_init_library_list(&layers, &libs); + if (VK_SUCCESS != res) { + return res; } - size_t lib_count = 0; // Prepend layers onto the chain if they implement this entry point for (uint32_t i = 0; i < layers.count; ++i) { - if (!loader_implicit_layer_is_enabled(NULL, layers.list + i) || - layers.list[i].pre_instance_functions.enumerate_instance_version[0] == '\0') { + // Skip this layer if it doesn't expose the entry-point + if (NULL == layers.list[i].pre_instance_functions.enumerate_instance_version) { continue; } @@ -430,21 +486,64 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t return res; } +// Add the "instance-only" debug functions to the list of active debug functions +// at the very end. This way it doesn't get replaced by any new messengers +void loader_add_instance_only_debug_funcs(struct loader_instance *ptr_instance) { + VkLayerDbgFunctionNode *cur_node = ptr_instance->current_dbg_function_head; + if (cur_node == NULL) { + ptr_instance->current_dbg_function_head = ptr_instance->instance_only_dbg_function_head; + } else { + while (cur_node != NULL) { + if (cur_node == ptr_instance->instance_only_dbg_function_head) { + // Already added + break; + } + // Last item + else if (cur_node->pNext == NULL) { + cur_node->pNext = ptr_instance->instance_only_dbg_function_head; + } + cur_node = cur_node->pNext; + } + } +} + +// Remove the "instance-only" debug functions from the list of active debug functions. +// It should be added after the last actual debug utils/debug report function. +void loader_remove_instance_only_debug_funcs(struct loader_instance *ptr_instance) { + VkLayerDbgFunctionNode *cur_node = ptr_instance->current_dbg_function_head; + + // Only thing in list is the instance only head + if (cur_node == ptr_instance->instance_only_dbg_function_head) { + ptr_instance->current_dbg_function_head = NULL; + } + while (cur_node != NULL) { + if (cur_node->pNext == ptr_instance->instance_only_dbg_function_head) { + cur_node->pNext = NULL; + break; + } + cur_node = cur_node->pNext; + } +} + LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { struct loader_instance *ptr_instance = NULL; VkInstance created_instance = VK_NULL_HANDLE; VkResult res = VK_ERROR_INITIALIZATION_FAILED; + VkInstanceCreateInfo ici = {0}; + struct loader_envvar_all_filters layer_filters = {0}; LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize); if (pCreateInfo == NULL) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateInstance: \'pCreateInfo\' is NULL (VUID-vkCreateInstance-pCreateInfo-parameter)"); goto out; } + ici = *pCreateInfo; + if (pInstance == NULL) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateInstance \'pInstance\' not valid (VUID-vkCreateInstance-pInstance-parameter)"); goto out; } @@ -452,8 +551,6 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr ptr_instance = (struct loader_instance *)loader_calloc(pAllocator, sizeof(struct loader_instance), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); - VkInstanceCreateInfo ici = *pCreateInfo; - if (ptr_instance == NULL) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -470,8 +567,6 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr ptr_instance->app_api_version = LOADER_VERSION_1_0_0; } else { ptr_instance->app_api_version = loader_make_version(pCreateInfo->pApplicationInfo->apiVersion); - // zero out the patch version since we don't actually want to compare with it - ptr_instance->app_api_version.patch = 0; } // Look for one or more VK_EXT_debug_report or VK_EXT_debug_utils create info structures @@ -493,34 +588,67 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr goto out; } + VkResult settings_file_res = get_loader_settings(ptr_instance, &ptr_instance->settings); + if (settings_file_res == VK_ERROR_OUT_OF_HOST_MEMORY) { + res = settings_file_res; + goto out; + } + if (ptr_instance->settings.settings_active) { + log_settings(ptr_instance, &ptr_instance->settings); + } + + // Providing an apiVersion less than VK_API_VERSION_1_0 but greater than zero prevents the validation layers from starting + if (pCreateInfo->pApplicationInfo && pCreateInfo->pApplicationInfo->apiVersion < VK_API_VERSION_1_0) { + loader_log(ptr_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of %u which is not permitted. If apiVersion is " + "not 0, then it must be " + "greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]", + pCreateInfo->pApplicationInfo->apiVersion); + } + // Check the VkInstanceCreateInfoFlags wether to allow the portability enumeration flag if ((pCreateInfo->flags & VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR) == 1) { - // Make sure the extension has been enabled + ptr_instance->portability_enumeration_flag_bit_set = true; + } + // Make sure the extension has been enabled + if (pCreateInfo->ppEnabledExtensionNames) { for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME) == 0) { - ptr_instance->portability_enumeration_enabled = true; - loader_log(ptr_instance, VULKAN_LOADER_INFO_BIT, 0, - "Portability enumeration bit was set, enumerating portability drivers."); + ptr_instance->portability_enumeration_extension_enabled = true; + if (ptr_instance->portability_enumeration_flag_bit_set) { + ptr_instance->portability_enumeration_enabled = true; + loader_log(ptr_instance, VULKAN_LOADER_INFO_BIT, 0, + "Portability enumeration bit was set, enumerating portability drivers."); + } } } } - // 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) { + const uint32_t expected_variant = 0; + 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); } } + res = parse_layer_environment_var_filters(ptr_instance, &layer_filters); + if (VK_SUCCESS != res) { + goto out; + } + // Due to implicit layers need to get layer list even if // enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always // get layer list via loader_scan_for_layers(). memset(&ptr_instance->instance_layer_list, 0, sizeof(ptr_instance->instance_layer_list)); - loader_scan_for_layers(ptr_instance, &ptr_instance->instance_layer_list); + res = loader_scan_for_layers(ptr_instance, &ptr_instance->instance_layer_list, &layer_filters); + if (VK_SUCCESS != res) { + goto out; + } // Validate the app requested layers to be enabled if (pCreateInfo->enabledLayerCount > 0) { @@ -531,21 +659,37 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr } } - // Scan/discover all ICD libraries - memset(&ptr_instance->icd_tramp_list, 0, sizeof(ptr_instance->icd_tramp_list)); + // Scan/discover all System and Environment Variable ICD libraries bool skipped_portability_drivers = false; - res = loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list, &skipped_portability_drivers); + res = loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list, pCreateInfo, &skipped_portability_drivers); if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { goto out; - } else if (ptr_instance->icd_tramp_list.count == 0) { + } + + if (ptr_instance->icd_tramp_list.count == 0) { // No drivers found if (skipped_portability_drivers) { - loader_log( - ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, - "vkCreateInstance: Found drivers that contain devices which support the portability subset, but the " - "portability enumeration bit was not set! Applications that wish to enumerate portability drivers must set the " - "VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo flags and " - "enable the VK_KHR_portability_enumeration instance extension."); + 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, + "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 " + "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo " + "flags."); + } else if (ptr_instance->portability_enumeration_flag_bit_set && + !ptr_instance->portability_enumeration_extension_enabled) { + loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "VkInstanceCreateInfo: If flags has the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit set, the " + "list of enabled extensions in ppEnabledExtensionNames must contain VK_KHR_portability_enumeration " + "[VUID-VkInstanceCreateInfo-flags-06559 ]" + "Applications that wish to enumerate portability drivers must enable the VK_KHR_portability_enumeration " + "instance extension."); + } else { + loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, + "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 " + "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo " + "flags and enable the VK_KHR_portability_enumeration instance extension."); + } } loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "vkCreateInstance: Found no drivers!"); res = VK_ERROR_INCOMPATIBLE_DRIVER; @@ -557,7 +701,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr if (res != VK_SUCCESS) { goto out; } - res = loader_validate_instance_extensions(ptr_instance, &ptr_instance->ext_list, &ptr_instance->instance_layer_list, &ici); + res = loader_validate_instance_extensions(ptr_instance, &ptr_instance->ext_list, &ptr_instance->instance_layer_list, + &layer_filters, &ici); if (res != VK_SUCCESS) { goto out; } @@ -578,7 +723,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr loader_platform_thread_unlock_mutex(&loader_global_instance_list_lock); // Activate any layers on instance chain - res = loader_enable_instance_layers(ptr_instance, &ici, &ptr_instance->instance_layer_list); + res = loader_enable_instance_layers(ptr_instance, &ici, &ptr_instance->instance_layer_list, &layer_filters); if (res != VK_SUCCESS) { goto out; } @@ -604,6 +749,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr // GetInstanceProcAddr functions to return valid extension functions // if enabled. loader_activate_instance_layer_extensions(ptr_instance, created_instance); + ptr_instance->instance_finished_creation = true; } else if (VK_ERROR_EXTENSION_NOT_PRESENT == res && !ptr_instance->create_terminator_invalid_extension) { loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0, "vkCreateInstance: Layer returning invalid extension error not triggered by ICD/Loader (Policy #LLP_LAYER_17)."); @@ -620,16 +766,14 @@ out: } loader_platform_thread_unlock_mutex(&loader_global_instance_list_lock); + free_loader_settings(ptr_instance, &ptr_instance->settings); + loader_instance_heap_free(ptr_instance, ptr_instance->disp); // Remove any created VK_EXT_debug_report or VK_EXT_debug_utils items destroy_debug_callbacks_chain(ptr_instance, pAllocator); - if (NULL != ptr_instance->expanded_activated_layer_list.list) { - loader_deactivate_layers(ptr_instance, NULL, &ptr_instance->expanded_activated_layer_list); - } - if (NULL != ptr_instance->app_activated_layer_list.list) { - loader_destroy_layer_list(ptr_instance, NULL, &ptr_instance->app_activated_layer_list); - } + loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->expanded_activated_layer_list); + loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->app_activated_layer_list); loader_delete_layer_list_and_properties(ptr_instance, &ptr_instance->instance_layer_list); loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_tramp_list); @@ -641,15 +785,22 @@ out: struct loader_icd_term *icd_term = NULL; while (NULL != ptr_instance->icd_terms) { icd_term = ptr_instance->icd_terms; + // Call destroy Instance on each driver in case we successfully called down the chain but failed on + // our way back out of it. + if (icd_term->instance) { + icd_term->dispatch.DestroyInstance(icd_term->instance, pAllocator); + } + icd_term->instance = VK_NULL_HANDLE; ptr_instance->icd_terms = icd_term->next; loader_icd_destroy(ptr_instance, icd_term, pAllocator); } + free_string_list(ptr_instance, &ptr_instance->enabled_layer_names); + loader_instance_heap_free(ptr_instance, ptr_instance); } else { // success path, swap out created debug callbacks out so they aren't used until instance destruction - ptr_instance->InstanceCreationDeletionDebugFunctionHead = ptr_instance->DbgFunctionHead; - ptr_instance->DbgFunctionHead = NULL; + loader_remove_instance_only_debug_funcs(ptr_instance); } // Only unlock when ptr_instance isn't NULL, as if it is, the above code didn't make it to when loader_lock was locked. loader_platform_thread_unlock_mutex(&loader_lock); @@ -669,7 +820,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, ptr_instance = loader_get_instance(instance); if (ptr_instance == NULL) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyInstance: Invalid instance [VUID-vkDestroyInstance-instance-parameter]"); loader_platform_thread_unlock_mutex(&loader_lock); abort(); /* Intentionally fail so user can correct issue. */ @@ -683,18 +834,19 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, destroy_debug_callbacks_chain(ptr_instance, pAllocator); // Swap in the debug callbacks created during instance creation - ptr_instance->DbgFunctionHead = ptr_instance->InstanceCreationDeletionDebugFunctionHead; - ptr_instance->InstanceCreationDeletionDebugFunctionHead = NULL; + loader_add_instance_only_debug_funcs(ptr_instance); disp = loader_get_instance_layer_dispatch(instance); disp->DestroyInstance(ptr_instance->instance, pAllocator); - if (NULL != ptr_instance->expanded_activated_layer_list.list) { - loader_deactivate_layers(ptr_instance, NULL, &ptr_instance->expanded_activated_layer_list); - } - if (NULL != ptr_instance->app_activated_layer_list.list) { - loader_destroy_layer_list(ptr_instance, NULL, &ptr_instance->app_activated_layer_list); - } + free_loader_settings(ptr_instance, &ptr_instance->settings); + + loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->expanded_activated_layer_list); + loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->app_activated_layer_list); + + loader_delete_layer_list_and_properties(ptr_instance, &ptr_instance->instance_layer_list); + + free_string_list(ptr_instance, &ptr_instance->enabled_layer_names); if (ptr_instance->phys_devs_tramp) { for (uint32_t i = 0; i < ptr_instance->phys_dev_count_tramp; i++) { @@ -710,8 +862,8 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, loader_instance_heap_free(ptr_instance, ptr_instance); loader_platform_thread_unlock_mutex(&loader_lock); - // Unload preloaded layers, so if vkEnumerateInstanceExtensionProperties or vkCreateInstance is called again, the ICD's are up - // to date + // Unload preloaded layers, so if vkEnumerateInstanceExtensionProperties or vkCreateInstance is called again, the ICD's are + // up to date loader_unload_preloaded_icds(); } @@ -724,13 +876,13 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstan inst = loader_get_instance(instance); if (NULL == inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkEnumeratePhysicalDevices: Invalid instance [VUID-vkEnumeratePhysicalDevices-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } if (NULL == pPhysicalDeviceCount) { - loader_log(inst, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(inst, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkEnumeratePhysicalDevices: Received NULL pointer for physical device count return value. " "[VUID-vkEnumeratePhysicalDevices-pPhysicalDeviceCount-parameter]"); res = VK_ERROR_INITIALIZATION_FAILED; @@ -760,7 +912,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalD VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { loader_log( - NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceFeatures: Invalid physicalDevice [VUID-vkGetPhysicalDeviceFeatures-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -773,7 +925,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkP const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceFormatProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceFormatProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -788,7 +940,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatPrope const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceImageFormatProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceImageFormatProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -803,9 +955,9 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysica const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log( - NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetPhysicalDeviceProperties: Invalid physicalDevice [VUID-vkGetPhysicalDeviceProperties-physicalDevice-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetPhysicalDeviceProperties: Invalid physicalDevice " + "[VUID-vkGetPhysicalDeviceProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } disp = loader_get_instance_layer_dispatch(physicalDevice); @@ -818,7 +970,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyPropertie const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceQueueFamilyProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceQueueFamilyProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -832,7 +984,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkP const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceMemoryProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceMemoryProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -844,7 +996,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkP LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { if (VK_NULL_HANDLE == loader_unwrap_physical_device(physicalDevice)) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDevice: Invalid physicalDevice [VUID-vkCreateDevice-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -862,7 +1014,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const } disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyDevice: Invalid device [VUID-vkDestroyDevice-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -882,7 +1034,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionPropertie const VkLayerInstanceDispatchTable *disp; phys_dev = (struct loader_physical_device_tramp *)physicalDevice; if (VK_NULL_HANDLE == physicalDevice || PHYS_TRAMP_MAGIC_NUMBER != phys_dev->magic) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkEnumerateDeviceExtensionProperties: Invalid physicalDevice " "[VUID-vkEnumerateDeviceExtensionProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -906,8 +1058,6 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(Vk VkLayerProperties *pProperties) { uint32_t copy_size; struct loader_physical_device_tramp *phys_dev; - struct loader_layer_list *enabled_layers, layers_list; - memset(&layers_list, 0, sizeof(layers_list)); loader_platform_thread_lock_mutex(&loader_lock); // Don't dispatch this call down the instance chain, want all device layers @@ -917,7 +1067,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(Vk phys_dev = (struct loader_physical_device_tramp *)physicalDevice; if (VK_NULL_HANDLE == physicalDevice || PHYS_TRAMP_MAGIC_NUMBER != phys_dev->magic) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkEnumerateDeviceLayerProperties: Invalid physicalDevice " "[VUID-vkEnumerateDeviceLayerProperties-physicalDevice-parameter]"); loader_platform_thread_unlock_mutex(&loader_lock); @@ -932,11 +1082,10 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(Vk loader_platform_thread_unlock_mutex(&loader_lock); return VK_SUCCESS; } - enabled_layers = (struct loader_layer_list *)&inst->app_activated_layer_list; copy_size = (*pPropertyCount < count) ? *pPropertyCount : count; for (uint32_t i = 0; i < copy_size; i++) { - memcpy(&pProperties[i], &(enabled_layers->list[i].info), sizeof(VkLayerProperties)); + memcpy(&pProperties[i], &(inst->app_activated_layer_list.list[i]->info), sizeof(VkLayerProperties)); } *pPropertyCount = copy_size; @@ -953,7 +1102,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint3 VkQueue *pQueue) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceQueue: Invalid device [VUID-vkGetDeviceQueue-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -968,7 +1117,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32 VkFence fence) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkQueueSubmit: Invalid queue [VUID-vkQueueSubmit-queue-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -979,7 +1128,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32 LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkQueueWaitIdle: Invalid queue [VUID-vkQueueWaitIdle-queue-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -990,7 +1139,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) { LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDeviceWaitIdle: Invalid device [VUID-vkDeviceWaitIdle-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1002,7 +1151,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, c const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAllocateMemory: Invalid device [VUID-vkAllocateMemory-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1014,7 +1163,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceM const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkFreeMemory: Invalid device [VUID-vkFreeMemory-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1026,7 +1175,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDevi VkDeviceSize size, VkFlags flags, void **ppData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkMapMemory: Invalid device [VUID-vkMapMemory-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1037,7 +1186,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDevi LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory mem) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkUnmapMemory: Invalid device [VUID-vkUnmapMemory-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1049,7 +1198,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice const VkMappedMemoryRange *pMemoryRanges) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkFlushMappedMemoryRanges: Invalid device [VUID-vkFlushMappedMemoryRanges-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1061,7 +1210,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDe const VkMappedMemoryRange *pMemoryRanges) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkInvalidateMappedMemoryRanges: Invalid device [VUID-vkInvalidateMappedMemoryRanges-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1073,7 +1222,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice de VkDeviceSize *pCommittedMemoryInBytes) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceMemoryCommitment: Invalid device [VUID-vkGetDeviceMemoryCommitment-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1085,7 +1234,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkDeviceSize offset) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindBufferMemory: Invalid device [VUID-vkBindBufferMemory-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1097,7 +1246,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkDeviceSize offset) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindImageMemory: Invalid device [VUID-vkBindImageMemory-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1109,7 +1258,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice VkMemoryRequirements *pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferMemoryRequirements: Invalid device [VUID-vkGetBufferMemoryRequirements-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1121,7 +1270,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice d VkMemoryRequirements *pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageMemoryRequirements: Invalid device [VUID-vkGetImageMemoryRequirements-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1134,7 +1283,7 @@ vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSp VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageSparseMemoryRequirements: Invalid device [VUID-vkGetImageSparseMemoryRequirements-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1148,7 +1297,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatPro const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSparseImageFormatProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSparseImageFormatProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1163,7 +1312,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, ui const VkBindSparseInfo *pBindInfo, VkFence fence) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkQueueBindSparse: Invalid queue [VUID-vkQueueBindSparse-queue-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1175,7 +1324,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, cons const VkAllocationCallbacks *pAllocator, VkFence *pFence) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateFence: Invalid device [VUID-vkCreateFence-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1186,7 +1335,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, cons LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyFence: Invalid device [VUID-vkDestroyFence-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1197,7 +1346,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkResetFences: Invalid device [VUID-vkResetFences-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1208,7 +1357,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetFenceStatus: Invalid device [VUID-vkGetFenceStatus-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1220,7 +1369,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, ui VkBool32 waitAll, uint64_t timeout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkWaitForFences: Invalid device [VUID-vkWaitForFences-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1232,7 +1381,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateSemaphore: Invalid device [VUID-vkCreateSemaphore-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1244,7 +1393,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkS const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroySemaphore: Invalid device [VUID-vkDestroySemaphore-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1256,7 +1405,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, cons const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateEvent: Invalid device [VUID-vkCreateEvent-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1267,7 +1416,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, cons LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyEvent: Invalid device [VUID-vkDestroyEvent-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1278,7 +1427,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetEventStatus: Invalid device [VUID-vkGetEventStatus-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1289,7 +1438,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, V LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkSetEvent: Invalid device [VUID-vkSetEvent-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1300,7 +1449,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkResetEvent: Invalid device [VUID-vkResetEvent-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1312,7 +1461,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateQueryPool: Invalid device [VUID-vkCreateQueryPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1324,7 +1473,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQ const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyQueryPool: Invalid device [VUID-vkDestroyQueryPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1337,7 +1486,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice devi VkDeviceSize stride, VkQueryResultFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetQueryPoolResults: Invalid device [VUID-vkGetQueryPoolResults-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1349,7 +1498,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, con const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateBuffer: Invalid device [VUID-vkCreateBuffer-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1361,7 +1510,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuff const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyBuffer: Invalid device [VUID-vkDestroyBuffer-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1373,7 +1522,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateBufferView: Invalid device [VUID-vkCreateBufferView-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1385,7 +1534,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, Vk const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyBufferView: Invalid device [VUID-vkDestroyBufferView-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1397,7 +1546,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, cons const VkAllocationCallbacks *pAllocator, VkImage *pImage) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateImage: Invalid device [VUID-vkCreateImage-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1408,7 +1557,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, cons LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyImage: Invalid device [VUID-vkDestroyImage-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1421,7 +1570,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice de VkSubresourceLayout *pLayout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageSubresourceLayout: Invalid device [VUID-vkGetImageSubresourceLayout-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1433,7 +1582,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkAllocationCallbacks *pAllocator, VkImageView *pView) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateImageView: Invalid device [VUID-vkCreateImageView-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1445,7 +1594,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkI const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyImageView: Invalid device [VUID-vkDestroyImageView-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1458,7 +1607,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice devic VkShaderModule *pShader) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateShaderModule: Invalid device [VUID-vkCreateShaderModule-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1470,7 +1619,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyShaderModule: Invalid device [VUID-vkDestroyShaderModule-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1483,7 +1632,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice devi VkPipelineCache *pPipelineCache) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreatePipelineCache: Invalid device [VUID-vkCreatePipelineCache-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1495,7 +1644,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyPipelineCache: Invalid device [VUID-vkDestroyPipelineCache-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1507,7 +1656,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice dev size_t *pDataSize, void *pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPipelineCacheData: Invalid device [VUID-vkGetPipelineCacheData-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1519,7 +1668,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice devi uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkMergePipelineCaches: Invalid device [VUID-vkMergePipelineCaches-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1534,7 +1683,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice VkPipeline *pPipelines) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateGraphicsPipelines: Invalid device [VUID-vkCreateGraphicsPipelines-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1549,7 +1698,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice d VkPipeline *pPipelines) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateComputePipelines: Invalid device [VUID-vkCreateComputePipelines-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1561,7 +1710,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPi const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyPipeline: Invalid device [VUID-vkDestroyPipeline-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1574,7 +1723,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice dev VkPipelineLayout *pPipelineLayout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreatePipelineLayout: Invalid device [VUID-vkCreatePipelineLayout-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1586,7 +1735,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyPipelineLayout: Invalid device [VUID-vkDestroyPipelineLayout-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1598,7 +1747,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, co const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateSampler: Invalid device [VUID-vkCreateSampler-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1610,7 +1759,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSam const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroySampler: Invalid device [VUID-vkDestroySampler-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1624,7 +1773,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevic VkDescriptorSetLayout *pSetLayout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDescriptorSetLayout: Invalid device [VUID-vkCreateDescriptorSetLayout-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1636,7 +1785,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice d const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyDescriptorSetLayout: Invalid device [VUID-vkDestroyDescriptorSetLayout-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1649,7 +1798,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice dev VkDescriptorPool *pDescriptorPool) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDescriptorPool: Invalid device [VUID-vkCreateDescriptorPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1661,7 +1810,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyDescriptorPool: Invalid device [VUID-vkDestroyDescriptorPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1673,7 +1822,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice devi VkDescriptorPoolResetFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkResetDescriptorPool: Invalid device [VUID-vkResetDescriptorPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1686,7 +1835,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice d VkDescriptorSet *pDescriptorSets) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAllocateDescriptorSets: Invalid device [VUID-vkAllocateDescriptorSets-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1699,7 +1848,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice devic const VkDescriptorSet *pDescriptorSets) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkFreeDescriptorSets: Invalid device [VUID-vkFreeDescriptorSets-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1713,7 +1862,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, const VkCopyDescriptorSet *pDescriptorCopies) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkUpdateDescriptorSets: Invalid device [VUID-vkUpdateDescriptorSets-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1726,7 +1875,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device VkFramebuffer *pFramebuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateFramebuffer: Invalid device [VUID-vkCreateFramebuffer-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1738,7 +1887,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, V const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyFramebuffer: Invalid device [VUID-vkDestroyFramebuffer-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1751,7 +1900,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, VkRenderPass *pRenderPass) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateRenderPass: Invalid device [VUID-vkCreateRenderPass-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1763,7 +1912,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, Vk const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyRenderPass: Invalid device [VUID-vkDestroyRenderPass-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1775,7 +1924,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice dev VkExtent2D *pGranularity) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetRenderAreaGranularity: Invalid device [VUID-vkGetRenderAreaGranularity-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1788,7 +1937,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device VkCommandPool *pCommandPool) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateCommandPool: Invalid device [VUID-vkCreateCommandPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1800,7 +1949,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, V const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyCommandPool: Invalid device [VUID-vkDestroyCommandPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1812,7 +1961,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPoolResetFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkResetCommandPool: Invalid device [VUID-vkResetCommandPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1826,7 +1975,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice d VkResult res; const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAllocateCommandBuffers: Invalid device [VUID-vkAllocateCommandBuffers-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1835,7 +1984,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice d if (res == VK_SUCCESS) { for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) { if (pCommandBuffers[i]) { - loader_init_dispatch(pCommandBuffers[i], disp); + loader_set_dispatch(pCommandBuffers[i], disp); } } } @@ -1847,7 +1996,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, V uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkFreeCommandBuffers: Invalid device [VUID-vkFreeCommandBuffers-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1861,7 +2010,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffe disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBeginCommandBuffer: Invalid commandBuffer [VUID-vkBeginCommandBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1872,7 +2021,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffe LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkEndCommandBuffer: Invalid commandBuffer [VUID-vkEndCommandBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1883,7 +2032,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkResetCommandBuffer: Invalid commandBuffer [VUID-vkResetCommandBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1895,7 +2044,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer comma VkPipeline pipeline) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindPipeline: Invalid commandBuffer [VUID-vkCmdBindPipeline-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1907,7 +2056,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer comman uint32_t viewportCount, const VkViewport *pViewports) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetViewport: Invalid commandBuffer [VUID-vkCmdSetViewport-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1919,7 +2068,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer command uint32_t scissorCount, const VkRect2D *pScissors) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetScissor: Invalid commandBuffer [VUID-vkCmdSetScissor-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1930,7 +2079,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer command LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetLineWidth: Invalid commandBuffer [VUID-vkCmdSetLineWidth-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1942,7 +2091,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer comma float depthBiasClamp, float depthBiasSlopeFactor) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetDepthBias: Invalid commandBuffer [VUID-vkCmdSetDepthBias-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1953,7 +2102,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer comma LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetBlendConstants: Invalid commandBuffer [VUID-vkCmdSetBlendConstants-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1965,7 +2114,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer com float maxDepthBounds) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetDepthBounds: Invalid commandBuffer [VUID-vkCmdSetDepthBounds-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1977,7 +2126,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuf uint32_t compareMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetStencilCompareMask: Invalid commandBuffer [VUID-vkCmdSetStencilCompareMask-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1989,7 +2138,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffe uint32_t writeMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetStencilWriteMask: Invalid commandBuffer [VUID-vkCmdSetStencilWriteMask-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2001,7 +2150,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffe uint32_t reference) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetStencilReference: Invalid commandBuffer [VUID-vkCmdSetStencilReference-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2016,7 +2165,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindDescriptorSets: Invalid commandBuffer [VUID-vkCmdBindDescriptorSets-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2029,7 +2178,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer co VkIndexType indexType) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindIndexBuffer: Invalid commandBuffer [VUID-vkCmdBindIndexBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2042,7 +2191,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer const VkDeviceSize *pOffsets) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBindVertexBuffers: Invalid commandBuffer [VUID-vkCmdBindVertexBuffers-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2054,7 +2203,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer uint32_t firstVertex, uint32_t firstInstance) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDraw: Invalid commandBuffer [VUID-vkCmdDraw-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2067,7 +2216,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer comman uint32_t firstInstance) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndexed: Invalid commandBuffer [VUID-vkCmdDrawIndexed-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2079,7 +2228,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer comma uint32_t drawCount, uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndirect: Invalid commandBuffer [VUID-vkCmdDrawIndirect-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2091,7 +2240,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffe VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndexedIndirect: Invalid commandBuffer [VUID-vkCmdDrawIndexedIndirect-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2102,7 +2251,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffe LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDispatch: Invalid commandBuffer [VUID-vkCmdDispatch-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2114,7 +2263,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer c VkDeviceSize offset) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDispatchIndirect: Invalid commandBuffer [VUID-vkCmdDispatchIndirect-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2126,7 +2275,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer command uint32_t regionCount, const VkBufferCopy *pRegions) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyBuffer: Invalid commandBuffer [VUID-vkCmdCopyBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2140,8 +2289,8 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandB const VkImageCopy *pRegions) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkCmdCopyImage: Invalid commandBuffer [VUID-vkCmdCopyImage-devcommandBufferice-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdCopyImage: Invalid commandBuffer [VUID-vkCmdCopyImage-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2154,7 +2303,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandB const VkImageBlit *pRegions, VkFilter filter) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBlitImage: Invalid commandBuffer [VUID-vkCmdBlitImage-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2167,7 +2316,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer const VkBufferImageCopy *pRegions) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyBufferToImage: Invalid commandBuffer [VUID-vkCmdCopyBufferToImage-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2180,7 +2329,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer uint32_t regionCount, const VkBufferImageCopy *pRegions) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyImageToBuffer: Invalid commandBuffer [VUID-vkCmdCopyImageToBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2192,7 +2341,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer comma VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdUpdateBuffer: Invalid commandBuffer [VUID-vkCmdUpdateBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2204,7 +2353,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer command VkDeviceSize size, uint32_t data) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdFillBuffer: Invalid commandBuffer [VUID-vkCmdFillBuffer-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2217,7 +2366,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer co uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdClearColorImage: Invalid commandBuffer [VUID-vkCmdClearColorImage-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2231,7 +2380,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBu uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdClearDepthStencilImage: Invalid commandBuffer [VUID-vkCmdClearDepthStencilImage-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2244,7 +2393,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer c const VkClearRect *pRects) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdClearAttachments: Invalid commandBuffer [VUID-vkCmdClearAttachments-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2258,7 +2407,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer comma const VkImageResolve *pRegions) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdResolveImage: Invalid commandBuffer [VUID-vkCmdResolveImage-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2270,7 +2419,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBu VkPipelineStageFlags stageMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetEvent: Invalid commandBuffer [VUID-vkCmdSetEvent-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2282,7 +2431,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer command VkPipelineStageFlags stageMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdResetEvent: Invalid commandBuffer [VUID-vkCmdResetEvent-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2299,7 +2448,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer command const VkImageMemoryBarrier *pImageMemoryBarriers) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdWaitEvents: Invalid commandBuffer [VUID-vkCmdWaitEvents-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2317,7 +2466,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer co const VkImageMemoryBarrier *pImageMemoryBarriers) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdPipelineBarrier: Invalid commandBuffer [VUID-vkCmdPipelineBarrier-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2330,7 +2479,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer command VkFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginQuery: Invalid commandBuffer [VUID-vkCmdBeginQuery-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2341,7 +2490,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer command LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndQuery: Invalid commandBuffer [VUID-vkCmdEndQuery-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2353,7 +2502,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer com uint32_t firstQuery, uint32_t queryCount) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdResetQueryPool: Invalid commandBuffer [VUID-vkCmdResetQueryPool-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2365,7 +2514,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer com VkQueryPool queryPool, uint32_t slot) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdWriteTimestamp: Invalid commandBuffer [VUID-vkCmdWriteTimestamp-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2378,7 +2527,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuff VkDeviceSize dstOffset, VkDeviceSize stride, VkFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdCopyQueryPoolResults: Invalid commandBuffer [VUID-vkCmdCopyQueryPoolResults-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2391,7 +2540,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer comm const void *pValues) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdPushConstants: Invalid commandBuffer [VUID-vkCmdPushConstants-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2404,7 +2553,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer co VkSubpassContents contents) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginRenderPass: Invalid commandBuffer [VUID-vkCmdBeginRenderPass-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2415,7 +2564,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer co LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdNextSubpass: Invalid commandBuffer [VUID-vkCmdNextSubpass-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2426,7 +2575,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer comman LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndRenderPass: Invalid commandBuffer [VUID-vkCmdEndRenderPass-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2438,7 +2587,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer co const VkCommandBuffer *pCommandBuffers) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdExecuteCommands: Invalid commandBuffer [VUID-vkCmdExecuteCommands-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2458,7 +2607,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups( inst = loader_get_instance(instance); if (NULL == inst) { loader_log( - NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkEnumeratePhysicalDeviceGroupsKHR: Invalid instance [VUID-vkEnumeratePhysicalDeviceGroups-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2492,7 +2641,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysical VkPhysicalDeviceFeatures2 *pFeatures) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceFeatures2: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceFeatures2-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2511,7 +2660,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysic VkPhysicalDeviceProperties2 *pProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceProperties2: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceProperties2-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2530,7 +2679,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(Vk VkFormatProperties2 *pFormatProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceFormatProperties2: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceFormatProperties2-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2550,7 +2699,7 @@ vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkImageFormatProperties2 *pImageFormatProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceImageFormatProperties2: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceImageFormatProperties2-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2569,7 +2718,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyPropertie VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceQueueFamilyProperties2: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceQueueFamilyProperties2-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2588,7 +2737,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceMemoryProperties2: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceMemoryProperties2-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2608,7 +2757,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatPro VkSparseImageFormatProperties2 *pProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSparseImageFormatProperties2: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSparseImageFormatProperties2-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2628,7 +2777,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProper VkExternalBufferProperties *pExternalBufferProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceExternalBufferProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceExternalBufferProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2644,11 +2793,11 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProper } 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) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceExternalSemaphoreProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceExternalSemaphoreProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2670,7 +2819,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropert VkExternalFenceProperties *pExternalFenceProperties) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceExternalFenceProperties: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceExternalFenceProperties-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2689,7 +2838,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device const VkBindBufferMemoryInfo *pBindInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindBufferMemory2: Invalid device [VUID-vkBindBufferMemory2-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2700,7 +2849,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, const VkBindImageMemoryInfo *pBindInfos) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkBindImageMemory2: Invalid device [VUID-vkBindImageMemory2-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2712,7 +2861,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDe VkPeerMemoryFeatureFlags *pPeerMemoryFeatures) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceGroupPeerMemoryFeatures: Invalid device [VUID-vkGetDeviceGroupPeerMemoryFeatures-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2722,7 +2871,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDe LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdSetDeviceMask: Invalid commandBuffer [VUID-vkCmdSetDeviceMask-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2734,7 +2883,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBase(VkCommandBuffer comma uint32_t groupCountZ) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDispatchBase: Invalid commandBuffer [VUID-vkCmdDispatchBase-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2745,7 +2894,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice VkMemoryRequirements2 *pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageMemoryRequirements2: Invalid device [VUID-vkGetImageMemoryRequirements2-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2757,7 +2906,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice VkMemoryRequirements2 *pMemoryRequirements) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferMemoryRequirements2: Invalid device [VUID-vkGetBufferMemoryRequirements2-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2770,7 +2919,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2( const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { loader_log( - NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetImageSparseMemoryRequirements2: Invalid device [VUID-vkGetImageSparseMemoryRequirements2-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2781,7 +2930,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCo VkCommandPoolTrimFlags flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkTrimCommandPool: Invalid device [VUID-vkTrimCommandPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2791,7 +2940,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCo LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceQueue2: Invalid device [VUID-vkGetDeviceQueue2-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2807,7 +2956,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDe VkSamplerYcbcrConversion *pYcbcrConversion) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateSamplerYcbcrConversion: Invalid device [VUID-vkCreateSamplerYcbcrConversion-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2818,7 +2967,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevic const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroySamplerYcbcrConversion: Invalid device [VUID-vkDestroySamplerYcbcrConversion-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2830,7 +2979,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevic VkDescriptorSetLayoutSupport *pSupport) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDescriptorSetLayoutSupport: Invalid device [VUID-vkGetDescriptorSetLayoutSupport-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2842,7 +2991,7 @@ vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTempla const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDescriptorUpdateTemplate: Invalid device [VUID-vkCreateDescriptorUpdateTemplate-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2854,7 +3003,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDev const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroyDescriptorUpdateTemplate: Invalid device [VUID-vkDestroyDescriptorUpdateTemplate-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2866,7 +3015,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDev const void *pData) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkUpdateDescriptorSetWithTemplate: Invalid device [VUID-vkUpdateDescriptorSetWithTemplate-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2880,7 +3029,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass2(VkDevice device VkRenderPass *pRenderPass) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateRenderPass2: Invalid device [VUID-vkCreateRenderPass2-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2892,7 +3041,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass2(VkCommandBuffer c const VkSubpassBeginInfo *pSubpassBeginInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdBeginRenderPass2: Invalid commandBuffer [VUID-vkCmdBeginRenderPass2-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2904,7 +3053,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass2(VkCommandBuffer comma const VkSubpassEndInfo *pSubpassEndInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdNextSubpass2: Invalid commandBuffer [VUID-vkCmdNextSubpass2-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2915,7 +3064,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2(VkCommandBuffer com const VkSubpassEndInfo *pSubpassEndInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdEndRenderPass2: Invalid commandBuffer [VUID-vkCmdEndRenderPass2-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2927,7 +3076,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCount(VkCommandBuffer uint32_t maxDrawCount, uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCmdDrawIndirectCount: Invalid commandBuffer [VUID-vkCmdDrawIndirectCount-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2940,9 +3089,9 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCount(VkCommand uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); if (NULL == disp) { - loader_log( - NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkCmdDrawIndexedIndirectCount: Invalid commandBuffer [VUID-vkCmdDrawIndexedIndirectCount-commandBuffer-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdDrawIndexedIndirectCount: Invalid commandBuffer " + "[VUID-vkCmdDrawIndexedIndirectCount-commandBuffer-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } disp->CmdDrawIndexedIndirectCount(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); @@ -2951,7 +3100,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCount(VkCommand LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t *pValue) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetSemaphoreCounterValue: Invalid device [VUID-vkGetSemaphoreCounterValue-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2962,7 +3111,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkWaitSemaphores(VkDevice device, c uint64_t timeout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkWaitSemaphores: Invalid device [VUID-vkWaitSemaphores-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2972,7 +3121,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkWaitSemaphores(VkDevice device, c LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkSignalSemaphore: Invalid device [VUID-vkSignalSemaphore-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2983,7 +3132,7 @@ LOADER_EXPORT VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddress(VkD const VkBufferDeviceAddressInfo *pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferDeviceAddress: Invalid device [VUID-vkGetBufferDeviceAddress-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2994,7 +3143,7 @@ LOADER_EXPORT VKAPI_ATTR uint64_t VKAPI_CALL vkGetBufferOpaqueCaptureAddress(VkD const VkBufferDeviceAddressInfo *pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetBufferOpaqueCaptureAddress: Invalid device [VUID-vkGetBufferOpaqueCaptureAddress-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -3005,9 +3154,9 @@ LOADER_EXPORT VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log( - NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetDeviceMemoryOpaqueCaptureAddress: Invalid device [VUID-vkGetDeviceMemoryOpaqueCaptureAddress-device-parameter]"); + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetDeviceMemoryOpaqueCaptureAddress: Invalid device " + "[VUID-vkGetDeviceMemoryOpaqueCaptureAddress-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } return disp->GetDeviceMemoryOpaqueCaptureAddress(device, pInfo); @@ -3017,7 +3166,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkResetQueryPool(VkDevice device, VkQue uint32_t queryCount) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkResetQueryPool: Invalid device [VUID-vkResetQueryPool-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } diff --git a/loader/unknown_ext_chain.c b/loader/unknown_ext_chain.c index 3ce7f3b1c974ca16b64280a32b8b2e69a6fcc2db..4bcf1d527d912f9c4074852bcd2319fb16e05394 100644 --- a/loader/unknown_ext_chain.c +++ b/loader/unknown_ext_chain.c @@ -48,7 +48,7 @@ struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; \ struct loader_instance *inst = (struct loader_instance *)icd_term->this_instance; \ if (NULL == icd_term->phys_dev_ext[num]) { \ - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "Extension %s not supported for this physical device", \ + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "Function %s not supported for this physical device", \ inst->phys_dev_ext_disp_functions[num]); \ } \ icd_term->phys_dev_ext[num](phys_dev_term->phys_dev); \ diff --git a/loader/unknown_ext_chain_gas_aarch64.S b/loader/unknown_ext_chain_gas_aarch64.S index 5a7d98a07b9cfb84fff74181d12f39377b43423e..a4078e4e339dad3752ffec9bbcdc4a955c13c844 100644 --- a/loader/unknown_ext_chain_gas_aarch64.S +++ b/loader/unknown_ext_chain_gas_aarch64.S @@ -27,6 +27,11 @@ .macro PhysDevExtTramp num .global vkPhysDevExtTramp\num +#if defined(__ELF__) + .hidden vkPhysDevExtTramp\num +#endif +.balign 4 + vkPhysDevExtTramp\num: ldr x9, [x0] // Load the loader_instance_dispatch_table* into x9 ldr x0, [x0, PHYS_DEV_OFFSET_PHYS_DEV_TRAMP] // Load the unwrapped VkPhysicalDevice into x0 @@ -37,6 +42,10 @@ vkPhysDevExtTramp\num: .macro PhysDevExtTermin num .global vkPhysDevExtTermin\num +#if defined(__ELF__) + .hidden vkPhysDevExtTermin\num +#endif +.balign 4 vkPhysDevExtTermin\num: ldr x9, [x0, ICD_TERM_OFFSET_PHYS_DEV_TERM] // Load the loader_icd_term* in x9 mov x11, (DISPATCH_OFFSET_ICD_TERM + (PTR_SIZE * \num)) // Put the offset into the dispatch table in x11 @@ -46,20 +55,22 @@ vkPhysDevExtTermin\num: br x10 // Jump to the next function in the chain terminError\num: mov x10, (FUNCTION_OFFSET_INSTANCE + (CHAR_PTR_SIZE * \num)) // Offset of the function name string in the instance - ldr x11, [x9, INSTANCE_OFFSET_ICD_TERM] // Load the instance pointer - mov x0, x11 // Vulkan instance pointer (first arg) - mov x1, VULKAN_LOADER_ERROR_BIT // The error logging bit (second arg) - mov x2, #0 // Zero (third arg) - adrp x9, termin_error_string - add x3, x9, #:lo12:termin_error_string // The error string (fourth arg) - ldr x4, [x11, x10] // The function name (fifth arg) - bl loader_log // Log the error message before we crash + ldr x11, [x9, INSTANCE_OFFSET_ICD_TERM] // Load the instance pointer + mov x0, x11 // Vulkan instance pointer (first arg) + mov x1, VULKAN_LOADER_ERROR_BIT // The error logging bit (second arg) + mov x2, #0 // Zero (third arg) + ldr x3, [x11, x10] // The function name (fourth arg) + bl loader_log_asm_function_not_supported // Log the error message before we crash mov x0, #0 - br x0 // Crash intentionally by jumping to address zero + br x0 // Crash intentionally by jumping to address zero .endm .macro DevExtTramp num .global vkdev_ext\num +#if defined(__ELF__) + .hidden vkdev_ext\num +#endif +.balign 4 vkdev_ext\num: ldr x9, [x0] // Load the loader_instance_dispatch_table* into x9 mov x10, (EXT_OFFSET_DEVICE_DISPATCH + (PTR_SIZE * \num)) // Offset of the desired function in the dispatch table @@ -76,7 +87,7 @@ vkdev_ext\num: .data termin_error_string: -.string "Extension %s not supported for this physical device" +.string "Function %s not supported for this physical device" .text diff --git a/loader/unknown_ext_chain_gas_x86.S b/loader/unknown_ext_chain_gas_x86.S index 496208ddf305eccb0735b3289f27fc930cb51c29..de5a920308275dabb08f7b4c381c3f07e1a4b8fa 100644 --- a/loader/unknown_ext_chain_gas_x86.S +++ b/loader/unknown_ext_chain_gas_x86.S @@ -1,7 +1,7 @@ # -# Copyright (c) 2017-2021 The Khronos Group Inc. -# Copyright (c) 2017-2021 Valve Corporation -# Copyright (c) 2017-2021 LunarG, Inc. +# Copyright (c) 2017-2023 The Khronos Group Inc. +# Copyright (c) 2017-2023 Valve Corporation +# Copyright (c) 2017-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,9 @@ # VkPhysicalDevice or a dispatchable object it can unwrap the object, possibly overwriting the wrapped physical device, and then # jump to the next function in the call chain -#ifdef HAVE_CET_H +# The .hidden directive is only supported in ELF executables so in APPLE builds, the directive is removed + +#if defined(HAVE_CET_H) #include #else #define _CET_ENDBR @@ -37,6 +39,9 @@ .macro PhysDevExtTramp num .global vkPhysDevExtTramp\num +#if defined(__ELF__) +.hidden vkPhysDevExtTramp\num +#endif vkPhysDevExtTramp\num: _CET_ENDBR mov rax, [rdi] @@ -46,6 +51,9 @@ vkPhysDevExtTramp\num: .macro PhysDevExtTermin num .global vkPhysDevExtTermin\num +#if defined(__ELF__) +.hidden vkPhysDevExtTermin\num +#endif vkPhysDevExtTermin\num: _CET_ENDBR mov rax, [rdi + ICD_TERM_OFFSET_PHYS_DEV_TERM] # Store the loader_icd_term* in rax @@ -58,7 +66,7 @@ terminError\num: mov rdi, [rax + INSTANCE_OFFSET_ICD_TERM] # Load the loader_instance into rdi (first arg) lea rsi, [VULKAN_LOADER_ERROR_BIT] # Write the error logging bit to rsi (second arg) xor rdx, rdx # Set rdx to zero (third arg) - lea rcx, [rip + termin_error_string] # Load the error string into rcx (fourth arg) + lea rcx, [rip + termin_error_string] # Load the error string into rcx (fourth arg) mov r8, [rdi + (FUNCTION_OFFSET_INSTANCE + (CHAR_PTR_SIZE * \num))] # Load the func name into r8 (fifth arg) call loader_log # Log the error message before we crash add rsp, 56 # Clean up the stack frame @@ -68,6 +76,9 @@ terminError\num: .macro DevExtTramp num .global vkdev_ext\num +#if defined(__ELF__) +.hidden vkdev_ext\num +#endif vkdev_ext\num: _CET_ENDBR mov rax, [rdi] # Dereference the handle to get the dispatch table @@ -78,6 +89,9 @@ vkdev_ext\num: .macro PhysDevExtTramp num .global vkPhysDevExtTramp\num +#if defined(__ELF__) +.hidden vkPhysDevExtTramp\num +#endif vkPhysDevExtTramp\num: _CET_ENDBR mov eax, [esp + 4] # Load the wrapped VkPhysicalDevice into eax @@ -89,6 +103,9 @@ vkPhysDevExtTramp\num: .macro PhysDevExtTermin num .global vkPhysDevExtTermin\num +#if defined(__ELF__) +.hidden vkPhysDevExtTermin\num +#endif vkPhysDevExtTermin\num: _CET_ENDBR mov ecx, [esp + 4] # Move the wrapped VkPhysicalDevice into ecx @@ -100,12 +117,11 @@ vkPhysDevExtTermin\num: jmp [eax + (DISPATCH_OFFSET_ICD_TERM + (PTR_SIZE * \num))] # Jump to the next function in the chain terminError\num: mov eax, dword ptr [eax + INSTANCE_OFFSET_ICD_TERM] # Load the loader_instance into eax - push dword ptr [eax + (FUNCTION_OFFSET_INSTANCE + (CHAR_PTR_SIZE * \num))] # Push the func name (fifth arg) - push offset termin_error_string@GOT # Push the error string (fourth arg) + push dword ptr [eax + (FUNCTION_OFFSET_INSTANCE + (CHAR_PTR_SIZE * \num))] # Push the func name (fourth arg) push 0 # Push zero (third arg) push VULKAN_LOADER_ERROR_BIT # Push the error logging bit (second arg) push eax # Push the loader_instance (first arg) - call loader_log # Log the error message before we crash + call loader_log_asm_function_not_supported # Log the error message before we crash add esp, 20 # Clean up the args mov eax, 0 jmp eax # Crash intentionally by jumping to address zero @@ -113,6 +129,9 @@ terminError\num: .macro DevExtTramp num .global vkdev_ext\num +#if defined(__ELF__) +.hidden vkdev_ext\num +#endif vkdev_ext\num: _CET_ENDBR mov eax, dword ptr [esp + 4] # Dereference the handle to get the dispatch table @@ -129,7 +148,7 @@ vkdev_ext\num: .data termin_error_string: -.string "Extension %s not supported for this physical device" +.string "Function %s not supported for this physical device" .text diff --git a/loader/unknown_ext_chain_masm.asm b/loader/unknown_ext_chain_masm.asm index e33858aeb9c77fed4af614d2667a8239674f87df..46d13de4737e45882ff1a3e5461016f29337e03d 100644 --- a/loader/unknown_ext_chain_masm.asm +++ b/loader/unknown_ext_chain_masm.asm @@ -119,7 +119,7 @@ endm ENDIF .const - termin_error_string db 'Extension %s not supported for this physical device', 0 + termin_error_string db 'Function %s not supported for this physical device', 0 .code diff --git a/loader/unknown_function_handling.c b/loader/unknown_function_handling.c index 6eb6918b060dd796db05b20ed43692aebb3476fd..d6ebe7f87a8b2176cfafacd5ec06bdd27598b322 100644 --- a/loader/unknown_function_handling.c +++ b/loader/unknown_function_handling.c @@ -85,17 +85,16 @@ bool loader_check_icds_for_dev_ext_address(struct loader_instance *inst, const c // Look in the layers list of device extensions, which contain names of entry points. If funcName is present, return true // If not, call down the first layer's vkGetInstanceProcAddr to determine if any layers support the function bool loader_check_layer_list_for_dev_ext_address(struct loader_instance *inst, const char *funcName) { - struct loader_layer_properties *layer_prop_list = inst->expanded_activated_layer_list.list; - // Iterate over the layers. for (uint32_t layer = 0; layer < inst->expanded_activated_layer_list.count; ++layer) { // Iterate over the extensions. - const struct loader_device_extension_list *const extensions = &(layer_prop_list[layer].device_extension_list); + const struct loader_device_extension_list *const extensions = + &(inst->expanded_activated_layer_list.list[layer]->device_extension_list); for (uint32_t extension = 0; extension < extensions->count; ++extension) { // Iterate over the entry points. const struct loader_dev_ext_props *const property = &(extensions->list[extension]); - for (uint32_t entry = 0; entry < property->entrypoint_count; ++entry) { - if (strcmp(property->entrypoints[entry], funcName) == 0) { + for (uint32_t entry = 0; entry < property->entrypoints.count; ++entry) { + if (strcmp(property->entrypoints.list[entry], funcName) == 0) { return true; } } @@ -104,7 +103,7 @@ bool loader_check_layer_list_for_dev_ext_address(struct loader_instance *inst, c // If the function pointer doesn't appear in the layer manifest for intercepted device functions, look down the // vkGetInstanceProcAddr chain if (inst->expanded_activated_layer_list.count > 0) { - const struct loader_layer_functions *const functions = &(layer_prop_list[0].functions); + const struct loader_layer_functions *const functions = &(inst->expanded_activated_layer_list.list[0]->functions); if (NULL != functions->get_instance_proc_addr) { return NULL != functions->get_instance_proc_addr((VkInstance)inst->instance, funcName); } @@ -165,7 +164,7 @@ void *loader_dev_ext_gpa_impl(struct loader_instance *inst, const char *funcName // failed to allocate memory, return NULL return NULL; } - strncpy(inst->dev_ext_disp_functions[inst->dev_ext_disp_function_count], funcName, funcName_len); + loader_strncpy(inst->dev_ext_disp_functions[inst->dev_ext_disp_function_count], funcName_len, funcName, funcName_len); // init any dev dispatch table entries as needed loader_init_dispatch_dev_ext_entry(inst, NULL, inst->dev_ext_disp_function_count, funcName); void *out_function = loader_get_dev_ext_trampoline(inst->dev_ext_disp_function_count); @@ -188,6 +187,7 @@ bool loader_check_icds_for_phys_dev_ext_address(struct loader_instance *inst, co icd_term = inst->icd_terms; while (NULL != icd_term) { if (icd_term->scanned_icd->interface_version >= MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION && + icd_term->scanned_icd->GetPhysicalDeviceProcAddr && icd_term->scanned_icd->GetPhysicalDeviceProcAddr(icd_term->instance, funcName)) // this icd supports funcName return true; @@ -198,13 +198,13 @@ bool loader_check_icds_for_phys_dev_ext_address(struct loader_instance *inst, co } bool loader_check_layer_list_for_phys_dev_ext_address(struct loader_instance *inst, const char *funcName) { - struct loader_layer_properties *layer_prop_list = inst->expanded_activated_layer_list.list; for (uint32_t layer = 0; layer < inst->expanded_activated_layer_list.count; layer++) { + struct loader_layer_properties *layer_prop_list = inst->expanded_activated_layer_list.list[layer]; // Find the first layer in the call chain which supports vk_layerGetPhysicalDeviceProcAddr // and call that, returning whether it found a valid pointer for this function name. // We return if the topmost layer supports GPDPA since the layer should call down the chain for us. - if (layer_prop_list[layer].interface_version > 1) { - const struct loader_layer_functions *const functions = &(layer_prop_list[layer].functions); + if (layer_prop_list->interface_version > 1) { + const struct loader_layer_functions *const functions = &(layer_prop_list->functions); if (NULL != functions->get_physical_device_proc_addr) { return NULL != functions->get_physical_device_proc_addr((VkInstance)inst->instance, funcName); } @@ -276,12 +276,12 @@ void *loader_phys_dev_ext_gpa_impl(struct loader_instance *inst, const char *fun // failed to allocate memory, return NULL return NULL; } - strncpy(inst->phys_dev_ext_disp_functions[inst->phys_dev_ext_disp_function_count], funcName, funcName_len); + loader_strncpy(inst->phys_dev_ext_disp_functions[inst->phys_dev_ext_disp_function_count], funcName_len, funcName, + funcName_len); new_function_index = inst->phys_dev_ext_disp_function_count; // increment the count so that the subsequent logic includes the newly added entry point when searching for functions inst->phys_dev_ext_disp_function_count++; - has_found = true; } // Setup the ICD function pointers @@ -310,7 +310,7 @@ void *loader_phys_dev_ext_gpa_impl(struct loader_instance *inst, const char *fun // point. Only set the instance dispatch table to it if it isn't NULL. if (is_tramp) { for (uint32_t i = 0; i < inst->expanded_activated_layer_list.count; i++) { - struct loader_layer_properties *layer_prop = &inst->expanded_activated_layer_list.list[i]; + struct loader_layer_properties *layer_prop = inst->expanded_activated_layer_list.list[i]; if (layer_prop->interface_version > 1 && NULL != layer_prop->functions.get_physical_device_proc_addr) { void *layer_ret_function = (PFN_PhysDevExt)layer_prop->functions.get_physical_device_proc_addr(inst->instance, funcName); diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index 7e800851d15fbd1932ed33907bb8267b7531361b..1f804744d514ec6c2270e047c936bf8152519cd9 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. @@ -29,21 +31,26 @@ #include #endif -#if defined(_WIN32) -// WinSock2.h must be included *BEFORE* windows.h -#include -#endif // _WIN32 - #include -#include +#include #include #include +#include +#include #if defined(__Fuchsia__) #include "dlopen_fuchsia.h" #endif // defined(__Fuchsia__) -#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__) +// Set of platforms with a common set of functionality which is queried throughout the program +#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNX__) || defined(__FreeBSD__) || \ + defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) +#define COMMON_UNIX_PLATFORMS 1 +#else +#define COMMON_UNIX_PLATFORMS 0 +#endif + +#if COMMON_UNIX_PLATFORMS #include // Note: The following file is for dynamic loading: #include @@ -51,14 +58,13 @@ #include #include -#elif defined(_WIN32) // defined(__linux__) -/* Windows-specific common code: */ +#elif defined(_WIN32) // WinBase.h defines CreateSemaphore and synchapi.h defines CreateEvent // undefine them to avoid conflicts with VkLayerDispatchTable struct members. -#ifdef CreateSemaphore +#if defined(CreateSemaphore) #undef CreateSemaphore #endif -#ifdef CreateEvent +#if defined(CreateEvent) #undef CreateEvent #endif #include @@ -69,7 +75,13 @@ #include "stack_allocation.h" -#if defined(__GNUC__) && __GNUC__ >= 4 +#if defined(APPLE_STATIC_LOADER) && !defined(__APPLE__) +#error "APPLE_STATIC_LOADER can only be defined on Apple platforms!" +#endif + +#if defined(APPLE_STATIC_LOADER) +#define LOADER_EXPORT +#elif defined(__GNUC__) && __GNUC__ >= 4 #define LOADER_EXPORT __attribute__((visibility("default"))) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) #define LOADER_EXPORT __attribute__((visibility("default"))) @@ -81,24 +93,39 @@ // This is defined in vk_layer.h, but if there's problems we need to create the define // here. -#ifndef MAX_NUM_UNKNOWN_EXTS +#if !defined(MAX_NUM_UNKNOWN_EXTS) #define MAX_NUM_UNKNOWN_EXTS 250 #endif // Environment Variable information -#define VK_ICD_FILENAMES_ENV_VAR "VK_ICD_FILENAMES" // Deprecated +#define VK_ICD_FILENAMES_ENV_VAR "VK_ICD_FILENAMES" // Deprecated in v1.3.207 loader #define VK_DRIVER_FILES_ENV_VAR "VK_DRIVER_FILES" -#define VK_ADDITIONAL_DRIVER_FILES_ENV_VAR "VK_ADD_DRIVER_FILES" #define VK_LAYER_PATH_ENV_VAR "VK_LAYER_PATH" +// Support added in v1.3.207 loader +#define VK_ADDITIONAL_DRIVER_FILES_ENV_VAR "VK_ADD_DRIVER_FILES" #define VK_ADDITIONAL_LAYER_PATH_ENV_VAR "VK_ADD_LAYER_PATH" +// Support added in v1.3.234 loader +#define VK_LAYERS_ENABLE_ENV_VAR "VK_LOADER_LAYERS_ENABLE" +#define VK_LAYERS_DISABLE_ENV_VAR "VK_LOADER_LAYERS_DISABLE" +#define VK_LAYERS_ALLOW_ENV_VAR "VK_LOADER_LAYERS_ALLOW" +#define VK_DRIVERS_SELECT_ENV_VAR "VK_LOADER_DRIVERS_SELECT" +#define VK_DRIVERS_DISABLE_ENV_VAR "VK_LOADER_DRIVERS_DISABLE" +#define VK_LOADER_DISABLE_ALL_LAYERS_VAR_1 "~all~" +#define VK_LOADER_DISABLE_ALL_LAYERS_VAR_2 "*" +#define VK_LOADER_DISABLE_ALL_LAYERS_VAR_3 "**" +#define VK_LOADER_DISABLE_IMPLICIT_LAYERS_VAR "~implicit~" +#define VK_LOADER_DISABLE_EXPLICIT_LAYERS_VAR "~explicit~" // Override layer information #define VK_OVERRIDE_LAYER_NAME "VK_LAYER_LUNARG_override" +// Loader Settings filename +#define VK_LOADER_SETTINGS_FILENAME "vk_loader_settings.json" + #define LAYERS_PATH_ENV "VK_LAYER_PATH" #define ENABLED_LAYERS_ENV "VK_INSTANCE_LAYERS" -#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if COMMON_UNIX_PLATFORMS /* Linux-specific common code: */ // VK Library Filenames, Paths, etc.: @@ -119,11 +146,11 @@ #define VK_ILAYERS_INFO_RELATIVE_DIR VULKAN_DIR VULKAN_ILAYERCONF_DIR #define VK_DRIVERS_INFO_REGISTRY_LOC "" -#define VK_SETTINGS_INFO_REGISTRY_LOC "" #define VK_ELAYERS_INFO_REGISTRY_LOC "" #define VK_ILAYERS_INFO_REGISTRY_LOC "" +#define VK_SETTINGS_INFO_REGISTRY_LOC "" -#if defined(__QNXNTO__) +#if defined(__QNX__) #define SYSCONFDIR "/etc" #endif @@ -144,8 +171,8 @@ typedef pthread_mutex_t loader_platform_thread_mutex; typedef pthread_cond_t loader_platform_thread_cond; -#elif defined(_WIN32) // defined(__linux__) - +#elif defined(_WIN32) +/* Windows-specific common code: */ // VK Library Filenames, Paths, etc.: #define PATH_SEPARATOR ';' #define DIRECTORY_SYMBOL '\\' @@ -159,15 +186,13 @@ typedef pthread_cond_t loader_platform_thread_cond; #define VK_ELAYERS_INFO_RELATIVE_DIR "" #define VK_ILAYERS_INFO_RELATIVE_DIR "" -#ifdef _WIN64 -#define HKR_VK_DRIVER_NAME API_NAME "DriverName" -#else -#define HKR_VK_DRIVER_NAME API_NAME "DriverNameWow" -#endif -#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\Drivers" -#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\Settings" -#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\ExplicitLayers" -#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\ImplicitLayers" +#define VK_VARIANT_REG_STR "" +#define VK_VARIANT_REG_STR_W L"" + +#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\Drivers" +#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ExplicitLayers" +#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ImplicitLayers" +#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\LoaderSettings" #define PRINTF_SIZE_T_SPECIFIER "%Iu" @@ -185,16 +210,19 @@ typedef CRITICAL_SECTION loader_platform_thread_mutex; typedef CONDITION_VARIABLE loader_platform_thread_cond; -#else // defined(_WIN32) +#else -#error The "vk_loader_platform.h" file must be modified for this OS. +#warning The "vk_loader_platform.h" file must be modified for this OS. // NOTE: In order to support another OS, an #elif needs to be added (above the // "#else // defined(_WIN32)") for that OS, and OS-specific versions of the // contents of this file must be created, or extend one of the existing OS specific // sections with the necessary changes. -#endif // defined(_WIN32) +#endif + +// controls whether loader_platform_close_library() closes the libraries or not - controlled by an environment variables +extern bool loader_disable_dynamic_library_unloading; // Returns true if the DIRECTORY_SYMBOL is contained within path static inline bool loader_platform_is_path(const char *path) { return strchr(path, DIRECTORY_SYMBOL) != NULL; } @@ -203,7 +231,7 @@ static inline bool loader_platform_is_path(const char *path) { return strchr(pat // resources allocated by anything allocated by once init. This isn't a problem for static libraries, but it is for dynamic // ones. When building a DLL, we use DllMain() instead to allow properly cleaning up resources. -#if defined(__APPLE__) && defined(BUILD_STATIC_LOADER) +#if defined(APPLE_STATIC_LOADER) static inline void loader_platform_thread_once_fn(pthread_once_t *ctl, void (*func)(void)) { assert(func != NULL); assert(ctl != NULL); @@ -219,7 +247,7 @@ static inline void loader_platform_thread_once_fn(pthread_once_t *ctl, void (*fu #endif -#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if COMMON_UNIX_PLATFORMS // File IO static inline bool loader_platform_file_exists(const char *path) { @@ -242,7 +270,7 @@ static inline char *loader_platform_dirname(char *path) { return dirname(path); // loader_platform_executable_path finds application path + name. // Path cannot be longer than 1024, returns NULL if it is greater than that. -#if defined(__linux__) +#if defined(__linux__) || defined(__GNU__) static inline char *loader_platform_executable_path(char *buffer, size_t size) { ssize_t count = readlink("/proc/self/exe", buffer, size); if (count == -1) return NULL; @@ -250,15 +278,32 @@ static inline char *loader_platform_executable_path(char *buffer, size_t size) { buffer[count] = '\0'; return buffer; } -#elif defined(__APPLE__) // defined(__linux__) +#elif defined(__APPLE__) +#include +// TARGET_OS_IPHONE isn't just iOS it's also iOS/tvOS/watchOS. See TargetConditionals.h documentation. +#if TARGET_OS_IPHONE +static inline char *loader_platform_executable_path(char *buffer, size_t size) { + (void)size; + buffer[0] = '\0'; + return buffer; +} +#endif +#if TARGET_OS_OSX #include static inline char *loader_platform_executable_path(char *buffer, size_t size) { + // proc_pidpath takes a uint32_t for the buffer size + if (size > UINT32_MAX) { + return NULL; + } pid_t pid = getpid(); - int ret = proc_pidpath(pid, buffer, size); - if (ret <= 0) return NULL; + int ret = proc_pidpath(pid, buffer, (uint32_t)size); + if (ret <= 0) { + return NULL; + } buffer[ret] = '\0'; return buffer; } +#endif #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) #include static inline char *loader_platform_executable_path(char *buffer, size_t size) { @@ -282,7 +327,7 @@ static inline char *loader_platform_executable_path(char *buffer, size_t size) { } #elif defined(__Fuchsia__) || defined(__OpenBSD__) static inline char *loader_platform_executable_path(char *buffer, size_t size) { return NULL; } -#elif defined(__QNXNTO__) +#elif defined(__QNX__) #define SYSCONFDIR "/etc" @@ -306,15 +351,15 @@ static inline char *loader_platform_executable_path(char *buffer, size_t size) { return buffer; } -#endif // defined (__QNXNTO__) +#endif // defined (__QNX__) -// Compatability with compilers that don't support __has_feature -#ifndef __has_feature +// Compatibility with compilers that don't support __has_feature +#if !defined(__has_feature) #define __has_feature(x) 0 #endif #if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) -#define LOADER_ADDRESS_SANITIZER // TODO: Add proper build flag for ASAN support +#define LOADER_ADDRESS_SANITIZER_ACTIVE // TODO: Add proper build flag for ASAN support #endif // When loading the library, we use RTLD_LAZY so that not all symbols have to be @@ -337,23 +382,29 @@ static inline loader_platform_dl_handle loader_platform_open_library(const char #endif static inline const char *loader_platform_open_library_error(const char *libPath) { -#ifdef __Fuchsia__ + (void)libPath; +#if defined(__Fuchsia__) return dlerror_fuchsia(); #else return dlerror(); #endif } static inline void loader_platform_close_library(loader_platform_dl_handle library) { -#if !defined (__OHOS__) - dlclose(library); -#endif + if (!loader_disable_dynamic_library_unloading) { + dlclose(library); + } else { + (void)library; + } } static inline void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) { assert(library); assert(name); return dlsym(library, name); } -static inline const char *loader_platform_get_proc_address_error(const char *name) { return dlerror(); } +static inline const char *loader_platform_get_proc_address_error(const char *name) { + (void)name; + return dlerror(); +} // Thread mutex: static inline void loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_init(pMutex, NULL); } @@ -361,19 +412,31 @@ static inline void loader_platform_thread_lock_mutex(loader_platform_thread_mute static inline void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_unlock(pMutex); } static inline void loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_destroy(pMutex); } -#elif defined(_WIN32) // defined(__linux__) +static inline void *thread_safe_strtok(char *str, const char *delim, char **saveptr) { return strtok_r(str, delim, saveptr); } + +static inline FILE *loader_fopen(const char *fileName, const char *mode) { return fopen(fileName, mode); } +static inline char *loader_strncat(char *dest, size_t dest_sz, const char *src, size_t count) { + (void)dest_sz; + return strncat(dest, src, count); +} +static inline char *loader_strncpy(char *dest, size_t dest_sz, const char *src, size_t count) { + (void)dest_sz; + return strncpy(dest, src, count); +} + +#elif defined(_WIN32) // Get the key for the plug n play driver registry // The string returned by this function should NOT be freed static inline const char *LoaderPnpDriverRegistry() { BOOL is_wow; IsWow64Process(GetCurrentProcess(), &is_wow); - return is_wow ? "VulkanDriverNameWow" : "VulkanDriverName"; + return is_wow ? "Vulkan" VK_VARIANT_REG_STR "DriverNameWow" : "Vulkan" VK_VARIANT_REG_STR "DriverName"; } static inline const wchar_t *LoaderPnpDriverRegistryWide() { BOOL is_wow; IsWow64Process(GetCurrentProcess(), &is_wow); - return is_wow ? L"VulkanDriverNameWow" : L"VulkanDriverName"; + return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"DriverNameWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"DriverName"; } // Get the key for the plug 'n play explicit layer registry @@ -381,12 +444,12 @@ static inline const wchar_t *LoaderPnpDriverRegistryWide() { static inline const char *LoaderPnpELayerRegistry() { BOOL is_wow; IsWow64Process(GetCurrentProcess(), &is_wow); - return is_wow ? "VulkanExplicitLayersWow" : "VulkanExplicitLayers"; + return is_wow ? "Vulkan" VK_VARIANT_REG_STR "ExplicitLayersWow" : "Vulkan" VK_VARIANT_REG_STR "ExplicitLayers"; } static inline const wchar_t *LoaderPnpELayerRegistryWide() { BOOL is_wow; IsWow64Process(GetCurrentProcess(), &is_wow); - return is_wow ? L"VulkanExplicitLayersWow" : L"VulkanExplicitLayers"; + return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"ExplicitLayersWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"ExplicitLayers"; } // Get the key for the plug 'n play implicit layer registry @@ -394,16 +457,16 @@ static inline const wchar_t *LoaderPnpELayerRegistryWide() { static inline const char *LoaderPnpILayerRegistry() { BOOL is_wow; IsWow64Process(GetCurrentProcess(), &is_wow); - return is_wow ? "VulkanImplicitLayersWow" : "VulkanImplicitLayers"; + return is_wow ? "Vulkan" VK_VARIANT_REG_STR "ImplicitLayersWow" : "Vulkan" VK_VARIANT_REG_STR "ImplicitLayers"; } static inline const wchar_t *LoaderPnpILayerRegistryWide() { BOOL is_wow; IsWow64Process(GetCurrentProcess(), &is_wow); - return is_wow ? L"VulkanImplicitLayersWow" : L"VulkanImplicitLayers"; + return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"ImplicitLayersWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"ImplicitLayers"; } // File IO -static bool loader_platform_file_exists(const char *path) { +static inline bool loader_platform_file_exists(const char *path) { int path_utf16_size = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0); if (path_utf16_size <= 0) { return false; @@ -420,7 +483,7 @@ static bool loader_platform_file_exists(const char *path) { // Returns true if the given string appears to be a relative or absolute // path, as opposed to a bare filename. -static bool loader_platform_is_path_absolute(const char *path) { +static inline bool loader_platform_is_path_absolute(const char *path) { if (!path || !*path) { return false; } @@ -469,7 +532,7 @@ static inline char *loader_platform_executable_path(char *buffer, size_t size) { } // Dynamic Loading: -static loader_platform_dl_handle loader_platform_open_library(const char *lib_path) { +static inline loader_platform_dl_handle loader_platform_open_library(const char *lib_path) { int lib_path_utf16_size = MultiByteToWideChar(CP_UTF8, 0, lib_path, -1, NULL, 0); if (lib_path_utf16_size <= 0) { return NULL; @@ -486,32 +549,61 @@ static loader_platform_dl_handle loader_platform_open_library(const char *lib_pa } return lib_handle; } -static const char *loader_platform_open_library_error(const char *libPath) { +static inline const char *loader_platform_open_library_error(const char *libPath) { static char errorMsg[512]; (void)snprintf(errorMsg, 511, "Failed to open dynamic library \"%s\" with error %lu", libPath, GetLastError()); return errorMsg; } -static void loader_platform_close_library(loader_platform_dl_handle library) { FreeLibrary(library); } -static void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) { +static inline void loader_platform_close_library(loader_platform_dl_handle library) { + if (!loader_disable_dynamic_library_unloading) { + FreeLibrary(library); + } else { + (void)library; + } +} +static inline void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) { assert(library); assert(name); return (void *)GetProcAddress(library, name); } -static const char *loader_platform_get_proc_address_error(const char *name) { +static inline const char *loader_platform_get_proc_address_error(const char *name) { static char errorMsg[120]; (void)snprintf(errorMsg, 119, "Failed to find function \"%s\" in dynamic library", name); return errorMsg; } // Thread mutex: -static void loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { InitializeCriticalSection(pMutex); } -static void loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { EnterCriticalSection(pMutex); } -static void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { LeaveCriticalSection(pMutex); } -static void loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { DeleteCriticalSection(pMutex); } +static inline void loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { InitializeCriticalSection(pMutex); } +static inline void loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { EnterCriticalSection(pMutex); } +static inline void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { LeaveCriticalSection(pMutex); } +static inline void loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { DeleteCriticalSection(pMutex); } + +static inline void *thread_safe_strtok(char *str, const char *delimiters, char **context) { + return strtok_s(str, delimiters, context); +} + +static inline FILE *loader_fopen(const char *fileName, const char *mode) { + FILE *file = NULL; + errno_t err = fopen_s(&file, fileName, mode); + if (err != 0) return NULL; + return file; +} + +static inline char *loader_strncat(char *dest, size_t dest_sz, const char *src, size_t count) { + errno_t err = strncat_s(dest, dest_sz, src, count); + if (err != 0) return NULL; + return dest; +} + +static inline char *loader_strncpy(char *dest, size_t dest_sz, const char *src, size_t count) { + errno_t err = strncpy_s(dest, dest_sz, src, count); + if (err != 0) return NULL; + return dest; +} #else // defined(_WIN32) -#error The "vk_loader_platform.h" file must be modified for this OS. +#warning The "vk_loader_platform.h" file must be modified for this OS. // NOTE: In order to support another OS, an #elif needs to be added (above the // "#else // defined(_WIN32)") for that OS, and OS-specific versions of the diff --git a/loader/vulkan.pc.in b/loader/vulkan.pc.in index 1538155774e2e72c5e002f75494b3a87a35f8310..6a285f267c85f290af1184e40b2b43ea4a90eb61 100644 --- a/loader/vulkan.pc.in +++ b/loader/vulkan.pc.in @@ -1,12 +1,10 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR_PC@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR_PC@ -Name: @CMAKE_PROJECT_NAME@ +Name: Vulkan-Loader Description: Vulkan Loader -Version: @VK_API_VERSION@ +Version: @VULKAN_LOADER_VERSION@ Libs: -L${libdir} -lvulkan@VULKAN_LIB_SUFFIX@ -Libs.private: @PRIVATE_LIBS@ Cflags: -I${includedir} - diff --git a/loader/wsi.c b/loader/wsi.c index fceb0397a48365c0e6d6ae0ef92e212837e679df..56f9e6e1f1866825c298837a10559275adcde651 100644 --- a/loader/wsi.c +++ b/loader/wsi.c @@ -44,67 +44,67 @@ void wsi_create_instance(struct loader_instance *loader_inst, const VkInstanceCr loader_inst->wsi_surface_enabled = true; continue; } -#ifdef VK_USE_PLATFORM_WIN32_KHR +#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; continue; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_wayland_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_xcb_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_xlib_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#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; continue; } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_android_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_OHOS_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_ohos_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_MVK_MACOS_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_macos_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_MVK_IOS_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_ios_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_ggp_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_imagepipe_surface_enabled = true; continue; @@ -126,7 +126,7 @@ void wsi_create_instance(struct loader_instance *loader_inst, const VkInstanceCr continue; } #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NN_VI_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_vi_surface_enabled = true; continue; @@ -153,19 +153,19 @@ void wsi_create_instance(struct loader_instance *loader_inst, const VkInstanceCr // advertises support for a given Linux surface extension but the loader was not // built to support the extension. bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop) { -#ifndef VK_USE_PLATFORM_WAYLAND_KHR +#if !defined(VK_USE_PLATFORM_WAYLAND_KHR) if (!strcmp(ext_prop->extensionName, "VK_KHR_wayland_surface")) return true; #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifndef VK_USE_PLATFORM_XCB_KHR +#if !defined(VK_USE_PLATFORM_XCB_KHR) if (!strcmp(ext_prop->extensionName, "VK_KHR_xcb_surface")) return true; #endif // VK_USE_PLATFORM_XCB_KHR -#ifndef VK_USE_PLATFORM_XLIB_KHR +#if !defined(VK_USE_PLATFORM_XLIB_KHR) if (!strcmp(ext_prop->extensionName, "VK_KHR_xlib_surface")) return true; #endif // VK_USE_PLATFORM_XLIB_KHR -#ifndef VK_USE_PLATFORM_DIRECTFB_EXT +#if !defined(VK_USE_PLATFORM_DIRECTFB_EXT) if (!strcmp(ext_prop->extensionName, "VK_EXT_directfb_surface")) return true; #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifndef VK_USE_PLATFORM_SCREEN_QNX +#if !defined(VK_USE_PLATFORM_SCREEN_QNX) if (!strcmp(ext_prop->extensionName, "VK_QNX_screen_surface")) return true; #endif // VK_USE_PLATFORM_SCREEN_QNX @@ -179,7 +179,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance const VkAllocationCallbacks *pAllocator) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroySurfaceKHR: Invalid instance [VUID-vkDestroySurfaceKHR-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -225,7 +225,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKH const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSurfaceSupportKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfaceSupportKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -245,13 +245,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkP struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceSupportKHR not executed!\n"); + "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceSupportKHR not executed!"); return VK_SUCCESS; } if (NULL == pSupported) { - loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "NULL pointer passed into vkGetPhysicalDeviceSurfaceSupportKHR for pSupported!\n"); + loader_log(loader_inst, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "NULL pointer passed into vkGetPhysicalDeviceSurfaceSupportKHR for pSupported!"); abort(); } *pSupported = false; @@ -260,7 +260,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkP // set pSupported to false as this driver doesn't support WSI functionality *pSupported = false; loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceSurfaceSupportKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceSurfaceSupportKHR!"); return VK_SUCCESS; } @@ -280,7 +280,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilit const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfaceCapabilitiesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -300,13 +300,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKH struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed!\n"); + "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed!"); return VK_SUCCESS; } if (NULL == pSurfaceCapabilities) { - loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "NULL pointer passed into vkGetPhysicalDeviceSurfaceCapabilitiesKHR for pSurfaceCapabilities!\n"); + loader_log(loader_inst, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "NULL pointer passed into vkGetPhysicalDeviceSurfaceCapabilitiesKHR for pSurfaceCapabilities!"); abort(); } @@ -314,7 +314,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKH // Zero out the capabilities as this driver doesn't support WSI functionality memset(pSurfaceCapabilities, 0, sizeof(VkSurfaceCapabilitiesKHR)); loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceSurfaceCapabilitiesKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceSurfaceCapabilitiesKHR!"); return VK_SUCCESS; } @@ -336,7 +336,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKH const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSurfaceFormatsKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfaceFormatsKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -356,13 +356,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkP struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceFormatsKHR not executed!\n"); + "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceFormatsKHR not executed!"); return VK_SUCCESS; } if (NULL == pSurfaceFormatCount) { - loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "NULL pointer passed into vkGetPhysicalDeviceSurfaceFormatsKHR for pSurfaceFormatCount!\n"); + loader_log(loader_inst, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "NULL pointer passed into vkGetPhysicalDeviceSurfaceFormatsKHR for pSurfaceFormatCount!"); abort(); } @@ -370,7 +370,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkP // Zero out the format count as this driver doesn't support WSI functionality *pSurfaceFormatCount = 0; loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceSurfaceCapabilitiesKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceSurfaceCapabilitiesKHR!"); return VK_SUCCESS; } @@ -394,7 +394,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentMo const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSurfacePresentModesKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfacePresentModesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -414,13 +414,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKH struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfacePresentModesKHR not executed!\n"); + "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfacePresentModesKHR not executed!"); return VK_SUCCESS; } if (NULL == pPresentModeCount) { - loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "NULL pointer passed into vkGetPhysicalDeviceSurfacePresentModesKHR for pPresentModeCount!\n"); + loader_log(loader_inst, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0, + "NULL pointer passed into vkGetPhysicalDeviceSurfacePresentModesKHR for pPresentModeCount!"); abort(); } @@ -428,7 +428,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKH // Zero out the present mode count as this driver doesn't support WSI functionality *pPresentModeCount = 0; loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceSurfacePresentModesKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceSurfacePresentModesKHR!"); return VK_SUCCESS; } @@ -451,10 +451,18 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice devic VkSwapchainKHR *pSwapchain) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateSwapchainKHR: Invalid device [VUID-vkCreateSwapchainKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } + if (NULL == disp->CreateSwapchainKHR) { + struct loader_device *dev = *((struct loader_device **)device); + loader_log(NULL != dev ? dev->phys_dev_term->this_icd_term->this_instance : NULL, + VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " + "extension enabled?"); + abort(); + } return disp->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } @@ -463,25 +471,42 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSwapchainKHR(VkDevice device, co 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 != icd_term->dispatch.CreateSwapchainKHR) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfo->surface; - if (NULL != icd_surface->real_icd_surfaces) { - if ((VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { - // We found the ICD, and there is an ICD KHR surface - // associated with it, so copy the CreateInfo struct - // and point it at the ICD's surface. - VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR)); - if (NULL == pCreateCopy) { - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - memcpy(pCreateCopy, pCreateInfo, sizeof(VkSwapchainCreateInfoKHR)); - pCreateCopy->surface = icd_surface->real_icd_surfaces[icd_index]; - return icd_term->dispatch.CreateSwapchainKHR(device, pCreateCopy, pAllocator, pSwapchain); + if (NULL == icd_term || NULL == dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateSwapchainKHR Terminator: device handle. This is likely the result of a " + "layer wrapping device handles and failing to unwrap them in all functions. " + "[VUID-vkCreateSwapchainKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (NULL == pCreateInfo) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateSwapchainKHR: Invalid pCreateInfo pointer [VUID-vkCreateSwapchainKHR-pCreateInfo-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + // Need to gracefully handle the function pointer not being found. + if (NULL == dev->loader_dispatch.extension_terminator_dispatch.CreateSwapchainKHR) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " + "extension enabled?"); + return VK_SUCCESS; + } + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfo->surface; + if (NULL != icd_surface->real_icd_surfaces) { + if ((VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { + // We found the ICD, and there is an ICD KHR surface + // associated with it, so copy the CreateInfo struct + // and point it at the ICD's surface. + VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR)); + if (NULL == pCreateCopy) { + return VK_ERROR_OUT_OF_HOST_MEMORY; } + memcpy(pCreateCopy, pCreateInfo, sizeof(VkSwapchainCreateInfoKHR)); + pCreateCopy->surface = icd_surface->real_icd_surfaces[icd_index]; + return dev->loader_dispatch.extension_terminator_dispatch.CreateSwapchainKHR(device, pCreateCopy, pAllocator, + pSwapchain); } - return icd_term->dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } - return VK_SUCCESS; + return dev->loader_dispatch.extension_terminator_dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } // This is the trampoline entrypoint for DestroySwapchainKHR @@ -489,7 +514,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkDestroySwapchainKHR: Invalid device [VUID-vkDestroySwapchainKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -501,7 +526,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice de uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetSwapchainImagesKHR: Invalid device [VUID-vkGetSwapchainImagesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -513,7 +538,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice devi VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAcquireNextImageKHR: Invalid device [VUID-vkAcquireNextImageKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -524,14 +549,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice devi LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(queue); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkQueuePresentKHR: Invalid queue [VUID-vkQueuePresentKHR-queue-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } return disp->QueuePresentKHR(queue, pPresentInfo); } -static VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, size_t base_size, size_t platform_size) { +VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, size_t base_size, size_t platform_size) { // Next, if so, proceed with the implementation of this function: VkIcdSurface *pIcdSurface = loader_instance_heap_alloc(instance, sizeof(VkIcdSurface), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (pIcdSurface != NULL) { @@ -552,7 +577,7 @@ static VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, return pIcdSurface; } -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) // Functions for the VK_KHR_win32_surface extension: @@ -563,7 +588,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateWin32SurfaceKHR: Invalid instance [VUID-vkCreateWin32SurfaceKHR-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -583,7 +608,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance insta struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_win32_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_win32_surface extension not enabled. vkCreateWin32SurfaceKHR not executed!\n"); + "VK_KHR_win32_surface extension not enabled. vkCreateWin32SurfaceKHR not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -612,7 +637,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance insta } } - *pSurface = (VkSurfaceKHR)(pIcdSurface); + *pSurface = (VkSurfaceKHR)(uintptr_t)pIcdSurface; out: @@ -640,7 +665,7 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32Presentatio const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceWin32PresentationSupportKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceWin32PresentationSupportKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -659,14 +684,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupp struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_win32_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_win32_surface extension not enabled. vkGetPhysicalDeviceWin32PresentationSupportKHR not executed!\n"); + "VK_KHR_win32_surface extension not enabled. vkGetPhysicalDeviceWin32PresentationSupportKHR not executed!"); return VK_FALSE; } if (NULL == icd_term->dispatch.GetPhysicalDeviceWin32PresentationSupportKHR) { // return VK_FALSE as this driver doesn't support WSI functionality loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceWin32PresentationSupportKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceWin32PresentationSupportKHR!"); return VK_FALSE; } @@ -674,7 +699,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupp } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) // This is the trampoline entrypoint for CreateWaylandSurfaceKHR LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(VkInstance instance, @@ -683,7 +708,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(VkInstanc VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateWaylandSurfaceKHR: Invalid instance [VUID-vkCreateWaylandSurfaceKHR-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -702,7 +727,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance ins struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_wayland_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_wayland_surface extension not enabled. vkCreateWaylandSurfaceKHR not executed!\n"); + "VK_KHR_wayland_surface extension not enabled. vkCreateWaylandSurfaceKHR not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -760,7 +785,7 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentat const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceWaylandPresentationSupportKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceWaylandPresentationSupportKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -779,16 +804,15 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSu struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_wayland_surface_enabled) { - loader_log( - loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_wayland_surface extension not enabled. vkGetPhysicalDeviceWaylandPresentationSupportKHR not executed!\n"); + loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, + "VK_KHR_wayland_surface extension not enabled. vkGetPhysicalDeviceWaylandPresentationSupportKHR not executed!"); return VK_FALSE; } if (NULL == icd_term->dispatch.GetPhysicalDeviceWaylandPresentationSupportKHR) { // return VK_FALSE as this driver doesn't support WSI functionality loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceWaylandPresentationSupportKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceWaylandPresentationSupportKHR!"); return VK_FALSE; } @@ -796,7 +820,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSu } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) // Functions for the VK_KHR_xcb_surface extension: @@ -807,7 +831,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(VkInstance in VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateXcbSurfaceKHR: Invalid instance [VUID-vkCreateXcbSurfaceKHR-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -825,7 +849,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instanc struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_xcb_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_xcb_surface extension not enabled. vkCreateXcbSurfaceKHR not executed!\n"); + "VK_KHR_xcb_surface extension not enabled. vkCreateXcbSurfaceKHR not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -884,7 +908,7 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationS const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceXcbPresentationSupportKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceXcbPresentationSupportKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -905,14 +929,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSuppor struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_xcb_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_xcb_surface extension not enabled. vkGetPhysicalDeviceXcbPresentationSupportKHR not executed!\n"); + "VK_KHR_xcb_surface extension not enabled. vkGetPhysicalDeviceXcbPresentationSupportKHR not executed!"); return VK_FALSE; } if (NULL == icd_term->dispatch.GetPhysicalDeviceXcbPresentationSupportKHR) { // return VK_FALSE as this driver doesn't support WSI functionality loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceXcbPresentationSupportKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceXcbPresentationSupportKHR!"); return VK_FALSE; } @@ -921,7 +945,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSuppor } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) // Functions for the VK_KHR_xlib_surface extension: @@ -932,7 +956,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance i VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateXlibSurfaceKHR: Invalid instance [VUID-vkCreateXlibSurfaceKHR-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -950,7 +974,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instan struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_xlib_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_xlib_surface extension not enabled. vkCreateXlibSurfaceKHR not executed!\n"); + "VK_KHR_xlib_surface extension not enabled. vkCreateXlibSurfaceKHR not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -1008,7 +1032,7 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentation const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceXlibPresentationSupportKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceXlibPresentationSupportKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1028,14 +1052,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSuppo struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_xlib_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_xlib_surface extension not enabled. vkGetPhysicalDeviceXlibPresentationSupportKHR not executed!\n"); + "VK_KHR_xlib_surface extension not enabled. vkGetPhysicalDeviceXlibPresentationSupportKHR not executed!"); return VK_FALSE; } if (NULL == icd_term->dispatch.GetPhysicalDeviceXlibPresentationSupportKHR) { // return VK_FALSE as this driver doesn't support WSI functionality loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceXlibPresentationSupportKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceXlibPresentationSupportKHR!"); return VK_FALSE; } @@ -1043,7 +1067,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSuppo } #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) // Functions for the VK_EXT_directfb_surface extension: @@ -1054,7 +1078,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT(VkInstan VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDirectFBSurfaceEXT: Invalid instance [VUID-vkCreateDirectFBSurfaceEXT-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1074,7 +1098,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDirectFBSurfaceEXT(VkInstance in struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_directfb_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_EXT_directfb_surface extension not enabled. vkCreateDirectFBSurfaceEXT not executed!\n"); + "VK_EXT_directfb_surface extension not enabled. vkCreateDirectFBSurfaceEXT not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -1133,7 +1157,7 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresenta const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceDirectFBPresentationSupportEXT: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceDirectFBPresentationSupportEXT-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1154,14 +1178,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceDirectFBPresentationS if (!loader_inst->wsi_directfb_surface_enabled) { loader_log( loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_EXT_directfb_surface extension not enabled. vkGetPhysicalDeviceDirectFBPresentationSupportKHR not executed!\n"); + "VK_EXT_directfb_surface extension not enabled. vkGetPhysicalDeviceDirectFBPresentationSupportKHR not executed!"); return VK_FALSE; } if (NULL == icd_term->dispatch.GetPhysicalDeviceDirectFBPresentationSupportEXT) { // return VK_FALSE as this driver doesn't support WSI functionality loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceDirectFBPresentationSupportEXT!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceDirectFBPresentationSupportEXT!"); return VK_FALSE; } @@ -1170,7 +1194,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceDirectFBPresentationS #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) // Functions for the VK_KHR_android_surface extension: @@ -1181,7 +1205,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(VkInstanc VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateAndroidSurfaceKHR: Invalid instance [VUID-vkCreateAndroidSurfaceKHR-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1196,7 +1220,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance ins struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkCreateAndroidSurfaceKHR not executed!\n"); + "VK_KHR_display extension not enabled. vkCreateAndroidSurfaceKHR not executed!"); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -1217,19 +1241,19 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance ins #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) // Functions for the VK_OHOS_surface extension: // This is the trampoline entrypoint for CreateSurfaceOHOS LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS(VkInstance instance, - const VkSurfaceCreateInfoOHOS *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface) { + const VkSurfaceCreateInfoOHOS *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateSurfaceOHOS: Invalid instance [VUID-vkCreateSurfaceOHOS-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1238,8 +1262,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS(VkInstance inst // This is the instance chain terminator function for CreateSurfaceOHOS VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSurfaceOHOS(VkInstance instance, - const VkSurfaceCreateInfoOHOS *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { + const VkSurfaceCreateInfoOHOS *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { // First, check to ensure the appropriate extension was enabled: struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_ohos_surface_enabled) { @@ -1274,7 +1298,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateHeadlessSurfaceEXT(VkInstan VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateHeadlessSurfaceEXT: Invalid instance [VUID-vkCreateHeadlessSurfaceEXT-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1293,7 +1317,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateHeadlessSurfaceEXT(VkInstance in if (!inst->wsi_headless_surface_enabled) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, "VK_EXT_headless_surface extension not enabled. " - "vkCreateHeadlessSurfaceEXT not executed!\n"); + "vkCreateHeadlessSurfaceEXT not executed!"); return VK_SUCCESS; } @@ -1339,7 +1363,34 @@ out: return vkRes; } -#ifdef VK_USE_PLATFORM_MACOS_MVK +// Ensure we are properly setting VK_USE_PLATFORM_METAL_EXT, VK_USE_PLATFORM_IOS_MVK, and VK_USE_PLATFORM_MACOS_MVK. +#if __APPLE__ + +#ifndef VK_USE_PLATFORM_METAL_EXT +#error "VK_USE_PLATFORM_METAL_EXT not defined!" +#endif + +#include + +#if TARGET_OS_IOS + +#ifndef VK_USE_PLATFORM_IOS_MVK +#error "VK_USE_PLATFORM_IOS_MVK not defined!" +#endif + +#endif // TARGET_OS_IOS + +#if TARGET_OS_OSX + +#ifndef VK_USE_PLATFORM_MACOS_MVK +#error "VK_USE_PLATFORM_MACOS_MVK not defined!" +#endif + +#endif // TARGET_OS_OSX + +#endif // __APPLE__ + +#if defined(VK_USE_PLATFORM_MACOS_MVK) // Functions for the VK_MVK_macos_surface extension: @@ -1350,7 +1401,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(VkInstance VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateMacOSSurfaceMVK: Invalid instance [VUID-vkCreateMacOSSurfaceMVK-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1368,7 +1419,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMacOSSurfaceMVK(VkInstance insta struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_macos_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_MVK_macos_surface extension not enabled. vkCreateMacOSSurfaceMVK not executed!\n"); + "VK_MVK_macos_surface extension not enabled. vkCreateMacOSSurfaceMVK not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -1419,7 +1470,7 @@ out: #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) // Functions for the VK_MVK_ios_surface extension: @@ -1430,7 +1481,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(VkInstance in VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateIOSSurfaceMVK: Invalid instance [VUID-vkCreateIOSSurfaceMVK-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1440,11 +1491,13 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(VkInstance in // This is the instance chain terminator function for CreateIOSSurfaceKHR VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { + (void)pAllocator; + // First, check to ensure the appropriate extension was enabled: struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_ios_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_MVK_ios_surface extension not enabled. vkCreateIOSSurfaceMVK not executed!\n"); + "VK_MVK_ios_surface extension not enabled. vkCreateIOSSurfaceMVK not executed!"); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -1465,7 +1518,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateIOSSurfaceMVK(VkInstance instanc #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) // Functions for the VK_GGP_stream_descriptor_surface extension: @@ -1476,7 +1529,7 @@ vkCreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptor struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { loader_log( - NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateStreamDescriptorSurfaceGGP: Invalid instance [VUID-vkCreateStreamDescriptorSurfaceGGP-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1496,7 +1549,7 @@ terminator_CreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamD struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_ggp_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_GGP_stream_descriptor_surface extension not enabled. vkCreateStreamDescriptorSurfaceGGP not executed!\n"); + "VK_GGP_stream_descriptor_surface extension not enabled. vkCreateStreamDescriptorSurfaceGGP not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -1554,7 +1607,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(VkInstance VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateMetalSurfaceEXT: Invalid instance [VUID-vkCreateMetalSurfaceEXT-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1571,7 +1624,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMetalSurfaceEXT(VkInstance insta struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_metal_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_EXT_metal_surface extension not enabled. vkCreateMetalSurfaceEXT will not be executed.\n"); + "VK_EXT_metal_surface extension not enabled. vkCreateMetalSurfaceEXT will not be executed."); } // Next, if so, proceed with the implementation of this function: @@ -1597,7 +1650,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMetalSurfaceEXT(VkInstance insta } } } - *pSurface = (VkSurfaceKHR)icd_surface; + *pSurface = (VkSurfaceKHR)(uintptr_t)icd_surface; out: if (result != VK_SUCCESS && icd_surface != NULL) { @@ -1617,7 +1670,7 @@ out: #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) // This is the trampoline entrypoint for CreateScreenSurfaceQNX LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateScreenSurfaceQNX(VkInstance instance, @@ -1626,7 +1679,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateScreenSurfaceQNX(VkInstance VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateScreenSurfaceQNX: Invalid instance [VUID-vkCreateScreenSurfaceQNX-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1645,7 +1698,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateScreenSurfaceQNX(VkInstance inst struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_screen_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_QNX_screen_surface extension not enabled. vkCreateScreenSurfaceQNX not executed!\n"); + "VK_QNX_screen_surface extension not enabled. vkCreateScreenSurfaceQNX not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -1702,7 +1755,7 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceScreenPresentati struct _screen_window *window) { VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceScreenPresentationSupportQNX: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceScreenPresentationSupportQNX-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1723,14 +1776,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceScreenPresentationSup struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_screen_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_QNX_screen_surface extension not enabled. vkGetPhysicalDeviceScreenPresentationSupportQNX not executed!\n"); + "VK_QNX_screen_surface extension not enabled. vkGetPhysicalDeviceScreenPresentationSupportQNX not executed!"); return VK_FALSE; } if (NULL == icd_term->dispatch.GetPhysicalDeviceScreenPresentationSupportQNX) { // return VK_FALSE as this driver doesn't support WSI functionality loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceScreenPresentationSupportQNX!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceScreenPresentationSupportQNX!"); return VK_FALSE; } @@ -1738,7 +1791,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceScreenPresentationSup } #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) // Functions for the VK_NN_vi_surface extension: @@ -1747,7 +1800,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN(VkInstance inst const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateViSurfaceNN: Invalid instance [VUID-vkCreateViSurfaceNN-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -1765,7 +1818,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateViSurfaceNN(VkInstance instance, struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_vi_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_NN_vi_surface extension not enabled. vkCreateViSurfaceNN not executed!\n"); + "VK_NN_vi_surface extension not enabled. vkCreateViSurfaceNN not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -1823,7 +1876,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertie const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceDisplayPropertiesKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceDisplayPropertiesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1842,13 +1895,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR( struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkGetPhysicalDeviceDisplayPropertiesKHR not executed!\n"); + "VK_KHR_display extension not enabled. vkGetPhysicalDeviceDisplayPropertiesKHR not executed!"); return VK_SUCCESS; } if (NULL == icd_term->dispatch.GetPhysicalDeviceDisplayPropertiesKHR) { loader_log(loader_inst, VULKAN_LOADER_WARN_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceDisplayPropertiesKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceDisplayPropertiesKHR!"); // return 0 for property count as this driver doesn't support WSI functionality if (pPropertyCount) { *pPropertyCount = 0; @@ -1864,7 +1917,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlaneProp const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceDisplayPlanePropertiesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1883,13 +1936,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertie struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkGetPhysicalDeviceDisplayPlanePropertiesKHR not executed!\n"); + "VK_KHR_display extension not enabled. vkGetPhysicalDeviceDisplayPlanePropertiesKHR not executed!"); return VK_SUCCESS; } if (NULL == icd_term->dispatch.GetPhysicalDeviceDisplayPlanePropertiesKHR) { loader_log(loader_inst, VULKAN_LOADER_WARN_BIT, 0, - "ICD for selected physical device does not export vkGetPhysicalDeviceDisplayPlanePropertiesKHR!\n"); + "ICD for selected physical device does not export vkGetPhysicalDeviceDisplayPlanePropertiesKHR!"); // return 0 for property count as this driver doesn't support WSI functionality if (pPropertyCount) { *pPropertyCount = 0; @@ -1906,7 +1959,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysK const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDisplayPlaneSupportedDisplaysKHR: Invalid physicalDevice " "[VUID-vkGetDisplayPlaneSupportedDisplaysKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1924,13 +1977,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(Vk struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkGetDisplayPlaneSupportedDisplaysKHR not executed!\n"); + "VK_KHR_display extension not enabled. vkGetDisplayPlaneSupportedDisplaysKHR not executed!"); return VK_SUCCESS; } if (NULL == icd_term->dispatch.GetDisplayPlaneSupportedDisplaysKHR) { loader_log(loader_inst, VULKAN_LOADER_WARN_BIT, 0, - "ICD for selected physical device does not export vkGetDisplayPlaneSupportedDisplaysKHR!\n"); + "ICD for selected physical device does not export vkGetDisplayPlaneSupportedDisplaysKHR!"); // return 0 for property count as this driver doesn't support WSI functionality if (pDisplayCount) { *pDisplayCount = 0; @@ -1947,7 +2000,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR(VkPhy const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDisplayModePropertiesKHR: Invalid physicalDevice " "[VUID-vkGetDisplayModePropertiesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -1966,13 +2019,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysical struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkGetDisplayModePropertiesKHR not executed!\n"); + "VK_KHR_display extension not enabled. vkGetDisplayModePropertiesKHR not executed!"); return VK_SUCCESS; } if (NULL == icd_term->dispatch.GetDisplayModePropertiesKHR) { loader_log(loader_inst, VULKAN_LOADER_WARN_BIT, 0, - "ICD for selected physical device does not export vkGetDisplayModePropertiesKHR!\n"); + "ICD for selected physical device does not export vkGetDisplayModePropertiesKHR!"); // return 0 for property count as this driver doesn't support WSI functionality if (pPropertyCount) { *pPropertyCount = 0; @@ -1990,7 +2043,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR(VkPhysicalDe const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDisplayModeKHR: Invalid physicalDevice " "[VUID-vkCreateDisplayModeKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2009,14 +2062,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkCreateDisplayModeKHR not executed!\n"); + "VK_KHR_display extension not enabled. vkCreateDisplayModeKHR not executed!"); return VK_ERROR_EXTENSION_NOT_PRESENT; } if (NULL == icd_term->dispatch.CreateDisplayModeKHR) { // Can't emulate, so return an appropriate error loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "ICD for selected physical device does not export vkCreateDisplayModeKHR!\n"); + "ICD for selected physical device does not export vkCreateDisplayModeKHR!"); return VK_ERROR_INITIALIZATION_FAILED; } @@ -2029,7 +2082,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR(Vk const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDisplayPlaneCapabilitiesKHR: Invalid physicalDevice " "[VUID-vkGetDisplayPlaneCapabilitiesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2048,14 +2101,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysi struct loader_instance *loader_inst = (struct loader_instance *)icd_term->this_instance; if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkGetDisplayPlaneCapabilitiesKHR not executed!\n"); + "VK_KHR_display extension not enabled. vkGetDisplayPlaneCapabilitiesKHR not executed!"); return VK_SUCCESS; } if (NULL == icd_term->dispatch.GetDisplayPlaneCapabilitiesKHR) { // Emulate support loader_log(loader_inst, VULKAN_LOADER_WARN_BIT, 0, - "ICD for selected physical device does not export vkGetDisplayPlaneCapabilitiesKHR!\n"); + "ICD for selected physical device does not export vkGetDisplayPlaneCapabilitiesKHR!"); if (pCapabilities) { memset(pCapabilities, 0, sizeof(VkDisplayPlaneCapabilitiesKHR)); } @@ -2071,7 +2124,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR(VkIn VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateDisplayPlaneSurfaceKHR: Invalid instance [VUID-vkCreateDisplayPlaneSurfaceKHR-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2090,7 +2143,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstanc if (!inst->wsi_display_enabled) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_surface extension not enabled. vkCreateDisplayPlaneSurfaceKHR not executed!\n"); + "VK_KHR_surface extension not enabled. vkCreateDisplayPlaneSurfaceKHR not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -2153,7 +2206,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR(VkDevic VkSwapchainKHR *pSwapchains) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateSharedSwapchainsKHR: Invalid device [VUID-vkCreateSharedSwapchainsKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2167,34 +2220,44 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSharedSwapchainsKHR(VkDevice dev 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 != icd_term->dispatch.CreateSharedSwapchainsKHR) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfos->surface; - if (NULL != icd_surface->real_icd_surfaces) { - if ((VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { - // We found the ICD, and there is an ICD KHR surface - // associated with it, so copy the CreateInfo struct - // and point it at the ICD's surface. - VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); - if (NULL == pCreateCopy) { - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - memcpy(pCreateCopy, pCreateInfos, sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); - for (uint32_t sc = 0; sc < swapchainCount; sc++) { - pCreateCopy[sc].surface = icd_surface->real_icd_surfaces[icd_index]; - } - return icd_term->dispatch.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateCopy, pAllocator, pSwapchains); - } + if (NULL == icd_term || NULL == dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateSharedSwapchainsKHR Terminator: Invalid device handle. This is likely the result of a " + "layer wrapping device handles and failing to unwrap them in all functions. " + "[VUID-vkCreateSharedSwapchainsKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + if (NULL == dev->loader_dispatch.extension_terminator_dispatch.CreateSharedSwapchainsKHR) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT, 0, + "vkCreateSharedSwapchainsKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the " + "VK_KHR_display_swapchain extension enabled?"); + return VK_SUCCESS; + } + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfos->surface; + if ((VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { + // We found the ICD, and there is an ICD KHR surface + // associated with it, so copy the CreateInfo struct + // and point it at the ICD's surface. + VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); + if (NULL == pCreateCopy) { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + memcpy(pCreateCopy, pCreateInfos, sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); + for (uint32_t sc = 0; sc < swapchainCount; sc++) { + pCreateCopy[sc].surface = icd_surface->real_icd_surfaces[icd_index]; } - return icd_term->dispatch.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); + return dev->loader_dispatch.extension_terminator_dispatch.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateCopy, + pAllocator, pSwapchains); } - return VK_SUCCESS; + return dev->loader_dispatch.extension_terminator_dispatch.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, + pAllocator, pSwapchains); } LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceGroupPresentCapabilitiesKHR: Invalid device " "[VUID-vkGetDeviceGroupPresentCapabilitiesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2206,7 +2269,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes VkDeviceGroupPresentModeFlagsKHR *pModes) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDeviceGroupSurfacePresentModesKHR: Invalid device " "[VUID-vkGetDeviceGroupSurfacePresentModesKHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2219,15 +2282,25 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModesKHR(V 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 != icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR) { - VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; - if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { - return icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR(device, icd_surface->real_icd_surfaces[icd_index], - pModes); - } - return icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); + if (NULL == icd_term || NULL == dev) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetDeviceGroupSurfacePresentModesKHR: Invalid device " + "[VUID-vkGetDeviceGroupSurfacePresentModesKHR-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ } - return VK_SUCCESS; + if (NULL == dev->loader_dispatch.extension_terminator_dispatch.GetDeviceGroupSurfacePresentModesKHR) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT, 0, + "vkGetDeviceGroupSurfacePresentModesKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was either " + "Vulkan 1.1 and VK_KHR_swapchain enabled or both the VK_KHR_device_group and VK_KHR_surface " + "extensions enabled when using Vulkan 1.0?"); + return VK_SUCCESS; + } + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; + if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)(uintptr_t)NULL != icd_surface->real_icd_surfaces[icd_index]) { + return dev->loader_dispatch.extension_terminator_dispatch.GetDeviceGroupSurfacePresentModesKHR( + device, icd_surface->real_icd_surfaces[icd_index], pModes); + } + return dev->loader_dispatch.extension_terminator_dispatch.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); } LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, @@ -2236,7 +2309,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectangle const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDevicePresentRectanglesKHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDevicePresentRectanglesKHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2272,7 +2345,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR(VkDevice dev uint32_t *pImageIndex) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkAcquireNextImage2KHR: Invalid device [VUID-vkAcquireNextImage2KHR-device-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2287,7 +2360,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertie const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceDisplayProperties2KHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceDisplayProperties2KHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2342,7 +2415,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlaneProp const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceDisplayPlaneProperties2KHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2399,7 +2472,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModeProperties2KHR(VkPh const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDisplayModeProperties2KHR: Invalid physicalDevice " "[VUID-vkGetDisplayModeProperties2KHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2455,7 +2528,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilities2KHR(V const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetDisplayPlaneCapabilities2KHR: Invalid physicalDevice " "[VUID-vkGetDisplayPlaneCapabilities2KHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2492,7 +2565,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilities2KHR(VkPhys pDisplayPlaneInfo->planeIndex, &pCapabilities->capabilities); } -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) // This is the trampoline entrypoint for CreateImagePipeSurfaceFUCHSIA LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(VkInstance instance, @@ -2501,7 +2574,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(VkI VkSurfaceKHR *pSurface) { struct loader_instance *loader_inst = loader_get_instance(instance); if (NULL == loader_inst) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkCreateImagePipeSurfaceFUCHSIA: Invalid instance [VUID-vkCreateImagePipeSurfaceFUCHSIA-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } @@ -2525,7 +2598,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateImagePipeSurfaceFUCHSIA(VkInstan if (!loader_inst->wsi_imagepipe_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, "VK_FUCHSIA_imagepipe_surface extension not enabled. " - "vkCreateImagePipeSurfaceFUCHSIA not executed!\n"); + "vkCreateImagePipeSurfaceFUCHSIA not executed!"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -2553,7 +2626,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateImagePipeSurfaceFUCHSIA(VkInstan } } - *pSurface = (VkSurfaceKHR)(pIcdSurface); + *pSurface = (VkSurfaceKHR)(uintptr_t)pIcdSurface; out: @@ -2581,7 +2654,7 @@ vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, cons const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSurfaceCapabilities2KHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfaceCapabilities2KHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2599,7 +2672,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2K if (!loader_inst->wsi_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceCapabilities2KHR not executed!\n"); + "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceCapabilities2KHR not executed!"); return VK_SUCCESS; } @@ -2672,7 +2745,7 @@ vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkP const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); if (VK_NULL_HANDLE == unwrapped_phys_dev) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "vkGetPhysicalDeviceSurfaceFormats2KHR: Invalid physicalDevice " "[VUID-vkGetPhysicalDeviceSurfaceFormats2KHR-physicalDevice-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ @@ -2691,7 +2764,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormats2KHR(Vk if (!loader_inst->wsi_surface_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceFormats2KHR not executed!\n"); + "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceFormats2KHR not executed!"); return VK_SUCCESS; } @@ -2843,7 +2916,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) // Functions for the VK_KHR_win32_surface extension: if (!strcmp("vkCreateWin32SurfaceKHR", name)) { @@ -2855,7 +2928,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) // Functions for the VK_KHR_wayland_surface extension: if (!strcmp("vkCreateWaylandSurfaceKHR", name)) { @@ -2867,7 +2940,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) // Functions for the VK_KHR_xcb_surface extension: if (!strcmp("vkCreateXcbSurfaceKHR", name)) { @@ -2879,7 +2952,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) // Functions for the VK_KHR_xlib_surface extension: if (!strcmp("vkCreateXlibSurfaceKHR", name)) { @@ -2891,7 +2964,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) // Functions for the VK_EXT_directfb_surface extension: if (!strcmp("vkCreateDirectFBSurfaceEXT", name)) { @@ -2903,7 +2976,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) // Functions for the VK_KHR_android_surface extension: if (!strcmp("vkCreateAndroidSurfaceKHR", name)) { @@ -2911,7 +2984,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) // Functions for the VK_OHOS_surface extension: if (!strcmp("vkCreateSurfaceOHOS", name)) { @@ -2920,7 +2993,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char } #endif // VK_USE_PLATFORM_OHOS -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) // Functions for the VK_MVK_macos_surface extension: if (!strcmp("vkCreateMacOSSurfaceMVK", name)) { @@ -2928,7 +3001,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) // Functions for the VK_MVK_ios_surface extension: if (!strcmp("vkCreateIOSSurfaceMVK", name)) { @@ -2936,7 +3009,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) // Functions for the VK_GGP_stream_descriptor_surface extension: if (!strcmp("vkCreateStreamDescriptorSurfaceGGP", name)) { @@ -2944,7 +3017,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) // Functions for the VK_FUCHSIA_imagepipe_surface extension: if (!strcmp("vkCreateImagePipeSurfaceFUCHSIA", name)) { @@ -2968,7 +3041,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char } #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) // Functions for the VK_QNX_screen_surface extension: if (!strcmp("vkCreateScreenSurfaceQNX", name)) { @@ -2981,7 +3054,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char } #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) // Functions for the VK_NN_vi_surface extension: if (!strcmp("vkCreateViSurfaceNN", name)) { diff --git a/loader/wsi.h b/loader/wsi.h index 9895da3d99a28493f971c5262de30ebe1fc569e9..a84df04e14def51b317daaa421c5db5a0722531a 100644 --- a/loader/wsi.h +++ b/loader/wsi.h @@ -26,37 +26,37 @@ typedef struct { union { -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) VkIcdSurfaceWayland wayland_surf; #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VkIcdSurfaceWin32 win_surf; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) VkIcdSurfaceXcb xcb_surf; #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) VkIcdSurfaceXlib xlib_surf; #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VkIcdSurfaceDirectFB directfb_surf; #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) VkIcdSurfaceMacOS macos_surf; #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) VkIcdSurfaceGgp ggp_surf; #endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VkIcdSurfaceImagePipe imagepipe_surf; #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) VkIcdSurfaceMetal metal_surf; #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) VkIcdSurfaceScreen screen_surf; #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) VkIcdSurfaceVi vi_surf; #endif // VK_USE_PLATFORM_VI_NN VkIcdSurfaceDisplay display_surf; @@ -103,13 +103,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKH VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes); -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); #endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); @@ -117,7 +117,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSu uint32_t queueFamilyIndex, struct wl_display *display); #endif -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); @@ -126,14 +126,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSuppor xcb_connection_t *connection, xcb_visualid_t visual_id); #endif -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy, VisualID visualID); #endif -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDirectFBSurfaceEXT(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); @@ -141,15 +141,15 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceDirectFBPresentationS uint32_t queueFamilyIndex, IDirectFB *dfb); #endif -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); #endif -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); #endif -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); @@ -158,7 +158,7 @@ terminator_CreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamD VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMetalSurfaceEXT(VkInstance instance, const VkMetalSurfaceCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); #endif -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateScreenSurfaceQNX(VkInstance instance, const VkScreenSurfaceCreateInfoQNX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); @@ -166,7 +166,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceScreenPresentationSup uint32_t queueFamilyIndex, struct _screen_window *window); #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateViSurfaceNN(VkInstance instance, const VkViSurfaceCreateInfoNN *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); #endif // VK_USE_PLATFORM_VI_NN @@ -216,20 +216,20 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModeProperties2KHR(VkPhysica VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo, VkDisplayPlaneCapabilities2KHR *pCapabilities); -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateImagePipeSurfaceFUCHSIA(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); #endif -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); #endif -#ifdef VK_USE_PLATFORM_OHOS +#if defined(VK_USE_PLATFORM_OHOS) VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSurfaceOHOS(VkInstance instance, const VkSurfaceCreateInfoOHOS* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..22fe9b2925c9d3dd5f352314742ccb64db0b7abc --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1,146 @@ +# ~~~ +# Copyright (c) 2023 LunarG, Inc. +# +# 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. +# ~~~ + +option(UPDATE_DEPS "Run update_deps.py for user") +if (UPDATE_DEPS) + find_package(Python3 REQUIRED QUIET) + + set(update_dep_py "${CMAKE_CURRENT_LIST_DIR}/update_deps.py") + set(known_good_json "${CMAKE_CURRENT_LIST_DIR}/known_good.json") + + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${update_dep_py} ${known_good_json}) + + list(APPEND update_dep_command "${update_dep_py}") + list(APPEND update_dep_command "--generator") + list(APPEND update_dep_command "${CMAKE_GENERATOR}") + + if (CMAKE_GENERATOR_PLATFORM) + list(APPEND update_dep_command "--arch") + list(APPEND update_dep_command "${CMAKE_GENERATOR_PLATFORM}") + endif() + + if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES ";") + list(APPEND update_dep_command "--osx-archs") + string(REPLACE ";" ":" osx_archs "${CMAKE_OSX_ARCHITECTURES}") + list(APPEND update_dep_command "${osx_archs}") + + set(APPLE_UNIVERSAL_BINARY ON) + endif() + + if (NOT CMAKE_BUILD_TYPE) + message(WARNING "CMAKE_BUILD_TYPE not set. Using Debug for dependency build type") + set(_build_type Debug) + else() + set(_build_type ${CMAKE_BUILD_TYPE}) + 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 (CMAKE_CROSSCOMPILING) + if (APPLE_UNIVERSAL_BINARY) + set(UPDATE_DEPS_DIR_SUFFIX "${CMAKE_SYSTEM_NAME}/${UPDATE_DEPS_DIR_SUFFIX}/universal") + else() + set(UPDATE_DEPS_DIR_SUFFIX "${CMAKE_SYSTEM_NAME}/${UPDATE_DEPS_DIR_SUFFIX}/${CMAKE_SYSTEM_PROCESSOR}") + endif() + else() + if (APPLE_UNIVERSAL_BINARY) + set(UPDATE_DEPS_DIR_SUFFIX "${UPDATE_DEPS_DIR_SUFFIX}/universal") + else() + math(EXPR bitness "8 * ${CMAKE_SIZEOF_VOID_P}") + set(UPDATE_DEPS_DIR_SUFFIX "${UPDATE_DEPS_DIR_SUFFIX}/${bitness}") + endif() + endif() + set(UPDATE_DEPS_DIR "${PROJECT_SOURCE_DIR}/external/${UPDATE_DEPS_DIR_SUFFIX}" CACHE PATH "Location where update_deps.py installs packages") + list(APPEND update_dep_command "--dir" ) + list(APPEND update_dep_command "${UPDATE_DEPS_DIR}") + + if (NOT BUILD_TESTS) + list(APPEND update_dep_command "--optional=tests") + endif() + + if (UPDATE_DEPS_SKIP_EXISTING_INSTALL) + list(APPEND update_dep_command "--skip-existing-install") + endif() + + list(APPEND cmake_vars "CMAKE_TOOLCHAIN_FILE") + + # Avoids manually setting CMAKE_SYSTEM_NAME unless it's needed: + # https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING.html + if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") + list(APPEND cmake_vars "CMAKE_SYSTEM_NAME") + endif() + if (APPLE) + list(APPEND cmake_vars "CMAKE_OSX_DEPLOYMENT_TARGET") + endif() + if (NOT MSVC_IDE) + list(APPEND cmake_vars "CMAKE_CXX_COMPILER" "CMAKE_C_COMPILER" "CMAKE_ASM_COMPILER") + endif() + if (ANDROID) + list(APPEND cmake_vars "ANDROID_PLATFORM" "CMAKE_ANDROID_ARCH_ABI" "CMAKE_ANDROID_STL_TYPE" "CMAKE_ANDROID_RTTI" "CMAKE_ANDROID_EXCEPTIONS" "ANDROID_USE_LEGACY_TOOLCHAIN_FILE") + endif() + + set(cmake_var) + foreach(var IN LISTS cmake_vars) + if (DEFINED ${var}) + list(APPEND update_dep_command "--cmake_var") + list(APPEND update_dep_command "${var}=${${var}}") + endif() + endforeach() + + if (cmake_var) + list(APPEND update_dep_command "${cmake_var}") + endif() + + file(TIMESTAMP ${update_dep_py} timestamp_1) + file(TIMESTAMP ${known_good_json} timestamp_2) + + string("MD5" md5_hash "${timestamp_1}-${timestamp_2}-${update_dep_command}") + + set(UPDATE_DEPS_HASH "0" CACHE STRING "Default value until we run update_deps.py") + mark_as_advanced(UPDATE_DEPS_HASH) + + if ("${UPDATE_DEPS_HASH}" STREQUAL "0") + list(APPEND update_dep_command "--clean-build") + list(APPEND update_dep_command "--clean-install") + endif() + + if ("${md5_hash}" STREQUAL $CACHE{UPDATE_DEPS_HASH}) + message(DEBUG "update_deps.py: no work to do.") + else() + execute_process( + COMMAND ${Python3_EXECUTABLE} ${update_dep_command} + RESULT_VARIABLE _update_deps_result + ) + if (NOT (${_update_deps_result} EQUAL 0)) + message(FATAL_ERROR "Could not run update_deps.py which is necessary to download dependencies.") + endif() + set(UPDATE_DEPS_HASH ${md5_hash} CACHE STRING "Ensure we only run update_deps.py when we need to." FORCE) + include("${UPDATE_DEPS_DIR}/helper.cmake") + endif() +endif() +if (VULKAN_HEADERS_INSTALL_DIR) + list(APPEND CMAKE_PREFIX_PATH ${VULKAN_HEADERS_INSTALL_DIR}) + set(CMAKE_REQUIRE_FIND_PACKAGE_VulkanHeaders TRUE PARENT_SCOPE) +endif() + +if (CMAKE_CROSSCOMPILING) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH} PARENT_SCOPE) +else() + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE) +endif() diff --git a/scripts/check_commit_message_format.sh b/scripts/check_commit_message_format.sh deleted file mode 100755 index 29666356a99ad48c2c2fd1af8a38759c9ef92919..0000000000000000000000000000000000000000 --- a/scripts/check_commit_message_format.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# Copyright (c) 2018 Valve Corporation -# Copyright (c) 2018 LunarG, Inc. - -# 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. -# -# Checks commit messages against project standards in CONTRIBUTING.md document -# Script to determine if commit messages in Pull Request are properly formatted. -# Exits with non 0 exit code if reformatting is needed. - -# Disable subshells -shopt -s lastpipe - -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -# TRAVIS_COMMIT_RANGE contains range of commits for this PR - -# Get user-supplied commit message text for applicable commits and insert -# a unique separator string identifier. The git command returns ONLY the -# subject line and body for each of the commits. -COMMIT_TEXT=$(git log ${TRAVIS_COMMIT_RANGE} --pretty=format:"XXXNEWLINEXXX"%n%B) - -# Bail if there are none -if [ -z "${COMMIT_TEXT}" ]; then - echo -e "${GREEN}No commit messgages to check for formatting.${NC}" - exit 0 -elif ! echo $TRAVIS_COMMIT_RANGE | grep -q "\.\.\."; then - echo -e "${GREEN}No commit messgages to check for formatting.${NC}" - exit 0 -fi - -# Process commit messages -success=1 -current_line=0 -prevline="" - -# Process each line of the commit message output, resetting counter on separator -printf %s "$COMMIT_TEXT" | while IFS='' read -r line; do - # echo "Count = $current_line = $line" - current_line=$((current_line+1)) - if [ "$line" = "XXXNEWLINEXXX" ]; then - current_line=0 - fi - chars=${#line} - if [ $current_line -eq 1 ]; then - # Subject line should be 50 chars or less (but give some slack here) - if [ $chars -gt 54 ]; then - echo "The following subject line exceeds 50 characters in length." - echo " '$line'" - success=0 - fi - i=$(($chars-1)) - last_char=${line:$i:1} - # Output error if last char of subject line is not alpha-numeric - if [[ ! $last_char =~ [0-9a-zA-Z] ]]; then - echo "For the following commit, the last character of the subject line must not be non-alphanumeric." - echo " '$line'" - success=0 - fi - # Checking if subject line doesn't start with 'module: ' - prefix=$(echo $line | cut -f1 -d " ") - if [ "${prefix: -1}" != ":" ]; then - echo "The following subject line must start with a single word specifying the functional area of the change, followed by a colon and space. I.e., 'layers: Subject line here'" - echo " '$line'" - success=0 - fi - elif [ $current_line -eq 2 ]; then - # Commit message must have a blank line between subject and body - if [ $chars -ne 0 ]; then - echo "The following subject line must be followed by a blank line." - echo " '$prevline'" - success=0 - fi - else - # Lines in a commit message body must be less than 72 characters in length (but give some slack) - if [ $chars -gt 76 ]; then - echo "The following commit message body line exceeds the 72 character limit." - echo "'$line\'" - success=0 - fi - fi - prevline=$line -done - -if [ $success -eq 1 ]; then - echo -e "${GREEN}All commit messages in pull request are properly formatted.${NC}" - exit 0 -else - exit 1 -fi diff --git a/scripts/dispatch_table_helper_generator.py b/scripts/dispatch_table_helper_generator.py index 6d4a5bb1c4ed92f7d5a4090f75548078d3c2e716..67af7be1d3f6161d5a108fe693313597ea2aad9e 100644 --- a/scripts/dispatch_table_helper_generator.py +++ b/scripts/dispatch_table_helper_generator.py @@ -103,7 +103,7 @@ class DispatchTableHelperOutputGenerator(OutputGenerator): write(s, file=self.outFile) # File Comment file_comment = '// *** THIS FILE IS GENERATED - DO NOT EDIT ***\n' - file_comment += '// See dispatch_helper_generator.py for modifications\n' + file_comment += '// See dispatch_table_helper_generator.py for modifications\n' write(file_comment, file=self.outFile) # Copyright Notice copyright = '/*\n' @@ -132,7 +132,7 @@ class DispatchTableHelperOutputGenerator(OutputGenerator): preamble += '#include \n' preamble += '#include \n' preamble += '#include \n' - preamble += '#include "vk_layer_dispatch_table.h"\n' + preamble += '#include "loader/generated/vk_layer_dispatch_table.h"\n' write(copyright, file=self.outFile) write(preamble, file=self.outFile) @@ -183,27 +183,6 @@ class DispatchTableHelperOutputGenerator(OutputGenerator): return if handle_type != 'VkInstance' and handle_type != 'VkPhysicalDevice' and name != 'vkGetInstanceProcAddr': self.device_dispatch_list.append((name, self.featureExtraProtect)) - if "VK_VERSION" not in self.featureName and self.extension_type == 'device': - self.device_extension_list.append(name) - # Build up stub function - decl = self.makeCDecls(cmdinfo.elem)[1] - return_type = cmdinfo.elem.find('proto/type').text - return_statement = "" # default type is void, so no return type - try: - return_statement = 'return ' + return_type_table[return_type] + ';' - except KeyError: - if return_type != "void": - raise AssertionError("return_type_table does not contain all possible types. Add an entry for `" + return_type + "`.") - decl = decl.split('*PFN_vk')[1] - decl = decl.replace(')(', '(') - decl = 'static VKAPI_ATTR ' + return_type + ' VKAPI_CALL Stub' + decl - func_body = ' { ' + return_statement + ' }' - decl = decl.replace (';', func_body) - if self.featureExtraProtect is not None: - self.dev_ext_stub_list.append('#ifdef %s' % self.featureExtraProtect) - self.dev_ext_stub_list.append(decl) - if self.featureExtraProtect is not None: - self.dev_ext_stub_list.append('#endif // %s' % self.featureExtraProtect) else: self.instance_dispatch_list.append((name, self.featureExtraProtect)) return @@ -240,7 +219,7 @@ class DispatchTableHelperOutputGenerator(OutputGenerator): base_name = item[0][2:] if item[1] is not None: - table += '#ifdef %s\n' % item[1] + table += '#if defined(%s)\n' % item[1] # If we're looking for the proc we are passing in, just point the table to it. This fixes the issue where # a layer overrides the function name for the loader. @@ -250,9 +229,6 @@ class DispatchTableHelperOutputGenerator(OutputGenerator): table += ' table->GetInstanceProcAddr = gpa;\n' else: table += ' table->%s = (PFN_%s) gpa(%s, "%s");\n' % (base_name, item[0], table_type, item[0]) - if item[0] in self.device_extension_list: - stub_check = ' if (table->%s == nullptr) { table->%s = (PFN_%s)Stub%s; }\n' % (base_name, base_name, item[0], base_name) - table += stub_check if item[1] is not None: table += '#endif // %s\n' % item[1] diff --git a/scripts/generate_source.py b/scripts/generate_source.py index 233e92bfdfbdb493af5c6aa82b389fd46518c183..e301ff43f4516451f65b4ce582f9050694815338 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. @@ -26,13 +28,17 @@ import shutil import subprocess import sys import tempfile - -# files to exclude from --verify check -verify_exclude = ['.clang-format'] +import datetime +import re 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'], + 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') @@ -41,19 +47,17 @@ def main(argv): gen_cmds = [[common_codegen.repo_relative('scripts/loader_genvk.py'), '-registry', os.path.abspath(os.path.join(args.registry, 'vk.xml')), '-quiet', - filename] for filename in ['vk_dispatch_table_helper.h', - 'vk_layer_dispatch_table.h', + filename] for filename in ['vk_layer_dispatch_table.h', 'vk_loader_extensions.h', 'vk_loader_extensions.c', - 'vk_object_types.h', - 'loader_generated_header_version.cmake']] + 'vk_object_types.h']] repo_dir = common_codegen.repo_relative('loader/generated') # get directory where generators will run if args.verify or args.incremental: # generate in temp directory so we can compare or copy later - temp_obj = tempfile.TemporaryDirectory(prefix='VulkanLoader_generated_source_') + temp_obj = tempfile.TemporaryDirectory(prefix='loader_codegen_') temp_dir = temp_obj.name gen_dir = temp_dir else: @@ -78,7 +82,7 @@ def main(argv): temp_files = set(os.listdir(temp_dir)) repo_files = set(os.listdir(repo_dir)) files_match = True - for filename in sorted((temp_files | repo_files) - set(verify_exclude)): + for filename in sorted((temp_files | repo_files)): if filename not in repo_files: print('ERROR: Missing repo file', filename) files_match = False @@ -107,6 +111,26 @@ def main(argv): print('update', repo_filename) shutil.copyfile(temp_filename, repo_filename) + # write out the header version used to generate the code to a checked in CMake file + if args.generated_version: + # Update the CMake project version + with open(common_codegen.repo_relative('CMakeLists.txt'), "r+") as f: + data = f.read() + f.seek(0) + f.write(re.sub("project.*VERSION.*", f"project(VULKAN_LOADER VERSION {args.generated_version} LANGUAGES C)", data)) + f.truncate() + + with open(common_codegen.repo_relative('loader/loader.rc.in'), "r") as rc_file: + rc_file_contents = rc_file.read() + rc_ver = ', '.join(args.generated_version.split('.') + ['0']) + rc_file_contents = rc_file_contents.replace('${LOADER_VER_FILE_VERSION}', f'{rc_ver}') + rc_file_contents = rc_file_contents.replace('${LOADER_VER_FILE_DESCRIPTION_STR}', f'"{args.generated_version}.Dev Build"') + rc_file_contents = rc_file_contents.replace('${LOADER_VER_FILE_VERSION_STR}', f'"Vulkan Loader - Dev Build"') + rc_file_contents = rc_file_contents.replace('${LOADER_CUR_COPYRIGHT_YEAR}', f'{datetime.date.today().year}') + with open(common_codegen.repo_relative('loader/loader.rc'), "w") as rc_file_out: + rc_file_out.write(rc_file_contents) + rc_file_out.close() + return 0 if __name__ == '__main__': diff --git a/build-gn/DEPS b/scripts/gn/DEPS similarity index 35% rename from build-gn/DEPS rename to scripts/gn/DEPS index d44f2a3e14008e23da044324626a02dc64821a8a..8cf931a8282bba1d7dbdb454035ab8bcb9a22e2a 100644 --- a/build-gn/DEPS +++ b/scripts/gn/DEPS @@ -1,53 +1,64 @@ +gclient_gn_args_file = 'build/config/gclient_args.gni' + vars = { 'chromium_git': 'https://chromium.googlesource.com', + 'ninja_version': 'version:2@1.11.1.chromium.6', } deps = { 'build': { - 'url': '{chromium_git}/chromium/src/build.git@45ab3c89af6fc3126b0ca5a7836f0db85ad1ba0e', + 'url': '{chromium_git}/chromium/src/build.git@1015724d82945f9ef7e51c6f804034ccf5f79951', }, 'buildtools': { - 'url': '{chromium_git}/chromium/src/buildtools.git@204a35a2a64f7179f8b76d7a0385653690839e21', + 'url': '{chromium_git}/chromium/src/buildtools.git@3c7e3f1b8b1e4c0b6ec693430379cea682de78d6', + }, + + 'buildtools/linux64': { + 'packages': [ + { + 'package': 'gn/gn/linux-${{arch}}', + 'version': 'git_revision:5e19d2fb166fbd4f6f32147fbb2f497091a54ad8', + } + ], + 'dep_type': 'cipd', + 'condition': 'host_os == "linux"', }, 'testing': { - 'url': '{chromium_git}/chromium/src/testing@3993ef1f527b206d8d3bf3f9824f4fe0e4bbdb0e', + 'url': '{chromium_git}/chromium/src/testing@949b2864b6bd27656753b917c9aa7731dc7a06f6', }, 'tools/clang': { - 'url': '{chromium_git}/chromium/src/tools/clang.git@04b99e7bf9160d551c3a5562f583014b6afc90f9', + 'url': '{chromium_git}/chromium/src/tools/clang.git@566877f1ff1a5fa6beaca3ab4b47bd0b92eb614f', + }, + + 'third_party/ninja': { + 'packages': [ + { + 'package': 'infra/3pp/tools/ninja/${{platform}}', + 'version': Var('ninja_version'), + } + ], + 'dep_type': 'cipd', }, } hooks = [ - # Pull clang-format binaries using checked-in hashes. - { - 'name': 'clang_format_linux', - 'pattern': '.', - 'condition': 'host_os == "linux"', - 'action': [ 'download_from_google_storage', - '--no_resume', - '--platform=linux*', - '--no_auth', - '--bucket', 'chromium-clang-format', - '-s', 'buildtools/linux64/clang-format.sha1', - ], - }, { 'name': 'sysroot_x64', 'pattern': '.', 'condition': 'checkout_linux and checkout_x64', - 'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py', + 'action': ['python3', 'build/linux/sysroot_scripts/install-sysroot.py', '--arch=x64'], }, { # Note: On Win, this should run after win_toolchain, as it may use it. 'name': 'clang', 'pattern': '.', - 'action': ['python', 'tools/clang/scripts/update.py'], + 'action': ['python3', 'tools/clang/scripts/update.py'], }, ] diff --git a/scripts/gn/gn.py b/scripts/gn/gn.py new file mode 100644 index 0000000000000000000000000000000000000000..52b20c580b5a14ecc9fa26611a213b508d67709a --- /dev/null +++ b/scripts/gn/gn.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# Copyright 2023 The Khronos Group Inc. +# Copyright 2023 Valve Corporation +# Copyright 2023 LunarG, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +import os +import subprocess +import sys + +# helper to define paths relative to the repo root +def RepoRelative(path): + return os.path.abspath(os.path.join(os.path.dirname(__file__), '../../', path)) + +def BuildGn(): + if not os.path.exists(RepoRelative("depot_tools")): + print("Cloning Chromium depot_tools\n", flush=True) + clone_cmd = 'git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools'.split(" ") + subprocess.call(clone_cmd) + + os.environ['PATH'] = os.environ.get('PATH') + ":" + RepoRelative("depot_tools") + + print("Updating Repo Dependencies and GN Toolchain\n", flush=True) + update_cmd = './scripts/gn/update_deps.sh' + subprocess.call(update_cmd) + + print("Checking Header Dependencies\n", flush=True) + gn_check_cmd = 'gn gen --check out/Debug'.split(" ") + subprocess.call(gn_check_cmd) + + print("Generating Ninja Files\n", flush=True) + gn_gen_cmd = 'gn gen out/Debug'.split(" ") + subprocess.call(gn_gen_cmd) + + print("Running Ninja Build\n", flush=True) + ninja_build_cmd = 'ninja -C out/Debug'.split(" ") + subprocess.call(ninja_build_cmd) + +# +# Module Entrypoint +def main(): + try: + BuildGn() + + except subprocess.CalledProcessError as proc_error: + print('Command "%s" failed with return code %s' % (' '.join(proc_error.cmd), proc_error.returncode)) + sys.exit(proc_error.returncode) + except Exception as unknown_error: + print('An unkown error occured: %s', unknown_error) + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() diff --git a/build-gn/update_deps.sh b/scripts/gn/update_deps.sh old mode 100755 new mode 100644 similarity index 69% rename from build-gn/update_deps.sh rename to scripts/gn/update_deps.sh index 06a194a25ab383e5b6b872faa72b62aca75f7ce2..95899249545f772aa483c11d7d105378e4b782fa --- a/build-gn/update_deps.sh +++ b/scripts/gn/update_deps.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2019 LunarG, Inc. +# Copyright (c) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,17 +15,29 @@ # limitations under the License. # Execute at repo root -cd "$(dirname $0)/.." +cd "$(dirname $0)/../../" # Use update_deps.py to update source dependencies from /scripts/known_good.json scripts/update_deps.py --dir="external" --no-build -# Use gclient to update toolchain dependencies from /build-gn/DEPS (from chromium) +cat << EOF > .gn +buildconfig = "//build/config/BUILDCONFIG.gn" +secondary_source = "//scripts/gn/secondary/" + +script_executable = "python3" + +default_args = { + clang_use_chrome_plugins = false + use_custom_libcxx = false +} +EOF + +# Use gclient to update toolchain dependencies from /scripts/gn/DEPS (from chromium) cat << EOF >> .gclient solutions = [ { "name" : ".", "url" : "https://github.com/KhronosGroup/Vulkan-Loader", - "deps_file" : "build-gn/DEPS", + "deps_file" : "scripts/gn/DEPS", "managed" : False, "custom_deps" : { }, diff --git a/scripts/helper_file_generator.py b/scripts/helper_file_generator.py index 41685114f4029776c268071d53818415db8714c3..a2b9c59fbbacde158c569ed534a5d5ace8017879 100644 --- a/scripts/helper_file_generator.py +++ b/scripts/helper_file_generator.py @@ -121,6 +121,9 @@ class HelperFileOutputGenerator(OutputGenerator): # User-supplied prefix text, if any (list of strings) self.helper_file_type = genOpts.helper_file_type self.library_name = genOpts.library_name + + write("// clang-format off", file=self.outFile) + # File Comment file_comment = '// *** THIS FILE IS GENERATED - DO NOT EDIT ***\n' file_comment += '// See helper_file_generator.py for modifications\n' @@ -163,7 +166,8 @@ class HelperFileOutputGenerator(OutputGenerator): # Remove blank lines at EOF if dest_file.endswith('\n'): dest_file = dest_file[:-1] - write(dest_file, file=self.outFile); + write(dest_file, file=self.outFile) + write("// clang-format on", file=self.outFile) # Finish processing in superclass OutputGenerator.endFile(self) # @@ -176,10 +180,7 @@ class HelperFileOutputGenerator(OutputGenerator): if interface.tag != 'extension': return name = self.featureName - nameElem = interface[0][1] - name_define = nameElem.get('name') - if 'EXTENSION_NAME' not in name_define: - print("Error in vk.xml file -- extension name is not available") + name_define = next(enum.get('name') for enum in interface.findall('require/enum') if enum.get('name').endswith('_EXTENSION_NAME')) requires = interface.get('requires') if requires is not None: required_extensions = requires.split(',') @@ -426,7 +427,7 @@ class HelperFileOutputGenerator(OutputGenerator): object_types_header += 'const VkDebugReportObjectTypeEXT get_debug_report_enum[] = {\n' object_types_header += ' VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeUnknown\n' - dbg_re = '^VK_DEBUG_REPORT_OBJECT_TYPE_(.*)_EXT$' + dbg_re = '^VK_DEBUG_REPORT_OBJECT_TYPE_(.*?)(_EXT)?$' dbg_map = {to_key(dbg_re, dbg) : dbg for dbg in self.debug_report_object_types} dbg_default = 'VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT' for object_type in type_list: diff --git a/scripts/known_good.json b/scripts/known_good.json index 6354dbd513ba25ff73f68edc27b923477c696369..7bb67421892c4926f42d74f6fcd7ed9e2103e120 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -2,11 +2,12 @@ "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.231" + "commit": "v1.3.275" }, { "name": "googletest", @@ -15,7 +16,7 @@ "build_dir": "googletest", "install_dir": "googletest", "build_step": "skip", - "commit": "release-1.11.0", + "commit": "v1.14.0", "optional": [ "tests" ] @@ -41,4 +42,4 @@ "googletest": "GOOGLETEST_INSTALL_DIR", "detours": "DETOURS_INSTALL_DIR" } -} \ No newline at end of file +} diff --git a/scripts/loader_extension_generator.py b/scripts/loader_extension_generator.py index 623133048017da9bae7b765a16b265c2e4a518e2..4040a9ba0c31b7fae3daddf22464ac272053e63e 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. @@ -78,6 +80,11 @@ DEVICE_CMDS_NEED_TERM = ['vkGetDeviceProcAddr', 'vkCmdInsertDebugUtilsLabelEXT', 'vkGetDeviceGroupSurfacePresentModes2EXT'] +DEVICE_CMDS_MUST_USE_TRAMP = ['vkSetDebugUtilsObjectNameEXT', + 'vkSetDebugUtilsObjectTagEXT', + 'vkDebugMarkerSetObjectNameEXT', + 'vkDebugMarkerSetObjectTagEXT'] + # These are the aliased functions that use the same terminator for both extension and core versions # Generally, this is only applies to physical device level functions in instance extensions SHARED_ALIASES = { @@ -99,6 +106,16 @@ PRE_INSTANCE_FUNCTIONS = ['vkEnumerateInstanceExtensionProperties', 'vkEnumerateInstanceLayerProperties', 'vkEnumerateInstanceVersion'] +# +# API Version +class APIVersion: + def __init__(self, token, apiname = 'Vulkan', supported = True): + self.token = token + self.constant = token.replace('_VERSION_', '_API_VERSION_') + self.number = token[token.find('_VERSION_') + len('_VERSION_'):].replace('_', '.') + self.name = f'{apiname} {self.number}' + self.supported = supported + # # LoaderExtensionGeneratorOptions - subclass of GeneratorOptions. class LoaderExtensionGeneratorOptions(GeneratorOptions): @@ -190,6 +207,8 @@ class LoaderExtensionOutputGenerator(OutputGenerator): 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' @@ -209,6 +228,8 @@ class LoaderExtensionOutputGenerator(OutputGenerator): preamble = '' + preamble += '// clang-format off\n' + if self.genOpts.filename == 'vk_loader_extensions.h': preamble += '#pragma once\n' @@ -227,7 +248,9 @@ class LoaderExtensionOutputGenerator(OutputGenerator): elif self.genOpts.filename == 'vk_layer_dispatch_table.h': preamble += '#pragma once\n' preamble += '\n' + preamble += '#if !defined(PFN_GetPhysicalDeviceProcAddr)\n' preamble += 'typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);\n' + preamble += '#endif\n' write(copyright, file=self.outFile) write(preamble, file=self.outFile) @@ -242,11 +265,14 @@ class LoaderExtensionOutputGenerator(OutputGenerator): file_data += self.OutputLoaderTerminators() file_data += self.OutputIcdDispatchTable() file_data += self.OutputIcdExtensionEnableUnion() + file_data += self.OutputDeviceFunctionTerminatorDispatchTable() elif self.genOpts.filename == 'vk_loader_extensions.c': file_data += self.OutputUtilitiesInSource() file_data += self.OutputIcdDispatchTableInit() file_data += self.OutputLoaderDispatchTables() + file_data += self.InitDeviceFunctionTerminatorDispatchTable() + file_data += self.OutputDeviceFunctionTrampolinePrototypes() file_data += self.OutputLoaderLookupFunc() file_data += self.CreateTrampTermFuncs() file_data += self.InstExtensionGPA() @@ -259,6 +285,8 @@ class LoaderExtensionOutputGenerator(OutputGenerator): file_data += self.OutputLayerInstanceDispatchTable() file_data += self.OutputLayerDeviceDispatchTable() + file_data += '// clang-format on' + write(file_data, file=self.outFile); # Finish processing in superclass @@ -326,6 +354,26 @@ class LoaderExtensionOutputGenerator(OutputGenerator): result = str(result).replace('::', '->') return result + # + # Returns an APIVersion object corresponding to the specified version token or None + def getAPIVersion(self, token): + if self.genOpts.apiname == 'vulkansc': + if token 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 + token = 'VKSC_VERSION_1_0' + + if token.startswith('VKSC_VERSION_'): + return APIVersion(token, 'Vulkan SC', True) + elif token.startswith('VK_VERSION_'): + # Unsupported Vulkan version + return APIVersion(token, 'Vulkan', False) + else: + return None + + if token.startswith('VK_VERSION_'): + return APIVersion(token) + return None + # # 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): @@ -338,8 +386,8 @@ class LoaderExtensionOutputGenerator(OutputGenerator): require = None if name == 'vkGetDeviceGroupSurfacePresentModes2EXT': require_node = self.registry.tree.find("./extensions/extension[@name='{}']/require/command[@name='{}']/..".format(extension_name, name)) - if 'extension' in require_node.attrib: - require = require_node.attrib['extension'] + if 'depends' in require_node.attrib: + require = require_node.attrib['depends'] cmd_params = [] @@ -360,12 +408,17 @@ class LoaderExtensionOutputGenerator(OutputGenerator): cmd_params.append(self.CommandParam(type=param_type, name=param_name, cdecl=param_cdecl)) + version = self.getAPIVersion(extension_name) + if version and not version.supported: + # Skip commands in unsupported versions + 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 - if 'VK_VERSION_' in extension_name: + if version: self.core_commands.append( - self.CommandData(name=name, ext_name=extension_name, + self.CommandData(name=name, ext_name=version.token, ext_type='device', require=require, protect=self.featureExtraProtect, @@ -387,9 +440,9 @@ class LoaderExtensionOutputGenerator(OutputGenerator): else: # 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 - if 'VK_VERSION_' in extension_name: + if version: self.core_commands.append( - self.CommandData(name=name, ext_name=extension_name, + self.CommandData(name=name, ext_name=version.token, ext_type='instance', require=require, protect=self.featureExtraProtect, @@ -445,7 +498,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): protos += '// Extension interception for vkGetDeviceProcAddr function, so we can return\n' protos += '// an appropriate terminator if this is one of those few device commands requiring\n' protos += '// a terminator.\n' - protos += 'PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *dev, const char *pName);\n' + protos += 'PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *dev, const char *name, bool* found_name);\n' protos += '\n' protos += '// Dispatch table properly filled in with appropriate terminators for the\n' protos += '// supported extensions.\n' @@ -454,8 +507,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): protos += '// Array of extension strings for instance extensions we support.\n' protos += 'extern const char *const LOADER_INSTANCE_EXTENSIONS[];\n' protos += '\n' - protos += 'VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_term, VkInstance inst,\n' - protos += ' const PFN_vkGetInstanceProcAddr fp_gipa);\n' + protos += 'VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_instance* inst, struct loader_icd_term *icd_term);\n' protos += '\n' protos += '// Init Device function pointer dispatch table with core commands\n' protos += 'VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa,\n' @@ -477,7 +529,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): protos += ' VkInstance inst);\n' protos += '\n' protos += '// Device command lookup function\n' - protos += 'VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name);\n' + protos += 'VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name, bool* name_found);\n' protos += '\n' protos += '// Instance command lookup function\n' protos += 'VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name,\n' @@ -523,12 +575,13 @@ class LoaderExtensionOutputGenerator(OutputGenerator): commands = self.ext_commands for cur_cmd in commands: + version = self.getAPIVersion(cur_cmd.ext_name) is_inst_handle_type = cur_cmd.name in ADD_INST_CMDS or cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice' if is_inst_handle_type: 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:] + if version: + table += '\n // ---- Core %s commands\n' % version.name else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -537,7 +590,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): base_name = cur_cmd.name[2:] if cur_cmd.protect is not None: - table += '#ifdef %s\n' % cur_cmd.protect + table += '#if defined(%s)\n' % cur_cmd.protect table += ' PFN_%s %s;\n' % (cur_cmd.name, base_name) @@ -566,12 +619,13 @@ class LoaderExtensionOutputGenerator(OutputGenerator): commands = self.ext_commands for cur_cmd in commands: + version = self.getAPIVersion(cur_cmd.ext_name) is_inst_handle_type = cur_cmd.name in ADD_INST_CMDS or cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice' if not is_inst_handle_type: 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:] + if version: + table += '\n // ---- Core %s commands\n' % version.name else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -580,7 +634,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): base_name = cur_cmd.name[2:] if cur_cmd.protect is not None: - table += '#ifdef %s\n' % cur_cmd.protect + table += '#if defined(%s)\n' % cur_cmd.protect table += ' PFN_%s %s;\n' % (cur_cmd.name, base_name) @@ -590,6 +644,12 @@ class LoaderExtensionOutputGenerator(OutputGenerator): table += '} VkLayerDispatchTable;\n\n' return table + # + # Common code between the dispatch table struct and the function filling out said struct + def ShouldPrintInIcdDispatchTable(self, cur_cmd, skip_list): + return cur_cmd.name == 'vkGetDeviceProcAddr' or \ + (cur_cmd.handle_type not in ['VkDevice', 'VkCommandBuffer', 'VkQueue'] and cur_cmd.name not in skip_list) + # # Create a dispatch table from the appropriate list and return it as a string def OutputIcdDispatchTable(self): @@ -597,6 +657,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator): table = '' cur_extension_name = '' + skip_commands = ['vkGetInstanceProcAddr', + 'vkEnumerateDeviceLayerProperties', + ] + table += '// ICD function pointer dispatch table\n' table += 'struct loader_icd_term_dispatch {\n' @@ -607,13 +671,11 @@ class LoaderExtensionOutputGenerator(OutputGenerator): commands = self.ext_commands for cur_cmd in commands: - is_inst_handle_type = cur_cmd.name in ADD_INST_CMDS or cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice' - if ((is_inst_handle_type or cur_cmd.name in DEVICE_CMDS_NEED_TERM) and - (cur_cmd.name != 'vkGetInstanceProcAddr' and cur_cmd.name != 'vkEnumerateDeviceLayerProperties')): - + version = self.getAPIVersion(cur_cmd.ext_name) + if (self.ShouldPrintInIcdDispatchTable(cur_cmd, skip_commands)): 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:] + if version: + table += '\n // ---- Core %s commands\n' % version.name else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -622,7 +684,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): base_name = cur_cmd.name[2:] if cur_cmd.protect is not None: - table += '#ifdef %s\n' % cur_cmd.protect + table += '#if defined(%s)\n' % cur_cmd.protect table += ' PFN_%s %s;\n' % (cur_cmd.name, base_name) @@ -639,20 +701,23 @@ class LoaderExtensionOutputGenerator(OutputGenerator): cur_extension_name = '' table = '' - table += 'VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_term, VkInstance inst,\n' - table += ' const PFN_vkGetInstanceProcAddr fp_gipa) {\n' + table += 'VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_instance* inst, struct loader_icd_term *icd_term) {\n' + table += ' const PFN_vkGetInstanceProcAddr fp_gipa = icd_term->scanned_icd->GetInstanceProcAddr;\n' + table += '\n' + table += '#define LOOKUP_GIPA(func) icd_term->dispatch.func = (PFN_vk##func)fp_gipa(icd_term->instance, "vk" #func);\n' table += '\n' - table += '#define LOOKUP_GIPA(func, required) \\\n' - table += ' do { \\\n' - table += ' icd_term->dispatch.func = (PFN_vk##func)fp_gipa(inst, "vk" #func); \\\n' - table += ' if (!icd_term->dispatch.func && required) { \\\n' - table += ' loader_log((struct loader_instance *)inst, VULKAN_LOADER_WARN_BIT, 0, \\\n' - table += ' loader_platform_get_proc_address_error("vk" #func)); \\\n' - table += ' return false; \\\n' - table += ' } \\\n' + table += '#define LOOKUP_REQUIRED_GIPA(func) \\\n' + table += ' do { \\\n' + table += ' LOOKUP_GIPA(func); \\\n' + table += ' if (!icd_term->dispatch.func) { \\\n' + table += ' loader_log(inst, VULKAN_LOADER_WARN_BIT, 0, "Unable to load %s from ICD %s",\\\n' + table += ' "vk"#func, icd_term->scanned_icd->lib_name); \\\n' + table += ' return false; \\\n' + table += ' } \\\n' table += ' } while (0)\n' table += '\n' + skip_gipa_commands = ['vkGetInstanceProcAddr', 'vkEnumerateDeviceLayerProperties', 'vkCreateInstance', @@ -669,13 +734,13 @@ class LoaderExtensionOutputGenerator(OutputGenerator): required = False for cur_cmd in commands: - is_inst_handle_type = cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice' - if ((is_inst_handle_type or cur_cmd.name in DEVICE_CMDS_NEED_TERM) and (cur_cmd.name not in skip_gipa_commands)): + version = self.getAPIVersion(cur_cmd.ext_name) + if (self.ShouldPrintInIcdDispatchTable(cur_cmd, skip_gipa_commands)): if cur_cmd.ext_name != cur_extension_name: - 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' + if version: + table += '\n // ---- Core %s\n' % version.name + required = version.number == '1.0' else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name required = False @@ -685,16 +750,19 @@ class LoaderExtensionOutputGenerator(OutputGenerator): base_name = cur_cmd.name[2:] if cur_cmd.protect is not None: - table += '#ifdef %s\n' % cur_cmd.protect - - # 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 - table += ' LOOKUP_GIPA(%s, %s);\n' % (base_name, 'true' if required else 'false') + table += '#if defined(%s)\n' % cur_cmd.protect + if required: + # 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 + table += f' LOOKUP_REQUIRED_GIPA({base_name});\n' + else: + table += f' LOOKUP_GIPA({base_name});\n' if cur_cmd.protect is not None: table += '#endif // %s\n' % cur_cmd.protect table += '\n' + table += '#undef LOOKUP_REQUIRED_GIPA\n' table += '#undef LOOKUP_GIPA\n' table += '\n' table += ' return true;\n' @@ -709,7 +777,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): 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 (self.getAPIVersion(ext.name) or ext.name in WSI_EXT_NAMES or ext.type == 'device' or ext.num_commands == 0): continue @@ -735,7 +803,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): mod_string = mod_string.replace(cur_cmd.name[2:] + '(\n', cur_cmd.name[2:] + '(\n const Vk' + cur_cmd.name[2:] + 'Chain* chain,\n') if (cur_cmd.protect is not None): - terminators += '#ifdef %s\n' % cur_cmd.protect + terminators += '#if defined(%s)\n' % cur_cmd.protect terminators += mod_string terminators += '\n' @@ -765,7 +833,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): tables += 'VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa,\n' tables += ' VkDevice dev) {\n' tables += ' VkLayerDispatchTable *table = &dev_table->core_dispatch;\n' - tables += ' table->magic = DEVICE_DISP_TABLE_MAGIC_NUMBER;\n' + tables += ' if (table->magic != DEVICE_DISP_TABLE_MAGIC_NUMBER) { abort(); }\n' tables += ' for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) dev_table->ext_dispatch[i] = (PFN_vkDevExt)vkDevExtError;\n' elif x == 1: @@ -801,11 +869,12 @@ class LoaderExtensionOutputGenerator(OutputGenerator): tables += ' VkInstance inst) {\n' for cur_cmd in commands: + version = self.getAPIVersion(cur_cmd.ext_name) is_inst_handle_type = cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice' if ((cur_type == 'instance' and is_inst_handle_type) or (cur_type == 'device' and not is_inst_handle_type)): 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:] + if version: + tables += '\n // ---- Core %s commands\n' % version.name else: tables += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -821,7 +890,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): continue if cur_cmd.protect is not None: - tables += '#ifdef %s\n' % cur_cmd.protect + tables += '#if defined(%s)\n' % cur_cmd.protect # If we're looking for the proc we are passing in, just point the table to it. This fixes the issue where # a layer overrides the function name for the loader. @@ -859,10 +928,18 @@ class LoaderExtensionOutputGenerator(OutputGenerator): cur_type = 'device' tables += '// Device command lookup function\n' - tables += 'VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name) {\n' - tables += ' if (!name || name[0] != \'v\' || name[1] != \'k\') return NULL;\n' + tables += 'VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name, bool* found_name) {\n' + tables += ' if (!name || name[0] != \'v\' || name[1] != \'k\') {\n' + tables += ' *found_name = false;\n' + tables += ' return NULL;\n' + tables += ' }\n' tables += '\n' tables += ' name += 2;\n' + tables += ' *found_name = true;\n' + tables += ' struct loader_device* dev = (struct loader_device *)table;\n' + tables += ' const struct loader_instance* inst = dev->phys_dev_term->this_icd_term->this_instance;\n' + tables += ' uint32_t api_version = VK_MAKE_API_VERSION(0, inst->app_api_version.major, inst->app_api_version.minor, inst->app_api_version.patch);\n' + tables += '\n' else: cur_type = 'instance' @@ -877,6 +954,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): tables += ' *found_name = true;\n' tables += ' name += 2;\n' + for y in range(0, 2): if y == 0: commands = self.core_commands @@ -884,14 +962,18 @@ class LoaderExtensionOutputGenerator(OutputGenerator): commands = self.ext_commands for cur_cmd in commands: + version = self.getAPIVersion(cur_cmd.ext_name) is_inst_handle_type = cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice' if ((cur_type == 'instance' and is_inst_handle_type) or (cur_type == 'device' and not is_inst_handle_type)): - 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:] + if version: + tables += '\n // ---- Core %s commands\n' % version.name + if cur_type == 'device': + version_check = f' if (dev->should_ignore_device_commands_from_newer_version && api_version < {version.constant}) return NULL;\n' else: + tables += '\n // ---- %s extension commands\n' % cur_cmd.ext_name + version_check = '' cur_extension_name = cur_cmd.ext_name # Remove 'vk' from proto name @@ -904,22 +986,32 @@ class LoaderExtensionOutputGenerator(OutputGenerator): continue if cur_cmd.protect is not None: - tables += '#ifdef %s\n' % cur_cmd.protect + tables += '#if defined(%s)\n' % cur_cmd.protect + + tables += f' if (!strcmp(name, "{base_name}")) ' + if cur_cmd.name in DEVICE_CMDS_MUST_USE_TRAMP: + if version_check != '': + tables += f'{{\n{version_check} return dev->layer_extensions.{cur_cmd.ext_name[3:].lower()}_enabled ? (void *){base_name} : NULL;\n }}\n' + else: + tables += f'return dev->layer_extensions.{cur_cmd.ext_name[3:].lower()}_enabled ? (void *){base_name} : NULL;\n' - tables += ' if (!strcmp(name, "%s")) return (void *)table->%s;\n' % (base_name, base_name) + else: + if version_check != '': + tables += f'{{\n{version_check} return (void *)table->{base_name};\n }}\n' + else: + tables += f'return (void *)table->{base_name};\n' if cur_cmd.protect is not None: tables += '#endif // %s\n' % cur_cmd.protect tables += '\n' - if x == 1: - tables += ' *found_name = false;\n' + tables += ' *found_name = false;\n' tables += ' return NULL;\n' tables += '}\n\n' return tables # - # Create the appropriate trampoline (and possibly terminator) functinos + # Create the appropriate trampoline (and possibly terminator) functions def CreateTrampTermFuncs(self): entries = [] funcs = '' @@ -960,15 +1052,16 @@ class LoaderExtensionOutputGenerator(OutputGenerator): ext_cmd.name in manual_ext_commands): continue + version = self.getAPIVersion(ext_cmd.ext_name) 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:] + if version: + funcs += '\n// ---- Core %s trampoline/terminators\n\n' % version.name else: funcs += '\n// ---- %s extension trampoline/terminators\n\n' % ext_cmd.ext_name cur_extension_name = ext_cmd.ext_name if ext_cmd.protect is not None: - funcs += '#ifdef %s\n' % ext_cmd.protect + funcs += '#if defined(%s)\n' % ext_cmd.protect func_header = ext_cmd.cdecl.replace(";", " {\n") tramp_header = func_header.replace("VKAPI_CALL vk", "VKAPI_CALL ") @@ -1034,7 +1127,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ' const VkLayerInstanceDispatchTable *disp;\n' funcs += ' VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(%s);\n' % (phys_dev_var_name) funcs += ' if (VK_NULL_HANDLE == unwrapped_phys_dev) {\n' - funcs += ' loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' + funcs += ' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' funcs += ' "%s: Invalid %s "\n' % (ext_cmd.name, phys_dev_var_name) funcs += ' "[VUID-%s-%s-parameter]");\n' % (ext_cmd.name, phys_dev_var_name) funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' @@ -1044,7 +1137,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ' struct loader_instance *inst = loader_get_instance(%s);\n' % (instance_var_name) funcs += ' if (NULL == inst) {\n' funcs += ' loader_log(\n' - funcs += ' NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' + funcs += ' NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' funcs += ' "%s: Invalid instance [VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.name, instance_var_name) funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' funcs += ' }\n' @@ -1054,7 +1147,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ext_cmd.params[0].name funcs += ');\n' funcs += ' if (NULL == disp) {\n' - funcs += ' loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' + funcs += ' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' funcs += ' "%s: Invalid %s "\n' % (ext_cmd.name, ext_cmd.params[0].name) funcs += ' "[VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.params[0].name) funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' @@ -1068,6 +1161,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->object;\n' funcs += ' local_name_info.object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n' funcs += ' }\n' + funcs += ' if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) {\n' + funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pNameInfo->object;\n' + funcs += ' local_name_info.object = (uint64_t)(uintptr_t)instance->instance;\n' + funcs += ' }\n' elif 'DebugMarkerSetObjectTag' in ext_cmd.name: funcs += ' VkDebugMarkerObjectTagInfoEXT local_tag_info;\n' funcs += ' memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugMarkerObjectTagInfoEXT));\n' @@ -1076,6 +1173,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->object;\n' funcs += ' local_tag_info.object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n' funcs += ' }\n' + funcs += ' if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) {\n' + funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pTagInfo->object;\n' + funcs += ' local_tag_info.object = (uint64_t)(uintptr_t)instance->instance;\n' + funcs += ' }\n' elif 'SetDebugUtilsObjectName' in ext_cmd.name: funcs += ' VkDebugUtilsObjectNameInfoEXT local_name_info;\n' funcs += ' memcpy(&local_name_info, pNameInfo, sizeof(VkDebugUtilsObjectNameInfoEXT));\n' @@ -1084,6 +1185,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->objectHandle;\n' funcs += ' local_name_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n' funcs += ' }\n' + funcs += ' if (pNameInfo->objectType == VK_OBJECT_TYPE_INSTANCE) {\n' + funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pNameInfo->objectHandle;\n' + funcs += ' local_name_info.objectHandle = (uint64_t)(uintptr_t)instance->instance;\n' + funcs += ' }\n' elif 'SetDebugUtilsObjectTag' in ext_cmd.name: funcs += ' VkDebugUtilsObjectTagInfoEXT local_tag_info;\n' funcs += ' memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugUtilsObjectTagInfoEXT));\n' @@ -1092,6 +1197,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->objectHandle;\n' funcs += ' local_tag_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n' funcs += ' }\n' + funcs += ' if (pTagInfo->objectType == VK_OBJECT_TYPE_INSTANCE) {\n' + funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pTagInfo->objectHandle;\n' + funcs += ' local_tag_info.objectHandle = (uint64_t)(uintptr_t)instance->instance;\n' + funcs += ' }\n' if ext_cmd.ext_name in NULL_CHECK_EXT_NAMES: funcs += ' if (disp->' + base_name + ' != NULL) {\n' @@ -1132,7 +1241,8 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ' if (NULL == icd_term->dispatch.' funcs += base_name funcs += ') {\n' - funcs += ' loader_log(icd_term->this_instance, VULKAN_LOADER_ERROR_BIT, 0,\n' + fatal_error_bit = '' if ext_cmd.ext_type =='instance' and has_return_type else 'VULKAN_LOADER_FATAL_ERROR_BIT | ' + funcs += f' loader_log(icd_term->this_instance, {fatal_error_bit}VULKAN_LOADER_ERROR_BIT, 0,\n' funcs += ' "ICD associated with VkPhysicalDevice does not support ' funcs += base_name funcs += '");\n' @@ -1140,7 +1250,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): # If this is an instance function taking a physical device (i.e. pre Vulkan 1.1), we need to behave and not crash so return an # error here. if ext_cmd.ext_type =='instance' and has_return_type: - funcs += ' return VK_ERROR_INITIALIZATION_FAILED;\n' + funcs += ' return VK_ERROR_EXTENSION_NOT_PRESENT;\n' else: funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' funcs += ' }\n' @@ -1195,127 +1305,68 @@ class LoaderExtensionOutputGenerator(OutputGenerator): count += 1 funcs += ');\n' - elif has_surface == 1 and not (ext_cmd.handle_type == 'VkPhysicalDevice' or ext_cmd.handle_type == 'VkInstance'): - funcs += ' uint32_t icd_index = 0;\n' - funcs += ' struct loader_device *dev;\n' - funcs += ' struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index);\n' - funcs += ' if (NULL != icd_term && NULL != icd_term->dispatch.%s) {\n' % base_name - funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)%s;\n' % (surface_var_name) - funcs += ' if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) {\n' - funcs += ' %sicd_term->dispatch.%s(' % (return_prefix, base_name) - count = 0 - for param in ext_cmd.params: - if count != 0: - funcs += ', ' - - if param.type == 'VkSurfaceKHR': - funcs += 'icd_surface->real_icd_surfaces[icd_index]' - else: - funcs += param.name - - count += 1 - funcs += ');\n' - if not has_return_type: - funcs += ' return;\n' - funcs += ' }\n' - funcs += ' %sicd_term->dispatch.%s(' % (return_prefix, base_name) - count = 0 - for param in ext_cmd.params: - if count != 0: - funcs += ', ' - funcs += param.name - count += 1 - funcs += ');\n' - funcs += ' }\n' - if has_return_type: - funcs += ' return VK_SUCCESS;\n' elif ext_cmd.handle_type == 'VkInstance': funcs += ' struct loader_instance *inst = loader_get_instance(%s);\n' % (instance_var_name) funcs += ' if (NULL == inst) {\n' funcs += ' loader_log(\n' - funcs += ' NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' + funcs += ' NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' funcs += ' "%s: Invalid instance [VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.name, instance_var_name) funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' funcs += ' }\n' funcs += '#error("Not implemented. Likely needs to be manually generated!");\n' - elif 'DebugMarkerSetObject' in ext_cmd.name or 'SetDebugUtilsObject' in ext_cmd.name or 'DebugUtilsLabel' in ext_cmd.name: - funcs += ' uint32_t icd_index = 0;\n' - funcs += ' struct loader_device *dev;\n' - funcs += ' struct loader_icd_term *icd_term = loader_get_icd_and_device(%s, &dev, &icd_index);\n' % (ext_cmd.params[0].name) - funcs += ' if (NULL != icd_term && NULL != icd_term->dispatch.' - funcs += base_name - funcs += ') {\n' - if 'DebugMarkerSetObjectName' in ext_cmd.name: - funcs += ' VkDebugMarkerObjectNameInfoEXT local_name_info;\n' - funcs += ' memcpy(&local_name_info, pNameInfo, sizeof(VkDebugMarkerObjectNameInfoEXT));\n' - funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n' - funcs += ' if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {\n' - funcs += ' struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pNameInfo->object;\n' - funcs += ' local_name_info.object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;\n' - funcs += ' // 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.\n' - funcs += ' } else if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) {\n' - funcs += ' if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) {\n' - funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pNameInfo->object;\n' - funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n' - funcs += ' local_name_info.object = (uint64_t)icd_surface->real_icd_surfaces[icd_index];\n' - funcs += ' }\n' - funcs += ' }\n' - funcs += ' }\n' - elif 'DebugMarkerSetObjectTag' in ext_cmd.name: - funcs += ' VkDebugMarkerObjectTagInfoEXT local_tag_info;\n' - funcs += ' memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugMarkerObjectTagInfoEXT));\n' - funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n' - funcs += ' if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {\n' - funcs += ' struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pTagInfo->object;\n' - funcs += ' local_tag_info.object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;\n' - funcs += ' // 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.\n' - funcs += ' } else if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) {\n' - funcs += ' if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) {\n' - funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pTagInfo->object;\n' - funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n' - funcs += ' local_tag_info.object = (uint64_t)icd_surface->real_icd_surfaces[icd_index];\n' - funcs += ' }\n' - funcs += ' }\n' - funcs += ' }\n' - elif 'SetDebugUtilsObjectName' in ext_cmd.name: - funcs += ' VkDebugUtilsObjectNameInfoEXT local_name_info;\n' - funcs += ' memcpy(&local_name_info, pNameInfo, sizeof(VkDebugUtilsObjectNameInfoEXT));\n' - funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n' - funcs += ' if (pNameInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) {\n' - funcs += ' struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pNameInfo->objectHandle;\n' - funcs += ' local_name_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;\n' - funcs += ' // 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.\n' - funcs += ' } else if (pNameInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) {\n' - funcs += ' if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) {\n' - funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pNameInfo->objectHandle;\n' - funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n' - funcs += ' local_name_info.objectHandle = (uint64_t)icd_surface->real_icd_surfaces[icd_index];\n' - funcs += ' }\n' - funcs += ' }\n' - funcs += ' }\n' - elif 'SetDebugUtilsObjectTag' in ext_cmd.name: - funcs += ' VkDebugUtilsObjectTagInfoEXT local_tag_info;\n' - funcs += ' memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugUtilsObjectTagInfoEXT));\n' - funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n' - funcs += ' if (pTagInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) {\n' - funcs += ' struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pTagInfo->objectHandle;\n' - funcs += ' local_tag_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;\n' - funcs += ' // 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.\n' - funcs += ' } else if (pTagInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) {\n' - funcs += ' if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) {\n' - funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pTagInfo->objectHandle;\n' - funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n' - funcs += ' local_tag_info.objectHandle = (uint64_t)icd_surface->real_icd_surfaces[icd_index];\n' - funcs += ' }\n' + elif ext_cmd.ext_name in ['VK_EXT_debug_utils', 'VK_EXT_debug_marker']: + if ext_cmd.name in ['vkDebugMarkerSetObjectNameEXT', 'vkDebugMarkerSetObjectTagEXT', 'vkSetDebugUtilsObjectNameEXT' , 'vkSetDebugUtilsObjectTagEXT']: + + is_debug_utils = ext_cmd.ext_name == "VK_EXT_debug_utils" + debug_struct_name = ext_cmd.params[1].name + local_struct = 'local_name_info' if 'ObjectName' in ext_cmd.name else 'local_tag_info' + member_name = 'objectHandle' if is_debug_utils else 'object' + phys_dev_check = 'VK_OBJECT_TYPE_PHYSICAL_DEVICE' if is_debug_utils else 'VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT' + surf_check = 'VK_OBJECT_TYPE_SURFACE_KHR' if is_debug_utils else 'VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT' + inst_check = 'VK_OBJECT_TYPE_INSTANCE' if is_debug_utils else 'VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT' + funcs += ' uint32_t icd_index = 0;\n' + funcs += ' struct loader_device *dev;\n' + funcs += f' struct loader_icd_term *icd_term = loader_get_icd_and_device({ ext_cmd.params[0].name}, &dev, &icd_index);\n' + funcs += f' if (NULL == icd_term || NULL == dev) {{\n' + funcs += f' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "{ext_cmd.name[2:]}: Invalid device handle");\n' + funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' + funcs += ' }\n' + funcs += f' { ext_cmd.params[1].type} {local_struct};\n' + funcs += f' memcpy(&{local_struct}, {debug_struct_name}, sizeof({ ext_cmd.params[1].type}));\n' + funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n' + funcs += f' if ({debug_struct_name}->objectType == {phys_dev_check}) {{\n' + funcs += f' struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t){debug_struct_name}->{member_name};\n' + funcs += f' {local_struct}.{member_name} = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;\n' + funcs += ' // 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.\n' + funcs += f' }} else if ({debug_struct_name}->objectType == {surf_check}) {{\n' + funcs += ' if (NULL != dev && NULL != dev->loader_dispatch.core_dispatch.CreateSwapchainKHR) {\n' + funcs += f' VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t){debug_struct_name}->{member_name};\n' + funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n' + funcs += f' {local_struct}.{member_name} = (uint64_t)icd_surface->real_icd_surfaces[icd_index];\n' funcs += ' }\n' funcs += ' }\n' - funcs += ' ' + funcs += ' // If this is an instance we have to replace it with the proper one for the next call.\n' + funcs += f' }} else if ({debug_struct_name}->objectType == {inst_check}) {{\n' + funcs += f' {local_struct}.{member_name} = (uint64_t)(uintptr_t)icd_term->instance;\n' + funcs += ' }\n' + funcs += ' // Exit early if the driver does not support the function - this can happen as a layer or the loader itself supports\n' + funcs += ' // debug utils but the driver does not.\n' + funcs += f' if (NULL == dev->loader_dispatch.extension_terminator_dispatch.{ext_cmd.name[2:]})\n return VK_SUCCESS;\n' + dispatch = 'dev->loader_dispatch.' + else: + funcs += f' struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch({ext_cmd.params[0].name});\n' + funcs += f' if (NULL == dispatch_table) {{\n' + funcs += f' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "{ext_cmd.ext_name}: Invalid device handle");\n' + funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' + funcs += ' }\n' + funcs += ' // Only call down if the device supports the function\n' + funcs += f' if (NULL != dispatch_table->extension_terminator_dispatch.{base_name})\n ' + dispatch = 'dispatch_table->' + funcs += ' ' if has_return_type: funcs += 'return ' - funcs += 'icd_term->dispatch.' - funcs += base_name - funcs += '(' + funcs += f'{dispatch}extension_terminator_dispatch.{base_name}(' count = 0 for param in ext_cmd.params: if count != 0: @@ -1334,10 +1385,6 @@ class LoaderExtensionOutputGenerator(OutputGenerator): count += 1 funcs += ');\n' - if has_return_type: - funcs += ' } else {\n' - funcs += ' return VK_SUCCESS;\n' - funcs += ' }\n' else: funcs += '#error("Unknown error path!");\n' @@ -1350,7 +1397,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): funcs += ext_cmd.params[0].name funcs += ');\n' funcs += ' if (NULL == disp) {\n' - funcs += ' loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' + funcs += ' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n' funcs += ' "%s: Invalid %s "\n' % (ext_cmd.name, ext_cmd.params[0].name) funcs += ' "[VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.params[0].name) funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n' @@ -1358,6 +1405,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): if ext_cmd.ext_name in NULL_CHECK_EXT_NAMES: funcs += ' if (disp->' + base_name + ' != NULL) {\n' + funcs += ' ' funcs += return_prefix funcs += 'disp->' funcs += base_name @@ -1394,7 +1442,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): gpa_func += ' *addr = NULL;\n\n' for cur_cmd in self.ext_commands: - if ('VK_VERSION_' in cur_cmd.ext_name or + if (self.getAPIVersion(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 ): @@ -1405,7 +1453,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): cur_extension_name = cur_cmd.ext_name if cur_cmd.protect is not None: - gpa_func += '#ifdef %s\n' % cur_cmd.protect + gpa_func += '#if defined(%s)\n' % cur_cmd.protect #base_name = cur_cmd.name[2:] base_name = SHARED_ALIASES[cur_cmd.name] if cur_cmd.name in SHARED_ALIASES else cur_cmd.name[2:] @@ -1446,7 +1494,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): 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 (self.getAPIVersion(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 @@ -1456,7 +1504,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): cur_extension_name = ext.name if ext.protect is not None: - create_func += '#ifdef %s\n' % ext.protect + create_func += '#if defined(%s)\n' % ext.protect if count == 0: create_func += ' if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], ' else: @@ -1481,60 +1529,144 @@ class LoaderExtensionOutputGenerator(OutputGenerator): # extension entrypoints and return it as a string def DeviceExtensionGetTerminator(self): term_func = '' - cur_extension_name = '' term_func += '// Some device commands still need a terminator because the loader needs to unwrap something about them.\n' term_func += '// In many cases, the item needing unwrapping is a VkPhysicalDevice or VkSurfaceKHR object. But there may be other items\n' term_func += '// in the future.\n' - term_func += 'PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *dev, const char *pName) {\n' - term_func += ' PFN_vkVoidFunction addr = NULL;\n' + term_func += 'PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *dev, const char *name, bool* found_name) {\n' + term_func += ''' *found_name = false; + if (!name || name[0] != 'v' || name[1] != 'k') { + return NULL; + } + name += 2; +''' + last_protect = None + last_ext = None + for ext_cmd in self.ext_commands: + version = self.getAPIVersion(ext_cmd.ext_name) + if ext_cmd.name in DEVICE_CMDS_NEED_TERM: + if version: + term_func += f' // ---- Core {version.name} commands\n' + else: + last_protect = ext_cmd.protect + if ext_cmd.protect is not None: + term_func += f'#if defined({ext_cmd.protect})\n' + if (last_ext != ext_cmd.ext_name): + term_func += f' // ---- {ext_cmd.ext_name} extension commands\n' + last_ext = ext_cmd.ext_name + + term_func += f' if (!strcmp(name, "{ext_cmd.name[2:]}")) {{\n' + term_func += f' *found_name = true;\n' + if ext_cmd.require: + term_func += f' return dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled && dev->driver_extensions.{ext_cmd.require[3:].lower()}_enabled ?\n' + else: + term_func += f' return dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled ?\n' + term_func += f' (PFN_vkVoidFunction)terminator_{(ext_cmd.name[2:])} : NULL;\n' + term_func += f' }}\n' + + if last_protect is not None: + term_func += '#endif // %s\n' % last_protect + + term_func += ' return NULL;\n' + term_func += '}\n\n' + + return term_func + + # + # Create a dispatch table solely for device functions which have custom terminators + def OutputDeviceFunctionTerminatorDispatchTable(self): + term_func = '' + term_func += '// Functions that required a terminator need to have a separate dispatch table which contains their corresponding\n' + term_func += '// device function. This is used in the terminators themselves.\n' + term_func += 'struct loader_device_terminator_dispatch {\n' - count = 0 - is_extension = False last_protect = None + last_ext = None for ext_cmd in self.ext_commands: + version = self.getAPIVersion(ext_cmd.ext_name) if ext_cmd.name in DEVICE_CMDS_NEED_TERM: - if ext_cmd.ext_name != cur_extension_name: - if count > 0: - count = 0; - term_func += ' }\n' - if is_extension: - term_func += ' }\n' - is_extension = False - - if 'VK_VERSION_' in ext_cmd.ext_name: - term_func += '\n // ---- Core %s commands\n' % ext_cmd.ext_name[11:] - else: - last_protect = ext_cmd.protect - if ext_cmd.protect is not None: - term_func += '#ifdef %s\n' % ext_cmd.protect - term_func += '\n // ---- %s extension commands\n' % ext_cmd.ext_name - if ext_cmd.require: - term_func += ' if (dev->extensions.%s_enabled && dev->extensions.%s_enabled) {\n' % (ext_cmd.ext_name[3:].lower(), ext_cmd.require[3:].lower()) - else: - term_func += ' if (dev->extensions.%s_enabled) {\n' % ext_cmd.ext_name[3:].lower() - is_extension = True - cur_extension_name = ext_cmd.ext_name + if version: + term_func += f' // ---- Core {version.name} commands\n' + else: + last_protect = ext_cmd.protect + if ext_cmd.protect is not None: + term_func += f'#if defined({ext_cmd.protect})\n' + if (last_ext != ext_cmd.ext_name): + term_func += f' // ---- {ext_cmd.ext_name} extension commands\n' + last_ext = ext_cmd.ext_name + + term_func += f' PFN_{ext_cmd.name} {ext_cmd.name[2:]};\n' + + if last_protect is not None: + term_func += '#endif // %s\n' % last_protect + + term_func += '};\n\n' + + return term_func - if count == 0: - term_func += ' if' + def OutputDeviceFunctionTrampolinePrototypes(self): + tramp_protos = '' + tramp_protos += '// These are prototypes for functions that need their trampoline called in all circumstances.\n' + tramp_protos += '// They are used in loader_lookup_device_dispatch_table but are defined afterwards.\n' + last_protect = None + last_ext = None + for ext_cmd in self.ext_commands: + version = self.getAPIVersion(ext_cmd.ext_name) + if ext_cmd.name in DEVICE_CMDS_MUST_USE_TRAMP: + if version: + tramp_protos += f' // ---- Core {version.name} commands\n' else: - term_func += ' } else if' + last_protect = ext_cmd.protect + if ext_cmd.protect is not None: + tramp_protos += f'#if defined({ext_cmd.protect})\n' + if (last_ext != ext_cmd.ext_name): + tramp_protos += f' // ---- {ext_cmd.ext_name} extension commands\n' + last_ext = ext_cmd.ext_name - term_func += '(!strcmp(pName, "%s")) {\n' % (ext_cmd.name) - term_func += ' addr = (PFN_vkVoidFunction)terminator_%s;\n' % (ext_cmd.name[2:]) + tramp_protos += f'{ext_cmd.cdecl.replace("VKAPI_CALL vk", "VKAPI_CALL ")}\n' + if last_protect is not None: + tramp_protos += '#endif // %s\n' % last_protect + tramp_protos += '\n' + return tramp_protos - count += 1 + # + # Create code to initialize a dispatch table from the appropriate list of + # extension entrypoints and return it as a string + def InitDeviceFunctionTerminatorDispatchTable(self): + term_func = '' - if count > 0: - term_func += ' }\n' - if is_extension: - term_func += ' }\n' - if last_protect is not None: - term_func += '#endif // %s\n' % ext_cmd.protect + term_func += '// Functions that required a terminator need to have a separate dispatch table which contains their corresponding\n' + term_func += '// device function. This is used in the terminators themselves.\n' + term_func += 'void init_extension_device_proc_terminator_dispatch(struct loader_device *dev) {\n' + term_func += ' struct loader_device_terminator_dispatch* dispatch = &dev->loader_dispatch.extension_terminator_dispatch;\n' + term_func += ' PFN_vkGetDeviceProcAddr gpda = (PFN_vkGetDeviceProcAddr)dev->phys_dev_term->this_icd_term->dispatch.GetDeviceProcAddr;\n' + last_protect = None + last_ext = None + for ext_cmd in self.ext_commands: + version = self.getAPIVersion(ext_cmd.ext_name) + if ext_cmd.name in DEVICE_CMDS_NEED_TERM: + if version: + term_func += f' // ---- Core {version.name} commands\n' + else: + last_protect = ext_cmd.protect + if ext_cmd.protect is not None: + term_func += f'#if defined({ext_cmd.protect})\n' + if (last_ext != ext_cmd.ext_name): + term_func += f' // ---- {ext_cmd.ext_name} extension commands\n' + last_ext = ext_cmd.ext_name + + + if ext_cmd.require: + term_func += f' if (dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled && dev->driver_extensions.{ext_cmd.require[3:].lower()}_enabled)\n' + term_func += f' dispatch->{ext_cmd.name[2:]} = (PFN_{(ext_cmd.name)})gpda(dev->icd_device, "{(ext_cmd.name)}");\n' + else: + term_func += f' if (dev->driver_extensions.{ext_cmd.ext_name[3:].lower()}_enabled)\n' + term_func += f' dispatch->{ext_cmd.name[2:]} = (PFN_{(ext_cmd.name)})gpda(dev->icd_device, "{(ext_cmd.name)}");\n' + + if last_protect is not None: + term_func += '#endif // %s\n' % last_protect - term_func += ' return addr;\n' term_func += '}\n\n' return term_func @@ -1559,11 +1691,11 @@ class LoaderExtensionOutputGenerator(OutputGenerator): commands = self.ext_commands for cur_cmd in commands: - + version = self.getAPIVersion(cur_cmd.ext_name) if cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice': 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:] + if version: + table += '\n // ---- Core %s commands\n' % version.name else: table += '\n // ---- %s extension commands\n' % cur_cmd.ext_name cur_extension_name = cur_cmd.ext_name @@ -1579,7 +1711,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator): continue if cur_cmd.protect is not None: - table += '#ifdef %s\n' % cur_cmd.protect + table += '#if defined(%s)\n' % cur_cmd.protect if base_name == 'GetInstanceProcAddr': table += ' .%s = %s,\n' % (base_name, cur_cmd.name) @@ -1604,11 +1736,11 @@ class LoaderExtensionOutputGenerator(OutputGenerator): 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 self.getAPIVersion(ext.name): continue if ext.protect is not None: - table += '#ifdef %s\n' % ext.protect + table += '#if defined(%s)\n' % ext.protect table += ' ' table += ext.define + ',\n' diff --git a/scripts/loader_genvk.py b/scripts/loader_genvk.py index 5d79f4433a88f6e2b7d61476d0dc642e1ca887bf..1cdd6d88944198f092e7c28de6124818c4a34b51 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, @@ -239,30 +247,6 @@ def makeGenOpts(args): helper_file_type = 'object_types_header') ] - # Loader Generated Header Version Options for loader_generated_header_version.cmake - genOpts['loader_generated_header_version.cmake'] = [ - LoaderVersioningGenerator, - LoaderVersioningGeneratorOptions( - conventions = conventions, - filename = 'loader_generated_header_version.cmake', - directory = directory, - genpath = None, - apiname = 'vulkan', - profile = None, - versions = featuresPat, - emitversions = featuresPat, - defaultExtensions = 'vulkan', - addExtensions = addExtensionsPat, - removeExtensions = removeExtensionsPat, - emitExtensions = emitExtensionsPat, - prefixText = prefixStrings + vkPrefixStrings, - apicall = 'VKAPI_ATTR ', - apientry = 'VKAPI_CALL ', - apientryp = 'VKAPI_PTR *', - alignFuncParam = 48, - expandEnumerants = False) - ] - # Create an API generator and corresponding generator options based on # the requested target and command line options. # This is encapsulated in a function so it can be profiled and/or timed. @@ -286,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) @@ -310,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'], + 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=[], @@ -381,7 +370,6 @@ if __name__ == '__main__': from dispatch_table_helper_generator import DispatchTableHelperOutputGenerator, DispatchTableHelperOutputGeneratorOptions from helper_file_generator import HelperFileOutputGenerator, HelperFileOutputGeneratorOptions from loader_extension_generator import LoaderExtensionOutputGenerator, LoaderExtensionGeneratorOptions - from loader_versioning_generator import LoaderVersioningGenerator, LoaderVersioningGeneratorOptions # Temporary workaround for vkconventions python2 compatibility import abc; abc.ABC = abc.ABCMeta('ABC', (object,), {}) diff --git a/scripts/loader_versioning_generator.py b/scripts/loader_versioning_generator.py deleted file mode 100644 index 821cfbc917276f6d302f3894735d6704518d4299..0000000000000000000000000000000000000000 --- a/scripts/loader_versioning_generator.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/python3 -i -# -# Copyright (c) 2021 The Khronos Group Inc. -# Copyright (c) 2021 Valve Corporation -# Copyright (c) 2021 LunarG, Inc. -# Copyright (c) 2021 Google Inc. - -# 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: Charles Giessen - -import os,re,sys -import xml.etree.ElementTree as etree -from generator import * -from collections import namedtuple -from common_codegen import * - -# -# LoaderVersioningGeneratorOptions - subclass of GeneratorOptions. -class LoaderVersioningGeneratorOptions(GeneratorOptions): - def __init__(self, - conventions = None, - filename = None, - directory = '.', - genpath = None, - apiname = None, - profile = None, - versions = '.*', - emitversions = '.*', - defaultExtensions = None, - addExtensions = None, - removeExtensions = None, - emitExtensions = None, - sortProcedure = regSortFeatures, - prefixText = "", - genFuncPointers = True, - protectFile = True, - protectFeature = True, - apicall = '', - apientry = '', - apientryp = '', - alignFuncParam = 0, - library_name = '', - expandEnumerants = True): - GeneratorOptions.__init__(self, - conventions = conventions, - filename = filename, - directory = directory, - genpath = genpath, - apiname = apiname, - profile = profile, - versions = versions, - emitversions = emitversions, - defaultExtensions = defaultExtensions, - addExtensions = addExtensions, - removeExtensions = removeExtensions, - emitExtensions = emitExtensions, - sortProcedure = sortProcedure) - self.prefixText = prefixText - self.genFuncPointers = genFuncPointers - self.protectFile = protectFile - self.protectFeature = protectFeature - self.apicall = apicall - self.apientry = apientry - self.apientryp = apientryp - self.alignFuncParam = alignFuncParam - self.library_name = library_name -# -# LoaderVersioningGenerator - subclass of OutputGenerator. Outputs cmake file containing vulkan version used when generating files -class LoaderVersioningGenerator(OutputGenerator): - """Generate helper file based on XML element attributes""" - def __init__(self, - errFile = sys.stderr, - warnFile = sys.stderr, - diagFile = sys.stdout): - OutputGenerator.__init__(self, errFile, warnFile, diagFile) - - # - # Called once at the beginning of each run - def beginFile(self, genOpts): - OutputGenerator.beginFile(self, genOpts) - # User-supplied prefix text, if any (list of strings) - self.library_name = genOpts.library_name - - version_major = '' - version_minor = '' - version_patch = '' - for elem in self.registry.reg.find('types').findall('type'): - if elem.get('category') == 'define': - if elem.get('name') == 'VK_HEADER_VERSION_COMPLETE': - # Parses the following string: - #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION) - # The 0th index is the VARIANT version, 1st & 2nd are the Major & Minor - version_major = re.findall("[0-9]+", ''.join(elem.itertext()))[1] - version_minor = re.findall("[0-9]+", ''.join(elem.itertext()))[2] - if elem.get('name') == 'VK_HEADER_VERSION': - # Parses the following string: - #define VK_HEADER_VERSION 189 - version_patch = re.findall("[0-9]+", ''.join(elem.itertext()))[0] - - # File Comment - file_comment = '# *** THIS FILE IS GENERATED - DO NOT EDIT ***\n' - file_comment += '# See loader_versioning_generator.py for modifications\n' - write(file_comment, file=self.outFile) - # Copyright Notice - cmake_version_copyright = '''############################################################################ -# -# Copyright (c) 2021 The Khronos Group Inc. -# Copyright (c) 2021 Valve Corporation -# Copyright (c) 2021 LunarG, Inc. -# Copyright (c) 2021 Google Inc. -# -# 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: Charles Giessen -# -############################################################################ -''' - write(cmake_version_copyright, file=self.outFile) - write(f'set(LOADER_GENERATED_HEADER_VERSION \"{version_major}.{version_minor}.{version_patch}\")', file=self.outFile) - - # - # Write generated file content to output file - def endFile(self): - dest_file = '' - # Remove blank lines at EOF - if dest_file.endswith('\n'): - dest_file = dest_file[:-1] - write(dest_file, file=self.outFile) - # Finish processing in superclass - OutputGenerator.endFile(self) \ No newline at end of file diff --git a/scripts/parse_asm_values.py b/scripts/parse_asm_values.py new file mode 100644 index 0000000000000000000000000000000000000000..87d669326fd2b744a1ed80339794717f99927333 --- /dev/null +++ b/scripts/parse_asm_values.py @@ -0,0 +1,101 @@ +#!/usr/bin/python3 -i +# +# Copyright (c) 2022 The Khronos Group Inc. +# Copyright (c) 2022 LunarG, Inc. + +# 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: Charles Giessen + +# This script reads in the 'intermediate output' of a compiler to look for sizeof/offsetof information +# necessary for the assembler portions of the loader. This is achieved by forcing the compiler to output +# the intermediate assembly output and looking for specific patterns which contain the relevant information + +import sys +import os.path +from os.path import exists +import re + + +# Where to write the "gen_defines.asm" file +destination_file = sys.argv[1] +# The location the build system puts the intermediate asm file which depends on the compiler +source_asm_file = sys.argv[2] +# Whether we are using "MASM" or "GAS" for the assembler +assembler_type = sys.argv[3] +# Whether we are using gcc, clang, or msvc +compiler = sys.argv[4] +# taken from CMAKE_SYSTEM_PROCESSOR - x86_64, aarch64, or x86 +# Only used with GAS - MASM doesn't need this, as it has its own way to determine x86 vs x64 +arch = sys.argv[5] + +POSIX_COMPILERS = ["GNU", "Clang", "AppleClang"] + +if destination_file is None or source_asm_file is None or assembler_type is None or compiler is None or arch is None: + print("Required command line arguments were not provided") + sys.exit(1) + +defines = ["VULKAN_LOADER_ERROR_BIT", + "PTR_SIZE", + "CHAR_PTR_SIZE", + "FUNCTION_OFFSET_INSTANCE", + "PHYS_DEV_OFFSET_INST_DISPATCH", + "PHYS_DEV_OFFSET_PHYS_DEV_TRAMP", + "ICD_TERM_OFFSET_PHYS_DEV_TERM", + "PHYS_DEV_OFFSET_PHYS_DEV_TERM", + "INSTANCE_OFFSET_ICD_TERM", + "DISPATCH_OFFSET_ICD_TERM", + "EXT_OFFSET_DEVICE_DISPATCH" ] + +try: + with open(source_asm_file, 'r') as f: + asm_intermediate_file = f.read() +except IOError: + print("Could not open assembler file:", source_asm_file) + sys.exit(1) + +with open(destination_file, "w", encoding="utf-8") as dest: + if assembler_type == "MASM": + # special case vulkan error bit due to it not appearing in the asm - its defined in the header as 8 so it shouldn't change + dest.write("VULKAN_LOADER_ERROR_BIT equ 8;\n") + elif assembler_type == "GAS": + # let the assembler know which platform to use + if arch == "x86_64": + dest.write(".set X86_64, 1\n") + elif arch == "aarch64" or arch == "arm64": + dest.write(".set AARCH_64, 1\n") + # Nothing to write in the x86 case + + for d in defines: + match = None + if compiler == "MSVC": + if d == "VULKAN_LOADER_ERROR_BIT": + continue # skip due to special case + match = re.search(d + " DD [ ]*([0-9a-f]+)H", asm_intermediate_file) + elif compiler in POSIX_COMPILERS: + match = re.search(d + " = ([0-9]+)", asm_intermediate_file) + + if match: + if compiler == "MSVC": + value = str(int(match.group(1), 16)) + elif compiler in POSIX_COMPILERS: + value = match.group(1) + if assembler_type == "MASM": + # MASM uses hex values, decode them here + dest.write(d + " equ " + value +";\n") + elif assembler_type == "GAS": + dest.write(".set " + d + ", " + value + "\n") + else: + print("Couldn't find ", d) + sys.exit(1) + diff --git a/scripts/qnx/README.md b/scripts/qnx/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f8f46af67332457a591db2628814d846856d8b12 --- /dev/null +++ b/scripts/qnx/README.md @@ -0,0 +1,12 @@ +QNX maintains it's own slightly modified ICD loader. + +Instead of using /etc/ for layers and drivers JSONs - it asks Screen Composition Manager for the all settings and fetches the lists from it. + +Like it is currently done for OpenGL ES, OpenCL, etc. + +More information: +https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.screen/topic/manual/cscreen_config_intro.html#screen_khronos_egl_display__vk-exps + +This QNX build is mostly for the hardware vendors, so they could test Vulkan drivers before QNX with Vulkan support was officially released using the Linux way of drivers loading. + +Some customers still can use this if they don't need to run Screen composition manager. For example, for Vulkan-SC used as compute engine and offscreen renderer. diff --git a/build-qnx/common.mk b/scripts/qnx/common.mk similarity index 65% rename from build-qnx/common.mk rename to scripts/qnx/common.mk index d851f7f5ee8998b3fba67bd2b75c8c6dc312aa6e..6c2e50a99d04977e3410189b270511957fbc4eb4 100644 --- a/build-qnx/common.mk +++ b/scripts/qnx/common.mk @@ -7,9 +7,9 @@ define PINFO PINFO DESCRIPTION = "Vulkan ICD Loader" endef -ICD_ROOT=$(CURDIR)/../../../.. +ICD_ROOT=$(CURDIR)/../../../../.. -EXTRA_INCVPATH+=$(ICD_ROOT)/build_qnx +EXTRA_INCVPATH+=$(ICD_ROOT)/scripts/gn EXTRA_INCVPATH+=$(ICD_ROOT)/external/Vulkan-Headers/include EXTRA_SRCVPATH+=$(ICD_ROOT)/loader @@ -22,21 +22,20 @@ NAME=vulkan SRCS = cJSON.c debug_utils.c dev_ext_trampoline.c loader.c \ phys_dev_ext.c trampoline.c unknown_ext_chain.c wsi.c \ - extension_manual.c unknown_function_handling.c + extension_manual.c unknown_function_handling.c settings.c \ + log.c allocation.c loader_environment.c gpa_helper.c \ + terminator.c LDFLAGS += -Wl,--unresolved-symbols=report-all -Wl,--no-undefined -Wl,-fPIC include $(MKFILES_ROOT)/qtargets.mk -CCFLAGS += -DVK_USE_PLATFORM_SCREEN_QNX=1 -Dvulkan_EXPORTS +CCFLAGS += -DVK_USE_PLATFORM_SCREEN_QNX=1 -DVK_ENABLE_BETA_EXTENSIONS CCFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -CCFLAGS += -fno-strict-aliasing -fno-builtin-memcmp -Wno-stringop-truncation -CCFLAGS += -Wno-stringop-overflow -Wimplicit-fallthrough=0 -fvisibility=hidden +CCFLAGS += -Wno-stringop-truncation +CCFLAGS += -Wno-stringop-overflow -fvisibility=hidden CCFLAGS += -Wpointer-arith -fPIC -# Enable this if required -CCFLAGS += -DVK_ENABLE_BETA_EXTENSIONS - CXXFLAGS += $(CCFLAGS) # cJSON requires math library for pow() function diff --git a/build-qnx/loader_cmake_config.h b/scripts/qnx/loader_cmake_config.h similarity index 100% rename from build-qnx/loader_cmake_config.h rename to scripts/qnx/loader_cmake_config.h diff --git a/scripts/update_deps.py b/scripts/update_deps.py index 8a576d38f24804629483c8ff2f422c5c60a40817..35b4990d5f19e8b866f8ce8d7696cb87f0408b91 100755 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -1,8 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 The Glslang Authors. All rights reserved. -# Copyright (c) 2018 Valve Corporation -# Copyright (c) 2018-2021 LunarG, Inc. +# Copyright (c) 2018-2023 Valve Corporation +# Copyright (c) 2018-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. @@ -31,11 +32,6 @@ this home repository depend on. It also checks out each dependent repository at a "known-good" commit in order to provide stability in the dependent repositories. -Python Compatibility --------------------- - -This program can be used with Python 2.7 and Python 3. - Known-Good JSON Database ------------------------ @@ -117,6 +113,10 @@ examples of all of these elements. The name of the dependent repository. This field can be referenced by the "deps.repo_name" structure to record a dependency. +- api + +The name of the API the dependency is specific to (e.g. "vulkan"). + - url Specifies the URL of the repository. @@ -141,8 +141,6 @@ to the "top" directory. The commit used to checkout the repository. This can be a SHA-1 object name or a refname used with the remote name "origin". -For example, this field can be set to "origin/sdk-1.1.77" to -select the end of the sdk-1.1.77 branch. - deps (optional) @@ -206,11 +204,6 @@ A list of options to pass to CMake during the generation phase. A list of environment variables where one must be set to "true" (case-insensitive) in order for this repo to be fetched and built. This list can be used to specify repos that should be built only in CI. -Typically, this list might contain "TRAVIS" and/or "APPVEYOR" because -each of these CI systems sets an environment variable with its own -name to "true". Note that this could also be (ab)used to control -the processing of the repo with any environment variable. The default -is an empty list, which means that the repo is always processed. - build_step (optional) @@ -225,6 +218,7 @@ Legal options include: "windows" "linux" "darwin" +"android" Builds on all platforms by default. @@ -238,10 +232,9 @@ option can be a relative or absolute path. """ -from __future__ import print_function - import argparse import json +import os import os.path import subprocess import sys @@ -261,7 +254,8 @@ CONFIG_MAP = { 'minsizerel': 'MinSizeRel' } -VERBOSE = False +# NOTE: CMake also uses the VERBOSE environment variable. This is intentional. +VERBOSE = os.getenv("VERBOSE") DEVNULL = open(os.devnull, 'wb') @@ -269,7 +263,7 @@ DEVNULL = open(os.devnull, 'wb') def on_rm_error( func, path, exc_info): """Error handler for recursively removing a directory. The shutil.rmtree function can fail on Windows due to read-only files. - This handler will change the permissions for tha file and continue. + This handler will change the permissions for the file and continue. """ os.chmod( path, stat.S_IWRITE ) os.unlink( path ) @@ -280,25 +274,40 @@ def make_or_exist_dirs(path): if not os.path.isdir(path): os.makedirs(path) -def command_output(cmd, directory, fail_ok=False): - """Runs a command in a directory and returns its standard output stream. +def command_output(cmd, directory): + # Runs a command in a directory and returns its standard output stream. + # Captures the standard error stream and prints it an error occurs. + # Raises a RuntimeError if the command fails to launch or otherwise fails. + if VERBOSE: + print('In {d}: {cmd}'.format(d=directory, cmd=cmd)) + + result = subprocess.run(cmd, cwd=directory, capture_output=True, text=True) - Captures the standard error stream and prints it if error. + if result.returncode != 0: + print(f'{result.stderr}', file=sys.stderr) + raise RuntimeError(f'Failed to run {cmd} in {directory}') - Raises a RuntimeError if the command fails to launch or otherwise fails. - """ if VERBOSE: - print('In {d}: {cmd}'.format(d=directory, cmd=cmd)) - p = subprocess.Popen( - cmd, cwd=directory, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdout, stderr) = p.communicate() - if p.returncode != 0: - print('*** Error ***\nstderr contents:\n{}'.format(stderr)) - if not fail_ok: - raise RuntimeError('Failed to run {} in {}'.format(cmd, directory)) + print(result.stdout) + return result.stdout + +def run_cmake_command(cmake_cmd): + # NOTE: Because CMake is an exectuable that runs executables + # stdout/stderr are mixed together. So this combines the outputs + # and prints them properly in case there is a non-zero exit code. + result = subprocess.run(cmake_cmd, + stdout = subprocess.PIPE, + stderr = subprocess.STDOUT, + text = True + ) + if VERBOSE: - print(stdout) - return stdout + print(result.stdout) + print(f"CMake command: {cmake_cmd} ", flush=True) + + if result.returncode != 0: + print(result.stdout, file=sys.stderr) + sys.exit(result.returncode) def escape(path): return path.replace('\\', '/') @@ -340,6 +349,7 @@ class GoodRepo(object): self.build_step = json['build_step'] if ('build_step' in json) else 'build' self.build_platforms = json['build_platforms'] if ('build_platforms' in json) else [] self.optional = set(json.get('optional', [])) + self.api = json['api'] if ('api' in json) else None # Absolute paths for a repo's directories dir_top = os.path.abspath(args.dir) self.repo_dir = os.path.join(dir_top, self.sub_dir) @@ -347,13 +357,21 @@ class GoodRepo(object): self.build_dir = os.path.join(dir_top, self.build_dir) if self.install_dir: self.install_dir = os.path.join(dir_top, self.install_dir) - # Check if platform is one to build on + + # By default the target platform is the host platform. + target_platform = platform.system().lower() + # However, we need to account for cross-compiling. + for cmake_var in self._args.cmake_var: + if "android.toolchain.cmake" in cmake_var: + target_platform = 'android' + self.on_build_platform = False - if self.build_platforms == [] or platform.system().lower() in self.build_platforms: + if self.build_platforms == [] or target_platform in self.build_platforms: self.on_build_platform = True def Clone(self, retries=10, retry_seconds=60): - print('Cloning {n} into {d}'.format(n=self.name, d=self.repo_dir)) + if VERBOSE: + print('Cloning {n} into {d}'.format(n=self.name, d=self.repo_dir)) for retry in range(retries): make_or_exist_dirs(self.repo_dir) try: @@ -394,7 +412,9 @@ class GoodRepo(object): raise e def Checkout(self): - print('Checking out {n} in {d}'.format(n=self.name, d=self.repo_dir)) + if VERBOSE: + print('Checking out {n} in {d}'.format(n=self.name, d=self.repo_dir)) + if self._args.do_clean_repo: if os.path.isdir(self.repo_dir): shutil.rmtree(self.repo_dir, onerror = on_rm_error) @@ -405,7 +425,9 @@ class GoodRepo(object): command_output(['git', 'checkout', self._args.ref], self.repo_dir) else: command_output(['git', 'checkout', self.commit], self.repo_dir) - print(command_output(['git', 'status'], self.repo_dir)) + + if VERBOSE: + print(command_output(['git', 'status'], self.repo_dir)) def CustomPreProcess(self, cmd_str, repo_dict): return cmd_str.format(repo_dict, self._args, CONFIG_MAP[self._args.config]) @@ -423,6 +445,12 @@ class GoodRepo(object): def CustomBuild(self, repo_dict): """Execute any custom_build steps from the repo root""" + + # It's not uncommon for builds to not support universal binaries + if self._args.OSX_ARCHITECTURES: + print("Universal Binaries not supported for custom builds", file=sys.stderr) + exit(-1) + for p in self.custom_build: cmd = self.CustomPreProcess(p, repo_dict) command_output(shlex.split(cmd), self.repo_dir) @@ -430,9 +458,11 @@ class GoodRepo(object): def CMakeConfig(self, repos): """Build CMake command for the configuration phase and execute it""" if self._args.do_clean_build: - shutil.rmtree(self.build_dir) + if os.path.isdir(self.build_dir): + shutil.rmtree(self.build_dir, onerror=on_rm_error) if self._args.do_clean_install: - shutil.rmtree(self.install_dir) + if os.path.isdir(self.install_dir): + shutil.rmtree(self.install_dir, onerror=on_rm_error) # Create and change to build directory make_or_exist_dirs(self.build_dir) @@ -443,6 +473,11 @@ class GoodRepo(object): '-DCMAKE_INSTALL_PREFIX=' + self.install_dir ] + # Allow users to pass in arbitrary cache variables + for cmake_var in self._args.cmake_var: + pieces = cmake_var.split('=', 1) + cmake_cmd.append('-D{}={}'.format(pieces[0], pieces[1])) + # For each repo this repo depends on, generate a CMake variable # definitions for "...INSTALL_DIR" that points to that dependent # repo's install dir. @@ -457,10 +492,13 @@ class GoodRepo(object): for option in self.cmake_options: cmake_cmd.append(escape(option.format(**self.__dict__))) - # Set build config for single-configuration generators - if platform.system() == 'Linux' or platform.system() == 'Darwin': - cmake_cmd.append('-DCMAKE_BUILD_TYPE={config}'.format( - config=CONFIG_MAP[self._args.config])) + # Set build config for single-configuration generators (this is a no-op on multi-config generators) + cmake_cmd.append(f'-D CMAKE_BUILD_TYPE={CONFIG_MAP[self._args.config]}') + + if self._args.OSX_ARCHITECTURES: + # CMAKE_OSX_ARCHITECTURES must be a semi-colon seperated list + cmake_osx_archs = self._args.OSX_ARCHITECTURES.replace(':', ';') + cmake_cmd.append(f'-D CMAKE_OSX_ARCHITECTURES={cmake_osx_archs}') # Use the CMake -A option to select the platform architecture # without needing a Visual Studio generator. @@ -478,68 +516,49 @@ class GoodRepo(object): if self._args.generator is not None: cmake_cmd.extend(['-G', self._args.generator]) - if VERBOSE: - print("CMake command: " + " ".join(cmake_cmd)) + # Removes warnings related to unused CLI + # EX: Setting CMAKE_CXX_COMPILER for a C project + if not VERBOSE: + cmake_cmd.append("--no-warn-unused-cli") - ret_code = subprocess.call(cmake_cmd) - if ret_code != 0: - sys.exit(ret_code) + run_cmake_command(cmake_cmd) def CMakeBuild(self): """Build CMake command for the build phase and execute it""" - cmake_cmd = ['cmake', '--build', self.build_dir, '--target', 'install'] + cmake_cmd = ['cmake', '--build', self.build_dir, '--target', 'install', '--config', CONFIG_MAP[self._args.config]] if self._args.do_clean: cmake_cmd.append('--clean-first') - if platform.system() == 'Windows': - cmake_cmd.append('--config') - cmake_cmd.append(CONFIG_MAP[self._args.config]) + # Xcode / Ninja are parallel by default. + if self._args.generator != "Ninja" or self._args.generator != "Xcode": + cmake_cmd.append('--parallel') + cmake_cmd.append(format(multiprocessing.cpu_count())) - # Speed up the build. - if platform.system() == 'Linux' or platform.system() == 'Darwin': - cmake_cmd.append('--') - num_make_jobs = multiprocessing.cpu_count() - env_make_jobs = os.environ.get('MAKE_JOBS', None) - if env_make_jobs is not None: - try: - num_make_jobs = min(num_make_jobs, int(env_make_jobs)) - except ValueError: - print('warning: environment variable MAKE_JOBS has non-numeric value "{}". ' - 'Using {} (CPU count) instead.'.format(env_make_jobs, num_make_jobs)) - cmake_cmd.append('-j{}'.format(num_make_jobs)) - if platform.system() == 'Windows' and self._args.generator != "Ninja": - cmake_cmd.append('--') - cmake_cmd.append('/maxcpucount') + run_cmake_command(cmake_cmd) + def Build(self, repos, repo_dict): + """Build the dependent repo and time how long it took""" if VERBOSE: - print("CMake command: " + " ".join(cmake_cmd)) + print('Building {n} in {d}'.format(n=self.name, d=self.repo_dir)) + print('Build dir = {b}'.format(b=self.build_dir)) + print('Install dir = {i}\n'.format(i=self.install_dir)) - ret_code = subprocess.call(cmake_cmd) - if ret_code != 0: - sys.exit(ret_code) + start = time.time() - def Build(self, repos, repo_dict): - """Build the dependent repo""" - print('Building {n} in {d}'.format(n=self.name, d=self.repo_dir)) - print('Build dir = {b}'.format(b=self.build_dir)) - print('Install dir = {i}\n'.format(i=self.install_dir)) - - # Run any prebuild commands self.PreBuild() if self.build_step == 'custom': self.CustomBuild(repo_dict) - return + else: + self.CMakeConfig(repos) + self.CMakeBuild() - # Build and execute CMake command for creating build files - self.CMakeConfig(repos) + total_time = time.time() - start - # Build and execute CMake command for the build - self.CMakeBuild() + print(f"Installed {self.name} ({self.commit}) in {total_time} seconds", flush=True) def IsOptional(self, opts): - if len(self.optional.intersection(opts)) > 0: return True - else: return False + return len(self.optional.intersection(opts)) > 0 def GetGoodRepos(args): """Returns the latest list of GoodRepo objects. @@ -596,6 +615,10 @@ def CreateHelper(args, repos, filename): install_names = GetInstallNames(args) with open(filename, 'w') as helper_file: for repo in repos: + # If the repo has an API tag and that does not match + # the target API then skip it + if repo.api is not None and repo.api != args.api: + continue if install_names and repo.name in install_names and repo.on_build_platform: helper_file.write('set({var} "{dir}" CACHE STRING "" FORCE)\n' .format( @@ -619,7 +642,7 @@ def main(): '--ref', dest='ref', default='', - help="Override 'commit' with git reference. E.g., 'origin/master'") + help="Override 'commit' with git reference. E.g., 'origin/main'") parser.add_argument( '--no-build', dest='do_build', @@ -651,12 +674,18 @@ def main(): action='store_true', help="Delete install directory before building", default=False) + parser.add_argument( + '--skip-existing-install', + dest='skip_existing_install', + action='store_true', + help="Skip build if install directory exists", + default=False) parser.add_argument( '--arch', dest='arch', choices=['32', '64', 'x86', 'x64', 'win32', 'win64'], type=str.lower, - help="Set build files architecture (Windows)", + help="Set build files architecture (Visual Studio Generator Only)", default='64') parser.add_argument( '--config', @@ -665,6 +694,12 @@ def main(): type=str.lower, help="Set build files configuration", default='debug') + parser.add_argument( + '--api', + dest='api', + default='vulkan', + choices=['vulkan'], + help="Target API") parser.add_argument( '--generator', dest='generator', @@ -676,10 +711,26 @@ def main(): type=lambda a: set(a.lower().split(',')), help="Comma-separated list of 'optional' resources that may be skipped. Only 'tests' is currently supported as 'optional'", default=set()) + parser.add_argument( + '--cmake_var', + dest='cmake_var', + action='append', + metavar='VAR[=VALUE]', + help="Add CMake command line option -D'VAR'='VALUE' to the CMake generation command line; may be used multiple times", + default=[]) + parser.add_argument( + '--osx-archs', + dest='OSX_ARCHITECTURES', + help="Architectures when building a universal binary. Takes a colon seperated list. Ex: arm64:x86_64", + type=str, + default=None) args = parser.parse_args() save_cwd = os.getcwd() + if args.OSX_ARCHITECTURES: + print(f"Building dependencies as universal binaries targeting {args.OSX_ARCHITECTURES}") + # Create working "top" directory if needed make_or_exist_dirs(args.dir) abs_top_dir = os.path.abspath(args.dir) @@ -689,11 +740,24 @@ def main(): print('Starting builds in {d}'.format(d=abs_top_dir)) for repo in repos: + # If the repo has an API tag and that does not match + # the target API then skip it + if repo.api is not None and repo.api != args.api: + continue + # If the repo has a platform whitelist, skip the repo # unless we are building on a whitelisted platform. if not repo.on_build_platform: continue + # Skip building the repo if its install directory already exists + # and requested via an option. This is useful for cases where the + # install directory is restored from a cache that is known to be up + # to date. + if args.skip_existing_install and os.path.isdir(repo.install_dir): + print('Skipping build for repo {n} due to existing install directory'.format(n=repo.name)) + continue + # Skip test-only repos if the --tests option was not passed in if repo.IsOptional(args.optional): continue @@ -721,7 +785,7 @@ def main(): if len(repo.ci_only): do_build = False for env in repo.ci_only: - if not env in os.environ: + if env not in os.environ: continue if os.environ[env].lower() == 'true': do_build = True @@ -745,3 +809,4 @@ def main(): if __name__ == '__main__': main() + diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f9677bcd36d2fc7012dacc2bc35af91ec4898d32..10273899b79e039284bf1de37f2bb7a4d3210373 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,6 @@ # ~~~ -# Copyright (c) 2014-2022 Valve Corporation -# Copyright (c) 2014-2022 LunarG, Inc. +# Copyright (c) 2014-2023 Valve Corporation +# Copyright (c) 2014-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,12 +14,64 @@ # See the License for the specific language governing permissions and # limitations under the License. # ~~~ +enable_language(CXX) # Tests use C++ +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Make sure tests uses the dynamic runtime instead +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + +# For MSVC/Windows, replace /GR with an empty string, this prevents warnings of /GR being overriden by /GR- +# Newer CMake versions (3.20) have better solutions for this through policy - using the old +# way while waiting for when updating can occur +string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + +if (IS_DIRECTORY "${GOOGLETEST_INSTALL_DIR}/googletest") + set(BUILD_GTEST ON) + set(BUILD_GMOCK OFF) + set(gtest_force_shared_crt ON) + set(BUILD_SHARED_LIBS ON) + set(INSTALL_GTEST OFF) + add_subdirectory("${GOOGLETEST_INSTALL_DIR}" ${CMAKE_CURRENT_BINARY_DIR}/gtest) +else() + message(FATAL_ERROR "Could not find googletest directory. See BUILD.md") +endif() + +if (WIN32) + if(NOT IS_DIRECTORY ${DETOURS_INSTALL_DIR}) + message(FATAL_ERROR "Could not find detours! See BUILD.md") + endif() + add_library(detours STATIC + ${DETOURS_INSTALL_DIR}/src/creatwth.cpp + ${DETOURS_INSTALL_DIR}/src/detours.cpp + ${DETOURS_INSTALL_DIR}/src/detours.h + ${DETOURS_INSTALL_DIR}/src/detver.h + ${DETOURS_INSTALL_DIR}/src/disasm.cpp + ${DETOURS_INSTALL_DIR}/src/disolarm.cpp + ${DETOURS_INSTALL_DIR}/src/disolarm64.cpp + ${DETOURS_INSTALL_DIR}/src/disolia64.cpp + ${DETOURS_INSTALL_DIR}/src/disolx64.cpp + ${DETOURS_INSTALL_DIR}/src/disolx86.cpp + ${DETOURS_INSTALL_DIR}/src/image.cpp + ${DETOURS_INSTALL_DIR}/src/modules.cpp + ) + target_include_directories(detours PUBLIC ${DETOURS_INSTALL_DIR}/src) + + target_compile_definitions(detours PUBLIC WIN32_LEAN_AND_MEAN) + + if(MSVC) + target_compile_definitions(detours PUBLIC "_CRT_SECURE_NO_WARNINGS=1") + set_target_properties(detours PROPERTIES COMPILE_FLAGS /EHsc) + endif() + + # Silence errors found in clang-cl + if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "${CMAKE_C_SIMULATE_ID}" MATCHES "MSVC") + target_compile_options(detours PRIVATE -Wno-sizeof-pointer-memaccess -Wno-microsoft-goto -Wno-microsoft-cast) + endif() +endif() -# By default, tests and loader are built without sanitizers -# Use these options to force a specific sanitizer on all test executables -option(TEST_USE_ADDRESS_SANITIZER "Linux only: Advanced memory checking" OFF) -option(TEST_USE_THREAD_SANITIZER "Linux only: Advanced thread checking" OFF) option(ENABLE_LIVE_VERIFICATION_TESTS "Enable tests which expect to run on live drivers. Meant for manual verification only" OFF) include(GoogleTest) @@ -36,11 +88,11 @@ add_executable( loader_layer_tests.cpp loader_regression_tests.cpp loader_phys_dev_inst_ext_tests.cpp + loader_settings_tests.cpp loader_version_tests.cpp loader_unknown_ext_tests.cpp loader_wsi_tests.cpp) target_link_libraries(test_regression PUBLIC testing_dependencies) -set_target_properties(test_regression ${LOADER_STANDARD_CXX_PROPERTIES}) target_compile_definitions(test_regression PUBLIC VK_NO_PROTOTYPES) # Threading tests live in separate executabe just for threading tests as it'll need support @@ -50,7 +102,6 @@ add_executable( loader_testing_main.cpp loader_threading_tests.cpp) target_link_libraries(test_threading PUBLIC testing_dependencies) -set_target_properties(test_threading ${LOADER_STANDARD_CXX_PROPERTIES}) target_compile_definitions(test_threading PUBLIC VK_NO_PROTOTYPES) # executables that are meant for testing against real drivers rather than the mocks @@ -75,9 +126,46 @@ if(WIN32) endif() endif() +# https://discourse.cmake.org/t/googletest-crash-when-using-cmake-xcode-arm64/5766 +# +# TLDR: On macOS arm64, all binaries have to be signed before running. +# Delay test discovery until test time as a workaround. +if (XCODE) + set(CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE "PRE_TEST") +endif() + # must happen after the dll's get copied over if(NOT CMAKE_CROSSCOMPILING) gtest_discover_tests(test_regression PROPERTIES DISCOVERY_TIMEOUT 100) else() gtest_add_tests(TARGET test_regression) endif() + +# When APPLE_STATIC_LOADER is ON installation is disabled +if (APPLE_STATIC_LOADER) + return() +endif() + +# Test installation +set(test_install_dir "${CMAKE_CURRENT_BINARY_DIR}/install") +add_test(NAME integration.install + COMMAND ${CMAKE_COMMAND} --install ${PROJECT_BINARY_DIR} --prefix ${test_install_dir} --config $ +) + +# find_package testing currently doesn't work well under cross-compilation scenarios. +if (CMAKE_CROSSCOMPILING OR + NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + return() +endif() + +# Test find_package suppport +add_test(NAME integration.find_package + COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration + ${CMAKE_CURRENT_BINARY_DIR}/find_package + --build-generator ${CMAKE_GENERATOR} + --build-options -DCMAKE_PREFIX_PATH=${test_install_dir} +) + +# Installing comes before testing +set_tests_properties(integration.find_package PROPERTIES DEPENDS integration.install) diff --git a/tests/README.md b/tests/README.md index a12fde3ec47dc9bc8c0eee892f00d8cfd374ba7a..7a09938f934ad796e225ab36e09834655154b799 100644 --- a/tests/README.md +++ b/tests/README.md @@ -11,8 +11,6 @@ These tests are not exhaustive — they are expected to be supplemented with | ------------------------------ | -------- | ------- | -------------------------------------------------------- | | BUILD_TESTS | All | `OFF` | Controls whether or not the loader tests are built. | | ENABLE_LIVE_VERIFICATION_TESTS | All | `OFF` | Enables building of tests meant to run with live drivers | -| TEST_USE_ADDRESS_SANITIZER | Linux | `OFF` | Enables Address Sanitizer in the loader and tests | -| TEST_USE_THREAD_SANITIZER | Linux | `OFF` | Enables Thread Sanitizer in the loader and tests | ## Running Tests @@ -51,4 +49,4 @@ Then run the test again but with this env-var set to the older loader without th Basic usage example: ```c VK_LOADER_TEST_LOADER_PATH="/path/to/older/loader/build" ctest --output-on-failure -``` \ No newline at end of file +``` diff --git a/tests/corpus/VkLayer_complex_file.json b/tests/corpus/VkLayer_complex_file.json new file mode 100644 index 0000000000000000000000000000000000000000..dde37e3a99e41d66cd879eac9374204c701468c9 --- /dev/null +++ b/tests/corpus/VkLayer_complex_file.json @@ -0,0 +1,741 @@ +{ + "file_format_version": "1.2.0", + "layer": { + "test_code_description": "This file is literally a copy of an installed Validation layer manifest file for linux. It was chosen because it contains a lot of complex json structures that aren't present in the test framework's generated json, so exercises cJSON better", + "name": "VK_LAYER_KHRONOS_validation", + "type": "GLOBAL", + "library_path": "libVkLayer_khronos_validation.so", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Khronos Validation Layer", + "introduction": "The main, comprehensive Khronos validation layer.\n\nVulkan is an Explicit API, enabling direct control over how GPUs actually work. By design, minimal error checking is done inside a Vulkan driver. Applications have full control and responsibility for correct operation. Any errors in how Vulkan is used can result in a crash. \n\nThe Khronos Valiation Layer can be enabled to assist development by enabling developers to verify their applications correctly use the Vulkan API.", + "platforms": [ + "WINDOWS", + "LINUX", + "ANDROID", + "MACOS" + ], + "url": "https://vulkan.lunarg.com/doc/sdk/latest/windows/khronos_validation_layer.html", + "instance_extensions": [ + { + "name": "VK_EXT_debug_report", + "spec_version": "9" + }, + { + "name": "VK_EXT_debug_utils", + "spec_version": "1" + }, + { + "name": "VK_EXT_validation_features", + "spec_version": "2" + } + ], + "device_extensions": [ + { + "name": "VK_EXT_debug_marker", + "spec_version": "4", + "entrypoints": [ + "vkDebugMarkerSetObjectTagEXT", + "vkDebugMarkerSetObjectNameEXT", + "vkCmdDebugMarkerBeginEXT", + "vkCmdDebugMarkerEndEXT", + "vkCmdDebugMarkerInsertEXT" + ] + }, + { + "name": "VK_EXT_validation_cache", + "spec_version": "1", + "entrypoints": [ + "vkCreateValidationCacheEXT", + "vkDestroyValidationCacheEXT", + "vkGetValidationCacheDataEXT", + "vkMergeValidationCachesEXT" + ] + }, + { + "name": "VK_EXT_tooling_info", + "spec_version": "1", + "entrypoints": [ + "vkGetPhysicalDeviceToolPropertiesEXT" + ] + } + ], + "features": { + "presets": [ + { + "label": "Standard", + "description": "Good default validation setup that balance validation coverage and performance.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT" + ] + } + ] + }, + { + "label": "Reduced-Overhead", + "description": "Disables some checks in the interest of better performance.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS" + ], + "status": "STABLE", + "editor_state": "01110111111111111111111001111111111110", + "settings": [ + { + "key": "enables", + "value": [] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VALIDATION_CHECK_DISABLE_IMAGE_LAYOUT_VALIDATION", + "VALIDATION_CHECK_DISABLE_COMMAND_BUFFER_STATE", + "VALIDATION_CHECK_DISABLE_OBJECT_IN_USE", + "VALIDATION_CHECK_DISABLE_QUERY_VALIDATION" + ] + } + ] + }, + { + "label": "Best Practices", + "description": "Provides warnings on valid API usage that is potential API misuse.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + } + ] + }, + { + "label": "Synchronization", + "description": "Identify resource access conflicts due to missing or incorrect synchronization operations between actions reading or writing the same regions of memory.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + } + ] + }, + { + "label": "GPU-Assisted", + "description": "Check for API usage errors at shader execution time.", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT", + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + } + ] + }, + { + "label": "Debug Printf", + "description": "Debug shader code by \"printing\" any values of interest to the debug callback or stdout.", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + }, + { + "key": "enable_message_limit", + "value": false + } + ] + } + ], + "settings": [ + { + "key": "debug_action", + "label": "Debug Action", + "description": "Specifies what action is to be taken when a layer reports information", + "type": "FLAGS", + "flags": [ + { + "key": "VK_DBG_LAYER_ACTION_LOG_MSG", + "label": "Log Message", + "description": "Log a txt message to stdout or to a log filename.", + "settings": [ + { + "key": "log_filename", + "label": "Log Filename", + "description": "Specifies the output filename", + "type": "SAVE_FILE", + "default": "stdout", + "dependence": { + "mode": "ALL", + "settings": [ + { + "key": "debug_action", + "value": [ + "VK_DBG_LAYER_ACTION_LOG_MSG" + ] + } + ] + } + } + ] + }, + { + "key": "VK_DBG_LAYER_ACTION_CALLBACK", + "label": "Callback", + "description": "Call user defined callback function(s) that have been registered via the VK_EXT_debug_report extension. Since application must register callback, this is a NOOP for the settings file.", + "view": "HIDDEN" + }, + { + "key": "VK_DBG_LAYER_ACTION_DEBUG_OUTPUT", + "label": "Debug Output", + "description": "Log a txt message using the Windows OutputDebugString function.", + "platforms": [ + "WINDOWS" + ] + }, + { + "key": "VK_DBG_LAYER_ACTION_BREAK", + "label": "Break", + "description": "Trigger a breakpoint if a debugger is in use." + } + ], + "default": [ + "VK_DBG_LAYER_ACTION_LOG_MSG" + ] + }, + { + "key": "report_flags", + "label": "Message Severity", + "description": "Comma-delineated list of options specifying the types of messages to be reported", + "type": "FLAGS", + "flags": [ + { + "key": "info", + "label": "Info", + "description": "Report informational messages." + }, + { + "key": "warn", + "label": "Warning", + "description": "Report warnings from using the API in a manner which may lead to undefined behavior or to warn the user of common trouble spots. A warning does NOT necessarily signify illegal application behavior." + }, + { + "key": "perf", + "label": "Performance", + "description": "Report usage of the API that may cause suboptimal performance." + }, + { + "key": "error", + "label": "Error", + "description": "Report errors in API usage." + }, + { + "key": "debug", + "label": "Debug", + "description": "For layer development. Report messages for debugging layer behavior.", + "view": "HIDDEN" + } + ], + "default": [ + "error" + ] + }, + { + "key": "enable_message_limit", + "label": "Limit Duplicated Messages", + "description": "Enable limiting of duplicate messages.", + "type": "BOOL", + "default": true, + "settings": [ + { + "key": "duplicate_message_limit", + "env": "VK_LAYER_DUPLICATE_MESSAGE_LIMIT", + "label": "Max Duplicated Messages", + "description": "Maximum number of times any single validation message should be reported.", + "type": "INT", + "default": 10, + "range": { + "min": 1 + }, + "dependence": { + "mode": "ALL", + "settings": [ + { + "key": "enable_message_limit", + "value": true + } + ] + } + } + ] + }, + { + "key": "message_id_filter", + "label": "Mute Message VUIDs", + "description": "List of VUIDs and VUID identifers which are to be IGNORED by the validation layer", + "type": "LIST", + "env": "VK_LAYER_MESSAGE_ID_FILTER", + "default": [] + }, + { + "key": "disables", + "label": "Disables", + "description": "Specify areas of validation to be disabled", + "type": "FLAGS", + "env": "VK_LAYER_DISABLES", + "flags": [ + { + "key": "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "label": "Thread Safety", + "description": "Thread checks. In order to not degrade performance, it might be best to run your program with thread-checking disabled most of the time, enabling it occasionally for a quick sanity check or when debugging difficult application behaviors." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "label": "Stateless Parameter", + "description": "Stateless parameter checks. This may not always be necessary late in a development cycle." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "label": "Object Lifetime", + "description": "Object tracking checks. This may not always be necessary late in a development cycle." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT", + "label": "Core", + "description": "The main, heavy-duty validation checks. This may be valuable early in the development cycle to reduce validation output while correcting parameter/object usage errors." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "label": "Handle Wrapping", + "description": "Handle wrapping checks. Disable this feature if you are exerience crashes when creating new extensions or developing new Vulkan objects/structures." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT", + "label": "Shader Validation", + "description": "Shader checks. These checks can be CPU intensive during application start up, especially if Shader Validation Caching is also disabled.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_COMMAND_BUFFER_STATE", + "label": "Command Buffer State", + "description": "Check that all Vulkan objects used by a command buffer have not been destroyed. These checks can be CPU intensive for some applications.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_IMAGE_LAYOUT_VALIDATION", + "label": "Image Layout", + "description": "Check that the layout of each image subresource is correct whenever it is used by a command buffer. These checks are very CPU intensive for some applications.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_QUERY_VALIDATION", + "label": "Query", + "description": "Checks for commands that use VkQueryPool objects.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_OBJECT_IN_USE", + "label": "Object in Use", + "description": "Check that Vulkan objects are not in use by a command buffer when they are destroyed.", + "view": "ADVANCED" + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_SHADER_VALIDATION_CACHE_EXT", + "label": "Shader Validation Caching", + "description": "Disable caching of shader validation results.", + "view": "ADVANCED" + } + ], + "default": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT" + ] + }, + { + "key": "enables", + "label": "Enables", + "description": "Setting an option here will enable specialized areas of validation", + "type": "FLAGS", + "env": "VK_LAYER_ENABLES", + "flags": [ + { + "key": "VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT", + "label": "Synchronization", + "description": "This feature reports resource access conflicts due to missing or incorrect synchronization operations between actions (Draw, Copy, Dispatch, Blit) reading or writing the same regions of memory.", + "url": "${LUNARG_SDK}/synchronization_usage.html", + "status": "STABLE", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_SYNCHRONIZATION_VALIDATION_QUEUE_SUBMIT", + "label": "QueueSubmit Synchronization Validation", + "description": "Enable synchronization validation between submitted command buffers when Synchronization Validation is enabled.", + "status": "ALPHA" + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT", + "label": "Debug Printf", + "description": "Enables processing of debug printf instructions in shaders and sending debug strings to the debug callback.", + "url": "${LUNARG_SDK}/debug_printf.html", + "status": "STABLE", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "settings": [ + { + "key": "printf_to_stdout", + "label": "Redirect Printf messages to stdout", + "description": "Enable redirection of Debug Printf messages from the debug callback to stdout", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + } + ] + } + }, + { + "key": "printf_verbose", + "label": "Printf verbose", + "description": "Set the verbosity of debug printf messages", + "type": "BOOL", + "default": false, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + } + ] + } + }, + { + "key": "printf_buffer_size", + "label": "Printf buffer size", + "description": "Set the size in bytes of the buffer used by debug printf", + "type": "INT", + "default": 1024, + "range": { + "min": 128, + "max": 1048576 + }, + "unit": "bytes", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + } + ] + } + } + ] + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT", + "label": "GPU-Assisted", + "description": "Check for API usage errors at shader execution time.", + "url": "${LUNARG_SDK}/gpu_validation.html", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "settings": [ + { + "key": "gpuav_descriptor_indexing", + "label": "Check descriptor indexing accesses", + "description": "Enable descriptor indexing access checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "gpuav_buffer_oob", + "label": "Check Out of Bounds ", + "description": "Enable buffer out of bounds checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "validate_draw_indirect", + "label": "Check Draw Indirect Count Buffers and firstInstance values", + "description": "Enable draw indirect checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "validate_dispatch_indirect", + "label": "Check Dispatch Indirect group count values", + "description": "Enable dispatch indirect checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "vma_linear_output", + "label": "Use VMA linear memory allocations for GPU-AV output buffers", + "description": "Use linear allocation algorithm", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + } + ] + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT", + "label": "Reserve Descriptor Set Binding Slot", + "description": "Specifies that the validation layers reserve a descriptor set binding slot for their own use. The layer reports a value for VkPhysicalDeviceLimits::maxBoundDescriptorSets that is one less than the value reported by the device. If the device supports the binding of only one descriptor set, the validation layer does not perform GPU-assisted validation.", + "platforms": [ + "WINDOWS", + "LINUX" + ] + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT", + "label": "Best Practices", + "description": "Activating this feature enables the output of warnings related to common misuse of the API, but which are not explicitly prohibited by the specification.", + "url": "${LUNARG_SDK}/best_practices.html", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_ARM", + "label": "ARM-specific best practices", + "description": "Activating this feature enables the output of warnings related to ARM-specific misuse of the API, but which are not explicitly prohibited by the specification.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_AMD", + "label": "AMD-specific best practices", + "description": "Adds check for spec-conforming but non-ideal code on AMD GPUs.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_NVIDIA", + "label": "NVIDIA-specific best practices", + "description": "Activating this feature enables the output of warnings related to NVIDIA-specific misuse of the API, but which are not explicitly prohibited by the specification.", + "platforms": [ + "WINDOWS", + "LINUX", + "ANDROID" + ] + } + ], + "default": [] + }, + { + "key": "fine_grained_locking", + "env": "VK_LAYER_FINE_GRAINED_LOCKING", + "label": "Fine Grained Locking", + "description": "Enable fine grained locking for Core Validation, which should improve performance in multithreaded applications. This setting allows the optimization to be disabled for debugging.", + "status": "STABLE", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + } + ] + } + } +} diff --git a/tests/corpus/config.json b/tests/corpus/config.json new file mode 100644 index 0000000000000000000000000000000000000000..99313efff323893b9084d42bf502aaeffc90b599 --- /dev/null +++ b/tests/corpus/config.json @@ -0,0 +1,99 @@ +{ + "file_format_version": "1.2.0", + "settings_array": [ + { + "app_keys": [ + "/out/settings_fuzzer", + "/work/settings_fuzzer" + ], + "stderr_log": ["all", "info", "warn", "perf", "error", "debug", "layer", "driver", "validation"], + "log_locations": [ + { + "destinations":["/tmp"], + "filters":["all"] + } + ], + "layers": [ + { + "control": "auto", + "name": "test_auto", + "path": "test", + "treat_as_implicit_manifest": true + }, + { + "control": "on", + "name": "test_on", + "path": "test", + "treat_as_implicit_manifest": true + }, + { + "control": "off", + "name": "test_off", + "path": "test", + "treat_as_implicit_manifest": true + } + ] + }, + { + "app_keys": [ + "val1", + "val2", + "val3", + "val4" + ] + } + ], + "layers": [ + { + "name": "VK_LAYER_test_layer_1", + "type": "INSTANCE", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Test layer 1", + "library_path": "libVkLayer_khronos_validation.so", + "component_layers": ["VK_LAYER_test_layer_1", "VK_LAYER_test_layer_2"], + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": ["/out/settings_fuzzer"] + }, + { + "name": "VK_LAYER_test_layer_2", + "type": "GLOBAL", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Test layer 2", + "library_path": "libVkLayer_khronos_validation.so", + "component_layers": ["VK_LAYER_test_layer_1", "VK_LAYER_test_layer_2"], + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": ["/out/settings_fuzzer"] + }, + { + "name": "VK_LAYER_KHRONOS_validation", + "type": "GLOBAL", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Khronos validation", + "library_path": "libVkLayer_khronos_validation.so", + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": ["/out/settings_fuzzer"] + } + ], + "ICD": { + "library_path": "/src/vulkan-loader/tests/framework/data/binaries/libdummy_library_elf_32.so", + "api_version": "1.3.231" + } +} diff --git a/tests/corpus/config_with_other_arch.json b/tests/corpus/config_with_other_arch.json new file mode 100644 index 0000000000000000000000000000000000000000..d39b08afc7fb80dc8d6e6ddb9c3227748e295167 --- /dev/null +++ b/tests/corpus/config_with_other_arch.json @@ -0,0 +1,99 @@ +{ + "file_format_version": "1.2.0", + "settings_array": [ + { + "app_keys": [ + "/out/settings_fuzzer", + "/work/settings_fuzzer" + ], + "stderr_log": ["all", "info", "warn", "perf", "error", "debug", "layer", "driver", "validation"], + "log_locations": [ + { + "destinations":["/tmp"], + "filters":["all"] + } + ], + "layers": [ + { + "control": "auto", + "name": "test_auto", + "path": "test", + "treat_as_implicit_manifest": true + }, + { + "control": "on", + "name": "test_on", + "path": "test", + "treat_as_implicit_manifest": true + }, + { + "control": "off", + "name": "test_off", + "path": "test", + "treat_as_implicit_manifest": true + } + ] + }, + { + "app_keys": [ + "val1", + "val2", + "val3", + "val4" + ] + } + ], + "layers": [ + { + "name": "VK_LAYER_test_layer_1", + "type": "INSTANCE", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Test layer 1", + "library_path": "libVkLayer_khronos_validation.so", + "component_layers": ["VK_LAYER_test_layer_1", "VK_LAYER_test_layer_2"], + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": ["/out/settings_fuzzer"] + }, + { + "name": "VK_LAYER_test_layer_2", + "type": "GLOBAL", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Test layer 2", + "library_path": "libVkLayer_khronos_validation.so", + "component_layers": ["VK_LAYER_test_layer_1", "VK_LAYER_test_layer_2"], + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": ["/out/settings_fuzzer"] + }, + { + "name": "VK_LAYER_KHRONOS_validation", + "type": "GLOBAL", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Khronos validation", + "library_path": "libVkLayer_khronos_validation.so", + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": ["/out/settings_fuzzer"] + } + ], + "ICD": { + "library_path": "/src/vulkan-loader/tests/framework/data/binaries/libdummy_library_elf_64.so", + "api_version": "1.3.231" + } +} diff --git a/tests/corpus/config_with_unordered_layer_location.json b/tests/corpus/config_with_unordered_layer_location.json new file mode 100644 index 0000000000000000000000000000000000000000..290d32e61c0c131b0a052e7ff7b69ad551348a14 --- /dev/null +++ b/tests/corpus/config_with_unordered_layer_location.json @@ -0,0 +1,40 @@ +{ + "file_format_version": "1.2.0", + "settings_array": [ + { + "app_keys": [ + "/out/settings_fuzzer", + "/work/settings_fuzzer" + ], + "stderr_log": "/tmp/stderr.log", + "log_locations": [ + { + "destinations":["/tmp"], + "filters":["all"] + } + ], + "layers": [ + { + "control": "auto", + "name": "test", + "path": "test", + "treat_as_implicit_manifest": true + }, + { + "control": "unordered_layer_location", + "name": "test2", + "path": "test2", + "treat_as_implicit_manifest": true + } + ] + }, + { + "app_keys": [ + "val1", + "val2", + "val3", + "val4" + ] + } + ] +} diff --git a/tests/framework/CMakeLists.txt b/tests/framework/CMakeLists.txt index 1ecc82cfdbbac149f011347a38cf4e5e34f01b24..e61825ce8a284c0dc276cdcaba8f41595c4fc116 100644 --- a/tests/framework/CMakeLists.txt +++ b/tests/framework/CMakeLists.txt @@ -17,7 +17,6 @@ add_library(testing_framework_util STATIC test_util.cpp) target_link_libraries(testing_framework_util PUBLIC loader_common_options Vulkan::Headers) -set_target_properties(testing_framework_util ${LOADER_STANDARD_CXX_PROPERTIES}) if(UNIX OR APPLE) target_link_libraries(testing_framework_util PUBLIC ${CMAKE_DL_LIBS}) @@ -30,20 +29,20 @@ endif() target_include_directories(testing_framework_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) if (UNIX) - if (TEST_USE_ADDRESS_SANITIZER) + if (LOADER_ENABLE_ADDRESS_SANITIZER) target_compile_options(testing_framework_util PUBLIC -fsanitize=address) target_link_options(testing_framework_util PUBLIC -fsanitize=address) - target_compile_options(vulkan PUBLIC -fsanitize=address) - target_link_options(vulkan PUBLIC -fsanitize=address) endif() - if (TEST_USE_THREAD_SANITIZER) + if (LOADER_ENABLE_THREAD_SANITIZER) target_compile_options(testing_framework_util PUBLIC -fsanitize=thread) target_link_options(testing_framework_util PUBLIC -fsanitize=thread) - target_compile_options(vulkan PUBLIC -fsanitize=thread) - target_link_options(vulkan PUBLIC -fsanitize=thread) target_compile_options(gtest PUBLIC -fsanitize=thread) target_link_options(gtest PUBLIC -fsanitize=thread) endif() + if (LOADER_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER) + target_compile_options(testing_framework_util PUBLIC -fsanitize=undefined) + target_link_options(testing_framework_util PUBLIC -fsanitize=undefined) + endif() endif() if (MSVC) @@ -51,7 +50,6 @@ if (MSVC) target_compile_options(testing_framework_util PUBLIC /wd4458) endif() -include(CMakeParseArguments) function(AddSharedLibrary LIBRARY_NAME) set(singleValueArgs DEF_FILE) set(multiValueArgs SOURCES DEFINITIONS) @@ -61,7 +59,6 @@ function(AddSharedLibrary LIBRARY_NAME) add_library(${LIBRARY_NAME} SHARED ${PARSED_ARGS_SOURCES}) target_link_libraries(${LIBRARY_NAME} PUBLIC testing_framework_util) target_compile_definitions(${LIBRARY_NAME} PRIVATE ${PARSED_ARGS_DEFINITIONS} VK_NO_PROTOTYPES) - set_target_properties(${LIBRARY_NAME} ${LOADER_STANDARD_CXX_PROPERTIES}) # Windows requires export definitions for these libraries if(WIN32) target_sources(${LIBRARY_NAME} PRIVATE export_definitions/${PARSED_ARGS_DEF_FILE}.def) @@ -85,17 +82,20 @@ add_custom_command( PRE_BUILD COMMAND ${CMAKE_COMMAND} "-E" "copy_if_different" "${CMAKE_CURRENT_BINARY_DIR}/framework_config_$.h" "${CMAKE_CURRENT_BINARY_DIR}/framework_config.h" VERBATIM - PRE_BUILD DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/framework_config_$.h" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/framework_config.h" COMMENT "creating framework_config.h file ({event: PRE_BUILD}, {filename: framework_config.h })" ) add_custom_target (generate_framework_config DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/framework_config.h") +add_dependencies (generate_framework_config vulkan) add_dependencies (testing_framework_util generate_framework_config) add_library(testing_dependencies STATIC test_environment.cpp test_environment.h) target_link_libraries(testing_dependencies PUBLIC gtest Vulkan::Headers testing_framework_util shim-library) -target_include_directories(testing_dependencies PUBLIC ${CMAKE_BINARY_DIR}/tests/framework) +target_include_directories(testing_dependencies PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_compile_definitions(testing_dependencies PUBLIC "GTEST_LINKED_AS_SHARED_LIBRARY=1") -set_target_properties(testing_dependencies ${LOADER_STANDARD_CXX_PROPERTIES}) +if (APPLE_STATIC_LOADER) + target_compile_definitions(testing_dependencies PUBLIC "APPLE_STATIC_LOADER=1") + target_link_libraries(testing_dependencies PUBLIC vulkan) +endif() diff --git a/tests/framework/README.md b/tests/framework/README.md index 3b11698f91cf1ba429885568044499ebd4e60e58..7ae04c22e714295f4bc99f3ba2a3dc19b1d35e02 100644 --- a/tests/framework/README.md +++ b/tests/framework/README.md @@ -22,8 +22,8 @@ Use the CMake configuration `UPDATE_DEPS=ON` to automatically get all required t Or Ensure that `googletest` is in the `external` directory. And on Windows only, ensure that the `Detours` library is in the `external` directory. -Linux only: The CMake Configuration `TEST_USE_ADDRESS_SANITIZER` can be used to -enable Address Sanitizer inside the testing framework. +Linux & macOS only: The CMake Configuration `LOADER_ENABLE_ADDRESS_SANITIZER` can be used to +enable Address Sanitizer. Run the test executables as normal @@ -133,7 +133,7 @@ This is due to some functions being used to query other functions, which the shi There are many utilities that the test framework and tests have access to. These include: * Including common C and C++ headers * `FRAMEWORK_EXPORT` - macro used for exporting shared library funtions -* Environment Variable helpers: `get_env_var`, `set_env_var`, `remove_env_var` +* Environment Variable Wrapper: `EnvVarWrapper` for creating, setting, getting, and removing environment variables in a RAII manner * Windows API error handling helpers * filesystem abstractions: * `fs::path` - wrapper around std::string that has a similar API to C++17's `filesystem::path` library diff --git a/tests/framework/data/VkLayer_complex_file.json b/tests/framework/data/VkLayer_complex_file.json new file mode 100644 index 0000000000000000000000000000000000000000..dde37e3a99e41d66cd879eac9374204c701468c9 --- /dev/null +++ b/tests/framework/data/VkLayer_complex_file.json @@ -0,0 +1,741 @@ +{ + "file_format_version": "1.2.0", + "layer": { + "test_code_description": "This file is literally a copy of an installed Validation layer manifest file for linux. It was chosen because it contains a lot of complex json structures that aren't present in the test framework's generated json, so exercises cJSON better", + "name": "VK_LAYER_KHRONOS_validation", + "type": "GLOBAL", + "library_path": "libVkLayer_khronos_validation.so", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Khronos Validation Layer", + "introduction": "The main, comprehensive Khronos validation layer.\n\nVulkan is an Explicit API, enabling direct control over how GPUs actually work. By design, minimal error checking is done inside a Vulkan driver. Applications have full control and responsibility for correct operation. Any errors in how Vulkan is used can result in a crash. \n\nThe Khronos Valiation Layer can be enabled to assist development by enabling developers to verify their applications correctly use the Vulkan API.", + "platforms": [ + "WINDOWS", + "LINUX", + "ANDROID", + "MACOS" + ], + "url": "https://vulkan.lunarg.com/doc/sdk/latest/windows/khronos_validation_layer.html", + "instance_extensions": [ + { + "name": "VK_EXT_debug_report", + "spec_version": "9" + }, + { + "name": "VK_EXT_debug_utils", + "spec_version": "1" + }, + { + "name": "VK_EXT_validation_features", + "spec_version": "2" + } + ], + "device_extensions": [ + { + "name": "VK_EXT_debug_marker", + "spec_version": "4", + "entrypoints": [ + "vkDebugMarkerSetObjectTagEXT", + "vkDebugMarkerSetObjectNameEXT", + "vkCmdDebugMarkerBeginEXT", + "vkCmdDebugMarkerEndEXT", + "vkCmdDebugMarkerInsertEXT" + ] + }, + { + "name": "VK_EXT_validation_cache", + "spec_version": "1", + "entrypoints": [ + "vkCreateValidationCacheEXT", + "vkDestroyValidationCacheEXT", + "vkGetValidationCacheDataEXT", + "vkMergeValidationCachesEXT" + ] + }, + { + "name": "VK_EXT_tooling_info", + "spec_version": "1", + "entrypoints": [ + "vkGetPhysicalDeviceToolPropertiesEXT" + ] + } + ], + "features": { + "presets": [ + { + "label": "Standard", + "description": "Good default validation setup that balance validation coverage and performance.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT" + ] + } + ] + }, + { + "label": "Reduced-Overhead", + "description": "Disables some checks in the interest of better performance.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS" + ], + "status": "STABLE", + "editor_state": "01110111111111111111111001111111111110", + "settings": [ + { + "key": "enables", + "value": [] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VALIDATION_CHECK_DISABLE_IMAGE_LAYOUT_VALIDATION", + "VALIDATION_CHECK_DISABLE_COMMAND_BUFFER_STATE", + "VALIDATION_CHECK_DISABLE_OBJECT_IN_USE", + "VALIDATION_CHECK_DISABLE_QUERY_VALIDATION" + ] + } + ] + }, + { + "label": "Best Practices", + "description": "Provides warnings on valid API usage that is potential API misuse.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + } + ] + }, + { + "label": "Synchronization", + "description": "Identify resource access conflicts due to missing or incorrect synchronization operations between actions reading or writing the same regions of memory.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + } + ] + }, + { + "label": "GPU-Assisted", + "description": "Check for API usage errors at shader execution time.", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT", + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + } + ] + }, + { + "label": "Debug Printf", + "description": "Debug shader code by \"printing\" any values of interest to the debug callback or stdout.", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "status": "STABLE", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + }, + { + "key": "disables", + "value": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT" + ] + }, + { + "key": "enable_message_limit", + "value": false + } + ] + } + ], + "settings": [ + { + "key": "debug_action", + "label": "Debug Action", + "description": "Specifies what action is to be taken when a layer reports information", + "type": "FLAGS", + "flags": [ + { + "key": "VK_DBG_LAYER_ACTION_LOG_MSG", + "label": "Log Message", + "description": "Log a txt message to stdout or to a log filename.", + "settings": [ + { + "key": "log_filename", + "label": "Log Filename", + "description": "Specifies the output filename", + "type": "SAVE_FILE", + "default": "stdout", + "dependence": { + "mode": "ALL", + "settings": [ + { + "key": "debug_action", + "value": [ + "VK_DBG_LAYER_ACTION_LOG_MSG" + ] + } + ] + } + } + ] + }, + { + "key": "VK_DBG_LAYER_ACTION_CALLBACK", + "label": "Callback", + "description": "Call user defined callback function(s) that have been registered via the VK_EXT_debug_report extension. Since application must register callback, this is a NOOP for the settings file.", + "view": "HIDDEN" + }, + { + "key": "VK_DBG_LAYER_ACTION_DEBUG_OUTPUT", + "label": "Debug Output", + "description": "Log a txt message using the Windows OutputDebugString function.", + "platforms": [ + "WINDOWS" + ] + }, + { + "key": "VK_DBG_LAYER_ACTION_BREAK", + "label": "Break", + "description": "Trigger a breakpoint if a debugger is in use." + } + ], + "default": [ + "VK_DBG_LAYER_ACTION_LOG_MSG" + ] + }, + { + "key": "report_flags", + "label": "Message Severity", + "description": "Comma-delineated list of options specifying the types of messages to be reported", + "type": "FLAGS", + "flags": [ + { + "key": "info", + "label": "Info", + "description": "Report informational messages." + }, + { + "key": "warn", + "label": "Warning", + "description": "Report warnings from using the API in a manner which may lead to undefined behavior or to warn the user of common trouble spots. A warning does NOT necessarily signify illegal application behavior." + }, + { + "key": "perf", + "label": "Performance", + "description": "Report usage of the API that may cause suboptimal performance." + }, + { + "key": "error", + "label": "Error", + "description": "Report errors in API usage." + }, + { + "key": "debug", + "label": "Debug", + "description": "For layer development. Report messages for debugging layer behavior.", + "view": "HIDDEN" + } + ], + "default": [ + "error" + ] + }, + { + "key": "enable_message_limit", + "label": "Limit Duplicated Messages", + "description": "Enable limiting of duplicate messages.", + "type": "BOOL", + "default": true, + "settings": [ + { + "key": "duplicate_message_limit", + "env": "VK_LAYER_DUPLICATE_MESSAGE_LIMIT", + "label": "Max Duplicated Messages", + "description": "Maximum number of times any single validation message should be reported.", + "type": "INT", + "default": 10, + "range": { + "min": 1 + }, + "dependence": { + "mode": "ALL", + "settings": [ + { + "key": "enable_message_limit", + "value": true + } + ] + } + } + ] + }, + { + "key": "message_id_filter", + "label": "Mute Message VUIDs", + "description": "List of VUIDs and VUID identifers which are to be IGNORED by the validation layer", + "type": "LIST", + "env": "VK_LAYER_MESSAGE_ID_FILTER", + "default": [] + }, + { + "key": "disables", + "label": "Disables", + "description": "Specify areas of validation to be disabled", + "type": "FLAGS", + "env": "VK_LAYER_DISABLES", + "flags": [ + { + "key": "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT", + "label": "Thread Safety", + "description": "Thread checks. In order to not degrade performance, it might be best to run your program with thread-checking disabled most of the time, enabling it occasionally for a quick sanity check or when debugging difficult application behaviors." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT", + "label": "Stateless Parameter", + "description": "Stateless parameter checks. This may not always be necessary late in a development cycle." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT", + "label": "Object Lifetime", + "description": "Object tracking checks. This may not always be necessary late in a development cycle." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT", + "label": "Core", + "description": "The main, heavy-duty validation checks. This may be valuable early in the development cycle to reduce validation output while correcting parameter/object usage errors." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT", + "label": "Handle Wrapping", + "description": "Handle wrapping checks. Disable this feature if you are exerience crashes when creating new extensions or developing new Vulkan objects/structures." + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT", + "label": "Shader Validation", + "description": "Shader checks. These checks can be CPU intensive during application start up, especially if Shader Validation Caching is also disabled.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_COMMAND_BUFFER_STATE", + "label": "Command Buffer State", + "description": "Check that all Vulkan objects used by a command buffer have not been destroyed. These checks can be CPU intensive for some applications.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_IMAGE_LAYOUT_VALIDATION", + "label": "Image Layout", + "description": "Check that the layout of each image subresource is correct whenever it is used by a command buffer. These checks are very CPU intensive for some applications.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_QUERY_VALIDATION", + "label": "Query", + "description": "Checks for commands that use VkQueryPool objects.", + "view": "ADVANCED" + }, + { + "key": "VALIDATION_CHECK_DISABLE_OBJECT_IN_USE", + "label": "Object in Use", + "description": "Check that Vulkan objects are not in use by a command buffer when they are destroyed.", + "view": "ADVANCED" + }, + { + "key": "VK_VALIDATION_FEATURE_DISABLE_SHADER_VALIDATION_CACHE_EXT", + "label": "Shader Validation Caching", + "description": "Disable caching of shader validation results.", + "view": "ADVANCED" + } + ], + "default": [ + "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT" + ] + }, + { + "key": "enables", + "label": "Enables", + "description": "Setting an option here will enable specialized areas of validation", + "type": "FLAGS", + "env": "VK_LAYER_ENABLES", + "flags": [ + { + "key": "VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT", + "label": "Synchronization", + "description": "This feature reports resource access conflicts due to missing or incorrect synchronization operations between actions (Draw, Copy, Dispatch, Blit) reading or writing the same regions of memory.", + "url": "${LUNARG_SDK}/synchronization_usage.html", + "status": "STABLE", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_SYNCHRONIZATION_VALIDATION_QUEUE_SUBMIT", + "label": "QueueSubmit Synchronization Validation", + "description": "Enable synchronization validation between submitted command buffers when Synchronization Validation is enabled.", + "status": "ALPHA" + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT", + "label": "Debug Printf", + "description": "Enables processing of debug printf instructions in shaders and sending debug strings to the debug callback.", + "url": "${LUNARG_SDK}/debug_printf.html", + "status": "STABLE", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "settings": [ + { + "key": "printf_to_stdout", + "label": "Redirect Printf messages to stdout", + "description": "Enable redirection of Debug Printf messages from the debug callback to stdout", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + } + ] + } + }, + { + "key": "printf_verbose", + "label": "Printf verbose", + "description": "Set the verbosity of debug printf messages", + "type": "BOOL", + "default": false, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + } + ] + } + }, + { + "key": "printf_buffer_size", + "label": "Printf buffer size", + "description": "Set the size in bytes of the buffer used by debug printf", + "type": "INT", + "default": 1024, + "range": { + "min": 128, + "max": 1048576 + }, + "unit": "bytes", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT" + ] + } + ] + } + } + ] + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT", + "label": "GPU-Assisted", + "description": "Check for API usage errors at shader execution time.", + "url": "${LUNARG_SDK}/gpu_validation.html", + "platforms": [ + "WINDOWS", + "LINUX" + ], + "settings": [ + { + "key": "gpuav_descriptor_indexing", + "label": "Check descriptor indexing accesses", + "description": "Enable descriptor indexing access checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "gpuav_buffer_oob", + "label": "Check Out of Bounds ", + "description": "Enable buffer out of bounds checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "validate_draw_indirect", + "label": "Check Draw Indirect Count Buffers and firstInstance values", + "description": "Enable draw indirect checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "validate_dispatch_indirect", + "label": "Check Dispatch Indirect group count values", + "description": "Enable dispatch indirect checking", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + }, + { + "key": "vma_linear_output", + "label": "Use VMA linear memory allocations for GPU-AV output buffers", + "description": "Use linear allocation algorithm", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX" + ], + "dependence": { + "mode": "ANY", + "settings": [ + { + "key": "enables", + "value": [ + "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT" + ] + } + ] + } + } + ] + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT", + "label": "Reserve Descriptor Set Binding Slot", + "description": "Specifies that the validation layers reserve a descriptor set binding slot for their own use. The layer reports a value for VkPhysicalDeviceLimits::maxBoundDescriptorSets that is one less than the value reported by the device. If the device supports the binding of only one descriptor set, the validation layer does not perform GPU-assisted validation.", + "platforms": [ + "WINDOWS", + "LINUX" + ] + }, + { + "key": "VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT", + "label": "Best Practices", + "description": "Activating this feature enables the output of warnings related to common misuse of the API, but which are not explicitly prohibited by the specification.", + "url": "${LUNARG_SDK}/best_practices.html", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_ARM", + "label": "ARM-specific best practices", + "description": "Activating this feature enables the output of warnings related to ARM-specific misuse of the API, but which are not explicitly prohibited by the specification.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_AMD", + "label": "AMD-specific best practices", + "description": "Adds check for spec-conforming but non-ideal code on AMD GPUs.", + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS" + ] + }, + { + "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_NVIDIA", + "label": "NVIDIA-specific best practices", + "description": "Activating this feature enables the output of warnings related to NVIDIA-specific misuse of the API, but which are not explicitly prohibited by the specification.", + "platforms": [ + "WINDOWS", + "LINUX", + "ANDROID" + ] + } + ], + "default": [] + }, + { + "key": "fine_grained_locking", + "env": "VK_LAYER_FINE_GRAINED_LOCKING", + "label": "Fine Grained Locking", + "description": "Enable fine grained locking for Core Validation, which should improve performance in multithreaded applications. This setting allows the optimization to be disabled for debugging.", + "status": "STABLE", + "type": "BOOL", + "default": true, + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS", + "ANDROID" + ] + } + ] + } + } +} diff --git a/tests/framework/data/fuzzer_output.json b/tests/framework/data/fuzzer_output.json new file mode 100644 index 0000000000000000000000000000000000000000..571378087faf05d3e88d5ab0739bf7747cbd1751 --- /dev/null +++ b/tests/framework/data/fuzzer_output.json @@ -0,0 +1,125 @@ +{ + "file_format_version": "1.2.0", + "settings_array": [ + { + "device_e": [ + "/out/settings_fuzzer", + "/work/settings_fuzzer" + ], + "stderr_log": [ + "all", + "info", + "warn", + "perf", + "error", + "debug", + "layer", + "driver", + "validation" + ], + "log_locations": [ + { + "destinations": [ + "/tmp" + ], + "filters": [ + "all" + ] + } + ], + "layers": [ + { + "control": "auto", + "name": "test_auto", + "path": "test", + "treat_as_implicit_manifest": true + }, + { + "control": "on", + "tame": "test_on", + "path": "test", + "treat_as_implicit_manifeÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿst": true + }, + { + "control": "off", + "name": "test_off", + "path": "test", + "treat_as_implicit_manifest": true + } + ] + }, + { + "app_keys": [ + "val1", + "val0", + "val3", + "val4" + ] + } + ], + "layers": [ + { + "name": "VK_LAYER_test_layer_1", + "type": "INSTANCE", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Test layer 1", + "library_path": "libVkLayer_khronos_validation.so", + "component_layers": [ + "VK_LAYER_test_layer_1", + "VK_LAYER_test_layer_2" + ], + "disable_environment": { + "test_key": "test_value" + }, + "enbale_environment": { + "test_key": "test_value" + }, + "app_keys": [ + "/out/settings_fuzzer" + ] + }, + { + "name": "VK_LAYER_test_layer_2", + "type": "GLOBAL", + "api_version": "1.3.231", + "implementation_version": "1", + "description": "Test layer 2", + "library_path": "libVkLayer_khronos_validation.so", + "component_*layers": [ + "VK_LAYER_test_layer_1", + "VK_LAYER_test_layer_2" + ], + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": [ + "/out/settings_fuzzer" + ] + }, + { + "name": "VK_LAYER_KHRONOS_validation", + "type": "GLOBAL", + "api_version": "0.3.231", + "implementation_version": "1", + "description": "Khronos validation", + "library_path": "libVkLayer_khronos_validation.so", + "disable_environment": { + "test_key": "test_value" + }, + "enable_environment": { + "test_key": "test_value" + }, + "app_keys": [ + "/out/settings_fuzzer" + ] + } + ], + "ICD": { + "library_path": "scuvrl//kan-loader/tests/framework/data/binaries/libdummy with error 386.so", + "api_version": "1.3.231" + } +} diff --git a/tests/framework/framework_config.h.in b/tests/framework/framework_config.h.in index ddbb0ab4d0251aa78c22497b7ea91fc9f7379ec7..aa14908d2853bcb23f350d246707b46236509287 100644 --- a/tests/framework/framework_config.h.in +++ b/tests/framework/framework_config.h.in @@ -42,8 +42,7 @@ #define TEST_ICD_PATH_VERSION_2 "$" #define TEST_JSON_NAME_VERSION_2_UNICODE "\xf0\x9f\x8c\x8b" -#define TEST_ICD_PATH_VERSION_2_UNICODE \ - "$/" TEST_JSON_NAME_VERSION_2_UNICODE "$" +#define TEST_ICD_PATH_VERSION_2_UNICODE "$" // assumes version 2 exports #define TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA "$" @@ -55,6 +54,10 @@ // All possible defines for v6 #define TEST_ICD_PATH_VERSION_6 "$" +// Version 7 +#define TEST_ICD_PATH_VERSION_7 "$" +#define TEST_ICD_PATH_VERSION_7_WITH_ADDITIONAL_EXPORTS "$" + // TestLayer binaries #define TEST_LAYER_PATH_EXPORT_BASE "$" #define TEST_LAYER_PATH_EXPORT_VERSION_0 "$" @@ -65,6 +68,9 @@ #define TEST_LAYER_WRAP_OBJECTS_2 "$" #define TEST_LAYER_WRAP_OBJECTS_3 "$" +#define COMPLEX_JSON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/data/VkLayer_complex_file.json" +#define FUZZER_OUTPUT_JSON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/data/fuzzer_output.json" + // Dummy Binaries #if _WIN32 || _WIN64 #define DUMMY_BINARY_WINDOWS_64 "${CMAKE_CURRENT_SOURCE_DIR}/data/binaries/dummy_library_pe_64.dll" @@ -72,7 +78,7 @@ #define BAD_DUMMY_BINARY_WINDOWS_64 "${CMAKE_CURRENT_SOURCE_DIR}/data/binaries/libdummy_library_elf_64.dll" #define BAD_DUMMY_BINARY_WINDOWS_32 "${CMAKE_CURRENT_SOURCE_DIR}/data/binaries/libdummy_library_elf_32.dll" #endif -#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) #define DUMMY_BINARY_LINUX_64 "${CMAKE_CURRENT_SOURCE_DIR}/data/binaries/libdummy_library_elf_64.so" #define DUMMY_BINARY_LINUX_32 "${CMAKE_CURRENT_SOURCE_DIR}/data/binaries/libdummy_library_elf_32.so" #define BAD_DUMMY_BINARY_LINUX_64 "${CMAKE_CURRENT_SOURCE_DIR}/data/binaries/dummy_library_pe_64.so" @@ -89,7 +95,7 @@ #define CURRENT_PLATFORM_DUMMY_BINARY_BAD BAD_DUMMY_BINARY_WINDOWS_32 #endif #endif -#if defined(__linux__) +#if defined(__linux__) || defined(__GNU__) #if __x86_64__ || __ppc64__ #define CURRENT_PLATFORM_DUMMY_BINARY_WRONG_TYPE DUMMY_BINARY_LINUX_32 #define CURRENT_PLATFORM_DUMMY_BINARY_BAD BAD_DUMMY_BINARY_LINUX_64 diff --git a/tests/framework/icd/CMakeLists.txt b/tests/framework/icd/CMakeLists.txt index 9deb6d420115dbd184714d8d9b1308eebac47828..28548ef1b853ef952b601bffcf70b6e67949f260 100644 --- a/tests/framework/icd/CMakeLists.txt +++ b/tests/framework/icd/CMakeLists.txt @@ -39,9 +39,14 @@ AddSharedLibrary(test_icd_version_2_export_icd_gpdpa DEF_FILE test_icd_2_gpdpa AddSharedLibrary(test_icd_version_6 DEF_FILE test_icd_6 SOURCES test_icd.cpp DEFINITIONS TEST_ICD_EXPORT_ICD_GPDPA=1 TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES=1 ${TEST_ICD_VERSION_2_DEFINES}) - -add_custom_command(TARGET test_icd_version_2 POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - "$" - "$/🌋${CMAKE_SHARED_LIBRARY_SUFFIX}" -) +AddSharedLibrary(test_icd_version_7 DEF_FILE test_icd_7 + SOURCES test_icd.cpp + DEFINITIONS TEST_ICD_EXPOSE_VERSION_7=1 ${TEST_ICD_VERSION_2_DEFINES}) +AddSharedLibrary(test_icd_version_7_with_additional_exports DEF_FILE test_icd_7_with_exports + SOURCES test_icd.cpp + DEFINITIONS TEST_ICD_EXPOSE_VERSION_7=1 TEST_ICD_EXPORT_ICD_GPDPA=1 + TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES=1 ${TEST_ICD_VERSION_2_DEFINES}) +AddSharedLibrary(test_unicode DEF_FILE test_icd_2 + SOURCES test_icd.cpp + DEFINITIONS ${TEST_ICD_VERSION_2_DEFINES}) +set_target_properties(test_unicode PROPERTIES OUTPUT_NAME "🌋") # Test unicode library diff --git a/tests/framework/icd/export_definitions/test_icd_7.def b/tests/framework/icd/export_definitions/test_icd_7.def new file mode 100644 index 0000000000000000000000000000000000000000..4414bbeabc0054bf64b638ad6a790a24fae03a8a --- /dev/null +++ b/tests/framework/icd/export_definitions/test_icd_7.def @@ -0,0 +1,3 @@ +LIBRARY test_icd_version_7 +EXPORTS + vk_icdGetInstanceProcAddr diff --git a/tests/framework/icd/export_definitions/test_icd_7_with_exports.def b/tests/framework/icd/export_definitions/test_icd_7_with_exports.def new file mode 100644 index 0000000000000000000000000000000000000000..7861805730574be2cd880a05b51ff3ab81d21d5d --- /dev/null +++ b/tests/framework/icd/export_definitions/test_icd_7_with_exports.def @@ -0,0 +1,6 @@ +LIBRARY test_icd_version_7_with_additional_exports +EXPORTS + vk_icdGetInstanceProcAddr + vk_icdNegotiateLoaderICDInterfaceVersion + vk_icdEnumerateAdapterPhysicalDevices + vk_icdGetPhysicalDeviceProcAddr diff --git a/tests/framework/icd/physical_device.h b/tests/framework/icd/physical_device.h index fbe5cb14fa746dded988ba5bd05b5b5ee0b42212..e88bee89b947a37b52a2c82221845fdc48b4c921 100644 --- a/tests/framework/icd/physical_device.h +++ b/tests/framework/icd/physical_device.h @@ -34,8 +34,7 @@ struct PhysicalDevice { PhysicalDevice() {} PhysicalDevice(std::string name) : deviceName(name) {} PhysicalDevice(const char* name) : deviceName(name) {} - PhysicalDevice(std::string name, uint32_t bus) : deviceName(name), pci_bus(bus) {} - PhysicalDevice(const char* name, uint32_t bus) : deviceName(name), pci_bus(bus) {} + DispatchableHandle vk_physical_device; BUILDER_VALUE(PhysicalDevice, std::string, deviceName, "") BUILDER_VALUE(PhysicalDevice, VkPhysicalDeviceProperties, properties, {}) @@ -64,9 +63,19 @@ struct PhysicalDevice { BUILDER_VALUE(PhysicalDevice, VkDisplayModeKHR, display_mode, {}) BUILDER_VALUE(PhysicalDevice, VkDisplayPlaneCapabilitiesKHR, display_plane_capabilities, {}) - // VkDevice handles created from this physical device - std::vector device_handles; + BUILDER_VALUE(PhysicalDevice, VkLayeredDriverUnderlyingApiMSFT, layered_driver_underlying_api, + VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT) + PhysicalDevice& set_api_version(uint32_t version) { + properties.apiVersion = version; + return *this; + } + + PhysicalDevice&& finish() { return std::move(*this); } + + // Objects created from this physical device + std::vector device_handles; + std::vector device_create_infos; std::vector> queue_handles; // Unknown physical device functions. Add a `VulkanFunction` to this list which will be searched in diff --git a/tests/framework/icd/test_icd.cpp b/tests/framework/icd/test_icd.cpp index 75ccb8191d0bd833454c98485311cbe3c7c7aadb..a8cf1b24f560cbcee7bdac8c67cd0d8f719a3f02 100644 --- a/tests/framework/icd/test_icd.cpp +++ b/tests/framework/icd/test_icd.cpp @@ -1,7 +1,9 @@ /* - * Copyright (c) 2021-2022 The Khronos Group Inc. - * Copyright (c) 2021-2022 Valve Corporation - * Copyright (c) 2021-2022 LunarG, Inc. + * 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 @@ -28,25 +30,31 @@ #include "test_icd.h" // export vk_icdGetInstanceProcAddr -#ifndef TEST_ICD_EXPORT_ICD_GIPA +#if !defined(TEST_ICD_EXPORT_ICD_GIPA) #define TEST_ICD_EXPORT_ICD_GIPA 0 #endif // export vk_icdNegotiateLoaderICDInterfaceVersion -#ifndef TEST_ICD_EXPORT_NEGOTIATE_INTERFACE_VERSION +#if !defined(TEST_ICD_EXPORT_NEGOTIATE_INTERFACE_VERSION) #define TEST_ICD_EXPORT_NEGOTIATE_INTERFACE_VERSION 0 #endif // export vk_icdGetPhysicalDeviceProcAddr -#ifndef TEST_ICD_EXPORT_ICD_GPDPA +#if !defined(TEST_ICD_EXPORT_ICD_GPDPA) #define TEST_ICD_EXPORT_ICD_GPDPA 0 #endif // export vk_icdEnumerateAdapterPhysicalDevices -#ifndef TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES +#if !defined(TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES) #define TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES 0 #endif +// expose vk_icdNegotiateLoaderICDInterfaceVersion, vk_icdEnumerateAdapterPhysicalDevices, and vk_icdGetPhysicalDeviceProcAddr +// through vk_icdGetInstanceProcAddr or vkGetInstanceProcAddr +#if !defined(TEST_ICD_EXPOSE_VERSION_7) +#define TEST_ICD_EXPOSE_VERSION_7 0 +#endif + TestICD icd; extern "C" { FRAMEWORK_EXPORT TestICD* get_test_icd_func() { return &icd; } @@ -167,13 +175,14 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceLayerProperties(uint32_t* VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceVersion(uint32_t* pApiVersion) { if (pApiVersion != nullptr) { - *pApiVersion = VK_API_VERSION_1_0; + *pApiVersion = icd.icd_api_version; } return VK_SUCCESS; } VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) { + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkInstance* pInstance) { if (pCreateInfo == nullptr || pCreateInfo->pApplicationInfo == nullptr) { return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -199,10 +208,11 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) {} +VKAPI_ATTR void VKAPI_CALL test_vkDestroyInstance([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator) {} // VK_SUCCESS,VK_INCOMPLETE -VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, +VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDevices([[maybe_unused]] VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) { if (pPhysicalDevices == nullptr) { *pPhysicalDeviceCount = static_cast(icd.physical_devices.size()); @@ -223,8 +233,9 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDevices(VkInstance instan } // VK_SUCCESS,VK_INCOMPLETE, VK_ERROR_INITIALIZATION_FAILED -VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDeviceGroups( - VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) { +VKAPI_ATTR VkResult VKAPI_CALL +test_vkEnumeratePhysicalDeviceGroups([[maybe_unused]] VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, + VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) { VkResult result = VK_SUCCESS; if (pPhysicalDeviceGroupProperties == nullptr) { @@ -258,6 +269,9 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDeviceGroups( pPhysicalDeviceGroupProperties[device_group].physicalDeviceCount = 1; pPhysicalDeviceGroupProperties[device_group].physicalDevices[0] = icd.physical_devices[device_group].vk_physical_device.handle; + for (size_t i = 1; i < VK_MAX_DEVICE_GROUP_SIZE; i++) { + pPhysicalDeviceGroupProperties[device_group].physicalDevices[i] = {}; + } } } else { group_count = static_cast(icd.physical_device_groups.size()); @@ -275,6 +289,9 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDeviceGroups( pPhysicalDeviceGroupProperties[device_group].physicalDevices[i] = icd.physical_device_groups[device_group].physical_device_handles[i]->vk_physical_device.handle; } + for (size_t i = handles_written; i < VK_MAX_DEVICE_GROUP_SIZE; i++) { + pPhysicalDeviceGroupProperties[device_group].physicalDevices[i] = {}; + } pPhysicalDeviceGroupProperties[device_group].physicalDeviceCount = handles_written; } } @@ -294,10 +311,9 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDeviceGroups( return result; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDebugUtilsMessengerEXT(VkInstance instance, - const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDebugUtilsMessengerEXT* pMessenger) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDebugUtilsMessengerEXT( + [[maybe_unused]] VkInstance instance, [[maybe_unused]] const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pMessenger) { if (nullptr != pMessenger) { uint64_t fake_msgr_handle = reinterpret_cast(new uint8_t); icd.messenger_handles.push_back(fake_msgr_handle); @@ -311,8 +327,9 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDebugUtilsMessengerEXT(VkInstance in return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, - const VkAllocationCallbacks* pAllocator) { +VKAPI_ATTR void VKAPI_CALL test_vkDestroyDebugUtilsMessengerEXT([[maybe_unused]] VkInstance instance, + VkDebugUtilsMessengerEXT messenger, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator) { if (messenger != VK_NULL_HANDLE) { uint64_t fake_msgr_handle = (uint64_t)(messenger); auto found_iter = std::find(icd.messenger_handles.begin(), icd.messenger_handles.end(), fake_msgr_handle); @@ -327,11 +344,78 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroyDebugUtilsMessengerEXT(VkInstance insta } } +// Debug utils & debug marker ext stubs +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); + if (pd != icd.physical_devices.at(icd.lookup_device(dev).phys_dev_index).vk_physical_device.handle) + return VK_ERROR_DEVICE_LOST; + } + if (pTagInfo && pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + if (pTagInfo->object != icd.surface_handles.at(0)) return VK_ERROR_DEVICE_LOST; + } + if (pTagInfo && pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + if (pTagInfo->object != (uint64_t)(uintptr_t)icd.instance_handle.handle) return VK_ERROR_DEVICE_LOST; + } + return VK_SUCCESS; +} +VKAPI_ATTR VkResult VKAPI_CALL test_vkDebugMarkerSetObjectNameEXT(VkDevice dev, const VkDebugMarkerObjectNameInfoEXT* pNameInfo) { + if (pNameInfo && pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + VkPhysicalDevice pd = (VkPhysicalDevice)(uintptr_t)(pNameInfo->object); + if (pd != icd.physical_devices.at(icd.lookup_device(dev).phys_dev_index).vk_physical_device.handle) + return VK_ERROR_DEVICE_LOST; + } + if (pNameInfo && pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + if (pNameInfo->object != icd.surface_handles.at(0)) return VK_ERROR_DEVICE_LOST; + } + if (pNameInfo && pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + if (pNameInfo->object != (uint64_t)(uintptr_t)icd.instance_handle.handle) return VK_ERROR_DEVICE_LOST; + } + return VK_SUCCESS; +} +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*) {} + +VKAPI_ATTR VkResult VKAPI_CALL test_vkSetDebugUtilsObjectNameEXT(VkDevice dev, const VkDebugUtilsObjectNameInfoEXT* pNameInfo) { + if (pNameInfo && pNameInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + VkPhysicalDevice pd = (VkPhysicalDevice)(uintptr_t)(pNameInfo->objectHandle); + if (pd != icd.physical_devices.at(icd.lookup_device(dev).phys_dev_index).vk_physical_device.handle) + return VK_ERROR_DEVICE_LOST; + } + if (pNameInfo && pNameInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) { + if (pNameInfo->objectHandle != icd.surface_handles.at(0)) return VK_ERROR_DEVICE_LOST; + } + if (pNameInfo && pNameInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + if (pNameInfo->objectHandle != (uint64_t)(uintptr_t)icd.instance_handle.handle) return VK_ERROR_DEVICE_LOST; + } + return VK_SUCCESS; +} +VKAPI_ATTR VkResult VKAPI_CALL test_vkSetDebugUtilsObjectTagEXT(VkDevice dev, const VkDebugUtilsObjectTagInfoEXT* pTagInfo) { + if (pTagInfo && pTagInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + VkPhysicalDevice pd = (VkPhysicalDevice)(uintptr_t)(pTagInfo->objectHandle); + if (pd != icd.physical_devices.at(icd.lookup_device(dev).phys_dev_index).vk_physical_device.handle) + return VK_ERROR_DEVICE_LOST; + } + if (pTagInfo && pTagInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) { + if (pTagInfo->objectHandle != icd.surface_handles.at(0)) return VK_ERROR_DEVICE_LOST; + } + if (pTagInfo && pTagInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + if (pTagInfo->objectHandle != (uint64_t)(uintptr_t)icd.instance_handle.handle) return VK_ERROR_DEVICE_LOST; + } + return VK_SUCCESS; +} +VKAPI_ATTR void VKAPI_CALL test_vkQueueBeginDebugUtilsLabelEXT(VkQueue, const VkDebugUtilsLabelEXT*) {} +VKAPI_ATTR void VKAPI_CALL test_vkQueueEndDebugUtilsLabelEXT(VkQueue) {} +VKAPI_ATTR void VKAPI_CALL test_vkQueueInsertDebugUtilsLabelEXT(VkQueue, const VkDebugUtilsLabelEXT*) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer, const VkDebugUtilsLabelEXT*) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer, const VkDebugUtilsLabelEXT*) {} + //// Physical Device functions //// // VK_SUCCESS,VK_INCOMPLETE -VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, - VkLayerProperties* pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateDeviceLayerProperties(VkPhysicalDevice, uint32_t*, VkLayerProperties*) { assert(false && "ICD's don't contain layers???"); return VK_SUCCESS; } @@ -357,7 +441,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceQueueFamilyProperties(VkPhysi } VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) { + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) { // VK_SUCCESS auto found = std::find_if(icd.physical_devices.begin(), icd.physical_devices.end(), [physicalDevice](PhysicalDevice& phys_dev) { return phys_dev.vk_physical_device.handle == physicalDevice; @@ -366,21 +450,26 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDevice(VkPhysicalDevice physicalDevi auto device_handle = DispatchableHandle(); *pDevice = device_handle.handle; found->device_handles.push_back(device_handle.handle); - icd.device_handles.emplace_back(std::move(device_handle)); - + found->device_create_infos.push_back(DeviceCreateInfo{pCreateInfo}); for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++) { found->queue_handles.emplace_back(); } + icd.device_handles.emplace_back(std::move(device_handle)); return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) { +VKAPI_ATTR void VKAPI_CALL test_vkDestroyDevice(VkDevice device, [[maybe_unused]] const VkAllocationCallbacks* pAllocator) { auto found = std::find(icd.device_handles.begin(), icd.device_handles.end(), device); if (found != icd.device_handles.end()) icd.device_handles.erase(found); + auto fd = icd.lookup_device(device); + if (!fd.found) return; + auto& phys_dev = icd.physical_devices.at(fd.phys_dev_index); + phys_dev.device_handles.erase(phys_dev.device_handles.begin() + fd.dev_index); + phys_dev.device_create_infos.erase(phys_dev.device_create_infos.begin() + fd.dev_index); } -VKAPI_ATTR VkResult VKAPI_CALL generic_tool_props_function(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, +VKAPI_ATTR VkResult VKAPI_CALL generic_tool_props_function([[maybe_unused]] VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolPropertiesEXT* pToolProperties) { if (icd.tooling_properties.size() == 0) { return VK_SUCCESS; @@ -439,7 +528,7 @@ void common_nondispatch_handle_creation(std::vector& handles, HandleTy *pHandle = to_nondispatch_handle(handles.back()); } } -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { @@ -448,62 +537,62 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateAndroidSurfaceKHR(VkInstance instanc } #endif -#ifdef VK_USE_PLATFORM_WIN32_KHR -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +#if defined(VK_USE_PLATFORM_WIN32_KHR) +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateWin32SurfaceKHR([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkWin32SurfaceCreateInfoKHR* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } -VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex) { - return VK_TRUE; -} +VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice, uint32_t) { return VK_TRUE; } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateWaylandSurfaceKHR([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } -VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - struct wl_display* display) { +VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice, uint32_t, + struct wl_display*) { return VK_TRUE; } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +#if defined(VK_USE_PLATFORM_XCB_KHR) +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateXcbSurfaceKHR([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkXcbSurfaceCreateInfoKHR* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } -VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - xcb_connection_t* connection, - xcb_visualid_t visual_id) { +VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice, uint32_t, xcb_connection_t*, + xcb_visualid_t) { return VK_TRUE; } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +#if defined(VK_USE_PLATFORM_XLIB_KHR) +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateXlibSurfaceKHR([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkXlibSurfaceCreateInfoKHR* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } -VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, Display* dpy, - VisualID visualID) { +VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice, uint32_t, Display*, VisualID) { return VK_TRUE; } #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDirectFBSurfaceEXT(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { @@ -518,23 +607,27 @@ VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceDirectFBPresentationSuppo #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_MACOS_MVK -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +#if defined(VK_USE_PLATFORM_MACOS_MVK) +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMacOSSurfaceMVK([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +#if defined(VK_USE_PLATFORM_IOS_MVK) +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateIOSSurfaceMVK([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkIOSSurfaceCreateInfoMVK* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, @@ -545,14 +638,16 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateStreamDescriptorSurfaceGGP(VkInstanc #endif // VK_USE_PLATFORM_GGP #if defined(VK_USE_PLATFORM_METAL_EXT) -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMetalSurfaceEXT(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMetalSurfaceEXT([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkMetalSurfaceCreateInfoEXT* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateScreenSurfaceQNX(VkInstance instance, const VkScreenSurfaceCreateInfoQNX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); @@ -566,15 +661,16 @@ VKAPI_ATTR VkBool32 VKAPI_CALL test_vkGetPhysicalDeviceScreenPresentationSupport } #endif // VK_USE_PLATFORM_SCREEN_QNX -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateHeadlessSurfaceEXT(VkInstance instance, - const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateHeadlessSurfaceEXT([[maybe_unused]] VkInstance instance, + [[maybe_unused]] const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface) { common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks* pAllocator) { +VKAPI_ATTR void VKAPI_CALL test_vkDestroySurfaceKHR([[maybe_unused]] VkInstance instance, VkSurfaceKHR surface, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator) { if (surface != VK_NULL_HANDLE) { uint64_t fake_surf_handle = from_nondispatch_handle(surface); auto found_iter = std::find(icd.surface_handles.begin(), icd.surface_handles.end(), fake_surf_handle); @@ -586,25 +682,50 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroySurfaceKHR(VkInstance instance, VkSurfa } } } - -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) { +// VK_KHR_swapchain +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateSwapchainKHR([[maybe_unused]] VkDevice device, + [[maybe_unused]] const VkSwapchainCreateInfoKHR* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchain) { common_nondispatch_handle_creation(icd.swapchain_handles, pSwapchain); return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, - const VkAllocationCallbacks* pAllocator) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetSwapchainImagesKHR([[maybe_unused]] VkDevice device, + [[maybe_unused]] VkSwapchainKHR swapchain, + uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) { + std::vector handles{123, 234, 345, 345, 456}; + if (pSwapchainImages == nullptr) { + if (pSwapchainImageCount) *pSwapchainImageCount = static_cast(handles.size()); + } else if (pSwapchainImageCount) { + for (uint32_t i = 0; i < *pSwapchainImageCount && i < handles.size(); i++) { + pSwapchainImages[i] = to_nondispatch_handle(handles.back()); + } + if (*pSwapchainImageCount < handles.size()) return VK_INCOMPLETE; + } + return VK_SUCCESS; +} + +VKAPI_ATTR void VKAPI_CALL test_vkDestroySwapchainKHR([[maybe_unused]] VkDevice device, VkSwapchainKHR swapchain, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator) { if (swapchain != VK_NULL_HANDLE) { uint64_t fake_swapchain_handle = from_nondispatch_handle(swapchain); auto found_iter = icd.swapchain_handles.erase( std::remove(icd.swapchain_handles.begin(), icd.swapchain_handles.end(), fake_swapchain_handle), icd.swapchain_handles.end()); - if (found_iter == icd.swapchain_handles.end()) { + if (!icd.swapchain_handles.empty() && found_iter == icd.swapchain_handles.end()) { assert(false && "Swapchain not found during destroy!"); } } } +// VK_KHR_swapchain with 1.1 +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDeviceGroupSurfacePresentModesKHR([[maybe_unused]] VkDevice device, + [[maybe_unused]] VkSurfaceKHR surface, + VkDeviceGroupPresentModeFlagsKHR* pModes) { + if (!pModes) return VK_ERROR_INITIALIZATION_FAILED; + *pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR; + return VK_SUCCESS; +} // VK_KHR_surface VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, @@ -679,47 +800,40 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceDisplayPlanePropertiesKHR FillCountPtr(icd.GetPhysDevice(physicalDevice).display_plane_properties, pPropertyCount, pProperties); return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, + [[maybe_unused]] uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays) { FillCountPtr(icd.GetPhysDevice(physicalDevice).displays, pDisplayCount, pDisplays); return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, - uint32_t* pPropertyCount, +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, + [[maybe_unused]] VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties) { FillCountPtr(icd.GetPhysDevice(physicalDevice).display_mode_properties, pPropertyCount, pProperties); return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, - const VkDisplayModeCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, [[maybe_unused]] VkDisplayKHR display, + [[maybe_unused]] const VkDisplayModeCreateInfoKHR* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkDisplayModeKHR* pMode) { if (nullptr != pMode) { *pMode = icd.GetPhysDevice(physicalDevice).display_mode; } return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, - uint32_t planeIndex, +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, + [[maybe_unused]] VkDisplayModeKHR mode, + [[maybe_unused]] uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities) { if (nullptr != pCapabilities) { *pCapabilities = icd.GetPhysDevice(physicalDevice).display_plane_capabilities; } return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDisplayPlaneSurfaceKHR(VkInstance instance, - const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, - 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 - } +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDisplayPlaneSurfaceKHR( + [[maybe_unused]] VkInstance instance, [[maybe_unused]] const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) { + common_nondispatch_handle_creation(icd.surface_handles, pSurface); return VK_SUCCESS; } @@ -750,21 +864,32 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhys } return VK_SUCCESS; } +// VK_KHR_display_swapchain +VkResult test_vkCreateSharedSwapchainsKHR([[maybe_unused]] VkDevice device, uint32_t swapchainCount, + [[maybe_unused]] const VkSwapchainCreateInfoKHR* pCreateInfos, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains) { + for (uint32_t i = 0; i < swapchainCount; i++) { + common_nondispatch_handle_creation(icd.swapchain_handles, &pSwapchains[i]); + } + return VK_SUCCESS; +} //// misc -VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateCommandPool([[maybe_unused]] VkDevice device, + [[maybe_unused]] const VkCommandPoolCreateInfo* pCreateInfo, + [[maybe_unused]] const VkAllocationCallbacks* pAllocator, + VkCommandPool* pCommandPool) { if (pCommandPool != nullptr) { pCommandPool = reinterpret_cast(0xdeadbeefdeadbeef); } return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, - const VkAllocationCallbacks* pAllocator) { +VKAPI_ATTR void VKAPI_CALL test_vkDestroyCommandPool(VkDevice, VkCommandPool, const VkAllocationCallbacks*) { // do nothing, leak memory for now } -VKAPI_ATTR VkResult VKAPI_CALL test_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, +VKAPI_ATTR VkResult VKAPI_CALL test_vkAllocateCommandBuffers([[maybe_unused]] VkDevice device, + const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers) { if (pAllocateInfo != nullptr && pCommandBuffers != nullptr) { for (size_t i = 0; i < pAllocateInfo->commandBufferCount; i++) { @@ -775,17 +900,19 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkAllocateCommandBuffers(VkDevice device, co return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) { - *pQueue = icd.physical_devices.back().queue_handles[queueIndex].handle; +VKAPI_ATTR void VKAPI_CALL test_vkGetDeviceQueue([[maybe_unused]] VkDevice device, [[maybe_unused]] uint32_t queueFamilyIndex, + uint32_t queueIndex, VkQueue* pQueue) { + auto fd = icd.lookup_device(device); + if (fd.found) { + *pQueue = icd.physical_devices.at(fd.phys_dev_index).queue_handles[queueIndex].handle; + } } // VK_EXT_acquire_drm_display -VKAPI_ATTR VkResult VKAPI_CALL test_vkAcquireDrmDisplayEXT(VkPhysicalDevice physicalDevice, int32_t drmFd, VkDisplayKHR display) { - return VK_SUCCESS; -} +VKAPI_ATTR VkResult VKAPI_CALL test_vkAcquireDrmDisplayEXT(VkPhysicalDevice, int32_t, VkDisplayKHR) { return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDrmDisplayEXT(VkPhysicalDevice physicalDevice, int32_t drmFd, uint32_t connectorId, - VkDisplayKHR* display) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDrmDisplayEXT(VkPhysicalDevice physicalDevice, [[maybe_unused]] int32_t drmFd, + [[maybe_unused]] uint32_t connectorId, VkDisplayKHR* display) { if (nullptr != display && icd.GetPhysDevice(physicalDevice).displays.size() > 0) { *display = icd.GetPhysDevice(physicalDevice).displays[0]; } @@ -816,11 +943,10 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDe memcpy(pMemoryProperties, &icd.GetPhysDevice(physicalDevice).memory_properties, sizeof(VkPhysicalDeviceMemoryProperties)); } } -VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, - VkImageType type, VkSampleCountFlagBits samples, - VkImageUsageFlags usage, VkImageTiling tiling, - uint32_t* pPropertyCount, - VkSparseImageFormatProperties* pProperties) { +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); } VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, @@ -830,10 +956,10 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceFormatProperties(VkPhysicalDe sizeof(VkFormatProperties)); } } -VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, - VkImageType type, VkImageTiling tiling, - VkImageUsageFlags usage, VkImageCreateFlags flags, - VkImageFormatProperties* pImageFormatProperties) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceImageFormatProperties( + VkPhysicalDevice physicalDevice, [[maybe_unused]] VkFormat format, [[maybe_unused]] VkImageType type, + [[maybe_unused]] VkImageTiling tiling, [[maybe_unused]] VkImageUsageFlags usage, [[maybe_unused]] VkImageCreateFlags flags, + VkImageFormatProperties* pImageFormatProperties) { if (nullptr != pImageFormatProperties) { memcpy(pImageFormatProperties, &icd.GetPhysDevice(physicalDevice).image_format_properties, sizeof(VkImageFormatProperties)); } @@ -855,10 +981,13 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceProperties2(VkPhysicalDevice VkBaseInStructure* pNext = reinterpret_cast(pProperties->pNext); while (pNext) { if (pNext->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT) { - VkPhysicalDevicePCIBusInfoPropertiesEXT* bus_info = - reinterpret_cast(pNext); + auto* bus_info = reinterpret_cast(pNext); bus_info->pciBus = phys_dev.pci_bus; } + if (pNext->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT) { + auto* layered_driver_props = reinterpret_cast(pNext); + layered_driver_props->underlyingAPI = phys_dev.layered_driver_underlying_api; + } pNext = reinterpret_cast(const_cast(pNext->pNext)); } } @@ -924,7 +1053,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceImageFormatProperties2( return VK_SUCCESS; } VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceExternalBufferProperties( - VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, + VkPhysicalDevice physicalDevice, [[maybe_unused]] const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) { if (nullptr != pExternalBufferProperties) { auto& phys_dev = icd.GetPhysDevice(physicalDevice); @@ -933,7 +1062,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceExternalBufferProperties( } } VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceExternalSemaphoreProperties( - VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, + VkPhysicalDevice physicalDevice, [[maybe_unused]] const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) { if (nullptr != pExternalSemaphoreProperties) { auto& phys_dev = icd.GetPhysDevice(physicalDevice); @@ -941,7 +1070,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceExternalSemaphoreProperties( } } VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceExternalFenceProperties( - VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, + VkPhysicalDevice physicalDevice, [[maybe_unused]] const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) { if (nullptr != pExternalFenceProperties) { auto& phys_dev = icd.GetPhysDevice(physicalDevice); @@ -950,41 +1079,98 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceExternalFenceProperties( } // Entry-points associated with the VK_KHR_performance_query extension VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, uint32_t* pCounterCount, VkPerformanceCounterKHR* pCounters, - VkPerformanceCounterDescriptionKHR* pCounterDescriptions) { - return VK_SUCCESS; -} -VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR( - VkPhysicalDevice physicalDevice, const VkQueryPoolPerformanceCreateInfoKHR* pPerformanceQueryCreateInfo, uint32_t* pNumPasses) { -} -VKAPI_ATTR VkResult VKAPI_CALL test_vkAcquireProfilingLockKHR(VkDevice device, const VkAcquireProfilingLockInfoKHR* pInfo) { + VkPhysicalDevice, uint32_t, uint32_t*, VkPerformanceCounterKHR*, VkPerformanceCounterDescriptionKHR*) { return VK_SUCCESS; } -VKAPI_ATTR void VKAPI_CALL test_vkReleaseProfilingLockKHR(VkDevice device) {} +VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(VkPhysicalDevice, + const VkQueryPoolPerformanceCreateInfoKHR*, + uint32_t*) {} +VKAPI_ATTR VkResult VKAPI_CALL test_vkAcquireProfilingLockKHR(VkDevice, const VkAcquireProfilingLockInfoKHR*) { return VK_SUCCESS; } +VKAPI_ATTR void VKAPI_CALL test_vkReleaseProfilingLockKHR(VkDevice) {} // Entry-points associated with the VK_EXT_sample_locations extension -VKAPI_ATTR void VKAPI_CALL test_vkCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer, - const VkSampleLocationsInfoEXT* pSampleLocationsInfo) {} -VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice, - VkSampleCountFlagBits samples, - VkMultisamplePropertiesEXT* pMultisampleProperties) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdSetSampleLocationsEXT(VkCommandBuffer, const VkSampleLocationsInfoEXT*) {} +VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice, VkSampleCountFlagBits, + VkMultisamplePropertiesEXT*) {} // Entry-points associated with the VK_EXT_calibrated_timestamps extension -VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, - uint32_t* pTimeDomainCount, - VkTimeDomainEXT* pTimeDomains) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice, uint32_t*, VkTimeDomainEXT*) { + return VK_SUCCESS; +} +VKAPI_ATTR VkResult VKAPI_CALL test_vkGetCalibratedTimestampsEXT(VkDevice, uint32_t, const VkCalibratedTimestampInfoEXT*, uint64_t*, + uint64_t*) { return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, - const VkCalibratedTimestampInfoEXT* pTimestampInfos, - uint64_t* pTimestamps, uint64_t* pMaxDeviation) { + +#if defined(WIN32) +VKAPI_ATTR VkResult VKAPI_CALL test_vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices) { + if (adapterLUID.LowPart != icd.adapterLUID.LowPart || adapterLUID.HighPart != icd.adapterLUID.HighPart) { + *pPhysicalDeviceCount = 0; + return VK_ERROR_INCOMPATIBLE_DRIVER; + } + icd.called_enumerate_adapter_physical_devices = true; + VkResult res = test_vkEnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); + // For this testing, flip order intentionally + if (nullptr != pPhysicalDevices) { + std::reverse(pPhysicalDevices, pPhysicalDevices + *pPhysicalDeviceCount); + } + return res; +} +#endif // defined(WIN32) + +VkResult test_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion) { + if (icd.called_vk_icd_gipa == CalledICDGIPA::not_called && + icd.called_negotiate_interface == CalledNegotiateInterface::not_called) + icd.called_negotiate_interface = CalledNegotiateInterface::vk_icd_negotiate; + else if (icd.called_vk_icd_gipa != CalledICDGIPA::not_called) + icd.called_negotiate_interface = CalledNegotiateInterface::vk_icd_gipa_first; + + // loader puts the minimum it supports in pSupportedVersion, if that is lower than our minimum + // If the ICD doesn't supports the interface version provided by the loader, report VK_ERROR_INCOMPATIBLE_DRIVER + if (icd.min_icd_interface_version > *pSupportedVersion) { + icd.interface_version_check = InterfaceVersionCheck::loader_version_too_old; + *pSupportedVersion = icd.min_icd_interface_version; + return VK_ERROR_INCOMPATIBLE_DRIVER; + } + + // the loader-provided interface version is newer than that supported by the ICD + if (icd.max_icd_interface_version < *pSupportedVersion) { + icd.interface_version_check = InterfaceVersionCheck::loader_version_too_new; + *pSupportedVersion = icd.max_icd_interface_version; + } + // ICD interface version is greater than the loader's, return the loader's version + else if (icd.max_icd_interface_version > *pSupportedVersion) { + icd.interface_version_check = InterfaceVersionCheck::icd_version_too_new; + // don't change *pSupportedVersion + } else { + icd.interface_version_check = InterfaceVersionCheck::version_is_supported; + *pSupportedVersion = icd.max_icd_interface_version; + } + return VK_SUCCESS; } +// Forward declarations for trampolines +extern "C" { +#if TEST_ICD_EXPOSE_VERSION_7 +FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion); +#if TEST_ICD_EXPORT_ICD_GPDPA +FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char* pName); +#endif +#if defined(WIN32) && TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES +FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices); +#endif +#endif +} + //// trampolines -PFN_vkVoidFunction get_instance_func_ver_1_1(VkInstance instance, const char* pName) { +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) { if (string_eq(pName, "test_vkEnumerateInstanceVersion")) { - return to_vkVoidFunction(test_vkEnumerateInstanceVersion); + return icd.can_query_vkEnumerateInstanceVersion ? to_vkVoidFunction(test_vkEnumerateInstanceVersion) : nullptr; } if (string_eq(pName, "vkEnumeratePhysicalDeviceGroups")) { return to_vkVoidFunction(test_vkEnumeratePhysicalDeviceGroups); @@ -992,14 +1178,8 @@ PFN_vkVoidFunction get_instance_func_ver_1_1(VkInstance instance, const char* pN } return nullptr; } -PFN_vkVoidFunction get_instance_func_ver_1_2(VkInstance instance, const char* pName) { - if (icd.icd_api_version >= VK_API_VERSION_1_2) { - return nullptr; - } - return nullptr; -} -PFN_vkVoidFunction get_physical_device_func_wsi(VkInstance instance, const char* pName) { +PFN_vkVoidFunction get_physical_device_func_wsi([[maybe_unused]] VkInstance instance, const char* pName) { if (IsInstanceExtensionEnabled("VK_KHR_surface")) { if (string_eq(pName, "vkGetPhysicalDeviceSurfaceSupportKHR")) return to_vkVoidFunction(test_vkGetPhysicalDeviceSurfaceSupportKHR); @@ -1037,18 +1217,18 @@ PFN_vkVoidFunction get_physical_device_func_wsi(VkInstance instance, const char* PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) { if (icd.min_icd_interface_version >= 3 && icd.enable_icd_wsi == true) { -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (string_eq(pName, "vkCreateAndroidSurfaceKHR")) { - icd.is_using_icd_wsi = UsingICDProvidedWSI::is_using; + icd.is_using_icd_wsi = true; return to_vkVoidFunction(test_vkCreateAndroidSurfaceKHR); } #endif -#ifdef VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_METAL_EXT) if (string_eq(pName, "vkCreateMetalSurfaceEXT")) { return to_vkVoidFunction(test_vkCreateMetalSurfaceEXT); } #endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) if (string_eq(pName, "vkCreateWaylandSurfaceKHR")) { return to_vkVoidFunction(test_vkCreateWaylandSurfaceKHR); } @@ -1056,7 +1236,7 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) return to_vkVoidFunction(test_vkGetPhysicalDeviceWaylandPresentationSupportKHR); } #endif -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) if (string_eq(pName, "vkCreateXcbSurfaceKHR")) { return to_vkVoidFunction(test_vkCreateXcbSurfaceKHR); } @@ -1064,7 +1244,7 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) return to_vkVoidFunction(test_vkGetPhysicalDeviceXcbPresentationSupportKHR); } #endif -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) if (string_eq(pName, "vkCreateXlibSurfaceKHR")) { return to_vkVoidFunction(test_vkCreateXlibSurfaceKHR); } @@ -1072,7 +1252,7 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) return to_vkVoidFunction(test_vkGetPhysicalDeviceXlibPresentationSupportKHR); } #endif -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (string_eq(pName, "vkCreateWin32SurfaceKHR")) { return to_vkVoidFunction(test_vkCreateWin32SurfaceKHR); } @@ -1080,7 +1260,7 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) return to_vkVoidFunction(test_vkGetPhysicalDeviceWin32PresentationSupportKHR); } #endif -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) if (string_eq(pName, "vkCreateDirectFBSurfaceEXT")) { return to_vkVoidFunction(test_vkCreateDirectFBSurfaceEXT); } @@ -1089,25 +1269,25 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) if (string_eq(pName, "vkCreateMacOSSurfaceMVK")) { return to_vkVoidFunction(test_vkCreateMacOSSurfaceMVK); } #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) if (string_eq(pName, "vkCreateIOSSurfaceMVK")) { return to_vkVoidFunction(test_vkCreateIOSSurfaceMVK); } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) if (string_eq(pName, "vkCreateStreamDescriptorSurfaceGGP")) { return to_vkVoidFunction(test_vkCreateStreamDescriptorSurfaceGGP); } #endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) if (string_eq(pName, "vkCreateScreenSurfaceQNX")) { return to_vkVoidFunction(test_vkCreateScreenSurfaceQNX); } @@ -1121,7 +1301,7 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) } if (string_eq(pName, "vkDestroySurfaceKHR")) { - icd.is_using_icd_wsi = UsingICDProvidedWSI::is_using; + icd.is_using_icd_wsi = true; return to_vkVoidFunction(test_vkDestroySurfaceKHR); } } @@ -1138,7 +1318,7 @@ PFN_vkVoidFunction get_instance_func_wsi(VkInstance instance, const char* pName) if (ret_phys_dev_wsi != nullptr) return ret_phys_dev_wsi; return nullptr; } -PFN_vkVoidFunction get_physical_device_func(VkInstance instance, const char* pName) { +PFN_vkVoidFunction get_physical_device_func([[maybe_unused]] VkInstance instance, const char* pName) { if (string_eq(pName, "vkEnumerateDeviceLayerProperties")) return to_vkVoidFunction(test_vkEnumerateDeviceLayerProperties); if (string_eq(pName, "vkEnumerateDeviceExtensionProperties")) return to_vkVoidFunction(test_vkEnumerateDeviceExtensionProperties); @@ -1146,14 +1326,19 @@ PFN_vkVoidFunction get_physical_device_func(VkInstance instance, const char* pNa return to_vkVoidFunction(test_vkGetPhysicalDeviceQueueFamilyProperties); if (string_eq(pName, "vkCreateDevice")) return to_vkVoidFunction(test_vkCreateDevice); - 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); + if (string_eq(pName, "vkGetPhysicalDeviceFeatures")) + return icd.can_query_GetPhysicalDeviceFuncs ? to_vkVoidFunction(test_vkGetPhysicalDeviceFeatures) : nullptr; + if (string_eq(pName, "vkGetPhysicalDeviceProperties")) + return icd.can_query_GetPhysicalDeviceFuncs ? to_vkVoidFunction(test_vkGetPhysicalDeviceProperties) : nullptr; + if (string_eq(pName, "vkGetPhysicalDeviceMemoryProperties")) + return icd.can_query_GetPhysicalDeviceFuncs ? to_vkVoidFunction(test_vkGetPhysicalDeviceMemoryProperties) : nullptr; if (string_eq(pName, "vkGetPhysicalDeviceSparseImageFormatProperties")) - return to_vkVoidFunction(test_vkGetPhysicalDeviceSparseImageFormatProperties); - if (string_eq(pName, "vkGetPhysicalDeviceFormatProperties")) return to_vkVoidFunction(test_vkGetPhysicalDeviceFormatProperties); + return icd.can_query_GetPhysicalDeviceFuncs ? to_vkVoidFunction(test_vkGetPhysicalDeviceSparseImageFormatProperties) + : nullptr; + if (string_eq(pName, "vkGetPhysicalDeviceFormatProperties")) + return icd.can_query_GetPhysicalDeviceFuncs ? to_vkVoidFunction(test_vkGetPhysicalDeviceFormatProperties) : nullptr; if (string_eq(pName, "vkGetPhysicalDeviceImageFormatProperties")) - return to_vkVoidFunction(test_vkGetPhysicalDeviceImageFormatProperties); + return icd.can_query_GetPhysicalDeviceFuncs ? to_vkVoidFunction(test_vkGetPhysicalDeviceImageFormatProperties) : nullptr; if (IsInstanceExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { if (string_eq(pName, "vkGetPhysicalDeviceFeatures2KHR")) return to_vkVoidFunction(test_vkGetPhysicalDeviceFeatures2); @@ -1252,10 +1437,6 @@ PFN_vkVoidFunction get_physical_device_func(VkInstance instance, const char* pNa } PFN_vkVoidFunction get_instance_func(VkInstance instance, const char* pName) { - if (string_eq(pName, "vkEnumerateInstanceExtensionProperties")) - return to_vkVoidFunction(test_vkEnumerateInstanceExtensionProperties); - if (string_eq(pName, "vkEnumerateInstanceLayerProperties")) return to_vkVoidFunction(test_vkEnumerateInstanceLayerProperties); - if (string_eq(pName, "vkCreateInstance")) return to_vkVoidFunction(test_vkCreateInstance); if (string_eq(pName, "vkDestroyInstance")) return to_vkVoidFunction(test_vkDestroyInstance); if (string_eq(pName, "vkEnumeratePhysicalDevices")) return to_vkVoidFunction(test_vkEnumeratePhysicalDevices); @@ -1269,9 +1450,6 @@ PFN_vkVoidFunction get_instance_func(VkInstance instance, const char* pName) { PFN_vkVoidFunction ret_1_1 = get_instance_func_ver_1_1(instance, pName); if (ret_1_1 != nullptr) return ret_1_1; - PFN_vkVoidFunction ret_1_2 = get_instance_func_ver_1_2(instance, pName); - if (ret_1_2 != nullptr) return ret_1_2; - PFN_vkVoidFunction ret_wsi = get_instance_func_wsi(instance, pName); if (ret_wsi != nullptr) return ret_wsi; @@ -1284,22 +1462,61 @@ PFN_vkVoidFunction get_instance_func(VkInstance instance, const char* pName) { return nullptr; } +bool should_check(std::vector const& exts, VkDevice device, const char* ext_name) { + if (device == NULL) return true; // always look if device is NULL + for (auto const& ext : exts) { + if (string_eq(ext, ext_name)) { + return true; + } + } + return false; +} + PFN_vkVoidFunction get_device_func(VkDevice device, const char* pName) { + TestICD::FindDevice fd{}; + DeviceCreateInfo create_info{}; if (device != nullptr) { - if (!std::any_of(icd.physical_devices.begin(), icd.physical_devices.end(), [&](const PhysicalDevice& pd) { - return std::any_of(pd.device_handles.begin(), pd.device_handles.end(), - [&](const VkDevice& pd_device) { return pd_device == device; }); - })) { - return nullptr; - } + fd = icd.lookup_device(device); + if (!fd.found) return NULL; + create_info = icd.physical_devices.at(fd.phys_dev_index).device_create_infos.at(fd.dev_index); } - if (string_eq(pName, "vkDestroyDevice")) return to_vkVoidFunction(test_vkDestroyDevice); - if (string_eq(pName, "vkCreateSwapchainKHR")) return to_vkVoidFunction(test_vkCreateSwapchainKHR); - if (string_eq(pName, "vkDestroySwapchainKHR")) return to_vkVoidFunction(test_vkDestroySwapchainKHR); if (string_eq(pName, "vkCreateCommandPool")) return to_vkVoidFunction(test_vkCreateCommandPool); if (string_eq(pName, "vkAllocateCommandBuffers")) return to_vkVoidFunction(test_vkAllocateCommandBuffers); if (string_eq(pName, "vkDestroyCommandPool")) return to_vkVoidFunction(test_vkDestroyCommandPool); if (string_eq(pName, "vkGetDeviceQueue")) return to_vkVoidFunction(test_vkGetDeviceQueue); + if (string_eq(pName, "vkDestroyDevice")) return to_vkVoidFunction(test_vkDestroyDevice); + if (should_check(create_info.enabled_extensions, device, "VK_KHR_swapchain")) { + if (string_eq(pName, "vkCreateSwapchainKHR")) return to_vkVoidFunction(test_vkCreateSwapchainKHR); + if (string_eq(pName, "vkGetSwapchainImagesKHR")) return to_vkVoidFunction(test_vkGetSwapchainImagesKHR); + if (string_eq(pName, "vkDestroySwapchainKHR")) return to_vkVoidFunction(test_vkDestroySwapchainKHR); + + if (icd.icd_api_version >= VK_API_VERSION_1_1 && string_eq(pName, "vkGetDeviceGroupSurfacePresentModesKHR")) + return to_vkVoidFunction(test_vkGetDeviceGroupSurfacePresentModesKHR); + } + if (should_check(create_info.enabled_extensions, device, "VK_KHR_display_swapchain")) { + if (string_eq(pName, "vkCreateSharedSwapchainsKHR")) return to_vkVoidFunction(test_vkCreateSharedSwapchainsKHR); + } + if (should_check(create_info.enabled_extensions, device, "VK_KHR_device_group")) { + if (string_eq(pName, "vkGetDeviceGroupSurfacePresentModesKHR")) + return to_vkVoidFunction(test_vkGetDeviceGroupSurfacePresentModesKHR); + } + 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); + if (string_eq(pName, "vkCmdDebugMarkerBeginEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerBeginEXT); + if (string_eq(pName, "vkCmdDebugMarkerEndEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerEndEXT); + if (string_eq(pName, "vkCmdDebugMarkerInsertEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerInsertEXT); + } + 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); + if (string_eq(pName, "vkQueueBeginDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkQueueBeginDebugUtilsLabelEXT); + if (string_eq(pName, "vkQueueEndDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkQueueEndDebugUtilsLabelEXT); + if (string_eq(pName, "vkQueueInsertDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkQueueInsertDebugUtilsLabelEXT); + if (string_eq(pName, "vkCmdBeginDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkCmdBeginDebugUtilsLabelEXT); + if (string_eq(pName, "vkCmdEndDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkCmdEndDebugUtilsLabelEXT); + if (string_eq(pName, "vkCmdInsertDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkCmdInsertDebugUtilsLabelEXT); + } // look for device functions setup from a test for (const auto& phys_dev : icd.physical_devices) { for (const auto& function : phys_dev.known_device_functions) { @@ -1322,12 +1539,32 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL test_vkGetDeviceProcAddr(VkDevice devic PFN_vkVoidFunction base_get_instance_proc_addr(VkInstance instance, const char* pName) { if (pName == nullptr) return nullptr; if (instance == NULL) { +#if TEST_ICD_EXPOSE_VERSION_7 + if (string_eq(pName, "vk_icdNegotiateLoaderICDInterfaceVersion")) + return icd.exposes_vk_icdNegotiateLoaderICDInterfaceVersion + ? to_vkVoidFunction(vk_icdNegotiateLoaderICDInterfaceVersion) + : NULL; +#if TEST_ICD_EXPORT_ICD_GPDPA + if (string_eq(pName, "vk_icdGetPhysicalDeviceProcAddr")) + return icd.exposes_vk_icdGetPhysicalDeviceProcAddr ? to_vkVoidFunction(vk_icdGetPhysicalDeviceProcAddr) : NULL; +#endif +#if defined(WIN32) && TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES + if (string_eq(pName, "vk_icdEnumerateAdapterPhysicalDevices")) + return icd.exposes_vk_icdEnumerateAdapterPhysicalDevices ? to_vkVoidFunction(vk_icdEnumerateAdapterPhysicalDevices) + : NULL; +#endif // defined(WIN32) +#endif // TEST_ICD_EXPOSE_VERSION_7 + if (string_eq(pName, "vkGetInstanceProcAddr")) return to_vkVoidFunction(test_vkGetInstanceProcAddr); if (string_eq(pName, "vkEnumerateInstanceExtensionProperties")) - return to_vkVoidFunction(test_vkEnumerateInstanceExtensionProperties); + return icd.exposes_vkEnumerateInstanceExtensionProperties + ? to_vkVoidFunction(test_vkEnumerateInstanceExtensionProperties) + : NULL; if (string_eq(pName, "vkEnumerateInstanceLayerProperties")) return to_vkVoidFunction(test_vkEnumerateInstanceLayerProperties); - if (string_eq(pName, "vkEnumerateInstanceVersion")) return to_vkVoidFunction(test_vkEnumerateInstanceVersion); + if (string_eq(pName, "vkEnumerateInstanceVersion")) + return icd.can_query_vkEnumerateInstanceVersion ? to_vkVoidFunction(test_vkEnumerateInstanceVersion) : nullptr; + if (string_eq(pName, "vkCreateInstance")) return to_vkVoidFunction(test_vkCreateInstance); } if (string_eq(pName, "vkGetDeviceProcAddr")) return to_vkVoidFunction(test_vkGetDeviceProcAddr); @@ -1343,36 +1580,8 @@ PFN_vkVoidFunction base_get_instance_proc_addr(VkInstance instance, const char* // Exported functions extern "C" { #if TEST_ICD_EXPORT_NEGOTIATE_INTERFACE_VERSION -extern FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion) { - if (icd.called_vk_icd_gipa == CalledICDGIPA::not_called && - icd.called_negotiate_interface == CalledNegotiateInterface::not_called) - icd.called_negotiate_interface = CalledNegotiateInterface::vk_icd_negotiate; - else if (icd.called_vk_icd_gipa != CalledICDGIPA::not_called) - icd.called_negotiate_interface = CalledNegotiateInterface::vk_icd_gipa_first; - - // loader puts the minimum it supports in pSupportedVersion, if that is lower than our minimum - // If the ICD doesn't supports the interface version provided by the loader, report VK_ERROR_INCOMPATIBLE_DRIVER - if (icd.min_icd_interface_version > *pSupportedVersion) { - icd.interface_version_check = InterfaceVersionCheck::loader_version_too_old; - *pSupportedVersion = icd.min_icd_interface_version; - return VK_ERROR_INCOMPATIBLE_DRIVER; - } - - // the loader-provided interface version is newer than that supported by the ICD - if (icd.max_icd_interface_version < *pSupportedVersion) { - icd.interface_version_check = InterfaceVersionCheck::loader_version_too_new; - *pSupportedVersion = icd.max_icd_interface_version; - } - // ICD interface version is greater than the loader's, return the loader's version - else if (icd.max_icd_interface_version > *pSupportedVersion) { - icd.interface_version_check = InterfaceVersionCheck::icd_version_too_new; - // don't change *pSupportedVersion - } else { - icd.interface_version_check = InterfaceVersionCheck::version_is_supported; - *pSupportedVersion = icd.max_icd_interface_version; - } - - return VK_SUCCESS; +FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion) { + return test_vk_icdNegotiateLoaderICDInterfaceVersion(pSupportedVersion); } #endif // TEST_ICD_EXPORT_NEGOTIATE_INTERFACE_VERSION @@ -1384,16 +1593,11 @@ FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDevic #if TEST_ICD_EXPORT_ICD_GIPA FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName) { - // std::cout << "icdGetInstanceProcAddr: " << pName << "\n"; - if (icd.called_vk_icd_gipa == CalledICDGIPA::not_called) icd.called_vk_icd_gipa = CalledICDGIPA::vk_icd_gipa; - return base_get_instance_proc_addr(instance, pName); } #else // !TEST_ICD_EXPORT_ICD_GIPA FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* pName) { - // std::cout << "icdGetInstanceProcAddr: " << pName << "\n"; - if (icd.called_vk_icd_gipa == CalledICDGIPA::not_called) icd.called_vk_icd_gipa = CalledICDGIPA::vk_gipa; return base_get_instance_proc_addr(instance, pName); } @@ -1413,17 +1617,7 @@ FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProp FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) { - if (adapterLUID.LowPart != icd.adapterLUID.LowPart || adapterLUID.HighPart != icd.adapterLUID.HighPart) { - *pPhysicalDeviceCount = 0; - return VK_SUCCESS; - } - icd.called_enumerate_adapter_physical_devices = true; - VkResult res = test_vkEnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); - // For this testing, flip order intentionally - if (nullptr != pPhysicalDevices) { - std::reverse(pPhysicalDevices, pPhysicalDevices + *pPhysicalDeviceCount); - } - return res; + return test_vk_icdEnumerateAdapterPhysicalDevices(instance, adapterLUID, pPhysicalDeviceCount, pPhysicalDevices); } #endif // defined(WIN32) #endif // TEST_ICD_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES diff --git a/tests/framework/icd/test_icd.h b/tests/framework/icd/test_icd.h index 6acdab142df4ae42500c45da12c35d0d1b6ef276..8515a849390361efd34a9db4b20073de2caea960 100644 --- a/tests/framework/icd/test_icd.h +++ b/tests/framework/icd/test_icd.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021-2022 The Khronos Group Inc. - * Copyright (c) 2021-2022 Valve Corporation - * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -45,25 +45,65 @@ enum class InterfaceVersionCheck { version_is_supported }; -enum class CalledEnumerateAdapterPhysicalDevices { not_called, called }; - -enum class UsingICDProvidedWSI { not_using, is_using }; +// clang-format off +inline std::ostream& operator<<(std::ostream& os, const CalledICDGIPA& result) { + switch (result) { + case (CalledICDGIPA::not_called): return os << "CalledICDGIPA::not_called"; + case (CalledICDGIPA::vk_icd_gipa): return os << "CalledICDGIPA::vk_icd_gipa"; + case (CalledICDGIPA::vk_gipa): return os << "CalledICDGIPA::vk_gipa"; + } + return os << static_cast(result); +} +inline std::ostream& operator<<(std::ostream& os, const CalledNegotiateInterface& result) { + switch (result) { + case (CalledNegotiateInterface::not_called): return os << "CalledNegotiateInterface::not_called"; + case (CalledNegotiateInterface::vk_icd_negotiate): return os << "CalledNegotiateInterface::vk_icd_negotiate"; + case (CalledNegotiateInterface::vk_icd_gipa_first): return os << "CalledNegotiateInterface::vk_icd_gipa_first"; + } + return os << static_cast(result); +} +inline std::ostream& operator<<(std::ostream& os, const InterfaceVersionCheck& result) { + switch (result) { + case (InterfaceVersionCheck::not_called): return os << "InterfaceVersionCheck::not_called"; + case (InterfaceVersionCheck::loader_version_too_old): return os << "InterfaceVersionCheck::loader_version_too_old"; + case (InterfaceVersionCheck::loader_version_too_new): return os << "InterfaceVersionCheck::loader_version_too_new"; + case (InterfaceVersionCheck::icd_version_too_new): return os << "InterfaceVersionCheck::icd_version_too_new"; + case (InterfaceVersionCheck::version_is_supported): return os << "InterfaceVersionCheck::version_is_supported"; + } + return os << static_cast(result); +} +// clang-format on struct TestICD { fs::path manifest_file_path; + BUILDER_VALUE(TestICD, bool, exposes_vk_icdNegotiateLoaderICDInterfaceVersion, true) + BUILDER_VALUE(TestICD, bool, exposes_vkEnumerateInstanceExtensionProperties, true) + BUILDER_VALUE(TestICD, bool, exposes_vkCreateInstance, true) + BUILDER_VALUE(TestICD, bool, exposes_vk_icdGetPhysicalDeviceProcAddr, true) +#if defined(WIN32) + BUILDER_VALUE(TestICD, bool, exposes_vk_icdEnumerateAdapterPhysicalDevices, true) +#endif + CalledICDGIPA called_vk_icd_gipa = CalledICDGIPA::not_called; CalledNegotiateInterface called_negotiate_interface = CalledNegotiateInterface::not_called; InterfaceVersionCheck interface_version_check = InterfaceVersionCheck::not_called; BUILDER_VALUE(TestICD, uint32_t, min_icd_interface_version, 0) - BUILDER_VALUE(TestICD, uint32_t, max_icd_interface_version, 6) + BUILDER_VALUE(TestICD, uint32_t, max_icd_interface_version, 7) uint32_t icd_interface_version_received = 0; bool called_enumerate_adapter_physical_devices = false; BUILDER_VALUE(TestICD, bool, enable_icd_wsi, false); - UsingICDProvidedWSI is_using_icd_wsi = UsingICDProvidedWSI::not_using; + bool is_using_icd_wsi = false; + + TestICD& setup_WSI(const char* api_selection = nullptr) { + enable_icd_wsi = true; + add_instance_extensions({"VK_KHR_surface", get_platform_wsi_extension(api_selection)}); + min_icd_interface_version = (3U < min_icd_interface_version) ? min_icd_interface_version : 3U; + return *this; + } BUILDER_VALUE(TestICD, uint32_t, icd_api_version, VK_API_VERSION_1_0) BUILDER_VECTOR(TestICD, LayerDefinition, instance_layers, instance_layer) @@ -80,9 +120,13 @@ struct TestICD { std::vector messenger_handles; std::vector swapchain_handles; + BUILDER_VALUE(TestICD, bool, can_query_vkEnumerateInstanceVersion, true); + BUILDER_VALUE(TestICD, bool, can_query_GetPhysicalDeviceFuncs, true); + // Unknown instance functions Add a `VulkanFunction` to this list which will be searched in - // vkGetInstanceProcAddr for custom_instance_functions and vk_icdGetPhysicalDeviceProcAddr for custom_physical_device_functions. - // To add unknown device functions, add it to the PhysicalDevice directly (in the known_device_functions member) + // vkGetInstanceProcAddr for custom_instance_functions and vk_icdGetPhysicalDeviceProcAddr for + // custom_physical_device_functions. To add unknown device functions, add it to the PhysicalDevice directly (in the + // known_device_functions member) BUILDER_VECTOR(TestICD, VulkanFunction, custom_instance_functions, custom_instance_function) // Must explicitely state support for the tooling info extension, that way we can control if vkGetInstanceProcAddr returns a @@ -90,7 +134,7 @@ struct TestICD { 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' - std::vector tooling_properties; + BUILDER_VECTOR(TestICD, VkPhysicalDeviceToolPropertiesEXT, tooling_properties, tooling_property) std::vector> allocated_command_buffers; VkInstanceCreateFlags passed_in_instance_create_flags{}; @@ -110,6 +154,28 @@ struct TestICD { return info; } + struct FindDevice { + bool found = false; + uint32_t phys_dev_index = 0; + uint32_t dev_index = 0; + }; + + FindDevice lookup_device(VkDevice device) { + FindDevice fd{}; + for (uint32_t p = 0; p < physical_devices.size(); p++) { + auto const& phys_dev = physical_devices.at(p); + for (uint32_t d = 0; d < phys_dev.device_handles.size(); d++) { + if (phys_dev.device_handles.at(d) == device) { + fd.found = true; + fd.phys_dev_index = p; + fd.dev_index = d; + return fd; + } + } + } + return fd; + } + #if defined(WIN32) BUILDER_VALUE(TestICD, LUID, adapterLUID, {}) #endif // defined(WIN32) diff --git a/tests/framework/json_writer.h b/tests/framework/json_writer.h new file mode 100644 index 0000000000000000000000000000000000000000..d259ae6fb68d1a22cfe60501376a5c0e56843128 --- /dev/null +++ b/tests/framework/json_writer.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2023 The Khronos Group Inc. + * Copyright (c) 2023 Valve Corporation + * Copyright (c) 2023 LunarG, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and/or associated documentation files (the "Materials"), to + * deal in the Materials without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Materials, and to permit persons to whom the Materials are + * furnished to do so, subject to the following conditions: + * + * The above copyright notice(s) and this permission notice shall be included in + * all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE + * USE OR OTHER DEALINGS IN THE MATERIALS. + * + * Author: Charles Giessen + */ + +#pragma once + +#include +#include +#include + +// Utility class to simplify the writing of JSON manifest files + +struct JsonWriter { + std::string output; + + // the bool represents whether an object has been written & a comma is needed + std::stack stack; + + void StartObject() { + CommaAndNewLine(); + Indent(); + output += "{"; + stack.push(false); + } + void StartKeyedObject(std::string const& key) { + CommaAndNewLine(); + Indent(); + output += "\"" + key + "\": {"; + stack.push(false); + } + void EndObject() { + stack.pop(); + output += "\n"; + Indent(); + output += "}"; + } + void StartKeyedArray(std::string const& key) { + CommaAndNewLine(); + Indent(); + output += "\"" + key + "\": ["; + stack.push(false); + } + void StartArray() { + CommaAndNewLine(); + Indent(); + output += "["; + stack.push(false); + } + void EndArray() { + stack.pop(); + output += "\n"; + Indent(); + output += "]"; + } + + void AddKeyedString(std::string const& key, std::string const& value) { + CommaAndNewLine(); + Indent(); + output += "\"" + key + "\": \"" + value + "\""; + } + void AddString(std::string const& value) { + CommaAndNewLine(); + Indent(); + output += "\"" + value + "\""; + } + + void AddKeyedBool(std::string const& key, bool value) { + CommaAndNewLine(); + Indent(); + output += "\"" + key + "\": " + (value ? "true" : "false"); + } + void AddBool(bool value) { + CommaAndNewLine(); + Indent(); + output += std::string(value ? "true" : "false"); + } + + private: + void CommaAndNewLine() { + if (stack.size() > 0) { + if (stack.top() == false) { + stack.top() = true; + } else { + output += ","; + } + output += "\n"; + } + } + void Indent() { + for (uint32_t i = 0; i < stack.size(); i++) { + output += '\t'; + } + } +}; diff --git a/tests/framework/layer/CMakeLists.txt b/tests/framework/layer/CMakeLists.txt index 7d53779213211ac4020f0cff82d44929c6d8be42..a624062389c04977b1cebce7802e5a64a387caf6 100644 --- a/tests/framework/layer/CMakeLists.txt +++ b/tests/framework/layer/CMakeLists.txt @@ -16,13 +16,15 @@ # ~~~ set(TEST_LAYER_BASE_EXPORTS TEST_LAYER_EXPORT_ENUMERATE_FUNCTIONS=1) -set(TEST_LAYER_VERSION_0_EXPORTS ${TEST_LAYER_BASE_EXPORTS} TEST_LAYER_EXPORT_LAYER_NAMED_GIPA=1 TEST_LAYER_EXPORT_LAYER_NAMED_GDPA=1) -set(TEST_LAYER_VERSION_1_EXPORTS ${TEST_LAYER_VERSION_0_EXPORTS} TEST_LAYER_EXPORT_NO_PREFIX_GIPA=1 TEST_LAYER_EXPORT_NO_PREFIX_GDPA=1) +set(TEST_LAYER_VERSION_0_EXPORTS ${TEST_LAYER_BASE_EXPORTS} TEST_LAYER_EXPORT_LAYER_VK_GIPA=1 TEST_LAYER_EXPORT_LAYER_VK_GDPA=1) +set(TEST_LAYER_VERSION_0_NAMED_GPA_EXPORTS ${TEST_LAYER_BASE_EXPORTS} TEST_LAYER_EXPORT_LAYER_NAMED_GIPA=1 TEST_LAYER_EXPORT_LAYER_NAMED_GDPA=1) +set(TEST_LAYER_VERSION_1_EXPORTS ${TEST_LAYER_VERSION_0_EXPORTS} TEST_LAYER_EXPORT_OVERRIDE_GIPA=1 TEST_LAYER_EXPORT_OVERRIDE_GDPA=1) set(TEST_LAYER_VERSION_2_EXPORTS ${TEST_LAYER_VERSION_1_EXPORTS} TEST_LAYER_EXPORT_GET_PHYSICAL_DEVICE_PROC_ADDR=1 LAYER_EXPORT_NEGOTIATE_LOADER_LAYER_INTERFACE_VERSION=1) AddSharedLibrary(test_layer_export_base DEF_FILE test_layer_base SOURCES test_layer.cpp DEFINITIONS ${TEST_LAYER_BASE_EXPORTS}) AddSharedLibrary(test_layer_export_version_0 DEF_FILE test_layer_0 SOURCES test_layer.cpp DEFINITIONS ${TEST_LAYER_VERSION_0_EXPORTS}) +AddSharedLibrary(test_layer_export_version_0_named_gpa DEF_FILE test_layer_0_named_gpa SOURCES test_layer.cpp DEFINITIONS ${TEST_LAYER_VERSION_0_NAMED_GPA_EXPORTS}) AddSharedLibrary(test_layer_export_version_1 DEF_FILE test_layer_1 SOURCES test_layer.cpp DEFINITIONS ${TEST_LAYER_VERSION_1_EXPORTS}) AddSharedLibrary(test_layer_export_version_2 DEF_FILE test_layer_2 SOURCES test_layer.cpp DEFINITIONS ${TEST_LAYER_VERSION_2_EXPORTS}) diff --git a/tests/framework/layer/export_definitions/test_layer_0.def b/tests/framework/layer/export_definitions/test_layer_0.def index b24063525e5dab056ec82f66155250e336e9c16f..7be478a4d8c1701875d4d6674b9d6724642db030 100644 --- a/tests/framework/layer/export_definitions/test_layer_0.def +++ b/tests/framework/layer/export_definitions/test_layer_0.def @@ -4,5 +4,5 @@ EXPORTS vkEnumerateInstanceExtensionProperties vkEnumerateDeviceLayerProperties vkEnumerateDeviceExtensionProperties - test_layer_GetInstanceProcAddr - test_layer_GetDeviceProcAddr \ No newline at end of file + vkGetInstanceProcAddr + vkGetDeviceProcAddr diff --git a/tests/framework/layer/export_definitions/test_layer_0_named_gpa.def b/tests/framework/layer/export_definitions/test_layer_0_named_gpa.def new file mode 100644 index 0000000000000000000000000000000000000000..b24063525e5dab056ec82f66155250e336e9c16f --- /dev/null +++ b/tests/framework/layer/export_definitions/test_layer_0_named_gpa.def @@ -0,0 +1,8 @@ +LIBRARY test_layer_export_version_0 +EXPORTS + vkEnumerateInstanceLayerProperties + vkEnumerateInstanceExtensionProperties + vkEnumerateDeviceLayerProperties + vkEnumerateDeviceExtensionProperties + test_layer_GetInstanceProcAddr + test_layer_GetDeviceProcAddr \ No newline at end of file diff --git a/tests/framework/layer/export_definitions/test_layer_1.def b/tests/framework/layer/export_definitions/test_layer_1.def index 373507d35e0b1740e9830647ab382ad403ce2e4b..da95aa8b5e238ef9448b536c87aafdb2395093fe 100644 --- a/tests/framework/layer/export_definitions/test_layer_1.def +++ b/tests/framework/layer/export_definitions/test_layer_1.def @@ -4,8 +4,6 @@ EXPORTS vkEnumerateInstanceExtensionProperties vkEnumerateDeviceLayerProperties vkEnumerateDeviceExtensionProperties - test_layer_GetInstanceProcAddr - test_layer_GetDeviceProcAddr - GetInstanceProcAddr - GetDeviceProcAddr - test_override_vkGetInstanceProcAddr \ No newline at end of file + vkGetInstanceProcAddr + vkGetDeviceProcAddr + test_override_vkGetInstanceProcAddr diff --git a/tests/framework/layer/export_definitions/test_layer_2.def b/tests/framework/layer/export_definitions/test_layer_2.def index a29167ba946ff7e9776bc58de6182ffbb23c44e6..7db1e7498940221624ffc8fd8c495fc60788792a 100644 --- a/tests/framework/layer/export_definitions/test_layer_2.def +++ b/tests/framework/layer/export_definitions/test_layer_2.def @@ -4,13 +4,11 @@ EXPORTS vkEnumerateInstanceExtensionProperties vkEnumerateDeviceLayerProperties vkEnumerateDeviceExtensionProperties - test_layer_GetInstanceProcAddr - test_layer_GetDeviceProcAddr - GetInstanceProcAddr - GetDeviceProcAddr + vkGetInstanceProcAddr + vkGetDeviceProcAddr vk_layerGetPhysicalDeviceProcAddr vkNegotiateLoaderLayerInterfaceVersion test_preinst_vkEnumerateInstanceLayerProperties test_preinst_vkEnumerateInstanceExtensionProperties test_preinst_vkEnumerateInstanceVersion - test_override_vkGetInstanceProcAddr \ No newline at end of file + test_override_vkGetInstanceProcAddr diff --git a/tests/framework/layer/layer_util.h b/tests/framework/layer/layer_util.h index b47add00ca5d93599321546270e571a815331834..549bfa7019cb32f28ffa0d482bcaa89fd30588a5 100644 --- a/tests/framework/layer/layer_util.h +++ b/tests/framework/layer/layer_util.h @@ -36,15 +36,6 @@ struct LayerDefinition { BUILDER_VALUE(LayerDefinition, std::string, description, {}) BUILDER_VECTOR(LayerDefinition, Extension, extensions, extension) - LayerDefinition(std::string layerName, uint32_t specVersion = VK_API_VERSION_1_0, - uint32_t implementationVersion = VK_API_VERSION_1_0, std::string description = "", - std::vector extensions = {}) - : layerName(layerName), - specVersion(specVersion), - implementationVersion(implementationVersion), - description(description), - extensions(extensions) {} - VkLayerProperties get() const noexcept { VkLayerProperties props{}; copy_string_to_char_array(layerName, &props.layerName[0], VK_MAX_EXTENSION_NAME_SIZE); diff --git a/tests/framework/layer/test_layer.cpp b/tests/framework/layer/test_layer.cpp index 0ccb1f6d8e505e328052d678d5101ab0e9351597..14f0ebd6032ad5b943f872517154e0779074a37f 100644 --- a/tests/framework/layer/test_layer.cpp +++ b/tests/framework/layer/test_layer.cpp @@ -27,55 +27,55 @@ #include "test_layer.h" -#include "loader/generated/vk_dispatch_table_helper.h" +#include "vk_dispatch_table_helper.h" // export the enumeration functions instance|device+layer|extension -#ifndef TEST_LAYER_EXPORT_ENUMERATE_FUNCTIONS +#if !defined(TEST_LAYER_EXPORT_ENUMERATE_FUNCTIONS) #define TEST_LAYER_EXPORT_ENUMERATE_FUNCTIONS 0 #endif // export test_layer_GetInstanceProcAddr -#ifndef TEST_LAYER_EXPORT_LAYER_NAMED_GIPA +#if !defined(TEST_LAYER_EXPORT_LAYER_NAMED_GIPA) #define TEST_LAYER_EXPORT_LAYER_NAMED_GIPA 0 #endif +// export test_override_GetInstanceProcAddr +#if !defined(TEST_LAYER_EXPORT_OVERRIDE_GIPA) +#define TEST_LAYER_EXPORT_OVERRIDE_GIPA 0 +#endif + // export vkGetInstanceProcAddr -#ifndef TEST_LAYER_EXPORT_LAYER_VK_GIPA +#if !defined(TEST_LAYER_EXPORT_LAYER_VK_GIPA) #define TEST_LAYER_EXPORT_LAYER_VK_GIPA 0 #endif // export test_layer_GetDeviceProcAddr -#ifndef TEST_LAYER_EXPORT_LAYER_NAMED_GDPA +#if !defined(TEST_LAYER_EXPORT_LAYER_NAMED_GDPA) #define TEST_LAYER_EXPORT_LAYER_NAMED_GDPA 0 #endif -// export vkGetDeviceProcAddr -#ifndef TEST_LAYER_EXPORT_LAYER_VK_GDPA -#define TEST_LAYER_EXPORT_LAYER_VK_GDPA 0 -#endif - -// export GetInstanceProcAddr -#ifndef TEST_LAYER_EXPORT_NO_PREFIX_GIPA -#define TEST_LAYER_EXPORT_NO_PREFIX_GIPA 0 +// export test_override_GetDeviceProcAddr +#if !defined(TEST_LAYER_EXPORT_OVERRIDE_GDPA) +#define TEST_LAYER_EXPORT_OVERRIDE_GDPA 0 #endif -// export GetDeviceProcAddr -#ifndef TEST_LAYER_EXPORT_NO_PREFIX_GDPA -#define TEST_LAYER_EXPORT_NO_PREFIX_GDPA 0 +// export vkGetDeviceProcAddr +#if !defined(TEST_LAYER_EXPORT_LAYER_VK_GDPA) +#define TEST_LAYER_EXPORT_LAYER_VK_GDPA 0 #endif // export vk_layerGetPhysicalDeviceProcAddr -#ifndef TEST_LAYER_EXPORT_GET_PHYSICAL_DEVICE_PROC_ADDR +#if !defined(TEST_LAYER_EXPORT_GET_PHYSICAL_DEVICE_PROC_ADDR) #define TEST_LAYER_EXPORT_GET_PHYSICAL_DEVICE_PROC_ADDR 0 #endif // export vkNegotiateLoaderLayerInterfaceVersion -#ifndef LAYER_EXPORT_NEGOTIATE_LOADER_LAYER_INTERFACE_VERSION +#if !defined(LAYER_EXPORT_NEGOTIATE_LOADER_LAYER_INTERFACE_VERSION) #define LAYER_EXPORT_NEGOTIATE_LOADER_LAYER_INTERFACE_VERSION 0 #endif -#ifndef TEST_LAYER_NAME -#define TEST_LAYER_NAME "VkLayer_LunarG_test_layer" +#if !defined(TEST_LAYER_NAME) +#define TEST_LAYER_NAME "VK_LAYER_LunarG_test_layer" #endif TestLayer layer; @@ -87,6 +87,32 @@ FRAMEWORK_EXPORT TestLayer* reset_layer_func() { } } +bool IsInstanceExtensionSupported(const char* extension_name) { + return layer.instance_extensions.end() != + std::find_if(layer.instance_extensions.begin(), layer.instance_extensions.end(), + [extension_name](Extension const& ext) { return string_eq(&ext.extensionName[0], extension_name); }); +} + +bool IsInstanceExtensionEnabled(const char* extension_name) { + return layer.enabled_instance_extensions.end() != + std::find_if(layer.enabled_instance_extensions.begin(), layer.enabled_instance_extensions.end(), + [extension_name](Extension const& ext) { return string_eq(&ext.extensionName[0], extension_name); }); +} + +bool IsDeviceExtensionAvailable(VkDevice dev, const char* extension_name) { + for (auto& device : layer.created_devices) { + if ((dev == VK_NULL_HANDLE || device.device_handle == dev) && + device.enabled_extensions.end() != + std::find_if(device.enabled_extensions.begin(), device.enabled_extensions.end(), + [extension_name](Extension const& ext) { return ext.extensionName == extension_name; })) { + return true; + } + } + return false; +} + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_instance_func(VkInstance instance, const char* pName); + VkLayerInstanceCreateInfo* get_chain_info(const VkInstanceCreateInfo* pCreateInfo, VkLayerFunction func) { VkLayerInstanceCreateInfo* chain_info = (VkLayerInstanceCreateInfo*)pCreateInfo->pNext; while (chain_info && !(chain_info->sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO && chain_info->function == func)) { @@ -105,33 +131,104 @@ VkLayerDeviceCreateInfo* get_chain_info(const VkDeviceCreateInfo* pCreateInfo, V return chain_info; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties) { - return VK_SUCCESS; -} +VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceLayerProperties(uint32_t*, VkLayerProperties*) { return VK_SUCCESS; } VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) { + if (pPropertyCount == nullptr) { + return VK_INCOMPLETE; + } if (pLayerName && string_eq(pLayerName, TEST_LAYER_NAME)) { - *pPropertyCount = 0; + if (pProperties) { + if (*pPropertyCount < layer.injected_instance_extensions.size()) { + return VK_INCOMPLETE; + } + for (size_t i = 0; i < layer.injected_instance_extensions.size(); i++) { + pProperties[i] = layer.injected_instance_extensions.at(i).get(); + } + *pPropertyCount = static_cast(layer.injected_instance_extensions.size()); + } else { + *pPropertyCount = static_cast(layer.injected_instance_extensions.size()); + } return VK_SUCCESS; } - return layer.instance_dispatch_table.EnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties); + + uint32_t hardware_prop_count = 0; + if (pProperties) { + hardware_prop_count = *pPropertyCount - static_cast(layer.injected_instance_extensions.size()); + } + + VkResult res = + layer.instance_dispatch_table.EnumerateInstanceExtensionProperties(pLayerName, &hardware_prop_count, pProperties); + if (res < 0) { + return res; + } + + if (pProperties == nullptr) { + *pPropertyCount = hardware_prop_count + static_cast(layer.injected_instance_extensions.size()); + } else { + if (hardware_prop_count + layer.injected_instance_extensions.size() > *pPropertyCount) { + *pPropertyCount = hardware_prop_count; + return VK_INCOMPLETE; + } + for (size_t i = 0; i < layer.injected_instance_extensions.size(); i++) { + pProperties[hardware_prop_count + i] = layer.injected_instance_extensions.at(i).get(); + } + *pPropertyCount = hardware_prop_count + static_cast(layer.injected_instance_extensions.size()); + } + return res; } -VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, - VkLayerProperties* pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateDeviceLayerProperties(VkPhysicalDevice, uint32_t*, VkLayerProperties*) { return VK_SUCCESS; } VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) { + if (pPropertyCount == nullptr) { + return VK_INCOMPLETE; + } + if (pLayerName && string_eq(pLayerName, TEST_LAYER_NAME)) { - *pPropertyCount = 0; + if (pProperties) { + if (*pPropertyCount < static_cast(layer.injected_device_extensions.size())) { + return VK_INCOMPLETE; + } + for (size_t i = 0; i < layer.injected_device_extensions.size(); i++) { + pProperties[i] = layer.injected_device_extensions.at(i).get(); + } + *pPropertyCount = static_cast(layer.injected_device_extensions.size()); + } else { + *pPropertyCount = static_cast(layer.injected_device_extensions.size()); + } return VK_SUCCESS; } - return layer.instance_dispatch_table.EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, - pProperties); + + uint32_t hardware_prop_count = 0; + if (pProperties) { + hardware_prop_count = *pPropertyCount - static_cast(layer.injected_device_extensions.size()); + } + + VkResult res = layer.instance_dispatch_table.EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, + &hardware_prop_count, pProperties); + if (res < 0) { + return res; + } + + if (pProperties == nullptr) { + *pPropertyCount = hardware_prop_count + static_cast(layer.injected_device_extensions.size()); + } else { + if (hardware_prop_count + layer.injected_device_extensions.size() > *pPropertyCount) { + *pPropertyCount = hardware_prop_count; + return VK_INCOMPLETE; + } + for (size_t i = 0; i < layer.injected_device_extensions.size(); i++) { + pProperties[hardware_prop_count + i] = layer.injected_device_extensions.at(i).get(); + } + *pPropertyCount = hardware_prop_count + static_cast(layer.injected_device_extensions.size()); + } + return res; } VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceVersion(uint32_t* pApiVersion) { @@ -152,12 +249,40 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* return VK_ERROR_INITIALIZATION_FAILED; } + if (layer.call_create_device_while_create_device_is_called) { + auto* createDeviceCallback = get_chain_info(pCreateInfo, VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK); + layer.callback_vkCreateDevice = createDeviceCallback->u.layerDevice.pfnLayerCreateDevice; + layer.callback_vkDestroyDevice = createDeviceCallback->u.layerDevice.pfnLayerDestroyDevice; + } + // Advance the link info for the next element of the chain chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; layer.next_vkGetInstanceProcAddr = fpGetInstanceProcAddr; + bool use_modified_create_info = false; + VkInstanceCreateInfo instance_create_info{}; + VkApplicationInfo application_info{}; + if (pCreateInfo) { + instance_create_info = *pCreateInfo; + if (pCreateInfo->pApplicationInfo) { + application_info = *pCreateInfo->pApplicationInfo; + } + } + + // If the test needs to modify the api version, do it before we call down the chain + if (layer.alter_api_version != VK_API_VERSION_1_0 && pCreateInfo && pCreateInfo->pApplicationInfo) { + application_info.apiVersion = layer.alter_api_version; + instance_create_info.pApplicationInfo = &application_info; + use_modified_create_info = true; + } + const VkInstanceCreateInfo* create_info_pointer = use_modified_create_info ? &instance_create_info : pCreateInfo; + + if (layer.clobber_pInstance) { + memset(*pInstance, 0, 128); + } + // Continue call down the chain - VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); + VkResult result = fpCreateInstance(create_info_pointer, pAllocator, pInstance); if (result != VK_SUCCESS) { return result; } @@ -172,6 +297,10 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* // next layer in the chain. layer_init_instance_dispatch_table(layer.instance_handle, &layer.instance_dispatch_table, fpGetInstanceProcAddr); + for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { + layer.enabled_instance_extensions.push_back({pCreateInfo->ppEnabledExtensionNames[i]}); + } + if (layer.create_instance_callback) result = layer.create_instance_callback(layer); for (auto& func : layer.custom_physical_device_interception_functions) { @@ -192,11 +321,54 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* } } + if (!layer.make_spurious_log_in_create_instance.empty()) { + auto* chain = reinterpret_cast(pCreateInfo->pNext); + while (chain) { + if (chain->sType == VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT) { + auto* debug_messenger = reinterpret_cast(chain); + VkDebugUtilsMessengerCallbackDataEXT data{}; + data.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT; + data.pMessage = layer.make_spurious_log_in_create_instance.c_str(); + debug_messenger->pfnUserCallback(VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT, + VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT, &data, debug_messenger->pUserData); + } + + chain = chain->pNext; + } + } + + if (layer.buggy_query_of_vkCreateDevice) { + layer.instance_dispatch_table.CreateDevice = + reinterpret_cast(fpGetInstanceProcAddr(nullptr, "vkCreateDevice")); + } + + if (layer.call_create_device_while_create_device_is_called) { + uint32_t phys_dev_count = 0; + result = layer.instance_dispatch_table.EnumeratePhysicalDevices(layer.instance_handle, &phys_dev_count, nullptr); + if (result != VK_SUCCESS) { + return result; + } + layer.queried_physical_devices.resize(phys_dev_count); + result = layer.instance_dispatch_table.EnumeratePhysicalDevices(layer.instance_handle, &phys_dev_count, + layer.queried_physical_devices.data()); + if (result != VK_SUCCESS) { + return result; + } + } + + if (layer.check_if_EnumDevExtProps_is_same_as_queried_function) { + auto chain_info_EnumDeviceExtProps = reinterpret_cast( + fpGetInstanceProcAddr(layer.instance_handle, "vkEnumerateDeviceExtensionProperties")); + if (chain_info_EnumDeviceExtProps != layer.instance_dispatch_table.EnumerateDeviceExtensionProperties) { + return VK_ERROR_INITIALIZATION_FAILED; + } + } + return result; } -VKAPI_ATTR VkResult VKAPI_CALL test_override_vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) { +VKAPI_ATTR VkResult VKAPI_CALL test_override_vkCreateInstance(const VkInstanceCreateInfo*, const VkAllocationCallbacks*, + VkInstance*) { return VK_ERROR_INVALID_SHADER_NV; } @@ -215,16 +387,28 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDevice(VkPhysicalDevice physicalDevi PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; - PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(layer.instance_handle, "vkCreateDevice"); + VkInstance instance_to_use = layer.buggy_query_of_vkCreateDevice ? NULL : layer.instance_handle; + PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(instance_to_use, "vkCreateDevice"); if (fpCreateDevice == NULL) { return VK_ERROR_INITIALIZATION_FAILED; } layer.next_vkGetDeviceProcAddr = fpGetDeviceProcAddr; + if (layer.check_if_EnumDevExtProps_is_same_as_queried_function) { + auto chain_info_EnumDeviceExtProps = reinterpret_cast( + fpGetInstanceProcAddr(layer.instance_handle, "vkEnumerateDeviceExtensionProperties")); + if (chain_info_EnumDeviceExtProps != layer.instance_dispatch_table.EnumerateDeviceExtensionProperties) { + return VK_ERROR_INITIALIZATION_FAILED; + } + } // Advance the link info for the next element on the chain chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; + if (layer.clobber_pDevice) { + memset(*pDevice, 0, 128); + } + VkResult result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); if (result != VK_SUCCESS) { return result; @@ -235,6 +419,10 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDevice(VkPhysicalDevice physicalDevi // initialize layer's dispatch table layer_init_device_dispatch_table(device.device_handle, &device.dispatch_table, fpGetDeviceProcAddr); + for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { + device.enabled_extensions.push_back({pCreateInfo->ppEnabledExtensionNames[i]}); + } + for (auto& func : layer.custom_device_interception_functions) { auto next_func = layer.next_vkGetDeviceProcAddr(*pDevice, func.name.c_str()); layer.custom_dispatch_functions.at(func.name.c_str()) = next_func; @@ -256,6 +444,20 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDevice(VkPhysicalDevice physicalDevi } } + if (layer.call_create_device_while_create_device_is_called) { + PFN_vkGetDeviceProcAddr next_gdpa = layer.next_vkGetDeviceProcAddr; + result = layer.callback_vkCreateDevice( + instance_to_use, layer.queried_physical_devices.at(layer.physical_device_index_to_use_during_create_device), + pCreateInfo, pAllocator, &layer.second_device_created_during_create_device.device_handle, get_instance_func, + &next_gdpa); + if (result != VK_SUCCESS) { + return result; + } + // initialize the other device's dispatch table + layer_init_device_dispatch_table(layer.second_device_created_during_create_device.device_handle, + &layer.second_device_created_during_create_device.dispatch_table, next_gdpa); + } + return result; } @@ -369,10 +571,8 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDeviceGroups( // underneath us when using this test. uint32_t icd_group_count = 0; layer.instance_dispatch_table.EnumeratePhysicalDeviceGroups(instance, &icd_group_count, nullptr); - std::vector tmp_vector(icd_group_count); - for (uint32_t group = 0; group < icd_group_count; ++group) { - tmp_vector[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; - } + std::vector tmp_vector(icd_group_count, + {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES}); layer.instance_dispatch_table.EnumeratePhysicalDeviceGroups(instance, &icd_group_count, tmp_vector.data()); layer.complete_physical_device_groups.clear(); @@ -457,13 +657,132 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroyDevice(VkDevice device, const VkAllocat } } - for (auto& created_device : layer.created_devices) { - if (created_device.device_handle == device) { - created_device.dispatch_table.DestroyDevice(device, pAllocator); - break; + if (layer.call_create_device_while_create_device_is_called) { + layer.callback_vkDestroyDevice(layer.second_device_created_during_create_device.device_handle, pAllocator, + layer.second_device_created_during_create_device.dispatch_table.DestroyDevice); + } + + auto it = std::find_if(std::begin(layer.created_devices), std::end(layer.created_devices), + [device](const TestLayer::Device& dev) { return device == dev.device_handle; }); + if (it != std::end(layer.created_devices)) { + it->dispatch_table.DestroyDevice(device, pAllocator); + layer.created_devices.erase(it); + } +} + +VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDebugUtilsMessengerEXT(VkInstance instance, + const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDebugUtilsMessengerEXT* pMessenger) { + if (layer.instance_dispatch_table.CreateDebugUtilsMessengerEXT) { + return layer.instance_dispatch_table.CreateDebugUtilsMessengerEXT(instance, pCreateInfo, pAllocator, pMessenger); + } else { + return VK_SUCCESS; + } +} + +VKAPI_ATTR void VKAPI_CALL test_vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, + const VkAllocationCallbacks* pAllocator) { + if (layer.instance_dispatch_table.DestroyDebugUtilsMessengerEXT) + return layer.instance_dispatch_table.DestroyDebugUtilsMessengerEXT(instance, messenger, pAllocator); +} + +// Debug utils & debug marker ext stubs +VKAPI_ATTR VkResult VKAPI_CALL test_vkDebugMarkerSetObjectTagEXT(VkDevice dev, const VkDebugMarkerObjectTagInfoEXT* pTagInfo) { + for (const auto& d : layer.created_devices) { + if (d.device_handle == dev) { + if (d.dispatch_table.DebugMarkerSetObjectTagEXT) { + return d.dispatch_table.DebugMarkerSetObjectTagEXT(dev, pTagInfo); + } else { + return VK_SUCCESS; + } } } + return VK_SUCCESS; +} +VKAPI_ATTR VkResult VKAPI_CALL test_vkDebugMarkerSetObjectNameEXT(VkDevice dev, const VkDebugMarkerObjectNameInfoEXT* pNameInfo) { + for (const auto& d : layer.created_devices) { + if (d.device_handle == dev) { + if (d.dispatch_table.DebugMarkerSetObjectNameEXT) { + return d.dispatch_table.DebugMarkerSetObjectNameEXT(dev, pNameInfo); + } else { + return VK_SUCCESS; + } + } + } + return VK_SUCCESS; } +VKAPI_ATTR void VKAPI_CALL test_vkCmdDebugMarkerBeginEXT(VkCommandBuffer cmd_buf, const VkDebugMarkerMarkerInfoEXT* marker_info) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.CmdDebugMarkerBeginEXT) + layer.created_devices[0].dispatch_table.CmdDebugMarkerBeginEXT(cmd_buf, marker_info); +} +VKAPI_ATTR void VKAPI_CALL test_vkCmdDebugMarkerEndEXT(VkCommandBuffer cmd_buf) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.CmdDebugMarkerEndEXT) + layer.created_devices[0].dispatch_table.CmdDebugMarkerEndEXT(cmd_buf); +} +VKAPI_ATTR void VKAPI_CALL test_vkCmdDebugMarkerInsertEXT(VkCommandBuffer cmd_buf, const VkDebugMarkerMarkerInfoEXT* marker_info) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.CmdDebugMarkerInsertEXT) + layer.created_devices[0].dispatch_table.CmdDebugMarkerInsertEXT(cmd_buf, marker_info); +} + +VKAPI_ATTR VkResult VKAPI_CALL test_vkSetDebugUtilsObjectNameEXT(VkDevice dev, const VkDebugUtilsObjectNameInfoEXT* pNameInfo) { + for (const auto& d : layer.created_devices) { + if (d.device_handle == dev) { + if (d.dispatch_table.SetDebugUtilsObjectNameEXT) { + return d.dispatch_table.SetDebugUtilsObjectNameEXT(dev, pNameInfo); + } else { + return VK_SUCCESS; + } + } + } + return VK_SUCCESS; +} +VKAPI_ATTR VkResult VKAPI_CALL test_vkSetDebugUtilsObjectTagEXT(VkDevice dev, const VkDebugUtilsObjectTagInfoEXT* pTagInfo) { + for (const auto& d : layer.created_devices) { + if (d.device_handle == dev) { + if (d.dispatch_table.SetDebugUtilsObjectTagEXT) { + return d.dispatch_table.SetDebugUtilsObjectTagEXT(dev, pTagInfo); + } else { + return VK_SUCCESS; + } + } + } + return VK_SUCCESS; +} +VKAPI_ATTR void VKAPI_CALL test_vkQueueBeginDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT* label) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.QueueBeginDebugUtilsLabelEXT) + layer.created_devices[0].dispatch_table.QueueBeginDebugUtilsLabelEXT(queue, label); +} +VKAPI_ATTR void VKAPI_CALL test_vkQueueEndDebugUtilsLabelEXT(VkQueue queue) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.QueueEndDebugUtilsLabelEXT) + layer.created_devices[0].dispatch_table.QueueEndDebugUtilsLabelEXT(queue); +} +VKAPI_ATTR void VKAPI_CALL test_vkQueueInsertDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT* label) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.QueueInsertDebugUtilsLabelEXT) + layer.created_devices[0].dispatch_table.QueueInsertDebugUtilsLabelEXT(queue, label); +} +VKAPI_ATTR void VKAPI_CALL test_vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer cmd_buf, const VkDebugUtilsLabelEXT* label) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.CmdBeginDebugUtilsLabelEXT) + layer.created_devices[0].dispatch_table.CmdBeginDebugUtilsLabelEXT(cmd_buf, label); +} +VKAPI_ATTR void VKAPI_CALL test_vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer cmd_buf) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.CmdEndDebugUtilsLabelEXT) + layer.created_devices[0].dispatch_table.CmdEndDebugUtilsLabelEXT(cmd_buf); +} +VKAPI_ATTR void VKAPI_CALL test_vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer cmd_buf, const VkDebugUtilsLabelEXT* label) { + // Just call the first device - + if (layer.created_devices[0].dispatch_table.CmdInsertDebugUtilsLabelEXT) + layer.created_devices[0].dispatch_table.CmdInsertDebugUtilsLabelEXT(cmd_buf, label); +} + // forward declarations needed for trampolines #if TEST_LAYER_EXPORT_GET_PHYSICAL_DEVICE_PROC_ADDR extern "C" { @@ -473,10 +792,28 @@ FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_layerGetPhysicalDev // trampolines VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func(VkDevice device, const char* pName); -VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func_impl(VkDevice device, const char* pName) { +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func_impl([[maybe_unused]] VkDevice device, const char* pName) { if (string_eq(pName, "vkGetDeviceProcAddr")) return to_vkVoidFunction(get_device_func); if (string_eq(pName, "vkDestroyDevice")) return to_vkVoidFunction(test_vkDestroyDevice); + 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); + if (string_eq(pName, "vkCmdDebugMarkerBeginEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerBeginEXT); + if (string_eq(pName, "vkCmdDebugMarkerEndEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerEndEXT); + if (string_eq(pName, "vkCmdDebugMarkerInsertEXT")) return to_vkVoidFunction(test_vkCmdDebugMarkerInsertEXT); + } + 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); + if (string_eq(pName, "vkQueueBeginDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkQueueBeginDebugUtilsLabelEXT); + if (string_eq(pName, "vkQueueEndDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkQueueEndDebugUtilsLabelEXT); + if (string_eq(pName, "vkQueueInsertDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkQueueInsertDebugUtilsLabelEXT); + if (string_eq(pName, "vkCmdBeginDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkCmdBeginDebugUtilsLabelEXT); + if (string_eq(pName, "vkCmdEndDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkCmdEndDebugUtilsLabelEXT); + if (string_eq(pName, "vkCmdInsertDebugUtilsLabelEXT")) return to_vkVoidFunction(test_vkCmdInsertDebugUtilsLabelEXT); + } + for (auto& func : layer.custom_device_interception_functions) { if (func.name == pName) { return to_vkVoidFunction(func.function); @@ -492,14 +829,14 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func_impl(VkDevice device, c return nullptr; } -VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func(VkDevice device, const char* pName) { +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_func([[maybe_unused]] VkDevice device, const char* pName) { PFN_vkVoidFunction ret_dev = get_device_func_impl(device, pName); if (ret_dev != nullptr) return ret_dev; return layer.next_vkGetDeviceProcAddr(device, pName); } -VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_physical_device_func(VkInstance instance, const char* pName) { +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_physical_device_func([[maybe_unused]] VkInstance instance, const char* pName) { if (string_eq(pName, "vkEnumerateDeviceLayerProperties")) return to_vkVoidFunction(test_vkEnumerateDeviceLayerProperties); if (string_eq(pName, "vkEnumerateDeviceExtensionProperties")) return to_vkVoidFunction(test_vkEnumerateDeviceExtensionProperties); @@ -633,6 +970,9 @@ FRAMEWORK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProper FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL test_layer_GetInstanceProcAddr(VkInstance instance, const char* pName) { return get_instance_func(instance, pName); } +#endif + +#if TEST_LAYER_EXPORT_OVERRIDE_GIPA FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL test_override_vkGetInstanceProcAddr(VkInstance instance, const char* pName) { if (string_eq(pName, "vkCreateInstance")) return to_vkVoidFunction(test_override_vkCreateInstance); @@ -652,20 +992,14 @@ FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL test_layer_GetDevicePr } #endif -#if TEST_LAYER_EXPORT_LAYER_VK_GDPA -FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* pName) { +#if TEST_LAYER_EXPORT_OVERRIDE_GDPA +FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL test_override_GetDeviceProcAddr(VkDevice device, const char* pName) { return get_device_func(device, pName); } #endif -#if TEST_LAYER_EXPORT_NO_PREFIX_GIPA -FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char* pName) { - return get_instance_func(instance, pName); -} -#endif - -#if TEST_LAYER_EXPORT_NO_PREFIX_GDPA -FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char* pName) { +#if TEST_LAYER_EXPORT_LAYER_VK_GDPA +FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* pName) { return get_device_func(device, pName); } #endif diff --git a/tests/framework/layer/test_layer.h b/tests/framework/layer/test_layer.h index 2d3571b431452b19e03fbab0bc90be2c3dca353a..d6d086c14d2fa688e7bd6402e5579905bbac72dc 100644 --- a/tests/framework/layer/test_layer.h +++ b/tests/framework/layer/test_layer.h @@ -102,14 +102,24 @@ struct TestLayer { 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 + BUILDER_VALUE(TestLayer, uint32_t, alter_api_version, VK_API_VERSION_1_0) + BUILDER_VECTOR(TestLayer, std::string, alternative_function_names, alternative_function_name) BUILDER_VECTOR(TestLayer, Extension, instance_extensions, instance_extension) + std::vector enabled_instance_extensions; + BUILDER_VECTOR(TestLayer, Extension, device_extensions, device_extension) BUILDER_VALUE(TestLayer, std::string, enable_environment, {}); BUILDER_VALUE(TestLayer, std::string, disable_environment, {}); + // Modifies the extension list returned by vkEnumerateInstanceExtensionProperties to include what is in this vector + BUILDER_VECTOR(TestLayer, Extension, injected_instance_extensions, injected_instance_extension) + // Modifies the extension list returned by vkEnumerateDeviceExtensionProperties to include what is in this vector + BUILDER_VECTOR(TestLayer, Extension, injected_device_extensions, injected_device_extension) + BUILDER_VECTOR(TestLayer, LayerDefinition, meta_component_layers, meta_component_layer); BUILDER_VALUE(TestLayer, bool, intercept_vkEnumerateInstanceExtensionProperties, false) @@ -157,6 +167,8 @@ struct TestLayer { return nullptr; } + // Allows distinguishing different layers (that use the same binary) + BUILDER_VALUE(TestLayer, std::string, make_spurious_log_in_create_instance, "") BUILDER_VALUE(TestLayer, bool, do_spurious_allocations_in_create_instance, false) void* spurious_instance_memory_allocation = nullptr; BUILDER_VALUE(TestLayer, bool, do_spurious_allocations_in_create_device, false) @@ -169,6 +181,20 @@ struct TestLayer { // By default query GPDPA from GIPA, don't use value given from pNext BUILDER_VALUE(TestLayer, bool, use_gipa_GetPhysicalDeviceProcAddr, true) + // Have a layer query for vkCreateDevice with a NULL instance handle + BUILDER_VALUE(TestLayer, bool, buggy_query_of_vkCreateDevice, false) + + // Makes the layer try to create a device using the loader provided function in the layer chain + BUILDER_VALUE(TestLayer, bool, call_create_device_while_create_device_is_called, false) + BUILDER_VALUE(TestLayer, uint32_t, physical_device_index_to_use_during_create_device, 0) + + BUILDER_VALUE(TestLayer, bool, check_if_EnumDevExtProps_is_same_as_queried_function, false) + + // Clober the data pointed to by pInstance to overwrite the magic value + BUILDER_VALUE(TestLayer, bool, clobber_pInstance, false) + // Clober the data pointed to by pDevice to overwrite the magic value + BUILDER_VALUE(TestLayer, bool, clobber_pDevice, false) + PFN_vkGetInstanceProcAddr next_vkGetInstanceProcAddr = VK_NULL_HANDLE; PFN_GetPhysicalDeviceProcAddr next_GetPhysicalDeviceProcAddr = VK_NULL_HANDLE; PFN_vkGetDeviceProcAddr next_vkGetDeviceProcAddr = VK_NULL_HANDLE; @@ -179,8 +205,15 @@ struct TestLayer { struct Device { VkDevice device_handle = VK_NULL_HANDLE; VkLayerDispatchTable dispatch_table{}; + std::vector enabled_extensions; }; std::vector created_devices; + + // Stores the callback that allows layers to create devices on their own + PFN_vkLayerCreateDevice callback_vkCreateDevice{}; + PFN_vkLayerDestroyDevice callback_vkDestroyDevice{}; + std::vector queried_physical_devices; + Device second_device_created_during_create_device{}; }; using GetTestLayerFunc = TestLayer* (*)(); diff --git a/tests/framework/layer/vk_dispatch_table_helper.h b/tests/framework/layer/vk_dispatch_table_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..48b628800d1b3cf05a2b115d84eddca85f49a7fa --- /dev/null +++ b/tests/framework/layer/vk_dispatch_table_helper.h @@ -0,0 +1,952 @@ +#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. + * + * 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/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->FreeMemory = (PFN_vkFreeMemory)gpa(device, "vkFreeMemory"); + 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->GetImageSparseMemoryRequirements = + (PFN_vkGetImageSparseMemoryRequirements)gpa(device, "vkGetImageSparseMemoryRequirements"); + table->QueueBindSparse = (PFN_vkQueueBindSparse)gpa(device, "vkQueueBindSparse"); + 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->DestroyQueryPool = (PFN_vkDestroyQueryPool)gpa(device, "vkDestroyQueryPool"); + 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->CreateShaderModule = (PFN_vkCreateShaderModule)gpa(device, "vkCreateShaderModule"); + table->DestroyShaderModule = (PFN_vkDestroyShaderModule)gpa(device, "vkDestroyShaderModule"); + table->CreatePipelineCache = (PFN_vkCreatePipelineCache)gpa(device, "vkCreatePipelineCache"); + table->DestroyPipelineCache = (PFN_vkDestroyPipelineCache)gpa(device, "vkDestroyPipelineCache"); + table->GetPipelineCacheData = (PFN_vkGetPipelineCacheData)gpa(device, "vkGetPipelineCacheData"); + table->MergePipelineCaches = (PFN_vkMergePipelineCaches)gpa(device, "vkMergePipelineCaches"); + 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->DestroyDescriptorPool = (PFN_vkDestroyDescriptorPool)gpa(device, "vkDestroyDescriptorPool"); + 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->DestroyCommandPool = (PFN_vkDestroyCommandPool)gpa(device, "vkDestroyCommandPool"); + 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->GetImageSparseMemoryRequirements2 = + (PFN_vkGetImageSparseMemoryRequirements2)gpa(device, "vkGetImageSparseMemoryRequirements2"); + table->TrimCommandPool = (PFN_vkTrimCommandPool)gpa(device, "vkTrimCommandPool"); + table->GetDeviceQueue2 = (PFN_vkGetDeviceQueue2)gpa(device, "vkGetDeviceQueue2"); + table->CreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion)gpa(device, "vkCreateSamplerYcbcrConversion"); + table->DestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion)gpa(device, "vkDestroySamplerYcbcrConversion"); + table->CreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate)gpa(device, "vkCreateDescriptorUpdateTemplate"); + table->DestroyDescriptorUpdateTemplate = + (PFN_vkDestroyDescriptorUpdateTemplate)gpa(device, "vkDestroyDescriptorUpdateTemplate"); + table->UpdateDescriptorSetWithTemplate = + (PFN_vkUpdateDescriptorSetWithTemplate)gpa(device, "vkUpdateDescriptorSetWithTemplate"); + 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->CreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot)gpa(device, "vkCreatePrivateDataSlot"); + table->DestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot)gpa(device, "vkDestroyPrivateDataSlot"); + table->SetPrivateData = (PFN_vkSetPrivateData)gpa(device, "vkSetPrivateData"); + table->GetPrivateData = (PFN_vkGetPrivateData)gpa(device, "vkGetPrivateData"); + table->CmdSetEvent2 = (PFN_vkCmdSetEvent2)gpa(device, "vkCmdSetEvent2"); + table->CmdResetEvent2 = (PFN_vkCmdResetEvent2)gpa(device, "vkCmdResetEvent2"); + table->CmdWaitEvents2 = (PFN_vkCmdWaitEvents2)gpa(device, "vkCmdWaitEvents2"); + table->CmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2)gpa(device, "vkCmdPipelineBarrier2"); + table->CmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2)gpa(device, "vkCmdWriteTimestamp2"); + table->QueueSubmit2 = (PFN_vkQueueSubmit2)gpa(device, "vkQueueSubmit2"); + table->CmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2)gpa(device, "vkCmdCopyBuffer2"); + table->CmdCopyImage2 = (PFN_vkCmdCopyImage2)gpa(device, "vkCmdCopyImage2"); + table->CmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2)gpa(device, "vkCmdCopyBufferToImage2"); + table->CmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2)gpa(device, "vkCmdCopyImageToBuffer2"); + table->CmdBlitImage2 = (PFN_vkCmdBlitImage2)gpa(device, "vkCmdBlitImage2"); + table->CmdResolveImage2 = (PFN_vkCmdResolveImage2)gpa(device, "vkCmdResolveImage2"); + table->CmdBeginRendering = (PFN_vkCmdBeginRendering)gpa(device, "vkCmdBeginRendering"); + table->CmdEndRendering = (PFN_vkCmdEndRendering)gpa(device, "vkCmdEndRendering"); + table->CmdSetCullMode = (PFN_vkCmdSetCullMode)gpa(device, "vkCmdSetCullMode"); + table->CmdSetFrontFace = (PFN_vkCmdSetFrontFace)gpa(device, "vkCmdSetFrontFace"); + table->CmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology)gpa(device, "vkCmdSetPrimitiveTopology"); + table->CmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount)gpa(device, "vkCmdSetViewportWithCount"); + table->CmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount)gpa(device, "vkCmdSetScissorWithCount"); + table->CmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2)gpa(device, "vkCmdBindVertexBuffers2"); + table->CmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable)gpa(device, "vkCmdSetDepthTestEnable"); + table->CmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable)gpa(device, "vkCmdSetDepthWriteEnable"); + table->CmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp)gpa(device, "vkCmdSetDepthCompareOp"); + table->CmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable)gpa(device, "vkCmdSetDepthBoundsTestEnable"); + table->CmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable)gpa(device, "vkCmdSetStencilTestEnable"); + table->CmdSetStencilOp = (PFN_vkCmdSetStencilOp)gpa(device, "vkCmdSetStencilOp"); + table->CmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable)gpa(device, "vkCmdSetRasterizerDiscardEnable"); + table->CmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable)gpa(device, "vkCmdSetDepthBiasEnable"); + table->CmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable)gpa(device, "vkCmdSetPrimitiveRestartEnable"); + table->GetDeviceBufferMemoryRequirements = + (PFN_vkGetDeviceBufferMemoryRequirements)gpa(device, "vkGetDeviceBufferMemoryRequirements"); + table->GetDeviceImageMemoryRequirements = + (PFN_vkGetDeviceImageMemoryRequirements)gpa(device, "vkGetDeviceImageMemoryRequirements"); + table->GetDeviceImageSparseMemoryRequirements = + (PFN_vkGetDeviceImageSparseMemoryRequirements)gpa(device, "vkGetDeviceImageSparseMemoryRequirements"); + table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR"); + table->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR"); + 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->CreateVideoSessionKHR = (PFN_vkCreateVideoSessionKHR)gpa(device, "vkCreateVideoSessionKHR"); + table->DestroyVideoSessionKHR = (PFN_vkDestroyVideoSessionKHR)gpa(device, "vkDestroyVideoSessionKHR"); + table->GetVideoSessionMemoryRequirementsKHR = + (PFN_vkGetVideoSessionMemoryRequirementsKHR)gpa(device, "vkGetVideoSessionMemoryRequirementsKHR"); + table->BindVideoSessionMemoryKHR = (PFN_vkBindVideoSessionMemoryKHR)gpa(device, "vkBindVideoSessionMemoryKHR"); + table->CreateVideoSessionParametersKHR = + (PFN_vkCreateVideoSessionParametersKHR)gpa(device, "vkCreateVideoSessionParametersKHR"); + table->UpdateVideoSessionParametersKHR = + (PFN_vkUpdateVideoSessionParametersKHR)gpa(device, "vkUpdateVideoSessionParametersKHR"); + table->DestroyVideoSessionParametersKHR = + (PFN_vkDestroyVideoSessionParametersKHR)gpa(device, "vkDestroyVideoSessionParametersKHR"); + table->CmdBeginVideoCodingKHR = (PFN_vkCmdBeginVideoCodingKHR)gpa(device, "vkCmdBeginVideoCodingKHR"); + table->CmdEndVideoCodingKHR = (PFN_vkCmdEndVideoCodingKHR)gpa(device, "vkCmdEndVideoCodingKHR"); + table->CmdControlVideoCodingKHR = (PFN_vkCmdControlVideoCodingKHR)gpa(device, "vkCmdControlVideoCodingKHR"); + table->CmdDecodeVideoKHR = (PFN_vkCmdDecodeVideoKHR)gpa(device, "vkCmdDecodeVideoKHR"); + table->CmdBeginRenderingKHR = (PFN_vkCmdBeginRenderingKHR)gpa(device, "vkCmdBeginRenderingKHR"); + table->CmdEndRenderingKHR = (PFN_vkCmdEndRenderingKHR)gpa(device, "vkCmdEndRenderingKHR"); + table->GetDeviceGroupPeerMemoryFeaturesKHR = + (PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR)gpa(device, "vkGetDeviceGroupPeerMemoryFeaturesKHR"); + table->CmdSetDeviceMaskKHR = (PFN_vkCmdSetDeviceMaskKHR)gpa(device, "vkCmdSetDeviceMaskKHR"); + table->CmdDispatchBaseKHR = (PFN_vkCmdDispatchBaseKHR)gpa(device, "vkCmdDispatchBaseKHR"); + table->TrimCommandPoolKHR = (PFN_vkTrimCommandPoolKHR)gpa(device, "vkTrimCommandPoolKHR"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetMemoryWin32HandleKHR = (PFN_vkGetMemoryWin32HandleKHR)gpa(device, "vkGetMemoryWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetMemoryWin32HandlePropertiesKHR = + (PFN_vkGetMemoryWin32HandlePropertiesKHR)gpa(device, "vkGetMemoryWin32HandlePropertiesKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)gpa(device, "vkGetMemoryFdKHR"); + table->GetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHR)gpa(device, "vkGetMemoryFdPropertiesKHR"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->ImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR)gpa(device, "vkImportSemaphoreWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetSemaphoreWin32HandleKHR = (PFN_vkGetSemaphoreWin32HandleKHR)gpa(device, "vkGetSemaphoreWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->ImportSemaphoreFdKHR = (PFN_vkImportSemaphoreFdKHR)gpa(device, "vkImportSemaphoreFdKHR"); + table->GetSemaphoreFdKHR = (PFN_vkGetSemaphoreFdKHR)gpa(device, "vkGetSemaphoreFdKHR"); + table->CmdPushDescriptorSetKHR = (PFN_vkCmdPushDescriptorSetKHR)gpa(device, "vkCmdPushDescriptorSetKHR"); + table->CmdPushDescriptorSetWithTemplateKHR = + (PFN_vkCmdPushDescriptorSetWithTemplateKHR)gpa(device, "vkCmdPushDescriptorSetWithTemplateKHR"); + table->CreateDescriptorUpdateTemplateKHR = + (PFN_vkCreateDescriptorUpdateTemplateKHR)gpa(device, "vkCreateDescriptorUpdateTemplateKHR"); + table->DestroyDescriptorUpdateTemplateKHR = + (PFN_vkDestroyDescriptorUpdateTemplateKHR)gpa(device, "vkDestroyDescriptorUpdateTemplateKHR"); + table->UpdateDescriptorSetWithTemplateKHR = + (PFN_vkUpdateDescriptorSetWithTemplateKHR)gpa(device, "vkUpdateDescriptorSetWithTemplateKHR"); + table->CreateRenderPass2KHR = (PFN_vkCreateRenderPass2KHR)gpa(device, "vkCreateRenderPass2KHR"); + table->CmdBeginRenderPass2KHR = (PFN_vkCmdBeginRenderPass2KHR)gpa(device, "vkCmdBeginRenderPass2KHR"); + table->CmdNextSubpass2KHR = (PFN_vkCmdNextSubpass2KHR)gpa(device, "vkCmdNextSubpass2KHR"); + table->CmdEndRenderPass2KHR = (PFN_vkCmdEndRenderPass2KHR)gpa(device, "vkCmdEndRenderPass2KHR"); + table->GetSwapchainStatusKHR = (PFN_vkGetSwapchainStatusKHR)gpa(device, "vkGetSwapchainStatusKHR"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->ImportFenceWin32HandleKHR = (PFN_vkImportFenceWin32HandleKHR)gpa(device, "vkImportFenceWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetFenceWin32HandleKHR = (PFN_vkGetFenceWin32HandleKHR)gpa(device, "vkGetFenceWin32HandleKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + 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->GetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2KHR)gpa(device, "vkGetImageMemoryRequirements2KHR"); + table->GetBufferMemoryRequirements2KHR = + (PFN_vkGetBufferMemoryRequirements2KHR)gpa(device, "vkGetBufferMemoryRequirements2KHR"); + table->GetImageSparseMemoryRequirements2KHR = + (PFN_vkGetImageSparseMemoryRequirements2KHR)gpa(device, "vkGetImageSparseMemoryRequirements2KHR"); + table->CreateSamplerYcbcrConversionKHR = + (PFN_vkCreateSamplerYcbcrConversionKHR)gpa(device, "vkCreateSamplerYcbcrConversionKHR"); + table->DestroySamplerYcbcrConversionKHR = + (PFN_vkDestroySamplerYcbcrConversionKHR)gpa(device, "vkDestroySamplerYcbcrConversionKHR"); + table->BindBufferMemory2KHR = (PFN_vkBindBufferMemory2KHR)gpa(device, "vkBindBufferMemory2KHR"); + table->BindImageMemory2KHR = (PFN_vkBindImageMemory2KHR)gpa(device, "vkBindImageMemory2KHR"); + table->GetDescriptorSetLayoutSupportKHR = + (PFN_vkGetDescriptorSetLayoutSupportKHR)gpa(device, "vkGetDescriptorSetLayoutSupportKHR"); + table->CmdDrawIndirectCountKHR = (PFN_vkCmdDrawIndirectCountKHR)gpa(device, "vkCmdDrawIndirectCountKHR"); + table->CmdDrawIndexedIndirectCountKHR = (PFN_vkCmdDrawIndexedIndirectCountKHR)gpa(device, "vkCmdDrawIndexedIndirectCountKHR"); + table->GetSemaphoreCounterValueKHR = (PFN_vkGetSemaphoreCounterValueKHR)gpa(device, "vkGetSemaphoreCounterValueKHR"); + table->WaitSemaphoresKHR = (PFN_vkWaitSemaphoresKHR)gpa(device, "vkWaitSemaphoresKHR"); + table->SignalSemaphoreKHR = (PFN_vkSignalSemaphoreKHR)gpa(device, "vkSignalSemaphoreKHR"); + table->CmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR)gpa(device, "vkCmdSetFragmentShadingRateKHR"); + table->WaitForPresentKHR = (PFN_vkWaitForPresentKHR)gpa(device, "vkWaitForPresentKHR"); + table->GetBufferDeviceAddressKHR = (PFN_vkGetBufferDeviceAddressKHR)gpa(device, "vkGetBufferDeviceAddressKHR"); + table->GetBufferOpaqueCaptureAddressKHR = + (PFN_vkGetBufferOpaqueCaptureAddressKHR)gpa(device, "vkGetBufferOpaqueCaptureAddressKHR"); + table->GetDeviceMemoryOpaqueCaptureAddressKHR = + (PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR)gpa(device, "vkGetDeviceMemoryOpaqueCaptureAddressKHR"); + table->CreateDeferredOperationKHR = (PFN_vkCreateDeferredOperationKHR)gpa(device, "vkCreateDeferredOperationKHR"); + table->DestroyDeferredOperationKHR = (PFN_vkDestroyDeferredOperationKHR)gpa(device, "vkDestroyDeferredOperationKHR"); + table->GetDeferredOperationMaxConcurrencyKHR = + (PFN_vkGetDeferredOperationMaxConcurrencyKHR)gpa(device, "vkGetDeferredOperationMaxConcurrencyKHR"); + table->GetDeferredOperationResultKHR = (PFN_vkGetDeferredOperationResultKHR)gpa(device, "vkGetDeferredOperationResultKHR"); + table->DeferredOperationJoinKHR = (PFN_vkDeferredOperationJoinKHR)gpa(device, "vkDeferredOperationJoinKHR"); + table->GetPipelineExecutablePropertiesKHR = + (PFN_vkGetPipelineExecutablePropertiesKHR)gpa(device, "vkGetPipelineExecutablePropertiesKHR"); + table->GetPipelineExecutableStatisticsKHR = + (PFN_vkGetPipelineExecutableStatisticsKHR)gpa(device, "vkGetPipelineExecutableStatisticsKHR"); + table->GetPipelineExecutableInternalRepresentationsKHR = + (PFN_vkGetPipelineExecutableInternalRepresentationsKHR)gpa(device, "vkGetPipelineExecutableInternalRepresentationsKHR"); + table->MapMemory2KHR = (PFN_vkMapMemory2KHR)gpa(device, "vkMapMemory2KHR"); + table->UnmapMemory2KHR = (PFN_vkUnmapMemory2KHR)gpa(device, "vkUnmapMemory2KHR"); +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->GetEncodedVideoSessionParametersKHR = + (PFN_vkGetEncodedVideoSessionParametersKHR)gpa(device, "vkGetEncodedVideoSessionParametersKHR"); +#endif // VK_ENABLE_BETA_EXTENSIONS +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->CmdEncodeVideoKHR = (PFN_vkCmdEncodeVideoKHR)gpa(device, "vkCmdEncodeVideoKHR"); +#endif // VK_ENABLE_BETA_EXTENSIONS + 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->CmdTraceRaysIndirect2KHR = (PFN_vkCmdTraceRaysIndirect2KHR)gpa(device, "vkCmdTraceRaysIndirect2KHR"); + table->GetDeviceBufferMemoryRequirementsKHR = + (PFN_vkGetDeviceBufferMemoryRequirementsKHR)gpa(device, "vkGetDeviceBufferMemoryRequirementsKHR"); + table->GetDeviceImageMemoryRequirementsKHR = + (PFN_vkGetDeviceImageMemoryRequirementsKHR)gpa(device, "vkGetDeviceImageMemoryRequirementsKHR"); + table->GetDeviceImageSparseMemoryRequirementsKHR = + (PFN_vkGetDeviceImageSparseMemoryRequirementsKHR)gpa(device, "vkGetDeviceImageSparseMemoryRequirementsKHR"); + table->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)gpa(device, "vkDebugMarkerSetObjectTagEXT"); + table->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)gpa(device, "vkDebugMarkerSetObjectNameEXT"); + table->CmdDebugMarkerBeginEXT = (PFN_vkCmdDebugMarkerBeginEXT)gpa(device, "vkCmdDebugMarkerBeginEXT"); + table->CmdDebugMarkerEndEXT = (PFN_vkCmdDebugMarkerEndEXT)gpa(device, "vkCmdDebugMarkerEndEXT"); + table->CmdDebugMarkerInsertEXT = (PFN_vkCmdDebugMarkerInsertEXT)gpa(device, "vkCmdDebugMarkerInsertEXT"); + table->CmdBindTransformFeedbackBuffersEXT = + (PFN_vkCmdBindTransformFeedbackBuffersEXT)gpa(device, "vkCmdBindTransformFeedbackBuffersEXT"); + table->CmdBeginTransformFeedbackEXT = (PFN_vkCmdBeginTransformFeedbackEXT)gpa(device, "vkCmdBeginTransformFeedbackEXT"); + table->CmdEndTransformFeedbackEXT = (PFN_vkCmdEndTransformFeedbackEXT)gpa(device, "vkCmdEndTransformFeedbackEXT"); + table->CmdBeginQueryIndexedEXT = (PFN_vkCmdBeginQueryIndexedEXT)gpa(device, "vkCmdBeginQueryIndexedEXT"); + table->CmdEndQueryIndexedEXT = (PFN_vkCmdEndQueryIndexedEXT)gpa(device, "vkCmdEndQueryIndexedEXT"); + table->CmdDrawIndirectByteCountEXT = (PFN_vkCmdDrawIndirectByteCountEXT)gpa(device, "vkCmdDrawIndirectByteCountEXT"); + table->CreateCuModuleNVX = (PFN_vkCreateCuModuleNVX)gpa(device, "vkCreateCuModuleNVX"); + table->CreateCuFunctionNVX = (PFN_vkCreateCuFunctionNVX)gpa(device, "vkCreateCuFunctionNVX"); + table->DestroyCuModuleNVX = (PFN_vkDestroyCuModuleNVX)gpa(device, "vkDestroyCuModuleNVX"); + table->DestroyCuFunctionNVX = (PFN_vkDestroyCuFunctionNVX)gpa(device, "vkDestroyCuFunctionNVX"); + table->CmdCuLaunchKernelNVX = (PFN_vkCmdCuLaunchKernelNVX)gpa(device, "vkCmdCuLaunchKernelNVX"); + table->GetImageViewHandleNVX = (PFN_vkGetImageViewHandleNVX)gpa(device, "vkGetImageViewHandleNVX"); + table->GetImageViewAddressNVX = (PFN_vkGetImageViewAddressNVX)gpa(device, "vkGetImageViewAddressNVX"); + table->CmdDrawIndirectCountAMD = (PFN_vkCmdDrawIndirectCountAMD)gpa(device, "vkCmdDrawIndirectCountAMD"); + table->CmdDrawIndexedIndirectCountAMD = (PFN_vkCmdDrawIndexedIndirectCountAMD)gpa(device, "vkCmdDrawIndexedIndirectCountAMD"); + table->GetShaderInfoAMD = (PFN_vkGetShaderInfoAMD)gpa(device, "vkGetShaderInfoAMD"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)gpa(device, "vkGetMemoryWin32HandleNV"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->CmdBeginConditionalRenderingEXT = + (PFN_vkCmdBeginConditionalRenderingEXT)gpa(device, "vkCmdBeginConditionalRenderingEXT"); + table->CmdEndConditionalRenderingEXT = (PFN_vkCmdEndConditionalRenderingEXT)gpa(device, "vkCmdEndConditionalRenderingEXT"); + table->CmdSetViewportWScalingNV = (PFN_vkCmdSetViewportWScalingNV)gpa(device, "vkCmdSetViewportWScalingNV"); + 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->GetRefreshCycleDurationGOOGLE = (PFN_vkGetRefreshCycleDurationGOOGLE)gpa(device, "vkGetRefreshCycleDurationGOOGLE"); + table->GetPastPresentationTimingGOOGLE = + (PFN_vkGetPastPresentationTimingGOOGLE)gpa(device, "vkGetPastPresentationTimingGOOGLE"); + 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"); +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + table->GetAndroidHardwareBufferPropertiesANDROID = + (PFN_vkGetAndroidHardwareBufferPropertiesANDROID)gpa(device, "vkGetAndroidHardwareBufferPropertiesANDROID"); +#endif // VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + table->GetMemoryAndroidHardwareBufferANDROID = + (PFN_vkGetMemoryAndroidHardwareBufferANDROID)gpa(device, "vkGetMemoryAndroidHardwareBufferANDROID"); +#endif // VK_USE_PLATFORM_ANDROID_KHR + table->CmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)gpa(device, "vkCmdSetSampleLocationsEXT"); + table->GetImageDrmFormatModifierPropertiesEXT = + (PFN_vkGetImageDrmFormatModifierPropertiesEXT)gpa(device, "vkGetImageDrmFormatModifierPropertiesEXT"); + table->CreateValidationCacheEXT = (PFN_vkCreateValidationCacheEXT)gpa(device, "vkCreateValidationCacheEXT"); + table->DestroyValidationCacheEXT = (PFN_vkDestroyValidationCacheEXT)gpa(device, "vkDestroyValidationCacheEXT"); + table->MergeValidationCachesEXT = (PFN_vkMergeValidationCachesEXT)gpa(device, "vkMergeValidationCachesEXT"); + table->GetValidationCacheDataEXT = (PFN_vkGetValidationCacheDataEXT)gpa(device, "vkGetValidationCacheDataEXT"); + table->CmdBindShadingRateImageNV = (PFN_vkCmdBindShadingRateImageNV)gpa(device, "vkCmdBindShadingRateImageNV"); + table->CmdSetViewportShadingRatePaletteNV = + (PFN_vkCmdSetViewportShadingRatePaletteNV)gpa(device, "vkCmdSetViewportShadingRatePaletteNV"); + table->CmdSetCoarseSampleOrderNV = (PFN_vkCmdSetCoarseSampleOrderNV)gpa(device, "vkCmdSetCoarseSampleOrderNV"); + table->CreateAccelerationStructureNV = (PFN_vkCreateAccelerationStructureNV)gpa(device, "vkCreateAccelerationStructureNV"); + table->DestroyAccelerationStructureNV = (PFN_vkDestroyAccelerationStructureNV)gpa(device, "vkDestroyAccelerationStructureNV"); + table->GetAccelerationStructureMemoryRequirementsNV = + (PFN_vkGetAccelerationStructureMemoryRequirementsNV)gpa(device, "vkGetAccelerationStructureMemoryRequirementsNV"); + table->BindAccelerationStructureMemoryNV = + (PFN_vkBindAccelerationStructureMemoryNV)gpa(device, "vkBindAccelerationStructureMemoryNV"); + table->CmdBuildAccelerationStructureNV = + (PFN_vkCmdBuildAccelerationStructureNV)gpa(device, "vkCmdBuildAccelerationStructureNV"); + table->CmdCopyAccelerationStructureNV = (PFN_vkCmdCopyAccelerationStructureNV)gpa(device, "vkCmdCopyAccelerationStructureNV"); + table->CmdTraceRaysNV = (PFN_vkCmdTraceRaysNV)gpa(device, "vkCmdTraceRaysNV"); + table->CreateRayTracingPipelinesNV = (PFN_vkCreateRayTracingPipelinesNV)gpa(device, "vkCreateRayTracingPipelinesNV"); + table->GetRayTracingShaderGroupHandlesKHR = + (PFN_vkGetRayTracingShaderGroupHandlesKHR)gpa(device, "vkGetRayTracingShaderGroupHandlesKHR"); + table->GetRayTracingShaderGroupHandlesNV = + (PFN_vkGetRayTracingShaderGroupHandlesNV)gpa(device, "vkGetRayTracingShaderGroupHandlesNV"); + table->GetAccelerationStructureHandleNV = + (PFN_vkGetAccelerationStructureHandleNV)gpa(device, "vkGetAccelerationStructureHandleNV"); + table->CmdWriteAccelerationStructuresPropertiesNV = + (PFN_vkCmdWriteAccelerationStructuresPropertiesNV)gpa(device, "vkCmdWriteAccelerationStructuresPropertiesNV"); + table->CompileDeferredNV = (PFN_vkCompileDeferredNV)gpa(device, "vkCompileDeferredNV"); + table->GetMemoryHostPointerPropertiesEXT = + (PFN_vkGetMemoryHostPointerPropertiesEXT)gpa(device, "vkGetMemoryHostPointerPropertiesEXT"); + table->CmdWriteBufferMarkerAMD = (PFN_vkCmdWriteBufferMarkerAMD)gpa(device, "vkCmdWriteBufferMarkerAMD"); + table->GetCalibratedTimestampsEXT = (PFN_vkGetCalibratedTimestampsEXT)gpa(device, "vkGetCalibratedTimestampsEXT"); + table->CmdDrawMeshTasksNV = (PFN_vkCmdDrawMeshTasksNV)gpa(device, "vkCmdDrawMeshTasksNV"); + table->CmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV)gpa(device, "vkCmdDrawMeshTasksIndirectNV"); + table->CmdDrawMeshTasksIndirectCountNV = + (PFN_vkCmdDrawMeshTasksIndirectCountNV)gpa(device, "vkCmdDrawMeshTasksIndirectCountNV"); + table->CmdSetExclusiveScissorEnableNV = (PFN_vkCmdSetExclusiveScissorEnableNV)gpa(device, "vkCmdSetExclusiveScissorEnableNV"); + table->CmdSetExclusiveScissorNV = (PFN_vkCmdSetExclusiveScissorNV)gpa(device, "vkCmdSetExclusiveScissorNV"); + table->CmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV)gpa(device, "vkCmdSetCheckpointNV"); + table->GetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV)gpa(device, "vkGetQueueCheckpointDataNV"); + table->InitializePerformanceApiINTEL = (PFN_vkInitializePerformanceApiINTEL)gpa(device, "vkInitializePerformanceApiINTEL"); + table->UninitializePerformanceApiINTEL = + (PFN_vkUninitializePerformanceApiINTEL)gpa(device, "vkUninitializePerformanceApiINTEL"); + table->CmdSetPerformanceMarkerINTEL = (PFN_vkCmdSetPerformanceMarkerINTEL)gpa(device, "vkCmdSetPerformanceMarkerINTEL"); + table->CmdSetPerformanceStreamMarkerINTEL = + (PFN_vkCmdSetPerformanceStreamMarkerINTEL)gpa(device, "vkCmdSetPerformanceStreamMarkerINTEL"); + table->CmdSetPerformanceOverrideINTEL = (PFN_vkCmdSetPerformanceOverrideINTEL)gpa(device, "vkCmdSetPerformanceOverrideINTEL"); + table->AcquirePerformanceConfigurationINTEL = + (PFN_vkAcquirePerformanceConfigurationINTEL)gpa(device, "vkAcquirePerformanceConfigurationINTEL"); + table->ReleasePerformanceConfigurationINTEL = + (PFN_vkReleasePerformanceConfigurationINTEL)gpa(device, "vkReleasePerformanceConfigurationINTEL"); + table->QueueSetPerformanceConfigurationINTEL = + (PFN_vkQueueSetPerformanceConfigurationINTEL)gpa(device, "vkQueueSetPerformanceConfigurationINTEL"); + table->GetPerformanceParameterINTEL = (PFN_vkGetPerformanceParameterINTEL)gpa(device, "vkGetPerformanceParameterINTEL"); + table->SetLocalDimmingAMD = (PFN_vkSetLocalDimmingAMD)gpa(device, "vkSetLocalDimmingAMD"); + table->GetBufferDeviceAddressEXT = (PFN_vkGetBufferDeviceAddressEXT)gpa(device, "vkGetBufferDeviceAddressEXT"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->AcquireFullScreenExclusiveModeEXT = + (PFN_vkAcquireFullScreenExclusiveModeEXT)gpa(device, "vkAcquireFullScreenExclusiveModeEXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->ReleaseFullScreenExclusiveModeEXT = + (PFN_vkReleaseFullScreenExclusiveModeEXT)gpa(device, "vkReleaseFullScreenExclusiveModeEXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetDeviceGroupSurfacePresentModes2EXT = + (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)gpa(device, "vkGetDeviceGroupSurfacePresentModes2EXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->CmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)gpa(device, "vkCmdSetLineStippleEXT"); + table->ResetQueryPoolEXT = (PFN_vkResetQueryPoolEXT)gpa(device, "vkResetQueryPoolEXT"); + 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->ReleaseSwapchainImagesEXT = (PFN_vkReleaseSwapchainImagesEXT)gpa(device, "vkReleaseSwapchainImagesEXT"); + table->GetGeneratedCommandsMemoryRequirementsNV = + (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)gpa(device, "vkGetGeneratedCommandsMemoryRequirementsNV"); + table->CmdPreprocessGeneratedCommandsNV = + (PFN_vkCmdPreprocessGeneratedCommandsNV)gpa(device, "vkCmdPreprocessGeneratedCommandsNV"); + table->CmdExecuteGeneratedCommandsNV = (PFN_vkCmdExecuteGeneratedCommandsNV)gpa(device, "vkCmdExecuteGeneratedCommandsNV"); + table->CmdBindPipelineShaderGroupNV = (PFN_vkCmdBindPipelineShaderGroupNV)gpa(device, "vkCmdBindPipelineShaderGroupNV"); + table->CreateIndirectCommandsLayoutNV = (PFN_vkCreateIndirectCommandsLayoutNV)gpa(device, "vkCreateIndirectCommandsLayoutNV"); + table->DestroyIndirectCommandsLayoutNV = + (PFN_vkDestroyIndirectCommandsLayoutNV)gpa(device, "vkDestroyIndirectCommandsLayoutNV"); + table->CreatePrivateDataSlotEXT = (PFN_vkCreatePrivateDataSlotEXT)gpa(device, "vkCreatePrivateDataSlotEXT"); + table->DestroyPrivateDataSlotEXT = (PFN_vkDestroyPrivateDataSlotEXT)gpa(device, "vkDestroyPrivateDataSlotEXT"); + table->SetPrivateDataEXT = (PFN_vkSetPrivateDataEXT)gpa(device, "vkSetPrivateDataEXT"); + table->GetPrivateDataEXT = (PFN_vkGetPrivateDataEXT)gpa(device, "vkGetPrivateDataEXT"); +#if defined(VK_USE_PLATFORM_METAL_EXT) + table->ExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT)gpa(device, "vkExportMetalObjectsEXT"); +#endif // VK_USE_PLATFORM_METAL_EXT + table->GetDescriptorSetLayoutSizeEXT = (PFN_vkGetDescriptorSetLayoutSizeEXT)gpa(device, "vkGetDescriptorSetLayoutSizeEXT"); + table->GetDescriptorSetLayoutBindingOffsetEXT = + (PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)gpa(device, "vkGetDescriptorSetLayoutBindingOffsetEXT"); + table->GetDescriptorEXT = (PFN_vkGetDescriptorEXT)gpa(device, "vkGetDescriptorEXT"); + table->CmdBindDescriptorBuffersEXT = (PFN_vkCmdBindDescriptorBuffersEXT)gpa(device, "vkCmdBindDescriptorBuffersEXT"); + table->CmdSetDescriptorBufferOffsetsEXT = + (PFN_vkCmdSetDescriptorBufferOffsetsEXT)gpa(device, "vkCmdSetDescriptorBufferOffsetsEXT"); + table->CmdBindDescriptorBufferEmbeddedSamplersEXT = + (PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)gpa(device, "vkCmdBindDescriptorBufferEmbeddedSamplersEXT"); + table->GetBufferOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetBufferOpaqueCaptureDescriptorDataEXT"); + table->GetImageOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetImageOpaqueCaptureDescriptorDataEXT"); + table->GetImageViewOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetImageViewOpaqueCaptureDescriptorDataEXT"); + table->GetSamplerOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)gpa(device, "vkGetSamplerOpaqueCaptureDescriptorDataEXT"); + table->GetAccelerationStructureOpaqueCaptureDescriptorDataEXT = + (PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)gpa( + device, "vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT"); + table->CmdSetFragmentShadingRateEnumNV = + (PFN_vkCmdSetFragmentShadingRateEnumNV)gpa(device, "vkCmdSetFragmentShadingRateEnumNV"); + table->GetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)gpa(device, "vkGetImageSubresourceLayout2EXT"); + table->GetDeviceFaultInfoEXT = (PFN_vkGetDeviceFaultInfoEXT)gpa(device, "vkGetDeviceFaultInfoEXT"); + table->CmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)gpa(device, "vkCmdSetVertexInputEXT"); +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetMemoryZirconHandleFUCHSIA = (PFN_vkGetMemoryZirconHandleFUCHSIA)gpa(device, "vkGetMemoryZirconHandleFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetMemoryZirconHandlePropertiesFUCHSIA = + (PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)gpa(device, "vkGetMemoryZirconHandlePropertiesFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->ImportSemaphoreZirconHandleFUCHSIA = + (PFN_vkImportSemaphoreZirconHandleFUCHSIA)gpa(device, "vkImportSemaphoreZirconHandleFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetSemaphoreZirconHandleFUCHSIA = + (PFN_vkGetSemaphoreZirconHandleFUCHSIA)gpa(device, "vkGetSemaphoreZirconHandleFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->CreateBufferCollectionFUCHSIA = (PFN_vkCreateBufferCollectionFUCHSIA)gpa(device, "vkCreateBufferCollectionFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->SetBufferCollectionImageConstraintsFUCHSIA = + (PFN_vkSetBufferCollectionImageConstraintsFUCHSIA)gpa(device, "vkSetBufferCollectionImageConstraintsFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->SetBufferCollectionBufferConstraintsFUCHSIA = + (PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA)gpa(device, "vkSetBufferCollectionBufferConstraintsFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->DestroyBufferCollectionFUCHSIA = (PFN_vkDestroyBufferCollectionFUCHSIA)gpa(device, "vkDestroyBufferCollectionFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->GetBufferCollectionPropertiesFUCHSIA = + (PFN_vkGetBufferCollectionPropertiesFUCHSIA)gpa(device, "vkGetBufferCollectionPropertiesFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA + table->GetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI = + (PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI)gpa(device, "vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI"); + table->CmdSubpassShadingHUAWEI = (PFN_vkCmdSubpassShadingHUAWEI)gpa(device, "vkCmdSubpassShadingHUAWEI"); + table->CmdBindInvocationMaskHUAWEI = (PFN_vkCmdBindInvocationMaskHUAWEI)gpa(device, "vkCmdBindInvocationMaskHUAWEI"); + table->GetMemoryRemoteAddressNV = (PFN_vkGetMemoryRemoteAddressNV)gpa(device, "vkGetMemoryRemoteAddressNV"); + table->GetPipelinePropertiesEXT = (PFN_vkGetPipelinePropertiesEXT)gpa(device, "vkGetPipelinePropertiesEXT"); + 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"); + table->CmdDrawMultiEXT = (PFN_vkCmdDrawMultiEXT)gpa(device, "vkCmdDrawMultiEXT"); + table->CmdDrawMultiIndexedEXT = (PFN_vkCmdDrawMultiIndexedEXT)gpa(device, "vkCmdDrawMultiIndexedEXT"); + table->CreateMicromapEXT = (PFN_vkCreateMicromapEXT)gpa(device, "vkCreateMicromapEXT"); + table->DestroyMicromapEXT = (PFN_vkDestroyMicromapEXT)gpa(device, "vkDestroyMicromapEXT"); + table->CmdBuildMicromapsEXT = (PFN_vkCmdBuildMicromapsEXT)gpa(device, "vkCmdBuildMicromapsEXT"); + table->BuildMicromapsEXT = (PFN_vkBuildMicromapsEXT)gpa(device, "vkBuildMicromapsEXT"); + table->CopyMicromapEXT = (PFN_vkCopyMicromapEXT)gpa(device, "vkCopyMicromapEXT"); + table->CopyMicromapToMemoryEXT = (PFN_vkCopyMicromapToMemoryEXT)gpa(device, "vkCopyMicromapToMemoryEXT"); + table->CopyMemoryToMicromapEXT = (PFN_vkCopyMemoryToMicromapEXT)gpa(device, "vkCopyMemoryToMicromapEXT"); + table->WriteMicromapsPropertiesEXT = (PFN_vkWriteMicromapsPropertiesEXT)gpa(device, "vkWriteMicromapsPropertiesEXT"); + table->CmdCopyMicromapEXT = (PFN_vkCmdCopyMicromapEXT)gpa(device, "vkCmdCopyMicromapEXT"); + table->CmdCopyMicromapToMemoryEXT = (PFN_vkCmdCopyMicromapToMemoryEXT)gpa(device, "vkCmdCopyMicromapToMemoryEXT"); + table->CmdCopyMemoryToMicromapEXT = (PFN_vkCmdCopyMemoryToMicromapEXT)gpa(device, "vkCmdCopyMemoryToMicromapEXT"); + table->CmdWriteMicromapsPropertiesEXT = (PFN_vkCmdWriteMicromapsPropertiesEXT)gpa(device, "vkCmdWriteMicromapsPropertiesEXT"); + table->GetDeviceMicromapCompatibilityEXT = + (PFN_vkGetDeviceMicromapCompatibilityEXT)gpa(device, "vkGetDeviceMicromapCompatibilityEXT"); + table->GetMicromapBuildSizesEXT = (PFN_vkGetMicromapBuildSizesEXT)gpa(device, "vkGetMicromapBuildSizesEXT"); + table->CmdDrawClusterHUAWEI = (PFN_vkCmdDrawClusterHUAWEI)gpa(device, "vkCmdDrawClusterHUAWEI"); + table->CmdDrawClusterIndirectHUAWEI = (PFN_vkCmdDrawClusterIndirectHUAWEI)gpa(device, "vkCmdDrawClusterIndirectHUAWEI"); + table->SetDeviceMemoryPriorityEXT = (PFN_vkSetDeviceMemoryPriorityEXT)gpa(device, "vkSetDeviceMemoryPriorityEXT"); + table->GetDescriptorSetLayoutHostMappingInfoVALVE = + (PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE)gpa(device, "vkGetDescriptorSetLayoutHostMappingInfoVALVE"); + table->GetDescriptorSetHostMappingVALVE = + (PFN_vkGetDescriptorSetHostMappingVALVE)gpa(device, "vkGetDescriptorSetHostMappingVALVE"); + table->CmdCopyMemoryIndirectNV = (PFN_vkCmdCopyMemoryIndirectNV)gpa(device, "vkCmdCopyMemoryIndirectNV"); + table->CmdCopyMemoryToImageIndirectNV = (PFN_vkCmdCopyMemoryToImageIndirectNV)gpa(device, "vkCmdCopyMemoryToImageIndirectNV"); + table->CmdDecompressMemoryNV = (PFN_vkCmdDecompressMemoryNV)gpa(device, "vkCmdDecompressMemoryNV"); + table->CmdDecompressMemoryIndirectCountNV = + (PFN_vkCmdDecompressMemoryIndirectCountNV)gpa(device, "vkCmdDecompressMemoryIndirectCountNV"); + table->CmdSetTessellationDomainOriginEXT = + (PFN_vkCmdSetTessellationDomainOriginEXT)gpa(device, "vkCmdSetTessellationDomainOriginEXT"); + table->CmdSetDepthClampEnableEXT = (PFN_vkCmdSetDepthClampEnableEXT)gpa(device, "vkCmdSetDepthClampEnableEXT"); + table->CmdSetPolygonModeEXT = (PFN_vkCmdSetPolygonModeEXT)gpa(device, "vkCmdSetPolygonModeEXT"); + table->CmdSetRasterizationSamplesEXT = (PFN_vkCmdSetRasterizationSamplesEXT)gpa(device, "vkCmdSetRasterizationSamplesEXT"); + table->CmdSetSampleMaskEXT = (PFN_vkCmdSetSampleMaskEXT)gpa(device, "vkCmdSetSampleMaskEXT"); + table->CmdSetAlphaToCoverageEnableEXT = (PFN_vkCmdSetAlphaToCoverageEnableEXT)gpa(device, "vkCmdSetAlphaToCoverageEnableEXT"); + table->CmdSetAlphaToOneEnableEXT = (PFN_vkCmdSetAlphaToOneEnableEXT)gpa(device, "vkCmdSetAlphaToOneEnableEXT"); + table->CmdSetLogicOpEnableEXT = (PFN_vkCmdSetLogicOpEnableEXT)gpa(device, "vkCmdSetLogicOpEnableEXT"); + table->CmdSetColorBlendEnableEXT = (PFN_vkCmdSetColorBlendEnableEXT)gpa(device, "vkCmdSetColorBlendEnableEXT"); + table->CmdSetColorBlendEquationEXT = (PFN_vkCmdSetColorBlendEquationEXT)gpa(device, "vkCmdSetColorBlendEquationEXT"); + table->CmdSetColorWriteMaskEXT = (PFN_vkCmdSetColorWriteMaskEXT)gpa(device, "vkCmdSetColorWriteMaskEXT"); + table->CmdSetRasterizationStreamEXT = (PFN_vkCmdSetRasterizationStreamEXT)gpa(device, "vkCmdSetRasterizationStreamEXT"); + table->CmdSetConservativeRasterizationModeEXT = + (PFN_vkCmdSetConservativeRasterizationModeEXT)gpa(device, "vkCmdSetConservativeRasterizationModeEXT"); + table->CmdSetExtraPrimitiveOverestimationSizeEXT = + (PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT)gpa(device, "vkCmdSetExtraPrimitiveOverestimationSizeEXT"); + table->CmdSetDepthClipEnableEXT = (PFN_vkCmdSetDepthClipEnableEXT)gpa(device, "vkCmdSetDepthClipEnableEXT"); + table->CmdSetSampleLocationsEnableEXT = (PFN_vkCmdSetSampleLocationsEnableEXT)gpa(device, "vkCmdSetSampleLocationsEnableEXT"); + table->CmdSetColorBlendAdvancedEXT = (PFN_vkCmdSetColorBlendAdvancedEXT)gpa(device, "vkCmdSetColorBlendAdvancedEXT"); + table->CmdSetProvokingVertexModeEXT = (PFN_vkCmdSetProvokingVertexModeEXT)gpa(device, "vkCmdSetProvokingVertexModeEXT"); + table->CmdSetLineRasterizationModeEXT = (PFN_vkCmdSetLineRasterizationModeEXT)gpa(device, "vkCmdSetLineRasterizationModeEXT"); + table->CmdSetLineStippleEnableEXT = (PFN_vkCmdSetLineStippleEnableEXT)gpa(device, "vkCmdSetLineStippleEnableEXT"); + table->CmdSetDepthClipNegativeOneToOneEXT = + (PFN_vkCmdSetDepthClipNegativeOneToOneEXT)gpa(device, "vkCmdSetDepthClipNegativeOneToOneEXT"); + table->CmdSetViewportWScalingEnableNV = (PFN_vkCmdSetViewportWScalingEnableNV)gpa(device, "vkCmdSetViewportWScalingEnableNV"); + table->CmdSetViewportSwizzleNV = (PFN_vkCmdSetViewportSwizzleNV)gpa(device, "vkCmdSetViewportSwizzleNV"); + table->CmdSetCoverageToColorEnableNV = (PFN_vkCmdSetCoverageToColorEnableNV)gpa(device, "vkCmdSetCoverageToColorEnableNV"); + table->CmdSetCoverageToColorLocationNV = + (PFN_vkCmdSetCoverageToColorLocationNV)gpa(device, "vkCmdSetCoverageToColorLocationNV"); + table->CmdSetCoverageModulationModeNV = (PFN_vkCmdSetCoverageModulationModeNV)gpa(device, "vkCmdSetCoverageModulationModeNV"); + table->CmdSetCoverageModulationTableEnableNV = + (PFN_vkCmdSetCoverageModulationTableEnableNV)gpa(device, "vkCmdSetCoverageModulationTableEnableNV"); + table->CmdSetCoverageModulationTableNV = + (PFN_vkCmdSetCoverageModulationTableNV)gpa(device, "vkCmdSetCoverageModulationTableNV"); + table->CmdSetShadingRateImageEnableNV = (PFN_vkCmdSetShadingRateImageEnableNV)gpa(device, "vkCmdSetShadingRateImageEnableNV"); + table->CmdSetRepresentativeFragmentTestEnableNV = + (PFN_vkCmdSetRepresentativeFragmentTestEnableNV)gpa(device, "vkCmdSetRepresentativeFragmentTestEnableNV"); + table->CmdSetCoverageReductionModeNV = (PFN_vkCmdSetCoverageReductionModeNV)gpa(device, "vkCmdSetCoverageReductionModeNV"); + table->GetShaderModuleIdentifierEXT = (PFN_vkGetShaderModuleIdentifierEXT)gpa(device, "vkGetShaderModuleIdentifierEXT"); + table->GetShaderModuleCreateInfoIdentifierEXT = + (PFN_vkGetShaderModuleCreateInfoIdentifierEXT)gpa(device, "vkGetShaderModuleCreateInfoIdentifierEXT"); + table->CreateOpticalFlowSessionNV = (PFN_vkCreateOpticalFlowSessionNV)gpa(device, "vkCreateOpticalFlowSessionNV"); + table->DestroyOpticalFlowSessionNV = (PFN_vkDestroyOpticalFlowSessionNV)gpa(device, "vkDestroyOpticalFlowSessionNV"); + table->BindOpticalFlowSessionImageNV = (PFN_vkBindOpticalFlowSessionImageNV)gpa(device, "vkBindOpticalFlowSessionImageNV"); + table->CmdOpticalFlowExecuteNV = (PFN_vkCmdOpticalFlowExecuteNV)gpa(device, "vkCmdOpticalFlowExecuteNV"); + table->CreateShadersEXT = (PFN_vkCreateShadersEXT)gpa(device, "vkCreateShadersEXT"); + table->DestroyShaderEXT = (PFN_vkDestroyShaderEXT)gpa(device, "vkDestroyShaderEXT"); + table->GetShaderBinaryDataEXT = (PFN_vkGetShaderBinaryDataEXT)gpa(device, "vkGetShaderBinaryDataEXT"); + table->CmdBindShadersEXT = (PFN_vkCmdBindShadersEXT)gpa(device, "vkCmdBindShadersEXT"); + table->GetFramebufferTilePropertiesQCOM = + (PFN_vkGetFramebufferTilePropertiesQCOM)gpa(device, "vkGetFramebufferTilePropertiesQCOM"); + table->GetDynamicRenderingTilePropertiesQCOM = + (PFN_vkGetDynamicRenderingTilePropertiesQCOM)gpa(device, "vkGetDynamicRenderingTilePropertiesQCOM"); + table->CmdSetAttachmentFeedbackLoopEnableEXT = + (PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)gpa(device, "vkCmdSetAttachmentFeedbackLoopEnableEXT"); + table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)gpa(device, "vkCreateAccelerationStructureKHR"); + table->DestroyAccelerationStructureKHR = + (PFN_vkDestroyAccelerationStructureKHR)gpa(device, "vkDestroyAccelerationStructureKHR"); + table->CmdBuildAccelerationStructuresKHR = + (PFN_vkCmdBuildAccelerationStructuresKHR)gpa(device, "vkCmdBuildAccelerationStructuresKHR"); + table->CmdBuildAccelerationStructuresIndirectKHR = + (PFN_vkCmdBuildAccelerationStructuresIndirectKHR)gpa(device, "vkCmdBuildAccelerationStructuresIndirectKHR"); + table->BuildAccelerationStructuresKHR = (PFN_vkBuildAccelerationStructuresKHR)gpa(device, "vkBuildAccelerationStructuresKHR"); + table->CopyAccelerationStructureKHR = (PFN_vkCopyAccelerationStructureKHR)gpa(device, "vkCopyAccelerationStructureKHR"); + table->CopyAccelerationStructureToMemoryKHR = + (PFN_vkCopyAccelerationStructureToMemoryKHR)gpa(device, "vkCopyAccelerationStructureToMemoryKHR"); + table->CopyMemoryToAccelerationStructureKHR = + (PFN_vkCopyMemoryToAccelerationStructureKHR)gpa(device, "vkCopyMemoryToAccelerationStructureKHR"); + table->WriteAccelerationStructuresPropertiesKHR = + (PFN_vkWriteAccelerationStructuresPropertiesKHR)gpa(device, "vkWriteAccelerationStructuresPropertiesKHR"); + table->CmdCopyAccelerationStructureKHR = + (PFN_vkCmdCopyAccelerationStructureKHR)gpa(device, "vkCmdCopyAccelerationStructureKHR"); + table->CmdCopyAccelerationStructureToMemoryKHR = + (PFN_vkCmdCopyAccelerationStructureToMemoryKHR)gpa(device, "vkCmdCopyAccelerationStructureToMemoryKHR"); + table->CmdCopyMemoryToAccelerationStructureKHR = + (PFN_vkCmdCopyMemoryToAccelerationStructureKHR)gpa(device, "vkCmdCopyMemoryToAccelerationStructureKHR"); + table->GetAccelerationStructureDeviceAddressKHR = + (PFN_vkGetAccelerationStructureDeviceAddressKHR)gpa(device, "vkGetAccelerationStructureDeviceAddressKHR"); + table->CmdWriteAccelerationStructuresPropertiesKHR = + (PFN_vkCmdWriteAccelerationStructuresPropertiesKHR)gpa(device, "vkCmdWriteAccelerationStructuresPropertiesKHR"); + table->GetDeviceAccelerationStructureCompatibilityKHR = + (PFN_vkGetDeviceAccelerationStructureCompatibilityKHR)gpa(device, "vkGetDeviceAccelerationStructureCompatibilityKHR"); + table->GetAccelerationStructureBuildSizesKHR = + (PFN_vkGetAccelerationStructureBuildSizesKHR)gpa(device, "vkGetAccelerationStructureBuildSizesKHR"); + table->CmdTraceRaysKHR = (PFN_vkCmdTraceRaysKHR)gpa(device, "vkCmdTraceRaysKHR"); + table->CreateRayTracingPipelinesKHR = (PFN_vkCreateRayTracingPipelinesKHR)gpa(device, "vkCreateRayTracingPipelinesKHR"); + table->GetRayTracingCaptureReplayShaderGroupHandlesKHR = + (PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)gpa(device, "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR"); + table->CmdTraceRaysIndirectKHR = (PFN_vkCmdTraceRaysIndirectKHR)gpa(device, "vkCmdTraceRaysIndirectKHR"); + table->GetRayTracingShaderGroupStackSizeKHR = + (PFN_vkGetRayTracingShaderGroupStackSizeKHR)gpa(device, "vkGetRayTracingShaderGroupStackSizeKHR"); + table->CmdSetRayTracingPipelineStackSizeKHR = + (PFN_vkCmdSetRayTracingPipelineStackSizeKHR)gpa(device, "vkCmdSetRayTracingPipelineStackSizeKHR"); + table->CmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT)gpa(device, "vkCmdDrawMeshTasksEXT"); + table->CmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)gpa(device, "vkCmdDrawMeshTasksIndirectEXT"); + table->CmdDrawMeshTasksIndirectCountEXT = + (PFN_vkCmdDrawMeshTasksIndirectCountEXT)gpa(device, "vkCmdDrawMeshTasksIndirectCountEXT"); +} + +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->GetPhysicalDeviceSparseImageFormatProperties = + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties)gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties"); + 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->GetPhysicalDeviceSparseImageFormatProperties2 = + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2)gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2"); + table->GetPhysicalDeviceExternalBufferProperties = + (PFN_vkGetPhysicalDeviceExternalBufferProperties)gpa(instance, "vkGetPhysicalDeviceExternalBufferProperties"); + table->GetPhysicalDeviceExternalFenceProperties = + (PFN_vkGetPhysicalDeviceExternalFenceProperties)gpa(instance, "vkGetPhysicalDeviceExternalFenceProperties"); + table->GetPhysicalDeviceExternalSemaphoreProperties = + (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)gpa(instance, "vkGetPhysicalDeviceExternalSemaphoreProperties"); + table->GetPhysicalDeviceToolProperties = + (PFN_vkGetPhysicalDeviceToolProperties)gpa(instance, "vkGetPhysicalDeviceToolProperties"); + 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"); +#if defined(VK_USE_PLATFORM_XLIB_KHR) + table->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR"); +#endif // VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) + table->GetPhysicalDeviceXlibPresentationSupportKHR = + (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); +#endif // VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) + table->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR"); +#endif // VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) + table->GetPhysicalDeviceXcbPresentationSupportKHR = + (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); +#endif // VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + table->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(instance, "vkCreateWaylandSurfaceKHR"); +#endif // VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + table->GetPhysicalDeviceWaylandPresentationSupportKHR = + (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); +#endif // VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + table->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa(instance, "vkCreateAndroidSurfaceKHR"); +#endif // VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetPhysicalDeviceWin32PresentationSupportKHR = + (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->GetPhysicalDeviceVideoCapabilitiesKHR = + (PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)gpa(instance, "vkGetPhysicalDeviceVideoCapabilitiesKHR"); + table->GetPhysicalDeviceVideoFormatPropertiesKHR = + (PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)gpa(instance, "vkGetPhysicalDeviceVideoFormatPropertiesKHR"); + table->GetPhysicalDeviceFeatures2KHR = (PFN_vkGetPhysicalDeviceFeatures2KHR)gpa(instance, "vkGetPhysicalDeviceFeatures2KHR"); + table->GetPhysicalDeviceProperties2KHR = + (PFN_vkGetPhysicalDeviceProperties2KHR)gpa(instance, "vkGetPhysicalDeviceProperties2KHR"); + table->GetPhysicalDeviceFormatProperties2KHR = + (PFN_vkGetPhysicalDeviceFormatProperties2KHR)gpa(instance, "vkGetPhysicalDeviceFormatProperties2KHR"); + table->GetPhysicalDeviceImageFormatProperties2KHR = + (PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)gpa(instance, "vkGetPhysicalDeviceImageFormatProperties2KHR"); + table->GetPhysicalDeviceQueueFamilyProperties2KHR = + (PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)gpa(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); + table->GetPhysicalDeviceMemoryProperties2KHR = + (PFN_vkGetPhysicalDeviceMemoryProperties2KHR)gpa(instance, "vkGetPhysicalDeviceMemoryProperties2KHR"); + table->GetPhysicalDeviceSparseImageFormatProperties2KHR = + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)gpa(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); + table->EnumeratePhysicalDeviceGroupsKHR = + (PFN_vkEnumeratePhysicalDeviceGroupsKHR)gpa(instance, "vkEnumeratePhysicalDeviceGroupsKHR"); + table->GetPhysicalDeviceExternalBufferPropertiesKHR = + (PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)gpa(instance, "vkGetPhysicalDeviceExternalBufferPropertiesKHR"); + table->GetPhysicalDeviceExternalSemaphorePropertiesKHR = + (PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)gpa(instance, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); + table->GetPhysicalDeviceExternalFencePropertiesKHR = + (PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)gpa(instance, "vkGetPhysicalDeviceExternalFencePropertiesKHR"); + 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"); +#if defined(VK_ENABLE_BETA_EXTENSIONS) + table->GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR = (PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR)gpa( + instance, "vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR"); +#endif // VK_ENABLE_BETA_EXTENSIONS + table->CreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)gpa(instance, "vkCreateDebugReportCallbackEXT"); + table->DestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)gpa(instance, "vkDestroyDebugReportCallbackEXT"); + table->DebugReportMessageEXT = (PFN_vkDebugReportMessageEXT)gpa(instance, "vkDebugReportMessageEXT"); +#if defined(VK_USE_PLATFORM_GGP) + table->CreateStreamDescriptorSurfaceGGP = + (PFN_vkCreateStreamDescriptorSurfaceGGP)gpa(instance, "vkCreateStreamDescriptorSurfaceGGP"); +#endif // VK_USE_PLATFORM_GGP + table->GetPhysicalDeviceExternalImageFormatPropertiesNV = + (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)gpa(instance, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"); +#if defined(VK_USE_PLATFORM_VI_NN) + table->CreateViSurfaceNN = (PFN_vkCreateViSurfaceNN)gpa(instance, "vkCreateViSurfaceNN"); +#endif // VK_USE_PLATFORM_VI_NN + table->ReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT)gpa(instance, "vkReleaseDisplayEXT"); +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) + table->AcquireXlibDisplayEXT = (PFN_vkAcquireXlibDisplayEXT)gpa(instance, "vkAcquireXlibDisplayEXT"); +#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) + table->GetRandROutputDisplayEXT = (PFN_vkGetRandROutputDisplayEXT)gpa(instance, "vkGetRandROutputDisplayEXT"); +#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT + table->GetPhysicalDeviceSurfaceCapabilities2EXT = + (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); +#if defined(VK_USE_PLATFORM_IOS_MVK) + table->CreateIOSSurfaceMVK = (PFN_vkCreateIOSSurfaceMVK)gpa(instance, "vkCreateIOSSurfaceMVK"); +#endif // VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) + table->CreateMacOSSurfaceMVK = (PFN_vkCreateMacOSSurfaceMVK)gpa(instance, "vkCreateMacOSSurfaceMVK"); +#endif // VK_USE_PLATFORM_MACOS_MVK + 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"); +#if defined(VK_USE_PLATFORM_FUCHSIA) + table->CreateImagePipeSurfaceFUCHSIA = (PFN_vkCreateImagePipeSurfaceFUCHSIA)gpa(instance, "vkCreateImagePipeSurfaceFUCHSIA"); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_METAL_EXT) + table->CreateMetalSurfaceEXT = (PFN_vkCreateMetalSurfaceEXT)gpa(instance, "vkCreateMetalSurfaceEXT"); +#endif // VK_USE_PLATFORM_METAL_EXT + table->GetPhysicalDeviceToolPropertiesEXT = + (PFN_vkGetPhysicalDeviceToolPropertiesEXT)gpa(instance, "vkGetPhysicalDeviceToolPropertiesEXT"); + table->GetPhysicalDeviceCooperativeMatrixPropertiesNV = + (PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV)gpa(instance, "vkGetPhysicalDeviceCooperativeMatrixPropertiesNV"); + table->GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV = + (PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)gpa( + instance, "vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetPhysicalDeviceSurfacePresentModes2EXT = + (PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT)gpa(instance, "vkGetPhysicalDeviceSurfacePresentModes2EXT"); +#endif // VK_USE_PLATFORM_WIN32_KHR + table->CreateHeadlessSurfaceEXT = (PFN_vkCreateHeadlessSurfaceEXT)gpa(instance, "vkCreateHeadlessSurfaceEXT"); + table->AcquireDrmDisplayEXT = (PFN_vkAcquireDrmDisplayEXT)gpa(instance, "vkAcquireDrmDisplayEXT"); + table->GetDrmDisplayEXT = (PFN_vkGetDrmDisplayEXT)gpa(instance, "vkGetDrmDisplayEXT"); +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->AcquireWinrtDisplayNV = (PFN_vkAcquireWinrtDisplayNV)gpa(instance, "vkAcquireWinrtDisplayNV"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + table->GetWinrtDisplayNV = (PFN_vkGetWinrtDisplayNV)gpa(instance, "vkGetWinrtDisplayNV"); +#endif // VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + table->CreateDirectFBSurfaceEXT = (PFN_vkCreateDirectFBSurfaceEXT)gpa(instance, "vkCreateDirectFBSurfaceEXT"); +#endif // VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + table->GetPhysicalDeviceDirectFBPresentationSupportEXT = + (PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)gpa(instance, "vkGetPhysicalDeviceDirectFBPresentationSupportEXT"); +#endif // VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + table->CreateScreenSurfaceQNX = (PFN_vkCreateScreenSurfaceQNX)gpa(instance, "vkCreateScreenSurfaceQNX"); +#endif // VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + table->GetPhysicalDeviceScreenPresentationSupportQNX = + (PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)gpa(instance, "vkGetPhysicalDeviceScreenPresentationSupportQNX"); +#endif // VK_USE_PLATFORM_SCREEN_QNX + table->GetPhysicalDeviceOpticalFlowImageFormatsNV = + (PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)gpa(instance, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); +} diff --git a/tests/framework/layer/wrap_objects.cpp b/tests/framework/layer/wrap_objects.cpp index f2ed84a7178b290da5d8281c0d62058f521504ad..514f904a720995edbe1b574b825aa1acbe5a01a6 100644 --- a/tests/framework/layer/wrap_objects.cpp +++ b/tests/framework/layer/wrap_objects.cpp @@ -25,28 +25,29 @@ #include #include #include +#include #include "vulkan/vk_layer.h" -#include "loader/generated/vk_dispatch_table_helper.h" +#include "vk_dispatch_table_helper.h" #include "loader/vk_loader_layer.h" // Export full support of instance extension VK_EXT_direct_mode_display extension -#ifndef TEST_LAYER_EXPORT_DIRECT_DISP +#if !defined(TEST_LAYER_EXPORT_DIRECT_DISP) #define TEST_LAYER_EXPORT_DIRECT_DISP 0 #endif // Export full support of instance extension VK_EXT_display_surface_counter extension -#ifndef TEST_LAYER_EXPORT_DISP_SURF_COUNT +#if !defined(TEST_LAYER_EXPORT_DISP_SURF_COUNT) #define TEST_LAYER_EXPORT_DISP_SURF_COUNT 0 #endif // Export full support of device extension VK_KHR_maintenance1 extension -#ifndef TEST_LAYER_EXPORT_MAINT_1 +#if !defined(TEST_LAYER_EXPORT_MAINT_1) #define TEST_LAYER_EXPORT_MAINT_1 0 #endif // Export full support of device extension VK_KHR_shared_presentable_image extension -#ifndef TEST_LAYER_EXPORT_PRESENT_IMAGE +#if !defined(TEST_LAYER_EXPORT_PRESENT_IMAGE) #define TEST_LAYER_EXPORT_PRESENT_IMAGE 0 #endif @@ -75,6 +76,7 @@ struct wrapped_inst_obj { bool layer_is_implicit; bool direct_display_enabled; bool display_surf_counter_enabled; + bool debug_utils_enabled; }; struct wrapped_dev_obj { @@ -85,31 +87,49 @@ struct wrapped_dev_obj { VkDevice obj; bool maintanence_1_enabled; bool present_image_enabled; + bool debug_utils_enabled; + bool debug_report_enabled; + bool debug_marker_enabled; }; -struct wrapped_debutil_mess_obj { +struct wrapped_debug_util_mess_obj { VkInstance inst; VkDebugUtilsMessengerEXT obj; }; +struct saved_wrapped_handles_storage { + std::vector instances; + std::vector physical_devices; + std::vector devices; + std::vector debug_util_messengers; +}; + +saved_wrapped_handles_storage saved_wrapped_handles; + VkInstance unwrap_instance(const VkInstance instance, wrapped_inst_obj **inst) { *inst = reinterpret_cast(instance); - return (*inst)->obj; + auto it = std::find(saved_wrapped_handles.instances.begin(), saved_wrapped_handles.instances.end(), *inst); + return (it == saved_wrapped_handles.instances.end()) ? VK_NULL_HANDLE : (*inst)->obj; } VkPhysicalDevice unwrap_phys_dev(const VkPhysicalDevice physical_device, wrapped_phys_dev_obj **phys_dev) { *phys_dev = reinterpret_cast(physical_device); - return reinterpret_cast((*phys_dev)->obj); + auto it = std::find(saved_wrapped_handles.physical_devices.begin(), saved_wrapped_handles.physical_devices.end(), *phys_dev); + return (it == saved_wrapped_handles.physical_devices.end()) ? VK_NULL_HANDLE + : reinterpret_cast((*phys_dev)->obj); } VkDevice unwrap_device(const VkDevice device, wrapped_dev_obj **dev) { *dev = reinterpret_cast(device); - return (*dev)->obj; + auto it = std::find(saved_wrapped_handles.devices.begin(), saved_wrapped_handles.devices.end(), *dev); + return (it == saved_wrapped_handles.devices.end()) ? VK_NULL_HANDLE : (*dev)->obj; } -VkDebugUtilsMessengerEXT unwrap_debutil_messenger(const VkDebugUtilsMessengerEXT messenger, wrapped_debutil_mess_obj **mess) { - *mess = reinterpret_cast(messenger); - return (*mess)->obj; +VkDebugUtilsMessengerEXT unwrap_debug_util_messenger(const VkDebugUtilsMessengerEXT messenger, wrapped_debug_util_mess_obj **mess) { + *mess = reinterpret_cast(messenger); + auto it = + std::find(saved_wrapped_handles.debug_util_messengers.begin(), saved_wrapped_handles.debug_util_messengers.end(), *mess); + return (it == saved_wrapped_handles.debug_util_messengers.end()) ? VK_NULL_HANDLE : (*mess)->obj; } VkLayerInstanceCreateInfo *get_chain_info(const VkInstanceCreateInfo *pCreateInfo, VkLayerFunction func) { @@ -132,7 +152,7 @@ VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo, V namespace wrap_objects { -static const VkLayerProperties global_layer = { +const VkLayerProperties global_layer = { "VK_LAYER_LUNARG_wrap_objects", VK_HEADER_VERSION_COMPLETE, 1, @@ -157,6 +177,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateInstance(const VkInstanceCreateInfo } auto inst = new wrapped_inst_obj; if (!inst) return VK_ERROR_OUT_OF_HOST_MEMORY; + saved_wrapped_handles.instances.push_back(inst); memset(inst, 0, sizeof(*inst)); inst->obj = (*pInstance); *pInstance = reinterpret_cast(inst); @@ -170,7 +191,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateInstance(const VkInstanceCreateInfo inst->pfn_inst_init = NULL; inst->loader_disp = *(reinterpret_cast(inst->obj)); } - layer_init_instance_dispatch_table(*pInstance, &inst->layer_disp, fpGetInstanceProcAddr); + layer_init_instance_dispatch_table(inst->obj, &inst->layer_disp, fpGetInstanceProcAddr); bool found = false; for (uint32_t layer = 0; layer < pCreateInfo->enabledLayerCount; ++layer) { std::string layer_name = pCreateInfo->ppEnabledLayerNames[layer]; @@ -196,6 +217,9 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateInstance(const VkInstanceCreateInfo inst->display_surf_counter_enabled = true; #endif } + if (!strcmp(pCreateInfo->ppEnabledExtensionNames[ext], VK_EXT_DEBUG_UTILS_EXTENSION_NAME)) { + inst->debug_utils_enabled = true; + } } return result; @@ -218,8 +242,9 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateDebugUtilsMessengerEXT(VkInstance in auto vk_inst = unwrap_instance(instance, &inst); VkLayerInstanceDispatchTable *pDisp = &inst->layer_disp; VkResult result = pDisp->CreateDebugUtilsMessengerEXT(vk_inst, pCreateInfo, pAllocator, pMessenger); - auto mess = new wrapped_debutil_mess_obj; + auto mess = new wrapped_debug_util_mess_obj; if (!mess) return VK_ERROR_OUT_OF_HOST_MEMORY; + saved_wrapped_handles.debug_util_messengers.push_back(mess); memset(mess, 0, sizeof(*mess)); mess->obj = (*pMessenger); *pMessenger = reinterpret_cast(mess); @@ -231,8 +256,8 @@ VKAPI_ATTR void VKAPI_CALL wrap_vkDestroyDebugUtilsMessengerEXT(VkInstance insta wrapped_inst_obj *inst; auto vk_inst = unwrap_instance(instance, &inst); VkLayerInstanceDispatchTable *pDisp = &inst->layer_disp; - wrapped_debutil_mess_obj *mess; - auto vk_mess = unwrap_debutil_messenger(messenger, &mess); + wrapped_debug_util_mess_obj *mess; + auto vk_mess = unwrap_debug_util_messenger(messenger, &mess); pDisp->DestroyDebugUtilsMessengerEXT(vk_inst, vk_mess, pAllocator); delete mess; } @@ -244,7 +269,7 @@ VKAPI_ATTR void VKAPI_CALL wrap_vkDestroySurfaceKHR(VkInstance instance, VkSurfa VkLayerInstanceDispatchTable *pDisp = &inst->layer_disp; pDisp->DestroySurfaceKHR(vk_inst, surface, pAllocator); } -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -254,7 +279,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateAndroidSurfaceKHR(VkInstance instanc } #endif -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -264,7 +289,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateWin32SurfaceKHR(VkInstance instance, } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -274,7 +299,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateWaylandSurfaceKHR(VkInstance instanc } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -284,7 +309,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateXcbSurfaceKHR(VkInstance instance, c } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -294,7 +319,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateXlibSurfaceKHR(VkInstance instance, } #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateDirectFBSurfaceEXT(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { @@ -305,7 +330,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateDirectFBSurfaceEXT(VkInstance instan } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -315,7 +340,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateMacOSSurfaceMVK(VkInstance instance, } #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -325,7 +350,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateIOSSurfaceMVK(VkInstance instance, c } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo, const VkAllocationCallbacks *pAllocator, @@ -347,7 +372,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateMetalSurfaceEXT(VkInstance instance, } #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateScreenSurfaceQNX(VkInstance instance, const VkScreenSurfaceCreateInfoQNX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { wrapped_inst_obj *inst; @@ -369,6 +394,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkEnumeratePhysicalDevices(VkInstance instan assert(pPhysicalDeviceCount); auto phys_devs = new wrapped_phys_dev_obj[*pPhysicalDeviceCount]; if (!phys_devs) return VK_ERROR_OUT_OF_HOST_MEMORY; + saved_wrapped_handles.physical_devices.push_back(phys_devs); if (inst->ptr_phys_devs) delete[] inst->ptr_phys_devs; inst->ptr_phys_devs = phys_devs; for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) { @@ -418,7 +444,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkEnumerateDeviceExtensionProperties(VkPhysi #endif if (pPropertyCount) { if (pProperties) { - uint32_t count = ext_count; + [[maybe_unused]] uint32_t count = ext_count; if (count > *pPropertyCount) { count = *pPropertyCount; result = VK_INCOMPLETE; @@ -481,6 +507,7 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateDevice(VkPhysicalDevice physicalDevi if (!dev) { return VK_ERROR_OUT_OF_HOST_MEMORY; } + saved_wrapped_handles.devices.push_back(dev); memset(dev, 0, sizeof(*dev)); dev->obj = *pDevice; dev->pfn_get_dev_proc_addr = pfn_get_dev_proc_addr; @@ -512,7 +539,11 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkCreateDevice(VkPhysicalDevice physicalDevi dev->present_image_enabled = true; #endif } + if (!strcmp(pCreateInfo->ppEnabledExtensionNames[ext], VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { + dev->debug_marker_enabled = true; + } } + dev->debug_utils_enabled = phys_dev->inst->debug_utils_enabled; return result; } @@ -525,12 +556,9 @@ VKAPI_ATTR void VKAPI_CALL wrap_vkDestroyDevice(VkDevice device, const VkAllocat } // Fake instance extension support -VKAPI_ATTR VkResult VKAPI_CALL wrap_vkReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { - return VK_SUCCESS; -} +VKAPI_ATTR VkResult VKAPI_CALL wrap_vkReleaseDisplayEXT(VkPhysicalDevice, VkDisplayKHR) { return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL wrap_vkGetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, +VKAPI_ATTR VkResult VKAPI_CALL wrap_vkGetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { if (nullptr != pSurfaceCapabilities) { pSurfaceCapabilities->minImageCount = 7; @@ -541,12 +569,109 @@ VKAPI_ATTR VkResult VKAPI_CALL wrap_vkGetPhysicalDeviceSurfaceCapabilities2EXT(V } // Fake device extension support -VKAPI_ATTR void VKAPI_CALL wrap_vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) {} +VKAPI_ATTR void VKAPI_CALL wrap_vkTrimCommandPoolKHR(VkDevice, VkCommandPool, VkCommandPoolTrimFlags) {} // Return an odd error so we can verify that this actually got called -VKAPI_ATTR VkResult VKAPI_CALL wrap_vkGetSwapchainStatusKHR(VkDevice device, VkSwapchainKHR swapchain) { - return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; +VKAPI_ATTR VkResult VKAPI_CALL wrap_vkGetSwapchainStatusKHR(VkDevice, VkSwapchainKHR) { return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; } + +// Debug utils & debug marker ext stubs +VKAPI_ATTR VkResult VKAPI_CALL wrap_vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) { + VkDebugMarkerObjectTagInfoEXT new_info = *pTagInfo; + wrapped_dev_obj *dev; + auto vk_dev = unwrap_device(device, &dev); + if (pTagInfo && pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + wrapped_phys_dev_obj *phys_dev; + auto vk_phys_dev = unwrap_phys_dev((VkPhysicalDevice)(uintptr_t)(pTagInfo->object), &phys_dev); + if (vk_phys_dev == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.object = (uint64_t)(uintptr_t)vk_phys_dev; + } + if (pTagInfo && pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + // TODO + } + if (pTagInfo && pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + wrapped_inst_obj *inst; + auto instance = unwrap_instance((VkInstance)(uintptr_t)(pTagInfo->object), &inst); + if (instance == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.object = (uint64_t)(uintptr_t)instance; + } + return dev->disp.DebugMarkerSetObjectTagEXT(vk_dev, &new_info); } +VKAPI_ATTR VkResult VKAPI_CALL wrap_vkDebugMarkerSetObjectNameEXT(VkDevice device, + const VkDebugMarkerObjectNameInfoEXT *pNameInfo) { + VkDebugMarkerObjectNameInfoEXT new_info = *pNameInfo; + wrapped_dev_obj *dev; + auto vk_dev = unwrap_device(device, &dev); + if (pNameInfo && pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + wrapped_phys_dev_obj *phys_dev; + auto vk_phys_dev = unwrap_phys_dev((VkPhysicalDevice)(uintptr_t)(pNameInfo->object), &phys_dev); + if (vk_phys_dev == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.object = (uint64_t)(uintptr_t)vk_phys_dev; + } + if (pNameInfo && pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + // TODO + } + if (pNameInfo && pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) { + wrapped_inst_obj *inst; + auto instance = unwrap_instance((VkInstance)(uintptr_t)(pNameInfo->object), &inst); + if (instance == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.object = (uint64_t)(uintptr_t)instance; + } + return dev->disp.DebugMarkerSetObjectNameEXT(vk_dev, &new_info); +} +// Debug Marker functions that are not supported: +// vkCmdDebugMarkerBeginEXT +// vkCmdDebugMarkerEndEXT +// vkCmdDebugMarkerInsertEXT + +VKAPI_ATTR VkResult VKAPI_CALL wrap_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) { + VkDebugUtilsObjectNameInfoEXT new_info = *pNameInfo; + wrapped_dev_obj *dev; + auto vk_dev = unwrap_device(device, &dev); + if (pNameInfo && pNameInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + wrapped_phys_dev_obj *phys_dev; + auto vk_phys_dev = unwrap_phys_dev((VkPhysicalDevice)(uintptr_t)(pNameInfo->objectHandle), &phys_dev); + if (vk_phys_dev == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.objectHandle = (uint64_t)(uintptr_t)vk_phys_dev; + } + if (pNameInfo && pNameInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) { + // TODO + } + if (pNameInfo && pNameInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + wrapped_inst_obj *inst; + auto instance = unwrap_instance((VkInstance)(uintptr_t)(pNameInfo->objectHandle), &inst); + if (instance == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.objectHandle = (uint64_t)(uintptr_t)instance; + } + return dev->disp.SetDebugUtilsObjectNameEXT(vk_dev, &new_info); +} +VKAPI_ATTR VkResult VKAPI_CALL wrap_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) { + VkDebugUtilsObjectTagInfoEXT new_info = *pTagInfo; + wrapped_dev_obj *dev; + auto vk_dev = unwrap_device(device, &dev); + if (pTagInfo && pTagInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) { + wrapped_phys_dev_obj *phys_dev; + auto vk_phys_dev = unwrap_phys_dev((VkPhysicalDevice)(uintptr_t)(pTagInfo->objectHandle), &phys_dev); + if (vk_phys_dev == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.objectHandle = (uint64_t)(uintptr_t)vk_phys_dev; + } + if (pTagInfo && pTagInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) { + // TODO + } + if (pTagInfo && pTagInfo->objectType == VK_OBJECT_TYPE_INSTANCE) { + wrapped_inst_obj *inst; + auto instance = unwrap_instance((VkInstance)(uintptr_t)(pTagInfo->objectHandle), &inst); + if (instance == VK_NULL_HANDLE) return VK_ERROR_DEVICE_LOST; + new_info.objectHandle = (uint64_t)(uintptr_t)instance; + } + return dev->disp.SetDebugUtilsObjectTagEXT(vk_dev, &new_info); +} +// Debug utils functions that are not supported +// vkQueueBeginDebugUtilsLabelEXT +// vkQueueEndDebugUtilsLabelEXT +// vkQueueInsertDebugUtilsLabelEXT +// vkCmdBeginDebugUtilsLabelEXT +// vkCmdEndDebugUtilsLabelEXT +// vkCmdInsertDebugUtilsLabelEXT PFN_vkVoidFunction layer_intercept_device_proc(wrapped_dev_obj *dev, const char *name) { if (!name || name[0] != 'v' || name[1] != 'k') return NULL; @@ -559,6 +684,15 @@ PFN_vkVoidFunction layer_intercept_device_proc(wrapped_dev_obj *dev, const char if (dev->present_image_enabled && !strcmp(name, "GetSwapchainStatusKHR")) return (PFN_vkVoidFunction)wrap_vkGetSwapchainStatusKHR; + if (dev->debug_marker_enabled && !strcmp(name, "DebugMarkerSetObjectTagEXT")) + return (PFN_vkVoidFunction)wrap_vkDebugMarkerSetObjectTagEXT; + if (dev->debug_marker_enabled && !strcmp(name, "DebugMarkerSetObjectNameEXT")) + return (PFN_vkVoidFunction)wrap_vkDebugMarkerSetObjectNameEXT; + if (dev->debug_utils_enabled && !strcmp(name, "SetDebugUtilsObjectNameEXT")) + return (PFN_vkVoidFunction)wrap_vkSetDebugUtilsObjectNameEXT; + if (dev->debug_utils_enabled && !strcmp(name, "SetDebugUtilsObjectTagEXT")) + return (PFN_vkVoidFunction)wrap_vkSetDebugUtilsObjectTagEXT; + return NULL; } @@ -599,39 +733,39 @@ PFN_vkVoidFunction layer_intercept_instance_proc(wrapped_inst_obj *inst, const c if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties")) return (PFN_vkVoidFunction)wrap_vkGetPhysicalDeviceQueueFamilyProperties; -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) if (!strcmp(name, "CreateAndroidSurfaceKHR")) return (PFN_vkVoidFunction)wrap_vkCreateAndroidSurfaceKHR; #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) if (!strcmp(name, "CreateWin32SurfaceKHR")) return (PFN_vkVoidFunction)wrap_vkCreateWin32SurfaceKHR; #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) if (!strcmp(name, "CreateWaylandSurfaceKHR")) return (PFN_vkVoidFunction)wrap_vkCreateWaylandSurfaceKHR; #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) if (!strcmp(name, "CreateXcbSurfaceKHR")) return (PFN_vkVoidFunction)wrap_vkCreateXcbSurfaceKHR; #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) if (!strcmp(name, "CreateXlibSurfaceKHR")) return (PFN_vkVoidFunction)wrap_vkCreateXlibSurfaceKHR; #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) if (!strcmp(name, "CreateDirectFBSurfaceEXT")) return (PFN_vkVoidFunction)wrap_vkCreateDirectFBSurfaceEXT; #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) if (!strcmp(name, "CreateMacOSSurfaceMVK")) return (PFN_vkVoidFunction)wrap_vkCreateMacOSSurfaceMVK; #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) if (!strcmp(name, "CreateIOSSurfaceMVK")) return (PFN_vkVoidFunction)wrap_vkCreateIOSSurfaceMVK; #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) if (!strcmp(name, "CreateStreamDescriptorSurfaceGGP")) return (PFN_vkVoidFunction)wrap_vkCreateStreamDescriptorSurfaceGGP; #endif // VK_USE_PLATFORM_GGP @@ -639,7 +773,7 @@ PFN_vkVoidFunction layer_intercept_instance_proc(wrapped_inst_obj *inst, const c if (!strcmp(name, "CreateMetalSurfaceEXT")) return (PFN_vkVoidFunction)wrap_vkCreateMetalSurfaceEXT; #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) if (!strcmp(name, "CreateScreenSurfaceQNX")) return (PFN_vkVoidFunction)wrap_vkCreateScreenSurfaceQNX; #endif // VK_USE_PLATFORM_SCREEN_QNX if (!strcmp(name, "DestroySurfaceKHR")) return (PFN_vkVoidFunction)wrap_vkDestroySurfaceKHR; @@ -648,6 +782,18 @@ PFN_vkVoidFunction layer_intercept_instance_proc(wrapped_inst_obj *inst, const c if (inst->display_surf_counter_enabled && !strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2EXT")) return (PFN_vkVoidFunction)wrap_vkGetPhysicalDeviceSurfaceCapabilities2EXT; + // 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) + if (!strcmp(name, "TrimCommandPoolKHR")) return (PFN_vkVoidFunction)wrap_vkTrimCommandPoolKHR; + if (!strcmp(name, "GetSwapchainStatusKHR")) return (PFN_vkVoidFunction)wrap_vkGetSwapchainStatusKHR; + + if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) return (PFN_vkVoidFunction)wrap_vkDebugMarkerSetObjectTagEXT; + if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) return (PFN_vkVoidFunction)wrap_vkDebugMarkerSetObjectNameEXT; + if (inst->debug_utils_enabled && !strcmp(name, "SetDebugUtilsObjectNameEXT")) + return (PFN_vkVoidFunction)wrap_vkSetDebugUtilsObjectNameEXT; + if (inst->debug_utils_enabled && !strcmp(name, "SetDebugUtilsObjectTagEXT")) + return (PFN_vkVoidFunction)wrap_vkSetDebugUtilsObjectTagEXT; + return NULL; } @@ -662,7 +808,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL wrap_vkGetInstanceProcAddr(VkInstance i } wrapped_inst_obj *inst; - (void)unwrap_instance(instance, &inst); + unwrap_instance(instance, &inst); addr = layer_intercept_instance_proc(inst, funcName); if (addr) return addr; @@ -670,18 +816,18 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL wrap_vkGetInstanceProcAddr(VkInstance i VkLayerInstanceDispatchTable *pTable = &inst->layer_disp; if (pTable->GetInstanceProcAddr == NULL) return NULL; - return pTable->GetInstanceProcAddr(instance, funcName); + return pTable->GetInstanceProcAddr(inst->obj, funcName); } VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName) { assert(instance); wrapped_inst_obj *inst; - (void)unwrap_instance(instance, &inst); + unwrap_instance(instance, &inst); VkLayerInstanceDispatchTable *pTable = &inst->layer_disp; if (pTable->GetPhysicalDeviceProcAddr == NULL) return NULL; - return pTable->GetPhysicalDeviceProcAddr(instance, funcName); + return pTable->GetPhysicalDeviceProcAddr(inst->obj, funcName); } } // namespace wrap_objects @@ -696,21 +842,20 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkD return wrap_objects::wrap_vkGetDeviceProcAddr(device, funcName); } -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, - VkExtensionProperties *pProperties) { +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *, uint32_t *, + VkExtensionProperties *) { assert(0); // TODO return wrap_objects::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); return VK_SUCCESS; } -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, - VkLayerProperties *pProperties) { +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *, VkLayerProperties *) { assert(0); // TODO return wrap_objects::EnumerateInstanceLayerProperties(pCount, pProperties); return VK_SUCCESS; } -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, - const char *pLayerName, uint32_t *pCount, - VkExtensionProperties *pProperties) { +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL +vkEnumerateDeviceExtensionProperties([[maybe_unused]] VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pCount, + VkExtensionProperties *pProperties) { // the layer command handles VK_NULL_HANDLE just fine internally assert(physicalDevice == VK_NULL_HANDLE); return wrap_objects::wrap_vkEnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties); @@ -732,63 +877,63 @@ VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR return wrap_objects::wrap_vkDestroySurfaceKHR(instance, surface, pAllocator); } -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateDirectFBSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateMacOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateIOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { @@ -803,7 +948,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(VkInstance instance, cons } #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) VKAPI_ATTR VkResult VKAPI_CALL vkCreateScreenSurfaceQNX(VkInstance instance, const VkScreenSurfaceCreateInfoQNX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { return wrap_objects::wrap_vkCreateScreenSurfaceQNX(instance, pCreateInfo, pAllocator, pSurface); diff --git a/tests/framework/shim/CMakeLists.txt b/tests/framework/shim/CMakeLists.txt index 82c2573f52ca5a5de3e0dd45af3221f279f337a5..a7cf4540dc3184d3033b3004c301b5a40ba1b551 100644 --- a/tests/framework/shim/CMakeLists.txt +++ b/tests/framework/shim/CMakeLists.txt @@ -18,7 +18,6 @@ add_library(shim-common STATIC shim_common.cpp) target_link_libraries(shim-common PUBLIC testing_framework_util) target_include_directories(shim-common PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -set_target_properties(shim-common ${LOADER_STANDARD_CXX_PROPERTIES}) if (WIN32) # need adapters.h which is in the loader folder @@ -31,10 +30,10 @@ if (WIN32) elseif(UNIX) if(APPLE) add_library(shim-library SHARED unix_shim.cpp) + target_link_libraries(shim-library PRIVATE "-framework CoreFoundation") else() add_library(shim-library STATIC unix_shim.cpp) endif() endif() #common attributes target_link_libraries(shim-library PUBLIC shim-common) -set_target_properties(shim-library ${LOADER_STANDARD_CXX_PROPERTIES}) diff --git a/tests/framework/shim/shim.h b/tests/framework/shim/shim.h index b619465e27daac01f97232851851969f374dad04..a3a515ac7ae73c46f1c9f354e97c0927f896e8b8 100644 --- a/tests/framework/shim/shim.h +++ b/tests/framework/shim/shim.h @@ -29,6 +29,7 @@ #include "test_util.h" +#include #include #if defined(WIN32) @@ -44,10 +45,18 @@ #include #endif -enum class ManifestCategory { implicit_layer, explicit_layer, icd }; +enum class ManifestCategory { implicit_layer, explicit_layer, icd, settings }; enum class GpuType { unspecified, integrated, discrete, external }; #if defined(WIN32) +#define VK_VARIANT_REG_STR "" +#define VK_VARIANT_REG_STR_W L"" + +#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\Drivers" +#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ExplicitLayers" +#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ImplicitLayers" +#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\LoaderSettings" + struct RegistryEntry { RegistryEntry() = default; RegistryEntry(std::string const& name) noexcept : name(name) {} @@ -71,8 +80,8 @@ static const char* pnp_registry_path = "SYSTEM\\CurrentControlSet\\Control\\Clas // Needed for DXGI mocking struct KnownDriverData { - const char* filename; - int vendor_id; + const char* filename = nullptr; + int vendor_id = 0; }; static std::array known_driver_list = { #if defined(_WIN64) @@ -85,17 +94,14 @@ static std::array known_driver_list = { }; struct DXGIAdapter { - DXGIAdapter(GpuType gpu_preference, DXGI_ADAPTER_DESC1 desc1, uint32_t adapter_index) - : gpu_preference(gpu_preference), desc1(desc1), adapter_index(adapter_index) {} GpuType gpu_preference = GpuType::unspecified; DXGI_ADAPTER_DESC1 desc1{}; uint32_t adapter_index = 0; + IDXGIAdapter1 adapter_instance{}; + IDXGIAdapter1Vtbl adapter_vtbl_instance{}; }; struct D3DKMT_Adapter { - D3DKMT_Adapter() = default; - D3DKMT_Adapter(UINT hAdapter, LUID adapter_luid) noexcept : hAdapter(hAdapter), adapter_luid(adapter_luid) {} - D3DKMT_Adapter& add_driver_manifest_path(fs::path const& src); D3DKMT_Adapter& add_implicit_layer_manifest_path(fs::path const& src); D3DKMT_Adapter& add_explicit_layer_manifest_path(fs::path const& src); @@ -110,13 +116,15 @@ struct D3DKMT_Adapter { D3DKMT_Adapter& add_path(fs::path src, std::vector& dest); }; -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS struct DirEntry { - DIR* directory; + DIR* directory = nullptr; std::string folder_path; std::vector contents; - size_t current_index; + // the current item being read by an app (incremented by readdir, reset to zero by opendir & closedir) + size_t current_index = 0; + bool is_fake_path = false; // true when this entry is for folder redirection }; #endif @@ -138,26 +146,28 @@ struct PlatformShim { void redirect_all_paths(fs::path const& path); void redirect_category(fs::path const& new_path, ManifestCategory category); - void set_path(ManifestCategory category, fs::path const& path); + // fake paths are paths that the loader normally looks in but actually point to locations inside the test framework + void set_fake_path(ManifestCategory category, fs::path const& path); + + // known paths are real paths but since the test framework guarantee's the order files are found in, files in these paths + // need to be ordered correctly + void add_known_path(fs::path const& path); void add_manifest(ManifestCategory category, fs::path const& path); + void add_unsecured_manifest(ManifestCategory category, fs::path const& path); // platform specific shim interface #if defined(WIN32) // Control Platform Elevation Level - void set_elevated_privilege(bool elev) { - (elev) ? elevation_level = SECURITY_MANDATORY_HIGH_RID : elevation_level = SECURITY_MANDATORY_LOW_RID; - } + void set_elevated_privilege(bool elev) { elevation_level = (elev) ? SECURITY_MANDATORY_HIGH_RID : SECURITY_MANDATORY_LOW_RID; } unsigned long elevation_level = SECURITY_MANDATORY_LOW_RID; void add_dxgi_adapter(GpuType gpu_preference, DXGI_ADAPTER_DESC1 desc1); void add_d3dkmt_adapter(D3DKMT_Adapter const& adapter); void set_app_package_path(fs::path const& path); - uint32_t next_adapter_handle = 1; // increment everytime add_dxgi_adapter is called - std::vector dxgi_adapters; - std::unordered_map dxgi_adapter_map; - // next two are a pair + std::unordered_map dxgi_adapters; + std::vector d3dkmt_adapters; // TODO: @@ -174,6 +184,8 @@ struct PlatformShim { std::vector hkey_local_machine_explicit_layers; std::vector hkey_local_machine_implicit_layers; std::vector hkey_local_machine_drivers; + std::vector hkey_local_machine_settings; + std::vector hkey_current_user_settings; std::wstring app_package_path; @@ -181,20 +193,35 @@ struct PlatformShim { size_t created_key_count = 0; std::vector created_keys; -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS bool is_fake_path(fs::path const& path); - fs::path const& get_fake_path(fs::path const& path); + fs::path const& get_real_path_from_fake_path(fs::path const& path); void redirect_path(fs::path const& path, fs::path const& new_path); void remove_redirect(fs::path const& path); + bool is_known_path(fs::path const& path); + void remove_known_path(fs::path const& path); + + void redirect_dlopen_name(fs::path const& filename, fs::path const& actual_path); + bool is_dlopen_redirect_name(fs::path const& filename); + + fs::path query_default_redirect_path(ManifestCategory category); + std::unordered_map redirection_map; + std::unordered_map dlopen_redirection_map; + std::unordered_set known_path_set; void set_elevated_privilege(bool elev) { use_fake_elevation = elev; } bool use_fake_elevation = false; std::vector dir_entries; + +#if defined(__APPLE__) + std::string bundle_contents; +#endif #endif + bool is_during_destruction = false; }; std::vector parse_env_var_list(std::string const& var); @@ -208,7 +235,7 @@ extern "C" { using PFN_get_platform_shim = PlatformShim* (*)(std::vector* folders); #define GET_PLATFORM_SHIM_STR "get_platform_shim" -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) // statically link on linux PlatformShim* get_platform_shim(std::vector* folders); #endif diff --git a/tests/framework/shim/shim_common.cpp b/tests/framework/shim/shim_common.cpp index dd4c4bf8e57065943995f3de22bf2ac49136a75d..8fe7aa0549566e855a8c4f74d535085b9aef8556 100644 --- a/tests/framework/shim/shim_common.cpp +++ b/tests/framework/shim/shim_common.cpp @@ -42,7 +42,7 @@ std::vector parse_env_var_list(std::string const& var) { for (size_t i = 0; i < var.size(); i++) { #if defined(WIN32) if (var[i] == ';') { -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS if (var[i] == ':') { #endif if (len != 0) { @@ -101,19 +101,38 @@ void PlatformShim::reset() { hkey_local_machine_explicit_layers.clear(); hkey_local_machine_implicit_layers.clear(); hkey_local_machine_drivers.clear(); + hkey_local_machine_settings.clear(); + hkey_current_user_settings.clear(); } -void PlatformShim::set_path(ManifestCategory category, fs::path const& path) {} +void PlatformShim::set_fake_path([[maybe_unused]] ManifestCategory category, [[maybe_unused]] fs::path const& path) {} +void PlatformShim::add_known_path([[maybe_unused]] fs::path const& path) {} void PlatformShim::add_manifest(ManifestCategory category, fs::path const& path) { - if (category == ManifestCategory::implicit_layer) hkey_local_machine_implicit_layers.emplace_back(path.str()); - if (category == ManifestCategory::explicit_layer) + if (category == ManifestCategory::settings) { + hkey_local_machine_settings.emplace_back(path.str()); + } else if (category == ManifestCategory::implicit_layer) { + hkey_local_machine_implicit_layers.emplace_back(path.str()); + } else if (category == ManifestCategory::explicit_layer) { hkey_local_machine_explicit_layers.emplace_back(path.str()); - else + } else { hkey_local_machine_drivers.emplace_back(path.str()); + } } + +void PlatformShim::add_unsecured_manifest(ManifestCategory category, fs::path const& path) { + if (category == ManifestCategory::settings) { + hkey_current_user_settings.emplace_back(path.str()); + } else if (category == ManifestCategory::implicit_layer) { + hkey_current_user_implicit_layers.emplace_back(path.str()); + } else if (category == ManifestCategory::explicit_layer) { + hkey_current_user_explicit_layers.emplace_back(path.str()); + } +} + void PlatformShim::add_dxgi_adapter(GpuType gpu_preference, DXGI_ADAPTER_DESC1 desc1) { - dxgi_adapters.push_back(DXGIAdapter(gpu_preference, desc1, next_adapter_handle++)); + uint32_t next_index = static_cast(dxgi_adapters.size()); + dxgi_adapters.emplace(next_index, DXGIAdapter{gpu_preference, desc1, next_index}); } void PlatformShim::add_d3dkmt_adapter(D3DKMT_Adapter const& adapter) { d3dkmt_adapters.push_back(adapter); } @@ -124,7 +143,8 @@ void PlatformShim::set_app_package_path(fs::path const& path) { } // TODO: -void PlatformShim::add_CM_Device_ID(std::wstring const& id, fs::path const& icd_path, fs::path const& layer_path) { +void PlatformShim::add_CM_Device_ID([[maybe_unused]] std::wstring const& id, [[maybe_unused]] fs::path const& icd_path, + [[maybe_unused]] fs::path const& layer_path) { // // append a null byte as separator if there is already id's in the list // if (CM_device_ID_list.size() != 0) { // CM_device_ID_list += L'\0'; // I'm sure this wont cause issues with std::string down the line... /s @@ -143,14 +163,15 @@ void PlatformShim::add_CM_Device_ID(std::wstring const& id, fs::path const& icd_ // // add_key_value_string(id_key, "VulkanLayerName", layer_path.c_str()); } -void PlatformShim::redirect_category(fs::path const& new_path, ManifestCategory search_category) {} +void PlatformShim::redirect_category(fs::path const&, ManifestCategory) {} -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS #include #include std::string category_path_name(ManifestCategory category) { + if (category == ManifestCategory::settings) return "settings.d"; if (category == ManifestCategory::implicit_layer) return "implicit_layer.d"; if (category == ManifestCategory::explicit_layer) return "explicit_layer.d"; @@ -160,12 +181,17 @@ std::string category_path_name(ManifestCategory category) { void PlatformShim::reset() { redirection_map.clear(); } +bool PlatformShim::is_fake_path(fs::path const& path) { return redirection_map.count(path.str()) > 0; } +fs::path const& PlatformShim::get_real_path_from_fake_path(fs::path const& path) { return redirection_map.at(path.str()); } void PlatformShim::redirect_path(fs::path const& path, fs::path const& new_path) { redirection_map[path.str()] = new_path; } void PlatformShim::remove_redirect(fs::path const& path) { redirection_map.erase(path.str()); } -bool PlatformShim::is_fake_path(fs::path const& path) { return redirection_map.count(path.str()) > 0; } -fs::path const& PlatformShim::get_fake_path(fs::path const& path) { return redirection_map.at(path.str()); } -void PlatformShim::add_manifest(ManifestCategory category, fs::path const& path) {} +bool PlatformShim::is_known_path(fs::path const& path) { return known_path_set.count(path.str()) > 0; } +void PlatformShim::add_known_path(fs::path const& path) { known_path_set.insert(path.str()); } +void PlatformShim::remove_known_path(fs::path const& path) { known_path_set.erase(path.str()); } + +void PlatformShim::add_manifest([[maybe_unused]] ManifestCategory category, [[maybe_unused]] fs::path const& path) {} +void PlatformShim::add_unsecured_manifest([[maybe_unused]] ManifestCategory category, [[maybe_unused]] fs::path const& path) {} void parse_and_add_env_var_override(std::vector& paths, std::string env_var_contents) { auto parsed_paths = parse_env_var_list(env_var_contents); @@ -175,14 +201,21 @@ void parse_and_add_env_var_override(std::vector& paths, std::string void PlatformShim::redirect_category(fs::path const& new_path, ManifestCategory category) { std::vector paths; auto home = fs::path(get_env_var("HOME")); + if (category == ManifestCategory::settings) { + redirect_path(home / ".local/share/vulkan" / category_path_name(category), new_path); + return; + } + if (home.size() != 0) { paths.push_back((home / ".config").str()); paths.push_back((home / ".local/share").str()); } - parse_and_add_env_var_override(paths, get_env_var("XDG_CONFIG_DIRS")); - parse_and_add_env_var_override(paths, get_env_var("XDG_CONFIG_HOME")); - parse_and_add_env_var_override(paths, get_env_var("XDG_DATA_DIRS")); - parse_and_add_env_var_override(paths, get_env_var("XDG_DATA_HOME")); + // Don't report errors on apple - these env-vars are not suppose to be defined + bool report_errors = true; +#if defined(__APPLE__) + report_errors = false; +#endif + parse_and_add_env_var_override(paths, get_env_var("XDG_CONFIG_HOME", report_errors)); if (category == ManifestCategory::explicit_layer) { parse_and_add_env_var_override(paths, get_env_var("VK_LAYER_PATH", false)); // don't report failure } @@ -209,9 +242,18 @@ void PlatformShim::redirect_category(fs::path const& new_path, ManifestCategory } } -void PlatformShim::set_path(ManifestCategory category, fs::path const& path) { +void PlatformShim::set_fake_path(ManifestCategory category, fs::path const& path) { // use /etc as the 'redirection path' by default since its always searched redirect_path(fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category), path); } +void PlatformShim::redirect_dlopen_name(fs::path const& filename, fs::path const& actual_path) { + dlopen_redirection_map[filename.str()] = actual_path; +} + +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) { + return fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category); +} #endif diff --git a/tests/framework/shim/unix_shim.cpp b/tests/framework/shim/unix_shim.cpp index c52bec7bc00b11d3885c9e8228e81b0daac86880..12b3bfa56fbb1a6bc4f2291e1359df8c672eb36c 100644 --- a/tests/framework/shim/unix_shim.cpp +++ b/tests/framework/shim/unix_shim.cpp @@ -27,9 +27,15 @@ #include "shim.h" -static PlatformShim platform_shim; +#include + +#if defined(__APPLE__) +#include +#endif + +PlatformShim platform_shim; extern "C" { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) PlatformShim* get_platform_shim(std::vector* folders) { platform_shim = PlatformShim(folders); return &platform_shim; @@ -42,12 +48,13 @@ FRAMEWORK_EXPORT PlatformShim* get_platform_shim(std::vector* #endif // Necessary for MacOS function shimming -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) #define OPENDIR_FUNC_NAME opendir #define READDIR_FUNC_NAME readdir #define CLOSEDIR_FUNC_NAME closedir #define ACCESS_FUNC_NAME access #define FOPEN_FUNC_NAME fopen +#define DLOPEN_FUNC_NAME dlopen #define GETEUID_FUNC_NAME geteuid #define GETEGID_FUNC_NAME getegid #if defined(HAVE_SECURE_GETENV) @@ -62,8 +69,10 @@ FRAMEWORK_EXPORT PlatformShim* get_platform_shim(std::vector* #define CLOSEDIR_FUNC_NAME my_closedir #define ACCESS_FUNC_NAME my_access #define FOPEN_FUNC_NAME my_fopen +#define DLOPEN_FUNC_NAME my_dlopen #define GETEUID_FUNC_NAME my_geteuid #define GETEGID_FUNC_NAME my_getegid +#if !defined(TARGET_OS_IPHONE) #if defined(HAVE_SECURE_GETENV) #define SECURE_GETENV_FUNC_NAME my_secure_getenv #endif @@ -71,40 +80,67 @@ FRAMEWORK_EXPORT PlatformShim* get_platform_shim(std::vector* #define __SECURE_GETENV_FUNC_NAME my__secure_getenv #endif #endif +#endif using PFN_OPENDIR = DIR* (*)(const char* path_name); using PFN_READDIR = struct dirent* (*)(DIR* dir_stream); using PFN_CLOSEDIR = int (*)(DIR* dir_stream); using PFN_ACCESS = int (*)(const char* pathname, int mode); using PFN_FOPEN = FILE* (*)(const char* filename, const char* mode); +using PFN_DLOPEN = void* (*)(const char* in_filename, int flags); using PFN_GETEUID = uid_t (*)(void); using PFN_GETEGID = gid_t (*)(void); #if defined(HAVE_SECURE_GETENV) || defined(HAVE___SECURE_GETENV) using PFN_SEC_GETENV = char* (*)(const char* name); #endif -static PFN_OPENDIR real_opendir = nullptr; -static PFN_READDIR real_readdir = nullptr; -static PFN_CLOSEDIR real_closedir = nullptr; -static PFN_ACCESS real_access = nullptr; -static PFN_FOPEN real_fopen = nullptr; -static PFN_GETEUID real_geteuid = nullptr; -static PFN_GETEGID real_getegid = nullptr; +#if defined(__APPLE__) +#define real_opendir opendir +#define real_readdir readdir +#define real_closedir closedir +#define real_access access +#define real_fopen fopen +#define real_dlopen dlopen +#define real_geteuid geteuid +#define real_getegid getegid #if defined(HAVE_SECURE_GETENV) -static PFN_SEC_GETENV real_secure_getenv = nullptr; +#define real_secure_getenv secure_getenv #endif #if defined(HAVE___SECURE_GETENV) -static PFN_SEC_GETENV real__secure_getenv = nullptr; +#define real__secure_getenv __secure_getenv +#endif +#else +PFN_OPENDIR real_opendir = nullptr; +PFN_READDIR real_readdir = nullptr; +PFN_CLOSEDIR real_closedir = nullptr; +PFN_ACCESS real_access = nullptr; +PFN_FOPEN real_fopen = nullptr; +PFN_DLOPEN real_dlopen = nullptr; +PFN_GETEUID real_geteuid = nullptr; +PFN_GETEGID real_getegid = nullptr; +#if defined(HAVE_SECURE_GETENV) +PFN_SEC_GETENV real_secure_getenv = nullptr; +#endif +#if defined(HAVE___SECURE_GETENV) +PFN_SEC_GETENV real__secure_getenv = nullptr; +#endif #endif FRAMEWORK_EXPORT DIR* OPENDIR_FUNC_NAME(const char* path_name) { +#if !defined(__APPLE__) if (!real_opendir) real_opendir = (PFN_OPENDIR)dlsym(RTLD_NEXT, "opendir"); - +#endif + if (platform_shim.is_during_destruction) { + return real_opendir(path_name); + } DIR* dir; if (platform_shim.is_fake_path(path_name)) { - auto fake_path_name = platform_shim.get_fake_path(fs::path(path_name)); - dir = real_opendir(fake_path_name.c_str()); - platform_shim.dir_entries.push_back(DirEntry{dir, std::string(path_name), {}, false}); + auto real_path_name = platform_shim.get_real_path_from_fake_path(fs::path(path_name)); + dir = real_opendir(real_path_name.c_str()); + platform_shim.dir_entries.push_back(DirEntry{dir, std::string(path_name), {}, 0, true}); + } else if (platform_shim.is_known_path(path_name)) { + dir = real_opendir(path_name); + platform_shim.dir_entries.push_back(DirEntry{dir, std::string(path_name), {}, 0, false}); } else { dir = real_opendir(path_name); } @@ -113,7 +149,12 @@ FRAMEWORK_EXPORT DIR* OPENDIR_FUNC_NAME(const char* path_name) { } FRAMEWORK_EXPORT struct dirent* READDIR_FUNC_NAME(DIR* dir_stream) { +#if !defined(__APPLE__) if (!real_readdir) real_readdir = (PFN_READDIR)dlsym(RTLD_NEXT, "readdir"); +#endif + if (platform_shim.is_during_destruction) { + return real_readdir(dir_stream); + } auto it = std::find_if(platform_shim.dir_entries.begin(), platform_shim.dir_entries.end(), [dir_stream](DirEntry const& entry) { return entry.directory == dir_stream; }); @@ -132,8 +173,11 @@ FRAMEWORK_EXPORT struct dirent* READDIR_FUNC_NAME(DIR* dir_stream) { folder_contents.push_back(dir_entry); dirent_filenames.push_back(&dir_entry->d_name[0]); } - auto real_path = platform_shim.redirection_map.at(it->folder_path); - auto filenames = get_folder_contents(platform_shim.folders, real_path.str()); + auto real_path = it->folder_path; + if (it->is_fake_path) { + real_path = platform_shim.redirection_map.at(it->folder_path).str(); + } + auto filenames = get_folder_contents(platform_shim.folders, real_path); // Add the dirent structures in the order they appear in the FolderManager // Ignore anything which wasn't in the FolderManager @@ -151,8 +195,12 @@ FRAMEWORK_EXPORT struct dirent* READDIR_FUNC_NAME(DIR* dir_stream) { } FRAMEWORK_EXPORT int CLOSEDIR_FUNC_NAME(DIR* dir_stream) { +#if !defined(__APPLE__) if (!real_closedir) real_closedir = (PFN_CLOSEDIR)dlsym(RTLD_NEXT, "closedir"); - +#endif + if (platform_shim.is_during_destruction) { + return real_closedir(dir_stream); + } auto it = std::find_if(platform_shim.dir_entries.begin(), platform_shim.dir_entries.end(), [dir_stream](DirEntry const& entry) { return entry.directory == dir_stream; }); @@ -164,24 +212,26 @@ FRAMEWORK_EXPORT int CLOSEDIR_FUNC_NAME(DIR* dir_stream) { } FRAMEWORK_EXPORT int ACCESS_FUNC_NAME(const char* in_pathname, int mode) { +#if !defined(__APPLE__) if (!real_access) real_access = (PFN_ACCESS)dlsym(RTLD_NEXT, "access"); - +#endif fs::path path{in_pathname}; if (!path.has_parent_path()) { return real_access(in_pathname, mode); } if (platform_shim.is_fake_path(path.parent_path())) { - fs::path fake_path = platform_shim.get_fake_path(path.parent_path()); - fake_path /= path.filename(); - return real_access(fake_path.c_str(), mode); + fs::path real_path = platform_shim.get_real_path_from_fake_path(path.parent_path()); + real_path /= path.filename(); + return real_access(real_path.c_str(), mode); } return real_access(in_pathname, mode); } FRAMEWORK_EXPORT FILE* FOPEN_FUNC_NAME(const char* in_filename, const char* mode) { +#if !defined(__APPLE__) if (!real_fopen) real_fopen = (PFN_FOPEN)dlsym(RTLD_NEXT, "fopen"); - +#endif fs::path path{in_filename}; if (!path.has_parent_path()) { return real_fopen(in_filename, mode); @@ -189,8 +239,8 @@ FRAMEWORK_EXPORT FILE* FOPEN_FUNC_NAME(const char* in_filename, const char* mode FILE* f_ptr; if (platform_shim.is_fake_path(path.parent_path())) { - auto fake_path = platform_shim.get_fake_path(path.parent_path()) / path.filename(); - f_ptr = real_fopen(fake_path.c_str(), mode); + auto real_path = platform_shim.get_real_path_from_fake_path(path.parent_path()) / path.filename(); + f_ptr = real_fopen(real_path.c_str(), mode); } else { f_ptr = real_fopen(in_filename, mode); } @@ -198,9 +248,21 @@ FRAMEWORK_EXPORT FILE* FOPEN_FUNC_NAME(const char* in_filename, const char* mode return f_ptr; } +FRAMEWORK_EXPORT void* DLOPEN_FUNC_NAME(const char* in_filename, int flags) { +#if !defined(__APPLE__) + if (!real_dlopen) real_dlopen = (PFN_DLOPEN)dlsym(RTLD_NEXT, "dlopen"); +#endif + + if (platform_shim.is_dlopen_redirect_name(in_filename)) { + return real_dlopen(platform_shim.dlopen_redirection_map[in_filename].c_str(), flags); + } + return real_dlopen(in_filename, flags); +} + FRAMEWORK_EXPORT uid_t GETEUID_FUNC_NAME(void) { +#if !defined(__APPLE__) if (!real_geteuid) real_geteuid = (PFN_GETEUID)dlsym(RTLD_NEXT, "geteuid"); - +#endif if (platform_shim.use_fake_elevation) { // Root on linux is 0, so force pretending like we're root return 0; @@ -210,8 +272,9 @@ FRAMEWORK_EXPORT uid_t GETEUID_FUNC_NAME(void) { } FRAMEWORK_EXPORT gid_t GETEGID_FUNC_NAME(void) { +#if !defined(__APPLE__) if (!real_getegid) real_getegid = (PFN_GETEGID)dlsym(RTLD_NEXT, "getegid"); - +#endif if (platform_shim.use_fake_elevation) { // Root on linux is 0, so force pretending like we're root return 0; @@ -220,10 +283,12 @@ FRAMEWORK_EXPORT gid_t GETEGID_FUNC_NAME(void) { } } +#if !defined(TARGET_OS_IPHONE) #if defined(HAVE_SECURE_GETENV) FRAMEWORK_EXPORT char* SECURE_GETENV_FUNC_NAME(const char* name) { +#if !defined(__APPLE__) if (!real_secure_getenv) real_secure_getenv = (PFN_SEC_GETENV)dlsym(RTLD_NEXT, "secure_getenv"); - +#endif if (platform_shim.use_fake_elevation) { return NULL; } else { @@ -233,7 +298,9 @@ FRAMEWORK_EXPORT char* SECURE_GETENV_FUNC_NAME(const char* name) { #endif #if defined(HAVE___SECURE_GETENV) FRAMEWORK_EXPORT char* __SECURE_GETENV_FUNC_NAME(const char* name) { +#if !defined(__APPLE__) if (!real__secure_getenv) real__secure_getenv = (PFN_SEC_GETENV)dlsym(RTLD_NEXT, "__secure_getenv"); +#endif if (platform_shim.use_fake_elevation) { return NULL; @@ -242,6 +309,30 @@ FRAMEWORK_EXPORT char* __SECURE_GETENV_FUNC_NAME(const char* name) { } } #endif +#endif +#if defined(__APPLE__) +FRAMEWORK_EXPORT CFBundleRef my_CFBundleGetMainBundle() { + static CFBundleRef global_bundle{}; + return reinterpret_cast(&global_bundle); +} +FRAMEWORK_EXPORT CFURLRef my_CFBundleCopyResourcesDirectoryURL([[maybe_unused]] CFBundleRef bundle) { + static CFURLRef global_url{}; + return reinterpret_cast(&global_url); +} +FRAMEWORK_EXPORT Boolean my_CFURLGetFileSystemRepresentation([[maybe_unused]] CFURLRef url, + [[maybe_unused]] Boolean resolveAgainstBase, UInt8* buffer, + CFIndex maxBufLen) { + if (!platform_shim.bundle_contents.empty()) { + CFIndex copy_len = (CFIndex)platform_shim.bundle_contents.size(); + if (copy_len > maxBufLen) { + copy_len = maxBufLen; + } + strncpy(reinterpret_cast(buffer), platform_shim.bundle_contents.c_str(), copy_len); + return TRUE; + } + return FALSE; +} +#endif /* Shiming functions on apple is limited by the linker prefering to not use functions in the * executable in loaded dylibs. By adding an interposer, we redirect the linker to use our @@ -262,8 +353,10 @@ __attribute__((used)) static Interposer _interpose_opendir MACOS_ATTRIB = {VOIDP __attribute__((used)) static Interposer _interpose_closedir MACOS_ATTRIB = {VOIDP_CAST(my_closedir), VOIDP_CAST(closedir)}; __attribute__((used)) static Interposer _interpose_access MACOS_ATTRIB = {VOIDP_CAST(my_access), VOIDP_CAST(access)}; __attribute__((used)) static Interposer _interpose_fopen MACOS_ATTRIB = {VOIDP_CAST(my_fopen), VOIDP_CAST(fopen)}; +__attribute__((used)) static Interposer _interpose_dlopen MACOS_ATTRIB = {VOIDP_CAST(my_dlopen), VOIDP_CAST(dlopen)}; __attribute__((used)) static Interposer _interpose_euid MACOS_ATTRIB = {VOIDP_CAST(my_geteuid), VOIDP_CAST(geteuid)}; __attribute__((used)) static Interposer _interpose_egid MACOS_ATTRIB = {VOIDP_CAST(my_getegid), VOIDP_CAST(getegid)}; +#if !defined(TARGET_OS_IPHONE) #if defined(HAVE_SECURE_GETENV) __attribute__((used)) static Interposer _interpose_secure_getenv MACOS_ATTRIB = {VOIDP_CAST(my_secure_getenv), VOIDP_CAST(secure_getenv)}; @@ -272,5 +365,13 @@ __attribute__((used)) static Interposer _interpose_secure_getenv MACOS_ATTRIB = __attribute__((used)) static Interposer _interpose__secure_getenv MACOS_ATTRIB = {VOIDP_CAST(my__secure_getenv), VOIDP_CAST(__secure_getenv)}; #endif +#endif +__attribute__((used)) static Interposer _interpose_CFBundleGetMainBundle MACOS_ATTRIB = {VOIDP_CAST(my_CFBundleGetMainBundle), + VOIDP_CAST(CFBundleGetMainBundle)}; +__attribute__((used)) static Interposer _interpose_CFBundleCopyResourcesDirectoryURL MACOS_ATTRIB = { + VOIDP_CAST(my_CFBundleCopyResourcesDirectoryURL), VOIDP_CAST(CFBundleCopyResourcesDirectoryURL)}; +__attribute__((used)) static Interposer _interpose_CFURLGetFileSystemRepresentation MACOS_ATTRIB = { + VOIDP_CAST(my_CFURLGetFileSystemRepresentation), VOIDP_CAST(CFURLGetFileSystemRepresentation)}; + #endif } // extern "C" diff --git a/tests/framework/shim/windows_shim.cpp b/tests/framework/shim/windows_shim.cpp index c847234af7d907ee396e1bb8ce58302b4085c73c..8a896c1eeb4d13a8fc3a61b86c41529453278ef5 100644 --- a/tests/framework/shim/windows_shim.cpp +++ b/tests/framework/shim/windows_shim.cpp @@ -26,7 +26,7 @@ */ // This needs to be defined first, or else we'll get redefinitions on NTSTATUS values -#ifdef _WIN32 +#if defined(_WIN32) #define UMDF_USING_NTSTATUS #include #endif @@ -44,7 +44,7 @@ static LibraryWrapper gdi32_dll; using PFN_GetSidSubAuthority = PDWORD(__stdcall *)(PSID pSid, DWORD nSubAuthority); static PFN_GetSidSubAuthority fpGetSidSubAuthority = GetSidSubAuthority; -PDWORD __stdcall ShimGetSidSubAuthority(PSID pSid, DWORD nSubAuthority) { return &platform_shim.elevation_level; } +PDWORD __stdcall ShimGetSidSubAuthority(PSID, DWORD) { return &platform_shim.elevation_level; } static PFN_LoaderEnumAdapters2 fpEnumAdapters2 = nullptr; static PFN_LoaderQueryAdapterInfo fpQueryAdapterInfo = nullptr; @@ -82,11 +82,11 @@ NTSTATUS APIENTRY ShimQueryAdapterInfo(const LoaderQueryAdapterInfo *query_info) auto *reg_info = reinterpret_cast(query_info->private_data); std::vector *paths = nullptr; - if (reg_info->value_name[6] == L'D') { // looking for drivers + if (wcsstr(reg_info->value_name, L"DriverName") != nullptr) { // looking for drivers paths = &adapter.driver_paths; - } else if (reg_info->value_name[6] == L'I') { // looking for implicit layers + } else if (wcsstr(reg_info->value_name, L"ImplicitLayers") != nullptr) { // looking for implicit layers paths = &adapter.implicit_layer_paths; - } else if (reg_info->value_name[6] == L'E') { // looking for explicit layers + } else if (wcsstr(reg_info->value_name, L"ExplicitLayers") != nullptr) { // looking for explicit layers paths = &adapter.explicit_layer_paths; } @@ -128,14 +128,16 @@ static CONFIGRET(WINAPI *REAL_CM_Get_DevNode_Registry_PropertyW)(DEVINST dnDevIn static CONFIGRET(WINAPI *REAL_CM_Get_Sibling)(PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags) = CM_Get_Sibling; // clang-format on -CONFIGRET WINAPI SHIM_CM_Get_Device_ID_List_SizeW(PULONG pulLen, PCWSTR pszFilter, ULONG ulFlags) { +CONFIGRET WINAPI SHIM_CM_Get_Device_ID_List_SizeW(PULONG pulLen, [[maybe_unused]] PCWSTR pszFilter, + [[maybe_unused]] ULONG ulFlags) { if (pulLen == nullptr) { return CR_INVALID_POINTER; } *pulLen = static_cast(platform_shim.CM_device_ID_list.size()); return CR_SUCCESS; } -CONFIGRET WINAPI SHIM_CM_Get_Device_ID_ListW(PCWSTR pszFilter, PZZWSTR Buffer, ULONG BufferLen, ULONG ulFlags) { +CONFIGRET WINAPI SHIM_CM_Get_Device_ID_ListW([[maybe_unused]] PCWSTR pszFilter, PZZWSTR Buffer, ULONG BufferLen, + [[maybe_unused]] ULONG ulFlags) { if (Buffer != NULL) { if (BufferLen < platform_shim.CM_device_ID_list.size()) return CR_BUFFER_SMALL; for (size_t i = 0; i < BufferLen; i++) { @@ -145,22 +147,17 @@ CONFIGRET WINAPI SHIM_CM_Get_Device_ID_ListW(PCWSTR pszFilter, PZZWSTR Buffer, U return CR_SUCCESS; } // TODO -CONFIGRET WINAPI SHIM_CM_Locate_DevNodeW(PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags) { return CR_FAILURE; } +CONFIGRET WINAPI SHIM_CM_Locate_DevNodeW(PDEVINST, DEVINSTID_W, ULONG) { return CR_FAILURE; } // TODO -CONFIGRET WINAPI SHIM_CM_Get_DevNode_Status(PULONG pulStatus, PULONG pulProblemNumber, DEVINST dnDevInst, ULONG ulFlags) { - return CR_FAILURE; -} +CONFIGRET WINAPI SHIM_CM_Get_DevNode_Status(PULONG, PULONG, DEVINST, ULONG) { return CR_FAILURE; } // TODO -CONFIGRET WINAPI SHIM_CM_Get_Device_IDW(DEVINST dnDevInst, PWSTR Buffer, ULONG BufferLen, ULONG ulFlags) { return CR_FAILURE; } +CONFIGRET WINAPI SHIM_CM_Get_Device_IDW(DEVINST, PWSTR, ULONG, ULONG) { return CR_FAILURE; } // TODO -CONFIGRET WINAPI SHIM_CM_Get_Child(PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags) { return CR_FAILURE; } +CONFIGRET WINAPI SHIM_CM_Get_Child(PDEVINST, DEVINST, ULONG) { return CR_FAILURE; } // TODO -CONFIGRET WINAPI SHIM_CM_Get_DevNode_Registry_PropertyW(DEVINST dnDevInst, ULONG ulProperty, PULONG pulRegDataType, PVOID Buffer, - PULONG pulLength, ULONG ulFlags) { - return CR_FAILURE; -} +CONFIGRET WINAPI SHIM_CM_Get_DevNode_Registry_PropertyW(DEVINST, ULONG, PULONG, PVOID, PULONG, ULONG) { return CR_FAILURE; } // TODO -CONFIGRET WINAPI SHIM_CM_Get_Sibling(PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags) { return CR_FAILURE; } +CONFIGRET WINAPI SHIM_CM_Get_Sibling(PDEVINST, DEVINST, ULONG) { return CR_FAILURE; } static LibraryWrapper dxgi_module; typedef HRESULT(APIENTRY *PFN_CreateDXGIFactory1)(REFIID riid, void **ppFactory); @@ -171,52 +168,27 @@ HRESULT __stdcall ShimGetDesc1(IDXGIAdapter1 *pAdapter, /* [annotation][out] */ _Out_ DXGI_ADAPTER_DESC1 *pDesc) { if (pAdapter == nullptr || pDesc == nullptr) return DXGI_ERROR_INVALID_CALL; - auto it = platform_shim.dxgi_adapter_map.find(pAdapter); - if (it == platform_shim.dxgi_adapter_map.end()) { - return DXGI_ERROR_INVALID_CALL; - } - *pDesc = platform_shim.dxgi_adapters[it->second].desc1; - return S_OK; -} -ULONG __stdcall ShimIDXGIFactory1Release(IDXGIFactory1 *factory) { - if (factory != nullptr) { - if (factory->lpVtbl != nullptr) { - delete factory->lpVtbl; - } - delete factory; - } - return S_OK; -} -ULONG __stdcall ShimIDXGIFactory6Release(IDXGIFactory6 *factory) { - if (factory != nullptr) { - if (factory->lpVtbl != nullptr) { - delete factory->lpVtbl; - } - delete factory; - } - return S_OK; -} -ULONG __stdcall ShimRelease(IDXGIAdapter1 *pAdapter) { - if (pAdapter != nullptr) { - if (pAdapter->lpVtbl != nullptr) { - delete pAdapter->lpVtbl; + for (const auto &[index, adapter] : platform_shim.dxgi_adapters) { + if (&adapter.adapter_instance == pAdapter) { + *pDesc = adapter.desc1; + return S_OK; } - delete pAdapter; } - return S_OK; + return DXGI_ERROR_INVALID_CALL; } - -IDXGIAdapter1 *create_IDXGIAdapter1() { - IDXGIAdapter1Vtbl *vtbl = new IDXGIAdapter1Vtbl(); - vtbl->GetDesc1 = ShimGetDesc1; - vtbl->Release = ShimRelease; - IDXGIAdapter1 *adapter = new IDXGIAdapter1(); - adapter->lpVtbl = vtbl; - return adapter; +ULONG __stdcall ShimIDXGIFactory1Release(IDXGIFactory1 *) { return S_OK; } +ULONG __stdcall ShimIDXGIFactory6Release(IDXGIFactory6 *) { return S_OK; } +ULONG __stdcall ShimRelease(IDXGIAdapter1 *) { return S_OK; } + +IDXGIAdapter1 *setup_and_get_IDXGIAdapter1(DXGIAdapter &adapter) { + adapter.adapter_vtbl_instance.GetDesc1 = ShimGetDesc1; + adapter.adapter_vtbl_instance.Release = ShimRelease; + adapter.adapter_instance.lpVtbl = &adapter.adapter_vtbl_instance; + return &adapter.adapter_instance; } -HRESULT __stdcall ShimEnumAdapters1_1(IDXGIFactory1 *This, +HRESULT __stdcall ShimEnumAdapters1_1([[maybe_unused]] IDXGIFactory1 *This, /* [in] */ UINT Adapter, /* [annotation][out] */ _COM_Outptr_ IDXGIAdapter1 **ppAdapter) { @@ -224,14 +196,12 @@ HRESULT __stdcall ShimEnumAdapters1_1(IDXGIFactory1 *This, return DXGI_ERROR_INVALID_CALL; } if (ppAdapter != nullptr) { - auto *pAdapter = create_IDXGIAdapter1(); - *ppAdapter = pAdapter; - platform_shim.dxgi_adapter_map[pAdapter] = Adapter; + *ppAdapter = setup_and_get_IDXGIAdapter1(platform_shim.dxgi_adapters.at(Adapter)); } return S_OK; } -HRESULT __stdcall ShimEnumAdapters1_6(IDXGIFactory6 *This, +HRESULT __stdcall ShimEnumAdapters1_6([[maybe_unused]] IDXGIFactory6 *This, /* [in] */ UINT Adapter, /* [annotation][out] */ _COM_Outptr_ IDXGIAdapter1 **ppAdapter) { @@ -239,15 +209,14 @@ HRESULT __stdcall ShimEnumAdapters1_6(IDXGIFactory6 *This, return DXGI_ERROR_INVALID_CALL; } if (ppAdapter != nullptr) { - auto *pAdapter = create_IDXGIAdapter1(); - *ppAdapter = pAdapter; - platform_shim.dxgi_adapter_map[pAdapter] = Adapter; + *ppAdapter = setup_and_get_IDXGIAdapter1(platform_shim.dxgi_adapters.at(Adapter)); } return S_OK; } -HRESULT __stdcall ShimEnumAdapterByGpuPreference(IDXGIFactory6 *This, _In_ UINT Adapter, _In_ DXGI_GPU_PREFERENCE GpuPreference, - _In_ REFIID riid, _COM_Outptr_ void **ppvAdapter) { +HRESULT __stdcall ShimEnumAdapterByGpuPreference([[maybe_unused]] IDXGIFactory6 *This, _In_ UINT Adapter, + [[maybe_unused]] _In_ DXGI_GPU_PREFERENCE GpuPreference, + [[maybe_unused]] _In_ REFIID riid, _COM_Outptr_ void **ppvAdapter) { if (Adapter >= platform_shim.dxgi_adapters.size()) { return DXGI_ERROR_NOT_FOUND; } @@ -256,40 +225,38 @@ HRESULT __stdcall ShimEnumAdapterByGpuPreference(IDXGIFactory6 *This, _In_ UINT assert(GpuPreference == DXGI_GPU_PREFERENCE::DXGI_GPU_PREFERENCE_UNSPECIFIED && "Test shim assumes the GpuPreference is unspecified."); if (ppvAdapter != nullptr) { - auto *pAdapter = create_IDXGIAdapter1(); - *ppvAdapter = pAdapter; - platform_shim.dxgi_adapter_map[pAdapter] = Adapter; + *ppvAdapter = setup_and_get_IDXGIAdapter1(platform_shim.dxgi_adapters.at(Adapter)); } return S_OK; } -IDXGIFactory1 *create_IDXGIFactory1() { - IDXGIFactory1Vtbl *vtbl = new IDXGIFactory1Vtbl(); - vtbl->EnumAdapters1 = ShimEnumAdapters1_1; - vtbl->Release = ShimIDXGIFactory1Release; - IDXGIFactory1 *factory = new IDXGIFactory1(); - factory->lpVtbl = vtbl; - return factory; +static IDXGIFactory1 *get_IDXGIFactory1() { + static IDXGIFactory1Vtbl vtbl{}; + vtbl.EnumAdapters1 = ShimEnumAdapters1_1; + vtbl.Release = ShimIDXGIFactory1Release; + static IDXGIFactory1 factory{}; + factory.lpVtbl = &vtbl; + return &factory; } -IDXGIFactory6 *create_IDXGIFactory6() { - IDXGIFactory6Vtbl *vtbl = new IDXGIFactory6Vtbl(); - vtbl->EnumAdapters1 = ShimEnumAdapters1_6; - vtbl->EnumAdapterByGpuPreference = ShimEnumAdapterByGpuPreference; - vtbl->Release = ShimIDXGIFactory6Release; - IDXGIFactory6 *factory = new IDXGIFactory6(); - factory->lpVtbl = vtbl; - return factory; +static IDXGIFactory6 *get_IDXGIFactory6() { + static IDXGIFactory6Vtbl vtbl{}; + vtbl.EnumAdapters1 = ShimEnumAdapters1_6; + vtbl.EnumAdapterByGpuPreference = ShimEnumAdapterByGpuPreference; + vtbl.Release = ShimIDXGIFactory6Release; + static IDXGIFactory6 factory{}; + factory.lpVtbl = &vtbl; + return &factory; } HRESULT __stdcall ShimCreateDXGIFactory1(REFIID riid, void **ppFactory) { if (riid == IID_IDXGIFactory1) { - auto *factory = create_IDXGIFactory1(); + auto *factory = get_IDXGIFactory1(); *ppFactory = factory; return S_OK; } if (riid == IID_IDXGIFactory6) { - auto *factory = create_IDXGIFactory6(); + auto *factory = get_IDXGIFactory6(); *ppFactory = factory; return S_OK; } @@ -310,13 +277,15 @@ static PFN_RegEnumValueA fpRegEnumValueA = RegEnumValueA; using PFN_RegCloseKey = LSTATUS(__stdcall *)(HKEY hKey); static PFN_RegCloseKey fpRegCloseKey = RegCloseKey; -LSTATUS __stdcall ShimRegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult) { +LSTATUS __stdcall ShimRegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, [[maybe_unused]] DWORD ulOptions, + [[maybe_unused]] REGSAM samDesired, PHKEY phkResult) { if (HKEY_LOCAL_MACHINE != hKey && HKEY_CURRENT_USER != hKey) return ERROR_BADKEY; std::string hive = ""; if (HKEY_LOCAL_MACHINE == hKey) hive = "HKEY_LOCAL_MACHINE"; else if (HKEY_CURRENT_USER == hKey) hive = "HKEY_CURRENT_USER"; + if (hive == "") return ERROR_ACCESS_DENIED; platform_shim.created_keys.emplace_back(platform_shim.created_key_count++, hive + "\\" + lpSubKey); *phkResult = platform_shim.created_keys.back().get(); @@ -331,24 +300,22 @@ const std::string *get_path_of_created_key(HKEY hKey) { return nullptr; } std::vector *get_registry_vector(std::string const &path) { - if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\Drivers") return &platform_shim.hkey_local_machine_drivers; - if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers") - return &platform_shim.hkey_local_machine_explicit_layers; - if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers") - return &platform_shim.hkey_local_machine_implicit_layers; - if (path == "HKEY_CURRENT_USER\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers") - return &platform_shim.hkey_current_user_explicit_layers; - if (path == "HKEY_CURRENT_USER\\SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers") - return &platform_shim.hkey_current_user_implicit_layers; + if (path == "HKEY_LOCAL_MACHINE\\" VK_DRIVERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_drivers; + if (path == "HKEY_LOCAL_MACHINE\\" VK_ELAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_explicit_layers; + if (path == "HKEY_LOCAL_MACHINE\\" VK_ILAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_implicit_layers; + if (path == "HKEY_CURRENT_USER\\" VK_ELAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_current_user_explicit_layers; + if (path == "HKEY_CURRENT_USER\\" VK_ILAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_current_user_implicit_layers; + if (path == "HKEY_LOCAL_MACHINE\\" VK_SETTINGS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_settings; + if (path == "HKEY_CURRENT_USER\\" VK_SETTINGS_INFO_REGISTRY_LOC) return &platform_shim.hkey_current_user_settings; return nullptr; } -LSTATUS __stdcall ShimRegQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, - LPDWORD lpcbData) { +LSTATUS __stdcall ShimRegQueryValueExA(HKEY, LPCSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD) { // TODO: return ERROR_SUCCESS; } -LSTATUS __stdcall ShimRegEnumValueA(HKEY hKey, DWORD dwIndex, LPSTR lpValueName, LPDWORD lpcchValueName, LPDWORD lpReserved, - LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData) { +LSTATUS __stdcall ShimRegEnumValueA(HKEY hKey, DWORD dwIndex, LPSTR lpValueName, LPDWORD lpcchValueName, + [[maybe_unused]] LPDWORD lpReserved, [[maybe_unused]] LPDWORD lpType, LPBYTE lpData, + LPDWORD lpcbData) { const std::string *path = get_path_of_created_key(hKey); if (path == nullptr) return ERROR_NO_MORE_ITEMS; @@ -399,7 +366,12 @@ LONG WINAPI ShimGetPackagesByPackageFamily(_In_ PCWSTR packageFamilyName, _Inout *bufferLength = ARRAYSIZE(package_full_name); if (too_small) return ERROR_INSUFFICIENT_BUFFER; - wcscpy(buffer, package_full_name); + for (size_t i = 0; i < sizeof(package_full_name) / sizeof(wchar_t); i++) { + if (i >= *bufferLength) { + break; + } + buffer[i] = package_full_name[i]; + } *packageFullNames = buffer; return 0; } @@ -420,7 +392,12 @@ LONG WINAPI ShimGetPackagePathByFullName(_In_ PCWSTR packageFullName, _Inout_ UI *pathLength = static_cast(platform_shim.app_package_path.size() + 1); return ERROR_INSUFFICIENT_BUFFER; } - wcscpy(path, platform_shim.app_package_path.c_str()); + for (size_t i = 0; i < platform_shim.app_package_path.length(); i++) { + if (i >= *pathLength) { + break; + } + path[i] = platform_shim.app_package_path.c_str()[i]; + } return 0; } @@ -505,7 +482,7 @@ void DetachFunctions() { DetourTransactionCommit(); } -BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved) { +BOOL WINAPI DllMain([[maybe_unused]] HINSTANCE hinst, DWORD dwReason, [[maybe_unused]] LPVOID reserved) { if (DetourIsHelperProcess()) { return TRUE; } diff --git a/tests/framework/test_environment.cpp b/tests/framework/test_environment.cpp index 8431b2473674aa43c6e49d3480ca531bcfc9c724..1105f84b200dd94206b0739c3ee9e2b8bbb9a5df 100644 --- a/tests/framework/test_environment.cpp +++ b/tests/framework/test_environment.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 The Khronos Group Inc. - * Copyright (c) 2021 Valve Corporation - * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * 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,6 +27,144 @@ #include "test_environment.h" +fs::path get_loader_path() { + auto loader_path = fs::path(FRAMEWORK_VULKAN_LIBRARY_PATH); + auto env_var_res = get_env_var("VK_LOADER_TEST_LOADER_PATH", false); + if (!env_var_res.empty()) { + loader_path = fs::path(env_var_res); + } + return loader_path; +} + +void init_vulkan_functions(VulkanFunctions& funcs) { +#if defined(APPLE_STATIC_LOADER) +#define GPA(name) name +#else +#define GPA(name) funcs.loader.get_symbol(#name) +#endif + + // clang-format off + funcs.vkGetInstanceProcAddr = GPA(vkGetInstanceProcAddr); + funcs.vkEnumerateInstanceExtensionProperties = GPA(vkEnumerateInstanceExtensionProperties); + funcs.vkEnumerateInstanceLayerProperties = GPA(vkEnumerateInstanceLayerProperties); + funcs.vkEnumerateInstanceVersion = GPA(vkEnumerateInstanceVersion); + funcs.vkCreateInstance = GPA(vkCreateInstance); + funcs.vkDestroyInstance = GPA(vkDestroyInstance); + funcs.vkEnumeratePhysicalDevices = GPA(vkEnumeratePhysicalDevices); + funcs.vkEnumeratePhysicalDeviceGroups = GPA(vkEnumeratePhysicalDeviceGroups); + funcs.vkGetPhysicalDeviceFeatures = GPA(vkGetPhysicalDeviceFeatures); + funcs.vkGetPhysicalDeviceFeatures2 = GPA(vkGetPhysicalDeviceFeatures2); + funcs.vkGetPhysicalDeviceFormatProperties = GPA(vkGetPhysicalDeviceFormatProperties); + funcs.vkGetPhysicalDeviceFormatProperties2 = GPA(vkGetPhysicalDeviceFormatProperties2); + funcs.vkGetPhysicalDeviceImageFormatProperties = GPA(vkGetPhysicalDeviceImageFormatProperties); + funcs.vkGetPhysicalDeviceImageFormatProperties2 = GPA(vkGetPhysicalDeviceImageFormatProperties2); + funcs.vkGetPhysicalDeviceSparseImageFormatProperties = GPA(vkGetPhysicalDeviceSparseImageFormatProperties); + funcs.vkGetPhysicalDeviceSparseImageFormatProperties2 = GPA(vkGetPhysicalDeviceSparseImageFormatProperties2); + funcs.vkGetPhysicalDeviceProperties = GPA(vkGetPhysicalDeviceProperties); + funcs.vkGetPhysicalDeviceProperties2 = GPA(vkGetPhysicalDeviceProperties2); + funcs.vkGetPhysicalDeviceQueueFamilyProperties = GPA(vkGetPhysicalDeviceQueueFamilyProperties); + funcs.vkGetPhysicalDeviceQueueFamilyProperties2 = GPA(vkGetPhysicalDeviceQueueFamilyProperties2); + funcs.vkGetPhysicalDeviceMemoryProperties = GPA(vkGetPhysicalDeviceMemoryProperties); + funcs.vkGetPhysicalDeviceMemoryProperties2 = GPA(vkGetPhysicalDeviceMemoryProperties2); + funcs.vkGetPhysicalDeviceSurfaceSupportKHR = GPA(vkGetPhysicalDeviceSurfaceSupportKHR); + funcs.vkGetPhysicalDeviceSurfaceFormatsKHR = GPA(vkGetPhysicalDeviceSurfaceFormatsKHR); + funcs.vkGetPhysicalDeviceSurfacePresentModesKHR = GPA(vkGetPhysicalDeviceSurfacePresentModesKHR); + funcs.vkGetPhysicalDeviceSurfaceCapabilitiesKHR = GPA(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); + funcs.vkEnumerateDeviceExtensionProperties = GPA(vkEnumerateDeviceExtensionProperties); + funcs.vkEnumerateDeviceLayerProperties = GPA(vkEnumerateDeviceLayerProperties); + funcs.vkGetPhysicalDeviceExternalBufferProperties = GPA(vkGetPhysicalDeviceExternalBufferProperties); + funcs.vkGetPhysicalDeviceExternalFenceProperties = GPA(vkGetPhysicalDeviceExternalFenceProperties); + funcs.vkGetPhysicalDeviceExternalSemaphoreProperties = GPA(vkGetPhysicalDeviceExternalSemaphoreProperties); + + funcs.vkDestroySurfaceKHR = GPA(vkDestroySurfaceKHR); + funcs.vkGetDeviceProcAddr = GPA(vkGetDeviceProcAddr); + funcs.vkCreateDevice = GPA(vkCreateDevice); + + funcs.vkCreateHeadlessSurfaceEXT = GPA(vkCreateHeadlessSurfaceEXT); + funcs.vkCreateDisplayPlaneSurfaceKHR = GPA(vkCreateDisplayPlaneSurfaceKHR); + funcs.vkGetPhysicalDeviceDisplayPropertiesKHR = GPA(vkGetPhysicalDeviceDisplayPropertiesKHR); + funcs.vkGetPhysicalDeviceDisplayPlanePropertiesKHR = GPA(vkGetPhysicalDeviceDisplayPlanePropertiesKHR); + funcs.vkGetDisplayPlaneSupportedDisplaysKHR = GPA(vkGetDisplayPlaneSupportedDisplaysKHR); + funcs.vkGetDisplayModePropertiesKHR = GPA(vkGetDisplayModePropertiesKHR); + funcs.vkCreateDisplayModeKHR = GPA(vkCreateDisplayModeKHR); + funcs.vkGetDisplayPlaneCapabilitiesKHR = GPA(vkGetDisplayPlaneCapabilitiesKHR); + funcs.vkGetPhysicalDevicePresentRectanglesKHR = GPA(vkGetPhysicalDevicePresentRectanglesKHR); + funcs.vkGetPhysicalDeviceDisplayProperties2KHR = GPA(vkGetPhysicalDeviceDisplayProperties2KHR); + funcs.vkGetPhysicalDeviceDisplayPlaneProperties2KHR = GPA(vkGetPhysicalDeviceDisplayPlaneProperties2KHR); + funcs.vkGetDisplayModeProperties2KHR = GPA(vkGetDisplayModeProperties2KHR); + funcs.vkGetDisplayPlaneCapabilities2KHR = GPA(vkGetDisplayPlaneCapabilities2KHR); + funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR = GPA(vkGetPhysicalDeviceSurfaceCapabilities2KHR); + funcs.vkGetPhysicalDeviceSurfaceFormats2KHR = GPA(vkGetPhysicalDeviceSurfaceFormats2KHR); + +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + funcs.vkCreateAndroidSurfaceKHR = GPA(vkCreateAndroidSurfaceKHR); +#endif // VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + funcs.vkCreateDirectFBSurfaceEXT = GPA(vkCreateDirectFBSurfaceEXT); + funcs.vkGetPhysicalDeviceDirectFBPresentationSupportEXT = GPA(vkGetPhysicalDeviceDirectFBPresentationSupportEXT); +#endif // VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_FUCHSIA) + funcs.vkCreateImagePipeSurfaceFUCHSIA = GPA(vkCreateImagePipeSurfaceFUCHSIA); +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_GGP) + funcs.vkCreateStreamDescriptorSurfaceGGP = GPA(vkCreateStreamDescriptorSurfaceGGP); +#endif // VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_IOS_MVK) + funcs.vkCreateIOSSurfaceMVK = GPA(vkCreateIOSSurfaceMVK); +#endif // VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) + funcs.vkCreateMacOSSurfaceMVK = GPA(vkCreateMacOSSurfaceMVK); +#endif // VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_METAL_EXT) + funcs.vkCreateMetalSurfaceEXT = GPA(vkCreateMetalSurfaceEXT); +#endif // VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + funcs.vkCreateScreenSurfaceQNX = GPA(vkCreateScreenSurfaceQNX); + funcs.vkGetPhysicalDeviceScreenPresentationSupportQNX = GPA(vkGetPhysicalDeviceScreenPresentationSupportQNX); +#endif // VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + funcs.vkCreateWaylandSurfaceKHR = GPA(vkCreateWaylandSurfaceKHR); + funcs.vkGetPhysicalDeviceWaylandPresentationSupportKHR = GPA(vkGetPhysicalDeviceWaylandPresentationSupportKHR); +#endif // VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) + funcs.vkCreateXcbSurfaceKHR = GPA(vkCreateXcbSurfaceKHR); + funcs.vkGetPhysicalDeviceXcbPresentationSupportKHR = GPA(vkGetPhysicalDeviceXcbPresentationSupportKHR); +#endif // VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) + funcs.vkCreateXlibSurfaceKHR = GPA(vkCreateXlibSurfaceKHR); + funcs.vkGetPhysicalDeviceXlibPresentationSupportKHR = GPA(vkGetPhysicalDeviceXlibPresentationSupportKHR); +#endif // VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + funcs.vkCreateWin32SurfaceKHR = GPA(vkCreateWin32SurfaceKHR); + funcs.vkGetPhysicalDeviceWin32PresentationSupportKHR = GPA(vkGetPhysicalDeviceWin32PresentationSupportKHR); +#endif // VK_USE_PLATFORM_WIN32_KHR + + funcs.vkDestroyDevice = GPA(vkDestroyDevice); + funcs.vkGetDeviceQueue = GPA(vkGetDeviceQueue); +#undef GPA + // clang-format on +} + +#if defined(APPLE_STATIC_LOADER) +VulkanFunctions::VulkanFunctions() { +#else +VulkanFunctions::VulkanFunctions() : loader(get_loader_path()) { +#endif + init_vulkan_functions(*this); +} + +DeviceFunctions::DeviceFunctions(const VulkanFunctions& vulkan_functions, VkDevice device) { + vkGetDeviceProcAddr = vulkan_functions.vkGetDeviceProcAddr; + vkDestroyDevice = load(device, "vkDestroyDevice"); + vkGetDeviceQueue = load(device, "vkGetDeviceQueue"); + vkCreateCommandPool = load(device, "vkCreateCommandPool"); + vkAllocateCommandBuffers = load(device, "vkAllocateCommandBuffers"); + vkDestroyCommandPool = load(device, "vkDestroyCommandPool"); + vkCreateSwapchainKHR = load(device, "vkCreateSwapchainKHR"); + vkGetSwapchainImagesKHR = load(device, "vkGetSwapchainImagesKHR"); + vkDestroySwapchainKHR = load(device, "vkDestroySwapchainKHR"); +} + InstWrapper::InstWrapper(VulkanFunctions& functions, VkAllocationCallbacks* callbacks) noexcept : functions(&functions), callbacks(callbacks) {} InstWrapper::InstWrapper(VulkanFunctions& functions, VkInstance inst, VkAllocationCallbacks* callbacks) noexcept @@ -56,6 +194,10 @@ void InstWrapper::CheckCreate(VkResult result_to_check) { ASSERT_EQ(result_to_check, functions->vkCreateInstance(create_info.get(), callbacks, &inst)); } +void InstWrapper::CheckCreateWithInfo(InstanceCreateInfo& create_info, VkResult result_to_check) { + ASSERT_EQ(result_to_check, functions->vkCreateInstance(create_info.get(), callbacks, &inst)); +} + std::vector InstWrapper::GetPhysDevs(uint32_t phys_dev_count, VkResult result_to_check) { uint32_t physical_count = phys_dev_count; std::vector physical_devices; @@ -68,6 +210,7 @@ std::vector InstWrapper::GetPhysDevs(uint32_t phys_dev_count, std::vector InstWrapper::GetPhysDevs(VkResult result_to_check) { uint32_t physical_count = 0; VkResult res = functions->vkEnumeratePhysicalDevices(inst, &physical_count, nullptr); + EXPECT_EQ(result_to_check, res); std::vector physical_devices; physical_devices.resize(physical_count); res = functions->vkEnumeratePhysicalDevices(inst, &physical_count, physical_devices.data()); @@ -83,15 +226,41 @@ VkPhysicalDevice InstWrapper::GetPhysDev(VkResult result_to_check) { return physical_device; } -std::vector EnumerateDeviceExtensions(InstWrapper const& inst, VkPhysicalDevice physical_device) { - uint32_t ext_count = 1; - VkResult res = inst.functions->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &ext_count, nullptr); +std::vector InstWrapper::GetActiveLayers(VkPhysicalDevice phys_dev, uint32_t expected_count) { + uint32_t count = 0; + VkResult res = functions->vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); + std::vector layer_props{count}; + res = functions->vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); + return layer_props; +} + +std::vector InstWrapper::EnumerateDeviceExtensions(VkPhysicalDevice physical_device, + uint32_t expected_count) { + uint32_t count = 0; + VkResult res = functions->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &count, nullptr); EXPECT_EQ(VK_SUCCESS, res); - std::vector extensions; - extensions.resize(ext_count); - res = inst.functions->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &ext_count, extensions.data()); + EXPECT_EQ(count, expected_count); + std::vector extensions{count}; + res = functions->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &count, extensions.data()); EXPECT_EQ(VK_SUCCESS, res); - extensions.resize(ext_count); + EXPECT_EQ(count, expected_count); + return extensions; +} + +std::vector InstWrapper::EnumerateLayerDeviceExtensions(VkPhysicalDevice physical_device, + const char* layer_name, uint32_t expected_count) { + uint32_t count = 0; + VkResult res = functions->vkEnumerateDeviceExtensionProperties(physical_device, layer_name, &count, nullptr); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); + std::vector extensions{count}; + res = functions->vkEnumerateDeviceExtensionProperties(physical_device, layer_name, &count, extensions.data()); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); return extensions; } @@ -136,21 +305,45 @@ void FillDebugUtilsCreateDetails(InstanceCreateInfo& create_info, DebugUtilsWrap create_info.instance_info.pNext = wrapper.get(); } -PlatformShimWrapper::PlatformShimWrapper(std::vector* folders, bool enable_log) noexcept { +// Look through the event log. If you find a line containing the prefix we're interested in, look for the end of +// line character, and then see if the postfix occurs in it as well. +bool DebugUtilsLogger::find_prefix_then_postfix(const char* prefix, const char* postfix) const { + size_t new_start = 0; + size_t postfix_index = 0; + size_t next_eol = 0; + while ((new_start = returned_output.find(prefix, new_start)) != std::string::npos) { + next_eol = returned_output.find("\n", new_start); + if ((postfix_index = returned_output.find(postfix, new_start)) != std::string::npos) { + if (postfix_index < next_eol) { + return true; + } + } + new_start = next_eol + 1; + } + return false; +} + +bool FindPrefixPostfixStringOnLine(DebugUtilsLogger const& env_log, const char* prefix, const char* postfix) { + return env_log.find_prefix_then_postfix(prefix, postfix); +} + +PlatformShimWrapper::PlatformShimWrapper(std::vector* folders, const char* log_filter) noexcept + : loader_logging{"VK_LOADER_DEBUG"} { #if defined(WIN32) || defined(__APPLE__) shim_library = LibraryWrapper(SHIM_LIBRARY_NAME); PFN_get_platform_shim get_platform_shim_func = shim_library.get_symbol(GET_PLATFORM_SHIM_STR); assert(get_platform_shim_func != NULL && "Must be able to get \"platform_shim\""); platform_shim = get_platform_shim_func(folders); -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) platform_shim = get_platform_shim(folders); #endif platform_shim->reset(); - if (enable_log) { - set_env_var("VK_LOADER_DEBUG", "all"); + if (log_filter) { + loader_logging.set_new_value(log_filter); } } + PlatformShimWrapper::~PlatformShimWrapper() noexcept { platform_shim->reset(); } TestICDHandle::TestICDHandle() noexcept {} @@ -168,6 +361,7 @@ TestICD& TestICDHandle::reset_icd() noexcept { } fs::path TestICDHandle::get_icd_full_path() noexcept { return icd_library.lib_path; } fs::path TestICDHandle::get_icd_manifest_path() noexcept { return manifest_path; } +fs::path TestICDHandle::get_shimmed_manifest_path() noexcept { return shimmed_manifest_path; } TestLayerHandle::TestLayerHandle() noexcept {} TestLayerHandle::TestLayerHandle(fs::path const& layer_path) noexcept : layer_library(layer_path) { @@ -184,9 +378,11 @@ TestLayer& TestLayerHandle::reset_layer() noexcept { } fs::path TestLayerHandle::get_layer_full_path() noexcept { return layer_library.lib_path; } fs::path TestLayerHandle::get_layer_manifest_path() noexcept { return manifest_path; } +fs::path TestLayerHandle::get_shimmed_manifest_path() noexcept { return shimmed_manifest_path; } -FrameworkEnvironment::FrameworkEnvironment() noexcept : FrameworkEnvironment(true) {} -FrameworkEnvironment::FrameworkEnvironment(bool enable_log) noexcept : platform_shim(&folders, enable_log), vulkan_functions() { +FrameworkEnvironment::FrameworkEnvironment() noexcept : FrameworkEnvironment(FrameworkSettings{}) {} +FrameworkEnvironment::FrameworkEnvironment(FrameworkSettings const& settings) noexcept + : settings(settings), platform_shim(&folders, settings.log_filter) { // This order is important, it matches the enum ManifestLocation, used to index the folders vector folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("null_dir")); folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("icd_manifests")); @@ -197,14 +393,54 @@ FrameworkEnvironment::FrameworkEnvironment(bool enable_log) noexcept : platform_ folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("implicit_layer_manifests")); folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("override_layer_manifests")); folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("app_package_manifests")); + folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("macos_bundle")); + folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("unsecured_location")); + folders.emplace_back(FRAMEWORK_BUILD_DIRECTORY, std::string("settings_location")); platform_shim->redirect_all_paths(get_folder(ManifestLocation::null).location()); - platform_shim->set_path(ManifestCategory::icd, get_folder(ManifestLocation::driver).location()); - platform_shim->set_path(ManifestCategory::explicit_layer, get_folder(ManifestLocation::explicit_layer).location()); - platform_shim->set_path(ManifestCategory::implicit_layer, get_folder(ManifestLocation::implicit_layer).location()); + if (settings.enable_default_search_paths) { + platform_shim->set_fake_path(ManifestCategory::icd, get_folder(ManifestLocation::driver).location()); + platform_shim->set_fake_path(ManifestCategory::explicit_layer, get_folder(ManifestLocation::explicit_layer).location()); + platform_shim->set_fake_path(ManifestCategory::implicit_layer, get_folder(ManifestLocation::implicit_layer).location()); +#if COMMON_UNIX_PLATFORMS + auto home = get_env_var("HOME"); + auto unsecured_location = get_folder(ManifestLocation::unsecured_location).location(); + 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 + } +#if COMMON_UNIX_PLATFORMS + 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 + +#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(); + 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 + // only set the settings file if there are elements in the app_specific_settings vector + if (!settings.loader_settings.app_specific_settings.empty()) { + update_loader_settings(settings.loader_settings); + } } -void FrameworkEnvironment::add_icd(TestICDDetails icd_details) noexcept { +FrameworkEnvironment::~FrameworkEnvironment() { + // This is necessary to prevent the folder manager from using dead memory during destruction. + // What happens is that each folder manager tries to cleanup itself. Except, folders that were never called did not have their + // DirEntry array's filled out. So when that folder calls delete_folder, which calls readdir, the shim tries to order the files. + // Except, the list of files is in a object that is currently being destroyed. + platform_shim->is_during_destruction = true; +} + +TestICD& FrameworkEnvironment::add_icd(TestICDDetails icd_details) noexcept { size_t cur_icd_index = icds.size(); fs::FolderManager* folder = &get_folder(ManifestLocation::driver); if (icd_details.discovery_type == ManifestDiscoveryType::env_var || @@ -214,46 +450,95 @@ void FrameworkEnvironment::add_icd(TestICDDetails icd_details) noexcept { if (icd_details.discovery_type == ManifestDiscoveryType::windows_app_package) { folder = &get_folder(ManifestLocation::windows_app_package); } + if (icd_details.discovery_type == ManifestDiscoveryType::macos_bundle) { + folder = &get_folder(ManifestLocation::macos_bundle); + } + if (icd_details.discovery_type == ManifestDiscoveryType::unsecured_generic) { + folder = &get_folder(ManifestLocation::unsecured_location); + } + if (icd_details.discovery_type == ManifestDiscoveryType::null_dir || + icd_details.discovery_type == ManifestDiscoveryType::none) { + folder = &get_folder(ManifestLocation::null); + } if (!icd_details.is_fake) { fs::path new_driver_name = fs::path(icd_details.icd_manifest.lib_path).stem() + "_" + std::to_string(cur_icd_index) + fs::path(icd_details.icd_manifest.lib_path).extension(); auto new_driver_location = folder->copy_file(icd_details.icd_manifest.lib_path, new_driver_name.str()); +#if COMMON_UNIX_PLATFORMS + 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) { + platform_shim->redirect_dlopen_name(fs::path(SYSCONFDIR) / "vulkan" / "icd.d" / "." / new_driver_name, + new_driver_location); + } +#endif +#if defined(WIN32) + if (icd_details.library_path_type == LibraryPathType::default_search_paths) { + SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS); + AddDllDirectory(conver_str_to_wstr(new_driver_location.parent_path().str()).c_str()); + } +#endif icds.push_back(TestICDHandle(new_driver_location)); icds.back().reset_icd(); - icd_details.icd_manifest.lib_path = new_driver_location.str(); + if (icd_details.library_path_type == LibraryPathType::relative) { + icd_details.icd_manifest.lib_path = fs::path(".") / new_driver_name; + } else if (icd_details.library_path_type == LibraryPathType::default_search_paths) { + icd_details.icd_manifest.lib_path = new_driver_name.str(); + } else { + icd_details.icd_manifest.lib_path = new_driver_location.str(); + } } - std::string full_json_name = icd_details.json_name + "_" + std::to_string(cur_icd_index) + ".json"; - - icds.back().manifest_path = folder->write_manifest(full_json_name, icd_details.icd_manifest.get_manifest_str()); - switch (icd_details.discovery_type) { - default: - case (ManifestDiscoveryType::generic): - platform_shim->add_manifest(ManifestCategory::icd, icds.back().manifest_path); - break; - case (ManifestDiscoveryType::env_var): - if (!env_var_vk_icd_filenames.empty()) { - env_var_vk_icd_filenames += OS_ENV_VAR_LIST_SEPARATOR; - } - env_var_vk_icd_filenames += (folder->location() / full_json_name).str(); - set_env_var("VK_DRIVER_FILES", env_var_vk_icd_filenames); - break; - case (ManifestDiscoveryType::add_env_var): - if (!add_env_var_vk_icd_filenames.empty()) { - add_env_var_vk_icd_filenames += OS_ENV_VAR_LIST_SEPARATOR; - } - add_env_var_vk_icd_filenames += (folder->location() / full_json_name).str(); - set_env_var("VK_ADD_DRIVER_FILES", add_env_var_vk_icd_filenames); - break; - case (ManifestDiscoveryType::none): - break; -#ifdef _WIN32 - case (ManifestDiscoveryType::windows_app_package): - platform_shim->set_app_package_path(folder->location()); - break; + if (icd_details.discovery_type != ManifestDiscoveryType::none) { + std::string full_json_name = icd_details.json_name; + if (!icd_details.disable_icd_inc) { + full_json_name += "_" + std::to_string(cur_icd_index); + } + full_json_name += ".json"; + icds.back().manifest_path = folder->write_manifest(full_json_name, icd_details.icd_manifest.get_manifest_str()); + icds.back().shimmed_manifest_path = icds.back().manifest_path; + switch (icd_details.discovery_type) { + default: + case (ManifestDiscoveryType::generic): + platform_shim->add_manifest(ManifestCategory::icd, icds.back().manifest_path); +#if COMMON_UNIX_PLATFORMS + icds.back().shimmed_manifest_path = + platform_shim->query_default_redirect_path(ManifestCategory::icd) / full_json_name; +#endif + break; + case (ManifestDiscoveryType::env_var): + if (icd_details.is_dir) { + env_var_vk_icd_filenames.add_to_list(folder->location().str()); + } else { + env_var_vk_icd_filenames.add_to_list((folder->location() / full_json_name).str()); + } + platform_shim->add_known_path(folder->location()); + break; + case (ManifestDiscoveryType::add_env_var): + if (icd_details.is_dir) { + add_env_var_vk_icd_filenames.add_to_list(folder->location().str()); + } else { + add_env_var_vk_icd_filenames.add_to_list((folder->location() / full_json_name).str()); + } + platform_shim->add_known_path(folder->location()); + break; + case (ManifestDiscoveryType::macos_bundle): + platform_shim->add_manifest(ManifestCategory::icd, icds.back().manifest_path); + break; + case (ManifestDiscoveryType::unsecured_generic): + platform_shim->add_unsecured_manifest(ManifestCategory::icd, icds.back().manifest_path); + break; + case (ManifestDiscoveryType::null_dir): + break; +#if defined(_WIN32) + case (ManifestDiscoveryType::windows_app_package): + platform_shim->set_app_package_path(folder->location()); + break; #endif + } } + return icds.back().get_test_icd(); } void FrameworkEnvironment::add_implicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept { @@ -284,34 +569,60 @@ void FrameworkEnvironment::add_layer_impl(TestLayerDetails layer_details, Manife break; case (ManifestDiscoveryType::env_var): fs_ptr = &get_folder(ManifestLocation::explicit_layer_env_var); - if (!env_var_vk_layer_paths.empty()) { - env_var_vk_layer_paths += OS_ENV_VAR_LIST_SEPARATOR; + if (layer_details.is_dir) { + env_var_vk_layer_paths.add_to_list(fs_ptr->location().str()); + } else { + env_var_vk_layer_paths.add_to_list((fs_ptr->location() / layer_details.json_name).str()); } - env_var_vk_layer_paths += fs_ptr->location().str(); - set_env_var("VK_LAYER_PATH", env_var_vk_layer_paths); + platform_shim->add_known_path(fs_ptr->location()); break; case (ManifestDiscoveryType::add_env_var): fs_ptr = &get_folder(ManifestLocation::explicit_layer_add_env_var); - if (!add_env_var_vk_layer_paths.empty()) { - add_env_var_vk_layer_paths += OS_ENV_VAR_LIST_SEPARATOR; + if (layer_details.is_dir) { + add_env_var_vk_layer_paths.add_to_list(fs_ptr->location().str()); + } else { + add_env_var_vk_layer_paths.add_to_list((fs_ptr->location() / layer_details.json_name).str()); } - add_env_var_vk_layer_paths += fs_ptr->location().str(); - set_env_var("VK_ADD_LAYER_PATH", add_env_var_vk_layer_paths); + platform_shim->add_known_path(fs_ptr->location()); break; case (ManifestDiscoveryType::override_folder): fs_ptr = &get_folder(ManifestLocation::override_layer); break; + case (ManifestDiscoveryType::macos_bundle): + fs_ptr = &(get_folder(ManifestLocation::macos_bundle)); + break; + case (ManifestDiscoveryType::unsecured_generic): + fs_ptr = &(get_folder(ManifestLocation::unsecured_location)); + break; case (ManifestDiscoveryType::none): + case (ManifestDiscoveryType::null_dir): + fs_ptr = &(get_folder(ManifestLocation::null)); break; } auto& folder = *fs_ptr; size_t new_layers_start = layers.size(); for (auto& layer : layer_details.layer_manifest.layers) { - size_t cur_layer_index = layers.size(); if (!layer.lib_path.str().empty()) { - std::string new_layer_name = layer.name + "_" + std::to_string(cur_layer_index) + "_" + layer.lib_path.filename().str(); + fs::path layer_binary_name = + layer.lib_path.filename().stem() + "_" + std::to_string(layers.size()) + layer.lib_path.filename().extension(); - auto new_layer_location = folder.copy_file(layer.lib_path, new_layer_name); + auto new_layer_location = folder.copy_file(layer.lib_path, layer_binary_name.str()); + +#if COMMON_UNIX_PLATFORMS + if (layer_details.library_path_type == LibraryPathType::default_search_paths) { + platform_shim->redirect_dlopen_name(layer_binary_name, new_layer_location); + } + if (layer_details.library_path_type == LibraryPathType::relative) { + platform_shim->redirect_dlopen_name( + fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category) / "." / layer_binary_name, new_layer_location); + } +#endif +#if defined(WIN32) + if (layer_details.library_path_type == LibraryPathType::default_search_paths) { + SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS); + AddDllDirectory(conver_str_to_wstr(new_layer_location.parent_path().str()).c_str()); + } +#endif // Don't load the layer binary if using any of the wrap objects layers, since it doesn't export the same interface // functions @@ -320,195 +631,243 @@ void FrameworkEnvironment::add_layer_impl(TestLayerDetails layer_details, Manife layers.push_back(TestLayerHandle(new_layer_location)); layers.back().reset_layer(); } - layer.lib_path = new_layer_location; + if (layer_details.library_path_type == LibraryPathType::relative) { + layer.lib_path = fs::path(".") / layer_binary_name; + } else if (layer_details.library_path_type == LibraryPathType::default_search_paths) { + layer.lib_path = layer_binary_name; + } else { + layer.lib_path = new_layer_location; + } } } if (layer_details.discovery_type != ManifestDiscoveryType::none) { - auto layer_loc = folder.write_manifest(layer_details.json_name, layer_details.layer_manifest.get_manifest_str()); - platform_shim->add_manifest(category, layer_loc); + // Write a manifest file to a folder as long as the discovery type isn't none + auto layer_manifest_loc = folder.write_manifest(layer_details.json_name, layer_details.layer_manifest.get_manifest_str()); + // only add the manifest to the registry if its a generic location (as if it was installed) - both system and user local + if (layer_details.discovery_type == ManifestDiscoveryType::generic) { + platform_shim->add_manifest(category, layer_manifest_loc); + } + if (layer_details.discovery_type == ManifestDiscoveryType::unsecured_generic) { + platform_shim->add_unsecured_manifest(category, layer_manifest_loc); + } for (size_t i = new_layers_start; i < layers.size(); i++) { - layers.at(i).manifest_path = layer_loc; + layers.at(i).manifest_path = layer_manifest_loc; + layers.at(i).shimmed_manifest_path = layer_manifest_loc; +#if COMMON_UNIX_PLATFORMS + if (layer_details.discovery_type == ManifestDiscoveryType::generic) { + layers.at(i).shimmed_manifest_path = platform_shim->query_default_redirect_path(category) / layer_details.json_name; + } +#endif + } + } +} + +std::string get_loader_settings_file_contents(const LoaderSettings& loader_settings) noexcept { + JsonWriter writer; + writer.StartObject(); + writer.AddKeyedString("file_format_version", loader_settings.file_format_version.get_version_str()); + bool one_setting_file = true; + if (loader_settings.app_specific_settings.size() > 1) { + writer.StartKeyedArray("settings_array"); + one_setting_file = false; + } + for (const auto& setting : loader_settings.app_specific_settings) { + if (one_setting_file) { + writer.StartKeyedObject("settings"); + } else { + writer.StartObject(); + } + if (!setting.app_keys.empty()) { + writer.StartKeyedArray("app_keys"); + for (const auto& app_key : setting.app_keys) { + writer.AddString(app_key); + } + writer.EndArray(); + } + if (!setting.layer_configurations.empty()) { + writer.StartKeyedArray("layers"); + for (const auto& config : setting.layer_configurations) { + writer.StartObject(); + writer.AddKeyedString("name", config.name); + writer.AddKeyedString("path", fs::fixup_backslashes_in_path(config.path)); + writer.AddKeyedString("control", config.control); + writer.AddKeyedBool("treat_as_implicit_manifest", config.treat_as_implicit_manifest); + writer.EndObject(); + } + writer.EndArray(); + } + if (!setting.stderr_log.empty()) { + writer.StartKeyedArray("stderr_log"); + for (const auto& filter : setting.stderr_log) { + writer.AddString(filter); + } + writer.EndArray(); + } + if (!setting.log_configurations.empty()) { + writer.StartKeyedArray("log_locations"); + for (const auto& config : setting.log_configurations) { + writer.StartObject(); + writer.StartKeyedArray("destinations"); + for (const auto& dest : config.destinations) { + writer.AddString(dest); + } + writer.EndArray(); + writer.StartKeyedArray("filter"); + for (const auto& filter : config.filters) { + writer.AddString(filter); + } + writer.EndArray(); + writer.EndObject(); + } + writer.EndArray(); } + writer.EndObject(); } + if (!one_setting_file) { + writer.EndArray(); + } + + writer.EndObject(); + return writer.output; +} +void FrameworkEnvironment::write_settings_file(std::string const& file_contents) { + auto out_path = get_folder(ManifestLocation::settings_location).write_manifest("vk_loader_settings.json", file_contents); +#if defined(WIN32) + platform_shim->hkey_current_user_settings.clear(); + platform_shim->hkey_local_machine_settings.clear(); +#endif + if (settings.secure_loader_settings) + platform_shim->add_manifest(ManifestCategory::settings, out_path); + else + platform_shim->add_unsecured_manifest(ManifestCategory::settings, out_path); +} +void FrameworkEnvironment::update_loader_settings(const LoaderSettings& settings) noexcept { + write_settings_file(get_loader_settings_file_contents(settings)); +} +void FrameworkEnvironment::remove_loader_settings() { + get_folder(ManifestLocation::settings_location).remove("vk_loader_settings.json"); } TestICD& FrameworkEnvironment::get_test_icd(size_t index) noexcept { return icds[index].get_test_icd(); } TestICD& FrameworkEnvironment::reset_icd(size_t index) noexcept { return icds[index].reset_icd(); } fs::path FrameworkEnvironment::get_test_icd_path(size_t index) noexcept { return icds[index].get_icd_full_path(); } fs::path FrameworkEnvironment::get_icd_manifest_path(size_t index) noexcept { return icds[index].get_icd_manifest_path(); } +fs::path FrameworkEnvironment::get_shimmed_icd_manifest_path(size_t index) noexcept { + return icds[index].get_shimmed_manifest_path(); +} TestLayer& FrameworkEnvironment::get_test_layer(size_t index) noexcept { return layers[index].get_test_layer(); } TestLayer& FrameworkEnvironment::reset_layer(size_t index) noexcept { return layers[index].reset_layer(); } fs::path FrameworkEnvironment::get_test_layer_path(size_t index) noexcept { return layers[index].get_layer_full_path(); } fs::path FrameworkEnvironment::get_layer_manifest_path(size_t index) noexcept { return layers[index].get_layer_manifest_path(); } +fs::path FrameworkEnvironment::get_shimmed_layer_manifest_path(size_t index) noexcept { + return layers[index].get_shimmed_manifest_path(); +} fs::FolderManager& FrameworkEnvironment::get_folder(ManifestLocation location) noexcept { // index it directly using the enum location since they will always be in that order return folders.at(static_cast(location)); } -void setup_WSI_in_ICD(TestICD& icd) { - icd.enable_icd_wsi = true; -#ifdef VK_USE_PLATFORM_ANDROID_KHR - icd.add_instance_extensions({"VK_KHR_surface", "VK_KHR_android_surface"}); -#endif -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - icd.add_instance_extensions({"VK_KHR_surface", "VK_EXT_directfb_surface"}); -#endif -#ifdef VK_USE_PLATFORM_FUCHSIA - icd.add_instance_extensions({"VK_KHR_surface", "VK_FUCHSIA_imagepipe_surface"}); -#endif -#ifdef VK_USE_PLATFORM_GGP - icd.add_instance_extensions({"VK_KHR_surface", "VK_GGP_stream_descriptor_surface"}); -#endif -#ifdef VK_USE_PLATFORM_IOS_MVK - icd.add_instance_extensions({"VK_KHR_surface", "VK_MVK_ios_surface"}); -#endif -#ifdef VK_USE_PLATFORM_MACOS_MVK - icd.add_instance_extensions({"VK_KHR_surface", "VK_MVK_macos_surface"}); -#endif -#ifdef VK_USE_PLATFORM_METAL_EXT - icd.add_instance_extensions({"VK_KHR_surface", "VK_EXT_metal_surface"}); -#endif -#ifdef VK_USE_PLATFORM_SCREEN_QNX - icd.add_instance_extensions({"VK_KHR_surface", "VK_QNX_screen_surface"}); -#endif -#ifdef VK_USE_PLATFORM_VI_NN - icd.add_instance_extensions({"VK_KHR_surface", "VK_NN_vi_surface"}); -#endif -#ifdef VK_USE_PLATFORM_XCB_KHR - icd.add_instance_extensions({"VK_KHR_surface", "VK_KHR_xcb_surface"}); -#endif -#ifdef VK_USE_PLATFORM_XLIB_KHR - icd.add_instance_extensions({"VK_KHR_surface", "VK_KHR_xlib_surface"}); -#endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - icd.add_instance_extensions({"VK_KHR_surface", "VK_KHR_wayland_surface"}); -#endif -#ifdef VK_USE_PLATFORM_WIN32_KHR - icd.add_instance_extensions({"VK_KHR_surface", "VK_KHR_win32_surface"}); -#endif +fs::FolderManager const& FrameworkEnvironment::get_folder(ManifestLocation location) const noexcept { + return folders.at(static_cast(location)); } -void setup_WSI_in_create_instance(InstWrapper& inst) { -#ifdef VK_USE_PLATFORM_ANDROID_KHR - inst.create_info.add_extensions({"VK_KHR_surface", "VK_KHR_android_surface"}); -#endif -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - inst.create_info.add_extensions({"VK_KHR_surface", "VK_EXT_directfb_surface"}); -#endif -#ifdef VK_USE_PLATFORM_FUCHSIA - inst.create_info.add_extensions({"VK_KHR_surface", "VK_FUCHSIA_imagepipe_surface"}); -#endif -#ifdef VK_USE_PLATFORM_GGP - inst.create_info.add_extensions({"VK_KHR_surface", "VK_GGP_stream_descriptor_surface"}); -#endif -#ifdef VK_USE_PLATFORM_IOS_MVK - inst.create_info.add_extensions({"VK_KHR_surface", "VK_MVK_ios_surface"}); -#endif -#ifdef VK_USE_PLATFORM_MACOS_MVK - inst.create_info.add_extensions({"VK_KHR_surface", "VK_MVK_macos_surface"}); -#endif -#ifdef VK_USE_PLATFORM_METAL_EXT - inst.create_info.add_extensions({"VK_KHR_surface", "VK_EXT_metal_surface"}); -#endif -#ifdef VK_USE_PLATFORM_SCREEN_QNX - inst.create_info.add_extensions({"VK_KHR_surface", "VK_QNX_screen_surface"}); -#endif -#ifdef VK_USE_PLATFORM_VI_NN - inst.create_info.add_extensions({"VK_KHR_surface", "VK_NN_vi_surface"}); -#endif -#ifdef VK_USE_PLATFORM_XCB_KHR - inst.create_info.add_extensions({"VK_KHR_surface", "VK_KHR_xcb_surface"}); -#endif -#ifdef VK_USE_PLATFORM_XLIB_KHR - inst.create_info.add_extensions({"VK_KHR_surface", "VK_KHR_xlib_surface"}); -#endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - inst.create_info.add_extensions({"VK_KHR_surface", "VK_KHR_wayland_surface"}); -#endif -#ifdef VK_USE_PLATFORM_WIN32_KHR - inst.create_info.add_extensions({"VK_KHR_surface", "VK_KHR_win32_surface"}); -#endif +#if defined(__APPLE__) +void FrameworkEnvironment::setup_macos_bundle() noexcept { + platform_shim->bundle_contents = get_folder(ManifestLocation::macos_bundle).location().str(); } -VkSurfaceKHR create_surface(InstWrapper& inst, const char* api_selection) { - VkSurfaceKHR surface{}; -#ifdef VK_USE_PLATFORM_ANDROID_KHR - PFN_vkCreateAndroidSurfaceKHR pfn_CreateSurface = inst.load("vkCreateAndroidSurfaceKHR"); - VkAndroidSurfaceCreateInfoKHR surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); -#endif -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - PFN_vkCreateDirectFBSurfaceEXT pfn_CreateSurface = inst.load("vkCreateDirectFBSurfaceEXT"); - VkDirectFBSurfaceCreateInfoEXT surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); -#endif -#ifdef VK_USE_PLATFORM_FUCHSIA - PFN_vkCreateImagePipeSurfaceFUCHSIA pfn_CreateSurface = inst.load("vkCreateImagePipeSurfaceFUCHSIA"); - VkImagePipeSurfaceCreateInfoFUCHSIA surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); -#endif -#ifdef VK_USE_PLATFORM_GGP - PFN__vkCreateStreamDescriptorSurfaceGGP pfn_CreateSurface = inst.load("vkCreateStreamDescriptorSurfaceGGP"); - VkStreamDescriptorSurfaceCreateInfoGGP surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); -#endif -#ifdef VK_USE_PLATFORM_IOS_MVK - PFN_vkCreateIOSSurfaceMVK pfn_CreateSurface = inst.load("vkCreateIOSSurfaceMVK"); - VkIOSSurfaceCreateInfoMVK surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); -#endif -#ifdef VK_USE_PLATFORM_MACOS_MVK - if (string_eq(api_selection, "VK_USE_PLATFORM_MACOS_MVK")) { - PFN_vkCreateMacOSSurfaceMVK pfn_CreateSurface = inst.load("vkCreateMacOSSurfaceMVK"); - VkMacOSSurfaceCreateInfoMVK surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); - } -#endif -#ifdef VK_USE_PLATFORM_METAL_EXT - if (string_eq(api_selection, "VK_USE_PLATFORM_METAL_EXT")) { - PFN_vkCreateMetalSurfaceEXT pfn_CreateSurface = inst.load("vkCreateMetalSurfaceEXT"); - VkMetalSurfaceCreateInfoEXT surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); - } -#endif -#ifdef VK_USE_PLATFORM_SCREEN_QNX - PFN_vkCreateScreenSurfaceQNX pfn_CreateSurface = inst.load("vkCreateScreenSurfaceQNX"); - VkScreenSurfaceCreateInfoQNX surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); -#endif -#ifdef VK_USE_PLATFORM_VI_NN - PFN_vkCreateViSurfaceNN pfn_CreateSurface = inst.load("vkCreateViSurfaceNN"); - VkViSurfaceCreateInfoNN surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); -#endif -#ifdef VK_USE_PLATFORM_WIN32_KHR - PFN_vkCreateWin32SurfaceKHR pfn_CreateSurface = inst.load("vkCreateWin32SurfaceKHR"); - VkWin32SurfaceCreateInfoKHR surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); #endif -#ifdef VK_USE_PLATFORM_XCB_KHR - if (string_eq(api_selection, "VK_USE_PLATFORM_XCB_KHR")) { - PFN_vkCreateXcbSurfaceKHR pfn_CreateSurface = inst.load("vkCreateXcbSurfaceKHR"); - VkXcbSurfaceCreateInfoKHR surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); - } -#endif -#ifdef VK_USE_PLATFORM_XLIB_KHR - if (string_eq(api_selection, "VK_USE_PLATFORM_XLIB_KHR")) { - PFN_vkCreateXlibSurfaceKHR pfn_CreateSurface = inst.load("vkCreateXlibSurfaceKHR"); - VkXlibSurfaceCreateInfoKHR surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); - } -#endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - if (string_eq(api_selection, "VK_USE_PLATFORM_WAYLAND_KHR")) { - PFN_vkCreateWaylandSurfaceKHR pfn_CreateSurface = inst.load("vkCreateWaylandSurfaceKHR"); - VkWaylandSurfaceCreateInfoKHR surf_create_info{}; - EXPECT_EQ(VK_SUCCESS, pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface)); - } -#endif - - return surface; +std::vector FrameworkEnvironment::GetInstanceExtensions(uint32_t expected_count, const char* layer_name) { + uint32_t count = 0; + VkResult res = vulkan_functions.vkEnumerateInstanceExtensionProperties(layer_name, &count, nullptr); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); + std::vector extension_props{count}; + res = vulkan_functions.vkEnumerateInstanceExtensionProperties(layer_name, &count, extension_props.data()); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); + return extension_props; +} +std::vector FrameworkEnvironment::GetLayerProperties(uint32_t expected_count) { + uint32_t count = 0; + VkResult res = vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); + std::vector layer_props{count}; + res = vulkan_functions.vkEnumerateInstanceLayerProperties(&count, layer_props.data()); + EXPECT_EQ(VK_SUCCESS, res); + EXPECT_EQ(count, expected_count); + return layer_props; +} + +template +VkResult create_surface_helper(VulkanFunctions* functions, VkInstance inst, VkSurfaceKHR& surface, const char* load_func_name) { + CreationFunc pfn_CreateSurface = functions->load(inst, load_func_name); + if (!pfn_CreateSurface) return VK_ERROR_EXTENSION_NOT_PRESENT; + CreateInfo surf_create_info{}; + return pfn_CreateSurface(inst, &surf_create_info, nullptr, &surface); +} +VkResult create_surface(VulkanFunctions* functions, VkInstance inst, VkSurfaceKHR& surface, + [[maybe_unused]] const char* api_selection) { +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + return create_surface_helper(functions, inst, surface, + "vkCreateAndroidSurfaceKHR"); +#elif defined(VK_USE_PLATFORM_DIRECTFB_EXT) + return create_surface_helper(functions, inst, surface, + "vkCreateDirectFBSurfaceEXT"); +#elif defined(VK_USE_PLATFORM_FUCHSIA) + return create_surface_helper( + functions, inst, surface, "vkCreateImagePipeSurfaceFUCHSIA"); +#elif defined(VK_USE_PLATFORM_GGP) + return create_surface_helper( + functions, inst, surface, "vkCreateStreamDescriptorSurfaceGGP"); +#elif defined(VK_USE_PLATFORM_IOS_MVK) + return create_surface_helper(functions, inst, surface, + "vkCreateIOSSurfaceMVK"); +#elif defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) +#if defined(VK_USE_PLATFORM_MACOS_MVK) + if (api_selection != nullptr && string_eq(api_selection, "VK_USE_PLATFORM_MACOS_MVK")) + return create_surface_helper(functions, inst, surface, + "vkCreateMacOSSurfaceMVK"); +#endif +#if defined(VK_USE_PLATFORM_METAL_EXT) + if (api_selection == nullptr || (api_selection != nullptr && string_eq(api_selection, "VK_USE_PLATFORM_METAL_EXT"))) + return create_surface_helper(functions, inst, surface, + "vkCreateMetalSurfaceEXT"); +#endif + return VK_ERROR_NOT_PERMITTED_KHR; +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + return create_surface_helper(functions, inst, surface, + "vkCreateScreenSurfaceQNX"); +#elif defined(VK_USE_PLATFORM_VI_NN) + return create_surface_helper(functions, inst, surface, "vkCreateViSurfaceNN"); +#elif defined(VK_USE_PLATFORM_WIN32_KHR) + return create_surface_helper(functions, inst, surface, + "vkCreateWin32SurfaceKHR"); +#elif defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WAYLAND_KHR) +#if defined(VK_USE_PLATFORM_XLIB_KHR) + if (string_eq(api_selection, "VK_USE_PLATFORM_XLIB_KHR")) + return create_surface_helper(functions, inst, surface, + "vkCreateXlibSurfaceKHR"); +#endif +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + if (string_eq(api_selection, "VK_USE_PLATFORM_WAYLAND_KHR")) + return create_surface_helper(functions, inst, surface, + "vkCreateWaylandSurfaceKHR"); +#endif +#if defined(VK_USE_PLATFORM_XCB_KHR) + if (api_selection == nullptr || string_eq(api_selection, "VK_USE_PLATFORM_XCB_KHR")) + return create_surface_helper(functions, inst, surface, + "vkCreateXcbSurfaceKHR"); +#endif + return VK_ERROR_NOT_PERMITTED_KHR; +#else + return create_surface_helper( + functions, inst, surface, "vkCreateDisplayPlaneSurfaceKHR"); +#endif +} +VkResult create_surface(InstWrapper& inst, VkSurfaceKHR& surface, const char* api_selection) { + return create_surface(inst.functions, inst.inst, surface, api_selection); } extern "C" { diff --git a/tests/framework/test_environment.h b/tests/framework/test_environment.h index 20a25307af92ec70470a1135a1639d08b48569df..3f6bf519db95c90b425b09481700011abac8a454 100644 --- a/tests/framework/test_environment.h +++ b/tests/framework/test_environment.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 The Khronos Group Inc. - * Copyright (c) 2021 Valve Corporation - * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -34,7 +34,7 @@ // Must include gtest first to guard against Xlib colliding due to redefinitions of "None" and "Bool" -#ifdef _MSC_VER +#if defined(_MSC_VER) #pragma warning(push) /* MSVC warnings 4251 and 4275 have to do with potential dll-interface mismatch @@ -47,15 +47,15 @@ #endif // GTest and Xlib collide due to redefinitions of "None" and "Bool" -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) #pragma push_macro("None") #pragma push_macro("Bool") #undef None #undef Bool #endif -#ifdef _WIN32 -#ifndef NOMINMAX +#if defined(_WIN32) +#if !defined(NOMINMAX) #define NOMINMAX #endif #endif @@ -72,6 +72,13 @@ #include "layer/test_layer.h" +// Useful defines +#if COMMON_UNIX_PLATFORMS +#define HOME_DIR "/home/fake_home" +#define USER_LOCAL_SHARE_DIR HOME_DIR "/.local/share" +#define ETC_DIR "/etc" +#endif + // handle checking template void handle_assert_has_value(T const& handle) { @@ -117,13 +124,154 @@ void handle_assert_equal(size_t count, T left[], T right[]) { } } -// InstWrapper & DeviceWrapper - used to make creating instances & devices easier test writing +// VulkanFunctions - loads vulkan functions for tests to use + +struct VulkanFunctions { +#if !defined(APPLE_STATIC_LOADER) + LibraryWrapper loader; +#endif + // Pre-Instance + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = nullptr; + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties = nullptr; + PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties = nullptr; + PFN_vkEnumerateInstanceVersion vkEnumerateInstanceVersion = nullptr; + PFN_vkCreateInstance vkCreateInstance = nullptr; + + // Instance + PFN_vkDestroyInstance vkDestroyInstance = nullptr; + PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices = nullptr; + PFN_vkEnumeratePhysicalDeviceGroups vkEnumeratePhysicalDeviceGroups = nullptr; + PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures = nullptr; + PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2 = nullptr; + PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties = nullptr; + PFN_vkGetPhysicalDeviceFormatProperties2 vkGetPhysicalDeviceFormatProperties2 = nullptr; + PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties = nullptr; + PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2 = nullptr; + PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties = nullptr; + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 vkGetPhysicalDeviceSparseImageFormatProperties2 = nullptr; + PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties = nullptr; + PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2 = nullptr; + PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties = nullptr; + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 vkGetPhysicalDeviceQueueFamilyProperties2 = nullptr; + PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties = nullptr; + PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2 = nullptr; + PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR = nullptr; + PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR = nullptr; + PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR = nullptr; + PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR = nullptr; + PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties = nullptr; + PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties = nullptr; + PFN_vkGetPhysicalDeviceExternalBufferProperties vkGetPhysicalDeviceExternalBufferProperties = nullptr; + PFN_vkGetPhysicalDeviceExternalFenceProperties vkGetPhysicalDeviceExternalFenceProperties = nullptr; + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties vkGetPhysicalDeviceExternalSemaphoreProperties = nullptr; + + PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr = nullptr; + PFN_vkCreateDevice vkCreateDevice = nullptr; + PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT = nullptr; + PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT = nullptr; + + // WSI + PFN_vkCreateHeadlessSurfaceEXT vkCreateHeadlessSurfaceEXT = nullptr; + PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR = nullptr; + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vkGetPhysicalDeviceDisplayPropertiesKHR = nullptr; + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vkGetPhysicalDeviceDisplayPlanePropertiesKHR = nullptr; + PFN_vkGetDisplayPlaneSupportedDisplaysKHR vkGetDisplayPlaneSupportedDisplaysKHR = nullptr; + PFN_vkGetDisplayModePropertiesKHR vkGetDisplayModePropertiesKHR = nullptr; + PFN_vkCreateDisplayModeKHR vkCreateDisplayModeKHR = nullptr; + PFN_vkGetDisplayPlaneCapabilitiesKHR vkGetDisplayPlaneCapabilitiesKHR = nullptr; + PFN_vkGetPhysicalDevicePresentRectanglesKHR vkGetPhysicalDevicePresentRectanglesKHR = nullptr; + PFN_vkGetPhysicalDeviceDisplayProperties2KHR vkGetPhysicalDeviceDisplayProperties2KHR = nullptr; + PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR vkGetPhysicalDeviceDisplayPlaneProperties2KHR = nullptr; + PFN_vkGetDisplayModeProperties2KHR vkGetDisplayModeProperties2KHR = nullptr; + PFN_vkGetDisplayPlaneCapabilities2KHR vkGetDisplayPlaneCapabilities2KHR = nullptr; + PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR vkGetPhysicalDeviceSurfaceCapabilities2KHR = nullptr; + PFN_vkGetPhysicalDeviceSurfaceFormats2KHR vkGetPhysicalDeviceSurfaceFormats2KHR = nullptr; + +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR = nullptr; +#endif // VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) + PFN_vkCreateDirectFBSurfaceEXT vkCreateDirectFBSurfaceEXT = nullptr; + PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT vkGetPhysicalDeviceDirectFBPresentationSupportEXT = nullptr; +#endif // VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_FUCHSIA) + PFN_vkCreateImagePipeSurfaceFUCHSIA vkCreateImagePipeSurfaceFUCHSIA = nullptr; +#endif // VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_GGP) + PFN_vkCreateStreamDescriptorSurfaceGGP vkCreateStreamDescriptorSurfaceGGP = nullptr; +#endif // VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_IOS_MVK) + PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK = nullptr; +#endif // VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) + PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK = nullptr; +#endif // VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_METAL_EXT) + PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT = nullptr; +#endif // VK_USE_PLATFORM_METAL_EXT +#if defined(VK_USE_PLATFORM_SCREEN_QNX) + PFN_vkCreateScreenSurfaceQNX vkCreateScreenSurfaceQNX = nullptr; + PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX vkGetPhysicalDeviceScreenPresentationSupportQNX = nullptr; +#endif // VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR = nullptr; + PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR vkGetPhysicalDeviceWaylandPresentationSupportKHR = nullptr; +#endif // VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) + PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR = nullptr; + PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR vkGetPhysicalDeviceXcbPresentationSupportKHR = nullptr; +#endif // VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) + PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR = nullptr; + PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR vkGetPhysicalDeviceXlibPresentationSupportKHR = nullptr; +#endif // VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) + PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR = nullptr; + PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR vkGetPhysicalDeviceWin32PresentationSupportKHR = nullptr; +#endif // VK_USE_PLATFORM_WIN32_KHR + PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR = nullptr; + + // device functions + PFN_vkDestroyDevice vkDestroyDevice = nullptr; + PFN_vkGetDeviceQueue vkGetDeviceQueue = nullptr; + + VulkanFunctions(); + + FromVoidStarFunc load(VkInstance inst, const char* func_name) const { + return FromVoidStarFunc(vkGetInstanceProcAddr(inst, func_name)); + } + + FromVoidStarFunc load(VkDevice device, const char* func_name) const { + return FromVoidStarFunc(vkGetDeviceProcAddr(device, func_name)); + } +}; + +struct DeviceFunctions { + PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr = nullptr; + PFN_vkDestroyDevice vkDestroyDevice = nullptr; + PFN_vkGetDeviceQueue vkGetDeviceQueue = nullptr; + PFN_vkCreateCommandPool vkCreateCommandPool = nullptr; + PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers = nullptr; + PFN_vkDestroyCommandPool vkDestroyCommandPool = nullptr; + PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR = nullptr; + PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR = nullptr; + PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR = nullptr; + + DeviceFunctions() = default; + DeviceFunctions(const VulkanFunctions& vulkan_functions, VkDevice device); + + FromVoidStarFunc load(VkDevice device, const char* func_name) const { + return FromVoidStarFunc(vkGetDeviceProcAddr(device, func_name)); + } +}; + +// InstWrapper & DeviceWrapper - used to make creating instances & devices easier when writing tests struct InstWrapper { InstWrapper(VulkanFunctions& functions, VkAllocationCallbacks* callbacks = nullptr) noexcept; InstWrapper(VulkanFunctions& functions, VkInstance inst, VkAllocationCallbacks* callbacks = nullptr) noexcept; ~InstWrapper() noexcept; - // Move-nly object + // Move-only object InstWrapper(InstWrapper const&) = delete; InstWrapper& operator=(InstWrapper const&) = delete; InstWrapper(InstWrapper&& other) noexcept; @@ -131,6 +279,7 @@ struct InstWrapper { // Construct this VkInstance using googletest to assert if it succeeded void CheckCreate(VkResult result_to_check = VK_SUCCESS); + void CheckCreateWithInfo(InstanceCreateInfo& create_info, VkResult result_to_check = VK_SUCCESS); // Convenience operator VkInstance() { return inst; } @@ -145,14 +294,23 @@ struct InstWrapper { // Enumerate a single physical device using googletest to assert if it succeeded VkPhysicalDevice GetPhysDev(VkResult result_to_check = VK_SUCCESS); + // Get all the list of active layers through vkEnumerateDeviceLayerProperties + // Use count to specify the expected count + std::vector GetActiveLayers(VkPhysicalDevice phys_dev, uint32_t count); + + // Get list of device extensions associated with a VkPhysicalDevice + // Use count to specify an expected count + std::vector EnumerateDeviceExtensions(VkPhysicalDevice physical_device, uint32_t count); + // Same as EnumerateDeviceExtensions but for a specific layer + std::vector EnumerateLayerDeviceExtensions(VkPhysicalDevice physical_device, const char* layer_name, + uint32_t expected_count); + VulkanFunctions* functions = nullptr; VkInstance inst = VK_NULL_HANDLE; VkAllocationCallbacks* callbacks = nullptr; InstanceCreateInfo create_info{}; }; -std::vector EnumerateDeviceExtensions(InstWrapper const& inst, VkPhysicalDevice physical_device); - struct DeviceWrapper { DeviceWrapper(InstWrapper& inst_wrapper, VkAllocationCallbacks* callbacks = nullptr) noexcept; DeviceWrapper(VulkanFunctions& functions, VkDevice device, VkAllocationCallbacks* callbacks = nullptr) noexcept; @@ -181,10 +339,10 @@ struct DeviceWrapper { }; struct DebugUtilsLogger { - static VkBool32 VKAPI_PTR DebugUtilsMessengerLoggerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageTypes, - const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, - void* pUserData) { + static VkBool32 VKAPI_PTR + DebugUtilsMessengerLoggerCallback([[maybe_unused]] VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + [[maybe_unused]] VkDebugUtilsMessageTypeFlagsEXT messageTypes, + const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData) { DebugUtilsLogger* debug = reinterpret_cast(pUserData); debug->returned_output += pCallbackData->pMessage; debug->returned_output += '\n'; @@ -211,6 +369,11 @@ struct DebugUtilsLogger { DebugUtilsLogger& operator=(DebugUtilsLogger&&) = delete; // Find a string in the log output bool find(std::string const& search_text) const { return returned_output.find(search_text) != std::string::npos; } + + // Look through the event log. If you find a line containing the prefix we're interested in, look for the end of + // line character, and then see if the postfix occurs in it as well. + bool find_prefix_then_postfix(const char* prefix, const char* postfix) const; + // Clear the log void clear() { returned_output.clear(); } VkDebugUtilsMessengerCreateInfoEXT* get() noexcept { return &create_info; } @@ -259,10 +422,45 @@ VkResult CreateDebugUtilsMessenger(DebugUtilsWrapper& debug_utils); void FillDebugUtilsCreateDetails(InstanceCreateInfo& create_info, DebugUtilsLogger& logger); void FillDebugUtilsCreateDetails(InstanceCreateInfo& create_info, DebugUtilsWrapper& wrapper); +struct LoaderSettingsLayerConfiguration { + BUILDER_VALUE(LoaderSettingsLayerConfiguration, std::string, name, {}) + BUILDER_VALUE(LoaderSettingsLayerConfiguration, std::string, path, {}) + BUILDER_VALUE(LoaderSettingsLayerConfiguration, std::string, control, {}) + BUILDER_VALUE(LoaderSettingsLayerConfiguration, bool, treat_as_implicit_manifest, false) +}; +inline bool operator==(LoaderSettingsLayerConfiguration const& a, LoaderSettingsLayerConfiguration const& b) { + return a.name == b.name && a.path == b.path && a.control == b.control && + a.treat_as_implicit_manifest == b.treat_as_implicit_manifest; +} +inline bool operator!=(LoaderSettingsLayerConfiguration const& a, LoaderSettingsLayerConfiguration const& b) { return !(a == b); } +inline bool operator<(LoaderSettingsLayerConfiguration const& a, LoaderSettingsLayerConfiguration const& b) { + return a.name < b.name; +} +inline bool operator>(LoaderSettingsLayerConfiguration const& a, LoaderSettingsLayerConfiguration const& b) { return (b < a); } +inline bool operator<=(LoaderSettingsLayerConfiguration const& a, LoaderSettingsLayerConfiguration const& b) { return !(b < a); } +inline bool operator>=(LoaderSettingsLayerConfiguration const& a, LoaderSettingsLayerConfiguration const& b) { return !(a < b); } + +// Log files and their associated filter +struct LoaderLogConfiguration { + BUILDER_VECTOR(LoaderLogConfiguration, std::string, destinations, destination) + BUILDER_VECTOR(LoaderLogConfiguration, std::string, filters, filter) +}; +struct AppSpecificSettings { + BUILDER_VECTOR(AppSpecificSettings, std::string, app_keys, app_key) + BUILDER_VECTOR(AppSpecificSettings, LoaderSettingsLayerConfiguration, layer_configurations, layer_configuration) + BUILDER_VECTOR(AppSpecificSettings, std::string, stderr_log, stderr_log_filter) + BUILDER_VECTOR(AppSpecificSettings, LoaderLogConfiguration, log_configurations, log_configuration) +}; + +struct LoaderSettings { + BUILDER_VALUE(LoaderSettings, ManifestVersion, file_format_version, {}) + BUILDER_VECTOR(LoaderSettings, AppSpecificSettings, app_specific_settings, app_specific_setting); +}; + struct FrameworkEnvironment; // forward declaration struct PlatformShimWrapper { - PlatformShimWrapper(std::vector* folders, bool enable_log) noexcept; + PlatformShimWrapper(std::vector* folders, const char* log_filter) noexcept; ~PlatformShimWrapper() noexcept; PlatformShimWrapper(PlatformShimWrapper const&) = delete; PlatformShimWrapper& operator=(PlatformShimWrapper const&) = delete; @@ -271,7 +469,8 @@ struct PlatformShimWrapper { PlatformShim* operator->() { return platform_shim; } LibraryWrapper shim_library; - PlatformShim* platform_shim; + PlatformShim* platform_shim = nullptr; + EnvVarWrapper loader_logging; }; struct TestICDHandle { @@ -281,12 +480,14 @@ struct TestICDHandle { TestICD& get_test_icd() noexcept; fs::path get_icd_full_path() noexcept; fs::path get_icd_manifest_path() noexcept; + fs::path get_shimmed_manifest_path() noexcept; // Must use statically LibraryWrapper icd_library; GetTestICDFunc proc_addr_get_test_icd = nullptr; GetNewTestICDFunc proc_addr_reset_icd = nullptr; - fs::path manifest_path; + fs::path manifest_path; // path to the manifest file is on the actual filesystem (aka /tests/framework/<...>) + fs::path shimmed_manifest_path; // path to where the loader will find the manifest file (eg /usr/local/share/vulkan/<...>) }; struct TestLayerHandle { TestLayerHandle() noexcept; @@ -295,32 +496,49 @@ struct TestLayerHandle { TestLayer& get_test_layer() noexcept; fs::path get_layer_full_path() noexcept; fs::path get_layer_manifest_path() noexcept; + fs::path get_shimmed_manifest_path() noexcept; // Must use statically LibraryWrapper layer_library; GetTestLayerFunc proc_addr_get_test_layer = nullptr; GetNewTestLayerFunc proc_addr_reset_layer = nullptr; - fs::path manifest_path; + fs::path manifest_path; // path to the manifest file is on the actual filesystem (aka /tests/framework/<...>) + fs::path shimmed_manifest_path; // path to where the loader will find the manifest file (eg /usr/local/share/vulkan/<...>) }; +// Controls whether to create a manifest and where to put it enum class ManifestDiscoveryType { generic, // put the manifest in the regular locations - none, // don't add to regular locations - eg D3DKMT + unsecured_generic, // put the manifest in a user folder rather than system + none, // Do not write the manifest anywhere (for Direct Driver Loading) + null_dir, // put the manifest in the 'null_dir' which the loader does not search in (D3DKMT for instance) env_var, // use the corresponding env-var for it add_env_var, // use the corresponding add-env-var for it override_folder, // add to a special folder for the override layer to use windows_app_package, // let the app package search find it + macos_bundle, // place it in a location only accessible to macos bundles +}; + +enum class LibraryPathType { + absolute, // default for testing - the exact path of the binary + relative, // Relative to the manifest file + default_search_paths, // Dont add any path information to the library_path - force the use of the default search paths }; struct TestICDDetails { TestICDDetails(ManifestICD icd_manifest) noexcept : icd_manifest(icd_manifest) {} - TestICDDetails(fs::path icd_path, uint32_t api_version = VK_API_VERSION_1_0) noexcept { - icd_manifest.set_lib_path(icd_path.str()).set_api_version(api_version); + TestICDDetails(fs::path icd_binary_path, uint32_t api_version = VK_API_VERSION_1_0) noexcept { + icd_manifest.set_lib_path(icd_binary_path.str()).set_api_version(api_version); } BUILDER_VALUE(TestICDDetails, ManifestICD, icd_manifest, {}); BUILDER_VALUE(TestICDDetails, std::string, json_name, "test_icd"); + // Uses the json_name without modification - default is to append _1 in the json file to distinguish drivers + BUILDER_VALUE(TestICDDetails, bool, disable_icd_inc, false); BUILDER_VALUE(TestICDDetails, ManifestDiscoveryType, discovery_type, ManifestDiscoveryType::generic); BUILDER_VALUE(TestICDDetails, bool, is_fake, false); + // If discovery type is env-var, is_dir controls whether to use the path to the file or folder the manifest is in + BUILDER_VALUE(TestICDDetails, bool, is_dir, false); + BUILDER_VALUE(TestICDDetails, LibraryPathType, library_path_type, LibraryPathType::absolute); }; struct TestLayerDetails { @@ -330,8 +548,13 @@ struct TestLayerDetails { BUILDER_VALUE(TestLayerDetails, std::string, json_name, "test_layer"); BUILDER_VALUE(TestLayerDetails, ManifestDiscoveryType, discovery_type, ManifestDiscoveryType::generic); BUILDER_VALUE(TestLayerDetails, bool, is_fake, false); + // If discovery type is env-var, is_dir controls whether to use the path to the file or folder the manifest is in + BUILDER_VALUE(TestLayerDetails, bool, is_dir, true); + BUILDER_VALUE(TestLayerDetails, LibraryPathType, library_path_type, LibraryPathType::absolute); }; +// Locations manifests can go in the test framework +// If this enum is added to - the contructor of FrameworkEnvironment also needs to be updated with the new enum value enum class ManifestLocation { null = 0, driver = 1, @@ -342,13 +565,27 @@ enum class ManifestLocation { implicit_layer = 6, override_layer = 7, windows_app_package = 8, + macos_bundle = 9, + unsecured_location = 10, + settings_location = 11, }; -struct FrameworkEnvironment { - FrameworkEnvironment() noexcept; // default is to enable VK_LOADER_DEBUG=all - FrameworkEnvironment(bool enable_log) noexcept; +struct FrameworkSettings { + BUILDER_VALUE(FrameworkSettings, const char*, log_filter, "all"); + BUILDER_VALUE(FrameworkSettings, bool, enable_default_search_paths, true); + BUILDER_VALUE(FrameworkSettings, LoaderSettings, loader_settings, {}); + BUILDER_VALUE(FrameworkSettings, bool, secure_loader_settings, false); +}; - void add_icd(TestICDDetails icd_details) noexcept; +struct FrameworkEnvironment { + FrameworkEnvironment() noexcept; // default is to enable VK_LOADER_DEBUG=all and enable the default search paths + FrameworkEnvironment(const FrameworkSettings& settings) noexcept; + ~FrameworkEnvironment(); + // Delete copy constructors - this class should never move after being created + FrameworkEnvironment(const FrameworkEnvironment&) = delete; + FrameworkEnvironment& operator=(const FrameworkEnvironment&) = delete; + + TestICD& add_icd(TestICDDetails icd_details) noexcept; void add_implicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept; void add_implicit_layer(TestLayerDetails layer_details) noexcept; void add_explicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept; @@ -356,17 +593,38 @@ struct FrameworkEnvironment { void add_fake_implicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept; void add_fake_explicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept; + // resets the current settings with the values contained in loader_settings + void write_settings_file(std::string const& file_contents); + // apply any changes made to FrameworkEnvironment's loader_settings member + void update_loader_settings(const LoaderSettings& loader_settings) noexcept; + void remove_loader_settings(); + TestICD& get_test_icd(size_t index = 0) noexcept; TestICD& reset_icd(size_t index = 0) noexcept; fs::path get_test_icd_path(size_t index = 0) noexcept; fs::path get_icd_manifest_path(size_t index = 0) noexcept; + fs::path get_shimmed_icd_manifest_path(size_t index = 0) noexcept; TestLayer& get_test_layer(size_t index = 0) noexcept; TestLayer& reset_layer(size_t index = 0) noexcept; fs::path get_test_layer_path(size_t index = 0) noexcept; fs::path get_layer_manifest_path(size_t index = 0) noexcept; + fs::path get_shimmed_layer_manifest_path(size_t index = 0) noexcept; fs::FolderManager& get_folder(ManifestLocation location) noexcept; + fs::FolderManager const& get_folder(ManifestLocation location) const noexcept; +#if defined(__APPLE__) + // Set the path of the app bundle to the appropriate test framework bundle + void setup_macos_bundle() noexcept; +#endif + + FrameworkSettings settings; + + // Query the global extensions + // Optional: use layer_name to query the extensions of a specific layer + std::vector GetInstanceExtensions(uint32_t count, const char* layer_name = nullptr); + // Query the available layers + std::vector GetLayerProperties(uint32_t count); PlatformShimWrapper platform_shim; std::vector folders; @@ -377,20 +635,21 @@ struct FrameworkEnvironment { std::vector icds; std::vector layers; - std::string env_var_vk_icd_filenames; - std::string add_env_var_vk_icd_filenames; - - std::string env_var_vk_layer_paths; - std::string add_env_var_vk_layer_paths; + EnvVarWrapper env_var_vk_icd_filenames{"VK_DRIVER_FILES"}; + EnvVarWrapper add_env_var_vk_icd_filenames{"VK_ADD_DRIVER_FILES"}; + EnvVarWrapper env_var_vk_layer_paths{"VK_LAYER_PATH"}; + EnvVarWrapper add_env_var_vk_layer_paths{"VK_ADD_LAYER_PATH"}; + LoaderSettings loader_settings; // the current settings written to disk private: void add_layer_impl(TestLayerDetails layer_details, ManifestCategory category); }; -// The following helpers setup an icd with the required extensions and setting to use with WSI -// By default they use whatever the set VK_USE_PLATFORM_XXX macros define -void setup_WSI_in_ICD(TestICD& icd); -void setup_WSI_in_create_instance(InstWrapper& inst); -// api_selection: optionally provide a VK_USE_PLATFORM_XXX string to select which API to create a surface with -// Note: MUST provide api_selection on platforms with multiple viable API's, such as linux and MacOS -VkSurfaceKHR create_surface(InstWrapper& inst, const char* api_selection = nullptr); +// Create a surface using a platform specific API +// api_selection: optionally provide a VK_USE_PLATFORM_XXX string to select which API to create a surface with. +// defaults to Metal on macOS and XCB on linux if not provided +// Returns an VkResult with the result of surface creation +// returns VK_ERROR_EXTENSION_NOT_PRESENT if it fails to load the surface creation function +VkResult create_surface(InstWrapper& inst, VkSurfaceKHR& out_surface, const char* api_selection = nullptr); +// Alternate parameter list for allocation callback tests +VkResult create_surface(VulkanFunctions* functions, VkInstance inst, VkSurfaceKHR& surface, const char* api_selection = nullptr); diff --git a/tests/framework/test_util.cpp b/tests/framework/test_util.cpp index f7acaee190771c5e59b53295976ec9afa0f59b0e..6952a480d2f97bb950694f9f69d0728947acaf8b 100644 --- a/tests/framework/test_util.cpp +++ b/tests/framework/test_util.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 The Khronos Group Inc. - * Copyright (c) 2021 Valve Corporation - * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -57,13 +57,13 @@ void print_error_message(LSTATUS status, const char* function_name, std::string LocalFree(lpMsgBuf); } -void set_env_var(std::string const& name, std::string const& value) { - BOOL ret = SetEnvironmentVariableW(widen(name).c_str(), widen(value).c_str()); +void EnvVarWrapper::set_env_var() { + BOOL ret = SetEnvironmentVariableW(widen(name).c_str(), widen(cur_value).c_str()); if (ret == 0) { print_error_message(ERROR_SETENV_FAILED, "SetEnvironmentVariableW"); } } -void remove_env_var(std::string const& name) { SetEnvironmentVariableW(widen(name).c_str(), nullptr); } +void EnvVarWrapper::remove_env_var() const { SetEnvironmentVariableW(widen(name).c_str(), nullptr); } std::string get_env_var(std::string const& name, bool report_failure) { std::wstring name_utf16 = widen(name); DWORD value_size = GetEnvironmentVariableW(name_utf16.c_str(), nullptr, 0); @@ -77,10 +77,10 @@ std::string get_env_var(std::string const& name, bool report_failure) { } return narrow(value); } -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS -void set_env_var(std::string const& name, std::string const& value) { setenv(name.c_str(), value.c_str(), 1); } -void remove_env_var(std::string const& name) { unsetenv(name.c_str()); } +void EnvVarWrapper::set_env_var() { setenv(name.c_str(), cur_value.c_str(), 1); } +void EnvVarWrapper::remove_env_var() const { unsetenv(name.c_str()); } std::string get_env_var(std::string const& name, bool report_failure) { char* ret = getenv(name.c_str()); if (ret == nullptr) { @@ -92,98 +92,88 @@ std::string get_env_var(std::string const& name, bool report_failure) { #endif template -void print_list_of_t(std::string& out, const char* object_name, std::vector const& vec) { - if (vec.size() > 0) { - out += std::string(",\n\t\t\"") + object_name + "\": {"; - for (size_t i = 0; i < vec.size(); i++) { - if (i > 0) out += ",\t\t\t"; - out += "\n\t\t\t" + vec.at(i).get_manifest_str(); - } - out += "\n\t\t}"; +void print_object_of_t(JsonWriter& writer, const char* object_name, std::vector const& vec) { + if (vec.size() == 0) return; + writer.StartKeyedObject(object_name); + for (auto& element : vec) { + element.get_manifest_str(writer); } + writer.EndObject(); } template -void print_vector_of_t(std::string& out, const char* object_name, std::vector const& vec) { - if (vec.size() > 0) { - out += std::string(",\n\t\t\"") + object_name + "\": ["; - for (size_t i = 0; i < vec.size(); i++) { - if (i > 0) out += ",\t\t\t"; - out += "\n\t\t\t" + vec.at(i).get_manifest_str(); - } - out += "\n\t\t]"; +void print_array_of_t(JsonWriter& writer, const char* object_name, std::vector const& vec) { + if (vec.size() == 0) return; + writer.StartKeyedArray(object_name); + for (auto& element : vec) { + element.get_manifest_str(writer); } + writer.EndArray(); } -void print_vector_of_strings(std::string& out, const char* object_name, std::vector const& strings) { - if (strings.size() > 0) { - out += std::string(",\n\t\t\"") + object_name + "\": ["; - for (size_t i = 0; i < strings.size(); i++) { - if (i > 0) out += ",\t\t\t"; - out += "\"" + fs::fixup_backslashes_in_path(strings.at(i)) + "\""; - } - out += "]"; +void print_vector_of_strings(JsonWriter& writer, const char* object_name, std::vector const& strings) { + if (strings.size() == 0) return; + writer.StartKeyedArray(object_name); + for (auto& str : strings) { + writer.AddString(fs::fixup_backslashes_in_path(str)); } + writer.EndArray(); } std::string to_text(bool b) { return b ? std::string("true") : std::string("false"); } std::string ManifestICD::get_manifest_str() const { - std::string out; - out += "{\n"; - out += " " + file_format_version.get_version_str() + "\n"; - out += " \"ICD\": {\n"; - out += " \"library_path\": \"" + fs::fixup_backslashes_in_path(lib_path) + "\",\n"; - out += " \"api_version\": \"" + version_to_string(api_version) + "\",\n"; - out += " \"is_portability_driver\": " + to_text(is_portability_driver); - if (!library_arch.empty()) { - out += ",\n \"library_arch\": \"" + library_arch + "\"\n"; - } else { - out += "\n"; - } - out += " }\n"; - out += "}\n"; - return out; -} - -std::string ManifestLayer::LayerDescription::Extension::get_manifest_str() const { - std::string out; - out += "{ \"name\":\"" + name + "\",\n\t\t\t\"spec_version\":\"" + std::to_string(spec_version) + "\""; - print_vector_of_strings(out, "entrypoints", entrypoints); - out += "\n\t\t\t}"; - return out; -} - -std::string ManifestLayer::LayerDescription::get_manifest_str() const { - std::string out; - out += "\t{\n"; - out += "\t\t\"name\":\"" + name + "\",\n"; - out += "\t\t\"type\":\"" + get_type_str(type) + "\",\n"; - if (lib_path.size() > 0) { - out += "\t\t\"library_path\": \"" + fs::fixup_backslashes_in_path(lib_path.str()) + "\",\n"; - } - out += "\t\t\"api_version\": \"" + version_to_string(api_version) + "\",\n"; - out += "\t\t\"implementation_version\":\"" + std::to_string(implementation_version) + "\",\n"; - out += "\t\t\"description\": \"" + description + "\""; - print_list_of_t(out, "functions", functions); - print_vector_of_t(out, "instance_extensions", instance_extensions); - print_vector_of_t(out, "device_extensions", device_extensions); + JsonWriter writer; + writer.StartObject(); + writer.AddKeyedString("file_format_version", file_format_version.get_version_str()); + writer.StartKeyedObject("ICD"); + writer.AddKeyedString("library_path", fs::fixup_backslashes_in_path(lib_path).str()); + writer.AddKeyedString("api_version", version_to_string(api_version)); + writer.AddKeyedBool("is_portability_driver", is_portability_driver); + if (!library_arch.empty()) writer.AddKeyedString("library_arch", library_arch); + writer.EndObject(); + writer.EndObject(); + return writer.output; +} + +void ManifestLayer::LayerDescription::Extension::get_manifest_str(JsonWriter& writer) const { + writer.StartObject(); + writer.AddKeyedString("name", name); + writer.AddKeyedString("spec_version", std::to_string(spec_version)); + writer.AddKeyedString("spec_version", std::to_string(spec_version)); + print_vector_of_strings(writer, "entrypoints", entrypoints); + writer.EndObject(); +} + +void ManifestLayer::LayerDescription::get_manifest_str(JsonWriter& writer) const { + writer.AddKeyedString("name", name); + writer.AddKeyedString("type", get_type_str(type)); + if (!lib_path.str().empty()) { + writer.AddKeyedString("library_path", fs::fixup_backslashes_in_path(lib_path.str())); + } + writer.AddKeyedString("api_version", version_to_string(api_version)); + writer.AddKeyedString("implementation_version", std::to_string(implementation_version)); + writer.AddKeyedString("description", description); + print_object_of_t(writer, "functions", functions); + print_array_of_t(writer, "instance_extensions", instance_extensions); + print_array_of_t(writer, "device_extensions", device_extensions); if (!enable_environment.empty()) { - out += ",\n\t\t\"enable_environment\": { \"" + enable_environment + "\": \"1\" }"; + writer.StartKeyedObject("enable_environment"); + writer.AddKeyedString(enable_environment, "1"); + writer.EndObject(); } if (!disable_environment.empty()) { - out += ",\n\t\t\"disable_environment\": { \"" + disable_environment + "\": \"1\" }"; - } - print_vector_of_strings(out, "component_layers", component_layers); - print_vector_of_strings(out, "blacklisted_layers", blacklisted_layers); - print_vector_of_strings(out, "override_paths", override_paths); - print_vector_of_strings(out, "app_keys", app_keys); - print_list_of_t(out, "pre_instance_functions", pre_instance_functions); + writer.StartKeyedObject("disable_environment"); + writer.AddKeyedString(disable_environment, "1"); + writer.EndObject(); + } + print_vector_of_strings(writer, "component_layers", component_layers); + print_vector_of_strings(writer, "blacklisted_layers", blacklisted_layers); + print_vector_of_strings(writer, "override_paths", override_paths); + print_vector_of_strings(writer, "app_keys", app_keys); + print_object_of_t(writer, "pre_instance_functions", pre_instance_functions); if (!library_arch.empty()) { - out += ",\n\t\t\"library_arch\": \"" + library_arch + "\""; + writer.AddKeyedString("library_arch", library_arch); } - out += "\n\t}"; - - return out; } VkLayerProperties ManifestLayer::LayerDescription::get_layer_properties() const { @@ -196,22 +186,24 @@ VkLayerProperties ManifestLayer::LayerDescription::get_layer_properties() const } std::string ManifestLayer::get_manifest_str() const { - std::string out; - out += "{\n"; - out += "\t" + file_format_version.get_version_str() + "\n"; + JsonWriter writer; + writer.StartObject(); + writer.AddKeyedString("file_format_version", file_format_version.get_version_str()); if (layers.size() == 1) { - out += "\t\"layer\": "; - out += layers.at(0).get_manifest_str() + "\n"; + writer.StartKeyedObject("layer"); + layers.at(0).get_manifest_str(writer); + writer.EndObject(); } else { - out += "\"\tlayers\": ["; + writer.StartKeyedArray("layers"); for (size_t i = 0; i < layers.size(); i++) { - if (i > 0) out += ","; - out += "\n" + layers.at(0).get_manifest_str(); + writer.StartObject(); + layers.at(i).get_manifest_str(writer); + writer.EndObject(); } - out += "\n]"; + writer.EndArray(); } - out += "}\n"; - return out; + writer.EndObject(); + return writer.output; } namespace fs { @@ -224,7 +216,7 @@ std::string make_native(std::string const& in_path) { else out += c; } -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS for (size_t i = 0; i < in_path.size(); i++) { if (i + 1 < in_path.size() && in_path[i] == '\\' && in_path[i + 1] == '\\') { out += '/'; @@ -471,6 +463,8 @@ path FolderManager::write_manifest(std::string const& name, std::string const& c file << contents << std::endl; return out_path; } +void FolderManager::add_existing_file(std::string const& file_name) { files.emplace_back(file_name); } + // close file handle, delete file, remove `name` from managed file list. void FolderManager::remove(std::string const& name) { path out_path = folder / name; @@ -514,132 +508,52 @@ path FolderManager::copy_file(path const& file, std::string const& new_name) { } } // namespace fs -bool string_eq(const char* a, const char* b) noexcept { return strcmp(a, b) == 0; } -bool string_eq(const char* a, const char* b, size_t len) noexcept { return strncmp(a, b, len) == 0; } - -fs::path get_loader_path() { - auto loader_path = fs::path(FRAMEWORK_VULKAN_LIBRARY_PATH); - auto env_var_res = get_env_var("VK_LOADER_TEST_LOADER_PATH", false); - if (!env_var_res.empty()) { - loader_path = fs::path(env_var_res); - } - return loader_path; -} - -VulkanFunctions::VulkanFunctions() : loader(get_loader_path()) { - // clang-format off - vkGetInstanceProcAddr = loader.get_symbol("vkGetInstanceProcAddr"); - vkEnumerateInstanceExtensionProperties = loader.get_symbol("vkEnumerateInstanceExtensionProperties"); - vkEnumerateInstanceLayerProperties = loader.get_symbol("vkEnumerateInstanceLayerProperties"); - vkEnumerateInstanceVersion = loader.get_symbol("vkEnumerateInstanceVersion"); - vkCreateInstance = loader.get_symbol("vkCreateInstance"); - vkDestroyInstance = loader.get_symbol("vkDestroyInstance"); - vkEnumeratePhysicalDevices = loader.get_symbol("vkEnumeratePhysicalDevices"); - vkEnumeratePhysicalDeviceGroups = loader.get_symbol("vkEnumeratePhysicalDeviceGroups"); - vkGetPhysicalDeviceFeatures = loader.get_symbol("vkGetPhysicalDeviceFeatures"); - vkGetPhysicalDeviceFeatures2 = loader.get_symbol("vkGetPhysicalDeviceFeatures2"); - vkGetPhysicalDeviceFormatProperties = loader.get_symbol("vkGetPhysicalDeviceFormatProperties"); - vkGetPhysicalDeviceFormatProperties2 = loader.get_symbol("vkGetPhysicalDeviceFormatProperties2"); - vkGetPhysicalDeviceImageFormatProperties = loader.get_symbol("vkGetPhysicalDeviceImageFormatProperties"); - vkGetPhysicalDeviceImageFormatProperties2 = loader.get_symbol("vkGetPhysicalDeviceImageFormatProperties2"); - vkGetPhysicalDeviceSparseImageFormatProperties = loader.get_symbol("vkGetPhysicalDeviceSparseImageFormatProperties"); - vkGetPhysicalDeviceSparseImageFormatProperties2 = loader.get_symbol("vkGetPhysicalDeviceSparseImageFormatProperties2"); - vkGetPhysicalDeviceProperties = loader.get_symbol("vkGetPhysicalDeviceProperties"); - vkGetPhysicalDeviceProperties2 = loader.get_symbol("vkGetPhysicalDeviceProperties2"); - vkGetPhysicalDeviceQueueFamilyProperties = loader.get_symbol("vkGetPhysicalDeviceQueueFamilyProperties"); - vkGetPhysicalDeviceQueueFamilyProperties2 = loader.get_symbol("vkGetPhysicalDeviceQueueFamilyProperties2"); - vkGetPhysicalDeviceMemoryProperties = loader.get_symbol("vkGetPhysicalDeviceMemoryProperties"); - vkGetPhysicalDeviceMemoryProperties2 = loader.get_symbol("vkGetPhysicalDeviceMemoryProperties2"); - vkGetPhysicalDeviceSurfaceSupportKHR = loader.get_symbol("vkGetPhysicalDeviceSurfaceSupportKHR"); - vkGetPhysicalDeviceSurfaceFormatsKHR = loader.get_symbol("vkGetPhysicalDeviceSurfaceFormatsKHR"); - vkGetPhysicalDeviceSurfacePresentModesKHR = loader.get_symbol("vkGetPhysicalDeviceSurfacePresentModesKHR"); - vkGetPhysicalDeviceSurfaceCapabilitiesKHR = loader.get_symbol("vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); - vkEnumerateDeviceExtensionProperties = loader.get_symbol("vkEnumerateDeviceExtensionProperties"); - vkEnumerateDeviceLayerProperties = loader.get_symbol("vkEnumerateDeviceLayerProperties"); - vkGetPhysicalDeviceExternalBufferProperties = loader.get_symbol("vkGetPhysicalDeviceExternalBufferProperties"); - vkGetPhysicalDeviceExternalFenceProperties = loader.get_symbol("vkGetPhysicalDeviceExternalFenceProperties"); - vkGetPhysicalDeviceExternalSemaphoreProperties = loader.get_symbol("vkGetPhysicalDeviceExternalSemaphoreProperties"); - - vkDestroySurfaceKHR = loader.get_symbol("vkDestroySurfaceKHR"); - vkGetDeviceProcAddr = loader.get_symbol("vkGetDeviceProcAddr"); - vkCreateDevice = loader.get_symbol("vkCreateDevice"); - - vkCreateHeadlessSurfaceEXT = loader.get_symbol("vkCreateHeadlessSurfaceEXT"); - vkCreateDisplayPlaneSurfaceKHR = loader.get_symbol("vkCreateDisplayPlaneSurfaceKHR"); - vkGetPhysicalDeviceDisplayPropertiesKHR = loader.get_symbol("vkGetPhysicalDeviceDisplayPropertiesKHR"); - vkGetPhysicalDeviceDisplayPlanePropertiesKHR = loader.get_symbol("vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); - vkGetDisplayPlaneSupportedDisplaysKHR = loader.get_symbol("vkGetDisplayPlaneSupportedDisplaysKHR"); - vkGetDisplayModePropertiesKHR = loader.get_symbol("vkGetDisplayModePropertiesKHR"); - vkCreateDisplayModeKHR = loader.get_symbol("vkCreateDisplayModeKHR"); - vkGetDisplayPlaneCapabilitiesKHR = loader.get_symbol("vkGetDisplayPlaneCapabilitiesKHR"); - vkGetPhysicalDevicePresentRectanglesKHR = loader.get_symbol("vkGetPhysicalDevicePresentRectanglesKHR"); - vkGetPhysicalDeviceDisplayProperties2KHR = loader.get_symbol("vkGetPhysicalDeviceDisplayProperties2KHR"); - vkGetPhysicalDeviceDisplayPlaneProperties2KHR = loader.get_symbol("vkGetPhysicalDeviceDisplayPlaneProperties2KHR"); - vkGetDisplayModeProperties2KHR = loader.get_symbol("vkGetDisplayModeProperties2KHR"); - vkGetDisplayPlaneCapabilities2KHR = loader.get_symbol("vkGetDisplayPlaneCapabilities2KHR"); - vkGetPhysicalDeviceSurfaceCapabilities2KHR = loader.get_symbol("vkGetPhysicalDeviceSurfaceCapabilities2KHR"); - vkGetPhysicalDeviceSurfaceFormats2KHR = loader.get_symbol("vkGetPhysicalDeviceSurfaceFormats2KHR"); - -#ifdef VK_USE_PLATFORM_ANDROID_KHR - vkCreateAndroidSurfaceKHR = loader.get_symbol("vkCreateAndroidSurfaceKHR"); -#endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - vkCreateDirectFBSurfaceEXT = loader.get_symbol("vkCreateDirectFBSurfaceEXT"); - vkGetPhysicalDeviceDirectFBPresentationSupportEXT = loader.get_symbol("vkGetPhysicalDeviceDirectFBPresentationSupportEXT"); -#endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_FUCHSIA - vkCreateImagePipeSurfaceFUCHSIA = loader.get_symbol("vkCreateImagePipeSurfaceFUCHSIA"); -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_GGP - vkCreateStreamDescriptorSurfaceGGP = loader.get_symbol("vkCreateStreamDescriptorSurfaceGGP"); -#endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_IOS_MVK - vkCreateIOSSurfaceMVK = loader.get_symbol("vkCreateIOSSurfaceMVK"); -#endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_MACOS_MVK - vkCreateMacOSSurfaceMVK = loader.get_symbol("vkCreateMacOSSurfaceMVK"); -#endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_METAL_EXT - vkCreateMetalSurfaceEXT = loader.get_symbol("vkCreateMetalSurfaceEXT"); -#endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX - vkCreateScreenSurfaceQNX = loader.get_symbol("vkCreateScreenSurfaceQNX"); - vkGetPhysicalDeviceScreenPresentationSupportQNX = loader.get_symbol("vkGetPhysicalDeviceScreenPresentationSupportQNX"); -#endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - vkCreateWaylandSurfaceKHR = loader.get_symbol("vkCreateWaylandSurfaceKHR"); - vkGetPhysicalDeviceWaylandPresentationSupportKHR = loader.get_symbol("vkGetPhysicalDeviceWaylandPresentationSupportKHR"); -#endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR - vkCreateXcbSurfaceKHR = loader.get_symbol("vkCreateXcbSurfaceKHR"); - vkGetPhysicalDeviceXcbPresentationSupportKHR = loader.get_symbol("vkGetPhysicalDeviceXcbPresentationSupportKHR"); -#endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR - vkCreateXlibSurfaceKHR = loader.get_symbol("vkCreateXlibSurfaceKHR"); - vkGetPhysicalDeviceXlibPresentationSupportKHR = loader.get_symbol("vkGetPhysicalDeviceXlibPresentationSupportKHR"); -#endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - vkCreateWin32SurfaceKHR = loader.get_symbol("vkCreateWin32SurfaceKHR"); - vkGetPhysicalDeviceWin32PresentationSupportKHR = loader.get_symbol("vkGetPhysicalDeviceWin32PresentationSupportKHR"); -#endif // VK_USE_PLATFORM_WIN32_KHR - - vkDestroyDevice = loader.get_symbol("vkDestroyDevice"); - vkGetDeviceQueue = loader.get_symbol("vkGetDeviceQueue"); - - // clang-format on -} - -DeviceFunctions::DeviceFunctions(const VulkanFunctions& vulkan_functions, VkDevice device) { - vkGetDeviceProcAddr = vulkan_functions.vkGetDeviceProcAddr; - vkDestroyDevice = load(device, "vkDestroyDevice"); - vkGetDeviceQueue = load(device, "vkGetDeviceQueue"); - vkCreateCommandPool = load(device, "vkCreateCommandPool"); - vkAllocateCommandBuffers = load(device, "vkAllocateCommandBuffers"); - vkDestroyCommandPool = load(device, "vkDestroyCommandPool"); - vkCreateSwapchainKHR = load(device, "vkCreateSwapchainKHR"); - vkDestroySwapchainKHR = load(device, "vkDestroySwapchainKHR"); +const char* get_platform_wsi_extension([[maybe_unused]] const char* api_selection) { +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + return "VK_KHR_android_surface"; +#elif defined(VK_USE_PLATFORM_DIRECTFB_EXT) + return "VK_EXT_directfb_surface"; +#elif defined(VK_USE_PLATFORM_FUCHSIA) + return "VK_FUCHSIA_imagepipe_surface"; +#elif defined(VK_USE_PLATFORM_GGP) + return "VK_GGP_stream_descriptor_surface"; +#elif defined(VK_USE_PLATFORM_IOS_MVK) + return "VK_MVK_ios_surface"; +#elif defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) +#if defined(VK_USE_PLATFORM_MACOS_MVK) + if (string_eq(api_selection, "VK_USE_PLATFORM_MACOS_MVK")) return "VK_MVK_macos_surface"; +#endif +#if defined(VK_USE_PLATFORM_METAL_EXT) + if (string_eq(api_selection, "VK_USE_PLATFORM_METAL_EXT")) return "VK_EXT_metal_surface"; + return "VK_EXT_metal_surface"; +#endif +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + return "VK_QNX_screen_surface"; +#elif defined(VK_USE_PLATFORM_VI_NN) + return "VK_NN_vi_surface"; +#elif defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WAYLAND_KHR) +#if defined(VK_USE_PLATFORM_XCB_KHR) + if (string_eq(api_selection, "VK_USE_PLATFORM_XCB_KHR")) return "VK_KHR_xcb_surface"; +#endif +#if defined(VK_USE_PLATFORM_XLIB_KHR) + if (string_eq(api_selection, "VK_USE_PLATFORM_XLIB_KHR")) return "VK_KHR_xlib_surface"; +#endif +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + if (string_eq(api_selection, "VK_USE_PLATFORM_WAYLAND_KHR")) return "VK_KHR_wayland_surface"; +#endif +#if defined(VK_USE_PLATFORM_XCB_KHR) + return "VK_KHR_xcb_surface"; +#endif +#elif defined(VK_USE_PLATFORM_WIN32_KHR) + return "VK_KHR_win32_surface"; +#else + return "VK_KHR_display"; +#endif } +bool string_eq(const char* a, const char* b) noexcept { return a && b && strcmp(a, b) == 0; } +bool string_eq(const char* a, const char* b, size_t len) noexcept { return a && b && strncmp(a, b, len) == 0; } + InstanceCreateInfo::InstanceCreateInfo() { instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; application_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; @@ -665,15 +579,41 @@ InstanceCreateInfo& InstanceCreateInfo::set_api_version(uint32_t major, uint32_t this->api_version = VK_MAKE_API_VERSION(0, major, minor, patch); return *this; } +InstanceCreateInfo& InstanceCreateInfo::setup_WSI(const char* api_selection) { + add_extensions({"VK_KHR_surface", get_platform_wsi_extension(api_selection)}); + return *this; +} DeviceQueueCreateInfo::DeviceQueueCreateInfo() { queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; } +DeviceQueueCreateInfo::DeviceQueueCreateInfo(const VkDeviceQueueCreateInfo* create_info) { + queue_create_info = *create_info; + for (uint32_t i = 0; i < create_info->queueCount; i++) { + priorities.push_back(create_info->pQueuePriorities[i]); + } +} VkDeviceQueueCreateInfo DeviceQueueCreateInfo::get() noexcept { queue_create_info.pQueuePriorities = priorities.data(); + queue_create_info.queueCount = 1; + queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; return queue_create_info; } +DeviceCreateInfo::DeviceCreateInfo(const VkDeviceCreateInfo* create_info) { + dev = *create_info; + for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) { + enabled_extensions.push_back(create_info->ppEnabledExtensionNames[i]); + } + for (uint32_t i = 0; i < create_info->enabledLayerCount; i++) { + enabled_layers.push_back(create_info->ppEnabledLayerNames[i]); + } + for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++) { + device_queue_infos.push_back(create_info->pQueueCreateInfos[i]); + } +} + VkDeviceCreateInfo* DeviceCreateInfo::get() noexcept { + dev.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; dev.enabledLayerCount = static_cast(enabled_layers.size()); dev.ppEnabledLayerNames = enabled_layers.data(); dev.enabledExtensionCount = static_cast(enabled_extensions.size()); @@ -681,6 +621,7 @@ VkDeviceCreateInfo* DeviceCreateInfo::get() noexcept { uint32_t index = 0; for (auto& queue : queue_info_details) { queue.queue_create_info.queueFamilyIndex = index++; + queue.queue_create_info.queueCount = 1; device_queue_infos.push_back(queue.get()); } diff --git a/tests/framework/test_util.h b/tests/framework/test_util.h index 37791c26566435238b59808a16b13481aeead1c7..1386151cd941694fc2631e0d2e8ad080b6536b20 100644 --- a/tests/framework/test_util.h +++ b/tests/framework/test_util.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 The Khronos Group Inc. - * Copyright (c) 2021 Valve Corporation - * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -37,7 +37,6 @@ * LibraryWrapper - RAII wrapper for a library * DispatchableHandle - RAII wrapper for vulkan dispatchable handle objects * ostream overload for VkResult - prettifies googletest output - * VulkanFunctions - loads vulkan functions for tests to use * Instance & Device create info helpers * operator == overloads for many vulkan structs - more concise tests */ @@ -62,11 +61,19 @@ #include #include +// Set of platforms with a common set of functionality which is queried throughout the program +#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNX__) || defined(__FreeBSD__) || \ + defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) +#define COMMON_UNIX_PLATFORMS 1 +#else +#define COMMON_UNIX_PLATFORMS 0 +#endif + #if defined(WIN32) #include #include #include -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS #include #include #include @@ -95,25 +102,72 @@ #define FRAMEWORK_EXPORT #endif +#include "json_writer.h" + +// get_env_var() - returns a std::string of `name`. if report_failure is true, then it will log to stderr that it didn't find the +// env-var +// NOTE: This is only intended for test framework code, all test code MUST use EnvVarWrapper +std::string get_env_var(std::string const& name, bool report_failure = true); + /* - * Common Environment Variable operations - * These operate on the actual environemnt, they are not shims. - * set_env_var - sets the env-var with `name` to `value`. - * remove_env_var - unsets the env-var `name`. Different than set_env_var(name, ""); - * get_env_var - returns a std::string of `name`. if report_failure is true, then it will log to stderr that it didn't find the - * env-var + * Wrapper around Environment Variables with common operations + * Since Environment Variables leak between tests, there needs to be RAII code to remove them during test cleanup + */ -#if defined(WIN32) -void set_env_var(std::string const& name, std::string const& value); -void remove_env_var(std::string const& name); -std::string get_env_var(std::string const& name, bool report_failure = true); +// Wrapper to set & remove env-vars automatically +struct EnvVarWrapper { + // Constructor which unsets the env-var + EnvVarWrapper(std::string const& name) noexcept : name(name) { + initial_value = get_env_var(name, false); + remove_env_var(); + } + // Constructor which set the env-var to the specified value + EnvVarWrapper(std::string const& name, std::string const& value) noexcept : name(name), cur_value(value) { + initial_value = get_env_var(name, false); + set_env_var(); + } + ~EnvVarWrapper() noexcept { + remove_env_var(); + if (!initial_value.empty()) { + set_new_value(initial_value); + } + } -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) -void set_env_var(std::string const& name, std::string const& value); -void remove_env_var(std::string const& name); -std::string get_env_var(std::string const& name, bool report_failure = true); + // delete copy operators + EnvVarWrapper(const EnvVarWrapper&) = delete; + EnvVarWrapper& operator=(const EnvVarWrapper&) = delete; + + void set_new_value(std::string const& value) { + cur_value = value; + set_env_var(); + } + void add_to_list(std::string const& list_item) { + if (!cur_value.empty()) { + cur_value += OS_ENV_VAR_LIST_SEPARATOR; + } + cur_value += list_item; + set_env_var(); + } + void remove_value() const { remove_env_var(); } + const char* get() const { return name.c_str(); } + const char* value() const { return cur_value.c_str(); } + + private: + std::string name; + std::string cur_value; + std::string initial_value; + + void set_env_var(); + void remove_env_var() const; +#if defined(WIN32) + // Environment variable list separator - not for filesystem paths + const char OS_ENV_VAR_LIST_SEPARATOR = ';'; +#elif COMMON_UNIX_PLATFORMS + // Environment variable list separator - not for filesystem paths + const char OS_ENV_VAR_LIST_SEPARATOR = ':'; #endif +}; // Windows specific error handling logic #if defined(WIN32) @@ -126,22 +180,13 @@ void print_error_message(LSTATUS status, const char* function_name, std::string struct ManifestICD; // forward declaration for FolderManager::write struct ManifestLayer; // forward declaration for FolderManager::write -#ifdef _WIN32 -// Environment variable list separator - not for filesystem paths -const char OS_ENV_VAR_LIST_SEPARATOR = ';'; -#else -// Environment variable list separator - not for filesystem paths -const char OS_ENV_VAR_LIST_SEPARATOR = ':'; -#endif - namespace fs { std::string make_native(std::string const&); struct path { - private: #if defined(WIN32) static const char path_separator = '\\'; -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS static const char path_separator = '/'; #endif @@ -170,12 +215,12 @@ struct path { path operator/(std::string const& in) const; path operator/(const char* in) const; - // accesors - path parent_path() const; - bool has_parent_path() const; - path filename() const; - path extension() const; - path stem() const; + // accessors + path parent_path() const; // Everything before the last path separator, if there is one. + bool has_parent_path() const; // True if the path contains more than just a filename. + path filename() const; // Everything after the last path separator. + path extension() const; // The file extension, if it has one. + path stem() const; // The filename minus the extension. // modifiers path& replace_filename(path const& replacement); @@ -210,8 +255,12 @@ class FolderManager { FolderManager(FolderManager&& other) noexcept; FolderManager& operator=(FolderManager&& other) noexcept; + // Add a manifest to the folder path write_manifest(std::string const& name, std::string const& contents); + // Add an already existing file to the manager, so it will be cleaned up automatically + void add_existing_file(std::string const& file_name); + // close file handle, delete file, remove `name` from managed file list. void remove(std::string const& name); @@ -233,17 +282,7 @@ class FolderManager { // src - std::string to read from // dst - char array to write to // size_dst - number of characters in the dst array -inline void copy_string_to_char_array(std::string const& src, char* dst, size_t size_dst) { -// Creates a spurious C4996 Warning in VS 2015 - ignore it -#if defined(WIN32) -#pragma warning(push) -#pragma warning(disable : 4996) -#endif - dst[src.copy(dst, size_dst - 1)] = 0; -#if defined(WIN32) -#pragma warning(pop) -#endif -} +inline void copy_string_to_char_array(std::string const& src, char* dst, size_t size_dst) { dst[src.copy(dst, size_dst - 1)] = 0; } #if defined(WIN32) // Convert an UTF-16 wstring to an UTF-8 string @@ -254,7 +293,7 @@ std::wstring widen(const std::string& utf8); #if defined(WIN32) typedef HMODULE loader_platform_dl_handle; -static loader_platform_dl_handle loader_platform_open_library(const char* lib_path) { +inline loader_platform_dl_handle loader_platform_open_library(const char* lib_path) { std::wstring lib_path_utf16 = widen(lib_path); // Try loading the library the original way first. loader_platform_dl_handle lib_handle = LoadLibraryW(lib_path_utf16.c_str()); @@ -267,7 +306,7 @@ static loader_platform_dl_handle loader_platform_open_library(const char* lib_pa } inline char* loader_platform_open_library_error(const char* libPath) { static char errorMsg[164]; - (void)snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\" with error %lu", libPath, GetLastError()); + snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\" with error %lu", libPath, GetLastError()); return errorMsg; } inline void loader_platform_close_library(loader_platform_dl_handle library) { FreeLibrary(library); } @@ -278,24 +317,24 @@ inline void* loader_platform_get_proc_address(loader_platform_dl_handle library, } inline char* loader_platform_get_proc_address_error(const char* name) { static char errorMsg[120]; - (void)snprintf(errorMsg, 119, "Failed to find function \"%s\" in dynamic library", name); + snprintf(errorMsg, 119, "Failed to find function \"%s\" in dynamic library", name); return errorMsg; } -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif COMMON_UNIX_PLATFORMS typedef void* loader_platform_dl_handle; inline loader_platform_dl_handle loader_platform_open_library(const char* libPath) { return dlopen(libPath, RTLD_LAZY | RTLD_LOCAL); } -inline const char* loader_platform_open_library_error(const char* libPath) { return dlerror(); } +inline const char* loader_platform_open_library_error([[maybe_unused]] const char* libPath) { return dlerror(); } inline void loader_platform_close_library(loader_platform_dl_handle library) { dlclose(library); } inline void* loader_platform_get_proc_address(loader_platform_dl_handle library, const char* name) { assert(library); assert(name); return dlsym(library, name); } -inline const char* loader_platform_get_proc_address_error(const char* name) { return dlerror(); } +inline const char* loader_platform_get_proc_address_error([[maybe_unused]] const char* name) { return dlerror(); } #endif class FromVoidStarFunc { @@ -487,10 +526,16 @@ inline std::ostream& operator<<(std::ostream& os, const VkResult& result) { return os << "VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR"; case (VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR): return os << "VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR"; + case (VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR): + return os << "VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR"; + case (VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT): + return os << "VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT"; } return os << static_cast(result); } +const char* get_platform_wsi_extension([[maybe_unused]] const char* api_selection); + bool string_eq(const char* a, const char* b) noexcept; bool string_eq(const char* a, const char* b, size_t len) noexcept; @@ -540,20 +585,17 @@ struct ManifestVersion { BUILDER_VALUE(ManifestVersion, uint32_t, major, 1) BUILDER_VALUE(ManifestVersion, uint32_t, minor, 0) BUILDER_VALUE(ManifestVersion, uint32_t, patch, 0) - ManifestVersion() noexcept {}; - ManifestVersion(uint32_t major, uint32_t minor, uint32_t patch) noexcept : major(major), minor(minor), patch(patch){}; std::string get_version_str() const noexcept { - return std::string("\"file_format_version\": \"") + std::to_string(major) + "." + std::to_string(minor) + "." + - std::to_string(patch) + "\","; + return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(patch); } }; // ManifestICD builder struct ManifestICD { - BUILDER_VALUE(ManifestICD, ManifestVersion, file_format_version, ManifestVersion()) + BUILDER_VALUE(ManifestICD, ManifestVersion, file_format_version, {}) BUILDER_VALUE(ManifestICD, uint32_t, api_version, 0) - BUILDER_VALUE(ManifestICD, std::string, lib_path, {}) + BUILDER_VALUE(ManifestICD, fs::path, lib_path, {}) BUILDER_VALUE(ManifestICD, bool, is_portability_driver, false) BUILDER_VALUE(ManifestICD, std::string, library_arch, "") std::string get_manifest_str() const; @@ -575,7 +617,7 @@ struct ManifestLayer { BUILDER_VALUE(FunctionOverride, std::string, vk_func, {}) BUILDER_VALUE(FunctionOverride, std::string, override_name, {}) - std::string get_manifest_str() const { return std::string("\"") + vk_func + "\":\"" + override_name + "\""; } + void get_manifest_str(JsonWriter& writer) const { writer.AddKeyedString(vk_func, override_name); } }; struct Extension { Extension() noexcept {} @@ -584,7 +626,7 @@ struct ManifestLayer { std::string name; uint32_t spec_version = 0; std::vector entrypoints; - std::string get_manifest_str() const; + void get_manifest_str(JsonWriter& writer) const; }; BUILDER_VALUE(LayerDescription, std::string, name, {}) BUILDER_VALUE(LayerDescription, Type, type, Type::INSTANCE) @@ -604,7 +646,7 @@ struct ManifestLayer { BUILDER_VECTOR(LayerDescription, std::string, app_keys, app_key) BUILDER_VALUE(LayerDescription, std::string, library_arch, "") - std::string get_manifest_str() const; + void get_manifest_str(JsonWriter& writer) const; VkLayerProperties get_layer_properties() const; }; BUILDER_VALUE(ManifestLayer, ManifestVersion, file_format_version, {}) @@ -634,151 +676,9 @@ struct MockQueueFamilyProperties { BUILDER_VALUE(MockQueueFamilyProperties, VkQueueFamilyProperties, properties, {}) BUILDER_VALUE(MockQueueFamilyProperties, bool, support_present, false) - MockQueueFamilyProperties() {} - - MockQueueFamilyProperties(VkQueueFamilyProperties properties, bool support_present = false) - : properties(properties), support_present(support_present) {} - VkQueueFamilyProperties get() const noexcept { return properties; } }; -struct VulkanFunctions { - LibraryWrapper loader; - - // Pre-Instance - PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = nullptr; - PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties = nullptr; - PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties = nullptr; - PFN_vkEnumerateInstanceVersion vkEnumerateInstanceVersion = nullptr; - PFN_vkCreateInstance vkCreateInstance = nullptr; - - // Instance - PFN_vkDestroyInstance vkDestroyInstance = nullptr; - PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices = nullptr; - PFN_vkEnumeratePhysicalDeviceGroups vkEnumeratePhysicalDeviceGroups = nullptr; - PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures = nullptr; - PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2 = nullptr; - PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties = nullptr; - PFN_vkGetPhysicalDeviceFormatProperties2 vkGetPhysicalDeviceFormatProperties2 = nullptr; - PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties = nullptr; - PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2 = nullptr; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties = nullptr; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 vkGetPhysicalDeviceSparseImageFormatProperties2 = nullptr; - PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties = nullptr; - PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2 = nullptr; - PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties = nullptr; - PFN_vkGetPhysicalDeviceQueueFamilyProperties2 vkGetPhysicalDeviceQueueFamilyProperties2 = nullptr; - PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties = nullptr; - PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2 = nullptr; - PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR = nullptr; - PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR = nullptr; - PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR = nullptr; - PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR = nullptr; - PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties = nullptr; - PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties = nullptr; - PFN_vkGetPhysicalDeviceExternalBufferProperties vkGetPhysicalDeviceExternalBufferProperties = nullptr; - PFN_vkGetPhysicalDeviceExternalFenceProperties vkGetPhysicalDeviceExternalFenceProperties = nullptr; - PFN_vkGetPhysicalDeviceExternalSemaphoreProperties vkGetPhysicalDeviceExternalSemaphoreProperties = nullptr; - - PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr = nullptr; - PFN_vkCreateDevice vkCreateDevice = nullptr; - PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT = nullptr; - PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT = nullptr; - - // WSI - PFN_vkCreateHeadlessSurfaceEXT vkCreateHeadlessSurfaceEXT = nullptr; - PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vkGetPhysicalDeviceDisplayPropertiesKHR = nullptr; - PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vkGetPhysicalDeviceDisplayPlanePropertiesKHR = nullptr; - PFN_vkGetDisplayPlaneSupportedDisplaysKHR vkGetDisplayPlaneSupportedDisplaysKHR = nullptr; - PFN_vkGetDisplayModePropertiesKHR vkGetDisplayModePropertiesKHR = nullptr; - PFN_vkCreateDisplayModeKHR vkCreateDisplayModeKHR = nullptr; - PFN_vkGetDisplayPlaneCapabilitiesKHR vkGetDisplayPlaneCapabilitiesKHR = nullptr; - PFN_vkGetPhysicalDevicePresentRectanglesKHR vkGetPhysicalDevicePresentRectanglesKHR = nullptr; - PFN_vkGetPhysicalDeviceDisplayProperties2KHR vkGetPhysicalDeviceDisplayProperties2KHR = nullptr; - PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR vkGetPhysicalDeviceDisplayPlaneProperties2KHR = nullptr; - PFN_vkGetDisplayModeProperties2KHR vkGetDisplayModeProperties2KHR = nullptr; - PFN_vkGetDisplayPlaneCapabilities2KHR vkGetDisplayPlaneCapabilities2KHR = nullptr; - PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR vkGetPhysicalDeviceSurfaceCapabilities2KHR = nullptr; - PFN_vkGetPhysicalDeviceSurfaceFormats2KHR vkGetPhysicalDeviceSurfaceFormats2KHR = nullptr; - -#ifdef VK_USE_PLATFORM_ANDROID_KHR - PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR = nullptr; -#endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT - PFN_vkCreateDirectFBSurfaceEXT vkCreateDirectFBSurfaceEXT = nullptr; - PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT vkGetPhysicalDeviceDirectFBPresentationSupportEXT = nullptr; -#endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_FUCHSIA - PFN_vkCreateImagePipeSurfaceFUCHSIA vkCreateImagePipeSurfaceFUCHSIA = nullptr; -#endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_GGP - PFN_vkCreateStreamDescriptorSurfaceGGP vkCreateStreamDescriptorSurfaceGGP = nullptr; -#endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_IOS_MVK - PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK = nullptr; -#endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_MACOS_MVK - PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK = nullptr; -#endif // VK_USE_PLATFORM_MACOS_MVK -#ifdef VK_USE_PLATFORM_METAL_EXT - PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT = nullptr; -#endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX - PFN_vkCreateScreenSurfaceQNX vkCreateScreenSurfaceQNX = nullptr; - PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX vkGetPhysicalDeviceScreenPresentationSupportQNX = nullptr; -#endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR vkGetPhysicalDeviceWaylandPresentationSupportKHR = nullptr; -#endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR - PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR vkGetPhysicalDeviceXcbPresentationSupportKHR = nullptr; -#endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR - PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR vkGetPhysicalDeviceXlibPresentationSupportKHR = nullptr; -#endif // VK_USE_PLATFORM_XLIB_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR - PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR vkGetPhysicalDeviceWin32PresentationSupportKHR = nullptr; -#endif // VK_USE_PLATFORM_WIN32_KHR - PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR = nullptr; - - // device functions - PFN_vkDestroyDevice vkDestroyDevice = nullptr; - PFN_vkGetDeviceQueue vkGetDeviceQueue = nullptr; - - VulkanFunctions(); - - FromVoidStarFunc load(VkInstance inst, const char* func_name) const { - return FromVoidStarFunc(vkGetInstanceProcAddr(inst, func_name)); - } - - FromVoidStarFunc load(VkDevice device, const char* func_name) const { - return FromVoidStarFunc(vkGetDeviceProcAddr(device, func_name)); - } -}; - -struct DeviceFunctions { - PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr = nullptr; - PFN_vkDestroyDevice vkDestroyDevice = nullptr; - PFN_vkGetDeviceQueue vkGetDeviceQueue = nullptr; - PFN_vkCreateCommandPool vkCreateCommandPool = nullptr; - PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers = nullptr; - PFN_vkDestroyCommandPool vkDestroyCommandPool = nullptr; - PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR = nullptr; - PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR = nullptr; - - DeviceFunctions() = default; - DeviceFunctions(const VulkanFunctions& vulkan_functions, VkDevice device); - - FromVoidStarFunc load(VkDevice device, const char* func_name) const { - return FromVoidStarFunc(vkGetDeviceProcAddr(device, func_name)); - } -}; - struct InstanceCreateInfo { BUILDER_VALUE(InstanceCreateInfo, VkInstanceCreateInfo, instance_info, {}) BUILDER_VALUE(InstanceCreateInfo, VkApplicationInfo, application_info, {}) @@ -798,17 +698,24 @@ struct InstanceCreateInfo { VkInstanceCreateInfo* get() noexcept; InstanceCreateInfo& set_api_version(uint32_t major, uint32_t minor, uint32_t patch); + + InstanceCreateInfo& setup_WSI(const char* api_selection = nullptr); }; struct DeviceQueueCreateInfo { + DeviceQueueCreateInfo(); + DeviceQueueCreateInfo(const VkDeviceQueueCreateInfo* create_info); + BUILDER_VALUE(DeviceQueueCreateInfo, VkDeviceQueueCreateInfo, queue_create_info, {}) BUILDER_VECTOR(DeviceQueueCreateInfo, float, priorities, priority) - DeviceQueueCreateInfo(); VkDeviceQueueCreateInfo get() noexcept; }; struct DeviceCreateInfo { + DeviceCreateInfo() = default; + DeviceCreateInfo(const VkDeviceCreateInfo* create_info); + BUILDER_VALUE(DeviceCreateInfo, VkDeviceCreateInfo, dev, {}) BUILDER_VECTOR(DeviceCreateInfo, const char*, enabled_extensions, extension) BUILDER_VECTOR(DeviceCreateInfo, const char*, enabled_layers, layer) @@ -844,36 +751,26 @@ inline bool operator!=(const VkExtensionProperties& a, const VkExtensionProperti struct VulkanFunction { std::string name; - PFN_vkVoidFunction function; + PFN_vkVoidFunction function = nullptr; }; template bool check_permutation(std::initializer_list expected, std::array const& returned) { if (expected.size() != returned.size()) return false; for (uint32_t i = 0; i < expected.size(); i++) { - bool found = false; - for (auto& elem : returned) { - if (string_eq(*(expected.begin() + i), elem.layerName)) { - found = true; - break; - } - } - if (!found) return false; + auto found = std::find_if(std::begin(returned), std::end(returned), + [&](T elem) { return string_eq(*(expected.begin() + i), elem.layerName); }); + if (found == std::end(returned)) return false; } return true; } -template +template bool check_permutation(std::initializer_list expected, std::vector const& returned) { if (expected.size() != returned.size()) return false; for (uint32_t i = 0; i < expected.size(); i++) { - bool found = false; - for (auto& elem : returned) { - if (string_eq(*(expected.begin() + i), elem.layerName)) { - found = true; - break; - } - } - if (!found) return false; + auto found = std::find_if(std::begin(returned), std::end(returned), + [&](T elem) { return string_eq(*(expected.begin() + i), elem.layerName); }); + if (found == std::end(returned)) return false; } return true; } @@ -887,10 +784,10 @@ inline bool contains(std::vector const& vec, const char* name [name](VkLayerProperties const& elem) { return string_eq(name, elem.layerName); }); } -#if defined(__linux__) +#if defined(__linux__) || defined(__GNU__) // find application path + name. Path cannot be longer than 1024, returns NULL if it is greater than that. -static inline std::string test_platform_executable_path() { +inline std::string test_platform_executable_path() { std::string buffer; buffer.resize(1024); ssize_t count = readlink("/proc/self/exe", &buffer[0], buffer.size()); @@ -900,13 +797,13 @@ static inline std::string test_platform_executable_path() { buffer.resize(count); return buffer; } -#elif defined(__APPLE__) // defined(__linux__) +#elif defined(__APPLE__) #include -static inline std::string test_platform_executable_path() { +inline std::string test_platform_executable_path() { std::string buffer; buffer.resize(1024); pid_t pid = getpid(); - int ret = proc_pidpath(pid, &buffer[0], buffer.size()); + int ret = proc_pidpath(pid, &buffer[0], static_cast(buffer.size())); if (ret <= 0) return NULL; buffer[ret] = '\0'; buffer.resize(ret); @@ -914,7 +811,7 @@ static inline std::string test_platform_executable_path() { } #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) #include -static inline std::string test_platform_executable_path() { +inline std::string test_platform_executable_path() { int mib[] = { CTL_KERN, #if defined(__NetBSD__) @@ -938,15 +835,15 @@ static inline std::string test_platform_executable_path() { return buffer; } #elif defined(__Fuchsia__) || defined(__OpenBSD__) -static inline std::string test_platform_executable_path() { return {}; } -#elif defined(__QNXNTO__) +inline std::string test_platform_executable_path() { return {}; } +#elif defined(__QNX__) #define SYSCONFDIR "/etc" #include #include -static inline std::string test_platform_executable_path() { +inline std::string test_platform_executable_path() { std::string buffer; buffer.resize(1024); int fd = open("/proc/self/exefile", O_RDONLY); @@ -966,9 +863,9 @@ static inline std::string test_platform_executable_path() { return buffer; } -#endif // defined (__QNXNTO__) +#endif // defined (__QNX__) #if defined(WIN32) -static inline std::string test_platform_executable_path() { +inline std::string test_platform_executable_path() { std::string buffer; buffer.resize(1024); DWORD ret = GetModuleFileName(NULL, static_cast(&buffer[0]), (DWORD)buffer.size()); @@ -978,4 +875,13 @@ static inline std::string test_platform_executable_path() { buffer[ret] = '\0'; return buffer; } + +inline std::wstring conver_str_to_wstr(std::string const& input) { + std::wstring output{}; + output.resize(input.size()); + size_t characters_converted = 0; + mbstowcs_s(&characters_converted, &output[0], output.size() + 1, input.c_str(), input.size()); + return output; +} + #endif diff --git a/scripts/check_code_format.sh b/tests/integration/CMakeLists.txt old mode 100755 new mode 100644 similarity index 38% rename from scripts/check_code_format.sh rename to tests/integration/CMakeLists.txt index dde4379482538042bc94428288656c52edbdaf4b..f15685222beb6df929a7f1e76308471da86e148e --- a/scripts/check_code_format.sh +++ b/tests/integration/CMakeLists.txt @@ -1,6 +1,7 @@ -#!/bin/bash -# Copyright (c) 2017 Google Inc. - +# ~~~ +# Copyright (c) 2023 Valve Corporation +# Copyright (c) 2023 LunarG, Inc. +# # 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 @@ -12,30 +13,27 @@ # 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. -# -# Script to determine if source code in Pull Request is properly formatted. -# Exits with non 0 exit code if formatting is needed. -# -# This script assumes to be invoked at the project root directory. +# ~~~ +cmake_minimum_required(VERSION 3.17.2) -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color +project(INTEGRATION LANGUAGES C) -FILES_TO_CHECK=$(git diff --name-only master | grep -v -E "^include/vulkan" | grep -E ".*\.(cpp|cc|c\+\+|cxx|c|h|hpp)$") +find_package(VulkanLoader REQUIRED CONFIG) -if [ -z "${FILES_TO_CHECK}" ]; then - echo -e "${GREEN}No source code to check for formatting.${NC}" - exit 0 -fi +# The intent is ensuring we don't accidentally change the names of these +# targets. Since it would break downstream users. +if (NOT TARGET Vulkan::Loader) + message(FATAL_ERROR "Vulkan::Loader target not defined!") +endif() -FORMAT_DIFF=$(git diff -U0 master -- ${FILES_TO_CHECK} | python ./scripts/clang-format-diff.py -p1 -style=file) +if (NOT DEFINED VulkanLoader_VERSION) + message(FATAL_ERROR "VulkanLoader_VERSION not defined!") +endif() +message(STATUS "VulkanLoader_VERSION = ${VulkanLoader_VERSION}") -if [ -z "${FORMAT_DIFF}" ]; then - echo -e "${GREEN}All source code in PR properly formatted.${NC}" - exit 0 -else - echo -e "${RED}Found formatting errors!${NC}" - echo "${FORMAT_DIFF}" - exit 1 -fi +# NOTE: This check is NOT sufficient to ensure vulkan.pc is actually valid +find_package(PkgConfig) +if(PKG_CONFIG_FOUND) + find_file(VULKAN_PC vulkan.pc PATH_SUFFIXES lib/pkgconfig REQUIRED) + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --validate ${VULKAN_PC}) +endif() diff --git a/tests/live_verification/CMakeLists.txt b/tests/live_verification/CMakeLists.txt index 87155e23ac6e2910fa26f0b22c16323730ae0eda..3873c2dab53859194ec7e303d001cf0ef497cdfb 100644 --- a/tests/live_verification/CMakeLists.txt +++ b/tests/live_verification/CMakeLists.txt @@ -17,16 +17,14 @@ add_executable(dynamic_rendering_get_proc_addr dynamic_rendering_get_proc_addr.cpp) target_link_libraries(dynamic_rendering_get_proc_addr testing_dependencies) -set_target_properties(dynamic_rendering_get_proc_addr ${LOADER_STANDARD_CXX_PROPERTIES}) add_subdirectory(dynamic_loader_behavior) -if(APPLE AND BUILD_STATIC_LOADER) +if(APPLE_STATIC_LOADER) add_executable(macos_static_loader_build macos_static_loader_build.cpp) target_link_libraries(macos_static_loader_build loader_common_options vulkan Vulkan::Headers) - set_target_properties(macos_static_loader_build ${LOADER_STANDARD_CXX_PROPERTIES}) if (TEST_USE_THREAD_SANITIZER) target_compile_options(macos_static_loader_build PUBLIC -fsanitize=thread) target_link_options(macos_static_loader_build PUBLIC -fsanitize=thread) endif() -endif() \ No newline at end of file +endif() diff --git a/tests/live_verification/dynamic_loader_behavior/CMakeLists.txt b/tests/live_verification/dynamic_loader_behavior/CMakeLists.txt index ef174c918d896dd89e873fd999b41dd918ca8141..67eacd5ad87e834a34c82435fcf5664577ce22a6 100644 --- a/tests/live_verification/dynamic_loader_behavior/CMakeLists.txt +++ b/tests/live_verification/dynamic_loader_behavior/CMakeLists.txt @@ -21,17 +21,14 @@ else() add_library(dynamic_library_a dynamic_library.cpp) target_link_libraries(dynamic_library_a PUBLIC testing_framework_util) target_compile_definitions(dynamic_library_a PRIVATE PRINT_OUTPUT_A) -set_target_properties(dynamic_library_a ${LOADER_STANDARD_CXX_PROPERTIES}) add_library(dynamic_library_b dynamic_library.cpp) target_link_libraries(dynamic_library_b PUBLIC testing_framework_util) target_compile_definitions(dynamic_library_b PRIVATE PRINT_OUTPUT_B) -set_target_properties(dynamic_library_b ${LOADER_STANDARD_CXX_PROPERTIES}) add_library(dynamic_library_c dynamic_library.cpp) target_link_libraries(dynamic_library_c PUBLIC testing_framework_util) target_compile_definitions(dynamic_library_c PRIVATE PRINT_OUTPUT_C) -set_target_properties(dynamic_library_c ${LOADER_STANDARD_CXX_PROPERTIES}) add_executable(test_dynamic_linking_a_first test_dynamic_linking.cpp) add_executable(test_dynamic_linking_b_first test_dynamic_linking.cpp) @@ -39,19 +36,14 @@ add_executable(test_dynamic_linking_c_then_load test_dynamic_linking.cpp) target_link_libraries(test_dynamic_linking_a_first PUBLIC dynamic_library_a dynamic_library_b) target_link_libraries(test_dynamic_linking_b_first PUBLIC dynamic_library_b dynamic_library_a) target_link_libraries(test_dynamic_linking_c_then_load PUBLIC dynamic_library_c) -set_target_properties(test_dynamic_linking_a_first ${LOADER_STANDARD_CXX_PROPERTIES}) -set_target_properties(test_dynamic_linking_b_first ${LOADER_STANDARD_CXX_PROPERTIES}) -set_target_properties(test_dynamic_linking_c_then_load ${LOADER_STANDARD_CXX_PROPERTIES}) target_compile_definitions(test_dynamic_linking_c_then_load PRIVATE PRINT_OUTPUT_C) add_executable(test_dynamic_loading test_dynamic_loading.cpp) target_link_libraries(test_dynamic_loading PUBLIC testing_framework_util) -set_target_properties(test_dynamic_loading ${LOADER_STANDARD_CXX_PROPERTIES}) add_executable(test_dynamic_loading_and_linking test_dynamic_loading_and_linking.cpp) target_link_libraries(test_dynamic_loading_and_linking PUBLIC testing_framework_util) target_link_libraries(test_dynamic_loading_and_linking PUBLIC dynamic_library_a) -set_target_properties(test_dynamic_loading_and_linking ${LOADER_STANDARD_CXX_PROPERTIES}) -endif() \ No newline at end of file +endif() diff --git a/tests/live_verification/dynamic_loader_behavior/dynamic_library.h b/tests/live_verification/dynamic_loader_behavior/dynamic_library.h index 8b6e29a4c7eda542ae2b6f6d8bf29aff6a839a05..1d88d306e65a92ce8ca2e0d1a10a331fd7677ac0 100644 --- a/tests/live_verification/dynamic_loader_behavior/dynamic_library.h +++ b/tests/live_verification/dynamic_loader_behavior/dynamic_library.h @@ -39,15 +39,15 @@ FRAMEWORK_EXPORT void init(); }; #if defined(WIN32) -#ifndef LIB_EXT +#if !defined(LIB_EXT) #define LIB_EXT "dll" #endif #elif defined(__APPLE__) -#ifndef LIB_EXT +#if !defined(LIB_EXT) #define LIB_EXT "dylib" #endif #else -#ifndef LIB_EXT +#if !defined(LIB_EXT) #define LIB_EXT "so" #endif -#endif \ No newline at end of file +#endif diff --git a/tests/live_verification/dynamic_rendering_get_proc_addr.cpp b/tests/live_verification/dynamic_rendering_get_proc_addr.cpp index f4a521fbcd15640924c258049ed3c5f9abd39b22..61144f760de1e44abda4d19395afb96948f06380 100644 --- a/tests/live_verification/dynamic_rendering_get_proc_addr.cpp +++ b/tests/live_verification/dynamic_rendering_get_proc_addr.cpp @@ -40,7 +40,17 @@ int main() { auto phys_devs = inst.GetPhysDevs(); for (const auto& phys_dev : phys_devs) { - auto extensions = EnumerateDeviceExtensions(inst, phys_dev); + uint32_t count = 0; + VkResult res = vk_funcs.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &count, nullptr); + if (res != VK_SUCCESS) { + std::cout << "Failed to query device extension count\n"; + } + std::vector extensions{count}; + res = vk_funcs.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &count, extensions.data()); + if (res != VK_SUCCESS) { + std::cout << "Failed to query device extensions\n"; + } + bool has_dynamic_rendering = false; for (const auto& ext : extensions) { if (string_eq("VK_KHR_dynamic_rendering", ext.extensionName)) { @@ -68,8 +78,10 @@ int main() { reinterpret_cast(vk_funcs.vkGetInstanceProcAddr(inst.inst, "vkBeginCommandBuffer")); VkCommandBufferBeginInfo begin_info{}; begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; - VkResult res = vkBeginCommandBuffer(command_buffer, &begin_info); - assert(res == VK_SUCCESS); + res = vkBeginCommandBuffer(command_buffer, &begin_info); + if (res != VK_SUCCESS) { + std::cout << "Failed to begin command buffer\n"; + } // call the dynamic rendering function -- should not go into the physical device function trampoline. PFN_vkCmdBeginRenderingKHR vkCmdBeginRenderingKHR = @@ -79,4 +91,4 @@ int main() { vkCmdBeginRenderingKHR(command_buffer, &rendering_info); } } -} \ No newline at end of file +} diff --git a/tests/loader_alloc_callback_tests.cpp b/tests/loader_alloc_callback_tests.cpp index 4f3ea16e1c14cec0ca56ff834640db8b0d360eea..1c31e06e49be22cde872709f0f276eba375d8447 100644 --- a/tests/loader_alloc_callback_tests.cpp +++ b/tests/loader_alloc_callback_tests.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 The Khronos Group Inc. - * Copyright (c) 2021 Valve Corporation - * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -30,13 +30,6 @@ #include struct MemoryTrackerSettings { - MemoryTrackerSettings() = default; - MemoryTrackerSettings(bool should_fail_on_allocation, size_t fail_after_allocations, bool should_fail_after_set_number_of_calls, - size_t fail_after_calls) - : should_fail_on_allocation(should_fail_on_allocation), - fail_after_allocations(fail_after_allocations), - should_fail_after_set_number_of_calls(should_fail_after_set_number_of_calls), - fail_after_calls(fail_after_calls) {} bool should_fail_on_allocation = false; size_t fail_after_allocations = 0; // fail after this number of allocations in total bool should_fail_after_set_number_of_calls = false; @@ -49,61 +42,50 @@ class MemoryTracker { VkAllocationCallbacks callbacks{}; // Implementation internals struct AllocationDetails { + std::unique_ptr allocation; size_t requested_size_bytes; size_t actual_size_bytes; + size_t alignment; VkSystemAllocationScope alloc_scope; }; const static size_t UNKNOWN_ALLOCATION = std::numeric_limits::max(); size_t allocation_count = 0; size_t call_count = 0; - std::vector> allocations; - std::vector allocations_aligned; - std::vector allocation_details; - void add_element(std::unique_ptr&& alloc, void* aligned_alloc, AllocationDetails detail) { - allocations.push_back(std::move(alloc)); - allocations_aligned.push_back(aligned_alloc); - allocation_details.push_back(detail); - } - void erase_index(size_t index) { - allocations.erase(std::next(allocations.begin(), index)); - allocations_aligned.erase(std::next(allocations_aligned.begin(), index)); - allocation_details.erase(std::next(allocation_details.begin(), index)); - } - size_t find_element(void* ptr) { - auto it = std::find(allocations_aligned.begin(), allocations_aligned.end(), ptr); - if (it == allocations_aligned.end()) return UNKNOWN_ALLOCATION; - return it - allocations_aligned.begin(); - } + std::unordered_map allocations; void* allocate(size_t size, size_t alignment, VkSystemAllocationScope alloc_scope) { - if (settings.should_fail_on_allocation && allocation_count == settings.fail_after_allocations) return nullptr; - if (settings.should_fail_after_set_number_of_calls && call_count == settings.fail_after_calls) return nullptr; + if ((settings.should_fail_on_allocation && allocation_count == settings.fail_after_allocations) || + (settings.should_fail_after_set_number_of_calls && call_count == settings.fail_after_calls)) { + return nullptr; + } call_count++; - AllocationDetails detail{size, size + (alignment - 1), alloc_scope}; - auto alloc = std::unique_ptr(new char[detail.actual_size_bytes]); - if (!alloc) return nullptr; - uint64_t addr = (uint64_t)alloc.get(); + allocation_count++; + AllocationDetails detail{nullptr, size, size + (alignment - 1), alignment, alloc_scope}; + detail.allocation = std::unique_ptr(new char[detail.actual_size_bytes]); + if (!detail.allocation) { + abort(); + }; + uint64_t addr = (uint64_t)detail.allocation.get(); addr += (alignment - 1); addr &= ~(alignment - 1); void* aligned_alloc = (void*)addr; - add_element(std::move(alloc), aligned_alloc, detail); - allocation_count++; - return allocations_aligned.back(); + allocations.insert(std::make_pair(aligned_alloc, std::move(detail))); + return aligned_alloc; } void* reallocate(void* pOriginal, size_t size, size_t alignment, VkSystemAllocationScope alloc_scope) { if (pOriginal == nullptr) { return allocate(size, alignment, alloc_scope); } - size_t index = find_element(pOriginal); - if (index == UNKNOWN_ALLOCATION) return nullptr; - size_t original_size = allocation_details[index].requested_size_bytes; + auto elem = allocations.find(pOriginal); + if (elem == allocations.end()) return nullptr; + size_t original_size = elem->second.requested_size_bytes; // We only care about the case where realloc is used to increase the size if (size >= original_size && settings.should_fail_after_set_number_of_calls && call_count == settings.fail_after_calls) return nullptr; call_count++; if (size == 0) { - erase_index(index); + allocations.erase(elem); allocation_count--; return nullptr; } else if (size < original_size) { @@ -111,16 +93,18 @@ class MemoryTracker { } else { void* new_alloc = allocate(size, alignment, alloc_scope); if (new_alloc == nullptr) return nullptr; + allocation_count--; // allocate() increments this, we we don't want that + call_count--; // allocate() also increments this, we don't want that memcpy(new_alloc, pOriginal, original_size); - erase_index(index); + allocations.erase(elem); return new_alloc; } } void free(void* pMemory) { if (pMemory == nullptr) return; - size_t index = find_element(pMemory); - if (index == UNKNOWN_ALLOCATION) return; - erase_index(index); + auto elem = allocations.find(pMemory); + if (elem == allocations.end()) return; + allocations.erase(elem); assert(allocation_count != 0 && "Cant free when there are no valid allocations"); allocation_count--; } @@ -140,22 +124,21 @@ class MemoryTracker { std::lock_guard lg(main_mutex); free(pMemory); } - void impl_internal_allocation_notification(size_t size, VkInternalAllocationType allocationType, - VkSystemAllocationScope allocationScope) noexcept { + void impl_internal_allocation_notification([[maybe_unused]] size_t size, + [[maybe_unused]] VkInternalAllocationType allocationType, + [[maybe_unused]] VkSystemAllocationScope allocationScope) noexcept { std::lock_guard lg(main_mutex); // TODO? } - void impl_internal_free(size_t size, VkInternalAllocationType allocationType, - VkSystemAllocationScope allocationScope) noexcept { + void impl_internal_free([[maybe_unused]] size_t size, [[maybe_unused]] VkInternalAllocationType allocationType, + [[maybe_unused]] VkSystemAllocationScope allocationScope) noexcept { std::lock_guard lg(main_mutex); // TODO? } public: MemoryTracker(MemoryTrackerSettings settings) noexcept : settings(settings) { - allocations.reserve(512); - allocations_aligned.reserve(512); - allocation_details.reserve(512); + allocations.reserve(3000); callbacks.pUserData = this; callbacks.pfnAllocation = public_allocation; @@ -170,9 +153,6 @@ class MemoryTracker { bool empty() noexcept { return allocation_count == 0; } - void update_settings(MemoryTrackerSettings new_settings) noexcept { settings = new_settings; } - size_t current_allocation_count() const noexcept { return allocation_count; } - size_t current_call_count() const noexcept { return call_count; } // Static callbacks static VKAPI_ATTR void* VKAPI_CALL public_allocation(void* pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope) noexcept { @@ -205,7 +185,7 @@ TEST(Allocation, Instance) { MemoryTracker tracker; { InstWrapper inst{env.vulkan_functions, tracker.get()}; - inst.CheckCreate(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); } ASSERT_TRUE(tracker.empty()); } @@ -219,7 +199,7 @@ TEST(Allocation, GetInstanceProcAddr) { MemoryTracker tracker; { InstWrapper inst{env.vulkan_functions, tracker.get()}; - inst.CheckCreate(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); auto* pfnCreateDevice = inst->vkGetInstanceProcAddr(inst, "vkCreateDevice"); auto* pfnDestroyDevice = inst->vkGetInstanceProcAddr(inst, "vkDestroyDevice"); @@ -232,14 +212,12 @@ TEST(Allocation, GetInstanceProcAddr) { // a vkEnumeratePhysicalDevices call pair. TEST(Allocation, EnumeratePhysicalDevices) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); MemoryTracker tracker; - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); { InstWrapper inst{env.vulkan_functions, tracker.get()}; - inst.CheckCreate(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); uint32_t physical_count = 1; uint32_t returned_physical_count = 0; ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, nullptr)); @@ -257,15 +235,15 @@ TEST(Allocation, EnumeratePhysicalDevices) { // allocators used on both the instance and device. TEST(Allocation, InstanceAndDevice) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device(PhysicalDevice{"physical_device_0"} + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}) + .finish()); MemoryTracker tracker; - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); { InstWrapper inst{env.vulkan_functions, tracker.get()}; - inst.CheckCreate(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); uint32_t physical_count = 1; uint32_t returned_physical_count = 0; @@ -289,12 +267,14 @@ TEST(Allocation, InstanceAndDevice) { ASSERT_EQ(family.timestampValidBits, 0U); DeviceCreateInfo dev_create_info; - DeviceQueueCreateInfo queue_info; - queue_info.add_priority(0.0f); - dev_create_info.add_device_queue(queue_info); + dev_create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); VkDevice device; ASSERT_EQ(inst->vkCreateDevice(physical_device, dev_create_info.get(), tracker.get(), &device), VK_SUCCESS); + + VkQueue queue; + inst->vkGetDeviceQueue(device, 0, 0, &queue); + inst->vkDestroyDevice(device, tracker.get()); } ASSERT_TRUE(tracker.empty()); @@ -304,16 +284,15 @@ TEST(Allocation, InstanceAndDevice) { // allocators used on only the instance and not the device. TEST(Allocation, InstanceButNotDevice) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device(PhysicalDevice{"physical_device_0"} + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}) + .finish()); MemoryTracker tracker; { - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); - InstWrapper inst{env.vulkan_functions, tracker.get()}; - inst.CheckCreate(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); uint32_t physical_count = 1; uint32_t returned_physical_count = 0; @@ -337,12 +316,13 @@ TEST(Allocation, InstanceButNotDevice) { ASSERT_EQ(family.timestampValidBits, 0U); DeviceCreateInfo dev_create_info; - DeviceQueueCreateInfo queue_info; - queue_info.add_priority(0.0f); - dev_create_info.add_device_queue(queue_info); + dev_create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); VkDevice device; ASSERT_EQ(inst->vkCreateDevice(physical_device, dev_create_info.get(), nullptr, &device), VK_SUCCESS); + VkQueue queue; + inst->vkGetDeviceQueue(device, 0, 0, &queue); + inst->vkDestroyDevice(device, nullptr); } ASSERT_TRUE(tracker.empty()); @@ -353,9 +333,12 @@ TEST(Allocation, InstanceButNotDevice) { // allocators used on only the device and not the instance. TEST(Allocation, DeviceButNotInstance) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device(PhysicalDevice{"physical_device_0"} + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}) + .finish()); - const char* layer_name = "VkLayerImplicit0"; + const char* layer_name = "VK_LAYER_implicit"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -365,12 +348,8 @@ TEST(Allocation, DeviceButNotInstance) { MemoryTracker tracker; { - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); - InstWrapper inst{env.vulkan_functions}; - inst.CheckCreate(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); uint32_t physical_count = 1; uint32_t returned_physical_count = 0; @@ -394,12 +373,14 @@ TEST(Allocation, DeviceButNotInstance) { ASSERT_EQ(family.timestampValidBits, 0U); DeviceCreateInfo dev_create_info; - DeviceQueueCreateInfo queue_info; - queue_info.add_priority(0.0f); - dev_create_info.add_device_queue(queue_info); + dev_create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); VkDevice device; ASSERT_EQ(inst->vkCreateDevice(physical_device, dev_create_info.get(), tracker.get(), &device), VK_SUCCESS); + + VkQueue queue; + inst->vkGetDeviceQueue(device, 0, 0, &queue); + inst->vkDestroyDevice(device, tracker.get()); } ASSERT_TRUE(tracker.empty()); @@ -408,10 +389,130 @@ TEST(Allocation, DeviceButNotInstance) { // Test failure during vkCreateInstance to make sure we don't leak memory if // one of the out-of-memory conditions trigger. TEST(Allocation, CreateInstanceIntentionalAllocFail) { - FrameworkEnvironment env{}; + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + + const char* layer_name = "VK_LAYER_implicit"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ENV")), + "test_layer.json"); + env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true); + + size_t fail_index = 0; + VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; + while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { + MemoryTracker tracker({false, 0, true, fail_index}); + + VkInstance instance; + InstanceCreateInfo inst_create_info{}; + result = env.vulkan_functions.vkCreateInstance(inst_create_info.get(), tracker.get(), &instance); + if (result == VK_SUCCESS) { + env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); + } + ASSERT_TRUE(tracker.empty()); + fail_index++; + } +} + +// Test failure during vkCreateInstance to make sure we don't leak memory if +// one of the out-of-memory conditions trigger and there are invalid jsons in the same folder +TEST(Allocation, CreateInstanceIntentionalAllocFailInvalidManifests) { + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + std::vector invalid_jsons; + invalid_jsons.push_back(","); + invalid_jsons.push_back("{},[]"); + invalid_jsons.push_back("{ \"foo\":\"bar\", }"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": [], },"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": [{},] },"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": {\"fee\"} },"); + invalid_jsons.push_back("{\"\":\"bar\", \"baz\": {}"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": {\"fee\":1234, true, \"ab\":\"bc\"} },"); + + for (size_t i = 0; i < invalid_jsons.size(); i++) { + auto file_name = std::string("invalid_implicit_layer_") + std::to_string(i) + ".json"; + fs::path new_path = env.get_folder(ManifestLocation::implicit_layer).write_manifest(file_name, invalid_jsons[i]); + env.platform_shim->add_manifest(ManifestCategory::implicit_layer, new_path); + } + const char* layer_name = "VkLayerImplicit0"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ENV")), + "test_layer.json"); + + size_t fail_index = 0; + VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; + while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { + MemoryTracker tracker({false, 0, true, fail_index}); + + VkInstance instance; + InstanceCreateInfo inst_create_info{}; + result = env.vulkan_functions.vkCreateInstance(inst_create_info.get(), tracker.get(), &instance); + if (result == VK_SUCCESS) { + env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); + } + ASSERT_TRUE(tracker.empty()); + fail_index++; + } +} + +// Test failure during vkCreateInstance & surface creation to make sure we don't leak memory if +// one of the out-of-memory conditions trigger. +TEST(Allocation, CreateSurfaceIntentionalAllocFail) { + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); + + const char* layer_name = "VK_LAYER_implicit"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ENV")), + "test_layer.json"); + env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true); + + size_t fail_index = 0; + VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; + while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { + MemoryTracker tracker({false, 0, true, fail_index}); + + VkInstance instance; + InstanceCreateInfo inst_create_info{}; + inst_create_info.setup_WSI(); + result = env.vulkan_functions.vkCreateInstance(inst_create_info.get(), tracker.get(), &instance); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { + ASSERT_TRUE(tracker.empty()); + fail_index++; + continue; + } + + VkSurfaceKHR surface{}; + result = create_surface(&env.vulkan_functions, instance, surface); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { + env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); + ASSERT_TRUE(tracker.empty()); + fail_index++; + continue; + } + env.vulkan_functions.vkDestroySurfaceKHR(instance, surface, tracker.get()); + + env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); + ASSERT_TRUE(tracker.empty()); + fail_index++; + } +} + +// Test failure during vkCreateInstance to make sure we don't leak memory if +// one of the out-of-memory conditions trigger. +TEST(Allocation, CreateInstanceIntentionalAllocFailWithSettingsFilePresent) { + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + + const char* layer_name = "VK_LAYER_implicit"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -419,10 +520,17 @@ TEST(Allocation, CreateInstanceIntentionalAllocFail) { "test_layer.json"); env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true); + env.update_loader_settings( + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("auto") + .set_path(env.get_shimmed_layer_manifest_path(0).str())))); + size_t fail_index = 0; VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { - MemoryTracker tracker(MemoryTrackerSettings{false, 0, true, fail_index}); + MemoryTracker tracker({false, 0, true, fail_index}); VkInstance instance; InstanceCreateInfo inst_create_info{}; @@ -435,13 +543,64 @@ TEST(Allocation, CreateInstanceIntentionalAllocFail) { } } +// Test failure during vkCreateInstance & surface creation to make sure we don't leak memory if +// one of the out-of-memory conditions trigger. +TEST(Allocation, CreateSurfaceIntentionalAllocFailWithSettingsFilePresent) { + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); + + const char* layer_name = "VK_LAYER_implicit"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ENV")), + "test_layer.json"); + env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true); + env.update_loader_settings( + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("auto") + .set_path(env.get_shimmed_layer_manifest_path(0).str())))); + + size_t fail_index = 0; + VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; + while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { + MemoryTracker tracker({false, 0, true, fail_index}); + + VkInstance instance; + InstanceCreateInfo inst_create_info{}; + inst_create_info.setup_WSI(); + result = env.vulkan_functions.vkCreateInstance(inst_create_info.get(), tracker.get(), &instance); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { + ASSERT_TRUE(tracker.empty()); + fail_index++; + continue; + } + + VkSurfaceKHR surface{}; + result = create_surface(&env.vulkan_functions, instance, surface); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { + env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); + ASSERT_TRUE(tracker.empty()); + fail_index++; + continue; + } + env.vulkan_functions.vkDestroySurfaceKHR(instance, surface, tracker.get()); + + env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); + ASSERT_TRUE(tracker.empty()); + fail_index++; + } +} + // Test failure during vkCreateInstance to make sure we don't leak memory if // one of the out-of-memory conditions trigger. TEST(Allocation, DriverEnvVarIntentionalAllocFail) { - FrameworkEnvironment env{}; + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}.set_discovery_type(ManifestDiscoveryType::env_var)); - const char* layer_name = "VkLayerImplicit0"; + const char* layer_name = "VK_LAYER_implicit"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -449,15 +608,11 @@ TEST(Allocation, DriverEnvVarIntentionalAllocFail) { "test_layer.json"); env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true); - auto driver_files = get_env_var("VK_DRIVER_FILES"); - driver_files += OS_ENV_VAR_LIST_SEPARATOR; - driver_files += (fs::path("totally_made_up") / "path_to_fake" / "jason_file.json").str(); - set_env_var("VK_DRIVER_FILES", driver_files); - - size_t fail_index = 66; // 0 + env.env_var_vk_icd_filenames.add_to_list((fs::path("totally_made_up") / "path_to_fake" / "jason_file.json").str()); + size_t fail_index = 0; VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { - MemoryTracker tracker(MemoryTrackerSettings{false, 0, true, fail_index}); + MemoryTracker tracker({false, 0, true, fail_index}); VkInstance instance; InstanceCreateInfo inst_create_info{}; @@ -468,7 +623,6 @@ TEST(Allocation, DriverEnvVarIntentionalAllocFail) { ASSERT_TRUE(tracker.empty()); fail_index++; } - remove_env_var("VK_DRIVER_FILES"); } // Test failure during vkCreateDevice to make sure we don't leak memory if @@ -476,16 +630,16 @@ TEST(Allocation, DriverEnvVarIntentionalAllocFail) { // Use 2 physical devices so that anything which copies a list of devices item by item // may fail. TEST(Allocation, CreateDeviceIntentionalAllocFail) { - FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); - driver.physical_devices.emplace_back("physical_device_1"); - driver.physical_devices[1].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); - - const char* layer_name = "VK_LAYER_VkLayerImplicit0"; + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device(PhysicalDevice{"physical_device_0"} + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}) + .finish()) + .add_physical_device(PhysicalDevice{"physical_device_1"} + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}) + .finish()); + + const char* layer_name = "VK_LAYER_implicit"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -494,7 +648,7 @@ TEST(Allocation, CreateDeviceIntentionalAllocFail) { env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true); InstWrapper inst{env.vulkan_functions}; - inst.CheckCreate(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); uint32_t physical_count = 2; uint32_t returned_physical_count = 0; @@ -520,16 +674,17 @@ TEST(Allocation, CreateDeviceIntentionalAllocFail) { size_t fail_index = 0; VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; while (result == VK_ERROR_OUT_OF_HOST_MEMORY) { - MemoryTracker tracker(MemoryTrackerSettings{false, 0, true, fail_index}); + MemoryTracker tracker({false, 0, true, fail_index}); DeviceCreateInfo dev_create_info; - DeviceQueueCreateInfo queue_info; - queue_info.add_priority(0.0f); - dev_create_info.add_device_queue(queue_info); + dev_create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); VkDevice device; result = inst->vkCreateDevice(physical_devices[0], dev_create_info.get(), tracker.get(), &device); if (result == VK_SUCCESS || fail_index > 10000) { + VkQueue queue; + inst->vkGetDeviceQueue(device, 0, 0, &queue); + inst->vkDestroyDevice(device, tracker.get()); break; } @@ -540,37 +695,77 @@ TEST(Allocation, CreateDeviceIntentionalAllocFail) { // Test failure during vkCreateInstance and vkCreateDevice to make sure we don't // leak memory if one of the out-of-memory conditions trigger. +// Includes drivers with several instance extensions, drivers that will fail to load, directly loaded drivers TEST(Allocation, CreateInstanceDeviceIntentionalAllocFail) { - FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; + uint32_t num_physical_devices = 4; + uint32_t num_implicit_layers = 3; + for (uint32_t i = 0; i < num_physical_devices; i++) { + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2) + .icd_manifest.set_is_portability_driver(false) + .set_library_arch(sizeof(void*) == 8 ? "64" : "32")) + .set_icd_api_version(VK_API_VERSION_1_1) + .add_instance_extension("VK_KHR_get_physical_device_properties2") + .add_physical_device("physical_device_0") + .physical_devices.at(0) + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}) + .add_extensions({"VK_EXT_one", "VK_EXT_two", "VK_EXT_three", "VK_EXT_four", "VK_EXT_five"}); + } - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); + env.add_icd(TestICDDetails(CURRENT_PLATFORM_DUMMY_BINARY_WRONG_TYPE).set_is_fake(true)); - const char* layer_name = "VkLayerImplicit0"; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)); + + 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"); + + VkDirectDriverLoadingListLUNARG ddl_list{}; + ddl_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; + ddl_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; + ddl_list.driverCount = 1; + ddl_list.pDrivers = &ddl_info; + + const char* layer_name = "VK_LAYER_ImplicitAllocFail"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_disable_environment("DISABLE_ENV")), "test_layer.json"); env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true); + for (uint32_t i = 1; i < num_implicit_layers + 1; i++) { + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("VK_LAYER_Implicit1" + std::to_string(i)) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ENV")), + "test_layer_" + std::to_string(i) + ".json"); + } + std::fstream custom_json_file{COMPLEX_JSON_FILE, std::ios_base::in}; + ASSERT_TRUE(custom_json_file.is_open()); + std::stringstream custom_json_file_contents; + custom_json_file_contents << custom_json_file.rdbuf(); + + fs::path new_path = env.get_folder(ManifestLocation::explicit_layer) + .write_manifest("VK_LAYER_complex_file.json", custom_json_file_contents.str()); + env.platform_shim->add_manifest(ManifestCategory::explicit_layer, new_path); size_t fail_index = 0; VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { - MemoryTracker tracker(MemoryTrackerSettings{false, 0, true, fail_index}); + MemoryTracker tracker{{false, 0, true, fail_index}}; fail_index++; // applies to the next loop VkInstance instance; InstanceCreateInfo inst_create_info{}; + inst_create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst_create_info.instance_info.pNext = reinterpret_cast(&ddl_list); result = env.vulkan_functions.vkCreateInstance(inst_create_info.get(), tracker.get(), &instance); if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { ASSERT_TRUE(tracker.empty()); continue; } + ASSERT_EQ(result, VK_SUCCESS); - uint32_t physical_count = 1; uint32_t returned_physical_count = 0; result = env.vulkan_functions.vkEnumeratePhysicalDevices(instance, &returned_physical_count, nullptr); if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { @@ -578,37 +773,45 @@ TEST(Allocation, CreateInstanceDeviceIntentionalAllocFail) { ASSERT_TRUE(tracker.empty()); continue; } - ASSERT_EQ(physical_count, returned_physical_count); + ASSERT_EQ(result, VK_SUCCESS); + ASSERT_EQ(num_physical_devices, returned_physical_count); - VkPhysicalDevice physical_device; - result = env.vulkan_functions.vkEnumeratePhysicalDevices(instance, &returned_physical_count, &physical_device); + std::vector physical_devices; + physical_devices.resize(returned_physical_count); + result = env.vulkan_functions.vkEnumeratePhysicalDevices(instance, &returned_physical_count, physical_devices.data()); if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); ASSERT_TRUE(tracker.empty()); continue; } - ASSERT_EQ(physical_count, returned_physical_count); + ASSERT_EQ(result, VK_SUCCESS); + ASSERT_EQ(num_physical_devices, returned_physical_count); + for (uint32_t i = 0; i < returned_physical_count; i++) { + uint32_t family_count = 1; + uint32_t returned_family_count = 0; + env.vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties(physical_devices.at(i), &returned_family_count, nullptr); + ASSERT_EQ(returned_family_count, family_count); - uint32_t family_count = 1; - uint32_t returned_family_count = 0; - env.vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &returned_family_count, nullptr); - ASSERT_EQ(returned_family_count, family_count); + VkQueueFamilyProperties family; + env.vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties(physical_devices.at(i), &returned_family_count, &family); + ASSERT_EQ(returned_family_count, family_count); + ASSERT_EQ(family.queueFlags, static_cast(VK_QUEUE_GRAPHICS_BIT)); + ASSERT_EQ(family.queueCount, family_count); + ASSERT_EQ(family.timestampValidBits, 0U); - VkQueueFamilyProperties family; - env.vulkan_functions.vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &returned_family_count, &family); - ASSERT_EQ(returned_family_count, family_count); - ASSERT_EQ(family.queueFlags, static_cast(VK_QUEUE_GRAPHICS_BIT)); - ASSERT_EQ(family.queueCount, family_count); - ASSERT_EQ(family.timestampValidBits, 0U); + DeviceCreateInfo dev_create_info; + dev_create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); - DeviceCreateInfo dev_create_info; - DeviceQueueCreateInfo queue_info; - queue_info.add_priority(0.0f); - dev_create_info.add_device_queue(queue_info); + VkDevice device; + result = env.vulkan_functions.vkCreateDevice(physical_devices.at(i), dev_create_info.get(), tracker.get(), &device); + if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { + break; + } + ASSERT_EQ(result, VK_SUCCESS); + + VkQueue queue; + env.vulkan_functions.vkGetDeviceQueue(device, 0, 0, &queue); - VkDevice device; - result = env.vulkan_functions.vkCreateDevice(physical_device, dev_create_info.get(), tracker.get(), &device); - if (result == VK_SUCCESS) { env.vulkan_functions.vkDestroyDevice(device, tracker.get()); } env.vulkan_functions.vkDestroyInstance(instance, tracker.get()); @@ -621,11 +824,11 @@ TEST(Allocation, CreateInstanceDeviceIntentionalAllocFail) { // to make sure the loader uses the valid ICD and doesn't report incompatible driver just because // an incompatible driver exists TEST(TryLoadWrongBinaries, CreateInstanceIntentionalAllocFail) { - FrameworkEnvironment env{}; + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); env.add_icd(TestICDDetails(CURRENT_PLATFORM_DUMMY_BINARY_WRONG_TYPE).set_is_fake(true)); - const char* layer_name = "VkLayerImplicit0"; + const char* layer_name = "VK_LAYER_implicit"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -636,7 +839,7 @@ TEST(TryLoadWrongBinaries, CreateInstanceIntentionalAllocFail) { size_t fail_index = 0; VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { - MemoryTracker tracker(MemoryTrackerSettings{false, 0, true, fail_index}); + MemoryTracker tracker({false, 0, true, fail_index}); VkInstance instance; InstanceCreateInfo inst_create_info{}; @@ -653,10 +856,10 @@ TEST(TryLoadWrongBinaries, CreateInstanceIntentionalAllocFail) { // Test failure during vkCreateInstance and vkCreateDevice to make sure we don't // leak memory if one of the out-of-memory conditions trigger. TEST(Allocation, EnumeratePhysicalDevicesIntentionalAllocFail) { - FrameworkEnvironment env{}; + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - const char* layer_name = "VkLayerImplicit0"; + const char* layer_name = "VK_LAYER_implicit"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -674,10 +877,10 @@ TEST(Allocation, EnumeratePhysicalDevicesIntentionalAllocFail) { auto& driver = env.reset_icd(); for (uint32_t i = 0; i < physical_dev_count; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); - driver.physical_devices[i].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); + driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)) + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); } - MemoryTracker tracker{MemoryTrackerSettings{false, 0, true, fail_index}}; + MemoryTracker tracker{{false, 0, true, fail_index}}; InstanceCreateInfo inst_create_info; VkInstance instance; result = env.vulkan_functions.vkCreateInstance(inst_create_info.get(), tracker.get(), &instance); @@ -696,8 +899,8 @@ TEST(Allocation, EnumeratePhysicalDevicesIntentionalAllocFail) { ASSERT_EQ(physical_dev_count, returned_physical_count); for (uint32_t i = 0; i < 2; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(physical_dev_count)); - driver.physical_devices.back().add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); + driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(physical_dev_count)) + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); physical_dev_count += 1; } @@ -725,7 +928,7 @@ TEST(Allocation, EnumeratePhysicalDevicesIntentionalAllocFail) { } ASSERT_EQ(physical_dev_count, returned_physical_count); - std::array devices; + std::array devices; for (uint32_t i = 0; i < returned_physical_count; i++) { uint32_t family_count = 1; uint32_t returned_family_count = 0; @@ -740,11 +943,14 @@ TEST(Allocation, EnumeratePhysicalDevicesIntentionalAllocFail) { ASSERT_EQ(family.timestampValidBits, 0U); DeviceCreateInfo dev_create_info; - DeviceQueueCreateInfo queue_info; - queue_info.add_priority(0.0f); - dev_create_info.add_device_queue(queue_info); + dev_create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); result = env.vulkan_functions.vkCreateDevice(physical_devices[i], dev_create_info.get(), tracker.get(), &devices[i]); + + VkQueue queue; + if (result == VK_SUCCESS) { + env.vulkan_functions.vkGetDeviceQueue(devices[i], 0, 0, &queue); + } } for (uint32_t i = 0; i < returned_physical_count; i++) { if (result == VK_SUCCESS) { @@ -761,17 +967,17 @@ TEST(Allocation, EnumeratePhysicalDevicesIntentionalAllocFail) { // Test failure during vkCreateInstance and vkCreateDevice to make sure we don't // leak memory if one of the out-of-memory conditions trigger. TEST(Allocation, CreateInstanceDeviceWithDXGIDriverIntentionalAllocFail) { - FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_discovery_type(ManifestDiscoveryType::none)); + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("error,warn")}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_discovery_type(ManifestDiscoveryType::null_dir)); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); for (uint32_t i = 0; i < 2; i++) { auto& driver = env.get_test_icd(i); - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); - driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); + driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)) + .add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false}); } - const char* layer_name = "VkLayerImplicit0"; + const char* layer_name = "VK_LAYER_implicit"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -784,14 +990,14 @@ TEST(Allocation, CreateInstanceDeviceWithDXGIDriverIntentionalAllocFail) { desc1.VendorId = known_driver.vendor_id; desc1.AdapterLuid = _LUID{10, 1000}; env.platform_shim->add_dxgi_adapter(GpuType::discrete, desc1); - env.get_test_icd().set_adapterLUID(desc1.AdapterLuid); + env.get_test_icd(0).set_adapterLUID(desc1.AdapterLuid); env.platform_shim->add_d3dkmt_adapter(D3DKMT_Adapter{0, _LUID{10, 1000}}.add_driver_manifest_path(env.get_icd_manifest_path())); size_t fail_index = 0; VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY; while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) { - MemoryTracker tracker(MemoryTrackerSettings{false, 0, true, fail_index}); + MemoryTracker tracker({false, 0, true, fail_index}); fail_index++; // applies to the next loop VkInstance instance; @@ -836,13 +1042,14 @@ TEST(Allocation, CreateInstanceDeviceWithDXGIDriverIntentionalAllocFail) { ASSERT_EQ(family.timestampValidBits, 0U); DeviceCreateInfo dev_create_info; - DeviceQueueCreateInfo queue_info; - queue_info.add_priority(0.0f); - dev_create_info.add_device_queue(queue_info); + dev_create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); result = env.vulkan_functions.vkCreateDevice(physical_devices[i], dev_create_info.get(), tracker.get(), &devices[i]); if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { devices[i] = VK_NULL_HANDLE; + } else { + VkQueue queue; + env.vulkan_functions.vkGetDeviceQueue(devices[i], 0, 0, &queue); } } for (uint32_t i = 0; i < returned_physical_count; i++) { diff --git a/tests/loader_debug_ext_tests.cpp b/tests/loader_debug_ext_tests.cpp index 1cefbb8c5d6255732e1110527145454c374f4430..aa6b7f0e7c7f0127c5df3fa96033c4b1af9a2b37 100644 --- a/tests/loader_debug_ext_tests.cpp +++ b/tests/loader_debug_ext_tests.cpp @@ -34,9 +34,9 @@ // // Prototype declaration for callback so we can use it in class utility methods -static VkBool32 VKAPI_CALL test_DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, - uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, - const char* pMessage, void* pUserData); +VkBool32 VKAPI_CALL test_DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, + size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, + void* pUserData); class DebugReportTest : public ::testing::Test { public: @@ -121,9 +121,10 @@ class DebugReportTest : public ::testing::Test { }; // This is the actual callback prototyped above. -static VkBool32 VKAPI_CALL test_DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, - uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, - const char* pMessage, void* pUserData) { +VkBool32 VKAPI_CALL test_DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, + [[maybe_unused]] uint64_t object, [[maybe_unused]] size_t location, + [[maybe_unused]] int32_t messageCode, [[maybe_unused]] const char* pLayerPrefix, + const char* pMessage, void* pUserData) { DebugReportTest* debug_report_test = reinterpret_cast(pUserData); debug_report_test->VerifyExpected(flags, objectType, pMessage); return VK_FALSE; @@ -360,9 +361,9 @@ TEST_F(ManualReport, InfoMessage) { // // Prototype declaration for callback so we can use it in class utility methods -static VkBool32 VKAPI_CALL test_DebugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity, - VkDebugUtilsMessageTypeFlagsEXT message_types, - const VkDebugUtilsMessengerCallbackDataEXT* callback_data, void* user_data); +VkBool32 VKAPI_CALL test_DebugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity, + VkDebugUtilsMessageTypeFlagsEXT message_types, + const VkDebugUtilsMessengerCallbackDataEXT* callback_data, void* user_data); class DebugUtilTest : public ::testing::Test { public: @@ -461,9 +462,9 @@ class DebugUtilTest : public ::testing::Test { // This is the actual callback prototyped above. -static VkBool32 VKAPI_CALL test_DebugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity, - VkDebugUtilsMessageTypeFlagsEXT message_types, - const VkDebugUtilsMessengerCallbackDataEXT* callback_data, void* user_data) { +VkBool32 VKAPI_CALL test_DebugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity, + VkDebugUtilsMessageTypeFlagsEXT message_types, + const VkDebugUtilsMessengerCallbackDataEXT* callback_data, void* user_data) { DebugUtilTest* debug_util_test = reinterpret_cast(user_data); debug_util_test->VerifyExpected(message_types, message_severity, callback_data->pMessage, callback_data); return VK_FALSE; @@ -849,3 +850,389 @@ TEST_F(ManualMessage, InfoMessage) { // Message should be found ASSERT_EQ(true, message_found); } + +void CheckDeviceFunctions(FrameworkEnvironment& env, bool use_GIPA, bool enable_debug_extensions, + bool hardware_supports_debug_exts) { + InstWrapper inst(env.vulkan_functions); + if (enable_debug_extensions) { + inst.create_info.add_extension("VK_EXT_debug_utils"); + inst.create_info.add_extension("VK_EXT_debug_report"); + } + inst.create_info.setup_WSI(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + + auto phys_dev = inst.GetPhysDev(); + + DeviceWrapper dev{inst}; + dev.create_info.add_extension("VK_KHR_swapchain"); + dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + if (enable_debug_extensions) { + dev.create_info.add_extension("VK_EXT_debug_marker"); + } + + if (enable_debug_extensions && !hardware_supports_debug_exts) { + // if the hardware doesn't support VK_EXT_debug_marker and we are trying to enable it, then we should exit since that will + // fail to create a device + + dev.CheckCreate(phys_dev, VK_ERROR_EXTENSION_NOT_PRESENT); + return; + } else { + ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); + } + DeviceFunctions dev_funcs{env.vulkan_functions, dev}; + + VkSurfaceKHR surface{}; + ASSERT_EQ(VK_SUCCESS, create_surface(inst, surface)); + + VkSwapchainCreateInfoKHR info{}; + info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + info.surface = surface; + + VkSwapchainKHR swapchain{}; + ASSERT_EQ(VK_SUCCESS, dev_funcs.vkCreateSwapchainKHR(dev.dev, &info, nullptr, &swapchain)); + + auto load_function = [&inst, &dev, use_GIPA](const char* func_name) { + return use_GIPA ? inst.load(func_name) : dev.load(func_name); + }; + + // 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"); + // Debug utils + PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = load_function("vkSetDebugUtilsObjectNameEXT"); + PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT = load_function("vkSetDebugUtilsObjectTagEXT"); + PFN_vkQueueBeginDebugUtilsLabelEXT QueueBeginDebugUtilsLabelEXT = load_function("vkQueueBeginDebugUtilsLabelEXT"); + PFN_vkQueueEndDebugUtilsLabelEXT QueueEndDebugUtilsLabelEXT = load_function("vkQueueEndDebugUtilsLabelEXT"); + PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsertDebugUtilsLabelEXT = load_function("vkQueueInsertDebugUtilsLabelEXT"); + PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT = load_function("vkCmdBeginDebugUtilsLabelEXT"); + PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT = load_function("vkCmdEndDebugUtilsLabelEXT"); + PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT = load_function("vkCmdInsertDebugUtilsLabelEXT"); + + // 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); + ASSERT_TRUE(nullptr != DebugMarkerSetObjectNameEXT); + ASSERT_TRUE(nullptr != CmdDebugMarkerBeginEXT); + ASSERT_TRUE(nullptr != CmdDebugMarkerEndEXT); + ASSERT_TRUE(nullptr != CmdDebugMarkerInsertEXT); + } else { + ASSERT_EQ(enable_debug_extensions, nullptr != DebugMarkerSetObjectTagEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != DebugMarkerSetObjectNameEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != CmdDebugMarkerBeginEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != CmdDebugMarkerEndEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != CmdDebugMarkerInsertEXT); + } + + // Debug utils functions - should only be found if the extension was enabled (because its instance level) + ASSERT_EQ(enable_debug_extensions, nullptr != SetDebugUtilsObjectNameEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != SetDebugUtilsObjectTagEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != QueueBeginDebugUtilsLabelEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != QueueEndDebugUtilsLabelEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != QueueInsertDebugUtilsLabelEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != CmdBeginDebugUtilsLabelEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != CmdEndDebugUtilsLabelEXT); + ASSERT_EQ(enable_debug_extensions, nullptr != CmdInsertDebugUtilsLabelEXT); + + if (SetDebugUtilsObjectNameEXT) { + VkDebugUtilsObjectNameInfoEXT obj_name_info{}; + obj_name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + obj_name_info.objectHandle = (uint64_t)swapchain; + obj_name_info.objectType = VK_OBJECT_TYPE_SWAPCHAIN_KHR; + obj_name_info.pObjectName = " Your mom!"; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectNameEXT(dev.dev, &obj_name_info)); + + obj_name_info.objectHandle = (uint64_t)(uintptr_t)surface; + obj_name_info.objectType = VK_OBJECT_TYPE_SURFACE_KHR; + obj_name_info.pObjectName = " Your moms surface!"; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectNameEXT(dev.dev, &obj_name_info)); + + obj_name_info.objectHandle = (uint64_t)(uintptr_t)phys_dev; + obj_name_info.objectType = VK_OBJECT_TYPE_PHYSICAL_DEVICE; + obj_name_info.pObjectName = "Physical Device AAAAAAAAA"; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectNameEXT(dev.dev, &obj_name_info)); + + obj_name_info.objectHandle = (uint64_t)(uintptr_t)inst.inst; + obj_name_info.objectType = VK_OBJECT_TYPE_INSTANCE; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectNameEXT(dev.dev, &obj_name_info)); + } + if (SetDebugUtilsObjectTagEXT) { + VkDebugUtilsObjectTagInfoEXT utils_object_tag{}; + utils_object_tag.objectHandle = (uint64_t)(uintptr_t)inst.inst; + utils_object_tag.objectType = VK_OBJECT_TYPE_INSTANCE; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(dev.dev, &utils_object_tag)); + + utils_object_tag.objectHandle = (uint64_t)(uintptr_t)phys_dev; + utils_object_tag.objectType = VK_OBJECT_TYPE_PHYSICAL_DEVICE; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(dev.dev, &utils_object_tag)); + + utils_object_tag.objectHandle = (uint64_t)surface; + utils_object_tag.objectType = VK_OBJECT_TYPE_SURFACE_KHR; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(dev.dev, &utils_object_tag)); + } + VkDebugMarkerObjectTagInfoEXT marker_object_tag{}; + VkDebugMarkerObjectNameInfoEXT marker_object_name{}; + if (use_GIPA && !enable_debug_extensions) { + // These functions crash when the extension isn't enabled and the function was acquired with GIPA. + ASSERT_DEATH(DebugMarkerSetObjectTagEXT(dev.dev, &marker_object_tag), ""); + ASSERT_DEATH(DebugMarkerSetObjectNameEXT(dev.dev, &marker_object_name), ""); + } else { + if (DebugMarkerSetObjectTagEXT) { + marker_object_tag.object = (uint64_t)(uintptr_t)swapchain; + marker_object_tag.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(dev.dev, &marker_object_tag)); + + marker_object_tag.object = (uint64_t)(uintptr_t)phys_dev; + marker_object_tag.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(dev.dev, &marker_object_tag)); + + marker_object_tag.object = (uint64_t)surface; + marker_object_tag.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(dev.dev, &marker_object_tag)); + + marker_object_tag.object = (uint64_t)(uintptr_t)inst.inst; + marker_object_tag.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(dev.dev, &marker_object_tag)); + } + if (DebugMarkerSetObjectNameEXT) { + marker_object_name.object = (uint64_t)(uintptr_t)swapchain; + marker_object_name.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(dev.dev, &marker_object_name)); + + marker_object_name.object = (uint64_t)(uintptr_t)phys_dev; + marker_object_name.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(dev.dev, &marker_object_name)); + + marker_object_name.object = (uint64_t)surface; + marker_object_name.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(dev.dev, &marker_object_name)); + + marker_object_name.object = (uint64_t)(uintptr_t)inst.inst; + marker_object_name.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(dev.dev, &marker_object_name)); + } + } + VkQueue queue{}; + dev.functions->vkGetDeviceQueue(dev.dev, 0, 0, &queue); + VkDebugUtilsLabelEXT utils_label{}; + utils_label.pLabelName = "Testing testing 123"; + if (QueueBeginDebugUtilsLabelEXT) QueueBeginDebugUtilsLabelEXT(queue, &utils_label); + if (QueueEndDebugUtilsLabelEXT) QueueEndDebugUtilsLabelEXT(queue); + if (QueueInsertDebugUtilsLabelEXT) QueueInsertDebugUtilsLabelEXT(queue, &utils_label); + VkCommandBuffer cmd_buf{}; + VkCommandPool cmd_pool; + VkCommandPoolCreateInfo cmd_pool_info{}; + cmd_pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; + ASSERT_EQ(VK_SUCCESS, dev_funcs.vkCreateCommandPool(dev.dev, &cmd_pool_info, nullptr, &cmd_pool)); + VkCommandBufferAllocateInfo cmd_buf_alloc_info{}; + cmd_buf_alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; + cmd_buf_alloc_info.commandBufferCount = 1; + cmd_buf_alloc_info.commandPool = cmd_pool; + ASSERT_EQ(VK_SUCCESS, dev_funcs.vkAllocateCommandBuffers(dev.dev, &cmd_buf_alloc_info, &cmd_buf)); + if (CmdBeginDebugUtilsLabelEXT) CmdBeginDebugUtilsLabelEXT(cmd_buf, &utils_label); + if (CmdEndDebugUtilsLabelEXT) CmdEndDebugUtilsLabelEXT(cmd_buf); + if (CmdInsertDebugUtilsLabelEXT) CmdInsertDebugUtilsLabelEXT(cmd_buf, &utils_label); + + dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); + env.vulkan_functions.vkDestroySurfaceKHR(inst.inst, surface, nullptr); +} + +TEST(GetProcAddr, DebugFuncsWithTerminator) { + FrameworkEnvironment env{}; + auto& driver = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).setup_WSI().add_physical_device("physical_device_0"); + driver.physical_devices.at(0).add_extensions({"VK_KHR_swapchain"}); + // Hardware doesn't support the debug extensions + + // Use getDeviceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, false, false)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, true, false)); + + // Use getInstanceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, false, false)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, true, false)); + + // Now set the hardware to support the extensions and run the situations again + driver.add_instance_extensions({"VK_EXT_debug_utils", "VK_EXT_debug_report"}); + driver.physical_devices.at(0).add_extensions({"VK_EXT_debug_marker"}); + + // 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)); + + // Use getInstanceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, false, true)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, true, true)); +} + +TEST(GetProcAddr, DebugFuncsWithTrampoline) { + FrameworkEnvironment env{}; + auto& driver = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).setup_WSI().add_physical_device("physical_device_0"); + driver.physical_devices.at(0).add_extensions({"VK_KHR_swapchain"}); + // Hardware doesn't support the debug extensions + + // Use getDeviceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, false, false)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, true, false)); + + // Use getInstanceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, false, false)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, true, false)); + + // Now add a layer that supports the extensions and run the situations again + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("VK_LAYER_test_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_instance_extensions({{VK_EXT_DEBUG_REPORT_EXTENSION_NAME}, + {VK_EXT_DEBUG_UTILS_EXTENSION_NAME}}) + .add_device_extension({VK_EXT_DEBUG_MARKER_EXTENSION_NAME})), + "test_layer.json"); + + // // 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)); + + // Use getInstanceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, false, true)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, true, true)); +} + +TEST(GetProcAddr, DebugFuncsWithDebugExtsForceAdded) { + FrameworkEnvironment env{}; + auto& driver = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).setup_WSI().add_physical_device("physical_device_0"); + driver.physical_devices.at(0).add_extensions({"VK_KHR_swapchain"}); + // Hardware doesn't support the debug extensions + + // Use getDeviceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, false, false)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, false, true, false)); + + // Use getInstanceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, false, false)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, true, false)); + + // Now add a layer that supports the extensions and run the situations again + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("VK_LAYER_test_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "test_layer.json"); + env.get_test_layer() + .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}); + + // 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)); + + // Use getInstanceProcAddr & vary enabling the debug extensions + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, false, true)); + ASSERT_NO_FATAL_FAILURE(CheckDeviceFunctions(env, true, true, true)); +} + +TEST(DebugUtils, WrappingLayer) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .set_min_icd_interface_version(5) + .add_physical_device(PhysicalDevice{}.add_extension(VK_EXT_DEBUG_MARKER_EXTENSION_NAME).finish()) + .add_instance_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + + const char* wrap_objects_name = "VK_LAYER_LUNARG_wrap_objects"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(wrap_objects_name) + .set_lib_path(TEST_LAYER_WRAP_OBJECTS) + .set_disable_environment("DISABLE_ME") + .add_instance_extension({VK_EXT_DEBUG_UTILS_EXTENSION_NAME})), + "wrap_objects_layer.json"); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + inst.create_info.add_extension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME); + inst.create_info.add_layer(wrap_objects_name); + inst.CheckCreate(); + DebugUtilsWrapper log{inst}; + CreateDebugUtilsMessenger(log); + + auto phys_dev = inst.GetPhysDev(); + DeviceWrapper device{inst}; + device.create_info.add_extension(VK_EXT_DEBUG_MARKER_EXTENSION_NAME); + device.CheckCreate(phys_dev); + { + PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = inst.load("vkSetDebugUtilsObjectNameEXT"); + + VkDebugUtilsObjectNameInfoEXT info = {}; + info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + info.objectType = VK_OBJECT_TYPE_DEVICE; + info.objectHandle = (uint64_t)device.dev; + info.pObjectName = "Test Name"; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectNameEXT(device, &info)); + + info.objectType = VK_OBJECT_TYPE_PHYSICAL_DEVICE; + info.objectHandle = (uint64_t)phys_dev; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectNameEXT(device, &info)); + + info.objectType = VK_OBJECT_TYPE_INSTANCE; + info.objectHandle = (uint64_t)inst.inst; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectNameEXT(device, &info)); + } + { + PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT = inst.load("vkSetDebugUtilsObjectTagEXT"); + + VkDebugUtilsObjectTagInfoEXT info = {}; + info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT; + info.objectType = VK_OBJECT_TYPE_DEVICE; + info.objectHandle = (uint64_t)device.dev; + info.pTag = "Test Name"; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(device, &info)); + + info.objectType = VK_OBJECT_TYPE_PHYSICAL_DEVICE; + info.objectHandle = (uint64_t)phys_dev; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(device, &info)); + + info.objectType = VK_OBJECT_TYPE_INSTANCE; + info.objectHandle = (uint64_t)inst.inst; + ASSERT_EQ(VK_SUCCESS, SetDebugUtilsObjectTagEXT(device, &info)); + } + // Debug marker + { + PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT = inst.load("vkDebugMarkerSetObjectNameEXT"); + + VkDebugMarkerObjectNameInfoEXT info = {}; + info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT; + info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT; + info.object = (uint64_t)device.dev; + info.pObjectName = "Test Name"; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(device, &info)); + + info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT; + info.object = (uint64_t)phys_dev; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(device, &info)); + + info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT; + info.object = (uint64_t)inst.inst; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectNameEXT(device, &info)); + } + { + PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT = inst.load("vkDebugMarkerSetObjectTagEXT"); + + VkDebugMarkerObjectTagInfoEXT info = {}; + info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT; + info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT; + info.object = (uint64_t)device.dev; + info.pTag = "Test Name"; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(device, &info)); + + info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT; + info.object = (uint64_t)phys_dev; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(device, &info)); + + info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT; + info.object = (uint64_t)inst.inst; + ASSERT_EQ(VK_SUCCESS, DebugMarkerSetObjectTagEXT(device, &info)); + } +} diff --git a/tests/loader_envvar_tests.cpp b/tests/loader_envvar_tests.cpp index 63e050c9be40748d9e53df1aa673e20b599cc0f8..3bb7515e8bcef8947f65bb32784199344c9dfd52 100644 --- a/tests/loader_envvar_tests.cpp +++ b/tests/loader_envvar_tests.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021-2022 The Khronos Group Inc. - * Copyright (c) 2021-2022 Valve Corporation - * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -28,21 +28,6 @@ #include "test_environment.h" -class EnvVarICDOverrideSetup : public ::testing::Test { - protected: - virtual void SetUp() { - remove_env_var("VK_ICD_FILENAMES"); - remove_env_var("VK_DRIVER_FILES"); - remove_env_var("VK_ADD_DRIVER_FILES"); - } - - virtual void TearDown() { - remove_env_var("VK_ICD_FILENAMES"); - remove_env_var("VK_DRIVER_FILES"); - remove_env_var("VK_ADD_DRIVER_FILES"); - } -}; - // Don't support vk_icdNegotiateLoaderICDInterfaceVersion // Loader calls vk_icdGetInstanceProcAddr second // does not support vk_icdGetInstanceProcAddr @@ -107,7 +92,7 @@ TEST(EnvVarICDOverrideSetup, version_2_negotiate_interface_version_and_icd_gipa_ TEST(EnvVarICDOverrideSetup, TestOnlyDriverEnvVar) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)); - env.get_test_icd(0).physical_devices.emplace_back("pd0"); + env.get_test_icd(0).add_physical_device("pd0"); InstWrapper inst1{env.vulkan_functions}; FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); @@ -121,9 +106,9 @@ TEST(EnvVarICDOverrideSetup, TestOnlyDriverEnvVar) { ASSERT_EQ(phys_dev_count, 1U); for (uint32_t add = 0; add < 2; ++add) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)); - env.get_test_icd(add + 1).physical_devices.emplace_back("pd" + std::to_string(add) + "0"); - env.get_test_icd(add + 1).physical_devices.emplace_back("pd" + std::to_string(add) + "1"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)) + .add_physical_device("pd" + std::to_string(add) + "0") + .add_physical_device("pd" + std::to_string(add) + "1"); } env.debug_log.clear(); @@ -147,23 +132,66 @@ TEST(EnvVarICDOverrideSetup, TestOnlyDriverEnvVar) { EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!")); env.platform_shim->set_elevated_privilege(false); +} + +// Test VK_DRIVER_FILES environment variable containing a path to a folder +TEST(EnvVarICDOverrideSetup, TestOnlyDriverEnvVarInFolder) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var).set_is_dir(false)); + env.get_test_icd(0).add_physical_device("pd0"); + + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + EXPECT_FALSE( + env.debug_log.find("Ignoring override VK_ICD_FILENAMES, VK_DRIVER_FILES, and VK_ADD_DRIVER_FILES due to high-integrity")); + + std::array phys_devs_array; + uint32_t phys_dev_count = 1; + ASSERT_EQ(inst1->vkEnumeratePhysicalDevices(inst1.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); + ASSERT_EQ(phys_dev_count, 1U); + + for (uint32_t add = 0; add < 2; ++add) { + env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)) + .add_physical_device("pd" + std::to_string(add) + "0") + .add_physical_device("pd" + std::to_string(add) + "1"); + } + + env.debug_log.clear(); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + phys_dev_count = 5; + ASSERT_EQ(inst2->vkEnumeratePhysicalDevices(inst2.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); + ASSERT_EQ(phys_dev_count, 5U); - remove_env_var("VK_DRIVER_FILES"); + env.debug_log.clear(); + + env.platform_shim->set_elevated_privilege(true); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); + + EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!")); + + env.platform_shim->set_elevated_privilege(false); } -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) -// Make sure the loader reports the correct message based on if USE_UNSAFE_FILE_SEARCH is set or not +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) +// Make sure the loader reports the correct message based on if LOADER_USE_UNSAFE_FILE_SEARCH is set or not TEST(EnvVarICDOverrideSetup, NonSecureEnvVarLookup) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; FillDebugUtilsCreateDetails(inst.create_info, log); inst.CheckCreate(); -#if !defined(USE_UNSAFE_FILE_SEARCH) +#if !defined(LOADER_USE_UNSAFE_FILE_SEARCH) ASSERT_FALSE(log.find("Loader is using non-secure environment variable lookup for")); #else ASSERT_TRUE(log.find("Loader is using non-secure environment variable lookup for")); @@ -176,29 +204,42 @@ TEST(EnvVarICDOverrideSetup, XDG) { // so that the test app can find them. Include some badly specified elements as well. // Need to redirect the 'home' directory fs::path HOME = "/home/fake_home"; - set_env_var("HOME", HOME.str()); - set_env_var("XDG_CONFIG_DIRS", ":/tmp/goober:::::/tmp/goober/::::"); - set_env_var("XDG_CONFIG_HOME", ":/tmp/goober:::::/tmp/goober2/::::"); - set_env_var("XDG_DATA_DIRS", "::::/tmp/goober3:/tmp/goober4/with spaces:::"); - set_env_var("XDG_DATA_HOME", "::::/tmp/goober3:/tmp/goober4/with spaces:::"); + EnvVarWrapper home_env_var{"HOME", HOME.str()}; + EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", ":/tmp/goober:::::/tmp/goober/::::"}; + EnvVarWrapper xdg_config_home_env_var{"XDG_CONFIG_HOME", ":/tmp/goober:::::/tmp/goober2/::::"}; + EnvVarWrapper xdg_data_dirs_env_var{"XDG_DATA_DIRS", "::::/tmp/goober3:/tmp/goober4/with spaces:::"}; + EnvVarWrapper xdg_data_home_env_var{"XDG_DATA_HOME", "::::/tmp/goober3:/tmp/goober4/with spaces:::"}; FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); InstWrapper inst{env.vulkan_functions}; FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(); - auto check_paths = [](DebugUtilsLogger const& debug_log, ManifestCategory category, fs::path const& HOME) { + auto check_paths = [](DebugUtilsLogger const& debug_log, ManifestCategory category) { 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())); }; - check_paths(env.debug_log, ManifestCategory::icd, HOME); - check_paths(env.debug_log, ManifestCategory::implicit_layer, HOME); - check_paths(env.debug_log, ManifestCategory::explicit_layer, HOME); + check_paths(env.debug_log, ManifestCategory::icd); + check_paths(env.debug_log, ManifestCategory::implicit_layer); + check_paths(env.debug_log, ManifestCategory::explicit_layer); +} +// Check that a json file in the paths don't cause the loader to crash +TEST(EnvVarICDOverrideSetup, XDGContainsJsonFile) { + // Set up a layer path that includes default and user-specified locations, + // so that the test app can find them. Include some badly specified elements as well. + // Need to redirect the 'home' directory + EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", "bad_file.json"}; + + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(VK_SUCCESS); } #endif @@ -226,8 +267,6 @@ TEST(EnvVarICDOverrideSetup, TestOnlyAddDriverEnvVar) { EXPECT_TRUE(env.debug_log.find("vkCreateInstance: Found no drivers!")); env.platform_shim->set_elevated_privilege(false); - - remove_env_var("VK_ADD_DRIVER_FILES"); } // Test Both VK_DRIVER_FILES and VK_ADD_DRIVER_FILES environment variable @@ -236,11 +275,10 @@ TEST(EnvVarICDOverrideSetup, TestBothDriverEnvVars) { // Add a driver that isn't enabled with the environment variable env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::env_var)); - env.get_test_icd(0).physical_devices.emplace_back("pd0"); - env.get_test_icd(0).physical_devices.emplace_back("pd1"); + env.get_test_icd(0).add_physical_device("pd0").add_physical_device("pd1"); env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_discovery_type(ManifestDiscoveryType::add_env_var)); - env.get_test_icd(0).physical_devices.emplace_back("pd2"); + env.get_test_icd(0).add_physical_device("pd2"); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); @@ -250,17 +288,13 @@ TEST(EnvVarICDOverrideSetup, TestBothDriverEnvVars) { uint32_t phys_dev_count = 3; ASSERT_EQ(inst->vkEnumeratePhysicalDevices(inst.inst, &phys_dev_count, phys_devs_array.data()), VK_SUCCESS); ASSERT_EQ(phys_dev_count, 3U); - - remove_env_var("VK_DRIVER_FILES"); - remove_env_var("VK_ADD_DRIVER_FILES"); } -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) // Test VK_LAYER_PATH environment variable TEST(EnvVarICDOverrideSetup, TestOnlyLayerEnvVar) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); env.platform_shim->redirect_path("/tmp/carol", env.get_folder(ManifestLocation::explicit_layer_env_var).location()); const char* layer_name = "TestLayer"; @@ -274,11 +308,10 @@ TEST(EnvVarICDOverrideSetup, TestOnlyLayerEnvVar) { // so that the test app can find them. Include some badly specified elements as well. // Need to redirect the 'home' directory fs::path HOME = "/home/fake_home"; - set_env_var("HOME", HOME.str()); + EnvVarWrapper home_env_var{"HOME", HOME.str()}; std::string vk_layer_path = ":/tmp/carol::::/:"; vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str(); - set_env_var("VK_LAYER_PATH", vk_layer_path); - + EnvVarWrapper layer_path_env_var{"VK_LAYER_PATH", vk_layer_path}; InstWrapper inst1{env.vulkan_functions}; inst1.create_info.add_layer(layer_name); FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); @@ -301,15 +334,12 @@ TEST(EnvVarICDOverrideSetup, TestOnlyLayerEnvVar) { EXPECT_FALSE(env.debug_log.find("/tmp/carol")); env.platform_shim->set_elevated_privilege(false); - - remove_env_var("VK_LAYER_PATH"); } // Test VK_ADD_LAYER_PATH environment variable TEST(EnvVarICDOverrideSetup, TestOnlyAddLayerEnvVar) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); env.platform_shim->redirect_path("/tmp/carol", env.get_folder(ManifestLocation::explicit_layer_add_env_var).location()); const char* layer_name = "TestLayer"; @@ -323,10 +353,10 @@ TEST(EnvVarICDOverrideSetup, TestOnlyAddLayerEnvVar) { // so that the test app can find them. Include some badly specified elements as well. // Need to redirect the 'home' directory fs::path HOME = "/home/fake_home"; - set_env_var("HOME", HOME.str()); + EnvVarWrapper home_env_var{"HOME", HOME.str()}; std::string vk_layer_path = ":/tmp/carol::::/:"; vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str(); - set_env_var("VK_ADD_LAYER_PATH", vk_layer_path); + EnvVarWrapper add_layer_path_env_var{"VK_ADD_LAYER_PATH", vk_layer_path}; InstWrapper inst1{env.vulkan_functions}; inst1.create_info.add_layer(layer_name); @@ -350,8 +380,371 @@ TEST(EnvVarICDOverrideSetup, TestOnlyAddLayerEnvVar) { EXPECT_FALSE(env.debug_log.find("/tmp/carol")); env.platform_shim->set_elevated_privilege(false); - - remove_env_var("VK_ADD_LAYER_PATH"); } #endif + +// Test that the driver filter select will only enable driver manifest files that match the filter +TEST(EnvVarICDOverrideSetup, FilterSelectDriver) { + FrameworkEnvironment env{}; + EnvVarWrapper filter_select_env_var{"VK_LOADER_DRIVERS_SELECT"}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD")); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD")); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_disable_icd_inc(true).set_json_name("CDE_ICD")); + + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Match full-name + env.debug_log.clear(); + filter_select_env_var.set_new_value("ABC_ICD.json"); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_TRUE(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")); + + // Match prefix + env.debug_log.clear(); + filter_select_env_var.set_new_value("ABC*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_TRUE(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")); + + // Match suffix + env.debug_log.clear(); + filter_select_env_var.set_new_value("*C_ICD.json"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_TRUE(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")); + + // Match sub-string + env.debug_log.clear(); + filter_select_env_var.set_new_value("*BC*"); + + InstWrapper inst5{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + inst5.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_TRUE(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")); + + // Match all with star '*' + env.debug_log.clear(); + filter_select_env_var.set_new_value("*"); + + InstWrapper inst6{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + inst6.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Match all with special name + env.debug_log.clear(); + filter_select_env_var.set_new_value("~all~"); + + InstWrapper inst7{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); + inst7.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // The full-name string is not a valid match if it doesn't also include the file extension + env.debug_log.clear(); + filter_select_env_var.set_new_value("ABC_ICD"); + + InstWrapper inst8{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst8.create_info, env.debug_log); + inst8.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_TRUE(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")); +} + +// Test that the driver filter disable disables driver manifest files that match the filter +TEST(EnvVarICDOverrideSetup, FilterDisableDriver) { + FrameworkEnvironment env{}; + EnvVarWrapper filter_disable_env_var{"VK_LOADER_DRIVERS_DISABLE"}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD")); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD")); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_disable_icd_inc(true).set_json_name("CDE_ICD")); + + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Match full-name + env.debug_log.clear(); + filter_disable_env_var.set_new_value("ABC_ICD.json"); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Match prefix + env.debug_log.clear(); + filter_disable_env_var.set_new_value("ABC_*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Match suffix + env.debug_log.clear(); + filter_disable_env_var.set_new_value("*C_ICD.json"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Match substring + env.debug_log.clear(); + filter_disable_env_var.set_new_value("*BC*"); + + InstWrapper inst5{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + inst5.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Match all with star '*' + env.debug_log.clear(); + filter_disable_env_var.set_new_value("*"); + + InstWrapper inst6{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + inst6.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); + + // Match all with special name + env.debug_log.clear(); + filter_disable_env_var.set_new_value("~all~"); + + InstWrapper inst7{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); + inst7.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); +} + +// Test that the when both driver filter select and disable environment variables are present, that the +// appropriate drivers are enabled and disabled +TEST(EnvVarICDOverrideSetup, FilterSelectAndDisableDriver) { + FrameworkEnvironment env{}; + EnvVarWrapper filter_disable_env_var{"VK_LOADER_DRIVERS_DISABLE"}; + EnvVarWrapper filter_select_env_var{"VK_LOADER_DRIVERS_SELECT"}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_disable_icd_inc(true).set_json_name("ABC_ICD")); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_2}.set_disable_icd_inc(true).set_json_name("BCD_ICD")); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_disable_icd_inc(true).set_json_name("CDE_ICD")); + + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); + + // Disable two, but enable one + env.debug_log.clear(); + filter_disable_env_var.set_new_value("*BC*"); + filter_select_env_var.set_new_value("BCD*"); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_TRUE(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")); + + // Disable all, but enable two + env.debug_log.clear(); + filter_disable_env_var.set_new_value("*"); + filter_select_env_var.set_new_value("*BC*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because not selected by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("CDE_ICD.json", "ignored because it was disabled by env var")); + + // Disable all, but enable all + env.debug_log.clear(); + filter_disable_env_var.set_new_value("*"); + filter_select_env_var.set_new_value("*"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "ABC_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("ABC_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "BCD_ICD.json")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because not selected by env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("BCD_ICD.json", "ignored because it was disabled by env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found ICD manifest file", "CDE_ICD.json")); + 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")); +} diff --git a/tests/loader_get_proc_addr_tests.cpp b/tests/loader_get_proc_addr_tests.cpp index 64a3c74d582f4602225d26f492374b40996ce359..295eee7b94bfb842b2d2f805d7a79c1293ce113f 100644 --- a/tests/loader_get_proc_addr_tests.cpp +++ b/tests/loader_get_proc_addr_tests.cpp @@ -30,8 +30,7 @@ // Verify that the various ways to get vkGetInstanceProcAddr return the same value TEST(GetProcAddr, VerifyGetInstanceProcAddr) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); { InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(VK_API_VERSION_1_1); @@ -62,8 +61,7 @@ TEST(GetProcAddr, VerifyGetInstanceProcAddr) { // Verify that the various ways to get vkGetDeviceProcAddr return the same value TEST(GetProcAddr, VerifyGetDeviceProcAddr) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(VK_API_VERSION_1_1); @@ -73,16 +71,13 @@ TEST(GetProcAddr, VerifyGetDeviceProcAddr) { // NOTE: The vulkan_functions are queried using the platform get proc addr from the loader. So we'll compare // that to what is returned by asking it what the various Vulkan get proc addr functions are. PFN_vkGetDeviceProcAddr gdpa_loader = env.vulkan_functions.vkGetDeviceProcAddr; - PFN_vkGetDeviceProcAddr gdpa_inst_queried = - reinterpret_cast(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetDeviceProcAddr")); + PFN_vkGetDeviceProcAddr gdpa_inst_queried = inst.load("vkGetDeviceProcAddr"); ASSERT_EQ(gdpa_loader, gdpa_inst_queried); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_dev); - PFN_vkGetDeviceProcAddr gdpa_dev_queried = - reinterpret_cast(env.vulkan_functions.vkGetDeviceProcAddr(dev.dev, "vkGetDeviceProcAddr")); + PFN_vkGetDeviceProcAddr gdpa_dev_queried = dev.load("vkGetDeviceProcAddr"); ASSERT_EQ(gdpa_loader, gdpa_dev_queried); } @@ -90,8 +85,7 @@ TEST(GetProcAddr, VerifyGetDeviceProcAddr) { // Call the function to make sure it is callable, don't care about what is returned. TEST(GetProcAddr, GlobalFunctions) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); auto& gipa = env.vulkan_functions.vkGetInstanceProcAddr; // global entry points with NULL instance handle @@ -126,29 +120,28 @@ TEST(GetProcAddr, GlobalFunctions) { inst.create_info.api_version = VK_MAKE_API_VERSION(0, 1, i, 0); inst.CheckCreate(); - auto EnumerateInstanceExtensionProperties = - reinterpret_cast(gipa(inst, "vkEnumerateInstanceExtensionProperties")); + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties = + inst.load("vkEnumerateInstanceExtensionProperties"); handle_assert_has_value(EnumerateInstanceExtensionProperties); uint32_t ext_count = 0; ASSERT_EQ(VK_SUCCESS, EnumerateInstanceExtensionProperties("", &ext_count, nullptr)); - auto EnumerateInstanceLayerProperties = - reinterpret_cast(gipa(inst, "vkEnumerateInstanceLayerProperties")); + PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties = inst.load("vkEnumerateInstanceLayerProperties"); handle_assert_has_value(EnumerateInstanceLayerProperties); uint32_t layer_count = 0; ASSERT_EQ(VK_SUCCESS, EnumerateInstanceLayerProperties(&layer_count, nullptr)); - auto EnumerateInstanceVersion = reinterpret_cast(gipa(inst, "vkEnumerateInstanceVersion")); + PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion = inst.load("vkEnumerateInstanceVersion"); handle_assert_has_value(EnumerateInstanceVersion); uint32_t api_version = 0; EnumerateInstanceVersion(&api_version); - auto GetInstanceProcAddr = reinterpret_cast(gipa(inst, "vkGetInstanceProcAddr")); + PFN_vkGetInstanceProcAddr GetInstanceProcAddr = inst.load("vkGetInstanceProcAddr"); handle_assert_has_value(GetInstanceProcAddr); ASSERT_EQ(GetInstanceProcAddr, reinterpret_cast(GetInstanceProcAddr(inst, "vkGetInstanceProcAddr"))); - auto CreateInstance = reinterpret_cast(gipa(inst, "vkCreateInstance")); + PFN_vkCreateInstance CreateInstance = inst.load("vkCreateInstance"); handle_assert_has_value(CreateInstance); } { @@ -157,31 +150,346 @@ TEST(GetProcAddr, GlobalFunctions) { inst.create_info.api_version = VK_MAKE_API_VERSION(0, 1, 3, 0); inst.CheckCreate(); - auto EnumerateInstanceExtensionProperties = - reinterpret_cast(gipa(inst, "vkEnumerateInstanceExtensionProperties")); + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties = + inst.load("vkEnumerateInstanceExtensionProperties"); handle_assert_null(EnumerateInstanceExtensionProperties); - auto EnumerateInstanceLayerProperties = - reinterpret_cast(gipa(inst, "vkEnumerateInstanceLayerProperties")); + PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties = inst.load("vkEnumerateInstanceLayerProperties"); handle_assert_null(EnumerateInstanceLayerProperties); - auto EnumerateInstanceVersion = reinterpret_cast(gipa(inst, "vkEnumerateInstanceVersion")); + PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion = inst.load("vkEnumerateInstanceVersion"); handle_assert_null(EnumerateInstanceVersion); - auto CreateInstance = reinterpret_cast(gipa(inst, "vkCreateInstance")); + PFN_vkCreateInstance CreateInstance = inst.load("vkCreateInstance"); handle_assert_null(CreateInstance); - auto GetInstanceProcAddr = reinterpret_cast(gipa(inst, "vkGetInstanceProcAddr")); + PFN_vkGetInstanceProcAddr GetInstanceProcAddr = inst.load("vkGetInstanceProcAddr"); handle_assert_equal(env.vulkan_functions.vkGetInstanceProcAddr, GetInstanceProcAddr); ASSERT_EQ(GetInstanceProcAddr, reinterpret_cast(GetInstanceProcAddr(inst, "vkGetInstanceProcAddr"))); ASSERT_EQ(GetInstanceProcAddr, reinterpret_cast(GetInstanceProcAddr(NULL, "vkGetInstanceProcAddr"))); // get a non pre-instance function pointer - auto EnumeratePhysicalDevices = reinterpret_cast(gipa(inst, "vkEnumeratePhysicalDevices")); + PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices = inst.load("vkEnumeratePhysicalDevices"); handle_assert_has_value(EnumeratePhysicalDevices); - EnumeratePhysicalDevices = reinterpret_cast(gipa(NULL, "vkEnumeratePhysicalDevices")); + EnumeratePhysicalDevices = reinterpret_cast(gipa(NULL, "vkEnumeratePhysicalDevices")); handle_assert_null(EnumeratePhysicalDevices); } -} \ No newline at end of file +} + +TEST(GetProcAddr, Verify10FunctionsFailToLoadWithSingleDriver) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}).set_can_query_GetPhysicalDeviceFuncs(false); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); +} + +TEST(GetProcAddr, Verify10FunctionsLoadWithMultipleDrivers) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}).set_can_query_GetPhysicalDeviceFuncs(false); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + inst.GetPhysDevs(1); +} + +// Swapchain functions which require a terminator in all cases have situations where the driver may have a +// NULL function pointer but the loader shouldn't abort() if that is the case. Rather, it should log a message +// and return VK_SUCCESS to maintain previous behavior. +TEST(GetDeviceProcAddr, SwapchainFuncsWithTerminator) { + FrameworkEnvironment env{}; + auto& driver = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).setup_WSI().add_physical_device("physical_device_0"); + + InstWrapper inst(env.vulkan_functions); + inst.create_info.add_extension("VK_EXT_debug_utils"); + inst.create_info.setup_WSI(); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + + VkSurfaceKHR surface{}; + ASSERT_EQ(VK_SUCCESS, create_surface(inst, surface)); + + DebugUtilsWrapper log{inst}; + ASSERT_EQ(VK_SUCCESS, CreateDebugUtilsMessenger(log)); + auto phys_dev = inst.GetPhysDev(); + { + DeviceWrapper dev{inst}; + ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); + DeviceFunctions dev_funcs{env.vulkan_functions, dev}; + + PFN_vkCreateSwapchainKHR CreateSwapchainKHR = dev.load("vkCreateSwapchainKHR"); + PFN_vkCreateSwapchainKHR inst_CreateSwapchainKHR = inst.load("vkCreateSwapchainKHR"); + PFN_vkGetDeviceGroupSurfacePresentModesKHR GetDeviceGroupSurfacePresentModesKHR = + dev.load("vkGetDeviceGroupSurfacePresentModesKHR"); + PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR = dev.load("vkCreateSharedSwapchainsKHR"); + ASSERT_FALSE(CreateSwapchainKHR); + ASSERT_TRUE(inst_CreateSwapchainKHR); + ASSERT_FALSE(GetDeviceGroupSurfacePresentModesKHR); + ASSERT_FALSE(CreateSharedSwapchainsKHR); + + VkSwapchainCreateInfoKHR info{}; + info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + info.surface = surface; + + VkSwapchainKHR swapchain{}; + if (CreateSwapchainKHR) CreateSwapchainKHR(dev.dev, &info, nullptr, &swapchain); + ASSERT_FALSE( + log.find("vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " + "extension enabled?")); + log.logger.clear(); + 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) { + ASSERT_DEATH(inst_CreateSwapchainKHR(dev.dev, &info, nullptr, &swapchain), + "vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " + "extension enabled?"); + } + log.logger.clear(); + if (dev_funcs.vkDestroySwapchainKHR) dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); + + VkDeviceGroupPresentModeFlagsKHR modes{}; + if (GetDeviceGroupSurfacePresentModesKHR) GetDeviceGroupSurfacePresentModesKHR(dev.dev, surface, &modes); + + if (CreateSharedSwapchainsKHR) CreateSharedSwapchainsKHR(dev.dev, 1, &info, nullptr, &swapchain); + } + driver.physical_devices.at(0).add_extensions({"VK_KHR_swapchain", "VK_KHR_display_swapchain", "VK_EXT_debug_marker"}); + { + DeviceWrapper dev{inst}; + dev.create_info.add_extensions({"VK_KHR_swapchain", "VK_KHR_display_swapchain", "VK_EXT_debug_marker"}); + ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); + DeviceFunctions dev_funcs{env.vulkan_functions, dev}; + + PFN_vkCreateSwapchainKHR CreateSwapchainKHR = dev.load("vkCreateSwapchainKHR"); + PFN_vkCreateSwapchainKHR inst_CreateSwapchainKHR = inst.load("vkCreateSwapchainKHR"); + PFN_vkGetDeviceGroupSurfacePresentModesKHR GetDeviceGroupSurfacePresentModesKHR = + dev.load("vkGetDeviceGroupSurfacePresentModesKHR"); + PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR = dev.load("vkCreateSharedSwapchainsKHR"); + ASSERT_TRUE(CreateSwapchainKHR); + ASSERT_TRUE(inst_CreateSwapchainKHR); + ASSERT_TRUE(GetDeviceGroupSurfacePresentModesKHR); + ASSERT_TRUE(CreateSharedSwapchainsKHR); + + VkSwapchainCreateInfoKHR info{}; + info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + info.surface = surface; + + VkSwapchainKHR swapchain{}; + if (CreateSwapchainKHR) CreateSwapchainKHR(dev.dev, &info, nullptr, &swapchain); + ASSERT_FALSE( + log.find("vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " + "extension enabled?")); + log.logger.clear(); + if (dev_funcs.vkDestroySwapchainKHR) dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); + if (inst_CreateSwapchainKHR) inst_CreateSwapchainKHR(dev.dev, &info, nullptr, &swapchain); + ASSERT_FALSE( + log.find("vkCreateSwapchainKHR: Driver's function pointer was NULL, returning VK_SUCCESS. Was the VK_KHR_swapchain " + "extension enabled?")); + log.logger.clear(); + if (dev_funcs.vkDestroySwapchainKHR) dev_funcs.vkDestroySwapchainKHR(dev.dev, swapchain, nullptr); + + VkDeviceGroupPresentModeFlagsKHR modes{}; + if (GetDeviceGroupSurfacePresentModesKHR) GetDeviceGroupSurfacePresentModesKHR(dev.dev, surface, &modes); + + if (CreateSharedSwapchainsKHR) CreateSharedSwapchainsKHR(dev.dev, 1, &info, nullptr, &swapchain); + } + env.vulkan_functions.vkDestroySurfaceKHR(inst.inst, surface, nullptr); +} + +// Verify that the various ways to get vkGetDeviceProcAddr return the same value +TEST(GetProcAddr, PreserveLayerGettingVkCreateDeviceWithNullInstance) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); + + env.add_implicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("VK_LAYER_technically_buggy_layer") + .set_description("actually_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("if_you_can")), + "buggy_layer_1.json")); + env.get_test_layer().set_buggy_query_of_vkCreateDevice(true); + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(VK_API_VERSION_1_1); + inst.CheckCreate(); + VkPhysicalDevice phys_dev = inst.GetPhysDev(); + + DeviceWrapper dev{inst}; + dev.CheckCreate(phys_dev); +} + +// 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 +// should return zero when that extension is enabled. + +TEST(GetDeviceProcAddr, AppQueries11FunctionsWhileOnlyEnabling10) { + FrameworkEnvironment env{}; + auto& driver = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_icd_api_version(VK_API_VERSION_1_1) + .add_physical_device( + PhysicalDevice{}.set_api_version(VK_API_VERSION_1_1).add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME).finish()); + + std::vector functions = {"vkGetDeviceQueue2", "vkCmdDispatchBase", "vkCreateDescriptorUpdateTemplate"}; + for (const auto& f : functions) { + driver.physical_devices.back().add_device_function(VulkanFunction{f, [] {}}); + } + { // doesn't enable the feature or extension + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 0, 0); + inst.CheckCreate(); + + DeviceWrapper dev{inst}; + dev.CheckCreate(inst.GetPhysDev()); + for (const auto& f : functions) { + ASSERT_NE(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } + { // doesn't enable the feature + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 0, 0); + inst.CheckCreate(); + + DeviceWrapper dev{inst}; + dev.create_info.add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME); + dev.CheckCreate(inst.GetPhysDev()); + for (const auto& f : functions) { + ASSERT_NE(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } + { // enables the feature and extension + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 0, 0); + inst.CheckCreate(); + + VkPhysicalDeviceMaintenance5FeaturesKHR features{}; + features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; + features.maintenance5 = VK_TRUE; + + DeviceWrapper dev{inst}; + dev.create_info.add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME); + dev.create_info.dev.pNext = &features; + dev.CheckCreate(inst.GetPhysDev()); + for (const auto& f : functions) { + ASSERT_EQ(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } +} + +TEST(GetDeviceProcAddr, AppQueries12FunctionsWhileOnlyEnabling11) { + FrameworkEnvironment env{}; + auto& driver = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2) + .add_physical_device( + PhysicalDevice{}.set_api_version(VK_API_VERSION_1_2).add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME).finish()); + std::vector functions = {"vkCmdDrawIndirectCount", "vkCmdNextSubpass2", "vkGetBufferDeviceAddress", + "vkGetDeviceMemoryOpaqueCaptureAddress"}; + for (const auto& f : functions) { + driver.physical_devices.back().add_device_function(VulkanFunction{f, [] {}}); + } + { // doesn't enable the feature or extension + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 1, 0); + inst.CheckCreate(); + + DeviceWrapper dev{inst}; + dev.CheckCreate(inst.GetPhysDev()); + + for (const auto& f : functions) { + ASSERT_NE(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } + { // doesn't enable the feature + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 1, 0); + inst.CheckCreate(); + + DeviceWrapper dev{inst}; + dev.create_info.add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME); + dev.CheckCreate(inst.GetPhysDev()); + + for (const auto& f : functions) { + ASSERT_NE(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } + { // enables the feature and extension + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 1, 0); + inst.CheckCreate(); + + VkPhysicalDeviceMaintenance5FeaturesKHR features{}; + features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; + features.maintenance5 = VK_TRUE; + + DeviceWrapper dev{inst}; + dev.create_info.add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME); + dev.create_info.dev.pNext = &features; + dev.CheckCreate(inst.GetPhysDev()); + + for (const auto& f : functions) { + ASSERT_EQ(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } +} + +TEST(GetDeviceProcAddr, AppQueries13FunctionsWhileOnlyEnabling12) { + FrameworkEnvironment env{}; + auto& driver = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_3)) + .set_icd_api_version(VK_API_VERSION_1_3) + .add_physical_device( + PhysicalDevice{}.set_api_version(VK_API_VERSION_1_3).add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME).finish()); + std::vector functions = {"vkCreatePrivateDataSlot", "vkGetDeviceBufferMemoryRequirements", "vkCmdWaitEvents2", + "vkGetDeviceImageSparseMemoryRequirements"}; + + for (const auto& f : functions) { + driver.physical_devices.back().add_device_function(VulkanFunction{f, [] {}}); + } + { // doesn't enable the feature or extension + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 2, 0); + inst.CheckCreate(); + + DeviceWrapper dev{inst}; + dev.CheckCreate(inst.GetPhysDev()); + + for (const auto& f : functions) { + ASSERT_NE(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } + { // doesn't enable the feature + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 2, 0); + inst.CheckCreate(); + + DeviceWrapper dev{inst}; + dev.create_info.add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME); + dev.CheckCreate(inst.GetPhysDev()); + + for (const auto& f : functions) { + ASSERT_NE(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } + { // enables the feature and extension + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 2, 0); + inst.CheckCreate(); + + VkPhysicalDeviceMaintenance5FeaturesKHR features{}; + features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; + features.maintenance5 = VK_TRUE; + + DeviceWrapper dev{inst}; + dev.create_info.add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME); + dev.create_info.dev.pNext = &features; + dev.CheckCreate(inst.GetPhysDev()); + + for (const auto& f : functions) { + ASSERT_EQ(nullptr, dev->vkGetDeviceProcAddr(dev.dev, f)); + } + } +} diff --git a/tests/loader_handle_validation_tests.cpp b/tests/loader_handle_validation_tests.cpp index 614e4336f08a21385db1580ceddf3d1d07bfb489..7154393f947e0327ee9c98fe98df252c3e43271f 100644 --- a/tests/loader_handle_validation_tests.cpp +++ b/tests/loader_handle_validation_tests.cpp @@ -41,9 +41,7 @@ T get_bad_handle() { TEST(LoaderHandleValidTests, BadInstEnumPhysDevices) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); @@ -57,9 +55,7 @@ TEST(LoaderHandleValidTests, BadInstEnumPhysDevices) { TEST(LoaderHandleValidTests, BadInstGetInstProcAddr) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); @@ -71,9 +67,7 @@ TEST(LoaderHandleValidTests, BadInstGetInstProcAddr) { TEST(LoaderHandleValidTests, BadInstDestroyInstance) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); @@ -86,15 +80,14 @@ TEST(LoaderHandleValidTests, BadInstDestroyInstance) { TEST(LoaderHandleValidTests, BadInstDestroySurface) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension first_ext{"VK_KHR_surface"}; Extension second_ext{"VK_EXT_headless_surface"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions({first_ext, second_ext}) + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); + instance.create_info.add_extension(first_ext.extensionName.c_str()); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -105,16 +98,14 @@ TEST(LoaderHandleValidTests, BadInstDestroySurface) { TEST(LoaderHandleValidTests, BadInstCreateHeadlessSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension first_ext{"VK_KHR_surface"}; Extension second_ext{"VK_EXT_headless_surface"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions({first_ext, second_ext}) + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_EXT_headless_surface"); + instance.create_info.add_extensions({first_ext.extensionName.c_str(), second_ext.extensionName.c_str()}); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -129,16 +120,14 @@ TEST(LoaderHandleValidTests, BadInstCreateHeadlessSurf) { TEST(LoaderHandleValidTests, BadInstCreateDisplayPlaneSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension first_ext{"VK_KHR_surface"}; Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions({first_ext, second_ext}) + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); + instance.create_info.add_extensions({first_ext.extensionName.c_str(), second_ext.extensionName.c_str()}); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -151,16 +140,13 @@ TEST(LoaderHandleValidTests, BadInstCreateDisplayPlaneSurf) { "vkCreateDisplayPlaneSurfaceKHR: Invalid instance \\[VUID-vkCreateDisplayPlaneSurfaceKHR-instance-parameter\\]"); } -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) TEST(LoaderHandleValidTests, BadInstCreateAndroidSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -174,16 +160,13 @@ TEST(LoaderHandleValidTests, BadInstCreateAndroidSurf) { } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) TEST(LoaderHandleValidTests, BadInstCreateDirectFBSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -197,16 +180,13 @@ TEST(LoaderHandleValidTests, BadInstCreateDirectFBSurf) { } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) TEST(LoaderHandleValidTests, BadInstCreateFuchsiaSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -220,16 +200,13 @@ TEST(LoaderHandleValidTests, BadInstCreateFuchsiaSurf) { } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) TEST(LoaderHandleValidTests, BadInstCreateGGPSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -244,16 +221,13 @@ TEST(LoaderHandleValidTests, BadInstCreateGGPSurf) { } #endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) TEST(LoaderHandleValidTests, BadInstCreateIOSSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -267,16 +241,13 @@ TEST(LoaderHandleValidTests, BadInstCreateIOSSurf) { } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) TEST(LoaderHandleValidTests, BadInstCreateMacOSSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -293,13 +264,10 @@ TEST(LoaderHandleValidTests, BadInstCreateMacOSSurf) { #if defined(VK_USE_PLATFORM_METAL_EXT) TEST(LoaderHandleValidTests, BadInstCreateMetalSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -313,16 +281,13 @@ TEST(LoaderHandleValidTests, BadInstCreateMetalSurf) { } #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) TEST(LoaderHandleValidTests, BadInstCreateQNXSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -337,16 +302,13 @@ TEST(LoaderHandleValidTests, BadInstCreateQNXSurf) { } #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) TEST(LoaderHandleValidTests, BadInstCreateViNNSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -361,16 +323,13 @@ TEST(LoaderHandleValidTests, BadInstCreateViNNSurf) { } #endif // VK_USE_PLATFORM_VI_NN -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) TEST(LoaderHandleValidTests, BadInstCreateWaylandSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -385,16 +344,13 @@ TEST(LoaderHandleValidTests, BadInstCreateWaylandSurf) { } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) TEST(LoaderHandleValidTests, BadInstCreateWin32Surf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -409,16 +365,13 @@ TEST(LoaderHandleValidTests, BadInstCreateWin32Surf) { } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) TEST(LoaderHandleValidTests, BadInstCreateXCBSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -433,16 +386,13 @@ TEST(LoaderHandleValidTests, BadInstCreateXCBSurf) { } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) TEST(LoaderHandleValidTests, BadInstCreateXlibSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_instance = get_bad_handle(); @@ -461,9 +411,9 @@ TEST(LoaderHandleValidTests, BadInstCreateXlibSurf) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -479,9 +429,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -497,9 +447,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -517,9 +467,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -535,9 +485,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -552,9 +502,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -570,9 +520,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps) { TEST(LoaderHandleValidTests, BadPhysDevCreateDevice) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -606,9 +556,9 @@ TEST(LoaderHandleValidTests, BadPhysDevCreateDevice) { TEST(LoaderHandleValidTests, BadPhysDevEnumDevExtProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -623,9 +573,9 @@ TEST(LoaderHandleValidTests, BadPhysDevEnumDevExtProps) { TEST(LoaderHandleValidTests, BadPhysDevEnumDevLayerProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -640,9 +590,9 @@ TEST(LoaderHandleValidTests, BadPhysDevEnumDevLayerProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -660,9 +610,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -680,9 +630,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFeature2) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -700,9 +650,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFormatProps2) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -723,9 +673,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevImgFormatProps2) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevProps2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -743,9 +693,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevProps2) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -760,9 +710,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamProps2) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -780,9 +730,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDevMemProps2) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -801,9 +751,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSparseImgFormatProps2) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternFenceProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -822,9 +772,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternFenceProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternBufferProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -843,9 +793,9 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternBufferProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternSemaphoreProps) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); InstWrapper instance(env.vulkan_functions); instance.create_info.set_api_version(1, 1, 0); @@ -853,7 +803,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 = {}; @@ -864,15 +814,14 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternSemaphoreProps) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceSupportKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_headless_surface"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); + Extension second_ext{"VK_KHR_display"}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions({first_ext, second_ext}) + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); + instance.create_info.add_extension(first_ext.extensionName.c_str()); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -885,15 +834,14 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceSupportKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCapsKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_headless_surface"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); + Extension second_ext{"VK_KHR_display"}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions({first_ext, second_ext}) + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); + instance.create_info.add_extension(first_ext.extensionName.c_str()); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -905,15 +853,14 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCapsKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormatsKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_headless_surface"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); + Extension second_ext{"VK_KHR_display"}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions({first_ext, second_ext}) + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); + instance.create_info.add_extension(first_ext.extensionName.c_str()); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -925,15 +872,14 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormatsKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModesKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_headless_surface"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); + Extension second_ext{"VK_KHR_display"}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions({first_ext, second_ext}) + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); + instance.create_info.add_extension(first_ext.extensionName.c_str()); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -943,16 +889,13 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModesKHR) { "\\[VUID-vkGetPhysicalDeviceSurfacePresentModesKHR-physicalDevice-parameter\\]"); } -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) TEST(LoaderHandleValidTests, BadPhysDevGetDirectFBPresentSupportKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -963,16 +906,13 @@ TEST(LoaderHandleValidTests, BadPhysDevGetDirectFBPresentSupportKHR) { } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) TEST(LoaderHandleValidTests, BadPhysDevGetQNXPresentSupportKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -982,16 +922,13 @@ TEST(LoaderHandleValidTests, BadPhysDevGetQNXPresentSupportKHR) { } #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevWaylandPresentSupportKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -1001,16 +938,13 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevWaylandPresentSupportKHR) { } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevWin32PresentSupportKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -1020,16 +954,13 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevWin32PresentSupportKHR) { } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) TEST(LoaderHandleValidTests, BadPhysDevGetXCBPresentSupportKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -1040,16 +971,13 @@ TEST(LoaderHandleValidTests, BadPhysDevGetXCBPresentSupportKHR) { } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) TEST(LoaderHandleValidTests, BadPhysDevGetXlibPresentSupportKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); + instance.create_info.setup_WSI(); instance.CheckCreate(); auto bad_physical_dev = get_bad_handle(); @@ -1061,19 +989,25 @@ TEST(LoaderHandleValidTests, BadPhysDevGetXlibPresentSupportKHR) { } #endif // VK_USE_PLATFORM_XLIB_KHR -TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPropsKHR) { - FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); +InstWrapper setup_BadPhysDev_env(FrameworkEnvironment& env, std::vector exts) { + std::vector ext_modified; + for (const auto& ext : exts) { + ext_modified.push_back(Extension{ext}); + } + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_instance_extensions(ext_modified) + .setup_WSI() + .add_physical_device("physical_device_0"); InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); + instance.create_info.add_extensions(exts); instance.CheckCreate(); + return instance; +} + +TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPropsKHR) { + FrameworkEnvironment env{}; + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_display"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1084,17 +1018,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPropsKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlanePropsKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_display"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1105,17 +1029,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlanePropsKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneSupportedDisplaysKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_display"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1126,17 +1040,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneSupportedDisplaysKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetDisplayModePropsKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_display"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1147,17 +1051,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetDisplayModePropsKHR) { TEST(LoaderHandleValidTests, BadPhysDevCreateDisplayModeKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_display"}); auto bad_physical_dev = get_bad_handle(); VkDisplayModeCreateInfoKHR create_info = {}; @@ -1171,17 +1065,7 @@ TEST(LoaderHandleValidTests, BadPhysDevCreateDisplayModeKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCapsKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_display"}); auto bad_physical_dev = get_bad_handle(); VkDisplayPlaneCapabilitiesKHR caps = {}; @@ -1192,17 +1076,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCapsKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevPresentRectsKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_display"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1213,17 +1087,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevPresentRectsKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayProps2KHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_get_display_properties2"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_get_display_properties2"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_get_display_properties2"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1234,17 +1098,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayProps2KHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlaneProps2KHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_get_display_properties2"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_get_display_properties2"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_get_display_properties2"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1255,17 +1109,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevDisplayPlaneProps2KHR) { TEST(LoaderHandleValidTests, BadPhysDevGetDisplayModeProps2KHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_get_display_properties2"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_get_display_properties2"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_get_display_properties2"}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1276,17 +1120,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetDisplayModeProps2KHR) { TEST(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCaps2KHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_get_display_properties2"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_get_display_properties2"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_get_display_properties2"}); auto bad_physical_dev = get_bad_handle(); VkDisplayPlaneInfo2KHR disp_plane_info = {}; @@ -1300,17 +1134,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetDisplayPlaneCaps2KHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCaps2KHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_get_surface_capabilities2"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_surface"); - instance.create_info.add_extension("VK_KHR_get_surface_capabilities2"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_get_surface_capabilities2"}); auto bad_physical_dev = get_bad_handle(); VkPhysicalDeviceSurfaceInfo2KHR phys_dev_surf_info = {}; @@ -1324,16 +1148,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceCaps2KHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormats2KHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_KHR_get_surface_capabilities2"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_KHR_get_surface_capabilities2"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_KHR_get_surface_capabilities2"}); auto bad_physical_dev = get_bad_handle(); VkPhysicalDeviceSurfaceInfo2KHR phys_dev_surf_info = {}; @@ -1347,12 +1162,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfaceFormats2KHR) { TEST(LoaderHandleValidTests, BadPhysDevEnumPhysDevQueueFamilyPerfQueryCountersKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1366,12 +1176,7 @@ TEST(LoaderHandleValidTests, BadPhysDevEnumPhysDevQueueFamilyPerfQueryCountersKH TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamilyPerfQueryPassesKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {}); auto bad_physical_dev = get_bad_handle(); VkQueryPoolPerformanceCreateInfoKHR create_info = {}; @@ -1388,12 +1193,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevQueueFamilyPerfQueryPassesKHR) TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFragmentShadingRatesKHR) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {}); auto bad_physical_dev = get_bad_handle(); uint32_t count = 0; @@ -1406,12 +1206,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevFragmentShadingRatesKHR) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevMSPropsEXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {}); auto bad_physical_dev = get_bad_handle(); VkMultisamplePropertiesEXT props = {}; @@ -1424,16 +1219,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevMSPropsEXT) { TEST(LoaderHandleValidTests, BadPhysDevAcquireDrmDisplayEXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_acquire_drm_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_EXT_acquire_drm_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_EXT_acquire_drm_display"}); auto bad_physical_dev = get_bad_handle(); PFN_vkAcquireDrmDisplayEXT pfn = instance.load("vkAcquireDrmDisplayEXT"); @@ -1444,16 +1230,7 @@ TEST(LoaderHandleValidTests, BadPhysDevAcquireDrmDisplayEXT) { TEST(LoaderHandleValidTests, BadPhysDevGetDrmDisplayEXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_acquire_drm_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_EXT_acquire_drm_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_EXT_acquire_drm_display"}); auto bad_physical_dev = get_bad_handle(); PFN_vkGetDrmDisplayEXT pfn = instance.load("vkGetDrmDisplayEXT"); @@ -1465,16 +1242,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetDrmDisplayEXT) { TEST(LoaderHandleValidTests, BadPhysDevReleaseDisplayEXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_direct_mode_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_EXT_direct_mode_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_EXT_direct_mode_display"}); auto bad_physical_dev = get_bad_handle(); PFN_vkReleaseDisplayEXT pfn = instance.load("vkReleaseDisplayEXT"); @@ -1483,19 +1251,10 @@ TEST(LoaderHandleValidTests, BadPhysDevReleaseDisplayEXT) { "vkReleaseDisplayEXT: Invalid physicalDevice \\[VUID-vkReleaseDisplayEXT-physicalDevice-parameter\\]"); } -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT) TEST(LoaderHandleValidTests, BadPhysDevAcquireXlibDisplayEXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_acquire_xlib_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_EXT_acquire_xlib_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_EXT_acquire_xlib_display"}); auto bad_physical_dev = get_bad_handle(); PFN_vkAcquireXlibDisplayEXT pfn = instance.load("vkAcquireXlibDisplayEXT"); @@ -1506,16 +1265,7 @@ TEST(LoaderHandleValidTests, BadPhysDevAcquireXlibDisplayEXT) { TEST(LoaderHandleValidTests, BadPhysDevGetRandROutputDisplayEXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - Extension first_ext{"VK_KHR_surface"}; - Extension second_ext{"VK_EXT_acquire_xlib_display"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({first_ext, second_ext}); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.add_extension("VK_EXT_acquire_xlib_display"); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {"VK_KHR_surface", "VK_EXT_acquire_xlib_display"}); auto bad_physical_dev = get_bad_handle(); RROutput rrout = {}; @@ -1528,13 +1278,10 @@ TEST(LoaderHandleValidTests, BadPhysDevGetRandROutputDisplayEXT) { } #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModes2EXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); @@ -1554,12 +1301,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevSurfacePresentModes2EXT) { TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevToolPropertiesEXT) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - - InstWrapper instance(env.vulkan_functions); - instance.CheckCreate(); + auto instance = setup_BadPhysDev_env(env, {}); auto bad_physical_dev = get_bad_handle(); PFN_vkGetPhysicalDeviceToolPropertiesEXT pfn = instance.load("vkGetPhysicalDeviceToolPropertiesEXT"); @@ -1570,26 +1312,20 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevToolPropertiesEXT) { "\\[VUID-vkGetPhysicalDeviceToolPropertiesEXT-physicalDevice-parameter\\]"); } -#ifdef VK_USE_PLATFORM_ANDROID_KHR +#if defined(VK_USE_PLATFORM_ANDROID_KHR) TEST(LoaderHandleValidTests, VerifyHandleWrappingAndroidSurface) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkAndroidSurfaceCreateInfoKHR surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; @@ -1604,26 +1340,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingAndroidSurface) { } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT +#if defined(VK_USE_PLATFORM_DIRECTFB_EXT) TEST(LoaderHandleValidTests, VerifyHandleWrappingDirectFBSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkDirectFBSurfaceCreateInfoEXT surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_DIRECTFB_SURFACE_CREATE_INFO_EXT; @@ -1638,26 +1368,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingDirectFBSurf) { } #endif // VK_USE_PLATFORM_DIRECTFB_EXT -#ifdef VK_USE_PLATFORM_FUCHSIA +#if defined(VK_USE_PLATFORM_FUCHSIA) TEST(LoaderHandleValidTests, VerifyHandleWrappingFuchsiaSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkImagePipeSurfaceCreateInfoFUCHSIA surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_IMAGEPIPE_SURFACE_CREATE_INFO_FUCHSIA; @@ -1672,26 +1396,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingFuchsiaSurf) { } #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_GGP +#if defined(VK_USE_PLATFORM_GGP) TEST(LoaderHandleValidTests, VerifyHandleWrappingGGPSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkStreamDescriptorSurfaceCreateInfoGGP surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP; @@ -1706,26 +1424,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingGGPSurf) { } #endif // VK_USE_PLATFORM_GGP -#ifdef VK_USE_PLATFORM_IOS_MVK +#if defined(VK_USE_PLATFORM_IOS_MVK) TEST(LoaderHandleValidTests, VerifyHandleWrappingIOSSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkIOSSurfaceCreateInfoMVK surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; @@ -1740,26 +1452,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingIOSSurf) { } #endif // VK_USE_PLATFORM_IOS_MVK -#ifdef VK_USE_PLATFORM_MACOS_MVK +#if defined(VK_USE_PLATFORM_MACOS_MVK) TEST(LoaderHandleValidTests, VerifyHandleWrappingMacOSSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI("VK_USE_PLATFORM_MACOS_MVK"); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI("VK_USE_PLATFORM_MACOS_MVK"); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkMacOSSurfaceCreateInfoMVK surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; @@ -1777,23 +1483,17 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingMacOSSurf) { #if defined(VK_USE_PLATFORM_METAL_EXT) TEST(LoaderHandleValidTests, VerifyHandleWrappingMetalSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI("VK_USE_PLATFORM_METAL_EXT"); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI("VK_USE_PLATFORM_METAL_EXT"); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkMetalSurfaceCreateInfoEXT surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT; @@ -1808,26 +1508,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingMetalSurf) { } #endif // VK_USE_PLATFORM_METAL_EXT -#ifdef VK_USE_PLATFORM_SCREEN_QNX +#if defined(VK_USE_PLATFORM_SCREEN_QNX) TEST(LoaderHandleValidTests, VerifyHandleWrappingQNXSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkScreenSurfaceCreateInfoQNX surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX; @@ -1842,26 +1536,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingQNXSurf) { } #endif // VK_USE_PLATFORM_SCREEN_QNX -#ifdef VK_USE_PLATFORM_VI_NN +#if defined(VK_USE_PLATFORM_VI_NN) TEST(LoaderHandleValidTests, VerifyHandleWrappingViNNSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkViSurfaceCreateInfoNN surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN; @@ -1876,26 +1564,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingViNNSurf) { } #endif // VK_USE_PLATFORM_VI_NN -#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) TEST(LoaderHandleValidTests, VerifyHandleWrappingWaylandSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI("VK_USE_PLATFORM_WAYLAND_KHR"); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI("VK_USE_PLATFORM_WAYLAND_KHR"); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkWaylandSurfaceCreateInfoKHR surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; @@ -1910,26 +1592,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingWaylandSurf) { } #endif // VK_USE_PLATFORM_WAYLAND_KHR -#ifdef VK_USE_PLATFORM_WIN32_KHR +#if defined(VK_USE_PLATFORM_WIN32_KHR) TEST(LoaderHandleValidTests, VerifyHandleWrappingWin32Surf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkWin32SurfaceCreateInfoKHR surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; @@ -1944,26 +1620,20 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingWin32Surf) { } #endif // VK_USE_PLATFORM_WIN32_KHR -#ifdef VK_USE_PLATFORM_XCB_KHR +#if defined(VK_USE_PLATFORM_XCB_KHR) TEST(LoaderHandleValidTests, VerifyHandleWrappingXCBSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI(); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI(); instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkXcbSurfaceCreateInfoKHR surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; @@ -1978,26 +1648,24 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingXCBSurf) { } #endif // VK_USE_PLATFORM_XCB_KHR -#ifdef VK_USE_PLATFORM_XLIB_KHR +#if defined(VK_USE_PLATFORM_XLIB_KHR) TEST(LoaderHandleValidTests, VerifyHandleWrappingXlibSurf) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - setup_WSI_in_ICD(driver); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).setup_WSI("VK_USE_PLATFORM_XLIB_KHR"); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); - setup_WSI_in_create_instance(instance); - instance.CheckCreate(); + instance.create_info.setup_WSI("VK_USE_PLATFORM_XLIB_KHR"); + // + for (auto& ext : instance.create_info.enabled_extensions) { + std::cout << ext << "\n"; + } instance.create_info.add_layer(wrap_objects_name); + instance.CheckCreate(); VkXlibSurfaceCreateInfoKHR surf_create_info = {}; surf_create_info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; @@ -2012,34 +1680,24 @@ TEST(LoaderHandleValidTests, VerifyHandleWrappingXlibSurf) { } #endif // VK_USE_PLATFORM_XLIB_KHR -static VKAPI_ATTR VkBool32 VKAPI_CALL JunkDebugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageTypes, - const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, - void* pUserData) { +VKAPI_ATTR VkBool32 VKAPI_CALL JunkDebugUtilsCallback([[maybe_unused]] VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + [[maybe_unused]] VkDebugUtilsMessageTypeFlagsEXT messageTypes, + [[maybe_unused]] const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, + [[maybe_unused]] void* pUserData) { // This is just a stub callback in case the loader or any other layer triggers it. - (void)messageSeverity; - (void)messageTypes; - (void)pCallbackData; - (void)pUserData; return VK_FALSE; } TEST(LoaderHandleValidTests, VerifyHandleWrappingDebugUtilsMessenger) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); Extension ext{"VK_EXT_debug_utils"}; - auto& driver = env.get_test_icd(); - driver.add_instance_extensions({ext}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_instance_extensions({ext}); const char* wrap_objects_name = "WrapObjectsLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - driver.physical_devices.emplace_back("physical_device_0"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - driver.physical_devices.back().queue_family_properties.push_back(family_props); - InstWrapper instance(env.vulkan_functions); instance.create_info.add_extension("VK_EXT_debug_utils"); instance.create_info.add_layer(wrap_objects_name); diff --git a/tests/loader_layer_tests.cpp b/tests/loader_layer_tests.cpp index ec0750047f28bd377830c3dee8c95585e5b5c319..b7c88171d7db943dbc5e2804a16609e599ed9224 100644 --- a/tests/loader_layer_tests.cpp +++ b/tests/loader_layer_tests.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021-2022 The Khronos Group Inc. - * Copyright (c) 2021-2022 Valve Corporation - * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * 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,9 +33,9 @@ void CheckLogForLayerString(FrameworkEnvironment& env, const char* implicit_laye FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(VK_SUCCESS); if (check_for_enable) { - ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + implicit_layer_name)); + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + implicit_layer_name)); } else { - ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer ") + implicit_layer_name)); + ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer \"") + implicit_layer_name)); } } env.debug_log.clear(); @@ -47,75 +47,72 @@ TEST(ImplicitLayers, WithEnableAndDisableEnvVar) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; - const char* enable_env_var = "ENABLE_ME"; - const char* disable_env_var = "DISABLE_ME"; + + EnvVarWrapper enable_env_var{"ENABLE_ME"}; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(implicit_layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_disable_environment(disable_env_var) - .set_enable_environment(enable_env_var)), + .set_disable_environment(disable_env_var.get()) + .set_enable_environment(enable_env_var.get())), "implicit_test_layer.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); // didn't set enable env-var, layer should not load CheckLogForLayerString(env, implicit_layer_name, false); // set enable env-var to 0, no layer should be found - set_env_var(enable_env_var, "0"); + enable_env_var.set_new_value("0"); CheckLogForLayerString(env, implicit_layer_name, false); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + enable_env_var.set_new_value("1"); CheckLogForLayerString(env, implicit_layer_name, true); - remove_env_var(enable_env_var); + // remove enable env var, so we can check what happens when only disable is present + enable_env_var.remove_value(); // set disable env-var to 0, layer should not load - set_env_var(disable_env_var, "0"); + disable_env_var.set_new_value("0"); CheckLogForLayerString(env, implicit_layer_name, false); // set disable env-var to 1, layer should not load - set_env_var(disable_env_var, "1"); + disable_env_var.set_new_value("1"); CheckLogForLayerString(env, implicit_layer_name, false); // set both enable and disable env-var, layer should not load - set_env_var(enable_env_var, "1"); - set_env_var(disable_env_var, "1"); + enable_env_var.set_new_value("1"); + disable_env_var.set_new_value("1"); CheckLogForLayerString(env, implicit_layer_name, false); - - remove_env_var(enable_env_var); - remove_env_var(disable_env_var); } TEST(ImplicitLayers, OnlyDisableEnvVar) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - const char* implicit_layer_name = "ImplicitTestLayer"; - const char* disable_env_var = "DISABLE_ME"; + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(implicit_layer_name) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_disable_environment(disable_env_var)), + .set_disable_environment(disable_env_var.get())), "implicit_test_layer.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); // don't set disable env-var, layer should load CheckLogForLayerString(env, implicit_layer_name, true); // set disable env-var to 0, layer should load - set_env_var(disable_env_var, "0"); + disable_env_var.set_new_value("0"); CheckLogForLayerString(env, implicit_layer_name, false); // set disable env-var to 1, layer should not load - set_env_var(disable_env_var, "1"); + disable_env_var.set_new_value("1"); CheckLogForLayerString(env, implicit_layer_name, false); { @@ -123,27 +120,25 @@ TEST(ImplicitLayers, OnlyDisableEnvVar) { FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.create_info.add_layer(implicit_layer_name); inst.CheckCreate(VK_SUCCESS); - ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + implicit_layer_name)); + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + implicit_layer_name)); } - remove_env_var(disable_env_var); } TEST(ImplicitLayers, PreInstanceEnumInstLayerProps) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - const char* implicit_layer_name = "ImplicitTestLayer"; - const char* disable_env_var = "DISABLE_ME"; + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; env.add_implicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(implicit_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_disable_environment(disable_env_var) - .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} - .set_vk_func("vkEnumerateInstanceLayerProperties") - .set_override_name("test_preinst_vkEnumerateInstanceLayerProperties"))), + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_env_var.get()) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceLayerProperties") + .set_override_name("test_preinst_vkEnumerateInstanceLayerProperties"))), "implicit_test_layer.json"); uint32_t layer_props = 43; @@ -155,33 +150,30 @@ TEST(ImplicitLayers, PreInstanceEnumInstLayerProps) { ASSERT_EQ(count, layer_props); // set disable env-var to 1, layer should not load - set_env_var(disable_env_var, "1"); + disable_env_var.set_new_value("1"); count = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); ASSERT_NE(count, 0U); ASSERT_NE(count, layer_props); - - remove_env_var(disable_env_var); } TEST(ImplicitLayers, PreInstanceEnumInstExtProps) { FrameworkEnvironment env; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - const char* implicit_layer_name = "ImplicitTestLayer"; - const char* disable_env_var = "DISABLE_ME"; + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(implicit_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_disable_environment(disable_env_var) - .add_pre_instance_function( - ManifestLayer::LayerDescription::FunctionOverride{} - .set_vk_func("vkEnumerateInstanceExtensionProperties") - .set_override_name("test_preinst_vkEnumerateInstanceExtensionProperties"))), - "implicit_test_layer.json"); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_env_var.get()) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceExtensionProperties") + .set_override_name("test_preinst_vkEnumerateInstanceExtensionProperties"))), + "implicit_test_layer.json"); uint32_t ext_props = 52; auto& layer = env.get_test_layer(0); @@ -192,37 +184,33 @@ TEST(ImplicitLayers, PreInstanceEnumInstExtProps) { ASSERT_EQ(count, ext_props); // set disable env-var to 1, layer should not load - set_env_var(disable_env_var, "1"); + disable_env_var.set_new_value("1"); count = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); ASSERT_NE(count, 0U); ASSERT_NE(count, ext_props); - - remove_env_var(disable_env_var); } TEST(ImplicitLayers, PreInstanceVersion) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 3); - - const char* implicit_layer_name = "ImplicitTestLayer"; - const char* disable_env_var = "DISABLE_ME"; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)) + .add_physical_device({}) + .set_icd_api_version(VK_MAKE_API_VERSION(0, 1, 2, 3)); - env.add_implicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(implicit_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 2, 3)) - .set_disable_environment(disable_env_var) - .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} - .set_vk_func("vkEnumerateInstanceVersion") - .set_override_name("test_preinst_vkEnumerateInstanceVersion"))), - "implicit_test_layer.json"); + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; + + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 2, 3)) + .set_disable_environment(disable_env_var.get()) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceVersion") + .set_override_name("test_preinst_vkEnumerateInstanceVersion"))), + "implicit_test_layer.json"); uint32_t layer_version = VK_MAKE_API_VERSION(1, 2, 3, 4); auto& layer = env.get_test_layer(0); @@ -233,14 +221,12 @@ TEST(ImplicitLayers, PreInstanceVersion) { ASSERT_EQ(version, layer_version); // set disable env-var to 1, layer should not load - set_env_var(disable_env_var, "1"); + disable_env_var.set_new_value("1"); version = 0; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); ASSERT_NE(version, 0U); ASSERT_NE(version, layer_version); - - remove_env_var(disable_env_var); } // Run with a pre-Negotiate function version of the layer so that it has to query vkCreateInstance using the @@ -249,21 +235,19 @@ TEST(ImplicitLayers, PreInstanceVersion) { // tested through behavior above). TEST(ImplicitLayers, OverrideGetInstanceProcAddr) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); - const char* implicit_layer_name = "ImplicitTestLayer"; - const char* disable_env_var = "DISABLE_ME"; - - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 0, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(implicit_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_1) - .set_disable_environment(disable_env_var) - .add_function(ManifestLayer::LayerDescription::FunctionOverride{} - .set_vk_func("vkGetInstanceProcAddr") - .set_override_name("test_override_vkGetInstanceProcAddr"))), + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; + + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 0, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_1) + .set_disable_environment(disable_env_var.get()) + .add_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkGetInstanceProcAddr") + .set_override_name("test_override_vkGetInstanceProcAddr"))), "implicit_test_layer.json"); { @@ -273,12 +257,756 @@ TEST(ImplicitLayers, OverrideGetInstanceProcAddr) { { // set disable env-var to 1, layer should not load - set_env_var(disable_env_var, "1"); + disable_env_var.set_new_value("1"); InstWrapper inst2{env.vulkan_functions}; inst2.CheckCreate(); } +} + +// Force enable with filter env var +TEST(ImplicitLayers, EnableWithFilter) { + FrameworkEnvironment env; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)) + .add_physical_device({}) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* implicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* implicit_json_name_1 = "First_layer.json"; + const char* disable_layer_name_1 = "DISABLE_FIRST"; + const char* enable_layer_name_1 = "ENABLE_FIRST"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_enable_environment(enable_layer_name_1) + .set_disable_environment(disable_layer_name_1) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_1); + + const char* implicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* implicit_json_name_2 = "Second_layer.json"; + const char* disable_layer_name_2 = "DISABLE_SECOND"; + const char* enable_layer_name_2 = "ENABLE_SECOND"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_enable_environment(enable_layer_name_2) + .set_disable_environment(disable_layer_name_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_2); + + const char* implicit_layer_name_3 = "VK_LAYER_LUNARG_Second_test_layer"; + const char* implicit_json_name_3 = "Second_test_layer.json"; + const char* disable_layer_name_3 = "DISABLE_THIRD"; + const char* enable_layer_name_3 = "ENABLE_THIRD"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_3) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_enable_environment(enable_layer_name_3) + .set_disable_environment(disable_layer_name_3) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_3); + + EnvVarWrapper layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE"}; + EnvVarWrapper layer_1_enable_env_var{enable_layer_name_1}; + + // First, test an instance/device without the layer forced on. + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Now force on one layer with its full name + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value(implicit_layer_name_1); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match prefix + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("VK_LAYER_LUNARG_*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match suffix + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("*Second_layer"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match substring + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst5{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + inst5.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with star '*' + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("*"); + + InstWrapper inst6{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + inst6.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with special name + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("~all~"); + + InstWrapper inst7{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); + inst7.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match substring, but enable the other layer manually + // ------------------------------------------ + env.debug_log.clear(); + layer_1_enable_env_var.set_new_value("1"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst8{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst8.create_info, env.debug_log); + inst8.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); +} + +// Force disabled with new filter env var +TEST(ImplicitLayers, DisableWithFilter) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* implicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* implicit_json_name_1 = "First_layer.json"; + const char* disable_layer_name_1 = "DISABLE_FIRST"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_1) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_1); + + const char* implicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* implicit_json_name_2 = "Second_layer.json"; + const char* disable_layer_name_2 = "DISABLE_SECOND"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_2); + + const char* implicit_layer_name_3 = "VK_LAYER_LUNARG_Second_test_layer"; + const char* implicit_json_name_3 = "Second_test_layer.json"; + const char* disable_layer_name_3 = "DISABLE_THIRD"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_3) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_3) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_3); + + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE"}; + + // First, test an instance/device + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Now force off one layer with its full name + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value(implicit_layer_name_1); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match prefix + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("VK_LAYER_LUNARG_*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match suffix + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*Second_layer"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match substring + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*Second*"); + + InstWrapper inst5{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + inst5.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with star '*' + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*"); + + InstWrapper inst6{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + inst6.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with special name + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~all~"); + + InstWrapper inst7{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); + inst7.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); +} + +// Force disabled with new filter env var +TEST(ImplicitLayers, DisableWithFilterWhenLayersEnableEnvVarIsActive) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* implicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* implicit_json_name_1 = "First_layer.json"; + const char* disable_layer_name_1 = "DISABLE_FIRST"; + const char* enable_layer_name_1 = "ENABLE_FIRST"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_1) + .set_enable_environment(enable_layer_name_1) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_1); + + const char* implicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* implicit_json_name_2 = "Second_layer.json"; + const char* disable_layer_name_2 = "DISABLE_SECOND"; + const char* enable_layer_name_2 = "ENABLE_SECOND"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_2) + .set_enable_environment(enable_layer_name_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_2); + + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE"}; + EnvVarWrapper layer_1_enable_env_var{enable_layer_name_1}; + EnvVarWrapper layer_2_enable_env_var{enable_layer_name_2}; + + // First, test an instance/device + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + + // Set the layers enable env-var + // ------------------------------------------ + env.debug_log.clear(); + layer_1_enable_env_var.set_new_value("1"); + layer_2_enable_env_var.set_new_value("1"); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + + // Now force off one layer with its full name + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value(implicit_layer_name_1); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + + // Now force off both layers + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~implicit~"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); +} + +// Test interaction between both the enable and disable filter environment variables. The enable should always +// override the disable. +TEST(ImplicitLayers, EnableAndDisableWithFilter) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* implicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* implicit_json_name_1 = "First_layer.json"; + const char* disable_layer_name_1 = "DISABLE_FIRST"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_1) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_1); + + const char* implicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* implicit_json_name_2 = "Second_layer.json"; + const char* disable_layer_name_2 = "DISABLE_SECOND"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_2); + + const char* implicit_layer_name_3 = "VK_LAYER_LUNARG_Second_test_layer"; + const char* implicit_json_name_3 = "Second_test_layer.json"; + const char* disable_layer_name_3 = "DISABLE_THIRD"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name_3) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_layer_name_3) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + implicit_json_name_3); + + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE"}; + EnvVarWrapper layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE"}; + + // Disable 2 but enable 1 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*Second*"); + layers_enable_env_var.set_new_value("*test_layer"); + + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable all but enable 2 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable all but enable 2 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~all~"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable implicit but enable 2 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~implicit~"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable explicit but enable 2 (should still be everything) + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~explicit~"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst5{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + inst5.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable implicit but enable all + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~implicit~"); + layers_enable_env_var.set_new_value("*"); + + InstWrapper inst6{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + inst6.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", implicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", implicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(implicit_layer_name_3, "disabled because name matches filter of env var")); +} + +// Add 2 implicit layers with the same layer name and expect only one to be loaded. +// Expect the second layer to be found first, because it'll be in a path that is searched first. +TEST(ImplicitLayers, DuplicateLayers) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* same_layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_implicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(same_layer_name_1) + .set_description("actually_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("if_you_can")), + "regular_layer_1.json")); + auto& layer1 = env.get_test_layer(0); + layer1.set_description("actually_layer_1"); + layer1.set_make_spurious_log_in_create_instance("actually_layer_1"); + + env.add_implicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(same_layer_name_1) + .set_description("actually_layer_2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("if_you_can")), + "regular_layer_1.json") + // use override folder as just a folder and manually add it to the implicit layer search paths + .set_discovery_type(ManifestDiscoveryType::override_folder)); + auto& layer2 = env.get_test_layer(1); + layer2.set_description("actually_layer_2"); + layer2.set_make_spurious_log_in_create_instance("actually_layer_2"); +#if defined(WIN32) + env.platform_shim->add_manifest(ManifestCategory::implicit_layer, env.get_folder(ManifestLocation::override_layer).location()); +#elif COMMON_UNIX_PLATFORMS + env.platform_shim->redirect_path(fs::path(USER_LOCAL_SHARE_DIR "/vulkan/implicit_layer.d"), + env.get_folder(ManifestLocation::override_layer).location()); +#endif + + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(same_layer_name_1, layer_props[0].layerName)); + ASSERT_TRUE(string_eq(same_layer_name_1, layer_props[1].layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), layer_props[1].description)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); - remove_env_var(disable_env_var); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(same_layer_name_1, enabled_layer_props.at(0).layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props.at(0).description)); + ASSERT_TRUE(env.debug_log.find("actually_layer_1")); + ASSERT_FALSE(env.debug_log.find("actually_layer_2")); } // Meta layer which contains component layers that do not exist. @@ -288,14 +1016,13 @@ TEST(MetaLayers, InvalidComponentLayer) { const char* meta_layer_name = "VK_LAYER_MetaTestLayer"; const char* invalid_layer_name_1 = "VK_LAYER_InvalidLayer1"; const char* invalid_layer_name_2 = "VK_LAYER_InvalidLayer2"; - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(meta_layer_name) - .add_component_layers({invalid_layer_name_1, invalid_layer_name_2}) - .set_disable_environment("NotGonnaWork") - .add_instance_extension({"NeverGonnaGiveYouUp"}) - .add_device_extension({"NeverGonnaLetYouDown"})), + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(meta_layer_name) + .add_component_layers({invalid_layer_name_1, invalid_layer_name_2}) + .set_disable_environment("NotGonnaWork") + .add_instance_extension({"NeverGonnaGiveYouUp"}) + .add_device_extension({"NeverGonnaLetYouDown"})), "meta_test_layer.json"); const char* regular_layer_name = "TestLayer"; @@ -305,23 +1032,14 @@ TEST(MetaLayers, InvalidComponentLayer) { "regular_test_layer.json"); // should find 1, the 'regular' layer - uint32_t layer_count = 1; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 1U); - - VkLayerProperties layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, &layer_props)); - EXPECT_EQ(layer_count, 1U); - EXPECT_TRUE(string_eq(layer_props.layerName, regular_layer_name)); - - uint32_t extension_count = 0; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 3U); // return debug report & debug utils & portability enumeration + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); - EXPECT_EQ(extension_count, 3U); + 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)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(meta_layer_name); @@ -334,59 +1052,40 @@ TEST(MetaLayers, InvalidComponentLayer) { // Meta layer that is an explicit layer TEST(MetaLayers, ExplicitMetaLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* meta_layer_name = "VK_LAYER_MetaTestLayer"; const char* regular_layer_name = "VK_LAYER_TestLayer"; env.add_explicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), "meta_test_layer.json"); env.add_explicit_layer( ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_test_layer.json"); + { // global functions - // should find 1, the 'regular' layer - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 2U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 2U); + // should find 1, the 'regular' layer + auto layer_props = env.GetLayerProperties(2); EXPECT_TRUE(check_permutation({regular_layer_name, meta_layer_name}, layer_props)); - uint32_t extension_count = 0; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 3U); // return debug report & debug utils & portability enumeration - - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); - EXPECT_EQ(extension_count, 3U); + 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)); } { // don't enable the layer, shouldn't find any layers when calling vkEnumerateDeviceLayerProperties InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(VK_SUCCESS); - auto phys_dev = inst.GetPhysDev(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(count, 0U); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); } { InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(meta_layer_name); inst.CheckCreate(VK_SUCCESS); - auto phys_dev = inst.GetPhysDev(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(count, 2U); - std::array layer_props; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(count, 2U); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); EXPECT_TRUE(check_permutation({regular_layer_name, meta_layer_name}, layer_props)); } } @@ -397,14 +1096,13 @@ TEST(MetaLayers, MetaLayerNameInComponentLayers) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); const char* meta_layer_name = "VK_LAYER_MetaTestLayer"; const char* regular_layer_name = "VK_LAYER_TestLayer"; - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(meta_layer_name) - .add_component_layers({meta_layer_name, regular_layer_name}) - .set_disable_environment("NotGonnaWork") - .add_instance_extension({"NeverGonnaGiveYouUp"}) - .add_device_extension({"NeverGonnaLetYouDown"})), + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(meta_layer_name) + .add_component_layers({meta_layer_name, regular_layer_name}) + .set_disable_environment("NotGonnaWork") + .add_instance_extension({"NeverGonnaGiveYouUp"}) + .add_device_extension({"NeverGonnaLetYouDown"})), "meta_test_layer.json"); env.add_explicit_layer( @@ -413,23 +1111,14 @@ TEST(MetaLayers, MetaLayerNameInComponentLayers) { "regular_test_layer.json"); // should find 1, the 'regular' layer - uint32_t layer_count = 1; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); - VkLayerProperties layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, &layer_props)); - EXPECT_EQ(layer_count, 1U); - EXPECT_TRUE(string_eq(layer_props.layerName, regular_layer_name)); - - uint32_t extension_count = 0; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 3U); // return debug report & debug utils & portability enumeration - - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); - EXPECT_EQ(extension_count, 3U); + 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)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(meta_layer_name); @@ -451,34 +1140,23 @@ TEST(MetaLayers, MetaLayerWhichAddsMetaLayer) { ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_test_layer.json"); env.add_explicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), "meta_test_layer.json"); - env.add_explicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(meta_meta_layer_name) - .add_component_layers({meta_layer_name, regular_layer_name})), + env.add_explicit_layer(ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(meta_meta_layer_name) + .add_component_layers({meta_layer_name, regular_layer_name})), "meta_meta_test_layer.json"); - uint32_t layer_count = 3; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 3U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 3U); + auto layer_props = env.GetLayerProperties(3); EXPECT_TRUE(check_permutation({regular_layer_name, meta_layer_name, meta_meta_layer_name}, layer_props)); - uint32_t extension_count = 0; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 3U); // return debug report & debug utils & portability enumeration - - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); - EXPECT_EQ(extension_count, 3U); + 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)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(meta_layer_name); @@ -490,8 +1168,8 @@ TEST(MetaLayers, MetaLayerWhichAddsMetaLayer) { TEST(MetaLayers, InstanceExtensionInComponentLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* meta_layer_name = "VK_LAYER_MetaTestLayer"; const char* regular_layer_name = "VK_LAYER_TestLayer"; const char* instance_ext_name = "VK_EXT_headless_surface"; @@ -501,26 +1179,18 @@ TEST(MetaLayers, InstanceExtensionInComponentLayer) { .add_instance_extension({instance_ext_name})), "regular_test_layer.json"); env.add_explicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), "meta_test_layer.json"); - uint32_t extension_count = 0; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(meta_layer_name, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 1U); // return instance_ext_name - - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(meta_layer_name, &extension_count, extensions.data())); - EXPECT_EQ(extension_count, 1U); + auto extensions = env.GetInstanceExtensions(1, meta_layer_name); EXPECT_TRUE(string_eq(extensions[0].extensionName, instance_ext_name)); } TEST(MetaLayers, DeviceExtensionInComponentLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* meta_layer_name = "VK_LAYER_MetaTestLayer"; const char* regular_layer_name = "VK_LAYER_TestLayer"; const char* device_ext_name = "VK_EXT_fake_dev_ext"; @@ -530,16 +1200,12 @@ TEST(MetaLayers, DeviceExtensionInComponentLayer) { .add_device_extension({device_ext_name})), "regular_test_layer.json"); env.add_explicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{}.set_name(meta_layer_name).add_component_layers({regular_layer_name})), "meta_test_layer.json"); - { - uint32_t extension_count = 0; - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(meta_layer_name, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 0U); - } + + ASSERT_NO_FATAL_FAILURE(env.GetInstanceExtensions(0, meta_layer_name)); + { // layer is not enabled InstWrapper inst{env.vulkan_functions}; FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); @@ -547,17 +1213,8 @@ TEST(MetaLayers, DeviceExtensionInComponentLayer) { ASSERT_TRUE(env.debug_log.find(std::string("Meta-layer ") + meta_layer_name + " component layer " + regular_layer_name + " adding device extension " + device_ext_name)); - auto phys_dev = inst.GetPhysDev(); - uint32_t extension_count = 0; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, meta_layer_name, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 1U); // return device_ext_name - - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, meta_layer_name, &extension_count, - extensions.data())); - EXPECT_EQ(extension_count, 1U); - EXPECT_TRUE(string_eq(extensions[0].extensionName, device_ext_name)); + auto extensions = inst.EnumerateLayerDeviceExtensions(inst.GetPhysDev(), meta_layer_name, 1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, device_ext_name)); } { // layer is enabled InstWrapper inst{env.vulkan_functions}; @@ -566,25 +1223,17 @@ TEST(MetaLayers, DeviceExtensionInComponentLayer) { inst.CheckCreate(); ASSERT_TRUE(env.debug_log.find(std::string("Meta-layer ") + meta_layer_name + " component layer " + regular_layer_name + " adding device extension " + device_ext_name)); - auto phys_dev = inst.GetPhysDev(); - - uint32_t extension_count = 0; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, meta_layer_name, &extension_count, nullptr)); - EXPECT_EQ(extension_count, 1U); // return device_ext_name - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, meta_layer_name, &extension_count, - extensions.data())); - EXPECT_EQ(extension_count, 1U); - EXPECT_TRUE(string_eq(extensions[0].extensionName, device_ext_name)); + auto extensions = inst.EnumerateLayerDeviceExtensions(inst.GetPhysDev(), meta_layer_name, 1); + EXPECT_TRUE(string_eq(extensions.at(0).extensionName, device_ext_name)); } } + // Override meta layer missing disable environment variable still enables the layer TEST(OverrideMetaLayer, InvalidDisableEnvironment) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* regular_layer_name = "VK_LAYER_TestLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(regular_layer_name) @@ -593,21 +1242,14 @@ TEST(OverrideMetaLayer, InvalidDisableEnvironment) { .add_device_extension({"NeverGonnaLetYouDown"})), "regular_test_layer.json"); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layers({regular_layer_name})), - "meta_test_layer.json"); - - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 1U); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layers({regular_layer_name})), + "meta_test_layer.json"); - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); EXPECT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); InstWrapper inst{env.vulkan_functions}; @@ -617,8 +1259,8 @@ TEST(OverrideMetaLayer, InvalidDisableEnvironment) { // Override meta layer whose version is less than the api version of the instance TEST(OverrideMetaLayer, OlderVersionThanInstance) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* regular_layer_name = "VK_LAYER_TestLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name(regular_layer_name) @@ -627,37 +1269,22 @@ TEST(OverrideMetaLayer, OlderVersionThanInstance) { .add_device_extension({"NeverGonnaLetYouDown"})), "regular_test_layer.json"); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .set_disable_environment("DisableMeIfYouCan") - .add_component_layers({regular_layer_name})), - "meta_test_layer.json"); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .set_disable_environment("DisableMeIfYouCan") + .add_component_layers({regular_layer_name})), + "meta_test_layer.json"); { // global functions - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 2U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 2U); + auto layer_props = env.GetLayerProperties(2); EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } { // 1.1 instance InstWrapper inst{env.vulkan_functions}; inst.create_info.api_version = VK_API_VERSION_1_1; inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(2U, count); - std::array layer_props; - - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(2U, count); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); ASSERT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); ASSERT_TRUE(string_eq(layer_props[1].layerName, lunarg_meta_layer_name)); } @@ -666,15 +1293,8 @@ TEST(OverrideMetaLayer, OlderVersionThanInstance) { InstWrapper inst{env.vulkan_functions}; inst.create_info.api_version = VK_API_VERSION_1_3; inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(2U, count); - std::array layer_props; + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(2U, count); ASSERT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); ASSERT_TRUE(string_eq(layer_props[1].layerName, lunarg_meta_layer_name)); } @@ -682,34 +1302,25 @@ TEST(OverrideMetaLayer, OlderVersionThanInstance) { TEST(OverrideMetaLayer, OlderMetaLayerWithNewerInstanceVersion) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* regular_layer_name = "VK_LAYER_TestLayer"; - env.add_explicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(regular_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))), - "regular_test_layer.json"); + env.add_explicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))), + "regular_test_layer.json"); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layers({regular_layer_name}) - .set_disable_environment("DisableMeIfYouCan")), - "meta_test_layer.json"); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layers({regular_layer_name}) + .set_disable_environment("DisableMeIfYouCan")), + "meta_test_layer.json"); { // global functions - uint32_t layer_count = 2; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 2U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 2U); + auto layer_props = env.GetLayerProperties(2); EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } { @@ -717,15 +1328,7 @@ TEST(OverrideMetaLayer, OlderMetaLayerWithNewerInstanceVersion) { InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 1, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(2U, count); - std::array layer_props; - - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(2U, count); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); ASSERT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); ASSERT_TRUE(string_eq(layer_props[1].layerName, lunarg_meta_layer_name)); } @@ -735,15 +1338,7 @@ TEST(OverrideMetaLayer, OlderMetaLayerWithNewerInstanceVersion) { InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 3, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(2U, count); - std::array layer_props; - - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(2U, count); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); ASSERT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); ASSERT_TRUE(string_eq(layer_props[1].layerName, lunarg_meta_layer_name)); } @@ -751,34 +1346,26 @@ TEST(OverrideMetaLayer, OlderMetaLayerWithNewerInstanceVersion) { TEST(OverrideMetaLayer, NewerComponentLayerInMetaLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* regular_layer_name = "VK_LAYER_TestLayer"; - env.add_explicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(regular_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 2, 0))), - "regular_test_layer.json"); + env.add_explicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_API_VERSION_1_2)), + "regular_test_layer.json"); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layers({regular_layer_name}) - .set_disable_environment("DisableMeIfYouCan")), - "meta_test_layer.json"); - { // global functions - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 2U); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layers({regular_layer_name}) + .set_disable_environment("DisableMeIfYouCan")), + "meta_test_layer.json"); - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 2U); + { // global functions + auto layer_props = env.GetLayerProperties(2); // Expect the explicit layer to still be found EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } @@ -788,19 +1375,12 @@ TEST(OverrideMetaLayer, NewerComponentLayerInMetaLayer) { FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.create_info.set_api_version(1, 1, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); // Newer component is allowed now - EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + regular_layer_name)); - env.debug_log.clear(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(2U, count); - std::array layer_props; - - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - EXPECT_EQ(2U, count); + EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } + env.debug_log.clear(); { // 1.3 instance @@ -808,51 +1388,35 @@ TEST(OverrideMetaLayer, NewerComponentLayerInMetaLayer) { FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.create_info.set_api_version(1, 3, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); // Newer component is allowed now - EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + regular_layer_name)); - env.debug_log.clear(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(2U, count); - std::array layer_props; + EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - EXPECT_EQ(2U, count); EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } } TEST(OverrideMetaLayer, OlderComponentLayerInMetaLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* regular_layer_name = "VK_LAYER_TestLayer"; - env.add_explicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(regular_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), - "regular_test_layer.json"); + env.add_explicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + "regular_test_layer.json"); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layers({regular_layer_name}) - .set_disable_environment("DisableMeIfYouCan")), - "meta_test_layer.json"); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layers({regular_layer_name}) + .set_disable_environment("DisableMeIfYouCan")), + "meta_test_layer.json"); { // global functions - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 1U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); EXPECT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); } { @@ -861,17 +1425,11 @@ TEST(OverrideMetaLayer, OlderComponentLayerInMetaLayer) { FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.create_info.set_api_version(1, 1, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); EXPECT_TRUE( env.debug_log.find("verify_meta_layer_component_layers: Meta-layer uses API version 1.1, but component layer 0 has API " "version 1.0 that is lower. Skipping this layer.")); env.debug_log.clear(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(0U, count); - std::array layer_props; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(0U, count); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); } { @@ -880,24 +1438,17 @@ TEST(OverrideMetaLayer, OlderComponentLayerInMetaLayer) { FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.create_info.set_api_version(1, 2, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); ASSERT_TRUE( env.debug_log.find("verify_meta_layer_component_layers: Meta-layer uses API version 1.1, but component layer 0 has API " "version 1.0 that is lower. Skipping this layer.")); env.debug_log.clear(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(0U, count); - std::array layer_props; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(0U, count); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); } } TEST(OverrideMetaLayer, ApplicationEnabledLayerInBlacklist) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* automatic_regular_layer_name = "VK_LAYER_TestLayer_1"; const char* manual_regular_layer_name = "VK_LAYER_TestLayer_2"; @@ -911,17 +1462,20 @@ TEST(OverrideMetaLayer, ApplicationEnabledLayerInBlacklist) { .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))), "regular_test_layer_2.json"); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layer(automatic_regular_layer_name) - .add_blacklisted_layer(manual_regular_layer_name) - .set_disable_environment("DisableMeIfYouCan")), - "meta_test_layer.json"); - - { // enable the layer in the blacklist + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(automatic_regular_layer_name) + .add_blacklisted_layer(manual_regular_layer_name) + .set_disable_environment("DisableMeIfYouCan")), + "meta_test_layer.json"); + { // Check that enumerating the layers returns only the non-blacklisted layers + override layer + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(check_permutation({automatic_regular_layer_name, lunarg_meta_layer_name}, layer_props)); + } + { + // enable the layer in the blacklist InstWrapper inst{env.vulkan_functions}; FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.create_info.add_layer(manual_regular_layer_name); @@ -935,25 +1489,19 @@ TEST(OverrideMetaLayer, ApplicationEnabledLayerInBlacklist) { InstWrapper inst{env.vulkan_functions}; FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); ASSERT_TRUE(env.debug_log.find(std::string("loader_remove_layers_in_blacklist: Override layer is active and layer ") + manual_regular_layer_name + " is in the blacklist inside of it. Removing that layer from current layer list.")); env.debug_log.clear(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(2U, count); - std::array layer_props; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - ASSERT_EQ(2U, count); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); ASSERT_TRUE(check_permutation({automatic_regular_layer_name, lunarg_meta_layer_name}, layer_props)); } } TEST(OverrideMetaLayer, BasicOverridePaths) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + fs::FolderManager override_layer_folder{FRAMEWORK_BUILD_DIRECTORY, "override_layer_folder"}; const char* regular_layer_name = "VK_LAYER_TestLayer_1"; @@ -964,39 +1512,36 @@ TEST(OverrideMetaLayer, BasicOverridePaths) { .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))) .get_manifest_str()); - auto override_folder_location = fs::make_native(override_layer_folder.location().str()); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layer(regular_layer_name) - .set_disable_environment("DisableMeIfYouCan") - .add_override_path(override_folder_location)), + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(regular_layer_name) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(fs::make_native(override_layer_folder.location().str()))), "meta_test_layer.json"); InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 1, 0); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(); - ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + regular_layer_name)); + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); env.layers.clear(); } TEST(OverrideMetaLayer, BasicOverridePathsIgnoreOtherLayers) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + fs::FolderManager override_layer_folder{FRAMEWORK_BUILD_DIRECTORY, "override_layer_folder"}; const char* regular_layer_name = "VK_LAYER_TestLayer"; - env.add_explicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(regular_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), - "regular_test_layer.json"); + env.add_explicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + "regular_test_layer.json"); const char* special_layer_name = "VK_LAYER_TestLayer_1"; override_layer_folder.write_manifest("regular_test_layer.json", @@ -1006,15 +1551,13 @@ TEST(OverrideMetaLayer, BasicOverridePathsIgnoreOtherLayers) { .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))) .get_manifest_str()); - auto override_folder_location = fs::make_native(override_layer_folder.location().str()); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layer(special_layer_name) - .set_disable_environment("DisableMeIfYouCan") - .add_override_path(override_folder_location)), + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(special_layer_name) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(fs::make_native(override_layer_folder.location().str()))), "meta_test_layer.json"); InstWrapper inst{env.vulkan_functions}; @@ -1022,24 +1565,22 @@ TEST(OverrideMetaLayer, BasicOverridePathsIgnoreOtherLayers) { inst.create_info.add_layer(regular_layer_name); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); - ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer ") + regular_layer_name)); + ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); env.layers.clear(); } TEST(OverrideMetaLayer, OverridePathsInteractionWithVK_LAYER_PATH) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); // add explicit layer to VK_LAYER_PATH folder const char* env_var_layer_name = "VK_LAYER_env_var_set_path"; - env.add_explicit_layer(TestLayerDetails{ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(env_var_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), - "regular_test_layer.json"} + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(env_var_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + "regular_test_layer.json"} .set_discovery_type(ManifestDiscoveryType::env_var)); // add layer to regular explicit layer folder @@ -1051,43 +1592,45 @@ TEST(OverrideMetaLayer, OverridePathsInteractionWithVK_LAYER_PATH) { "regular_test_layer.json"} .set_discovery_type(ManifestDiscoveryType::override_folder)); - env.add_implicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layer(regular_layer_name) - .set_disable_environment("DisableMeIfYouCan") - .add_override_path(env.get_folder(ManifestLocation::override_layer).location().str())), - "meta_test_layer.json"); + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(regular_layer_name) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(env.get_folder(ManifestLocation::override_layer).location().str())), + "meta_test_layer.json"); + + auto meta_layer_path = env.get_folder(ManifestLocation::override_layer).location(); InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 1, 0); inst.create_info.add_layer(env_var_layer_name); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); - ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer ") + env_var_layer_name)); + ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer \"") + env_var_layer_name)); + ASSERT_TRUE(env.debug_log.find( + std::string("Ignoring VK_LAYER_PATH. The Override layer is active and has override paths set, which takes priority. " + "VK_LAYER_PATH is set to ") + + env.env_var_vk_layer_paths.value())); + ASSERT_TRUE(env.debug_log.find("Override layer has override paths set to " + meta_layer_path.str())); env.layers.clear(); - remove_env_var("VK_LAYER_PATH"); } // Make sure that implicit layers not in the override paths aren't found by mistake TEST(OverrideMetaLayer, OverridePathsEnableImplicitLayerInDefaultPaths) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); fs::FolderManager override_layer_folder{FRAMEWORK_BUILD_DIRECTORY, "override_layer_folder"}; const char* implicit_layer_name = "VK_LAYER_ImplicitLayer"; - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(implicit_layer_name) - .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), - "implicit_test_layer.json"); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + "implicit_test_layer.json"); const char* regular_layer_name = "VK_LAYER_TestLayer_1"; override_layer_folder.write_manifest("regular_test_layer.json", @@ -1097,22 +1640,20 @@ TEST(OverrideMetaLayer, OverridePathsEnableImplicitLayerInDefaultPaths) { .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))) .get_manifest_str()); - auto override_folder_location = fs::make_native(override_layer_folder.location().str()); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layers({regular_layer_name, implicit_layer_name}) - .set_disable_environment("DisableMeIfYouCan") - .add_override_path(override_folder_location)), + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layers({regular_layer_name, implicit_layer_name}) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(fs::make_native(override_layer_folder.location().str()))), "meta_test_layer.json"); InstWrapper inst{env.vulkan_functions}; FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.create_info.set_api_version(1, 1, 0); inst.CheckCreate(); - ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer ") + implicit_layer_name)); + ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer \"") + implicit_layer_name)); ASSERT_TRUE( env.debug_log.find("Removing meta-layer VK_LAYER_LUNARG_override from instance layer list since it appears invalid.")); env.layers.clear(); @@ -1120,8 +1661,7 @@ TEST(OverrideMetaLayer, OverridePathsEnableImplicitLayerInDefaultPaths) { TEST(OverrideMetaLayer, ManifestFileFormatVersionTooOld) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); fs::FolderManager override_layer_folder{FRAMEWORK_BUILD_DIRECTORY, "override_layer_folder"}; const char* regular_layer_name = "VK_LAYER_TestLayer_1"; @@ -1132,22 +1672,20 @@ TEST(OverrideMetaLayer, ManifestFileFormatVersionTooOld) { .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))) .get_manifest_str()); - auto override_folder_location = fs::make_native(override_layer_folder.location().str()); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 0, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) - .add_component_layer(regular_layer_name) - .set_disable_environment("DisableMeIfYouCan") - .add_override_path(override_folder_location)), + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 0, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(regular_layer_name) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(fs::make_native(override_layer_folder.location().str()))), "meta_test_layer.json"); InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 1, 0); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(); - ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + regular_layer_name)); + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); ASSERT_TRUE(env.debug_log.find("Indicating meta-layer-specific override paths, but using older JSON file version.")); env.layers.clear(); } @@ -1155,49 +1693,32 @@ TEST(OverrideMetaLayer, ManifestFileFormatVersionTooOld) { // app_key contains test executable name, should activate the override layer TEST(OverrideMetaLayer, AppKeysDoesContainCurrentApplication) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* regular_layer_name = "VK_LAYER_TestLayer"; env.add_explicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer( - ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_test_layer.json"); std::string cur_path = test_platform_executable_path(); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .add_component_layers({regular_layer_name}) - .set_disable_environment("DisableMeIfYouCan") - .add_app_key(cur_path)), - "meta_test_layer.json"); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .add_component_layers({regular_layer_name}) + .set_disable_environment("DisableMeIfYouCan") + .add_app_key(cur_path)), + "meta_test_layer.json"); { // global functions - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 2U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 2U); + auto layer_props = env.GetLayerProperties(2); EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } { // instance InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(2U, count); - std::array layer_props; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - EXPECT_EQ(2U, count); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); } } @@ -1205,68 +1726,307 @@ TEST(OverrideMetaLayer, AppKeysDoesContainCurrentApplication) { // app_key contains random strings, should not activate the override layer TEST(OverrideMetaLayer, AppKeysDoesNotContainCurrentApplication) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* regular_layer_name = "VK_LAYER_TestLayer"; env.add_explicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer( - ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_test_layer.json"); - env.add_implicit_layer(ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 2, 0)) - .add_layer(ManifestLayer::LayerDescription{} - .set_name(lunarg_meta_layer_name) - .add_component_layers({regular_layer_name}) - .set_disable_environment("DisableMeIfYouCan") - .add_app_keys({"/Hello", "Hi", "./../Uh-oh", "C:/Windows/Only"})), + env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .add_component_layers({regular_layer_name}) + .set_disable_environment("DisableMeIfYouCan") + .add_app_keys({"/Hello", "Hi", "./../Uh-oh", "C:/Windows/Only"})), "meta_test_layer.json"); { // global functions - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 1U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); EXPECT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); } { // instance InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } +} + +TEST(OverrideMetaLayer, RunningWithElevatedPrivilegesFromSecureLocation) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + fs::FolderManager override_layer_folder{FRAMEWORK_BUILD_DIRECTORY, "override_layer_folder"}; + + const char* regular_layer_name = "VK_LAYER_TestLayer_1"; + override_layer_folder.write_manifest("regular_test_layer.json", + ManifestLayer{} + .add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))) + .get_manifest_str()); + auto override_folder_location = fs::make_native(override_layer_folder.location().str()); + env.add_implicit_layer(TestLayerDetails{ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(regular_layer_name) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(fs::make_native(override_layer_folder.location().str()))), + "meta_test_layer.json"}); + + { // try with no elevated privileges + auto layer_props = env.GetLayerProperties(2); + EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 1, 0); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); + env.debug_log.clear(); + } + + env.platform_shim->set_elevated_privilege(true); + + { // try with elevated privileges + auto layer_props = env.GetLayerProperties(2); + EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 1, 0); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, active_layer_props)); + } +} + +// Override layer should not be found and thus not loaded when running with elevated privileges +TEST(OverrideMetaLayer, RunningWithElevatedPrivilegesFromUnsecureLocation) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + fs::FolderManager override_layer_folder{FRAMEWORK_BUILD_DIRECTORY, "override_layer_folder"}; + + const char* regular_layer_name = "VK_LAYER_TestLayer_1"; + override_layer_folder.write_manifest("regular_test_layer.json", + ManifestLayer{} + .add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))) + .get_manifest_str()); + env.add_implicit_layer(TestLayerDetails{ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(regular_layer_name) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(fs::make_native(override_layer_folder.location().str()))), + "meta_test_layer.json"} + .set_discovery_type(ManifestDiscoveryType::unsecured_generic)); + + { // try with no elevated privileges + auto layer_props = env.GetLayerProperties(2); + EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, layer_props)); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(0U, count); - std::array layer_props; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, layer_props.data()); - EXPECT_EQ(0U, count); + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 1, 0); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); + env.debug_log.clear(); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + EXPECT_TRUE(check_permutation({regular_layer_name, lunarg_meta_layer_name}, active_layer_props)); + } + + env.platform_shim->set_elevated_privilege(true); + + { // try with no elevated privileges + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(1, 1, 0); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); } } +// Makes sure explicit layers can't override pre-instance functions even if enabled by the override layer +TEST(ExplicitLayers, OverridePreInstanceFunctions) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* explicit_layer_name = "VK_LAYER_enabled_by_override"; + const char* disable_env_var = "DISABLE_ME"; + + env.add_explicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceLayerProperties") + .set_override_name("test_preinst_vkEnumerateInstanceLayerProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceExtensionProperties") + .set_override_name("test_preinst_vkEnumerateInstanceExtensionProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceVersion") + .set_override_name("test_preinst_vkEnumerateInstanceVersion"))), + "explicit_test_layer.json"); + + auto& layer = env.get_test_layer(0); + layer.set_reported_layer_props(34); + layer.set_reported_extension_props(22); + layer.set_reported_instance_version(VK_MAKE_API_VERSION(1, 0, 0, 1)); + + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .add_component_layers({explicit_layer_name}) + .set_disable_environment(disable_env_var)), + "override_meta_layer.json"); + + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); + ASSERT_EQ(count, 2U); + count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); + ASSERT_EQ(count, 4U); + + uint32_t version = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); + ASSERT_EQ(version, VK_HEADER_VERSION_COMPLETE); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, explicit_layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, lunarg_meta_layer_name)); +} + +TEST(ExplicitLayers, LayerSettingsPreInstanceFunctions) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* explicit_layer_name = "VK_LAYER_enabled_by_override"; + + env.add_explicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceLayerProperties") + .set_override_name("test_preinst_vkEnumerateInstanceLayerProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceExtensionProperties") + .set_override_name("test_preinst_vkEnumerateInstanceExtensionProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceVersion") + .set_override_name("test_preinst_vkEnumerateInstanceVersion"))), + "explicit_test_layer.json"); + + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(false))); + env.update_loader_settings(env.loader_settings); + + auto& layer = env.get_test_layer(0); + layer.set_reported_layer_props(34); + layer.set_reported_extension_props(22); + layer.set_reported_instance_version(VK_MAKE_API_VERSION(1, 0, 0, 1)); + + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); + ASSERT_EQ(count, 1U); + count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); + ASSERT_EQ(count, 4U); + + uint32_t version = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); + ASSERT_EQ(version, VK_HEADER_VERSION_COMPLETE); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, explicit_layer_name)); +} + +TEST(ExplicitLayers, ContainsPreInstanceFunctions) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* explicit_layer_name = "VK_LAYER_enabled_by_override"; + + env.add_explicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceLayerProperties") + .set_override_name("test_preinst_vkEnumerateInstanceLayerProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceExtensionProperties") + .set_override_name("test_preinst_vkEnumerateInstanceExtensionProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceVersion") + .set_override_name("test_preinst_vkEnumerateInstanceVersion"))), + "explicit_test_layer.json"); + + auto& layer = env.get_test_layer(0); + layer.set_reported_layer_props(34); + layer.set_reported_extension_props(22); + layer.set_reported_instance_version(VK_MAKE_API_VERSION(1, 0, 0, 1)); + + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); + ASSERT_EQ(count, 1U); + count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); + ASSERT_EQ(count, 4U); + + uint32_t version = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); + ASSERT_EQ(version, VK_HEADER_VERSION_COMPLETE); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(explicit_layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, explicit_layer_name)); +} + // This test makes sure that any layer calling GetPhysicalDeviceProperties2 inside of CreateInstance // succeeds and doesn't crash. TEST(LayerCreateInstance, GetPhysicalDeviceProperties2) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 1, 0); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)) + .add_physical_device({}) + .set_icd_api_version(VK_API_VERSION_1_1); - const char* regular_layer_name = "TestLayer"; + const char* regular_layer_name = "VK_LAYER_TestLayer"; env.add_explicit_layer( - ManifestLayer{} - .set_file_format_version(ManifestVersion(1, 1, 2)) - .add_layer( - ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_test_layer.json"); - auto& layer = env.get_test_layer(0); - layer.set_create_instance_callback([](TestLayer& layer) -> VkResult { + auto& layer_handle = env.get_test_layer(0); + layer_handle.set_create_instance_callback([](TestLayer& layer) -> VkResult { uint32_t phys_dev_count = 0; VkResult res = layer.instance_dispatch_table.EnumeratePhysicalDevices(layer.instance_handle, &phys_dev_count, nullptr); if (res != VK_SUCCESS || phys_dev_count > 1) { @@ -1294,9 +2054,9 @@ TEST(LayerCreateInstance, GetPhysicalDeviceProperties2) { TEST(LayerCreateInstance, GetPhysicalDeviceProperties2KHR) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().add_instance_extension({"VK_KHR_get_physical_device_properties2", 0}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)) + .add_physical_device({}) + .add_instance_extension({"VK_KHR_get_physical_device_properties2", 0}); const char* regular_layer_name = "VK_LAYER_TestLayer"; env.add_explicit_layer( @@ -1304,8 +2064,8 @@ TEST(LayerCreateInstance, GetPhysicalDeviceProperties2KHR) { ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_test_layer.json"); - auto& layer = env.get_test_layer(0); - layer.set_create_instance_callback([](TestLayer& layer) -> VkResult { + auto& layer_handle = env.get_test_layer(0); + layer_handle.set_create_instance_callback([](TestLayer& layer) -> VkResult { uint32_t phys_dev_count = 1; VkPhysicalDevice phys_dev{}; layer.instance_dispatch_table.EnumeratePhysicalDevices(layer.instance_handle, &phys_dev_count, &phys_dev); @@ -1325,32 +2085,52 @@ TEST(LayerCreateInstance, GetPhysicalDeviceProperties2KHR) { inst.CheckCreate(); } +TEST(ExplicitLayers, MultipleLayersInSingleManifest) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* regular_layer_name_1 = "VK_LAYER_RegularLayer1"; + const char* regular_layer_name_2 = "VK_LAYER_RegularLayer2"; + const char* regular_layer_name_3 = "VK_LAYER_RegularLayer3"; + env.add_explicit_layer(TestLayerDetails( + ManifestLayer{} + .set_file_format_version({1, 0, 1}) + .add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name_1).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)) + .add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name_2).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)) + .add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name_3).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "multi_layer_manifest.json")); + + auto layer_props = env.GetLayerProperties(3); + ASSERT_TRUE(string_eq(regular_layer_name_1, layer_props[0].layerName)); + ASSERT_TRUE(string_eq(regular_layer_name_2, layer_props[1].layerName)); + ASSERT_TRUE(string_eq(regular_layer_name_3, layer_props[2].layerName)); +} + TEST(ExplicitLayers, WrapObjects) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device("physical_device_0"); const char* wrap_objects_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer(ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(wrap_objects_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "wrap_objects_layer.json"); - const char* regular_layer_name_1 = "RegularLayer1"; + const char* regular_layer_name_1 = "VK_LAYER_RegularLayer1"; env.add_explicit_layer( ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(regular_layer_name_1).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_layer_1.json"); - const char* regular_layer_name_2 = "RegularLayer2"; + const char* regular_layer_name_2 = "VK_LAYER_RegularLayer2"; env.add_explicit_layer( ManifestLayer{}.add_layer( ManifestLayer::LayerDescription{}.set_name(regular_layer_name_2).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), "regular_layer_2.json"); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); { // just the wrap layer InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(wrap_objects_name); @@ -1358,7 +2138,6 @@ TEST(ExplicitLayers, WrapObjects) { VkPhysicalDevice phys_dev = inst.GetPhysDev(); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_dev); } { // wrap layer first @@ -1368,7 +2147,6 @@ TEST(ExplicitLayers, WrapObjects) { VkPhysicalDevice phys_dev = inst.GetPhysDev(); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_dev); } { // wrap layer last @@ -1378,7 +2156,6 @@ TEST(ExplicitLayers, WrapObjects) { VkPhysicalDevice phys_dev = inst.GetPhysDev(); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_dev); } { // wrap layer last @@ -1388,70 +2165,462 @@ TEST(ExplicitLayers, WrapObjects) { VkPhysicalDevice phys_dev = inst.GetPhysDev(); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_dev); } } -TEST(LayerExtensions, ImplicitNoAdditionalInstanceExtension) { +TEST(ExplicitLayers, VkLayerPathEnvVar) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + { + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* regular_layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + .set_discovery_type(ManifestDiscoveryType::env_var) + .set_is_dir(false)); + + InstWrapper inst(env.vulkan_functions); + inst.create_info.add_layer(regular_layer_name_1); + inst.CheckCreate(VK_SUCCESS); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name_1)); + } + { + // verify layers load successfully when setting VK_LAYER_PATH to multiple full filepaths + const char* regular_layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + .set_discovery_type(ManifestDiscoveryType::env_var) + .set_is_dir(false)); + + const char* regular_layer_name_2 = "VK_LAYER_RegularLayer2"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_2.json") + .set_discovery_type(ManifestDiscoveryType::env_var) + .set_is_dir(false)); + + InstWrapper inst(env.vulkan_functions); + inst.create_info.add_layer(regular_layer_name_1); + inst.create_info.add_layer(regular_layer_name_2); + inst.CheckCreate(VK_SUCCESS); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + EXPECT_TRUE(check_permutation({regular_layer_name_1, regular_layer_name_2}, layer_props)); + } + { + // verify layers load successfully when setting VK_LAYER_PATH to a directory + const char* regular_layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + .set_discovery_type(ManifestDiscoveryType::env_var)); + + const char* regular_layer_name_2 = "VK_LAYER_RegularLayer2"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(regular_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_2.json") + .set_discovery_type(ManifestDiscoveryType::env_var)); + + InstWrapper inst(env.vulkan_functions); + inst.create_info.add_layer(regular_layer_name_1); + inst.create_info.add_layer(regular_layer_name_2); + inst.CheckCreate(VK_SUCCESS); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + EXPECT_TRUE(check_permutation({regular_layer_name_1, regular_layer_name_2}, layer_props)); + } +} - const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; - const char* enable_env_var = "ENABLE_ME"; - const char* disable_env_var = "DISABLE_ME"; +TEST(ExplicitLayers, DuplicateLayersInVK_LAYER_PATH) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* same_layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(same_layer_name_1) + .set_description("actually_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + // use override folder as just a folder and manually set the VK_LAYER_PATH env-var to it + .set_discovery_type(ManifestDiscoveryType::override_folder) + .set_is_dir(true)); + auto& layer1 = env.get_test_layer(0); + layer1.set_description("actually_layer_1"); + layer1.set_make_spurious_log_in_create_instance("actually_layer_1"); + env.env_var_vk_layer_paths.add_to_list(env.get_folder(ManifestLocation::override_layer).location().str()); + + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(same_layer_name_1) + .set_description("actually_layer_2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + .set_discovery_type(ManifestDiscoveryType::env_var) + .set_is_dir(true)); + auto& layer2 = env.get_test_layer(1); + layer2.set_description("actually_layer_2"); + layer2.set_make_spurious_log_in_create_instance("actually_layer_2"); + + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(same_layer_name_1, layer_props[0].layerName)); + ASSERT_TRUE(string_eq(same_layer_name_1, layer_props[1].layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), layer_props[1].description)); + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(same_layer_name_1); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(same_layer_name_1, enabled_layer_props.at(0).layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props.at(0).description)); + ASSERT_TRUE(env.debug_log.find("actually_layer_1")); + ASSERT_FALSE(env.debug_log.find("actually_layer_2")); + } + env.debug_log.clear(); - env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name(implicit_layer_name) - .set_lib_path(TEST_LAYER_WRAP_OBJECTS) - .set_disable_environment(disable_env_var) - .set_enable_environment(enable_env_var)), - "implicit_wrap_layer_no_ext.json"); + { + EnvVarWrapper layers_enable_env_var{"VK_INSTANCE_LAYERS", same_layer_name_1}; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(same_layer_name_1, enabled_layer_props.at(0).layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props.at(0).description)); + ASSERT_TRUE(env.debug_log.find("actually_layer_1")); + ASSERT_FALSE(env.debug_log.find("actually_layer_2")); + } + env.debug_log.clear(); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + { + EnvVarWrapper layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE", same_layer_name_1}; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(same_layer_name_1, enabled_layer_props.at(0).layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props.at(0).description)); + ASSERT_TRUE(env.debug_log.find("actually_layer_1")); + ASSERT_FALSE(env.debug_log.find("actually_layer_2")); + } + env.debug_log.clear(); +} - // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); - CheckLogForLayerString(env, implicit_layer_name, true); +TEST(ExplicitLayers, DuplicateLayersInVK_ADD_LAYER_PATH) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* same_layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(same_layer_name_1) + .set_description("actually_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + // use override folder as just a folder and manually set the VK_ADD_LAYER_PATH env-var to it + .set_discovery_type(ManifestDiscoveryType::override_folder) + .set_is_dir(true)); + auto& layer1 = env.get_test_layer(0); + layer1.set_description("actually_layer_1"); + layer1.set_make_spurious_log_in_create_instance("actually_layer_1"); + env.add_env_var_vk_layer_paths.add_to_list(env.get_folder(ManifestLocation::override_layer).location().str()); + + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(same_layer_name_1) + .set_description("actually_layer_2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + .set_discovery_type(ManifestDiscoveryType::add_env_var) + .set_is_dir(true)); + auto& layer2 = env.get_test_layer(1); + layer2.set_description("actually_layer_2"); + layer2.set_make_spurious_log_in_create_instance("actually_layer_2"); + + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(same_layer_name_1, layer_props[0].layerName)); + ASSERT_TRUE(string_eq(same_layer_name_1, layer_props[1].layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), layer_props[1].description)); + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(same_layer_name_1); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(same_layer_name_1, enabled_layer_props.at(0).layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props.at(0).description)); + ASSERT_TRUE(env.debug_log.find("actually_layer_1")); + ASSERT_FALSE(env.debug_log.find("actually_layer_2")); + } + env.debug_log.clear(); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); + { + EnvVarWrapper layers_enable_env_var{"VK_INSTANCE_LAYERS", same_layer_name_1}; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(same_layer_name_1, enabled_layer_props.at(0).layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props.at(0).description)); + ASSERT_TRUE(env.debug_log.find("actually_layer_1")); + ASSERT_FALSE(env.debug_log.find("actually_layer_2")); + } + env.debug_log.clear(); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - ASSERT_EQ(extension_count, 3U); // debug_utils, debug_report, and portability enumeration + { + EnvVarWrapper layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE", same_layer_name_1}; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(same_layer_name_1, enabled_layer_props.at(0).layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props.at(0).description)); + ASSERT_TRUE(env.debug_log.find("actually_layer_1")); + ASSERT_FALSE(env.debug_log.find("actually_layer_2")); + } + env.debug_log.clear(); +} - // Make sure the extensions that are implemented only in the test layers is not present. - ASSERT_FALSE(contains(extension_props, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_FALSE(contains(extension_props, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); +TEST(ExplicitLayers, CorrectOrderOfEnvVarEnabledLayers) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name_1) + .set_description("actually_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json") + .set_discovery_type(ManifestDiscoveryType::env_var) + .set_is_dir(true)); + auto& layer1 = env.get_test_layer(0); + layer1.set_description("actually_layer_1"); + + const char* layer_name_2 = "VK_LAYER_RegularLayer2"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name_2) + .set_description("actually_layer_2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_2.json") + .set_discovery_type(ManifestDiscoveryType::env_var) + .set_is_dir(true)); + auto& layer2 = env.get_test_layer(1); + layer2.set_description("actually_layer_2"); + + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_name_1, layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_2, layer_props[1].layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), layer_props[1].description)); + // 1 then 2 + { + EnvVarWrapper inst_layers_env_var{"VK_INSTANCE_LAYERS"}; + inst_layers_env_var.add_to_list(layer_name_1); + inst_layers_env_var.add_to_list(layer_name_2); - InstWrapper inst{env.vulkan_functions}; - inst.CheckCreate(); + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); - // Make sure all the function pointers are NULL as well + // Expect the env-var layer to be first + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), enabled_layer_props[1].description)); + ASSERT_TRUE(string_eq(layer_name_1, enabled_layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_2, enabled_layer_props[1].layerName)); + } + // 2 then 1 + { + EnvVarWrapper inst_layers_env_var{"VK_INSTANCE_LAYERS"}; + inst_layers_env_var.add_to_list(layer_name_2); + inst_layers_env_var.add_to_list(layer_name_1); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + // Expect the env-var layer to be first + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layer2.description.c_str(), enabled_layer_props[0].description)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props[1].description)); + ASSERT_TRUE(string_eq(layer_name_2, enabled_layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_1, enabled_layer_props[1].layerName)); + } +} + +TEST(ExplicitLayers, CorrectOrderOfEnvVarEnabledLayersFromSystemLocations) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name_1) + .set_description("actually_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json")); + auto& layer1 = env.get_test_layer(0); + layer1.set_description("actually_layer_1"); + + const char* layer_name_2 = "VK_LAYER_RegularLayer2"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name_2) + .set_description("actually_layer_2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_2.json")); + auto& layer2 = env.get_test_layer(1); + layer2.set_description("actually_layer_2"); + + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_name_1, layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_2, layer_props[1].layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), layer_props[1].description)); + // 1 then 2 + { + EnvVarWrapper inst_layers_env_var{"VK_INSTANCE_LAYERS"}; + inst_layers_env_var.add_to_list(layer_name_1); + inst_layers_env_var.add_to_list(layer_name_2); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), enabled_layer_props[1].description)); + ASSERT_TRUE(string_eq(layer_name_1, enabled_layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_2, enabled_layer_props[1].layerName)); + } + // 2 then 1 + { + EnvVarWrapper inst_layers_env_var{"VK_INSTANCE_LAYERS"}; + inst_layers_env_var.add_to_list(layer_name_2); + inst_layers_env_var.add_to_list(layer_name_1); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + // Expect the env-var layer to be first + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layer2.description.c_str(), enabled_layer_props[0].description)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props[1].description)); + ASSERT_TRUE(string_eq(layer_name_2, enabled_layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_1, enabled_layer_props[1].layerName)); + } +} + +TEST(ExplicitLayers, CorrectOrderOfApplicationEnabledLayers) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + // verify layer loads successfully when setting VK_LAYER_PATH to a full filepath + const char* layer_name_1 = "VK_LAYER_RegularLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name_1) + .set_description("actually_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_1.json")); + auto& layer1 = env.get_test_layer(0); + layer1.set_description("actually_layer_1"); + layer1.set_make_spurious_log_in_create_instance("actually_layer_1"); + + const char* layer_name_2 = "VK_LAYER_RegularLayer2"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name_2) + .set_description("actually_layer_2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_layer_2.json")); + auto& layer2 = env.get_test_layer(1); + layer2.set_description("actually_layer_2"); + layer2.set_make_spurious_log_in_create_instance("actually_layer_2"); + + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_name_1, layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_2, layer_props[1].layerName)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), layer_props[1].description)); + + // 1 then 2 + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name_1); + inst.create_info.add_layer(layer_name_2); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + // Expect the env-var layer to be first + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props[0].description)); + ASSERT_TRUE(string_eq(layer2.description.c_str(), enabled_layer_props[1].description)); + ASSERT_TRUE(string_eq(layer_name_1, enabled_layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_2, enabled_layer_props[1].layerName)); + } + // 2 then 1 + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name_2); + inst.create_info.add_layer(layer_name_1); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + // Expect the env-var layer to be first + auto enabled_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layer2.description.c_str(), enabled_layer_props[0].description)); + ASSERT_TRUE(string_eq(layer1.description.c_str(), enabled_layer_props[1].description)); + ASSERT_TRUE(string_eq(layer_name_2, enabled_layer_props[0].layerName)); + ASSERT_TRUE(string_eq(layer_name_1, enabled_layer_props[1].layerName)); + } +} + +TEST(LayerExtensions, ImplicitNoAdditionalInstanceExtension) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; + const char* enable_env_var = "ENABLE_ME"; + const char* disable_env_var = "DISABLE_ME"; + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_WRAP_OBJECTS) + .set_disable_environment(disable_env_var) + .set_enable_environment(enable_env_var)), + "implicit_wrap_layer_no_ext.json"); + + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); + + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; + CheckLogForLayerString(env, implicit_layer_name, true); + + 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)); + + // 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)); + ASSERT_FALSE(contains(extensions, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + // Make sure all the function pointers are NULL as well handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT")); handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT")); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ImplicitDirDispModeInstanceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; const char* enable_env_var = "ENABLE_ME"; @@ -1467,26 +2636,22 @@ TEST(LayerExtensions, ImplicitDirDispModeInstanceExtension) { .add_instance_extension({VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME, 1, {"vkReleaseDisplayEXT"}})), "implicit_wrap_layer_dir_disp_mode.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 4U); // the instance extension, debug_utils, debug_report, and portability enumeration - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - ASSERT_EQ(extension_count, 4U); + 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)); // Make sure the extensions that are implemented only in the test layers is not present. - ASSERT_TRUE(contains(extension_props, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_FALSE(contains(extension_props, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); + ASSERT_FALSE(contains(extensions, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extension(VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME); @@ -1495,18 +2660,11 @@ TEST(LayerExtensions, ImplicitDirDispModeInstanceExtension) { // Make sure only the appropriate function pointers are NULL as well handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT")); handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT")); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ImplicitDispSurfCountInstanceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; const char* enable_env_var = "ENABLE_ME"; @@ -1522,26 +2680,19 @@ TEST(LayerExtensions, ImplicitDispSurfCountInstanceExtension) { {"vkGetPhysicalDeviceSurfaceCapabilities2EXT"}})), "implicit_wrap_layer_disp_surf_count.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 4U); // the instance extension, debug_utils, debug_report, and portability enumeration - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - ASSERT_EQ(extension_count, 4U); - - // Make sure the extensions that are implemented only in the test layers is not present. - ASSERT_FALSE(contains(extension_props, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_TRUE(contains(extension_props, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); + 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)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extension(VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME); @@ -1550,18 +2701,11 @@ TEST(LayerExtensions, ImplicitDispSurfCountInstanceExtension) { // Make sure only the appropriate function pointers are NULL as well handle_assert_null(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT")); handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT")); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ImplicitBothInstanceExtensions) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; const char* enable_env_var = "ENABLE_ME"; @@ -1579,26 +2723,20 @@ TEST(LayerExtensions, ImplicitBothInstanceExtensions) { {VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, 1, {"vkGetPhysicalDeviceSurfaceCapabilities2EXT"}})), "implicit_wrap_layer_both_inst.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 5U); // the two instance extension plus debug_utils, debug_report, portability enumeration - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - ASSERT_EQ(extension_count, 5U); - - // Make sure the extensions that are implemented only in the test layers is not present. - ASSERT_TRUE(contains(extension_props, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_TRUE(contains(extension_props, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); + 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)); + 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)); + EXPECT_TRUE(string_eq(extensions.at(5).extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extension(VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME) @@ -1608,18 +2746,11 @@ TEST(LayerExtensions, ImplicitBothInstanceExtensions) { // Make sure only the appropriate function pointers are NULL as well handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkReleaseDisplayEXT")); handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT")); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ExplicitNoAdditionalInstanceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -1627,31 +2758,17 @@ TEST(LayerExtensions, ExplicitNoAdditionalInstanceExtension) { ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "explicit_wrap_layer_no_ext.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); - - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 3U); // debug utils, debug report, portability enumeration - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - ASSERT_EQ(extension_count, 3U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); - // Make sure the extensions are not present - for (const auto& ext : extension_props) { - ASSERT_FALSE(string_eq(ext.extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_FALSE(string_eq(ext.extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); - } + 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)); // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(explicit_layer_name, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 0U); + ASSERT_NO_FATAL_FAILURE(env.GetInstanceExtensions(0, explicit_layer_name)); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); @@ -1663,12 +2780,7 @@ TEST(LayerExtensions, ExplicitNoAdditionalInstanceExtension) { TEST(LayerExtensions, ExplicitDirDispModeInstanceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -1679,43 +2791,18 @@ TEST(LayerExtensions, ExplicitDirDispModeInstanceExtension) { .add_instance_extension({VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME, 1, {"vkReleaseDisplayEXT"}})), "explicit_wrap_layer_dir_disp_mode.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 3U); // debug utils, debug report, portability enumeration - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - ASSERT_EQ(extension_count, 3U); - // Make sure the extensions are not present - for (const auto& ext : extension_props) { - ASSERT_FALSE(string_eq(ext.extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_FALSE(string_eq(ext.extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); - } + 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)); // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(explicit_layer_name, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 1U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(explicit_layer_name, &extension_count, - extension_props.data())); - - // Make sure the extensions still aren't present in this layer - bool found = false; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (!strcmp(extension_props[ext].extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)) { - found = true; - } - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); - } - ASSERT_EQ(true, found); + auto layer_extensions = env.GetInstanceExtensions(1, explicit_layer_name); + EXPECT_TRUE(string_eq(layer_extensions.at(0).extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); InstWrapper inst1{env.vulkan_functions}; inst1.create_info.add_extension(VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME); @@ -1736,12 +2823,7 @@ TEST(LayerExtensions, ExplicitDirDispModeInstanceExtension) { TEST(LayerExtensions, ExplicitDispSurfCountInstanceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -1752,44 +2834,18 @@ TEST(LayerExtensions, ExplicitDispSurfCountInstanceExtension) { {"vkGetPhysicalDeviceSurfaceCapabilities2EXT"}})), "explicit_wrap_layer_disp_surf_count.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - - // Make sure the extensions are not present - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); - } - } + 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)); // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(explicit_layer_name, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 1U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(explicit_layer_name, &extension_count, - extension_props.data())); - - // Make sure the extensions still aren't present in this layer - bool found = false; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (!strcmp(extension_props[ext].extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)) { - found = true; - } - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - } - ASSERT_EQ(true, found); + auto layer_extensions = env.GetInstanceExtensions(1, explicit_layer_name); + EXPECT_TRUE(string_eq(layer_extensions.at(0).extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); InstWrapper inst1{env.vulkan_functions}; inst1.create_info.add_extension(VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME); @@ -1810,12 +2866,7 @@ TEST(LayerExtensions, ExplicitDispSurfCountInstanceExtension) { TEST(LayerExtensions, ExplicitBothInstanceExtensions) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -1828,48 +2879,19 @@ TEST(LayerExtensions, ExplicitBothInstanceExtensions) { {VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, 1, {"vkGetPhysicalDeviceSurfaceCapabilities2EXT"}})), "explicit_wrap_layer_both_inst.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); - - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extension_props.data())); - - // Make sure the extensions are not present - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); - } - } + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); - // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(explicit_layer_name, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 2U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(explicit_layer_name, &extension_count, - extension_props.data())); + 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)); // Make sure the extensions still aren't present in this layer - bool found[2] = {false, false}; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (!strcmp(extension_props[ext].extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)) { - found[0] = true; - } - if (!strcmp(extension_props[ext].extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)) { - found[1] = true; - } - } - for (uint32_t ext = 0; ext < 2; ++ext) { - ASSERT_EQ(true, found[ext]); - } + auto layer_extensions = env.GetInstanceExtensions(2, explicit_layer_name); + EXPECT_TRUE(string_eq(layer_extensions.at(0).extensionName, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)); + EXPECT_TRUE(string_eq(layer_extensions.at(1).extensionName, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)); InstWrapper inst1{env.vulkan_functions}; inst1.create_info.add_extension(VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME) @@ -1890,8 +2912,7 @@ TEST(LayerExtensions, ExplicitBothInstanceExtensions) { // Make sure only the appropriate function pointers are NULL as well handle_assert_has_value(env.vulkan_functions.vkGetInstanceProcAddr(inst2.inst, "vkReleaseDisplayEXT")); PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT pfnGetPhysicalDeviceSurfaceCapabilities2EXT = - reinterpret_cast( - env.vulkan_functions.vkGetInstanceProcAddr(inst2.inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT")); + inst2.load("vkGetPhysicalDeviceSurfaceCapabilities2EXT"); handle_assert_has_value(pfnGetPhysicalDeviceSurfaceCapabilities2EXT); VkSurfaceCapabilities2EXT surf_caps{VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT}; @@ -1905,12 +2926,7 @@ TEST(LayerExtensions, ExplicitBothInstanceExtensions) { TEST(LayerExtensions, ImplicitNoAdditionalDeviceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; const char* enable_env_var = "ENABLE_ME"; @@ -1923,56 +2939,34 @@ TEST(LayerExtensions, ImplicitNoAdditionalDeviceExtension) { .set_enable_environment(enable_env_var)), "implicit_wrap_layer_no_ext.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure the extensions that are implemented only in the test layers is not present. - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - } + ASSERT_NO_FATAL_FAILURE(inst.EnumerateDeviceExtensions(phys_dev, 0)); // Device functions queried using vkGetInstanceProcAddr should be non-NULL since this could be available for any attached // physical device. - PFN_vkTrimCommandPoolKHR pfn_vkTrimCommandPool = - reinterpret_cast(inst->vkGetInstanceProcAddr(inst.inst, "vkTrimCommandPoolKHR")); - PFN_vkGetSwapchainStatusKHR pfn_vkGetSwapchainStatus = - reinterpret_cast(inst->vkGetInstanceProcAddr(inst.inst, "vkGetSwapchainStatusKHR")); - PFN_vkSetDeviceMemoryPriorityEXT pfn_vkSetDeviceMemoryPriority = - reinterpret_cast(inst->vkGetInstanceProcAddr(inst.inst, "vkSetDeviceMemoryPriorityEXT")); + PFN_vkTrimCommandPoolKHR pfn_vkTrimCommandPool = inst.load("vkTrimCommandPoolKHR"); + PFN_vkGetSwapchainStatusKHR pfn_vkGetSwapchainStatus = inst.load("vkGetSwapchainStatusKHR"); + PFN_vkSetDeviceMemoryPriorityEXT pfn_vkSetDeviceMemoryPriority = inst.load("vkSetDeviceMemoryPriorityEXT"); handle_assert_has_value(pfn_vkTrimCommandPool); handle_assert_has_value(pfn_vkGetSwapchainStatus); handle_assert_has_value(pfn_vkSetDeviceMemoryPriority); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_dev); // Query again after create device to make sure the value returned by vkGetInstanceProcAddr did not change - PFN_vkTrimCommandPoolKHR pfn_vkTrimCommandPool2 = - reinterpret_cast(inst->vkGetInstanceProcAddr(inst.inst, "vkTrimCommandPoolKHR")); - PFN_vkGetSwapchainStatusKHR pfn_vkGetSwapchainStatus2 = - reinterpret_cast(inst->vkGetInstanceProcAddr(inst.inst, "vkGetSwapchainStatusKHR")); - PFN_vkSetDeviceMemoryPriorityEXT pfn_vkSetDeviceMemoryPriority2 = - reinterpret_cast(inst->vkGetInstanceProcAddr(inst.inst, "vkSetDeviceMemoryPriorityEXT")); + PFN_vkTrimCommandPoolKHR pfn_vkTrimCommandPool2 = inst.load("vkTrimCommandPoolKHR"); + PFN_vkGetSwapchainStatusKHR pfn_vkGetSwapchainStatus2 = inst.load("vkGetSwapchainStatusKHR"); + PFN_vkSetDeviceMemoryPriorityEXT pfn_vkSetDeviceMemoryPriority2 = inst.load("vkSetDeviceMemoryPriorityEXT"); ASSERT_EQ(pfn_vkTrimCommandPool, pfn_vkTrimCommandPool2); ASSERT_EQ(pfn_vkGetSwapchainStatus, pfn_vkGetSwapchainStatus2); ASSERT_EQ(pfn_vkSetDeviceMemoryPriority, pfn_vkSetDeviceMemoryPriority2); @@ -1986,18 +2980,11 @@ TEST(LayerExtensions, ImplicitNoAdditionalDeviceExtension) { ASSERT_DEATH(pfn_vkTrimCommandPool(dev.dev, VK_NULL_HANDLE, 0), ""); ASSERT_DEATH(pfn_vkGetSwapchainStatus(dev.dev, VK_NULL_HANDLE), ""); ASSERT_DEATH(pfn_vkSetDeviceMemoryPriority(dev.dev, VK_NULL_HANDLE, 0.f), ""); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ImplicitMaintenanceDeviceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; const char* enable_env_var = "ENABLE_ME"; @@ -2010,55 +2997,31 @@ TEST(LayerExtensions, ImplicitMaintenanceDeviceExtension) { .set_enable_environment(enable_env_var)), "implicit_wrap_layer_maint.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 1U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure only the one extension implemented by the enabled implicit layer is present. - bool found = false; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (!strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)) { - found = true; - } - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - ASSERT_EQ(true, found); + auto device_extensions = inst.EnumerateDeviceExtensions(phys_dev, 1); + ASSERT_TRUE(string_eq(device_extensions.at(0).extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); DeviceWrapper dev{inst}; - dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME).add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME); dev.CheckCreate(phys_dev); // Make sure only the appropriate function pointers are NULL as well handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR")); handle_assert_null(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ImplicitPresentImageDeviceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; const char* enable_env_var = "ENABLE_ME"; @@ -2071,56 +3034,31 @@ TEST(LayerExtensions, ImplicitPresentImageDeviceExtension) { .set_enable_environment(enable_env_var)), "implicit_wrap_layer_pres.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 1U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure only the one extension implemented by the enabled implicit layer is present. - bool found = false; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - if (!strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - found = true; - } - } - ASSERT_EQ(true, found); + auto device_extensions = inst.EnumerateDeviceExtensions(phys_dev, 1); + ASSERT_TRUE(string_eq(device_extensions.at(0).extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); DeviceWrapper dev{inst}; - dev.create_info.add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME) - .add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME); dev.CheckCreate(phys_dev); // Make sure only the appropriate function pointers are NULL as well handle_assert_null(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR")); handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ImplicitBothDeviceExtensions) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; const char* enable_env_var = "ENABLE_ME"; @@ -2133,61 +3071,32 @@ TEST(LayerExtensions, ImplicitBothDeviceExtensions) { .set_enable_environment(enable_env_var)), "implicit_wrap_layer_both_dev.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); - // // set enable env-var, layer should load - set_env_var(enable_env_var, "1"); + // set enable env-var, layer should load + EnvVarWrapper wrap_enable_env_var{enable_env_var, "1"}; CheckLogForLayerString(env, implicit_layer_name, true); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 2U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure only the one extension implemented by the enabled implicit layer is present. - bool found[2] = {false, false}; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (!strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)) { - found[0] = true; - } - if (!strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - found[1] = true; - } - } - for (uint32_t ext = 0; ext < 2; ++ext) { - ASSERT_EQ(true, found[ext]); - } + auto device_extensions = inst.EnumerateDeviceExtensions(phys_dev, 2); + ASSERT_TRUE(string_eq(device_extensions.at(0).extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); + ASSERT_TRUE(string_eq(device_extensions.at(1).extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); DeviceWrapper dev{inst}; - dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME) - .add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME) - .add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME).add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME); dev.CheckCreate(phys_dev); // Make sure only the appropriate function pointers are NULL as well handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR")); handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); - - remove_env_var(enable_env_var); } TEST(LayerExtensions, ExplicitNoAdditionalDeviceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -2195,49 +3104,18 @@ TEST(LayerExtensions, ExplicitNoAdditionalDeviceExtension) { ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_WRAP_OBJECTS)), "explicit_wrap_layer_no_ext.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(explicit_layer_name); inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure the extensions are not present - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - } - - // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, - &extension_count, extension_props.data())); - - // Make sure the extensions still aren't present in this layer - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - } + ASSERT_NO_FATAL_FAILURE(inst.EnumerateDeviceExtensions(phys_dev, 0)); + ASSERT_NO_FATAL_FAILURE(inst.EnumerateLayerDeviceExtensions(phys_dev, explicit_layer_name, 0)); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_dev); // Make sure all the function pointers are NULL as well @@ -2248,12 +3126,7 @@ TEST(LayerExtensions, ExplicitNoAdditionalDeviceExtension) { TEST(LayerExtensions, ExplicitMaintenanceDeviceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -2264,52 +3137,20 @@ TEST(LayerExtensions, ExplicitMaintenanceDeviceExtension) { .add_device_extension({VK_KHR_MAINTENANCE1_EXTENSION_NAME, 1, {"vkTrimCommandPoolKHR"}})), "explicit_wrap_layer_maint.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(explicit_layer_name); inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure the extensions are not present - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - } - - // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 1U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, &extension_count, - extension_props.data())); - - // Make sure only the one extension implemented by the enabled implicit layer is present. - bool found = true; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (!strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)) { - found = true; - } - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - ASSERT_EQ(true, found); + ASSERT_NO_FATAL_FAILURE(inst.EnumerateDeviceExtensions(phys_dev, 0)); + auto layer_extensions = inst.EnumerateLayerDeviceExtensions(phys_dev, explicit_layer_name, 1); + ASSERT_TRUE(string_eq(layer_extensions.at(0).extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); DeviceWrapper dev{inst}; - dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME).add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME); dev.CheckCreate(phys_dev); // Make sure only the appropriate function pointers are NULL as well @@ -2319,12 +3160,7 @@ TEST(LayerExtensions, ExplicitMaintenanceDeviceExtension) { TEST(LayerExtensions, ExplicitPresentImageDeviceExtension) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -2336,53 +3172,20 @@ TEST(LayerExtensions, ExplicitPresentImageDeviceExtension) { .add_device_extension({VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME, 1, {"vkGetSwapchainStatusKHR"}})), "explicit_wrap_layer_pres.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(explicit_layer_name); inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure the extensions are not present - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - } - - // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 1U); - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, &extension_count, - extension_props.data())); - - // Make sure only the one extension implemented by the enabled implicit layer is present. - bool found = false; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - if (!strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - found = true; - } - } - ASSERT_EQ(true, found); + ASSERT_NO_FATAL_FAILURE(inst.EnumerateDeviceExtensions(phys_dev, 0)); + auto layer_extensions = inst.EnumerateLayerDeviceExtensions(phys_dev, explicit_layer_name, 1); + ASSERT_TRUE(string_eq(layer_extensions.at(0).extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); DeviceWrapper dev{inst}; - dev.create_info.add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME) - .add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME); dev.CheckCreate(phys_dev); // Make sure only the appropriate function pointers are NULL as well @@ -2392,12 +3195,7 @@ TEST(LayerExtensions, ExplicitPresentImageDeviceExtension) { TEST(LayerExtensions, ExplicitBothDeviceExtensions) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -2410,9 +3208,8 @@ TEST(LayerExtensions, ExplicitBothDeviceExtensions) { .add_device_extension({VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME, 1, {"vkGetSwapchainStatusKHR"}})), "explicit_wrap_layer_both_dev.json"); - uint32_t count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); - ASSERT_EQ(count, 1U); + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, explicit_layer_name)); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(explicit_layer_name); @@ -2420,58 +3217,20 @@ TEST(LayerExtensions, ExplicitBothDeviceExtensions) { VkPhysicalDevice phys_dev = inst.GetPhysDev(); handle_assert_has_value(phys_dev); - uint32_t extension_count = 0; - std::vector extension_props; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, nullptr)); - if (extension_count > 0) { - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, nullptr, &extension_count, - extension_props.data())); - - // Make sure the extensions are not present - for (uint32_t ext = 0; ext < extension_count; ++ext) { - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); - ASSERT_NE(0, strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); - } - } - - // Now query by layer name. - extension_count = 0; - extension_props.clear(); - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 2U); // debug_utils, and debug_report - extension_props.resize(extension_count); - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev, explicit_layer_name, &extension_count, - extension_props.data())); - - // Make sure only the one extension implemented by the enabled implicit layer is present. - bool found[2] = {false, false}; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (!strcmp(extension_props[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)) { - found[0] = true; - } - if (!strcmp(extension_props[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - found[1] = true; - } - } - for (uint32_t ext = 0; ext < 2; ++ext) { - ASSERT_EQ(true, found[ext]); - } + ASSERT_NO_FATAL_FAILURE(inst.EnumerateDeviceExtensions(phys_dev, 0)); + auto layer_extensions = inst.EnumerateLayerDeviceExtensions(phys_dev, explicit_layer_name, 2); + ASSERT_TRUE(string_eq(layer_extensions.at(0).extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); + ASSERT_TRUE(string_eq(layer_extensions.at(1).extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); DeviceWrapper dev{inst}; - dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME) - .add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME) - .add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME).add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME); dev.CheckCreate(phys_dev); // Make sure only the appropriate function pointers are NULL as well handle_assert_has_value(dev->vkGetDeviceProcAddr(dev.dev, "vkTrimCommandPoolKHR")); - PFN_vkGetSwapchainStatusKHR gipa_pfnGetSwapchainStatusKHR = - reinterpret_cast(inst->vkGetInstanceProcAddr(inst.inst, "vkGetSwapchainStatusKHR")); - PFN_vkGetSwapchainStatusKHR gdpa_pfnGetSwapchainStatusKHR = - reinterpret_cast(dev->vkGetDeviceProcAddr(dev.dev, "vkGetSwapchainStatusKHR")); + PFN_vkGetSwapchainStatusKHR gipa_pfnGetSwapchainStatusKHR = inst.load("vkGetSwapchainStatusKHR"); + PFN_vkGetSwapchainStatusKHR gdpa_pfnGetSwapchainStatusKHR = dev.load("vkGetSwapchainStatusKHR"); handle_assert_has_value(gipa_pfnGetSwapchainStatusKHR); handle_assert_has_value(gdpa_pfnGetSwapchainStatusKHR); @@ -2482,12 +3241,10 @@ TEST(LayerExtensions, ExplicitBothDeviceExtensions) { TEST(TestLayers, ExplicitlyEnableImplicitLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0))); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0); - VkPhysicalDeviceProperties properties{}; - properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 2, 0); - env.get_test_icd().add_physical_device({}); - env.get_test_icd().physical_devices.back().set_properties(properties); + uint32_t api_version = VK_API_VERSION_1_2; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, api_version)) + .set_icd_api_version(api_version) + .add_physical_device(PhysicalDevice{}.set_api_version(api_version).finish()); const char* regular_layer_name = "VK_LAYER_TestLayer1"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -2501,40 +3258,24 @@ TEST(TestLayers, ExplicitlyEnableImplicitLayer) { inst.create_info.add_layer(regular_layer_name); inst.create_info.set_api_version(1, 1, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - EXPECT_EQ(1U, count); - ASSERT_TRUE(string_eq(regular_layer_name, layer_props.layerName)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(regular_layer_name, layer_props.at(0).layerName)); } { // 1.2 instance InstWrapper inst{env.vulkan_functions}; inst.create_info.add_layer(regular_layer_name); inst.create_info.set_api_version(1, 2, 0); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - ASSERT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - ASSERT_EQ(1U, count); + inst.GetActiveLayers(inst.GetPhysDev(), 1); } } TEST(TestLayers, NewerInstanceVersionThanImplicitLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0))); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0); - VkPhysicalDeviceProperties properties{}; - properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 2, 0); - env.get_test_icd().add_physical_device({}); - env.get_test_icd().physical_devices.back().set_properties(properties); + uint32_t api_version = VK_API_VERSION_1_2; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, api_version)) + .set_icd_api_version(api_version) + .add_physical_device(PhysicalDevice{}.set_api_version(api_version).finish()); const char* regular_layer_name = "VK_LAYER_TestLayer1"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -2544,13 +3285,7 @@ TEST(TestLayers, NewerInstanceVersionThanImplicitLayer) { .set_disable_environment("DisableMeIfYouCan")), "regular_test_layer.json"); { // global functions - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 1U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); EXPECT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); } { // 1.1 instance - should find the implicit layer @@ -2558,45 +3293,30 @@ TEST(TestLayers, NewerInstanceVersionThanImplicitLayer) { inst.create_info.set_api_version(1, 1, 0); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(); - EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + regular_layer_name)); + EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); env.debug_log.clear(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - EXPECT_EQ(1U, count); - ASSERT_TRUE(string_eq(regular_layer_name, layer_props.layerName)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(regular_layer_name, layer_props.at(0).layerName)); } { // 1.2 instance -- instance layer should be found InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 2, 0); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(); - EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer ") + regular_layer_name)); + EXPECT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + regular_layer_name)); env.debug_log.clear(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - EXPECT_EQ(1U, count); - ASSERT_TRUE(string_eq(regular_layer_name, layer_props.layerName)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(regular_layer_name, layer_props.at(0).layerName)); } } TEST(TestLayers, ImplicitLayerPre10APIVersion) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0))); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0); - VkPhysicalDeviceProperties properties{}; - properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 2, 0); - env.get_test_icd().add_physical_device({}); - env.get_test_icd().physical_devices.back().set_properties(properties); + uint32_t api_version = VK_API_VERSION_1_2; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, api_version)) + .set_icd_api_version(api_version) + .add_physical_device(PhysicalDevice{}.set_api_version(api_version).finish()); const char* regular_layer_name = "VK_LAYER_TestLayer1"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -2606,14 +3326,7 @@ TEST(TestLayers, ImplicitLayerPre10APIVersion) { .set_disable_environment("DisableMeIfYouCan")), "regular_test_layer.json"); { // global functions - - uint32_t layer_count = 0; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr)); - EXPECT_EQ(layer_count, 1U); - - std::array layer_props; - EXPECT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data())); - EXPECT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); EXPECT_TRUE(string_eq(layer_props[0].layerName, regular_layer_name)); } { // 1.0 instance @@ -2622,16 +3335,9 @@ TEST(TestLayers, ImplicitLayerPre10APIVersion) { inst.create_info.set_api_version(1, 0, 0); FillDebugUtilsCreateDetails(inst.create_info, log); inst.CheckCreate(); - EXPECT_TRUE(log.find(std::string("Insert instance layer ") + regular_layer_name)); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - EXPECT_EQ(1U, count); - ASSERT_TRUE(string_eq(regular_layer_name, layer_props.layerName)); + EXPECT_TRUE(log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(regular_layer_name, layer_props.at(0).layerName)); } { // 1.1 instance DebugUtilsLogger log; @@ -2639,15 +3345,9 @@ TEST(TestLayers, ImplicitLayerPre10APIVersion) { inst.create_info.set_api_version(1, 1, 0); FillDebugUtilsCreateDetails(inst.create_info, log); inst.CheckCreate(); - EXPECT_TRUE(log.find(std::string("Insert instance layer ") + regular_layer_name)); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - EXPECT_EQ(1U, count); - ASSERT_TRUE(string_eq(regular_layer_name, layer_props.layerName)); + EXPECT_TRUE(log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(regular_layer_name, layer_props.at(0).layerName)); } { // 1.2 instance DebugUtilsLogger log; @@ -2655,45 +3355,30 @@ TEST(TestLayers, ImplicitLayerPre10APIVersion) { inst.create_info.set_api_version(1, 2, 0); FillDebugUtilsCreateDetails(inst.create_info, log); inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - EXPECT_TRUE(log.find(std::string("Insert instance layer ") + regular_layer_name)); - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - EXPECT_EQ(1U, count); - ASSERT_TRUE(string_eq(regular_layer_name, layer_props.layerName)); - } - { // application doesn't state its API version + EXPECT_TRUE(log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(regular_layer_name, layer_props.at(0).layerName)); + } + { // application sets its API version to 0 DebugUtilsLogger log; InstWrapper inst{env.vulkan_functions}; - inst.create_info.set_fill_in_application_info(false); + inst.create_info.set_api_version(0); FillDebugUtilsCreateDetails(inst.create_info, log); inst.CheckCreate(); - EXPECT_TRUE(log.find(std::string("Insert instance layer ") + regular_layer_name)); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); - - uint32_t count = 0; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, nullptr); - EXPECT_EQ(1U, count); - VkLayerProperties layer_props{}; - env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &count, &layer_props); - EXPECT_EQ(1U, count); - ASSERT_TRUE(string_eq(regular_layer_name, layer_props.layerName)); + EXPECT_TRUE(log.find(std::string("Insert instance layer \"") + regular_layer_name)); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(regular_layer_name, layer_props.at(0).layerName)); } } // 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, EnvironEnableExplicitLayer) { +TEST(TestLayers, InstEnvironEnableExplicitLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0))); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0); - VkPhysicalDeviceProperties properties{}; - properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 2, 0); - env.get_test_icd().add_physical_device({}); - env.get_test_icd().physical_devices.back().set_properties(properties); + uint32_t api_version = VK_API_VERSION_1_2; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, api_version)) + .set_icd_api_version(api_version) + .add_physical_device(PhysicalDevice{}.set_api_version(api_version).finish()); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -2712,21 +3397,10 @@ TEST(TestLayers, EnvironEnableExplicitLayer) { inst1.CheckCreate(); VkPhysicalDevice phys_dev1 = inst1.GetPhysDev(); - // Make sure the extensions in the layer aren't present - uint32_t extension_count = 40; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev1, nullptr, &extension_count, extensions.data())); - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (string_eq(extensions[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME) || - string_eq(extensions[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - FAIL() << "Extension should not be present"; - } - } + ASSERT_NO_FATAL_FAILURE(inst1.EnumerateDeviceExtensions(phys_dev1, 0)); // Create a device and query the function pointers DeviceWrapper dev1{inst1}; - dev1.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev1.CheckCreate(phys_dev1); PFN_vkTrimCommandPoolKHR pfn_TrimCommandPoolBefore = dev1.load("vkTrimCommandPoolKHR"); PFN_vkGetSwapchainStatusKHR pfn_GetSwapchainStatusBefore = dev1.load("vkGetSwapchainStatusKHR"); @@ -2734,7 +3408,7 @@ TEST(TestLayers, EnvironEnableExplicitLayer) { handle_assert_null(pfn_GetSwapchainStatusBefore); // Now setup the instance layer - set_env_var("VK_INSTANCE_LAYERS", explicit_layer_name); + EnvVarWrapper instance_layers_env_var{"VK_INSTANCE_LAYERS", explicit_layer_name}; // Now, test an instance/device with the layer forced on. The extensions should be present and // the function pointers should be valid. @@ -2742,27 +3416,13 @@ TEST(TestLayers, EnvironEnableExplicitLayer) { inst2.CheckCreate(); VkPhysicalDevice phys_dev2 = inst2.GetPhysDev(); - // Make sure the extensions in the layer are present - extension_count = 40; - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev2, nullptr, &extension_count, extensions.data())); - bool maint_found = false; - bool pres_found = false; - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (string_eq(extensions[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)) { - maint_found = true; - } - if (string_eq(extensions[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - pres_found = true; - } - } - ASSERT_EQ(true, maint_found); - ASSERT_EQ(true, pres_found); + auto layer_extensions = inst2.EnumerateLayerDeviceExtensions(phys_dev2, explicit_layer_name, 2); + ASSERT_TRUE(string_eq(layer_extensions.at(0).extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); + ASSERT_TRUE(string_eq(layer_extensions.at(1).extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)); DeviceWrapper dev2{inst2}; dev2.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME) - .add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME) - .add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + .add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME); dev2.CheckCreate(phys_dev2); PFN_vkTrimCommandPoolKHR pfn_TrimCommandPoolAfter = dev2.load("vkTrimCommandPoolKHR"); @@ -2771,27 +3431,967 @@ TEST(TestLayers, EnvironEnableExplicitLayer) { handle_assert_has_value(pfn_GetSwapchainStatusAfter); ASSERT_EQ(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, pfn_GetSwapchainStatusAfter(dev2.dev, VK_NULL_HANDLE)); - - remove_env_var("VK_INSTANCE_LAYERS"); } -// Add a device layer, should not work -TEST(TestLayers, DoNotUseDeviceLayer) { +// 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 +TEST(TestLayers, EnvironLayerEnableExplicitLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0))); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0); - VkPhysicalDeviceProperties properties{}; - properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 2, 0); - env.get_test_icd().add_physical_device({}); - env.get_test_icd().physical_devices.back().set_properties(properties); + uint32_t api_version = VK_API_VERSION_1_2; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, api_version)) + .set_icd_api_version(api_version) + .add_physical_device(PhysicalDevice{}); - const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; - env.add_explicit_layer( - ManifestLayer{}.add_layer( - ManifestLayer::LayerDescription{} - .set_name(explicit_layer_name) - .set_lib_path(TEST_LAYER_WRAP_OBJECTS_3) - .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)) + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_1); + + const char* explicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* explicit_json_name_2 = "Second_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_2); + + const char* explicit_layer_name_3 = "VK_LAYER_LUNARG_second_test_layer"; + const char* explicit_json_name_3 = "second_test_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_3) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_3); + + EnvVarWrapper layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE"}; + + // First, test an instance/device without the layer forced on. + InstWrapper inst1{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + inst1.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Now force on one layer with its full name + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value(explicit_layer_name_1); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + inst2.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match prefix + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("VK_LAYER_LUNARG_*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + inst3.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match suffix + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("*Second_layer"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + inst4.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match substring + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst5{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + inst5.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with star '*' + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("*"); + + InstWrapper inst6{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + inst6.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with special name + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value("~all~"); + + InstWrapper inst7{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); + inst7.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); +} + +// Verify that VK_LOADER_LAYERS_DISABLE work. To test this, make sure that an explicit layer does not affect an instance until +// it is set with VK_LOADER_LAYERS_DISABLE +TEST(TestLayers, EnvironLayerDisableExplicitLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2) + .add_physical_device(PhysicalDevice{}); + + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_1); + + const char* explicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* explicit_json_name_2 = "Second_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_2); + + const char* explicit_layer_name_3 = "VK_LAYER_LUNARG_Second_test_layer"; + const char* explicit_json_name_3 = "Second_test_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_3) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_3); + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE"}; + + // First, test an instance/device without the layer forced on. + InstWrapper inst1{env.vulkan_functions}; + inst1.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst1.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Now force on one layer with its full name + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value(explicit_layer_name_1); + + InstWrapper inst2{env.vulkan_functions}; + inst2.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst2.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match prefix + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("VK_LAYER_LUNARG_*"); + + InstWrapper inst3{env.vulkan_functions}; + inst3.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match suffix + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*Second_layer"); + + InstWrapper inst4{env.vulkan_functions}; + inst4.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst4.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match substring + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*Second*"); + + InstWrapper inst5{env.vulkan_functions}; + inst5.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst5.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with star '*' + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*"); + + InstWrapper inst6{env.vulkan_functions}; + inst6.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst6.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match all with special name + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~all~"); + + InstWrapper inst7{env.vulkan_functions}; + inst7.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst7.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Match explicit special name + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~explicit~"); + + InstWrapper inst8{env.vulkan_functions}; + inst8.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst8.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst8.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // No match implicit special name + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~implicit~"); + + InstWrapper inst9{env.vulkan_functions}; + inst9.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst9.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst9.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); +} + +// Verify that VK_LOADER_LAYERS_ENABLE + VK_LOADER_LAYERS_DISABLE work.(results in the layer still being +// enabled) +TEST(TestLayers, EnvironLayerEnableDisableExplicitLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_1); + + const char* explicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* explicit_json_name_2 = "Second_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_2); + + const char* explicit_layer_name_3 = "VK_LAYER_LUNARG_Second_test_layer"; + const char* explicit_json_name_3 = "Second_test_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_3) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_3); + + EnvVarWrapper layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE"}; + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE"}; + + // First, test an instance/device without the layer forced on. + InstWrapper inst1{env.vulkan_functions}; + inst1.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst1.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable 2 but enable 1 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*Second*"); + layers_enable_env_var.set_new_value("*test_layer"); + + InstWrapper inst2{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst2.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable all but enable 2 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst3{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable all but enable 2 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~all~"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst4{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst4.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst4.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable explicit but enable 2 + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~explicit~"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst5{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst5.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst5.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable implicit but enable 2 (should still be everything) + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~implicit~"); + layers_enable_env_var.set_new_value("*Second*"); + + InstWrapper inst6{env.vulkan_functions}; + inst6.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst6.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst6.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); + + // Disable explicit but enable all + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("~explicit~"); + layers_enable_env_var.set_new_value("*"); + + InstWrapper inst7{env.vulkan_functions}; + inst7.create_info.add_layer(explicit_layer_name_1).add_layer(explicit_layer_name_2).add_layer(explicit_layer_name_3); + FillDebugUtilsCreateDetails(inst7.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst7.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_3)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_3, "disabled because name matches filter of env var")); +} + +// Verify that VK_INSTANCE_LAYERS + VK_LOADER_LAYERS_DISABLE work.(results in the layer still being +// enabled) +TEST(TestLayers, EnvironVkInstanceLayersAndDisableFilters) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_1); + + const char* explicit_layer_name_2 = "VK_LAYER_LUNARG_Second_layer"; + const char* explicit_json_name_2 = "Second_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_2); + + EnvVarWrapper layers_enable_env_var{"VK_INSTANCE_LAYERS"}; + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE"}; + + // First, test an instance/device without the layer forced on. + InstWrapper inst1{env.vulkan_functions}; + inst1.create_info.add_layer(explicit_layer_name_1); + FillDebugUtilsCreateDetails(inst1.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst1.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + + // Enable the non-default enabled layer with VK_INSTANCE_LAYERS + // ------------------------------------------ + env.debug_log.clear(); + layers_enable_env_var.set_new_value(explicit_layer_name_2); + + InstWrapper inst2{env.vulkan_functions}; + inst2.create_info.add_layer(explicit_layer_name_1); + FillDebugUtilsCreateDetails(inst2.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst2.CheckCreate()); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); + + // Try to disable all + // ------------------------------------------ + env.debug_log.clear(); + layers_disable_env_var.set_new_value("*"); + + InstWrapper inst3{env.vulkan_functions}; + inst3.create_info.add_layer(explicit_layer_name_1); + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer", explicit_layer_name_2)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_2, "disabled because name matches filter of env var")); +} + +// Verify that layers enabled through VK_INSTANCE_LAYERS which were not found get the proper error message +TEST(TestLayers, NonExistantLayerInVK_INSTANCE_LAYERS) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + const char* layer_name = "VK_LAYER_test_layer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"); + + EnvVarWrapper layers_enable_env_var{"VK_INSTANCE_LAYERS", "VK_LAYER_I_dont_exist"}; + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE( + env.debug_log.find("Layer \"VK_LAYER_I_dont_exist\" was not found but was requested by env var VK_INSTANCE_LAYERS!")); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + // Make sure layers that do exist are loaded + env.debug_log.clear(); + layers_enable_env_var.add_to_list(layer_name); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE( + env.debug_log.find("Layer \"VK_LAYER_I_dont_exist\" was not found but was requested by env var VK_INSTANCE_LAYERS!")); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, layer_name)); + } + // Make sure that if the layer appears twice in the env-var nothing bad happens + env.debug_log.clear(); + layers_enable_env_var.add_to_list("VK_LAYER_I_dont_exist"); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE( + env.debug_log.find("Layer \"VK_LAYER_I_dont_exist\" was not found but was requested by env var VK_INSTANCE_LAYERS!")); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, layer_name)); + } +} + +// Verify that if the same layer appears twice in VK_INSTANCE_LAYERS nothing bad happens +TEST(TestLayers, DuplicatesInEnvironVK_INSTANCE_LAYERS) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + const char* layer_name = "VK_LAYER_test_layer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"); + + EnvVarWrapper layers_enable_env_var{"VK_INSTANCE_LAYERS"}; + + layers_enable_env_var.add_to_list(layer_name); + layers_enable_env_var.add_to_list(layer_name); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + auto layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, layer_name)); +} + +TEST(TestLayers, AppEnabledExplicitLayerFails) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0))), + explicit_json_name_1); + + env.debug_log.clear(); + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE", explicit_layer_name_1}; + + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst3{env.vulkan_functions}; + inst3.create_info.add_layer(explicit_layer_name_1); + FillDebugUtilsCreateDetails(inst3.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst3.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); +} + +TEST(TestLayers, OverrideEnabledExplicitLayerWithDisableFilter) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))), + explicit_json_name_1); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(explicit_layer_name_1) + .set_disable_environment("DisableMeIfYouCan")), + "meta_test_layer.json"); + + env.debug_log.clear(); + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE", explicit_layer_name_1}; + + auto layers = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(lunarg_meta_layer_name, layers[0].layerName)); + + { // both override layer and Disable env var + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE( + env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + } + env.debug_log.clear(); + { // Now try to enable the explicit layer as well + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(explicit_layer_name_1); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE( + env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + } +} + +TEST(TestLayers, OverrideEnabledExplicitLayerWithDisableFilterForOverrideLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))), + explicit_json_name_1); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(explicit_layer_name_1) + .set_disable_environment("DisableMeIfYouCan")), + "meta_test_layer.json"); + + env.debug_log.clear(); + EnvVarWrapper layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE", lunarg_meta_layer_name}; + + auto layers = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(explicit_layer_name_1, layers[0].layerName)); + + { // both override layer and Disable env var + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE( + env.debug_log.find_prefix_then_postfix(lunarg_meta_layer_name, "disabled because name matches filter of env var")); + } + env.debug_log.clear(); + { // Now try to enable the explicit layer as well + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(explicit_layer_name_1); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1)); + ASSERT_FALSE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_TRUE( + env.debug_log.find_prefix_then_postfix(lunarg_meta_layer_name, "disabled because name matches filter of env var")); + } +} + +TEST(TestLayers, OverrideBlacklistedLayerWithEnableFilter) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2); + + const char* explicit_layer_name_1 = "VK_LAYER_LUNARG_First_layer"; + const char* explicit_json_name_1 = "First_layer.json"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))), + explicit_json_name_1); + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_blacklisted_layer(explicit_layer_name_1) + .set_disable_environment("DisableMeIfYouCan")), + "meta_test_layer.json"); + + env.debug_log.clear(); + EnvVarWrapper layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE", explicit_layer_name_1}; + + auto layers = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(explicit_layer_name_1, layers[0].layerName)); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE( + env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + } + env.debug_log.clear(); + { // Try to enable a blacklisted layer + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(explicit_layer_name_1); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Insert instance layer ", explicit_layer_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix("Found manifest file", explicit_json_name_1)); + ASSERT_TRUE(env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "forced enabled due to env var")); + ASSERT_FALSE( + env.debug_log.find_prefix_then_postfix(explicit_layer_name_1, "disabled because name matches filter of env var")); + } +} + +// Add a device layer, should not work +TEST(TestLayers, DoNotUseDeviceLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2) + .add_physical_device(PhysicalDevice{}.set_api_version(VK_API_VERSION_1_2).finish()); + + const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name) + .set_lib_path(TEST_LAYER_WRAP_OBJECTS_3) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)) .add_device_extension({VK_KHR_MAINTENANCE1_EXTENSION_NAME, 1, {"vkTrimCommandPoolKHR"}}) .add_device_extension({VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME, 1, {"vkGetSwapchainStatusKHR"}})), "explicit_wrap_layer_both_dev.json"); @@ -2803,20 +4403,10 @@ TEST(TestLayers, DoNotUseDeviceLayer) { VkPhysicalDevice phys_dev1 = inst1.GetPhysDev(); // Make sure the extensions in the layer aren't present - uint32_t extension_count = 40; - std::array extensions; - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev1, nullptr, &extension_count, extensions.data())); - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (string_eq(extensions[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME) || - string_eq(extensions[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - FAIL() << "Extension should not be present"; - } - } + ASSERT_NO_FATAL_FAILURE(inst1.EnumerateDeviceExtensions(phys_dev1, 0)); // Create a device and query the function pointers DeviceWrapper dev1{inst1}; - dev1.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev1.CheckCreate(phys_dev1); PFN_vkTrimCommandPoolKHR pfn_TrimCommandPoolBefore = dev1.load("vkTrimCommandPoolKHR"); PFN_vkGetSwapchainStatusKHR pfn_GetSwapchainStatusBefore = dev1.load("vkGetSwapchainStatusKHR"); @@ -2830,25 +4420,16 @@ TEST(TestLayers, DoNotUseDeviceLayer) { VkPhysicalDevice phys_dev2 = inst2.GetPhysDev(); // Make sure the extensions in the layer aren't present - extension_count = 40; - EXPECT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateDeviceExtensionProperties(phys_dev1, nullptr, &extension_count, extensions.data())); - for (uint32_t ext = 0; ext < extension_count; ++ext) { - if (string_eq(extensions[ext].extensionName, VK_KHR_MAINTENANCE1_EXTENSION_NAME) || - string_eq(extensions[ext].extensionName, VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) { - FAIL() << "Extension should not be present"; - } - } + ASSERT_NO_FATAL_FAILURE(inst2.EnumerateDeviceExtensions(phys_dev2, 0)); DeviceWrapper dev2{inst2}; dev2.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME) .add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME) - .add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)) .add_layer(explicit_layer_name); dev2.CheckCreate(phys_dev2, VK_ERROR_EXTENSION_NOT_PRESENT); DeviceWrapper dev3{inst2}; - dev3.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)).add_layer(explicit_layer_name); + dev3.create_info.add_layer(explicit_layer_name); dev3.CheckCreate(phys_dev2); PFN_vkTrimCommandPoolKHR pfn_TrimCommandPoolAfter = dev3.load("vkTrimCommandPoolKHR"); @@ -2860,12 +4441,9 @@ TEST(TestLayers, DoNotUseDeviceLayer) { // Make sure that a layer enabled as both an instance and device layer works properly. TEST(TestLayers, InstanceAndDeviceLayer) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0))); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0); - VkPhysicalDeviceProperties properties{}; - properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 2, 0); - env.get_test_icd().add_physical_device({}); - env.get_test_icd().physical_devices.back().set_properties(properties); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2) + .add_physical_device(PhysicalDevice{}.set_api_version(VK_API_VERSION_1_2).finish()); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; env.add_explicit_layer( @@ -2886,7 +4464,6 @@ TEST(TestLayers, InstanceAndDeviceLayer) { DeviceWrapper dev{inst}; dev.create_info.add_extension(VK_KHR_MAINTENANCE1_EXTENSION_NAME) .add_extension(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME) - .add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)) .add_layer(explicit_layer_name); dev.CheckCreate(phys_dev); @@ -2901,13 +4478,9 @@ TEST(TestLayers, InstanceAndDeviceLayer) { // Make sure loader does not throw an error for a device layer that is not present TEST(TestLayers, DeviceLayerNotPresent) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 2, 0))); - env.get_test_icd().icd_api_version = VK_MAKE_API_VERSION(0, 1, 2, 0); - VkPhysicalDeviceProperties properties{}; - properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 2, 0); - env.get_test_icd().add_physical_device({}); - env.get_test_icd().physical_devices.back().set_properties(properties); - + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_2)) + .set_icd_api_version(VK_API_VERSION_1_2) + .add_physical_device(PhysicalDevice{}.set_api_version(VK_API_VERSION_1_2).finish()); const char* explicit_layer_name = "VK_LAYER_LUNARG_wrap_objects"; InstWrapper inst{env.vulkan_functions}; @@ -2921,9 +4494,8 @@ TEST(TestLayers, DeviceLayerNotPresent) { TEST(LayerPhysDeviceMod, AddPhysicalDevices) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_add_phys_dev") + .set_name("VK_LAYER_LunarG_add_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_ADD_PHYS_DEV")), @@ -2933,9 +4505,8 @@ TEST(LayerPhysDeviceMod, AddPhysicalDevices) { layer.set_add_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3000,9 +4571,8 @@ TEST(LayerPhysDeviceMod, AddPhysicalDevices) { TEST(LayerPhysDeviceMod, RemovePhysicalDevices) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_remove_phys_dev") + .set_name("VK_LAYER_LunarG_remove_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_REMOVE_PHYS_DEV")), @@ -3012,9 +4582,8 @@ TEST(LayerPhysDeviceMod, RemovePhysicalDevices) { layer.set_remove_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3052,9 +4621,8 @@ TEST(LayerPhysDeviceMod, RemovePhysicalDevices) { TEST(LayerPhysDeviceMod, ReorderPhysicalDevices) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_reorder_phys_dev") + .set_name("VK_LAYER_LunarG_reorder_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_REORDER_PHYS_DEV")), @@ -3064,9 +4632,8 @@ TEST(LayerPhysDeviceMod, ReorderPhysicalDevices) { layer.set_reorder_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3104,9 +4671,8 @@ TEST(LayerPhysDeviceMod, ReorderPhysicalDevices) { TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDevices) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_all_phys_dev") + .set_name("VK_LAYER_LunarG_all_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_ALL_PHYS_DEV")), @@ -3116,9 +4682,8 @@ TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDevices) { layer.set_add_phys_devs(true).set_remove_phys_devs(true).set_reorder_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3168,7 +4733,7 @@ TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDevices) { ASSERT_EQ(found_added_count, 3U); } -static bool GroupsAreTheSame(VkPhysicalDeviceGroupProperties a, VkPhysicalDeviceGroupProperties b) { +bool GroupsAreTheSame(VkPhysicalDeviceGroupProperties a, VkPhysicalDeviceGroupProperties b) { if (a.physicalDeviceCount != b.physicalDeviceCount) { return false; } @@ -3182,9 +4747,8 @@ static bool GroupsAreTheSame(VkPhysicalDeviceGroupProperties a, VkPhysicalDevice TEST(LayerPhysDeviceMod, AddPhysicalDeviceGroups) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_add_phys_dev") + .set_name("VK_LAYER_LunarG_add_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_ADD_PHYS_DEV")), @@ -3194,9 +4758,8 @@ TEST(LayerPhysDeviceMod, AddPhysicalDeviceGroups) { layer.set_add_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3226,18 +4789,16 @@ TEST(LayerPhysDeviceMod, AddPhysicalDeviceGroups) { ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &grp_count, nullptr)); ASSERT_GT(grp_count, icd_groups); - auto not_exp_phys_dev_groups = std::vector(icd_groups); - for (uint32_t group = 0; group < icd_groups; ++group) { - not_exp_phys_dev_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; - } + auto not_exp_phys_dev_groups = + std::vector(icd_groups, {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES}); + uint32_t returned_group_count = icd_groups; ASSERT_EQ(VK_INCOMPLETE, inst->vkEnumeratePhysicalDeviceGroups(inst, &returned_group_count, not_exp_phys_dev_groups.data())); ASSERT_EQ(icd_groups, returned_group_count); - auto phys_dev_groups = std::vector(grp_count); - for (uint32_t group = 0; group < grp_count; ++group) { - phys_dev_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; - } + auto phys_dev_groups = + std::vector(grp_count, {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES}); + returned_group_count = grp_count; ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &returned_group_count, phys_dev_groups.data())); ASSERT_EQ(grp_count, returned_group_count); @@ -3272,9 +4833,9 @@ TEST(LayerPhysDeviceMod, AddPhysicalDeviceGroups) { TEST(LayerPhysDeviceMod, RemovePhysicalDeviceGroups) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + EnvVarWrapper disable_linux_sort("VK_LOADER_DISABLE_SELECT", "1"); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_remove_phys_dev") + .set_name("VK_LAYER_LunarG_remove_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_REMOVE_PHYS_DEV")), @@ -3284,9 +4845,8 @@ TEST(LayerPhysDeviceMod, RemovePhysicalDeviceGroups) { layer.set_remove_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3306,7 +4866,7 @@ TEST(LayerPhysDeviceMod, RemovePhysicalDeviceGroups) { cur_icd.physical_device_groups.emplace_back(cur_icd.physical_devices[1]); cur_icd.physical_device_groups.back().use_physical_device(cur_icd.physical_devices[2]); } - const uint32_t icd_groups = 4; + const uint32_t icd_groups = 3; InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(VK_API_VERSION_1_1); @@ -3314,12 +4874,11 @@ TEST(LayerPhysDeviceMod, RemovePhysicalDeviceGroups) { uint32_t grp_count = 0; ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &grp_count, nullptr)); - ASSERT_LT(grp_count, icd_groups); + ASSERT_EQ(grp_count, icd_groups); + + auto phys_dev_groups = + std::vector(grp_count, {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES}); - auto phys_dev_groups = std::vector(grp_count); - for (uint32_t group = 0; group < grp_count; ++group) { - phys_dev_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; - } uint32_t returned_group_count = grp_count; ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &returned_group_count, phys_dev_groups.data())); ASSERT_EQ(grp_count, returned_group_count); @@ -3327,9 +4886,8 @@ TEST(LayerPhysDeviceMod, RemovePhysicalDeviceGroups) { TEST(LayerPhysDeviceMod, ReorderPhysicalDeviceGroups) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_reorder_phys_dev") + .set_name("VK_LAYER_LunarG_reorder_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_REORDER_PHYS_DEV")), @@ -3339,9 +4897,8 @@ TEST(LayerPhysDeviceMod, ReorderPhysicalDeviceGroups) { layer.set_reorder_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3371,10 +4928,9 @@ TEST(LayerPhysDeviceMod, ReorderPhysicalDeviceGroups) { ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &grp_count, nullptr)); ASSERT_EQ(grp_count, icd_groups); - auto phys_dev_groups = std::vector(grp_count); - for (uint32_t group = 0; group < grp_count; ++group) { - phys_dev_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; - } + auto phys_dev_groups = + std::vector(grp_count, {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES}); + uint32_t returned_group_count = grp_count; ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &returned_group_count, phys_dev_groups.data())); ASSERT_EQ(grp_count, returned_group_count); @@ -3382,9 +4938,8 @@ TEST(LayerPhysDeviceMod, ReorderPhysicalDeviceGroups) { TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDeviceGroups) { FrameworkEnvironment env; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} - .set_name("VkLayer_LunarG_all_phys_dev") + .set_name("VK_LAYER_LunarG_all_phys_dev") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_api_version(VK_API_VERSION_1_1) .set_disable_environment("TEST_DISABLE_ALL_PHYS_DEV")), @@ -3394,9 +4949,8 @@ TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDeviceGroups) { layer.set_add_phys_devs(true).set_remove_phys_devs(true).set_reorder_phys_devs(true); for (uint32_t icd = 0; icd < 2; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& cur_icd = env.get_test_icd(icd); - cur_icd.icd_api_version = VK_API_VERSION_1_2; + auto& cur_icd = + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_2)).set_icd_api_version(VK_API_VERSION_1_2); VkPhysicalDeviceProperties properties{}; properties.apiVersion = VK_API_VERSION_1_2; properties.vendorID = 0x11000000 + (icd << 6); @@ -3413,8 +4967,8 @@ TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDeviceGroups) { cur_icd.physical_devices.back().set_properties(properties); } cur_icd.physical_device_groups.emplace_back(cur_icd.physical_devices[0]); - cur_icd.physical_device_groups.emplace_back(cur_icd.physical_devices[1]); - cur_icd.physical_device_groups.back().use_physical_device(cur_icd.physical_devices[2]); + cur_icd.physical_device_groups.back().use_physical_device(cur_icd.physical_devices[1]); + cur_icd.physical_device_groups.emplace_back(cur_icd.physical_devices[2]); } const uint32_t icd_groups = 4; @@ -3426,10 +4980,9 @@ TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDeviceGroups) { ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &grp_count, nullptr)); ASSERT_GT(grp_count, icd_groups); - auto phys_dev_groups = std::vector(grp_count); - for (uint32_t group = 0; group < grp_count; ++group) { - phys_dev_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; - } + auto phys_dev_groups = + std::vector(grp_count, {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES}); + uint32_t returned_group_count = grp_count; ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &returned_group_count, phys_dev_groups.data())); ASSERT_EQ(grp_count, returned_group_count); @@ -3455,3 +5008,487 @@ TEST(LayerPhysDeviceMod, AddRemoveAndReorderPhysicalDeviceGroups) { ASSERT_EQ(2U, diff_count); ASSERT_EQ(found_added_count, 3U); } + +TEST(TestLayers, AllowFilterWithExplicitLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* layer_name = "VK_LAYER_test_layer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer_all.json"); + + EnvVarWrapper allow{"VK_LOADER_LAYERS_ALLOW", layer_name}; + { + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + EnvVarWrapper enable{"VK_LOADER_LAYERS_ENABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(false))); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } +} + +TEST(TestLayers, AllowFilterWithImplicitLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* layer_name = "VK_LAYER_test_layer"; + const char* disable_env_var = "TEST_DISABLE_ENV_VAR"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment(disable_env_var)), + "test_layer_all.json"); + + EnvVarWrapper allow{"VK_LOADER_LAYERS_ALLOW", layer_name}; + + { + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + EnvVarWrapper enable{"VK_LOADER_LAYERS_ENABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true))); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + + env.remove_loader_settings(); + + // Set the disable_environment variable + EnvVarWrapper set_disable_env_var{disable_env_var, "1"}; + + { + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + EnvVarWrapper enable{"VK_LOADER_LAYERS_ENABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + // layer's disable_environment takes priority + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true))); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } +} + +TEST(TestLayers, AllowFilterWithConditionallyImlicitLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* layer_name = "VK_LAYER_test_layer"; + const char* enable_env_var = "TEST_ENABLE_ENV_VAR"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("TEST_DISABLE_ENV_VAR") + .set_enable_environment(enable_env_var)), + "test_layer_all.json"); + + EnvVarWrapper allow{"VK_LOADER_LAYERS_ALLOW", layer_name}; + + { + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + EnvVarWrapper enable{"VK_LOADER_LAYERS_ENABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true))); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + + env.remove_loader_settings(); + + // Repeate the above tests but with the enable_environment variable set + EnvVarWrapper set_enable_env_var{enable_env_var, "1"}; + + { + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + EnvVarWrapper enable{"VK_LOADER_LAYERS_ENABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true))); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } +} + +TEST(TestLayers, AllowFilterWithConditionallyImlicitLayerWithOverrideLayer) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* layer_name = "VK_LAYER_test_layer"; + const char* enable_env_var = "TEST_ENABLE_ENV_VAR"; + env.add_implicit_layer(TestLayerDetails{ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name) + .set_api_version(VK_API_VERSION_1_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("TEST_DISABLE_ENV_VAR") + .set_enable_environment(enable_env_var)), + "test_layer_all.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(lunarg_meta_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)) + .add_component_layer(layer_name) + .set_disable_environment("DisableMeIfYouCan") + .add_override_path(fs::make_native(env.get_folder(ManifestLocation::override_layer).location().str()))), + "meta_test_layer.json"); + + EnvVarWrapper allow{"VK_LOADER_LAYERS_ALLOW", layer_name}; + + { + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, lunarg_meta_layer_name)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, lunarg_meta_layer_name)); + } + { + EnvVarWrapper disable{"VK_LOADER_LAYERS_DISABLE", layer_name}; + EnvVarWrapper enable{"VK_LOADER_LAYERS_ENABLE", layer_name}; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, lunarg_meta_layer_name)); + } + { + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, lunarg_meta_layer_name)); + } + { + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true))); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } +} diff --git a/tests/loader_phys_dev_inst_ext_tests.cpp b/tests/loader_phys_dev_inst_ext_tests.cpp index 14f4b57435f476d33a80b2bf9aafa642e33c7fa9..36be527ef64caa10f0d0678459820010c23ccdd6 100644 --- a/tests/loader_phys_dev_inst_ext_tests.cpp +++ b/tests/loader_phys_dev_inst_ext_tests.cpp @@ -35,13 +35,13 @@ // validation. // Fill in random but valid data into the device properties struct for the current physical device -static void FillInRandomICDInfo(uint32_t& vendor_id, uint32_t& driver_vers) { +void FillInRandomICDInfo(uint32_t& vendor_id, uint32_t& driver_vers) { vendor_id = VK_MAKE_API_VERSION(0, rand() % 64, rand() % 255, rand() % 255); driver_vers = VK_MAKE_API_VERSION(0, rand() % 64, rand() % 255, rand() % 255); } // Fill in random but valid data into the device properties struct for the current physical device -static void FillInRandomDeviceProps(VkPhysicalDeviceProperties& props, uint32_t api_vers, uint32_t vendor, uint32_t driver_vers) { +void FillInRandomDeviceProps(VkPhysicalDeviceProperties& props, uint32_t api_vers, uint32_t vendor, uint32_t driver_vers) { props.apiVersion = api_vers; props.driverVersion = driver_vers; props.vendorID = vendor; @@ -65,8 +65,7 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2KHR")); + PFN_vkGetPhysicalDeviceProperties2KHR GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2KHR"); ASSERT_EQ(GetPhysDevProps2, nullptr); } @@ -80,8 +79,7 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2KHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2KHR")); + PFN_vkGetPhysicalDeviceProperties2KHR GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2KHR"); ASSERT_EQ(GetPhysDevProps2, nullptr); } @@ -97,8 +95,7 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2KHR")); + PFN_vkGetPhysicalDeviceProperties2KHR GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2KHR"); ASSERT_NE(GetPhysDevProps2, nullptr); uint32_t driver_count = 1; @@ -122,40 +119,106 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2KHRInstanceAndICDSupport) { // Test vkGetPhysicalDeviceProperties2 where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevProps2Simple) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_1)); env.get_test_icd(0).icd_api_version = VK_API_VERSION_1_1; env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 0}); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_API_VERSION_1_1, 5, 123); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2"); + ASSERT_NE(GetPhysDevProps2, nullptr); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2")); - ASSERT_NE(GetPhysDevProps2, nullptr); + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); + VkPhysicalDeviceProperties props{}; + instance->vkGetPhysicalDeviceProperties(physical_device, &props); + VkPhysicalDeviceProperties2KHR props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR}; + GetPhysDevProps2(physical_device, &props2); - VkPhysicalDeviceProperties props{}; - instance->vkGetPhysicalDeviceProperties(physical_device, &props); - VkPhysicalDeviceProperties2KHR props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR}; - GetPhysDevProps2(physical_device, &props2); + // Both properties should match + ASSERT_EQ(props.apiVersion, props2.properties.apiVersion); + ASSERT_EQ(props.driverVersion, props2.properties.driverVersion); + ASSERT_EQ(props.vendorID, props2.properties.vendorID); + ASSERT_EQ(props.deviceID, props2.properties.deviceID); + ASSERT_EQ(props.deviceType, props2.properties.deviceType); + ASSERT_EQ(0, memcmp(props.pipelineCacheUUID, props2.properties.pipelineCacheUUID, VK_UUID_SIZE)); + } - // Both properties should match - ASSERT_EQ(props.apiVersion, props2.properties.apiVersion); - ASSERT_EQ(props.driverVersion, props2.properties.driverVersion); - ASSERT_EQ(props.vendorID, props2.properties.vendorID); - ASSERT_EQ(props.deviceID, props2.properties.deviceID); - ASSERT_EQ(props.deviceType, props2.properties.deviceType); - ASSERT_EQ(0, memcmp(props.pipelineCacheUUID, props2.properties.pipelineCacheUUID, VK_UUID_SIZE)); + { // Do the same logic but have the application forget to use 1.1 and doesn't enable the extension - should emulate the call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2"); + ASSERT_NE(GetPhysDevProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceProperties props{}; + instance->vkGetPhysicalDeviceProperties(physical_device, &props); + VkPhysicalDeviceProperties2KHR props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR}; + GetPhysDevProps2(physical_device, &props2); + + // Both properties should match + ASSERT_EQ(props.apiVersion, props2.properties.apiVersion); + ASSERT_EQ(props.driverVersion, props2.properties.driverVersion); + ASSERT_EQ(props.vendorID, props2.properties.vendorID); + ASSERT_EQ(props.deviceID, props2.properties.deviceID); + ASSERT_EQ(props.deviceType, props2.properties.deviceType); + ASSERT_EQ(0, memcmp(props.pipelineCacheUUID, props2.properties.pipelineCacheUUID, VK_UUID_SIZE)); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2"); + ASSERT_NE(GetPhysDevProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceProperties props{}; + instance->vkGetPhysicalDeviceProperties(physical_device, &props); + VkPhysicalDeviceProperties2KHR props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR}; + GetPhysDevProps2(physical_device, &props2); + + // Both properties should match + ASSERT_EQ(props.apiVersion, props2.properties.apiVersion); + ASSERT_EQ(props.driverVersion, props2.properties.driverVersion); + ASSERT_EQ(props.vendorID, props2.properties.vendorID); + ASSERT_EQ(props.deviceID, props2.properties.deviceID); + ASSERT_EQ(props.deviceType, props2.properties.deviceType); + ASSERT_EQ(0, memcmp(props.pipelineCacheUUID, props2.properties.pipelineCacheUUID, VK_UUID_SIZE)); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceProperties2 and vkGetPhysicalDeviceProperties2KHR where ICD is 1.0 and supports @@ -176,12 +239,10 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2KHRInstanceSupports11) { DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2")); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2"); ASSERT_NE(GetPhysDevProps2, nullptr); - auto GetPhysDevProps2KHR = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2KHR")); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2KHR = instance.load("vkGetPhysicalDeviceProperties2KHR"); ASSERT_NE(GetPhysDevProps2KHR, nullptr); uint32_t driver_count = 1; @@ -236,15 +297,13 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2Mixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -269,8 +328,7 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2Mixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2")); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2"); ASSERT_NE(GetPhysDevProps2, nullptr); uint32_t device_count = max_phys_devs; @@ -295,7 +353,7 @@ TEST(LoaderInstPhysDevExts, PhysDevProps2Mixed) { } // Fill in random but valid data into the features struct for the current physical device -static void FillInRandomFeatures(VkPhysicalDeviceFeatures& feats) { +void FillInRandomFeatures(VkPhysicalDeviceFeatures& feats) { feats.robustBufferAccess = (rand() % 2) == 0 ? VK_FALSE : VK_TRUE; feats.fullDrawIndexUint32 = (rand() % 2) == 0 ? VK_FALSE : VK_TRUE; feats.imageCubeArray = (rand() % 2) == 0 ? VK_FALSE : VK_TRUE; @@ -354,7 +412,7 @@ static void FillInRandomFeatures(VkPhysicalDeviceFeatures& feats) { } // Compare the contents of the feature structs -static bool CompareFeatures(const VkPhysicalDeviceFeatures& feats1, const VkPhysicalDeviceFeatures2& feats2) { +bool CompareFeatures(const VkPhysicalDeviceFeatures& feats1, const VkPhysicalDeviceFeatures2& feats2) { return feats1.robustBufferAccess == feats2.features.robustBufferAccess && feats1.fullDrawIndexUint32 == feats2.features.fullDrawIndexUint32 && feats1.imageCubeArray == feats2.features.imageCubeArray && feats1.independentBlend == feats2.features.independentBlend && @@ -413,9 +471,8 @@ TEST(LoaderInstPhysDevExts, PhysDevFeats2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysDevFeats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2KHR")); - ASSERT_EQ(GetPhysDevFeats2, nullptr); + PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysDevFeats2KHR = instance.load("vkGetPhysicalDeviceFeatures2KHR"); + ASSERT_EQ(GetPhysDevFeats2KHR, nullptr); } // Test vkGetPhysicalDeviceFeatures2KHR where instance supports it, but nothing else. @@ -428,9 +485,8 @@ TEST(LoaderInstPhysDevExts, PhysDevFeatsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysDevFeats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2KHR")); - ASSERT_EQ(GetPhysDevFeats2, nullptr); + PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysDevFeats2KHR = instance.load("vkGetPhysicalDeviceFeatures2KHR"); + ASSERT_EQ(GetPhysDevFeats2KHR, nullptr); } // Test vkGetPhysicalDeviceFeatures2KHR where instance and ICD supports it, but device does not support it. @@ -445,9 +501,8 @@ TEST(LoaderInstPhysDevExts, PhysDevFeats2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysDevFeats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2KHR")); - ASSERT_NE(GetPhysDevFeats2, nullptr); + PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysDevFeats2KHR = instance.load("vkGetPhysicalDeviceFeatures2KHR"); + ASSERT_NE(GetPhysDevFeats2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -457,39 +512,93 @@ TEST(LoaderInstPhysDevExts, PhysDevFeats2KHRInstanceAndICDSupport) { VkPhysicalDeviceFeatures feats{}; instance->vkGetPhysicalDeviceFeatures(physical_device, &feats); VkPhysicalDeviceFeatures2 feats2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR}; - GetPhysDevFeats2(physical_device, &feats2); + GetPhysDevFeats2KHR(physical_device, &feats2); ASSERT_TRUE(CompareFeatures(feats, feats2)); } // Test vkGetPhysicalDeviceFeatures2 where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevFeats2Simple) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_1)); env.get_test_icd(0).icd_api_version = VK_API_VERSION_1_1; env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 0}); + env.get_test_icd(0).physical_devices.back().set_api_version(VK_API_VERSION_1_1); FillInRandomFeatures(env.get_test_icd(0).physical_devices.back().features); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); + PFN_vkGetPhysicalDeviceFeatures2 GetPhysDevFeats2 = instance.load("vkGetPhysicalDeviceFeatures2"); + ASSERT_NE(GetPhysDevFeats2, nullptr); - auto GetPhysDevFeats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2")); - ASSERT_NE(GetPhysDevFeats2, nullptr); + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); + VkPhysicalDeviceFeatures feats{}; + instance->vkGetPhysicalDeviceFeatures(physical_device, &feats); + VkPhysicalDeviceFeatures2 feats2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; + GetPhysDevFeats2(physical_device, &feats2); + ASSERT_TRUE(CompareFeatures(feats, feats2)); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); - VkPhysicalDeviceFeatures feats{}; - instance->vkGetPhysicalDeviceFeatures(physical_device, &feats); - VkPhysicalDeviceFeatures2 feats2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; - GetPhysDevFeats2(physical_device, &feats2); - ASSERT_TRUE(CompareFeatures(feats, feats2)); + PFN_vkGetPhysicalDeviceFeatures2 GetPhysDevFeats2 = instance.load("vkGetPhysicalDeviceFeatures2"); + ASSERT_NE(GetPhysDevFeats2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceFeatures feats{}; + instance->vkGetPhysicalDeviceFeatures(physical_device, &feats); + VkPhysicalDeviceFeatures2 feats2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; + GetPhysDevFeats2(physical_device, &feats2); + ASSERT_TRUE(CompareFeatures(feats, feats2)); + + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceFeatures2 GetPhysDevFeats2 = instance.load("vkGetPhysicalDeviceFeatures2"); + ASSERT_NE(GetPhysDevFeats2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceFeatures feats{}; + instance->vkGetPhysicalDeviceFeatures(physical_device, &feats); + VkPhysicalDeviceFeatures2 feats2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; + GetPhysDevFeats2(physical_device, &feats2); + ASSERT_TRUE(CompareFeatures(feats, feats2)); + + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceFeatures2 and vkGetPhysicalDeviceFeatures2KHR where ICD is 1.0 and supports @@ -510,12 +619,10 @@ TEST(LoaderInstPhysDevExts, PhysDevFeats2KHRInstanceSupports11) { DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevFeats2KHR = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2KHR")); + PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysDevFeats2KHR = instance.load("vkGetPhysicalDeviceFeatures2KHR"); ASSERT_NE(GetPhysDevFeats2KHR, nullptr); - auto GetPhysDevFeats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2")); + PFN_vkGetPhysicalDeviceFeatures2 GetPhysDevFeats2 = instance.load("vkGetPhysicalDeviceFeatures2"); ASSERT_NE(GetPhysDevFeats2, nullptr); uint32_t driver_count = 1; @@ -557,15 +664,13 @@ TEST(LoaderInstPhysDevExts, PhysDevFeatsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -593,8 +698,7 @@ TEST(LoaderInstPhysDevExts, PhysDevFeatsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevFeats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2")); + PFN_vkGetPhysicalDeviceFeatures2 GetPhysDevFeats2 = instance.load("vkGetPhysicalDeviceFeatures2"); ASSERT_NE(GetPhysDevFeats2, nullptr); uint32_t device_count = max_phys_devs; @@ -612,7 +716,7 @@ TEST(LoaderInstPhysDevExts, PhysDevFeatsMixed) { } // Fill in random but valid data into the format properties struct for the current physical device -static void FillInRandomFormatProperties(std::vector& props) { +void FillInRandomFormatProperties(std::vector& props) { props.resize(5); for (uint8_t form = 0; form < 5; ++form) { props[form].bufferFeatures = static_cast(rand()); @@ -630,9 +734,9 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysDevFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2KHR")); - ASSERT_EQ(GetPhysDevFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysDevFormatProps2KHR = + instance.load("vkGetPhysicalDeviceFormatProperties2KHR"); + ASSERT_EQ(GetPhysDevFormatProps2KHR, nullptr); } // Test vkGetPhysicalDeviceFormatProperties2KHR where instance supports it, but nothing else. @@ -645,9 +749,9 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysDevFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2KHR")); - ASSERT_EQ(GetPhysDevFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysDevFormatProps2KHR = + instance.load("vkGetPhysicalDeviceFormatProperties2KHR"); + ASSERT_EQ(GetPhysDevFormatProps2KHR, nullptr); } // Test vkGetPhysicalDeviceFormatProperties2KHR where instance and ICD supports it, but device does not support it. @@ -665,9 +769,9 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatProps2KHRInstanceAndICDSupport) { DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2KHR")); - ASSERT_NE(GetPhysDevFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysDevFormatProps2KHR = + instance.load("vkGetPhysicalDeviceFormatProperties2KHR"); + ASSERT_NE(GetPhysDevFormatProps2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -677,7 +781,7 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatProps2KHRInstanceAndICDSupport) { VkFormatProperties props{}; instance->vkGetPhysicalDeviceFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props); VkFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; - GetPhysDevFormatProps2(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props2); + GetPhysDevFormatProps2KHR(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props2); ASSERT_EQ(props.bufferFeatures, props2.formatProperties.bufferFeatures); ASSERT_EQ(props.linearTilingFeatures, props2.formatProperties.linearTilingFeatures); @@ -686,38 +790,95 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatProps2KHRInstanceAndICDSupport) { // Test vkGetPhysicalDeviceFormatProperties2 where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevFormatProps2Simple) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_1)); env.get_test_icd(0).icd_api_version = VK_API_VERSION_1_1; env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 0}); + env.get_test_icd(0).physical_devices.back().set_api_version(VK_API_VERSION_1_1); FillInRandomFormatProperties(env.get_test_icd(0).physical_devices.back().format_properties); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysDevFormatProps2 = instance.load("vkGetPhysicalDeviceFormatProperties2"); + ASSERT_NE(GetPhysDevFormatProps2, nullptr); - auto GetPhysDevFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2")); - ASSERT_NE(GetPhysDevFormatProps2, nullptr); + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); + VkFormatProperties props{}; + instance->vkGetPhysicalDeviceFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props); + VkFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; + GetPhysDevFormatProps2(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props2); - VkFormatProperties props{}; - instance->vkGetPhysicalDeviceFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props); - VkFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; - GetPhysDevFormatProps2(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props2); + ASSERT_EQ(props.bufferFeatures, props2.formatProperties.bufferFeatures); + ASSERT_EQ(props.linearTilingFeatures, props2.formatProperties.linearTilingFeatures); + ASSERT_EQ(props.optimalTilingFeatures, props2.formatProperties.optimalTilingFeatures); + } + { // Do the same logic but have the application forget to enable 1.1 and doesn't enable the extension + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); - ASSERT_EQ(props.bufferFeatures, props2.formatProperties.bufferFeatures); - ASSERT_EQ(props.linearTilingFeatures, props2.formatProperties.linearTilingFeatures); - ASSERT_EQ(props.optimalTilingFeatures, props2.formatProperties.optimalTilingFeatures); -} + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysDevFormatProps2 = instance.load("vkGetPhysicalDeviceFormatProperties2"); + ASSERT_NE(GetPhysDevFormatProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkFormatProperties props{}; + instance->vkGetPhysicalDeviceFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props); + VkFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; + GetPhysDevFormatProps2(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props2); + + ASSERT_EQ(props.bufferFeatures, props2.formatProperties.bufferFeatures); + ASSERT_EQ(props.linearTilingFeatures, props2.formatProperties.linearTilingFeatures); + ASSERT_EQ(props.optimalTilingFeatures, props2.formatProperties.optimalTilingFeatures); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysDevFormatProps2 = instance.load("vkGetPhysicalDeviceFormatProperties2"); + ASSERT_NE(GetPhysDevFormatProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkFormatProperties props{}; + instance->vkGetPhysicalDeviceFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props); + VkFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; + GetPhysDevFormatProps2(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, &props2); + ASSERT_EQ(props.bufferFeatures, props2.formatProperties.bufferFeatures); + ASSERT_EQ(props.linearTilingFeatures, props2.formatProperties.linearTilingFeatures); + ASSERT_EQ(props.optimalTilingFeatures, props2.formatProperties.optimalTilingFeatures); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } +} // Test vkGetPhysicalDeviceFormatProperties2 and vkGetPhysicalDeviceFormatProperties2KHR where ICD is 1.0 and supports // extension but the instance supports 1.1 and the extension TEST(LoaderInstPhysDevExts, PhysDevFormatProps2KHRInstanceSupports11) { @@ -736,12 +897,11 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatProps2KHRInstanceSupports11) { DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2")); + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysDevFormatProps2 = instance.load("vkGetPhysicalDeviceFormatProperties2"); ASSERT_NE(GetPhysDevFormatProps2, nullptr); - auto GetPhysDevFormatProps2KHR = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2KHR")); + PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysDevFormatProps2KHR = + instance.load("vkGetPhysicalDeviceFormatProperties2KHR"); ASSERT_NE(GetPhysDevFormatProps2KHR, nullptr); uint32_t driver_count = 1; @@ -788,15 +948,13 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatPropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -824,8 +982,7 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatPropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2")); + PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysDevFormatProps2 = instance.load("vkGetPhysicalDeviceFormatProperties2"); ASSERT_NE(GetPhysDevFormatProps2, nullptr); uint32_t device_count = max_phys_devs; @@ -847,7 +1004,7 @@ TEST(LoaderInstPhysDevExts, PhysDevFormatPropsMixed) { } // Fill in random but valid data into the image format data struct for the current physical device -static void FillInRandomImageFormatData(VkImageFormatProperties& props) { +void FillInRandomImageFormatData(VkImageFormatProperties& props) { props.maxExtent = {static_cast(rand() % 512), static_cast(rand() % 512), static_cast(rand() % 512)}; props.maxMipLevels = static_cast(1 << (rand() % 16)); @@ -865,8 +1022,8 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysDevImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceImageFormatProperties2KHR")); + PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysDevImageFormatProps2 = + instance.load("vkGetPhysicalDeviceImageFormatProperties2KHR"); ASSERT_EQ(GetPhysDevImageFormatProps2, nullptr); } @@ -880,9 +1037,9 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysDevImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceImageFormatProperties2KHR")); - ASSERT_EQ(GetPhysDevImageFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysDevImageFormatProps2KHR = + instance.load("vkGetPhysicalDeviceImageFormatProperties2KHR"); + ASSERT_EQ(GetPhysDevImageFormatProps2KHR, nullptr); } // Test vkGetPhysicalDeviceImageFormatProperties2KHR where instance and ICD supports it, but device does not support it. @@ -897,9 +1054,9 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatProps2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysDevImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceImageFormatProperties2KHR")); - ASSERT_NE(GetPhysDevImageFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysDevImageFormatProps2KHR = + instance.load("vkGetPhysicalDeviceImageFormatProperties2KHR"); + ASSERT_NE(GetPhysDevImageFormatProps2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -921,7 +1078,7 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatProps2KHRInstanceAndICDSupport) { 0, // flags }; VkImageFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; - ASSERT_EQ(VK_SUCCESS, GetPhysDevImageFormatProps2(physical_device, &info2, &props2)); + ASSERT_EQ(VK_SUCCESS, GetPhysDevImageFormatProps2KHR(physical_device, &info2, &props2)); ASSERT_EQ(props.maxExtent.width, props2.imageFormatProperties.maxExtent.width); ASSERT_EQ(props.maxExtent.height, props2.imageFormatProperties.maxExtent.height); @@ -934,6 +1091,7 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatProps2KHRInstanceAndICDSupport) { // Test vkGetPhysicalDeviceImageFormatProperties2 where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevImageFormatProps2Simple) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -942,45 +1100,138 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatProps2Simple) { env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 0}); FillInRandomImageFormatData(env.get_test_icd(0).physical_devices.back().image_format_properties); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); + PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysDevImageFormatProps2 = + instance.load("vkGetPhysicalDeviceImageFormatProperties2"); + ASSERT_NE(GetPhysDevImageFormatProps2, nullptr); - auto GetPhysDevImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceImageFormatProperties2")); - ASSERT_NE(GetPhysDevImageFormatProps2, nullptr); + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); + VkImageFormatProperties props{}; + ASSERT_EQ(VK_SUCCESS, + instance->vkGetPhysicalDeviceImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, 0, 0, &props)); - VkImageFormatProperties props{}; - ASSERT_EQ(VK_SUCCESS, - instance->vkGetPhysicalDeviceImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, - VK_IMAGE_TILING_OPTIMAL, 0, 0, &props)); + VkPhysicalDeviceImageFormatInfo2 info2{ + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, // sType + nullptr, // pNext + VK_FORMAT_R4G4_UNORM_PACK8, // format + VK_IMAGE_TYPE_2D, // type + VK_IMAGE_TILING_OPTIMAL, // tiling + 0, // usage + 0, // flags + }; - VkPhysicalDeviceImageFormatInfo2 info2{ - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, // sType - nullptr, // pNext - VK_FORMAT_R4G4_UNORM_PACK8, // format - VK_IMAGE_TYPE_2D, // type - VK_IMAGE_TILING_OPTIMAL, // tiling - 0, // usage - 0, // flags - }; + VkImageFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; + ASSERT_EQ(VK_SUCCESS, GetPhysDevImageFormatProps2(physical_device, &info2, &props2)); - VkImageFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; - ASSERT_EQ(VK_SUCCESS, GetPhysDevImageFormatProps2(physical_device, &info2, &props2)); + ASSERT_EQ(props.maxExtent.width, props2.imageFormatProperties.maxExtent.width); + ASSERT_EQ(props.maxExtent.height, props2.imageFormatProperties.maxExtent.height); + ASSERT_EQ(props.maxExtent.depth, props2.imageFormatProperties.maxExtent.depth); + ASSERT_EQ(props.maxMipLevels, props2.imageFormatProperties.maxMipLevels); + ASSERT_EQ(props.maxArrayLayers, props2.imageFormatProperties.maxArrayLayers); + ASSERT_EQ(props.sampleCounts, props2.imageFormatProperties.sampleCounts); + ASSERT_EQ(props.maxResourceSize, props2.imageFormatProperties.maxResourceSize); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysDevImageFormatProps2 = + instance.load("vkGetPhysicalDeviceImageFormatProperties2"); + ASSERT_NE(GetPhysDevImageFormatProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - ASSERT_EQ(props.maxExtent.width, props2.imageFormatProperties.maxExtent.width); - ASSERT_EQ(props.maxExtent.height, props2.imageFormatProperties.maxExtent.height); - ASSERT_EQ(props.maxExtent.depth, props2.imageFormatProperties.maxExtent.depth); - ASSERT_EQ(props.maxMipLevels, props2.imageFormatProperties.maxMipLevels); - ASSERT_EQ(props.maxArrayLayers, props2.imageFormatProperties.maxArrayLayers); - ASSERT_EQ(props.sampleCounts, props2.imageFormatProperties.sampleCounts); - ASSERT_EQ(props.maxResourceSize, props2.imageFormatProperties.maxResourceSize); + VkImageFormatProperties props{}; + ASSERT_EQ(VK_SUCCESS, + instance->vkGetPhysicalDeviceImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, 0, 0, &props)); + + VkPhysicalDeviceImageFormatInfo2 info2{ + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, // sType + nullptr, // pNext + VK_FORMAT_R4G4_UNORM_PACK8, // format + VK_IMAGE_TYPE_2D, // type + VK_IMAGE_TILING_OPTIMAL, // tiling + 0, // usage + 0, // flags + }; + + VkImageFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; + ASSERT_EQ(VK_SUCCESS, GetPhysDevImageFormatProps2(physical_device, &info2, &props2)); + + ASSERT_EQ(props.maxExtent.width, props2.imageFormatProperties.maxExtent.width); + ASSERT_EQ(props.maxExtent.height, props2.imageFormatProperties.maxExtent.height); + ASSERT_EQ(props.maxExtent.depth, props2.imageFormatProperties.maxExtent.depth); + ASSERT_EQ(props.maxMipLevels, props2.imageFormatProperties.maxMipLevels); + ASSERT_EQ(props.maxArrayLayers, props2.imageFormatProperties.maxArrayLayers); + ASSERT_EQ(props.sampleCounts, props2.imageFormatProperties.sampleCounts); + ASSERT_EQ(props.maxResourceSize, props2.imageFormatProperties.maxResourceSize); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysDevImageFormatProps2 = + instance.load("vkGetPhysicalDeviceImageFormatProperties2"); + ASSERT_NE(GetPhysDevImageFormatProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkImageFormatProperties props{}; + ASSERT_EQ(VK_SUCCESS, + instance->vkGetPhysicalDeviceImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, 0, 0, &props)); + + VkPhysicalDeviceImageFormatInfo2 info2{ + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, // sType + nullptr, // pNext + VK_FORMAT_R4G4_UNORM_PACK8, // format + VK_IMAGE_TYPE_2D, // type + VK_IMAGE_TILING_OPTIMAL, // tiling + 0, // usage + 0, // flags + }; + + VkImageFormatProperties2 props2{VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; + ASSERT_EQ(VK_SUCCESS, GetPhysDevImageFormatProps2(physical_device, &info2, &props2)); + + ASSERT_EQ(props.maxExtent.width, props2.imageFormatProperties.maxExtent.width); + ASSERT_EQ(props.maxExtent.height, props2.imageFormatProperties.maxExtent.height); + ASSERT_EQ(props.maxExtent.depth, props2.imageFormatProperties.maxExtent.depth); + ASSERT_EQ(props.maxMipLevels, props2.imageFormatProperties.maxMipLevels); + ASSERT_EQ(props.maxArrayLayers, props2.imageFormatProperties.maxArrayLayers); + ASSERT_EQ(props.sampleCounts, props2.imageFormatProperties.sampleCounts); + ASSERT_EQ(props.maxResourceSize, props2.imageFormatProperties.maxResourceSize); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceImageFormatProperties2 and vkGetPhysicalDeviceImageFormatProperties2KHR where instance supports, an ICD, @@ -1001,12 +1252,12 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatProps2KHRInstanceSupports11) { DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceImageFormatProperties2")); + PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysDevImageFormatProps2 = + instance.load("vkGetPhysicalDeviceImageFormatProperties2"); ASSERT_NE(GetPhysDevImageFormatProps2, nullptr); - auto GetPhysDevImageFormatProps2KHR = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceImageFormatProperties2KHR")); + PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysDevImageFormatProps2KHR = + instance.load("vkGetPhysicalDeviceImageFormatProperties2KHR"); ASSERT_NE(GetPhysDevImageFormatProps2KHR, nullptr); uint32_t driver_count = 1; @@ -1074,15 +1325,13 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatPropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -1110,8 +1359,8 @@ TEST(LoaderInstPhysDevExts, PhysDevImageFormatPropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceImageFormatProperties2")); + PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysDevImageFormatProps2 = + instance.load("vkGetPhysicalDeviceImageFormatProperties2"); ASSERT_NE(GetPhysDevImageFormatProps2, nullptr); uint32_t device_count = max_phys_devs; @@ -1156,9 +1405,9 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysDevMemoryProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMemoryProperties2KHR")); - ASSERT_EQ(GetPhysDevMemoryProps2, nullptr); + PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysDevMemoryProps2KHR = + instance.load("vkGetPhysicalDeviceMemoryProperties2KHR"); + ASSERT_EQ(GetPhysDevMemoryProps2KHR, nullptr); } // Test vkGetPhysicalDeviceMemoryProperties2KHR where instance supports it, but nothing else. @@ -1171,13 +1420,13 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysDevMemoryProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMemoryProperties2KHR")); - ASSERT_EQ(GetPhysDevMemoryProps2, nullptr); + PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysDevMemoryProps2KHR = + instance.load("vkGetPhysicalDeviceMemoryProperties2KHR"); + ASSERT_EQ(GetPhysDevMemoryProps2KHR, nullptr); } // Fill in random but valid data into the memory data struct for the current physical device -static void FillInRandomMemoryData(VkPhysicalDeviceMemoryProperties& props) { +void FillInRandomMemoryData(VkPhysicalDeviceMemoryProperties& props) { props.memoryTypeCount = (rand() % 7) + 1; props.memoryHeapCount = (rand() % 7) + 1; for (uint32_t i = 0; i < props.memoryHeapCount; ++i) { @@ -1191,7 +1440,7 @@ static void FillInRandomMemoryData(VkPhysicalDeviceMemoryProperties& props) { } // Compare the memory structs -static bool CompareMemoryData(const VkPhysicalDeviceMemoryProperties& props1, const VkPhysicalDeviceMemoryProperties2& props2) { +bool CompareMemoryData(const VkPhysicalDeviceMemoryProperties& props1, const VkPhysicalDeviceMemoryProperties2& props2) { bool equal = true; equal = equal && props1.memoryTypeCount == props2.memoryProperties.memoryTypeCount; equal = equal && props1.memoryHeapCount == props2.memoryProperties.memoryHeapCount; @@ -1218,9 +1467,9 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryProps2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysDevMemoryProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMemoryProperties2KHR")); - ASSERT_NE(GetPhysDevMemoryProps2, nullptr); + PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysDevMemoryProps2KHR = + instance.load("vkGetPhysicalDeviceMemoryProperties2KHR"); + ASSERT_NE(GetPhysDevMemoryProps2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -1231,12 +1480,13 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryProps2KHRInstanceAndICDSupport) { instance->vkGetPhysicalDeviceMemoryProperties(physical_device, &props); VkPhysicalDeviceMemoryProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2}; - GetPhysDevMemoryProps2(physical_device, &props2); + GetPhysDevMemoryProps2KHR(physical_device, &props2); ASSERT_TRUE(CompareMemoryData(props, props2)); } // Test vkGetPhysicalDeviceMemoryProperties2 where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevMemoryProps2Simple) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -1245,26 +1495,78 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryProps2Simple) { env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 0}); FillInRandomMemoryData(env.get_test_icd(0).physical_devices.back().memory_properties); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); + PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysDevMemoryProps2 = instance.load("vkGetPhysicalDeviceMemoryProperties2"); + ASSERT_NE(GetPhysDevMemoryProps2, nullptr); - auto GetPhysDevMemoryProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMemoryProperties2")); - ASSERT_NE(GetPhysDevMemoryProps2, nullptr); + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); + VkPhysicalDeviceMemoryProperties props{}; + instance->vkGetPhysicalDeviceMemoryProperties(physical_device, &props); - VkPhysicalDeviceMemoryProperties props{}; - instance->vkGetPhysicalDeviceMemoryProperties(physical_device, &props); + VkPhysicalDeviceMemoryProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2}; + GetPhysDevMemoryProps2(physical_device, &props2); + ASSERT_TRUE(CompareMemoryData(props, props2)); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); - VkPhysicalDeviceMemoryProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2}; - GetPhysDevMemoryProps2(physical_device, &props2); - ASSERT_TRUE(CompareMemoryData(props, props2)); + PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysDevMemoryProps2 = instance.load("vkGetPhysicalDeviceMemoryProperties2"); + ASSERT_NE(GetPhysDevMemoryProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceMemoryProperties props{}; + instance->vkGetPhysicalDeviceMemoryProperties(physical_device, &props); + + VkPhysicalDeviceMemoryProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2}; + GetPhysDevMemoryProps2(physical_device, &props2); + ASSERT_TRUE(CompareMemoryData(props, props2)); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysDevMemoryProps2 = instance.load("vkGetPhysicalDeviceMemoryProperties2"); + ASSERT_NE(GetPhysDevMemoryProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceMemoryProperties props{}; + instance->vkGetPhysicalDeviceMemoryProperties(physical_device, &props); + + VkPhysicalDeviceMemoryProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2}; + GetPhysDevMemoryProps2(physical_device, &props2); + ASSERT_TRUE(CompareMemoryData(props, props2)); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceMemoryProperties2 and vkGetPhysicalDeviceMemoryProperties2KHR where ICD is 1.0 and supports @@ -1285,12 +1587,11 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryProps2KHRInstanceSupports11) { DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevMemoryProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMemoryProperties2")); + PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysDevMemoryProps2 = instance.load("vkGetPhysicalDeviceMemoryProperties2"); ASSERT_NE(GetPhysDevMemoryProps2, nullptr); - auto GetPhysDevMemoryProps2KHR = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMemoryProperties2KHR")); + PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysDevMemoryProps2KHR = + instance.load("vkGetPhysicalDeviceMemoryProperties2KHR"); ASSERT_NE(GetPhysDevMemoryProps2KHR, nullptr); uint32_t driver_count = 1; @@ -1331,15 +1632,13 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryPropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -1367,8 +1666,7 @@ TEST(LoaderInstPhysDevExts, PhysDevMemoryPropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevMemoryProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMemoryProperties2")); + PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysDevMemoryProps2 = instance.load("vkGetPhysicalDeviceMemoryProperties2"); ASSERT_NE(GetPhysDevMemoryProps2, nullptr); uint32_t device_count = max_phys_devs; @@ -1395,9 +1693,9 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysDevQueueFamilyProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR")); - ASSERT_EQ(GetPhysDevQueueFamilyProps2, nullptr); + PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysDevQueueFamilyProps2KHR = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2KHR"); + ASSERT_EQ(GetPhysDevQueueFamilyProps2KHR, nullptr); } // Test vkGetPhysicalDeviceQueueFamilyProperties2KHR where instance supports it, but nothing else. @@ -1410,13 +1708,13 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysDevQueueFamilyProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR")); - ASSERT_EQ(GetPhysDevQueueFamilyProps2, nullptr); + PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysDevQueueFamilyProps2KHR = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2KHR"); + ASSERT_EQ(GetPhysDevQueueFamilyProps2KHR, nullptr); } // Fill in random but valid data into the queue family data struct for the current physical device -static uint32_t FillInRandomQueueFamilyData(std::vector& props) { +uint32_t FillInRandomQueueFamilyData(std::vector& props) { props.resize((rand() % 4) + 1); for (uint32_t i = 0; i < props.size(); ++i) { props[i].properties.queueFlags = (rand() % 30) + 1; @@ -1431,8 +1729,8 @@ static uint32_t FillInRandomQueueFamilyData(std::vector& props1, - const std::vector& props2) { +bool CompareQueueFamilyData(const std::vector& props1, + const std::vector& props2) { if (props1.size() != props2.size()) return false; bool equal = true; for (uint32_t i = 0; i < props1.size(); ++i) { @@ -1461,9 +1759,9 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyProps2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysDevQueueFamilyProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR")); - ASSERT_NE(GetPhysDevQueueFamilyProps2, nullptr); + PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysDevQueueFamilyProps2KHR = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2KHR"); + ASSERT_NE(GetPhysDevQueueFamilyProps2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -1480,15 +1778,16 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyProps2KHRInstanceAndICDSupport) { std::vector props2{}; uint32_t ret_fam_2 = 0; - GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, nullptr); + GetPhysDevQueueFamilyProps2KHR(physical_device, &ret_fam_2, nullptr); ASSERT_EQ(ret_fam_1, ret_fam_2); props2.resize(ret_fam_2, VkQueueFamilyProperties2{VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2}); - GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, props2.data()); + GetPhysDevQueueFamilyProps2KHR(physical_device, &ret_fam_2, props2.data()); ASSERT_TRUE(CompareQueueFamilyData(props, props2)); } // Test vkGetPhysicalDeviceQueueFamilyProperties2 where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyProps2Simple) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -1497,35 +1796,108 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyProps2Simple) { env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 0}); uint32_t num_fam = FillInRandomQueueFamilyData(env.get_test_icd(0).physical_devices.back().queue_family_properties); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysDevQueueFamilyProps2 = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2"); + ASSERT_NE(GetPhysDevQueueFamilyProps2, nullptr); - auto GetPhysDevQueueFamilyProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2")); - ASSERT_NE(GetPhysDevQueueFamilyProps2, nullptr); + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); + uint32_t ret_fam_1 = 0; + std::vector props{}; + instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, nullptr); + ASSERT_EQ(num_fam, ret_fam_1); + props.resize(ret_fam_1); - uint32_t ret_fam_1 = 0; - std::vector props{}; - instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, nullptr); - ASSERT_EQ(num_fam, ret_fam_1); - props.resize(ret_fam_1); + instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, props.data()); - instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, props.data()); + std::vector props2{}; + uint32_t ret_fam_2 = 0; + GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, nullptr); + ASSERT_EQ(ret_fam_1, ret_fam_2); + props2.resize(ret_fam_2, VkQueueFamilyProperties2{VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2}); + GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, props2.data()); + ASSERT_TRUE(CompareQueueFamilyData(props, props2)); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysDevQueueFamilyProps2 = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2"); + ASSERT_NE(GetPhysDevQueueFamilyProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - std::vector props2{}; - uint32_t ret_fam_2 = 0; - GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, nullptr); - ASSERT_EQ(ret_fam_1, ret_fam_2); - props2.resize(ret_fam_2, VkQueueFamilyProperties2{VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2}); - GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, props2.data()); - ASSERT_TRUE(CompareQueueFamilyData(props, props2)); + uint32_t ret_fam_1 = 0; + std::vector props{}; + instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, nullptr); + ASSERT_EQ(num_fam, ret_fam_1); + props.resize(ret_fam_1); + + instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, props.data()); + + std::vector props2{}; + uint32_t ret_fam_2 = 0; + GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, nullptr); + ASSERT_EQ(ret_fam_1, ret_fam_2); + props2.resize(ret_fam_2, VkQueueFamilyProperties2{VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2}); + GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, props2.data()); + ASSERT_TRUE(CompareQueueFamilyData(props, props2)); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysDevQueueFamilyProps2 = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2"); + ASSERT_NE(GetPhysDevQueueFamilyProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + uint32_t ret_fam_1 = 0; + std::vector props{}; + instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, nullptr); + ASSERT_EQ(num_fam, ret_fam_1); + props.resize(ret_fam_1); + + instance->vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &ret_fam_1, props.data()); + + std::vector props2{}; + uint32_t ret_fam_2 = 0; + GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, nullptr); + ASSERT_EQ(ret_fam_1, ret_fam_2); + props2.resize(ret_fam_2, VkQueueFamilyProperties2{VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2}); + GetPhysDevQueueFamilyProps2(physical_device, &ret_fam_2, props2.data()); + ASSERT_TRUE(CompareQueueFamilyData(props, props2)); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceQueueFamilyProperties2 and vkGetPhysicalDeviceQueueFamilyProperties2KHR where ICD is 1.0 and supports @@ -1546,12 +1918,12 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyProps2KHRInstanceSupports11) { DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevQueueFamilyProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2")); + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysDevQueueFamilyProps2 = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2"); ASSERT_NE(GetPhysDevQueueFamilyProps2, nullptr); - auto GetPhysDevQueueFamilyProps2KHR = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2KHR")); + PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysDevQueueFamilyProps2KHR = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2KHR"); ASSERT_NE(GetPhysDevQueueFamilyProps2KHR, nullptr); uint32_t driver_count = 1; @@ -1606,15 +1978,13 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyPropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -1642,8 +2012,8 @@ TEST(LoaderInstPhysDevExts, PhysDevQueueFamilyPropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevQueueFamilyProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceQueueFamilyProperties2")); + PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysDevQueueFamilyProps2 = + instance.load("vkGetPhysicalDeviceQueueFamilyProperties2"); ASSERT_NE(GetPhysDevQueueFamilyProps2, nullptr); uint32_t device_count = max_phys_devs; @@ -1677,9 +2047,9 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysDevSparseImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR")); - ASSERT_EQ(GetPhysDevSparseImageFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysDevSparseImageFormatProps2KHR = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); + ASSERT_EQ(GetPhysDevSparseImageFormatProps2KHR, nullptr); } // Test vkGetPhysicalDeviceSparseImageFormatProperties2KHR where instance supports it, but nothing else. @@ -1692,13 +2062,13 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysDevSparseImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR")); - ASSERT_EQ(GetPhysDevSparseImageFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysDevSparseImageFormatProps2KHR = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); + ASSERT_EQ(GetPhysDevSparseImageFormatProps2KHR, nullptr); } // Fill in random but valid data into the sparse image format data struct for the current physical device -static void FillInRandomSparseImageFormatData(std::vector& props) { +void FillInRandomSparseImageFormatData(std::vector& props) { props.resize((rand() % 4) + 1); for (uint32_t i = 0; i < props.size(); ++i) { props[i].aspectMask = static_cast((rand() % 0x7FE) + 1); @@ -1709,8 +2079,8 @@ static void FillInRandomSparseImageFormatData(std::vector& props1, - const std::vector& props2) { +bool CompareSparseImageFormatData(const std::vector& props1, + const std::vector& props2) { if (props1.size() != props2.size()) return false; bool equal = true; for (uint32_t i = 0; i < props1.size(); ++i) { @@ -1735,9 +2105,9 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatProps2KHRInstanceAndICDSuppo instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysDevSparseImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR")); - ASSERT_NE(GetPhysDevSparseImageFormatProps2, nullptr); + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysDevSparseImageFormatProps2KHR = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); + ASSERT_NE(GetPhysDevSparseImageFormatProps2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -1767,16 +2137,17 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatProps2KHRInstanceAndICDSuppo }; std::vector props2{}; uint32_t sparse_count_2 = 0; - GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, nullptr); + GetPhysDevSparseImageFormatProps2KHR(physical_device, &info2, &sparse_count_2, nullptr); ASSERT_EQ(sparse_count_1, sparse_count_2); props2.resize(sparse_count_2, VkSparseImageFormatProperties2{VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2}); - GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, props2.data()); + GetPhysDevSparseImageFormatProps2KHR(physical_device, &info2, &sparse_count_2, props2.data()); ASSERT_EQ(sparse_count_1, sparse_count_2); ASSERT_TRUE(CompareSparseImageFormatData(props, props2)); } // Test vkGetPhysicalDeviceSparseImageFormatProperties2 where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatProps2Simple) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -1785,49 +2156,150 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatProps2Simple) { env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 0}); FillInRandomSparseImageFormatData(env.get_test_icd(0).physical_devices.back().sparse_image_format_properties); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 GetPhysDevSparseImageFormatProps2 = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2"); + ASSERT_NE(GetPhysDevSparseImageFormatProps2, nullptr); - auto GetPhysDevSparseImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2")); - ASSERT_NE(GetPhysDevSparseImageFormatProps2, nullptr); + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); + std::vector props{}; + uint32_t sparse_count_1 = 0; + instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, + VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, nullptr); + ASSERT_NE(sparse_count_1, 0U); + props.resize(sparse_count_1); + instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, + VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, props.data()); + ASSERT_NE(sparse_count_1, 0U); - std::vector props{}; - uint32_t sparse_count_1 = 0; - instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, - VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, - VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, nullptr); - ASSERT_NE(sparse_count_1, 0U); - props.resize(sparse_count_1); - instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, - VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, - VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, props.data()); - ASSERT_NE(sparse_count_1, 0U); + VkPhysicalDeviceSparseImageFormatInfo2 info2{ + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2, // sType + nullptr, // pNext + VK_FORMAT_R4G4_UNORM_PACK8, // format + VK_IMAGE_TYPE_2D, // type + VK_SAMPLE_COUNT_4_BIT, // samples + VK_IMAGE_USAGE_STORAGE_BIT, // usage + VK_IMAGE_TILING_OPTIMAL, // tiling + }; + std::vector props2{}; + uint32_t sparse_count_2 = 0; + GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, nullptr); + ASSERT_EQ(sparse_count_1, sparse_count_2); + props2.resize(sparse_count_2, VkSparseImageFormatProperties2{VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2}); + GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, props2.data()); + ASSERT_EQ(sparse_count_1, sparse_count_2); + ASSERT_TRUE(CompareSparseImageFormatData(props, props2)); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 GetPhysDevSparseImageFormatProps2 = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2"); + ASSERT_NE(GetPhysDevSparseImageFormatProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); - VkPhysicalDeviceSparseImageFormatInfo2 info2{ - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2, // sType - nullptr, // pNext - VK_FORMAT_R4G4_UNORM_PACK8, // format - VK_IMAGE_TYPE_2D, // type - VK_SAMPLE_COUNT_4_BIT, // samples - VK_IMAGE_USAGE_STORAGE_BIT, // usage - VK_IMAGE_TILING_OPTIMAL, // tiling - }; - std::vector props2{}; - uint32_t sparse_count_2 = 0; - GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, nullptr); - ASSERT_EQ(sparse_count_1, sparse_count_2); - props2.resize(sparse_count_2, VkSparseImageFormatProperties2{VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2}); - GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, props2.data()); - ASSERT_EQ(sparse_count_1, sparse_count_2); - ASSERT_TRUE(CompareSparseImageFormatData(props, props2)); + std::vector props{}; + uint32_t sparse_count_1 = 0; + instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, + VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, nullptr); + ASSERT_NE(sparse_count_1, 0U); + props.resize(sparse_count_1); + instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, + VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, props.data()); + ASSERT_NE(sparse_count_1, 0U); + + VkPhysicalDeviceSparseImageFormatInfo2 info2{ + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2, // sType + nullptr, // pNext + VK_FORMAT_R4G4_UNORM_PACK8, // format + VK_IMAGE_TYPE_2D, // type + VK_SAMPLE_COUNT_4_BIT, // samples + VK_IMAGE_USAGE_STORAGE_BIT, // usage + VK_IMAGE_TILING_OPTIMAL, // tiling + }; + std::vector props2{}; + uint32_t sparse_count_2 = 0; + GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, nullptr); + ASSERT_EQ(sparse_count_1, sparse_count_2); + props2.resize(sparse_count_2, VkSparseImageFormatProperties2{VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2}); + GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, props2.data()); + ASSERT_EQ(sparse_count_1, sparse_count_2); + ASSERT_TRUE(CompareSparseImageFormatData(props, props2)); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 GetPhysDevSparseImageFormatProps2 = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2"); + ASSERT_NE(GetPhysDevSparseImageFormatProps2, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + std::vector props{}; + uint32_t sparse_count_1 = 0; + instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, + VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, nullptr); + ASSERT_NE(sparse_count_1, 0U); + props.resize(sparse_count_1); + instance->vkGetPhysicalDeviceSparseImageFormatProperties(physical_device, VK_FORMAT_R4G4_UNORM_PACK8, VK_IMAGE_TYPE_2D, + VK_SAMPLE_COUNT_4_BIT, VK_IMAGE_USAGE_STORAGE_BIT, + VK_IMAGE_TILING_OPTIMAL, &sparse_count_1, props.data()); + ASSERT_NE(sparse_count_1, 0U); + + VkPhysicalDeviceSparseImageFormatInfo2 info2{ + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2, // sType + nullptr, // pNext + VK_FORMAT_R4G4_UNORM_PACK8, // format + VK_IMAGE_TYPE_2D, // type + VK_SAMPLE_COUNT_4_BIT, // samples + VK_IMAGE_USAGE_STORAGE_BIT, // usage + VK_IMAGE_TILING_OPTIMAL, // tiling + }; + std::vector props2{}; + uint32_t sparse_count_2 = 0; + GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, nullptr); + ASSERT_EQ(sparse_count_1, sparse_count_2); + props2.resize(sparse_count_2, VkSparseImageFormatProperties2{VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2}); + GetPhysDevSparseImageFormatProps2(physical_device, &info2, &sparse_count_2, props2.data()); + ASSERT_EQ(sparse_count_1, sparse_count_2); + ASSERT_TRUE(CompareSparseImageFormatData(props, props2)); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceSparseImageFormatProperties2 and vkGetPhysicalDeviceSparseImageFormatProperties2KHR where ICD is 1.0 and @@ -1848,12 +2320,12 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatProps2KHRInstanceSupports11) DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; CreateDebugUtilsMessenger(log); - auto GetPhysDevSparseImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2")); + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 GetPhysDevSparseImageFormatProps2 = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2"); ASSERT_NE(GetPhysDevSparseImageFormatProps2, nullptr); - auto GetPhysDevSparseImageFormatProps2KHR = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR")); + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysDevSparseImageFormatProps2KHR = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); ASSERT_NE(GetPhysDevSparseImageFormatProps2KHR, nullptr); uint32_t driver_count = 1; @@ -1923,15 +2395,13 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatPropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -1959,8 +2429,8 @@ TEST(LoaderInstPhysDevExts, PhysDevSparseImageFormatPropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevSparseImageFormatProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties2")); + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 GetPhysDevSparseImageFormatProps2 = + instance.load("vkGetPhysicalDeviceSparseImageFormatProperties2"); ASSERT_NE(GetPhysDevSparseImageFormatProps2, nullptr); uint32_t device_count = max_phys_devs; @@ -2014,9 +2484,9 @@ TEST(LoaderInstPhysDevExts, PhysDevExtBufPropsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceExternalBufferProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalBufferPropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceExternalBufferProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR GetPhysicalDeviceExternalBufferPropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalBufferPropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceExternalBufferPropertiesKHR, nullptr); } // Test vkGetPhysicalDeviceExternalBufferPropertiesKHR where instance supports it, but nothing else. @@ -2029,21 +2499,21 @@ TEST(LoaderInstPhysDevExts, PhysDevExtBufPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceExternalBufferProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalBufferPropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceExternalBufferProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR GetPhysicalDeviceExternalBufferPropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalBufferPropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceExternalBufferPropertiesKHR, nullptr); } // Fill in random but valid data into the external memorydata struct for the current physical device -static void FillInRandomExtMemoryData(VkExternalMemoryProperties& props) { +void FillInRandomExtMemoryData(VkExternalMemoryProperties& props) { props.externalMemoryFeatures = static_cast((rand() % 6) + 1); props.exportFromImportedHandleTypes = static_cast((rand() % 0x1FFE) + 1); props.compatibleHandleTypes = static_cast((rand() % 0x1FFE) + 1); } // Compare the external memory data structs -static bool CompareExtMemoryData(const VkExternalMemoryProperties& props1, const VkExternalMemoryProperties& props2, - bool supported = true) { +bool CompareExtMemoryData(const VkExternalMemoryProperties& props1, const VkExternalMemoryProperties& props2, + bool supported = true) { bool equal = true; if (supported) { equal = equal && props1.externalMemoryFeatures == props2.externalMemoryFeatures; @@ -2069,9 +2539,9 @@ TEST(LoaderInstPhysDevExts, PhysDevExtBufProps2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysicalDeviceExternalBufferProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalBufferPropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceExternalBufferProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR GetPhysicalDeviceExternalBufferPropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalBufferPropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceExternalBufferPropertiesKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -2080,13 +2550,14 @@ TEST(LoaderInstPhysDevExts, PhysDevExtBufProps2KHRInstanceAndICDSupport) { VkPhysicalDeviceExternalBufferInfoKHR info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR}; VkExternalBufferPropertiesKHR props{VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR}; - GetPhysicalDeviceExternalBufferProperties(physical_device, &info, &props); + GetPhysicalDeviceExternalBufferPropertiesKHR(physical_device, &info, &props); ASSERT_TRUE(CompareExtMemoryData(env.get_test_icd(0).physical_devices.back().external_memory_properties, props.externalMemoryProperties)); } // Test vkGetPhysicalDeviceExternalBufferProperties where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevExtBufProps2Simple) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -2095,25 +2566,78 @@ TEST(LoaderInstPhysDevExts, PhysDevExtBufProps2Simple) { env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, 0}); FillInRandomExtMemoryData(env.get_test_icd(0).physical_devices.back().external_memory_properties); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); - - auto GetPhysicalDeviceExternalBufferProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalBufferProperties")); - ASSERT_NE(GetPhysicalDeviceExternalBufferProperties, nullptr); - - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); - - VkPhysicalDeviceExternalBufferInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO}; - VkExternalBufferProperties props{VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES}; - GetPhysicalDeviceExternalBufferProperties(physical_device, &info, &props); - ASSERT_TRUE(CompareExtMemoryData(env.get_test_icd(0).physical_devices.back().external_memory_properties, - props.externalMemoryProperties)); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); + + PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties = + instance.load("vkGetPhysicalDeviceExternalBufferProperties"); + ASSERT_NE(GetPhysicalDeviceExternalBufferProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalBufferInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO}; + VkExternalBufferProperties props{VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES}; + GetPhysicalDeviceExternalBufferProperties(physical_device, &info, &props); + ASSERT_TRUE(CompareExtMemoryData(env.get_test_icd(0).physical_devices.back().external_memory_properties, + props.externalMemoryProperties)); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties = + instance.load("vkGetPhysicalDeviceExternalBufferProperties"); + ASSERT_NE(GetPhysicalDeviceExternalBufferProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalBufferInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO}; + VkExternalBufferProperties props{VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES}; + GetPhysicalDeviceExternalBufferProperties(physical_device, &info, &props); + // Compare against 'zeroed' out VkExternalMemoryProperties + ASSERT_TRUE(CompareExtMemoryData(VkExternalMemoryProperties{}, props.externalMemoryProperties)); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties = + instance.load("vkGetPhysicalDeviceExternalBufferProperties"); + ASSERT_NE(GetPhysicalDeviceExternalBufferProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalBufferInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO}; + VkExternalBufferProperties props{VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES}; + GetPhysicalDeviceExternalBufferProperties(physical_device, &info, &props); + ASSERT_TRUE(CompareExtMemoryData(env.get_test_icd(0).physical_devices.back().external_memory_properties, + props.externalMemoryProperties)); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceExternalBufferProperties where instance supports it with some ICDs that both support @@ -2136,15 +2660,13 @@ TEST(LoaderInstPhysDevExts, PhysDevExtBufPropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -2172,8 +2694,8 @@ TEST(LoaderInstPhysDevExts, PhysDevExtBufPropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysicalDeviceExternalBufferProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalBufferProperties")); + PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties = + instance.load("vkGetPhysicalDeviceExternalBufferProperties"); ASSERT_NE(GetPhysicalDeviceExternalBufferProperties, nullptr); uint32_t device_count = max_phys_devs; @@ -2225,9 +2747,9 @@ TEST(LoaderInstPhysDevExts, PhysDevExtSemPropsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceExternalSemaphoreProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR GetPhysicalDeviceExternalSemaphorePropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceExternalSemaphorePropertiesKHR, nullptr); } // Test vkGetPhysicalDeviceExternalSemaphorePropertiesKHR where instance supports it, but nothing else. @@ -2240,13 +2762,13 @@ TEST(LoaderInstPhysDevExts, PhysDevExtSemPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceExternalSemaphoreProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR GetPhysicalDeviceExternalSemaphorePropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceExternalSemaphorePropertiesKHR, nullptr); } // Fill in random but valid data into the external semaphore data struct for the current physical device -static void FillInRandomExtSemData(VkExternalSemaphoreProperties& props) { +void FillInRandomExtSemData(VkExternalSemaphoreProperties& props) { props.sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES; props.pNext = nullptr; props.exportFromImportedHandleTypes = static_cast((rand() % 0xFFF) + 1); @@ -2255,8 +2777,8 @@ static void FillInRandomExtSemData(VkExternalSemaphoreProperties& props) { } // Compare the external semaphore data structs -static bool CompareExtSemaphoreData(const VkExternalSemaphoreProperties& props1, const VkExternalSemaphoreProperties& props2, - bool supported = true) { +bool CompareExtSemaphoreData(const VkExternalSemaphoreProperties& props1, const VkExternalSemaphoreProperties& props2, + bool supported = true) { bool equal = true; if (supported) { equal = equal && props1.externalSemaphoreFeatures == props2.externalSemaphoreFeatures; @@ -2282,9 +2804,9 @@ TEST(LoaderInstPhysDevExts, PhysDevExtSemProps2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysicalDeviceExternalSemaphoreProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR GetPhysicalDeviceExternalSemaphorePropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceExternalSemaphorePropertiesKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -2293,12 +2815,13 @@ TEST(LoaderInstPhysDevExts, PhysDevExtSemProps2KHRInstanceAndICDSupport) { VkPhysicalDeviceExternalSemaphoreInfoKHR info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR}; VkExternalSemaphorePropertiesKHR props{VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR}; - GetPhysicalDeviceExternalSemaphoreProperties(physical_device, &info, &props); + GetPhysicalDeviceExternalSemaphorePropertiesKHR(physical_device, &info, &props); ASSERT_TRUE(CompareExtSemaphoreData(env.get_test_icd(0).physical_devices.back().external_semaphore_properties, props)); } // Test vkGetPhysicalDeviceExternalSemaphoreProperties where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevExtSemProps2Simple) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -2307,24 +2830,74 @@ TEST(LoaderInstPhysDevExts, PhysDevExtSemProps2Simple) { env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, 0}); FillInRandomExtSemData(env.get_test_icd(0).physical_devices.back().external_semaphore_properties); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); - - auto GetPhysicalDeviceExternalSemaphoreProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalSemaphoreProperties")); - ASSERT_NE(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); - - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); - - VkPhysicalDeviceExternalSemaphoreInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO}; - VkExternalSemaphoreProperties props{VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES}; - GetPhysicalDeviceExternalSemaphoreProperties(physical_device, &info, &props); - ASSERT_TRUE(CompareExtSemaphoreData(env.get_test_icd(0).physical_devices.back().external_semaphore_properties, props)); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); + + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties = + instance.load("vkGetPhysicalDeviceExternalSemaphoreProperties"); + ASSERT_NE(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalSemaphoreInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO}; + VkExternalSemaphoreProperties props{VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES}; + GetPhysicalDeviceExternalSemaphoreProperties(physical_device, &info, &props); + ASSERT_TRUE(CompareExtSemaphoreData(env.get_test_icd(0).physical_devices.back().external_semaphore_properties, props)); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties = + instance.load("vkGetPhysicalDeviceExternalSemaphoreProperties"); + ASSERT_NE(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalSemaphoreInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO}; + VkExternalSemaphoreProperties props{VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES}; + GetPhysicalDeviceExternalSemaphoreProperties(physical_device, &info, &props); + // Compare against 'zeroed' out VkExternalSemaphoreProperties + ASSERT_TRUE(CompareExtSemaphoreData(VkExternalSemaphoreProperties{}, props)); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties = + instance.load("vkGetPhysicalDeviceExternalSemaphoreProperties"); + ASSERT_NE(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalSemaphoreInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO}; + VkExternalSemaphoreProperties props{VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES}; + GetPhysicalDeviceExternalSemaphoreProperties(physical_device, &info, &props); + ASSERT_TRUE(CompareExtSemaphoreData(env.get_test_icd(0).physical_devices.back().external_semaphore_properties, props)); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } // Test vkGetPhysicalDeviceExternalSemaphoreProperties where instance supports it with some ICDs that both support @@ -2347,15 +2920,13 @@ TEST(LoaderInstPhysDevExts, PhysDevExtSemPropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -2383,8 +2954,8 @@ TEST(LoaderInstPhysDevExts, PhysDevExtSemPropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysicalDeviceExternalSemaphoreProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalSemaphoreProperties")); + PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties = + instance.load("vkGetPhysicalDeviceExternalSemaphoreProperties"); ASSERT_NE(GetPhysicalDeviceExternalSemaphoreProperties, nullptr); uint32_t device_count = max_phys_devs; @@ -2436,9 +3007,9 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFencePropsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceExternalFenceProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalFencePropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceExternalFenceProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR GetPhysicalDeviceExternalFencePropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalFencePropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceExternalFencePropertiesKHR, nullptr); } // Test vkGetPhysicalDeviceExternalFencePropertiesKHR where instance supports it, but nothing else. @@ -2451,13 +3022,13 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFencePropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceExternalFenceProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalFencePropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceExternalFenceProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR GetPhysicalDeviceExternalFencePropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalFencePropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceExternalFencePropertiesKHR, nullptr); } // Fill in random but valid data into the external fence data struct for the current physical device -static void FillInRandomExtFenceData(VkExternalFenceProperties& props) { +void FillInRandomExtFenceData(VkExternalFenceProperties& props) { props.sType = VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES; props.pNext = nullptr; props.exportFromImportedHandleTypes = static_cast((rand() % 0xFFF) + 1); @@ -2466,8 +3037,7 @@ static void FillInRandomExtFenceData(VkExternalFenceProperties& props) { } // Compare the external fence data structs -static bool CompareExtFenceData(const VkExternalFenceProperties& props1, const VkExternalFenceProperties& props2, - bool supported = true) { +bool CompareExtFenceData(const VkExternalFenceProperties& props1, const VkExternalFenceProperties& props2, bool supported = true) { bool equal = true; if (supported) { equal = equal && props1.externalFenceFeatures == props2.externalFenceFeatures; @@ -2493,9 +3063,9 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFenceProps2KHRInstanceAndICDSupport) { instance.create_info.add_extension(VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysicalDeviceExternalFenceProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalFencePropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceExternalFenceProperties, nullptr); + PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR GetPhysicalDeviceExternalFencePropertiesKHR = + instance.load("vkGetPhysicalDeviceExternalFencePropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceExternalFencePropertiesKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -2504,12 +3074,13 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFenceProps2KHRInstanceAndICDSupport) { VkPhysicalDeviceExternalFenceInfoKHR info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR}; VkExternalFencePropertiesKHR props{VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR}; - GetPhysicalDeviceExternalFenceProperties(physical_device, &info, &props); + GetPhysicalDeviceExternalFencePropertiesKHR(physical_device, &info, &props); ASSERT_TRUE(CompareExtFenceData(env.get_test_icd(0).physical_devices.back().external_fence_properties, props)); } // Test vkGetPhysicalDeviceExternalFenceProperties where instance supports, an ICD, and a device under that ICD // also support, so everything should work and return properly. +// Also check if the application didn't enable 1.1 and when a layer 'upgrades' the api version to 1.1 TEST(LoaderInstPhysDevExts, PhysDevExtFenceProps2Simple) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -2518,26 +3089,76 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFenceProps2Simple) { env.get_test_icd(0).physical_devices.push_back({}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME, 0}); FillInRandomExtFenceData(env.get_test_icd(0).physical_devices.back().external_fence_properties); - - InstWrapper instance(env.vulkan_functions); - instance.create_info.set_api_version(VK_API_VERSION_1_1); - instance.CheckCreate(); - - auto GetPhysicalDeviceExternalFenceProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalFenceProperties")); - ASSERT_NE(GetPhysicalDeviceExternalFenceProperties, nullptr); - - uint32_t driver_count = 1; - VkPhysicalDevice physical_device; - ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); - ASSERT_EQ(driver_count, 1U); - - VkPhysicalDeviceExternalFenceInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO}; - VkExternalFenceProperties props{VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES}; - GetPhysicalDeviceExternalFenceProperties(physical_device, &info, &props); - ASSERT_TRUE(CompareExtFenceData(env.get_test_icd(0).physical_devices.back().external_fence_properties, props)); + { + InstWrapper instance(env.vulkan_functions); + instance.create_info.set_api_version(VK_API_VERSION_1_1); + instance.CheckCreate(); + + PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties = + instance.load("vkGetPhysicalDeviceExternalFenceProperties"); + ASSERT_NE(GetPhysicalDeviceExternalFenceProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalFenceInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO}; + VkExternalFenceProperties props{VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES}; + GetPhysicalDeviceExternalFenceProperties(physical_device, &info, &props); + ASSERT_TRUE(CompareExtFenceData(env.get_test_icd(0).physical_devices.back().external_fence_properties, props)); + } + { // Now do the same logic but the application didn't enable 1.0 or the extension so they get the emulated call + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties = + instance.load("vkGetPhysicalDeviceExternalFenceProperties"); + ASSERT_NE(GetPhysicalDeviceExternalFenceProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalFenceInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO}; + VkExternalFenceProperties props{VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES}; + GetPhysicalDeviceExternalFenceProperties(physical_device, &info, &props); + // Compare against 'zeroed' out VkExternalFenceProperties + ASSERT_TRUE(CompareExtFenceData(VkExternalFenceProperties{}, props)); + ASSERT_TRUE(log.find("Emulating call in ICD")); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("modify_api_version_layer") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DisableEnvVar")), + "modify_api_version_layer.json"); + env.get_test_layer().set_alter_api_version(VK_API_VERSION_1_1); + { // Now do the same as above but with a layer that updates the version to 1.1 on behalf of the application + InstWrapper instance(env.vulkan_functions); + instance.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + instance.CheckCreate(); + DebugUtilsWrapper log{instance, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; + CreateDebugUtilsMessenger(log); + PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties = + instance.load("vkGetPhysicalDeviceExternalFenceProperties"); + ASSERT_NE(GetPhysicalDeviceExternalFenceProperties, nullptr); + + uint32_t driver_count = 1; + VkPhysicalDevice physical_device; + ASSERT_EQ(VK_SUCCESS, instance->vkEnumeratePhysicalDevices(instance, &driver_count, &physical_device)); + ASSERT_EQ(driver_count, 1U); + + VkPhysicalDeviceExternalFenceInfo info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO}; + VkExternalFenceProperties props{VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES}; + GetPhysicalDeviceExternalFenceProperties(physical_device, &info, &props); + ASSERT_TRUE(CompareExtFenceData(env.get_test_icd(0).physical_devices.back().external_fence_properties, props)); + ASSERT_FALSE(log.find("Emulating call in ICD")); + } } - // Test vkGetPhysicalDeviceExternalFenceProperties where instance supports it with some ICDs that both support // and don't support it: // ICD 0 supports @@ -2558,15 +3179,13 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFencePropsMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); // ICD 1 should not have 1.1 if (icd != 1) { cur_icd.icd_api_version = VK_API_VERSION_1_1; cur_icd.add_instance_extension({VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME}); - } else { - cur_icd.icd_api_version = VK_API_VERSION_1_0; } uint32_t rand_vendor_id; @@ -2594,8 +3213,8 @@ TEST(LoaderInstPhysDevExts, PhysDevExtFencePropsMixed) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysicalDeviceExternalFenceProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalFenceProperties")); + PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties = + instance.load("vkGetPhysicalDeviceExternalFenceProperties"); ASSERT_NE(GetPhysicalDeviceExternalFenceProperties, nullptr); uint32_t device_count = max_phys_devs; @@ -2647,9 +3266,9 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceCaps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceSurfaceCapabilities2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilities2KHR")); - ASSERT_EQ(GetPhysicalDeviceSurfaceCapabilities2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR GetPhysicalDeviceSurfaceCapabilities2KHR = + instance.load("vkGetPhysicalDeviceSurfaceCapabilities2KHR"); + ASSERT_EQ(GetPhysicalDeviceSurfaceCapabilities2KHR, nullptr); } // Test vkGetPhysicalDeviceSurfaceCapabilities2KHR where instance supports it, but nothing else. @@ -2662,13 +3281,13 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceCaps2KHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceSurfaceCapabilities2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilities2KHR")); - ASSERT_EQ(GetPhysicalDeviceSurfaceCapabilities2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR GetPhysicalDeviceSurfaceCapabilities2KHR = + instance.load("vkGetPhysicalDeviceSurfaceCapabilities2KHR"); + ASSERT_EQ(GetPhysicalDeviceSurfaceCapabilities2KHR, nullptr); } // Fill in random but valid data into the surface capability data struct for the current physical device -static void FillInRandomSurfaceCapsData(VkSurfaceCapabilitiesKHR& props) { +void FillInRandomSurfaceCapsData(VkSurfaceCapabilitiesKHR& props) { props.minImageCount = (rand() % 0xFFF) + 1; props.maxImageCount = (rand() % 0xFFF) + 1; props.currentExtent.width = (rand() % 0xFFF) + 1; @@ -2685,8 +3304,7 @@ static void FillInRandomSurfaceCapsData(VkSurfaceCapabilitiesKHR& props) { } // Compare the surface capability data structs -static bool CompareSurfaceCapsData(const VkSurfaceCapabilitiesKHR& props1, const VkSurfaceCapabilitiesKHR& props2, - bool supported = true) { +bool CompareSurfaceCapsData(const VkSurfaceCapabilitiesKHR& props1, const VkSurfaceCapabilitiesKHR& props2, bool supported = true) { bool equal = true; if (supported) { equal = equal && props1.minImageCount == props2.minImageCount; @@ -2739,18 +3357,16 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceCaps2KHRInstanceAndICDSupport) { {VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceSurfaceCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceCapabilities, nullptr); - auto CreateHeadlessSurfaceEXT = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkCreateHeadlessSurfaceEXT")); + PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR = + instance.load("vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceCapabilitiesKHR, nullptr); + PFN_vkCreateHeadlessSurfaceEXT CreateHeadlessSurfaceEXT = instance.load("vkCreateHeadlessSurfaceEXT"); ASSERT_NE(CreateHeadlessSurfaceEXT, nullptr); - auto DestroySurfaceKHR = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkDestroySurfaceKHR")); + PFN_vkDestroySurfaceKHR DestroySurfaceKHR = instance.load("vkDestroySurfaceKHR"); ASSERT_NE(DestroySurfaceKHR, nullptr); - auto GetPhysicalDeviceSurfaceCapabilities2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilities2KHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceCapabilities2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR GetPhysicalDeviceSurfaceCapabilities2KHR = + instance.load("vkGetPhysicalDeviceSurfaceCapabilities2KHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceCapabilities2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -2762,11 +3378,11 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceCaps2KHRInstanceAndICDSupport) { ASSERT_EQ(VK_SUCCESS, CreateHeadlessSurfaceEXT(instance.inst, &create_info, nullptr, &surface)); VkSurfaceCapabilitiesKHR props{}; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilities(physical_device, surface, &props)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, surface, &props)); VkPhysicalDeviceSurfaceInfo2KHR info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, nullptr, surface}; VkSurfaceCapabilities2KHR props2{VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR}; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilities2(physical_device, &info, &props2)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilities2KHR(physical_device, &info, &props2)); ASSERT_TRUE(CompareSurfaceCapsData(props, props2.surfaceCapabilities)); DestroySurfaceKHR(instance.inst, surface, nullptr); @@ -2795,7 +3411,7 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceCaps2KHRMixed) { Extension third_ext{VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME}; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.min_icd_interface_version = 3; @@ -2836,18 +3452,16 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceCaps2KHRMixed) { {VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceSurfaceCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceCapabilities, nullptr); - auto CreateHeadlessSurfaceEXT = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkCreateHeadlessSurfaceEXT")); + PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR = + instance.load("vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceCapabilitiesKHR, nullptr); + PFN_vkCreateHeadlessSurfaceEXT CreateHeadlessSurfaceEXT = instance.load("vkCreateHeadlessSurfaceEXT"); ASSERT_NE(CreateHeadlessSurfaceEXT, nullptr); - auto DestroySurfaceKHR = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkDestroySurfaceKHR")); + PFN_vkDestroySurfaceKHR DestroySurfaceKHR = instance.load("vkDestroySurfaceKHR"); ASSERT_NE(DestroySurfaceKHR, nullptr); - auto GetPhysicalDeviceSurfaceCapabilities2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilities2KHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceCapabilities2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR GetPhysicalDeviceSurfaceCapabilities2KHR = + instance.load("vkGetPhysicalDeviceSurfaceCapabilities2KHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceCapabilities2KHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -2860,11 +3474,11 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceCaps2KHRMixed) { for (uint32_t dev = 0; dev < device_count; ++dev) { VkSurfaceCapabilitiesKHR props{}; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilities(physical_devices[dev], surface, &props)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices[dev], surface, &props)); VkPhysicalDeviceSurfaceInfo2KHR info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, nullptr, surface}; VkSurfaceCapabilities2KHR props2{VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR}; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilities2(physical_devices[dev], &info, &props2)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceCapabilities2KHR(physical_devices[dev], &info, &props2)); ASSERT_TRUE(CompareSurfaceCapsData(props, props2.surfaceCapabilities)); } @@ -2880,9 +3494,9 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceFormats2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceSurfaceFormats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormats2KHR")); - ASSERT_EQ(GetPhysicalDeviceSurfaceFormats2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceFormats2KHR GetPhysicalDeviceSurfaceFormats2KHR = + instance.load("vkGetPhysicalDeviceSurfaceFormats2KHR"); + ASSERT_EQ(GetPhysicalDeviceSurfaceFormats2KHR, nullptr); } // Test vkGetPhysicalDeviceSurfaceFormats2KHR where instance supports it, but nothing else. @@ -2895,13 +3509,13 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceFormats2KHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceSurfaceFormats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormats2KHR")); - ASSERT_EQ(GetPhysicalDeviceSurfaceFormats2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceFormats2KHR GetPhysicalDeviceSurfaceFormats2KHR = + instance.load("vkGetPhysicalDeviceSurfaceFormats2KHR"); + ASSERT_EQ(GetPhysicalDeviceSurfaceFormats2KHR, nullptr); } // Fill in random but valid data into the surface formats data struct for the current physical device -static void FillInRandomSurfaceFormatsData(std::vector& props) { +void FillInRandomSurfaceFormatsData(std::vector& props) { props.resize((rand() % 5) + 1); for (uint32_t i = 0; i < props.size(); ++i) { props[i].format = static_cast((rand() % 0xFFF) + 1); @@ -2910,8 +3524,8 @@ static void FillInRandomSurfaceFormatsData(std::vector& prop } // Compare the surface formats data structs -static bool CompareSurfaceFormatsData(const std::vector& props1, const std::vector& props2, - bool supported = true) { +bool CompareSurfaceFormatsData(const std::vector& props1, const std::vector& props2, + bool supported = true) { if (props1.size() != props2.size()) return false; bool equal = true; for (uint32_t i = 0; i < props1.size(); ++i) { @@ -2945,18 +3559,16 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceFormats2KHRInstanceAndICDSupport) { {VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceSurfaceFormats = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceFormats, nullptr); - auto CreateHeadlessSurfaceEXT = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkCreateHeadlessSurfaceEXT")); + PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR = + instance.load("vkGetPhysicalDeviceSurfaceFormatsKHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceFormatsKHR, nullptr); + PFN_vkCreateHeadlessSurfaceEXT CreateHeadlessSurfaceEXT = instance.load("vkCreateHeadlessSurfaceEXT"); ASSERT_NE(CreateHeadlessSurfaceEXT, nullptr); - auto DestroySurfaceKHR = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkDestroySurfaceKHR")); + PFN_vkDestroySurfaceKHR DestroySurfaceKHR = instance.load("vkDestroySurfaceKHR"); ASSERT_NE(DestroySurfaceKHR, nullptr); - auto GetPhysicalDeviceSurfaceFormats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormats2KHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceFormats2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceFormats2KHR GetPhysicalDeviceSurfaceFormats2KHR = + instance.load("vkGetPhysicalDeviceSurfaceFormats2KHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceFormats2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -2969,19 +3581,19 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceFormats2KHRInstanceAndICDSupport) { std::vector props{}; uint32_t count_1 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats(physical_device, surface, &count_1, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &count_1, nullptr)); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().surface_formats.size(), count_1); props.resize(count_1); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats(physical_device, surface, &count_1, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &count_1, props.data())); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().surface_formats.size(), count_1); VkPhysicalDeviceSurfaceInfo2KHR info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, nullptr, surface}; std::vector props2{}; uint32_t count_2 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2(physical_device, &info, &count_2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2KHR(physical_device, &info, &count_2, nullptr)); ASSERT_EQ(count_1, count_2); props2.resize(count_2, VkSurfaceFormat2KHR{VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2(physical_device, &info, &count_2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2KHR(physical_device, &info, &count_2, props2.data())); ASSERT_TRUE(CompareSurfaceFormatsData(props, props2)); DestroySurfaceKHR(instance.inst, surface, nullptr); @@ -3010,7 +3622,7 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceFormats2KHRMixed) { Extension third_ext{VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME}; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.enable_icd_wsi = true; @@ -3051,18 +3663,16 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceFormats2KHRMixed) { {VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceSurfaceFormats = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceFormats, nullptr); - auto CreateHeadlessSurfaceEXT = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkCreateHeadlessSurfaceEXT")); + PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR = + instance.load("vkGetPhysicalDeviceSurfaceFormatsKHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceFormatsKHR, nullptr); + PFN_vkCreateHeadlessSurfaceEXT CreateHeadlessSurfaceEXT = instance.load("vkCreateHeadlessSurfaceEXT"); ASSERT_NE(CreateHeadlessSurfaceEXT, nullptr); - auto DestroySurfaceKHR = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkDestroySurfaceKHR")); + PFN_vkDestroySurfaceKHR DestroySurfaceKHR = instance.load("vkDestroySurfaceKHR"); ASSERT_NE(DestroySurfaceKHR, nullptr); - auto GetPhysicalDeviceSurfaceFormats2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormats2KHR")); - ASSERT_NE(GetPhysicalDeviceSurfaceFormats2, nullptr); + PFN_vkGetPhysicalDeviceSurfaceFormats2KHR GetPhysicalDeviceSurfaceFormats2KHR = + instance.load("vkGetPhysicalDeviceSurfaceFormats2KHR"); + ASSERT_NE(GetPhysicalDeviceSurfaceFormats2KHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -3076,19 +3686,19 @@ TEST(LoaderInstPhysDevExts, PhysDevSurfaceFormats2KHRMixed) { for (uint32_t dev = 0; dev < device_count; ++dev) { std::vector props{}; uint32_t count_1 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats(physical_devices[dev], surface, &count_1, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormatsKHR(physical_devices[dev], surface, &count_1, nullptr)); ASSERT_NE(0U, count_1); props.resize(count_1); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats(physical_devices[dev], surface, &count_1, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormatsKHR(physical_devices[dev], surface, &count_1, props.data())); ASSERT_NE(0U, count_1); VkPhysicalDeviceSurfaceInfo2KHR info{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, nullptr, surface}; std::vector props2{}; uint32_t count_2 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2(physical_devices[dev], &info, &count_2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2KHR(physical_devices[dev], &info, &count_2, nullptr)); ASSERT_EQ(count_1, count_2); props2.resize(count_2, VkSurfaceFormat2KHR{VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2(physical_devices[dev], &info, &count_2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceSurfaceFormats2KHR(physical_devices[dev], &info, &count_2, props2.data())); ASSERT_EQ(count_1, count_2); ASSERT_TRUE(CompareSurfaceFormatsData(props, props2)); } @@ -3109,9 +3719,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayPropertiesKHR, nullptr); } // Test vkGetPhysicalDeviceDisplayPropertiesKHR where instance supports it, but nothing else. @@ -3124,9 +3734,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceDisplayProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayPropertiesKHR, nullptr); } VkDisplayKHR CreateRandomDisplay() { return (VkDisplayKHR)(((rand() % 0xFFFFFFFBull) << 12) * (rand() % 0xFFFFFFFull) + 1); } @@ -3136,7 +3746,7 @@ VkDisplayModeKHR CreateRandomDisplayMode() { } // Fill in random but valid data into the display property data struct for the current physical device -static void FillInRandomDisplayPropData(std::vector& props) { +void FillInRandomDisplayPropData(std::vector& props) { props.resize((rand() % 5) + 1); for (uint32_t i = 0; i < props.size(); ++i) { props[i].display = CreateRandomDisplay(); @@ -3151,8 +3761,7 @@ static void FillInRandomDisplayPropData(std::vector& pro } // Compare the display property data structs -static bool CompareDisplayPropData(const std::vector& props1, - const std::vector& props2) { +bool CompareDisplayPropData(const std::vector& props1, const std::vector& props2) { if (props1.size() != props2.size()) return false; bool equal = true; for (uint32_t i = 0; i < props1.size(); ++i) { @@ -3180,9 +3789,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRInstanceAndICDSupport) { instance.create_info.add_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPropertiesKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -3191,10 +3800,10 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRInstanceAndICDSupport) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_device, &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPropertiesKHR(physical_device, &prop_count, nullptr)); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().display_properties.size(), prop_count); props.resize(prop_count); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_device, &prop_count, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPropertiesKHR(physical_device, &prop_count, props.data())); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().display_properties.size(), prop_count); ASSERT_TRUE(CompareDisplayPropData(props, env.get_test_icd(0).physical_devices.back().display_properties)); @@ -3220,7 +3829,7 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; @@ -3255,9 +3864,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRMixed) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPropertiesKHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -3281,7 +3890,7 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRMixed) { cur_dev.properties.vendorID == pd_props.vendorID) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_devices[dev], &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPropertiesKHR(physical_devices[dev], &prop_count, nullptr)); if (icd == 1) { // For this extension, if no support exists (like for ICD 1), the value of 0 should be returned by the // loader. @@ -3289,7 +3898,8 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPropsKHRMixed) { } else { ASSERT_EQ(cur_dev.display_properties.size(), prop_count); props.resize(prop_count); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_devices[dev], &prop_count, props.data())); + ASSERT_EQ(VK_SUCCESS, + GetPhysicalDeviceDisplayPropertiesKHR(physical_devices[dev], &prop_count, props.data())); ASSERT_EQ(cur_dev.display_properties.size(), prop_count); ASSERT_TRUE(CompareDisplayPropData(props, cur_dev.display_properties)); @@ -3314,9 +3924,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayPlaneProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayPlaneProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayPlanePropertiesKHR, nullptr); } // Test vkGetPhysicalDeviceDisplayPlanePropertiesKHR where instance supports it, but nothing else. @@ -3329,13 +3939,13 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceDisplayPlaneProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayPlaneProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayPlanePropertiesKHR, nullptr); } // Fill in random but valid data into the display plane property data struct for the current physical device -static void FillInRandomDisplayPlanePropData(std::vector& props) { +void FillInRandomDisplayPlanePropData(std::vector& props) { props.resize((rand() % 5) + 1); for (uint32_t i = 0; i < props.size(); ++i) { props[i].currentDisplay = CreateRandomDisplay(); @@ -3344,8 +3954,8 @@ static void FillInRandomDisplayPlanePropData(std::vector& props1, - const std::vector& props2) { +bool CompareDisplayPlanePropData(const std::vector& props1, + const std::vector& props2) { if (props1.size() != props2.size()) return false; bool equal = true; for (uint32_t i = 0; i < props1.size(); ++i) { @@ -3367,9 +3977,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRInstanceAndICDSupport) { instance.create_info.add_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayPlaneProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPlanePropertiesKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -3378,10 +3988,10 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRInstanceAndICDSupport) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties(physical_device, &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_device, &prop_count, nullptr)); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().display_plane_properties.size(), prop_count); props.resize(prop_count); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties(physical_device, &prop_count, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_device, &prop_count, props.data())); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().display_plane_properties.size(), prop_count); ASSERT_TRUE(CompareDisplayPlanePropData(props, env.get_test_icd(0).physical_devices.back().display_plane_properties)); @@ -3407,7 +4017,7 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; @@ -3442,9 +4052,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRMixed) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayPlaneProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPlanePropertiesKHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -3468,7 +4078,7 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRMixed) { cur_dev.properties.vendorID == pd_props.vendorID) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties(physical_devices[dev], &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_devices[dev], &prop_count, nullptr)); if (icd == 1) { // For this extension, if no support exists (like for ICD 1), the value of 0 should be returned by the // loader. @@ -3477,7 +4087,7 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlanePropsKHRMixed) { ASSERT_EQ(cur_dev.display_plane_properties.size(), prop_count); props.resize(prop_count); ASSERT_EQ(VK_SUCCESS, - GetPhysicalDeviceDisplayPlaneProperties(physical_devices[dev], &prop_count, props.data())); + GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_devices[dev], &prop_count, props.data())); ASSERT_EQ(cur_dev.display_plane_properties.size(), prop_count); ASSERT_TRUE(CompareDisplayPlanePropData(props, cur_dev.display_plane_properties)); @@ -3502,9 +4112,9 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetDisplayPlaneSupportedDisplays = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneSupportedDisplaysKHR")); - ASSERT_EQ(GetDisplayPlaneSupportedDisplays, nullptr); + PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR = + instance.load("vkGetDisplayPlaneSupportedDisplaysKHR"); + ASSERT_EQ(GetDisplayPlaneSupportedDisplaysKHR, nullptr); } // Test vkGetDisplayPlaneSupportedDisplaysKHR where instance supports it, but nothing else. @@ -3517,13 +4127,13 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetDisplayPlaneSupportedDisplays = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneSupportedDisplaysKHR")); - ASSERT_EQ(GetDisplayPlaneSupportedDisplays, nullptr); + PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR = + instance.load("vkGetDisplayPlaneSupportedDisplaysKHR"); + ASSERT_EQ(GetDisplayPlaneSupportedDisplaysKHR, nullptr); } // Fill in random but valid data into the display plane property data struct for the current physical device -static void GenerateRandomDisplays(std::vector& disps) { +void GenerateRandomDisplays(std::vector& disps) { disps.resize((rand() % 5) + 1); for (uint32_t i = 0; i < disps.size(); ++i) { disps[i] = CreateRandomDisplay(); @@ -3531,7 +4141,7 @@ static void GenerateRandomDisplays(std::vector& disps) { } // Compare the display plane property data structs -static bool CompareDisplays(const std::vector& disps1, const std::vector& disps2) { +bool CompareDisplays(const std::vector& disps1, const std::vector& disps2) { if (disps1.size() != disps2.size()) return false; bool equal = true; for (uint32_t i = 0; i < disps1.size(); ++i) { @@ -3552,9 +4162,9 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRInstanceAndICDSupport) { instance.create_info.add_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDisplayPlaneSupportedDisplays = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneSupportedDisplaysKHR")); - ASSERT_NE(GetDisplayPlaneSupportedDisplays, nullptr); + PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR = + instance.load("vkGetDisplayPlaneSupportedDisplaysKHR"); + ASSERT_NE(GetDisplayPlaneSupportedDisplaysKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -3563,10 +4173,10 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRInstanceAndICDSupport) { std::vector disps{}; uint32_t disp_count = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneSupportedDisplays(physical_device, 0, &disp_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneSupportedDisplaysKHR(physical_device, 0, &disp_count, nullptr)); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().displays.size(), disp_count); disps.resize(disp_count); - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneSupportedDisplays(physical_device, 0, &disp_count, disps.data())); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneSupportedDisplaysKHR(physical_device, 0, &disp_count, disps.data())); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().displays.size(), disp_count); ASSERT_TRUE(CompareDisplays(disps, env.get_test_icd(0).physical_devices.back().displays)); @@ -3592,7 +4202,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; @@ -3627,9 +4237,9 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRMixed) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(); - auto GetDisplayPlaneSupportedDisplays = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneSupportedDisplaysKHR")); - ASSERT_NE(GetDisplayPlaneSupportedDisplays, nullptr); + PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR = + instance.load("vkGetDisplayPlaneSupportedDisplaysKHR"); + ASSERT_NE(GetDisplayPlaneSupportedDisplaysKHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -3653,7 +4263,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRMixed) { cur_dev.properties.vendorID == pd_props.vendorID) { std::vector disps{}; uint32_t disp_count = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneSupportedDisplays(physical_devices[dev], 0, &disp_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneSupportedDisplaysKHR(physical_devices[dev], 0, &disp_count, nullptr)); if (icd == 1) { // For this extension, if no support exists (like for ICD 1), the value of 0 should be returned by the // loader. @@ -3662,7 +4272,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneSupDispsKHRMixed) { ASSERT_EQ(cur_dev.displays.size(), disp_count); disps.resize(disp_count); ASSERT_EQ(VK_SUCCESS, - GetDisplayPlaneSupportedDisplays(physical_devices[dev], 0, &disp_count, disps.data())); + GetDisplayPlaneSupportedDisplaysKHR(physical_devices[dev], 0, &disp_count, disps.data())); ASSERT_EQ(cur_dev.displays.size(), disp_count); ASSERT_TRUE(CompareDisplays(disps, cur_dev.displays)); @@ -3687,9 +4297,8 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetDisplayModeProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModePropertiesKHR")); - ASSERT_EQ(GetDisplayModeProperties, nullptr); + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR = instance.load("vkGetDisplayModePropertiesKHR"); + ASSERT_EQ(GetDisplayModePropertiesKHR, nullptr); } // Test vkGetDisplayModePropertiesKHR where instance supports it, but nothing else. @@ -3702,13 +4311,12 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetDisplayModeProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModePropertiesKHR")); - ASSERT_EQ(GetDisplayModeProperties, nullptr); + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR = instance.load("vkGetDisplayModePropertiesKHR"); + ASSERT_EQ(GetDisplayModePropertiesKHR, nullptr); } // Fill in random but valid data into the display mode properties data struct for the current physical device -static void GenerateRandomDisplayModeProps(std::vector& disps) { +void GenerateRandomDisplayModeProps(std::vector& disps) { disps.resize((rand() % 5) + 1); for (uint32_t i = 0; i < disps.size(); ++i) { disps[i].displayMode = CreateRandomDisplayMode(); @@ -3719,8 +4327,8 @@ static void GenerateRandomDisplayModeProps(std::vector& disps1, - const std::vector& disps2) { +bool CompareDisplayModeProps(const std::vector& disps1, + const std::vector& disps2) { if (disps1.size() != disps2.size()) return false; bool equal = true; for (uint32_t i = 0; i < disps1.size(); ++i) { @@ -3744,9 +4352,8 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRInstanceAndICDSupport) { instance.create_info.add_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDisplayModeProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModePropertiesKHR")); - ASSERT_NE(GetDisplayModeProperties, nullptr); + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR = instance.load("vkGetDisplayModePropertiesKHR"); + ASSERT_NE(GetDisplayModePropertiesKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -3755,10 +4362,10 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRInstanceAndICDSupport) { std::vector props{}; uint32_t props_count = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties(physical_device, VK_NULL_HANDLE, &props_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetDisplayModePropertiesKHR(physical_device, VK_NULL_HANDLE, &props_count, nullptr)); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().display_mode_properties.size(), props_count); props.resize(props_count); - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties(physical_device, VK_NULL_HANDLE, &props_count, props.data())); + ASSERT_EQ(VK_SUCCESS, GetDisplayModePropertiesKHR(physical_device, VK_NULL_HANDLE, &props_count, props.data())); ASSERT_EQ(env.get_test_icd(0).physical_devices.back().display_mode_properties.size(), props_count); ASSERT_TRUE(CompareDisplayModeProps(props, env.get_test_icd(0).physical_devices.back().display_mode_properties)); @@ -3784,7 +4391,7 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; @@ -3819,9 +4426,8 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRMixed) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(); - auto GetDisplayModeProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModePropertiesKHR")); - ASSERT_NE(GetDisplayModeProperties, nullptr); + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR = instance.load("vkGetDisplayModePropertiesKHR"); + ASSERT_NE(GetDisplayModePropertiesKHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -3844,7 +4450,8 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRMixed) { cur_dev.properties.driverVersion == pd_props.driverVersion && cur_dev.properties.vendorID == pd_props.vendorID) { uint32_t props_count = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties(physical_devices[dev], VK_NULL_HANDLE, &props_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, + GetDisplayModePropertiesKHR(physical_devices[dev], VK_NULL_HANDLE, &props_count, nullptr)); if (icd == 1) { // For this extension, if no support exists (like for ICD 1), the value of 0 should be returned by the // loader. @@ -3854,7 +4461,7 @@ TEST(LoaderInstPhysDevExts, GetDispModePropsKHRMixed) { ASSERT_EQ(cur_dev.display_mode_properties.size(), props_count); props.resize(props_count); ASSERT_EQ(VK_SUCCESS, - GetDisplayModeProperties(physical_devices[dev], VK_NULL_HANDLE, &props_count, props.data())); + GetDisplayModePropertiesKHR(physical_devices[dev], VK_NULL_HANDLE, &props_count, props.data())); ASSERT_EQ(cur_dev.display_mode_properties.size(), props_count); ASSERT_TRUE(CompareDisplayModeProps(props, cur_dev.display_mode_properties)); @@ -3879,9 +4486,8 @@ TEST(LoaderInstPhysDevExts, GetDispModesKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto CreateDisplayMode = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkCreateDisplayModeKHR")); - ASSERT_EQ(CreateDisplayMode, nullptr); + PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR = instance.load("vkCreateDisplayModeKHR"); + ASSERT_EQ(CreateDisplayModeKHR, nullptr); } // Test vkCreateDisplayModeKHR where instance supports it, but nothing else. @@ -3894,13 +4500,12 @@ TEST(LoaderInstPhysDevExts, GetDispModesKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto CreateDisplayMode = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkCreateDisplayModeKHR")); - ASSERT_EQ(CreateDisplayMode, nullptr); + PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR = instance.load("vkCreateDisplayModeKHR"); + ASSERT_EQ(CreateDisplayModeKHR, nullptr); } // Compare the display modes -static bool CompareDisplayModes(const VkDisplayModeKHR& disps1, VkDisplayModeKHR& disps2) { return disps1 == disps2; } +bool CompareDisplayModes(const VkDisplayModeKHR& disps1, VkDisplayModeKHR& disps2) { return disps1 == disps2; } // Test vkCreateDisplayModeKHR where instance and ICD supports it, but device does not support it. TEST(LoaderInstPhysDevExts, GetDispModesKHRInstanceAndICDSupport) { @@ -3914,9 +4519,8 @@ TEST(LoaderInstPhysDevExts, GetDispModesKHRInstanceAndICDSupport) { instance.create_info.add_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto CreateDisplayMode = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkCreateDisplayModeKHR")); - ASSERT_NE(CreateDisplayMode, nullptr); + PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR = instance.load("vkCreateDisplayModeKHR"); + ASSERT_NE(CreateDisplayModeKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -3925,7 +4529,7 @@ TEST(LoaderInstPhysDevExts, GetDispModesKHRInstanceAndICDSupport) { VkDisplayModeKHR mode{}; VkDisplayModeCreateInfoKHR create_info{VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR}; - ASSERT_EQ(VK_SUCCESS, CreateDisplayMode(physical_device, VK_NULL_HANDLE, &create_info, nullptr, &mode)); + ASSERT_EQ(VK_SUCCESS, CreateDisplayModeKHR(physical_device, VK_NULL_HANDLE, &create_info, nullptr, &mode)); ASSERT_TRUE(CompareDisplayModes(mode, env.get_test_icd(0).physical_devices.back().display_mode)); } @@ -3949,7 +4553,7 @@ TEST(LoaderInstPhysDevExts, GetDispModesKHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; @@ -3984,9 +4588,8 @@ TEST(LoaderInstPhysDevExts, GetDispModesKHRMixed) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(); - auto CreateDisplayMode = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkCreateDisplayModeKHR")); - ASSERT_NE(CreateDisplayMode, nullptr); + PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR = instance.load("vkCreateDisplayModeKHR"); + ASSERT_NE(CreateDisplayModeKHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -4013,10 +4616,10 @@ TEST(LoaderInstPhysDevExts, GetDispModesKHRMixed) { if (icd == 1) { // Unsupported ICD should return initialization failed (instead of crash) ASSERT_EQ(VK_ERROR_INITIALIZATION_FAILED, - CreateDisplayMode(physical_devices[dev], VK_NULL_HANDLE, &create_info, nullptr, &mode)); + CreateDisplayModeKHR(physical_devices[dev], VK_NULL_HANDLE, &create_info, nullptr, &mode)); } else { ASSERT_EQ(VK_SUCCESS, - CreateDisplayMode(physical_devices[dev], VK_NULL_HANDLE, &create_info, nullptr, &mode)); + CreateDisplayModeKHR(physical_devices[dev], VK_NULL_HANDLE, &create_info, nullptr, &mode)); ASSERT_TRUE(CompareDisplayModes(mode, cur_dev.display_mode)); } found = true; @@ -4039,9 +4642,8 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCapsKHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_EQ(GetDisplayPlaneCapabilities, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_EQ(GetDisplayPlaneCapabilitiesKHR, nullptr); } // Test vkGetDisplayPlaneCapabilitiesKHR where instance supports it, but nothing else. @@ -4054,13 +4656,12 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCapsKHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_EQ(GetDisplayPlaneCapabilities, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_EQ(GetDisplayPlaneCapabilitiesKHR, nullptr); } // Fill in random but valid data into the display plane caps for the current physical device -static void GenerateRandomDisplayPlaneCaps(VkDisplayPlaneCapabilitiesKHR& caps) { +void GenerateRandomDisplayPlaneCaps(VkDisplayPlaneCapabilitiesKHR& caps) { caps.supportedAlpha = static_cast((rand() % 0xFFFFFFF) + 1); caps.minSrcPosition.x = static_cast((rand() % 0xFFFFFFF) + 1); caps.minSrcPosition.y = static_cast((rand() % 0xFFFFFFF) + 1); @@ -4081,8 +4682,8 @@ static void GenerateRandomDisplayPlaneCaps(VkDisplayPlaneCapabilitiesKHR& caps) } // Compare the display plane caps -static bool CompareDisplayPlaneCaps(const VkDisplayPlaneCapabilitiesKHR& caps1, VkDisplayPlaneCapabilitiesKHR& caps2, - bool supported = true) { +bool CompareDisplayPlaneCaps(const VkDisplayPlaneCapabilitiesKHR& caps1, VkDisplayPlaneCapabilitiesKHR& caps2, + bool supported = true) { bool equal = true; if (supported) { equal = equal && caps1.supportedAlpha == caps2.supportedAlpha; @@ -4136,9 +4737,8 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCapsKHRInstanceAndICDSupport) { instance.create_info.add_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_NE(GetDisplayPlaneCapabilities, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_NE(GetDisplayPlaneCapabilitiesKHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -4146,7 +4746,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCapsKHRInstanceAndICDSupport) { ASSERT_EQ(driver_count, 1U); VkDisplayPlaneCapabilitiesKHR caps{}; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities(physical_device, 0, 0, &caps)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilitiesKHR(physical_device, 0, 0, &caps)); ASSERT_TRUE(CompareDisplayPlaneCaps(caps, env.get_test_icd(0).physical_devices.back().display_plane_capabilities)); } @@ -4170,7 +4770,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCapsKHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; @@ -4205,9 +4805,8 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCapsKHRMixed) { instance.create_info.add_extension(VK_KHR_DISPLAY_EXTENSION_NAME); instance.CheckCreate(); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_NE(GetDisplayPlaneCapabilities, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_NE(GetDisplayPlaneCapabilitiesKHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -4230,7 +4829,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCapsKHRMixed) { cur_dev.properties.driverVersion == pd_props.driverVersion && cur_dev.properties.vendorID == pd_props.vendorID) { VkDisplayPlaneCapabilitiesKHR caps{}; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities(physical_devices[dev], 0, 0, &caps)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilitiesKHR(physical_devices[dev], 0, 0, &caps)); ASSERT_TRUE(CompareDisplayPlaneCaps(caps, cur_dev.display_plane_capabilities, icd != 1)); found = true; break; @@ -4256,9 +4855,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayProperties2KHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayProperties2KHR GetPhysicalDeviceDisplayProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayProperties2KHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayProperties2KHR, nullptr); } // Test vkGetPhysicalDeviceDisplayProperties2KHR where instance supports it, but nothing else. @@ -4271,14 +4870,13 @@ TEST(LoaderInstPhysDevExts, PhysDevDispProps2KHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceDisplayProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayProperties2KHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayProperties2KHR GetPhysicalDeviceDisplayProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayProperties2KHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayProperties2KHR, nullptr); } // Compare the display property data structs -static bool CompareDisplayPropData(const std::vector& props1, - const std::vector& props2) { +bool CompareDisplayPropData(const std::vector& props1, const std::vector& props2) { if (props1.size() != props2.size()) return false; bool equal = true; for (uint32_t i = 0; i < props1.size(); ++i) { @@ -4308,12 +4906,12 @@ TEST(LoaderInstPhysDevExts, PhysDevDispProps2KHRInstanceAndICDSupport) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayProperties, nullptr); - auto GetPhysicalDeviceDisplayProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayProperties2KHR")); - ASSERT_NE(GetPhysicalDeviceDisplayProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPropertiesKHR, nullptr); + PFN_vkGetPhysicalDeviceDisplayProperties2KHR GetPhysicalDeviceDisplayProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayProperties2KHR"); + ASSERT_NE(GetPhysicalDeviceDisplayProperties2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -4322,17 +4920,17 @@ TEST(LoaderInstPhysDevExts, PhysDevDispProps2KHRInstanceAndICDSupport) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_device, &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPropertiesKHR(physical_device, &prop_count, nullptr)); ASSERT_NE(0U, prop_count); props.resize(prop_count); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_device, &prop_count, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPropertiesKHR(physical_device, &prop_count, props.data())); std::vector props2{}; uint32_t prop_count_2 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2(physical_device, &prop_count_2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2KHR(physical_device, &prop_count_2, nullptr)); ASSERT_EQ(prop_count, prop_count_2); props2.resize(prop_count_2, {VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2(physical_device, &prop_count_2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2KHR(physical_device, &prop_count_2, props2.data())); ASSERT_EQ(prop_count, prop_count_2); ASSERT_TRUE(CompareDisplayPropData(props, props2)); @@ -4358,7 +4956,7 @@ TEST(LoaderInstPhysDevExts, PhysDevDispProps2KHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.add_instance_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); @@ -4395,12 +4993,12 @@ TEST(LoaderInstPhysDevExts, PhysDevDispProps2KHRMixed) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayProperties, nullptr); - auto GetPhysicalDeviceDisplayProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayProperties2KHR")); - ASSERT_NE(GetPhysicalDeviceDisplayProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPropertiesKHR, nullptr); + PFN_vkGetPhysicalDeviceDisplayProperties2KHR GetPhysicalDeviceDisplayProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayProperties2KHR"); + ASSERT_NE(GetPhysicalDeviceDisplayProperties2KHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -4410,17 +5008,17 @@ TEST(LoaderInstPhysDevExts, PhysDevDispProps2KHRMixed) { for (uint32_t dev = 0; dev < device_count; ++dev) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_devices[dev], &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPropertiesKHR(physical_devices[dev], &prop_count, nullptr)); ASSERT_NE(0U, prop_count); props.resize(prop_count); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties(physical_devices[dev], &prop_count, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPropertiesKHR(physical_devices[dev], &prop_count, props.data())); std::vector props2{}; uint32_t prop_count_2 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2(physical_devices[dev], &prop_count_2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2KHR(physical_devices[dev], &prop_count_2, nullptr)); ASSERT_EQ(prop_count, prop_count_2); props2.resize(prop_count_2, {VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2(physical_devices[dev], &prop_count_2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayProperties2KHR(physical_devices[dev], &prop_count_2, props2.data())); ASSERT_EQ(prop_count, prop_count_2); ASSERT_TRUE(CompareDisplayPropData(props, props2)); @@ -4436,9 +5034,9 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlaneProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayPlaneProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayPlaneProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR GetPhysicalDeviceDisplayPlaneProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayPlaneProperties2KHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayPlaneProperties2KHR, nullptr); } // Test vkGetPhysicalDeviceDisplayPlaneProperties2KHR where instance supports it, but nothing else. @@ -4451,14 +5049,14 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlaneProps2KHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetPhysicalDeviceDisplayPlaneProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR")); - ASSERT_EQ(GetPhysicalDeviceDisplayPlaneProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR GetPhysicalDeviceDisplayPlaneProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayPlaneProperties2KHR"); + ASSERT_EQ(GetPhysicalDeviceDisplayPlaneProperties2KHR, nullptr); } // Compare the display plane property data structs -static bool CompareDisplayPlanePropData(const std::vector& props1, - const std::vector& props2) { +bool CompareDisplayPlanePropData(const std::vector& props1, + const std::vector& props2) { if (props1.size() != props2.size()) return false; bool equal = true; for (uint32_t i = 0; i < props1.size(); ++i) { @@ -4482,12 +5080,12 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlaneProps2KHRInstanceAndICDSupport) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayPlaneProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties, nullptr); - auto GetPhysicalDeviceDisplayPlaneProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR")); - ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPlanePropertiesKHR, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR GetPhysicalDeviceDisplayPlaneProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayPlaneProperties2KHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -4496,17 +5094,17 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlaneProps2KHRInstanceAndICDSupport) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties(physical_device, &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_device, &prop_count, nullptr)); ASSERT_NE(0U, prop_count); props.resize(prop_count); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties(physical_device, &prop_count, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_device, &prop_count, props.data())); std::vector props2{}; uint32_t prop_count2 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2(physical_device, &prop_count2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2KHR(physical_device, &prop_count2, nullptr)); ASSERT_EQ(prop_count, prop_count2); props2.resize(prop_count2, {VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2(physical_device, &prop_count2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2KHR(physical_device, &prop_count2, props2.data())); ASSERT_TRUE(CompareDisplayPlanePropData(props, props2)); } @@ -4531,7 +5129,7 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlaneProps2KHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.add_instance_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); @@ -4568,12 +5166,12 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlaneProps2KHRMixed) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetPhysicalDeviceDisplayPlaneProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR")); - ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties, nullptr); - auto GetPhysicalDeviceDisplayPlaneProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR")); - ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties2, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR = + instance.load("vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPlanePropertiesKHR, nullptr); + PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR GetPhysicalDeviceDisplayPlaneProperties2KHR = + instance.load("vkGetPhysicalDeviceDisplayPlaneProperties2KHR"); + ASSERT_NE(GetPhysicalDeviceDisplayPlaneProperties2KHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -4583,17 +5181,17 @@ TEST(LoaderInstPhysDevExts, PhysDevDispPlaneProps2KHRMixed) { for (uint32_t dev = 0; dev < device_count; ++dev) { std::vector props{}; uint32_t prop_count = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties(physical_devices[dev], &prop_count, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_devices[dev], &prop_count, nullptr)); ASSERT_NE(0U, prop_count); props.resize(prop_count); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties(physical_devices[dev], &prop_count, props.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlanePropertiesKHR(physical_devices[dev], &prop_count, props.data())); std::vector props2{}; uint32_t prop_count2 = 0; - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2(physical_devices[dev], &prop_count2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2KHR(physical_devices[dev], &prop_count2, nullptr)); ASSERT_EQ(prop_count, prop_count2); props2.resize(prop_count2, {VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2(physical_devices[dev], &prop_count2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceDisplayPlaneProperties2KHR(physical_devices[dev], &prop_count2, props2.data())); ASSERT_TRUE(CompareDisplayPlanePropData(props, props2)); } @@ -4608,9 +5206,8 @@ TEST(LoaderInstPhysDevExts, GetDispModeProps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetDisplayModeProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModeProperties2KHR")); - ASSERT_EQ(GetDisplayModeProperties2, nullptr); + PFN_vkGetDisplayModeProperties2KHR GetDisplayModeProperties2KHR = instance.load("vkGetDisplayModeProperties2KHR"); + ASSERT_EQ(GetDisplayModeProperties2KHR, nullptr); } // Test vkGetDisplayModeProperties2KHR where instance supports it, but nothing else. @@ -4623,14 +5220,13 @@ TEST(LoaderInstPhysDevExts, GetDispModeProps2KHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetDisplayModeProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModeProperties2KHR")); - ASSERT_EQ(GetDisplayModeProperties2, nullptr); + PFN_vkGetDisplayModeProperties2KHR GetDisplayModeProperties2KHR = instance.load("vkGetDisplayModeProperties2KHR"); + ASSERT_EQ(GetDisplayModeProperties2KHR, nullptr); } // Compare the display mode properties data structs -static bool CompareDisplayModeProps(const std::vector& disps1, - const std::vector& disps2) { +bool CompareDisplayModeProps(const std::vector& disps1, + const std::vector& disps2) { if (disps1.size() != disps2.size()) return false; bool equal = true; @@ -4658,12 +5254,10 @@ TEST(LoaderInstPhysDevExts, GetDispModeProps2KHRInstanceAndICDSupport) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDisplayModeProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModePropertiesKHR")); - ASSERT_NE(GetDisplayModeProperties, nullptr); - auto GetDisplayModeProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModeProperties2KHR")); - ASSERT_NE(GetDisplayModeProperties2, nullptr); + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR = instance.load("vkGetDisplayModePropertiesKHR"); + ASSERT_NE(GetDisplayModePropertiesKHR, nullptr); + PFN_vkGetDisplayModeProperties2KHR GetDisplayModeProperties2KHR = instance.load("vkGetDisplayModeProperties2KHR"); + ASSERT_NE(GetDisplayModeProperties2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -4672,17 +5266,17 @@ TEST(LoaderInstPhysDevExts, GetDispModeProps2KHRInstanceAndICDSupport) { std::vector props{}; uint32_t props_count1 = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties(physical_device, VK_NULL_HANDLE, &props_count1, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetDisplayModePropertiesKHR(physical_device, VK_NULL_HANDLE, &props_count1, nullptr)); ASSERT_NE(0U, props_count1); props.resize(props_count1); - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties(physical_device, VK_NULL_HANDLE, &props_count1, props.data())); + ASSERT_EQ(VK_SUCCESS, GetDisplayModePropertiesKHR(physical_device, VK_NULL_HANDLE, &props_count1, props.data())); std::vector props2{}; uint32_t props_count2 = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2(physical_device, VK_NULL_HANDLE, &props_count2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2KHR(physical_device, VK_NULL_HANDLE, &props_count2, nullptr)); ASSERT_EQ(props_count1, props_count2); props2.resize(props_count2, {VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2(physical_device, VK_NULL_HANDLE, &props_count2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2KHR(physical_device, VK_NULL_HANDLE, &props_count2, props2.data())); ASSERT_TRUE(CompareDisplayModeProps(props, props2)); } @@ -4707,7 +5301,7 @@ TEST(LoaderInstPhysDevExts, GetDispModeProps2KHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.add_instance_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); @@ -4744,12 +5338,10 @@ TEST(LoaderInstPhysDevExts, GetDispModeProps2KHRMixed) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDisplayModeProperties = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModePropertiesKHR")); - ASSERT_NE(GetDisplayModeProperties, nullptr); - auto GetDisplayModeProperties2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayModeProperties2KHR")); - ASSERT_NE(GetDisplayModeProperties2, nullptr); + PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR = instance.load("vkGetDisplayModePropertiesKHR"); + ASSERT_NE(GetDisplayModePropertiesKHR, nullptr); + PFN_vkGetDisplayModeProperties2KHR GetDisplayModeProperties2KHR = instance.load("vkGetDisplayModeProperties2KHR"); + ASSERT_NE(GetDisplayModeProperties2KHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -4759,17 +5351,17 @@ TEST(LoaderInstPhysDevExts, GetDispModeProps2KHRMixed) { for (uint32_t dev = 0; dev < device_count; ++dev) { std::vector props{}; uint32_t props_count1 = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties(physical_devices[dev], VK_NULL_HANDLE, &props_count1, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetDisplayModePropertiesKHR(physical_devices[dev], VK_NULL_HANDLE, &props_count1, nullptr)); ASSERT_NE(0U, props_count1); props.resize(props_count1); - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties(physical_devices[dev], VK_NULL_HANDLE, &props_count1, props.data())); + ASSERT_EQ(VK_SUCCESS, GetDisplayModePropertiesKHR(physical_devices[dev], VK_NULL_HANDLE, &props_count1, props.data())); std::vector props2{}; uint32_t props_count2 = 0; - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2(physical_devices[dev], VK_NULL_HANDLE, &props_count2, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2KHR(physical_devices[dev], VK_NULL_HANDLE, &props_count2, nullptr)); ASSERT_EQ(props_count1, props_count2); props2.resize(props_count2, {VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR}); - ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2(physical_devices[dev], VK_NULL_HANDLE, &props_count2, props2.data())); + ASSERT_EQ(VK_SUCCESS, GetDisplayModeProperties2KHR(physical_devices[dev], VK_NULL_HANDLE, &props_count2, props2.data())); ASSERT_TRUE(CompareDisplayModeProps(props, props2)); } @@ -4784,9 +5376,8 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_EQ(GetDisplayPlaneCapabilities, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_EQ(GetDisplayPlaneCapabilitiesKHR, nullptr); } // Test vkGetDisplayPlaneCapabilities2KHR where instance supports it, but nothing else. @@ -4799,13 +5390,12 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRNoICDSupport) { instance.create_info.add_extension(VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_EQ(GetDisplayPlaneCapabilities, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_EQ(GetDisplayPlaneCapabilitiesKHR, nullptr); } // Compare the display plane caps -static bool CompareDisplayPlaneCaps(const VkDisplayPlaneCapabilitiesKHR& caps1, VkDisplayPlaneCapabilities2KHR& caps2) { +bool CompareDisplayPlaneCaps(const VkDisplayPlaneCapabilitiesKHR& caps1, VkDisplayPlaneCapabilities2KHR& caps2) { bool equal = true; equal = equal && caps1.supportedAlpha == caps2.capabilities.supportedAlpha; equal = equal && caps1.minSrcPosition.x == caps2.capabilities.minSrcPosition.x; @@ -4841,12 +5431,10 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRInstanceAndICDSupport) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_NE(GetDisplayPlaneCapabilities, nullptr); - auto GetDisplayPlaneCapabilities2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilities2KHR")); - ASSERT_NE(GetDisplayPlaneCapabilities2, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_NE(GetDisplayPlaneCapabilitiesKHR, nullptr); + PFN_vkGetDisplayPlaneCapabilities2KHR GetDisplayPlaneCapabilities2KHR = instance.load("vkGetDisplayPlaneCapabilities2KHR"); + ASSERT_NE(GetDisplayPlaneCapabilities2KHR, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -4854,10 +5442,10 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRInstanceAndICDSupport) { ASSERT_EQ(driver_count, 1U); VkDisplayPlaneCapabilitiesKHR caps{}; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities(physical_device, 0, 0, &caps)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilitiesKHR(physical_device, 0, 0, &caps)); VkDisplayPlaneCapabilities2KHR caps2{}; VkDisplayPlaneInfo2KHR info{VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR}; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities2(physical_device, &info, &caps2)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities2KHR(physical_device, &info, &caps2)); ASSERT_TRUE(CompareDisplayPlaneCaps(caps, caps2)); } @@ -4881,7 +5469,7 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.add_instance_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); @@ -4918,12 +5506,10 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRMixed) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDisplayPlaneCapabilities = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR")); - ASSERT_NE(GetDisplayPlaneCapabilities, nullptr); - auto GetDisplayPlaneCapabilities2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilities2KHR")); - ASSERT_NE(GetDisplayPlaneCapabilities2, nullptr); + PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR = instance.load("vkGetDisplayPlaneCapabilitiesKHR"); + ASSERT_NE(GetDisplayPlaneCapabilitiesKHR, nullptr); + PFN_vkGetDisplayPlaneCapabilities2KHR GetDisplayPlaneCapabilities2KHR = instance.load("vkGetDisplayPlaneCapabilities2KHR"); + ASSERT_NE(GetDisplayPlaneCapabilities2KHR, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -4932,10 +5518,10 @@ TEST(LoaderInstPhysDevExts, GetDispPlaneCaps2KHRMixed) { for (uint32_t dev = 0; dev < device_count; ++dev) { VkDisplayPlaneCapabilitiesKHR caps{}; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities(physical_devices[dev], 0, 0, &caps)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilitiesKHR(physical_devices[dev], 0, 0, &caps)); VkDisplayPlaneCapabilities2KHR caps2{}; VkDisplayPlaneInfo2KHR info{VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR}; - ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities2(physical_devices[dev], &info, &caps2)); + ASSERT_EQ(VK_SUCCESS, GetDisplayPlaneCapabilities2KHR(physical_devices[dev], &info, &caps2)); CompareDisplayPlaneCaps(caps, caps2); } } @@ -4953,9 +5539,8 @@ TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto AcquireDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkAcquireDrmDisplayEXT")); - ASSERT_EQ(AcquireDrmDisplay, nullptr); + PFN_vkAcquireDrmDisplayEXT AcquireDrmDisplayEXT = instance.load("vkAcquireDrmDisplayEXT"); + ASSERT_EQ(AcquireDrmDisplayEXT, nullptr); } // Test vkAcquireDrmDisplayEXT where instance supports it, but nothing else. @@ -4968,9 +5553,8 @@ TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTNoICDSupport) { instance.create_info.add_extension(VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto AcquireDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkAcquireDrmDisplayEXT")); - ASSERT_EQ(AcquireDrmDisplay, nullptr); + PFN_vkAcquireDrmDisplayEXT AcquireDrmDisplayEXT = instance.load("vkAcquireDrmDisplayEXT"); + ASSERT_EQ(AcquireDrmDisplayEXT, nullptr); } // Test vkAcquireDrmDisplayEXT where instance and ICD supports it, but device does not support it. @@ -4987,9 +5571,8 @@ TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTInstanceAndICDSupport) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto AcquireDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkAcquireDrmDisplayEXT")); - ASSERT_NE(AcquireDrmDisplay, nullptr); + PFN_vkAcquireDrmDisplayEXT AcquireDrmDisplayEXT = instance.load("vkAcquireDrmDisplayEXT"); + ASSERT_NE(AcquireDrmDisplayEXT, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -4997,7 +5580,7 @@ TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTInstanceAndICDSupport) { ASSERT_EQ(driver_count, 1U); VkDisplayKHR display = VK_NULL_HANDLE; - ASSERT_EQ(VK_SUCCESS, AcquireDrmDisplay(physical_device, 0, display)); + ASSERT_EQ(VK_SUCCESS, AcquireDrmDisplayEXT(physical_device, 0, display)); } // Test vkAcquireDrmDisplayEXT where instance supports it with some ICDs that both support @@ -5020,7 +5603,7 @@ TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.add_instance_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); @@ -5057,9 +5640,8 @@ TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTMixed) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto AcquireDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkAcquireDrmDisplayEXT")); - ASSERT_NE(AcquireDrmDisplay, nullptr); + PFN_vkAcquireDrmDisplayEXT AcquireDrmDisplayEXT = instance.load("vkAcquireDrmDisplayEXT"); + ASSERT_NE(AcquireDrmDisplayEXT, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -5085,9 +5667,9 @@ TEST(LoaderInstPhysDevExts, AcquireDrmDisplayEXTMixed) { if (icd == 1) { // For this extension, if no support exists (like for ICD 1), the value of 0 should be returned by the // loader. - ASSERT_EQ(VK_ERROR_INITIALIZATION_FAILED, AcquireDrmDisplay(physical_devices[dev], 0, display)); + ASSERT_EQ(VK_ERROR_EXTENSION_NOT_PRESENT, AcquireDrmDisplayEXT(physical_devices[dev], 0, display)); } else { - ASSERT_EQ(VK_SUCCESS, AcquireDrmDisplay(physical_devices[dev], 0, display)); + ASSERT_EQ(VK_SUCCESS, AcquireDrmDisplayEXT(physical_devices[dev], 0, display)); } found = true; break; @@ -5109,9 +5691,8 @@ TEST(LoaderInstPhysDevExts, GetDrmDisplayEXTNoSupport) { InstWrapper instance(env.vulkan_functions); instance.CheckCreate(); - auto GetDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkGetDrmDisplayEXT")); - ASSERT_EQ(GetDrmDisplay, nullptr); + PFN_vkGetDrmDisplayEXT GetDrmDisplayEXT = instance.load("vkGetDrmDisplayEXT"); + ASSERT_EQ(GetDrmDisplayEXT, nullptr); } // Test vkGetDrmDisplayEXT where instance supports it, but nothing else. @@ -5124,9 +5705,8 @@ TEST(LoaderInstPhysDevExts, GetDrmDisplayEXTNoICDSupport) { instance.create_info.add_extension(VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME); instance.CheckCreate(VK_ERROR_EXTENSION_NOT_PRESENT); - auto GetDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkGetDrmDisplayEXT")); - ASSERT_EQ(GetDrmDisplay, nullptr); + PFN_vkGetDrmDisplayEXT GetDrmDisplayEXT = instance.load("vkGetDrmDisplayEXT"); + ASSERT_EQ(GetDrmDisplayEXT, nullptr); } // Test vkGetDrmDisplayEXT where instance and ICD supports it, but device does not support it. @@ -5143,9 +5723,8 @@ TEST(LoaderInstPhysDevExts, GetDrmDisplayEXTInstanceAndICDSupport) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkGetDrmDisplayEXT")); - ASSERT_NE(GetDrmDisplay, nullptr); + PFN_vkGetDrmDisplayEXT GetDrmDisplayEXT = instance.load("vkGetDrmDisplayEXT"); + ASSERT_NE(GetDrmDisplayEXT, nullptr); uint32_t driver_count = 1; VkPhysicalDevice physical_device; @@ -5153,7 +5732,7 @@ TEST(LoaderInstPhysDevExts, GetDrmDisplayEXTInstanceAndICDSupport) { ASSERT_EQ(driver_count, 1U); VkDisplayKHR display = VK_NULL_HANDLE; - ASSERT_EQ(VK_SUCCESS, GetDrmDisplay(physical_device, 0, 0, &display)); + ASSERT_EQ(VK_SUCCESS, GetDrmDisplayEXT(physical_device, 0, 0, &display)); ASSERT_EQ(display, env.get_test_icd(0).physical_devices.back().displays[0]); } @@ -5177,7 +5756,7 @@ TEST(LoaderInstPhysDevExts, GetDrmDisplayEXTMixed) { const uint32_t max_phys_devs = 7; for (uint32_t icd = 0; icd < max_icd_count; ++icd) { - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, icd != 1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0)); auto& cur_icd = env.get_test_icd(icd); cur_icd.icd_api_version = VK_API_VERSION_1_0; cur_icd.add_instance_extension({VK_KHR_DISPLAY_EXTENSION_NAME}); @@ -5214,9 +5793,8 @@ TEST(LoaderInstPhysDevExts, GetDrmDisplayEXTMixed) { instance.create_info.add_extensions({VK_KHR_DISPLAY_EXTENSION_NAME, VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME}); instance.CheckCreate(); - auto GetDrmDisplay = - reinterpret_cast(instance.functions->vkGetInstanceProcAddr(instance, "vkGetDrmDisplayEXT")); - ASSERT_NE(GetDrmDisplay, nullptr); + PFN_vkGetDrmDisplayEXT GetDrmDisplayEXT = instance.load("vkGetDrmDisplayEXT"); + ASSERT_NE(GetDrmDisplayEXT, nullptr); uint32_t device_count = max_phys_devs; std::array physical_devices; @@ -5242,9 +5820,9 @@ TEST(LoaderInstPhysDevExts, GetDrmDisplayEXTMixed) { if (icd == 1) { // For this extension, if no support exists (like for ICD 1), the value of 0 should be returned by the // loader. - ASSERT_EQ(VK_ERROR_INITIALIZATION_FAILED, GetDrmDisplay(physical_devices[dev], 0, 0, &display)); + ASSERT_EQ(VK_ERROR_EXTENSION_NOT_PRESENT, GetDrmDisplayEXT(physical_devices[dev], 0, 0, &display)); } else { - ASSERT_EQ(VK_SUCCESS, GetDrmDisplay(physical_devices[dev], 0, 0, &display)); + ASSERT_EQ(VK_SUCCESS, GetDrmDisplayEXT(physical_devices[dev], 0, 0, &display)); ASSERT_EQ(display, cur_dev.displays[0]); } found = true; @@ -5264,17 +5842,17 @@ TEST(LoaderInstPhysDevExts, DifferentInstanceExtensions) { // Add 3 drivers each of which supports a different instance extension env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(0).add_instance_extension({VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME}); - env.get_test_icd(0).physical_devices.push_back({"pd0", 7}); + env.get_test_icd(0).physical_devices.push_back({"pd0"}); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(1).add_instance_extension({VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME}); - env.get_test_icd(1).physical_devices.push_back({"pd1", 0}); + env.get_test_icd(1).physical_devices.push_back({"pd1"}); env.get_test_icd(1).physical_devices.back().extensions.push_back({VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(2).add_instance_extension({VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME}); - env.get_test_icd(2).physical_devices.push_back({"pd2", 1}); + env.get_test_icd(2).physical_devices.push_back({"pd2"}); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME, 0}); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT}; @@ -5288,12 +5866,12 @@ TEST(LoaderInstPhysDevExts, DifferentInstanceExtensions) { const uint32_t expected_device_count = 3; auto physical_devices = inst.GetPhysDevs(expected_device_count); - auto GetPhysicalDeviceExternalBufferProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceExternalBufferPropertiesKHR")); - auto GetPhysicalDeviceExternalSemaphoreProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR")); - auto GetPhysicalDeviceExternalFenceProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceExternalFencePropertiesKHR")); + PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR GetPhysicalDeviceExternalBufferProperties = + inst.load("vkGetPhysicalDeviceExternalBufferPropertiesKHR"); + PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR GetPhysicalDeviceExternalSemaphoreProperties = + inst.load("vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); + PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR GetPhysicalDeviceExternalFenceProperties = + inst.load("vkGetPhysicalDeviceExternalFencePropertiesKHR"); ASSERT_NE(nullptr, GetPhysicalDeviceExternalBufferProperties); ASSERT_NE(nullptr, GetPhysicalDeviceExternalSemaphoreProperties); ASSERT_NE(nullptr, GetPhysicalDeviceExternalFenceProperties); @@ -5318,15 +5896,15 @@ TEST(LoaderInstPhysDevExts, DifferentPhysicalDeviceExtensions) { // Add 3 drivers each of which supports a different physical device extension env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); - env.get_test_icd(0).physical_devices.push_back({"pd0", 7}); + env.get_test_icd(0).physical_devices.push_back("pd0"); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); - env.get_test_icd(1).physical_devices.push_back({"pd1", 0}); + env.get_test_icd(1).physical_devices.push_back("pd1"); env.get_test_icd(1).physical_devices.back().extensions.push_back({VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); - env.get_test_icd(2).physical_devices.push_back({"pd2", 1}); + env.get_test_icd(2).physical_devices.push_back("pd2"); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME, 0}); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT}; @@ -5337,16 +5915,16 @@ TEST(LoaderInstPhysDevExts, DifferentPhysicalDeviceExtensions) { const uint32_t expected_device_count = 3; auto physical_devices = inst.GetPhysDevs(expected_device_count); - auto EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCounters = - reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR")); - auto GetPhysicalDeviceMultisampleProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceMultisamplePropertiesEXT")); - auto GetPhysicalDeviceCalibrateableTimeDomains = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT")); - ASSERT_NE(nullptr, EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCounters); - ASSERT_NE(nullptr, GetPhysicalDeviceMultisampleProperties); - ASSERT_NE(nullptr, GetPhysicalDeviceCalibrateableTimeDomains); + PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR + EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR = + inst.load("vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR"); + PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT GetPhysicalDeviceMultisamplePropertiesEXT = + inst.load("vkGetPhysicalDeviceMultisamplePropertiesEXT"); + PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT = + inst.load("vkGetPhysicalDeviceCalibrateableTimeDomainsEXT"); + ASSERT_NE(nullptr, EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR); + ASSERT_NE(nullptr, GetPhysicalDeviceMultisamplePropertiesEXT); + ASSERT_NE(nullptr, GetPhysicalDeviceCalibrateableTimeDomainsEXT); for (uint32_t dev = 0; dev < expected_device_count; ++dev) { uint32_t extension_count = 0; @@ -5374,27 +5952,27 @@ TEST(LoaderInstPhysDevExts, DifferentPhysicalDeviceExtensions) { // For physical device extensions, they should work for devices that support it and crash for those that don't. if (supports_query) { - ASSERT_EQ(VK_SUCCESS, EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCounters(physical_devices[dev], 0, nullptr, - nullptr, nullptr)); + ASSERT_EQ(VK_SUCCESS, EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(physical_devices[dev], 0, nullptr, + nullptr, nullptr)); } else { ASSERT_DEATH( - EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCounters(physical_devices[dev], 0, nullptr, nullptr, nullptr), + EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(physical_devices[dev], 0, nullptr, nullptr, nullptr), ""); ASSERT_FALSE( log.find("ICD associated with VkPhysicalDevice does not support " "EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR")); } if (supports_samples) { - GetPhysicalDeviceMultisampleProperties(physical_devices[dev], VK_SAMPLE_COUNT_2_BIT, nullptr); + GetPhysicalDeviceMultisamplePropertiesEXT(physical_devices[dev], VK_SAMPLE_COUNT_2_BIT, nullptr); } else { - ASSERT_DEATH(GetPhysicalDeviceMultisampleProperties(physical_devices[dev], VK_SAMPLE_COUNT_2_BIT, nullptr), ""); + ASSERT_DEATH(GetPhysicalDeviceMultisamplePropertiesEXT(physical_devices[dev], VK_SAMPLE_COUNT_2_BIT, nullptr), ""); ASSERT_FALSE( log.find("ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceMultisamplePropertiesEXT")); } if (supports_timestamps) { - ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceCalibrateableTimeDomains(physical_devices[dev], nullptr, nullptr)); + ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceCalibrateableTimeDomainsEXT(physical_devices[dev], nullptr, nullptr)); } else { - ASSERT_DEATH(GetPhysicalDeviceCalibrateableTimeDomains(physical_devices[dev], nullptr, nullptr), ""); + ASSERT_DEATH(GetPhysicalDeviceCalibrateableTimeDomainsEXT(physical_devices[dev], nullptr, nullptr), ""); ASSERT_FALSE( log.find("ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceCalibrateableTimeDomainsEXT")); } diff --git a/tests/loader_regression_tests.cpp b/tests/loader_regression_tests.cpp index 4bf72eb1f057adb8140ececa8f03c7b3e5bb9404..407d8093e144a12efe91e7a34864e673c41db28e 100644 --- a/tests/loader_regression_tests.cpp +++ b/tests/loader_regression_tests.cpp @@ -1,7 +1,9 @@ /* - * Copyright (c) 2021-2022 The Khronos Group Inc. - * Copyright (c) 2021-2022 Valve Corporation - * Copyright (c) 2021-2022 LunarG, Inc. + * 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 @@ -36,10 +38,7 @@ TEST(CreateInstance, BasicRun) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - - auto& driver = env.get_test_icd(); - driver.set_min_icd_interface_version(5); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); @@ -96,7 +95,7 @@ TEST(CreateInstance, LayerNotPresent) { TEST(CreateInstance, LayerPresent) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}).add_physical_device({}); const char* layer_name = "TestLayer"; env.add_explicit_layer( @@ -109,6 +108,40 @@ TEST(CreateInstance, LayerPresent) { inst.CheckCreate(); } +TEST(CreateInstance, RelativePaths) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}.set_library_path_type(LibraryPathType::relative)).add_physical_device({}); + + const char* layer_name = "VK_LAYER_TestLayer"; + env.add_explicit_layer( + TestLayerDetails{ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"} + .set_library_path_type(LibraryPathType::relative)); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); + + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); +} + +TEST(CreateInstance, ApiVersionBelow1_0) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); + + DebugUtilsLogger debug_log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT}; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, debug_log); + inst.create_info.api_version = 1; + inst.CheckCreate(); + ASSERT_TRUE( + debug_log.find("VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 1 which is not permitted. If apiVersion is " + "not 0, then it must be " + "greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]")); +} + TEST(CreateInstance, ConsecutiveCreate) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); @@ -158,6 +191,7 @@ TEST(EnumerateInstanceLayerProperties, UsageChecks) { uint32_t layer_count = 2; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props)); ASSERT_EQ(layer_count, 2U); + auto layers = env.GetLayerProperties(2); ASSERT_TRUE(string_eq(layer_name_1, layer_props[0].layerName)); ASSERT_TRUE(string_eq(layer_name_2, layer_props[1].layerName)); } @@ -189,34 +223,28 @@ TEST(EnumerateInstanceExtensionProperties, UsageChecks) { env.reset_icd().add_instance_extensions({first_ext, second_ext}); { // One Pass - uint32_t extension_count = 5; - std::array extensions; + uint32_t extension_count = 6; + std::array extensions; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); - ASSERT_EQ(extension_count, 5U); // return debug report & debug utils & portability enumeration + our two extensions - - // loader always adds the debug report & debug utils extensions - ASSERT_TRUE(first_ext.extensionName == extensions[0].extensionName); - ASSERT_TRUE(second_ext.extensionName == extensions[1].extensionName); - ASSERT_TRUE(string_eq("VK_EXT_debug_report", extensions[2].extensionName)); - ASSERT_TRUE(string_eq("VK_EXT_debug_utils", extensions[3].extensionName)); - ASSERT_TRUE(string_eq("VK_KHR_portability_enumeration", extensions[4].extensionName)); + ASSERT_EQ(extension_count, 6U); // 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_REPORT_EXTENSION_NAME)); + 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)); } { // Two Pass - uint32_t extension_count = 0; - std::array extensions; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 5U); // return debug report & debug utils + our two extensions - - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); - ASSERT_EQ(extension_count, 5U); + auto extensions = env.GetInstanceExtensions(6); // loader always adds the debug report & debug utils extensions - ASSERT_TRUE(first_ext.extensionName == extensions[0].extensionName); - ASSERT_TRUE(second_ext.extensionName == extensions[1].extensionName); - ASSERT_TRUE(string_eq("VK_EXT_debug_report", extensions[2].extensionName)); - ASSERT_TRUE(string_eq("VK_EXT_debug_utils", extensions[3].extensionName)); - ASSERT_TRUE(string_eq("VK_KHR_portability_enumeration", extensions[4].extensionName)); + 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_REPORT_EXTENSION_NAME)); + 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)); } } @@ -225,10 +253,10 @@ TEST(EnumerateInstanceExtensionProperties, PropertyCountLessThanAvailable) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); uint32_t extension_count = 0; - std::array extensions; + std::array extensions; { // use nullptr for null string ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 3U); // return debug report & debug utils & portability enumeration + ASSERT_EQ(extension_count, 4U); // return debug report & debug utils & portability enumeration & direct driver loading extension_count = 1; // artificially remove one extension ASSERT_EQ(VK_INCOMPLETE, @@ -239,7 +267,7 @@ TEST(EnumerateInstanceExtensionProperties, PropertyCountLessThanAvailable) { } { // use "" for null string ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties("", &extension_count, nullptr)); - ASSERT_EQ(extension_count, 3U); // return debug report & debug utils & portability enumeration + ASSERT_EQ(extension_count, 4U); // return debug report & debug utils & portability enumeration & direct driver loading extension_count = 1; // artificially remove one extension ASSERT_EQ(VK_INCOMPLETE, @@ -258,44 +286,29 @@ TEST(EnumerateInstanceExtensionProperties, FilterUnkownInstanceExtensions) { Extension second_ext{"SecondTestExtension"}; env.reset_icd().add_instance_extensions({first_ext, second_ext}); { - uint32_t extension_count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties("", &extension_count, nullptr)); - ASSERT_EQ(extension_count, 3U); // return debug report & debug utils & portability enumeration - - std::array extensions; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties("", &extension_count, extensions.data())); - ASSERT_EQ(extension_count, 3U); + auto extensions = env.GetInstanceExtensions(4); // loader always adds the debug report & debug utils extensions - ASSERT_TRUE(string_eq(extensions[0].extensionName, "VK_EXT_debug_report")); - ASSERT_TRUE(string_eq(extensions[1].extensionName, "VK_EXT_debug_utils")); - ASSERT_TRUE(string_eq(extensions[2].extensionName, "VK_KHR_portability_enumeration")); + 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)); } { // Disable unknown instance extension filtering - set_env_var("VK_LOADER_DISABLE_INST_EXT_FILTER", "1"); - - uint32_t extension_count = 0; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties("", &extension_count, nullptr)); - ASSERT_EQ(extension_count, 5U); - - std::array extensions; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties("", &extension_count, extensions.data())); - ASSERT_EQ(extension_count, 5U); - - ASSERT_EQ(extensions[0], first_ext.get()); - ASSERT_EQ(extensions[1], second_ext.get()); - // Loader always adds these two extensions - ASSERT_TRUE(string_eq(extensions[2].extensionName, "VK_EXT_debug_report")); - ASSERT_TRUE(string_eq(extensions[3].extensionName, "VK_EXT_debug_utils")); - ASSERT_TRUE(string_eq(extensions[4].extensionName, "VK_KHR_portability_enumeration")); + EnvVarWrapper disable_inst_ext_filter_env_var{"VK_LOADER_DISABLE_INST_EXT_FILTER", "1"}; + + 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())); + EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); + 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)); } } TEST(EnumerateDeviceLayerProperties, LayersMatch) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name = "TestLayer"; env.add_explicit_layer( @@ -309,14 +322,8 @@ TEST(EnumerateDeviceLayerProperties, LayersMatch) { VkPhysicalDevice phys_dev = inst.GetPhysDev(); { // LayersMatch - - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - VkLayerProperties layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &layer_count, &layer_props), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - ASSERT_TRUE(string_eq(layer_props.layerName, layer_name)); + auto layer_props = inst.GetActiveLayers(phys_dev, 1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, layer_name)); } { // Property count less than available VkLayerProperties layer_props; @@ -328,10 +335,7 @@ TEST(EnumerateDeviceLayerProperties, LayersMatch) { TEST(EnumerateDeviceExtensionProperties, DeviceExtensionEnumerated) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); std::array device_extensions = {Extension{"MyExtension0", 4}, Extension{"MyExtension1", 7}}; for (auto& ext : device_extensions) { @@ -358,10 +362,7 @@ TEST(EnumerateDeviceExtensionProperties, DeviceExtensionEnumerated) { TEST(EnumerateDeviceExtensionProperties, PropertyCountLessThanAvailable) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); std::array device_extensions = {Extension{"MyExtension0", 4}, Extension{"MyExtension1", 7}}; for (auto& ext : device_extensions) { @@ -389,9 +390,8 @@ TEST(EnumerateDeviceExtensionProperties, PropertyCountLessThanAvailable) { TEST(EnumerateDeviceExtensionProperties, ZeroPhysicalDeviceExtensions) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); - env.get_test_icd().add_physical_device({}); InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)); inst.CheckCreate(VK_SUCCESS); @@ -408,16 +408,284 @@ TEST(EnumerateDeviceExtensionProperties, ZeroPhysicalDeviceExtensions) { ASSERT_EQ(ext_count, 0U); } -TEST(EnumeratePhysicalDevices, OneCall) { +void exercise_EnumerateDeviceExtensionProperties(InstWrapper& inst, VkPhysicalDevice physical_device, + std::vector& exts_to_expect) { + { // "expected enumeration pattern" + uint32_t extension_count = 0; + ASSERT_EQ(VK_SUCCESS, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &extension_count, nullptr)); + ASSERT_EQ(extension_count, exts_to_expect.size()); + + std::vector enumerated_device_exts{extension_count}; + ASSERT_EQ(VK_SUCCESS, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &extension_count, + enumerated_device_exts.data())); + ASSERT_EQ(extension_count, exts_to_expect.size()); + for (uint32_t i = 0; i < exts_to_expect.size(); i++) { + ASSERT_TRUE(exts_to_expect[i].extensionName == enumerated_device_exts[i].extensionName); + ASSERT_EQ(exts_to_expect[i].specVersion, enumerated_device_exts[i].specVersion); + } + } + { // "Single call pattern" + uint32_t extension_count = static_cast(exts_to_expect.size()); + std::vector enumerated_device_exts{extension_count}; + ASSERT_EQ(VK_SUCCESS, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &extension_count, + enumerated_device_exts.data())); + ASSERT_EQ(extension_count, exts_to_expect.size()); + enumerated_device_exts.resize(extension_count); + + ASSERT_EQ(extension_count, exts_to_expect.size()); + for (uint32_t i = 0; i < exts_to_expect.size(); i++) { + ASSERT_TRUE(exts_to_expect[i].extensionName == enumerated_device_exts[i].extensionName); + ASSERT_EQ(exts_to_expect[i].specVersion, enumerated_device_exts[i].specVersion); + } + } + { // pPropertiesCount == NULL + ASSERT_EQ(VK_INCOMPLETE, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, nullptr, nullptr)); + } + { // 2nd call pass in way more than in reality + uint32_t extension_count = std::numeric_limits::max(); + ASSERT_EQ(VK_SUCCESS, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &extension_count, nullptr)); + ASSERT_EQ(extension_count, exts_to_expect.size()); + + // reset size to a not earthshatteringly large number of extensions + extension_count = static_cast(exts_to_expect.size()) * 4; + std::vector enumerated_device_exts{extension_count}; + + ASSERT_EQ(VK_SUCCESS, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &extension_count, + enumerated_device_exts.data())); + ASSERT_EQ(extension_count, exts_to_expect.size()); + for (uint32_t i = 0; i < exts_to_expect.size(); i++) { + ASSERT_TRUE(exts_to_expect[i].extensionName == enumerated_device_exts[i].extensionName); + ASSERT_EQ(exts_to_expect[i].specVersion, enumerated_device_exts[i].specVersion); + } + } + { // 2nd call pass in not enough, go through all possible values from 0 to exts_to_expect.size() + uint32_t extension_count = std::numeric_limits::max(); + ASSERT_EQ(VK_SUCCESS, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &extension_count, nullptr)); + ASSERT_EQ(extension_count, exts_to_expect.size()); + std::vector enumerated_device_exts{extension_count}; + for (uint32_t i = 0; i < exts_to_expect.size() - 1; i++) { + extension_count = i; + ASSERT_EQ(VK_INCOMPLETE, inst->vkEnumerateDeviceExtensionProperties(physical_device, nullptr, &extension_count, + enumerated_device_exts.data())); + ASSERT_EQ(extension_count, i); + for (uint32_t j = 0; j < i; j++) { + ASSERT_TRUE(exts_to_expect[j].extensionName == enumerated_device_exts[j].extensionName); + ASSERT_EQ(exts_to_expect[j].specVersion, enumerated_device_exts[j].specVersion); + } + } + } +} + +TEST(EnumerateDeviceExtensionProperties, ImplicitLayerPresentNoExtensions) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + std::vector exts = {Extension{"MyDriverExtension0", 4}, Extension{"MyDriverExtension1", 7}, + Extension{"MyDriverExtension2", 6}, Extension{"MyDriverExtension3", 10}}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .add_physical_device("physical_device_0") + .physical_devices.at(0) + .add_extensions(exts); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer.json"); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + exercise_EnumerateDeviceExtensionProperties(inst, inst.GetPhysDev(), exts); +} + +TEST(EnumerateDeviceExtensionProperties, ImplicitLayerPresentWithExtensions) { + FrameworkEnvironment env{}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector exts; + std::vector layer_exts; + for (uint32_t i = 0; i < 6; i++) { + exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + layer_exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_device_extensions({layer_exts})), + "implicit_test_layer.json"); + auto& layer = env.get_test_layer(); + layer.device_extensions = exts; + + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension0", 4); + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension1", 7); + + exts.insert(exts.begin(), driver.physical_devices.front().extensions.begin(), driver.physical_devices.front().extensions.end()); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + VkPhysicalDevice physical_device = inst.GetPhysDev(); + exercise_EnumerateDeviceExtensionProperties(inst, physical_device, exts); +} + +TEST(EnumerateDeviceExtensionProperties, ImplicitLayerPresentWithLotsOfExtensions) { + FrameworkEnvironment env{}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector exts; + std::vector layer_exts; + for (uint32_t i = 0; i < 26; i++) { + exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + layer_exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_device_extensions({layer_exts})), + "implicit_test_layer.json"); + auto& layer = env.get_test_layer(); + layer.device_extensions = exts; + + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension0", 4); + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension1", 7); + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension2", 6); + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension3", 9); + + exts.insert(exts.begin(), driver.physical_devices.front().extensions.begin(), driver.physical_devices.front().extensions.end()); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + VkPhysicalDevice physical_device = inst.GetPhysDev(); + exercise_EnumerateDeviceExtensionProperties(inst, physical_device, exts); +} + +TEST(EnumerateDeviceExtensionProperties, NoDriverExtensionsImplicitLayerPresentWithExtensions) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector exts; + std::vector layer_exts; + for (uint32_t i = 0; i < 6; i++) { + exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + layer_exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_device_extensions({layer_exts})), + "implicit_test_layer.json"); + auto& layer = env.get_test_layer(); + layer.device_extensions = exts; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + VkPhysicalDevice physical_device = inst.GetPhysDev(); + exercise_EnumerateDeviceExtensionProperties(inst, physical_device, exts); +} + +TEST(EnumerateDeviceExtensionProperties, NoDriverExtensionsImplicitLayerPresentWithLotsOfExtensions) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector exts; + std::vector layer_exts; + for (uint32_t i = 0; i < 6; i++) { + exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + layer_exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_device_extensions({layer_exts})), + "implicit_test_layer.json"); + auto& layer = env.get_test_layer(); + layer.device_extensions = exts; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + VkPhysicalDevice physical_device = inst.GetPhysDev(); + exercise_EnumerateDeviceExtensionProperties(inst, physical_device, exts); +} + +TEST(EnumerateDeviceExtensionProperties, ImplicitLayerPresentWithDuplicateExtensions) { + FrameworkEnvironment env{}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector exts; + std::vector layer_exts; + for (uint32_t i = 0; i < 26; i++) { + exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + layer_exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_device_extensions({layer_exts})), + "implicit_test_layer.json"); + auto& layer = env.get_test_layer(); + layer.device_extensions = exts; + + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension0", 4); + driver.physical_devices.front().extensions.emplace_back("MyDriverExtension1", 7); - driver.physical_devices.emplace_back("physical_device_0", 1); - driver.physical_devices.emplace_back("physical_device_1", 2); - driver.physical_devices.emplace_back("physical_device_2", 3); - driver.physical_devices.emplace_back("physical_device_3", 4); + driver.physical_devices.front().extensions.insert(driver.physical_devices.front().extensions.end(), exts.begin(), exts.end()); + exts.emplace_back("MyDriverExtension0", 4); + exts.emplace_back("MyDriverExtension1", 7); + + driver.physical_devices.front().extensions = exts; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + VkPhysicalDevice physical_device = inst.GetPhysDev(); + exercise_EnumerateDeviceExtensionProperties(inst, physical_device, exts); +} + +TEST(EnumerateDeviceExtensionProperties, ImplicitLayerPresentWithOnlyDuplicateExtensions) { + FrameworkEnvironment env{}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector exts; + std::vector layer_exts; + for (uint32_t i = 0; i < 26; i++) { + exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + layer_exts.emplace_back(std::string("LayerExtNumba") + std::to_string(i), i + 10); + } + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_device_extensions({layer_exts})), + "implicit_test_layer.json"); + auto& layer = env.get_test_layer(); + layer.device_extensions = exts; + + driver.physical_devices.front().extensions = exts; + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + VkPhysicalDevice physical_device = inst.GetPhysDev(); + exercise_EnumerateDeviceExtensionProperties(inst, physical_device, exts); +} + +TEST(EnumeratePhysicalDevices, OneCall) { + FrameworkEnvironment env{}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); + + driver.add_physical_device("physical_device_0"); + driver.add_physical_device("physical_device_1"); + driver.add_physical_device("physical_device_2"); + driver.add_physical_device("physical_device_3"); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); @@ -431,14 +699,13 @@ TEST(EnumeratePhysicalDevices, OneCall) { TEST(EnumeratePhysicalDevices, TwoCall) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); - driver.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + 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}); const uint32_t real_device_count = 2; for (uint32_t i = 0; i < real_device_count; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i), i + 1); + driver.add_physical_device(std::string("physical_device_") + std::to_string(i)); driver.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); } @@ -458,14 +725,13 @@ TEST(EnumeratePhysicalDevices, TwoCall) { TEST(EnumeratePhysicalDevices, MatchOneAndTwoCallNumbers) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.set_min_icd_interface_version(5); - driver.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + 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}); const uint32_t real_device_count = 3; for (uint32_t i = 0; i < real_device_count; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i), i + 1); + driver.add_physical_device(std::string("physical_device_") + std::to_string(i)); driver.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); } @@ -495,13 +761,13 @@ TEST(EnumeratePhysicalDevices, MatchOneAndTwoCallNumbers) { TEST(EnumeratePhysicalDevices, TwoCallIncomplete) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); - driver.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + 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}); const uint32_t real_device_count = 2; for (uint32_t i = 0; i < real_device_count; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i), i + 1); + driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); driver.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); } @@ -553,8 +819,7 @@ TEST(EnumeratePhysicalDevices, ZeroPhysicalDevices) { TEST(EnumeratePhysicalDevices, ZeroPhysicalDevicesAfterCreateInstance) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)).set_min_icd_interface_version(5); InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(VK_API_VERSION_1_1); inst.CheckCreate(); @@ -576,8 +841,7 @@ TEST(EnumeratePhysicalDevices, ZeroPhysicalDevicesAfterCreateInstance) { TEST(EnumeratePhysicalDevices, CallTwiceNormal) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); for (size_t i = 0; i < 4; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); @@ -603,8 +867,7 @@ TEST(EnumeratePhysicalDevices, CallTwiceNormal) { TEST(EnumeratePhysicalDevices, CallTwiceIncompleteOnceNormal) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); for (size_t i = 0; i < 8; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); @@ -640,8 +903,7 @@ TEST(EnumeratePhysicalDevices, CallTwiceIncompleteOnceNormal) { TEST(EnumeratePhysicalDevices, CallThriceSuccessReduce) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); for (size_t i = 0; i < 8; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); @@ -677,8 +939,7 @@ TEST(EnumeratePhysicalDevices, CallThriceSuccessReduce) { TEST(EnumeratePhysicalDevices, CallThriceAddInBetween) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); driver.physical_devices.emplace_back("physical_device_0"); driver.physical_devices.emplace_back("physical_device_1"); @@ -717,8 +978,7 @@ TEST(EnumeratePhysicalDevices, CallThriceAddInBetween) { TEST(EnumeratePhysicalDevices, CallThriceRemoveInBetween) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); for (size_t i = 0; i < 4; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); @@ -774,8 +1034,7 @@ TEST(EnumeratePhysicalDevices, CallThriceRemoveInBetween) { TEST(EnumeratePhysicalDevices, MultipleAddRemoves) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).set_min_icd_interface_version(5); for (size_t i = 0; i < 4; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); @@ -906,30 +1165,15 @@ TEST(EnumeratePhysicalDevices, MultipleAddRemoves) { TEST(CreateDevice, ExtensionNotPresent) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; - - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - uint32_t familyCount = 0; - inst->vkGetPhysicalDeviceQueueFamilyProperties(phys_dev, &familyCount, nullptr); - ASSERT_EQ(familyCount, 1U); - - VkQueueFamilyProperties families; - inst->vkGetPhysicalDeviceQueueFamilyProperties(phys_dev, &familyCount, &families); - ASSERT_EQ(familyCount, 1U); - ASSERT_EQ(families, family_props.properties); - DeviceWrapper dev{inst}; - dev.create_info.add_extension("NotPresent").add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_extension("NotPresent"); dev.CheckCreate(phys_dev, VK_ERROR_EXTENSION_NOT_PRESENT); } @@ -939,43 +1183,115 @@ TEST(CreateDevice, ExtensionNotPresent) { // https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-layers-devicelayerdeprecation TEST(CreateDevice, LayersNotPresent) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; + VkPhysicalDevice phys_dev = inst.GetPhysDev(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); + DeviceWrapper dev{inst}; + dev.create_info.add_layer("NotPresent"); + + dev.CheckCreate(phys_dev); +} + +// Device layers are deprecated. +// Ensure that no error occur if instance and device are created with the same list of layers. +// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-layers-devicelayerdeprecation +TEST(CreateDevice, MatchInstanceAndDeviceLayers) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); + + const char* layer_name = "TestLayer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"); InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); inst.CheckCreate(); VkPhysicalDevice phys_dev = inst.GetPhysDev(); - uint32_t familyCount = 0; - inst->vkGetPhysicalDeviceQueueFamilyProperties(phys_dev, &familyCount, nullptr); - ASSERT_EQ(familyCount, 1U); + DeviceWrapper dev{inst}; + dev.create_info.add_layer(layer_name); - VkQueueFamilyProperties families; - inst->vkGetPhysicalDeviceQueueFamilyProperties(phys_dev, &familyCount, &families); - ASSERT_EQ(familyCount, 1U); - ASSERT_EQ(families, family_props.properties); + dev.CheckCreate(phys_dev); +} + +// Device layers are deprecated. +// Ensure that a message is generated when instance and device are created with different list of layers. +// At best , the user can list only instance layers in the device layer list +// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-layers-devicelayerdeprecation +TEST(CreateDevice, UnmatchInstanceAndDeviceLayers) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); + + const char* layer_name = "TestLayer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"); + + DebugUtilsLogger debug_log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT}; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, debug_log); + inst.CheckCreate(); + + DebugUtilsWrapper log{inst, VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT}; + CreateDebugUtilsMessenger(log); + + VkPhysicalDevice phys_dev = inst.GetPhysDev(); DeviceWrapper dev{inst}; - dev.create_info.add_layer("NotPresent").add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); + dev.create_info.add_layer(layer_name); + + dev.CheckCreate(phys_dev); + + ASSERT_TRUE( + log.find("loader_create_device_chain: Using deprecated and ignored 'ppEnabledLayerNames' member of 'VkDeviceCreateInfo' " + "when creating a Vulkan device.")); +} + +// Device layers are deprecated. +// Ensure that when VkInstanceCreateInfo is deleted, the check of the instance layer lists is running correctly during VkDevice +// creation +// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-layers-devicelayerdeprecation +TEST(CreateDevice, CheckCopyOfInstanceLayerNames) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); + + const char* layer_name = "TestLayer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"); + + InstWrapper inst{env.vulkan_functions}; + { + // We intentionally create a local InstanceCreateInfo that goes out of scope at the } so that when dev.CheckCreate is called + // the layer name pointers are no longer valid + InstanceCreateInfo create_info{}; + create_info.add_layer(layer_name); + inst.CheckCreateWithInfo(create_info); + } + + VkPhysicalDevice phys_dev = inst.GetPhysDev(); + + DeviceWrapper dev{inst}; + dev.create_info.add_layer(layer_name); dev.CheckCreate(phys_dev); } TEST(CreateDevice, ConsecutiveCreate) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; for (uint32_t i = 0; i < 100; i++) { driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); } InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); @@ -983,20 +1299,16 @@ TEST(CreateDevice, ConsecutiveCreate) { auto phys_devs = inst.GetPhysDevs(100); for (uint32_t i = 0; i < 100; i++) { DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_devs[i]); } } TEST(CreateDevice, ConsecutiveCreateWithoutDestruction) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true}; for (uint32_t i = 0; i < 100; i++) { driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().queue_family_properties.push_back(family_props); } InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); @@ -1007,7 +1319,6 @@ TEST(CreateDevice, ConsecutiveCreateWithoutDestruction) { for (uint32_t i = 0; i < 100; i++) { devices.emplace_back(inst); DeviceWrapper& dev = devices.back(); - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(0.0f)); dev.CheckCreate(phys_devs[i]); } @@ -1015,9 +1326,8 @@ TEST(CreateDevice, ConsecutiveCreateWithoutDestruction) { TEST(TryLoadWrongBinaries, WrongICD) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); env.add_icd(TestICDDetails(CURRENT_PLATFORM_DUMMY_BINARY_WRONG_TYPE).set_is_fake(true)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1027,7 +1337,7 @@ TEST(TryLoadWrongBinaries, WrongICD) { #if _WIN32 || _WIN64 ASSERT_TRUE(log.find("Failed to open dynamic library")); #endif -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) #if defined(__x86_64__) ASSERT_TRUE(log.find("wrong ELF class: ELFCLASS32")); #else @@ -1042,8 +1352,7 @@ TEST(TryLoadWrongBinaries, WrongICD) { TEST(TryLoadWrongBinaries, WrongExplicit) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name = "DummyLayerExplicit"; env.add_fake_explicit_layer( @@ -1051,13 +1360,8 @@ TEST(TryLoadWrongBinaries, WrongExplicit) { ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(CURRENT_PLATFORM_DUMMY_BINARY_WRONG_TYPE)), "dummy_test_layer.json"); - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - - std::array layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data()), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layer_name, layer_props[0].layerName)); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1068,18 +1372,17 @@ TEST(TryLoadWrongBinaries, WrongExplicit) { inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); // Should get an error message for the explicit layer -#ifndef __APPLE__ - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name) + std::string(" was wrong bit-type!"))); +#if !defined(__APPLE__) + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name) + std::string("\" was wrong bit-type!"))); #else // __APPLE__ // Apple only throws a wrong library type of error - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name) + std::string(" failed to load!"))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name) + std::string("\" failed to load!"))); #endif // __APPLE__ } TEST(TryLoadWrongBinaries, WrongImplicit) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name = "DummyLayerImplicit0"; env.add_fake_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -1088,13 +1391,8 @@ TEST(TryLoadWrongBinaries, WrongImplicit) { .set_disable_environment("DISABLE_ENV")), "dummy_test_layer.json"); - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - - std::array layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data()), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layer_name, layer_props[0].layerName)); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1104,19 +1402,18 @@ TEST(TryLoadWrongBinaries, WrongImplicit) { // application asking for them. inst.CheckCreate(VK_SUCCESS); -#ifndef __APPLE__ +#if !defined(__APPLE__) // Should get an info message for the bad implicit layer - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name) + std::string(" was wrong bit-type."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name) + std::string("\" was wrong bit-type."))); #else // __APPLE__ // Apple only throws a wrong library type of error - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name) + std::string(" failed to load."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name) + std::string("\" failed to load."))); #endif // __APPLE__ } TEST(TryLoadWrongBinaries, WrongExplicitAndImplicit) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name_0 = "DummyLayerExplicit"; env.add_fake_explicit_layer( @@ -1130,13 +1427,8 @@ TEST(TryLoadWrongBinaries, WrongExplicitAndImplicit) { .set_disable_environment("DISABLE_ENV")), "dummy_test_layer_1.json"); - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 2U); - - std::array layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data()), VK_SUCCESS); - ASSERT_EQ(layer_count, 2U); + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(check_permutation({layer_name_0, layer_name_1}, layer_props)); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1146,22 +1438,21 @@ TEST(TryLoadWrongBinaries, WrongExplicitAndImplicit) { // Explicit layer not found should generate a VK_ERROR_LAYER_NOT_PRESENT error message. inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); -#ifndef __APPLE__ +#if !defined(__APPLE__) // Should get error messages for both (the explicit is second and we don't want the implicit to return before the explicit // triggers a failure during vkCreateInstance) - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_0) + std::string(" was wrong bit-type!"))); - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_1) + std::string(" was wrong bit-type."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_0) + std::string("\" was wrong bit-type!"))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_1) + std::string("\" was wrong bit-type."))); #else // __APPLE__ // Apple only throws a wrong library type of error - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_0) + std::string(" failed to load!"))); - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_1) + std::string(" failed to load."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_0) + std::string("\" failed to load!"))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_1) + std::string("\" failed to load."))); #endif // __APPLE__ } TEST(TryLoadWrongBinaries, WrongExplicitAndImplicitErrorOnly) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name_0 = "DummyLayerExplicit"; env.add_fake_explicit_layer( @@ -1175,13 +1466,8 @@ TEST(TryLoadWrongBinaries, WrongExplicitAndImplicitErrorOnly) { .set_disable_environment("DISABLE_ENV")), "dummy_test_layer_1.json"); - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 2U); - - std::array layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data()), VK_SUCCESS); - ASSERT_EQ(layer_count, 2U); + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(check_permutation({layer_name_0, layer_name_1}, layer_props)); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1191,21 +1477,20 @@ TEST(TryLoadWrongBinaries, WrongExplicitAndImplicitErrorOnly) { // Explicit layer not found should generate a VK_ERROR_LAYER_NOT_PRESENT error message. inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); -#ifndef __APPLE__ +#if !defined(__APPLE__) // Should not get an error messages for either - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_0) + std::string(" was wrong bit-type!"))); - ASSERT_FALSE(log.find(std::string("Requested layer ") + std::string(layer_name_1) + std::string(" was wrong bit-type."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_0) + std::string("\" was wrong bit-type!"))); + ASSERT_FALSE(log.find(std::string("Requested layer \"") + std::string(layer_name_1) + std::string("\" was wrong bit-type."))); #else // __APPLE__ // Apple only throws a wrong library type of error - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_0) + std::string(" failed to load!"))); - ASSERT_FALSE(log.find(std::string("Requested layer ") + std::string(layer_name_1) + std::string(" failed to load."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_0) + std::string("\" failed to load!"))); + ASSERT_FALSE(log.find(std::string("Requested layer \"") + std::string(layer_name_1) + std::string("\" failed to load."))); #endif // __APPLE__ } TEST(TryLoadWrongBinaries, BadExplicit) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name = "DummyLayerExplicit"; env.add_fake_explicit_layer( @@ -1213,13 +1498,8 @@ TEST(TryLoadWrongBinaries, BadExplicit) { ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(CURRENT_PLATFORM_DUMMY_BINARY_BAD)), "dummy_test_layer.json"); - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - - std::array layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data()), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layer_name, layer_props[0].layerName)); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1230,13 +1510,12 @@ TEST(TryLoadWrongBinaries, BadExplicit) { inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); // Should get an error message for the bad explicit - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name) + std::string(" failed to load!"))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name) + std::string("\" failed to load!"))); } TEST(TryLoadWrongBinaries, BadImplicit) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name = "DummyLayerImplicit0"; env.add_fake_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -1245,13 +1524,8 @@ TEST(TryLoadWrongBinaries, BadImplicit) { .set_disable_environment("DISABLE_ENV")), "dummy_test_layer.json"); - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - - std::array layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data()), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); + auto layer_props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layer_name, layer_props[0].layerName)); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1262,13 +1536,12 @@ TEST(TryLoadWrongBinaries, BadImplicit) { inst.CheckCreate(VK_SUCCESS); // Should get an info message for the bad implicit - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name) + std::string(" failed to load."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name) + std::string("\" failed to load."))); } TEST(TryLoadWrongBinaries, BadExplicitAndImplicit) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); const char* layer_name_0 = "DummyLayerExplicit"; env.add_fake_explicit_layer( @@ -1282,13 +1555,8 @@ TEST(TryLoadWrongBinaries, BadExplicitAndImplicit) { .set_disable_environment("DISABLE_ENV")), "dummy_test_layer_1.json"); - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 2U); - - std::array layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, layer_props.data()), VK_SUCCESS); - ASSERT_EQ(layer_count, 2U); + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(check_permutation({layer_name_0, layer_name_1}, layer_props)); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1299,16 +1567,15 @@ TEST(TryLoadWrongBinaries, BadExplicitAndImplicit) { inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); // Apple only throws a wrong library type of error - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_0) + std::string(" failed to load!"))); - ASSERT_TRUE(log.find(std::string("Requested layer ") + std::string(layer_name_1) + std::string(" failed to load."))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_0) + std::string("\" failed to load!"))); + ASSERT_TRUE(log.find(std::string("Requested layer \"") + std::string(layer_name_1) + std::string("\" failed to load."))); } TEST(TryLoadWrongBinaries, WrongArchDriver) { FrameworkEnvironment env{}; // Intentionally set the wrong arch - env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}.icd_manifest.set_library_arch(sizeof(void*) == 4 ? "64" : "32")); - - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}.icd_manifest.set_library_arch(sizeof(void*) == 4 ? "64" : "32")) + .add_physical_device("physical_device_0"); DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT}; InstWrapper inst{env.vulkan_functions}; @@ -1321,8 +1588,7 @@ TEST(TryLoadWrongBinaries, WrongArchDriver) { TEST(TryLoadWrongBinaries, WrongArchLayer) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}); - env.get_test_icd().physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}).add_physical_device("physical_device_0"); const char* layer_name = "TestLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -1342,14 +1608,16 @@ TEST(TryLoadWrongBinaries, WrongArchLayer) { TEST(EnumeratePhysicalDeviceGroups, OneCall) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); - driver.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1) + .add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); // ICD contains 3 devices in two groups for (size_t i = 0; i < 3; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i), rand() % 50 + 3); + driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); driver.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } driver.physical_device_groups.emplace_back(driver.physical_devices[0]); driver.physical_device_groups.back().use_physical_device(driver.physical_devices[1]); @@ -1391,7 +1659,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]; @@ -1409,7 +1677,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); @@ -1427,8 +1695,7 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) { inst.create_info.add_extension(VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME); inst.CheckCreate(); - auto vkEnumeratePhysicalDeviceGroupsKHR = reinterpret_cast( - env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkEnumeratePhysicalDeviceGroupsKHR")); + PFN_vkEnumeratePhysicalDeviceGroupsKHR vkEnumeratePhysicalDeviceGroupsKHR = inst.load("vkEnumeratePhysicalDeviceGroupsKHR"); auto physical_devices = std::vector(max_physical_device_count); uint32_t returned_phys_dev_count = max_physical_device_count; @@ -1437,8 +1704,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}); ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data())); ASSERT_EQ(group_count, returned_group_count); @@ -1459,7 +1726,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]; @@ -1475,14 +1742,16 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) { TEST(EnumeratePhysicalDeviceGroups, TwoCall) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); - driver.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1) + .add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); // ICD contains 3 devices in two groups for (size_t i = 0; i < 3; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i), rand() % 50 + 3); + driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); driver.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } driver.physical_device_groups.emplace_back(driver.physical_devices[0]); driver.physical_device_groups.back().use_physical_device(driver.physical_devices[1]); @@ -1527,7 +1796,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]; @@ -1548,16 +1817,15 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) { ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDevices(inst, &returned_phys_dev_count, physical_devices.data())); handle_assert_has_values(physical_devices); - auto vkEnumeratePhysicalDeviceGroupsKHR = reinterpret_cast( - env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkEnumeratePhysicalDeviceGroupsKHR")); + PFN_vkEnumeratePhysicalDeviceGroupsKHR vkEnumeratePhysicalDeviceGroupsKHR = inst.load("vkEnumeratePhysicalDeviceGroupsKHR"); uint32_t group_count = static_cast(driver.physical_device_groups.size()); uint32_t returned_group_count = 0; 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}); ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data())); ASSERT_EQ(group_count, returned_group_count); @@ -1578,7 +1846,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]; @@ -1591,14 +1859,16 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) { TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); - driver.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1) + .add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); // ICD contains 3 devices in two groups for (size_t i = 0; i < 3; i++) { - driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i), rand() % 50 + 3); + driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); driver.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } driver.physical_device_groups.emplace_back(driver.physical_devices[0]); driver.physical_device_groups.back().use_physical_device(driver.physical_devices[1]); @@ -1642,7 +1912,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]; @@ -1658,8 +1928,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) { inst.create_info.add_extension("VK_KHR_device_group_creation"); inst.CheckCreate(); - auto vkEnumeratePhysicalDeviceGroupsKHR = reinterpret_cast( - env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkEnumeratePhysicalDeviceGroupsKHR")); + PFN_vkEnumeratePhysicalDeviceGroupsKHR vkEnumeratePhysicalDeviceGroupsKHR = inst.load("vkEnumeratePhysicalDeviceGroupsKHR"); uint32_t group_count = static_cast(driver.physical_device_groups.size()); uint32_t returned_group_count = 0; @@ -1667,13 +1936,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())); @@ -1693,7 +1962,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]; @@ -1708,14 +1977,16 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) { // vkEnumeratePhysicalDeviceGroupsKHR, and make sure they return the same info. TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); - driver.add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - driver.add_instance_extension({VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME}); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1) + .add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}) + .add_instance_extension({VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME}); // Generate the devices for (size_t i = 0; i < 6; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } // Generate the starting groups @@ -1731,7 +2002,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); @@ -1749,8 +2020,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) { ASSERT_EQ(VK_SUCCESS, inst->vkEnumeratePhysicalDeviceGroups(inst, &returned_group_count, core_group_props.data())); ASSERT_EQ(core_group_count, returned_group_count); - auto vkEnumeratePhysicalDeviceGroupsKHR = reinterpret_cast( - env.vulkan_functions.vkGetInstanceProcAddr(inst.inst, "vkEnumeratePhysicalDeviceGroupsKHR")); + PFN_vkEnumeratePhysicalDeviceGroupsKHR vkEnumeratePhysicalDeviceGroupsKHR = inst.load("vkEnumeratePhysicalDeviceGroupsKHR"); ext_group_count = static_cast(driver.physical_device_groups.size()); returned_group_count = 0; @@ -1758,7 +2028,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}); ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, ext_group_props.data())); ASSERT_EQ(ext_group_count, returned_group_count); @@ -1783,7 +2053,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]; @@ -1797,12 +2067,14 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) { // querying vkEnumeratePhysicalDeviceGroups before and after the add. TEST(EnumeratePhysicalDeviceGroups, CallThriceAddGroupInBetween) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1); // Generate the devices for (size_t i = 0; i < 7; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } // Generate the starting groups @@ -1860,7 +2132,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallThriceAddGroupInBetween) { for (uint32_t group2 = 0; group2 < group_props_after.size(); ++group2) { if (group_props_before[group1].physicalDeviceCount == group_props_after[group2].physicalDeviceCount) { uint32_t found_count = 0; - bool found; + bool found = false; for (uint32_t dev1 = 0; dev1 < group_props_before[group1].physicalDeviceCount; ++dev1) { found = false; for (uint32_t dev2 = 0; dev2 < group_props_after[group2].physicalDeviceCount; ++dev2) { @@ -1876,7 +2148,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]; @@ -1890,12 +2162,14 @@ TEST(EnumeratePhysicalDeviceGroups, CallThriceAddGroupInBetween) { // querying vkEnumeratePhysicalDeviceGroups before and after the remove. TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveGroupInBetween) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1); // Generate the devices for (size_t i = 0; i < 7; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } // Generate the starting groups @@ -1945,7 +2219,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveGroupInBetween) { for (uint32_t group2 = 0; group2 < group_props_before.size(); ++group2) { if (group_props_after[group1].physicalDeviceCount == group_props_before[group2].physicalDeviceCount) { uint32_t found_count = 0; - bool found; + bool found = false; for (uint32_t dev1 = 0; dev1 < group_props_after[group1].physicalDeviceCount; ++dev1) { found = false; for (uint32_t dev2 = 0; dev2 < group_props_before[group2].physicalDeviceCount; ++dev2) { @@ -1961,7 +2235,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]; @@ -1975,12 +2249,14 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveGroupInBetween) { // querying vkEnumeratePhysicalDeviceGroups before and after the add. TEST(EnumeratePhysicalDeviceGroups, CallTwiceAddDeviceInBetween) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1); // Generate the devices for (size_t i = 0; i < 7; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } // Generate the starting groups @@ -2027,7 +2303,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceAddDeviceInBetween) { for (uint32_t group1 = 0; group1 < group_props_before.size(); ++group1) { for (uint32_t group2 = 0; group2 < group_props_after.size(); ++group2) { uint32_t found_count = 0; - bool found; + bool found = false; for (uint32_t dev1 = 0; dev1 < group_props_before[group1].physicalDeviceCount; ++dev1) { found = false; for (uint32_t dev2 = 0; dev2 < group_props_after[group2].physicalDeviceCount; ++dev2) { @@ -2045,7 +2321,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]; @@ -2059,12 +2335,14 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceAddDeviceInBetween) { // querying vkEnumeratePhysicalDeviceGroups before and after the remove. TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveDeviceInBetween) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1); // Generate the devices for (size_t i = 0; i < 6; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } // Generate the starting groups @@ -2122,7 +2400,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveDeviceInBetween) { for (uint32_t group1 = 0; group1 < group_props_after.size(); ++group1) { for (uint32_t group2 = 0; group2 < group_props_before.size(); ++group2) { uint32_t found_count = 0; - bool found; + bool found = false; for (uint32_t dev1 = 0; dev1 < group_props_after[group1].physicalDeviceCount; ++dev1) { found = false; for (uint32_t dev2 = 0; dev2 < group_props_before[group2].physicalDeviceCount; ++dev2) { @@ -2140,7 +2418,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]; @@ -2154,12 +2432,14 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveDeviceInBetween) { // various devices and groups while querying in between. TEST(EnumeratePhysicalDeviceGroups, MultipleAddRemoves) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd().set_min_icd_interface_version(5).set_icd_api_version(VK_API_VERSION_1_1); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_min_icd_interface_version(5) + .set_icd_api_version(VK_API_VERSION_1_1); // Generate the devices for (size_t i = 0; i < 9; i++) { driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i)); + driver.physical_devices.back().properties.apiVersion = VK_API_VERSION_1_1; } // Generate the starting groups @@ -2256,7 +2536,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]; @@ -2267,8 +2547,8 @@ TEST(EnumeratePhysicalDeviceGroups, MultipleAddRemoves) { } // Fill in random but valid data into the device properties struct for the current physical device -static void FillInRandomDeviceProps(VkPhysicalDeviceProperties& props, VkPhysicalDeviceType dev_type, uint32_t api_vers, - uint32_t vendor, uint32_t device) { +void FillInRandomDeviceProps(VkPhysicalDeviceProperties& props, VkPhysicalDeviceType dev_type, uint32_t api_vers, uint32_t vendor, + uint32_t device) { props.apiVersion = api_vers; props.vendorID = vendor; props.deviceID = device; @@ -2294,18 +2574,18 @@ TEST(EnumeratePhysicalDeviceGroups, FakePNext) { // PhysDev 6: pd6, Discrete, Vulkan 1.1, Bus 2 // Group 0: PhysDev 5, PhysDev 6 // Group 1: PhysDev 4 - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_1)); auto& cur_icd_0 = env.get_test_icd(0); cur_icd_0.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_0.physical_devices.push_back({"pd0", 7}); + cur_icd_0.physical_devices.push_back({"pd0"}); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA001); - cur_icd_0.physical_devices.push_back({"pd1", 3}); + cur_icd_0.physical_devices.push_back({"pd1"}); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, VK_API_VERSION_1_1, 888, 0xAAA002); - cur_icd_0.physical_devices.push_back({"pd2", 6}); + cur_icd_0.physical_devices.push_back({"pd2"}); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA003); @@ -2315,18 +2595,18 @@ TEST(EnumeratePhysicalDeviceGroups, FakePNext) { .use_physical_device(cur_icd_0.physical_devices[2]); cur_icd_0.physical_device_groups.push_back({cur_icd_0.physical_devices[1]}); - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_1)); auto& cur_icd_1 = env.get_test_icd(1); cur_icd_1.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_1.physical_devices.push_back({"pd4", 1}); + cur_icd_1.physical_devices.push_back({"pd4"}); cur_icd_1.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_1.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC001); - cur_icd_1.physical_devices.push_back({"pd5", 4}); + cur_icd_1.physical_devices.push_back({"pd5"}); cur_icd_1.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_1.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC002); - cur_icd_1.physical_devices.push_back({"pd6", 2}); + cur_icd_1.physical_devices.push_back({"pd6"}); cur_icd_1.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_1.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC003); @@ -2340,14 +2620,13 @@ TEST(EnumeratePhysicalDeviceGroups, FakePNext) { inst.create_info.set_api_version(VK_API_VERSION_1_1); inst.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceProperties2")); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = inst.load("vkGetPhysicalDeviceProperties2"); ASSERT_NE(GetPhysDevProps2, nullptr); // NOTE: This is a fake struct to make sure the pNext chain is properly passed down to the ICD // vkEnumeratePhysicalDeviceGroups. // The two versions must match: - // "FakePNext" test in loader_regresion_tests.cpp + // "FakePNext" test in loader_regression_tests.cpp // "test_vkEnumeratePhysicalDeviceGroups" in test_icd.cpp struct FakePnextSharedWithICD { VkStructureType sType; @@ -2383,16 +2662,14 @@ TEST(ExtensionManual, ToolingProperties) { "No-Layer"}; { // No support in driver FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); auto phys_dev = inst.GetPhysDev(); - auto getToolProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceToolPropertiesEXT")); + PFN_vkGetPhysicalDeviceToolPropertiesEXT getToolProperties = inst.load("vkGetPhysicalDeviceToolPropertiesEXT"); handle_assert_has_value(getToolProperties); uint32_t tool_count = 0; @@ -2401,19 +2678,17 @@ TEST(ExtensionManual, ToolingProperties) { } { // extension is supported in driver FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().supports_tooling_info_ext = true; - env.get_test_icd().tooling_properties.push_back(icd_tool_props); - env.get_test_icd().physical_devices.back().extensions.push_back({VK_EXT_TOOLING_INFO_EXTENSION_NAME, 0}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)) + .set_supports_tooling_info_ext(true) + .add_tooling_property(icd_tool_props) + .add_physical_device(PhysicalDevice{}.add_extension(VK_EXT_TOOLING_INFO_EXTENSION_NAME).finish()); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); auto phys_dev = inst.GetPhysDev(); - auto getToolProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceToolPropertiesEXT")); + PFN_vkGetPhysicalDeviceToolPropertiesEXT getToolProperties = inst.load("vkGetPhysicalDeviceToolPropertiesEXT"); handle_assert_has_value(getToolProperties); uint32_t tool_count = 0; ASSERT_EQ(VK_SUCCESS, getToolProperties(phys_dev, &tool_count, nullptr)); @@ -2425,19 +2700,19 @@ TEST(ExtensionManual, ToolingProperties) { } { // core FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); - env.get_test_icd().physical_devices.back().properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 3, 0); - env.get_test_icd().supports_tooling_info_core = true; - env.get_test_icd().tooling_properties.push_back(icd_tool_props); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_API_VERSION_1_3)) + .add_physical_device({}) + .set_supports_tooling_info_core(true) + .add_tooling_property(icd_tool_props) + .physical_devices.back() + .properties.apiVersion = VK_MAKE_API_VERSION(0, 1, 3, 0); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); auto phys_dev = inst.GetPhysDev(); - auto getToolProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceToolProperties")); + PFN_vkGetPhysicalDeviceToolProperties getToolProperties = inst.load("vkGetPhysicalDeviceToolProperties"); handle_assert_has_value(getToolProperties); uint32_t tool_count = 0; ASSERT_EQ(VK_SUCCESS, getToolProperties(phys_dev, &tool_count, nullptr)); @@ -2469,42 +2744,48 @@ TEST(CreateInstance, InstanceNullExtensionPtr) { ASSERT_EQ(env.vulkan_functions.vkCreateInstance(&info, VK_NULL_HANDLE, &inst), VK_ERROR_EXTENSION_NOT_PRESENT); } -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__) // NOTE: Sort order only affects Linux TEST(SortedPhysicalDevices, DevicesSortEnabled10NoAppExt) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(0).physical_devices.push_back({"pd0", 7}); + env.get_test_icd(0).physical_devices.push_back({"pd0"}); + env.get_test_icd(0).physical_devices.back().set_pci_bus(7); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA001); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(0).physical_devices.push_back({"pd1", 3}); + env.get_test_icd(0).physical_devices.push_back({"pd1"}); + env.get_test_icd(0).physical_devices.back().set_pci_bus(3); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, VK_API_VERSION_1_1, 888, 0xAAA002); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(1).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(1).physical_devices.push_back({"pd2", 0}); + env.get_test_icd(1).physical_devices.push_back({"pd2"}); + env.get_test_icd(1).physical_devices.back().set_pci_bus(0); FillInRandomDeviceProps(env.get_test_icd(1).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_CPU, VK_API_VERSION_1_0, 1, 0xBBBB001); env.get_test_icd(1).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(2).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(2).physical_devices.push_back({"pd3", 1}); + env.get_test_icd(2).physical_devices.push_back({"pd3"}); + env.get_test_icd(2).physical_devices.back().set_pci_bus(1); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC001); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(2).physical_devices.push_back({"pd4", 4}); + env.get_test_icd(2).physical_devices.push_back({"pd4"}); + env.get_test_icd(2).physical_devices.back().set_pci_bus(4); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_0, 75, 0xCCCC002); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(3).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(3).physical_devices.push_back({"pd5", 0}); + env.get_test_icd(3).physical_devices.push_back({"pd5"}); + env.get_test_icd(3).physical_devices.back().set_pci_bus(0); FillInRandomDeviceProps(env.get_test_icd(3).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, VK_API_VERSION_1_1, 6940, 0xDDDD001); env.get_test_icd(3).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); @@ -2577,36 +2858,42 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled10AppExt) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(0).physical_devices.push_back({"pd0", 7}); + env.get_test_icd(0).physical_devices.push_back({"pd0"}); + env.get_test_icd(0).physical_devices.back().set_pci_bus(7); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA001); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(0).physical_devices.push_back({"pd1", 3}); + env.get_test_icd(0).physical_devices.push_back({"pd1"}); + env.get_test_icd(0).physical_devices.back().set_pci_bus(3); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, VK_API_VERSION_1_1, 888, 0xAAA002); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(1).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(1).physical_devices.push_back({"pd2", 0}); + env.get_test_icd(1).physical_devices.push_back({"pd2"}); + env.get_test_icd(1).physical_devices.back().set_pci_bus(0); FillInRandomDeviceProps(env.get_test_icd(1).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_CPU, VK_API_VERSION_1_0, 1, 0xBBBB001); env.get_test_icd(1).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(2).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(2).physical_devices.push_back({"pd3", 1}); + env.get_test_icd(2).physical_devices.push_back({"pd3"}); + env.get_test_icd(2).physical_devices.back().set_pci_bus(1); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC001); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(2).physical_devices.push_back({"pd4", 4}); + env.get_test_icd(2).physical_devices.push_back({"pd4"}); + env.get_test_icd(2).physical_devices.back().set_pci_bus(4); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_0, 75, 0xCCCC002); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(3).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(3).physical_devices.push_back({"pd5", 0}); + env.get_test_icd(3).physical_devices.push_back({"pd5"}); + env.get_test_icd(3).physical_devices.back().set_pci_bus(0); FillInRandomDeviceProps(env.get_test_icd(3).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, VK_API_VERSION_1_1, 6940, 0xDDDD001); env.get_test_icd(3).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); @@ -2615,8 +2902,7 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled10AppExt) { instance.create_info.add_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); instance.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2KHR")); + PFN_vkGetPhysicalDeviceProperties2KHR GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2KHR"); ASSERT_NE(GetPhysDevProps2, nullptr); const uint32_t max_phys_devs = 6; @@ -2695,11 +2981,13 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled11) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(0).set_icd_api_version(VK_API_VERSION_1_1); env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(0).physical_devices.push_back({"pd0", 7}); + env.get_test_icd(0).physical_devices.push_back({"pd0"}); + env.get_test_icd(0).physical_devices.back().set_pci_bus(7); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_0, 888, 0xAAA001); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(0).physical_devices.push_back({"pd1", 3}); + env.get_test_icd(0).physical_devices.push_back({"pd1"}); + env.get_test_icd(0).physical_devices.back().set_pci_bus(3); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, VK_API_VERSION_1_0, 888, 0xAAA002); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); @@ -2707,7 +2995,8 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled11) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(1).set_icd_api_version(VK_API_VERSION_1_1); env.get_test_icd(1).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(1).physical_devices.push_back({"pd2", 0}); + env.get_test_icd(1).physical_devices.push_back({"pd2"}); + env.get_test_icd(1).physical_devices.back().set_pci_bus(0); FillInRandomDeviceProps(env.get_test_icd(1).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_CPU, VK_API_VERSION_1_0, 1, 0xBBBB001); env.get_test_icd(1).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); @@ -2715,11 +3004,13 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled11) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(2).set_icd_api_version(VK_API_VERSION_1_1); env.get_test_icd(2).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(2).physical_devices.push_back({"pd3", 1}); + env.get_test_icd(2).physical_devices.push_back({"pd3"}); + env.get_test_icd(2).physical_devices.back().set_pci_bus(1); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC001); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(2).physical_devices.push_back({"pd4", 4}); + env.get_test_icd(2).physical_devices.push_back({"pd4"}); + env.get_test_icd(2).physical_devices.back().set_pci_bus(4); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC002); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); @@ -2727,7 +3018,8 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled11) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.get_test_icd(3).set_icd_api_version(VK_API_VERSION_1_1); env.get_test_icd(3).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(3).physical_devices.push_back({"pd5", 0}); + env.get_test_icd(3).physical_devices.push_back({"pd5"}); + env.get_test_icd(3).physical_devices.back().set_pci_bus(0); FillInRandomDeviceProps(env.get_test_icd(3).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, VK_API_VERSION_1_1, 6940, 0xDDDD001); env.get_test_icd(3).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); @@ -2736,8 +3028,7 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled11) { instance.create_info.set_api_version(VK_API_VERSION_1_1); instance.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - instance.functions->vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2")); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = instance.load("vkGetPhysicalDeviceProperties2"); ASSERT_NE(GetPhysDevProps2, nullptr); const uint32_t max_phys_devs = 6; @@ -2814,40 +3105,40 @@ TEST(SortedPhysicalDevices, DevicesSortEnabled11) { TEST(SortedPhysicalDevices, DevicesSortedDisabled) { FrameworkEnvironment env{}; - set_env_var("VK_LOADER_DISABLE_SELECT", "1"); + EnvVarWrapper disable_select_env_var{"VK_LOADER_DISABLE_SELECT", "1"}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(0).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(0).physical_devices.push_back({"pd0", 4}); + env.get_test_icd(0).physical_devices.push_back({"pd0"}); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_0, 888, 0xAAA001); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(0).physical_devices.push_back({"pd1", 3}); + env.get_test_icd(0).physical_devices.push_back({"pd1"}); FillInRandomDeviceProps(env.get_test_icd(0).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, VK_API_VERSION_1_0, 888, 0xAAA002); env.get_test_icd(0).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(1).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(1).physical_devices.push_back({"pd2", 0}); + env.get_test_icd(1).physical_devices.push_back({"pd2"}); FillInRandomDeviceProps(env.get_test_icd(1).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_CPU, VK_API_VERSION_1_0, 1, 0xBBBB001); env.get_test_icd(1).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(2).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(2).physical_devices.push_back({"pd3", 7}); + env.get_test_icd(2).physical_devices.push_back({"pd3"}); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_0, 75, 0xCCCC001); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); - env.get_test_icd(2).physical_devices.push_back({"pd4", 1}); + env.get_test_icd(2).physical_devices.push_back({"pd4"}); FillInRandomDeviceProps(env.get_test_icd(2).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_0, 75, 0xCCCC002); env.get_test_icd(2).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_0)); env.get_test_icd(3).add_instance_extension({VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME}); - env.get_test_icd(3).physical_devices.push_back({"pd5", 0}); + env.get_test_icd(3).physical_devices.push_back({"pd5"}); FillInRandomDeviceProps(env.get_test_icd(3).physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, VK_API_VERSION_1_0, 6940, 0xDDDD001); env.get_test_icd(3).physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); @@ -2917,8 +3208,6 @@ TEST(SortedPhysicalDevices, DevicesSortedDisabled) { for (uint32_t dev = 0; dev < device_count; ++dev) { ASSERT_EQ(physical_devices[dev], physical_devices_again[dev]); } - - remove_env_var("VK_LOADER_DISABLE_SELECT"); } TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) { @@ -2943,15 +3232,18 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_0 = env.get_test_icd(0); cur_icd_0.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_0.physical_devices.push_back({"pd0", 7}); + cur_icd_0.physical_devices.push_back({"pd0"}); + cur_icd_0.physical_devices.back().set_pci_bus(7); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA001); - cur_icd_0.physical_devices.push_back({"pd1", 3}); + cur_icd_0.physical_devices.push_back({"pd1"}); + cur_icd_0.physical_devices.back().set_pci_bus(3); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, VK_API_VERSION_1_1, 888, 0xAAA002); - cur_icd_0.physical_devices.push_back({"pd2", 6}); + cur_icd_0.physical_devices.push_back({"pd2"}); + cur_icd_0.physical_devices.back().set_pci_bus(6); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA003); @@ -2964,7 +3256,8 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_1 = env.get_test_icd(1); cur_icd_1.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_1.physical_devices.push_back({"pd3", 0}); + cur_icd_1.physical_devices.push_back({"pd3"}); + cur_icd_1.physical_devices.back().set_pci_bus(0); cur_icd_1.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_1.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_CPU, VK_API_VERSION_1_1, 1, 0xBBBB001); @@ -2972,15 +3265,18 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_2 = env.get_test_icd(2); cur_icd_2.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_2.physical_devices.push_back({"pd4", 1}); + cur_icd_2.physical_devices.push_back({"pd4"}); + cur_icd_2.physical_devices.back().set_pci_bus(1); cur_icd_2.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_2.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC001); - cur_icd_2.physical_devices.push_back({"pd5", 4}); + cur_icd_2.physical_devices.push_back({"pd5"}); + cur_icd_2.physical_devices.back().set_pci_bus(4); cur_icd_2.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_2.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC002); - cur_icd_2.physical_devices.push_back({"pd6", 2}); + cur_icd_2.physical_devices.push_back({"pd6"}); + cur_icd_2.physical_devices.back().set_pci_bus(2); cur_icd_2.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_2.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC003); @@ -2993,7 +3289,8 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_3 = env.get_test_icd(3); cur_icd_3.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_3.physical_devices.push_back({"pd7", 0}); + cur_icd_3.physical_devices.push_back({"pd7"}); + cur_icd_3.physical_devices.back().set_pci_bus(0); cur_icd_3.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_3.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, VK_API_VERSION_1_1, 6940, 0xDDDD001); @@ -3002,8 +3299,7 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) { inst.create_info.set_api_version(VK_API_VERSION_1_1); inst.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceProperties2")); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = inst.load("vkGetPhysicalDeviceProperties2"); ASSERT_NE(GetPhysDevProps2, nullptr); const uint32_t max_phys_devs = 8; @@ -3108,7 +3404,7 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedEnabled) { TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { FrameworkEnvironment env{}; - set_env_var("VK_LOADER_DISABLE_SELECT", "1"); + EnvVarWrapper disable_select_env_var{"VK_LOADER_DISABLE_SELECT", "1"}; // ICD 0: Vulkan 1.1 // PhysDev 0: pd0, Discrete, Vulkan 1.1, Bus 7 @@ -3129,15 +3425,15 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_0 = env.get_test_icd(0); cur_icd_0.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_0.physical_devices.push_back({"pd0", 7}); + cur_icd_0.physical_devices.push_back({"pd0"}); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA001); - cur_icd_0.physical_devices.push_back({"pd1", 3}); + cur_icd_0.physical_devices.push_back({"pd1"}); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, VK_API_VERSION_1_1, 888, 0xAAA002); - cur_icd_0.physical_devices.push_back({"pd2", 6}); + cur_icd_0.physical_devices.push_back({"pd2"}); cur_icd_0.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_0.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 888, 0xAAA003); @@ -3150,7 +3446,7 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_1 = env.get_test_icd(1); cur_icd_1.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_1.physical_devices.push_back({"pd3", 0}); + cur_icd_1.physical_devices.push_back({"pd3"}); cur_icd_1.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_1.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_CPU, VK_API_VERSION_1_1, 1, 0xBBBB001); @@ -3158,15 +3454,15 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_2 = env.get_test_icd(2); cur_icd_2.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_2.physical_devices.push_back({"pd4", 1}); + cur_icd_2.physical_devices.push_back({"pd4"}); cur_icd_2.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_2.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC001); - cur_icd_2.physical_devices.push_back({"pd5", 4}); + cur_icd_2.physical_devices.push_back({"pd5"}); cur_icd_2.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_2.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC002); - cur_icd_2.physical_devices.push_back({"pd6", 2}); + cur_icd_2.physical_devices.push_back({"pd6"}); cur_icd_2.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_2.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_API_VERSION_1_1, 75, 0xCCCC003); @@ -3179,7 +3475,7 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); auto& cur_icd_3 = env.get_test_icd(3); cur_icd_3.set_icd_api_version(VK_API_VERSION_1_1); - cur_icd_3.physical_devices.push_back({"pd7", 0}); + cur_icd_3.physical_devices.push_back({"pd7"}); cur_icd_3.physical_devices.back().extensions.push_back({VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, 0}); FillInRandomDeviceProps(cur_icd_3.physical_devices.back().properties, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, VK_API_VERSION_1_1, 6940, 0xDDDD001); @@ -3188,8 +3484,7 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { inst.create_info.set_api_version(VK_API_VERSION_1_1); inst.CheckCreate(); - auto GetPhysDevProps2 = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceProperties2")); + PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = inst.load("vkGetPhysicalDeviceProperties2"); ASSERT_NE(GetPhysDevProps2, nullptr); const uint32_t max_phys_devs = 8; @@ -3277,26 +3572,35 @@ TEST(SortedPhysicalDevices, DeviceGroupsSortedDisabled) { ASSERT_EQ(physical_device_groups[group].physicalDevices[dev], physical_device_groups_again[group].physicalDevices[dev]); } } - - remove_env_var("VK_LOADER_DISABLE_SELECT"); } -#endif // __linux__ || __FreeBSD__ || __OpenBSD__ +#endif // __linux__ || __FreeBSD__ || __OpenBSD__ || __GNU__ const char* portability_driver_warning = - "vkCreateInstance: Found drivers that contain devices which support the portability subset, but the " - "portability enumeration bit was not set! Applications that wish to enumerate portability drivers must set the " - "VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo flags and " - "enable the VK_KHR_portability_enumeration instance extension."; + "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 " + "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo " + "flags and enable the VK_KHR_portability_enumeration instance extension."; + +const char* portability_flag_missing = + "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 " + "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo " + "flags."; + +const char* portability_extension_missing = + "VkInstanceCreateInfo: If flags has the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit set, the " + "list of enabled extensions in ppEnabledExtensionNames must contain VK_KHR_portability_enumeration " + "[VUID-VkInstanceCreateInfo-flags-06559 ]" + "Applications that wish to enumerate portability drivers must enable the VK_KHR_portability_enumeration " + "instance extension."; TEST(PortabilityICDConfiguration, PortabilityICDOnly) { FrameworkEnvironment env{}; env.add_icd( - TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_is_portability_driver(true))); - - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.max_icd_interface_version = 1; + TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_is_portability_driver(true))) + .add_physical_device("physical_device_0") + .set_max_icd_interface_version(1); { // enable portability extension and flag InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); @@ -3315,6 +3619,8 @@ TEST(PortabilityICDConfiguration, PortabilityICDOnly) { DeviceWrapper dev_info{inst}; dev_info.CheckCreate(phys_dev); ASSERT_FALSE(log.find(portability_driver_warning)); + ASSERT_FALSE(log.find(portability_flag_missing)); + ASSERT_FALSE(log.find(portability_extension_missing)); } { // enable portability flag but not extension - shouldn't be able to create an instance when filtering is enabled InstWrapper inst{env.vulkan_functions}; @@ -3322,7 +3628,7 @@ TEST(PortabilityICDConfiguration, PortabilityICDOnly) { inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); - ASSERT_TRUE(env.debug_log.find(portability_driver_warning)); + ASSERT_TRUE(env.debug_log.find(portability_extension_missing)); } { // enable portability extension but not flag - shouldn't be able to create an instance when filtering is enabled InstWrapper inst{env.vulkan_functions}; @@ -3330,7 +3636,7 @@ TEST(PortabilityICDConfiguration, PortabilityICDOnly) { inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); - ASSERT_TRUE(env.debug_log.find(portability_driver_warning)); + ASSERT_TRUE(env.debug_log.find(portability_flag_missing)); } { // enable neither the portability extension or the flag - shouldn't be able to create an instance when filtering is enabled InstWrapper inst{env.vulkan_functions}; @@ -3455,38 +3761,25 @@ TEST(PortabilityICDConfiguration, PortabilityAndRegularICDCheckFlagsPassedIntoIC TEST(PortabilityICDConfiguration, PortabilityAndRegularICDPreInstanceFunctions) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA))); - env.add_icd( - TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_is_portability_driver(true))); - Extension first_ext{"VK_EXT_validation_features"}; // known instance extensions Extension second_ext{"VK_EXT_headless_surface"}; - env.get_test_icd().add_instance_extensions({first_ext, second_ext}); - - auto& driver0 = env.get_test_icd(0); - auto& driver1 = env.get_test_icd(1); - - driver0.physical_devices.emplace_back("physical_device_0"); - driver0.max_icd_interface_version = 1; - - driver1.physical_devices.emplace_back("portability_physical_device_1"); - driver1.max_icd_interface_version = 1; + env.add_icd(TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA))) + .add_physical_device("physical_device_0") + .set_max_icd_interface_version(1) + .add_instance_extensions({first_ext, second_ext}); + env.add_icd( + TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_is_portability_driver(true))) + .add_physical_device("portability_physical_device_1") + .set_max_icd_interface_version(1); { // check that enumerating instance extensions work with a portability driver present - uint32_t extension_count = 0; - std::array extensions; - ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, nullptr)); - ASSERT_EQ(extension_count, 5U); // return debug report & debug utils + our two extensions - - ASSERT_EQ(VK_SUCCESS, - env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &extension_count, extensions.data())); - ASSERT_EQ(extension_count, 5U); - // loader always adds the debug report & debug utils extensions - ASSERT_TRUE(first_ext.extensionName == extensions[0].extensionName); - ASSERT_TRUE(second_ext.extensionName == extensions[1].extensionName); - ASSERT_TRUE(string_eq("VK_EXT_debug_report", extensions[2].extensionName)); - ASSERT_TRUE(string_eq("VK_EXT_debug_utils", extensions[3].extensionName)); - ASSERT_TRUE(string_eq("VK_KHR_portability_enumeration", extensions[4].extensionName)); + 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())); + EXPECT_TRUE(string_eq(extensions.at(2).extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME)); + 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)); } const char* layer_name = "TestLayer"; @@ -3501,14 +3794,8 @@ TEST(PortabilityICDConfiguration, PortabilityAndRegularICDPreInstanceFunctions) VkPhysicalDevice phys_dev = inst.GetPhysDev(); { // LayersMatch - - uint32_t layer_count = 0; - ASSERT_EQ(env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &layer_count, nullptr), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - VkLayerProperties layer_props; - ASSERT_EQ(env.vulkan_functions.vkEnumerateDeviceLayerProperties(phys_dev, &layer_count, &layer_props), VK_SUCCESS); - ASSERT_EQ(layer_count, 1U); - ASSERT_TRUE(string_eq(layer_props.layerName, layer_name)); + auto layer_props = inst.GetActiveLayers(phys_dev, 1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, layer_name)); } { // Property count less than available VkLayerProperties layer_props; @@ -3518,13 +3805,584 @@ TEST(PortabilityICDConfiguration, PortabilityAndRegularICDPreInstanceFunctions) } } -#ifdef _WIN32 +#if defined(_WIN32) TEST(AppPackageDriverDiscovery, AppPackageTest) { FrameworkEnvironment env; - env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}.set_discovery_type(ManifestDiscoveryType::windows_app_package)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}.set_discovery_type(ManifestDiscoveryType::windows_app_package)) + .add_physical_device({}); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); +} + +// Make sure that stale layer manifests (path to nonexistant file) which have the same name as real manifests don't cause the real +// manifests to be skipped. Stale registry entries happen when a registry is written on layer/driver installation but not cleaned up +// when the corresponding manifest is removed from the file system. +TEST(DuplicateRegistryEntries, Layers) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2))); + + auto null_path = env.get_folder(ManifestLocation::null).location() / "test_layer.json"; + + env.platform_shim->add_manifest(ManifestCategory::explicit_layer, null_path.str()); + + const char* layer_name = "TestLayer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + inst.CheckCreate(); +} + +// Check that the de-duplication of drivers found in both PnP and generic Khronos/Vulkan/Drivers doesn't result in the same thing +// being added twice +TEST(DuplicateRegistryEntries, Drivers) { + FrameworkEnvironment env{}; + auto null_path = env.get_folder(ManifestLocation::null).location() / "test_icd_0.json"; + env.platform_shim->add_manifest(ManifestCategory::icd, null_path.str()); + + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA}.set_discovery_type(ManifestDiscoveryType::null_dir)) + .add_physical_device("physical_device_0") + .set_adapterLUID(_LUID{10, 1000}); + env.platform_shim->add_d3dkmt_adapter(D3DKMT_Adapter{0, _LUID{10, 1000}}.add_driver_manifest_path(env.get_icd_manifest_path())); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(std::string("Skipping adding of json file \"") + null_path.str() + + "\" from registry \"HKEY_LOCAL_MACHINE\\" VK_DRIVERS_INFO_REGISTRY_LOC + "\" to the list due to duplication")); +} +#endif + +TEST(LibraryLoading, SystemLocations) { + FrameworkEnvironment env{}; + EnvVarWrapper ld_library_path("LD_LIBRARY_PATH", env.get_folder(ManifestLocation::driver).location().str()); + ld_library_path.add_to_list(env.get_folder(ManifestLocation::explicit_layer).location().str()); + + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2).set_library_path_type(LibraryPathType::default_search_paths)) + .add_physical_device({}); + const char* fake_ext_name = "VK_FAKE_extension"; + driver.physical_devices.back().add_extension(fake_ext_name); + + const char* layer_name = "TestLayer"; + env.add_explicit_layer( + TestLayerDetails{ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "test_layer.json"} + .set_library_path_type(LibraryPathType::default_search_paths)); + + auto props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(props.at(0).layerName, layer_name)); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(layer_name); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + auto phys_dev = inst.GetPhysDev(); + + auto active_props = inst.GetActiveLayers(phys_dev, 1); + ASSERT_TRUE(string_eq(active_props.at(0).layerName, layer_name)); + + auto device_extensions = inst.EnumerateDeviceExtensions(phys_dev, 1); + ASSERT_TRUE(string_eq(device_extensions.at(0).extensionName, fake_ext_name)); +} + +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +// Check that valid symlinks do not cause the loader to crash when directly in an XDG env-var +TEST(ManifestDiscovery, ValidSymlinkInXDGEnvVar) { + FrameworkEnvironment env{FrameworkSettings{}.set_enable_default_search_paths(false)}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_discovery_type(ManifestDiscoveryType::override_folder)) + .add_physical_device({}); + auto driver_path = env.get_icd_manifest_path(0); + std::string symlink_name = "symlink_to_driver.json"; + fs::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name; + env.get_folder(ManifestLocation::driver_env_var).add_existing_file(symlink_name); + int res = symlink(driver_path.c_str(), symlink_path.c_str()); + ASSERT_EQ(res, 0); + EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", symlink_path.str()}; + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); +} + +// Check that valid symlinks do not cause the loader to crash +TEST(ManifestDiscovery, ValidSymlink) { + FrameworkEnvironment env{FrameworkSettings{}.set_enable_default_search_paths(false)}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_discovery_type(ManifestDiscoveryType::override_folder)) + .add_physical_device({}); + + auto driver_path = env.get_icd_manifest_path(0); + std::string symlink_name = "symlink_to_driver.json"; + fs::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name; + env.get_folder(ManifestLocation::driver_env_var).add_existing_file(symlink_name); + int res = symlink(driver_path.c_str(), symlink_path.c_str()); + ASSERT_EQ(res, 0); + + env.platform_shim->set_fake_path(ManifestCategory::icd, env.get_folder(ManifestLocation::driver_env_var).location()); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); +} + +// Check that invalid symlinks do not cause the loader to crash when directly in an XDG env-var +TEST(ManifestDiscovery, InvalidSymlinkXDGEnvVar) { + FrameworkEnvironment env{FrameworkSettings{}.set_enable_default_search_paths(false)}; + std::string symlink_name = "symlink_to_nothing.json"; + fs::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name; + fs::path invalid_driver_path = env.get_folder(ManifestLocation::driver).location() / "nothing_here.json"; + int res = symlink(invalid_driver_path.c_str(), symlink_path.c_str()); + ASSERT_EQ(res, 0); + env.get_folder(ManifestLocation::driver_env_var).add_existing_file(symlink_name); + + EnvVarWrapper xdg_config_dirs_env_var{symlink_path.str()}; + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); +} + +// Check that invalid symlinks do not cause the loader to crash +TEST(ManifestDiscovery, InvalidSymlink) { + FrameworkEnvironment env{FrameworkSettings{}.set_enable_default_search_paths(false)}; + std::string symlink_name = "symlink_to_nothing.json"; + fs::path symlink_path = env.get_folder(ManifestLocation::driver).location() / symlink_name; + fs::path invalid_driver_path = env.get_folder(ManifestLocation::driver_env_var).location() / "nothing_here.json"; + int res = symlink(invalid_driver_path.c_str(), symlink_path.c_str()); + ASSERT_EQ(res, 0); + env.get_folder(ManifestLocation::driver).add_existing_file(symlink_name); + + env.platform_shim->set_fake_path(ManifestCategory::icd, env.get_folder(ManifestLocation::driver_env_var).location()); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER); +} +#endif + +#if defined(__APPLE__) +// Add two drivers, one to the bundle and one to the system locations +TEST(ManifestDiscovery, AppleBundles) { + FrameworkEnvironment env{}; + env.setup_macos_bundle(); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_discovery_type(ManifestDiscoveryType::macos_bundle)); + env.get_test_icd(0).physical_devices.push_back({}); + env.get_test_icd(0).physical_devices.at(0).properties.deviceID = 1337; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.get_test_icd(1).physical_devices.push_back({}); + env.get_test_icd(1).physical_devices.at(0).properties.deviceID = 9999; + + InstWrapper inst{env.vulkan_functions}; + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + auto physical_devices = inst.GetPhysDevs(); + ASSERT_EQ(1, physical_devices.size()); + + // Verify that this is the 'right' GPU, aka the one from the bundle + VkPhysicalDeviceProperties props{}; + inst->vkGetPhysicalDeviceProperties(physical_devices[0], &props); + ASSERT_EQ(env.get_test_icd(0).physical_devices.at(0).properties.deviceID, props.deviceID); +} + +// Add two drivers, one to the bundle and one using the driver env-var +TEST(ManifestDiscovery, AppleBundlesEnvVarActive) { + FrameworkEnvironment env{}; + env.setup_macos_bundle(); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_discovery_type(ManifestDiscoveryType::macos_bundle)); + env.get_test_icd(0).physical_devices.push_back({}); + env.get_test_icd(0).physical_devices.at(0).properties.deviceID = 1337; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_discovery_type(ManifestDiscoveryType::env_var)); + env.get_test_icd(1).physical_devices.push_back({}); + env.get_test_icd(1).physical_devices.at(0).properties.deviceID = 9999; + + InstWrapper inst{env.vulkan_functions}; + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + auto physical_devices = inst.GetPhysDevs(); + ASSERT_EQ(1, physical_devices.size()); + + // Verify that this is the 'right' GPU, aka the one from the env-var + VkPhysicalDeviceProperties props{}; + inst->vkGetPhysicalDeviceProperties(physical_devices[0], &props); + ASSERT_EQ(env.get_test_icd(1).physical_devices.at(0).properties.deviceID, props.deviceID); +} +#endif + +TEST(LayerCreatesDevice, Basic) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer.json"); + env.get_test_layer().set_call_create_device_while_create_device_is_called(true); + env.get_test_layer().set_physical_device_index_to_use_during_create_device(0); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer2.json"); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + DeviceWrapper dev{inst}; + dev.CheckCreate(inst.GetPhysDev()); +} + +TEST(LayerCreatesDevice, DifferentPhysicalDevice) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.get_test_icd(0).physical_devices.emplace_back("Device0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.get_test_icd(1).physical_devices.emplace_back("Device1"); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer.json"); + env.get_test_layer().set_call_create_device_while_create_device_is_called(true); + env.get_test_layer().set_physical_device_index_to_use_during_create_device(1); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name2") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer2.json"); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); + + auto phys_devs = inst.GetPhysDevs(); + + DeviceWrapper dev{inst}; + dev.CheckCreate(phys_devs.at(0)); } + +TEST(Layer, pfnNextGetInstanceProcAddr_should_not_return_layers_own_functions) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer.json"); + env.get_test_layer(0).set_check_if_EnumDevExtProps_is_same_as_queried_function(true); + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + + auto phys_devs = inst.GetPhysDevs(); + + DeviceWrapper dev{inst}; + dev.CheckCreate(phys_devs.at(0)); +} + +TEST(Layer, LLP_LAYER_21) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer.json"); + env.get_test_layer(0).set_clobber_pInstance(true); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); +#if defined(WIN32) +#if defined(_WIN64) + ASSERT_DEATH( + inst.CheckCreate(), + testing::ContainsRegex( + R"(terminator_CreateInstance: Instance pointer \(................\) has invalid MAGIC value 0x00000000. Instance value )" + R"(possibly corrupted by active layer \(Policy #LLP_LAYER_21\))")); +#else + ASSERT_DEATH( + inst.CheckCreate(), + testing::ContainsRegex( + R"(terminator_CreateInstance: Instance pointer \(........\) has invalid MAGIC value 0x00000000. Instance value )" + R"(possibly corrupted by active layer \(Policy #LLP_LAYER_21\))")); +#endif +#else + ASSERT_DEATH( + inst.CheckCreate(), + testing::ContainsRegex( + R"(terminator_CreateInstance: Instance pointer \(0x[0-9A-Fa-f]+\) has invalid MAGIC value 0x00000000. Instance value )" + R"(possibly corrupted by active layer \(Policy #LLP_LAYER_21\))")); #endif +} + +TEST(Layer, LLP_LAYER_22) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name("implicit_layer_name") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")), + "implicit_test_layer.json"); + env.get_test_layer(0).set_clobber_pDevice(true); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_extension("VK_EXT_debug_utils"); + inst.CheckCreate(); + + DebugUtilsWrapper log{inst}; + CreateDebugUtilsMessenger(log); + + DeviceWrapper dev{inst}; +#if defined(WIN32) +#if defined(_WIN64) + ASSERT_DEATH( + dev.CheckCreate(inst.GetPhysDev()), + testing::ContainsRegex( + R"(terminator_CreateDevice: Device pointer \(................\) has invalid MAGIC value 0x00000000. The expected value is 0x10ADED040410ADED. Device value )" + R"(possibly corrupted by active layer \(Policy #LLP_LAYER_22\))")); +#else + ASSERT_DEATH( + dev.CheckCreate(inst.GetPhysDev()), + testing::ContainsRegex( + R"(terminator_CreateDevice: Device pointer \(........\) has invalid MAGIC value 0x00000000. The expected value is 0x10ADED040410ADED. Device value )" + R"(possibly corrupted by active layer \(Policy #LLP_LAYER_22\))")); +#endif +#else + ASSERT_DEATH( + dev.CheckCreate(inst.GetPhysDev()), + testing::ContainsRegex( + R"(terminator_CreateDevice: Device pointer \(0x[0-9A-Fa-f]+\) has invalid MAGIC value 0x00000000. The expected value is 0x10ADED040410ADED. Device value )" + R"(possibly corrupted by active layer \(Policy #LLP_LAYER_22\))")); +#endif +} + +TEST(InvalidManifest, ICD) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector invalid_jsons; + invalid_jsons.push_back(","); + invalid_jsons.push_back("{},[]"); + invalid_jsons.push_back("{ \"foo\":\"bar\", }"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": [], },"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": [{},] },"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": {\"fee\"} },"); + invalid_jsons.push_back("{\"\":\"bar\", \"baz\": {}"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": {\"fee\":1234, true, \"ab\":\"bc\"} },"); + + for (size_t i = 0; i < invalid_jsons.size(); i++) { + auto file_name = std::string("invalid_driver_") + std::to_string(i) + ".json"; + fs::path new_path = env.get_folder(ManifestLocation::driver).write_manifest(file_name, invalid_jsons[i]); + env.platform_shim->add_manifest(ManifestCategory::icd, new_path); + } + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); +} + +TEST(InvalidManifest, Layer) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + std::vector invalid_jsons; + invalid_jsons.push_back(","); + invalid_jsons.push_back("{},[]"); + invalid_jsons.push_back("{ \"foo\":\"bar\", }"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": [], },"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": [{},] },"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": {\"fee\"} },"); + invalid_jsons.push_back("{\"\":\"bar\", \"baz\": {}"); + invalid_jsons.push_back("{\"foo\":\"bar\", \"baz\": {\"fee\":1234, true, \"ab\":\"bc\"} },"); + + for (size_t i = 0; i < invalid_jsons.size(); i++) { + auto file_name = std::string("invalid_implicit_layer_") + std::to_string(i) + ".json"; + fs::path new_path = env.get_folder(ManifestLocation::implicit_layer).write_manifest(file_name, invalid_jsons[i]); + env.platform_shim->add_manifest(ManifestCategory::implicit_layer, new_path); + } + + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); +} +#if defined(WIN32) +void add_dxgi_adapter(FrameworkEnvironment& env, const char* name, LUID luid, uint32_t vendor_id) { + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_discovery_type(ManifestDiscoveryType::null_dir)); + driver.set_min_icd_interface_version(5); + driver.set_max_icd_interface_version(6); + driver.setup_WSI(); + driver.set_icd_api_version(VK_API_VERSION_1_1); + driver.physical_devices.emplace_back(name); + auto& pd0 = driver.physical_devices.back(); + pd0.properties.apiVersion = VK_API_VERSION_1_1; + + DXGI_ADAPTER_DESC1 desc{}; + desc.VendorId = known_driver_list.at(vendor_id).vendor_id; + desc.AdapterLuid = luid; + auto wide_name = conver_str_to_wstr(name); + wcsncpy_s(desc.Description, 128, wide_name.c_str(), wide_name.size()); + driver.set_adapterLUID(desc.AdapterLuid); + env.platform_shim->add_dxgi_adapter(GpuType::discrete, desc); + + env.platform_shim->add_d3dkmt_adapter( + D3DKMT_Adapter{static_cast(env.icds.size()) - 1U, desc.AdapterLuid}.add_driver_manifest_path( + env.get_icd_manifest_path(env.icds.size() - 1))); +} + +TEST(EnumerateAdapterPhysicalDevices, SameAdapterLUID_reordered) { + FrameworkEnvironment env; + + uint32_t physical_count = 3; + + // Physical devices are enumerate in reverse order to the drivers insertion into the test framework + add_dxgi_adapter(env, "physical_device_2", LUID{10, 100}, 2); + add_dxgi_adapter(env, "physical_device_1", LUID{20, 200}, 1); + add_dxgi_adapter(env, "physical_device_0", LUID{10, 100}, 2); + + { + uint32_t returned_physical_count = 0; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.setup_WSI().set_api_version(VK_API_VERSION_1_1); + inst.CheckCreate(); + + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, nullptr)); + ASSERT_EQ(physical_count, returned_physical_count); + std::vector physical_device_handles{returned_physical_count}; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, + physical_device_handles.data())); + ASSERT_EQ(physical_count, returned_physical_count); + + VkPhysicalDeviceProperties phys_dev_props[3]{}; + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[0], &(phys_dev_props[0])); + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[1], &(phys_dev_props[1])); + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[2], &(phys_dev_props[2])); + + EXPECT_TRUE(string_eq(phys_dev_props[0].deviceName, "physical_device_0")); + EXPECT_TRUE(string_eq(phys_dev_props[1].deviceName, "physical_device_2")); + // Because LUID{10,100} is encountered first, all physical devices which correspond to that LUID are enumerated before any + // other physical devices. + EXPECT_TRUE(string_eq(phys_dev_props[2].deviceName, "physical_device_1")); + + // Check that both devices do not report VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT + VkPhysicalDeviceLayeredDriverPropertiesMSFT layered_driver_properties_msft{}; + layered_driver_properties_msft.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; + VkPhysicalDeviceProperties2 props2{}; + props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + props2.pNext = (void*)&layered_driver_properties_msft; + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[0], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT); + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[1], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT); + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[2], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT); + } + // Set the first physical device that is enumerated to be a 'layered' driver so it should be swapped with the first physical + // device + env.get_test_icd(2).physical_devices.back().layered_driver_underlying_api = VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT; + { + uint32_t returned_physical_count = 0; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.setup_WSI().set_api_version(VK_API_VERSION_1_1); + inst.CheckCreate(); + + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, nullptr)); + ASSERT_EQ(physical_count, returned_physical_count); + std::vector physical_device_handles{returned_physical_count}; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, + physical_device_handles.data())); + ASSERT_EQ(physical_count, returned_physical_count); + + VkPhysicalDeviceProperties phys_dev_props[3]{}; + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[0], &(phys_dev_props[0])); + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[1], &(phys_dev_props[1])); + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[2], &(phys_dev_props[2])); + + // Because the 'last' driver has the layered_driver set to D3D12, the order is modified + EXPECT_TRUE(string_eq(phys_dev_props[0].deviceName, "physical_device_2")); + EXPECT_TRUE(string_eq(phys_dev_props[1].deviceName, "physical_device_0")); + // Because LUID{10,100} is encountered first, all physical devices which correspond to that LUID are enumerated before any + // other physical devices. + EXPECT_TRUE(string_eq(phys_dev_props[2].deviceName, "physical_device_1")); + + // Check that the correct physical device reports VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT + VkPhysicalDeviceLayeredDriverPropertiesMSFT layered_driver_properties_msft{}; + layered_driver_properties_msft.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; + VkPhysicalDeviceProperties2 props2{}; + props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + props2.pNext = (void*)&layered_driver_properties_msft; + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[0], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT); + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[1], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT); + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[2], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT); + } +} + +TEST(EnumerateAdapterPhysicalDevices, SameAdapterLUID_same_order) { + FrameworkEnvironment env; + + uint32_t physical_count = 3; + + // Physical devices are enumerate in reverse order to the drivers insertion into the test framework + add_dxgi_adapter(env, "physical_device_2", LUID{10, 100}, 2); + add_dxgi_adapter(env, "physical_device_1", LUID{20, 200}, 1); + add_dxgi_adapter(env, "physical_device_0", LUID{10, 100}, 2); + + // Set the last physical device that is enumerated last to be a 'layered' physical device - no swapping should occur + env.get_test_icd(0).physical_devices.back().layered_driver_underlying_api = VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT; + + uint32_t returned_physical_count = 0; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.setup_WSI().set_api_version(VK_API_VERSION_1_1); + inst.CheckCreate(); + + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, nullptr)); + ASSERT_EQ(physical_count, returned_physical_count); + std::vector physical_device_handles{returned_physical_count}; + ASSERT_EQ(VK_SUCCESS, + env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, physical_device_handles.data())); + ASSERT_EQ(physical_count, returned_physical_count); + + VkPhysicalDeviceProperties phys_dev_props[3]{}; + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[0], &(phys_dev_props[0])); + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[1], &(phys_dev_props[1])); + env.vulkan_functions.vkGetPhysicalDeviceProperties(physical_device_handles[2], &(phys_dev_props[2])); + + // Make sure that reordering doesn't occur if the MSFT layered driver appears second + EXPECT_TRUE(string_eq(phys_dev_props[0].deviceName, "physical_device_0")); + EXPECT_TRUE(string_eq(phys_dev_props[1].deviceName, "physical_device_2")); + // Because LUID{10,100} is encountered first, all physical devices which correspond to that LUID are enumerated before any + // other physical devices. + EXPECT_TRUE(string_eq(phys_dev_props[2].deviceName, "physical_device_1")); + + // Check that the correct physical device reports VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT + VkPhysicalDeviceLayeredDriverPropertiesMSFT layered_driver_properties_msft{}; + layered_driver_properties_msft.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; + VkPhysicalDeviceProperties2 props2{}; + props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + props2.pNext = (void*)&layered_driver_properties_msft; + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[0], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT); + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[1], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT); + + env.vulkan_functions.vkGetPhysicalDeviceProperties2(physical_device_handles[2], &props2); + EXPECT_EQ(layered_driver_properties_msft.underlyingAPI, VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT); +} +#endif // defined(WIN32) diff --git a/tests/loader_settings_tests.cpp b/tests/loader_settings_tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..03c01439eb7ef2e62b94d7621acd6d391e8c3f4a --- /dev/null +++ b/tests/loader_settings_tests.cpp @@ -0,0 +1,1704 @@ +/* + * Copyright (c) 2023 The Khronos Group Inc. + * Copyright (c) 2023 Valve Corporation + * Copyright (c) 2023 LunarG, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and/or associated documentation files (the "Materials"), to + * deal in the Materials without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Materials, and to permit persons to whom the Materials are + * furnished to do so, subject to the following conditions: + * + * The above copyright notice(s) and this permission notice shall be included in + * all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE + * USE OR OTHER DEALINGS IN THE MATERIALS. + * + * Author: Charles Giessen + */ + +#include "test_environment.h" + +std::string get_settings_location_log_message([[maybe_unused]] FrameworkEnvironment const& env, + [[maybe_unused]] bool use_secure = false) { + std::string s = "Using layer configurations found in loader settings from "; +#if defined(WIN32) + return s + env.get_folder(ManifestLocation::settings_location).location().str() + "\\vk_loader_settings.json"; +#elif COMMON_UNIX_PLATFORMS + 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 +} + +// Make sure settings layer is found and that a layer defined in it is loaded +TEST(SettingsFile, FileExist) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* regular_layer_name = "VK_LAYER_TestLayer_0"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(regular_layer_name) + .set_path(env.get_shimmed_layer_manifest_path().str()) + .set_control("on")))); + { + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + EXPECT_TRUE(string_eq(active_layer_props.at(0).layerName, regular_layer_name)); + } +} + +// Make sure that if the settings file is in a user local path, that it isn't used when running with elevated privileges +TEST(SettingsFile, SettingsInUnsecuredLocation) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* regular_layer_name = "VK_LAYER_TestLayer_0"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(regular_layer_name) + .set_path(env.get_layer_manifest_path().str()) + .set_control("on")))); + { + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + env.debug_log.clear(); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, regular_layer_name)); + } + env.platform_shim->set_elevated_privilege(true); + { + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } +} + +TEST(SettingsFile, SettingsInSecuredLocation) { + FrameworkEnvironment env{FrameworkSettings{}.set_secure_loader_settings(true)}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + const char* regular_layer_name = "VK_LAYER_TestLayer_0"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(regular_layer_name) + .set_path(env.get_layer_manifest_path().str()) + .set_control("on")))); + { + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env, true))); + env.debug_log.clear(); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, regular_layer_name)); + } + env.platform_shim->set_elevated_privilege(true); + { + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env, true))); + env.debug_log.clear(); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, regular_layer_name)); + } +} + +// Make sure settings file can have multiple sets of settings +TEST(SettingsFile, SupportsMultipleSetingsSimultaneously) { + FrameworkEnvironment env{}; + const char* app_specific_layer_name = "VK_LAYER_TestLayer_0"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(app_specific_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "VK_LAYER_app_specific.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + const char* global_layer_name = "VK_LAYER_TestLayer_1"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(global_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "VK_LAYER_global.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + env.update_loader_settings( + env.loader_settings + // configuration that matches the current executable path - but dont set the app-key just yet + .add_app_specific_setting(AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(app_specific_layer_name) + .set_path(env.get_layer_manifest_path(0).str()) + .set_control("on")) + .add_app_key("key0")) + // configuration that should never be used + .add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration( + LoaderSettingsLayerConfiguration{}.set_name("VK_LAYER_haha").set_path("/made/up/path").set_control("auto")) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name("VK_LAYER_haha2") + .set_path("/made/up/path2") + .set_control("auto")) + .add_app_key("key1") + .add_app_key("key2")) + // Add a global configuration + .add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(global_layer_name) + .set_path(env.get_layer_manifest_path(1).str()) + .set_control("on")))); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + { + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, global_layer_name)); + + // Check that the global config is used + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, global_layer_name)); + } + env.debug_log.clear(); + // Set one set to contain the current executable path + env.loader_settings.app_specific_settings.at(0).add_app_key(fs::fixup_backslashes_in_path(test_platform_executable_path())); + env.update_loader_settings(env.loader_settings); + { + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, app_specific_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, app_specific_layer_name)); + } +} + +// Make sure layers found through the settings file are enableable by environment variables +TEST(SettingsFile, LayerAutoEnabledByEnvVars) { + FrameworkEnvironment env{}; + env.loader_settings.set_file_format_version({1, 0, 0}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* layer_name = "VK_LAYER_automatic"; + env.add_explicit_layer( + TestLayerDetails{ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "layer_name.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + + env.update_loader_settings( + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name) + .set_path(env.get_layer_manifest_path(0).str()) + .set_control("auto")))); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + { + EnvVarWrapper instance_layers{"VK_INSTANCE_LAYERS", layer_name}; + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } + env.debug_log.clear(); + + { + EnvVarWrapper loader_layers_enable{"VK_LOADER_LAYERS_ENABLE", layer_name}; + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, layer_name)); + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name)); + } +} + +// Make sure layers are disallowed from loading if the settings file says so +TEST(SettingsFile, LayerDisablesImplicitLayer) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* implicit_layer_name = "VK_LAYER_Implicit_TestLayer"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("oof")), + "implicit_test_layer.json"); + + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("off") + .set_treat_as_implicit_manifest(true)))); + { + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } +} + +// Implicit layers should be reordered by the settings file +TEST(SettingsFile, ImplicitLayersDontInterfere) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* implicit_layer_name1 = "VK_LAYER_Implicit_TestLayer1"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("oof")), + "implicit_test_layer1.json"); + const char* implicit_layer_name2 = "VK_LAYER_Implicit_TestLayer2"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("oof")), + "implicit_test_layer2.json"); + // validate order when settings file is not present + { + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, implicit_layer_name2)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, implicit_layer_name2)); + } + // Now setup the settings file to contain a specific order + env.update_loader_settings(LoaderSettings{}.add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name1) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("auto") + .set_treat_as_implicit_manifest(true)) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name2) + .set_path(env.get_shimmed_layer_manifest_path(1).str()) + .set_control("auto") + .set_treat_as_implicit_manifest(true)))); + { + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, implicit_layer_name2)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, implicit_layer_name2)); + } + + // Flip the order and store the settings in the env for later use in the test + env.loader_settings = LoaderSettings{}.add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name2) + .set_path(env.get_shimmed_layer_manifest_path(1).str()) + .set_control("auto") + .set_treat_as_implicit_manifest(true)) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name1) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("auto") + .set_treat_as_implicit_manifest(true))); + env.update_loader_settings(env.loader_settings); + + { + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, implicit_layer_name1)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, implicit_layer_name1)); + } + + // Now add an explicit layer into the middle and verify that is in the correct location + const char* explicit_layer_name3 = "VK_LAYER_Explicit_TestLayer3"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name3).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer3.json"); + env.loader_settings.app_specific_settings.at(0).layer_configurations.insert( + env.loader_settings.app_specific_settings.at(0).layer_configurations.begin() + 1, + LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name3) + .set_path(env.get_shimmed_layer_manifest_path(2).str()) + .set_control("on")); + env.update_loader_settings(env.loader_settings); + { + auto layer_props = env.GetLayerProperties(3); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, explicit_layer_name3)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, implicit_layer_name1)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 3); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, explicit_layer_name3)); + ASSERT_TRUE(string_eq(layers.at(2).layerName, implicit_layer_name1)); + } +} + +// Make sure layers that are disabled can't be enabled by the application +TEST(SettingsFile, ApplicationEnablesIgnored) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* explicit_layer_name = "VK_LAYER_TestLayer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer.json"); + + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("off")))); + { + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.create_info.add_layer(explicit_layer_name); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT)); + } +} + +TEST(SettingsFile, LayerListIsEmpty) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* implicit_layer_name = "VK_LAYER_TestLayer"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("HeeHee")), + "regular_test_layer.json"); + + JsonWriter writer{}; + writer.StartObject(); + writer.AddKeyedString("file_format_version", "1.0.0"); + writer.StartKeyedObject("settings"); + writer.StartKeyedObject("layers"); + writer.EndObject(); + writer.EndObject(); + writer.EndObject(); + env.write_settings_file(writer.output); + + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); +} + +// If a settings file exists but contains no valid settings - don't consider it +TEST(SettingsFile, InvalidSettingsFile) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* explicit_layer_name = "VK_LAYER_TestLayer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer.json"); + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("foobarbaz")), + "implicit_test_layer.json"); + auto check_integrity = [&env, explicit_layer_name, implicit_layer_name]() { + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, explicit_layer_name)); + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.create_info.add_layer(explicit_layer_name); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, explicit_layer_name)); + }; + + { + std::fstream fuzzer_output_json_file{FUZZER_OUTPUT_JSON_FILE, std::ios_base::in}; + ASSERT_TRUE(fuzzer_output_json_file.is_open()); + std::stringstream fuzzer_output_json; + fuzzer_output_json << fuzzer_output_json_file.rdbuf(); + env.write_settings_file(fuzzer_output_json.str()); + + check_integrity(); + } + + // No actual settings + { + JsonWriter writer{}; + writer.StartObject(); + writer.AddKeyedString("file_format_version", "0.0.0"); + writer.EndObject(); + env.write_settings_file(writer.output); + + check_integrity(); + } + + { + JsonWriter writer{}; + writer.StartObject(); + writer.AddKeyedString("file_format_version", "0.0.0"); + writer.StartKeyedArray("settings_array"); + writer.EndArray(); + writer.StartKeyedObject("settings"); + writer.EndObject(); + writer.EndObject(); + env.write_settings_file(writer.output); + + check_integrity(); + } + + { + JsonWriter writer{}; + writer.StartObject(); + for (uint32_t i = 0; i < 3; i++) { + writer.StartKeyedArray("settings_array"); + writer.EndArray(); + writer.StartKeyedObject("boogabooga"); + writer.EndObject(); + writer.StartKeyedObject("settings"); + writer.EndObject(); + } + writer.EndObject(); + env.write_settings_file(writer.output); + + check_integrity(); + } +} + +// Unknown layers are put in the correct location +TEST(SettingsFile, UnknownLayersInRightPlace) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* explicit_layer_name1 = "VK_LAYER_TestLayer1"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name1).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer1.json"); + const char* implicit_layer_name1 = "VK_LAYER_ImplicitTestLayer1"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("foobarbaz")), + "implicit_test_layer1.json"); + const char* explicit_layer_name2 = "VK_LAYER_TestLayer2"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name2).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer2.json"); + const char* implicit_layer_name2 = "VK_LAYER_ImplicitTestLayer2"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("foobarbaz")), + "implicit_test_layer2.json"); + + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name2) + .set_path(env.get_shimmed_layer_manifest_path(2).str()) + .set_control("on")) + .add_layer_configuration(LoaderSettingsLayerConfiguration{}.set_control("unordered_layer_location")) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name2) + .set_path(env.get_shimmed_layer_manifest_path(3).str()) + .set_control("on") + .set_treat_as_implicit_manifest(true)))); + + auto layer_props = env.GetLayerProperties(4); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, explicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(3).layerName, implicit_layer_name2)); + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.create_info.add_layer(explicit_layer_name1); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 4); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, explicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(3).layerName, implicit_layer_name2)); +} + +// Settings file allows loading multiple layers with the same name - as long as the path is different +TEST(SettingsFile, MultipleLayersWithSameName) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* explicit_layer_name = "VK_LAYER_TestLayer"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name) + .set_description("0000") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer1.json"); + + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_name) + .set_description("1111") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer2.json"); + + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("on")) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(1).str()) + .set_control("on")))); + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name)); + ASSERT_TRUE(string_eq(layer_props.at(0).description, "0000")); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, explicit_layer_name)); + ASSERT_TRUE(string_eq(layer_props.at(1).description, "1111")); + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, explicit_layer_name)); + ASSERT_TRUE(string_eq(layers.at(0).description, "0000")); + ASSERT_TRUE(string_eq(layers.at(1).layerName, explicit_layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).description, "1111")); +} + +// Settings file shouldn't be able to cause the same layer from the same path twice +TEST(SettingsFile, MultipleLayersWithSamePath) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* explicit_layer_name = "VK_LAYER_TestLayer"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer1.json"); + + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("on")) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("on")))); + + auto layer_props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, explicit_layer_name)); +} + +// Settings contains a layer whose name doesn't match the one found in the layer manifest - make sure the layer from the settings +// file is removed +TEST(SettingsFile, MismatchedLayerNameAndManifestPath) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* manifest_explicit_layer_name = "VK_LAYER_MANIFEST_TestLayer"; + const char* settings_explicit_layer_name = "VK_LAYER_Settings_TestLayer"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(manifest_explicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer1.json"); + + const char* implicit_layer_name = "VK_LAYER_Implicit_TestLayer"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("oof")), + "implicit_test_layer.json"); + + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(settings_explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("on")))); + + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); +} + +// Settings file should take precedence over the meta layer, if present +TEST(SettingsFile, MetaLayerAlsoActivates) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* settings_explicit_layer_name = "VK_LAYER_Regular_TestLayer"; + env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(settings_explicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer.json"); + + const char* settings_implicit_layer_name = "VK_LAYER_RegularImplicit_TestLayer"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(settings_implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("AndISaidHey") + .set_enable_environment("WhatsGoingOn")), + "implicit_layer.json"); + + const char* component_explicit_layer_name1 = "VK_LAYER_Component_TestLayer1"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(component_explicit_layer_name1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "component_test_layer1.json")); + + const char* component_explicit_layer_name2 = "VK_LAYER_Component_TestLayer2"; + env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(component_explicit_layer_name2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "component_test_layer2.json")); + + const char* meta_layer_name1 = "VK_LAYER_meta_layer1"; + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer(ManifestLayer::LayerDescription{} + .set_name(meta_layer_name1) + .add_component_layer(component_explicit_layer_name2) + .add_component_layer(component_explicit_layer_name1) + .set_disable_environment("NotGonnaWork")), + "meta_test_layer.json"); + + const char* meta_layer_name2 = "VK_LAYER_meta_layer2"; + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer(ManifestLayer::LayerDescription{} + .set_name(meta_layer_name2) + .add_component_layer(component_explicit_layer_name1) + .set_disable_environment("ILikeTrains") + .set_enable_environment("BakedBeans")), + "not_automatic_meta_test_layer.json"); + + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(settings_explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("on") + .set_treat_as_implicit_manifest(false)) + .add_layer_configuration(LoaderSettingsLayerConfiguration{}.set_control("unordered_layer_location")) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(settings_implicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(1).str()) + .set_control("auto") + .set_treat_as_implicit_manifest(true)))); + { + EnvVarWrapper enable_meta_layer{"WhatsGoingOn", "1"}; + auto layer_props = env.GetLayerProperties(6); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, settings_explicit_layer_name)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, meta_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, meta_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(3).layerName, component_explicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(4).layerName, component_explicit_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(5).layerName, settings_implicit_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 5); + ASSERT_TRUE(string_eq(layers.at(0).layerName, settings_explicit_layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, component_explicit_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(2).layerName, component_explicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(3).layerName, meta_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(4).layerName, settings_implicit_layer_name)); + } + { + EnvVarWrapper enable_meta_layer{"BakedBeans", "1"}; + auto layer_props = env.GetLayerProperties(6); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, settings_explicit_layer_name)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, meta_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, meta_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(3).layerName, component_explicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(4).layerName, component_explicit_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(5).layerName, settings_implicit_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 5); + ASSERT_TRUE(string_eq(layers.at(0).layerName, settings_explicit_layer_name)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, component_explicit_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(2).layerName, component_explicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(3).layerName, meta_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(4).layerName, meta_layer_name2)); + } +} + +// Layers are correctly ordered by settings file. +TEST(SettingsFile, LayerOrdering) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* explicit_layer_name1 = "VK_LAYER_Regular_TestLayer1"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name1).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer1.json"); + + const char* explicit_layer_name2 = "VK_LAYER_Regular_TestLayer2"; + env.add_explicit_layer( + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name2).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer2.json"); + + const char* implicit_layer_name1 = "VK_LAYER_Implicit_TestLayer1"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("Domierigato")), + "implicit_layer1.json"); + + const char* implicit_layer_name2 = "VK_LAYER_Implicit_TestLayer2"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name2) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("Mistehrobato")), + "implicit_layer2.json"); + + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all")); + + std::vector layer_configs{4}; + layer_configs.at(0) + .set_name(explicit_layer_name1) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_control("on") + .set_treat_as_implicit_manifest(false); + layer_configs.at(1) + .set_name(explicit_layer_name2) + .set_path(env.get_shimmed_layer_manifest_path(1).str()) + .set_control("on") + .set_treat_as_implicit_manifest(false); + layer_configs.at(2) + .set_name(implicit_layer_name1) + .set_path(env.get_shimmed_layer_manifest_path(2).str()) + .set_control("on") + .set_treat_as_implicit_manifest(true); + layer_configs.at(3) + .set_name(implicit_layer_name2) + .set_path(env.get_shimmed_layer_manifest_path(3).str()) + .set_control("on") + .set_treat_as_implicit_manifest(true); + + std::sort(layer_configs.begin(), layer_configs.end()); + uint32_t permutation_count = 0; + do { + env.loader_settings.app_specific_settings.at(0).layer_configurations.clear(); + env.loader_settings.app_specific_settings.at(0).add_layer_configurations(layer_configs); + env.update_loader_settings(env.loader_settings); + + auto layer_props = env.GetLayerProperties(4); + for (uint32_t i = 0; i < 4; i++) { + ASSERT_TRUE(layer_configs.at(i).name == layer_props.at(i).layerName); + } + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto active_layers = inst.GetActiveLayers(inst.GetPhysDev(), 4); + for (uint32_t i = 0; i < 4; i++) { + ASSERT_TRUE(layer_configs.at(i).name == active_layers.at(i).layerName); + } + env.debug_log.clear(); + permutation_count++; + } while (std::next_permutation(layer_configs.begin(), layer_configs.end())); + ASSERT_EQ(permutation_count, 24U); // should be this many orderings +} + +TEST(SettingsFile, EnvVarsWork_VK_LAYER_PATH) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* explicit_layer_name1 = "VK_LAYER_Regular_TestLayer1"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name1).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer1.json"} + .set_discovery_type(ManifestDiscoveryType::env_var)); + + const char* implicit_layer_name1 = "VK_LAYER_Implicit_TestLayer1"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("Domierigato")), + "implicit_layer1.json"); + const char* non_env_var_layer_name2 = "VK_LAYER_Regular_TestLayer2"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(non_env_var_layer_name2).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer2.json"}); + + { + auto layer_props = env.GetLayerProperties(2); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, explicit_layer_name1)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name1)); + } + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.create_info.add_layer(explicit_layer_name1); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, explicit_layer_name1)); + } + env.update_loader_settings(env.loader_settings.add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(non_env_var_layer_name2) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(2).str())) + .add_layer_configuration(LoaderSettingsLayerConfiguration{}.set_control("unordered_layer_location")))); + { + auto layer_props = env.GetLayerProperties(3); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, non_env_var_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, explicit_layer_name1)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, non_env_var_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, implicit_layer_name1)); + } + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.create_info.add_layer(explicit_layer_name1); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 3); + ASSERT_TRUE(string_eq(layers.at(0).layerName, non_env_var_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(2).layerName, explicit_layer_name1)); + } +} + +TEST(SettingsFile, EnvVarsWork_VK_ADD_LAYER_PATH) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* implicit_layer_name1 = "VK_LAYER_Implicit_TestLayer1"; + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("Domierigato")), + "implicit_layer1.json"); + const char* explicit_layer_name1 = "VK_LAYER_Regular_TestLayer1"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name1).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer1.json"} + .set_discovery_type(ManifestDiscoveryType::add_env_var)); + const char* non_env_var_layer_name2 = "VK_LAYER_Regular_TestLayer2"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(non_env_var_layer_name2).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer2.json"}); + + { + auto layer_props = env.GetLayerProperties(3); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, explicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, non_env_var_layer_name2)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name1)); + } + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.create_info.add_layer(explicit_layer_name1); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 2); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, explicit_layer_name1)); + } + + env.update_loader_settings(env.loader_settings.add_app_specific_setting( + AppSpecificSettings{} + .add_stderr_log_filter("all") + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name1) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(1).str())) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(non_env_var_layer_name2) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(2).str())) + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name1) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true)))); + { + auto layer_props = env.GetLayerProperties(3); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name1)); + ASSERT_TRUE(string_eq(layer_props.at(1).layerName, non_env_var_layer_name2)); + ASSERT_TRUE(string_eq(layer_props.at(2).layerName, implicit_layer_name1)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 3); + ASSERT_TRUE(string_eq(layers.at(0).layerName, explicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, non_env_var_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(2).layerName, implicit_layer_name1)); + } + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.create_info.add_layer(explicit_layer_name1); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 3); + ASSERT_TRUE(string_eq(layers.at(0).layerName, explicit_layer_name1)); + ASSERT_TRUE(string_eq(layers.at(1).layerName, non_env_var_layer_name2)); + ASSERT_TRUE(string_eq(layers.at(2).layerName, implicit_layer_name1)); + } +} + +TEST(SettingsFile, EnvVarsWork_VK_INSTANCE_LAYERS) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* explicit_layer_name = "VK_LAYER_Regular_TestLayer1"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer1.json"}); + + { + EnvVarWrapper vk_instance_layers{"VK_INSTANCE_LAYERS", explicit_layer_name}; + auto layer_props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_FALSE(env.debug_log.find(get_settings_location_log_message(env))); + auto layer = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layer.at(0).layerName, explicit_layer_name)); + } + env.update_loader_settings( + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_control("off") + .set_path(env.get_shimmed_layer_manifest_path(0).str())))); + { + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + { + EnvVarWrapper vk_instance_layers{"VK_INSTANCE_LAYERS", explicit_layer_name}; + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } +} +// Make sure that layers disabled by settings file aren't enabled by VK_LOADER_LAYERS_ENABLE +TEST(SettingsFile, EnvVarsWork_VK_LOADER_LAYERS_ENABLE) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* explicit_layer_name = "VK_LAYER_Regular_TestLayer1"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer1.json"}); + + env.update_loader_settings( + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_control("off") + .set_path(env.get_shimmed_layer_manifest_path(0).str())))); + + EnvVarWrapper vk_instance_layers{"VK_LOADER_LAYERS_ENABLE", explicit_layer_name}; + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); +} +// Make sure that layers enabled by settings file aren't disabled by VK_LOADER_LAYERS_ENABLE +TEST(SettingsFile, EnvVarsWork_VK_LOADER_LAYERS_DISABLE) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + + const char* explicit_layer_name = "VK_LAYER_Regular_TestLayer1"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer1.json"}); + + env.update_loader_settings( + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str())))); + + EnvVarWrapper vk_instance_layers{"VK_LOADER_LAYERS_DISABLE", explicit_layer_name}; + auto layer_props = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); +} + +#if defined(WIN32) +TEST(SettingsFile, MultipleKeysInRegistryInUnsecureLocation) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + env.platform_shim->add_unsecured_manifest(ManifestCategory::settings, "jank_path"); + env.platform_shim->add_unsecured_manifest(ManifestCategory::settings, "jank_path2"); + + const char* regular_layer_name = "VK_LAYER_TestLayer_0"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(regular_layer_name) + .set_path(env.get_layer_manifest_path().str()) + .set_control("on")))); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + env.debug_log.clear(); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, regular_layer_name)); +} + +TEST(SettingsFile, MultipleKeysInRegistryInSecureLocation) { + FrameworkEnvironment env{FrameworkSettings{}.set_secure_loader_settings(true)}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + env.platform_shim->add_manifest(ManifestCategory::settings, "jank_path"); + env.platform_shim->add_manifest(ManifestCategory::settings, "jank_path2"); + + const char* regular_layer_name = "VK_LAYER_TestLayer_0"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(regular_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "regular_test_layer.json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(regular_layer_name) + .set_path(env.get_layer_manifest_path().str()) + .set_control("on")))); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + + // Make sure it works if the settings file is in the HKEY_LOCAL_MACHINE + env.platform_shim->set_elevated_privilege(true); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + { + auto layer_props = env.GetLayerProperties(1); + EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name)); + + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + env.debug_log.clear(); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, regular_layer_name)); + } +} +#endif + +// Preinstance functions respect the settings file +TEST(SettingsFile, PreInstanceFunctions) { + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + + env.add_implicit_layer( + ManifestLayer{}.set_file_format_version({1, 1, 2}).add_layer( + ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceLayerProperties") + .set_override_name("test_preinst_vkEnumerateInstanceLayerProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceExtensionProperties") + .set_override_name("test_preinst_vkEnumerateInstanceExtensionProperties")) + .add_pre_instance_function(ManifestLayer::LayerDescription::FunctionOverride{} + .set_vk_func("vkEnumerateInstanceVersion") + .set_override_name("test_preinst_vkEnumerateInstanceVersion"))), + "implicit_test_layer.json"); + + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name) + .set_control("on") + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true))); + env.update_loader_settings(env.loader_settings); + { + auto& layer = env.get_test_layer(0); + // Check layer props + uint32_t layer_props = 43; + layer.set_reported_layer_props(layer_props); + + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); + ASSERT_EQ(count, layer_props); + + // check extension props + uint32_t ext_props = 52; + layer.set_reported_extension_props(ext_props); + count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); + ASSERT_EQ(count, ext_props); + + // check version + uint32_t layer_version = VK_MAKE_API_VERSION(1, 2, 3, 4); + layer.set_reported_instance_version(layer_version); + + uint32_t version = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); + ASSERT_EQ(version, layer_version); + } + // control is set to off + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + + { + auto& layer = env.get_test_layer(0); + // Check layer props + uint32_t layer_props = 43; + layer.set_reported_layer_props(layer_props); + + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); + ASSERT_EQ(count, 0U); // dont use the intercepted count + + // check extension props + uint32_t ext_props = 52; + layer.set_reported_extension_props(ext_props); + count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); + ASSERT_EQ(count, 4U); // dont use the intercepted count - use default count + + // check version + uint32_t layer_version = VK_MAKE_API_VERSION(1, 2, 3, 4); + layer.set_reported_instance_version(layer_version); + + uint32_t version = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); + ASSERT_EQ(version, VK_HEADER_VERSION_COMPLETE); + } + + // control is set to auto + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + + { + auto& layer = env.get_test_layer(0); + // Check layer props + uint32_t layer_props = 43; + layer.set_reported_layer_props(layer_props); + + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr)); + ASSERT_EQ(count, layer_props); + + // check extension props + uint32_t ext_props = 52; + layer.set_reported_extension_props(ext_props); + count = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr)); + ASSERT_EQ(count, ext_props); + + // check version + uint32_t layer_version = VK_MAKE_API_VERSION(1, 2, 3, 4); + layer.set_reported_instance_version(layer_version); + + uint32_t version = 0; + ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceVersion(&version)); + ASSERT_EQ(version, layer_version); + } +} + +// If an implicit layer's disable environment variable is set, but the settings file says to turn the layer on, the layer should be +// activated. +TEST(SettingsFile, ImplicitLayerDisableEnvironmentVariableOverriden) { + auto check_log_for_insert_instance_layer_string = [](FrameworkEnvironment& env, const char* implicit_layer_name, + bool check_for_enable) { + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(VK_SUCCESS); + if (check_for_enable) { + ASSERT_TRUE(env.debug_log.find(std::string("Insert instance layer \"") + implicit_layer_name)); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1); + ASSERT_TRUE(string_eq(layers.at(0).layerName, implicit_layer_name)); + } else { + ASSERT_FALSE(env.debug_log.find(std::string("Insert instance layer \"") + implicit_layer_name)); + ASSERT_NO_FATAL_FAILURE(inst.GetActiveLayers(inst.GetPhysDev(), 0)); + } + } + env.debug_log.clear(); + }; + + FrameworkEnvironment env; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + const char* implicit_layer_name = "VK_LAYER_ImplicitTestLayer"; + + env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME") + .set_enable_environment("ENABLE_ME")), + "implicit_test_layer.json"); + env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(implicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path(0).str()) + .set_treat_as_implicit_manifest(true))); + + // control is set to on + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("on"); + env.update_loader_settings(env.loader_settings); + { + EnvVarWrapper enable_env_var{"ENABLE_ME"}; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; + + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); + + check_log_for_insert_instance_layer_string(env, implicit_layer_name, true); + + enable_env_var.set_new_value("0"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, true); + + enable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, true); + + enable_env_var.remove_value(); + + disable_env_var.set_new_value("0"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, true); + + disable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, true); + + enable_env_var.set_new_value("1"); + disable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, true); + } + + // control is set to off + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("off"); + env.update_loader_settings(env.loader_settings); + { + EnvVarWrapper enable_env_var{"ENABLE_ME"}; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; + + ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0)); + + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + enable_env_var.set_new_value("0"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + enable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + enable_env_var.remove_value(); + + disable_env_var.set_new_value("0"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + disable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + enable_env_var.set_new_value("1"); + disable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + } + + // control is set to auto + env.loader_settings.app_specific_settings.at(0).layer_configurations.at(0).set_control("auto"); + env.update_loader_settings(env.loader_settings); + { + EnvVarWrapper enable_env_var{"ENABLE_ME"}; + EnvVarWrapper disable_env_var{"DISABLE_ME"}; + + auto layers = env.GetLayerProperties(1); + ASSERT_TRUE(string_eq(layers[0].layerName, implicit_layer_name)); + + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + enable_env_var.set_new_value("0"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + enable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, true); + + enable_env_var.remove_value(); + + disable_env_var.set_new_value("0"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + disable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + + enable_env_var.set_new_value("1"); + disable_env_var.set_new_value("1"); + check_log_for_insert_instance_layer_string(env, implicit_layer_name, false); + } +} + +// Settings can say which filters to use - make sure those are propagated & treated correctly +TEST(SettingsFile, StderrLogFilters) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + const char* explicit_layer_name = "Regular_TestLayer1"; + env.add_explicit_layer(TestLayerDetails{ + ManifestLayer{}.add_layer( + ManifestLayer::LayerDescription{}.set_name(explicit_layer_name).set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + "explicit_test_layer1.json"}); + env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{} + .add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(explicit_layer_name) + .set_path(env.get_shimmed_layer_manifest_path().str()) + .set_control("on")) + .add_layer_configuration( + LoaderSettingsLayerConfiguration{}.set_name("VK_LAYER_missing").set_path("/road/to/nowhere").set_control("on")))); + + std::string expected_output_verbose; + expected_output_verbose += "Layer Configurations count = 2\n"; + expected_output_verbose += "---- Layer Configuration [0] ----\n"; + expected_output_verbose += std::string("Name: ") + explicit_layer_name + "\n"; + expected_output_verbose += "Path: " + env.get_shimmed_layer_manifest_path().str() + "\n"; + expected_output_verbose += "Control: on\n"; + expected_output_verbose += "---- Layer Configuration [1] ----\n"; + expected_output_verbose += "Name: VK_LAYER_missing\n"; + expected_output_verbose += "Path: /road/to/nowhere\n"; + expected_output_verbose += "Control: on\n"; + expected_output_verbose += "---------------------------------\n"; + + std::string expected_output_info = get_settings_location_log_message(env) + "\n"; + + std::string expected_output_warning = + "Layer name Regular_TestLayer1 does not conform to naming standard (Policy #LLP_LAYER_3)\n"; + + std::string expected_output_error = "loader_get_json: Failed to open JSON file /road/to/nowhere\n"; + + env.loader_settings.app_specific_settings.at(0).stderr_log = {"all"}; + env.update_loader_settings(env.loader_settings); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(expected_output_verbose)); + ASSERT_TRUE(env.debug_log.find(expected_output_info)); + ASSERT_TRUE(env.debug_log.find(expected_output_warning)); + ASSERT_TRUE(env.debug_log.find(expected_output_error)); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + EXPECT_TRUE(string_eq(active_layer_props.at(0).layerName, explicit_layer_name)); + } + env.debug_log.clear(); + env.debug_log.create_info.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT; + env.loader_settings.app_specific_settings.at(0).stderr_log = {"info"}; + env.update_loader_settings(env.loader_settings); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(expected_output_verbose)); + ASSERT_FALSE(env.debug_log.find(expected_output_info)); + ASSERT_FALSE(env.debug_log.find(expected_output_warning)); + ASSERT_FALSE(env.debug_log.find(expected_output_error)); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + EXPECT_TRUE(string_eq(active_layer_props.at(0).layerName, explicit_layer_name)); + } + env.debug_log.clear(); + env.debug_log.create_info.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT; + env.loader_settings.app_specific_settings.at(0).stderr_log = {"debug"}; + env.update_loader_settings(env.loader_settings); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_FALSE(env.debug_log.find(expected_output_verbose)); + ASSERT_TRUE(env.debug_log.find(expected_output_info)); + ASSERT_FALSE(env.debug_log.find(expected_output_warning)); + ASSERT_FALSE(env.debug_log.find(expected_output_error)); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + EXPECT_TRUE(string_eq(active_layer_props.at(0).layerName, explicit_layer_name)); + } + env.debug_log.clear(); + env.debug_log.create_info.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT; + env.loader_settings.app_specific_settings.at(0).stderr_log = {"warn"}; + env.update_loader_settings(env.loader_settings); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_FALSE(env.debug_log.find(expected_output_verbose)); + ASSERT_FALSE(env.debug_log.find(expected_output_info)); + ASSERT_TRUE(env.debug_log.find(expected_output_warning)); + ASSERT_FALSE(env.debug_log.find(expected_output_error)); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + EXPECT_TRUE(string_eq(active_layer_props.at(0).layerName, explicit_layer_name)); + } + env.debug_log.clear(); + env.debug_log.create_info.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT; + env.loader_settings.app_specific_settings.at(0).stderr_log = {"error"}; + env.update_loader_settings(env.loader_settings); + { + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_FALSE(env.debug_log.find(expected_output_verbose)); + ASSERT_FALSE(env.debug_log.find(expected_output_info)); + ASSERT_FALSE(env.debug_log.find(expected_output_warning)); + ASSERT_TRUE(env.debug_log.find(expected_output_error)); + auto active_layer_props = inst.GetActiveLayers(inst.GetPhysDev(), 1); + EXPECT_TRUE(string_eq(active_layer_props.at(0).layerName, explicit_layer_name)); + } +} + +// Enough layers exist that arrays need to be resized - make sure that works +TEST(SettingsFile, TooManyLayers) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({}); + env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting( + AppSpecificSettings{}.add_stderr_log_filter("all")); + std::string layer_name = "VK_LAYER_regular_layer_name_"; + uint32_t layer_count = 40; + for (uint32_t i = 0; i < layer_count; i++) { + env.add_explicit_layer(TestLayerDetails{ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} + .set_name(layer_name + std::to_string(i)) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)), + layer_name + std::to_string(i) + ".json"} + .set_discovery_type(ManifestDiscoveryType::override_folder)); + env.loader_settings.app_specific_settings.at(0).add_layer_configuration(LoaderSettingsLayerConfiguration{} + .set_name(layer_name + std::to_string(i)) + .set_path(env.get_layer_manifest_path(i).str()) + .set_control("on")); + } + env.update_loader_settings(env.loader_settings); + + { + auto layer_props = env.GetLayerProperties(40); + for (uint32_t i = 0; i < layer_count; i++) { + std::string expected_layer_name = layer_name + std::to_string(i); + EXPECT_TRUE(string_eq(layer_props.at(i).layerName, expected_layer_name.c_str())); + } + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + env.debug_log.clear(); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 40); + for (uint32_t i = 0; i < layer_count; i++) { + std::string expected_layer_name = layer_name + std::to_string(i); + EXPECT_TRUE(string_eq(layers.at(i).layerName, expected_layer_name.c_str())); + } + } + env.loader_settings.app_specific_settings.at(0).layer_configurations.clear(); + + // Now reverse the order to make sure adding the 'last' layer first works + for (uint32_t i = 0; i < layer_count; i++) { + env.loader_settings.app_specific_settings.at(0).add_layer_configuration( + LoaderSettingsLayerConfiguration{} + .set_name(layer_name + std::to_string(layer_count - i - 1)) + .set_path(env.get_layer_manifest_path(layer_count - i - 1).str()) + .set_control("on")); + } + env.update_loader_settings(env.loader_settings); + + { + auto layer_props = env.GetLayerProperties(40); + for (uint32_t i = 0; i < layer_count; i++) { + std::string expected_layer_name = layer_name + std::to_string(layer_count - i - 1); + EXPECT_TRUE(string_eq(layer_props.at(i).layerName, expected_layer_name.c_str())); + } + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(get_settings_location_log_message(env))); + env.debug_log.clear(); + auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 40); + for (uint32_t i = 0; i < layer_count; i++) { + std::string expected_layer_name = layer_name + std::to_string(layer_count - i - 1); + EXPECT_TRUE(string_eq(layers.at(i).layerName, expected_layer_name.c_str())); + } + } +} diff --git a/tests/loader_testing_main.cpp b/tests/loader_testing_main.cpp index eb2c8f836cde1d2e468e3ca2ae144e0002d0c98f..75e145d63fbd929e59c0e1d616189ee4e69ea61c 100644 --- a/tests/loader_testing_main.cpp +++ b/tests/loader_testing_main.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 The Khronos Group Inc. - * Copyright (c) 2021 Valve Corporation - * Copyright (c) 2021 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * 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,6 +27,20 @@ #include "test_environment.h" +// Makes any failed assertion throw, allowing for graceful cleanup of resources instead of hard aborts +class ThrowListener : public testing::EmptyTestEventListener { + void OnTestPartResult(const testing::TestPartResult& result) override { + if (result.type() == testing::TestPartResult::kFatalFailure) { + // We need to make sure an exception wasn't already thrown so we dont throw another exception at the same time + std::exception_ptr ex = std::current_exception(); + if (ex) { + return; + } + throw testing::AssertionException(result); + } + } +}; + int main(int argc, char** argv) { #if defined(_WIN32) // Avoid "Abort, Retry, Ignore" dialog boxes @@ -44,31 +58,39 @@ int main(int argc, char** argv) { // clean up folders from old test fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "null_dir"); fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "icd_manifests"); - fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "portability_icd_manifests"); + fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "icd_env_vars_manifests"); fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_layer_manifests"); + fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_env_var_layer_folder"); + fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_add_env_var_layer_folder"); fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "implicit_layer_manifests"); + fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "override_layer_manifests"); + fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "app_package_manifests"); + fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "macos_bundle"); // make sure the tests don't find these env-vars if they were set on the system - remove_env_var("VK_ICD_FILENAMES"); - remove_env_var("VK_DRIVER_FILES"); - remove_env_var("VK_ADD_DRIVER_FILES"); - remove_env_var("VK_LAYER_PATH"); - remove_env_var("VK_ADD_LAYER_PATH"); - remove_env_var("VK_INSTANCE_LAYERS"); - remove_env_var("VK_LOADER_DEBUG"); - remove_env_var("VK_LOADER_DISABLE_INST_EXT_FILTER"); + EnvVarWrapper vk_icd_filenames_env_var{"VK_ICD_FILENAMES"}; + EnvVarWrapper vk_driver_files_env_var{"VK_DRIVER_FILES"}; + EnvVarWrapper vk_add_driver_files_env_var{"VK_ADD_DRIVER_FILES"}; + EnvVarWrapper vk_layer_path_env_var{"VK_LAYER_PATH"}; + EnvVarWrapper vk_add_layer_path_env_var{"VK_ADD_LAYER_PATH"}; + EnvVarWrapper vk_instance_layers_env_var{"VK_INSTANCE_LAYERS"}; + EnvVarWrapper vk_loader_drivers_select_env_var{"VK_LOADER_DRIVERS_SELECT"}; + EnvVarWrapper vk_loader_drivers_disable_env_var{"VK_LOADER_DRIVERS_DISABLE"}; + EnvVarWrapper vk_loader_layers_enable_env_var{"VK_LOADER_LAYERS_ENABLE"}; + EnvVarWrapper vk_loader_layers_disable_env_var{"VK_LOADER_LAYERS_DISABLE"}; + EnvVarWrapper vk_loader_debug_env_var{"VK_LOADER_DEBUG"}; + EnvVarWrapper vk_loader_disable_inst_ext_filter_env_var{"VK_LOADER_DISABLE_INST_EXT_FILTER"}; -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) - set_env_var("XDG_CONFIG_HOME", "/etc"); - set_env_var("XDG_CONFIG_DIRS", "/etc"); - set_env_var("XDG_DATA_HOME", "/etc"); - set_env_var("XDG_DATA_DIRS", "/etc"); -#endif -#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) - set_env_var("HOME", "/home/fake_home"); +#if COMMON_UNIX_PLATFORMS + // Set only one of the 4 XDG variables to /etc, let everything else be empty + EnvVarWrapper xdg_config_home_env_var{"XDG_CONFIG_HOME", ETC_DIR}; + EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS"}; + EnvVarWrapper xdg_data_home_env_var{"XDG_DATA_HOME"}; + EnvVarWrapper xdg_data_dirs_env_var{"XDG_DATA_DIRS"}; + EnvVarWrapper home_env_var{"HOME", HOME_DIR}; #endif - ::testing::InitGoogleTest(&argc, argv); + ::testing::UnitTest::GetInstance()->listeners().Append(new ThrowListener); int result = RUN_ALL_TESTS(); return result; diff --git a/tests/loader_threading_tests.cpp b/tests/loader_threading_tests.cpp index 83b17da47d70d6fe4281fc7aab570ee5f778c0aa..2a2aadabb40d145836a2b5f284ab487b7db0e6e5 100644 --- a/tests/loader_threading_tests.cpp +++ b/tests/loader_threading_tests.cpp @@ -45,7 +45,6 @@ void create_destroy_instance_loop_with_function_queries(FrameworkEnvironment* en VkPhysicalDevice phys_dev = inst.GetPhysDev(); DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(1.0)); dev.CheckCreate(phys_dev); for (uint32_t j = 0; j < num_loops_try_get_device_proc_addr; j++) { PFN_vkCmdBindPipeline p = dev.load("vkCmdBindPipeline"); @@ -58,11 +57,9 @@ void create_destroy_device_loop(FrameworkEnvironment* env, uint32_t num_loops_cr uint32_t num_loops_try_get_proc_addr) { InstWrapper inst{env->vulkan_functions}; inst.CheckCreate(); - VkPhysicalDevice phys_dev = inst.GetPhysDev(); for (uint32_t i = 0; i < num_loops_create_destroy_device; i++) { DeviceWrapper dev{inst}; - dev.create_info.add_device_queue(DeviceQueueCreateInfo{}.add_priority(1.0)); - dev.CheckCreate(phys_dev); + dev.CheckCreate(inst.GetPhysDev()); for (uint32_t j = 0; j < num_loops_try_get_proc_addr; j++) { PFN_vkCmdBindPipeline p = dev.load("vkCmdBindPipeline"); @@ -78,31 +75,23 @@ void create_destroy_device_loop(FrameworkEnvironment* env, uint32_t num_loops_cr } } } -VKAPI_ATTR void VKAPI_CALL test_vkCmdBindPipeline(VkCommandBuffer cmd_buf, VkPipelineBindPoint pipelineBindPoint, - VkPipeline pipeline) {} -VKAPI_ATTR void VKAPI_CALL test_vkCmdBindDescriptorSets(VkCommandBuffer cmd_buf, VkPipelineBindPoint pipelineBindPoint, - VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, - const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, - const uint32_t* pDynamicOffsets) {} -VKAPI_ATTR void VKAPI_CALL test_vkCmdBindVertexBuffers(VkCommandBuffer cmd_buf, uint32_t firstBinding, uint32_t bindingCount, - const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {} -VKAPI_ATTR void VKAPI_CALL test_vkCmdBindIndexBuffer(VkCommandBuffer cmd_buf, uint32_t firstBinding, uint32_t bindingCount, - const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {} -VKAPI_ATTR void VKAPI_CALL test_vkCmdDraw(VkCommandBuffer cmd_buf, uint32_t vertexCount, uint32_t instanceCount, - uint32_t firstVertex, uint32_t firstInstance) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdBindPipeline(VkCommandBuffer, VkPipelineBindPoint, VkPipeline) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdBindDescriptorSets(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, + const VkDescriptorSet*, uint32_t, const uint32_t*) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdBindVertexBuffers(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer*, const VkDeviceSize*) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdBindIndexBuffer(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer*, const VkDeviceSize*) {} +VKAPI_ATTR void VKAPI_CALL test_vkCmdDraw(VkCommandBuffer, uint32_t, uint32_t, uint32_t, uint32_t) {} TEST(Threading, InstanceCreateDestroyLoop) { const auto processor_count = std::thread::hardware_concurrency(); - FrameworkEnvironment env{false}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("")}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); uint32_t num_loops_create_destroy_instance = 500; uint32_t num_loops_try_get_instance_proc_addr = 5; uint32_t num_loops_try_get_device_proc_addr = 100; - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().known_device_functions.push_back( - {"vkCmdBindPipeline", to_vkVoidFunction(test_vkCmdBindPipeline)}); + driver.physical_devices.emplace_back("physical_device_0") + .known_device_functions.push_back({"vkCmdBindPipeline", to_vkVoidFunction(test_vkCmdBindPipeline)}); std::vector instance_creation_threads; std::vector function_query_threads; @@ -119,23 +108,18 @@ TEST(Threading, InstanceCreateDestroyLoop) { TEST(Threading, DeviceCreateDestroyLoop) { const auto processor_count = std::thread::hardware_concurrency(); - FrameworkEnvironment env{false}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + FrameworkEnvironment env{FrameworkSettings{}.set_log_filter("")}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); uint32_t num_loops_create_destroy_device = 1000; uint32_t num_loops_try_get_device_proc_addr = 5; - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().known_device_functions.push_back( - {"vkCmdBindPipeline", to_vkVoidFunction(test_vkCmdBindPipeline)}); - driver.physical_devices.back().known_device_functions.push_back( - {"vkCmdBindDescriptorSets", to_vkVoidFunction(test_vkCmdBindDescriptorSets)}); - driver.physical_devices.back().known_device_functions.push_back( - {"vkCmdBindVertexBuffers", to_vkVoidFunction(test_vkCmdBindVertexBuffers)}); - driver.physical_devices.back().known_device_functions.push_back( - {"vkCmdBindIndexBuffer", to_vkVoidFunction(test_vkCmdBindIndexBuffer)}); - driver.physical_devices.back().known_device_functions.push_back({"vkCmdDraw", to_vkVoidFunction(test_vkCmdDraw)}); + driver.physical_devices.emplace_back("physical_device_0").known_device_functions = { + {"vkCmdBindPipeline", to_vkVoidFunction(test_vkCmdBindPipeline)}, + {"vkCmdBindDescriptorSets", to_vkVoidFunction(test_vkCmdBindDescriptorSets)}, + {"vkCmdBindVertexBuffers", to_vkVoidFunction(test_vkCmdBindVertexBuffers)}, + {"vkCmdBindIndexBuffer", to_vkVoidFunction(test_vkCmdBindIndexBuffer)}, + {"vkCmdDraw", to_vkVoidFunction(test_vkCmdDraw)}}; std::vector device_creation_threads; diff --git a/tests/loader_unknown_ext_tests.cpp b/tests/loader_unknown_ext_tests.cpp index 294251afe6ddba693f0fb668e75efbb84fdfcce2..dd918b8fa90992351bddcc0d7a5f7ae31ed55310 100644 --- a/tests/loader_unknown_ext_tests.cpp +++ b/tests/loader_unknown_ext_tests.cpp @@ -48,14 +48,14 @@ bool has_flag(std::vector const& flags, TestConfig config) { */ template struct custom_functions { - static VKAPI_ATTR uint32_t VKAPI_CALL func_zero(DispatchableHandleType handle, uint32_t foo) { return foo; }; - static VKAPI_ATTR uint32_t VKAPI_CALL func_one(DispatchableHandleType handle, uint32_t foo, uint32_t bar) { return foo + bar; }; - static VKAPI_ATTR float VKAPI_CALL func_two(DispatchableHandleType handle, uint32_t foo, uint32_t bar, float baz) { + static VKAPI_ATTR uint32_t VKAPI_CALL func_zero(DispatchableHandleType, uint32_t foo) { return foo; }; + static VKAPI_ATTR uint32_t VKAPI_CALL func_one(DispatchableHandleType, uint32_t foo, uint32_t bar) { return foo + bar; }; + static VKAPI_ATTR float VKAPI_CALL func_two(DispatchableHandleType, uint32_t foo, uint32_t bar, float baz) { return baz + foo + bar; }; - static VKAPI_ATTR int VKAPI_CALL func_three(DispatchableHandleType handle, int* ptr_a, int* ptr_b) { return *ptr_a + *ptr_b; }; - static VKAPI_ATTR float VKAPI_CALL func_four(DispatchableHandleType handle, int* ptr_a, int* ptr_b, int foo, int bar, float k, - float l, char a, char b, char c) { + static VKAPI_ATTR int VKAPI_CALL func_three(DispatchableHandleType, int* ptr_a, int* ptr_b) { return *ptr_a + *ptr_b; }; + static VKAPI_ATTR float VKAPI_CALL func_four(DispatchableHandleType, int* ptr_a, int* ptr_b, int foo, int bar, float k, float l, + char a, char b, char c) { return *ptr_a + *ptr_b + foo + bar + k + l + static_cast(a) + static_cast(b) + static_cast(c); }; }; @@ -102,7 +102,7 @@ struct layer_intercept_functions { return func(handle, layer, name, ptr_a, ptr_b); }; static VKAPI_ATTR float VKAPI_CALL func_four(DispatchableHandleType handle, TestLayer* layer, const char* name, int* ptr_a, - int* ptr_b, int foo, int bar, float k, float l, char a, char b, char c) { + int* ptr_b, int foo, int bar, float k, float l, char, char, char) { auto func = reinterpret_cast(find_custom_func(layer, name)); if (func == nullptr) return -1337.f; return func(handle, layer, name, ptr_a, ptr_b, foo + 4, bar + 5, k + 1, l + 2, 'd', 'e', 'f'); @@ -111,23 +111,19 @@ struct layer_intercept_functions { template struct layer_implementation_functions { - static VKAPI_ATTR uint32_t VKAPI_CALL func_zero(DispatchableHandleType device, TestLayer* layer, const char* name, uint32_t i) { - return i * 3; - } - static VKAPI_ATTR uint32_t VKAPI_CALL func_one(DispatchableHandleType device, TestLayer* layer, const char* name, uint32_t i, - float f) { + static VKAPI_ATTR uint32_t VKAPI_CALL func_zero(DispatchableHandleType, TestLayer*, const char*, uint32_t i) { return i * 3; } + static VKAPI_ATTR uint32_t VKAPI_CALL func_one(DispatchableHandleType, TestLayer*, const char*, uint32_t i, float f) { return static_cast(i * 3 + f * 10.f); } - static VKAPI_ATTR float VKAPI_CALL func_two(DispatchableHandleType handle, TestLayer* layer, const char* name, uint32_t foo, - uint32_t bar, float baz) { + static VKAPI_ATTR float VKAPI_CALL func_two(DispatchableHandleType, TestLayer*, const char*, uint32_t foo, uint32_t bar, + float baz) { return baz + foo + bar; }; - static VKAPI_ATTR int VKAPI_CALL func_three(DispatchableHandleType handle, TestLayer* layer, const char* name, int* ptr_a, - int* ptr_b) { + static VKAPI_ATTR int VKAPI_CALL func_three(DispatchableHandleType, TestLayer*, const char*, int* ptr_a, int* ptr_b) { return *ptr_a + *ptr_b; }; - static VKAPI_ATTR float VKAPI_CALL func_four(DispatchableHandleType handle, TestLayer* layer, const char* name, int* ptr_a, - int* ptr_b, int foo, int bar, float k, float l, char a, char b, char c) { + static VKAPI_ATTR float VKAPI_CALL func_four(DispatchableHandleType, TestLayer*, const char*, int* ptr_a, int* ptr_b, int foo, + int bar, float k, float l, char a, char b, char c) { return *ptr_a + *ptr_b + foo + bar + k + l + static_cast(a) + static_cast(b) + static_cast(c); }; }; @@ -186,7 +182,7 @@ void fill_phys_dev_intercept_functions(TestLayer& layer, std::vector -void check_custom_functions(FunctionLoader& loader, ParentType parent, DispatchableHandleType handle, FunctionStruct const& s, +void check_custom_functions(FunctionLoader& loader, ParentType parent, DispatchableHandleType handle, FunctionStruct const&, std::vector& func_names, uint32_t function_count, uint32_t function_start = 0) { for (uint32_t i = function_start; i < function_start + function_count;) { decltype(FunctionStruct::func_zero)* returned_func_i = loader.load(parent, func_names.at(i++).c_str()); @@ -218,7 +214,7 @@ void check_custom_functions(FunctionLoader& loader, ParentType parent, Dispatcha template void check_layer_custom_functions(FunctionLoader& loader, ParentType parent, DispatchableHandleType handle, TestLayer& layer, - FunctionStruct const& s, std::vector& func_names, uint32_t function_count, + FunctionStruct const&, std::vector& func_names, uint32_t function_count, uint32_t function_start = 0) { for (uint32_t i = function_start; i < function_start + function_count;) { decltype(FunctionStruct::func_zero)* returned_func_i = loader.load(parent, func_names.at(i).c_str()); @@ -258,7 +254,7 @@ void check_layer_custom_functions(FunctionLoader& loader, ParentType parent, Dis template void check_layer_custom_functions_no_implementation(FunctionLoader& loader, ParentType parent, DispatchableHandleType handle, - TestLayer& layer, FunctionStruct const& s, std::vector& func_names, + TestLayer& layer, FunctionStruct const&, std::vector& func_names, uint32_t function_count, uint32_t function_start = 0) { for (uint32_t i = function_start; i < function_start + function_count;) { decltype(FunctionStruct::func_zero)* returned_func_i = loader.load(parent, func_names.at(i).c_str()); @@ -296,7 +292,7 @@ void check_layer_custom_functions_no_implementation(FunctionLoader& loader, Pare template void check_layer_custom_functions_no_interception(FunctionLoader& loader, ParentType parent, DispatchableHandleType handle, - TestLayer& layer, FunctionStruct const& s, std::vector& func_names, + TestLayer& layer, FunctionStruct const&, std::vector& func_names, uint32_t function_count, uint32_t function_start = 0) { for (uint32_t i = function_start; i < function_start + function_count;) { decltype(FunctionStruct::func_zero)* returned_func_i = loader.load(parent, func_names.at(i).c_str()); @@ -338,17 +334,12 @@ using layer_intercept_physical_device_functions = layer_intercept_functions; TEST(UnknownFunction, PhysicalDeviceFunction) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); uint32_t function_count = MAX_NUM_UNKNOWN_EXTS; std::vector function_names; add_function_names(function_names, function_count); - driver.physical_devices.emplace_back("physical_device_0"); fill_implementation_functions(driver.physical_devices.at(0).custom_physical_device_functions, function_names, custom_physical_device_functions{}, function_count); InstWrapper inst{env.vulkan_functions}; @@ -360,26 +351,16 @@ TEST(UnknownFunction, PhysicalDeviceFunction) { } TEST(UnknownFunction, PhysicalDeviceFunctionMultipleDriverSupport) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver_0 = env.get_test_icd(0); - auto& driver_1 = env.get_test_icd(1); + auto& driver_0 = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + auto& driver_1 = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); uint32_t function_count = MAX_NUM_UNKNOWN_EXTS; std::vector function_names; add_function_names(function_names, function_count); // used to identify the GPUs - VkPhysicalDeviceProperties props{}; - driver_0.physical_devices.emplace_back("physical_device_0"); - props.deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; - driver_0.physical_devices.back().set_properties(props); - driver_1.physical_devices.emplace_back("physical_device_1"); - props.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; - driver_1.physical_devices.back().set_properties(props); + driver_0.physical_devices.emplace_back("physical_device_0").properties.deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; + driver_1.physical_devices.emplace_back("physical_device_1").properties.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; for (uint32_t i = 0; i < function_count / 10; i++) { fill_implementation_functions(driver_0.physical_devices.at(0).custom_physical_device_functions, function_names, @@ -393,6 +374,7 @@ TEST(UnknownFunction, PhysicalDeviceFunctionMultipleDriverSupport) { auto phys_devs = inst.GetPhysDevs(2); VkPhysicalDevice phys_dev_0 = phys_devs[0]; VkPhysicalDevice phys_dev_1 = phys_devs[1]; + VkPhysicalDeviceProperties props{}; env.vulkan_functions.vkGetPhysicalDeviceProperties(phys_devs[0], &props); if (props.deviceType != VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) { phys_dev_0 = phys_devs[1]; @@ -408,25 +390,15 @@ TEST(UnknownFunction, PhysicalDeviceFunctionMultipleDriverSupport) { // Add unknown functions to driver 0, and try to use them on driver 1. TEST(UnknownFunctionDeathTests, PhysicalDeviceFunctionErrorPath) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver_0 = env.get_test_icd(0); - auto& driver_1 = env.get_test_icd(1); + auto& driver_0 = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + auto& driver_1 = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); std::vector function_names; add_function_names(function_names, 1); // used to identify the GPUs - VkPhysicalDeviceProperties props{}; - driver_0.physical_devices.emplace_back("physical_device_0"); - props.deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; - driver_0.physical_devices.back().set_properties(props); - driver_1.physical_devices.emplace_back("physical_device_1"); - props.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; - driver_1.physical_devices.back().set_properties(props); + driver_0.physical_devices.emplace_back("physical_device_0").properties.deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; + driver_1.physical_devices.emplace_back("physical_device_1").properties.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; function_names.push_back(std::string("vkNotIntRealFuncTEST_0")); custom_physical_device_functions funcs{}; @@ -438,6 +410,7 @@ TEST(UnknownFunctionDeathTests, PhysicalDeviceFunctionErrorPath) { auto phys_devs = inst.GetPhysDevs(2); VkPhysicalDevice phys_dev_to_use = phys_devs[1]; + VkPhysicalDeviceProperties props{}; env.vulkan_functions.vkGetPhysicalDeviceProperties(phys_devs[1], &props); if (props.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) phys_dev_to_use = phys_devs[0]; // use the wrong GPU to query the functions, should get 5 errors @@ -445,22 +418,16 @@ TEST(UnknownFunctionDeathTests, PhysicalDeviceFunctionErrorPath) { decltype(custom_physical_device_functions::func_zero)* returned_func_i = env.vulkan_functions.load(inst.inst, function_names.at(0).c_str()); ASSERT_NE(returned_func_i, nullptr); - ASSERT_DEATH(returned_func_i(phys_dev_to_use, 0), "Extension vkNotIntRealFuncTEST_0 not supported for this physical device"); + ASSERT_DEATH(returned_func_i(phys_dev_to_use, 0), "Function vkNotIntRealFuncTEST_0 not supported for this physical device"); } TEST(UnknownFunction, PhysicalDeviceFunctionWithImplicitLayerImplementation) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); uint32_t function_count = MAX_NUM_UNKNOWN_EXTS; - auto& driver = env.get_test_icd(); std::vector function_names; add_function_names(function_names, function_count); - driver.physical_devices.emplace_back("physical_device_0"); - env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name("VK_LAYER_implicit_layer_unknown_function_intercept") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -479,26 +446,16 @@ TEST(UnknownFunction, PhysicalDeviceFunctionWithImplicitLayerImplementation) { } TEST(UnknownFunction, PhysicalDeviceFunctionMultipleDriverSupportWithImplicitLayerImplementation) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver_0 = env.get_test_icd(0); - auto& driver_1 = env.get_test_icd(1); + auto& driver_0 = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + auto& driver_1 = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); uint32_t function_count = MAX_NUM_UNKNOWN_EXTS; std::vector function_names; add_function_names(function_names, function_count); // used to identify the GPUs - VkPhysicalDeviceProperties props{}; - driver_0.physical_devices.emplace_back("physical_device_0"); - props.deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; - driver_0.physical_devices.back().set_properties(props); - driver_1.physical_devices.emplace_back("physical_device_1"); - props.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; - driver_1.physical_devices.back().set_properties(props); + driver_0.physical_devices.emplace_back("physical_device_0").properties.deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; + driver_1.physical_devices.emplace_back("physical_device_1").properties.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; for (uint32_t i = 0; i < function_count / 10; i++) { fill_implementation_functions(driver_0.physical_devices.at(0).custom_physical_device_functions, function_names, custom_physical_device_functions{}, 5, i * 10); @@ -518,6 +475,7 @@ TEST(UnknownFunction, PhysicalDeviceFunctionMultipleDriverSupportWithImplicitLay auto phys_devs = inst.GetPhysDevs(2); VkPhysicalDevice phys_dev_0 = phys_devs[0]; VkPhysicalDevice phys_dev_1 = phys_devs[1]; + VkPhysicalDeviceProperties props{}; env.vulkan_functions.vkGetPhysicalDeviceProperties(phys_devs[0], &props); if (props.deviceType != VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) { phys_dev_0 = phys_devs[1]; @@ -532,14 +490,9 @@ TEST(UnknownFunction, PhysicalDeviceFunctionMultipleDriverSupportWithImplicitLay } TEST(UnknownFunction, PhysicalDeviceFunctionWithImplicitLayerInterception) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); uint32_t function_count = MAX_NUM_UNKNOWN_EXTS; - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); std::vector function_names; add_function_names(function_names, function_count); @@ -561,16 +514,11 @@ TEST(UnknownFunction, PhysicalDeviceFunctionWithImplicitLayerInterception) { } TEST(UnknownFunction, PhysicalDeviceFunctionDriverSupportWithImplicitLayerInterception) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); uint32_t function_count = 100; std::vector function_names; add_function_names(function_names, function_count); - driver.physical_devices.emplace_back("physical_device_0"); fill_implementation_functions(driver.physical_devices.at(0).custom_physical_device_functions, function_names, layer_implementation_physical_device_functions{}, function_count); env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -590,12 +538,8 @@ TEST(UnknownFunction, PhysicalDeviceFunctionDriverSupportWithImplicitLayerInterc } TEST(UnknownFunction, PhysicalDeviceFunctionWithMultipleImplicitLayersInterception) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); std::vector function_names; uint32_t function_count = MAX_NUM_UNKNOWN_EXTS; add_function_names(function_names, function_count); @@ -637,11 +581,11 @@ template ParentType get_parent_type(InstWrapper const& inst, DeviceWrapper const& dev); template <> -VkInstance get_parent_type(InstWrapper const& inst, DeviceWrapper const& dev) { +VkInstance get_parent_type(InstWrapper const& inst, DeviceWrapper const&) { return inst.inst; } template <> -VkDevice get_parent_type(InstWrapper const& inst, DeviceWrapper const& dev) { +VkDevice get_parent_type(InstWrapper const&, DeviceWrapper const& dev) { return dev.dev; } @@ -650,13 +594,13 @@ DispatchableHandleType get_dispatch_handle(FrameworkEnvironment& env, DeviceWrap std::vector const& flags); template <> -VkDevice get_dispatch_handle(FrameworkEnvironment& env, DeviceWrapper const& dev, std::vector const& flags) { +VkDevice get_dispatch_handle(FrameworkEnvironment&, DeviceWrapper const& dev, std::vector const&) { return dev.dev; } template <> VkCommandBuffer get_dispatch_handle(FrameworkEnvironment& env, DeviceWrapper const& dev, - std::vector const& flags) { + std::vector const&) { VkCommandPool command_pool; VkCommandPoolCreateInfo pool_create_info{}; DeviceFunctions funcs{env.vulkan_functions, dev}; @@ -670,7 +614,7 @@ VkCommandBuffer get_dispatch_handle(FrameworkEnvironment& env, } template <> -VkQueue get_dispatch_handle(FrameworkEnvironment& env, DeviceWrapper const& dev, std::vector const& flags) { +VkQueue get_dispatch_handle(FrameworkEnvironment& env, DeviceWrapper const& dev, std::vector const&) { DeviceFunctions funcs{env.vulkan_functions, dev.dev}; VkQueue queue; funcs.vkGetDeviceQueue(dev, 0, 0, &queue); @@ -684,13 +628,9 @@ void unknown_function_test_impl(std::vector const& flags) { using layer_intercept_functions_type = layer_intercept_functions; FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); uint32_t function_count = MAX_NUM_UNKNOWN_EXTS; - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); - driver.physical_devices.back().add_queue_family_properties({}); - std::vector function_names; add_function_names(function_names, function_count); @@ -763,31 +703,17 @@ TEST(UnknownFunction, DeviceFromGDPAWithLayerInterceptionAndLayerImplementation) unknown_function_test_impl({TestConfig::add_layer_interception, TestConfig::add_layer_implementation}); } -TEST(UnknownFunction, DeviceFromGIPA) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif - unknown_function_test_impl({}); -} +TEST(UnknownFunction, DeviceFromGIPA) { unknown_function_test_impl({}); } TEST(UnknownFunction, DeviceFromGIPAWithLayerImplementation) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_implementation}); } TEST(UnknownFunction, DeviceFromGIPAWithLayerInterception) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_implementation}); } TEST(UnknownFunction, DeviceFromGIPAWithLayerInterceptionAndLayerImplementation) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_interception, TestConfig::add_layer_implementation}); } @@ -808,31 +734,17 @@ TEST(UnknownFunction, CommandBufferFromGDPAWithLayerInterceptionAndLayerImplemen {TestConfig::add_layer_interception, TestConfig::add_layer_implementation}); } -TEST(UnknownFunction, CommandBufferFromGIPA) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif - unknown_function_test_impl({}); -} +TEST(UnknownFunction, CommandBufferFromGIPA) { unknown_function_test_impl({}); } TEST(UnknownFunction, CommandBufferFromGIPAWithLayerImplementation) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_implementation}); } TEST(UnknownFunction, CommandBufferFromGIPAWithLayerInterception) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_implementation}); } TEST(UnknownFunction, CommandBufferFromGIPAWithLayerInterceptionAndLayerImplementation) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl( {TestConfig::add_layer_interception, TestConfig::add_layer_implementation}); } @@ -853,31 +765,17 @@ TEST(UnknownFunction, QueueFromGDPAWithLayerInterceptionAndLayerImplementation) unknown_function_test_impl({TestConfig::add_layer_interception, TestConfig::add_layer_implementation}); } -TEST(UnknownFunction, QueueFromGIPA) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif - unknown_function_test_impl({}); -} +TEST(UnknownFunction, QueueFromGIPA) { unknown_function_test_impl({}); } TEST(UnknownFunction, QueueFromGIPAWithLayer) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_implementation}); } TEST(UnknownFunction, QueueFromGIPAWithLayerInterception) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_implementation}); } TEST(UnknownFunction, QueueFromGIPAWithLayerInterceptionAndLayerImplementation) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif unknown_function_test_impl({TestConfig::add_layer_interception, TestConfig::add_layer_implementation}); } @@ -900,7 +798,7 @@ const char* LayerInterceptData::name = nullptr; template struct FunctionZero { - static VKAPI_ATTR uint32_t VKAPI_CALL implementation(DispatchableHandle handle, uint32_t a, uint32_t b) { return a + b; } + static VKAPI_ATTR uint32_t VKAPI_CALL implementation(DispatchableHandle, uint32_t a, uint32_t b) { return a + b; } template static VKAPI_ATTR uint32_t VKAPI_CALL intercept(DispatchableHandle handle, uint32_t a, uint32_t b) { @@ -928,9 +826,7 @@ struct FunctionZero { template struct FunctionOne { - static VKAPI_ATTR uint32_t VKAPI_CALL implementation(DispatchableHandle handle, uint32_t a, uint32_t b, char c) { - return a + b + c; - } + static VKAPI_ATTR uint32_t VKAPI_CALL implementation(DispatchableHandle, uint32_t a, uint32_t b, char c) { return a + b + c; } template static VKAPI_ATTR uint32_t VKAPI_CALL intercept(DispatchableHandle handle, uint32_t a, uint32_t b, char c) { @@ -959,7 +855,7 @@ struct FunctionOne { template struct FunctionTwo { - static VKAPI_ATTR float VKAPI_CALL implementation(DispatchableHandle handle, int* ptr_a, int* ptr_b) { + static VKAPI_ATTR float VKAPI_CALL implementation(DispatchableHandle, int* ptr_a, int* ptr_b) { return 0.123f + *ptr_a + *ptr_b; } @@ -994,7 +890,7 @@ struct FunctionTwo { template struct FunctionThree { - static VKAPI_ATTR float VKAPI_CALL implementation(DispatchableHandle handle, int* ptr_a, float* ptr_b, uint32_t c) { + static VKAPI_ATTR float VKAPI_CALL implementation(DispatchableHandle, int* ptr_a, float* ptr_b, uint32_t c) { return 0.456f + *ptr_a + *ptr_b + c; } @@ -1032,7 +928,7 @@ struct FunctionThree { template struct FunctionFour { - static VKAPI_ATTR VkResult VKAPI_CALL implementation(DispatchableHandle handle, VkPhysicalDeviceLimits* limits, uint32_t* count, + static VKAPI_ATTR VkResult VKAPI_CALL implementation(DispatchableHandle, VkPhysicalDeviceLimits* limits, uint32_t* count, VkExtensionProperties* props) { limits->nonCoherentAtomSize = 0x0000ABCD0000FEDCU; if (props == nullptr) { @@ -1130,7 +1026,7 @@ struct UnknownFunctionInfo { } template - static void add_to_layer(UnknownFunction& func, TestLayer& layer, LayerStruct intercept_struct) { + static void add_to_layer(UnknownFunction& func, TestLayer& layer, LayerStruct) { LayerInterceptData::layer = &layer; LayerInterceptData::name = func.name.c_str(); layer.add_custom_device_interception_function( @@ -1157,7 +1053,7 @@ struct UnknownFunctionInfo { } template - static void add_to_layer(UnknownFunction& func, TestLayer& layer, LayerStruct intercept_struct) { + static void add_to_layer(UnknownFunction& func, TestLayer& layer, LayerStruct) { LayerInterceptData::layer = &layer; LayerInterceptData::name = func.name.c_str(); layer.add_custom_physical_device_intercept_function( @@ -1192,14 +1088,8 @@ template struct D {}; TEST(UnknownFunction, PhysicalDeviceFunctionTwoLayerInterception) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); - - driver.physical_devices.emplace_back("physical_device_0"); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); PhysicalDevice& pd = driver.physical_devices.back(); UnknownFunction f{"vkFunc1"}; @@ -1231,12 +1121,9 @@ TEST(UnknownFunction, PhysicalDeviceFunctionTwoLayerInterception) { } TEST(UnknownFunction, ManyCombinations) { -#if defined(__APPLE__) - GTEST_SKIP() << "Skip this test as currently macOS doesn't fully support unknown functions."; -#endif FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + PhysicalDevice& physical_device = driver.physical_devices.back(); std::vector unknown_funcs; unknown_funcs.emplace_back("vkZero_uint32_uint32_0"); @@ -1253,9 +1140,6 @@ TEST(UnknownFunction, ManyCombinations) { unknown_funcs.emplace_back("vkOne_uint32_uint32_char_11"); unknown_funcs.emplace_back("vkTwo_ptr_int_ptr_int_12"); - driver.physical_devices.emplace_back("physical_device_0"); - PhysicalDevice& physical_device = driver.physical_devices.back(); - env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} .set_name("VK_LAYER_implicit_layer_unknown_function_intercept_0") .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) @@ -1379,3 +1263,49 @@ TEST(UnknownFunction, ManyCombinations) { unknown_funcs.at(5).check(env.vulkan_functions, inst.inst, phys_dev); } } + +TEST(UnknownFunction, PhysicalDeviceFunctionInLayer) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + env.add_implicit_layer(ManifestLayer{} + .add_layer(ManifestLayer::LayerDescription{} + .set_name("VK_LAYER_implicit_layer_1") + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_0) + .set_disable_environment("DISABLE_ME")) + .set_file_format_version({1, 0, 0}), + "implicit_layer_1.json"); + + UnknownFunction unknown_func{"vkPhysicalDeviceFunctionInLayer"}; + const char* ext_name = "VK_EXT_not_funny"; + + const char* explicit_layer_unknown_function_implement = "VK_LAYER_implement_unknown_function"; + env.add_explicit_layer( + ManifestLayer{} + .add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_unknown_function_implement) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .add_instance_extension(ManifestLayer::LayerDescription::Extension{ext_name, 0, {unknown_func.name}})) + .set_file_format_version({1, 1, 0}), + "implement_unknown_function.json"); + auto& layer0 = env.get_test_layer(1); + + const char* explicit_layer_to_enable_1 = "VK_LAYER_explicit_layer_1"; + env.add_explicit_layer(ManifestLayer{} + .add_layer(ManifestLayer::LayerDescription{} + .set_name(explicit_layer_to_enable_1) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)) + .set_file_format_version({1, 2, 0}), + "explicit_layer_2.json"); + + Functions::four::physical_device::add_implementation_to_layer(unknown_func, layer0); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_layer(explicit_layer_to_enable_1); + inst.create_info.add_layer(explicit_layer_unknown_function_implement); + inst.CheckCreate(); + + VkPhysicalDevice phys_dev = inst.GetPhysDev(); + + unknown_func.check(env.vulkan_functions, inst.inst, phys_dev); +} diff --git a/tests/loader_version_tests.cpp b/tests/loader_version_tests.cpp index 04c22acea7404effe041d9347d0b915553feedb0..8307995acb2085299e8b7e387eb34adfbf8f3011 100644 --- a/tests/loader_version_tests.cpp +++ b/tests/loader_version_tests.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021-2022 The Khronos Group Inc. - * Copyright (c) 2021-2022 Valve Corporation - * Copyright (c) 2021-2022 LunarG, Inc. + * Copyright (c) 2021-2023 The Khronos Group Inc. + * Copyright (c) 2021-2023 Valve Corporation + * Copyright (c) 2021-2023 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -29,13 +29,11 @@ TEST(ICDInterfaceVersion2Plus, vk_icdNegotiateLoaderICDInterfaceVersion) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); for (uint32_t i = 0; i <= 6; i++) { for (uint32_t j = i; j <= 6; j++) { - driver.min_icd_interface_version = i; - driver.max_icd_interface_version = j; + driver.set_min_icd_interface_version(i).set_max_icd_interface_version(j); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); } @@ -44,58 +42,55 @@ TEST(ICDInterfaceVersion2Plus, vk_icdNegotiateLoaderICDInterfaceVersion) { TEST(ICDInterfaceVersion2Plus, version_3) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); { - driver.min_icd_interface_version = 2; - driver.enable_icd_wsi = true; + driver.set_min_icd_interface_version(2).set_enable_icd_wsi(true); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); - ASSERT_EQ(driver.is_using_icd_wsi, UsingICDProvidedWSI::not_using); + ASSERT_FALSE(driver.is_using_icd_wsi); } { - driver.min_icd_interface_version = 3; - driver.enable_icd_wsi = false; + driver.set_min_icd_interface_version(3).set_enable_icd_wsi(false); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); - ASSERT_EQ(driver.is_using_icd_wsi, UsingICDProvidedWSI::not_using); + ASSERT_FALSE(driver.is_using_icd_wsi); } { - driver.min_icd_interface_version = 3; - driver.enable_icd_wsi = true; + driver.set_min_icd_interface_version(3).set_enable_icd_wsi(true); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); - ASSERT_EQ(driver.is_using_icd_wsi, UsingICDProvidedWSI::is_using); + ASSERT_TRUE(driver.is_using_icd_wsi); } } TEST(ICDInterfaceVersion2Plus, version_4) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); - auto& driver = env.get_test_icd(); - driver.physical_devices.emplace_back("physical_device_0"); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device("physical_device_0"); InstWrapper inst{env.vulkan_functions}; inst.CheckCreate(); } TEST(ICDInterfaceVersion2Plus, l4_icd4) { + // TODO: // ICD must fail with VK_ERROR_INCOMPATIBLE_DRIVER for all vkCreateInstance calls with apiVersion set to > Vulkan 1.0 // because both the loader and ICD support interface version <= 4. Otherwise, the ICD should behave as normal. } TEST(ICDInterfaceVersion2Plus, l4_icd5) { + // TODO: // ICD must fail with VK_ERROR_INCOMPATIBLE_DRIVER for all vkCreateInstance calls with apiVersion set to > Vulkan 1.0 // because the loader is still at interface version <= 4. Otherwise, the ICD should behave as normal. } TEST(ICDInterfaceVersion2Plus, l5_icd4) { + // TODO: // Loader will fail with VK_ERROR_INCOMPATIBLE_DRIVER if it can't handle the apiVersion. ICD may pass for all apiVersions, // but since its interface is <= 4, it is best if it assumes it needs to do the work of rejecting anything > Vulkan 1.0 and // fail with VK_ERROR_INCOMPATIBLE_DRIVER. Otherwise, the ICD should behave as normal. } TEST(ICDInterfaceVersion2Plus, l5_icd5) { + // TODO: // Loader will fail with VK_ERROR_INCOMPATIBLE_DRIVER if it can't handle the apiVersion, and ICDs should fail with // VK_ERROR_INCOMPATIBLE_DRIVER only if they can not support the specified apiVersion. Otherwise, the ICD should behave as // normal. @@ -105,8 +100,7 @@ TEST(ICDInterfaceVersion2Plus, l5_icd5) { // This test makes sure that EnumerateAdapterPhysicalDevices on drivers found in the Khronos/Vulkan/Drivers registry TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, version_6_in_drivers_registry) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES)); - auto& driver = env.get_test_icd(); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES)); driver.physical_devices.emplace_back("physical_device_1"); driver.physical_devices.emplace_back("physical_device_0"); uint32_t physical_count = static_cast(driver.physical_devices.size()); @@ -133,7 +127,7 @@ TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, version_6_in_drive // Make the version_6 driver found through the D3DKMT driver discovery mechanism of the loader TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, version_6) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_discovery_type(ManifestDiscoveryType::none)); + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_6, VK_API_VERSION_1_3}.set_discovery_type(ManifestDiscoveryType::null_dir)); // Version 6 provides a mechanism to allow the loader to sort physical devices. // The loader will only attempt to sort physical devices on an ICD if version 6 of the interface is supported. // This version provides the vk_icdEnumerateAdapterPhysicalDevices function. @@ -186,9 +180,9 @@ TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, version_6) { // EnumerateAdapterPhysicalDevices TEST(ICDInterfaceVersion2, EnumAdapters2) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA}.set_discovery_type(ManifestDiscoveryType::none)); + auto& driver = + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA}.set_discovery_type(ManifestDiscoveryType::null_dir)); InstWrapper inst{env.vulkan_functions}; - auto& driver = env.get_test_icd(); driver.physical_devices.emplace_back("physical_device_1"); driver.physical_devices.emplace_back("physical_device_0"); uint32_t physical_count = static_cast(driver.physical_devices.size()); @@ -211,11 +205,11 @@ TEST(ICDInterfaceVersion2, EnumAdapters2) { // Verify that the handles are correct by calling vkGetPhysicalDeviceProperties with them TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, VerifyPhysDevResults) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES}.set_discovery_type( - ManifestDiscoveryType::none)); - auto& driver = env.get_test_icd(); - driver.min_icd_interface_version = 6; - driver.set_icd_api_version(VK_API_VERSION_1_1); + auto& driver = + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES, VK_API_VERSION_1_1} + .set_discovery_type(ManifestDiscoveryType::null_dir)) + .set_min_icd_interface_version(6) + .set_icd_api_version(VK_API_VERSION_1_1); const std::vector physical_device_names = {"physical_device_4", "physical_device_3", "physical_device_2", "physical_device_1", "physical_device_0"}; for (const auto& dev_name : physical_device_names) driver.physical_devices.push_back(dev_name); @@ -225,7 +219,7 @@ TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, VerifyPhysDevResul desc1.VendorId = known_driver.vendor_id; desc1.AdapterLuid = _LUID{10, 1000}; env.platform_shim->add_dxgi_adapter(GpuType::discrete, desc1); - env.get_test_icd().set_adapterLUID(desc1.AdapterLuid); + driver.set_adapterLUID(desc1.AdapterLuid); env.platform_shim->add_d3dkmt_adapter(D3DKMT_Adapter{0, _LUID{10, 1000}}.add_driver_manifest_path(env.get_icd_manifest_path())); @@ -255,27 +249,27 @@ TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, VerifyPhysDevResul // Make sure physical device groups enumerated through EnumerateAdapterPhysicalDevices are properly found TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, VerifyGroupResults) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES}.set_discovery_type( - ManifestDiscoveryType::none)); - auto& driver = env.get_test_icd(); - driver.min_icd_interface_version = 6; - driver.set_icd_api_version(VK_API_VERSION_1_1); + auto& driver = + env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES, VK_API_VERSION_1_1} + .set_discovery_type(ManifestDiscoveryType::null_dir)) + .set_min_icd_interface_version(6) + .set_icd_api_version(VK_API_VERSION_1_1); const std::vector physical_device_names = {"physical_device_4", "physical_device_3", "physical_device_2", "physical_device_1", "physical_device_0"}; - for (const auto& dev_name : physical_device_names) driver.physical_devices.push_back(dev_name); + for (const auto& dev_name : physical_device_names) { + driver.physical_devices.push_back(dev_name); + } - driver.physical_device_groups.emplace_back(driver.physical_devices[0]); - driver.physical_device_groups.back().use_physical_device(driver.physical_devices[1]); + driver.physical_device_groups.emplace_back(driver.physical_devices[0]).use_physical_device(driver.physical_devices[1]); driver.physical_device_groups.emplace_back(driver.physical_devices[2]); - driver.physical_device_groups.emplace_back(driver.physical_devices[3]); - driver.physical_device_groups.back().use_physical_device(driver.physical_devices[4]); + driver.physical_device_groups.emplace_back(driver.physical_devices[3]).use_physical_device(driver.physical_devices[4]); auto& known_driver = known_driver_list.at(2); // which driver this test pretends to be DXGI_ADAPTER_DESC1 desc1{}; desc1.VendorId = known_driver.vendor_id; desc1.AdapterLuid = _LUID{10, 1000}; env.platform_shim->add_dxgi_adapter(GpuType::discrete, desc1); - env.get_test_icd().set_adapterLUID(desc1.AdapterLuid); + driver.set_adapterLUID(desc1.AdapterLuid); env.platform_shim->add_d3dkmt_adapter(D3DKMT_Adapter{0, _LUID{10, 1000}}.add_driver_manifest_path(env.get_icd_manifest_path())); @@ -310,6 +304,25 @@ TEST(ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices, VerifyGroupResults } #endif // defined(WIN32) +TEST(ICDInterfaceVersion7, SingleDriver) { + FrameworkEnvironment env{}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7_WITH_ADDITIONAL_EXPORTS)).add_physical_device({}); + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + DeviceWrapper dev{inst}; + dev.CheckCreate(inst.GetPhysDev()); + ASSERT_EQ(driver.interface_version_check, InterfaceVersionCheck::version_is_supported); +} + +TEST(ICDInterfaceVersion7, SingleDriverWithoutExportedFunctions) { + FrameworkEnvironment env{}; + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7)).add_physical_device({}); + InstWrapper inst{env.vulkan_functions}; + inst.CheckCreate(); + DeviceWrapper dev{inst}; + dev.CheckCreate(inst.GetPhysDev()); + ASSERT_EQ(driver.interface_version_check, InterfaceVersionCheck::version_is_supported); +} TEST(MultipleICDConfig, Basic) { FrameworkEnvironment env{}; @@ -402,7 +415,7 @@ TEST(MultipleDriverConfig, DifferentICDsWithDevices) { TEST(MultipleDriverConfig, DifferentICDsWithDevicesAndGroups) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_ICD_GIPA)); - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)); env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); // The loader has to be able to handle drivers that support device groups in combination @@ -420,8 +433,8 @@ TEST(MultipleDriverConfig, DifferentICDsWithDevicesAndGroups) { // ICD 1 : 1.1 support (with 1 group with 2 devices) TestICD& icd1 = env.get_test_icd(1); - icd1.physical_devices.emplace_back("physical_device_1"); - icd1.physical_devices.emplace_back("physical_device_2"); + icd1.physical_devices.emplace_back("physical_device_1").set_api_version(VK_API_VERSION_1_1); + icd1.physical_devices.emplace_back("physical_device_2").set_api_version(VK_API_VERSION_1_1); icd1.physical_device_groups.emplace_back(icd1.physical_devices[0]); icd1.physical_device_groups.back().use_physical_device(icd1.physical_devices[1]); icd1.min_icd_interface_version = 5; @@ -475,7 +488,7 @@ TEST(MultipleICDConfig, version_5_and_version_6) { auto& driver_5 = env.get_test_icd(i * 2 + 1); driver_5.set_max_icd_interface_version(5); driver_5.set_min_icd_interface_version(5); - setup_WSI_in_ICD(driver_5); + driver_5.setup_WSI(); driver_5.physical_devices.push_back({}); driver_5.physical_devices.back().queue_family_properties.push_back(family_props); driver_5.physical_devices.push_back({}); @@ -485,7 +498,7 @@ TEST(MultipleICDConfig, version_5_and_version_6) { physical_count += static_cast(driver_5.physical_devices.size()); auto& driver_6 = env.get_test_icd(i * 2); - setup_WSI_in_ICD(driver_6); + driver_6.setup_WSI(); driver_6.physical_devices.emplace_back("physical_device_0"); driver_6.physical_devices.back().queue_family_properties.push_back(family_props); driver_6.physical_devices.emplace_back("physical_device_1"); @@ -502,11 +515,10 @@ TEST(MultipleICDConfig, version_5_and_version_6) { desc1.AdapterLuid = LUID{100 + i, static_cast(100 + i)}; driver_6.set_adapterLUID(desc1.AdapterLuid); env.platform_shim->add_dxgi_adapter(GpuType::discrete, desc1); - env.get_test_icd().set_adapterLUID(desc1.AdapterLuid); } uint32_t returned_physical_count = 0; InstWrapper inst{env.vulkan_functions}; - setup_WSI_in_create_instance(inst); + inst.create_info.setup_WSI(); inst.CheckCreate(); ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, nullptr)); @@ -516,7 +528,8 @@ TEST(MultipleICDConfig, version_5_and_version_6) { env.vulkan_functions.vkEnumeratePhysicalDevices(inst.inst, &returned_physical_count, physical_device_handles.data())); ASSERT_EQ(physical_count, returned_physical_count); - VkSurfaceKHR surface = create_surface(inst); + VkSurfaceKHR surface{}; + ASSERT_EQ(VK_SUCCESS, create_surface(inst, surface)); for (const auto& handle : physical_device_handles) { handle_assert_has_value(handle); @@ -532,116 +545,98 @@ TEST(MultipleICDConfig, version_5_and_version_6) { // shim function pointers for 1.3 // Should use autogen for this - it generates 'shim' functions for validation layers, maybe that could be used here. -void test_vkCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, - VkSubpassContents contents) {} -void test_vkCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, - const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, - const VkDeviceSize* pStrides) {} -void test_vkCmdBlitImage2(VkCommandBuffer commandBuffer, const VkBlitImageInfo2* pBlitImageInfo) {} -void test_vkCmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2* pCopyBufferInfo) {} -void test_vkCmdCopyBufferToImage2(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo) {} -void test_vkCmdCopyImage2(VkCommandBuffer commandBuffer, const VkCopyImageInfo2* pCopyImageInfo) {} -void test_vkCmdCopyImageToBuffer2(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo) {} -void test_vkCmdEndRendering(VkCommandBuffer commandBuffer) {} -void test_vkCmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo) {} -void test_vkCmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask) {} -void test_vkCmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo) {} -void test_vkCmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) {} -void test_vkCmdSetDepthBiasEnable(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable) {} -void test_vkCmdSetDepthBoundsTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable) {} -void test_vkCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) {} -void test_vkCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) {} -void test_vkCmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) {} -void test_vkCmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo* pDependencyInfo) {} -void test_vkCmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace) {} -void test_vkCmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable) {} -void test_vkCmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology) {} -void test_vkCmdSetRasterizerDiscardEnable(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable) {} -void test_vkCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors) {} -void test_vkCmdSetStencilOp(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, - VkStencilOp depthFailOp, VkCompareOp compareOp) {} -void test_vkCmdSetStencilTestEnable(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) {} -void test_vkCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports) {} -void test_vkCmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, - const VkDependencyInfo* pDependencyInfos) {} -void test_vkCmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query) {} -VkResult test_vkCreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot) { - return VK_SUCCESS; -} -void test_vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator) {} -void test_vkGetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements* pInfo, - VkMemoryRequirements2* pMemoryRequirements) {} -void test_vkGetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, - VkMemoryRequirements2* pMemoryRequirements) {} -void test_vkGetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) {} -void test_vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, - uint64_t* pData) {} -VkResult test_vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence) { - return VK_SUCCESS; -} -VkResult test_vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, - uint64_t data) { +void test_vkCmdBeginRendering(VkCommandBuffer, const VkRenderingInfo*) {} +void test_vkCmdBindVertexBuffers2(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer*, const VkDeviceSize*, const VkDeviceSize*, + const VkDeviceSize*) {} +void test_vkCmdBlitImage2(VkCommandBuffer, const VkBlitImageInfo2*) {} +void test_vkCmdCopyBuffer2(VkCommandBuffer, const VkCopyBufferInfo2*) {} +void test_vkCmdCopyBufferToImage2(VkCommandBuffer, const VkCopyBufferToImageInfo2*) {} +void test_vkCmdCopyImage2(VkCommandBuffer, const VkCopyImageInfo2*) {} +void test_vkCmdCopyImageToBuffer2(VkCommandBuffer, const VkCopyImageToBufferInfo2*) {} +void test_vkCmdEndRendering(VkCommandBuffer) {} +void test_vkCmdPipelineBarrier2(VkCommandBuffer, const VkDependencyInfo*) {} +void test_vkCmdResetEvent2(VkCommandBuffer, VkEvent, VkPipelineStageFlags2) {} +void test_vkCmdResolveImage2(VkCommandBuffer, const VkResolveImageInfo2*) {} +void test_vkCmdSetCullMode(VkCommandBuffer, VkCullModeFlags) {} +void test_vkCmdSetDepthBiasEnable(VkCommandBuffer, VkBool32) {} +void test_vkCmdSetDepthBoundsTestEnable(VkCommandBuffer, VkBool32) {} +void test_vkCmdSetDepthCompareOp(VkCommandBuffer, VkCompareOp) {} +void test_vkCmdSetDepthTestEnable(VkCommandBuffer, VkBool32) {} +void test_vkCmdSetDepthWriteEnable(VkCommandBuffer, VkBool32) {} +void test_vkCmdSetEvent2(VkCommandBuffer, VkEvent, const VkDependencyInfo*) {} +void test_vkCmdSetFrontFace(VkCommandBuffer, VkFrontFace) {} +void test_vkCmdSetPrimitiveRestartEnable(VkCommandBuffer, VkBool32) {} +void test_vkCmdSetPrimitiveTopology(VkCommandBuffer, VkPrimitiveTopology) {} +void test_vkCmdSetRasterizerDiscardEnable(VkCommandBuffer, VkBool32) {} +void test_vkCmdSetScissorWithCount(VkCommandBuffer, uint32_t, const VkRect2D*) {} +void test_vkCmdSetStencilOp(VkCommandBuffer, VkStencilFaceFlags, VkStencilOp, VkStencilOp, VkStencilOp, VkCompareOp) {} +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) {} +VkResult test_vkCreatePrivateDataSlot(VkDevice, const VkPrivateDataSlotCreateInfo*, const VkAllocationCallbacks*, + VkPrivateDataSlot*) { return VK_SUCCESS; } +void test_vkDestroyPrivateDataSlot(VkDevice, VkPrivateDataSlot, const VkAllocationCallbacks*) {} +void test_vkGetDeviceBufferMemoryRequirements(VkDevice, const VkDeviceBufferMemoryRequirements*, VkMemoryRequirements2*) {} +void test_vkGetDeviceImageMemoryRequirements(VkDevice, const VkDeviceImageMemoryRequirements*, VkMemoryRequirements2*) {} +void test_vkGetDeviceImageSparseMemoryRequirements(VkDevice, const VkDeviceImageMemoryRequirements*, uint32_t*, + VkSparseImageMemoryRequirements2*) {} +void test_vkGetPrivateData(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t*) {} +VkResult test_vkQueueSubmit2(VkQueue, uint32_t, const VkSubmitInfo2*, VkFence) { return VK_SUCCESS; } +VkResult test_vkSetPrivateData(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t) { return VK_SUCCESS; } TEST(MinorVersionUpdate, Version1_3) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); - auto& icd_phys_dev = env.get_test_icd().physical_devices.back(); - icd_phys_dev.known_device_functions.insert( - icd_phys_dev.known_device_functions.end(), - { - VulkanFunction{"vkCmdBeginRendering", to_vkVoidFunction(test_vkCmdBeginRendering)}, - VulkanFunction{"vkCmdBindVertexBuffers2", to_vkVoidFunction(test_vkCmdBindVertexBuffers2)}, - VulkanFunction{"vkCmdBlitImage2", to_vkVoidFunction(test_vkCmdBlitImage2)}, - VulkanFunction{"vkCmdCopyBuffer2", to_vkVoidFunction(test_vkCmdCopyBuffer2)}, - VulkanFunction{"vkCmdCopyBufferToImage2", to_vkVoidFunction(test_vkCmdCopyBufferToImage2)}, - VulkanFunction{"vkCmdCopyImage2", to_vkVoidFunction(test_vkCmdCopyImage2)}, - VulkanFunction{"vkCmdCopyImageToBuffer2", to_vkVoidFunction(test_vkCmdCopyImageToBuffer2)}, - VulkanFunction{"vkCmdEndRendering", to_vkVoidFunction(test_vkCmdEndRendering)}, - VulkanFunction{"vkCmdPipelineBarrier2", to_vkVoidFunction(test_vkCmdPipelineBarrier2)}, - VulkanFunction{"vkCmdResetEvent2", to_vkVoidFunction(test_vkCmdResetEvent2)}, - VulkanFunction{"vkCmdResolveImage2", to_vkVoidFunction(test_vkCmdResolveImage2)}, - VulkanFunction{"vkCmdSetCullMode", to_vkVoidFunction(test_vkCmdSetCullMode)}, - VulkanFunction{"vkCmdSetDepthBiasEnable", to_vkVoidFunction(test_vkCmdSetDepthBiasEnable)}, - VulkanFunction{"vkCmdSetDepthBoundsTestEnable", to_vkVoidFunction(test_vkCmdSetDepthBoundsTestEnable)}, - VulkanFunction{"vkCmdSetDepthCompareOp", to_vkVoidFunction(test_vkCmdSetDepthCompareOp)}, - VulkanFunction{"vkCmdSetDepthTestEnable", to_vkVoidFunction(test_vkCmdSetDepthTestEnable)}, - VulkanFunction{"vkCmdSetDepthWriteEnable", to_vkVoidFunction(test_vkCmdSetDepthWriteEnable)}, - VulkanFunction{"vkCmdSetEvent2", to_vkVoidFunction(test_vkCmdSetEvent2)}, - VulkanFunction{"vkCmdSetFrontFace", to_vkVoidFunction(test_vkCmdSetFrontFace)}, - VulkanFunction{"vkCmdSetPrimitiveRestartEnable", to_vkVoidFunction(test_vkCmdSetPrimitiveRestartEnable)}, - VulkanFunction{"vkCmdSetPrimitiveTopology", to_vkVoidFunction(test_vkCmdSetPrimitiveTopology)}, - VulkanFunction{"vkCmdSetRasterizerDiscardEnable", to_vkVoidFunction(test_vkCmdSetRasterizerDiscardEnable)}, - VulkanFunction{"vkCmdSetScissorWithCount", to_vkVoidFunction(test_vkCmdSetScissorWithCount)}, - VulkanFunction{"vkCmdSetStencilOp", to_vkVoidFunction(test_vkCmdSetStencilOp)}, - VulkanFunction{"vkCmdSetStencilTestEnable", to_vkVoidFunction(test_vkCmdSetStencilTestEnable)}, - VulkanFunction{"vkCmdSetViewportWithCount", to_vkVoidFunction(test_vkCmdSetViewportWithCount)}, - VulkanFunction{"vkCmdWaitEvents2", to_vkVoidFunction(test_vkCmdWaitEvents2)}, - VulkanFunction{"vkCmdWriteTimestamp2", to_vkVoidFunction(test_vkCmdWriteTimestamp2)}, - VulkanFunction{"vkCreatePrivateDataSlot", to_vkVoidFunction(test_vkCreatePrivateDataSlot)}, - VulkanFunction{"vkDestroyPrivateDataSlot", to_vkVoidFunction(test_vkDestroyPrivateDataSlot)}, - VulkanFunction{"vkGetDeviceBufferMemoryRequirements", to_vkVoidFunction(test_vkGetDeviceBufferMemoryRequirements)}, - VulkanFunction{"vkGetDeviceImageMemoryRequirements", to_vkVoidFunction(test_vkGetDeviceImageMemoryRequirements)}, - VulkanFunction{"vkGetDeviceImageSparseMemoryRequirements", - to_vkVoidFunction(test_vkGetDeviceImageSparseMemoryRequirements)}, - VulkanFunction{"vkGetPrivateData", to_vkVoidFunction(test_vkGetPrivateData)}, - VulkanFunction{"vkQueueSubmit2", to_vkVoidFunction(test_vkQueueSubmit2)}, - VulkanFunction{"vkSetPrivateData", to_vkVoidFunction(test_vkSetPrivateData)}, - }); - icd_phys_dev.extensions.push_back({"VK_SOME_EXT_haha"}); + auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + driver.physical_devices.back().known_device_functions = { + VulkanFunction{"vkCmdBeginRendering", to_vkVoidFunction(test_vkCmdBeginRendering)}, + VulkanFunction{"vkCmdBindVertexBuffers2", to_vkVoidFunction(test_vkCmdBindVertexBuffers2)}, + VulkanFunction{"vkCmdBlitImage2", to_vkVoidFunction(test_vkCmdBlitImage2)}, + VulkanFunction{"vkCmdCopyBuffer2", to_vkVoidFunction(test_vkCmdCopyBuffer2)}, + VulkanFunction{"vkCmdCopyBufferToImage2", to_vkVoidFunction(test_vkCmdCopyBufferToImage2)}, + VulkanFunction{"vkCmdCopyImage2", to_vkVoidFunction(test_vkCmdCopyImage2)}, + VulkanFunction{"vkCmdCopyImageToBuffer2", to_vkVoidFunction(test_vkCmdCopyImageToBuffer2)}, + VulkanFunction{"vkCmdEndRendering", to_vkVoidFunction(test_vkCmdEndRendering)}, + VulkanFunction{"vkCmdPipelineBarrier2", to_vkVoidFunction(test_vkCmdPipelineBarrier2)}, + VulkanFunction{"vkCmdResetEvent2", to_vkVoidFunction(test_vkCmdResetEvent2)}, + VulkanFunction{"vkCmdResolveImage2", to_vkVoidFunction(test_vkCmdResolveImage2)}, + VulkanFunction{"vkCmdSetCullMode", to_vkVoidFunction(test_vkCmdSetCullMode)}, + VulkanFunction{"vkCmdSetDepthBiasEnable", to_vkVoidFunction(test_vkCmdSetDepthBiasEnable)}, + VulkanFunction{"vkCmdSetDepthBoundsTestEnable", to_vkVoidFunction(test_vkCmdSetDepthBoundsTestEnable)}, + VulkanFunction{"vkCmdSetDepthCompareOp", to_vkVoidFunction(test_vkCmdSetDepthCompareOp)}, + VulkanFunction{"vkCmdSetDepthTestEnable", to_vkVoidFunction(test_vkCmdSetDepthTestEnable)}, + VulkanFunction{"vkCmdSetDepthWriteEnable", to_vkVoidFunction(test_vkCmdSetDepthWriteEnable)}, + VulkanFunction{"vkCmdSetEvent2", to_vkVoidFunction(test_vkCmdSetEvent2)}, + VulkanFunction{"vkCmdSetFrontFace", to_vkVoidFunction(test_vkCmdSetFrontFace)}, + VulkanFunction{"vkCmdSetPrimitiveRestartEnable", to_vkVoidFunction(test_vkCmdSetPrimitiveRestartEnable)}, + VulkanFunction{"vkCmdSetPrimitiveTopology", to_vkVoidFunction(test_vkCmdSetPrimitiveTopology)}, + VulkanFunction{"vkCmdSetRasterizerDiscardEnable", to_vkVoidFunction(test_vkCmdSetRasterizerDiscardEnable)}, + VulkanFunction{"vkCmdSetScissorWithCount", to_vkVoidFunction(test_vkCmdSetScissorWithCount)}, + VulkanFunction{"vkCmdSetStencilOp", to_vkVoidFunction(test_vkCmdSetStencilOp)}, + VulkanFunction{"vkCmdSetStencilTestEnable", to_vkVoidFunction(test_vkCmdSetStencilTestEnable)}, + VulkanFunction{"vkCmdSetViewportWithCount", to_vkVoidFunction(test_vkCmdSetViewportWithCount)}, + VulkanFunction{"vkCmdWaitEvents2", to_vkVoidFunction(test_vkCmdWaitEvents2)}, + VulkanFunction{"vkCmdWriteTimestamp2", to_vkVoidFunction(test_vkCmdWriteTimestamp2)}, + VulkanFunction{"vkCreatePrivateDataSlot", to_vkVoidFunction(test_vkCreatePrivateDataSlot)}, + VulkanFunction{"vkDestroyPrivateDataSlot", to_vkVoidFunction(test_vkDestroyPrivateDataSlot)}, + VulkanFunction{"vkGetDeviceBufferMemoryRequirements", to_vkVoidFunction(test_vkGetDeviceBufferMemoryRequirements)}, + VulkanFunction{"vkGetDeviceImageMemoryRequirements", to_vkVoidFunction(test_vkGetDeviceImageMemoryRequirements)}, + VulkanFunction{"vkGetDeviceImageSparseMemoryRequirements", + to_vkVoidFunction(test_vkGetDeviceImageSparseMemoryRequirements)}, + VulkanFunction{"vkGetPrivateData", to_vkVoidFunction(test_vkGetPrivateData)}, + VulkanFunction{"vkQueueSubmit2", to_vkVoidFunction(test_vkQueueSubmit2)}, + VulkanFunction{"vkSetPrivateData", to_vkVoidFunction(test_vkSetPrivateData)}, + }; + driver.physical_devices.back().add_extension({"VK_SOME_EXT_haha"}); InstWrapper inst{env.vulkan_functions}; inst.create_info.set_api_version(1, 3, 0); inst.CheckCreate(); auto phys_dev = inst.GetPhysDev(); - auto GetPhysicalDeviceToolProperties = reinterpret_cast( - inst.functions->vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceToolProperties")); + PFN_vkGetPhysicalDeviceToolProperties GetPhysicalDeviceToolProperties = inst.load("vkGetPhysicalDeviceToolProperties"); uint32_t tool_count = 0; ASSERT_EQ(VK_SUCCESS, GetPhysicalDeviceToolProperties(phys_dev, &tool_count, nullptr)); ASSERT_EQ(tool_count, 0U); @@ -651,12 +646,9 @@ TEST(MinorVersionUpdate, Version1_3) { DeviceWrapper device{inst}; device.CheckCreate(phys_dev); - auto CreateCommandPool = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCreateCommandPool")); - auto AllocateCommandBuffers = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkAllocateCommandBuffers")); - auto DestroyCommandPool = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkDestroyCommandPool")); + PFN_vkCreateCommandPool CreateCommandPool = device.load("vkCreateCommandPool"); + PFN_vkAllocateCommandBuffers AllocateCommandBuffers = device.load("vkAllocateCommandBuffers"); + PFN_vkDestroyCommandPool DestroyCommandPool = device.load("vkDestroyCommandPool"); VkCommandPool command_pool{}; VkCommandPoolCreateInfo pool_create_info{}; pool_create_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; @@ -669,147 +661,121 @@ TEST(MinorVersionUpdate, Version1_3) { ASSERT_EQ(VK_SUCCESS, AllocateCommandBuffers(device, &buffer_allocate_info, &command_buffer)); DestroyCommandPool(device, command_pool, nullptr); - auto CmdBeginRendering = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdBeginRendering")); + PFN_vkCmdBeginRendering CmdBeginRendering = device.load("vkCmdBeginRendering"); VkRenderingInfoKHR rendering_info{}; CmdBeginRendering(command_buffer, &rendering_info); - auto CmdBindVertexBuffers2 = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdBindVertexBuffers2")); + PFN_vkCmdBindVertexBuffers2 CmdBindVertexBuffers2 = device.load("vkCmdBindVertexBuffers2"); CmdBindVertexBuffers2(command_buffer, 0, 0, nullptr, nullptr, nullptr, nullptr); - auto CmdBlitImage2 = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdBlitImage2")); + PFN_vkCmdBlitImage2 CmdBlitImage2 = device.load("vkCmdBlitImage2"); VkBlitImageInfo2 image_info{}; CmdBlitImage2(command_buffer, &image_info); - auto CmdCopyBuffer2 = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdCopyBuffer2")); + PFN_vkCmdCopyBuffer2 CmdCopyBuffer2 = device.load("vkCmdCopyBuffer2"); VkCopyBufferInfo2 copy_info{}; CmdCopyBuffer2(command_buffer, ©_info); - auto CmdCopyBufferToImage2 = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdCopyBufferToImage2")); + PFN_vkCmdCopyBufferToImage2 CmdCopyBufferToImage2 = device.load("vkCmdCopyBufferToImage2"); VkCopyBufferToImageInfo2 copy_buf_image{}; CmdCopyBufferToImage2(command_buffer, ©_buf_image); - auto CmdCopyImage2 = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdCopyImage2")); + PFN_vkCmdCopyImage2 CmdCopyImage2 = device.load("vkCmdCopyImage2"); VkCopyImageInfo2 copy_image_info{}; CmdCopyImage2(command_buffer, ©_image_info); - auto CmdCopyImageToBuffer2 = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdCopyImageToBuffer2")); + PFN_vkCmdCopyImageToBuffer2 CmdCopyImageToBuffer2 = device.load("vkCmdCopyImageToBuffer2"); VkCopyImageToBufferInfo2 copy_image_buf; CmdCopyImageToBuffer2(command_buffer, ©_image_buf); - auto CmdEndRendering = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdEndRendering")); + PFN_vkCmdEndRendering CmdEndRendering = device.load("vkCmdEndRendering"); CmdEndRendering(command_buffer); - auto CmdPipelineBarrier2 = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdPipelineBarrier2")); + PFN_vkCmdPipelineBarrier2 CmdPipelineBarrier2 = device.load("vkCmdPipelineBarrier2"); VkDependencyInfo deps_info; CmdPipelineBarrier2(command_buffer, &deps_info); - auto CmdResetEvent2 = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdResetEvent2")); + PFN_vkCmdResetEvent2 CmdResetEvent2 = device.load("vkCmdResetEvent2"); CmdResetEvent2(command_buffer, {}, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT); - auto CmdResolveImage2 = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdResolveImage2")); + PFN_vkCmdResolveImage2 CmdResolveImage2 = device.load("vkCmdResolveImage2"); VkResolveImageInfo2 resolve_image{}; CmdResolveImage2(command_buffer, &resolve_image); - auto CmdSetCullMode = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetCullMode")); + PFN_vkCmdSetCullMode CmdSetCullMode = device.load("vkCmdSetCullMode"); CmdSetCullMode(command_buffer, VK_CULL_MODE_BACK_BIT); - auto CmdSetDepthBiasEnable = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetDepthBiasEnable")); + PFN_vkCmdSetDepthBiasEnable CmdSetDepthBiasEnable = device.load("vkCmdSetDepthBiasEnable"); CmdSetDepthBiasEnable(command_buffer, true); - auto CmdSetDepthBoundsTestEnable = reinterpret_cast( - inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetDepthBoundsTestEnable")); + PFN_vkCmdSetDepthBoundsTestEnable CmdSetDepthBoundsTestEnable = device.load("vkCmdSetDepthBoundsTestEnable"); CmdSetDepthBoundsTestEnable(command_buffer, true); - auto CmdSetDepthCompareOp = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetDepthCompareOp")); + PFN_vkCmdSetDepthCompareOp CmdSetDepthCompareOp = device.load("vkCmdSetDepthCompareOp"); CmdSetDepthCompareOp(command_buffer, VK_COMPARE_OP_ALWAYS); - auto CmdSetDepthTestEnable = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetDepthTestEnable")); + PFN_vkCmdSetDepthTestEnable CmdSetDepthTestEnable = device.load("vkCmdSetDepthTestEnable"); CmdSetDepthTestEnable(command_buffer, true); - auto CmdSetDepthWriteEnable = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetDepthWriteEnable")); + PFN_vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable = device.load("vkCmdSetDepthWriteEnable"); CmdSetDepthWriteEnable(command_buffer, true); - auto CmdSetEvent2 = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetEvent2")); + PFN_vkCmdSetEvent2 CmdSetEvent2 = device.load("vkCmdSetEvent2"); CmdSetEvent2(command_buffer, {}, &deps_info); - auto CmdSetFrontFace = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetFrontFace")); + PFN_vkCmdSetFrontFace CmdSetFrontFace = device.load("vkCmdSetFrontFace"); CmdSetFrontFace(command_buffer, VK_FRONT_FACE_CLOCKWISE); - auto CmdSetPrimitiveRestartEnable = reinterpret_cast( - inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetPrimitiveRestartEnable")); + PFN_vkCmdSetPrimitiveRestartEnable CmdSetPrimitiveRestartEnable = device.load("vkCmdSetPrimitiveRestartEnable"); CmdSetPrimitiveRestartEnable(command_buffer, true); - auto CmdSetPrimitiveTopology = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetPrimitiveTopology")); + PFN_vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology = device.load("vkCmdSetPrimitiveTopology"); CmdSetPrimitiveTopology(command_buffer, VK_PRIMITIVE_TOPOLOGY_LINE_LIST); - auto CmdSetRasterizerDiscardEnable = reinterpret_cast( - inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetRasterizerDiscardEnable")); + PFN_vkCmdSetRasterizerDiscardEnable CmdSetRasterizerDiscardEnable = device.load("vkCmdSetRasterizerDiscardEnable"); CmdSetRasterizerDiscardEnable(command_buffer, true); - auto CmdSetScissorWithCount = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetScissorWithCount")); + PFN_vkCmdSetScissorWithCount CmdSetScissorWithCount = device.load("vkCmdSetScissorWithCount"); CmdSetScissorWithCount(command_buffer, 0, nullptr); - auto CmdSetStencilOp = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetStencilOp")); + PFN_vkCmdSetStencilOp CmdSetStencilOp = device.load("vkCmdSetStencilOp"); CmdSetStencilOp(command_buffer, VK_STENCIL_FACE_BACK_BIT, VK_STENCIL_OP_DECREMENT_AND_WRAP, VK_STENCIL_OP_DECREMENT_AND_CLAMP, VK_STENCIL_OP_DECREMENT_AND_WRAP, VK_COMPARE_OP_ALWAYS); - auto CmdSetStencilTestEnable = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetStencilTestEnable")); + PFN_vkCmdSetStencilTestEnable CmdSetStencilTestEnable = device.load("vkCmdSetStencilTestEnable"); CmdSetStencilTestEnable(command_buffer, true); - auto CmdSetViewportWithCount = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdSetViewportWithCount")); + PFN_vkCmdSetViewportWithCount CmdSetViewportWithCount = device.load("vkCmdSetViewportWithCount"); CmdSetViewportWithCount(command_buffer, 0, nullptr); - auto CmdWaitEvents2 = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdWaitEvents2")); + PFN_vkCmdWaitEvents2 CmdWaitEvents2 = device.load("vkCmdWaitEvents2"); CmdWaitEvents2(command_buffer, 0, nullptr, &deps_info); - auto CmdWriteTimestamp2 = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCmdWriteTimestamp2")); + PFN_vkCmdWriteTimestamp2 CmdWriteTimestamp2 = device.load("vkCmdWriteTimestamp2"); CmdWriteTimestamp2(command_buffer, VK_PIPELINE_STAGE_2_BLIT_BIT, {}, 0); - auto CreatePrivateDataSlot = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkCreatePrivateDataSlot")); + PFN_vkCreatePrivateDataSlot CreatePrivateDataSlot = device.load("vkCreatePrivateDataSlot"); CreatePrivateDataSlot(device, nullptr, nullptr, nullptr); - auto DestroyPrivateDataSlot = - reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkDestroyPrivateDataSlot")); + PFN_vkDestroyPrivateDataSlot DestroyPrivateDataSlot = device.load("vkDestroyPrivateDataSlot"); DestroyPrivateDataSlot(device, VK_NULL_HANDLE, nullptr); - auto GetDeviceBufferMemoryRequirements = reinterpret_cast( - inst.functions->vkGetDeviceProcAddr(device, "vkGetDeviceBufferMemoryRequirements")); + PFN_vkGetDeviceBufferMemoryRequirements GetDeviceBufferMemoryRequirements = device.load("vkGetDeviceBufferMemoryRequirements"); GetDeviceBufferMemoryRequirements(device, nullptr, nullptr); - auto GetDeviceImageMemoryRequirements = reinterpret_cast( - inst.functions->vkGetDeviceProcAddr(device, "vkGetDeviceImageMemoryRequirements")); + PFN_vkGetDeviceImageMemoryRequirements GetDeviceImageMemoryRequirements = device.load("vkGetDeviceImageMemoryRequirements"); GetDeviceImageMemoryRequirements(device, nullptr, nullptr); - auto GetDeviceImageSparseMemoryRequirements = reinterpret_cast( - inst.functions->vkGetDeviceProcAddr(device, "vkGetDeviceImageSparseMemoryRequirements")); + PFN_vkGetDeviceImageSparseMemoryRequirements GetDeviceImageSparseMemoryRequirements = + device.load("vkGetDeviceImageSparseMemoryRequirements"); GetDeviceImageSparseMemoryRequirements(device, nullptr, nullptr, nullptr); - auto GetPrivateData = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkGetPrivateData")); + PFN_vkGetPrivateData GetPrivateData = device.load("vkGetPrivateData"); GetPrivateData(device, VK_OBJECT_TYPE_UNKNOWN, 0, {}, nullptr); - auto QueueSubmit2 = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkQueueSubmit2")); + PFN_vkQueueSubmit2 QueueSubmit2 = device.load("vkQueueSubmit2"); QueueSubmit2(nullptr, 0, nullptr, VK_NULL_HANDLE); - auto SetPrivateData = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkSetPrivateData")); + PFN_vkSetPrivateData SetPrivateData = device.load("vkSetPrivateData"); SetPrivateData(device, VK_OBJECT_TYPE_UNKNOWN, 0, {}, 0); } TEST(ApplicationInfoVersion, NonVulkanVariant) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); DebugUtilsLogger log; InstWrapper inst{env.vulkan_functions}; @@ -823,8 +789,7 @@ TEST(ApplicationInfoVersion, NonVulkanVariant) { TEST(DriverManifest, NonVulkanVariant) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(1, 1, 0, 0))); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(1, 1, 0, 0))).add_physical_device({}); DebugUtilsLogger log; InstWrapper inst{env.vulkan_functions}; @@ -838,8 +803,7 @@ TEST(DriverManifest, NonVulkanVariant) { TEST(LayerManifest, ImplicitNonVulkanVariant) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 0, 0))); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 0, 0))).add_physical_device({}); const char* implicit_layer_name = "ImplicitTestLayer"; env.add_implicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -854,14 +818,13 @@ TEST(LayerManifest, ImplicitNonVulkanVariant) { inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); FillDebugUtilsCreateDetails(inst.create_info, log); inst.CheckCreate(); - ASSERT_TRUE(log.find(std::string("Layer ") + implicit_layer_name + - " has an \'api_version\' field which contains a non-zero variant value of 1. Skipping Layer.")); + ASSERT_TRUE(log.find(std::string("Layer \"") + implicit_layer_name + + "\" has an \'api_version\' field which contains a non-zero variant value of 1. Skipping Layer.")); } TEST(LayerManifest, ExplicitNonVulkanVariant) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 0, 0))); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_API_VERSION(0, 1, 0, 0))).add_physical_device({}); const char* explicit_layer_name = "ExplicitTestLayer"; env.add_explicit_layer(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{} @@ -875,15 +838,15 @@ TEST(LayerManifest, ExplicitNonVulkanVariant) { inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)).add_layer(explicit_layer_name); FillDebugUtilsCreateDetails(inst.create_info, log); inst.CheckCreate(VK_ERROR_LAYER_NOT_PRESENT); - 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.")); + 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.")); } TEST(DriverManifest, UnknownManifestVersion) { FrameworkEnvironment env{}; env.add_icd( - TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_file_format_version({3, 2, 1}))); - env.get_test_icd().physical_devices.push_back({}); + TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_file_format_version({3, 2, 1}))) + .add_physical_device({}); DebugUtilsLogger log; InstWrapper inst{env.vulkan_functions}; @@ -895,16 +858,31 @@ TEST(DriverManifest, UnknownManifestVersion) { ASSERT_TRUE(log.find("has unknown icd manifest file version 3.2.1. May cause errors.")); } +TEST(DriverManifest, LargeUnknownManifestVersion) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails( + ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_file_format_version({100, 222, 111}))) + .add_physical_device({}); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + FillDebugUtilsCreateDetails(inst.create_info, log); + inst.CheckCreate(); + ASSERT_TRUE(log.find("loader_parse_icd_manifest: ")); + // log prints the path to the file, don't look for it since it is hard to determine inside the test what the path should be. + ASSERT_TRUE(log.find("has unknown icd manifest file version 100.222.111. May cause errors.")); +} + TEST(LayerManifest, UnknownManifestVersion) { FrameworkEnvironment env{}; - env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); - env.get_test_icd().physical_devices.push_back({}); + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); const char* implicit_layer_name = "ImplicitTestLayer"; env.add_implicit_layer(ManifestLayer{} .add_layer(ManifestLayer::LayerDescription{} .set_name(implicit_layer_name) - .set_api_version(VK_MAKE_API_VERSION(1, 1, 0, 0)) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_disable_environment("DISABLE_ME")) .set_file_format_version({3, 2, 1}), @@ -919,3 +897,507 @@ TEST(LayerManifest, UnknownManifestVersion) { // log prints the path to the file, don't look for it since it is hard to determine inside the test what the path should be. ASSERT_TRUE(log.find("has unknown layer manifest file version 3.2.1. May cause errors.")); } + +TEST(LayerManifest, LargeUnknownManifestVersion) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)).add_physical_device({}); + + const char* implicit_layer_name = "ImplicitTestLayer"; + env.add_implicit_layer(ManifestLayer{} + .add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")) + .set_file_format_version({100, 222, 111}), + "implicit_test_layer.json"); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + FillDebugUtilsCreateDetails(inst.create_info, log); + inst.CheckCreate(); + ASSERT_TRUE(log.find("loader_add_layer_properties: ")); + // log prints the path to the file, don't look for it since it is hard to determine inside the test what the path should be. + ASSERT_TRUE(log.find("has unknown layer manifest file version 100.222.111. May cause errors.")); +} + +struct DriverInfo { + DriverInfo(TestICDDetails icd_details, uint32_t driver_version, bool expect_to_find) noexcept + : icd_details(icd_details), driver_version(driver_version), expect_to_find(expect_to_find) {} + TestICDDetails icd_details; + uint32_t driver_version = 0; + bool expect_to_find = false; +}; + +void CheckDirectDriverLoading(FrameworkEnvironment& env, std::vector const& normal_drivers, + std::vector const& direct_drivers, bool exclusive) { + std::vector ddl_infos; + uint32_t expected_driver_count = 0; + + for (auto const& driver : direct_drivers) { + auto& direct_driver_icd = env.add_icd(driver.icd_details); + direct_driver_icd.physical_devices.push_back({}); + direct_driver_icd.physical_devices.at(0).properties.driverVersion = driver.driver_version; + 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"); + ddl_infos.push_back(ddl_info); + if (driver.expect_to_find) { + expected_driver_count++; + } + } + + for (auto const& driver : normal_drivers) { + auto& direct_driver_icd = env.add_icd(driver.icd_details); + direct_driver_icd.physical_devices.push_back({}); + direct_driver_icd.physical_devices.at(0).properties.driverVersion = driver.driver_version; + if (!exclusive && driver.expect_to_find) { + expected_driver_count++; + } + } + + VkDirectDriverLoadingListLUNARG ddl_list{}; + ddl_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; + ddl_list.mode = exclusive ? VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG : VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; + ddl_list.driverCount = static_cast(ddl_infos.size()); + ddl_list.pDrivers = ddl_infos.data(); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + + if (exclusive) { + ASSERT_TRUE( + log.find("loader_scan_for_direct_drivers: The VK_LUNARG_direct_driver_loading extension is active and specified " + "VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG, skipping system and environment " + "variable driver search mechanisms.")); + } + + // Make sure all drivers we expect to load were found - including checking that the pfn matches exactly. + for (uint32_t i = 0; i < direct_drivers.size(); i++) { + if (direct_drivers.at(i).expect_to_find) { + std::stringstream ss; + ss << "loader_add_direct_driver: Adding driver found in index " << i + << " of VkDirectDriverLoadingListLUNARG::pDrivers structure. pfnGetInstanceProcAddr was set to " + << reinterpret_cast(ddl_infos.at(i).pfnGetInstanceProcAddr); + std::string log_message = ss.str(); + ASSERT_TRUE(log.find(log_message)); + } + } + + auto phys_devs = inst.GetPhysDevs(); + ASSERT_EQ(phys_devs.size(), expected_driver_count); + + // We have to iterate through the driver lists backwards because the loader *prepends* icd's, so the last found ICD is found + // first in the driver list + uint32_t driver_index = 0; + for (size_t i = normal_drivers.size() - 1; i == 0; i--) { + if (normal_drivers.at(i).expect_to_find) { + VkPhysicalDeviceProperties props{}; + inst.functions->vkGetPhysicalDeviceProperties(phys_devs.at(driver_index), &props); + ASSERT_EQ(props.driverVersion, normal_drivers.at(i).driver_version); + driver_index++; + } + } + for (size_t i = direct_drivers.size() - 1; i == 0; i--) { + if (direct_drivers.at(i).expect_to_find) { + VkPhysicalDeviceProperties props{}; + inst.functions->vkGetPhysicalDeviceProperties(phys_devs.at(driver_index), &props); + ASSERT_EQ(props.driverVersion, direct_drivers.at(i).driver_version); + driver_index++; + } + } +} + +// Only 1 direct driver +TEST(DirectDriverLoading, Individual) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 10, true); + + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, false)); +} + +// 2 direct drivers +TEST(DirectDriverLoading, MultipleDirectDrivers) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 13, true); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 7, true); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, false)); +} + +// Multiple direct drivers with a normal driver in the middle +TEST(DirectDriverLoading, MultipleDirectDriversAndNormalDrivers) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + normal_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA), 90, true); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 80, true); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 70, true); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, false)); +} + +// Normal driver and direct driver with direct driver exclusivity +TEST(DirectDriverLoading, ExclusiveWithNormalDriver) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 33, true); + normal_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_2), 44, false); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, true)); +} + +TEST(DirectDriverLoading, ExclusiveWithMultipleNormalDriver) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + normal_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_2), 55, true); + normal_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_2), 66, true); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 77, true); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, true)); +} + +TEST(DirectDriverLoading, ExclusiveWithDriverEnvVar) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + normal_drivers.emplace_back( + TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_discovery_type(ManifestDiscoveryType::env_var), 4, false); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 5, true); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, true)); +} + +TEST(DirectDriverLoading, ExclusiveWithAddDriverEnvVar) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + + normal_drivers.emplace_back( + TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_discovery_type(ManifestDiscoveryType::add_env_var), 6, false); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 7, true); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, true)); +} + +TEST(DirectDriverLoading, InclusiveWithFilterSelect) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + + EnvVarWrapper driver_filter_select_env_var{"VK_LOADER_DRIVERS_SELECT", "normal_driver.json"}; + + normal_drivers.emplace_back( + TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_disable_icd_inc(true).set_json_name("normal_driver"), 8, true); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 9, true); + + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, false)); +} + +TEST(DirectDriverLoading, ExclusiveWithFilterSelect) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + + EnvVarWrapper driver_filter_select_env_var{"VK_LOADER_DRIVERS_SELECT", "normal_driver.json"}; + + normal_drivers.emplace_back( + TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_disable_icd_inc(true).set_json_name("normal_driver"), 10, + false); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 11, true); + + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, true)); +} + +TEST(DirectDriverLoading, InclusiveWithFilterDisable) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + + EnvVarWrapper driver_filter_disable_env_var{"VK_LOADER_DRIVERS_DISABLE", "normal_driver.json"}; + + normal_drivers.emplace_back( + TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_disable_icd_inc(true).set_json_name("normal_driver"), 12, + false); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 13, true); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, false)); +} + +TEST(DirectDriverLoading, ExclusiveWithFilterDisable) { + FrameworkEnvironment env{}; + std::vector normal_drivers; + std::vector direct_drivers; + + EnvVarWrapper driver_filter_disable_env_var{"VK_LOADER_DRIVERS_DISABLE", "normal_driver.json"}; + + normal_drivers.emplace_back( + TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_disable_icd_inc(true).set_json_name("normal_driver"), 14, + false); + direct_drivers.emplace_back(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none), 15, true); + ASSERT_NO_FATAL_FAILURE(CheckDirectDriverLoading(env, normal_drivers, direct_drivers, true)); +} + +// The VK_LUNARG_direct_driver_loading extension is not enabled +TEST(DirectDriverLoading, ExtensionNotEnabled) { + FrameworkEnvironment env{}; + + auto& direct_driver_icd = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)); + direct_driver_icd.physical_devices.push_back({}); + + 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"); + + VkDirectDriverLoadingListLUNARG ddl_list{}; + ddl_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; + ddl_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; + ddl_list.driverCount = 1U; + ddl_list.pDrivers = &ddl_info; + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_scan_for_direct_drivers: The pNext chain of VkInstanceCreateInfo contained the " + "VkDirectDriverLoadingListLUNARG structure, but the VK_LUNARG_direct_driver_loading extension was " + "not enabled.")); +} + +// VkDirectDriverLoadingListLUNARG is not in the pNext chain of VkInstanceCreateInfo +TEST(DirectDriverLoading, DriverListNotInPnextChain) { + FrameworkEnvironment env{}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)).add_physical_device({}); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_scan_for_direct_drivers: The VK_LUNARG_direct_driver_loading extension was enabled but the pNext chain of " + "VkInstanceCreateInfo did not contain the " + "VkDirectDriverLoadingListLUNARG structure.")); +} + +// User sets the pDrivers pointer in VkDirectDriverLoadingListLUNARG to nullptr +TEST(DirectDriverLoading, DriverListHasNullDriverPointer) { + FrameworkEnvironment env{}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)).add_physical_device({}); + + VkDirectDriverLoadingListLUNARG ddl_list{}; + ddl_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; + ddl_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; + ddl_list.driverCount = 1U; + ddl_list.pDrivers = nullptr; // user forgot to set the pDrivers + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_scan_for_direct_drivers: The VkDirectDriverLoadingListLUNARG structure in the pNext chain of " + "VkInstanceCreateInfo has a NULL pDrivers member.")); +} + +// User sets the driverCount in VkDirectDriverLoadingListLUNARG to zero +TEST(DirectDriverLoading, DriverListHasZeroInfoCount) { + FrameworkEnvironment env{}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)).add_physical_device({}); + + 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"); + + VkDirectDriverLoadingListLUNARG ddl_list{}; + ddl_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; + ddl_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; + ddl_list.driverCount = 0; // user set 0 for the info list + ddl_list.pDrivers = &ddl_info; + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_scan_for_direct_drivers: The VkDirectDriverLoadingListLUNARG structure in the pNext chain of " + "VkInstanceCreateInfo has a non-null pDrivers member but a driverCount member with a value " + "of zero.")); +} + +// pfnGetInstanceProcAddr in VkDirectDriverLoadingInfoLUNARG is nullptr +TEST(DirectDriverLoading, DriverInfoMissingGetInstanceProcAddr) { + FrameworkEnvironment env{}; + + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)).add_physical_device({}); + + std::array ddl_infos{}; + ddl_infos[0].sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_INFO_LUNARG; + ddl_infos[0].pfnGetInstanceProcAddr = nullptr; // user didn't set the pfnGetInstanceProcAddr to the driver's handle + + ddl_infos[1].sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_INFO_LUNARG; + ddl_infos[1].pfnGetInstanceProcAddr = nullptr; // user didn't set the pfnGetInstanceProcAddr to the driver's handle + + VkDirectDriverLoadingListLUNARG ddl_list{}; + ddl_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; + ddl_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; + ddl_list.driverCount = static_cast(ddl_infos.size()); + ddl_list.pDrivers = ddl_infos.data(); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_add_direct_driver: VkDirectDriverLoadingInfoLUNARG structure at index 0 contains a NULL pointer for the " + "pfnGetInstanceProcAddr member, skipping.")); + ASSERT_TRUE( + log.find("loader_add_direct_driver: VkDirectDriverLoadingInfoLUNARG structure at index 1 contains a NULL pointer for the " + "pfnGetInstanceProcAddr member, skipping.")); +} + +// test the various error paths in loader_add_direct_driver +TEST(DirectDriverLoading, DriverDoesNotExportNegotiateFunction) { + FrameworkEnvironment env{}; + + auto& direct_driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_7).set_discovery_type(ManifestDiscoveryType::none)) + .add_physical_device({}) + .set_exposes_vk_icdNegotiateLoaderICDInterfaceVersion(false) + .set_exposes_vkCreateInstance(false) + .set_exposes_vkEnumerateInstanceExtensionProperties(false); + + 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"); + + VkDirectDriverLoadingListLUNARG ddl_list{}; + ddl_list.sType = VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG; + ddl_list.mode = VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG; + ddl_list.driverCount = 1; + ddl_list.pDrivers = &ddl_info; + + { + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_add_direct_driver: Could not get 'vk_icdNegotiateLoaderICDInterfaceVersion' from " + "VkDirectDriverLoadingInfoLUNARG structure at " + "index 0, skipping.")); + } + + // Allow the negotiate function to be found, now it should fail to find instance creation function + direct_driver.set_exposes_vk_icdNegotiateLoaderICDInterfaceVersion(true); + direct_driver.set_max_icd_interface_version(4); + + { + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE(log.find( + "loader_add_direct_driver: VkDirectDriverLoadingInfoLUNARG structure at index 0 supports interface version 4, " + "which is incompatible with the Loader Driver Interface version that supports the VK_LUNARG_direct_driver_loading " + "extension, skipping.")); + } + direct_driver.set_max_icd_interface_version(7); + + { + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_add_direct_driver: Could not get 'vkEnumerateInstanceExtensionProperties' from " + "VkDirectDriverLoadingInfoLUNARG structure at index 0, skipping.")); + } + + // Allow the instance creation function to be found, now it should fail to find EnumInstExtProps + direct_driver.set_exposes_vkCreateInstance(true); + + { + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + FillDebugUtilsCreateDetails(inst.create_info, log); + log.get()->pNext = reinterpret_cast(&ddl_list); + inst.create_info.add_extension(VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME); + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate(VK_ERROR_INCOMPATIBLE_DRIVER)); + + ASSERT_TRUE( + log.find("loader_add_direct_driver: Could not get 'vkEnumerateInstanceExtensionProperties' from " + "VkDirectDriverLoadingInfoLUNARG structure at index 0, skipping.")); + } +} + +TEST(DriverManifest, VersionMismatchWithEnumerateInstanceVersion) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_icd_api_version(VK_API_VERSION_1_0) + .add_physical_device({}); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(std::string("terminator_CreateInstance: Manifest ICD for \"") + env.get_test_icd_path().str() + + "\" contained a 1.1 or greater API version, but " + "vkEnumerateInstanceVersion returned 1.0, treating as a 1.0 ICD")); +} + +TEST(DriverManifest, EnumerateInstanceVersionNotSupported) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_API_VERSION_1_1)) + .set_icd_api_version(VK_API_VERSION_1_0) + .set_can_query_vkEnumerateInstanceVersion(false) + .add_physical_device({}); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_extension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + FillDebugUtilsCreateDetails(inst.create_info, env.debug_log); + inst.CheckCreate(); + + ASSERT_TRUE(env.debug_log.find(std::string("terminator_CreateInstance: Manifest ICD for \"") + env.get_test_icd_path().str() + + "\" contained a 1.1 or greater API version, but does " + "not support vkEnumerateInstanceVersion, treating as a 1.0 ICD")); +} diff --git a/tests/loader_wsi_tests.cpp b/tests/loader_wsi_tests.cpp index 265c2cc233a46c5b09f8d404af3dcfe5e05ec118..99e8bcbc5c06e998654bebd199448d11c0826b9d 100644 --- a/tests/loader_wsi_tests.cpp +++ b/tests/loader_wsi_tests.cpp @@ -37,7 +37,6 @@ TEST(WsiTests, CreateSurfaceWin32NoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); InstWrapper inst{env.vulkan_functions}; inst.create_info.add_extensions({VK_KHR_WIN32_SURFACE_EXTENSION_NAME}); @@ -55,7 +54,6 @@ TEST(WsiTests, CreateSurfaceWin32NoICDCreateSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = false; @@ -68,7 +66,6 @@ TEST(WsiTests, CreateSurfaceWin32NoICDCreateSupport) { VkWin32SurfaceCreateInfoKHR surf_create_info{VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR}; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkCreateWin32SurfaceKHR(inst, &surf_create_info, nullptr, &surface)); ASSERT_TRUE(surface != VK_NULL_HANDLE); - // ASSERT_EQ(cur_icd.is_using_icd_wsi, UsingICDProvidedWSI::not_using); env.vulkan_functions.vkDestroySurfaceKHR(inst, surface, nullptr); } @@ -79,7 +76,6 @@ TEST(WsiTests, CreateSurfaceWin32ICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = true; @@ -92,7 +88,6 @@ TEST(WsiTests, CreateSurfaceWin32ICDSupport) { VkWin32SurfaceCreateInfoKHR surf_create_info{VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR}; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkCreateWin32SurfaceKHR(inst, &surf_create_info, nullptr, &surface)); ASSERT_TRUE(surface != VK_NULL_HANDLE); - // ASSERT_EQ(cur_icd.is_using_icd_wsi, UsingICDProvidedWSI::not_using); env.vulkan_functions.vkDestroySurfaceKHR(inst, surface, nullptr); } @@ -121,7 +116,6 @@ TEST(WsiTests, CreateSurfaceWin32MixedICDSupport) { VkWin32SurfaceCreateInfoKHR surf_create_info{VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR}; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkCreateWin32SurfaceKHR(instance.inst, &surf_create_info, nullptr, &surface)); ASSERT_TRUE(surface != VK_NULL_HANDLE); - // ASSERT_EQ(cur_icd.is_using_icd_wsi, UsingICDProvidedWSI::not_using); env.vulkan_functions.vkDestroySurfaceKHR(instance.inst, surface, nullptr); } @@ -131,7 +125,6 @@ TEST(WsiTests, GetPhysicalDeviceWin32PresentNoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -159,7 +152,6 @@ TEST(WsiTests, GetPhysicalDeviceWin32PresentICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -202,7 +194,6 @@ TEST(WsiTests, Win32GetPhysicalDeviceSurfaceSupportKHR) { VkWin32SurfaceCreateInfoKHR surf_create_info{VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR}; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkCreateWin32SurfaceKHR(instance.inst, &surf_create_info, nullptr, &surface)); ASSERT_TRUE(surface != VK_NULL_HANDLE); - // ASSERT_EQ(driver.is_using_icd_wsi, UsingICDProvidedWSI::not_using); uint32_t device_count = max_device_count; std::array phys_devs; @@ -225,7 +216,6 @@ TEST(WsiTests, CreateSurfaceXCBNoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.enable_icd_wsi = false; InstWrapper inst{env.vulkan_functions}; @@ -244,7 +234,6 @@ TEST(WsiTests, CreateSurfaceXCBNoICDCreateSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = false; @@ -268,7 +257,6 @@ TEST(WsiTests, CreateSurfaceXCBICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = true; @@ -320,7 +308,6 @@ TEST(WsiTests, GetPhysicalDeviceXcbPresentNoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -348,7 +335,6 @@ TEST(WsiTests, GetPhysicalDeviceXcbPresentICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -391,7 +377,6 @@ TEST(WsiTests, XcbGetPhysicalDeviceSurfaceSupportKHR) { VkXcbSurfaceCreateInfoKHR xcb_createInfo{VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR}; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkCreateXcbSurfaceKHR(instance.inst, &xcb_createInfo, nullptr, &surface)); ASSERT_TRUE(surface != VK_NULL_HANDLE); - // ASSERT_EQ(cur_icd.is_using_icd_wsi, UsingICDProvidedWSI::not_using); uint32_t device_count = max_device_count; std::array phys_devs; @@ -414,7 +399,6 @@ TEST(WsiTests, CreateSurfaceXLIBNoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.enable_icd_wsi = false; InstWrapper inst{env.vulkan_functions}; @@ -433,7 +417,6 @@ TEST(WsiTests, CreateSurfaceXLIBNoICDCreateSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = false; @@ -457,7 +440,6 @@ TEST(WsiTests, CreateSurfaceXLIBICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = true; @@ -509,7 +491,6 @@ TEST(WsiTests, GetPhysicalDeviceXlibPresentNoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -537,7 +518,6 @@ TEST(WsiTests, GetPhysicalDeviceXlibPresentICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -580,7 +560,6 @@ TEST(WsiTests, XlibGetPhysicalDeviceSurfaceSupportKHR) { VkXlibSurfaceCreateInfoKHR createInfo{VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR}; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkCreateXlibSurfaceKHR(instance.inst, &createInfo, nullptr, &surface)); ASSERT_TRUE(surface != VK_NULL_HANDLE); - // ASSERT_EQ(driver.is_using_icd_wsi, UsingICDProvidedWSI::not_using); uint32_t device_count = max_device_count; std::array phys_devs; @@ -603,7 +582,6 @@ TEST(WsiTests, CreateSurfaceWaylandNoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.enable_icd_wsi = false; InstWrapper inst{env.vulkan_functions}; @@ -622,7 +600,6 @@ TEST(WsiTests, CreateSurfaceWaylandNoICDCreateSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = false; @@ -646,7 +623,6 @@ TEST(WsiTests, CreateSurfaceWaylandICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME}); cur_icd.enable_icd_wsi = true; @@ -698,7 +674,6 @@ TEST(WsiTests, GetPhysicalDeviceWaylandPresentNoICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -726,7 +701,6 @@ TEST(WsiTests, GetPhysicalDeviceWaylandPresentICDSupport) { env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)); auto& cur_icd = env.get_test_icd(0); cur_icd.set_min_icd_interface_version(5); - cur_icd.set_icd_api_version(VK_API_VERSION_1_0); cur_icd.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME}); cur_icd.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME}); cur_icd.physical_devices.emplace_back("physical_device_0"); @@ -769,7 +743,6 @@ TEST(WsiTests, WaylandGetPhysicalDeviceSurfaceSupportKHR) { VkWaylandSurfaceCreateInfoKHR createInfo{VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR}; ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkCreateWaylandSurfaceKHR(instance.inst, &createInfo, nullptr, &surface)); ASSERT_TRUE(surface != VK_NULL_HANDLE); - // ASSERT_EQ(cur_icd.is_using_icd_wsi, UsingICDProvidedWSI::not_using); uint32_t device_count = max_device_count; std::array phys_devs; @@ -784,3 +757,96 @@ TEST(WsiTests, WaylandGetPhysicalDeviceSurfaceSupportKHR) { env.vulkan_functions.vkDestroySurfaceKHR(instance.inst, surface, nullptr); } #endif + +TEST(WsiTests, ForgetEnableSurfaceExtensions) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .setup_WSI() + .add_physical_device(PhysicalDevice{}.add_extension("VK_KHR_swapchain").finish()); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.add_extension("VK_KHR_surface"); + ASSERT_NO_FATAL_FAILURE(inst.CheckCreate()); + + VkSurfaceKHR surface{}; + ASSERT_EQ(VK_ERROR_EXTENSION_NOT_PRESENT, create_surface(inst, surface)); +} + +TEST(WsiTests, SwapchainFunctional) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)) + .setup_WSI() + .add_physical_device(PhysicalDevice{}.add_extension("VK_KHR_swapchain").finish()); + + InstWrapper inst{env.vulkan_functions}; + inst.create_info.setup_WSI(); + inst.CheckCreate(); + VkSurfaceKHR surface{}; + ASSERT_EQ(VK_SUCCESS, create_surface(inst, surface)); + VkPhysicalDevice phys_dev = inst.GetPhysDev(); + + { // Use GDPA to get functions + DeviceWrapper dev{inst}; + dev.create_info.add_extension("VK_KHR_swapchain"); + + ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); + + VkSwapchainKHR swapchain{}; + VkSwapchainCreateInfoKHR swap_create_info{}; + swap_create_info.surface = surface; + DeviceFunctions funcs{*inst.functions, dev}; + ASSERT_EQ(VK_SUCCESS, funcs.vkCreateSwapchainKHR(dev, &swap_create_info, nullptr, &swapchain)); + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, funcs.vkGetSwapchainImagesKHR(dev, swapchain, &count, nullptr)); + ASSERT_GT(count, 0U); + std::array images; + ASSERT_EQ(VK_SUCCESS, funcs.vkGetSwapchainImagesKHR(dev, swapchain, &count, images.data())); + funcs.vkDestroySwapchainKHR(dev, swapchain, nullptr); + } + { // Use GIPA gotten functions + DeviceWrapper dev{inst}; + dev.create_info.add_extension("VK_KHR_swapchain"); + + ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); + + PFN_vkCreateSwapchainKHR inst_CreateSwapchainKHR = inst.load("vkCreateSwapchainKHR"); + PFN_vkGetSwapchainImagesKHR inst_GetSwapchainImagesKHR = inst.load("vkGetSwapchainImagesKHR"); + PFN_vkDestroySwapchainKHR inst_DestroySwapchainKHR = inst.load("vkDestroySwapchainKHR"); + ASSERT_TRUE(nullptr != inst_CreateSwapchainKHR); + ASSERT_TRUE(nullptr != inst_GetSwapchainImagesKHR); + ASSERT_TRUE(nullptr != inst_DestroySwapchainKHR); + + VkSwapchainKHR swapchain{}; + VkSwapchainCreateInfoKHR swap_create_info{}; + swap_create_info.surface = surface; + + ASSERT_EQ(VK_SUCCESS, inst_CreateSwapchainKHR(dev, &swap_create_info, nullptr, &swapchain)); + uint32_t count = 0; + ASSERT_EQ(VK_SUCCESS, inst_GetSwapchainImagesKHR(dev, swapchain, &count, nullptr)); + ASSERT_GT(count, 0U); + std::array images; + ASSERT_EQ(VK_SUCCESS, inst_GetSwapchainImagesKHR(dev, swapchain, &count, images.data())); + inst_DestroySwapchainKHR(dev, swapchain, nullptr); + } + { // forget to enable the extension + DeviceWrapper dev{inst}; + ASSERT_NO_FATAL_FAILURE(dev.CheckCreate(phys_dev)); + + DeviceFunctions funcs{*inst.functions, dev}; + ASSERT_EQ(funcs.vkCreateSwapchainKHR, nullptr); + ASSERT_EQ(funcs.vkGetSwapchainImagesKHR, nullptr); + ASSERT_EQ(funcs.vkDestroySwapchainKHR, nullptr); + } + { // forget to set the surface + DeviceWrapper dev{inst}; + dev.create_info.add_extension("VK_KHR_swapchain"); + + dev.CheckCreate(phys_dev); + + VkSwapchainKHR swapchain{}; + VkSwapchainCreateInfoKHR swap_create_info{}; + DeviceFunctions funcs{*inst.functions, dev}; + ASSERT_DEATH(funcs.vkCreateSwapchainKHR(dev, &swap_create_info, nullptr, &swapchain), ""); + } + env.vulkan_functions.vkDestroySurfaceKHR(inst.inst, surface, nullptr); +} diff --git a/vulkan.symbols.api b/vulkan.symbols.api deleted file mode 100644 index cae8b129ba94ba9ee88093a07f378e33b5b67bdc..0000000000000000000000000000000000000000 --- a/vulkan.symbols.api +++ /dev/null @@ -1,244 +0,0 @@ -vkAcquireNextImage2KHR -vkAcquireNextImageKHR -vkAllocateCommandBuffers -vkAllocateDescriptorSets -vkAllocateMemory -vkBeginCommandBuffer -vkBindBufferMemory -vkBindBufferMemory2 -vkBindImageMemory -vkBindImageMemory2 -vkCmdBeginQuery -vkCmdBeginRendering -vkCmdBeginRenderPass -vkCmdBeginRenderPass2 -vkCmdBindDescriptorSets -vkCmdBindIndexBuffer -vkCmdBindPipeline -vkCmdBindVertexBuffers -vkCmdBindVertexBuffers2 -vkCmdBlitImage -vkCmdBlitImage2 -vkCmdClearAttachments -vkCmdClearColorImage -vkCmdClearDepthStencilImage -vkCmdCopyBuffer -vkCmdCopyBuffer2 -vkCmdCopyBufferToImage -vkCmdCopyBufferToImage2 -vkCmdCopyImage -vkCmdCopyImage2 -vkCmdCopyImageToBuffer -vkCmdCopyImageToBuffer2 -vkCmdCopyQueryPoolResults -vkCmdDispatch -vkCmdDispatchBase -vkCmdDispatchIndirect -vkCmdDraw -vkCmdDrawIndexed -vkCmdDrawIndexedIndirect -vkCmdDrawIndexedIndirectCount -vkCmdDrawIndirect -vkCmdDrawIndirectCount -vkCmdEndQuery -vkCmdEndRendering -vkCmdEndRenderPass -vkCmdEndRenderPass2 -vkCmdExecuteCommands -vkCmdFillBuffer -vkCmdNextSubpass -vkCmdNextSubpass2 -vkCmdPipelineBarrier -vkCmdPipelineBarrier2 -vkCmdPushConstants -vkCmdResetEvent -vkCmdResetEvent2 -vkCmdResetQueryPool -vkCmdResolveImage -vkCmdResolveImage2 -vkCmdSetBlendConstants -vkCmdSetCullMode -vkCmdSetDepthBias -vkCmdSetDepthBiasEnable -vkCmdSetDepthBounds -vkCmdSetDepthBoundsTestEnable -vkCmdSetDepthCompareOp -vkCmdSetDepthTestEnable -vkCmdSetDepthWriteEnable -vkCmdSetDeviceMask -vkCmdSetEvent -vkCmdSetEvent2 -vkCmdSetFrontFace -vkCmdSetLineWidth -vkCmdSetPrimitiveRestartEnable -vkCmdSetPrimitiveTopology -vkCmdSetRasterizerDiscardEnable -vkCmdSetScissor -vkCmdSetScissorWithCount -vkCmdSetStencilCompareMask -vkCmdSetStencilOp -vkCmdSetStencilReference -vkCmdSetStencilTestEnable -vkCmdSetStencilWriteMask -vkCmdSetViewport -vkCmdSetViewportWithCount -vkCmdUpdateBuffer -vkCmdWaitEvents -vkCmdWaitEvents2 -vkCmdWriteTimestamp -vkCmdWriteTimestamp2 -vkCreateBuffer -vkCreateBufferView -vkCreateCommandPool -vkCreateComputePipelines -vkCreateDescriptorPool -vkCreateDescriptorSetLayout -vkCreateDescriptorUpdateTemplate -vkCreateDevice -vkCreateDisplayModeKHR -vkCreateDisplayPlaneSurfaceKHR -vkCreateEvent -vkCreateFence -vkCreateFramebuffer -vkCreateGraphicsPipelines -vkCreateImage -vkCreateImagePipeSurfaceFUCHSIA -vkCreateImageView -vkCreateInstance -vkCreatePipelineCache -vkCreatePipelineLayout -vkCreatePrivateDataSlot -vkCreateQueryPool -vkCreateRenderPass -vkCreateRenderPass2 -vkCreateSampler -vkCreateSamplerYcbcrConversion -vkCreateSemaphore -vkCreateShaderModule -vkCreateSharedSwapchainsKHR -vkCreateSwapchainKHR -vkDestroyBuffer -vkDestroyBufferView -vkDestroyCommandPool -vkDestroyDescriptorPool -vkDestroyDescriptorSetLayout -vkDestroyDescriptorUpdateTemplate -vkDestroyDevice -vkDestroyEvent -vkDestroyFence -vkDestroyFramebuffer -vkDestroyImage -vkDestroyImageView -vkDestroyInstance -vkDestroyPipeline -vkDestroyPipelineCache -vkDestroyPipelineLayout -vkDestroyPrivateDataSlot -vkDestroyQueryPool -vkDestroyRenderPass -vkDestroySampler -vkDestroySamplerYcbcrConversion -vkDestroySemaphore -vkDestroyShaderModule -vkDestroySurfaceKHR -vkDestroySwapchainKHR -vkDeviceWaitIdle -vkEndCommandBuffer -vkEnumerateDeviceExtensionProperties -vkEnumerateDeviceLayerProperties -vkEnumerateInstanceExtensionProperties -vkEnumerateInstanceLayerProperties -vkEnumerateInstanceVersion -vkEnumeratePhysicalDeviceGroups -vkEnumeratePhysicalDevices -vkFlushMappedMemoryRanges -vkFreeCommandBuffers -vkFreeDescriptorSets -vkFreeMemory -vkGetBufferDeviceAddress -vkGetBufferMemoryRequirements -vkGetBufferMemoryRequirements2 -vkGetBufferOpaqueCaptureAddress -vkGetDescriptorSetLayoutSupport -vkGetDeviceBufferMemoryRequirements -vkGetDeviceGroupPeerMemoryFeatures -vkGetDeviceGroupPresentCapabilitiesKHR -vkGetDeviceGroupSurfacePresentModesKHR -vkGetDeviceImageMemoryRequirements -vkGetDeviceImageSparseMemoryRequirements -vkGetDeviceMemoryCommitment -vkGetDeviceMemoryOpaqueCaptureAddress -vkGetDeviceProcAddr -vkGetDeviceQueue -vkGetDeviceQueue2 -vkGetDisplayModeProperties2KHR -vkGetDisplayModePropertiesKHR -vkGetDisplayPlaneCapabilities2KHR -vkGetDisplayPlaneCapabilitiesKHR -vkGetDisplayPlaneSupportedDisplaysKHR -vkGetEventStatus -vkGetFenceStatus -vkGetImageMemoryRequirements -vkGetImageMemoryRequirements2 -vkGetImageSparseMemoryRequirements -vkGetImageSparseMemoryRequirements2 -vkGetImageSubresourceLayout -vkGetInstanceProcAddr -vkGetPhysicalDeviceDisplayPlaneProperties2KHR -vkGetPhysicalDeviceDisplayPlanePropertiesKHR -vkGetPhysicalDeviceDisplayProperties2KHR -vkGetPhysicalDeviceDisplayPropertiesKHR -vkGetPhysicalDeviceExternalBufferProperties -vkGetPhysicalDeviceExternalFenceProperties -vkGetPhysicalDeviceExternalSemaphoreProperties -vkGetPhysicalDeviceFeatures -vkGetPhysicalDeviceFeatures2 -vkGetPhysicalDeviceFormatProperties -vkGetPhysicalDeviceFormatProperties2 -vkGetPhysicalDeviceImageFormatProperties -vkGetPhysicalDeviceImageFormatProperties2 -vkGetPhysicalDeviceMemoryProperties -vkGetPhysicalDeviceMemoryProperties2 -vkGetPhysicalDevicePresentRectanglesKHR -vkGetPhysicalDeviceProperties -vkGetPhysicalDeviceProperties2 -vkGetPhysicalDeviceQueueFamilyProperties -vkGetPhysicalDeviceQueueFamilyProperties2 -vkGetPhysicalDeviceSparseImageFormatProperties -vkGetPhysicalDeviceSparseImageFormatProperties2 -vkGetPhysicalDeviceSurfaceCapabilities2KHR -vkGetPhysicalDeviceSurfaceCapabilitiesKHR -vkGetPhysicalDeviceSurfaceFormats2KHR -vkGetPhysicalDeviceSurfaceFormatsKHR -vkGetPhysicalDeviceSurfacePresentModesKHR -vkGetPhysicalDeviceSurfaceSupportKHR -vkGetPhysicalDeviceToolProperties -vkGetPipelineCacheData -vkGetPrivateData -vkGetQueryPoolResults -vkGetRenderAreaGranularity -vkGetSemaphoreCounterValue -vkGetSwapchainImagesKHR -vkInvalidateMappedMemoryRanges -vkMapMemory -vkMergePipelineCaches -vkQueueBindSparse -vkQueuePresentKHR -vkQueueSubmit -vkQueueSubmit2 -vkQueueWaitIdle -vkResetCommandBuffer -vkResetCommandPool -vkResetDescriptorPool -vkResetEvent -vkResetFences -vkResetQueryPool -vkSetEvent -vkSetPrivateData -vkSignalSemaphore -vkTrimCommandPool -vkUnmapMemory -vkUpdateDescriptorSets -vkUpdateDescriptorSetWithTemplate -vkWaitForFences -vkWaitSemaphores \ No newline at end of file