From e5927fc403797ca0f5bd35226d2bb365ce0dbf17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 9 Sep 2020 16:44:33 +0200 Subject: [PATCH] package/ci: split Vulkan compile-test and render-test jobs. On Ubuntu, because SwiftShader Vulkan doesn't compile on GCC 4 (or 5) anymore, we use 4.8 on 16.04 for compile-test against libvulkan-dev and 18.04 for render-test with SwiftShader. On Mac, because we want to work with both MoltenVK and Vulkan Loader, we compile-test against MoltenVk in the generic "all build" and render-test against SwiftShader on a new, Vulkan-specific build. That requires us to supply our own loader as well -- apparently no such thing is on Homebrew, which is kinda silly (doesn't anybody do real Vulkan work on this crazy platform?!). --- package/ci/circleci.yml | 109 ++++++++++++++++++++++++------ package/ci/travis.yml | 61 ++++++++++++----- package/ci/unix-desktop-vulkan.sh | 22 +++--- package/ci/unix-desktop.sh | 17 ++++- 4 files changed, 160 insertions(+), 49 deletions(-) diff --git a/package/ci/circleci.yml b/package/ci/circleci.yml index 172ded6b2..68df40178 100644 --- a/package/ci/circleci.yml +++ b/package/ci/circleci.yml @@ -13,9 +13,15 @@ executors: ubuntu-16_04: docker: - image: ubuntu:xenial-20201014 - xcode-9_4: + ubuntu-18_04: + docker: + - image: ubuntu:bionic-20200921 + xcode-10_3: + macos: + xcode: 10.3.0 + xcode-11_6: macos: - xcode: 9.4.1 + xcode: 11.6.0 emscripten: docker: # 1.39.0 is the oldest on Docker. Anything before 1.39.2 is useless as emar @@ -119,6 +125,9 @@ commands: source $BASH_ENV && cmake --version | grep 3.4 install-swiftshader-gles: + parameters: + build: + type: string steps: - run: name: Install SwiftShader GLES @@ -126,10 +135,39 @@ commands: # self-hosted because GH Actions would make it too simple for people if # you could just download the artifacts directly, right? RIGHT? command: | - apt install -y wget unzip mkdir -p $HOME/swiftshader && cd $HOME/swiftshader - wget https://ci.magnum.graphics/swiftshader-gles-r5464.a6940c8e6e-ubuntu-16.04.zip - unzip swiftshader-gles-r5464.a6940c8e6e-ubuntu-16.04.zip + wget https://ci.magnum.graphics/swiftshader-gles-r5464.a6940c8e6e-<< parameters.build >>.zip + unzip swiftshader-gles-r5464.a6940c8e6e-<< parameters.build >>.zip + + install-swiftshader-vulkan: + parameters: + build: + type: string + steps: + - run: + name: Install SwiftShader Vulkan + # Zip from https://github.com/mosra/magnum-ci/tree/swiftshader and + # self-hosted because GH Actions would make it too simple for people if + # you could just download the artifacts directly, right? RIGHT? + command: | + mkdir -p $HOME/swiftshader && cd $HOME/swiftshader + wget https://ci.magnum.graphics/swiftshader-vulkan-r5464.a6940c8e6e-<< parameters.build >>.zip + unzip swiftshader-vulkan-r5464.a6940c8e6e-<< parameters.build >>.zip + + install-vulkan-loader: + parameters: + build: + type: string + steps: + - run: + name: Install Vulkan Loader + # Zip from https://github.com/mosra/magnum-ci/tree/vulkan-loader and + # self-hosted because GH Actions would make it too simple for people if + # you could just download the artifacts directly, right? RIGHT? + command: | + mkdir -p $HOME/vulkan-loader && cd $HOME/vulkan-loader + wget https://ci.magnum.graphics/vulkan-loader-1.2.153-<< parameters.build >>.zip + unzip vulkan-loader-1.2.153-<< parameters.build >>.zip setup-null-openal-driver: steps: @@ -176,7 +214,7 @@ jobs: PLATFORM_GL_API: GLX steps: - install-base-linux: - extra: libgl1-mesa-dev libsdl2-dev libglfw3-dev libopenal-dev + extra: libgl1-mesa-dev libsdl2-dev libglfw3-dev libopenal-dev libvulkan-dev - install-gcc-4_8 - install-cmake-3_4 - setup-null-openal-driver @@ -184,15 +222,19 @@ jobs: script: unix-desktop.sh - lcov + # vulkan-loader is broken on 16.04 and swiftshader vulkan needs GCC 7 to + # compile, so using 18.04 for Vulkan tests instead. Compile tests with GCC + # 4.8 are still done on 16.04 linux-vulkan: - executor: ubuntu-16_04 - # Using default GCC and CMake version here + executor: ubuntu-18_04 environment: CMAKE_CXX_FLAGS: --coverage CONFIGURATION: Debug steps: - install-base-linux: - extra: cmake libsdl2-dev libglfw3-dev + extra: cmake libsdl2-dev libglfw3-dev libvulkan-dev wget unzip + - install-swiftshader-vulkan: + build: ubuntu-18.04 - build: script: unix-desktop-vulkan.sh - lcov @@ -208,10 +250,11 @@ jobs: TARGET_GLES2: "ON" steps: - install-base-linux: - extra: libsdl2-dev libglfw3-dev + extra: libsdl2-dev libglfw3-dev wget unzip - install-gcc-4_8 - install-cmake-3_4 - - install-swiftshader-gles + - install-swiftshader-gles: + build: ubuntu-16.04 - build: script: unix-desktop-gles.sh - lcov @@ -227,10 +270,11 @@ jobs: TARGET_GLES2: "OFF" steps: - install-base-linux: - extra: libsdl2-dev libglfw3-dev + extra: libsdl2-dev libglfw3-dev wget unzip - install-gcc-4_8 - install-cmake-3_4 - - install-swiftshader-gles + - install-swiftshader-gles: + build: ubuntu-16.04 - build: script: unix-desktop-gles.sh - lcov @@ -247,7 +291,7 @@ jobs: PLATFORM_GL_API: GLX steps: - install-base-linux: - extra: libgl1-mesa-dev libsdl2-dev libglfw3-dev libopenal-dev + extra: libgl1-mesa-dev libsdl2-dev libglfw3-dev libopenal-dev libvulkan-dev - install-gcc-4_8 - install-cmake-3_4 - setup-null-openal-driver @@ -265,7 +309,7 @@ jobs: PLATFORM_GL_API: GLX steps: - install-base-linux: - extra: libgl1-mesa-dev libsdl2-dev libglfw3-dev libopenal-dev + extra: libgl1-mesa-dev libsdl2-dev libglfw3-dev libopenal-dev libvulkan-dev - install-gcc-4_8 - install-cmake-3_4 - setup-null-openal-driver @@ -284,7 +328,7 @@ jobs: PLATFORM_GL_API: GLX steps: - install-base-linux: - extra: libgl1-mesa-dev libopenal-dev + extra: libgl1-mesa-dev libopenal-dev libvulkan-dev - install-clang-3_8 - install-cmake-3_4 - setup-null-openal-driver @@ -303,7 +347,7 @@ jobs: PLATFORM_GL_API: GLX steps: - install-base-linux: - extra: libgl1-mesa-dev libopenal-dev + extra: libgl1-mesa-dev libopenal-dev libvulkan-dev - install-clang-3_8 - install-cmake-3_4 - setup-null-openal-driver @@ -311,20 +355,42 @@ jobs: script: unix-desktop.sh macos-gl: - executor: xcode-9_4 + # Molten-vk isn't in (non-updated) Homebrew on the 9.4 or 10.0/1/2 image, + # have to use 10.3 instead + executor: xcode-10_3 environment: CMAKE_CXX_FLAGS: --coverage CONFIGURATION: Debug PLATFORM_GL_API: CGL steps: - install-base-macos: - extra: sdl2 glfw + extra: sdl2 glfw molten-vk - build: script: unix-desktop.sh - lcov + macos-vulkan: + # SwiftShader is built on 10.15 and can't be used on older versions due to + # dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin + executor: xcode-11_6 + environment: + CMAKE_CXX_FLAGS: --coverage + CONFIGURATION: Debug + steps: + - install-base-macos: + extra: sdl2 glfw wget + - install-swiftshader-vulkan: + build: macos-10.15 + - install-vulkan-loader: + build: macos-10.15 + - build: + script: unix-desktop-vulkan.sh + - lcov + macos-static: - executor: xcode-9_4 + # Molten-vk isn't in (non-updated) Homebrew on the 9.4 or 10.0/1/2 image, + # have to use 10.3 instead + executor: xcode-10_3 environment: # STUPID yml interprets unquoted ON as a boolean BUILD_STATIC: "ON" @@ -333,7 +399,7 @@ jobs: PLATFORM_GL_API: CGL steps: - install-base-macos: - extra: sdl2 glfw + extra: sdl2 glfw molten-vk - build: script: unix-desktop.sh - lcov @@ -371,6 +437,7 @@ workflows: - linux-sanitizers - linux-threadsanitizer - macos-gl + - macos-vulkan - macos-static - emscripten-webgl1 - emscripten-webgl2 diff --git a/package/ci/travis.yml b/package/ci/travis.yml index 5a7ed4bf8..86f877ae3 100644 --- a/package/ci/travis.yml +++ b/package/ci/travis.yml @@ -8,6 +8,7 @@ addons: - libsdl2-dev - libglfw3-dev - libopenal-dev + - libvulkan-dev matrix: # The commented-out jobs are currently handled on Circle CI @@ -52,6 +53,7 @@ matrix: #- libsdl2-dev #- libglfw3-dev #- libopenal-dev + #- libvulkan-dev #- language: cpp #os: linux #dist: xenial @@ -72,9 +74,10 @@ matrix: #- libsdl2-dev #- libglfw3-dev #- libopenal-dev + #- libvulkan-dev #- language: cpp #os: linux - #dist: xenial + #dist: bionic #compiler: gcc #env: #- JOBID=linux-vulkan @@ -87,6 +90,7 @@ matrix: #- lcov #- libsdl2-dev #- libglfw3-dev + #- libvulkan-dev #- language: cpp #os: linux #dist: xenial @@ -108,6 +112,17 @@ matrix: #- TARGET_GLES2=ON #- CMAKE_CXX_FLAGS="--coverage" #- LCOV_EXTRA_OPTS="--gcov-tool /usr/bin/gcov-4.8" + #addons: + #apt: + #packages: + #- libgl1-mesa-dev + #- g++-4.8 + #- ninja-build + #- lcov + #- libsdl2-dev + #- libglfw3-dev + #- libopenal-dev + ## We don't need Vulkan here #- language: cpp #os: linux #dist: xenial @@ -120,16 +135,9 @@ matrix: #- LCOV_EXTRA_OPTS="--gcov-tool /usr/bin/gcov-4.8" #- language: cpp #os: osx - ## The new plugin testing workflow is dynamically loading and unloading them - ## in the tests. When that's combined with coverage and LLVM < 5.0.1, all - ## such tests crash on exit: https://bugs.llvm.org/show_bug.cgi?id=27224 - ## But only in some cases (for example not at all in tests for Corrade - ## PluginManager itself). The commit fixing it is from Jan 3 2018 and all - ## Xcode versions before Xcode 9.3 beta (released on Jan 24) are affected. - ## https://github.com/llvm-mirror/compiler-rt/commit/860d7953a6f36980f406bfbff76f3c00f15eed57 - ## Xcode 9.3 beta has broken git clone ("unknown protocol version 2") since - ## Feb 16 2019, so using version 9.3 now. - #osx_image: xcode9.3 + ## This is currently (Sep 2020) the Travis default, 9.3 didn't have + ## molten-vk in (non-updated) Homebrew. + #osx_image: xcode9.4 #compiler: clang #env: #- JOBID=macos-gl @@ -139,7 +147,7 @@ matrix: #- language: cpp #os: osx ## See above - #osx_image: xcode9.3 + #osx_image: xcode9.4 #compiler: clang #env: #- JOBID=macos-static @@ -147,6 +155,17 @@ matrix: #- CMAKE_CXX_FLAGS="--coverage" #- BUILD_STATIC=ON #- CONFIGURATION=Debug + #- language: cpp + #os: osx + ## SwiftShader is built on 10.15 and can't be used on older versions due to + ## dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin + #osx_image: xcode11.6 + #compiler: clang + #env: + #- JOBID=macos-vulkan + #- TARGET=desktop-vulkan + #- CMAKE_CXX_FLAGS="--coverage" + #- CONFIGURATION=Debug - language: cpp os: osx osx_image: xcode7.3 @@ -260,18 +279,26 @@ install: # GLFW (cached) - if [ "$TRAVIS_OS_NAME" == "osx" ] && ( [ "$TARGET" == "desktop" ] || [ "$TARGET" == "desktop-vulkan" ] ); then HOMEBREW_NO_AUTO_UPDATE=1 brew install glfw; fi -# SwiftShader on Linux GLES (16.04). Zip from +# SwiftShader on Linux GLES (16.04) and Vulkan (18.04) (cached). Zip from # https://github.com/mosra/magnum-ci/tree/swiftshader and self-hosted because # GH Actions would make it too simple for people if you could just download the # artifacts directly, right? RIGHT? - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-gles" ] && [ ! -e "$HOME/swiftshader/lib/libGLESv2.so" ]; then cd $HOME ; wget https://ci.magnum.graphics/swiftshader-gles-r5464.a6940c8e6e-ubuntu-16.04.zip && mkdir -p swiftshader && cd swiftshader && unzip ../swiftshader-gles-r5464.a6940c8e6e-ubuntu-16.04.zip && cd $TRAVIS_BUILD_DIR ; fi +- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-vulkan" ] && [ ! -e "$HOME/swiftshader/lib/libvk_swiftshader.so" ]; then cd $HOME ; wget https://ci.magnum.graphics/swiftshader-vulkan-r5464.a6940c8e6e-ubuntu-18.04.zip && mkdir -p swiftshader && cd swiftshader && unzip ../swiftshader-vulkan-r5464.a6940c8e6e-ubuntu-18.04.zip && cd $TRAVIS_BUILD_DIR ; fi + +# MoltenVk on macOS for the general desktop build (we just need to link against +# something as the tests aren't run anyway, desktop-vulkan uses Vulkan-Loader +# so this is an opportunity to test both) +- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install molten-vk; fi + +# SwiftShader on Mac, also self-hosted from GH Actions. We also need Vulkan +# loader there. +- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop-vulkan" ] && [ ! -e "$HOME/swiftshader/lib/libvk_swiftshader.dylib" ]; then cd $HOME ; wget https://ci.magnum.graphics/swiftshader-r5464.a6940c8e6e-macos-10.15.zip && mkdir -p swiftshader && cd swiftshader && unzip ../swiftshader-r5464.a6940c8e6e-macos-10.15.zip && cd $TRAVIS_BUILD_DIR ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop-vulkan" ] && [ ! -e "$HOME/vulkan-loader/lib/libvulkan.dylib" ]; then cd $HOME ; wget https://ci.magnum.graphics/vulkan-loader-1.2.153-macos-10.15.zip && mkdir -p vulkan-loader && cd vulkan-loader && unzip ../vulkan-loader-1.2.153-macos-10.15.zip && cd $TRAVIS_BUILD_DIR ; fi script: - if [ "$TRAVIS_OS_NAME" == "linux" ] && ( [ "$TARGET" == "desktop" ] || [ "$TARGET" == "desktop-sanitizers" ] ); then ./package/ci/travis-desktop.sh; fi -# Vulkan needs to be in a separate build, because it needs new CMake (for the -# Find module) and in the future also C++14. Unfortunately that means we can't -# apply the sanitizer or non-deprecated build on it. -- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-vulkan" ]; then ./package/ci/travis-desktop-vulkan.sh; fi +- if [ "$TARGET" == "desktop-vulkan" ]; then ./package/ci/travis-desktop-vulkan.sh; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-gles" ]; then ./package/ci/travis-desktop-gles.sh; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "android" ]; then ./package/ci/travis-android-arm.sh; fi - if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then ./package/ci/travis-desktop.sh; fi diff --git a/package/ci/unix-desktop-vulkan.sh b/package/ci/unix-desktop-vulkan.sh index 4a43f456d..97578fe43 100755 --- a/package/ci/unix-desktop-vulkan.sh +++ b/package/ci/unix-desktop-vulkan.sh @@ -17,20 +17,20 @@ cmake .. \ ninja install cd ../.. -# The fastest Vulkan driver ever. See travis.yml for why we have a separate -# Vulkan build. -g++ package/ci/libvulkan.cpp -std=c++11 -shared -o $HOME/libvulkan.so - # Enabling only stuff that's directly affected by Vulkan (which means also # parts of Platform, which need Trade for icon import in tests), disabling -# everything else. +# everything else. On Linux this uses a newer GCC because SwiftShader doesn't +# compile on 4.8; building of Vulkan Magnum code on GCC 4.8 is tested in the +# combined GL + Vulkan job. +# +# Not using CXXFLAGS in order to avoid affecting dependencies. mkdir build && cd build -# Not using CXXFLAGS in order to avoid affecting dependencies cmake .. \ -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ + `# Vulkan Loader is custom-built on Mac` \ + -DCMAKE_PREFIX_PATH="$HOME/deps;$HOME/vulkan-loader" \ -DCMAKE_INSTALL_PREFIX=$HOME/deps \ -DCMAKE_BUILD_TYPE=Debug \ - -DVulkan_LIBRARY=$HOME/libvulkan.so \ -DWITH_AUDIO=OFF \ -DWITH_DEBUGTOOLS=OFF \ -DWITH_GL=OFF \ @@ -70,7 +70,13 @@ cmake .. \ -DBUILD_DEPRECATED=$BUILD_DEPRECATED \ -G Ninja ninja -ASAN_OPTIONS="color=always" LSAN_OPTIONS="color=always suppressions=$TRAVIS_BUILD_DIR/package/ci/leaksanitizer.conf" CORRADE_TEST_COLOR=ON ctest -V -E "(GL|Vk)Test" + +export VK_ICD_FILENAMES=$HOME/swiftshader/share/vulkan/icd.d/vk_swiftshader_icd.json +export CORRADE_TEST_COLOR=ON + +ctest -V +MAGNUM_VULKAN_VERSION=1.0 CORRADE_TEST_SKIP_BENCHMARKS=ON ctest -V -R VkTest +MAGNUM_DISABLE_EXTENSIONS=VK_KHR_get_physical_device_properties2 MAGNUM_VULKAN_VERSION=1.0 CORRADE_TEST_SKIP_BENCHMARKS=ON ctest -V -R VkTest # Test install, after running the tests as for them it shouldn't be needed ninja install diff --git a/package/ci/unix-desktop.sh b/package/ci/unix-desktop.sh index c4ffa3e53..5c8732a3e 100755 --- a/package/ci/unix-desktop.sh +++ b/package/ci/unix-desktop.sh @@ -17,14 +17,23 @@ cmake .. \ ninja install cd ../.. +# Enabling both GL and Vulkan but not running rendering tests for either -- +# that's done by separate GLES and Vulkan jobs. For GL it's because there's no +# way to test desktop GL on SwiftShader, for Vulkan it's because: +# - SwiftShader doesn't compile on GCC 4.8 and we *need* to test compile on +# that, +# - SwiftShader for macOS is built on 10.15 and we want to test on older +# versions as well +# so we need two jobs to verify both compilation and rendering. +# +# Not using CXXFLAGS in order to avoid affecting dependencies. mkdir build && cd build -# Not using CXXFLAGS in order to avoid affecting dependencies cmake .. \ -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ -DCMAKE_INSTALL_PREFIX=$HOME/deps \ -DCMAKE_BUILD_TYPE=$CONFIGURATION \ -DWITH_AUDIO=ON \ - -DWITH_VK=OFF \ + -DWITH_VK=ON \ -DWITH_GLFWAPPLICATION=$BUILD_APPLICATIONS \ -DWITH_SDL2APPLICATION=$BUILD_APPLICATIONS \ -DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON \ @@ -48,15 +57,17 @@ cmake .. \ -DWITH_SCENECONVERTER=ON \ -DWITH_SHADERCONVERTER=ON \ -DWITH_GL_INFO=ON \ + -DWITH_VK_INFO=ON \ -DWITH_AL_INFO=ON \ -DBUILD_TESTS=ON \ -DBUILD_GL_TESTS=ON \ + -DBUILD_VK_TESTS=ON \ -DBUILD_DEPRECATED=$BUILD_DEPRECATED \ -DBUILD_STATIC=$BUILD_STATIC \ -DBUILD_PLUGINS_STATIC=$BUILD_STATIC \ -G Ninja ninja -ASAN_OPTIONS="color=always" LSAN_OPTIONS="color=always suppressions=$(pwd)/../package/ci/leaksanitizer.conf" TSAN_OPTIONS="color=always" CORRADE_TEST_COLOR=ON ctest -V -E GLTest +ASAN_OPTIONS="color=always" LSAN_OPTIONS="color=always suppressions=$(pwd)/../package/ci/leaksanitizer.conf" TSAN_OPTIONS="color=always" CORRADE_TEST_COLOR=ON ctest -V -E "(GL|Vk)Test" # Test install, after running the tests as for them it shouldn't be needed ninja install