- SDK Platforms > Android 6.0 and newer
- SDK Tools > Android SDK Build-Tools
- SDK Tools > Android SDK Platform-Tools
- - SDK Tools > Android SDK Tools
- - SDK Tools > NDK
+ - 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
-version, as Android Studio will roll it forward fairly regularly.
+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.
On Linux:
export ANDROID_SDK_HOME=$HOME/Android/sdk
- export ANDROID_NDK_HOME=$HOME/Android/sdk/ndk-bundle
- export PATH=$ANDROID_SDK_HOME:$PATH
+ export ANDROID_NDK_HOME=$HOME/Android/sdk/ndk/23.0.7599858
export PATH=$ANDROID_NDK_HOME:$PATH
- export PATH=$ANDROID_SDK_HOME/build-tools/23.0.3:$PATH
+ export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH
+ export PATH=$ANDROID_SDK_HOME/build-tools/31.0.0:$PATH
On Windows:
set ANDROID_SDK_HOME=%LOCALAPPDATA%\Android\sdk
- set ANDROID_NDK_HOME=%LOCALAPPDATA%\Android\sdk\ndk-bundle
- set PATH=%LOCALAPPDATA%\Android\sdk\ndk-bundle;%PATH%
+ 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%
On OSX:
export ANDROID_SDK_HOME=$HOME/Library/Android/sdk
- export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk-bundle
+ export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk/23.0.7599858
export PATH=$ANDROID_NDK_PATH:$PATH
- export PATH=$ANDROID_SDK_HOME/build-tools/23.0.3:$PATH
+ export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH
+ export PATH=$ANDROID_SDK_HOME/build-tools/31.0.0:$PATH
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,
sudo apt-get install openjdk-8-jdk
-#### Additional OSX System Requirements
-
-Tested on OSX version 10.13.3
-
-Setup Homebrew and components
-
-- Follow instructions on [brew.sh](http://brew.sh) to get Homebrew installed.
-
- /usr/bin/ruby -e "$(curl -fsSL \
- https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
-- Ensure Homebrew is at the beginning of your PATH:
-
- export PATH=/usr/local/bin:$PATH
-
-- Add packages with the following:
-
- brew install python
-
### Android Build
-There are two options for building the Android tools. Either using the SPIRV
-tools provided as part of the Android NDK, or using upstream sources. To build
-with SPIRV tools from the NDK, remove the build-android/third_party directory
-created by running update_external_sources_android.sh, (or avoid running
-update_external_sources_android.sh). Use the following script to build
-everything in the repository for Android, including validation layers, tests,
-demos, and APK packaging: This script does retrieve and use the upstream SPRIV
-tools.
+Use the following script to build the vkcube demo for Android:
cd build-android
./build_all.sh
-Test and application APKs can be installed on production devices with:
+The APK can be installed on production devices with:
./install_all.sh [-s <serial number>]
Note that there are no equivalent scripts on Windows yet, that work needs to
-be completed. The following per platform commands can be used for layer only
-builds:
-
-#### Linux and OSX
-
-Follow the setup steps for Linux or OSX above, then from your terminal:
-
- cd build-android
- ./update_external_sources_android.sh --no-build
- ./android-generate.sh
- ndk-build -j4
-
-#### Windows
-
-Follow the setup steps for Windows above, then from Developer Command Prompt
-for VS2013:
-
- cd build-android
- update_external_sources_android.bat
- android-generate.bat
- ndk-build
-
-### Android Tests and Demos
-
-After making any changes to the repository you should perform some quick
-sanity tests, including the layer validation tests and the vkcube
-demo with validation enabled.
-
-#### Run Layer Validation Tests
-
-Use the following steps to build, install, and run the layer validation tests
-for Android:
-
- cd build-android
- ./build_all.sh
- adb install -r bin/VulkanLayerValidationTests.apk
- adb shell am start com.example.VulkanLayerValidationTests/android.app.NativeActivity
-
-Alternatively, you can use the test_APK script to install and run the layer
-validation tests:
-
- test_APK.sh -s <serial number> -p <platform name> -f <gtest_filter>
-
-#### Run vkcube with Validation
-
-TODO: This must be reworked to pull in layers from the ValidationLayers repo
-
-Use the following steps to build, install, and run vkcube for Android:
-
- cd build-android
- ./build_all.sh
- adb install -r ../demos/android/cube/bin/vkcube.apk
- adb shell am start com.example.Cube/android.app.NativeActivity
-
-To build, install, and run Cube with validation layers,
-first build layers using steps above, then run:
-
- cd build-android
- ./build_all.sh
- adb install -r ../demos/android/cube-with-layers/bin/cube-with-layers.apk
-
-##### Run without validation enabled
+be completed.
- adb shell am start com.example.CubeWithLayers/android.app.NativeActivity
+### Run vkcube
-##### Run with validation enabled
+Use the following command to run vkcube for Android:
- adb shell am start -a android.intent.action.MAIN -c android-intent.category.LAUNCH -n com.example.CubeWithLayers/android.app.NativeActivity --es args "--validate"
+ adb shell am start com.example.VkCube/android.app.NativeActivity
## Building on MacOS
+++ /dev/null
-<?xml version="1.0"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.VulkanLayerValidationTests" android:versionCode="1" android:versionName="1.0">
-
- <!-- This is the platform API where NativeActivity was introduced. -->
- <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23"/>
-
- <!-- This .apk has no Java code itself, so set hasCode to false. -->
- <application android:label="@string/app_name" android:hasCode="false" android:debuggable='false'>
-
- <!-- This allows writing log files to sdcard -->
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-
- <!-- Our activity is the built-in NativeActivity framework class.
- This will take care of integrating with our NDK code. -->
- <activity android:name="android.app.NativeActivity" android:label="@string/app_name" android:exported="true">
- <!-- Tell NativeActivity the name of or .so -->
- <meta-data android:name="android.app.lib_name" android:value="VulkanLayerValidationTests"/>
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
+++ /dev/null
-Build Validation Layers with Android CMake Plugin
-=================================================
-Gradle project in this directory builds layers into AAR.
-The project could be directly added into application's gradle projects.
-[Android Studio 3.0.0+](https://developer.android.com/studio/index.html)
-IS required: earlier versions only publish release libs by default.
-
-Pre-requirements
-----------------
-Build ShaderC binary
-- Building from Github Repo source
-1. cd android-build
-2. ./update_external_sources_android.sh
-3. ./android-generate.sh
-
-Extra Steps if building from NDK's source tree
-```
- cd ${your ANDROID_NDK_ROOT}/sources/third_party/shaderc
- ndk-build APP_ABI=all APP_STL=c++_static NDK_TOOLCHAIN_VERSION=clang NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk libshaderc_combined
-```
-
-Adding layer module into Android Studio application project
---------------------------------------------------------
-1. app's settings.gradle, add
-```
- include ':layerLib'
- project(':layerLib').projectDir = new File('/path/to/cmake/layerlib')
-```
-2. app's build.gradle:
-```
-dependencies {
- // Android Studio 3.0.0+ is required
- implementation project(':layerLib')
-}
-```
-BUILD_IN_NDK variable in layerlib/CMakeLists.txt could detect whether the source is
-from NDK or github repo clone, and would configure the file paths accordingly
-
-Tested
------
-Build on Mac OS, tested on Google Pixel XL with Android Oreo.
-Equvilaent build scripts for Windows OS are at the same directory.
-
+++ /dev/null
-cmake_minimum_required(VERSION 3.4.1)
-
-# Validation layers could be built with code from
-# github repo OR
-# ndk's snapshot
-# The file structure for glslang spir-V is different, adding BUILD_IN_NDK variable
-set(BUILD_IN_NDK OFF)
-if (CMAKE_CURRENT_SOURCE_DIR MATCHES "sources/third_party/vulkan/src")
- set(BUILD_IN_NDK ON)
-endif()
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror \
- -Wno-unused-function -Wno-unused-const-variable \
- -Wno-c++98-compat-pedantic -DVK_PROTOTYPES \
- -DVK_USE_PLATFORM_ANDROID_KHR")
-
-if (BUILD_IN_NDK)
- # NDK directory structure:
- # $ANDROID_NDK/sources/third_party/
- # vulkan/src
- # shaderc/third_party (for glslang & spirv-tools )
- # this build uses combined lib libshaderc.a for libSPIRV-Tools.a purpose
- get_filename_component(SRC_DIR
- "${ANDROID_NDK}/sources/third_party/vulkan/src" ABSOLUTE)
- get_filename_component(EXTERNAL_DIR
- "${SRC_DIR}/../../shaderc/third_party" ABSOLUTE)
- get_filename_component(SPIRV_LIB
- "${SRC_DIR}/../../shaderc/libs/${ANDROID_STL}/${ANDROID_ABI}/libshaderc.a"
- ABSOLUTE)
-else ()
- # github directory structure:
- # ${SRC_DIR}
- # ${SRC_DIR}/build-android/external (for glslang, spirv-tools & shaderc )
- get_filename_component(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../.." ABSOLUTE)
- set(EXTERNAL_DIR "${SRC_DIR}/build-android/third_party/shaderc/third_party")
- set(SPIRV_LIB
- "${SRC_DIR}/build-android/third_party/shaderc/android_test/obj/local/${ANDROID_ABI}/libSPIRV-Tools.a")
-endif()
-set(COMMON_DIR "${SRC_DIR}/build-android/generated")
-
-set(CMAKE_CXX_clone "${CMAKE_CXX_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_ANDROID_KHR \
- -fvisibility=hidden")
-include_directories(${SRC_DIR}/include
- ${COMMON_DIR}/include
- ${SRC_DIR}/layers
- ${SRC_DIR}/loader)
-add_library(layer_utils STATIC
- ${SRC_DIR}/layers/vk_layer_config.cpp
- ${SRC_DIR}/layers/vk_layer_extension_utils.cpp
- ${SRC_DIR}/layers/vk_layer_utils.cpp
- ${SRC_DIR}/layers/vk_format_utils.cpp)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_clone}")
-
-# assume shaderc already built externally
-add_library(SPIRV-Tools-prebuilt STATIC IMPORTED)
-set_target_properties(SPIRV-Tools-prebuilt PROPERTIES IMPORTED_LOCATION
- ${SPIRV_LIB})
-
-# build core_validation layers which including shader validation
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_ANDROID_KHR \
- -fvisibility=hidden")
-add_library(VkLayer_core_validation SHARED
- ${SRC_DIR}/layers/core_validation.cpp
- ${SRC_DIR}/layers/descriptor_sets.cpp
- ${SRC_DIR}/layers/buffer_validation.cpp
- ${SRC_DIR}/layers/shader_validation.cpp
- ${SRC_DIR}/layers/vk_layer_table.cpp
- ${SRC_DIR}/layers/xxhash.c)
-target_include_directories(VkLayer_core_validation PRIVATE
- ${SRC_DIR}/include
- ${SRC_DIR}/layers
- ${COMMON_DIR}/include
- ${SRC_DIR}/loader
- ${EXTERNAL_DIR}/glslang
- ${EXTERNAL_DIR}/spirv-tools/include)
-target_link_libraries(VkLayer_core_validation PRIVATE
- log layer_utils SPIRV-Tools-prebuilt)
-
-add_library(VkLayer_parameter_validation SHARED
- ${COMMON_DIR}/include/parameter_validation.cpp
- ${SRC_DIR}/layers/parameter_validation_utils.cpp
- ${SRC_DIR}/layers/vk_layer_table.cpp)
-target_include_directories(VkLayer_parameter_validation PRIVATE
- ${SRC_DIR}/include
- ${COMMON_DIR}/include
- ${SRC_DIR}/layers
- ${SRC_DIR}/loader)
-target_link_libraries(VkLayer_parameter_validation PRIVATE log layer_utils)
-
-add_library(VkLayer_object_tracker SHARED
- ${COMMON_DIR}/include/object_tracker.cpp
- ${SRC_DIR}/layers/object_tracker_utils.cpp
- ${SRC_DIR}/layers/vk_layer_table.cpp)
-target_include_directories(VkLayer_object_tracker PRIVATE
- ${SRC_DIR}/include
- ${SRC_DIR}/layers
- ${COMMON_DIR}/include
- ${SRC_DIR}/loader)
-target_link_libraries(VkLayer_object_tracker PRIVATE log layer_utils)
-
-add_library(VkLayer_threading SHARED
- ${SRC_DIR}/layers/threading.cpp
- ${SRC_DIR}/layers/vk_layer_table.cpp)
-target_include_directories(VkLayer_threading PRIVATE
- ${SRC_DIR}/include
- ${SRC_DIR}/layers
- ${COMMON_DIR}/include
- ${SRC_DIR}/loader)
-target_link_libraries(VkLayer_threading PRIVATE log layer_utils)
-
-add_library(VkLayer_unique_objects SHARED
- ${SRC_DIR}/layers/unique_objects.cpp
- ${SRC_DIR}/layers/vk_layer_table.cpp)
-target_include_directories(VkLayer_unique_objects PRIVATE
- ${SRC_DIR}/include
- ${SRC_DIR}/layers
- ${COMMON_DIR}/include
- ${SRC_DIR}/loader)
-target_link_libraries(VkLayer_unique_objects PRIVATE log layer_utils)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_clone}")
+++ /dev/null
-apply plugin: 'com.android.library'
-
-android {
- /*
- * Required: Android Studio 3.0.0+!
- */
- compileSdkVersion 25
-
- defaultConfig {
- minSdkVersion 24
- targetSdkVersion 24
- versionCode 1
- versionName "1.0"
- ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
- externalNativeBuild {
- cmake.arguments '-DANDROID_TOOLCHAIN=clang',
- '-DANDROID_STL=c++_static',
- '-DANDROID_PLATFORM=android-24'
- }
- }
- externalNativeBuild {
- cmake.path 'CMakeLists.txt'
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'),
- 'proguard-rules.pro'
- }
- }
-}
-
+++ /dev/null
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${ANDROID_SDK}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
+++ /dev/null
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.layerlib">
-
- <application android:allowBackup="true" android:label="@string/app_name"
- android:supportsRtl="true">
-
- </application>
-
-</manifest>
+++ /dev/null
-<resources>
- <string name="app_name">Layer Library</string>
-</resources>
+++ /dev/null
-23ea3db3e5ea16b4964e9e3b5fee88bfc267fc57
+++ /dev/null
-https://github.com/KhronosGroup/glslang.git
+++ /dev/null
-# 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 := $(call my-dir)
-SRC_DIR := ../..
-
-$(call import-module,android/native_app_glue)
-$(call import-module,third_party/shaderc)
+++ /dev/null
-# 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-22
-APP_STL := c++_static
-NDK_TOOLCHAIN_VERSION := clang
-NDK_MODULE_PATH := .
+++ /dev/null
-APP_ABI := all
-APP_BUILD_SCRIPT := Android.mk
-APP_STL := c++_static
-APP_PLATFORM := android-23
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2016 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.
--->
-
-<!-- This file contains resource definitions for displayed strings, allowing
- them to be changed based on the locale and options. -->
-
-<resources>
- <!-- Simple strings. -->
- <string name="app_name">VulkanLayerValidationTests</string>
-
-</resources>
+++ /dev/null
-563bc6e87a43c38b5495469307922c768edbd191
+++ /dev/null
-https://github.com/google/shaderc.git
+++ /dev/null
-ce309203d7eceaf908bea8862c27f3e0749f7d00
+++ /dev/null
-https://github.com/KhronosGroup/SPIRV-Headers.git
+++ /dev/null
-5d442fad2f00fcca8354aaaa9bfd36be8c418a1b
+++ /dev/null
-https://github.com/KhronosGroup/SPIRV-Tools.git
+++ /dev/null
-#!/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.
-
-#
-# Parse parameters
-#
-
-function printUsage {
- echo "Supported parameters are:"
- echo " -p|--platform <platform> (optional)"
- echo " -f|--filter <gtest filter list> (optional)"
- echo " -s|--serial <target device serial number> (optional)"
- echo
- echo "i.e. ${0##*/} -p <platform> -f <test filter> -s <serial number>"
- 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
- -p|--platform)
- platform="$2"
- shift 2
- ;;
- -f|--filter)
- filter="$2"
- shift 2
- ;;
- -s|--serial)
- serial="$2"
- shift 2
- ;;
- -*)
- # unknown option
- echo Unknown option: $1
- echo
- printUsage
- exit 1
- ;;
- esac
-done
-
-if [[ $serial ]]; then
- 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
-
-if [[ -z $platform ]]
-then
- echo No platform specified.
- platform="UnspecifiedPlatform"
-fi
-
-if [[ -z $filter ]]
-then
- echo No filter specified, running all tests.
- filter="*"
-fi
-
-if [[ $platform ]]; then echo platform = "${platform}"; fi
-if [[ $filter ]]; then echo filter = "${filter}"; fi
-if [[ $serial ]]; then echo serial = "${serial}"; fi
-
-set -ev
-
-#
-# Start up
-#
-
-# Wake up the device
-adb $serialFlag shell input keyevent "KEYCODE_MENU"
-adb $serialFlag shell input keyevent "KEYCODE_HOME"
-
-# Grab our Android test mutex
-# Wait for any existing test runs on the devices
-
-# Blow away the lock if tests run too long, avoiding infinite loop
-lock_seconds=1200 # Duration in seconds.
-lock_end_time=$(( $(date +%s) + lock_seconds )) # Calculate end time.
-
-until mkdir /var/tmp/VkLayerValidationTests.$serial.lock
-do
- sleep 5
- echo "Waiting for existing Android test to complete on $serial"
-
- if [ $(date +%s) -gt $lock_end_time ]
- then
- echo "Lock timeout reached: $lock_seconds seconds"
- echo "Deleting /var/tmp/VkLayerValidationTests.$serial.lock"
- rm -r /var/tmp/VkLayerValidationTests.$serial.lock
- fi
-done
-
-# Clean up our lock on any exit condition
-function finish {
- rm -r /var/tmp/VkLayerValidationTests.$serial.lock
-}
-trap finish EXIT
-
-# Clear the log
-adb $serialFlag logcat -c
-
-# Ensure any previous activity has stopped, otherwise it won't run tests
-adb $serialFlag shell am force-stop com.example.VulkanLayerValidationTests
-
-# Remove any existing APK that may have been installed from another host
-# Disable exit on error in case the APK is not present
-set +e
-adb $serialFlag shell pm list packages | grep com.example.VulkanLayerValidationTests
-if [ $? -eq 0 ]
-then
- adb $serialFlag uninstall com.example.VulkanLayerValidationTests
-fi
-# Re-enable exit on error
-set -e
-
-# Install the current build
-adb $serialFlag install -r bin/VulkanLayerValidationTests.apk
-
-# Kick off the tests with known expection list
-adb $serialFlag shell am start -a android.intent.action.MAIN -c android-intent.category.LAUNCH -n com.example.VulkanLayerValidationTests/android.app.NativeActivity --es args --gtest_filter="${filter}"
-
-#
-# Scrape the log until we get pass/fail/crash
-#
-
-# The following loop will give tests 20 minutes to pass/fail/crash
-seconds=1200 # Duration in seconds.
-endTime=$(( $(date +%s) + seconds )) # Calculate end time.
-
-exitCode=-1;
-
-# Disable exit on error, we expect grep to fail multiple times in this loop
-set +e
-
-while [ $(date +%s) -lt $endTime ]; do # Loop until interval has elapsed.
-
- # The following line is printed from android_main on success
- adb $serialFlag logcat -d | grep "==== Tests PASSED ===="
- if [ $? -eq 0 ]
- then
- echo VulkanLayerValidationTests PASSED!
- exitCode=0
- break
- fi
-
- # The following line is printed from android_main on failure
- adb $serialFlag logcat -d | grep "==== Tests FAILED ===="
- if [ $? -eq 0 ]
- then
- echo VulkanLayerValidationTests FAILED!
- exitCode=1
- break
- fi
-
- # developer.android.com recommends searching for the following string to detect native crash
- adb $serialFlag logcat -d | grep "\*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\* \*\*\*"
- if [ $? -eq 0 ]
- then
- exitCode=2
- echo VulkanLayerValidationTests CRASHED!
- break
- fi
-
- sleep 5
-
-done
-
-# Re-enable exit on error
-set -e
-
-if [ $exitCode -eq -1 ]
-then
- echo "VulkanLayerValidationTests hasn't completed in $seconds seconds. Script exiting."
-fi
-
-#
-# Cleanup
-#
-
-# Return to home screen to clear any error pop-ups
-adb $serialFlag shell input keyevent "KEYCODE_HOME"
-
-# Stop the activity
-adb $serialFlag shell am force-stop com.example.VulkanLayerValidationTests
-
-today=$(date +%Y-%m-%d.%H:%M:%S)
-outFile="VulkanLayerValidationTests.$platform.$today.out.txt"
-errFile="VulkanLayerValidationTests.$platform.$today.err.txt"
-adb $serialFlag pull /sdcard/Android/data/com.example.VulkanLayerValidationTests/files/out.txt VulkanLayerValidationTests.$platform.$today.out.txt
-adb $serialFlag pull /sdcard/Android/data/com.example.VulkanLayerValidationTests/files/err.txt VulkanLayerValidationTests.$platform.$today.err.txt
-
-if [ -f $outFile ]; then
- echo $outFile size $(wc -c < $outFile)
-fi
-
-if [ -f $errFile ]; then
- echo $errFile size $(wc -c < $errFile)
-fi
-
-echo
-echo ===== Dumping logcat of VulkanLayerValidationTests =====
-echo If the test is crashing, be sure to inspect full log for complete stack trace.
-echo "adb $serialFlag logcat -d | grep VulkanLayerValidationTests"
-echo ========================================================
-echo
-adb $serialFlag logcat -d | grep VulkanLayerValidationTests
-
-exit $exitCode
@echo off
-REM Update source for glslang, spirv-tools, shaderc, vulkan-headers
+REM Update source for vulkan-headers
REM
REM Copyright 2016 The Android Open Source Project
set ANDROID_BUILD_DIR=%~dp0
set BUILD_DIR=%ANDROID_BUILD_DIR%
set BASE_DIR=%BUILD_DIR%\third_party
-set GLSLANG_DIR=%BASE_DIR%\shaderc\third_party\glslang
-set SPIRV_TOOLS_DIR=%BASE_DIR%\shaderc\third_party\spirv-tools
-set SPIRV_HEADERS_DIR=%BASE_DIR%\shaderc\third_party\spirv-tools\external\spirv-headers
-set SHADERC_DIR=%BASE_DIR%\shaderc
set VULKAN_HEADERS_DIR=%BASE_DIR%\Vulkan-Headers
for %%X in (where.exe) do (set FOUND=%%~$PATH:X)
REM Read the target versions from external file, which is shared with Linux script
-if not exist %ANDROID_BUILD_DIR%\glslang_revision_android (
- echo.
- echo Missing glslang_revision_android file. Place it in %ANDROID_BUILD_DIR%
- goto:error
-)
-
-if not exist %ANDROID_BUILD_DIR%\spirv-tools_revision_android (
- echo.
- echo Missing spirv-tools_revision_android file. Place it in %ANDROID_BUILD_DIR%
- set errorCode=1
- goto:error
-)
-
-if not exist %ANDROID_BUILD_DIR%\spirv-headers_revision_android (
- echo.
- echo Missing spirv-headers_revision_android file. Place it in %ANDROID_BUILD_DIR%
- set errorCode=1
- goto:error
-)
-
-if not exist %ANDROID_BUILD_DIR%\shaderc_revision_android (
- echo.
- echo Missing shaderc_revision_android file. Place it in %ANDROID_BUILD_DIR%
- set errorCode=1
- goto:error
-)
-
if not exist %ANDROID_BUILD_DIR%\vulkan-headers_revision_android (
echo.
echo Missing vulkan-headers_revision_android file. Place it in %ANDROID_BUILD_DIR%
goto:error
)
-set /p GLSLANG_REVISION= < glslang_revision_android
-set /p SPIRV_TOOLS_REVISION= < spirv-tools_revision_android
-set /p SPIRV_HEADERS_REVISION= < spirv-headers_revision_android
-set /p SHADERC_REVISION= < shaderc_revision_android
set /p VULKAN_HEADERS_REVISION= < vulkan-headers_revision_android
-echo GLSLANG_REVISION=%GLSLANG_REVISION%
-echo SPIRV_TOOLS_REVISION=%SPIRV_TOOLS_REVISION%
-echo SPIRV_HEADERS_REVISION=%SPIRV_HEADERS_REVISION%
-echo SHADERC_REVISION=%SHADERC_REVISION%
echo VULKAN_HEADERS_REVISION=%VULKAN_HEADERS_REVISION%
-echo Creating and/or updating glslang, spirv-tools, spirv-headers, shaderc, vulkan-headers in %BASE_DIR%
+echo Creating vulkan-headers in %BASE_DIR%
-set sync-glslang=0
-set sync-spirv-tools=0
-set sync-spirv-headers=0
-set sync-shaderc=0
set sync-vulkan-headers=1
-set build-shaderc=0
-
-if %sync-shaderc% equ 1 (
- if not exist %SHADERC_DIR% (
- call:create_shaderc
- )
- if %errorCode% neq 0 (goto:error)
- call:update_shaderc
- if %errorCode% neq 0 (goto:error)
-)
-
-if %sync-glslang% equ 1 (
- if not exist %GLSLANG_DIR% (
- call:create_glslang
- )
- if %errorCode% neq 0 (goto:error)
- call:update_glslang
- if %errorCode% neq 0 (goto:error)
-)
-
-if %sync-spirv-tools% equ 1 (
- if %ERRORLEVEL% neq 0 (goto:error)
- if not exist %SPIRV_TOOLS_DIR% (
- call:create_spirv-tools
- )
- if %errorCode% neq 0 (goto:error)
- call:update_spirv-tools
- if %errorCode% neq 0 (goto:error)
-)
-
-if %sync-spirv-headers% equ 1 (
- if %ERRORLEVEL% neq 0 (goto:error)
- if not exist %SPIRV_HEADERS_DIR% (
- call:create_spirv-headers
- )
- if %errorCode% neq 0 (goto:error)
- call:update_spirv-headers
- if %errorCode% neq 0 (goto:error)
-)
if %sync-vulkan-headers% equ 1 (
if %ERRORLEVEL% neq 0 (goto:error)
if %errorCode% neq 0 (goto:error)
)
-if %build-shaderc% equ 1 (
- call:build_shaderc
- if %errorCode% neq 0 (goto:error)
-)
-
echo.
echo Exiting
goto:finish
REM // ======== Functions ======== //
-:create_glslang
- echo.
- echo Creating local glslang repository %GLSLANG_DIR%
- if not exist "%GLSLANG_DIR%\" mkdir %GLSLANG_DIR%
- cd %GLSLANG_DIR%
- git clone https://github.com/KhronosGroup/glslang.git .
- git checkout %GLSLANG_REVISION%
- if not exist %GLSLANG_DIR%\SPIRV (
- echo glslang source download failed!
- set errorCode=1
- )
-goto:eof
-
-:update_glslang
- echo.
- echo Updating %GLSLANG_DIR%
- cd %GLSLANG_DIR%
- git fetch --all
- git checkout %GLSLANG_REVISION%
- if not exist %GLSLANG_DIR%\SPIRV (
- echo glslang source update failed!
- set errorCode=1
- )
-goto:eof
-
-:create_spirv-tools
- echo.
- echo Creating local spirv-tools repository %SPIRV_TOOLS_DIR%
- if not exist "%SPIRV_TOOLS_DIR%\" mkdir %SPIRV_TOOLS_DIR%
- cd %SPIRV_TOOLS_DIR%
- git clone https://github.com/KhronosGroup/SPIRV-Tools.git .
- git checkout %SPIRV_TOOLS_REVISION%
- if not exist %SPIRV_TOOLS_DIR%\source (
- echo spirv-tools source download failed!
- set errorCode=1
- )
-goto:eof
-
-:update_spirv-tools
- echo.
- echo Updating %SPIRV_TOOLS_DIR%
- cd %SPIRV_TOOLS_DIR%
- git fetch --all
- git checkout %SPIRV_TOOLS_REVISION%
- if not exist %SPIRV_TOOLS_DIR%\source (
- echo spirv-tools source update failed!
- set errorCode=1
- )
-goto:eof
-
-:create_spirv-headers
- echo.
- echo Creating local spirv-headers repository %SPIRV_HEADERS_DIR%
- if not exist "%SPIRV_HEADERS_DIR%\" mkdir %SPIRV_HEADERS_DIR%
- cd %SPIRV_HEADERS_DIR%
- git clone https://github.com/KhronosGroup/SPIRV-Headers.git .
- git checkout %SPIRV_HEADERS_REVISION%
- if not exist %SPIRV_HEADERS_DIR%\include (
- echo spirv-headers source download failed!
- set errorCode=1
- )
-goto:eof
-
-:update_spirv-headers
- echo.
- echo Updating %SPIRV_HEADERS_DIR%
- cd %SPIRV_HEADERS_DIR%
- git fetch --all
- git checkout %SPIRV_HEADERS_REVISION%
- if not exist %SPIRV_HEADERS_DIR%\include (
- echo spirv-headers source update failed!
- set errorCode=1
- )
-goto:eof
-
-:create_shaderc
- echo.
- echo Creating local shaderc repository %SHADERC_DIR%
- if not exist "%SHADERC_DIR%\" mkdir %SHADERC_DIR%
- cd %SHADERC_DIR%
- git clone https://github.com/google/shaderc.git .
- git checkout %SHADERC_REVISION%
- if not exist %SHADERC_DIR%\libshaderc (
- echo shaderc source download failed!
- set errorCode=1
- )
-goto:eof
-
-:update_shaderc
- echo.
- echo Updating %SHADERC_DIR%
- cd %SHADERC_DIR%
- git fetch --all
- git checkout %SHADERC_REVISION%
- if not exist %SHADERC_DIR%\libshaderc (
- echo shaderc source update failed!
- set errorCode=1
- )
-goto:eof
-
-:build_shaderc
- echo.
- echo Building %SHADERC_DIR%
- cd %SHADERC_DIR%\android_test
- echo Building shaderc with Android NDK
- call ndk-build NDK_APPLICATION_MK=../../../jni/shaderc/Application.mk THIRD_PARTY_PATH=../third_party -j 4
- REM Check for existence of one lib, even though we should check for all results
- if not exist %SHADERC_DIR%\android_test\obj\local\x86\libshaderc.a (
- echo.
- echo shaderc build failed!
- set errorCode=1
- )
-goto:eof
-
:create_vulkan-headers
echo.
echo Creating local vulkan-headers repository %VULKAN_HEADERS_DIR%
#!/bin/bash
-# Update source for glslang, spirv-tools, shaderc, vulkan-headers
+# Update source for vulkan-headers
# Copyright 2016 The Android Open Source Project
# Copyright (C) 2015 Valve Corporation
set -e
-sync_glslang=0
-sync_spirv_tools=0
-sync_spirv_headers=0
-sync_shaderc=0
sync_vulkan_headers=1
ANDROIDBUILDDIR=$PWD
BUILDDIR=$ANDROIDBUILDDIR
BASEDIR=$BUILDDIR/third_party
-GLSLANG_REVISION=$(cat $ANDROIDBUILDDIR/glslang_revision_android)
-SPIRV_TOOLS_REVISION=$(cat $ANDROIDBUILDDIR/spirv-tools_revision_android)
-SPIRV_HEADERS_REVISION=$(cat $ANDROIDBUILDDIR/spirv-headers_revision_android)
-SHADERC_REVISION=$(cat $ANDROIDBUILDDIR/shaderc_revision_android)
VULKAN_HEADERS_REVISION=$(cat $ANDROIDBUILDDIR/vulkan-headers_revision_android)
-echo "GLSLANG_REVISION=$GLSLANG_REVISION"
-echo "SPIRV_TOOLS_REVISION=$SPIRV_TOOLS_REVISION"
-echo "SPIRV_HEADERS_REVISION=$SPIRV_HEADERS_REVISION"
-echo "SHADERC_REVISION=$SHADERC_REVISION"
echo "VULKAN_HEADERS_REVISION=$VULKAN_HEADERS_REVISION"
-GLSLANG_URL=$(cat $ANDROIDBUILDDIR/glslang_url_android)
-SPIRV_TOOLS_URL=$(cat $ANDROIDBUILDDIR/spirv-tools_url_android)
-SPIRV_HEADERS_URL=$(cat $ANDROIDBUILDDIR/spirv-headers_url_android)
-SHADERC_URL=$(cat $ANDROIDBUILDDIR/shaderc_url_android)
VULKAN_HEADERS_URL=$(cat $ANDROIDBUILDDIR/vulkan-headers_url_android)
-echo "GLSLANG_URL=$GLSLANG_URL"
-echo "SPIRV_TOOL_URLS_=$SPIRV_TOOLS_URL"
-echo "SPIRV_HEADERS_URL=$SPIRV_HEADERS_URL"
-echo "SHADERC_URL=$SHADERC_URL"
-echo "VULKAN_HEADERS_URL=$VULKAN_HEADERS_URL"
-
if [[ $(uname) == "Linux" ]]; then
cores="$(nproc || echo 4)"
elif [[ $(uname) == "Darwin" ]]; then
echo Skipping build.
fi
-function create_glslang () {
- rm -rf $BASEDIR/shaderc/third_party/glslang
- echo "Creating local glslang repository ($BASEDIR/glslang)."
- mkdir -p $BASEDIR/shaderc/third_party/glslang
- cd $BASEDIR/shaderc/third_party/glslang
- git clone $GLSLANG_URL .
- git checkout $GLSLANG_REVISION
-}
-
-function update_glslang () {
- echo "Updating $BASEDIR/shaderc/third_party/glslang"
- cd $BASEDIR/shaderc/third_party/glslang
- if [[ $(git config --get remote.origin.url) != $GLSLANG_URL ]]; then
- echo "glslang URL mismatch, recreating local repo"
- create_glslang
- return
- fi
- git fetch --all
- git checkout $GLSLANG_REVISION
-}
-
-function create_spirv-tools () {
- rm -rf $BASEDIR/shaderc/third_party/spirv-tools
- echo "Creating local spirv-tools repository ($BASEDIR/shaderc/third_party/spirv-tools)."
- mkdir -p $BASEDIR/shaderc/third_party/spirv-tools
- cd $BASEDIR/shaderc/third_party/spirv-tools
- git clone $SPIRV_TOOLS_URL .
- git checkout $SPIRV_TOOLS_REVISION
-}
-
-function update_spirv-tools () {
- echo "Updating $BASEDIR/shaderc/third_party/spirv-tools"
- cd $BASEDIR/shaderc/third_party/spirv-tools
- if [[ $(git config --get remote.origin.url) != $SPIRV_TOOLS_URL ]]; then
- echo "spirv-tools URL mismatch, recreating local repo"
- create_spirv-tools
- return
- fi
- git fetch --all
- git checkout $SPIRV_TOOLS_REVISION
-}
-
-function create_spirv-headers () {
- rm -rf $BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers
- echo "Creating local spirv-headers repository ($BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers)."
- mkdir -p $BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers
- cd $BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers
- git clone $SPIRV_HEADERS_URL .
- git checkout $SPIRV_HEADERS_REVISION
-}
-
-function update_spirv-headers () {
- echo "Updating $BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers"
- cd $BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers
- if [[ $(git config --get remote.origin.url) != $SPIRV_HEADERS_URL ]]; then
- echo "spirv-headers URL mismatch, recreating local repo"
- create_spirv-headers
- return
- fi
- git fetch --all
- git checkout $SPIRV_HEADERS_REVISION
-}
-
-function create_shaderc () {
- rm -rf $BASEDIR/shaderc
- echo "Creating local shaderc repository ($BASEDIR/shaderc)."
- mkdir -p $BASEDIR/shaderc
- cd $BASEDIR/shaderc
- git clone $SHADERC_URL .
- git checkout $SHADERC_REVISION
-}
-
-function update_shaderc () {
- echo "Updating $BASEDIR/shaderc"
- cd $BASEDIR/shaderc
- if [[ $(git config --get remote.origin.url) != $SHADERC_URL ]]; then
- echo "shaderc URL mismatch, recreating local repo"
- create_shaderc
- return
- fi
- git fetch --all
- git checkout $SHADERC_REVISION
-}
-
-function build_shaderc () {
- echo "Building $BASEDIR/shaderc"
- cd $BASEDIR/shaderc/android_test
- if [[ $abi ]]; then
- ndk-build NDK_APPLICATION_MK=../../../jni/shaderc/Application.mk THIRD_PARTY_PATH=../third_party APP_ABI=$abi -j $cores;
- else
- ndk-build NDK_APPLICATION_MK=../../../jni/shaderc/Application.mk THIRD_PARTY_PATH=../third_party -j $cores;
- fi
-}
-
function create_vulkan-headers () {
rm -rf $BASEDIR/Vulkan-Headers
echo "Creating local Vulkan-Headers repository ($BASEDIR/Vulkan-Headers)."
git checkout $VULKAN_HEADERS_REVISION
}
-if [ $sync_shaderc -eq 1 ]; then
- if [ ! -d "$BASEDIR/shaderc" -o ! -d "$BASEDIR/shaderc/.git" ]; then
- create_shaderc
- fi
- update_shaderc
-fi
-
-if [ $sync_glslang -eq 1 ]; then
- if [ ! -d "$BASEDIR/shaderc/third_party/glslang" -o ! -d "$BASEDIR/shaderc/third_party/glslang/.git" -o -d "$BASEDIR/shaderc/third_party/glslang/.svn" ]; then
- create_glslang
- fi
- update_glslang
-fi
-
-if [ $sync_spirv_tools -eq 1 ]; then
- if [ ! -d "$BASEDIR/shaderc/third_party/spirv-tools" -o ! -d "$BASEDIR/shaderc/third_party/spirv-tools/.git" ]; then
- create_spirv-tools
- fi
- update_spirv-tools
-fi
-
-if [ $sync_spirv_headers -eq 1 ]; then
- if [ ! -d "$BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers" -o ! -d "$BASEDIR/shaderc/third_party/spirv-tools/external/spirv-headers/.git" ]; then
- create_spirv-headers
- fi
- update_spirv-headers
-fi
-
if [ $sync_vulkan_headers -eq 1 ]; then
if [ ! -d "$BASEDIR/Vulkan-Headers" -o ! -d "$BASEDIR/Vulkan-Headers/.git" ]; then
create_vulkan-headers
update_vulkan-headers
fi
-if [[ -z $nobuild ]]
-then
-build_shaderc
-fi
-
echo ""
echo "${0##*/} finished."