From 488e8dd468817a06b8f79889f3a40aa394569e2b Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 18 Jul 2024 17:15:06 -0700 Subject: [PATCH] Get the Vulkan Validation Layers from Maven. --- gradle/libs.versions.toml | 2 ++ hello-vulkan/README.md | 12 ------------ hello-vulkan/app/build.gradle | 3 ++- settings.gradle | 10 ++++++++++ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c6302cc8d..864a87626 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,6 +18,7 @@ curl = "7.79.1-beta-1" googletest = "1.11.0-beta-1" jsoncpp = "1.9.5-beta-1" openssl = "1.1.1q-beta-1" +vulkanValidationLayers = "1.3.283.0" [libraries] junit = { group = "junit", name = "junit", version.ref = "junit" } @@ -40,6 +41,7 @@ openssl = { group = "com.android.ndk.thirdparty", name = "openssl", version.ref # build-logic dependencies android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" } +vulkan-validationLayers = { module = "com.github.danalbert.vvl:vulkan-validation-layers", version.ref = "vulkanValidationLayers" } [plugins] android-application = { id = "com.android.application", version.ref = "agp" } diff --git a/hello-vulkan/README.md b/hello-vulkan/README.md index e445e5ee4..efbc119e2 100644 --- a/hello-vulkan/README.md +++ b/hello-vulkan/README.md @@ -32,18 +32,6 @@ features such as: ![Vulkan Triangle example](documentation-assets/example-triangle.png) -## Validation layers - -As the validation layer is a sizeable download, we chose to not ship them within -the apk. As such in order to enable validation layer, please follow the simple -steps below: - -1. Download the latest android binaries from: - https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases -1. Place them in their respective ABI folders located in: app/src/main/jniLibs -1. Go to hellovk.h, search for 'bool enableValidationLayers = false' and toggle - that to true. - ## Extra information: As Vulkan is well documented we will not provide detailed instructions regarding diff --git a/hello-vulkan/app/build.gradle b/hello-vulkan/app/build.gradle index 32e3bcea9..c00ef87d8 100644 --- a/hello-vulkan/app/build.gradle +++ b/hello-vulkan/app/build.gradle @@ -21,7 +21,7 @@ plugins { android { namespace 'com.android.hellovk' - + defaultConfig { applicationId 'com.android.hellovk' // TODO: Figure out why this isn't 24. @@ -52,4 +52,5 @@ android { dependencies { implementation libs.appcompat implementation libs.androidx.games.gameactivity + debugImplementation(libs.vulkan.validationLayers) } diff --git a/settings.gradle b/settings.gradle index f0d4b009a..00b342cb5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,11 +12,21 @@ pluginManagement { gradlePluginPortal() } } + dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() + maven { + url = uri("https://maven.pkg.github.com/DanAlbert/Vulkan-ValidationLayers") + // This is apparently required even for public packages. Should probably push these to + // Maven Central instead... + credentials { + username = settings.ext.find("gpr.user") ?: System.getenv("USERNAME") + password = settings.ext.find("gpr.key") ?: System.getenv("TOKEN") + } + } } }