# See the License for the specific language governing permissions and
# limitations under the License.
+ANDROID_BUILD_DIR=$(dirname $(readlink -f $0))
+PROJECT_DIR=$ANDROID_BUILD_DIR/..
+
if [ -z "${ANDROID_SDK_HOME}" ];
then echo "Please set ANDROID_SDK_HOME, exiting"; exit 1;
else echo "ANDROID_SDK_HOME is ${ANDROID_SDK_HOME}";
set -ev
-DEMO_BUILD_DIR=$PWD/../cube/android
+VULKANINFO_BUILD_DIR=$PROJECT_DIR/vulkaninfo/android
+echo VULKANINFO_BUILD_DIR="${VULKANINFO_BUILD_DIR}"
+
+DEMO_BUILD_DIR=$PROJECT_DIR/cube/android
echo DEMO_BUILD_DIR="${DEMO_BUILD_DIR}"
function create_APK() {
zipalign -f 4 bin/$1-unaligned.apk bin/$1.apk
}
+#
+# update dependencies
+#
+(
+pushd $ANDROID_BUILD_DIR
./update_external_sources_android.sh --no-build
+popd
+pushd $PROJECT_DIR
+python3 scripts/generate_source.py $ANDROID_BUILD_DIR/third_party/Vulkan-Headers/registry --incremental
+popd
+)
+
+#
+# build vulkaninfo
+#
+(
+pushd $VULKANINFO_BUILD_DIR
+ndk-build -j $cores
+popd
+)
#
# build vkcube APK
--- /dev/null
+bin
+libs
+obj
--- /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 := $(abspath $(call my-dir))
+SRC_DIR := $(LOCAL_PATH)/../../..
+VULKANINFO_DIR := $(SRC_DIR)/vulkaninfo
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := vulkaninfo
+LOCAL_SRC_FILES += $(VULKANINFO_DIR)/vulkaninfo.cpp
+LOCAL_C_INCLUDES += $(SRC_DIR)/build-android/third_party/Vulkan-Headers/include \
+ $(VULKANINFO_DIR) \
+ $(VULKANINFO_DIR)/generated
+LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR -DVK_ENABLE_BETA_EXTENSIONS
+LOCAL_LDLIBS := -llog -landroid
+include $(BUILD_EXECUTABLE)
--- /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-23
+APP_STL := c++_static
+APP_MODULES := vulkaninfo
+APP_CPPFLAGS += -std=c++11 -fexceptions -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
+APP_CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
+NDK_TOOLCHAIN_VERSION := clang
#if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WIN32_KHR) || \
defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_WAYLAND_KHR) || \
- defined(VK_USE_PLATFORM_DIRECTFB_EXT) || defined(VK_USE_PLATFORM_ANDROID_KHR) || defined(VK_USE_PLATFORM_GGP)
+ defined(VK_USE_PLATFORM_DIRECTFB_EXT) || defined(VK_USE_PLATFORM_GGP)
#define VULKANINFO_WSI_ENABLED
#endif
+
+//-----------------------------------------------------------
+#if defined(VULKANINFO_WSI_ENABLED)
+static void AppDestroySurface(AppInstance &inst, VkSurfaceKHR surface) { // same for all platforms
+ inst.dll.fp_vkDestroySurfaceKHR(inst.instance, surface, nullptr);
+}
+#endif // defined(VULKANINFO_WSI_ENABLED)
+//-----------------------------------------------------------
+
//---------------------------Win32---------------------------
#ifdef VK_USE_PLATFORM_WIN32_KHR
#endif // VK_USE_PLATFORM_WIN32_KHR
//-----------------------------------------------------------
-#if defined(VULKANINFO_WSI_ENABLED)
-static void AppDestroySurface(AppInstance &inst, VkSurfaceKHR surface) { // same for all platforms
- inst.dll.fp_vkDestroySurfaceKHR(inst.instance, surface, nullptr);
-}
-#endif // defined(VULKANINFO_WSI_ENABLED)
//----------------------------XCB----------------------------
-
#ifdef VK_USE_PLATFORM_XCB_KHR
static void AppCreateXcbWindow(AppInstance &inst) {
//--Init Connection--
createInfo.flags = 0;
createInfo.window = (struct ANativeWindow *)(inst.window);
- err = inst.dll.fp_vkCreateAndroidSurfaceKHR(inst.inst, &createInfo, NULL, &inst.surface);
- THROW_VK_ERR("vkCreateAndroidSurfaceKHR", err);
+ VkSurfaceKHR surface;
+ VkResult err = inst.dll.fp_vkCreateAndroidSurfaceKHR(inst.instance, &createInfo, NULL, &surface);
+ if (err) THROW_VK_ERR("vkCreateAndroidSurfaceKHR", err);
+ return surface;
}
-static VkSurfaceKHR AppDestroyAndroidSurface(AppInstance &inst) {}
+static void AppDestroyAndroidWindow(AppInstance &inst) {}
#endif
//-----------------------------------------------------------
//---------------------------GGP-----------------------------
//--ANDROID--
#ifdef VK_USE_PLATFORM_ANDROID_KHR
SurfaceExtension surface_ext_android;
- if (inst.CheckExtensionEnabled(VK_ANDROID_SURFACE_EXTENSION_NAME)) {
- surface_ext_android.name = VK_ANDROID_SURFACE_EXTENSION_NAME;
+ if (inst.CheckExtensionEnabled(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME)) {
+ surface_ext_android.name = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
surface_ext_android.create_window = AppCreateAndroidWindow;
surface_ext_android.create_surface = AppCreateAndroidSurface;
surface_ext_android.destroy_window = AppDestroyAndroidWindow;