From 6125cdb5cb163f77b9dde57e204e2ea1eb9690f3 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Sat, 11 Mar 2017 12:13:42 +0100 Subject: [PATCH] Android build files for deferred multisampling --- android/build-all.bat | 1 + android/deferredmultisampling/.gitignore | 10 ++++ .../deferredmultisampling/AndroidManifest.xml | 28 +++++++++ android/deferredmultisampling/build.py | 58 +++++++++++++++++++ android/deferredmultisampling/jni/Android.mk | 48 +++++++++++++++ .../deferredmultisampling/jni/Application.mk | 6 ++ android/uninstall-all.bat | 1 + 7 files changed, 152 insertions(+) create mode 100644 android/deferredmultisampling/.gitignore create mode 100644 android/deferredmultisampling/AndroidManifest.xml create mode 100644 android/deferredmultisampling/build.py create mode 100644 android/deferredmultisampling/jni/Android.mk create mode 100644 android/deferredmultisampling/jni/Application.mk diff --git a/android/build-all.bat b/android/build-all.bat index a072345b..99dc7166 100644 --- a/android/build-all.bat +++ b/android/build-all.bat @@ -36,6 +36,7 @@ call _build debugmarker %1 call _build scenerendering %1 call _build terraintessellation %1 call _build deferredshadows %1 +call _buold deferredmulitsampling %1 call _build indirectdraw %1 call _build texturemipmapgen %1 call _build texture3d %1 diff --git a/android/deferredmultisampling/.gitignore b/android/deferredmultisampling/.gitignore new file mode 100644 index 00000000..7a5d249c --- /dev/null +++ b/android/deferredmultisampling/.gitignore @@ -0,0 +1,10 @@ +/assets/ +/res/ +/bin/ +/libs/ +/obj/ +/build.xml +/local.properties +/project.properties +/proguard-project.txt +*.apk \ No newline at end of file diff --git a/android/deferredmultisampling/AndroidManifest.xml b/android/deferredmultisampling/AndroidManifest.xml new file mode 100644 index 00000000..64906144 --- /dev/null +++ b/android/deferredmultisampling/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/android/deferredmultisampling/build.py b/android/deferredmultisampling/build.py new file mode 100644 index 00000000..79397743 --- /dev/null +++ b/android/deferredmultisampling/build.py @@ -0,0 +1,58 @@ +import os +import shutil +import subprocess +import sys +import glob + +APK_NAME = "vulkanDeferredmulitsampling" +SHADER_DIR = "deferredmultisampling" +ASSETS_MODELS = ["openbox.dae"] +ASSETS_TEXTURES = ["stonefloor02_color_astc_8x8_unorm.ktx", "stonefloor02_color_bc3_unorm.ktx", "stonefloor02_normal_astc_8x8_unorm.ktx", "stonefloor02_normal_bc3_unorm.ktx", "stonefloor02_color_etc2_unorm.ktx", "stonefloor02_normal_etc2_unorm.ktx"] + +if subprocess.call("ndk-build", shell=True) == 0: + print("Build successful") + + # Assets + if not os.path.exists("./assets"): + os.makedirs("./assets") + + # Shaders + # Base + if not os.path.exists("./assets/shaders/base"): + os.makedirs("./assets/shaders/base") + for file in glob.glob("../../data/shaders/base/*.spv"): + shutil.copy(file, "./assets/shaders/base") + # Sample + if not os.path.exists("./assets/shaders/%s" % SHADER_DIR): + os.makedirs("./assets/shaders/%s" % SHADER_DIR) + for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR): + shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR) + # Textures and model + if not os.path.exists("./assets/models/armor/"): + os.makedirs("./assets/models/armor/") + for file in glob.glob("../../data/models/armor/*.*"): + shutil.copy(file, "./assets/models/armor") + # Textures from base + if not os.path.exists("./assets/textures"): + os.makedirs("./assets/textures") + for file in ASSETS_TEXTURES: + shutil.copy("../../data/textures/%s" % file, "./assets/textures") + if not os.path.exists("./assets/models"): + os.makedirs("./assets/models") + for file in ASSETS_MODELS: + shutil.copy("../../data/models/%s" % file, "./assets/models") + + # Icon + if not os.path.exists("./res/drawable"): + os.makedirs("./res/drawable") + shutil.copy("../../android/images/icon.png", "./res/drawable") + + if subprocess.call("ant debug -Dout.final.file=%s.apk" % APK_NAME, shell=True) == 0: + if len(sys.argv) > 1: + if sys.argv[1] == "-deploy": + if subprocess.call("adb install -r %s.apk" % APK_NAME, shell=True) != 0: + print("Could not deploy to device!") + else: + print("Error during build process!") +else: + print("Error building project!") diff --git a/android/deferredmultisampling/jni/Android.mk b/android/deferredmultisampling/jni/Android.mk new file mode 100644 index 00000000..02674920 --- /dev/null +++ b/android/deferredmultisampling/jni/Android.mk @@ -0,0 +1,48 @@ +LOCAL_PATH := $(call my-dir)/../../deferredmultisampling + +# assimp + +include $(CLEAR_VARS) + +LOCAL_MODULE := assimp +LOCAL_SRC_FILES := $(LOCAL_PATH)/../../libs/assimp/$(TARGET_ARCH_ABI)/libassimp.a +include $(PREBUILT_STATIC_LIBRARY) + +# vulkan example + +DATADIR := $(LOCAL_PATH)/../../data + +include $(CLEAR_VARS) + +LOCAL_MODULE := vulkanDeferredmulitsampling + +PROJECT_FILES := $(wildcard $(LOCAL_PATH)/../../deferredmultisampling/*.cpp) +PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../base/*.cpp) + +LOCAL_CPPFLAGS := -std=c++11 +LOCAL_CPPFLAGS += -D__STDC_LIMIT_MACROS +LOCAL_CPPFLAGS += -DVK_NO_PROTOTYPES +LOCAL_CPPFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../external/ +LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/glm +LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/gli +LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/assimp +LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/ +#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/android + +LOCAL_SRC_FILES := $(PROJECT_FILES) + +LOCAL_LDLIBS := -landroid -llog -lz + +LOCAL_DISABLE_FORMAT_STRING_CHECKS := true +LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true + +LOCAL_STATIC_LIBRARIES += android_native_app_glue +LOCAL_STATIC_LIBRARIES += cpufeatures +LOCAL_STATIC_LIBRARIES += libassimp + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module, android/native_app_glue) +$(call import-module, android/cpufeatures) diff --git a/android/deferredmultisampling/jni/Application.mk b/android/deferredmultisampling/jni/Application.mk new file mode 100644 index 00000000..e5347482 --- /dev/null +++ b/android/deferredmultisampling/jni/Application.mk @@ -0,0 +1,6 @@ +APP_PLATFORM := android-19 +APP_ABI := armeabi-v7a +APP_STL := c++_static +APP_CPPFLAGS := -std=c++11 +APP_CPPFLAGS += -fexceptions +NDK_TOOLCHAIN_VERSION := clang diff --git a/android/uninstall-all.bat b/android/uninstall-all.bat index db310650..5636e71f 100644 --- a/android/uninstall-all.bat +++ b/android/uninstall-all.bat @@ -42,6 +42,7 @@ adb uninstall de.saschawillems.vulkanDebugmarker adb uninstall de.saschawillems.vulkanScenerendering adb uninstall de.saschawillems.vulkanTerraintessellation adb uninstall de.saschawillems.vulkanDeferredshadows +adb uninstall de.saschawillems.vulkanDeferredmulitsampling adb uninstall de.saschawillems.vulkanIndirectdraw adb uninstall de.saschawillems.vulkanTexturemipmapgen adb uninstall de.saschawillems.vulkanTexture3d