diff --git a/.cmake-format.py b/.cmake-format.py deleted file mode 100644 index 07d2f99d6..000000000 --- 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/workflows/tools.yml b/.github/workflows/tools.yml index d9d5003de..eeaebddf9 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -76,7 +76,15 @@ jobs: with: key: ${{ runner.os }}-${{ matrix.config }}-${{ matrix.cc }}-${{matrix.cube_wsi}} - name: Configure - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCUBE_WSI_SELECTION=${{matrix.cube_wsi}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D ENABLE_ADDRESS_SANITIZER=ON + run: | + cmake -S. -B build -G "Ninja" \ + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ + -D CUBE_WSI_SELECTION=${{matrix.cube_wsi}} \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -D INSTALL_ICD=ON \ + -D BUILD_TESTS=ON \ + -D ENABLE_ADDRESS_SANITIZER=ON env: CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} @@ -116,7 +124,7 @@ jobs: arch: ${{ matrix.arch }} - name: Configure - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON + run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D BUILD_WERROR=ON - name: Build run: cmake --build ./build @@ -124,6 +132,10 @@ jobs: - name: Install run: cmake --install build/ --prefix build/install + - name: Test + working-directory: ./build + run: ctest --output-on-failure + - name: Verify generated source files run: python scripts/generate_source.py --verify external/${{matrix.config}}/Vulkan-Headers/build/install/share/vulkan/registry @@ -146,7 +158,7 @@ jobs: run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - name: Configure - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D ENABLE_ADDRESS_SANITIZER=ON + run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D ENABLE_ADDRESS_SANITIZER=ON -D BUILD_WERROR=ON env: MACOSX_DEPLOYMENT_TARGET: 10.15 @@ -160,47 +172,51 @@ jobs: - name: Verify generated source files run: python scripts/generate_source.py --verify external/Release/Vulkan-Headers/build/install/share/vulkan/registry - gn: - runs-on: ubuntu-20.04 - - strategy: - matrix: - config: [ Debug, Release ] - - steps: - - uses: actions/checkout@v3 - - - name: Get depot tools - 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 tools - run: ninja -C out/${{matrix.config}} - android: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Setup Environment - run: | - echo "ANDROID_SDK_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV - echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV - echo "$ANDROID_SDK_ROOT/build-tools/31.0.0" >> $GITHUB_PATH - echo "$ANDROID_NDK_LATEST_HOME" >> $GITHUB_PATH - $ANDROID_SDK_ROOT/tools/bin/sdkmanager "platforms;android-23" - keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug" - - name: Build vkcube - run: | - cd build-android - ./build_all.sh \ No newline at end of file + runs-on: ubuntu-22.04 + strategy: + matrix: + abi: [ armeabi-v7a, arm64-v8a ] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - uses: lukka/get-cmake@latest + - name: Configure + run: | + cmake -S . -B build/ --toolchain $ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \ + -D ANDROID_PLATFORM=23 \ + -D CMAKE_ANDROID_ARCH_ABI=${{matrix.abi}} \ + -D CMAKE_ANDROID_STL_TYPE=c++_static \ + -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO \ + -D CMAKE_BUILD_TYPE=Release \ + -D UPDATE_DEPS=ON \ + -D BUILD_TESTS=ON \ + -D BUILD_WERROR=ON \ + -G "Ninja" + - name: Build + run: cmake --build build + - name: Test + working-directory: ./build + run: ctest --output-on-failure -C Release + - name: Install + run: cmake --install build --prefix /tmp + + tools_codegen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - run: sudo apt-get -qq update && sudo apt install libwayland-dev xorg-dev wayland-protocols + - run: cmake -S . -B build/ -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR=external -D TOOLS_CODEGEN=ON + - run: cmake --build build --target tools_codegen + - run: git diff --exit-code + + chromium: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: scripts/gn/gn.py diff --git a/.github/workflows/tools_sc.yml b/.github/workflows/tools_sc.yml index 21ff1a105..ca5e0d356 100644 --- a/.github/workflows/tools_sc.yml +++ b/.github/workflows/tools_sc.yml @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: CI Build - Vulkan SC +name: tools - Vulkan SC on: push: @@ -23,6 +23,13 @@ on: branches: - sc_main +# 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 + jobs: linux-sc: runs-on: ${{matrix.os}} @@ -53,15 +60,23 @@ jobs: python3 -m pip install jsonschema pyparsing sudo apt update && sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev - - name: Generate build files - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D ENABLE_ADDRESS_SANITIZER=ON -D VULKANSC=ON -D BUILD_VKSC_DEVSIM=ON + - name: Configure + run: | + cmake -S. -B build -G "Ninja" \ + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -D INSTALL_ICD=ON \ + -D ENABLE_ADDRESS_SANITIZER=ON \ + -D VULKANSC=ON \ + -D BUILD_VKSC_DEVSIM=ON env: CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} - name: Build run: cmake --build build - + - name: Install run: cmake --install build/ --prefix build/install @@ -90,11 +105,23 @@ jobs: - name: Install dependencies run: python -m pip install jsonschema pyparsing - - name: Generate build files - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D VULKANSC=ON -D BUILD_VKSC_DEVSIM=ON + - name: Configure + run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_WERROR=ON -D VULKANSC=ON -D BUILD_VKSC_DEVSIM=ON - name: Build run: cmake --build ./build - name: Install run: cmake --install build/ --prefix build/install + + tools_codegen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - run: python -m pip install jsonschema pyparsing + - run: cmake -S . -B build/ -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR=external -D TOOLS_CODEGEN=ON -D VULKANSC=ON + - run: cmake --build build --target tools_codegen + - run: git diff --exit-code diff --git a/.gitignore b/.gitignore index cd76636c3..8bac04ada 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,12 @@ +# By default we install dependencies to the external directory +/external/* + +# Ignore any build directories +*build*/ + CMakeCache.txt CMakeLists.txt.user +CMakeUserPresets.json CMakeFiles/ cmake_install.cmake Makefile @@ -17,10 +24,6 @@ out64/* *.vcxproj *.sdf *.filters -build -build32 -dbuild -build-android/external *.config *.creator *.creator.user @@ -28,4 +31,16 @@ build-android/external *.includes .vscode/ .DS_Store -external/ + +# 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 5ac6b8397..000000000 --- a/.gn +++ /dev/null @@ -1,24 +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/" - -script_executable = "python3" - -default_args = { - clang_use_chrome_plugins = false - use_custom_libcxx = false -} - diff --git a/BUILD.gn b/BUILD.gn index 40cd58f92..08bd22a1d 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,5 +1,5 @@ # Copyright (C) 2018-2019 The ANGLE Project Authors. -# Copyright (C) 2019, 2023 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. @@ -16,32 +16,6 @@ import("//build_overrides/build.gni") import("//build_overrides/vulkan_tools.gni") -# Vulkan-tools isn't ported to Fuchsia yet. -# TODO(spang): Port mock ICD to Fuchsia. -assert(!is_fuchsia) - -config("vulkan_internal_config") { - defines = [ "VULKAN_NON_CMAKE_BUILD" ] - if (is_clang || !is_win) { - cflags = [ "-Wno-unused-function" ] - } - if (is_linux || is_chromeos) { - defines += [ - "SYSCONFDIR=\"/etc\"", - "FALLBACK_CONFIG_DIRS=\"/etc/xdg\"", - "FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"", - ] - } -} - -# Vulkan tool generated utility headers -source_set("vulkan_tools_headers") { - public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] - sources = [ - "icd/generated/vk_typemap_helper.h", - ] -} - if (!is_android) { vulkan_undefine_configs = [] if (is_win && build_with_chromium) { @@ -51,23 +25,20 @@ if (!is_android) { ] } - raw_vulkan_icd_dir = rebase_path("icd", root_build_dir) - - vulkan_data_dir = "$root_out_dir/$vulkan_data_subdir" - raw_vulkan_data_dir = rebase_path(vulkan_data_dir, root_build_dir) - # Vulkan Mock ICD # --------------- shared_library("VkICD_mock_icd") { configs -= vulkan_undefine_configs - deps = [ ":vulkan_tools_headers" ] - public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] + deps = [ + "$vulkan_headers_dir:vulkan_headers" + ] data_deps = [ ":vulkan_gen_icd_json_file" ] sources = [ "icd/mock_icd.h", "icd/mock_icd.cpp", "icd/generated/function_declarations.h", "icd/generated/function_definitions.h", + "icd/generated/vk_typemap_helper.h", ] include_dirs = [ "icd", @@ -83,26 +54,39 @@ if (!is_android) { } action("vulkan_gen_icd_json_file") { - script = "build-gn/generate_vulkan_layers_json.py" + script = "scripts/gn/generate_vulkan_icd_json.py" + public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] - sources = [ "$vulkan_headers_dir/include/vulkan/vulkan_core.h" ] - args = [ "--icd" ] - if (is_win) { - sources += [ "icd/windows/VkICD_mock_icd.json" ] - args += [ "$raw_vulkan_icd_dir/windows" ] - } - if (is_linux || is_chromeos) { - sources += [ "icd/linux/VkICD_mock_icd.json" ] - args += [ "$raw_vulkan_icd_dir/linux" ] + + sources = [ "icd/VkICD_mock_icd.json.in" ] + + vulkan_data_dir = "$root_out_dir/$vulkan_data_subdir" + + outputs = [ "$vulkan_data_dir/VkICD_mock_icd.json" ] + + if (is_linux) { + _platform = "Linux" + } else if (is_win) { + _platform = "Windows" + } else if (is_mac) { + _platform = "Darwin" + } else if (is_fuchsia) { + _platform = "Fuchsia" + } else { + _platform = "Other" } - if (is_mac) { - sources += [ "icd/macos/VkICD_mock_icd.json" ] - args += [ "$raw_vulkan_icd_dir/macos" ] + + args = [ + "--icd", + "--platform", _platform, + rebase_path("icd/", root_build_dir), + rebase_path(vulkan_data_dir, root_build_dir) + ] + rebase_path(sources, root_build_dir) + + if (is_win) { + args += [ "--no-path-prefix" ] } - # The layer JSON files are part of the necessary data deps. - outputs = [ "$vulkan_data_dir/VkICD_mock_icd.json" ] data = outputs - args += [ raw_vulkan_data_dir ] + rebase_path(sources, root_build_dir) } } diff --git a/BUILD.md b/BUILD.md index bd7fe8e3f..f31e81632 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,453 +1,105 @@ # Build Instructions -Instructions for building this repository on Linux, Windows, Android, and MacOS. - -## Index - -1. [Contributing](#contributing-to-the-repository) -1. [Repository Content](#repository-content) -1. [Repository Set-Up](#repository-set-up) -1. [Windows Build](#building-on-windows) +1. [Requirements](#requirements) +1. [Building Overview](#building-overview) +1. [Generated source code](#generated-source-code) +1. [Dependencies](#dependencies) 1. [Linux Build](#building-on-linux) -1. [Android Build](#building-on-android) +1. [Windows Build](#building-on-windows) 1. [MacOS build](#building-on-macos) +1. [Android Build](#building-for-android) +1. [Installed Files](#installed-files) 1. [Vulkan SC Build](#building-vulkan-sc-tools) -## Contributing to the Repository - -If you intend to contribute, the preferred work flow is for you to develop -your contribution in a fork of this repository in your GitHub account and then -submit a pull request. Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file -in this repository for more details. - -## Repository Content - -This repository contains the source code necessary to build the following components: - -- vulkaninfo -- vkcube and vkcubepp demos -- mock ICD - -Currently only the mock ICD is available for Vulkan SC. - -### Installed Files - -The `install` target installs the following files under the directory -indicated by *install_dir*: - -- *install_dir*`/bin` : The `vulkaninfo`, `vkcube` and `vkcubepp` executables - -`MockICD` if `INSTALL_ICD` is configured: - -For Unix operating systems: - -- *install_dir*`/bin` : The Mock ICD -- *install_dir*`/share/vulkan/icd.d` : Mock ICD JSON - -For WIN32: - -- *install_dir*`/bin` : The Mock ICD and JSON - -## Repository Set-Up - -### Display Drivers - -This repository does not contain a Vulkan- or VulkanSC-capable driver. You will need to -obtain and install an appropriate driver from your graphics hardware vendor or from -some other suitable source if you intend to run Vulkan or Vulkan SC applications. - -### Download the Repository - -To create your local git repository: - - git clone https://github.com/KhronosGroup/VulkanSC-Tools.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 - -Dependencies that cannot be resolved by the SDK or installed packages must be -resolved with the "install directory" override and are listed below. The -"install directory" override can also be used to force the use of a specific -version of that dependency. - -#### VulkanSC-Headers - -This repository has a required dependency on the -[Vulkan SC Headers repository](https://github.com/KhronosGroup/VulkanSC-Headers). -You must clone the headers repository and build its `install` target before -building this repository. The VulkanSC-Headers repository is required because it -contains the Vulkan SC API definition files (registry) that are required to build -the mock ICD. 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. - -Note that this dependency can be ignored if not building the mock ICD -(CMake option: `-DBUILD_ICD=OFF`). - -#### glslang - -This repository has a required dependency on the `glslangValidator` (shader -compiler) for compiling the shader programs for the vkcube demos. +## Requirements -The CMake code in this repository downloads release binaries of glslang if a -build glslang repository is not provided. The glslangValidator is obtained -from this set of release binaries. - -If you don't wish the CMake code to download these binaries, then you must -clone the [glslang repository](https://github.com/KhronosGroup/glslang) and -build its `install` target. Follow the build instructions in the glslang -[README.md](https://github.com/KhronosGroup/glslang/blob/main/README.md) -file. Ensure that the `update_glslang_sources.py` script has been run as part -of building glslang. You must also take note of the glslang install directory -and pass it on the CMake command line for building this repository, as -described below. - -Note that this dependency can be ignored if not building the vkcube demo -(CMake option: `-DBUILD_CUBE=OFF`). - -### Build and Install Directories - -A common convention is to place the build directory in the top directory of -the repository with a name of `build` and place the install directory as a -child of the build directory with the name `install`. The remainder of these -instructions follow this convention, although you can use any name for these -directories and place them in any location. - -### Building Dependent Repositories with Known-Good Revisions - -There is a Python utility script, `scripts/update_deps.py`, that you can use to -gather and build the dependent repositories mentioned above. This script uses -information stored in the `scripts/known_good.json` file to check out dependent -repository revisions that are known to be compatible with the revision of this -repository that you currently have checked out. As such, this script is useful -as a quick-start tool for common use cases and default configurations. - -For all platforms, start with: - - git clone git@github.com:KhronosGroup/VulkanSC-Tools.git - cd VulkanSC-Tools - mkdir build - cd build - -For 64-bit Linux and MacOS, continue with: - - ../scripts/update_deps.py - cmake -C helper.cmake .. - cmake --build . - -For 64-bit Windows, continue with: - - ..\scripts\update_deps.py --arch x64 - cmake -A x64 -C helper.cmake .. - cmake --build . - -For 32-bit Windows, continue with: - - ..\scripts\update_deps.py --arch Win32 - cmake -A Win32 -C helper.cmake .. - cmake --build . - -To update the dependencies for Vulkan SC, the `--api vulkansc` option must be -passed to the `update_deps.py` command. - -To build for Vulkan SC, the `-DVULKANSC=ON` option must be specified when -running `cmake -C`. - -Please see the more detailed build information later in this file if you have -specific requirements for configuring and building these components. - -#### Notes - -- 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 - (VulkanSC-Tools) repository. But there shouldn't be any conflicts - inside the `build` directory between the dependent repositories and the - build files for this repository. -- 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. -- 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 - execution. -- Please use `update_deps.py --help` to list additional options and read the - internal documentation in `update_deps.py` for further information. +1. CMake >= 3.17.2 +1. C++17 compatible toolchain +1. Git +1. Python >= 3.10 +1. Python packages: pyparsing jsonschema ### Generated source code -This repository contains generated source code in the `icd/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`: - - python3 scripts/generate_source.py PATH_TO_VULKAN_HEADERS_REGISTRY_DIR - -A helper CMake target `VulkanTools_generated_source` is also provided to simplify -the invocation of `scripts/generate_source.py` from the build directory: - - cmake --build . --target VulkanTools_generated_source - -### 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 | -| -------------------------- | -------- | ------- | -------------------------------------------------------------------------------- | -| VULKANSC | All | `OFF` | Controls whether the tools are built for Vulkan (`OFF`, the default), or for Vulkan SC (`ON`). | -| BUILD_VKSC_DEVSIM | All | `OFF` | Controls whether or not the Vulkan SC device simulation layer is built (supported only if `VULKANSC` is set to `ON`). | -| BUILD_TESTS | All | `OFF` | Controls whether the tests are built. | -| BUILD_CUBE | All | `ON` | Controls whether or not the vkcube demo is built. | -| BUILD_VULKANINFO | All | `ON` | Controls whether or not the vulkaninfo utility is built. | -| BUILD_ICD | All | `ON` | Controls whether or not the mock ICD is built. | -| INSTALL_ICD | All | `OFF` | Controls whether or not the mock ICD is installed as part of the install target. | -| BUILD_WSI_XCB_SUPPORT | Linux | `ON` | Build the components with XCB support. | -| BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the components with Xlib support. | -| BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the components with Wayland support. | -| BUILD_WSI_DIRECTFB_SUPPORT | Linux | `OFF` | Build the components with DirectFB support. | -| BUILD_WSI_SCI_SUPPORT | All | `OFF` | Build the copmonents with SCI support. | - -The following is a table of all string options currently supported by this repository: - -| Option | Platform | Default | Description | -| -------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------- | -| VULKANINFO_BUILD_DLL_VERSIONINFO | Windows | `""` | Set the Windows specific version information for Vulkaninfo. Format is "major.minor.patch.build". | - -These variables should be set using the `-D` option when invoking CMake to -generate the native platform files. - -## Building On Windows - -### Windows Development Environment Requirements - -- Windows - - Any Personal Computer version supported by Microsoft -- Microsoft [Visual Studio](https://www.visualstudio.com/) - - Versions - - [2013 (update 4)](https://www.visualstudio.com/vs/older-downloads/) - - [2015](https://www.visualstudio.com/vs/older-downloads/) - - [2017](https://www.visualstudio.com/vs/downloads/) - - The Community Edition of each of the above versions is sufficient, as - well as any more capable edition. -- [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 - for Windows - - Some IDEs (e.g., [Visual Studio](https://www.visualstudio.com/), - [GitHub Desktop](https://desktop.github.com/)) have integrated - Git client support - -### Windows Build - Microsoft Visual Studio - -The general approach is to run CMake to generate the Visual Studio project -files. Then either run CMake with the `--build` option to build from the -command line or use the Visual Studio IDE to open the generated solution and -work with the solution interactively. - -#### Windows Quick Start - - cd VulkanSC-Tools - mkdir build - cd build - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir - cmake --build . - -The above commands instruct CMake to find and use the default Visual Studio -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. - -See below for the details. - -#### Use `CMake` to Create the Visual Studio Project Files - -Change your current directory to the top of the cloned repository directory, -create a build directory and generate the Visual Studio project files: - - cd VulkanSC-Tools - mkdir build - cd build - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir - -> 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. +This repository contains generated source code which is not intended to be modified directly. -The `-A` option is used to select either the "Win32" or "x64" architecture. +A helper CMake target `tools_codegen` is also provided to simplify the invocation of `scripts/generate_source.py` from the build directory: -If a generator for a specific version of Visual Studio is required, you can -specify it for Visual Studio 2015, for example, with: +```bash +cmake -S . -B build -D TOOLS_CODEGEN=ON +cmake --build build --target tools_codegen +``` - 64-bit: -G "Visual Studio 14 2015 Win64" - 32-bit: -G "Visual Studio 14 2015" +NOTE: `TOOLS_CODEGEN` is `OFF` by default. -See this [list](#cmake-visual-studio-generators) of other possible generators -for Visual Studio. +## Building Overview -When generating the project files, the absolute path to a VulkanSC-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 -VulkanSC-Headers repository built with the install target. +The following will be enough for most people, for more detailed instructions, see below. -The above steps create a Windows solution file named -`Vulkan-Tools.sln` in the build directory. +```bash +git clone https://github.com/KhronosGroup/VulkanSC-Tools.git +cd VulkanSC-Tools -At this point, you can build the solution from the command line or open the -generated solution with Visual Studio. +cmake -S . -B build -D UPDATE_DEPS=ON -D BUILD_WERROR=ON -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug -D VULKANSC=ON +cmake --build build --config Debug +``` -#### Build the Solution From the Command Line +### Warnings as errors off by default! -While still in the build directory: +By default `BUILD_WERROR` is `OFF`. The idiom for open source projects is to NOT enable warnings as errors. - cmake --build . +System/language package managers have to build on multiple different platforms and compilers. -to build the Debug configuration (the default), or: +By defaulting to `ON` we cause issues for package managers since there is no standard way to disable warnings until CMake 3.24 - cmake --build . --config Release +Add `-D BUILD_WERROR=ON` to your workflow. Or use the `dev` preset shown below which will also enabling warnings as errors. -to make a Release build. +## Dependencies -#### Build the Solution With Visual Studio +Currently this repo has a custom process for grabbing C/C++ dependencies. -Launch Visual Studio and open the "Vulkan-Tools.sln" solution file in the -build folder. You may select "Debug" or "Release" from the Solution -Configurations drop-down list. Start a build by selecting the Build->Build -Solution menu item. +Keep in mind this repo predates tools like `vcpkg`, `conan`, etc. Our process is most similar to `vcpkg`. -#### Using a Loader Built from a Repository +By specifying `-D UPDATE_DEPS=ON` when configuring CMake we grab dependencies listed in [known_good.json](scripts/known_good.json). -If you do need to build and use your own loader, build the VulkanSC-Loader -repository with the install target and modify your CMake invocation to add the -location of the loader's install directory: +All we are doing is streamlining `building`/`installing` the `known good` dependencies and helping CMake `find` the dependencies. - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ - -DVULKAN_LOADER_INSTALL_DIR=absolute_path_to_install_dir .. +This is done via a combination of `Python` and `CMake` scripting. -#### Using glslang Built from a Repository +Misc Useful Information: -If you do need to build and use your own glslang, build the glslang repository -with the install target and modify your CMake invocation to add the location -of the glslang's install directory: +- By default `UPDATE_DEPS` is `OFF`. The intent is to be friendly by default to system/language package managers. +- You can run `update_deps.py` manually but it isn't recommended for most users. - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ - -DGLSLANG_INSTALL_DIR=absolute_path_to_install_dir .. +### How to test new dependency versions -### Windows Notes +Typically most developers alter `known_good.json` with the commit/branch they are testing. -#### CMake Visual Studio Generators +Alternatively you can modify `CMAKE_PREFIX_PATH` as follows. -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 2013 | "Visual Studio 12 2013 Win64" | "Visual Studio 12 2013" | -| 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" | +```sh +# Delete the CMakeCache.txt which will cache find_* results +rm build/ -rf +cmake -S . -B build/ ... -D CMAKE_PREFIX_PATH=~/foobar/my_custom_glslang_install/ ... +``` ## Building On Linux ### Linux Build 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. - -[CMake 3.17.2](https://cmake.org/files/v3.17/cmake-3.17.2-Linux-x86_64.tar.gz) is recommended. - -#### Required Package List - - sudo apt-get install git cmake build-essential libx11-xcb-dev \ - libxkbcommon-dev libwayland-dev libxrandr-dev wayland-protocols - -### Linux Build - -The general approach is to run CMake to generate make files. Then either run -CMake with the `--build` option or `make` to build from the command line. - -#### Linux Quick Start - - cd VulkanSC-Tools - mkdir build - cd build - cmake -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir .. - make - -See below for the details. - -#### Use CMake to Create the Make Files - -Change your current directory to the top of the cloned repository directory, -create a build directory and generate the make files. - - cd VulkanSC-Tools - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Debug \ - -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ - -DCMAKE_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. - -When generating the project files, the absolute path to a VulkanSC-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 -VulkanSC-Headers repository built with the install target. - -> Note: For Linux, the default value for `CMAKE_INSTALL_PREFIX` is -> `/usr/local`, which would be used if you do not specify -> `CMAKE_INSTALL_PREFIX`. In this case, you may need to use `sudo` to install -> to system directories later when you run `make install`. - -#### Build the Project - -You can just run `make` to begin the build. - -To speed up the build on a multi-core machine, use the `-j` option for `make` -to specify the number of cores to use for the build. For example: - - make -j4 +This repository is regularly built and tested on the two most recent Ubuntu LTS versions. -You can also use +```bash +sudo apt-get install git build-essential python3 python3-pip cmake - cmake --build . +# Linux WSI system libraries +sudo apt-get install libwayland-dev xorg-dev -If your build system supports ccache, you can enable that via CMake option `-DUSE_CCACHE=On` +# Python packages +pip3 install pyparsing jsonschema +``` -### Linux Notes - -#### WSI Support Build Options +### WSI Support Build Options By default, the repository components are built with support for the Vulkan-defined WSI display servers: Xcb, Xlib, and Wayland. It is recommended @@ -456,321 +108,225 @@ maximize their usability across Linux platforms. If it is necessary to build these modules without support for one of the display servers, the appropriate CMake option of the form `BUILD_WSI_xxx_SUPPORT` can be set to `OFF`. -Note vulkaninfo currently only supports Xcb and Xlib WSI display servers. See -the CMakeLists.txt file in `Vulkan-Tools/vulkaninfo` for more info. - -You can select which WSI subsystem is used to execute the vkcube applications -using a CMake option called CUBE_WSI_SELECTION. Supported options are XCB -(default), XLIB, and WAYLAND. Note that you must build using the corresponding -BUILD_WSI_*_SUPPORT enabled at the base repository level. For instance, -creating a build that will use Xlib when running the vkcube demos, your CMake -command line might look like: - - cmake -DCMAKE_BUILD_TYPE=Debug -DCUBE_WSI_SELECTION=XLIB .. - -#### Linux Install to System Directories - -Installing the files resulting from your build to the systems directories is -optional since environment variables can usually be used instead to locate the -binaries. There are also risks with interfering with binaries installed by -packages. If you are certain that you would like to install your binaries to -system directories, you can proceed with these instructions. - -Assuming that you've built the code as described above and the current -directory is still `build`, you can execute: - - sudo make install - -This command installs files to `/usr/local` if no `CMAKE_INSTALL_PREFIX` is -specified when creating the build files with CMake. - -You may need to run `ldconfig` in order to refresh the system loader search -cache on some Linux systems. - -You can further customize the installation location by setting additional -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 - -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 -them to another project that is dependent on them. - -Note: The Mock ICD is not installed by default since it is a "null" driver -that does not render anything and is used for testing purposes. Installing it -to system directories may cause some applications to discover and use this -driver instead of other full drivers installed on the system. If you really -want to install this null driver, use: - - -DINSTALL_ICD=ON - -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 of the -VulkanSC-Loader repository for more information about loader and layer -operation. - -### Linux Tests - -After making any changes to the repository, you should perform some quick -sanity tests, such as running the vkcube demo with validation enabled. - -To run the **vkcube application** with validation, in a terminal change to the -`build/cube` directory and run: +### Linux 32-bit support - VK_LAYER_PATH=../path/to/validation/layers ./vkcube --validate - -If you have an SDK installed and have run the setup script to set the -`VULKAN_SDK` environment variable, it may be unnecessary to specify a -`VK_LAYER_PATH`. - -#### Linux 32-bit support - -Usage of the contents of this repository in 32-bit Linux environments is not +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: -If not already installed, install the following 32-bit development libraries: - -`gcc-multilib g++-multilib libx11-dev:i386` - -This list may vary depending on your distribution and which windowing systems -you are building for. +```bash +# 32-bit libs +# your PKG_CONFIG configuration may be different, depending on your distribution +sudo apt-get install gcc-multilib g++-multilib libx11-dev:i386 +``` 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 - -Again, your PKG_CONFIG configuration may be different, depending on your -distribution. - -Finally, rebuild the repository using `cmake` and `make`, as explained above. - -## Building On Android - -Install the required tools for Linux and Windows covered above, then add the -following. - -### Android Build Requirements - -- Install [Android Studio 2.3](https://developer.android.com/studio/index.html) or later. -- From the "Welcome to Android Studio" splash screen, add the following components using - Configure > SDK Manager: - - SDK Platforms > Android 6.0 and newer - - SDK Tools > Android SDK Build-Tools - - SDK Tools > Android SDK Platform-Tools - - SDK Tools > NDK (Side by side) - -#### Add Android specifics to environment - -For each of the below, you may need to specify a different build-tools and ndk -versions, as Android Studio will roll them forward fairly regularly. +```bash +export ASFLAGS=--32 +export CFLAGS=-m32 +export CXXFLAGS=-m32 +export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu +``` -On Linux: +## Building On Windows - export ANDROID_SDK_HOME=$HOME/Android/sdk - export ANDROID_NDK_HOME=$HOME/Android/sdk/ndk/23.0.7599858 - export PATH=$ANDROID_NDK_HOME:$PATH - export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH - export PATH=$ANDROID_SDK_HOME/build-tools/31.0.0:$PATH +### Windows Development Environment Requirements -On Windows: +- Windows 10+ +- Visual Studio - set ANDROID_SDK_HOME=%LOCALAPPDATA%\Android\sdk - set ANDROID_NDK_HOME=%LOCALAPPDATA%\Android\sdk\ndk\23.0.7599858 - set PATH=%ANDROID_NDK_HOME%;%PATH% - set PATH=%ANDROID_SDK_HOME%\platform-tools;%PATH% - set PATH=%ANDROID_SDK_HOME%\build-tools\31.0.0;%PATH% +Note: Anything less than `Visual Studio 2019` is not guaranteed to compile/work. -On OSX: +### Visual Studio Generator - export ANDROID_SDK_HOME=$HOME/Library/Android/sdk - export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk/23.0.7599858 - export PATH=$ANDROID_NDK_PATH:$PATH - export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH - export PATH=$ANDROID_SDK_HOME/build-tools/31.0.0:$PATH +Run CMake to generate [Visual Studio project files](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#command-line-g-option). -Note: If `jarsigner` is missing from your platform, you can find it in the -Android Studio install or in your Java installation. If you do not have Java, -you can get it with something like the following: +```bash +# NOTE: By default CMake picks the latest version of Visual Studio as the default generator. +cmake -S . -B build --preset dev - sudo apt-get install openjdk-8-jdk +# Open the Visual Studio solution +cmake --open build +``` -### Android Build +See the [CMake documentation](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators) for further information on Visual Studio generators. -Use the following script to build the vkcube demo for Android: +NOTE: Windows developers don't have to develop in Visual Studio. Visual Studio just helps streamlining the needed C++ toolchain requirements (compilers, linker, etc). - cd build-android - ./build_all.sh +## Building on MacOS -The APK can be installed on production devices with: +### MacOS Development Environment Requirements - ./install_all.sh [-s ] +- Xcode -Note that there are no equivalent scripts on Windows yet, that work needs to -be completed. +NOTE: MacOS developers don't have to develop in Xcode. Xcode just helps streamlining the needed C++ toolchain requirements (compilers, linker, etc). Similar to Visual Studio on Windows. -### Run vkcube +### Xcode Generator -Use the following command to run vkcube for Android: +To create and open an Xcode project: - adb shell am start com.example.VkCube/android.app.NativeActivity +```bash +# Create the Xcode project +cmake -S . -B build -G Xcode --preset dev -## Building on MacOS +# Open the Xcode project +cmake --open build +``` -### MacOS Build Requirements +See the [CMake documentation](https://cmake.org/cmake/help/latest/generator/Xcode.html) for further information on the Xcode generator. -Tested on OSX version 10.12 +## Building For Android -NOTE: To force the OSX version set the environment variable [MACOSX_DEPLOYMENT_TARGET](https://cmake.org/cmake/help/latest/envvar/MACOSX_DEPLOYMENT_TARGET.html) when building VVL and it's dependencies. +- CMake 3.21+ +- NDK r25+ +- Ninja 1.10+ +- Android SDK Build-Tools 34.0.0+ -Setup Homebrew and components +### Android Build Requirements -- Ensure Homebrew is at the beginning of your PATH: +- Download [Android Studio](https://developer.android.com/studio) +- Install (https://developer.android.com/studio/install) +- From the `Welcome to Android Studio` splash screen, add the following components using the SDK Manager: + - SDK Platforms > Android 8.0 and newer (API Level 26 or higher) + - SDK Tools > Android SDK Build-Tools + - SDK Tools > Android SDK Platform-Tools + - SDK Tools > Android SDK Tools + - SDK Tools > NDK + - SDK Tools > CMake - export PATH=/usr/local/bin:$PATH +#### Add Android specifics to environment -- Add packages with the following (may need refinement) +NOTE: The following commands are streamlined for Linux but easily transferable to other platforms. +The main intent is setting 2 environment variables and ensuring the NDK and build tools are in the `PATH`. - brew install python python3 git +```sh +# Set environment variables +# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#environment-variables-2 +export ANDROID_SDK_ROOT=$HOME/Android/Sdk +export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/X.Y.Z -### Clone the Repository +# Modify path +export PATH=$ANDROID_SDK_ROOT/build-tools/X.Y.Z:$PATH -Clone the VulkanSC-Tools repository as defined above in the [Download the Repository](#download-the-repository) -section. +# (Optional if you have new enough version of CMake + Ninja) +export PATH=$ANDROID_SDK_ROOT/cmake/3.22.1/bin:$PATH -### Get the External Libraries +# Verify SDK build-tools is set correctly +which aapt -[MoltenVK](https://github.com/KhronosGroup/MoltenVK) Library +# Verify CMake/Ninja are in the path +which cmake +which ninja -- Building the vkcube and vulkaninfo applications require linking to the - MoltenVK Library (libMoltenVK.dylib) - - The following option should be used on the cmake command line to specify a - vulkan loader library: MOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK - making sure to specify an absolute path, like so: cmake - -DMOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK .... +# Check apksigner +apksigner --help +``` -Vulkan Loader Library +Note: If `apksigner` gives a `java: not found` error you do not have Java in your path. -- Building the vkcube and vulkaninfo applications require linking to the Vulkan - Loader Library (libvulkan.1.dylib) - - The following option should be used on the cmake command line to specify a - vulkan loader library: - VULKAN_LOADER_INSTALL_DIR=/absolute_path_to/Vulkan-Loader_install_dir - making sure to specify an absolute path. +```bash +# A common way to install on the system +sudo apt install default-jre +``` -### MacOS build +### Android Build -#### CMake Generators +1. Building libraries to package with your APK -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: +Invoking CMake directly to build the binary is relatively simple. -- Unix Makefiles -- Xcode +See https://developer.android.com/ndk/guides/cmake#command-line for CMake NDK documentation. -#### Building with the Unix Makefiles Generator +```sh +# Build release binary for arm64-v8a +cmake -S . -B build \ + -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \ + -D ANDROID_PLATFORM=26 \ + -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a \ + -D CMAKE_ANDROID_STL_TYPE=c++_static \ + -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO \ + -D CMAKE_BUILD_TYPE=Release \ + -D UPDATE_DEPS=ON \ + -G Ninja -This generator is the default generator, so all that is needed for a debug -build is: +cmake --build build - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Debug \ - -DVULKAN_LOADER_INSTALL_DIR=/absolute_path_to/Vulkan-Loader_install_dir \ - -DMOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK \ - -DCMAKE_INSTALL_PREFIX=install .. - make +cmake --install build --prefix build/install +``` -To speed up the build on a multi-core machine, use the `-j` option for `make` -to specify the number of cores to use for the build. For example: +Then you just package the library into your APK under the appropriate lib directory based on the ABI: +https://en.wikipedia.org/wiki/Apk_(file_format)#Package_contents - make -j4 +Alternatively users can also use `scripts/android.py` to build the binaries. -You can now run the demo applications from the command line: +Note: `scripts/android.py` will place the binaries in the `build-android/libs` directory. - open cube/vkcube.app - open cube/vkcubepp.app +```sh +# Build release binary for arm64-v8a +python3 scripts/android.py --config Release --app-abi arm64-v8a --app-stl c++_static +``` -Or you can locate them from `Finder` and launch them from there. +`android.py` can also streamline building for multiple ABIs: -##### The Install Target and RPATH +```sh +# Build release binaries for all ABIs +python3 scripts/android.py --config Release --app-abi 'armeabi-v7a arm64-v8a x86 x86_64' --app-stl c++_static +``` -The applications you just built are "bundled applications", but the -executables are using the `RPATH` mechanism to locate runtime dependencies -that are still in your build tree. +2. Building the test APK for development purposes -To see this, run this command from your `build` directory: +Creating the test APK is a bit of an involved process since it requires running multiple CLI tools after the CMake build has finished. - otool -l cube/cube.app/Contents/MacOS/vkcube +As a result users are enouraged to use `scripts/android.py` to build the test APK. -and note that the `vkcube` executable contains loader commands: +This script handles wrapping CMake and various Android CLI tools to create the APK for you. -- `LC_LOAD_DYLIB` to load `libvulkan.1.dylib` via an `@rpath` -- `LC_RPATH` that contains an absolute path to the build location of the Vulkan loader +```sh +# Build a complete test APK with debug binaries for all ABIS +python3 scripts/android.py --config Debug --app-abi 'armeabi-v7a arm64-v8a x86 x86_64' --app-stl c++_shared --apk --tests -This makes the bundled application "non-transportable", meaning that it won't -run unless the Vulkan loader is on that specific absolute path. This is useful -for debugging the loader or other components built in this repository, but not -if you want to move the application to another machine or remove your build -tree. +# Build a clean test APK with release binaries for arm64-v8a +python3 scripts/android.py --config Release --app-abi arm64-v8a --app-stl c++_shared --apk --tests --clean +``` -To address this problem, run: +Note: `scripts/android.py` will place the APK in the `build-android/bin` directory. - make install +See [tests/README.md](tests/README.md) for running APK / `vulkaninfo` on Android. -This step copies the bundled applications to the location specified by -CMAKE_INSTALL_PREFIX and "cleans up" the `RPATH` to remove any external -references and performs other bundle fix-ups. After running `make install`, -run the `otool` command again from the `build/install` directory and note: - -- `LC_LOAD_DYLIB` is now `@executable_path/../MacOS/libvulkan.1.dylib` -- `LC_RPATH` is no longer present +### Installed Files -The "bundle fix-up" operation also puts a copy of the Vulkan loader into the -bundle, making the bundle completely self-contained and self-referencing. +- *install_dir*`/bin` : The `vulkaninfo`, `vkcube` and `vkcubepp` executables -##### The vulkaninfo Application +If `INSTALL_ICD` is configured then MockICD will be installed as follows: -There is also a `vulkaninfo` application that you can run from the command line: +For Unix operating systems: - vulkaninfo/vulkaninfo +- *install_dir*`/bin` : The Mock ICD +- *install_dir*`/share/vulkan/icd.d` : Mock ICD JSON -If you run this from the build directory, vulkaninfo's RPATH is already -set to point to the Vulkan loader in the build tree, so it has no trouble -finding it. But the loader will not find the MoltenVK driver and you'll see a -message about an incompatible driver. To remedy this: +For WIN32: - VK_ICD_FILENAMES=/MoltenVK/Package/Latest/MoltenVK/macOS/MoltenVK_icd.json vulkaninfo/vulkaninfo +- *install_dir*`/bin` : The Mock ICD and JSON -If you run `vulkaninfo` from the install directory, the `RPATH` in the -`vulkaninfo` application got removed and the OS needs extra help to locate -the Vulkan loader: - DYLD_LIBRARY_PATH=/Vulkan-Loader/loader VK_ICD_FILENAMES=/MoltenVK/Package/Latest/MoltenVK/macOS/MoltenVK_icd.json vulkaninfo/vulkaninfo -#### Building with the Xcode Generator +### Software Installation -To create and open an Xcode project: +After you have built your project you can install using CMake's install functionality. - mkdir build-xcode - cd build-xcode - cmake -DVULKAN_LOADER_INSTALL_DIR=/absolute_path_to/Vulkan-Loader_install_dir -DMOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK -GXcode .. - open VULKAN.xcodeproj +CMake Docs: +- [Software Installation Guide](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#software-installation) +- [CLI for installing a project](https://cmake.org/cmake/help/latest/manual/cmake.1.html#install-a-project) -Within Xcode, you can select Debug or Release builds in the project's Build -Settings. You can also select individual schemes for working with specific -applications like `vkcube`. +```sh +# EX: Installs Release artifacts into `build/install` directory. +# NOTE: --config is only needed for multi-config generators (Visual Studio, Xcode, etc) +cmake --install build/ --config Release --prefix build/install +``` ### Building Vulkan SC Tools diff --git a/CMakeLists.txt b/CMakeLists.txt index 01fde0f68..192bbc988 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,11 +29,16 @@ endif() add_subdirectory(scripts) -# User-interface declarations ---------------------------------------------------------------------------------------------------- -# This section contains variables that affect development GUIs (e.g. CMake GUI and IDEs), such as option(), folders, and variables -# with the CACHE property. - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") +set(CMAKE_C_VISIBILITY_PRESET "hidden") +set(CMAKE_VISIBILITY_INLINES_HIDDEN "YES") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) option(VULKANSC "Build Vulkan SC tools" OFF) option(BUILD_VKSC_DEVSIM "Build Vulkan SC device simulation layer" OFF) @@ -41,9 +46,6 @@ option(BUILD_VKSC_DEVSIM "Build Vulkan SC device simulation layer" OFF) option(BUILD_CUBE "Build cube" ON) option(BUILD_VULKANINFO "Build vulkaninfo" ON) option(BUILD_ICD "Build icd" ON) -# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation. -# Require the user to ask that it be installed if they really want it. -option(INSTALL_ICD "Install icd" OFF) if(VULKANSC) set(BUILD_CUBE OFF CACHE BOOL "cube sample is not currently supported for Vulkan SC" FORCE) @@ -52,9 +54,7 @@ else() set(BUILD_VKSC_DEVSIM OFF CACHE BOOL "Vulkan SC device simulation layer is not supported for Vulkan" FORCE) endif() -if (UNIX AND NOT APPLE) # i.e. Linux - option(ENABLE_ADDRESS_SANITIZER "Use addres sanitization" OFF) -endif() +option(ENABLE_ADDRESS_SANITIZER "Use address sanitization") if(WIN32) # Optional: Allow specify the exact version used in the vulkaninfo executable @@ -67,29 +67,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # "Helper" targets that don't have interesting source code should set their FOLDER property to this set(TOOLS_HELPER_FOLDER "Helper Targets") -# ~~~ -# Find Vulkan Headers and Loader -# Search order: -# User-supplied CMAKE_PREFIX_PATH containing paths to the header and/or loader install dirs -# CMake options VULKAN_HEADERS_INSTALL_DIR and/or VULKAN_LOADER_INSTALL_DIR -# Env vars VULKAN_HEADERS_INSTALL_DIR and/or VULKAN_LOADER_INSTALL_DIR -# If on MacOS -# CMake option MOTLENVK_REPO_ROOT -# Env vars MOLTENVK_REPO_ROOT -# Fallback to FindVulkan operation using SDK install or system installed components. -# ~~~ -set(VULKAN_HEADERS_INSTALL_DIR "HEADERS-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Headers install directory") -set(VULKAN_LOADER_INSTALL_DIR "LOADER-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Loader install directory") -if(WIN32 AND "${VULKAN_LOADER_INSTALL_DIR}" STREQUAL "LOADER-NOTFOUND") - if(CMAKE_CL_64) - set(VULKAN_LOADER_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/x64") - else() - set(VULKAN_LOADER_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/x86") - endif() -endif() -set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};${VULKAN_HEADERS_INSTALL_DIR};${VULKAN_LOADER_INSTALL_DIR}; - $ENV{VULKAN_HEADERS_INSTALL_DIR};$ENV{VULKAN_LOADER_INSTALL_DIR}) - if(APPLE) set(MOLTENVK_REPO_ROOT "MOLTENVK-NOTFOUND" CACHE PATH "Absolute path to a MoltenVK repo directory") if(NOT MOLTENVK_REPO_ROOT AND NOT DEFINED ENV{MOLTENVK_REPO_ROOT}) @@ -101,52 +78,46 @@ if(APPLE) endif() message(STATUS "Using MoltenVK repo location at ${MOLTENVK_REPO_ROOT}") endif() -message(STATUS "Using find_package to locate Vulkan") -find_package(Vulkan) -find_package(VulkanHeaders REQUIRED CONFIG) -get_filename_component(Vulkan_LIBRARY_DIR ${Vulkan_LIBRARY} DIRECTORY) -message(STATUS "Vulkan FOUND = ${Vulkan_FOUND}") -message(STATUS "Vulkan Lib Dir = ${Vulkan_LIBRARY_DIR}") -message(STATUS "Vulkan Lib = ${Vulkan_LIBRARY}") -include(GNUInstallDirs) +find_package(VulkanHeaders QUIET CONFIG) +find_package(VulkanLoader QUIET CONFIG) -option(BUILD_WERROR "Treat compiler warnings as errors" ON) -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers") - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp") +if(VULKANSC) + find_package(VulkanUtilityLibraries REQUIRED CONFIG QUIET) +endif() - if(MAKE_C_COMPILER_ID MATCHES "Clang") - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-string-conversion -Wno-implicit-in-conversion -Wno-enum-enum-conversion") - endif() +include(GNUInstallDirs) - if(BUILD_WERROR) - if((CMAKE_COMPILER_IS_GNUCXX AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.3.0)) OR - (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0))) - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -Werror") - endif() - endif() +option(BUILD_WERROR "Treat compiler warnings as errors") +if (BUILD_WERROR) + add_compile_options("$,/WX,-Werror>") +endif() - # 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_COMPILER_IS_GNUCC AND NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.1)) - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -Wimplicit-fallthrough=0") - endif() +if (${CMAKE_CXX_COMPILER_ID} MATCHES "(GNU|Clang)") + add_compile_options( + -Wall + -Wextra + -Wno-unused-parameter + -Wno-missing-field-initializers + -fno-strict-aliasing + -fno-builtin-memcmp + ) - if(APPLE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_COMPILE_FLAGS}") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}") + if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + add_compile_options(-Wno-stringop-truncation) endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++14 -fno-rtti") - if(UNIX) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") + + if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + add_compile_options( + -Wno-sign-conversion + -Wno-shorten-64-to-32 + -Wno-string-conversion + -Wno-implicit-int-conversion + -Wno-enum-enum-conversion + ) endif() elseif(MSVC) - if(BUILD_WERROR) - add_compile_options("/WX") - endif() + # TODO: Update to /W4 add_compile_options("/W3") # Warn about nested declarations add_compile_options("/w34456") @@ -165,13 +136,34 @@ if (TOOLS_CODEGEN) add_custom_target(tools_codegen COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/generate_source.py "${VULKAN_HEADERS_INSTALL_DIR}/${CMAKE_INSTALL_DATADIR}/vulkan/registry" - --incremental --api ${API_TYPE} + --incremental --generated-version ${VulkanHeaders_VERSION} --api ${API_TYPE} ) endif() # Default to using the static CRT set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +# Find the Git branch & tag info for use in Mock ICD +find_package (Git) +if (GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git/HEAD") + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --tags --always + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE GIT_TAG_INFO) + string(REGEX REPLACE "\n$" "" GIT_TAG_INFO "${GIT_TAG_INFO}") + + file(READ "${CMAKE_CURRENT_LIST_DIR}/.git/HEAD" GIT_HEAD_REF_INFO) + if (GIT_HEAD_REF_INFO) + string(REGEX MATCH "ref: refs/heads/(.*)" _ ${GIT_HEAD_REF_INFO}) + if (CMAKE_MATCH_1) + set(GIT_BRANCH_NAME ${CMAKE_MATCH_1}) + else() + set(GIT_BRANCH_NAME ${GIT_HEAD_REF_INFO}) + endif() + string(REGEX REPLACE "\n$" "" GIT_BRANCH_NAME "${GIT_BRANCH_NAME}") + endif() +endif() + if(APPLE) include(mac_common.cmake) endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cd7e7ed2e..52829ebbf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,9 +41,7 @@ a good reason is "This violates the style guide, but it improves type safety." * Run **clang-format** on your changes to maintain consistent formatting * There are `.clang-format` files present in the repository to define 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 7.0.0 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. + * **clang-format** binaries are available from the LLVM orginization, here: [LLVM](https://clang.llvm.org/). * A sample git workflow may look like: > # Make changes to the source. @@ -66,16 +64,14 @@ a good reason is "This violates the style guide, but it improves type safety." Strive for commits that implement a single or related set of functionality, using as many commits as is necessary (more is better). That said, 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](#testing your changes) on all supported platforms --- the automatic Github Travis and AppVeyor continuous integration features will assist in enforcing this requirement. #### Generated Source Code -The `icd/generated` directory contains source code that is created by several +The `icd/generated` and `vulkaninfo/generated` directories 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/VulkanSC-Tools/blob/main/BUILD.md#generated-source-code). +corresponding generated output to keep the repository self-consistent. This requirement is enforced by CI. +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). #### **Testing Your Changes** * Run the repository components with the Vulkan Validation Layers before and after each of your commits to check for any regressions. @@ -92,29 +88,6 @@ scripts and before building and testing your changes. More details can be found * Run tests that explicitly exercise your changes. * Feel free to subject your code changes to other tests as well! -#### Coding Conventions for [CMake](http://cmake.org) files - -* When editing configuration files for CMake, follow the style conventions of the surrounding code. - * The column limit is 132. - * 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)** You will be prompted with a one-time "click-through" CLA dialog as part of submitting your pull request diff --git a/README.md b/README.md index 2f8842675..e89b8e148 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,11 @@ Please see the [GOVERNANCE.md](GOVERNANCE.md) file in this repository for reposi ## Version Tagging Scheme -Updates to the `VulkanSC-Tools` 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. For Vulkan SC, updates to a new API version will be tagged using the following format `vksc<`_`version`_`>.<`_`patch`_`>` (e.g., `vksc1.0.12`). diff --git a/build-android/build_all.sh b/build-android/build_all.sh deleted file mode 100755 index 9f5024520..000000000 --- a/build-android/build_all.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -# Copyright 2017 The Android Open Source Project -# -# 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. - -ANDROID_BUILD_DIR=$(dirname $(readlink -f $0)) -PROJECT_DIR=$ANDROID_BUILD_DIR/.. - -if [ -z "${ANDROID_SDK_HOME}" ]; -then echo "Please set ANDROID_SDK_HOME, exiting"; exit 1; -else echo "ANDROID_SDK_HOME is ${ANDROID_SDK_HOME}"; -fi - -if [ -z "${ANDROID_NDK_HOME}" ]; -then echo "Please set ANDROID_NDK_HOME, exiting"; exit 1; -else echo "ANDROID_NDK_HOME is ${ANDROID_NDK_HOME}"; -fi - -if [[ $(uname) == "Linux" ]]; then - cores=$(nproc) || echo 4 -elif [[ $(uname) == "Darwin" ]]; then - cores=$(sysctl -n hw.ncpu) || echo 4 -fi - -function findtool() { - if [[ ! $(type -t $1) ]]; then - echo Command $1 not found, see ../BUILD.md; - exit 1; - fi -} - -# Check for dependencies -findtool aapt -findtool zipalign -findtool jarsigner - -set -ev - -VULKANINFO_BUILD_DIR=$PROJECT_DIR/vulkaninfo/android -echo VULKANINFO_BUILD_DIR="${VULKANINFO_BUILD_DIR}" - -DEMO_BUILD_DIR=$PROJECT_DIR/cube/android -echo DEMO_BUILD_DIR="${DEMO_BUILD_DIR}" - -function create_APK() { - aapt package -f -M AndroidManifest.xml -I "$ANDROID_SDK_HOME/platforms/android-23/android.jar" -S res -F bin/$1-unaligned.apk bin/libs - # update this logic to detect if key is already there. If so, use it, otherwise create it. - jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android bin/$1-unaligned.apk androiddebugkey - zipalign -f 4 bin/$1-unaligned.apk bin/$1.apk -} - -# -# update dependencies -# -( -pushd $ANDROID_BUILD_DIR -./update_external_sources_android.sh --no-build -popd -pushd $PROJECT_DIR -python3 scripts/generate_source.py $ANDROID_BUILD_DIR/third_party/Vulkan-Headers/registry --incremental -popd -) - -# -# build vulkaninfo -# -( -pushd $VULKANINFO_BUILD_DIR -ndk-build -j $cores -popd -) - -# -# build vkcube APK -# -( -pushd $DEMO_BUILD_DIR -ndk-build -j $cores -mkdir -p $DEMO_BUILD_DIR/cube/bin/libs/lib -cp -r $DEMO_BUILD_DIR/libs/* $DEMO_BUILD_DIR/cube/bin/libs/lib/ -cd $DEMO_BUILD_DIR/cube -create_APK vkcube -popd -) - -echo Builds succeeded -exit 0 diff --git a/build-android/install_all.sh b/build-android/install_all.sh deleted file mode 100755 index f2ecd9028..000000000 --- a/build-android/install_all.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -# Copyright 2017 The Android Open Source Project -# -# 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. - -set -e - -# -# Parse parameters -# - -function printUsage { - echo "Supported parameters are:" - echo " -s|--serial (optional)" - echo - echo "i.e. ${0##*/} -s " - exit 1 -} - -if [[ $(($# % 2)) -ne 0 ]] -then - echo Parameters must be provided in pairs. - echo parameter count = $# - echo - printUsage - exit 1 -fi - -while [[ $# -gt 0 ]] -do - case $1 in - -s|--serial) - # include the flag, because we need to leave it off if not provided - serial="$2" - shift 2 - ;; - -*) - # unknown option - echo Unknown option: $1 - echo - printUsage - exit 1 - ;; - esac -done - -if [[ $serial ]]; then - echo serial = "${serial}" - serialFlag="-s $serial" - if [[ $(adb devices) != *"$serial"* ]] - then - echo Device not found: "${serial}" - echo - printUsage - exit 1 - fi -else - echo Using device $(adb get-serialno) -fi - -# Install everything built by build_all.sh -echo "adb $serialFlag install -r ../cube/android/cube/bin/vkcube.apk" -adb $serialFlag install -r ../cube/android/cube/bin/vkcube.apk - -exit $? diff --git a/build-android/update_external_sources_android.bat b/build-android/update_external_sources_android.bat deleted file mode 100755 index 5c6f25546..000000000 --- a/build-android/update_external_sources_android.bat +++ /dev/null @@ -1,134 +0,0 @@ -@echo off -REM Update source for vulkan-headers - -REM -REM Copyright 2016 The Android Open Source Project -REM Copyright (C) 2015 Valve Corporation -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM - -setlocal EnableDelayedExpansion -set errorCode=0 -set ANDROID_BUILD_DIR=%~dp0 -set BUILD_DIR=%ANDROID_BUILD_DIR% -set BASE_DIR=%BUILD_DIR%\third_party -set VULKAN_HEADERS_DIR=%BASE_DIR%\Vulkan-Headers - -for %%X in (where.exe) do (set FOUND=%%~$PATH:X) -if not defined FOUND ( - echo Dependency check failed: - echo where.exe not found - echo This script requires Windows Vista or later, which includes where.exe. - set errorCode=1 -) - -where /q git.exe -if %ERRORLEVEL% equ 1 ( - echo Dependency check failed: - echo git.exe not found - echo Git for Windows can be downloaded here: https://git-scm.com/download/win - echo Install and ensure git.exe makes it into your PATH - set errorCode=1 -) - -where /q ndk-build.cmd -if %ERRORLEVEL% equ 1 ( - echo Dependency check failed: - echo ndk-build.cmd not found - echo Android NDK can be downloaded here: http://developer.android.com/ndk/guides/setup.html - echo Install and ensure ndk-build.cmd makes it into your PATH - set errorCode=1 -) - -REM ensure where is working with below false test -REM where /q foo -REM if %ERRORLEVEL% equ 1 ( -REM echo foo -REM ) - -:main - -if %errorCode% neq 0 (goto:error) - -REM Read the target versions from external file, which is shared with Linux script - -if not exist %ANDROID_BUILD_DIR%\vulkan-headers_revision_android ( - echo. - echo Missing vulkan-headers_revision_android file. Place it in %ANDROID_BUILD_DIR% - set errorCode=1 - goto:error -) - -set /p VULKAN_HEADERS_REVISION= < vulkan-headers_revision_android -echo VULKAN_HEADERS_REVISION=%VULKAN_HEADERS_REVISION% - - -echo Creating vulkan-headers in %BASE_DIR% - -set sync-vulkan-headers=1 - -if %sync-vulkan-headers% equ 1 ( - if %ERRORLEVEL% neq 0 (goto:error) - if not exist %VULKAN_HEADERS_DIR% ( - call:create_vulkan-headers - ) - if %errorCode% neq 0 (goto:error) - call:update_vulkan-headers - if %errorCode% neq 0 (goto:error) -) - -echo. -echo Exiting -goto:finish - -:error -echo. -echo Halting due to error -goto:finish - -:finish -if not "%cd%\" == "%BUILD_DIR%" ( cd %BUILD_DIR% ) -endlocal -REM This needs a fix to return error, something like exit %errorCode% -REM Right now it is returning 0 -goto:eof - - - -REM // ======== Functions ======== // - -:create_vulkan-headers - echo. - echo Creating local vulkan-headers repository %VULKAN_HEADERS_DIR% - if not exist "%VULKAN_HEADERS_DIR%\" mkdir %VULKAN_HEADERS_DIR% - cd %VULKAN_HEADERS_DIR% - git clone https://github.com/KhronosGroup/Vulkan-Headers.git . - git checkout %VULKAN_HEADERS_REVISION% - if not exist %VULKAN_HEADERS_DIR%\registry ( - echo vulkan-headers source download failed! - set errorCode=1 - ) -goto:eof - -:update_vulkan-headers - echo. - echo Updating %VULKAN_HEADERS_DIR% - cd %VULKAN_HEADERS_DIR% - git fetch --all - git checkout %VULKAN_HEADERS_REVISION% - if not exist %VULKAN_HEADERS_DIR%\registry ( - echo vulkan-headers source update failed! - set errorCode=1 - ) -goto:eof diff --git a/build-android/update_external_sources_android.sh b/build-android/update_external_sources_android.sh deleted file mode 100755 index d86682d93..000000000 --- a/build-android/update_external_sources_android.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# Update source for vulkan-headers - -# Copyright 2016 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation -# -# 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. - -set -e - -sync_vulkan_headers=1 - -ANDROIDBUILDDIR=$PWD -BUILDDIR=$ANDROIDBUILDDIR -BASEDIR=$BUILDDIR/third_party - -VULKAN_HEADERS_REVISION=$(cat $ANDROIDBUILDDIR/vulkan-headers_revision_android) - -echo "VULKAN_HEADERS_REVISION=$VULKAN_HEADERS_REVISION" - -VULKAN_HEADERS_URL=$(cat $ANDROIDBUILDDIR/vulkan-headers_url_android) - -if [[ $(uname) == "Linux" ]]; then - cores="$(nproc || echo 4)" -elif [[ $(uname) == "Darwin" ]]; then - cores=$(sysctl -n hw.ncpu) -fi - -# -# Parse parameters -# - -function printUsage { - echo "Supported parameters are:" - echo " --abi (optional)" - echo " --no-build (optional)" - echo - echo "i.e. ${0##*/} --abi arm64-v8a \\" - exit 1 -} - -while [[ $# -gt 0 ]] -do - case $1 in - --abi) - abi="$2" - shift 2 - ;; - --no-build) - nobuild=1 - shift 1 - ;; - *) - # unknown option - echo Unknown option: $1 - echo - printUsage - exit 1 - ;; - esac -done - -echo abi=$abi -if [[ -z $abi ]] -then - echo No abi provided, so building for all supported abis. -fi - -echo no-build=$nobuild -if [[ $nobuild ]] -then - echo Skipping build. -fi - -function create_vulkan-headers () { - rm -rf $BASEDIR/Vulkan-Headers - echo "Creating local Vulkan-Headers repository ($BASEDIR/Vulkan-Headers)." - mkdir -p $BASEDIR/Vulkan-Headers - cd $BASEDIR/Vulkan-Headers - git clone $VULKAN_HEADERS_URL . - git checkout $VULKAN_HEADERS_REVISION -} - -function update_vulkan-headers () { - echo "Updating $BASEDIR/Vulkan-Headers" - cd $BASEDIR/Vulkan-Headers - if [[ $(git config --get remote.origin.url) != $VULKAN_HEADERS_URL ]]; then - echo "Vulkan-Headers URL mismatch, recreating local repo" - create_vulkan-headers - return - fi - git fetch --all - git checkout $VULKAN_HEADERS_REVISION -} - -if [ $sync_vulkan_headers -eq 1 ]; then - if [ ! -d "$BASEDIR/Vulkan-Headers" -o ! -d "$BASEDIR/Vulkan-Headers/.git" ]; then - create_vulkan-headers - fi - update_vulkan-headers -fi - -echo "" -echo "${0##*/} finished." - diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android deleted file mode 100644 index e00e07ecb..000000000 --- a/build-android/vulkan-headers_revision_android +++ /dev/null @@ -1 +0,0 @@ -v1.3.257 diff --git a/build-android/vulkan-headers_url_android b/build-android/vulkan-headers_url_android deleted file mode 100644 index 9ce985153..000000000 --- a/build-android/vulkan-headers_url_android +++ /dev/null @@ -1 +0,0 @@ -https://github.com/KhronosGroup/Vulkan-Headers.git diff --git a/cmake/Copyright_cmake.txt b/cmake/Copyright_cmake.txt deleted file mode 100644 index 743c63418..000000000 --- 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/FindVulkan.cmake b/cmake/FindVulkan.cmake deleted file mode 100644 index 846708e18..000000000 --- a/cmake/FindVulkan.cmake +++ /dev/null @@ -1,80 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindVulkan -# ---------- -# -# Try to find Vulkan -# -# IMPORTED Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if -# Vulkan has been found. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following variables:: -# -# Vulkan_FOUND - True if Vulkan was found -# Vulkan_INCLUDE_DIRS - include directories for Vulkan -# Vulkan_LIBRARIES - link against this library to use Vulkan -# -# The module will also define two cache variables:: -# -# Vulkan_INCLUDE_DIR - the Vulkan include directory -# Vulkan_LIBRARY - the path to the Vulkan library -# - -if(WIN32) - find_path(Vulkan_INCLUDE_DIR - NAMES vulkan/vulkan.h - HINTS - "$ENV{VULKAN_SDK}/Include" - ) - - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - find_library(Vulkan_LIBRARY - NAMES vulkan-1 - HINTS - "$ENV{VULKAN_SDK}/Lib" - "$ENV{VULKAN_SDK}/Bin" - ) - elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - find_library(Vulkan_LIBRARY - NAMES vulkan-1 - HINTS - "$ENV{VULKAN_SDK}/Lib32" - "$ENV{VULKAN_SDK}/Bin32" - NO_SYSTEM_ENVIRONMENT_PATH - ) - endif() -else() - find_path(Vulkan_INCLUDE_DIR - NAMES vulkan/vulkan.h - HINTS - "$ENV{VULKAN_SDK}/include") - find_library(Vulkan_LIBRARY - NAMES vulkan - HINTS - "$ENV{VULKAN_SDK}/lib") -endif() - -set(Vulkan_LIBRARIES ${Vulkan_LIBRARY}) -set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Vulkan - DEFAULT_MSG - Vulkan_LIBRARY Vulkan_INCLUDE_DIR) - -mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY) - -if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) - add_library(Vulkan::Vulkan UNKNOWN IMPORTED) - set_target_properties(Vulkan::Vulkan PROPERTIES - IMPORTED_LOCATION "${Vulkan_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}") -endif() diff --git a/cmake/FindWayland.cmake b/cmake/FindWayland.cmake deleted file mode 100644 index 758744d84..000000000 --- a/cmake/FindWayland.cmake +++ /dev/null @@ -1,68 +0,0 @@ -# Try to find Wayland on a Unix system -# -# This will define: -# -# WAYLAND_FOUND - True if Wayland is found -# WAYLAND_LIBRARIES - Link these to use Wayland -# WAYLAND_INCLUDE_DIR - Include directory for Wayland -# WAYLAND_DEFINITIONS - Compiler flags for using Wayland -# -# In addition the following more fine grained variables will be defined: -# -# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES -# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES -# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES -# -# Copyright (c) 2013 Martin Gräßlin -# -# 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) - IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES) - # In the cache already - SET(WAYLAND_FIND_QUIETLY TRUE) - ENDIF () - - # 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_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor) - - SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS}) - - FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - - FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - - set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR}) - - set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES}) - - list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR) - - include(FindPackageHandleStandardArgs) - - set(FPHSA_NAME_MISMATCHED ON) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR) - unset(FPHSA_NAME_MISMATCHED) - - MARK_AS_ADVANCED( - WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES - WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES - WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES - WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES - WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES - ) - -ENDIF () diff --git a/cmake/FindWaylandProtocols.cmake b/cmake/FindWaylandProtocols.cmake deleted file mode 100644 index 25cf2a62e..000000000 --- a/cmake/FindWaylandProtocols.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# Wayland protocols Defines: -# -# * WAYLAND_PROTOCOLS_FOUND True if the wayland-protocols data path is found -# * WAYLAND_PROTOCOLS_PATH Path to the wayland-scanner executable -# - -if(NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(WAYLAND_PROTOCOLS_PATH REQUIRED wayland-protocols) - execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols - OUTPUT_VARIABLE WAYLAND_PROTOCOLS_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) - - set(FPHSA_NAME_MISMATCHED ON) - find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_PROTOCOLS_PATH) - unset(FPHSA_NAME_MISMATCHED) - - mark_as_advanced(WAYLAND_PROTOCOLS_PATH) -endif() diff --git a/cmake/FindWaylandScanner.cmake b/cmake/FindWaylandScanner.cmake deleted file mode 100644 index d016c9347..000000000 --- a/cmake/FindWaylandScanner.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# Wayland scanner Defines: -# -# * WAYLAND_SCANNER_FOUND True if wayland-scanner is found -# * WAYLAND_SCANNER_EXECUTABLE Path to the wayland-scanner executable -# - -if(NOT WIN32) - # Delegate to pkg-config for our first guess - find_package(PkgConfig) - pkg_check_modules(PKG_WAYLAND_SCANNER QUIET wayland-scanner) - find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner ${PKG_WAYLAND_SCANNER_PREFIX}/bin/wayland-scanner) - - set(FPHSA_NAME_MISMATCHED ON) - find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_SCANNER_EXECUTABLE) - unset(FPHSA_NAME_MISMATCHED) - - mark_as_advanced(WAYLAND_SCANNER_EXECUTABLE) -endif() diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 9b16da317..8ab409e9d 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -15,41 +15,7 @@ # limitations under the License. # ~~~ -set(CUBE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/..) - -set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts") - -if (NOT GLSLANG_INSTALL_DIR AND DEFINED ENV{GLSLANG_INSTALL_DIR}) - set(GLSLANG_INSTALL_DIR $ENV{GLSLANG_INSTALL_DIR}) -endif() - -if(GLSLANG_INSTALL_DIR) - message(STATUS "Using GLSLANG_INSTALL_DIR to look for glslangValidator") - find_program(GLSLANG_VALIDATOR names glslangValidator HINTS "${GLSLANG_INSTALL_DIR}/bin") -else() - find_package(Python3 REQUIRED QUIET) - set(GLSLANG_VALIDATOR_NAME "glslangValidator") - message(STATUS "Using cmake find_program to look for glslangValidator") - if(WIN32) - execute_process( - COMMAND ${Python3_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-windows-x64-Release.zip) - set(GLSLANG_VALIDATOR_NAME "glslangValidator.exe") - elseif(APPLE) - execute_process(COMMAND ${Python3_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-osx-Release.zip) - elseif(UNIX AND NOT APPLE) # i.e. Linux - execute_process(COMMAND ${Python3_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-linux-Release.zip) - endif() - if (WIN32) - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/windows/bin") - elseif(APPLE) - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/darwin/bin") - else() - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/linux/bin") - endif() - find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME} HINTS ${PLATFORM_DIR}) -endif() - -if(UNIX AND NOT APPLE) # i.e. Linux +if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") 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) @@ -67,10 +33,13 @@ if(UNIX AND NOT APPLE) # i.e. Linux endif() if(BUILD_WSI_WAYLAND_SUPPORT) - find_package(Wayland REQUIRED) - find_package(WaylandScanner REQUIRED) - find_package(WaylandProtocols REQUIRED) - include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) + + pkg_get_variable(WAYLAND_SCANNER_EXECUTABLE wayland-scanner wayland_scanner) + message(STATUS "WAYLAND_SCANNER_EXECUTABLE = ${WAYLAND_SCANNER_EXECUTABLE}") + + pkg_get_variable(WAYLAND_PROTOCOLS_PATH wayland-protocols pkgdatadir) + message(STATUS "WAYLAND_PROTOCOLS_PATH = ${WAYLAND_PROTOCOLS_PATH}") set(XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_PATH}/stable/xdg-shell/xdg-shell.xml) add_custom_command(COMMENT "Generating xdg-shell protocol dispatch data" OUTPUT xdg-shell-code.c @@ -126,7 +95,7 @@ elseif(ANDROID) add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) elseif(APPLE) add_definitions(-DVK_USE_PLATFORM_METAL_EXT) -elseif(UNIX AND NOT APPLE) # i.e. Linux +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(NOT CUBE_WSI_SELECTION) set(CUBE_WSI_SELECTION "XCB") endif() @@ -147,8 +116,7 @@ elseif(UNIX AND NOT APPLE) # i.e. Linux if(NOT BUILD_WSI_WAYLAND_SUPPORT) message(FATAL_ERROR "Selected Wayland for vkcube build but not building Wayland support") endif() - set(CUBE_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS}) - link_libraries(${WAYLAND_CLIENT_LIBRARIES}) + link_libraries(PkgConfig::WAYLAND_CLIENT) set(CUBE_PLATFORM VK_USE_PLATFORM_WAYLAND_KHR) set(XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_PATH}/stable/xdg-shell/xdg-shell.xml) set(OPTIONAL_WAYLAND_DATA_FILES @@ -174,73 +142,84 @@ else() message(FATAL_ERROR "Unsupported Platform!") endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - -add_custom_command(COMMENT "Compiling cube vertex shader" - OUTPUT cube.vert.inc - COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.vert.inc - ${PROJECT_SOURCE_DIR}/cube/cube.vert - MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.vert - DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.vert ${GLSLANG_VALIDATOR}) -add_custom_command(COMMENT "Compiling cube fragment shader" - OUTPUT cube.frag.inc - COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.frag.inc - ${PROJECT_SOURCE_DIR}/cube/cube.frag - MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.frag - DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.frag ${GLSLANG_VALIDATOR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +if (COMPILE_CUBE_SHADERS) + # Try to find glslang in system paths or in an SDK if the VULKAN_SDK env-var is set + find_program(GLSLANG_VALIDATOR names glslang glslangValidator HINTS $ENV{GLSLANG_INSTALL_DIR} $ENV{VULKAN_SDK}/bin $ENV{VULKAN_SDK}/Bin) -if(WIN32) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES") + add_custom_command(COMMENT "Compiling cube vertex shader" + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/cube.vert.inc + COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_SOURCE_DIR}/cube.vert.inc + ${PROJECT_SOURCE_DIR}/cube/cube.vert + MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.vert + DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.vert ${GLSLANG_VALIDATOR}) + add_custom_command(COMMENT "Compiling cube fragment shader" + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/cube.frag.inc + COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_SOURCE_DIR}/cube.frag.inc + ${PROJECT_SOURCE_DIR}/cube/cube.frag + MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.frag + DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.frag ${GLSLANG_VALIDATOR}) endif() -include_directories(${CUBE_INCLUDE_DIRS}) +if(WIN32) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) + # vkcube / vkcube make use of M_PI and various other math defines. + add_compile_definitions(_USE_MATH_DEFINES) +endif() # ---------------------------------------------------------------------------- # vkcube if(APPLE) include(macOS/cube/cube.cmake) -elseif(NOT WIN32) - add_executable(vkcube - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc - ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcube Vulkan::Vulkan) +elseif (ANDROID) + add_library(vkcube MODULE) + + target_sources(vkcube PRIVATE cube.c) + + add_subdirectory(android) + + target_link_libraries(vkcube PRIVATE Vulkan::Headers) +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") + add_executable(vkcube) + target_sources(vkcube PRIVATE + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc + ${OPTIONAL_WAYLAND_DATA_FILES} + ) target_compile_definitions(vkcube PUBLIC ${CUBE_PLATFORM}) include(CheckLibraryExists) CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) if (NEED_RT) - target_link_libraries(vkcube rt) + target_link_libraries(vkcube PRIVATE rt) endif() - - if (ENABLE_ADDRESS_SANITIZER) - target_compile_options(vkcube PUBLIC -fsanitize=address) - target_link_options(vkcube PUBLIC -fsanitize=address) - endif () + target_link_libraries(vkcube PRIVATE Vulkan::Headers Vulkan::Loader) +elseif(WIN32) + add_executable(vkcube WIN32) + target_sources(vkcube PRIVATE + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc + ) + target_link_libraries(vkcube PRIVATE Vulkan::Headers Vulkan::Loader) else() - if(CMAKE_CL_64) - set(LIB_DIR "Win64") - else() - set(LIB_DIR "Win32") - endif() + message(FATAL_ERROR "Unsupported Platform!") +endif() - add_executable(vkcube - WIN32 - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc) - target_link_libraries(vkcube Vulkan::Vulkan) +if (ENABLE_ADDRESS_SANITIZER) + target_compile_options(vkcube PUBLIC -fsanitize=address) + target_link_options(vkcube PUBLIC -fsanitize=address) endif() -if(APPLE) +target_include_directories(vkcube PRIVATE .) + +if (ANDROID) + install(TARGETS vkcube DESTINATION ${CMAKE_INSTALL_LIBDIR}) +elseif(APPLE) # Keep RPATH so fixup_bundle can use it to find libraries set_target_properties(vkcube PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) install(TARGETS vkcube BUNDLE DESTINATION "cube") @@ -250,7 +229,11 @@ if(APPLE) fixup_bundle(\${CMAKE_INSTALL_PREFIX}/cube/vkcube.app \"\" \"${Vulkan_LIBRARY_DIR}\") ") else() - install(TARGETS vkcube RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vkcube) +endif() + +if (ANDROID) + return() endif() # ---------------------------------------------------------------------------- @@ -258,7 +241,7 @@ endif() if(APPLE) include(macOS/cubepp/cubepp.cmake) -elseif(NOT WIN32) +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") add_executable(vkcubepp cube.cpp ${PROJECT_SOURCE_DIR}/cube/cube.vert @@ -266,7 +249,7 @@ elseif(NOT WIN32) cube.vert.inc cube.frag.inc ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcubepp Vulkan::Vulkan) + target_link_libraries(vkcubepp Vulkan::Headers Vulkan::Loader) target_compile_definitions(vkcubepp PUBLIC ${CUBE_PLATFORM}) if (ENABLE_ADDRESS_SANITIZER) @@ -274,12 +257,6 @@ elseif(NOT WIN32) target_link_options(vkcubepp PUBLIC -fsanitize=address) endif () else() - if(CMAKE_CL_64) - set(LIB_DIR "Win64") - else() - set(LIB_DIR "Win32") - endif() - add_executable(vkcubepp WIN32 cube.cpp @@ -287,8 +264,9 @@ else() ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc) - target_link_libraries(vkcubepp Vulkan::Vulkan) + target_link_libraries(vkcubepp Vulkan::Headers Vulkan::Loader) endif() +target_include_directories(vkcubepp PRIVATE .) if(APPLE) # Keep RPATH so fixup_bundle can use it to find libraries @@ -300,37 +278,43 @@ if(APPLE) fixup_bundle(\${CMAKE_INSTALL_PREFIX}/cube/vkcubepp.app \"\" \"${Vulkan_LIBRARY_DIR}\") ") else() - install(TARGETS vkcubepp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vkcubepp) endif() # ---------------------------------------------------------------------------- # vkcube-wayland -if(UNIX AND NOT APPLE) # i.e. Linux +if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(BUILD_WSI_WAYLAND_SUPPORT AND EXISTS ${WAYLAND_PROTOCOLS_PATH}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml) - set(CUBE_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS}) - link_libraries(${WAYLAND_CLIENT_LIBRARIES}) - set(OPTIONAL_WAYLAND_DATA_FILES + add_executable(vkcube-wayland) + + target_sources(vkcube-wayland PRIVATE + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-code.c ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-client-header.h ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-code.c - ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - add_executable(vkcube-wayland - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc - ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcube-wayland Vulkan::Vulkan) - target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) + ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h + ) + target_include_directories(vkcube-wayland PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + . + ) + target_link_libraries(vkcube-wayland PRIVATE + Vulkan::Headers + Vulkan::Loader + PkgConfig::WAYLAND_CLIENT + ) + target_compile_definitions(vkcube-wayland PRIVATE VK_USE_PLATFORM_WAYLAND_KHR) include(CheckLibraryExists) CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) if (NEED_RT) - target_link_libraries(vkcube-wayland rt) + target_link_libraries(vkcube-wayland PRIVATE rt) endif() - install(TARGETS vkcube-wayland RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vkcube-wayland) if (ENABLE_ADDRESS_SANITIZER) target_compile_options(vkcube-wayland PUBLIC -fsanitize=address) diff --git a/cube/android/.gitignore b/cube/android/.gitignore deleted file mode 100644 index 8008f2548..000000000 --- a/cube/android/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -libs -obj diff --git a/cube/android/cube/AndroidManifest.xml b/cube/android/AndroidManifest.xml similarity index 84% rename from cube/android/cube/AndroidManifest.xml rename to cube/android/AndroidManifest.xml index 1bf9080bb..fbec106db 100644 --- a/cube/android/cube/AndroidManifest.xml +++ b/cube/android/AndroidManifest.xml @@ -6,15 +6,14 @@ - - + - + diff --git a/cube/android/CMakeLists.txt b/cube/android/CMakeLists.txt new file mode 100644 index 000000000..5783fa903 --- /dev/null +++ b/cube/android/CMakeLists.txt @@ -0,0 +1,64 @@ +# ~~~ +# 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. +# ~~~ + +target_sources(vkcube PRIVATE + android_util.cpp + android_util.h + vulkan_wrapper.cpp + vulkan_wrapper.h +) + +target_include_directories(vkcube PRIVATE + include + . +) + +target_compile_options(vkcube PRIVATE + --include=${CMAKE_CURRENT_SOURCE_DIR}/vulkan_wrapper.h +) + +set_directory_properties(PROPERTIES "COMPILE_OPTIONS" "") # Disable compiler warnings for android glue + +set(native_app_glue_dir "${CMAKE_ANDROID_NDK}/sources/android/native_app_glue") + +if (NOT EXISTS ${native_app_glue_dir}) + message(FATAL_ERROR "Couldn't find Android Native Glue directory!") +endif() + +# https://stackoverflow.com/questions/57189936/compiling-native-app-glue-c-results-in-an-invalid-library-file/76963564#76963564 +add_library(android_glue OBJECT) + +target_include_directories(android_glue PUBLIC ${native_app_glue_dir}) +target_sources(android_glue PRIVATE + ${native_app_glue_dir}/android_native_app_glue.c + ${native_app_glue_dir}/android_native_app_glue.h +) + +set_target_properties(vkcube PROPERTIES OUTPUT_NAME "VkCube") + +target_link_libraries(vkcube PRIVATE + android_glue + log + android +) + +# https://stackoverflow.com/questions/76631917/cmake-how-to-install-shared-stl-libraries-for-android/76656492#76656492 +if ("${CMAKE_ANDROID_STL_TYPE}" MATCHES "shared") + file(READ "${CMAKE_ANDROID_NDK}/meta/abis.json" JSON_FILE) + string(JSON TRIPLE GET "${JSON_FILE}" "${CMAKE_ANDROID_ARCH_ABI}" "triple") + install(FILES "${CMAKE_SYSROOT}/usr/lib/${TRIPLE}/libc++_shared.so" DESTINATION "${CMAKE_INSTALL_LIBDIR}") +endif() diff --git a/common/README.md b/cube/android/README.md similarity index 87% rename from common/README.md rename to cube/android/README.md index 3e496beec..75b1747fc 100644 --- a/common/README.md +++ b/cube/android/README.md @@ -22,7 +22,7 @@ Copy contents of parsed_header into generate_vulkan_wrapper.py between the secti Then run the script: popd - ./generate_vulkan_wrapper.py ../common/vulkan_wrapper.h - ./generate_vulkan_wrapper.py ../common/vulkan_wrapper.cpp + ./generate_vulkan_wrapper.py ../cube/android/vulkan_wrapper.h + ./generate_vulkan_wrapper.py ../cube/android/vulkan_wrapper.cpp clang-format -i vulkan_wrapper.h clang-format -i vulkan_wrapper.cpp diff --git a/common/android_util.cpp b/cube/android/android_util.cpp similarity index 100% rename from common/android_util.cpp rename to cube/android/android_util.cpp diff --git a/common/android_util.h b/cube/android/android_util.h similarity index 100% rename from common/android_util.h rename to cube/android/android_util.h diff --git a/cube/android/cube-with-layers/AndroidManifest.xml b/cube/android/cube-with-layers/AndroidManifest.xml deleted file mode 100644 index 50b216e4d..000000000 --- a/cube/android/cube-with-layers/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cube/android/cube-with-layers/custom_rules.xml b/cube/android/cube-with-layers/custom_rules.xml deleted file mode 100644 index 0ca5933ed..000000000 --- a/cube/android/cube-with-layers/custom_rules.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - -VkCubeWithLayers: Creating libs-with-layers - - -VkCubeWithLayers: Copying libs from demos/android - - - - -VkCubeWithLayers: Copying layers from build-android - - - - - -VkCubeWithLayers: Overriding native.libs.absolute.dir with ${cubeWithLayersDir} - - - diff --git a/cube/android/cube-with-layers/res/values/strings.xml b/cube/android/cube-with-layers/res/values/strings.xml deleted file mode 100644 index ecd779e42..000000000 --- a/cube/android/cube-with-layers/res/values/strings.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - VkCubeWithLayers - - diff --git a/cube/android/cube/custom_rules.xml b/cube/android/cube/custom_rules.xml deleted file mode 100644 index 31eb31ad2..000000000 --- a/cube/android/cube/custom_rules.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - -vkcube: Overriding native.libs.absolute.dir with ../libs - - diff --git a/cube/android/cube/res/values/strings.xml b/cube/android/cube/res/values/strings.xml deleted file mode 100644 index 8adead251..000000000 --- a/cube/android/cube/res/values/strings.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - VkCube - - diff --git a/cube/android/jni/Android.mk b/cube/android/jni/Android.mk deleted file mode 100644 index cc4b93cef..000000000 --- a/cube/android/jni/Android.mk +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# 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. - -LOCAL_PATH := $(abspath $(call my-dir)) -SRC_DIR := $(LOCAL_PATH)/../../.. -DEMO_DIR := $(SRC_DIR)/cube - -include $(CLEAR_VARS) -LOCAL_MODULE := VkCube -LOCAL_SRC_FILES += $(DEMO_DIR)/cube.c \ - $(SRC_DIR)/common/vulkan_wrapper.cpp \ - $(SRC_DIR)/common/android_util.cpp -LOCAL_C_INCLUDES += $(SRC_DIR)/build-android/third_party/Vulkan-Headers/include \ - $(DEMO_DIR)/android/include \ - $(SRC_DIR)/libs \ - $(SRC_DIR)/common \ - $(SRC_DIR)/build-android/generated/include -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR --include=$(SRC_DIR)/common/vulkan_wrapper.h -LOCAL_WHOLE_STATIC_LIBRARIES += android_native_app_glue -LOCAL_LDLIBS := -llog -landroid -LOCAL_LDFLAGS := -u ANativeActivity_onCreate -include $(BUILD_SHARED_LIBRARY) - -$(call import-module,android/native_app_glue) diff --git a/cube/android/jni/Application.mk b/cube/android/jni/Application.mk deleted file mode 100644 index a3d9754e3..000000000 --- a/cube/android/jni/Application.mk +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# 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. - -APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 -APP_PLATFORM := android-23 -APP_STL := c++_static -APP_MODULES := VkCube -APP_CPPFLAGS += -std=c++11 -fexceptions -Wall -Werror -Wextra -Wno-unused-parameter -DVK_NO_PROTOTYES -DGLM_FORCE_RADIANS -APP_CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -DVK_NO_PROTOTYES -DGLM_FORCE_RADIANS -NDK_TOOLCHAIN_VERSION := clang diff --git a/common/vulkan_wrapper.cpp b/cube/android/vulkan_wrapper.cpp similarity index 97% rename from common/vulkan_wrapper.cpp rename to cube/android/vulkan_wrapper.cpp index 85466decb..c663f9ee0 100644 --- a/common/vulkan_wrapper.cpp +++ b/cube/android/vulkan_wrapper.cpp @@ -488,6 +488,13 @@ int InitVulkan(void) { reinterpret_cast(dlsym(libvulkan, "vkGetDeviceImageMemoryRequirementsKHR")); vkGetDeviceImageSparseMemoryRequirementsKHR = reinterpret_cast( dlsym(libvulkan, "vkGetDeviceImageSparseMemoryRequirementsKHR")); + vkCmdBindIndexBuffer2KHR = reinterpret_cast(dlsym(libvulkan, "vkCmdBindIndexBuffer2KHR")); + vkGetRenderingAreaGranularityKHR = + reinterpret_cast(dlsym(libvulkan, "vkGetRenderingAreaGranularityKHR")); + vkGetDeviceImageSubresourceLayoutKHR = + reinterpret_cast(dlsym(libvulkan, "vkGetDeviceImageSubresourceLayoutKHR")); + vkGetImageSubresourceLayout2KHR = + reinterpret_cast(dlsym(libvulkan, "vkGetImageSubresourceLayout2KHR")); vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR = reinterpret_cast( dlsym(libvulkan, "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR")); vkCreateAccelerationStructureKHR = @@ -932,6 +939,10 @@ PFN_vkCmdTraceRaysIndirect2KHR vkCmdTraceRaysIndirect2KHR; PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequirementsKHR; PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirementsKHR; PFN_vkGetDeviceImageSparseMemoryRequirementsKHR vkGetDeviceImageSparseMemoryRequirementsKHR; +PFN_vkCmdBindIndexBuffer2KHR vkCmdBindIndexBuffer2KHR; +PFN_vkGetRenderingAreaGranularityKHR vkGetRenderingAreaGranularityKHR; +PFN_vkGetDeviceImageSubresourceLayoutKHR vkGetDeviceImageSubresourceLayoutKHR; +PFN_vkGetImageSubresourceLayout2KHR vkGetImageSubresourceLayout2KHR; PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR; PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT; PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT; @@ -1048,6 +1059,11 @@ PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; +PFN_vkCopyMemoryToImageEXT vkCopyMemoryToImageEXT; +PFN_vkCopyImageToMemoryEXT vkCopyImageToMemoryEXT; +PFN_vkCopyImageToImageEXT vkCopyImageToImageEXT; +PFN_vkTransitionImageLayoutEXT vkTransitionImageLayoutEXT; +PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; PFN_vkReleaseSwapchainImagesEXT vkReleaseSwapchainImagesEXT; PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; PFN_vkCmdPreprocessGeneratedCommandsNV vkCmdPreprocessGeneratedCommandsNV; @@ -1074,7 +1090,6 @@ PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT vkGetImageViewOpaqueCaptureDesc PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT vkGetSamplerOpaqueCaptureDescriptorDataEXT; PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT; PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; -PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT; PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI; @@ -1113,6 +1128,9 @@ PFN_vkCmdCopyMemoryIndirectNV vkCmdCopyMemoryIndirectNV; PFN_vkCmdCopyMemoryToImageIndirectNV vkCmdCopyMemoryToImageIndirectNV; PFN_vkCmdDecompressMemoryNV vkCmdDecompressMemoryNV; PFN_vkCmdDecompressMemoryIndirectCountNV vkCmdDecompressMemoryIndirectCountNV; +PFN_vkGetPipelineIndirectMemoryRequirementsNV vkGetPipelineIndirectMemoryRequirementsNV; +PFN_vkCmdUpdatePipelineIndirectBufferNV vkCmdUpdatePipelineIndirectBufferNV; +PFN_vkGetPipelineIndirectDeviceAddressNV vkGetPipelineIndirectDeviceAddressNV; PFN_vkCmdSetTessellationDomainOriginEXT vkCmdSetTessellationDomainOriginEXT; PFN_vkCmdSetDepthClampEnableEXT vkCmdSetDepthClampEnableEXT; PFN_vkCmdSetPolygonModeEXT vkCmdSetPolygonModeEXT; @@ -1157,6 +1175,11 @@ PFN_vkGetShaderBinaryDataEXT vkGetShaderBinaryDataEXT; PFN_vkCmdBindShadersEXT vkCmdBindShadersEXT; PFN_vkGetFramebufferTilePropertiesQCOM vkGetFramebufferTilePropertiesQCOM; PFN_vkGetDynamicRenderingTilePropertiesQCOM vkGetDynamicRenderingTilePropertiesQCOM; +PFN_vkSetLatencySleepModeNV vkSetLatencySleepModeNV; +PFN_vkLatencySleepNV vkLatencySleepNV; +PFN_vkSetLatencyMarkerNV vkSetLatencyMarkerNV; +PFN_vkGetLatencyTimingsNV vkGetLatencyTimingsNV; +PFN_vkQueueNotifyOutOfBandNV vkQueueNotifyOutOfBandNV; PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT vkCmdSetAttachmentFeedbackLoopEnableEXT; PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR; PFN_vkDestroyAccelerationStructureKHR vkDestroyAccelerationStructureKHR; @@ -1315,6 +1338,16 @@ PFN_vkGetEncodedVideoSessionParametersKHR vkGetEncodedVideoSessionParametersKHR; PFN_vkCmdEncodeVideoKHR vkCmdEncodeVideoKHR; #endif +#ifdef VK_ENABLE_BETA_EXTENSIONS +PFN_vkCreateExecutionGraphPipelinesAMDX vkCreateExecutionGraphPipelinesAMDX; +PFN_vkGetExecutionGraphPipelineScratchSizeAMDX vkGetExecutionGraphPipelineScratchSizeAMDX; +PFN_vkGetExecutionGraphPipelineNodeIndexAMDX vkGetExecutionGraphPipelineNodeIndexAMDX; +PFN_vkCmdInitializeGraphScratchMemoryAMDX vkCmdInitializeGraphScratchMemoryAMDX; +PFN_vkCmdDispatchGraphAMDX vkCmdDispatchGraphAMDX; +PFN_vkCmdDispatchGraphIndirectAMDX vkCmdDispatchGraphIndirectAMDX; +PFN_vkCmdDispatchGraphIndirectCountAMDX vkCmdDispatchGraphIndirectCountAMDX; +#endif + #ifdef __cplusplus } #endif diff --git a/common/vulkan_wrapper.h b/cube/android/vulkan_wrapper.h similarity index 98% rename from common/vulkan_wrapper.h rename to cube/android/vulkan_wrapper.h index 42000d786..678fdcfef 100644 --- a/common/vulkan_wrapper.h +++ b/cube/android/vulkan_wrapper.h @@ -458,6 +458,12 @@ extern PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequire extern PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirementsKHR; extern PFN_vkGetDeviceImageSparseMemoryRequirementsKHR vkGetDeviceImageSparseMemoryRequirementsKHR; +// VK_KHR_maintenance5 +extern PFN_vkCmdBindIndexBuffer2KHR vkCmdBindIndexBuffer2KHR; +extern PFN_vkGetRenderingAreaGranularityKHR vkGetRenderingAreaGranularityKHR; +extern PFN_vkGetDeviceImageSubresourceLayoutKHR vkGetDeviceImageSubresourceLayoutKHR; +extern PFN_vkGetImageSubresourceLayout2KHR vkGetImageSubresourceLayout2KHR; + // VK_KHR_cooperative_matrix extern PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR; diff --git a/cube/cube.c b/cube/cube.c index 75d573b4c..fc10edcd0 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -33,6 +33,7 @@ #include #include #include +#include #if defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_XCB_KHR) #include #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) @@ -359,7 +360,12 @@ struct demo { struct ANativeWindow *window; #elif defined(VK_USE_PLATFORM_METAL_EXT) void *caMetalLayer; +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_context_t screen_context; + screen_window_t screen_window; + screen_event_t screen_event; #endif + VkSurfaceKHR surface; bool prepared; bool use_staging_buffer; @@ -521,7 +527,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debug_messenger_callback(VkDebugUtilsMessageSever } sprintf(message, "%s - Message Id Number: %d | Message Id Name: %s\n\t%s\n", prefix, pCallbackData->messageIdNumber, - pCallbackData->pMessageIdName, pCallbackData->pMessage); + pCallbackData->pMessageIdName == NULL ? "" : pCallbackData->pMessageIdName, pCallbackData->pMessage); if (pCallbackData->objectCount > 0) { char tmp_message[500]; sprintf(tmp_message, "\n\tObjects - %d\n", pCallbackData->objectCount); @@ -2485,6 +2491,10 @@ static void demo_cleanup(struct demo *demo) { demo->event_buffer->Release(demo->event_buffer); demo->window->Release(demo->window); demo->dfb->Release(demo->dfb); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_destroy_event(demo->screen_event); + screen_destroy_window(demo->screen_window); + screen_destroy_context(demo->screen_context); #endif vkDestroyInstance(demo->inst, NULL); @@ -3157,6 +3167,170 @@ static void demo_run_display(struct demo *demo) { } } } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + +#include + +static void demo_run(struct demo *demo) { + int size[2] = { 0, 0 }; + screen_window_t win; + int val; + int rc; + + while (!demo->quit) { + while (!screen_get_event(demo->screen_context, demo->screen_event, demo->pause ? ~0 : 0)) { + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_TYPE, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_TYPE of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + if (val == SCREEN_EVENT_NONE) { + break; + } + switch (val) { + case SCREEN_EVENT_KEYBOARD: + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_FLAGS, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_FLAGS of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + if (val & KEY_DOWN) { + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_SYM, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SYM of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + switch (val) { + case KEYCODE_ESCAPE: + demo->quit = true; + break; + case KEYCODE_SPACE: + demo->pause = !demo->pause; + break; + case KEYCODE_LEFT: + demo->spin_angle -= demo->spin_increment; + break; + case KEYCODE_RIGHT: + demo->spin_angle += demo->spin_increment; + break; + default: + break; + } + } + break; + case SCREEN_EVENT_PROPERTY: + rc = screen_get_event_property_pv(demo->screen_event, SCREEN_PROPERTY_WINDOW, (void **)&win); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_WINDOW of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_NAME, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_NAME of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + if (win == demo->screen_window) { + switch(val) { + case SCREEN_PROPERTY_SIZE: + rc = screen_get_window_property_iv(win, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SIZE of the window in the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + demo->width = size[0]; + demo->height = size[1]; + demo_resize(demo); + break; + default: + /* We are not interested in any other events for now */ + break; + } + } + break; + } + } + + if (demo->pause) { + } else { + demo_draw(demo); + demo->curFrame++; + if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) { + demo->quit = true; + } + } + } +} + +static void demo_create_window(struct demo *demo) { + const char *idstr = APP_SHORT_NAME; + int size[2]; + int usage = SCREEN_USAGE_VULKAN; + int rc; + + rc = screen_create_context(&demo->screen_context, 0); + if (rc) { + printf("Cannot create QNX Screen context!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_window(&demo->screen_window, demo->screen_context); + if (rc) { + printf("Cannot create QNX Screen window!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_event(&demo->screen_event); + if (rc) { + printf("Cannot create QNX Screen event!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Set window caption */ + screen_set_window_property_cv(demo->screen_window, SCREEN_PROPERTY_ID_STRING, strlen(idstr), idstr); + + /* Setup VULKAN usage flags */ + rc = screen_set_window_property_iv(demo->screen_window, SCREEN_PROPERTY_USAGE, &usage); + if (rc) { + printf("Cannot set SCREEN_USAGE_VULKAN flag!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Setup window size */ + if ((demo->width == 0) || (demo->height == 0)) { + /* Obtain automatically set window size provided by WM */ + rc = screen_get_window_property_iv(demo->screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot obtain current window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + demo->width = size[0]; + demo->height = size[1]; + } else { + size[0] = demo->width; + size[1] = demo->height; + rc = screen_set_window_property_iv(demo->screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot set window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + } +} #endif /* @@ -3299,6 +3473,11 @@ static void demo_init_vk(struct demo *demo) { platformSurfaceExtFound = 1; demo->extension_names[demo->enabled_extension_count++] = VK_EXT_METAL_SURFACE_EXTENSION_NAME; } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + if (!strcmp(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) { + platformSurfaceExtFound = 1; + demo->extension_names[demo->enabled_extension_count++] = VK_QNX_SCREEN_SURFACE_EXTENSION_NAME; + } #endif if (!strcmp(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, instance_extensions[i].extensionName)) { demo->extension_names[demo->enabled_extension_count++] = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME; @@ -3376,6 +3555,12 @@ static void demo_init_vk(struct demo *demo) { "Do you have a compatible Vulkan installable client driver (ICD) installed?\n" "Please look at the Getting Started guide for additional information.\n", "vkCreateInstance Failure"); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the " VK_QNX_SCREEN_SURFACE_EXTENSION_NAME + " extension.\n\n" + "Do you have a compatible Vulkan installable client driver (ICD) installed?\n" + "Please look at the Getting Started guide for additional information.\n", + "vkCreateInstance Failure"); #endif } const VkApplicationInfo app = { @@ -3744,6 +3929,15 @@ static void demo_create_surface(struct demo *demo) { surface.pLayer = demo->caMetalLayer; err = vkCreateMetalSurfaceEXT(demo->inst, &surface, NULL, &demo->surface); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + VkScreenSurfaceCreateInfoQNX createInfo; + createInfo.sType = VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.context = demo->screen_context; + createInfo.window = demo->screen_window; + + err = vkCreateScreenSurfaceQNX(demo->inst, &createInfo, NULL, &demo->surface); #endif assert(!err); } @@ -3755,7 +3949,10 @@ static VkSurfaceFormatKHR pick_surface_format(const VkSurfaceFormatKHR *surfaceF if (format == VK_FORMAT_R8G8B8A8_UNORM || format == VK_FORMAT_B8G8R8A8_UNORM || format == VK_FORMAT_A2B10G10R10_UNORM_PACK32 || format == VK_FORMAT_A2R10G10B10_UNORM_PACK32 || + format == VK_FORMAT_A1R5G5B5_UNORM_PACK16 || format == VK_FORMAT_R5G6B5_UNORM_PACK16 || format == VK_FORMAT_R16G16B16A16_SFLOAT) { + + return surfaceFormats[i]; } } @@ -4386,6 +4583,8 @@ int main(int argc, char **argv) { demo_create_window(&demo); #elif defined(VK_USE_PLATFORM_DIRECTFB_EXT) demo_create_directfb_window(&demo); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo_create_window(&demo); #endif demo_init_vk_swapchain(&demo); @@ -4402,6 +4601,8 @@ int main(int argc, char **argv) { demo_run_directfb(&demo); #elif defined(VK_USE_PLATFORM_DISPLAY_KHR) demo_run_display(&demo); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo_run(&demo); #endif demo_cleanup(&demo); diff --git a/cube/cube.cpp b/cube/cube.cpp index 1e7d48cf6..667482560 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -286,6 +286,9 @@ struct Demo { #elif defined(VK_USE_PLATFORM_DISPLAY_KHR) vk::Result create_display_surface(); void run_display(); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + void run(); + void create_window(); #endif std::string name = "vkcubepp"; // Name to put on the window/icon @@ -322,6 +325,10 @@ struct Demo { IDirectFBEventBuffer *event_buffer = nullptr; #elif defined(VK_USE_PLATFORM_METAL_EXT) void *caMetalLayer; +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_context_t screen_context = nullptr; + screen_window_t screen_window = nullptr; + screen_event_t screen_event = nullptr; #endif vk::SurfaceKHR surface; @@ -620,6 +627,10 @@ void Demo::cleanup() { event_buffer->Release(event_buffer); window->Release(window); dfb->Release(dfb); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_destroy_event(screen_event); + screen_destroy_window(screen_window); + screen_destroy_context(screen_context); #endif if (use_debug_messenger) { inst.destroyDebugUtilsMessengerEXT(debug_messenger); @@ -653,7 +664,8 @@ void Demo::destroy_texture(texture_object &tex_objs) { void Demo::draw() { // Ensure no more than FRAME_LAG renderings are outstanding - device.waitForFences(fences[frame_index], VK_TRUE, UINT64_MAX); + const vk::Result wait_result = device.waitForFences(fences[frame_index], VK_TRUE, UINT64_MAX); + VERIFY(wait_result == vk::Result::eSuccess || wait_result == vk::Result::eTimeout); device.resetFences({fences[frame_index]}); vk::Result acquire_result; @@ -1051,7 +1063,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL Demo::debug_messenger_callback(VkDebugUtilsMessag } message << " - Message Id Number: " << std::to_string(pCallbackData->messageIdNumber); - message << " | Message Id Name: " << pCallbackData->pMessageIdName << "\n\t" << pCallbackData->pMessage << "\n"; + message << " | Message Id Name: " << (pCallbackData->pMessageIdName == nullptr ? "" : pCallbackData->pMessageIdName) << "\n\t" + << pCallbackData->pMessage << "\n"; if (pCallbackData->objectCount > 0) { message << "\n\tObjects - " << pCallbackData->objectCount << "\n"; @@ -1194,6 +1207,11 @@ void Demo::init_vk() { platformSurfaceExtFound = 1; enabled_instance_extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME); } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + else if (!strcmp(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME, extension.extensionName)) { + platformSurfaceExtFound = 1; + enabled_instance_extensions.push_back(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME); + } #endif } @@ -1249,6 +1267,13 @@ void Demo::init_vk() { "look at the Getting Started guide for additional " "information.\n", "vkCreateInstance Failure"); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the " VK_QNX_SCREEN_SURFACE_EXTENSION_NAME + " extension.\n\nDo you have a compatible " + "Vulkan installable client driver (ICD) installed?\nPlease " + "look at the Getting Started guide for additional " + "information.\n", + "vkCreateInstance Failure"); #endif } @@ -1454,6 +1479,13 @@ void Demo::create_surface() { auto result = create_display_surface(); VERIFY(result == vk::Result::eSuccess); } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + { + auto const createInfo = vk::ScreenSurfaceCreateInfoQNX().setContext(screen_context).setWindow(screen_window); + + auto result = inst.createScreenSurfaceQNX(&createInfo, nullptr, &surface); + VERIFY(result == vk::Result::eSuccess); + } #endif } @@ -2040,7 +2072,7 @@ void Demo::prepare_pipeline() { .setPDynamicState(&dynamicStateInfo) .setLayout(pipeline_layout) .setRenderPass(render_pass)); - VERIFY(result == vk::Result::eSuccess); + VERIFY(pipline_return.result == vk::Result::eSuccess); pipeline = pipline_return.value.at(0); device.destroyShaderModule(frag_shader_module); @@ -2492,6 +2524,7 @@ vk::SurfaceFormatKHR Demo::pick_surface_format(const std::vector + +void Demo::run() +{ + int size[2] = { 0, 0 }; + screen_window_t win; + int val; + int rc; + + while (!quit) { + while (!screen_get_event(screen_context, screen_event, pause ? ~0 : 0)) { + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_TYPE of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + if (val == SCREEN_EVENT_NONE) { + break; + } + switch (val) { + case SCREEN_EVENT_KEYBOARD: + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_FLAGS, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_FLAGS of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + if (val & KEY_DOWN) { + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_SYM, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SYM of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + switch (val) { + case KEYCODE_ESCAPE: + quit = true; + break; + case KEYCODE_SPACE: + pause = !pause; + break; + case KEYCODE_LEFT: + spin_angle -= spin_increment; + break; + case KEYCODE_RIGHT: + spin_angle += spin_increment; + break; + default: + break; + } + } + break; + case SCREEN_EVENT_PROPERTY: + rc = screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void **)&win); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_WINDOW of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_NAME, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_NAME of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + if (win == screen_window) { + switch(val) { + case SCREEN_PROPERTY_SIZE: + rc = screen_get_window_property_iv(win, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SIZE of the window in the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + width = size[0]; + height = size[1]; + resize(); + break; + default: + /* We are not interested in any other events for now */ + break; + } + } + break; + } + } + + if (pause) { + } else { + update_data_buffer(); + draw(); + curFrame++; + if (frameCount != UINT32_MAX && curFrame == frameCount) { + quit = true; + } + } + } +} + +void Demo::create_window() +{ + const char *idstr = APP_SHORT_NAME; + int size[2]; + int usage = SCREEN_USAGE_VULKAN; + int rc; + + rc = screen_create_context(&screen_context, 0); + if (rc) { + printf("Cannot create QNX Screen context!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_window(&screen_window, screen_context); + if (rc) { + printf("Cannot create QNX Screen window!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_event(&screen_event); + if (rc) { + printf("Cannot create QNX Screen event!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Set window caption */ + screen_set_window_property_cv(screen_window, SCREEN_PROPERTY_ID_STRING, strlen(idstr), idstr); + + /* Setup VULKAN usage flags */ + rc = screen_set_window_property_iv(screen_window, SCREEN_PROPERTY_USAGE, &usage); + if (rc) { + printf("Cannot set SCREEN_USAGE_VULKAN flag!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Setup window size */ + if ((width == 0) || (height == 0)) { + rc = screen_get_window_property_iv(screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot obtain current window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + width = size[0]; + height = size[1]; + } else { + size[0] = width; + size[1] = height; + rc = screen_set_window_property_iv(screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot set window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + } +} #endif #if _WIN32 @@ -3186,7 +3385,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, return static_cast(msg.wParam); } -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) int main(int argc, char **argv) { Demo demo; @@ -3201,6 +3400,8 @@ int main(int argc, char **argv) { demo.create_window(); #elif defined(VK_USE_PLATFORM_DIRECTFB_EXT) demo.create_directfb_window(); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo.create_window(); #endif demo.init_vk_swapchain(); @@ -3217,6 +3418,8 @@ int main(int argc, char **argv) { demo.run_directfb(); #elif defined(VK_USE_PLATFORM_DISPLAY_KHR) demo.run_display(); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo.run(); #endif demo.cleanup(); diff --git a/cube/cube.frag.inc b/cube/cube.frag.inc new file mode 100644 index 000000000..98ff52139 --- /dev/null +++ b/cube/cube.frag.inc @@ -0,0 +1,41 @@ + // 7.9.2888 + 0x07230203,0x00010000,0x00080007,0x00000030,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x00000022,0x0000002a, + 0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x00000190,0x00090004,0x415f4c47, + 0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004, + 0x415f4c47,0x735f4252,0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361, + 0x00040005,0x00000004,0x6e69616d,0x00000000,0x00030005,0x00000009,0x00005864,0x00050005, + 0x0000000b,0x67617266,0x736f705f,0x00000000,0x00030005,0x0000000e,0x00005964,0x00040005, + 0x00000011,0x6d726f6e,0x00006c61,0x00040005,0x00000017,0x6867696c,0x00000074,0x00050005, + 0x00000022,0x61724675,0x6c6f4367,0x0000726f,0x00030005,0x00000027,0x00786574,0x00050005, + 0x0000002a,0x63786574,0x64726f6f,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000001, + 0x00040047,0x00000022,0x0000001e,0x00000000,0x00040047,0x00000027,0x00000022,0x00000000, + 0x00040047,0x00000027,0x00000021,0x00000001,0x00040047,0x0000002a,0x0000001e,0x00000000, + 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, + 0x00040017,0x00000007,0x00000006,0x00000003,0x00040020,0x00000008,0x00000007,0x00000007, + 0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001, + 0x00040020,0x00000016,0x00000007,0x00000006,0x0004002b,0x00000006,0x00000018,0x00000000, + 0x0004002b,0x00000006,0x00000019,0x3ed91687,0x0004002b,0x00000006,0x0000001a,0x3f10e560, + 0x0004002b,0x00000006,0x0000001b,0x3f34fdf4,0x0006002c,0x00000007,0x0000001c,0x00000019, + 0x0000001a,0x0000001b,0x00040017,0x00000020,0x00000006,0x00000004,0x00040020,0x00000021, + 0x00000003,0x00000020,0x0004003b,0x00000021,0x00000022,0x00000003,0x00090019,0x00000024, + 0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b, + 0x00000025,0x00000024,0x00040020,0x00000026,0x00000000,0x00000025,0x0004003b,0x00000026, + 0x00000027,0x00000000,0x00040020,0x00000029,0x00000001,0x00000020,0x0004003b,0x00000029, + 0x0000002a,0x00000001,0x00040017,0x0000002b,0x00000006,0x00000002,0x00050036,0x00000002, + 0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009, + 0x00000007,0x0004003b,0x00000008,0x0000000e,0x00000007,0x0004003b,0x00000008,0x00000011, + 0x00000007,0x0004003b,0x00000016,0x00000017,0x00000007,0x0004003d,0x00000007,0x0000000c, + 0x0000000b,0x000400cf,0x00000007,0x0000000d,0x0000000c,0x0003003e,0x00000009,0x0000000d, + 0x0004003d,0x00000007,0x0000000f,0x0000000b,0x000400d0,0x00000007,0x00000010,0x0000000f, + 0x0003003e,0x0000000e,0x00000010,0x0004003d,0x00000007,0x00000012,0x00000009,0x0004003d, + 0x00000007,0x00000013,0x0000000e,0x0007000c,0x00000007,0x00000014,0x00000001,0x00000044, + 0x00000012,0x00000013,0x0006000c,0x00000007,0x00000015,0x00000001,0x00000045,0x00000014, + 0x0003003e,0x00000011,0x00000015,0x0004003d,0x00000007,0x0000001d,0x00000011,0x00050094, + 0x00000006,0x0000001e,0x0000001c,0x0000001d,0x0007000c,0x00000006,0x0000001f,0x00000001, + 0x00000028,0x00000018,0x0000001e,0x0003003e,0x00000017,0x0000001f,0x0004003d,0x00000006, + 0x00000023,0x00000017,0x0004003d,0x00000025,0x00000028,0x00000027,0x0004003d,0x00000020, + 0x0000002c,0x0000002a,0x0007004f,0x0000002b,0x0000002d,0x0000002c,0x0000002c,0x00000000, + 0x00000001,0x00050057,0x00000020,0x0000002e,0x00000028,0x0000002d,0x0005008e,0x00000020, + 0x0000002f,0x0000002e,0x00000023,0x0003003e,0x00000022,0x0000002f,0x000100fd,0x00010038 diff --git a/cube/cube.vert.inc b/cube/cube.vert.inc new file mode 100644 index 000000000..5d029c645 --- /dev/null +++ b/cube/cube.vert.inc @@ -0,0 +1,50 @@ + // 7.9.2888 + 0x07230203,0x00010000,0x00080007,0x0000002f,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000009,0x00000015,0x0000001e, + 0x0000002b,0x00030003,0x00000002,0x00000190,0x00090004,0x415f4c47,0x735f4252,0x72617065, + 0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004,0x415f4c47,0x735f4252, + 0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361,0x00040005,0x00000004, + 0x6e69616d,0x00000000,0x00050005,0x00000009,0x63786574,0x64726f6f,0x00000000,0x00030005, + 0x0000000f,0x00667562,0x00040006,0x0000000f,0x00000000,0x0050564d,0x00060006,0x0000000f, + 0x00000001,0x69736f70,0x6e6f6974,0x00000000,0x00050006,0x0000000f,0x00000002,0x72747461, + 0x00000000,0x00040005,0x00000011,0x66756275,0x00000000,0x00060005,0x00000015,0x565f6c67, + 0x65747265,0x646e4978,0x00007865,0x00060005,0x0000001c,0x505f6c67,0x65567265,0x78657472, + 0x00000000,0x00060006,0x0000001c,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00070006, + 0x0000001c,0x00000001,0x505f6c67,0x746e696f,0x657a6953,0x00000000,0x00070006,0x0000001c, + 0x00000002,0x435f6c67,0x4470696c,0x61747369,0x0065636e,0x00030005,0x0000001e,0x00000000, + 0x00050005,0x0000002b,0x67617266,0x736f705f,0x00000000,0x00040047,0x00000009,0x0000001e, + 0x00000000,0x00040047,0x0000000d,0x00000006,0x00000010,0x00040047,0x0000000e,0x00000006, + 0x00000010,0x00040048,0x0000000f,0x00000000,0x00000005,0x00050048,0x0000000f,0x00000000, + 0x00000023,0x00000000,0x00050048,0x0000000f,0x00000000,0x00000007,0x00000010,0x00050048, + 0x0000000f,0x00000001,0x00000023,0x00000040,0x00050048,0x0000000f,0x00000002,0x00000023, + 0x00000280,0x00030047,0x0000000f,0x00000002,0x00040047,0x00000011,0x00000022,0x00000000, + 0x00040047,0x00000011,0x00000021,0x00000000,0x00040047,0x00000015,0x0000000b,0x0000002a, + 0x00050048,0x0000001c,0x00000000,0x0000000b,0x00000000,0x00050048,0x0000001c,0x00000001, + 0x0000000b,0x00000001,0x00050048,0x0000001c,0x00000002,0x0000000b,0x00000003,0x00030047, + 0x0000001c,0x00000002,0x00040047,0x0000002b,0x0000001e,0x00000001,0x00020013,0x00000002, + 0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007, + 0x00000006,0x00000004,0x00040020,0x00000008,0x00000003,0x00000007,0x0004003b,0x00000008, + 0x00000009,0x00000003,0x00040018,0x0000000a,0x00000007,0x00000004,0x00040015,0x0000000b, + 0x00000020,0x00000000,0x0004002b,0x0000000b,0x0000000c,0x00000024,0x0004001c,0x0000000d, + 0x00000007,0x0000000c,0x0004001c,0x0000000e,0x00000007,0x0000000c,0x0005001e,0x0000000f, + 0x0000000a,0x0000000d,0x0000000e,0x00040020,0x00000010,0x00000002,0x0000000f,0x0004003b, + 0x00000010,0x00000011,0x00000002,0x00040015,0x00000012,0x00000020,0x00000001,0x0004002b, + 0x00000012,0x00000013,0x00000002,0x00040020,0x00000014,0x00000001,0x00000012,0x0004003b, + 0x00000014,0x00000015,0x00000001,0x00040020,0x00000017,0x00000002,0x00000007,0x0004002b, + 0x0000000b,0x0000001a,0x00000001,0x0004001c,0x0000001b,0x00000006,0x0000001a,0x0005001e, + 0x0000001c,0x00000007,0x00000006,0x0000001b,0x00040020,0x0000001d,0x00000003,0x0000001c, + 0x0004003b,0x0000001d,0x0000001e,0x00000003,0x0004002b,0x00000012,0x0000001f,0x00000000, + 0x00040020,0x00000020,0x00000002,0x0000000a,0x0004002b,0x00000012,0x00000023,0x00000001, + 0x00040017,0x00000029,0x00000006,0x00000003,0x00040020,0x0000002a,0x00000003,0x00000029, + 0x0004003b,0x0000002a,0x0000002b,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000, + 0x00000003,0x000200f8,0x00000005,0x0004003d,0x00000012,0x00000016,0x00000015,0x00060041, + 0x00000017,0x00000018,0x00000011,0x00000013,0x00000016,0x0004003d,0x00000007,0x00000019, + 0x00000018,0x0003003e,0x00000009,0x00000019,0x00050041,0x00000020,0x00000021,0x00000011, + 0x0000001f,0x0004003d,0x0000000a,0x00000022,0x00000021,0x0004003d,0x00000012,0x00000024, + 0x00000015,0x00060041,0x00000017,0x00000025,0x00000011,0x00000023,0x00000024,0x0004003d, + 0x00000007,0x00000026,0x00000025,0x00050091,0x00000007,0x00000027,0x00000022,0x00000026, + 0x00050041,0x00000008,0x00000028,0x0000001e,0x0000001f,0x0003003e,0x00000028,0x00000027, + 0x00050041,0x00000008,0x0000002c,0x0000001e,0x0000001f,0x0004003d,0x00000007,0x0000002d, + 0x0000002c,0x0008004f,0x00000029,0x0000002e,0x0000002d,0x0000002d,0x00000000,0x00000001, + 0x00000002,0x0003003e,0x0000002b,0x0000002e,0x000100fd,0x00010038 diff --git a/cube/macOS/cube/cube.cmake b/cube/macOS/cube/cube.cmake index 9b823f95a..a3c5624e5 100644 --- a/cube/macOS/cube/cube.cmake +++ b/cube/macOS/cube/cube.cmake @@ -28,14 +28,14 @@ set(cube_RESOURCES ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/VulkanIcon.icns) # Have Xcode handle the Storyboard -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) set(cube_RESOURCES ${cube_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard) endif() add_executable(vkcube MACOSX_BUNDLE ${cube_SRCS} ${cube_HDRS} ${cube_RESOURCES} cube.vert.inc cube.frag.inc) # Handle the Storyboard ourselves -if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(NOT XCODE) # Compile the storyboard file with the ibtool. add_custom_command(TARGET vkcube POST_BUILD COMMAND ${IBTOOL} @@ -55,7 +55,10 @@ add_dependencies(vkcube MoltenVK_icd-staging-json) target_include_directories(vkcube PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MOLTENVK_DIR}/MoltenVK/include) # We do this so vulkaninfo is linked to an individual library and NOT a framework. -target_link_libraries(vkcube ${Vulkan_LIBRARY} "-framework Cocoa -framework QuartzCore") +target_link_libraries(vkcube Vulkan::Loader "-framework Cocoa -framework QuartzCore") + +# Disable warnings about sprintf +target_compile_options(vkcube PRIVATE -Wno-deprecated-declarations) set_target_properties(vkcube PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Info.plist) @@ -70,7 +73,7 @@ set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json" "Resources/vulkan/icd.d") # Copy the MoltenVK lib into the bundle. -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) add_custom_command(TARGET vkcube POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" ${CMAKE_CURRENT_BINARY_DIR}/$/vkcube.app/Contents/Frameworks/libMoltenVK.dylib diff --git a/cube/macOS/cubepp/cubepp.cmake b/cube/macOS/cubepp/cubepp.cmake index eae4de3c4..e6a3e4858 100644 --- a/cube/macOS/cubepp/cubepp.cmake +++ b/cube/macOS/cubepp/cubepp.cmake @@ -30,14 +30,14 @@ set(cubepp_RESOURCES ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/VulkanIcon.icns) # Have Xcode handle the Storyboard -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) set(cubepp_RESOURCES ${cubepp_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard) endif() add_executable(vkcubepp MACOSX_BUNDLE ${cubepp_SRCS} ${cubepp_HDRS} ${cubepp_RESOURCES} cube.vert.inc cube.frag.inc) # Handle the Storyboard ourselves -if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(NOT XCODE) # Compile the storyboard file with the ibtool. add_custom_command(TARGET vkcubepp POST_BUILD COMMAND ${IBTOOL} @@ -57,7 +57,7 @@ add_dependencies(vkcubepp MoltenVK_icd-staging-json) target_include_directories(vkcubepp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MOLTENVK_DIR}/MoltenVK/include) # We do this so vulkaninfo is linked to an individual library and NOT a framework. -target_link_libraries(vkcubepp ${Vulkan_LIBRARY} "-framework Cocoa -framework QuartzCore") +target_link_libraries(vkcubepp Vulkan::Loader "-framework Cocoa -framework QuartzCore") set_target_properties(vkcubepp PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Info.plist) @@ -72,7 +72,7 @@ set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json" "Resources/vulkan/icd.d") # Copy the MoltenVK lib into the bundle. -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) add_custom_command(TARGET vkcubepp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" ${CMAKE_CURRENT_BINARY_DIR}/$/vkcubepp.app/Contents/Frameworks/libMoltenVK.dylib diff --git a/devsim/CMakeLists.txt b/devsim/CMakeLists.txt index dd3c2c5a2..935a29b71 100644 --- a/devsim/CMakeLists.txt +++ b/devsim/CMakeLists.txt @@ -64,7 +64,7 @@ find_package(VulkanHeaders REQUIRED CONFIG QUIET) find_package(valijson REQUIRED CONFIG) find_package(jsoncpp REQUIRED CONFIG) -target_include_directories(Vulkan::Headers INTERFACE ${VULKAN_VALIDATIONLAYERS_INSTALL_DIR}/include/vulkan) +target_include_directories(Vulkan::Headers INTERFACE ${VULKAN_UTILITY_LIBRARIES_INSTALL_DIR}/include/vulkan) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN -DNOMINMAX) @@ -101,6 +101,7 @@ else() message(FATAL_ERROR "Unsupported Platform!") endif() +option(BUILD_WSI_SCI_SUPPORT "Build with SCI platform headers" OFF) if (BUILD_WSI_SCI_SUPPORT) target_compile_definitions(Vulkan::Headers INTERFACE VK_USE_PLATFORM_SCI) endif() @@ -115,6 +116,8 @@ else() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith") endif() +add_definitions(-DVK_ENABLE_BETA_EXTENSIONS) + source_group("JSON Manifest" FILES ${LAYER_NAME}.json.in) source_group("Export Files" FILES ${LAYER_NAME}.def ${LAYER_NAME}.map) @@ -147,13 +150,16 @@ target_sources(DevSimLayer PRIVATE profiles_generated.cpp profiles.h vk_layer_table.cpp + vk_layer_table.h ${LAYER_NAME}.json.in ${LAYER_NAME}.def ${LAYER_NAME}.map ) target_link_libraries(DevSimLayer PRIVATE + Vulkan::LayerSettings Vulkan::Headers + Vulkan::UtilityHeaders jsoncpp_static valijson ) diff --git a/devsim/profiles_generated.cpp b/devsim/profiles_generated.cpp index 23fbea992..5e24bee9b 100644 --- a/devsim/profiles_generated.cpp +++ b/devsim/profiles_generated.cpp @@ -47,6 +47,7 @@ #include "profiles_util.h" #include "profiles_json.h" #include "profiles_settings.h" +#include SimulateCapabilityFlags GetSimulateCapabilityFlags(const std::vector &values) { SimulateCapabilityFlags result = 0; @@ -1213,6 +1214,27 @@ static uint32_t VkStringToUint(const std::string &input_value) { {"VK_QUEUE_COMPUTE_BIT", static_cast(VK_QUEUE_COMPUTE_BIT)}, {"VK_QUEUE_TRANSFER_BIT", static_cast(VK_QUEUE_TRANSFER_BIT)}, {"VK_QUEUE_PROTECTED_BIT", static_cast(VK_QUEUE_PROTECTED_BIT)}, + // VkImageUsageFlagBits + {"VK_IMAGE_USAGE_TRANSFER_SRC_BIT", static_cast(VK_IMAGE_USAGE_TRANSFER_SRC_BIT)}, + {"VK_IMAGE_USAGE_TRANSFER_DST_BIT", static_cast(VK_IMAGE_USAGE_TRANSFER_DST_BIT)}, + {"VK_IMAGE_USAGE_SAMPLED_BIT", static_cast(VK_IMAGE_USAGE_SAMPLED_BIT)}, + {"VK_IMAGE_USAGE_STORAGE_BIT", static_cast(VK_IMAGE_USAGE_STORAGE_BIT)}, + {"VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT", static_cast(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)}, + {"VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT", static_cast(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)}, + {"VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT", static_cast(VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT)}, + {"VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT", static_cast(VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)}, + {"VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR", static_cast(VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR)}, + // VkBufferUsageFlagBits + {"VK_BUFFER_USAGE_TRANSFER_SRC_BIT", static_cast(VK_BUFFER_USAGE_TRANSFER_SRC_BIT)}, + {"VK_BUFFER_USAGE_TRANSFER_DST_BIT", static_cast(VK_BUFFER_USAGE_TRANSFER_DST_BIT)}, + {"VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT", static_cast(VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT)}, + {"VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT", static_cast(VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)}, + {"VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT", static_cast(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT)}, + {"VK_BUFFER_USAGE_STORAGE_BUFFER_BIT", static_cast(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)}, + {"VK_BUFFER_USAGE_INDEX_BUFFER_BIT", static_cast(VK_BUFFER_USAGE_INDEX_BUFFER_BIT)}, + {"VK_BUFFER_USAGE_VERTEX_BUFFER_BIT", static_cast(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)}, + {"VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT", static_cast(VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT)}, + {"VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT", static_cast(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)}, }; const auto it = map.find(input_value); if (it != map.end()) { @@ -1499,10 +1521,6 @@ const VkLayerProperties kLayerProperties[] = {{ }}; const uint32_t kLayerPropertiesCount = (sizeof(kLayerProperties) / sizeof(kLayerProperties[0])); -// Instance extensions that this layer provides: -const std::array kInstanceExtensionProperties = {}; -const uint32_t kInstanceExtensionPropertiesCount = static_cast(kInstanceExtensionProperties.size()); - // Device extensions that this layer provides: #ifdef VULKANSC const std::array kDeviceExtensionProperties = {}; @@ -3582,7 +3600,7 @@ bool JsonLoader::GetQueueFamilyProperties(const char* device_name, const Json::V dest->global_priority_properties_.priorities[i++] = StringToVkQueueGlobalPriorityKHR(feature.asString()); } dest->global_priority_properties_.priorityCount = props["priorityCount"].asUInt(); - } else if (name == "VkVideoQueueFamilyPropertiesKHR") { + } else if (name == "VkQueueFamilyVideoPropertiesKHR") { for (const auto &feature : props["videoCodecOperations"]) { dest->video_properties_.videoCodecOperations |= StringToVkVideoCodecOperationFlagsKHR(feature.asString()); } @@ -3653,7 +3671,7 @@ bool JsonLoader::GetQueueFamilyProperties(const char* device_name, const Json::V dest->global_priority_properties_.priorityCount, priorities.c_str()); } if (dest->video_properties_.videoCodecOperations > 0) { - message += format(", VkVideoQueueFamilyPropertiesKHR [videoCodecOperations: %s]", + message += format(", VkQueueFamilyVideoPropertiesKHR [videoCodecOperations: %s]", string_VkVideoCodecOperationFlagsKHR(dest->video_properties_.videoCodecOperations).c_str()); } if (dest->checkpoint_properties_.checkpointExecutionStageMask > 0) { @@ -6904,7 +6922,7 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) { if (pLayerName && !strcmp(pLayerName, kLayerName)) { - return EnumerateProperties(kInstanceExtensionPropertiesCount, kInstanceExtensionProperties.data(), pCount, pProperties); + return EnumerateProperties(0, (VkExtensionProperties*)nullptr, pCount, pProperties); } return VK_ERROR_LAYER_NOT_PRESENT; } @@ -7148,7 +7166,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevi (*pToolCount)--; } - VkLayerInstanceDispatchTable *pInstanceTable = instance_dispatch_table(physicalDevice); + VkuInstanceDispatchTable *pInstanceTable = instance_dispatch_table(physicalDevice); VkResult result = pInstanceTable->GetPhysicalDeviceToolPropertiesEXT(physicalDevice, pToolCount, pToolProperties); if (original_pToolProperties != nullptr) { @@ -7489,7 +7507,7 @@ void LoadQueueFamilyProperties(VkInstance instance, VkPhysicalDevice pd, Physica dt->GetPhysicalDeviceQueueFamilyProperties2(pd, &count, props.data()); } else { dt->GetPhysicalDeviceQueueFamilyProperties2KHR(pd, &count, props.data()); - } + } for (uint32_t i = 0; i < count; ++i) { pdd->device_queue_family_properties_[i].properties_2 = props[i]; } diff --git a/devsim/profiles_json.cpp b/devsim/profiles_json.cpp index 9d6593d29..55ee5a3df 100644 --- a/devsim/profiles_json.cpp +++ b/devsim/profiles_json.cpp @@ -21,18 +21,10 @@ #include "profiles_util.h" #include -#include #include -#include #include -using valijson::Schema; -using valijson::SchemaParser; -using valijson::ValidationResults; -using valijson::Validator; -using valijson::adapters::JsonCppAdapter; - -std::unique_ptr schema; +std::unique_ptr schema; static Json::Value ParseJsonFile(std::string filename) { Json::Value root = Json::nullValue; @@ -74,11 +66,11 @@ bool JsonValidator::Init() { if (schema_document == Json::nullValue) { return false; } + + schema.reset(new valijson::Schema); - schema.reset(new Schema); - - SchemaParser parser; - JsonCppAdapter schema_adapter(schema_document); + valijson::SchemaParser parser; + valijson::adapters::JsonCppAdapter schema_adapter(schema_document); parser.populateSchema(schema_adapter, *schema); } @@ -90,12 +82,13 @@ bool JsonValidator::Check(const Json::Value &json_document) { if (schema.get() == nullptr) return true; - Validator validator(Validator::kWeakTypes); - JsonCppAdapter document_adapter(json_document); + valijson::Validator validator(valijson::Validator::kWeakTypes); + valijson::adapters::JsonCppAdapter document_adapter(json_document); + + valijson::ValidationResults results; - ValidationResults results; if (!validator.validate(*schema, document_adapter, &results)) { - ValidationResults::Error error; + valijson::ValidationResults::Error error; unsigned int error_num = 1; while (results.popError(error)) { std::string context; @@ -119,13 +112,12 @@ bool JsonValidator::Check(const Json::Value &json_document) { return false; } - return true; } bool WarnDuplicated(ProfileLayerSettings *layer_settings, const Json::Value &parent, const std::vector &members) { assert(layer_settings != nullptr); - + std::vector set; for (const auto &member : members) { if (parent.isMember(member)) { @@ -137,6 +129,5 @@ bool WarnDuplicated(ProfileLayerSettings *layer_settings, const Json::Value &par LogMessage(layer_settings, DEBUG_REPORT_WARNING_BIT, "Profile sets variables for %s while also using %s\n", set[0].c_str(), set[i].c_str()); } - return set.size() <= 1; } diff --git a/devsim/profiles_settings.cpp b/devsim/profiles_settings.cpp index c268984a8..b70ea1aa6 100644 --- a/devsim/profiles_settings.cpp +++ b/devsim/profiles_settings.cpp @@ -21,8 +21,8 @@ #include "profiles_util.h" void WarnMissingFormatFeatures(ProfileLayerSettings *layer_settings, const char *device_name, const std::string &format_name, - const std::string &features, - VkFormatFeatureFlags profile_features, VkFormatFeatureFlags device_features) { + const std::string &features, VkFormatFeatureFlags profile_features, + VkFormatFeatureFlags device_features) { if (!(layer_settings->log.debug_reports & DEBUG_REPORT_WARNING_BIT)) { return; } @@ -35,8 +35,8 @@ void WarnMissingFormatFeatures(ProfileLayerSettings *layer_settings, const char } void WarnMissingFormatFeatures2(ProfileLayerSettings *layer_settings, const char *device_name, const std::string &format_name, - const std::string &features, - VkFormatFeatureFlags2 profile_features, VkFormatFeatureFlags2 device_features) { + const std::string &features, VkFormatFeatureFlags2 profile_features, + VkFormatFeatureFlags2 device_features) { if (!(layer_settings->log.debug_reports & DEBUG_REPORT_WARNING_BIT)) { return; } @@ -64,6 +64,9 @@ std::string GetDebugActionsLog(DebugActionFlags flags) { } #if defined(__ANDROID__) + +#include + void AndroidPrintf(DebugReportBits level, const std::string &message) { switch (level) { default: diff --git a/devsim/profiles_settings.h b/devsim/profiles_settings.h index c6603069d..04462967a 100644 --- a/devsim/profiles_settings.h +++ b/devsim/profiles_settings.h @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include #include @@ -35,22 +35,6 @@ enum SimulateCapabilityBits { }; typedef int SimulateCapabilityFlags; -static std::vector GetSimulateCapabilityStrings(SimulateCapabilityFlags flags) { - static const char *table[] = { - "SIMULATE_API_VERSION_BIT", "SIMULATE_FEATURES_BIT", "SIMULATE_PROPERTIES_BIT", - "SIMULATE_EXTENSIONS_BIT", "SIMULATE_FORMATS_BIT", "SIMULATE_QUEUE_FAMILY_PROPERTIES_BIT"}; - - std::vector result; - - for (std::size_t i = 0, n = std::size(table); i < n; ++i) { - if (flags & (1 << i)) { - result.push_back(table[i]); - } - } - - return result; -} - enum DebugActionBits { DEBUG_ACTION_FILE_BIT = (1 << 0), DEBUG_ACTION_STDOUT_BIT = (1 << 1), @@ -125,21 +109,6 @@ static DebugReportFlags GetDebugReportFlags(const std::vector &valu return result; } -static std::vector GetDebugReportStrings(DebugReportFlags flags) { - static const char *table[] = { - "DEBUG_REPORT_NOTIFICATION_BIT", "DEBUG_REPORT_WARNING_BIT", "DEBUG_REPORT_ERROR_BIT", "DEBUG_REPORT_DEBUG_BIT"}; - - std::vector result; - - for (std::size_t i = 0, n = std::size(table); i < n; ++i) { - if (flags & (1 << i)) { - result.push_back(table[i]); - } - } - - return result; -} - enum DefaultFeatureValues { DEFAULT_FEATURE_VALUES_FALSE = 0, DEFAULT_FEATURE_VALUES_DEVICE @@ -171,18 +140,6 @@ enum ForceDevice { FORCE_DEVICE_WITH_NAME }; -static ForceDevice GetForceDevice(const std::string &value) { - if (value == "FORCE_DEVICE_OFF") { - return FORCE_DEVICE_OFF; - } else if (value == "FORCE_DEVICE_WITH_UUID") { - return FORCE_DEVICE_WITH_UUID; - } else if (value == "FORCE_DEVICE_WITH_NAME") { - return FORCE_DEVICE_WITH_NAME; - } - - return FORCE_DEVICE_OFF; -} - struct ProfileLayerSettings { ~ProfileLayerSettings() { if (log.profiles_log_file != nullptr) { diff --git a/devsim/profiles_util.h b/devsim/profiles_util.h index d41583b39..8245b1ed5 100644 --- a/devsim/profiles_util.h +++ b/devsim/profiles_util.h @@ -39,15 +39,11 @@ #include "vulkan/vulkan_beta.h" #include "vulkan/vulkan_screen.h" #include "vk_layer_table.h" -#include "generated/vk_enum_string_helper.h" -#include +#include +#include #include "profiles.h" -//typedef std::vector> List; - -//void LayerSettingsLog(const char *pSettingName, const char *pMessage); - std::string format(const char *message, ...); //std::string GetString(const List &list); diff --git a/devsim/vk_layer_table.cpp b/devsim/vk_layer_table.cpp index 69c12a043..8c5239ab1 100644 --- a/devsim/vk_layer_table.cpp +++ b/devsim/vk_layer_table.cpp @@ -2,6 +2,7 @@ * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. * Copyright (c) 2015-2022 Google, 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. @@ -18,32 +19,35 @@ * Author: Tobin Ehlis */ #include +#include +#include #include -#include "generated/vk_dispatch_table_helper.h" +#include #include "vulkan/vk_layer.h" #include "vk_layer_table.h" static device_table_map tableMap; static instance_table_map tableInstanceMap; +dispatch_key get_dispatch_key(const void *object) { return (dispatch_key) * (VkuDeviceDispatchTable **)object; } + // Map lookup must be thread safe -VkLayerDispatchTable *device_dispatch_table(void *object) { +VkuDeviceDispatchTable *device_dispatch_table(void *object) { dispatch_key key = get_dispatch_key(object); device_table_map::const_iterator it = tableMap.find((void *)key); assert(it != tableMap.end() && "Not able to find device dispatch entry"); - return it->second; + return it->second.get(); } -VkLayerInstanceDispatchTable *instance_dispatch_table(void *object) { +VkuInstanceDispatchTable *instance_dispatch_table(void *object) { dispatch_key key = get_dispatch_key(object); instance_table_map::const_iterator it = tableInstanceMap.find((void *)key); assert(it != tableInstanceMap.end() && "Not able to find instance dispatch entry"); - return it->second; + return it->second.get(); } void destroy_dispatch_table(device_table_map &map, dispatch_key key) { device_table_map::const_iterator it = map.find((void *)key); if (it != map.end()) { - delete it->second; map.erase(it); } } @@ -51,7 +55,6 @@ void destroy_dispatch_table(device_table_map &map, dispatch_key key) { void destroy_dispatch_table(instance_table_map &map, dispatch_key key) { instance_table_map::const_iterator it = map.find((void *)key); if (it != map.end()) { - delete it->second; map.erase(it); } } @@ -60,18 +63,18 @@ void destroy_device_dispatch_table(dispatch_key key) { destroy_dispatch_table(ta void destroy_instance_dispatch_table(dispatch_key key) { destroy_dispatch_table(tableInstanceMap, key); } -VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void *object) { +VkuDeviceDispatchTable *get_dispatch_table(device_table_map &map, void *object) { dispatch_key key = get_dispatch_key(object); device_table_map::const_iterator it = map.find((void *)key); assert(it != map.end() && "Not able to find device dispatch entry"); - return it->second; + return it->second.get(); } -VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void *object) { +VkuInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void *object) { dispatch_key key = get_dispatch_key(object); instance_table_map::const_iterator it = map.find((void *)key); assert(it != map.end() && "Not able to find instance dispatch entry"); - return it->second; + return it->second.get(); } VkLayerInstanceCreateInfo *get_chain_info(const VkInstanceCreateInfo *pCreateInfo, VkLayerFunction func) { @@ -99,19 +102,20 @@ VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo, V * Device -> CommandBuffer or Queue * If use the object themselves as key to map then implies Create entrypoints have to be intercepted * and a new key inserted into map */ -VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map) { - VkLayerInstanceDispatchTable *pTable; +VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map) { + VkuInstanceDispatchTable *pTable; dispatch_key key = get_dispatch_key(instance); instance_table_map::const_iterator it = map.find((void *)key); if (it == map.end()) { - pTable = new VkLayerInstanceDispatchTable; - map[(void *)key] = pTable; + auto table = std::make_unique(); + pTable = table.get(); + map[(void *)key] = std::move(table); } else { - return it->second; + return it->second.get(); } - layer_init_instance_dispatch_table(instance, pTable, gpa); + vkuInitInstanceDispatchTable(instance, pTable, gpa); // Setup func pointers that are required but not externally exposed. These won't be added to the instance dispatch table by // default. @@ -120,27 +124,39 @@ VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_v return pTable; } -VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa) { +VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa) { return initInstanceTable(instance, gpa, tableInstanceMap); } -VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa, device_table_map &map) { - VkLayerDispatchTable *pTable; +VkuDeviceDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa, device_table_map &map) { + VkuDeviceDispatchTable *pTable; dispatch_key key = get_dispatch_key(device); device_table_map::const_iterator it = map.find((void *)key); if (it == map.end()) { - pTable = new VkLayerDispatchTable; - map[(void *)key] = pTable; + auto table = std::make_unique(); + pTable = table.get(); + map[(void *)key] = std::move(table); } else { - return it->second; + return it->second.get(); } - layer_init_device_dispatch_table(device, pTable, gpa); + vkuInitDeviceDispatchTable(device, pTable, gpa); return pTable; } -VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa) { +VkuDeviceDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa) { return initDeviceTable(device, gpa, tableMap); } + +// Convert integer API version to a string +std::string StringAPIVersion(uint32_t version) { + std::stringstream version_name; + if (version == 0) { + return ""; + } + version_name << VK_API_VERSION_MAJOR(version) << "." << VK_API_VERSION_MINOR(version) << "." << VK_API_VERSION_PATCH(version) + << " (0x" << std::setfill('0') << std::setw(8) << std::hex << version << ")"; + return version_name.str(); +} diff --git a/devsim/vk_layer_table.h b/devsim/vk_layer_table.h index 97586051d..9a3f0c049 100644 --- a/devsim/vk_layer_table.h +++ b/devsim/vk_layer_table.h @@ -1,6 +1,7 @@ /* Copyright (c) 2015-2022 The Khronos Group Inc. * Copyright (c) 2015-2022 Valve Corporation * Copyright (c) 2015-2022 LunarG, Inc. + * Copyright (c) 2023-2023 RasterGrid Kft. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,27 +20,29 @@ #pragma once +#include "vulkan/utility/vk_dispatch_table.h" #include "vulkan/vk_layer.h" #include "vulkan/vulkan.h" +#include #include -#include "utils/vk_layer_utils.h" -typedef std::unordered_map device_table_map; -typedef std::unordered_map instance_table_map; -VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa, device_table_map &map); -VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa); -VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map); -VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa); +typedef std::unordered_map> device_table_map; +typedef std::unordered_map> instance_table_map; +VkuDeviceDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa, device_table_map &map); +VkuDeviceDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa); +VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map); +VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa); typedef void *dispatch_key; +dispatch_key get_dispatch_key(const void *object); -VkLayerDispatchTable *device_dispatch_table(void *object); +VkuDeviceDispatchTable *device_dispatch_table(void *object); -VkLayerInstanceDispatchTable *instance_dispatch_table(void *object); +VkuInstanceDispatchTable *instance_dispatch_table(void *object); -VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void *object); +VkuDeviceDispatchTable *get_dispatch_table(device_table_map &map, void *object); -VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void *object); +VkuInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void *object); VkLayerInstanceCreateInfo *get_chain_info(const VkInstanceCreateInfo *pCreateInfo, VkLayerFunction func); VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo, VkLayerFunction func); @@ -48,3 +51,6 @@ void destroy_device_dispatch_table(dispatch_key key); void destroy_instance_dispatch_table(dispatch_key key); void destroy_dispatch_table(device_table_map &map, dispatch_key key); void destroy_dispatch_table(instance_table_map &map, dispatch_key key); + +// Convert integer API version to a string +std::string StringAPIVersion(uint32_t version); diff --git a/external/x64/lib/vulkan-1.lib b/external/x64/lib/vulkan-1.lib deleted file mode 100644 index 3e23a7bcf..000000000 Binary files a/external/x64/lib/vulkan-1.lib and /dev/null differ diff --git a/external/x86/lib/vulkan-1.lib b/external/x86/lib/vulkan-1.lib deleted file mode 100644 index 3caa7ba04..000000000 Binary files a/external/x86/lib/vulkan-1.lib and /dev/null differ diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index d98c66a0f..416706dab 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -16,6 +16,10 @@ # limitations under the License. # ~~~ +if (ANDROID) + return() +endif() + # These variables enable downstream users to customize the CMake targets # based on the target API variant (e.g. Vulkan SC) set(MOCK_ICD_NAME VkICD_mock_icd) @@ -26,13 +30,15 @@ if(VULKANSC) set(GENERATED generated-vksc) endif() +option(BUILD_MOCK_ANDROID_SUPPORT "Build with Android Platform headers" OFF) + if(WIN32) add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN) -elseif(ANDROID) - add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR -DVK_USE_PLATFORM_ANDROID_KHX) elseif(APPLE) add_definitions(-DVK_USE_PLATFORM_MACOS_MVK) -elseif(UNIX AND NOT APPLE) # i.e. Linux +elseif(BUILD_MOCK_ANDROID_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(BUILD_WSI_XCB_SUPPORT) add_definitions(-DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XCB_KHX) endif() @@ -58,128 +64,102 @@ if(VULKANSC) remove_definitions(-DVK_USE_PLATFORM_MACOS_MVK) endif() -# Copy or link the JSON files to the binary directory for ease of use in the build tree. -if(WIN32) - # extra setup for out-of-tree builds - if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - if(CMAKE_GENERATOR MATCHES "^Visual Studio.*") - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${MOCK_ICD_NAME}.json src_json) - file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$/${MOCK_ICD_NAME}.json dst_json) - add_custom_target(VkICD_mock_icd-json ALL COMMAND copy ${src_json} ${dst_json} VERBATIM) - set_target_properties(VkICD_mock_icd-json PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER}) - else() - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${MOCK_ICD_NAME}.json src_json) - file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${MOCK_ICD_NAME}.json dst_json) - add_custom_target(VkICD_mock_icd-json ALL COMMAND copy ${src_json} ${dst_json} VERBATIM) - endif() - endif() -elseif(APPLE) - # extra setup for out-of-tree builds - if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - if(CMAKE_GENERATOR MATCHES "^Xcode.*") - add_custom_target(mk_icd_config_dir ALL - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/$) - add_custom_target(VkICD_mock_icd-json ALL - DEPENDS mk_icd_config_dir - COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/macos/${MOCK_ICD_NAME}.json - $ ${CMAKE_CURRENT_BINARY_DIR}/$/${MOCK_ICD_NAME}.json - VERBATIM) - else() - add_custom_target(VkICD_mock_icd-json ALL - COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/macos/${MOCK_ICD_NAME}.json - ${MOCK_ICD_NAME}.json - VERBATIM) - endif() +add_library(VkICD_mock_icd MODULE) +target_sources(VkICD_mock_icd PRIVATE mock_icd.cpp) +target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) + +target_include_directories(VkICD_mock_icd PRIVATE + ${GENERATED} + . +) + +if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang") + target_compile_options(VkICD_mock_icd PRIVATE + -Wpointer-arith + -Wno-unused-function + -Wno-sign-compare + ) + + if (ENABLE_ADDRESS_SANITIZER) + target_compile_options(VkICD_mock_icd PUBLIC -fsanitize=address) + target_link_options(VkICD_mock_icd PUBLIC -fsanitize=address) endif() +endif() + +if(MSVC) + target_compile_options(VkICD_mock_icd PRIVATE /bigobj) + target_compile_definitions(VkICD_mock_icd PRIVATE _CRT_SECURE_NO_WARNINGS) + target_link_options(VkICD_mock_icd PRIVATE /DEF:${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.def) +elseif(MINGW) + target_sources(VkICD_mock_icd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.def) else() - # extra setup for out-of-tree builds - if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - add_custom_target(VkICD_mock_icd-json ALL - COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/linux/${MOCK_ICD_NAME}.json - ${MOCK_ICD_NAME}.json - VERBATIM) + if(APPLE) + set_target_properties(VkICD_mock_icd PROPERTIES SUFFIX ".dylib") endif() + message(DEBUG "Mock ICD Functions are exported via EXPORT") endif() -# For ICD with a direct dependency on a project with the same name, use it. -if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - add_dependencies(VkICD_mock_icd-json VkICD_mock_icd) +set_target_properties(VkICD_mock_icd PROPERTIES OUTPUT_NAME ${MOCK_ICD_NAME}) + +if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO) + target_compile_definitions(VkICD_mock_icd PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}") endif() -add_custom_target(generate_icd_files DEPENDS mock_icd.cpp ${GENERATED}/function_definitions.h ${GENERATED}/function_declarations.h) -set_target_properties(generate_icd_files PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER}) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATED} - ${CMAKE_CURRENT_BINARY_DIR} - ${PROJECT_BINARY_DIR} - ${CMAKE_BINARY_DIR}) -if(BUILD_WSI_WAYLAND_SUPPORT) - include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + +# There are 2 primary deliverables for the mock driver. +# - The actual library (lib)VkICD_mock_icd.(dll|so|dylib) +# - The respective json file, VkICD_mock_icd.json +# This code generates the appropriate json for both local testing and the installation. +# NOTE: For WIN32 the JSON and dll MUST be placed in the same location, due to Win32 using a relative path for installation. +set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.json.in") +set(INTERMEDIATE_FILE "${CMAKE_CURRENT_BINARY_DIR}/json/mock_icd.json") +set(OUTPUT_FILE_FINAL_NAME "${MOCK_ICD_NAME}.json") +set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) +if (WIN32) + set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_BINDIR}) # WIN32/MINGW expect the dll in the `bin` dir, this matches our WIN32 SDK process endif() -if(WIN32) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj") - # Turn off transitional "changed behavior" warning message for Visual Studio versions prior to 2015. The changed behavior is - # that constructor initializers are now fixed to clear the struct members. - add_compile_options("$<$,$,19>>:/wd4351>") +if (WIN32) + set(JSON_LIBRARY_PATH ".\\\\${MOCK_ICD_NAME}.dll") +elseif(APPLE) + set(JSON_LIBRARY_PATH "./lib${MOCK_ICD_NAME}.dylib") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") + set(JSON_LIBRARY_PATH "./lib${MOCK_ICD_NAME}.so") endif() +configure_file(${INPUT_FILE} ${INTERMEDIATE_FILE} @ONLY) -if(WIN32) - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.def DEF_FILE) - add_custom_target(copy-mock_icd-def-file ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} ${MOCK_ICD_NAME}.def - VERBATIM) - set_target_properties(copy-mock_icd-def-file PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER}) - add_library(VkICD_mock_icd SHARED mock_icd.cpp ${MOCK_ICD_NAME}.def) - target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) - if(INSTALL_ICD) - install(TARGETS VkICD_mock_icd DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() -elseif(APPLE) - add_library(VkICD_mock_icd SHARED mock_icd.cpp ) - target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) - set_target_properties(VkICD_mock_icd PROPERTIES LINK_FLAGS "-Wl") - if(INSTALL_ICD) - install(TARGETS VkICD_mock_icd DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - endif() +# To support both multi/single configuration generators just copy the json to the correct directory +add_custom_command(TARGET VkICD_mock_icd POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INTERMEDIATE_FILE} $/${OUTPUT_FILE_FINAL_NAME} +) + +# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation. +# Require the user to ask that it be installed if they really want it. +option(INSTALL_ICD "Install Mock icd") +if (INSTALL_ICD) + message(NOTICE "INSTALL_ICD enabled!") else() - add_library(VkICD_mock_icd SHARED mock_icd.cpp ) - target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) - set_target_properties(VkICD_mock_icd PROPERTIES LINK_FLAGS "-Wl,-export-dynamic,-Bsymbolic,--exclude-libs,ALL") - if((UNIX AND NOT APPLE) AND INSTALL_ICD) # i.e. Linux - install(TARGETS VkICD_mock_icd DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - if (ENABLE_ADDRESS_SANITIZER) - target_compile_options(VkICD_mock_icd PUBLIC -fsanitize=address) - target_link_options(VkICD_mock_icd PUBLIC -fsanitize=address) - endif () + return() endif() -set_target_properties(VkICD_mock_icd PROPERTIES OUTPUT_NAME ${MOCK_ICD_NAME}) +# For UNIX-based systems, `library_path` should not contain a relative path (indicated by "./") before installing to system directories +# This json isn't used for regular local development, it's used for installation +if (UNIX) + set(UNIX_INTERMEDIATE_FILE "${CMAKE_CURRENT_BINARY_DIR}/json/unix_install_mock_icd.json") -# JSON file(s) install targets. For Linux, need to remove the "./" from the library path before installing to system directories. -if((UNIX AND NOT APPLE) AND INSTALL_ICD) # i.e. Linux - add_custom_target(VkICD_mock_icd-staging-json ALL - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/staging-json - COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/linux/${MOCK_ICD_NAME}.json ${CMAKE_CURRENT_BINARY_DIR}/staging-json - COMMAND sed -i -e "/\"library_path\":/s$./libVkICD$libVkICD$" - ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${MOCK_ICD_NAME}.json - VERBATIM - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linux/${MOCK_ICD_NAME}.json) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${MOCK_ICD_NAME}.json - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${API_TYPE}/icd.d) + if(APPLE) + set(JSON_LIBRARY_PATH "lib${MOCK_ICD_NAME}.dylib") + else() + set(JSON_LIBRARY_PATH "lib${MOCK_ICD_NAME}.so") + endif() + + configure_file(${INPUT_FILE} ${UNIX_INTERMEDIATE_FILE} @ONLY) + + install(FILES ${UNIX_INTERMEDIATE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${API_TYPE}/icd.d RENAME ${OUTPUT_FILE_FINAL_NAME}) endif() -# Windows uses the JSON file as-is. -if(WIN32 AND INSTALL_ICD) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/windows/${MOCK_ICD_NAME}.json DESTINATION ${CMAKE_INSTALL_BINDIR}) +if (WIN32) + install(FILES ${INTERMEDIATE_FILE} DESTINATION ${LAYER_INSTALL_DIR} RENAME ${OUTPUT_FILE_FINAL_NAME}) endif() + +install(TARGETS VkICD_mock_icd DESTINATION ${LAYER_INSTALL_DIR}) diff --git a/icd/VkICD_mock_icd.json.in b/icd/VkICD_mock_icd.json.in new file mode 100644 index 000000000..2ff43409d --- /dev/null +++ b/icd/VkICD_mock_icd.json.in @@ -0,0 +1,7 @@ +{ + "file_format_version": "1.0.1", + "ICD": { + "library_path": "@JSON_LIBRARY_PATH@", + "api_version": "1.3.268" + } +} \ No newline at end of file diff --git a/icd/windows/VkICD_mock_icd_vksc.json b/icd/VkICD_mock_icd_vksc.json.in similarity index 61% rename from icd/windows/VkICD_mock_icd_vksc.json rename to icd/VkICD_mock_icd_vksc.json.in index 3fe90a7a9..70e386430 100644 --- a/icd/windows/VkICD_mock_icd_vksc.json +++ b/icd/VkICD_mock_icd_vksc.json.in @@ -1,7 +1,7 @@ { "file_format_version": "1.0.1", "ICD": { - "library_path": ".\\VkICD_mock_icd_vksc.dll", + "library_path": "@JSON_LIBRARY_PATH@", "api_version": "1.0.13" } -} +} \ No newline at end of file diff --git a/icd/generated-vksc/function_declarations.h b/icd/generated-vksc/function_declarations.h index 71bc3c48d..3f0251abb 100644 --- a/icd/generated-vksc/function_declarations.h +++ b/icd/generated-vksc/function_declarations.h @@ -23,6 +23,7 @@ #pragma once #include +#include #include #include #include diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index c7e98171c..9c7a65d73 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -23,6 +23,7 @@ #pragma once #include +#include #include #include #include @@ -93,8 +94,8 @@ static const std::unordered_map device_extension_map = { {"VK_AMD_negative_viewport_height", 1}, {"VK_AMD_gpu_shader_half_float", 2}, {"VK_AMD_shader_ballot", 1}, - {"VK_EXT_video_encode_h264", 11}, - {"VK_EXT_video_encode_h265", 11}, + {"VK_EXT_video_encode_h264", 12}, + {"VK_EXT_video_encode_h265", 12}, {"VK_KHR_video_decode_h264", 8}, {"VK_AMD_texture_gather_bias_lod", 1}, {"VK_AMD_shader_info", 1}, @@ -155,6 +156,7 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_sampler_filter_minmax", 2}, {"VK_KHR_storage_buffer_storage_class", 1}, {"VK_AMD_gpu_shader_int16", 2}, + {"VK_AMDX_shader_enqueue", 1}, {"VK_AMD_mixed_attachment_samples", 1}, {"VK_AMD_shader_fragment_mask", 1}, {"VK_EXT_inline_uniform_block", 1}, @@ -251,6 +253,7 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_extended_dynamic_state", 1}, {"VK_KHR_deferred_host_operations", 4}, {"VK_KHR_pipeline_executable_properties", 1}, + {"VK_EXT_host_image_copy", 1}, {"VK_KHR_map_memory2", 1}, {"VK_EXT_shader_atomic_float2", 1}, {"VK_EXT_swapchain_maintenance1", 1}, @@ -271,7 +274,7 @@ static const std::unordered_map device_extension_map = { {"VK_KHR_present_id", 1}, {"VK_EXT_private_data", 1}, {"VK_EXT_pipeline_creation_cache_control", 3}, - {"VK_KHR_video_encode_queue", 9}, + {"VK_KHR_video_encode_queue", 10}, {"VK_NV_device_diagnostics_config", 2}, {"VK_QCOM_render_pass_store_ops", 2}, {"VK_NV_low_latency", 1}, @@ -313,6 +316,7 @@ static const std::unordered_map device_extension_map = { {"VK_HUAWEI_invocation_mask", 1}, {"VK_NV_external_memory_rdma", 1}, {"VK_EXT_pipeline_properties", 1}, + {"VK_EXT_frame_boundary", 1}, {"VK_EXT_multisampled_render_to_single_sampled", 1}, {"VK_EXT_extended_dynamic_state2", 1}, {"VK_EXT_color_write_enable", 1}, @@ -324,7 +328,7 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_image_2d_view_of_3d", 1}, {"VK_EXT_shader_tile_image", 1}, {"VK_EXT_opacity_micromap", 2}, - {"VK_NV_displacement_micromap", 1}, + {"VK_NV_displacement_micromap", 2}, {"VK_EXT_load_store_op_none", 1}, {"VK_HUAWEI_cluster_culling_shader", 2}, {"VK_EXT_border_color_swizzle", 1}, @@ -338,9 +342,11 @@ static const std::unordered_map device_extension_map = { {"VK_QCOM_fragment_density_map_offset", 1}, {"VK_NV_copy_memory_indirect", 1}, {"VK_NV_memory_decompression", 1}, + {"VK_NV_device_generated_commands_compute", 2}, {"VK_NV_linear_color_attachment", 1}, {"VK_EXT_image_compression_control_swapchain", 1}, {"VK_QCOM_image_processing", 1}, + {"VK_EXT_nested_command_buffer", 1}, {"VK_EXT_external_memory_acquire_unmodified", 1}, {"VK_EXT_extended_dynamic_state3", 2}, {"VK_EXT_subpass_merge_feedback", 2}, @@ -349,20 +355,30 @@ static const std::unordered_map device_extension_map = { {"VK_NV_optical_flow", 1}, {"VK_EXT_legacy_dithering", 1}, {"VK_EXT_pipeline_protected_access", 1}, + {"VK_ANDROID_external_format_resolve", 1}, + {"VK_KHR_maintenance5", 1}, {"VK_KHR_ray_tracing_position_fetch", 1}, {"VK_EXT_shader_object", 1}, {"VK_QCOM_tile_properties", 1}, {"VK_SEC_amigo_profiling", 1}, {"VK_QCOM_multiview_per_view_viewports", 1}, {"VK_NV_ray_tracing_invocation_reorder", 1}, + {"VK_NV_extended_sparse_address_space", 1}, {"VK_EXT_mutable_descriptor_type", 1}, {"VK_ARM_shader_core_builtins", 2}, {"VK_EXT_pipeline_library_group_handles", 1}, {"VK_EXT_dynamic_rendering_unused_attachments", 1}, + {"VK_NV_low_latency2", 1}, {"VK_KHR_cooperative_matrix", 2}, {"VK_QCOM_multiview_per_view_render_areas", 1}, + {"VK_QCOM_image_processing2", 1}, + {"VK_QCOM_filter_cubic_weights", 1}, + {"VK_QCOM_ycbcr_degamma", 1}, + {"VK_QCOM_filter_cubic_clamp", 1}, {"VK_EXT_attachment_feedback_loop_dynamic_state", 1}, {"VK_QNX_external_memory_screen_buffer", 1}, + {"VK_MSFT_layered_driver", 1}, + {"VK_NV_descriptor_pool_overallocation", 1}, }; @@ -2425,6 +2441,30 @@ static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSparseMemoryRequirementsKHR( VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); +static VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer2KHR( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType); + +static VKAPI_ATTR void VKAPI_CALL GetRenderingAreaGranularityKHR( + VkDevice device, + const VkRenderingAreaInfoKHR* pRenderingAreaInfo, + VkExtent2D* pGranularity); + +static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSubresourceLayoutKHR( + VkDevice device, + const VkDeviceImageSubresourceInfoKHR* pInfo, + VkSubresourceLayout2KHR* pLayout); + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2KHR( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); + + static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixPropertiesKHR( VkPhysicalDevice physicalDevice, @@ -2842,6 +2882,47 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryAndroidHardwareBufferANDROID( +#ifdef VK_ENABLE_BETA_EXTENSIONS + +static VKAPI_ATTR VkResult VKAPI_CALL CreateExecutionGraphPipelinesAMDX( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineScratchSizeAMDX( + VkDevice device, + VkPipeline executionGraph, + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineNodeIndexAMDX( + VkDevice device, + VkPipeline executionGraph, + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, + uint32_t* pNodeIndex); + +static VKAPI_ATTR void VKAPI_CALL CmdInitializeGraphScratchMemoryAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch); + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectCountAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + VkDeviceAddress countInfo); +#endif /* VK_ENABLE_BETA_EXTENSIONS */ + @@ -3308,6 +3389,30 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetStencilOpEXT( VkCompareOp compareOp); +static VKAPI_ATTR VkResult VKAPI_CALL CopyMemoryToImageEXT( + VkDevice device, + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToMemoryEXT( + VkDevice device, + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToImageEXT( + VkDevice device, + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL TransitionImageLayoutEXT( + VkDevice device, + uint32_t transitionCount, + const VkHostImageLayoutTransitionInfoEXT* pTransitions); + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); + + static VKAPI_ATTR VkResult VKAPI_CALL ReleaseSwapchainImagesEXT( @@ -3486,12 +3591,6 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateEnumNV( -static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( - VkDevice device, - VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout); - @@ -3625,6 +3724,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPipelinePropertiesEXT( + static VKAPI_ATTR void VKAPI_CALL CmdSetPatchControlPointsEXT( VkCommandBuffer commandBuffer, uint32_t patchControlPoints); @@ -3834,6 +3934,22 @@ static VKAPI_ATTR void VKAPI_CALL CmdDecompressMemoryIndirectCountNV( uint32_t stride); +static VKAPI_ATTR void VKAPI_CALL GetPipelineIndirectMemoryRequirementsNV( + VkDevice device, + const VkComputePipelineCreateInfo* pCreateInfo, + VkMemoryRequirements2* pMemoryRequirements); + +static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBufferNV( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +static VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetPipelineIndirectDeviceAddressNV( + VkDevice device, + const VkPipelineIndirectDeviceAddressInfoNV* pInfo); + + + @@ -4021,6 +4137,9 @@ static VKAPI_ATTR void VKAPI_CALL CmdOpticalFlowExecuteNV( +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + static VKAPI_ATTR VkResult VKAPI_CALL CreateShadersEXT( VkDevice device, @@ -4067,6 +4186,37 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( +static VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkLatencySleepModeInfoNV* pSleepModeInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkLatencySleepInfoNV* pSleepInfo); + +static VKAPI_ATTR void VKAPI_CALL SetLatencyMarkerNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo); + +static VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pTimingCount, + VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo); + +static VKAPI_ATTR void VKAPI_CALL QueueNotifyOutOfBandNV( + VkQueue queue, + const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo); + + + + + + + static VKAPI_ATTR void VKAPI_CALL CmdSetAttachmentFeedbackLoopEnableEXT( VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask); @@ -4080,6 +4230,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetScreenBufferPropertiesQNX( #endif /* VK_USE_PLATFORM_SCREEN_QNX */ + + static VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, @@ -4638,6 +4790,10 @@ static const std::unordered_map name_to_funcptr_map = { {"vkGetDeviceBufferMemoryRequirementsKHR", (void*)GetDeviceBufferMemoryRequirementsKHR}, {"vkGetDeviceImageMemoryRequirementsKHR", (void*)GetDeviceImageMemoryRequirementsKHR}, {"vkGetDeviceImageSparseMemoryRequirementsKHR", (void*)GetDeviceImageSparseMemoryRequirementsKHR}, + {"vkCmdBindIndexBuffer2KHR", (void*)CmdBindIndexBuffer2KHR}, + {"vkGetRenderingAreaGranularityKHR", (void*)GetRenderingAreaGranularityKHR}, + {"vkGetDeviceImageSubresourceLayoutKHR", (void*)GetDeviceImageSubresourceLayoutKHR}, + {"vkGetImageSubresourceLayout2KHR", (void*)GetImageSubresourceLayout2KHR}, {"vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR", (void*)GetPhysicalDeviceCooperativeMatrixPropertiesKHR}, {"vkCreateDebugReportCallbackEXT", (void*)CreateDebugReportCallbackEXT}, {"vkDestroyDebugReportCallbackEXT", (void*)DestroyDebugReportCallbackEXT}, @@ -4716,6 +4872,27 @@ static const std::unordered_map name_to_funcptr_map = { #endif #ifdef VK_USE_PLATFORM_ANDROID_KHR {"vkGetMemoryAndroidHardwareBufferANDROID", (void*)GetMemoryAndroidHardwareBufferANDROID}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCreateExecutionGraphPipelinesAMDX", (void*)CreateExecutionGraphPipelinesAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkGetExecutionGraphPipelineScratchSizeAMDX", (void*)GetExecutionGraphPipelineScratchSizeAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkGetExecutionGraphPipelineNodeIndexAMDX", (void*)GetExecutionGraphPipelineNodeIndexAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdInitializeGraphScratchMemoryAMDX", (void*)CmdInitializeGraphScratchMemoryAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdDispatchGraphAMDX", (void*)CmdDispatchGraphAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdDispatchGraphIndirectAMDX", (void*)CmdDispatchGraphIndirectAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdDispatchGraphIndirectCountAMDX", (void*)CmdDispatchGraphIndirectCountAMDX}, #endif {"vkCmdSetSampleLocationsEXT", (void*)CmdSetSampleLocationsEXT}, {"vkGetPhysicalDeviceMultisamplePropertiesEXT", (void*)GetPhysicalDeviceMultisamplePropertiesEXT}, @@ -4798,6 +4975,11 @@ static const std::unordered_map name_to_funcptr_map = { {"vkCmdSetDepthBoundsTestEnableEXT", (void*)CmdSetDepthBoundsTestEnableEXT}, {"vkCmdSetStencilTestEnableEXT", (void*)CmdSetStencilTestEnableEXT}, {"vkCmdSetStencilOpEXT", (void*)CmdSetStencilOpEXT}, + {"vkCopyMemoryToImageEXT", (void*)CopyMemoryToImageEXT}, + {"vkCopyImageToMemoryEXT", (void*)CopyImageToMemoryEXT}, + {"vkCopyImageToImageEXT", (void*)CopyImageToImageEXT}, + {"vkTransitionImageLayoutEXT", (void*)TransitionImageLayoutEXT}, + {"vkGetImageSubresourceLayout2EXT", (void*)GetImageSubresourceLayout2EXT}, {"vkReleaseSwapchainImagesEXT", (void*)ReleaseSwapchainImagesEXT}, {"vkGetGeneratedCommandsMemoryRequirementsNV", (void*)GetGeneratedCommandsMemoryRequirementsNV}, {"vkCmdPreprocessGeneratedCommandsNV", (void*)CmdPreprocessGeneratedCommandsNV}, @@ -4827,7 +5009,6 @@ static const std::unordered_map name_to_funcptr_map = { {"vkGetSamplerOpaqueCaptureDescriptorDataEXT", (void*)GetSamplerOpaqueCaptureDescriptorDataEXT}, {"vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT", (void*)GetAccelerationStructureOpaqueCaptureDescriptorDataEXT}, {"vkCmdSetFragmentShadingRateEnumNV", (void*)CmdSetFragmentShadingRateEnumNV}, - {"vkGetImageSubresourceLayout2EXT", (void*)GetImageSubresourceLayout2EXT}, {"vkGetDeviceFaultInfoEXT", (void*)GetDeviceFaultInfoEXT}, #ifdef VK_USE_PLATFORM_WIN32_KHR {"vkAcquireWinrtDisplayNV", (void*)AcquireWinrtDisplayNV}, @@ -4911,6 +5092,9 @@ static const std::unordered_map name_to_funcptr_map = { {"vkCmdCopyMemoryToImageIndirectNV", (void*)CmdCopyMemoryToImageIndirectNV}, {"vkCmdDecompressMemoryNV", (void*)CmdDecompressMemoryNV}, {"vkCmdDecompressMemoryIndirectCountNV", (void*)CmdDecompressMemoryIndirectCountNV}, + {"vkGetPipelineIndirectMemoryRequirementsNV", (void*)GetPipelineIndirectMemoryRequirementsNV}, + {"vkCmdUpdatePipelineIndirectBufferNV", (void*)CmdUpdatePipelineIndirectBufferNV}, + {"vkGetPipelineIndirectDeviceAddressNV", (void*)GetPipelineIndirectDeviceAddressNV}, {"vkCmdSetTessellationDomainOriginEXT", (void*)CmdSetTessellationDomainOriginEXT}, {"vkCmdSetDepthClampEnableEXT", (void*)CmdSetDepthClampEnableEXT}, {"vkCmdSetPolygonModeEXT", (void*)CmdSetPolygonModeEXT}, @@ -4955,6 +5139,11 @@ static const std::unordered_map name_to_funcptr_map = { {"vkCmdBindShadersEXT", (void*)CmdBindShadersEXT}, {"vkGetFramebufferTilePropertiesQCOM", (void*)GetFramebufferTilePropertiesQCOM}, {"vkGetDynamicRenderingTilePropertiesQCOM", (void*)GetDynamicRenderingTilePropertiesQCOM}, + {"vkSetLatencySleepModeNV", (void*)SetLatencySleepModeNV}, + {"vkLatencySleepNV", (void*)LatencySleepNV}, + {"vkSetLatencyMarkerNV", (void*)SetLatencyMarkerNV}, + {"vkGetLatencyTimingsNV", (void*)GetLatencyTimingsNV}, + {"vkQueueNotifyOutOfBandNV", (void*)QueueNotifyOutOfBandNV}, {"vkCmdSetAttachmentFeedbackLoopEnableEXT", (void*)CmdSetAttachmentFeedbackLoopEnableEXT}, #ifdef VK_USE_PLATFORM_SCREEN_QNX {"vkGetScreenBufferPropertiesQNX", (void*)GetScreenBufferPropertiesQNX}, diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 3a0d02c89..1fb95340d 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -1836,7 +1836,12 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferProperties( VkExternalBufferProperties* pExternalBufferProperties) { constexpr VkExternalMemoryHandleTypeFlags supported_flags = 0x1FF; - if (pExternalBufferInfo->handleType & supported_flags) { + if (pExternalBufferInfo->handleType & VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + // Can't have dedicated memory with AHB + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = pExternalBufferInfo->handleType; + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType; + } else if (pExternalBufferInfo->handleType & supported_flags) { pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7; pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = supported_flags; pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = supported_flags; @@ -2898,6 +2903,11 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2KHR( feat_bools = (VkBool32*)&blendop_features->advancedBlendCoherentOperations; SetBoolArrayTrue(feat_bools, num_bools); } + const auto *host_image_copy_features = lvl_find_in_chain(pFeatures->pNext); + if (host_image_copy_features) { + feat_bools = (VkBool32*)&host_image_copy_features->hostImageCopy; + SetBoolArrayTrue(feat_bools, 1); + } } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( @@ -2993,6 +3003,43 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( fragment_density_map2_props->maxSubsampledArrayLayers = 2; fragment_density_map2_props->maxDescriptorSetSubsampledSamplers = 1; } + + const uint32_t num_copy_layouts = 5; + const VkImageLayout HostCopyLayouts[]{ + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_GENERAL, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, + }; + + auto *host_image_copy_props = lvl_find_mod_in_chain(pProperties->pNext); + if (host_image_copy_props){ + if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copyDstLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopyDstLayouts[i] = HostCopyLayouts[i]; + } + } + if (host_image_copy_props->pCopySrcLayouts == nullptr) host_image_copy_props->copySrcLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copySrcLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopySrcLayouts[i] = HostCopyLayouts[i]; + } + } + } + + auto *driver_properties = lvl_find_mod_in_chain(pProperties->pNext); + if (driver_properties) { + std::strncpy(driver_properties->driverName, "Vulkan Mock Device", VK_MAX_DRIVER_NAME_SIZE); +#if defined(GIT_BRANCH_NAME) && defined(GIT_TAG_INFO) + std::strncpy(driver_properties->driverInfo, "Branch: " GIT_BRANCH_NAME " Tag Info: " GIT_TAG_INFO, VK_MAX_DRIVER_INFO_SIZE); +#else + std::strncpy(driver_properties->driverInfo, "Branch: --unknown-- Tag Info: --unknown--", VK_MAX_DRIVER_INFO_SIZE); +#endif + } } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR( @@ -3006,6 +3053,7 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR( props_3->linearTilingFeatures = pFormatProperties->formatProperties.linearTilingFeatures; props_3->optimalTilingFeatures = pFormatProperties->formatProperties.optimalTilingFeatures; props_3->bufferFeatures = pFormatProperties->formatProperties.bufferFeatures; + props_3->optimalTilingFeatures |= VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; } } @@ -3014,6 +3062,14 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties2KHR const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties) { + auto *external_image_prop = lvl_find_mod_in_chain(pImageFormatProperties->pNext); + auto *external_image_format = lvl_find_in_chain(pImageFormatInfo->pNext); + if (external_image_prop && external_image_format && external_image_format->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + external_image_prop->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + } + GetPhysicalDeviceImageFormatProperties(physicalDevice, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, pImageFormatInfo->usage, pImageFormatInfo->flags, &pImageFormatProperties->imageFormatProperties); return VK_SUCCESS; } @@ -3428,6 +3484,18 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2KHR( VkSurfaceCapabilities2KHR* pSurfaceCapabilities) { GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, pSurfaceInfo->surface, &pSurfaceCapabilities->surfaceCapabilities); + + auto *present_mode_compatibility = lvl_find_mod_in_chain(pSurfaceCapabilities->pNext); + if (present_mode_compatibility) { + if (!present_mode_compatibility->pPresentModes) { + present_mode_compatibility->presentModeCount = 3; + } else { + // arbitrary + present_mode_compatibility->pPresentModes[0] = VK_PRESENT_MODE_IMMEDIATE_KHR; + present_mode_compatibility->pPresentModes[1] = VK_PRESENT_MODE_FIFO_KHR; + present_mode_compatibility->pPresentModes[2] = VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR; + } + } return VK_SUCCESS; } @@ -3985,6 +4053,42 @@ static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSparseMemoryRequirementsKHR( } +static VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer2KHR( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetRenderingAreaGranularityKHR( + VkDevice device, + const VkRenderingAreaInfoKHR* pRenderingAreaInfo, + VkExtent2D* pGranularity) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSubresourceLayoutKHR( + VkDevice device, + const VkDeviceImageSubresourceInfoKHR* pInfo, + VkSubresourceLayout2KHR* pLayout) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2KHR( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout) +{ +//Not a CREATE or DESTROY function +} + + static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixPropertiesKHR( VkPhysicalDevice physicalDevice, @@ -3992,7 +4096,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixProperti VkCooperativeMatrixPropertiesKHR* pProperties) { if (!pProperties) { - *pPropertyCount = 1; + *pPropertyCount = 2; } else { // arbitrary pProperties[0].MSize = 16; @@ -4003,7 +4107,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixProperti pProperties[0].CType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].ResultType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].saturatingAccumulation = VK_FALSE; - pProperties[0].scope = VK_SCOPE_DEVICE_KHR; + pProperties[0].scope = VK_SCOPE_SUBGROUP_KHR; + + pProperties[1] = pProperties[0]; + pProperties[1].scope = VK_SCOPE_DEVICE_KHR; } return VK_SUCCESS; } @@ -4620,7 +4727,20 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties) { -//Not a CREATE or DESTROY function + pProperties->allocationSize = 65536; + pProperties->memoryTypeBits = 1 << 5; // DEVICE_LOCAL only type + + auto *format_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_prop) { + // Likley using this format + format_prop->format = VK_FORMAT_R8G8B8A8_UNORM; + format_prop->externalFormat = 37; + } + + auto *format_resolve_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_resolve_prop) { + format_resolve_prop->colorAttachmentFormat = VK_FORMAT_R8G8B8A8_UNORM; + } return VK_SUCCESS; } @@ -4636,6 +4756,74 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryAndroidHardwareBufferANDROID( +#ifdef VK_ENABLE_BETA_EXTENSIONS + +static VKAPI_ATTR VkResult VKAPI_CALL CreateExecutionGraphPipelinesAMDX( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines) +{ + unique_lock_t lock(global_lock); + for (uint32_t i = 0; i < createInfoCount; ++i) { + pPipelines[i] = (VkPipeline)global_unique_handle++; + } + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineScratchSizeAMDX( + VkDevice device, + VkPipeline executionGraph, + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineNodeIndexAMDX( + VkDevice device, + VkPipeline executionGraph, + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, + uint32_t* pNodeIndex) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL CmdInitializeGraphScratchMemoryAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectCountAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + VkDeviceAddress countInfo) +{ +//Not a CREATE or DESTROY function +} +#endif /* VK_ENABLE_BETA_EXTENSIONS */ + @@ -5360,6 +5548,49 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetStencilOpEXT( } +static VKAPI_ATTR VkResult VKAPI_CALL CopyMemoryToImageEXT( + VkDevice device, + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToMemoryEXT( + VkDevice device, + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToImageEXT( + VkDevice device, + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL TransitionImageLayoutEXT( + VkDevice device, + uint32_t transitionCount, + const VkHostImageLayoutTransitionInfoEXT* pTransitions) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout) +{ +//Not a CREATE or DESTROY function +} + + static VKAPI_ATTR VkResult VKAPI_CALL ReleaseSwapchainImagesEXT( @@ -5633,15 +5864,6 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateEnumNV( -static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( - VkDevice device, - VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout) -{ -//Not a CREATE or DESTROY function -} - @@ -5853,6 +6075,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPipelinePropertiesEXT( + static VKAPI_ATTR void VKAPI_CALL CmdSetPatchControlPointsEXT( VkCommandBuffer commandBuffer, uint32_t patchControlPoints) @@ -6171,6 +6394,32 @@ static VKAPI_ATTR void VKAPI_CALL CmdDecompressMemoryIndirectCountNV( } +static VKAPI_ATTR void VKAPI_CALL GetPipelineIndirectMemoryRequirementsNV( + VkDevice device, + const VkComputePipelineCreateInfo* pCreateInfo, + VkMemoryRequirements2* pMemoryRequirements) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBufferNV( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetPipelineIndirectDeviceAddressNV( + VkDevice device, + const VkPipelineIndirectDeviceAddressInfoNV* pInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + + + @@ -6480,6 +6729,9 @@ static VKAPI_ATTR void VKAPI_CALL CmdOpticalFlowExecuteNV( +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + static VKAPI_ATTR VkResult VKAPI_CALL CreateShadersEXT( VkDevice device, @@ -6551,6 +6803,54 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( +static VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkLatencySleepModeInfoNV* pSleepModeInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkLatencySleepInfoNV* pSleepInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL SetLatencyMarkerNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pTimingCount, + VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL QueueNotifyOutOfBandNV( + VkQueue queue, + const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo) +{ +//Not a CREATE or DESTROY function +} + + + + + + + static VKAPI_ATTR void VKAPI_CALL CmdSetAttachmentFeedbackLoopEnableEXT( VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask) @@ -6571,6 +6871,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetScreenBufferPropertiesQNX( #endif /* VK_USE_PLATFORM_SCREEN_QNX */ + + static VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index 88aa600b4..eb406e152 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -3204,6 +3204,78 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceMaintenance5FeaturesKHR Type; +}; + +// Map type VkPhysicalDeviceMaintenance5PropertiesKHR to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceMaintenance5PropertiesKHR Type; +}; + +// Map type VkRenderingAreaInfoKHR to id VK_STRUCTURE_TYPE_RENDERING_AREA_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_RENDERING_AREA_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkRenderingAreaInfoKHR Type; +}; + +// Map type VkImageSubresource2KHR to id VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkImageSubresource2KHR Type; +}; + +// Map type VkDeviceImageSubresourceInfoKHR to id VK_STRUCTURE_TYPE_DEVICE_IMAGE_SUBRESOURCE_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_DEVICE_IMAGE_SUBRESOURCE_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkDeviceImageSubresourceInfoKHR Type; +}; + +// Map type VkSubresourceLayout2KHR to id VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkSubresourceLayout2KHR Type; +}; + +// Map type VkPipelineCreateFlags2CreateInfoKHR to id VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkPipelineCreateFlags2CreateInfoKHR Type; +}; + +// Map type VkBufferUsageFlags2CreateInfoKHR to id VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkBufferUsageFlags2CreateInfoKHR Type; +}; + // Map type VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR; @@ -4152,6 +4224,61 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_FEATURES_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceShaderEnqueueFeaturesAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkPhysicalDeviceShaderEnqueuePropertiesAMDX to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_PROPERTIES_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_PROPERTIES_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceShaderEnqueuePropertiesAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkExecutionGraphPipelineScratchSizeAMDX to id VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_SCRATCH_SIZE_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_SCRATCH_SIZE_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkExecutionGraphPipelineScratchSizeAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkExecutionGraphPipelineCreateInfoAMDX to id VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_CREATE_INFO_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_CREATE_INFO_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkExecutionGraphPipelineCreateInfoAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkPipelineShaderStageNodeCreateInfoAMDX to id VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NODE_CREATE_INFO_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NODE_CREATE_INFO_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkPipelineShaderStageNodeCreateInfoAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS // Map type VkSampleLocationsInfoEXT to id VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT; @@ -5100,6 +5227,96 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceHostImageCopyFeaturesEXT Type; +}; + +// Map type VkPhysicalDeviceHostImageCopyPropertiesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceHostImageCopyPropertiesEXT Type; +}; + +// Map type VkMemoryToImageCopyEXT to id VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkMemoryToImageCopyEXT Type; +}; + +// Map type VkImageToMemoryCopyEXT to id VK_STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkImageToMemoryCopyEXT Type; +}; + +// Map type VkCopyMemoryToImageInfoEXT to id VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkCopyMemoryToImageInfoEXT Type; +}; + +// Map type VkCopyImageToMemoryInfoEXT to id VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkCopyImageToMemoryInfoEXT Type; +}; + +// Map type VkCopyImageToImageInfoEXT to id VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkCopyImageToImageInfoEXT Type; +}; + +// Map type VkHostImageLayoutTransitionInfoEXT to id VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkHostImageLayoutTransitionInfoEXT Type; +}; + +// Map type VkSubresourceHostMemcpySizeEXT to id VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkSubresourceHostMemcpySizeEXT Type; +}; + +// Map type VkHostImageCopyDevicePerformanceQueryEXT to id VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkHostImageCopyDevicePerformanceQueryEXT Type; +}; + // Map type VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT; @@ -5853,24 +6070,6 @@ template <> struct LvlSTypeMap typedef VkImageCompressionControlEXT Type; }; -// Map type VkSubresourceLayout2EXT to id VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT -template <> struct LvlTypeMap { - static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT; -}; - -template <> struct LvlSTypeMap { - typedef VkSubresourceLayout2EXT Type; -}; - -// Map type VkImageSubresource2EXT to id VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT -template <> struct LvlTypeMap { - static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT; -}; - -template <> struct LvlSTypeMap { - typedef VkImageSubresource2EXT Type; -}; - // Map type VkImageCompressionPropertiesEXT to id VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; @@ -6290,6 +6489,24 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceFrameBoundaryFeaturesEXT Type; +}; + +// Map type VkFrameBoundaryEXT to id VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkFrameBoundaryEXT Type; +}; + // Map type VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; @@ -6730,6 +6947,33 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV Type; +}; + +// Map type VkComputePipelineIndirectBufferInfoNV to id VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_INDIRECT_BUFFER_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_INDIRECT_BUFFER_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkComputePipelineIndirectBufferInfoNV Type; +}; + +// Map type VkPipelineIndirectDeviceAddressInfoNV to id VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPipelineIndirectDeviceAddressInfoNV Type; +}; + // Map type VkPhysicalDeviceLinearColorAttachmentFeaturesNV to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV; @@ -6775,6 +7019,24 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceNestedCommandBufferFeaturesEXT Type; +}; + +// Map type VkPhysicalDeviceNestedCommandBufferPropertiesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceNestedCommandBufferPropertiesEXT Type; +}; + // Map type VkExternalMemoryAcquireUnmodifiedEXT to id VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT; @@ -6973,6 +7235,39 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_FEATURES_ANDROID; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExternalFormatResolveFeaturesANDROID Type; +}; + +#endif // VK_USE_PLATFORM_ANDROID_KHR +#ifdef VK_USE_PLATFORM_ANDROID_KHR +// Map type VkPhysicalDeviceExternalFormatResolvePropertiesANDROID to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_PROPERTIES_ANDROID +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_PROPERTIES_ANDROID; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExternalFormatResolvePropertiesANDROID Type; +}; + +#endif // VK_USE_PLATFORM_ANDROID_KHR +#ifdef VK_USE_PLATFORM_ANDROID_KHR +// Map type VkAndroidHardwareBufferFormatResolvePropertiesANDROID to id VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_RESOLVE_PROPERTIES_ANDROID +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_RESOLVE_PROPERTIES_ANDROID; +}; + +template <> struct LvlSTypeMap { + typedef VkAndroidHardwareBufferFormatResolvePropertiesANDROID Type; +}; + +#endif // VK_USE_PLATFORM_ANDROID_KHR // Map type VkPhysicalDeviceShaderObjectFeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT; @@ -7063,6 +7358,24 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV Type; +}; + +// Map type VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV Type; +}; + // Map type VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM; @@ -7099,6 +7412,87 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SLEEP_MODE_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySleepModeInfoNV Type; +}; + +// Map type VkLatencySleepInfoNV to id VK_STRUCTURE_TYPE_LATENCY_SLEEP_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SLEEP_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySleepInfoNV Type; +}; + +// Map type VkSetLatencyMarkerInfoNV to id VK_STRUCTURE_TYPE_SET_LATENCY_MARKER_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SET_LATENCY_MARKER_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkSetLatencyMarkerInfoNV Type; +}; + +// Map type VkLatencyTimingsFrameReportNV to id VK_STRUCTURE_TYPE_LATENCY_TIMINGS_FRAME_REPORT_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_TIMINGS_FRAME_REPORT_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencyTimingsFrameReportNV Type; +}; + +// Map type VkGetLatencyMarkerInfoNV to id VK_STRUCTURE_TYPE_GET_LATENCY_MARKER_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_GET_LATENCY_MARKER_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkGetLatencyMarkerInfoNV Type; +}; + +// Map type VkLatencySubmissionPresentIdNV to id VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySubmissionPresentIdNV Type; +}; + +// Map type VkSwapchainLatencyCreateInfoNV to id VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkSwapchainLatencyCreateInfoNV Type; +}; + +// Map type VkOutOfBandQueueTypeInfoNV to id VK_STRUCTURE_TYPE_OUT_OF_BAND_QUEUE_TYPE_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_OUT_OF_BAND_QUEUE_TYPE_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkOutOfBandQueueTypeInfoNV Type; +}; + +// Map type VkLatencySurfaceCapabilitiesNV to id VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySurfaceCapabilitiesNV Type; +}; + // Map type VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM; @@ -7117,6 +7511,87 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceImageProcessing2FeaturesQCOM Type; +}; + +// Map type VkPhysicalDeviceImageProcessing2PropertiesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceImageProcessing2PropertiesQCOM Type; +}; + +// Map type VkSamplerBlockMatchWindowCreateInfoQCOM to id VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkSamplerBlockMatchWindowCreateInfoQCOM Type; +}; + +// Map type VkPhysicalDeviceCubicWeightsFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceCubicWeightsFeaturesQCOM Type; +}; + +// Map type VkSamplerCubicWeightsCreateInfoQCOM to id VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkSamplerCubicWeightsCreateInfoQCOM Type; +}; + +// Map type VkBlitImageCubicWeightsInfoQCOM to id VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkBlitImageCubicWeightsInfoQCOM Type; +}; + +// Map type VkPhysicalDeviceYcbcrDegammaFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceYcbcrDegammaFeaturesQCOM Type; +}; + +// Map type VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM to id VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM Type; +}; + +// Map type VkPhysicalDeviceCubicClampFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceCubicClampFeaturesQCOM Type; +}; + // Map type VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT; @@ -7181,6 +7656,24 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceLayeredDriverPropertiesMSFT Type; +}; + +// Map type VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV Type; +}; + // Map type VkAccelerationStructureGeometryTrianglesDataKHR to id VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR; diff --git a/icd/linux/VkICD_mock_icd.json b/icd/linux/VkICD_mock_icd.json deleted file mode 100644 index bf32f8e67..000000000 --- a/icd/linux/VkICD_mock_icd.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "file_format_version" : "1.0.1", - "ICD": { - "library_path": "./libVkICD_mock_icd.so", - "api_version": "1.1.97" - } -} - - - - - diff --git a/icd/linux/VkICD_mock_icd_vksc.json b/icd/linux/VkICD_mock_icd_vksc.json deleted file mode 100644 index 08c6f2e14..000000000 --- a/icd/linux/VkICD_mock_icd_vksc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "file_format_version": "1.0.1", - "ICD": { - "library_path": "./libVkICD_mock_icd_vksc.so", - "api_version": "1.0.13" - } -} diff --git a/icd/macos/VkICD_mock_icd.json b/icd/macos/VkICD_mock_icd.json deleted file mode 100644 index 710198688..000000000 --- a/icd/macos/VkICD_mock_icd.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "file_format_version" : "1.0.1", - "ICD": { - "library_path": "./libVkICD_mock_icd.dylib", - "api_version": "1.1.97" - } -} - diff --git a/icd/macos/VkICD_mock_icd_vksc.json b/icd/macos/VkICD_mock_icd_vksc.json deleted file mode 100644 index 220a92912..000000000 --- a/icd/macos/VkICD_mock_icd_vksc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "file_format_version": "1.0.1", - "ICD": { - "library_path": "./libVkICD_mock_icd_vksc.dylib", - "api_version": "1.0.13" - } -} diff --git a/icd/windows/VkICD_mock_icd.json b/icd/windows/VkICD_mock_icd.json deleted file mode 100644 index d192f5c24..000000000 --- a/icd/windows/VkICD_mock_icd.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "file_format_version" : "1.0.1", - "ICD": { - "library_path": ".\\VkICD_mock_icd.dll", - "api_version": "1.1.97" - } -} - - - - - diff --git a/mac_common.cmake b/mac_common.cmake index bad3c4143..b06dce96a 100644 --- a/mac_common.cmake +++ b/mac_common.cmake @@ -45,7 +45,7 @@ set_source_files_properties(${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json P find_library(COCOA NAMES Cocoa) # Locate Interface Builder Tool, needed to build things like Storyboards outside of Xcode. -if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(NOT XCODE) # Make sure we can find the 'ibtool' program. If we can NOT find it we skip generation of this project. find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin") if(${IBTOOL} STREQUAL "IBTOOL-NOTFOUND") diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 675b9be67..ad9916986 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -122,9 +122,8 @@ endif() if (VALIJSON_INSTALL_DIR) list(APPEND CMAKE_PREFIX_PATH ${VALIJSON_INSTALL_DIR}) endif() -if (VULKAN_VALIDATIONLAYERS_INSTALL_DIR) - list(APPEND CMAKE_INCLUDE_PATH ${VULKAN_VALIDATIONLAYERS_INSTALL_DIR}/include/vulkan) - set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} PARENT_SCOPE) +if (VULKAN_UTILITY_LIBRARIES_INSTALL_DIR) + list(APPEND CMAKE_PREFIX_PATH ${VULKAN_UTILITY_LIBRARIES_INSTALL_DIR}) endif() if (CMAKE_CROSSCOMPILING) diff --git a/scripts/android.py b/scripts/android.py new file mode 100755 index 000000000..f976a2f54 --- /dev/null +++ b/scripts/android.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python3 +# 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. + +# NOTE: Android this documentation is crucial for understanding the layout of the NDK. +# https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md + +# NOTE: Environment variables we can rely on users/environments setting. +# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#environment-variables-2 + +import argparse +import os +import sys +import shutil +import subprocess + +# helper to define paths relative to the repo root +def RepoRelative(path): + return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', path)) + +# Points to the directory containing the top level CMakeLists.txt +PROJECT_SRC_DIR = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')) +if not os.path.isfile(f'{PROJECT_SRC_DIR}/CMakeLists.txt'): + print(f'PROJECT_SRC_DIR invalid! {PROJECT_SRC_DIR}') + sys.exit(1) + +# Runs a command in a directory and returns its return code. +# Directory is project root by default, or a relative path from project root +def RunShellCmd(command, start_dir = PROJECT_SRC_DIR, env=None, verbose=False): + # Flush stdout here. Helps when debugging on CI. + sys.stdout.flush() + + if start_dir != PROJECT_SRC_DIR: + start_dir = RepoRelative(start_dir) + cmd_list = command.split(" ") + + if verbose: + print(f'CICMD({cmd_list}, env={env})') + subprocess.check_call(cmd_list, cwd=start_dir, env=env) + +# Manifest file describing out test application +def get_android_manifest() -> str: + manifest = RepoRelative('cube/android/AndroidManifest.xml') + if not os.path.isfile(manifest): + print(f"Unable to find manifest for APK! {manifest}") + sys.exit(-1) + return manifest + +# Generate the APK from the CMake binaries +def generate_apk(SDK_ROOT : str, CMAKE_INSTALL_DIR : str) -> str: + apk_dir = RepoRelative('build-android/bin') + + # Delete APK directory since it could contain files from old runs + if os.path.isdir(apk_dir): + shutil.rmtree(apk_dir) + + shutil.copytree(CMAKE_INSTALL_DIR, apk_dir) + + android_manifest = get_android_manifest() + + android_jar = f"{SDK_ROOT}/platforms/android-26/android.jar" + if not os.path.isfile(android_jar): + print(f"Unable to find {android_jar}!") + sys.exit(-1) + + apk_name = 'VkCube' + + unaligned_apk = f'{apk_dir}/{apk_name}-unaligned.apk' + test_apk = f'{apk_dir}/{apk_name}.apk' + + # Create APK + RunShellCmd(f'aapt package -f -M {android_manifest} -I {android_jar} -F {unaligned_apk} {CMAKE_INSTALL_DIR}') + + # Align APK + RunShellCmd(f'zipalign -f 4 {unaligned_apk} {test_apk}') + + # Create Key (If it doesn't already exist) + debug_key = RepoRelative(f'{apk_dir}/debug.keystore') + ks_pass = 'android' + if not os.path.isfile(debug_key): + dname = 'CN=Android-Debug,O=Android,C=US' + RunShellCmd(f'keytool -genkey -v -keystore {debug_key} -alias androiddebugkey -storepass {ks_pass} -keypass {ks_pass} -keyalg RSA -keysize 2048 -validity 10000 -dname {dname}') + + # Sign APK + RunShellCmd(f'apksigner sign --verbose --ks {debug_key} --ks-pass pass:{ks_pass} {test_apk}') + +# Android APKs can contain binaries for multiple ABIs (armeabi-v7a, arm64-v8a, x86, x86_64). +# https://en.wikipedia.org/wiki/Apk_(file_format)#Package_contents +# +# As a result CMake will need to be run multiple times to create a complete test APK that can be run on any Android device. +def main(): + configs = ['Release', 'Debug'] + + parser = argparse.ArgumentParser() + parser.add_argument('--config', type=str, choices=configs, default=configs[0]) + parser.add_argument('--app-abi', dest='android_abi', type=str, default="arm64-v8a") + parser.add_argument('--app-stl', dest='android_stl', type=str, choices=["c++_static", "c++_shared"], default="c++_static") + parser.add_argument('--apk', action='store_true', help='Generate an APK as a post build step.') + parser.add_argument('--tests', action='store_true', help='Build tests.') + parser.add_argument('--clean', action='store_true', help='Cleans CMake build artifacts') + args = parser.parse_args() + + cmake_config = args.config + android_abis = args.android_abi.split(" ") + android_stl = args.android_stl + create_apk = args.apk + build_tests = args.tests + clean = args.clean + + if "ANDROID_NDK_HOME" not in os.environ: + print("Cannot find ANDROID_NDK_HOME!") + sys.exit(1) + + android_ndk_home = os.environ.get('ANDROID_NDK_HOME') + android_toolchain = f'{android_ndk_home}/build/cmake/android.toolchain.cmake' + + # The only tool we require for building is CMake/Ninja + required_cli_tools = ['cmake', 'ninja'] + + # If we are building an APK we need a few more tools. + if create_apk: + if "ANDROID_SDK_ROOT" not in os.environ: + print("Cannot find ANDROID_SDK_ROOT!") + sys.exit(1) + + android_sdk_root = os.environ.get('ANDROID_SDK_ROOT') + print(f"ANDROID_SDK_ROOT = {android_sdk_root}") + required_cli_tools += ['aapt', 'zipalign', 'keytool', 'apksigner'] + + print(f"ANDROID_NDK_HOME = {android_ndk_home}") + print(f"Build configured for {cmake_config} | {android_stl} | {android_abis} | APK {create_apk}") + + if not os.path.isfile(android_toolchain): + print(f'Unable to find android.toolchain.cmake at {android_toolchain}') + exit(-1) + + for tool in required_cli_tools: + path = shutil.which(tool) + if path is None: + print(f"Unable to find {tool}!") + exit(-1) + + print(f"Using {tool} : {path}") + + cmake_install_dir = RepoRelative('build-android/libs') + + # Delete install directory since it could contain files from old runs + if os.path.isdir(cmake_install_dir): + print("Cleaning CMake install") + shutil.rmtree(cmake_install_dir) + + for abi in android_abis: + build_dir = RepoRelative(f'build-android/cmake/{abi}') + lib_dir = f'lib/{abi}' + + if clean: + print("Deleting CMakeCache.txt") + + # Delete CMakeCache.txt to ensure clean builds + # NOTE: CMake 3.24 has --fresh which would be better to use in the future. + cmake_cache = f'{build_dir}/CMakeCache.txt' + if os.path.isfile(cmake_cache): + os.remove(cmake_cache) + + cmake_cmd = f'cmake -S . -B {build_dir} -G Ninja' + + cmake_cmd += f' -D CMAKE_BUILD_TYPE={cmake_config}' + cmake_cmd += f' -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR={build_dir}' + cmake_cmd += f' -D CMAKE_TOOLCHAIN_FILE={android_toolchain}' + cmake_cmd += f' -D CMAKE_ANDROID_ARCH_ABI={abi}' + cmake_cmd += f' -D CMAKE_INSTALL_LIBDIR={lib_dir}' + cmake_cmd += f' -D BUILD_TESTS={build_tests}' + cmake_cmd += f' -D CMAKE_ANDROID_STL_TYPE={android_stl}' + + cmake_cmd += ' -D ANDROID_PLATFORM=26' + cmake_cmd += ' -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO' + + RunShellCmd(cmake_cmd) + + build_cmd = f'cmake --build {build_dir}' + RunShellCmd(build_cmd) + + install_cmd = f'cmake --install {build_dir} --prefix {cmake_install_dir}' + RunShellCmd(install_cmd) + + if create_apk: + generate_apk(SDK_ROOT = android_sdk_root, CMAKE_INSTALL_DIR = cmake_install_dir) + +if __name__ == '__main__': + main() diff --git a/scripts/check_code_format.sh b/scripts/check_code_format.sh deleted file mode 100755 index dbd7b7998..000000000 --- a/scripts/check_code_format.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright (c) 2017 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. -# -# 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. - -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -clang-format --version - -FILES_TO_CHECK=$(git diff --name-only main | grep -v -E "^include/vulkan" | grep -E ".*\.(cpp|cc|c\+\+|cxx|c|h|hpp)$") - -if [ -z "${FILES_TO_CHECK}" ]; then - echo -e "${GREEN}No source code to check for formatting.${NC}" - exit 0 -fi - -FORMAT_DIFF=$(git diff -U0 main -- ${FILES_TO_CHECK} | python ./scripts/clang-format-diff.py -p1 -style=file) - -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}" - echo "Be sure you are using the following version of clang-format:" - clang-format --version - exit 1 -fi diff --git a/scripts/check_commit_message_format.sh b/scripts/check_commit_message_format.sh deleted file mode 100755 index 29666356a..000000000 --- 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/determine_vs_version.py b/scripts/determine_vs_version.py deleted file mode 100755 index 7982bf717..000000000 --- a/scripts/determine_vs_version.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2016 The Khronos Group Inc. -# Copyright (c) 2016 Valve Corporation -# Copyright (c) 2016 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: Mark Young - -import sys -import os -import subprocess - -# Following function code snippet was found on StackOverflow (with a change to lower -# camel-case on the variable names): -# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python -def find_executable(program): - def is_exe(fPath): - return os.path.isfile(fPath) and os.access(fPath, os.X_OK) - - fPath, fName = os.path.split(program) - if fPath: - if is_exe(program): - return program - else: - for path in os.environ["PATH"].split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if is_exe(exe_file): - return exe_file - - return None - -def determine_year(version): - if version == 8: - return 2005 - elif version == 9: - return 2008 - elif version == 10: - return 2010 - elif version == 11: - return 2012 - elif version == 12: - return 2013 - elif version == 14: - return 2015 - elif version == 15: - return 2017 - else: - return 0000 - -# Determine if msbuild is in the path, then call it to determine the version and parse -# it into a format we can use, which is " ". -if __name__ == '__main__': - exeName = 'msbuild.exe' - arguments = '/ver' - - # Determine if the executable exists in the path, this is critical. - # - foundExeName = find_executable(exeName) - - # If not found, return an invalid number but in the appropriate format so it will - # fail if the program above tries to use it. - if foundExeName == None: - print('00 0000') - print('Executable ' + exeName + ' not found in PATH!') - else: - proc = subprocess.Popen([exeName, arguments], stdout=subprocess.PIPE) - sysCallOut = proc.stdout.readline().decode('iso-8859-1').rstrip() - - version = None - - # Split around any spaces first - spaceList = sysCallOut.split(' ') - for spaceString in spaceList: - - # If we've already found it, bail. - if version != None: - break - - # Now split around line feeds - lineList = spaceString.split('\n') - for curLine in lineList: - - # If we've already found it, bail. - if version != None: - break - - # We only want to continue if there's a period in the list - if '.' not in curLine: - continue - - # Get the first element and determine if it is a number, if so, we've - # got our number. - splitAroundPeriod = curLine.split('.') - if splitAroundPeriod[0].isdigit(): - version = int (splitAroundPeriod[0]) - break - - # Failsafe to return a number in the proper format, but one that will fail. - if version == None: - version = 00 - - # Determine the year associated with that version - year = determine_year(version) - - # Output the string we need for Cmake to properly build for this version - print(str(version) + ' ' + str(year)) diff --git a/scripts/fetch_glslangvalidator.py b/scripts/fetch_glslangvalidator.py deleted file mode 100755 index 936def893..000000000 --- a/scripts/fetch_glslangvalidator.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2018 The Khronos Group Inc. -# 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. -# -# Author: Mark Lobodzinski - - -# This script will download the latest glslang release binary and extract the -# glslangValidator binary needed by the vkcube and vkcubepp applications. -# -# It takes as its lone argument the filname (no path) describing the release -# binary name from the glslang github releases page. - -import sys -import os -import shutil -import ssl -import subprocess -import urllib.request -import zipfile -import platform - -SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__)) -REPO_DIR = os.path.join(SCRIPTS_DIR, '..') -GLSLANG_URL = "https://github.com/KhronosGroup/glslang/releases/download/7.9.2888" - -def platformDir(): return platform.system().lower() - -if __name__ == '__main__': - if len(sys.argv) != 2: - print("ERROR -- must include a single glslang release zipfile name argument") - sys.exit(); - - GLSLANG_FILENAME = sys.argv[1] - GLSLANG_COMPLETE_URL = GLSLANG_URL + "/" + GLSLANG_FILENAME - GLSLANG_OUTFILENAME = os.path.join(REPO_DIR, "glslang", GLSLANG_FILENAME) - GLSLANG_DIR = os.path.join(REPO_DIR, "glslang", platformDir()) - GLSLANG_VALIDATOR_PATH = os.path.join(GLSLANG_DIR, "bin") - GLSLANG_VALIDATOR_FULL_PATH = os.path.join(GLSLANG_VALIDATOR_PATH, "glslangValidator") - if platform.system() == 'Windows': - GLSLANG_VALIDATOR_FULL_PATH = GLSLANG_VALIDATOR_FULL_PATH + '.exe' - - if os.path.isdir(GLSLANG_DIR): - if os.path.exists(GLSLANG_VALIDATOR_FULL_PATH): - print(" Using glslangValidator at %s" % GLSLANG_VALIDATOR_PATH) - sys.exit() - else: - os.makedirs(GLSLANG_DIR) - print(" Downloading glslangValidator binary from glslang releases dir") - sys.stdout.flush() - - # Download release zip file from glslang github releases site - with urllib.request.urlopen(GLSLANG_COMPLETE_URL, context=ssl._create_unverified_context()) as response, open(GLSLANG_OUTFILENAME, 'wb') as out_file: - shutil.copyfileobj(response, out_file) - # Unzip the glslang binary archive - zipped_file = zipfile.ZipFile(GLSLANG_OUTFILENAME, 'r') - namelist = zipped_file.namelist() - for afile in namelist: - if "glslangValidator" in afile: - EXE_FILE_PATH = os.path.join(GLSLANG_DIR, afile) - zipped_file.extract(afile, GLSLANG_DIR) - os.chmod(EXE_FILE_PATH, 0o775) - break - zipped_file.close() - sys.exit(); diff --git a/scripts/generate_source.py b/scripts/generate_source.py index c65a2b5ad..6f1012194 100755 --- a/scripts/generate_source.py +++ b/scripts/generate_source.py @@ -22,6 +22,7 @@ import argparse import filecmp import os +import json import shutil import subprocess import sys @@ -38,6 +39,7 @@ def main(argv): default='vulkan', choices=['vulkan', 'vulkansc'], help='Specify API name to generate') + parser.add_argument('--generated-version', help='sets the header version used to generate the repo') parser.add_argument('registry', metavar='REGISTRY_PATH', help='path to the Vulkan-Headers registry directory') group = parser.add_mutually_exclusive_group() group.add_argument('-i', '--incremental', action='store_true', help='only update repo files that change') @@ -58,6 +60,22 @@ def main(argv): #base directory for the source repository repo_dir = common_codegen.repo_relative('') + # Update the api_version in the respective json files + if args.generated_version: + json_files = [] + if args.api == 'vulkansc': + json_files.append(common_codegen.repo_relative('icd/VkICD_mock_icd_vksc.json.in')) + else: + json_files.append(common_codegen.repo_relative('icd/VkICD_mock_icd.json.in')) + for json_file in json_files: + with open(json_file) as f: + data = json.load(f) + + data["ICD"]["api_version"] = args.generated_version + + with open(json_file, mode='w', encoding='utf-8', newline='\n') as f: + f.write(json.dumps(data, indent=4)) + # get directory where generators will run if needed if args.verify or args.incremental: # generate in temp directory so we can compare or copy later diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index f2f064605..35e3e5cc4 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -697,6 +697,13 @@ def __repr__(self): Command(name='vkGetDeviceImageSparseMemoryRequirementsKHR', dispatch='VkDevice'), ]) +VK_KHR_maintenance5 = Extension(name='VK_KHR_maintenance5', version=1, guard=None, commands=[ + Command(name='vkCmdBindIndexBuffer2KHR', dispatch='VkCommandBuffer'), + Command(name='vkGetRenderingAreaGranularityKHR', dispatch='VkDevice'), + Command(name='vkGetDeviceImageSubresourceLayoutKHR', dispatch='VkDevice'), + Command(name='vkGetImageSubresourceLayout2KHR', dispatch='VkDevice'), +]) + VK_KHR_ray_tracing_position_fetch = Extension(name='VK_KHR_ray_tracing_position_fetch', version=1, guard=None, commands=[ ]) @@ -1169,6 +1176,14 @@ def __repr__(self): Command(name='vkCmdSetStencilOpEXT', dispatch='VkCommandBuffer'), ]) +VK_EXT_host_image_copy = Extension(name='VK_EXT_host_image_copy', version=1, guard=None, commands=[ + Command(name='vkCopyMemoryToImageEXT', dispatch='VkDevice'), + Command(name='vkCopyImageToMemoryEXT', dispatch='VkDevice'), + Command(name='vkCopyImageToImageEXT', dispatch='VkDevice'), + Command(name='vkTransitionImageLayoutEXT', dispatch='VkDevice'), + Command(name='vkGetImageSubresourceLayout2EXT', dispatch='VkDevice'), +]) + VK_EXT_shader_atomic_float2 = Extension(name='VK_EXT_shader_atomic_float2', version=1, guard=None, commands=[ ]) @@ -1283,7 +1298,6 @@ def __repr__(self): ]) VK_EXT_image_compression_control = Extension(name='VK_EXT_image_compression_control', version=1, guard=None, commands=[ - Command(name='vkGetImageSubresourceLayout2EXT', dispatch='VkDevice'), ]) VK_EXT_attachment_feedback_loop_layout = Extension(name='VK_EXT_attachment_feedback_loop_layout', version=2, guard=None, commands=[ @@ -1338,6 +1352,9 @@ def __repr__(self): Command(name='vkGetPipelinePropertiesEXT', dispatch='VkDevice'), ]) +VK_EXT_frame_boundary = Extension(name='VK_EXT_frame_boundary', version=1, guard=None, commands=[ +]) + VK_EXT_multisampled_render_to_single_sampled = Extension(name='VK_EXT_multisampled_render_to_single_sampled', version=1, guard=None, commands=[ ]) @@ -1435,6 +1452,12 @@ def __repr__(self): Command(name='vkCmdDecompressMemoryIndirectCountNV', dispatch='VkCommandBuffer'), ]) +VK_NV_device_generated_commands_compute = Extension(name='VK_NV_device_generated_commands_compute', version=2, guard=None, commands=[ + Command(name='vkGetPipelineIndirectMemoryRequirementsNV', dispatch='VkDevice'), + Command(name='vkCmdUpdatePipelineIndirectBufferNV', dispatch='VkCommandBuffer'), + Command(name='vkGetPipelineIndirectDeviceAddressNV', dispatch='VkDevice'), +]) + VK_NV_linear_color_attachment = Extension(name='VK_NV_linear_color_attachment', version=1, guard=None, commands=[ ]) @@ -1447,6 +1470,9 @@ def __repr__(self): VK_QCOM_image_processing = Extension(name='VK_QCOM_image_processing', version=1, guard=None, commands=[ ]) +VK_EXT_nested_command_buffer = Extension(name='VK_EXT_nested_command_buffer', version=1, guard=None, commands=[ +]) + VK_EXT_external_memory_acquire_unmodified = Extension(name='VK_EXT_external_memory_acquire_unmodified', version=1, guard=None, commands=[ ]) @@ -1533,6 +1559,9 @@ def __repr__(self): VK_NV_ray_tracing_invocation_reorder = Extension(name='VK_NV_ray_tracing_invocation_reorder', version=1, guard=None, commands=[ ]) +VK_NV_extended_sparse_address_space = Extension(name='VK_NV_extended_sparse_address_space', version=1, guard=None, commands=[ +]) + VK_EXT_mutable_descriptor_type = Extension(name='VK_EXT_mutable_descriptor_type', version=1, guard=None, commands=[ ]) @@ -1545,13 +1574,39 @@ def __repr__(self): VK_EXT_dynamic_rendering_unused_attachments = Extension(name='VK_EXT_dynamic_rendering_unused_attachments', version=1, guard=None, commands=[ ]) +VK_NV_low_latency2 = Extension(name='VK_NV_low_latency2', version=1, guard=None, commands=[ + Command(name='vkSetLatencySleepModeNV', dispatch='VkDevice'), + Command(name='vkLatencySleepNV', dispatch='VkDevice'), + Command(name='vkSetLatencyMarkerNV', dispatch='VkDevice'), + Command(name='vkGetLatencyTimingsNV', dispatch='VkDevice'), + Command(name='vkQueueNotifyOutOfBandNV', dispatch='VkQueue'), +]) + VK_QCOM_multiview_per_view_render_areas = Extension(name='VK_QCOM_multiview_per_view_render_areas', version=1, guard=None, commands=[ ]) +VK_QCOM_image_processing2 = Extension(name='VK_QCOM_image_processing2', version=1, guard=None, commands=[ +]) + +VK_QCOM_filter_cubic_weights = Extension(name='VK_QCOM_filter_cubic_weights', version=1, guard=None, commands=[ +]) + +VK_QCOM_ycbcr_degamma = Extension(name='VK_QCOM_ycbcr_degamma', version=1, guard=None, commands=[ +]) + +VK_QCOM_filter_cubic_clamp = Extension(name='VK_QCOM_filter_cubic_clamp', version=1, guard=None, commands=[ +]) + VK_EXT_attachment_feedback_loop_dynamic_state = Extension(name='VK_EXT_attachment_feedback_loop_dynamic_state', version=1, guard=None, commands=[ Command(name='vkCmdSetAttachmentFeedbackLoopEnableEXT', dispatch='VkCommandBuffer'), ]) +VK_MSFT_layered_driver = Extension(name='VK_MSFT_layered_driver', version=1, guard=None, commands=[ +]) + +VK_NV_descriptor_pool_overallocation = Extension(name='VK_NV_descriptor_pool_overallocation', version=1, guard=None, commands=[ +]) + VK_KHR_acceleration_structure = Extension(name='VK_KHR_acceleration_structure', version=13, guard=None, commands=[ Command(name='vkCreateAccelerationStructureKHR', dispatch='VkDevice'), Command(name='vkDestroyAccelerationStructureKHR', dispatch='VkDevice'), @@ -1598,6 +1653,9 @@ def __repr__(self): Command(name='vkGetMemoryAndroidHardwareBufferANDROID', dispatch='VkDevice'), ]) +VK_ANDROID_external_format_resolve = Extension(name='VK_ANDROID_external_format_resolve', version=1, guard='VK_USE_PLATFORM_ANDROID_KHR', commands=[ +]) + VK_FUCHSIA_imagepipe_surface = Extension(name='VK_FUCHSIA_imagepipe_surface', version=1, guard='VK_USE_PLATFORM_FUCHSIA', commands=[ Command(name='vkCreateImagePipeSurfaceFUCHSIA', dispatch='VkInstance'), ]) @@ -1726,19 +1784,29 @@ def __repr__(self): VK_KHR_portability_subset = Extension(name='VK_KHR_portability_subset', version=1, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) -VK_KHR_video_encode_queue = Extension(name='VK_KHR_video_encode_queue', version=9, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_KHR_video_encode_queue = Extension(name='VK_KHR_video_encode_queue', version=10, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ Command(name='vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR', dispatch='VkPhysicalDevice'), Command(name='vkGetEncodedVideoSessionParametersKHR', dispatch='VkDevice'), Command(name='vkCmdEncodeVideoKHR', dispatch='VkCommandBuffer'), ]) -VK_EXT_video_encode_h264 = Extension(name='VK_EXT_video_encode_h264', version=11, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_EXT_video_encode_h264 = Extension(name='VK_EXT_video_encode_h264', version=12, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +]) + +VK_EXT_video_encode_h265 = Extension(name='VK_EXT_video_encode_h265', version=12, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) -VK_EXT_video_encode_h265 = Extension(name='VK_EXT_video_encode_h265', version=11, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_AMDX_shader_enqueue = Extension(name='VK_AMDX_shader_enqueue', version=1, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ + Command(name='vkCreateExecutionGraphPipelinesAMDX', dispatch='VkDevice'), + Command(name='vkGetExecutionGraphPipelineScratchSizeAMDX', dispatch='VkDevice'), + Command(name='vkGetExecutionGraphPipelineNodeIndexAMDX', dispatch='VkDevice'), + Command(name='vkCmdInitializeGraphScratchMemoryAMDX', dispatch='VkCommandBuffer'), + Command(name='vkCmdDispatchGraphAMDX', dispatch='VkCommandBuffer'), + Command(name='vkCmdDispatchGraphIndirectAMDX', dispatch='VkCommandBuffer'), + Command(name='vkCmdDispatchGraphIndirectCountAMDX', dispatch='VkCommandBuffer'), ]) -VK_NV_displacement_micromap = Extension(name='VK_NV_displacement_micromap', version=1, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_NV_displacement_micromap = Extension(name='VK_NV_displacement_micromap', version=2, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) extensions = [ @@ -1829,6 +1897,7 @@ def __repr__(self): VK_KHR_ray_tracing_maintenance1, VK_KHR_portability_enumeration, VK_KHR_maintenance4, + VK_KHR_maintenance5, VK_KHR_ray_tracing_position_fetch, VK_KHR_cooperative_matrix, VK_EXT_debug_report, @@ -1948,6 +2017,7 @@ def __repr__(self): VK_EXT_host_query_reset, VK_EXT_index_type_uint8, VK_EXT_extended_dynamic_state, + VK_EXT_host_image_copy, VK_EXT_shader_atomic_float2, VK_EXT_surface_maintenance1, VK_EXT_swapchain_maintenance1, @@ -1993,6 +2063,7 @@ def __repr__(self): VK_HUAWEI_invocation_mask, VK_NV_external_memory_rdma, VK_EXT_pipeline_properties, + VK_EXT_frame_boundary, VK_EXT_multisampled_render_to_single_sampled, VK_EXT_extended_dynamic_state2, VK_EXT_color_write_enable, @@ -2015,10 +2086,12 @@ def __repr__(self): VK_QCOM_fragment_density_map_offset, VK_NV_copy_memory_indirect, VK_NV_memory_decompression, + VK_NV_device_generated_commands_compute, VK_NV_linear_color_attachment, VK_GOOGLE_surfaceless_query, VK_EXT_image_compression_control_swapchain, VK_QCOM_image_processing, + VK_EXT_nested_command_buffer, VK_EXT_external_memory_acquire_unmodified, VK_EXT_extended_dynamic_state3, VK_EXT_subpass_merge_feedback, @@ -2033,18 +2106,27 @@ def __repr__(self): VK_SEC_amigo_profiling, VK_QCOM_multiview_per_view_viewports, VK_NV_ray_tracing_invocation_reorder, + VK_NV_extended_sparse_address_space, VK_EXT_mutable_descriptor_type, VK_ARM_shader_core_builtins, VK_EXT_pipeline_library_group_handles, VK_EXT_dynamic_rendering_unused_attachments, + VK_NV_low_latency2, VK_QCOM_multiview_per_view_render_areas, + VK_QCOM_image_processing2, + VK_QCOM_filter_cubic_weights, + VK_QCOM_ycbcr_degamma, + VK_QCOM_filter_cubic_clamp, VK_EXT_attachment_feedback_loop_dynamic_state, + VK_MSFT_layered_driver, + VK_NV_descriptor_pool_overallocation, VK_KHR_acceleration_structure, VK_KHR_ray_tracing_pipeline, VK_KHR_ray_query, VK_EXT_mesh_shader, VK_KHR_android_surface, VK_ANDROID_external_memory_android_hardware_buffer, + VK_ANDROID_external_format_resolve, VK_FUCHSIA_imagepipe_surface, VK_FUCHSIA_external_memory, VK_FUCHSIA_external_semaphore, @@ -2076,6 +2158,7 @@ def __repr__(self): VK_KHR_video_encode_queue, VK_EXT_video_encode_h264, VK_EXT_video_encode_h265, + VK_AMDX_shader_enqueue, VK_NV_displacement_micromap, ] # end of generated code diff --git a/build-gn/DEPS b/scripts/gn/DEPS similarity index 100% rename from build-gn/DEPS rename to scripts/gn/DEPS diff --git a/build-gn/generate_vulkan_layers_json.py b/scripts/gn/generate_vulkan_icd_json.py similarity index 83% rename from build-gn/generate_vulkan_layers_json.py rename to scripts/gn/generate_vulkan_icd_json.py index 398fb732b..c0dbd747c 100755 --- a/build-gn/generate_vulkan_layers_json.py +++ b/scripts/gn/generate_vulkan_icd_json.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +# Copyright (c) 2022-2023 LunarG, Inc. # Copyright (C) 2016 The ANGLE Project Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,18 +27,19 @@ import platform import sys - def glob_slash(dirname): """Like regular glob but replaces \ with / in returned paths.""" return [s.replace('\\', '/') for s in glob.glob(dirname)] - def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--icd', action='store_true') + parser.add_argument('--no-path-prefix', action='store_true') + parser.add_argument('--platform', type=str, default=platform.system(), + help='Target platform to build validation layers for: ' + 'Linux|Darwin|Windows|Fuchsia|...') parser.add_argument('source_dir') parser.add_argument('target_dir') - parser.add_argument('version_header', help='path to vulkan_core.h') parser.add_argument('json_files', nargs='*') args = parser.parse_args() @@ -85,25 +87,17 @@ def main(): with open(target_fname, 'w') as outfile: json.dump(data, outfile) - # Get the Vulkan version from the vulkan_core.h file - vk_header_filename = args.version_header - vk_version = None - with open(vk_header_filename) as vk_header_file: - for line in vk_header_file: - if line.startswith('#define VK_HEADER_VERSION'): - vk_version = line.split()[-1] - break - if not vk_version: - print('failed to extract vk_version', file=sys.stderr) - return 1 - # Set json file prefix and suffix for generating files, default to Linux. - relative_path_prefix = '../lib' - file_type_suffix = '.so' - if platform.system() == 'Windows': + if args.no_path_prefix: + relative_path_prefix = '' + elif args.platform == 'Windows': relative_path_prefix = r'..\\' # json-escaped, hence two backslashes. + else: + relative_path_prefix = '../lib' + file_type_suffix = '.so' + if args.platform == 'Windows': file_type_suffix = '.dll' - elif platform.system() == 'Darwin': + elif args.platform == 'Darwin': file_type_suffix = '.dylib' # For each *.json.in template files in source dir generate actual json file @@ -124,9 +118,7 @@ def main(): with open(json_out_fname,'w') as json_out_file, \ open(json_in_name) as infile: for line in infile: - line = line.replace('@RELATIVE_LAYER_BINARY@', - relative_path_prefix + layer_lib_name) - line = line.replace('@VK_VERSION@', '1.1.' + vk_version) + line = line.replace('@JSON_LIBRARY_PATH@', relative_path_prefix + layer_lib_name) json_out_file.write(line) if __name__ == '__main__': diff --git a/scripts/gn/gn.py b/scripts/gn/gn.py new file mode 100755 index 000000000..52b20c580 --- /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/secondary/build_overrides/build.gni b/scripts/gn/secondary/build_overrides/build.gni similarity index 94% rename from build-gn/secondary/build_overrides/build.gni rename to scripts/gn/secondary/build_overrides/build.gni index c6c11fa9b..dbf470393 100644 --- a/build-gn/secondary/build_overrides/build.gni +++ b/scripts/gn/secondary/build_overrides/build.gni @@ -1,4 +1,4 @@ -# 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. diff --git a/build-gn/secondary/build_overrides/vulkan_headers.gni b/scripts/gn/secondary/build_overrides/vulkan_headers.gni similarity index 93% rename from build-gn/secondary/build_overrides/vulkan_headers.gni rename to scripts/gn/secondary/build_overrides/vulkan_headers.gni index 0cd8307dc..5f24b39ee 100644 --- a/build-gn/secondary/build_overrides/vulkan_headers.gni +++ b/scripts/gn/secondary/build_overrides/vulkan_headers.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2020 LunarG, Inc. +# Copyright (c) 2020-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. diff --git a/build-gn/secondary/build_overrides/vulkan_tools.gni b/scripts/gn/secondary/build_overrides/vulkan_tools.gni similarity index 94% rename from build-gn/secondary/build_overrides/vulkan_tools.gni rename to scripts/gn/secondary/build_overrides/vulkan_tools.gni index 9f8084609..c62fb64de 100644 --- a/build-gn/secondary/build_overrides/vulkan_tools.gni +++ b/scripts/gn/secondary/build_overrides/vulkan_tools.gni @@ -1,4 +1,4 @@ -# 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. diff --git a/build-gn/update_deps.sh b/scripts/gn/update_deps.sh similarity index 69% rename from build-gn/update_deps.sh rename to scripts/gn/update_deps.sh index 41da2ab31..763c30586 100755 --- 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-Tools", - "deps_file" : "build-gn/DEPS", + "deps_file" : "scripts/gn/DEPS", "managed" : False, "custom_deps" : { }, diff --git a/scripts/known_good.json b/scripts/known_good.json index e6e4fd08f..f2d88ddfd 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.257" + "commit": "v1.3.268" }, { "name": "Vulkan-Headers", @@ -20,7 +20,22 @@ "-DVULKANSC=ON", "-DGEN_VULKANSC_COMBINED=ON" ], - "commit": "vksc1.0.13" + "commit": "sc_next" + }, + { + "name": "Vulkan-Utility-Libraries", + "api": "vulkansc", + "url": "https://github.com/KhronosGroup/VulkanSC-Utility-Libraries.git", + "sub_dir": "Vulkan-Utility-Libraries", + "build_dir": "Vulkan-Utility-Libraries/build", + "install_dir": "Vulkan-Utility-Libraries/build/install", + "commit": "sc_next", + "deps": [ + { + "var_name": "VULKAN_HEADERS_INSTALL_DIR", + "repo_name": "Vulkan-Headers" + } + ] }, { "name": "MoltenVK", @@ -28,7 +43,7 @@ "sub_dir": "MoltenVK", "build_dir": "MoltenVK", "install_dir": "MoltenVK", - "commit": "v1.2.4", + "commit": "v1.2.5", "custom_build": [ "./fetchDependencies --macos --no-parallel-build", "xcodebuild -project MoltenVKPackaging.xcodeproj GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS MVK_CONFIG_LOG_LEVEL=1' -scheme \"MoltenVK Package (macOS only)\" build" @@ -45,16 +60,20 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.257", + "cmake_options": [ + "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" + ], + "commit": "v1.3.268", + "build_platforms": [ + "windows", + "linux", + "darwin" + ], "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", "repo_name": "Vulkan-Headers" } - ], - "build_platforms": [ - "linux", - "darwin" ] }, { @@ -67,7 +86,7 @@ "cmake_options": [ "-DVULKANSC=ON" ], - "commit": "vksc1.0.13", + "commit": "sc_next", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", @@ -90,7 +109,7 @@ "-Dgtest_force_shared_crt=ON", "-DBUILD_SHARED_LIBS=OFF" ], - "commit": "v1.13.0", + "commit": "v1.14.0", "optional": [ "tests" ] @@ -120,36 +139,15 @@ "build_dir": "valijson/build", "install_dir": "valijson/build/install", "commit": "v1.0" - }, - { - "name": "Vulkan-ValidationLayers", - "api": "vulkansc", - "url": "https://github.com/KhronosGroup/VulkanSC-ValidationLayers.git", - "sub_dir": "Vulkan-ValidationLayers", - "build_dir": "Vulkan-ValidationLayers/build", - "install_dir": "Vulkan-ValidationLayers/build/install", - "commit": "vksc1.0.13", - "deps": [ - { - "var_name": "VULKAN_HEADERS_INSTALL_DIR", - "repo_name": "Vulkan-Headers" - } - ], - "cmake_options": [ - "-DVULKANSC=ON", - "-DBUILD_LAYERS=OFF", - "-DBUILD_LAYER_SUPPORT_FILES=ON", - "-DUSE_ROBIN_HOOD_HASHING=OFF" - ] } ], "install_names": { "Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR", + "Vulkan-Utility-Libraries": "VULKAN_UTILITY_LIBRARIES_INSTALL_DIR", "Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR", "MoltenVK": "MOLTENVK_REPO_ROOT", "googletest": "GOOGLETEST_INSTALL_DIR", "jsoncpp": "JSONCPP_INSTALL_DIR", - "valijson": "VALIJSON_INSTALL_DIR", - "Vulkan-ValidationLayers": "VULKAN_VALIDATIONLAYERS_INSTALL_DIR" + "valijson": "VALIJSON_INSTALL_DIR" } -} +} \ No newline at end of file diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index f0100e951..6ffd41021 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -300,6 +300,18 @@ ''', 'vkGetPhysicalDeviceSurfaceCapabilities2KHR': ''' GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, pSurfaceInfo->surface, &pSurfaceCapabilities->surfaceCapabilities); + + auto *present_mode_compatibility = lvl_find_mod_in_chain(pSurfaceCapabilities->pNext); + if (present_mode_compatibility) { + if (!present_mode_compatibility->pPresentModes) { + present_mode_compatibility->presentModeCount = 3; + } else { + // arbitrary + present_mode_compatibility->pPresentModes[0] = VK_PRESENT_MODE_IMMEDIATE_KHR; + present_mode_compatibility->pPresentModes[1] = VK_PRESENT_MODE_FIFO_KHR; + present_mode_compatibility->pPresentModes[2] = VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR; + } + } return VK_SUCCESS; ''', 'vkGetInstanceProcAddr': ''' @@ -387,6 +399,11 @@ feat_bools = (VkBool32*)&blendop_features->advancedBlendCoherentOperations; SetBoolArrayTrue(feat_bools, num_bools); } + const auto *host_image_copy_features = lvl_find_in_chain(pFeatures->pNext); + if (host_image_copy_features) { + feat_bools = (VkBool32*)&host_image_copy_features->hostImageCopy; + SetBoolArrayTrue(feat_bools, 1); + } ''', 'vkGetPhysicalDeviceFormatProperties': ''' if (VK_FORMAT_UNDEFINED == format) { @@ -417,6 +434,7 @@ props_3->linearTilingFeatures = pFormatProperties->formatProperties.linearTilingFeatures; props_3->optimalTilingFeatures = pFormatProperties->formatProperties.optimalTilingFeatures; props_3->bufferFeatures = pFormatProperties->formatProperties.bufferFeatures; + props_3->optimalTilingFeatures |= VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; } ''', 'vkGetPhysicalDeviceImageFormatProperties': ''' @@ -436,6 +454,14 @@ return VK_SUCCESS; ''', 'vkGetPhysicalDeviceImageFormatProperties2KHR': ''' + auto *external_image_prop = lvl_find_mod_in_chain(pImageFormatProperties->pNext); + auto *external_image_format = lvl_find_in_chain(pImageFormatInfo->pNext); + if (external_image_prop && external_image_format && external_image_format->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + external_image_prop->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + } + GetPhysicalDeviceImageFormatProperties(physicalDevice, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, pImageFormatInfo->usage, pImageFormatInfo->flags, &pImageFormatProperties->imageFormatProperties); return VK_SUCCESS; ''', @@ -575,6 +601,43 @@ fragment_density_map2_props->maxSubsampledArrayLayers = 2; fragment_density_map2_props->maxDescriptorSetSubsampledSamplers = 1; } + + const uint32_t num_copy_layouts = 5; + const VkImageLayout HostCopyLayouts[]{ + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_GENERAL, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, + }; + + auto *host_image_copy_props = lvl_find_mod_in_chain(pProperties->pNext); + if (host_image_copy_props){ + if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copyDstLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopyDstLayouts[i] = HostCopyLayouts[i]; + } + } + if (host_image_copy_props->pCopySrcLayouts == nullptr) host_image_copy_props->copySrcLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copySrcLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopySrcLayouts[i] = HostCopyLayouts[i]; + } + } + } + + auto *driver_properties = lvl_find_mod_in_chain(pProperties->pNext); + if (driver_properties) { + std::strncpy(driver_properties->driverName, "Vulkan Mock Device", VK_MAX_DRIVER_NAME_SIZE); +#if defined(GIT_BRANCH_NAME) && defined(GIT_TAG_INFO) + std::strncpy(driver_properties->driverInfo, "Branch: " GIT_BRANCH_NAME " Tag Info: " GIT_TAG_INFO, VK_MAX_DRIVER_INFO_SIZE); +#else + std::strncpy(driver_properties->driverInfo, "Branch: --unknown-- Tag Info: --unknown--", VK_MAX_DRIVER_INFO_SIZE); +#endif + } ''', 'vkGetPhysicalDeviceExternalSemaphoreProperties':''' // Hard code support for all handle types and features @@ -596,7 +659,12 @@ ''', 'vkGetPhysicalDeviceExternalBufferProperties':''' constexpr VkExternalMemoryHandleTypeFlags supported_flags = 0x1FF; - if (pExternalBufferInfo->handleType & supported_flags) { + if (pExternalBufferInfo->handleType & VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + // Can't have dedicated memory with AHB + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = pExternalBufferInfo->handleType; + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType; + } else if (pExternalBufferInfo->handleType & supported_flags) { pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7; pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = supported_flags; pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = supported_flags; @@ -923,7 +991,7 @@ ''', 'vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR': ''' if (!pProperties) { - *pPropertyCount = 1; + *pPropertyCount = 2; } else { // arbitrary pProperties[0].MSize = 16; @@ -934,7 +1002,10 @@ pProperties[0].CType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].ResultType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].saturatingAccumulation = VK_FALSE; - pProperties[0].scope = VK_SCOPE_DEVICE_KHR; + pProperties[0].scope = VK_SCOPE_SUBGROUP_KHR; + + pProperties[1] = pProperties[0]; + pProperties[1].scope = VK_SCOPE_DEVICE_KHR; } return VK_SUCCESS; ''', @@ -985,6 +1056,23 @@ pGranularity->width = 1; pGranularity->height = 1; ''', +'vkGetAndroidHardwareBufferPropertiesANDROID': ''' + pProperties->allocationSize = 65536; + pProperties->memoryTypeBits = 1 << 5; // DEVICE_LOCAL only type + + auto *format_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_prop) { + // Likley using this format + format_prop->format = VK_FORMAT_R8G8B8A8_UNORM; + format_prop->externalFormat = 37; + } + + auto *format_resolve_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_resolve_prop) { + format_resolve_prop->colorAttachmentFormat = VK_FORMAT_R8G8B8A8_UNORM; + } + return VK_SUCCESS; +''', } CUSTOM_VKSC_INTERCEPT_RENAMES = { @@ -1173,6 +1261,19 @@ custom_border_color_props->maxCustomBorderColorSamplers = 32; } ''', +'vkGetPhysicalDeviceFormatProperties2': ''' + GetPhysicalDeviceFormatProperties(physicalDevice, format, &pFormatProperties->formatProperties); + VkFormatProperties3KHR *props_3 = lvl_find_mod_in_chain(pFormatProperties->pNext); + if (props_3) { + props_3->linearTilingFeatures = pFormatProperties->formatProperties.linearTilingFeatures; + props_3->optimalTilingFeatures = pFormatProperties->formatProperties.optimalTilingFeatures; + props_3->bufferFeatures = pFormatProperties->formatProperties.bufferFeatures; + } +''', +'vkGetPhysicalDeviceImageFormatProperties2': ''' + GetPhysicalDeviceImageFormatProperties(physicalDevice, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, pImageFormatInfo->usage, pImageFormatInfo->flags, &pImageFormatProperties->imageFormatProperties); + return VK_SUCCESS; +''', 'vkGetPhysicalDeviceQueueFamilyProperties2': ''' if (pQueueFamilyProperties) { if (*pQueueFamilyPropertyCount >= 1) { @@ -1201,6 +1302,25 @@ GetPhysicalDeviceQueueFamilyProperties2(physicalDevice, pQueueFamilyPropertyCount, nullptr); } ''', +'vkGetPhysicalDeviceExternalBufferProperties':''' + constexpr VkExternalMemoryHandleTypeFlags supported_flags = 0x1FF; + if (pExternalBufferInfo->handleType & supported_flags) { + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = supported_flags; + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = supported_flags; + } else { + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = 0; + // According to spec, handle type is always compatible with itself. Even if export/import + // not supported, it's important to properly implement self-compatibility property since + // application's control flow can rely on this. + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType; + } +''', +'vkGetPhysicalDeviceSurfaceCapabilities2KHR': ''' + GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, pSurfaceInfo->surface, &pSurfaceCapabilities->surfaceCapabilities); + return VK_SUCCESS; +''', } # MockICDGeneratorOptions - subclass of GeneratorOptions. @@ -1420,6 +1540,7 @@ def beginFile(self, genOpts): break write('#pragma once\n',file=self.outFile) write('#include ',file=self.outFile) + write('#include ',file=self.outFile) write('#include ',file=self.outFile) write('#include ',file=self.outFile) write('#include ',file=self.outFile) diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 37ca830b3..2062115d1 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -81,7 +81,8 @@ # used in the .cpp code structures_to_gen = ['VkExtent3D', 'VkExtent2D', 'VkPhysicalDeviceLimits', 'VkPhysicalDeviceFeatures', 'VkPhysicalDeviceSparseProperties', - 'VkSurfaceCapabilitiesKHR', 'VkSurfaceFormatKHR', 'VkLayerProperties', 'VkPhysicalDeviceToolProperties', 'VkFormatProperties'] + 'VkSurfaceCapabilitiesKHR', 'VkSurfaceFormatKHR', 'VkLayerProperties', 'VkPhysicalDeviceToolProperties', 'VkFormatProperties', + 'VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT', 'VkPhysicalDeviceHostImageCopyPropertiesEXT'] enums_to_gen = ['VkResult', 'VkFormat', 'VkPresentModeKHR', 'VkPhysicalDeviceType', 'VkImageTiling'] flags_to_gen = ['VkSurfaceTransformFlagsKHR', 'VkCompositeAlphaFlagsKHR', 'VkSurfaceCounterFlagsEXT', 'VkQueueFlags', @@ -110,12 +111,38 @@ # Types that need pNext Chains built. 'extends' is the xml tag used in the structextends member. 'type' can be device, instance, or both EXTENSION_CATEGORIES = OrderedDict(( - ('phys_device_props2', {'extends': 'VkPhysicalDeviceProperties2', 'type': EXTENSION_TYPE_BOTH, 'holder_type': 'VkPhysicalDeviceProperties2', 'print_iterator': True}), - ('phys_device_mem_props2', {'extends': 'VkPhysicalDeviceMemoryProperties2', 'type': EXTENSION_TYPE_DEVICE, 'holder_type':'VkPhysicalDeviceMemoryProperties2', 'print_iterator': False}), - ('phys_device_features2', {'extends': 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo', 'type': EXTENSION_TYPE_DEVICE, 'holder_type': 'VkPhysicalDeviceFeatures2', 'print_iterator': True}), - ('surface_capabilities2', {'extends': 'VkSurfaceCapabilities2KHR', 'type': EXTENSION_TYPE_BOTH, 'holder_type': 'VkSurfaceCapabilities2KHR', 'print_iterator': True}), - ('format_properties2', {'extends': 'VkFormatProperties2', 'type': EXTENSION_TYPE_DEVICE, 'holder_type':'VkFormatProperties2', 'print_iterator': True}), - ('queue_properties2', {'extends': 'VkQueueFamilyProperties2', 'type': EXTENSION_TYPE_DEVICE, 'holder_type': 'VkQueueFamilyProperties2', 'print_iterator': True}) + ('phys_device_props2', + {'extends': 'VkPhysicalDeviceProperties2', + 'type': EXTENSION_TYPE_BOTH, + 'holder_type': 'VkPhysicalDeviceProperties2', + 'print_iterator': True, + 'exclude': ['VkPhysicalDeviceHostImageCopyPropertiesEXT']}), + ('phys_device_mem_props2', + {'extends': 'VkPhysicalDeviceMemoryProperties2', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type':'VkPhysicalDeviceMemoryProperties2', + 'print_iterator': False}), + ('phys_device_features2', + {'extends': 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type': 'VkPhysicalDeviceFeatures2', + 'print_iterator': True}), + ('surface_capabilities2', + {'extends': 'VkSurfaceCapabilities2KHR', + 'type': EXTENSION_TYPE_BOTH, + 'holder_type': 'VkSurfaceCapabilities2KHR', + 'print_iterator': True, + 'exclude': ['VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT']}), + ('format_properties2', + {'extends': 'VkFormatProperties2', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type':'VkFormatProperties2', + 'print_iterator': True}), + ('queue_properties2', + {'extends': 'VkQueueFamilyProperties2', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type': 'VkQueueFamilyProperties2', + 'print_iterator': True}) )) class VulkanInfoGeneratorOptions(GeneratorOptions): def __init__(self, @@ -243,9 +270,9 @@ def endFile(self): types_to_gen.update( GatherTypesToGen(self.all_structures, structures_to_gen)) - for key in EXTENSION_CATEGORIES.keys(): + for key, info in EXTENSION_CATEGORIES.items(): types_to_gen.update( - GatherTypesToGen(self.all_structures, self.extension_sets[key])) + GatherTypesToGen(self.all_structures, self.extension_sets[key], info.get('exclude'))) types_to_gen = sorted(types_to_gen) names_of_structures_to_gen = set() @@ -365,10 +392,13 @@ def genType(self, typeinfo, name, alias): for key, value in EXTENSION_CATEGORIES.items(): if str(typeinfo.elem.get('structextends')).find(value.get('extends')) != -1: - self.extension_sets[key].add(name) + if value.get('exclude') is None or name not in value.get('exclude'): + self.extension_sets[key].add(name) -def GatherTypesToGen(structure_list, structures): +def GatherTypesToGen(structure_list, structures, exclude = []): + if exclude == None: + exclude = [] types = set() for s in structures: types.add(s) @@ -380,8 +410,9 @@ def GatherTypesToGen(structure_list, structures): for m in s.members: if m.typeID not in predefined_types and m.name not in names_to_ignore: if m.typeID not in types: - types.add(m.typeID) - added_stuff = True + if s.name not in exclude: + types.add(m.typeID) + added_stuff = True return types @@ -567,15 +598,20 @@ def PrintStructure(struct, types_to_gen, structure_names, aliases): out += f' for (uint32_t i = 0; i < {v.arrayLength}; i++) {{ p.PrintElement(obj.{v.name}[i]); }}\n' out += f" }}\n" else: # dynamic array length based on other member - out += f' ArrayWrapper arr(p,"{v.name}", obj.' + v.arrayLength + ');\n' - out += f" for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n" + out += f" {{\n" + out += f' ArrayWrapper arr(p,"{v.name}", obj.' + v.arrayLength + ');\n' + out += f" for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n" if v.typeID in types_to_gen: - out += f" if (obj.{v.name} != nullptr) {{\n" - out += f" p.SetElementIndex(i);\n" - out += f' Dump{v.typeID}(p, "{v.name}", obj.{v.name}[i]);\n' - out += f" }}\n" + out += f' if (obj.{v.name} != nullptr) {{\n' + out += f' p.SetElementIndex(i);\n' + out += ' if (p.Type() == OutputType::json)\n' + out += f' p.PrintString(std::string("VK_") + {v.typeID}String(obj.{v.name}[i]));\n' + out += ' else\n' + out += f' p.PrintString({v.typeID}String(obj.{v.name}[i]));\n' + out += f' }}\n' else: - out += f" p.PrintElement(obj.{v.name}[i]);\n" + out += f" p.PrintElement(obj.{v.name}[i]);\n" + out += f" }}\n" out += f" }}\n" elif v.typeID == "VkBool32": out += f' p.PrintKeyBool("{v.name}", static_cast(obj.{v.name}));\n' @@ -642,13 +678,13 @@ def PrintChainStruct(listName, structures, all_structures, chain_details): out += AddGuardHeader(s) if s.sTypeName is not None: out += f" {s.name} {s.name[2:]}{{}};\n" - # Specific versions of drivers have an incorrect definition of the size of this struct. + # Specific versions of drivers have an incorrect definition of the size of these structs. # We need to artificially pad the structure it just so the driver doesn't write out of bounds and # into other structures that are adjacent. This bug comes from the in-development version of # the extension having a larger size than the final version, so older drivers try to write to # members which don't exist. - if s.sTypeName == "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES": - out += " char padding[64];\n" + if s.name in ['VkPhysicalDeviceShaderIntegerDotProductFeatures', 'VkPhysicalDeviceHostImageCopyFeaturesEXT']: + out += f" char {s.name}_padding[64];\n" out += AddGuardFooter(s) out += f" void initialize_chain() noexcept {{\n" for s in structs_to_print: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3a798772d..8f7125ac8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,10 +16,23 @@ # ~~~ if (VULKANSC) - add_subdirectory(vulkansc) return() # Return early endif() +if (ANDROID) + + # Ensure ANativeActivity_onCreate is being exported from vkcube + find_program(GNU_NM NAMES nm) + if (GNU_NM) + add_test(NAME ANativeActivity_onCreate COMMAND ${GNU_NM} --dynamic $) + set_tests_properties(ANativeActivity_onCreate + PROPERTIES PASS_REGULAR_EXPRESSION "T ANativeActivity_onCreate" + ) + endif() + + return() +endif() + # setup binary_locations_$.h.in using binary_locations.h.in as a source file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/binary_locations_$.h" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/binary_locations.h.in") @@ -40,19 +53,34 @@ find_package(GTest REQUIRED CONFIG QUIET) add_executable(vulkan_tools_tests) target_sources(vulkan_tools_tests PRIVATE main.cpp + test_common.h icd/mock_icd_tests.cpp ) get_target_property(TEST_SOURCES vulkan_tools_tests SOURCES) source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${TEST_SOURCES}) -target_include_directories(vulkan_tools_tests PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(vulkan_tools_tests GTest::gtest Vulkan::Vulkan) +target_include_directories(vulkan_tools_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(vulkan_tools_tests GTest::gtest Vulkan::Headers Vulkan::Loader) add_dependencies(vulkan_tools_tests generate_binary_locations) +if (WIN32) + target_compile_definitions(vulkan_tools_tests PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -DNOMINMAX) +endif() +set_target_properties(vulkan_tools_tests PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + +if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO) + target_compile_definitions(vulkan_tools_tests PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}") +endif() if (ENABLE_ADDRESS_SANITIZER) target_compile_options(vulkan_tools_tests PUBLIC -fsanitize=address) target_link_options(vulkan_tools_tests PUBLIC -fsanitize=address) endif () +if (WIN32) + # Copy the loader shared lib (if built) to the test application directory so the test app finds it. + add_custom_command(TARGET vulkan_tools_tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $) +endif() + include(GoogleTest) gtest_discover_tests(vulkan_tools_tests DISCOVERY_TIMEOUT 100) diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..0e0798e75 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,34 @@ +## Android + +### Running vkcube on Android + +```sh +cd Vulkan-Tools + +cd build-android + +# Optional +adb uninstall com.example.VkCube + +adb install -r -g --no-incremental bin/VkCube.apk + +adb shell am start com.example.VkCube/android.app.NativeActivity +``` + +### vulkaninfo on Android + +Unlike `vkcube`, `vulkaninfo` doesn't require the extra step of creating an `APK`. + +So the following should be enough. + +```sh +cd Vulkan-Tools + +scripts/android.py --config Release --app-abi arm64-v8a --app-stl c++_static --clean + +adb push build-android/cmake/arm64-v8a/vulkaninfo/vulkaninfo /data/local/tmp + +adb shell /data/local/tmp/vulkaninfo --json --output /data/local/tmp/foobar.json + +adb pull /data/local/tmp/foobar.json +``` diff --git a/tests/icd/mock_icd_tests.cpp b/tests/icd/mock_icd_tests.cpp index 4605658c6..cad067a3d 100644 --- a/tests/icd/mock_icd_tests.cpp +++ b/tests/icd/mock_icd_tests.cpp @@ -17,25 +17,7 @@ * */ -#include - -#include -#include -#include - -#include "gtest/gtest.h" -#include "vulkan/vulkan.h" - -// Location of the built binaries in this repo -#include "binary_locations.h" - -#if defined(WIN32) -#define WIN32_LEAN_AND_MEAN -#include -int set_environment_var(const char* name, const char* value) { return SetEnvironmentVariable(name, value); } -#else -int set_environment_var(const char* name, const char* value) { return setenv(name, value, 1); } -#endif +#include "test_common.h" void setup_mock_icd_env_vars() { // Necessary to point the loader at the mock driver @@ -256,7 +238,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfacePresentModesKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); uint32_t count = 0; std::array present_modes{}; res = vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &count, nullptr); @@ -278,7 +260,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceFormatsKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); uint32_t count = 0; std::array surface_formats{}; res = vkGetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &count, nullptr); @@ -298,7 +280,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceFormats2KHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); uint32_t count = 0; std::array surface_formats2{}; VkPhysicalDeviceSurfaceInfo2KHR surface_info{}; @@ -322,7 +304,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceSupportKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkBool32 supported = false; res = vkGetPhysicalDeviceSurfaceSupportKHR(physical_device, 0, surface, &supported); ASSERT_EQ(res, VK_SUCCESS); @@ -335,7 +317,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceCapabilitiesKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkSurfaceCapabilitiesKHR surface_capabilities{}; res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, surface, &surface_capabilities); ASSERT_EQ(res, VK_SUCCESS); @@ -354,7 +336,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceCapabilities2KHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkSurfaceCapabilities2KHR surface_capabilities2{}; VkPhysicalDeviceSurfaceInfo2KHR surface_info{}; surface_info.surface = surface; @@ -441,6 +423,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceFormatProperties2) { VkFormatProperties3 format_properties3{}; format_properties3.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3; VkFormatProperties2 format_properties2{}; + format_properties2.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2; format_properties2.pNext = static_cast(&format_properties3); vkGetPhysicalDeviceFormatProperties2(physical_device, VK_FORMAT_R8G8B8A8_SRGB, &format_properties2); ASSERT_EQ(format_properties2.formatProperties.bufferFeatures, 0x00FFFDFF); @@ -448,7 +431,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceFormatProperties2) { ASSERT_EQ(format_properties2.formatProperties.optimalTilingFeatures, 0x00FFFDFF); ASSERT_EQ(format_properties3.bufferFeatures, 0x00FFFDFF); ASSERT_EQ(format_properties3.linearTilingFeatures, 0x00FFFDFF); - ASSERT_EQ(format_properties3.optimalTilingFeatures, 0x00FFFDFF); + ASSERT_EQ(format_properties3.optimalTilingFeatures, 0x400000FFFDFF); } TEST_F(MockICD, vkGetPhysicalDeviceImageFormatProperties) { @@ -586,8 +569,12 @@ TEST_F(MockICD, vkGetPhysicalDeviceProperties2) { fragment_density_map2_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT; fragment_density_map2_properties.pNext = static_cast(&mesh_shader_properties); + VkPhysicalDeviceDriverProperties driver_properties{}; + driver_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; + driver_properties.pNext = static_cast(&fragment_density_map2_properties); + VkPhysicalDeviceProperties2 properties2{}; - properties2.pNext = static_cast(&fragment_density_map2_properties); + properties2.pNext = static_cast(&driver_properties); vkGetPhysicalDeviceProperties2(physical_device, &properties2); ASSERT_EQ(properties2.properties.apiVersion, VK_HEADER_VERSION_COMPLETE); ASSERT_EQ(properties2.properties.driverVersion, 1); @@ -641,6 +628,8 @@ TEST_F(MockICD, vkGetPhysicalDeviceProperties2) { ASSERT_EQ(fragment_density_map2_properties.subsampledCoarseReconstructionEarlyAccess, VK_FALSE); ASSERT_EQ(fragment_density_map2_properties.maxSubsampledArrayLayers, 2); ASSERT_EQ(fragment_density_map2_properties.maxDescriptorSetSubsampledSamplers, 1); + ASSERT_EQ(std::string(driver_properties.driverName), "Vulkan Mock Device"); + ASSERT_EQ(std::string(driver_properties.driverInfo), "Branch: " GIT_BRANCH_NAME " Tag Info: " GIT_TAG_INFO); } TEST_F(MockICD, vkGetPhysicalDeviceExternalSemaphoreProperties) { @@ -898,7 +887,7 @@ TEST_F(MockICD, SwapchainLifeCycle) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkSwapchainCreateInfoKHR swapchain_create_info{}; swapchain_create_info.surface = surface; @@ -906,7 +895,7 @@ TEST_F(MockICD, SwapchainLifeCycle) { VkSwapchainKHR swapchain{}; res = vkCreateSwapchainKHR(device, &swapchain_create_info, nullptr, &swapchain); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(swapchain, nullptr); + ASSERT_NE(swapchain, VK_NULL_HANDLE); uint32_t count = 0; res = vkGetSwapchainImagesKHR(device, swapchain, &count, nullptr); @@ -915,7 +904,7 @@ TEST_F(MockICD, SwapchainLifeCycle) { std::array swapchain_images; res = vkGetSwapchainImagesKHR(device, swapchain, &count, swapchain_images.data()); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(swapchain_images[0], nullptr); + ASSERT_NE(swapchain_images[0], VK_NULL_HANDLE); uint32_t image_index = 10; // arbitrary non zero value res = vkAcquireNextImageKHR(device, swapchain, 0, VK_NULL_HANDLE, VK_NULL_HANDLE, &image_index); diff --git a/tests/test_common.h b/tests/test_common.h new file mode 100644 index 000000000..de06a7844 --- /dev/null +++ b/tests/test_common.h @@ -0,0 +1,37 @@ +/* + * 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. + * + */ + +#include + +#include +#include +#include + +#include "gtest/gtest.h" +#include "vulkan/vulkan.h" + +// Location of the built binaries in this repo +#include "binary_locations.h" + +#if defined(WIN32) +#include +inline int set_environment_var(const char* name, const char* value) { return SetEnvironmentVariable(name, value); } +#else +inline int set_environment_var(const char* name, const char* value) { return setenv(name, value, 1); } +#endif diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index 689002867..4d654734a 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -15,8 +15,6 @@ # limitations under the License. # ~~~ -# CMakeLists.txt file for building Vulkaninfo - if(WIN32) # ~~~ # Setup the vulkaninfo.rc file to contain the correct info @@ -63,7 +61,7 @@ endif() target_compile_definitions(vulkaninfo PRIVATE -DVK_ENABLE_BETA_EXTENSIONS) -if(UNIX AND NOT APPLE) # i.e. Linux +if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") 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) @@ -84,9 +82,10 @@ if(UNIX AND NOT APPLE) # i.e. Linux endif() if(BUILD_WSI_WAYLAND_SUPPORT) - find_package(Wayland REQUIRED) - target_include_directories(vulkaninfo PRIVATE ${WAYLAND_CLIENT_INCLUDE_DIR}) - target_link_libraries(vulkaninfo ${WAYLAND_CLIENT_LIBRARIES}) + pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) + add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR) + + target_link_libraries(vulkaninfo PkgConfig::WAYLAND_CLIENT) target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_WAYLAND_KHR -DVK_NO_PROTOTYPES) endif() @@ -97,36 +96,41 @@ if(UNIX AND NOT APPLE) # i.e. Linux endif() if (ENABLE_ADDRESS_SANITIZER) - target_compile_options(vulkaninfo PUBLIC -fsanitize=address) - target_link_options(vulkaninfo PUBLIC -fsanitize=address) + target_compile_options(vulkaninfo PRIVATE -fsanitize=address) + target_link_options(vulkaninfo PRIVATE -fsanitize=address) endif () endif() if(APPLE) # We do this so vulkaninfo is linked to an individual library and NOT a framework. - target_link_libraries(vulkaninfo ${Vulkan_LIBRARY} "-framework AppKit -framework QuartzCore") + target_link_libraries(vulkaninfo Vulkan::Loader "-framework AppKit -framework QuartzCore") target_include_directories(vulkaninfo PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo) endif() target_link_libraries(vulkaninfo Vulkan::Headers) if(WIN32) - target_compile_definitions(vulkaninfo PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS -DVK_NO_PROTOTYPES) - if(MSVC AND NOT MSVC_VERSION LESS 1900) - # If MSVC, Enable control flow guard - message(STATUS "Building vulkaninfo with control flow guard") - add_compile_options("$<$:/guard:cf>") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf") - endif() + target_compile_definitions(vulkaninfo PRIVATE + VK_USE_PLATFORM_WIN32_KHR + WIN32_LEAN_AND_MEAN + _CRT_SECURE_NO_WARNINGS + VK_NO_PROTOTYPES + ) + + message(STATUS "Building vulkaninfo with control flow guard") + target_compile_options(vulkaninfo PRIVATE /guard:cf) + target_link_options(vulkaninfo PRIVATE /guard:cf) elseif(APPLE) - add_definitions(-DVK_USE_PLATFORM_MACOS_MVK -DVK_USE_PLATFORM_METAL_EXT) + target_compile_definitions(vulkaninfo PRIVATE + VK_USE_PLATFORM_MACOS_MVK + VK_USE_PLATFORM_METAL_EXT + ) endif() if(APPLE) install(TARGETS vulkaninfo RUNTIME DESTINATION "vulkaninfo") else() - install(TARGETS vulkaninfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vulkaninfo) endif() diff --git a/vulkaninfo/android/.gitignore b/vulkaninfo/android/.gitignore deleted file mode 100644 index 8008f2548..000000000 --- a/vulkaninfo/android/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -libs -obj diff --git a/vulkaninfo/android/jni/Android.mk b/vulkaninfo/android/jni/Android.mk deleted file mode 100644 index f3adbd5b2..000000000 --- a/vulkaninfo/android/jni/Android.mk +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# 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. - -LOCAL_PATH := $(abspath $(call my-dir)) -SRC_DIR := $(LOCAL_PATH)/../../.. -VULKANINFO_DIR := $(SRC_DIR)/vulkaninfo - -include $(CLEAR_VARS) -LOCAL_MODULE := vulkaninfo -LOCAL_SRC_FILES += $(VULKANINFO_DIR)/vulkaninfo.cpp -LOCAL_C_INCLUDES += $(SRC_DIR)/build-android/third_party/Vulkan-Headers/include \ - $(VULKANINFO_DIR) \ - $(VULKANINFO_DIR)/generated -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR -DVK_ENABLE_BETA_EXTENSIONS -LOCAL_LDLIBS := -llog -landroid -include $(BUILD_EXECUTABLE) diff --git a/vulkaninfo/android/jni/Application.mk b/vulkaninfo/android/jni/Application.mk deleted file mode 100644 index c294bc5ad..000000000 --- a/vulkaninfo/android/jni/Application.mk +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# 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. - -APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 -APP_PLATFORM := android-23 -APP_STL := c++_static -APP_MODULES := vulkaninfo -APP_CPPFLAGS += -std=c++11 -fexceptions -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -APP_CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -NDK_TOOLCHAIN_VERSION := clang diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 6f8a10a9f..e32a57cb5 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -98,6 +98,7 @@ std::string VkDriverIdString(VkDriverId value) { case (VK_DRIVER_ID_MESA_DOZEN): return "DRIVER_ID_MESA_DOZEN"; case (VK_DRIVER_ID_MESA_NVK): return "DRIVER_ID_MESA_NVK"; case (VK_DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA): return "DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA"; + case (VK_DRIVER_ID_MESA_AGXV): return "DRIVER_ID_MESA_AGXV"; default: return std::string("UNKNOWN_VkDriverId_value") + std::to_string(value); } } @@ -357,6 +358,8 @@ std::string VkFormatString(VkFormat value) { case (VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG): return "FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG"; case (VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG): return "FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG"; case (VK_FORMAT_R16G16_S10_5_NV): return "FORMAT_R16G16_S10_5_NV"; + case (VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR): return "FORMAT_A1B5G5R5_UNORM_PACK16_KHR"; + case (VK_FORMAT_A8_UNORM_KHR): return "FORMAT_A8_UNORM_KHR"; default: return std::string("UNKNOWN_VkFormat_value") + std::to_string(value); } } @@ -366,6 +369,45 @@ void DumpVkFormat(Printer &p, std::string name, VkFormat value) { else p.PrintKeyString(name, VkFormatString(value)); } +std::string VkImageLayoutString(VkImageLayout value) { + switch (value) { + case (VK_IMAGE_LAYOUT_UNDEFINED): return "IMAGE_LAYOUT_UNDEFINED"; + case (VK_IMAGE_LAYOUT_GENERAL): return "IMAGE_LAYOUT_GENERAL"; + case (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL): return "IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL"; + case (VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL): return "IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL"; + case (VK_IMAGE_LAYOUT_PREINITIALIZED): return "IMAGE_LAYOUT_PREINITIALIZED"; + case (VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_PRESENT_SRC_KHR): return "IMAGE_LAYOUT_PRESENT_SRC_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR): return "IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR): return "IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR): return "IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR"; + case (VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR): return "IMAGE_LAYOUT_SHARED_PRESENT_KHR"; + case (VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT): return "IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT"; + case (VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR): return "IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR): return "IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR): return "IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR): return "IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR"; + case (VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT): return "IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT"; + default: return std::string("UNKNOWN_VkImageLayout_value") + std::to_string(value); + } +} +void DumpVkImageLayout(Printer &p, std::string name, VkImageLayout value) { + if (p.Type() == OutputType::json) + p.PrintKeyString(name, std::string("VK_") + VkImageLayoutString(value)); + else + p.PrintKeyString(name, VkImageLayoutString(value)); +} std::string VkImageTilingString(VkImageTiling value) { switch (value) { case (VK_IMAGE_TILING_OPTIMAL): return "IMAGE_TILING_OPTIMAL"; @@ -710,6 +752,7 @@ std::vector VkFormatFeatureFlagBits2GetStrings(VkFormatFeatureFlag if (VK_FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR"); if (VK_FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT & value) strings.push_back("FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT"); if (VK_FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"); + if (VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT & value) strings.push_back("FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT"); if (VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR"); if (VK_FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR"); if (VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV & value) strings.push_back("FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV"); @@ -764,6 +807,7 @@ std::vector VkImageUsageFlagBitsGetStrings(VkImageUsageFlagBits va if (VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR"); if (VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT & value) strings.push_back("IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT"); if (VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR & value) strings.push_back("IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"); + if (VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT & value) strings.push_back("IMAGE_USAGE_HOST_TRANSFER_BIT_EXT"); if (VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR"); if (VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR"); if (VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR"); @@ -1023,6 +1067,7 @@ std::vector VkResolveModeFlagBitsGetStrings(VkResolveModeFlagBits if (VK_RESOLVE_MODE_AVERAGE_BIT & value) strings.push_back("RESOLVE_MODE_AVERAGE_BIT"); if (VK_RESOLVE_MODE_MIN_BIT & value) strings.push_back("RESOLVE_MODE_MIN_BIT"); if (VK_RESOLVE_MODE_MAX_BIT & value) strings.push_back("RESOLVE_MODE_MAX_BIT"); + if (VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID & value) strings.push_back("RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID"); return strings; } void DumpVkResolveModeFlags(Printer &p, std::string name, VkResolveModeFlags value) { @@ -1903,6 +1948,11 @@ void DumpVkPhysicalDeviceFragmentShadingRatePropertiesKHR(Printer &p, std::strin p.PrintKeyBool("fragmentShadingRateWithCustomSampleLocations", static_cast(obj.fragmentShadingRateWithCustomSampleLocations)); p.PrintKeyBool("fragmentShadingRateStrictMultiplyCombiner", static_cast(obj.fragmentShadingRateStrictMultiplyCombiner)); } +void DumpVkPhysicalDeviceFrameBoundaryFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceFrameBoundaryFeaturesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(13); + p.PrintKeyBool("frameBoundary", static_cast(obj.frameBoundary)); +} void DumpVkPhysicalDeviceGlobalPriorityQueryFeaturesKHR(Printer &p, std::string name, const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(19); @@ -1919,6 +1969,43 @@ void DumpVkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT(Printer &p, std::s p.PrintKeyBool("graphicsPipelineLibraryFastLinking", static_cast(obj.graphicsPipelineLibraryFastLinking)); p.PrintKeyBool("graphicsPipelineLibraryIndependentInterpolationDecoration", static_cast(obj.graphicsPipelineLibraryIndependentInterpolationDecoration)); } +void DumpVkPhysicalDeviceHostImageCopyFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceHostImageCopyFeaturesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(13); + p.PrintKeyBool("hostImageCopy", static_cast(obj.hostImageCopy)); +} +void DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(Printer &p, std::string name, const VkPhysicalDeviceHostImageCopyPropertiesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(35); + p.PrintKeyValue("copySrcLayoutCount", obj.copySrcLayoutCount); + { + ArrayWrapper arr(p,"pCopySrcLayouts", obj.copySrcLayoutCount); + for (uint32_t i = 0; i < obj.copySrcLayoutCount; i++) { + if (obj.pCopySrcLayouts != nullptr) { + p.SetElementIndex(i); + if (p.Type() == OutputType::json) + p.PrintString(std::string("VK_") + VkImageLayoutString(obj.pCopySrcLayouts[i])); + else + p.PrintString(VkImageLayoutString(obj.pCopySrcLayouts[i])); + } + } + } + p.PrintKeyValue("copyDstLayoutCount", obj.copyDstLayoutCount); + { + ArrayWrapper arr(p,"pCopyDstLayouts", obj.copyDstLayoutCount); + for (uint32_t i = 0; i < obj.copyDstLayoutCount; i++) { + if (obj.pCopyDstLayouts != nullptr) { + p.SetElementIndex(i); + if (p.Type() == OutputType::json) + p.PrintString(std::string("VK_") + VkImageLayoutString(obj.pCopyDstLayouts[i])); + else + p.PrintString(VkImageLayoutString(obj.pCopyDstLayouts[i])); + } + } + } + p.PrintKeyValue("optimalTilingLayoutUUID", obj.optimalTilingLayoutUUID); + p.PrintKeyBool("identicalMemoryTypeRequirements", static_cast(obj.identicalMemoryTypeRequirements)); +} void DumpVkPhysicalDeviceHostQueryResetFeatures(Printer &p, std::string name, const VkPhysicalDeviceHostQueryResetFeatures &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(14); @@ -2159,6 +2246,21 @@ void DumpVkPhysicalDeviceMaintenance4Properties(Printer &p, std::string name, co p.SetMinKeyWidth(13); p.PrintKeyValue("maxBufferSize", to_hex_str(p, obj.maxBufferSize)); } +void DumpVkPhysicalDeviceMaintenance5FeaturesKHR(Printer &p, std::string name, const VkPhysicalDeviceMaintenance5FeaturesKHR &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(12); + p.PrintKeyBool("maintenance5", static_cast(obj.maintenance5)); +} +void DumpVkPhysicalDeviceMaintenance5PropertiesKHR(Printer &p, std::string name, const VkPhysicalDeviceMaintenance5PropertiesKHR &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(51); + p.PrintKeyBool("earlyFragmentMultisampleCoverageAfterSampleCounting", static_cast(obj.earlyFragmentMultisampleCoverageAfterSampleCounting)); + p.PrintKeyBool("earlyFragmentSampleMaskTestBeforeSampleCounting", static_cast(obj.earlyFragmentSampleMaskTestBeforeSampleCounting)); + p.PrintKeyBool("depthStencilSwizzleOneSupport", static_cast(obj.depthStencilSwizzleOneSupport)); + p.PrintKeyBool("polygonModePointSize", static_cast(obj.polygonModePointSize)); + p.PrintKeyBool("nonStrictSinglePixelWideLinesUseParallelogram", static_cast(obj.nonStrictSinglePixelWideLinesUseParallelogram)); + p.PrintKeyBool("nonStrictWideLinesUseParallelogram", static_cast(obj.nonStrictWideLinesUseParallelogram)); +} void DumpVkPhysicalDeviceMemoryBudgetPropertiesEXT(Printer &p, std::string name, const VkPhysicalDeviceMemoryBudgetPropertiesEXT &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(14); @@ -2262,6 +2364,18 @@ void DumpVkPhysicalDeviceMutableDescriptorTypeFeaturesEXT(Printer &p, std::strin p.SetMinKeyWidth(21); p.PrintKeyBool("mutableDescriptorType", static_cast(obj.mutableDescriptorType)); } +void DumpVkPhysicalDeviceNestedCommandBufferFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceNestedCommandBufferFeaturesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(34); + p.PrintKeyBool("nestedCommandBuffer", static_cast(obj.nestedCommandBuffer)); + p.PrintKeyBool("nestedCommandBufferRendering", static_cast(obj.nestedCommandBufferRendering)); + p.PrintKeyBool("nestedCommandBufferSimultaneousUse", static_cast(obj.nestedCommandBufferSimultaneousUse)); +} +void DumpVkPhysicalDeviceNestedCommandBufferPropertiesEXT(Printer &p, std::string name, const VkPhysicalDeviceNestedCommandBufferPropertiesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(28); + p.PrintKeyValue("maxCommandBufferNestingLevel", obj.maxCommandBufferNestingLevel); +} void DumpVkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(18); @@ -3114,11 +3228,16 @@ void DumpVkSurfacePresentModeCompatibilityEXT(Printer &p, std::string name, cons ObjectWrapper object{p, name}; p.SetMinKeyWidth(31); p.PrintKeyValue("presentModeCount", obj.presentModeCount); - ArrayWrapper arr(p,"pPresentModes", obj.presentModeCount); - for (uint32_t i = 0; i < obj.presentModeCount; i++) { - if (obj.pPresentModes != nullptr) { - p.SetElementIndex(i); - DumpVkPresentModeKHR(p, "pPresentModes", obj.pPresentModes[i]); + { + ArrayWrapper arr(p,"pPresentModes", obj.presentModeCount); + for (uint32_t i = 0; i < obj.presentModeCount; i++) { + if (obj.pPresentModes != nullptr) { + p.SetElementIndex(i); + if (p.Type() == OutputType::json) + p.PrintString(std::string("VK_") + VkPresentModeKHRString(obj.pPresentModes[i])); + else + p.PrintString(VkPresentModeKHRString(obj.pPresentModes[i])); + } } } } @@ -3167,9 +3286,11 @@ struct phys_device_props2_chain { VkPhysicalDeviceLineRasterizationPropertiesEXT PhysicalDeviceLineRasterizationPropertiesEXT{}; VkPhysicalDeviceMaintenance3Properties PhysicalDeviceMaintenance3Properties{}; VkPhysicalDeviceMaintenance4Properties PhysicalDeviceMaintenance4Properties{}; + VkPhysicalDeviceMaintenance5PropertiesKHR PhysicalDeviceMaintenance5PropertiesKHR{}; VkPhysicalDeviceMeshShaderPropertiesEXT PhysicalDeviceMeshShaderPropertiesEXT{}; VkPhysicalDeviceMultiDrawPropertiesEXT PhysicalDeviceMultiDrawPropertiesEXT{}; VkPhysicalDeviceMultiviewProperties PhysicalDeviceMultiviewProperties{}; + VkPhysicalDeviceNestedCommandBufferPropertiesEXT PhysicalDeviceNestedCommandBufferPropertiesEXT{}; VkPhysicalDeviceOpacityMicromapPropertiesEXT PhysicalDeviceOpacityMicromapPropertiesEXT{}; VkPhysicalDevicePCIBusInfoPropertiesEXT PhysicalDevicePCIBusInfoPropertiesEXT{}; VkPhysicalDevicePerformanceQueryPropertiesKHR PhysicalDevicePerformanceQueryPropertiesKHR{}; @@ -3224,9 +3345,11 @@ struct phys_device_props2_chain { PhysicalDeviceLineRasterizationPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT; PhysicalDeviceMaintenance3Properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES; PhysicalDeviceMaintenance4Properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES; + PhysicalDeviceMaintenance5PropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR; PhysicalDeviceMeshShaderPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT; PhysicalDeviceMultiDrawPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; PhysicalDeviceMultiviewProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES; + PhysicalDeviceNestedCommandBufferPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT; PhysicalDeviceOpacityMicromapPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT; PhysicalDevicePCIBusInfoPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT; PhysicalDevicePerformanceQueryPropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR; @@ -3281,9 +3404,11 @@ struct phys_device_props2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceLineRasterizationPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance3Properties)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance4Properties)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance5PropertiesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMeshShaderPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiDrawPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiviewProperties)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceNestedCommandBufferPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceOpacityMicromapPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDevicePCIBusInfoPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDevicePerformanceQueryPropertiesKHR)); @@ -3389,8 +3514,11 @@ struct phys_device_features2_chain { VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR PhysicalDeviceFragmentShaderBarycentricFeaturesKHR{}; VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT PhysicalDeviceFragmentShaderInterlockFeaturesEXT{}; VkPhysicalDeviceFragmentShadingRateFeaturesKHR PhysicalDeviceFragmentShadingRateFeaturesKHR{}; + VkPhysicalDeviceFrameBoundaryFeaturesEXT PhysicalDeviceFrameBoundaryFeaturesEXT{}; VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR PhysicalDeviceGlobalPriorityQueryFeaturesKHR{}; VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT{}; + VkPhysicalDeviceHostImageCopyFeaturesEXT PhysicalDeviceHostImageCopyFeaturesEXT{}; + char VkPhysicalDeviceHostImageCopyFeaturesEXT_padding[64]; VkPhysicalDeviceHostQueryResetFeatures PhysicalDeviceHostQueryResetFeatures{}; VkPhysicalDeviceImage2DViewOf3DFeaturesEXT PhysicalDeviceImage2DViewOf3DFeaturesEXT{}; VkPhysicalDeviceImageCompressionControlFeaturesEXT PhysicalDeviceImageCompressionControlFeaturesEXT{}; @@ -3404,12 +3532,14 @@ struct phys_device_features2_chain { VkPhysicalDeviceLegacyDitheringFeaturesEXT PhysicalDeviceLegacyDitheringFeaturesEXT{}; VkPhysicalDeviceLineRasterizationFeaturesEXT PhysicalDeviceLineRasterizationFeaturesEXT{}; VkPhysicalDeviceMaintenance4Features PhysicalDeviceMaintenance4Features{}; + VkPhysicalDeviceMaintenance5FeaturesKHR PhysicalDeviceMaintenance5FeaturesKHR{}; VkPhysicalDeviceMemoryPriorityFeaturesEXT PhysicalDeviceMemoryPriorityFeaturesEXT{}; VkPhysicalDeviceMeshShaderFeaturesEXT PhysicalDeviceMeshShaderFeaturesEXT{}; VkPhysicalDeviceMultiDrawFeaturesEXT PhysicalDeviceMultiDrawFeaturesEXT{}; VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT PhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT{}; VkPhysicalDeviceMultiviewFeatures PhysicalDeviceMultiviewFeatures{}; VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT PhysicalDeviceMutableDescriptorTypeFeaturesEXT{}; + VkPhysicalDeviceNestedCommandBufferFeaturesEXT PhysicalDeviceNestedCommandBufferFeaturesEXT{}; VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT PhysicalDeviceNonSeamlessCubeMapFeaturesEXT{}; VkPhysicalDeviceOpacityMicromapFeaturesEXT PhysicalDeviceOpacityMicromapFeaturesEXT{}; VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT{}; @@ -3449,7 +3579,7 @@ struct phys_device_features2_chain { VkPhysicalDeviceShaderFloat16Int8Features PhysicalDeviceShaderFloat16Int8Features{}; VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT PhysicalDeviceShaderImageAtomicInt64FeaturesEXT{}; VkPhysicalDeviceShaderIntegerDotProductFeatures PhysicalDeviceShaderIntegerDotProductFeatures{}; - char padding[64]; + char VkPhysicalDeviceShaderIntegerDotProductFeatures_padding[64]; VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT PhysicalDeviceShaderModuleIdentifierFeaturesEXT{}; VkPhysicalDeviceShaderObjectFeaturesEXT PhysicalDeviceShaderObjectFeaturesEXT{}; VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures PhysicalDeviceShaderSubgroupExtendedTypesFeatures{}; @@ -3511,8 +3641,10 @@ struct phys_device_features2_chain { PhysicalDeviceFragmentShaderBarycentricFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR; PhysicalDeviceFragmentShaderInterlockFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT; PhysicalDeviceFragmentShadingRateFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR; + PhysicalDeviceFrameBoundaryFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; PhysicalDeviceGlobalPriorityQueryFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR; PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT; + PhysicalDeviceHostImageCopyFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; PhysicalDeviceHostQueryResetFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES; PhysicalDeviceImage2DViewOf3DFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT; PhysicalDeviceImageCompressionControlFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; @@ -3526,12 +3658,14 @@ struct phys_device_features2_chain { PhysicalDeviceLegacyDitheringFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT; PhysicalDeviceLineRasterizationFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT; PhysicalDeviceMaintenance4Features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES; + PhysicalDeviceMaintenance5FeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; PhysicalDeviceMemoryPriorityFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT; PhysicalDeviceMeshShaderFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT; PhysicalDeviceMultiDrawFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT; PhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; PhysicalDeviceMultiviewFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; PhysicalDeviceMutableDescriptorTypeFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT; + PhysicalDeviceNestedCommandBufferFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; PhysicalDeviceNonSeamlessCubeMapFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT; PhysicalDeviceOpacityMicromapFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT; PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT; @@ -3632,8 +3766,10 @@ struct phys_device_features2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShaderBarycentricFeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShaderInterlockFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShadingRateFeaturesKHR)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceFrameBoundaryFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGlobalPriorityQueryFeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostImageCopyFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostQueryResetFeatures)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceImage2DViewOf3DFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceImageCompressionControlFeaturesEXT)); @@ -3647,12 +3783,14 @@ struct phys_device_features2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceLegacyDitheringFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceLineRasterizationFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance4Features)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance5FeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMemoryPriorityFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMeshShaderFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiDrawFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiviewFeatures)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMutableDescriptorTypeFeaturesEXT)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceNestedCommandBufferFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceNonSeamlessCubeMapFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceOpacityMicromapFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT)); @@ -3741,24 +3879,18 @@ struct surface_capabilities2_chain { #ifdef VK_USE_PLATFORM_WIN32_KHR VkSurfaceCapabilitiesFullScreenExclusiveEXT SurfaceCapabilitiesFullScreenExclusiveEXT{}; #endif // VK_USE_PLATFORM_WIN32_KHR - VkSurfacePresentModeCompatibilityEXT SurfacePresentModeCompatibilityEXT{}; - VkSurfacePresentScalingCapabilitiesEXT SurfacePresentScalingCapabilitiesEXT{}; VkSurfaceProtectedCapabilitiesKHR SurfaceProtectedCapabilitiesKHR{}; void initialize_chain() noexcept { SharedPresentSurfaceCapabilitiesKHR.sType = VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR; #ifdef VK_USE_PLATFORM_WIN32_KHR SurfaceCapabilitiesFullScreenExclusiveEXT.sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT; #endif // VK_USE_PLATFORM_WIN32_KHR - SurfacePresentModeCompatibilityEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT; - SurfacePresentScalingCapabilitiesEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT; SurfaceProtectedCapabilitiesKHR.sType = VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR; std::vector chain_members; chain_members.push_back(reinterpret_cast(&SharedPresentSurfaceCapabilitiesKHR)); #ifdef VK_USE_PLATFORM_WIN32_KHR chain_members.push_back(reinterpret_cast(&SurfaceCapabilitiesFullScreenExclusiveEXT)); #endif // VK_USE_PLATFORM_WIN32_KHR - chain_members.push_back(reinterpret_cast(&SurfacePresentModeCompatibilityEXT)); - chain_members.push_back(reinterpret_cast(&SurfacePresentScalingCapabilitiesEXT)); chain_members.push_back(reinterpret_cast(&SurfaceProtectedCapabilitiesKHR)); for(size_t i = 0; i < chain_members.size() - 1; i++){ @@ -3991,6 +4123,12 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceMaintenance4Properties(p, gpu.api_version.minor >= 3 ?"VkPhysicalDeviceMaintenance4Properties":"VkPhysicalDeviceMaintenance4PropertiesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_MAINTENANCE_5_EXTENSION_NAME))) { + VkPhysicalDeviceMaintenance5PropertiesKHR* props = (VkPhysicalDeviceMaintenance5PropertiesKHR*)structure; + DumpVkPhysicalDeviceMaintenance5PropertiesKHR(p, "VkPhysicalDeviceMaintenance5PropertiesKHR", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_MESH_SHADER_EXTENSION_NAME))) { VkPhysicalDeviceMeshShaderPropertiesEXT* props = (VkPhysicalDeviceMeshShaderPropertiesEXT*)structure; @@ -4010,6 +4148,12 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceMultiviewProperties(p, gpu.api_version.minor >= 1 ?"VkPhysicalDeviceMultiviewProperties":"VkPhysicalDeviceMultiviewPropertiesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_NESTED_COMMAND_BUFFER_EXTENSION_NAME))) { + VkPhysicalDeviceNestedCommandBufferPropertiesEXT* props = (VkPhysicalDeviceNestedCommandBufferPropertiesEXT*)structure; + DumpVkPhysicalDeviceNestedCommandBufferPropertiesEXT(p, "VkPhysicalDeviceNestedCommandBufferPropertiesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_OPACITY_MICROMAP_EXTENSION_NAME))) { VkPhysicalDeviceOpacityMicromapPropertiesEXT* props = (VkPhysicalDeviceOpacityMicromapPropertiesEXT*)structure; @@ -4390,6 +4534,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceFragmentShadingRateFeaturesKHR(p, "VkPhysicalDeviceFragmentShadingRateFeaturesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_FRAME_BOUNDARY_EXTENSION_NAME))) { + VkPhysicalDeviceFrameBoundaryFeaturesEXT* props = (VkPhysicalDeviceFrameBoundaryFeaturesEXT*)structure; + DumpVkPhysicalDeviceFrameBoundaryFeaturesEXT(p, "VkPhysicalDeviceFrameBoundaryFeaturesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_GLOBAL_PRIORITY_EXTENSION_NAME) || gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_GLOBAL_PRIORITY_QUERY_EXTENSION_NAME))) { VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR* props = (VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR*)structure; @@ -4402,6 +4552,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT(p, "VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME))) { + VkPhysicalDeviceHostImageCopyFeaturesEXT* props = (VkPhysicalDeviceHostImageCopyFeaturesEXT*)structure; + DumpVkPhysicalDeviceHostImageCopyFeaturesEXT(p, "VkPhysicalDeviceHostImageCopyFeaturesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME) || gpu.api_version.minor >= 2)) { @@ -4485,6 +4641,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceMaintenance4Features(p, gpu.api_version.minor >= 3 ?"VkPhysicalDeviceMaintenance4Features":"VkPhysicalDeviceMaintenance4FeaturesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_MAINTENANCE_5_EXTENSION_NAME))) { + VkPhysicalDeviceMaintenance5FeaturesKHR* props = (VkPhysicalDeviceMaintenance5FeaturesKHR*)structure; + DumpVkPhysicalDeviceMaintenance5FeaturesKHR(p, "VkPhysicalDeviceMaintenance5FeaturesKHR", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME))) { VkPhysicalDeviceMemoryPriorityFeaturesEXT* props = (VkPhysicalDeviceMemoryPriorityFeaturesEXT*)structure; @@ -4522,6 +4684,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceMutableDescriptorTypeFeaturesEXT(p, "VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_NESTED_COMMAND_BUFFER_EXTENSION_NAME))) { + VkPhysicalDeviceNestedCommandBufferFeaturesEXT* props = (VkPhysicalDeviceNestedCommandBufferFeaturesEXT*)structure; + DumpVkPhysicalDeviceNestedCommandBufferFeaturesEXT(p, "VkPhysicalDeviceNestedCommandBufferFeaturesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_NON_SEAMLESS_CUBE_MAP_EXTENSION_NAME))) { VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT* props = (VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT*)structure; @@ -4942,18 +5110,6 @@ void chain_iterator_surface_capabilities2(Printer &p, AppInstance &inst, AppGpu p.AddNewline(); } #endif // VK_USE_PLATFORM_WIN32_KHR - if (structure->sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT && - (inst.CheckExtensionEnabled(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME))) { - VkSurfacePresentModeCompatibilityEXT* props = (VkSurfacePresentModeCompatibilityEXT*)structure; - DumpVkSurfacePresentModeCompatibilityEXT(p, "VkSurfacePresentModeCompatibilityEXT", *props); - p.AddNewline(); - } - if (structure->sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT && - (inst.CheckExtensionEnabled(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME))) { - VkSurfacePresentScalingCapabilitiesEXT* props = (VkSurfacePresentScalingCapabilitiesEXT*)structure; - DumpVkSurfacePresentScalingCapabilitiesEXT(p, "VkSurfacePresentScalingCapabilitiesEXT", *props); - p.AddNewline(); - } if (structure->sType == VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR && (inst.CheckExtensionEnabled(VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME))) { VkSurfaceProtectedCapabilitiesKHR* props = (VkSurfaceProtectedCapabilitiesKHR*)structure; diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 37c9a6845..e8e4241f8 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -155,6 +155,50 @@ void DumpSurfaceCapabilities(Printer &p, AppInstance &inst, AppGpu &gpu, AppSurf if (inst.CheckExtensionEnabled(VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME)) { chain_iterator_surface_capabilities2(p, inst, gpu, surface.surface_capabilities2_khr.pNext); } + if (inst.CheckExtensionEnabled(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME)) { + p.SetSubHeader(); + ObjectWrapper obj(p, "VK_EXT_surface_maintenance_1"); + for (auto &mode : surface.surf_present_modes) { + VkSurfacePresentModeEXT present_mode{}; + present_mode.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT; + present_mode.presentMode = mode; + + VkPhysicalDeviceSurfaceInfo2KHR surface_info{}; + surface_info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR; + surface_info.surface = surface.surface_extension.surface; + surface_info.pNext = &present_mode; + + VkSurfacePresentModeCompatibilityEXT SurfacePresentModeCompatibilityEXT{}; + SurfacePresentModeCompatibilityEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT; + + VkSurfacePresentScalingCapabilitiesEXT SurfacePresentScalingCapabilitiesEXT{}; + SurfacePresentScalingCapabilitiesEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT; + SurfacePresentScalingCapabilitiesEXT.pNext = &SurfacePresentModeCompatibilityEXT; + + VkSurfaceCapabilities2KHR surface_caps2{}; + surface_caps2.sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR; + surface_caps2.pNext = &SurfacePresentScalingCapabilitiesEXT; + + VkResult err = + inst.ext_funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2); + if (err != VK_SUCCESS) { + continue; + } + + std::vector compatible_present_modes{SurfacePresentModeCompatibilityEXT.presentModeCount}; + SurfacePresentModeCompatibilityEXT.pPresentModes = compatible_present_modes.data(); + + err = inst.ext_funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2); + + if (err == VK_SUCCESS) { + ObjectWrapper present_mode_obj(p, VkPresentModeKHRString(mode)); + DumpVkSurfacePresentScalingCapabilitiesEXT(p, "VkSurfacePresentScalingCapabilitiesEXT", + SurfacePresentScalingCapabilitiesEXT); + DumpVkSurfacePresentModeCompatibilityEXT(p, "VkSurfacePresentModeCompatibilityEXT", + SurfacePresentModeCompatibilityEXT); + } + } + } } void DumpSurface(Printer &p, AppInstance &inst, AppGpu &gpu, AppSurface &surface, std::set surface_types) { @@ -289,6 +333,22 @@ void DumpGroups(Printer &p, AppInstance &inst) { } } +void GetAndDumpHostImageCopyPropertiesEXT(Printer &p, AppGpu &gpu) { + // Manually implement VkPhysicalDeviceHostImageCopyPropertiesEXT due to it needing to be called twice + VkPhysicalDeviceHostImageCopyPropertiesEXT host_image_copy_properties_ext{}; + host_image_copy_properties_ext.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; + VkPhysicalDeviceProperties2KHR props2{}; + props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; + props2.pNext = static_cast(&host_image_copy_properties_ext); + gpu.inst.ext_funcs.vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2); + std::vector src_layouts(host_image_copy_properties_ext.copySrcLayoutCount); + host_image_copy_properties_ext.pCopySrcLayouts = src_layouts.data(); + std::vector dst_layouts(host_image_copy_properties_ext.copyDstLayoutCount); + host_image_copy_properties_ext.pCopyDstLayouts = dst_layouts.data(); + gpu.inst.ext_funcs.vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2); + DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(p, "VkPhysicalDeviceHostImageCopyPropertiesEXT", host_image_copy_properties_ext); +} + void GpuDumpProps(Printer &p, AppGpu &gpu) { auto props = gpu.GetDeviceProperties(); p.SetSubHeader(); @@ -318,6 +378,7 @@ void GpuDumpProps(Printer &p, AppGpu &gpu) { void *place = gpu.props2.pNext; chain_iterator_phys_device_props2(p, gpu.inst, gpu, place); p.AddNewline(); + GetAndDumpHostImageCopyPropertiesEXT(p, gpu); } } @@ -614,6 +675,7 @@ void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu) { if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { void *place = gpu.props2.pNext; chain_iterator_phys_device_props2(p, gpu.inst, gpu, place); + GetAndDumpHostImageCopyPropertiesEXT(p, gpu); } } { @@ -913,11 +975,15 @@ util::vulkaninfo_optional parse_arguments(int argc, char **argv, #endif ++i; } - } else if (strncmp("--json", argv[i], 6) == 0 || strcmp(argv[i], "-j") == 0) { + } else if (strncmp("--json", argv[i], 6) == 0 || strncmp(argv[i], "-j", 2) == 0) { if (strlen(argv[i]) > 7 && strncmp("--json=", argv[i], 7) == 0) { results.selected_gpu = static_cast(strtol(argv[i] + 7, nullptr, 10)); results.has_selected_gpu = true; } + if (strlen(argv[i]) > 3 && strncmp("-j=", argv[i], 3) == 0) { + results.selected_gpu = static_cast(strtol(argv[i] + 3, nullptr, 10)); + results.has_selected_gpu = true; + } results.output_category = OutputCategory::profile_json; results.default_filename = "vulkaninfo.json"; results.print_to_file = true; diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 2daa3ca60..1390863b0 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -67,7 +67,7 @@ #endif #endif // _WIN32 -#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) #include #endif @@ -252,7 +252,7 @@ auto GetVector(const char *func_name, F &&f, Ts &&...ts) -> std::vector { // ----------- Instance Setup ------- // struct VkDll { VkResult Initialize() { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) library = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); if (!library) library = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); #elif defined(_WIN32) @@ -264,7 +264,7 @@ struct VkDll { return VK_SUCCESS; } void Close() { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) dlclose(library); #elif defined(_WIN32) FreeLibrary(library); @@ -356,6 +356,11 @@ struct VkDll { #ifdef VK_USE_PLATFORM_METAL_EXT PFN_vkCreateMetalSurfaceEXT fp_vkCreateMetalSurfaceEXT = APPLE_FP(vkCreateMetalSurfaceEXT); #endif // VK_USE_PLATFORM_METAL_EXT +#ifdef VK_USE_PLATFORM_SCREEN_QNX + PFN_vkCreateScreenSurfaceQNX fp_vkCreateScreenSurfaceQNX = APPLE_FP(vkCreateScreenSurfaceQNX); + PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX fp_vkGetPhysicalDeviceScreenPresentationSupportQNX = + APPLE_FP(vkGetPhysicalDeviceScreenPresentationSupportQNX); +#endif // VK_USE_PLATFORM_SCREEN_QNX void InitializeDispatchPointers() { Load(fp_vkCreateInstance, "vkCreateInstance"); Load(fp_vkDestroyInstance, "vkDestroyInstance"); @@ -420,18 +425,21 @@ struct VkDll { #ifdef VK_USE_PLATFORM_METAL_EXT Load(fp_vkCreateMetalSurfaceEXT, "vkCreateMetalSurfaceEXT"); #endif // VK_USE_PLATFORM_METAL_EXT +#ifdef VK_USE_PLATFORM_SCREEN_QNX + Load(fp_vkCreateScreenSurfaceQNX, "vkCreateScreenSurfaceQNX"); +#endif // VK_USE_PLATFORM_SCREEN_QNX } private: template void Load(T &func_dest, const char *func_name) { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) func_dest = reinterpret_cast(dlsym(library, func_name)); #elif defined(_WIN32) func_dest = reinterpret_cast(GetProcAddress(library, func_name)); #endif } -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) void *library; #elif defined(_WIN32) HMODULE library; @@ -621,6 +629,10 @@ struct AppInstance { #endif #ifdef VK_USE_PLATFORM_ANDROID_KHR // TODO ANativeWindow *window; +#endif +#ifdef VK_USE_PLATFORM_SCREEN_QNX + struct _screen_context *context; + struct _screen_window *window; #endif AppInstance() { VkResult dllErr = dll.Initialize(); @@ -798,6 +810,12 @@ struct AppInstance { if (strcmp(VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME, ext.extensionName) == 0) { inst_extensions.push_back(ext.extensionName); } + if (strcmp(VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME, ext.extensionName) == 0) { + inst_extensions.push_back(ext.extensionName); + } + if (strcmp(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME, ext.extensionName) == 0) { + inst_extensions.push_back(ext.extensionName); + } } } @@ -822,7 +840,8 @@ struct AppInstance { #if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WIN32_KHR) || \ defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_WAYLAND_KHR) || \ - defined(VK_USE_PLATFORM_DIRECTFB_EXT) || defined(VK_USE_PLATFORM_GGP) + defined(VK_USE_PLATFORM_DIRECTFB_EXT) || defined(VK_USE_PLATFORM_GGP) || defined(VK_USE_PLATFORM_SCREEN_QNX) + #define VULKANINFO_WSI_ENABLED #endif @@ -1187,6 +1206,46 @@ static VkSurfaceKHR AppCreateGgpSurface(AppInstance &inst) { static void AppDestroyGgpWindow(AppInstance &inst) {} #endif //----------------------------------------------------------- +//----------------------QNX SCREEN--------------------------- +#ifdef VK_USE_PLATFORM_SCREEN_QNX +static void AppCreateScreenWindow(AppInstance &inst) { + int usage = SCREEN_USAGE_VULKAN; + int rc; + + rc = screen_create_context(&inst.context, 0); + if (rc) { + THROW_ERR("Could not create a QNX Screen context.\nExiting..."); + } + rc = screen_create_window(&inst.window, inst.context); + if (rc) { + THROW_ERR("Could not create a QNX Screen window.\nExiting..."); + } + rc = screen_set_window_property_iv(inst.window, SCREEN_PROPERTY_USAGE, &usage); + if (rc) { + THROW_ERR("Could not set SCREEN_USAGE_VULKAN flag for QNX Screen window!\nExiting..."); + } +} + +static VkSurfaceKHR AppCreateScreenSurface(AppInstance &inst) { + VkScreenSurfaceCreateInfoQNX createInfo; + createInfo.sType = VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX; + createInfo.pNext = nullptr; + createInfo.flags = 0; + createInfo.context = inst.context; + createInfo.window = inst.window; + + VkSurfaceKHR surface; + VkResult err = inst.dll.fp_vkCreateScreenSurfaceQNX(inst.instance, &createInfo, nullptr, &surface); + if (err) THROW_VK_ERR("vkCreateScreenSurfaceQNX", err); + return surface; +} + +static void AppDestroyScreenWindow(AppInstance &inst) { + screen_destroy_window(inst.window); + screen_destroy_context(inst.context); +} +#endif // VK_USE_PLATFORM_SCREEN_QNX +//----------------------------------------------------------- // ------------ Setup Windows ------------- // void SetupWindowExtensions(AppInstance &inst) { @@ -1319,6 +1378,18 @@ void SetupWindowExtensions(AppInstance &inst) { inst.AddSurfaceExtension(surface_ext_ggp); } #endif +//--QNX_SCREEN-- +#ifdef VK_USE_PLATFORM_SCREEN_QNX + SurfaceExtension surface_ext_qnx_screen; + if (inst.CheckExtensionEnabled(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME)) { + surface_ext_qnx_screen.name = VK_QNX_SCREEN_SURFACE_EXTENSION_NAME; + surface_ext_qnx_screen.create_window = AppCreateScreenWindow; + surface_ext_qnx_screen.create_surface = AppCreateScreenSurface; + surface_ext_qnx_screen.destroy_window = AppDestroyScreenWindow; + + inst.AddSurfaceExtension(surface_ext_qnx_screen); + } +#endif } // ---------- Surfaces -------------- // diff --git a/vulkaninfo/vulkaninfo.md b/vulkaninfo/vulkaninfo.md index 3e7456a14..8755b415e 100644 --- a/vulkaninfo/vulkaninfo.md +++ b/vulkaninfo/vulkaninfo.md @@ -1,5 +1,5 @@ - + [![Khronos Vulkan][1]][2] diff --git a/windows-runtime-installer/README.md b/windows-runtime-installer/README.md index d0dd5958d..81c581251 100644 --- a/windows-runtime-installer/README.md +++ b/windows-runtime-installer/README.md @@ -1,5 +1,4 @@ - -## Windows Runtime Installer +# Windows Runtime Installer This directory contains the files required for building the Windows Vulkan Runtime Installer package. The runtime installer is a method of delivering a Vulkan loader to system.