Skip to content
Commits on Source (74)
......@@ -12,18 +12,33 @@ version: "{build}"
max_jobs: 4
os:
- Visual Studio 2013
- Visual Studio 2017
init:
- git config --global core.autocrlf true
environment:
PYTHON_PATH: "C:/Python35"
PYTHON_PACKAGE_PATH: "C:/Python35/Scripts"
CMAKE_URL: "http://cmake.org/files/v3.10/cmake-3.10.2-win64-x64.zip"
branches:
only:
- master
install:
- appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip
- 7z x cmake.zip -oC:\cmake > nul
- set path=C:\cmake\bin;%path%
- cmake --version
before_build:
- "SET PATH=C:\\Python35;C:\\Python35\\Scripts;%PATH%"
# vcvars32.bat will override the platform ennvar, so we need to reset it or else appveyor dies
- "SET APPVEYOR_PLATFORM=%PLATFORM%"
- if %APPVEYOR_PLATFORM% == x64 (call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat")
- if %APPVEYOR_PLATFORM% == Win32 (call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat")
- "SET PLATFORM=%APPVEYOR_PLATFORM%"
- echo.
- echo Starting build for %APPVEYOR_REPO_NAME%
# Install dependencies
......@@ -33,6 +48,9 @@ before_build:
- cd external/googletest
- git checkout tags/release-1.8.1
- cd %APPVEYOR_BUILD_FOLDER%
# Verify consistency between source file generators and output
- echo Verifying consistency between source file generators and output
- python scripts/generate_source.py --verify external/Vulkan-Headers/registry
# Generate build files using CMake for the build step.
- echo Generating CMake files for %PLATFORM%
- mkdir build
......
# Copyright (C) 2019 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
buildconfig = "//build/config/BUILDCONFIG.gn"
secondary_source = "//build-gn/secondary/"
default_args = {
clang_use_chrome_plugins = false
use_custom_libcxx = false
}
......@@ -10,6 +10,7 @@ matrix:
fast_finish: true
allow_failures:
- env: CHECK_COMMIT_FORMAT=ON
- env: VULKAN_BUILD_TARGET=GN
include:
# Linux GCC debug build.
- os: linux
......@@ -19,6 +20,9 @@ matrix:
- os: linux
compiler: clang
env: VULKAN_BUILD_TARGET=LINUX
# Linux GN debug build
- os: linux
env: VULKAN_BUILD_TARGET=GN
# MacOS clang debug build.
- os: osx
compiler: clang
......@@ -38,6 +42,18 @@ cache: ccache
before_install:
- set -e
- CMAKE_VERSION=3.10.2
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
# Upgrade to the desired version of CMake
CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
echo CMAKE_URL=${CMAKE_URL}
mkdir cmake-${CMAKE_VERSION} && travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake-${CMAKE_VERSION}
export PATH=${PWD}/cmake-${CMAKE_VERSION}/bin:${PATH}
else
brew install cmake || brew upgrade cmake
fi
cmake --version
- unset -f cd pushd popd
- |
if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then
......@@ -45,10 +61,11 @@ before_install:
UPDATE_DEPS_EXTRA_OPTIONS="--ref=master"
fi
- |
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]] || [[ "$VULKAN_BUILD_TARGET" == "GN" ]]; then
# Install the appropriate Linux packages.
sudo apt-get -qq update
sudo apt-get -y install libxkbcommon-dev libwayland-dev libxrandr-dev libx11-xcb-dev
sudo apt-get -y install libxkbcommon-dev libwayland-dev libxrandr-dev libx11-xcb-dev \
python-pathlib
fi
- |
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]] || [[ "$VULKAN_BUILD_TARGET" == "MACOS" ]]; then
......@@ -76,6 +93,9 @@ script:
- set -e
- |
if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]] || [[ "$VULKAN_BUILD_TARGET" == "MACOS" ]]; then
# Verify consistency between source file generators and output
echo Verifying consistency between source file generators and output
python3 scripts/generate_source.py --verify external/Vulkan-Headers/registry
# Build Vulkan-Loader
mkdir build
cd build
......@@ -83,6 +103,14 @@ script:
make -j $core_count
cd ..
fi
- |
if [[ "$VULKAN_BUILD_TARGET" == "GN" ]]; then
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
export PATH=$PATH:$PWD/depot_tools
./build-gn/update_deps.sh
gn gen out/Debug
ninja -C out/Debug
fi
- |
if [[ "$CHECK_FORMAT" == "ON" ]]; then
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
......@@ -106,7 +134,6 @@ script:
notifications:
email:
recipients:
- karl@lunarg.com
- lenny@lunarg.com
on_success: change
on_failure: always
# Copyright (C) 2018-2019 The ANGLE Project Authors.
# 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.
import("//build_overrides/vulkan_loader.gni")
# Fuchsia has non-upstream changes to the vulkan loader, so we don't want
# to build it from upstream sources.
assert(!is_fuchsia)
if (!is_android) {
vulkan_undefine_configs = []
}
if (is_win) {
vulkan_undefine_configs += [
"//build/config/win:nominmax",
"//build/config/win:unicode",
]
}
config("vulkan_internal_config") {
defines = [ "VULKAN_NON_CMAKE_BUILD" ]
if (is_clang || !is_win) {
cflags = [ "-Wno-unused-function" ]
}
if (is_linux) {
defines += [
"SYSCONFDIR=\"/etc\"",
"FALLBACK_CONFIG_DIRS=\"/etc/xdg\"",
"FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"",
]
}
}
# Vulkan loader
# -------------
config("vulkan_loader_config") {
include_dirs = [
"loader/generated",
"loader",
]
defines = [ "API_NAME=\"Vulkan\"" ] + vulkan_loader_extra_defines
if (is_win) {
cflags = [ "/wd4201" ]
}
if (is_linux) {
# assume secure_getenv() is available
defines += [ "HAVE_SECURE_GETENV" ]
}
}
if (!is_android) {
if (vulkan_loader_shared) {
library_type = "shared_library"
} else {
library_type = "static_library"
}
target(library_type, "libvulkan") {
sources = [
"loader/asm_offset.c",
"loader/cJSON.c",
"loader/cJSON.h",
"loader/debug_utils.c",
"loader/debug_utils.h",
"loader/dev_ext_trampoline.c",
"loader/extension_manual.c",
"loader/extension_manual.h",
"loader/gpa_helper.h",
"loader/loader.c",
"loader/loader.h",
"loader/murmurhash.c",
"loader/murmurhash.h",
"loader/phys_dev_ext.c",
"loader/trampoline.c",
# TODO(jmadill): Use assembler where available.
"loader/unknown_ext_chain.c",
"loader/vk_loader_platform.h",
"loader/wsi.c",
"loader/wsi.h",
]
if (is_win) {
sources += [
"loader/dirent_on_windows.c",
"loader/dirent_on_windows.h",
]
if (!is_clang) {
cflags = [
"/wd4054", # Type cast from function pointer
"/wd4055", # Type cast from data pointer
"/wd4100", # Unreferenced formal parameter
"/wd4152", # Nonstandard extension used (pointer conversion)
"/wd4201", # Nonstandard extension used: nameless struct/union
"/wd4214", # Nonstandard extension used: bit field types other than int
"/wd4232", # Nonstandard extension used: address of dllimport is not static
"/wd4305", # Type cast truncation
"/wd4706", # Assignment within conditional expression
"/wd4996", # Unsafe stdlib function
]
}
}
public_deps = [
"$vulkan_headers_dir:vulkan_headers",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":vulkan_internal_config" ]
public_configs = [ ":vulkan_loader_config" ]
configs -= vulkan_undefine_configs
}
}
......@@ -71,6 +71,15 @@ contains the Vulkan API definition files (registry) that are required to build
the loader. You must also take note of the headers install directory and pass
it on the CMake command line for building this repository, as described below.
#### Windows Driver Kit (WDK)
On Windows builds, the loader needs to have a WDK installed. Microsoft provides
[WDK releases](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk),
including several old releases. The installed WDK must be at least version 1709.
Take note of the fact that the latest WDK release generally requires the latest
version of Visual Studio. It may be necessary to use an older WDK with an older
Visual Studio.
#### Google Test
The loader tests depend on the [Google Test](https://github.com/google/googletest)
......@@ -142,6 +151,20 @@ Here is a usage example for this repository:
- Please use `update_deps.py --help` to list additional options and read the
internal documentation in `update_deps.py` for further information.
### Generated source code
This repository contains generated source code in the `loader/generated`
directory which is not intended to be modified directly. Instead, changes should be
made to the corresponding generator in the `scripts` directory. The source files can
then be regenerated using `scripts/generate_source.py`:
python3 scripts/generate_source.py PATH_TO_VULKAN_HEADERS_REGISTRY_DIR
A helper CMake target `VulkanLoader_generated_source` is also provided to simplify
the invocation of `scripts/generate_source.py` from the build directory:
cmake --build . --target VulkanLoader_generated_source
### Build Options
When generating native platform build files through CMake, several options can
......@@ -179,12 +202,13 @@ CMake to generate the native platform files.
- 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/)
- [2017](https://www.visualstudio.com/vs/older-downloads/)
- [2019](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](http://www.cmake.org/download/) (Version 2.8.11 or better)
- [Windows Driver Kit](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) 1803 or later
- [CMake 3.10.2](https://cmake.org/files/v3.10/cmake-3.10.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
......@@ -202,6 +226,8 @@ work with the solution interactively.
#### Windows Quick Start
Open a developer command prompt and enter:
cd Vulkan-Loader
mkdir build
cd build
......@@ -213,6 +239,13 @@ installation to generate a Visual Studio solution and projects for the x64
architecture. The second CMake command builds the Debug (default)
configuration of the solution.
Note that if you do not wish to use a developer command prompt, you may either
run either `vcvars64.bat` or `vcvars32.bat` to set the required environment
variables. You may also define a `WDK_FULL_PATH` variable when first invoking CMake
like:
cmake -A x64 --DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir -DWDK_BASE="C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0" ..
See below for the details.
#### Use `CMake` to Create the Visual Studio Project Files
......@@ -324,9 +357,12 @@ 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" |
| Microsoft Visual Studio 2019 | "Visual Studio 16 2019" | "Visual Studio 16 2019" |
Note that with Visual Studio 2019, the architecture will need to be specified with the `-A`
flag for 64-bit builds.
#### Using The Vulkan Loader Library in this Repository on Windows
......@@ -360,9 +396,11 @@ that the minimum supported compiler versions are GCC 4.8.2 and Clang 3.4,
although earlier versions may work. It should be straightforward to adapt this
repository to other Linux distributions.
[CMake 3.10.2](https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz) is recommended.
#### Required Package List
sudo apt-get install git cmake build-essential libx11-xcb-dev \
sudo apt-get install git build-essential libx11-xcb-dev \
libxkbcommon-dev libwayland-dev libxrandr-dev
### Linux Build
......@@ -576,7 +614,7 @@ Setup Homebrew and components
- Add packages with the following (may need refinement)
brew install cmake python python3 git
brew install python python3 git
### Clone the Repository
......@@ -586,6 +624,8 @@ Clone the Vulkan-ValidationLayers repository:
### MacOS build
[CMake 3.10.2](https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz) is recommended.
#### CMake Generators
This repository uses CMake to generate build or project files that are then
......
# ~~~
# Copyright (c) 2014-2018 Valve Corporation
# Copyright (c) 2014-2018 LunarG, Inc.
# Copyright (c) 2014-2019 Valve Corporation
# Copyright (c) 2014-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.
......@@ -15,18 +15,24 @@
# limitations under the License.
# ~~~
cmake_minimum_required(VERSION 3.4)
cmake_minimum_required(VERSION 3.10.2)
# Apple: Must be set before enable_language() or project() as it may influence configuration of the toolchain and flags.
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version")
project(Vulkan-Loader)
enable_testing()
add_definitions(-DAPI_NAME="Vulkan")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(PythonInterp 3 REQUIRED)
find_package(PythonInterp 3 QUIET)
if (TARGET Vulkan::Headers)
message(STATUS "Using Vulkan headers from Vulkan::Headers target")
get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES)
else()
find_package(VulkanHeaders)
if(NOT ${VulkanHeaders_FOUND})
message(FATAL_ERROR "Could not find Vulkan headers path. This can be fixed by setting VULKAN_HEADERS_INSTALL_DIR to an "
......@@ -37,6 +43,12 @@ if(NOT ${VulkanRegistry_FOUND})
"installation of the Vulkan-Headers repository.")
endif()
# set up the Vulkan::Headers target for consistency
add_library(vulkan-headers INTERFACE)
target_include_directories(vulkan-headers INTERFACE "${VulkanHeaders_INCLUDE_DIRS}")
add_library(Vulkan::Headers ALIAS vulkan-headers)
endif()
option(USE_CCACHE "Use ccache" OFF)
if(USE_CCACHE)
find_program(CCACHE_FOUND ccache)
......@@ -78,6 +90,12 @@ if(UNIX)
STRING
"Search path to use when XDG_DATA_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant."
)
set(
SYSCONFDIR ""
CACHE
STRING
"System-wide search directory. If not set or empty, CMAKE_INSTALL_FULL_SYSCONFDIR and /etc are used."
)
endif()
if(UNIX AND NOT APPLE) # i.e.: Linux
......@@ -100,6 +118,7 @@ if(UNIX AND NOT APPLE) # i.e.: Linux
endif()
if(WIN32)
find_package(WDK REQUIRED)
option(ENABLE_WIN10_ONECORE "Link the loader with OneCore umbrella libraries" OFF)
option(ENABLE_STATIC_LOADER "Build the loader as a static library" OFF)
endif()
......@@ -112,9 +131,6 @@ else()
option(BUILD_TESTS "Build Tests" OFF)
endif()
# Add location of Vulkan header files to include search path
include_directories(${VulkanHeaders_INCLUDE_DIRS})
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 -Wno-stringop-truncation -Wno-stringop-overflow")
set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp")
......@@ -147,45 +163,25 @@ if(MSVC)
set(MSVC_LOADER_COMPILE_OPTIONS /WX /GR- /w34456 /w34701 /w34703 /w34057 /w34245)
endif()
# Define a macro to generate source code from vk.xml
set(SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
macro(GenerateFromVkXml output dependency)
add_custom_command(OUTPUT ${output}
COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/loader_genvk.py -registry ${VulkanRegistry_DIR}/vk.xml -scripts
${VulkanRegistry_DIR} ${output}
DEPENDS ${SCRIPTS_DIR}/${dependency}
${SCRIPTS_DIR}/loader_genvk.py
${VulkanRegistry_DIR}/vk.xml
${VulkanRegistry_DIR}/generator.py
${VulkanRegistry_DIR}/reg.py)
endmacro()
# Use the macro to generate the source files.
GenerateFromVkXml(vk_layer_dispatch_table.h loader_extension_generator.py)
GenerateFromVkXml(vk_dispatch_table_helper.h dispatch_table_helper_generator.py)
GenerateFromVkXml(vk_safe_struct.h helper_file_generator.py)
GenerateFromVkXml(vk_safe_struct.cpp helper_file_generator.py)
GenerateFromVkXml(vk_enum_string_helper.h helper_file_generator.py)
GenerateFromVkXml(vk_object_types.h helper_file_generator.py)
GenerateFromVkXml(vk_extension_helper.h helper_file_generator.py)
GenerateFromVkXml(vk_typemap_helper.h helper_file_generator.py)
# Use a custom target to cause the source files to be generated.
add_custom_target(generate_helper_files
DEPENDS vk_enum_string_helper.h
vk_safe_struct.h
vk_safe_struct.cpp
vk_object_types.h
vk_layer_dispatch_table.h
vk_dispatch_table_helper.h
vk_extension_helper.h
vk_typemap_helper.h)
set_target_properties(generate_helper_files PROPERTIES FOLDER ${LOADER_HELPER_FOLDER})
# Optional codegen target
if(PYTHONINTERP_FOUND)
add_custom_target(VulkanLoader_generated_source
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/generate_source.py
${VulkanRegistry_DIR} --incremental
)
else()
message("WARNING: VulkanLoader_generated_source target requires python 3")
endif()
if(UNIX)
add_definitions(-DFALLBACK_CONFIG_DIRS="${FALLBACK_CONFIG_DIRS}")
add_definitions(-DFALLBACK_DATA_DIRS="${FALLBACK_DATA_DIRS}")
if(NOT (SYSCONFDIR STREQUAL ""))
# SYSCONFDIR is specified, use it and do not force /etc.
add_definitions(-DSYSCONFDIR="${SYSCONFDIR}")
else()
add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
# Make sure /etc is searched by the loader
......@@ -193,6 +189,7 @@ if(UNIX)
add_definitions(-DEXTRASYSCONFDIR="/etc")
endif()
endif()
endif()
# uninstall target
if(NOT TARGET uninstall)
......
......@@ -45,6 +45,11 @@ current assignee.
* Please base your fixes on the master branch.
SDK branches are generally not updated except for critical fixes needed to
repair an SDK release.
* The resulting Pull Request will be assigned to a repository maintainer.
It is the maintainer's responsibility to ensure the Pull Request
passes the Google/LunarG internal CI processes.
Once the Pull Request has been approved and is passing internal CI,
a repository maintainer will merge the PR.
#### Coding Conventions and Formatting
......@@ -101,7 +106,16 @@ error for each commit in your pull request.
Note that to be accepted into the repository, the pull request must
pass all tests on all supported platforms.
The automatic Github Travis and AppVeyor continuous integration features
will assist in enforcing this requirement.
will assist in enforcing this requirement.*
#### Generated Source Code
The `loader/generated` directory contains source code that is created by several
generator scripts in the `scripts` directory. All changes to these scripts _must_ be submitted with the
corresponding generated output to keep the repository self-consistent. This requirement is enforced by both
Travis CI and AppVeyor test configurations. Regenerate source files after modifying any of the generator
scripts and before building and testing your changes. More details can be found in
[BUILD.md](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/BUILD.md#generated-source-code).
#### Testing Your Changes
......
vars = {
'chromium_git': 'https://chromium.googlesource.com',
}
deps = {
'./build': {
'url': '{chromium_git}/chromium/src/build.git@a660b0b9174e3a808f620222017566e8d1b2669b',
},
'./buildtools': {
'url': '{chromium_git}/chromium/src/buildtools.git@459baaf66bee809f6eb288e0215cf524f4d2429a',
},
'./testing': {
'url': '{chromium_git}/chromium/src/testing@083d633e752e7a57cbe62a468a06e51e28c49ee9',
},
'./tools/clang': {
'url': '{chromium_git}/chromium/src/tools/clang.git@3114fbc11f9644c54dd0a4cdbfa867bac50ff983',
},
}
hooks = [
# Pull clang-format binaries using checked-in hashes.
{
'name': 'clang_format_linux',
'pattern': '.',
'condition': 'host_os == "linux"',
'action': [ 'download_from_google_storage',
'--no_resume',
'--platform=linux*',
'--no_auth',
'--bucket', 'chromium-clang-format',
'-s', './buildtools/linux64/clang-format.sha1',
],
},
{
'name': 'sysroot_x64',
'pattern': '.',
'condition': 'checkout_linux and checkout_x64',
'action': ['python', './build/linux/sysroot_scripts/install-sysroot.py',
'--arch=x64'],
},
{
# Note: On Win, this should run after win_toolchain, as it may use it.
'name': 'clang',
'pattern': '.',
'action': ['python', './tools/clang/scripts/update.py'],
},
]
recursedeps = [
# buildtools provides clang_format.
'./buildtools',
]
# Copyright (c) 2019 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
build_with_chromium = false
ignore_elf32_limitations = true
linux_use_bundled_binutils_override = false
use_system_xcode = true
# Copyright (c) 2019 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Paths to loader dependencies
vulkan_headers_dir = "//external/Vulkan-Headers"
# Subdirectories for generated files
vulkan_gen_subdir = ""
# Vulkan loader build options
vulkan_loader_extra_defines = []
vulkan_loader_shared = true
#!/bin/sh
# 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.
# Execute at repo root
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 >> .gclient
solutions = [
{ "name" : ".",
"url" : "https://github.com/KhronosGroup/Vulkan-Loader",
"deps_file" : "build-gn/DEPS",
"managed" : False,
"custom_deps" : {
},
"custom_vars": {},
},
]
EOF
gclient sync
#.rst:
# FindWDK
# -----------------
#
# Try to find headers in the Windows Driver Kit
#
# This module is intended to be used by the Vulkan loader to locate
# the required headers from the Windows Driver Kit. This should not
# be considered feature complete for other uses, as it is only
# intended for the Vulkan loader.
#
# By default, this module uses environment variables to try to find an
# installed WDK. These environment variables are present in a developer
# command prompt, or can be set by running vcvarsall.bat (which comes
# with a Visual Studio installation.
#
# If a user wants to override the default behavior, or not set the
# needed environment variables, they may also specify one or more of
# the following CMake variables:
#
# WDK_FULL_PATH - Attempts to find a WDK in the given path. No
# other environment or CMake variable will have
# any effect if this is set.
# WDK_BASE - Sets the base path for the Windows Kit to use.
# This should be the path one level up from the
# "Include" directory.
# WDK_VERSION - Sets the version of the Windows Kit to use.
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines no IMPORTED targets
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables::
#
# WDK_FOUND - True if the WDK was found
# WDK_INCLUDE_DIRS - include directories for the WDK
#
if(NOT DEFINED WDK_FULL_PATH)
if(NOT DEFINED WDK_BASE)
set(WDK_BASE "$ENV{UniversalCRTSdkDir}")
endif()
if(NOT DEFINED WDK_VERSION)
set(WDK_VERSION "$ENV{UCRTVersion}")
string(REPLACE \\ "" WDK_VERSION "${WDK_VERSION}")
endif()
set(WDK_FULL_PATH "${WDK_BASE}/Include/${WDK_VERSION}")
endif()
find_path(WDK_VERSION_INCLUDE_DIR
NAMES km/d3dkmthk.h shared/d3dkmdt.h
PATHS "${WDK_FULL_PATH}"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WDK DEFAULT_MSG WDK_VERSION_INCLUDE_DIR)
if(WDK_FOUND)
set(WDK_INCLUDE_DIRS "${WDK_VERSION_INCLUDE_DIR}/km" "${WDK_VERSION_INCLUDE_DIR}/shared")
endif()
vulkan-loader (1.1.114.0-1) unstable; urgency=medium
* New upstream release.
-- Timo Aaltonen <tjaalton@debian.org> Thu, 01 Aug 2019 15:55:16 +0300
vulkan-loader (1.1.106.0-1) experimental; urgency=medium
* New upstream release.
-- Timo Aaltonen <tjaalton@debian.org> Wed, 24 Apr 2019 11:37:42 +0300
vulkan-loader (1.1.101.0-2) unstable; urgency=medium
* rules: Enable tests, but expect most of them to fail since there's
......
# ~~~
# Copyright (c) 2014-2018 Valve Corporation
# Copyright (c) 2014-2018 LunarG, Inc.
# Copyright (c) 2014-2019 Valve Corporation
# Copyright (c) 2014-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.
......@@ -15,7 +15,7 @@
# limitations under the License.
# ~~~
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_BINARY_DIR} ${CMAKE_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/generated ${CMAKE_CURRENT_BINARY_DIR})
# Check for the existance of the secure_getenv or __secure_getenv commands
include(CheckFunctionExists)
......@@ -127,7 +127,7 @@ if(WIN32)
endif()
add_executable(asm_offset asm_offset.c)
add_dependencies(asm_offset generate_helper_files loader_gen_files)
target_link_libraries(asm_offset Vulkan::Headers)
add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM)
add_custom_target(loader_asm_gen_files DEPENDS gen_defines.asm)
set_target_properties(loader_asm_gen_files PROPERTIES FOLDER ${LOADER_HELPER_FOLDER})
......@@ -137,7 +137,6 @@ if(WIN32)
message(WARNING "Could not find working MASM assebler\n${ASM_FAILURE_MSG}")
add_custom_target(loader_asm_gen_files)
add_library(loader-unknown-chain OBJECT unknown_ext_chain.c)
add_dependencies(loader-unknown-chain generate_helper_files loader_gen_files)
target_compile_options(loader-unknown-chain PUBLIC "$<$<CONFIG:DEBUG>:${LOCAL_C_FLAGS_REL}>")
target_compile_options(loader-unknown-chain PUBLIC ${MSVC_LOADER_COMPILE_OPTIONS})
endif()
......@@ -164,7 +163,7 @@ else(UNIX AND NOT APPLE) # i.e.: Linux
set(CMAKE_ASM-ATT_FLAGS "$ENV{ASFLAGS} -I\"${CMAKE_CURRENT_BINARY_DIR}\"")
set(OPT_LOADER_SRCS ${OPT_LOADER_SRCS} unknown_ext_chain_gas.asm)
add_executable(asm_offset asm_offset.c)
add_dependencies(asm_offset generate_helper_files loader_gen_files)
target_link_libraries(asm_offset Vulkan::Headers)
add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS)
add_custom_target(loader_asm_gen_files DEPENDS gen_defines.asm)
else()
......@@ -174,21 +173,18 @@ else(UNIX AND NOT APPLE) # i.e.: Linux
endif()
endif()
GenerateFromVkXml(vk_loader_extensions.h loader_extension_generator.py)
GenerateFromVkXml(vk_loader_extensions.c loader_extension_generator.py)
add_custom_target(loader_gen_files DEPENDS vk_loader_extensions.h vk_loader_extensions.c)
set_target_properties(loader_gen_files PROPERTIES FOLDER ${LOADER_HELPER_FOLDER})
if(WIN32)
add_library(loader-norm OBJECT ${NORMAL_LOADER_SRCS} dirent_on_windows.c)
add_dependencies(loader-norm generate_helper_files loader_gen_files)
target_compile_options(loader-norm PUBLIC "$<$<CONFIG:DEBUG>:${LOCAL_C_FLAGS_DBG}>")
target_compile_options(loader-norm PUBLIC ${MSVC_LOADER_COMPILE_OPTIONS})
target_include_directories(loader-norm PRIVATE "$<TARGET_PROPERTY:Vulkan::Headers,INTERFACE_INCLUDE_DIRECTORIES>")
target_include_directories(loader-norm PRIVATE "${WDK_INCLUDE_DIRS}")
add_library(loader-opt OBJECT ${OPT_LOADER_SRCS})
add_dependencies(loader-opt generate_helper_files loader_gen_files loader_asm_gen_files)
add_dependencies(loader-opt loader_asm_gen_files)
target_compile_options(loader-opt PUBLIC "$<$<CONFIG:DEBUG>:${LOCAL_C_FLAGS_REL}>")
target_compile_options(loader-opt PUBLIC ${MSVC_LOADER_COMPILE_OPTIONS})
target_include_directories(loader-opt PRIVATE "$<TARGET_PROPERTY:Vulkan::Headers,INTERFACE_INCLUDE_DIRECTORIES>")
if(NOT ENABLE_STATIC_LOADER)
target_compile_definitions(loader-norm PUBLIC LOADER_DYNAMIC_LIB)
......@@ -206,6 +202,7 @@ if(WIN32)
"/ignore:4098"
OUTPUT_NAME
vulkan-1)
target_link_libraries(vulkan Vulkan::Headers)
else()
add_library(vulkan
STATIC
......@@ -222,7 +219,7 @@ if(WIN32)
target_link_libraries(vulkan Cfgmgr32)
endif()
add_dependencies(vulkan generate_helper_files loader_gen_files loader_asm_gen_files)
add_dependencies(vulkan loader_asm_gen_files)
else()
# Linux and MacOS
......@@ -235,14 +232,15 @@ else()
endif()
add_library(vulkan SHARED ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS})
add_dependencies(vulkan generate_helper_files loader_gen_files loader_asm_gen_files)
add_dependencies(vulkan loader_asm_gen_files)
target_compile_definitions(vulkan PUBLIC -DLOADER_DYNAMIC_LIB)
set_target_properties(vulkan
PROPERTIES SOVERSION
"1"
VERSION
"${VulkanHeaders_VERSION_MAJOR}.${VulkanHeaders_VERSION_MINOR}.${VulkanHeaders_VERSION_PATCH}")
target_link_libraries(vulkan -ldl -lpthread -lm)
target_link_libraries(vulkan ${CMAKE_DL_LIBS} -lpthread -lm)
target_link_libraries(vulkan Vulkan::Headers)
if(APPLE)
find_library(COREFOUNDATION_LIBRARY NAMES CoreFoundation)
......@@ -267,9 +265,10 @@ else()
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan.hpp)
add_library(vulkan-framework SHARED ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS} ${FRAMEWORK_HEADERS})
add_dependencies(vulkan-framework generate_helper_files loader_gen_files loader_asm_gen_files)
add_dependencies(vulkan-framework loader_asm_gen_files)
target_compile_definitions(vulkan-framework PUBLIC -DLOADER_DYNAMIC_LIB)
target_link_libraries(vulkan-framework -ldl -lpthread -lm "-framework CoreFoundation")
target_link_libraries(vulkan-framework Vulkan::Headers)
# The FRAMEWORK_VERSION needs to be "A" here so that Xcode code-signing works when a user adds their framework to an Xcode
# project and does "Sign on Copy". It would have been nicer to use "1" to denote Vulkan 1. Although Apple docs say that a
......@@ -307,6 +306,9 @@ else()
endif()
endif()
target_link_libraries(vulkan Vulkan::Headers)
add_library(Vulkan::Vulkan ALIAS vulkan)
install(TARGETS vulkan
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......
......@@ -698,13 +698,10 @@ target-specific extensions:
| Windowing System | Extensions available |
|----------------|--------------------|
| Windows | VK_KHR_win32_surface |
| Linux (Default) | VK_KHR_xcb_surface and VK_KHR_xlib_surface |
| Linux (Wayland) | VK_KHR_wayland_surface |
| Linux (X11) | VK_KHR_xcb_surface and VK_KHR_xlib_surface |
| macOS (MoltenVK) | VK_MVK_macos_surface |
**NOTE:** Wayland is not fully supported at this time. Wayland
support is present, but should be considered Beta quality.
It is important to understand that while the loader may support the various
entry points for these extensions, there is a handshake required to actually
use them:
......@@ -1247,9 +1244,9 @@ appropriate type to call into the next entity.
* This can be implemented in various ways but
for clarity, will be referred to as a dispatch table.
- A layer can use the `VkLayerDispatchTable` structure as a device dispatch
table (see include/vulkan/vk_layer.h).
table (see include/vulkan/vk_dispatch_table_helper.h).
- A layer can use the `VkLayerInstanceDispatchTable` structure as a instance
dispatch table (see include/vulkan/vk_layer.h).
dispatch table (see include/vulkan/vk_dispatch_table_helper.h).
- A Layer's `vkGetInstanceProcAddr` function uses the next entity's
`vkGetInstanceProcAddr` to call down the chain for unknown (i.e.
non-intercepted) functions.
......@@ -2506,7 +2503,7 @@ If the loader handles the management of the `VkSurfaceKHR` objects:
functions without involving the ICDs.
* Where XXX stands for the Windowing System name:
* Wayland
* Xcb
* XCB
* Xlib
* Windows
* Android
......@@ -2518,7 +2515,7 @@ If the loader handles the management of the `VkSurfaceKHR` objects:
`VkIcdSurfaceXXX` structure.
4. The first field of all the `VkIcdSurfaceXXX` structures is a
`VkIcdSurfaceBase` enumerant that indicates whether the
surface object is Win32, Xcb, Xlib, or Wayland.
surface object is Win32, XCB, Xlib, or Wayland.
The ICD may choose to handle `VkSurfaceKHR` object creation instead. If an ICD
desires to handle creating and destroying it must do the following:
......
......@@ -271,8 +271,6 @@ static VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugUtilsMessengerEXT(VkIn
inst->disp->layer_inst_disp.DestroyDebugUtilsMessengerEXT(instance, messenger, pAllocator);
util_DestroyDebugUtilsMessenger(inst, messenger, pAllocator);
loader_platform_thread_unlock_mutex(&loader_lock);
}
......@@ -413,6 +411,8 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugUtilsMessengerEXT(VkInstance i
storage_idx++;
}
util_DestroyDebugUtilsMessenger(inst, messenger, pAllocator);
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
{
#else
......@@ -670,8 +670,6 @@ static VKAPI_ATTR void VKAPI_CALL debug_utils_DestroyDebugReportCallbackEXT(VkIn
inst->disp->layer_inst_disp.DestroyDebugReportCallbackEXT(instance, callback, pAllocator);
util_DestroyDebugReportCallback(inst, callback, pAllocator);
loader_platform_thread_unlock_mutex(&loader_lock);
}
......@@ -821,6 +819,8 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance i
storage_idx++;
}
util_DestroyDebugReportCallback(inst, callback, pAllocator);
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
{
#else
......
......@@ -58,6 +58,17 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2K
uint8_t icd_index = phys_dev_term->icd_index;
if (icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilities2KHR != NULL) {
VkBaseOutStructure *pNext = (VkBaseOutStructure *)pSurfaceCapabilities->pNext;
while (pNext != NULL) {
if ((int)pNext->sType == VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR) {
// Not all ICDs may be supporting VK_KHR_surface_protected_capabilities
// Initialize VkSurfaceProtectedCapabilitiesKHR.supportsProtected to false and
// if an ICD supports protected surfaces, it will reset it to true accordingly.
((VkSurfaceProtectedCapabilitiesKHR *)pNext)->supportsProtected = VK_FALSE;
}
pNext = (VkBaseOutStructure *)pNext->pNext;
}
// Pass the call to the driver, possibly unwrapping the ICD surface
if (icd_surface->real_icd_surfaces != NULL && (void *)icd_surface->real_icd_surfaces[icd_index] != NULL) {
VkPhysicalDeviceSurfaceInfo2KHR info_copy = *pSurfaceInfo;
......@@ -362,3 +373,71 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDev
}
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
#ifdef VK_USE_PLATFORM_WIN32_KHR
VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModes2EXT(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes) {
const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_layer_dispatch(physicalDevice);
return disp->GetPhysicalDeviceSurfacePresentModes2EXT(unwrapped_phys_dev, pSurfaceInfo, pPresentModeCount, pPresentModes);
}
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModes2EXT(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes) {
struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice;
struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;
if (NULL == icd_term->dispatch.GetPhysicalDeviceSurfacePresentModes2EXT) {
loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceSurfacePresentModes2EXT");
}
VkIcdSurface *icd_surface = (VkIcdSurface *)(pSurfaceInfo->surface);
uint8_t icd_index = phys_dev_term->icd_index;
if (NULL != icd_surface->real_icd_surfaces && NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) {
const VkPhysicalDeviceSurfaceInfo2KHR surface_info_copy = {
.sType = pSurfaceInfo->sType,
.pNext = pSurfaceInfo->pNext,
.surface = icd_surface->real_icd_surfaces[icd_index],
};
return icd_term->dispatch.GetPhysicalDeviceSurfacePresentModes2EXT(phys_dev_term->phys_dev, &surface_info_copy, pPresentModeCount, pPresentModes);
}
return icd_term->dispatch.GetPhysicalDeviceSurfacePresentModes2EXT(phys_dev_term->phys_dev, pSurfaceInfo, pPresentModeCount, pPresentModes);
}
VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModes2EXT(
VkDevice device,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
VkDeviceGroupPresentModeFlagsKHR* pModes) {
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
return disp->GetDeviceGroupSurfacePresentModes2EXT(device, pSurfaceInfo, pModes);
}
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModes2EXT(
VkDevice device,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
VkDeviceGroupPresentModeFlagsKHR* pModes) {
uint32_t icd_index = 0;
struct loader_device *dev;
struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index);
if (NULL != icd_term && NULL != icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT) {
VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pSurfaceInfo->surface;
if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) {
const VkPhysicalDeviceSurfaceInfo2KHR surface_info_copy = {
.sType = pSurfaceInfo->sType,
.pNext = pSurfaceInfo->pNext,
.surface = icd_surface->real_icd_surfaces[icd_index],
};
return icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, &surface_info_copy, pModes);
}
return icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, pSurfaceInfo, pModes);
}
return VK_SUCCESS;
}
#endif // VK_USE_PLATFORM_WIN32_KHR
......@@ -80,3 +80,27 @@ VKAPI_ATTR VkResult VKAPI_CALL GetRandROutputDisplayEXT(VkPhysicalDevice physica
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput,
VkDisplayKHR* pDisplay);
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
#ifdef VK_USE_PLATFORM_WIN32_KHR
VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModes2EXT(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes);
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModes2EXT(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes);
#endif // VK_USE_PLATFORM_WIN32_KHR
VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModes2EXT(
VkDevice device,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
VkDeviceGroupPresentModeFlagsKHR* pModes);
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModes2EXT(
VkDevice device,
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
VkDeviceGroupPresentModeFlagsKHR* pModes);
---
# Disable clang-format for generated code
DisableFormat: true
SortIncludes: false
...
This diff is collapsed.