From 25060a00b0f7c1656b14483dd6dcb637e82f1f7f Mon Sep 17 00:00:00 2001 From: saschawillems Date: Mon, 7 Aug 2017 21:40:57 +0200 Subject: [PATCH 1/3] Enable device features --- skeletalanimation/skeletalanimation.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/skeletalanimation/skeletalanimation.cpp b/skeletalanimation/skeletalanimation.cpp index 86dfb6ae..b94dc36c 100644 --- a/skeletalanimation/skeletalanimation.cpp +++ b/skeletalanimation/skeletalanimation.cpp @@ -434,6 +434,25 @@ public: delete(skinnedMesh); } + // Enable physical device features required for this example + virtual void getEnabledFeatures() + { + // Enable anisotropic filtering if supported + if (deviceFeatures.samplerAnisotropy) { + enabledFeatures.samplerAnisotropy = VK_TRUE; + } + // Enable texture compression + if (deviceFeatures.textureCompressionBC) { + enabledFeatures.textureCompressionBC = VK_TRUE; + } + else if (deviceFeatures.textureCompressionASTC_LDR) { + enabledFeatures.textureCompressionASTC_LDR = VK_TRUE; + } + else if (deviceFeatures.textureCompressionETC2) { + enabledFeatures.textureCompressionETC2 = VK_TRUE; + } + } + void buildCommandBuffers() { VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); From cd5f5318a94811fe11f3b775adbf981449cebf1f Mon Sep 17 00:00:00 2001 From: saschawillems Date: Mon, 7 Aug 2017 21:41:14 +0200 Subject: [PATCH 2/3] Fixed ETC texture format --- skeletalanimation/skeletalanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skeletalanimation/skeletalanimation.cpp b/skeletalanimation/skeletalanimation.cpp index b94dc36c..872a6b27 100644 --- a/skeletalanimation/skeletalanimation.cpp +++ b/skeletalanimation/skeletalanimation.cpp @@ -680,7 +680,7 @@ public: } else if (vulkanDevice->features.textureCompressionETC2) { texFormatSuffix = "_etc2_unorm"; - texFormat = VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; + texFormat = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; } else { vks::tools::exitFatal("Device does not support any compressed texture format!", "Error"); From be70aff2ae578971a575585f2e131d25fe53dd41 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Mon, 7 Aug 2017 22:02:56 +0200 Subject: [PATCH 3/3] Added compute cloth example Android build files --- android/build-all.py | 1 + android/computecloth/.gitignore | 10 +++++ android/computecloth/AndroidManifest.xml | 28 ++++++++++++++ android/computecloth/example.json | 14 +++++++ android/computecloth/jni/Android.mk | 48 ++++++++++++++++++++++++ android/computecloth/jni/Application.mk | 5 +++ android/uninstall-all.py | 1 + 7 files changed, 107 insertions(+) create mode 100644 android/computecloth/.gitignore create mode 100644 android/computecloth/AndroidManifest.xml create mode 100644 android/computecloth/example.json create mode 100644 android/computecloth/jni/Android.mk create mode 100644 android/computecloth/jni/Application.mk diff --git a/android/build-all.py b/android/build-all.py index d45ce6bb..8e2fe745 100644 --- a/android/build-all.py +++ b/android/build-all.py @@ -6,6 +6,7 @@ import sys EXAMPLES = [ "bloom", "computecullandlod", + "computecloth", "computenbody", "computeparticles", "computeshader", diff --git a/android/computecloth/.gitignore b/android/computecloth/.gitignore new file mode 100644 index 00000000..7a5d249c --- /dev/null +++ b/android/computecloth/.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/computecloth/AndroidManifest.xml b/android/computecloth/AndroidManifest.xml new file mode 100644 index 00000000..86dc355d --- /dev/null +++ b/android/computecloth/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/android/computecloth/example.json b/android/computecloth/example.json new file mode 100644 index 00000000..6fe3e02e --- /dev/null +++ b/android/computecloth/example.json @@ -0,0 +1,14 @@ +{ + "apkname": "vulkanComputecloth", + "directories": { + "shaders": "computecloth" + }, + "assets": { + "models": [ + "geosphere.obj" + ], + "textures": [ + "vulkan_cloth_rgba.ktx" + ] + } +} \ No newline at end of file diff --git a/android/computecloth/jni/Android.mk b/android/computecloth/jni/Android.mk new file mode 100644 index 00000000..5dd5217c --- /dev/null +++ b/android/computecloth/jni/Android.mk @@ -0,0 +1,48 @@ +LOCAL_PATH := $(call my-dir)/../../computecloth + +# 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 := vulkanComputecloth + +PROJECT_FILES := $(wildcard $(LOCAL_PATH)/../../computecloth/*.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/computecloth/jni/Application.mk b/android/computecloth/jni/Application.mk new file mode 100644 index 00000000..62020feb --- /dev/null +++ b/android/computecloth/jni/Application.mk @@ -0,0 +1,5 @@ +APP_PLATFORM := android-19 +APP_ABI := armeabi-v7a +APP_STL := c++_static +APP_CPPFLAGS := -std=c++11 +NDK_TOOLCHAIN_VERSION := clang diff --git a/android/uninstall-all.py b/android/uninstall-all.py index 17bbde1a..0ff262fa 100644 --- a/android/uninstall-all.py +++ b/android/uninstall-all.py @@ -5,6 +5,7 @@ import sys APP_NAMES = [ "de.saschawillems.vulkanBloom", "de.saschawillems.vulkanComputecullandlod", + "de.saschawillems.vulkanComputecloth", "de.saschawillems.vulkanComputenbody", "de.saschawillems.vulkanComputeparticles", "de.saschawillems.vulkanComputeshader",