From: Chris Forbes Date: Mon, 18 Jun 2018 23:52:10 +0000 (-0700) Subject: Add option to embed validation layers in Android package X-Git-Tag: upstream/1.3.5~2578 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=030ce2113c9a786ae4e0f629cc586408049688a0;p=platform%2Fupstream%2FVK-GL-CTS.git Add option to embed validation layers in Android package Based on https://github.com/KhronosGroup/VK-GL-CTS/pull/103 but reworked a bit to allow setting the path directly. This allows easy codevelopment of layers and tests. Components: Framework VK-GL-CTS: 1253 Change-Id: I232e48b82119f6bc358985d39be0def3c5a75766 --- diff --git a/external/vulkancts/README.md b/external/vulkancts/README.md index dd144d2..d42a7f8 100644 --- a/external/vulkancts/README.md +++ b/external/vulkancts/README.md @@ -364,6 +364,11 @@ By default `VK_DEBUG_REPORT_INFORMATION_BIT_EXT` and `_DEBUG_BIT_EXT` messages are excluded from the log, but that can be customized by modifying `vkt::TestCaseExecutor::deinit()` in `vktTestPackage.cpp`. +On the Android target, layers can be added to the APK during the build process +by setting the `--layers-path` command line option to point into the NDK or to +a locally-built layers tree. The layers are expected to be found under $abi/ +under the layers path. + Cherry GUI ---------- diff --git a/scripts/android/build_apk.py b/scripts/android/build_apk.py index df5c65c..309d6b6 100644 --- a/scripts/android/build_apk.py +++ b/scripts/android/build_apk.py @@ -29,6 +29,7 @@ import os import re import sys +import glob import string import shutil import argparse @@ -168,7 +169,7 @@ class Environment: self.ndk = ndk class Configuration: - def __init__(self, env, buildPath, abis, nativeApi, nativeBuildType, gtfTarget, verbose): + def __init__(self, env, buildPath, abis, nativeApi, nativeBuildType, gtfTarget, verbose, layers): self.env = env self.sourcePath = DEQP_DIR self.buildPath = buildPath @@ -178,6 +179,7 @@ class Configuration: self.nativeBuildType = nativeBuildType self.gtfTarget = gtfTarget self.verbose = verbose + self.layers = layers self.cmakeGenerator = selectFirstAvailableGenerator([NINJA_GENERATOR, MAKEFILE_GENERATOR, NMAKE_GENERATOR]) def check (self): @@ -709,6 +711,17 @@ class AddNativeLibsToAPK (BuildStep): shutil.copyfile(libSrcPath, libAbsPath) libFiles.append(libRelPath) + if config.layers: + layersGlob = os.path.join(config.layers, abi, "libVkLayer_*.so") + libVkLayers = glob.glob(layersGlob) + for layer in libVkLayers: + layerFilename = os.path.basename(layer) + layerRelPath = os.path.join("lib", abi, layerFilename) + layerAbsPath = os.path.join(pkgPath, layerRelPath) + shutil.copyfile(layer, layerAbsPath) + libFiles.append(layerRelPath) + print "Adding layer binary: %s" % (layer,) + shutil.copyfile(srcPath, dstPath) addFilesToAPK(config, dstPath, pkgPath, libFiles) @@ -884,6 +897,10 @@ def parseArgs (): default='gles32', choices=['gles32', 'gles31', 'gles3', 'gles2', 'gl'], help="KC-CTS (GTF) target API (only used in openglcts target)") + parser.add_argument('--layers-path', + dest='layers', + default=None, + required=False) args = parser.parse_args() @@ -918,7 +935,8 @@ if __name__ == "__main__": sdk = SDKEnv(os.path.realpath(args.sdkPath)) buildPath = os.path.realpath(args.buildRoot) env = Environment(sdk, ndk) - config = Configuration(env, buildPath, abis=args.abis, nativeApi=args.nativeApi, nativeBuildType=args.nativeBuildType, gtfTarget=args.gtfTarget, verbose=args.verbose) + config = Configuration(env, buildPath, abis=args.abis, nativeApi=args.nativeApi, nativeBuildType=args.nativeBuildType, gtfTarget=args.gtfTarget, verbose=args.verbose, + layers=args.layers) try: config.check()