diff --git a/CMakeLists.txt b/CMakeLists.txt index c95d5bc8..89b7dd93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,9 @@ message(STATUS ${VULKAN_LIB}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX -D_USE_MATH_DEFINES") add_definitions(-D_CRT_SECURE_NO_WARNINGS) -add_definitions(-std=c++11) +add_definitions(-std=c++14) add_definitions(-std=c++0x) +add_definitions(-std=gnu++14) file(GLOB SOURCE *.cpp base/*.cpp) @@ -78,6 +79,7 @@ set(EXAMPLES geometryshader instancing mesh + multithreading multisampling occlusionquery offscreen diff --git a/android/_build.bat b/android/_build.bat index 3488750d..b73d4347 100644 --- a/android/_build.bat +++ b/android/_build.bat @@ -1,4 +1,4 @@ -rem @echo off +@echo off if NOT EXIST %1 ( echo Please specify a valid project folder for running the build ) else ( diff --git a/android/build-all.bat b/android/build-all.bat index eee1aad8..de2b1616 100644 --- a/android/build-all.bat +++ b/android/build-all.bat @@ -26,4 +26,5 @@ call _build sphericalenvmapping %1 call _build radialblur %1 call _build displacement %1 call _build raytracing %1 -call _build multisampling %1 \ No newline at end of file +call _build multisampling %1 +call _build multithreading %1 \ No newline at end of file diff --git a/android/multithreading/.gitignore b/android/multithreading/.gitignore new file mode 100644 index 00000000..7a5d249c --- /dev/null +++ b/android/multithreading/.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/multithreading/AndroidManifest.xml b/android/multithreading/AndroidManifest.xml new file mode 100644 index 00000000..d2df8a43 --- /dev/null +++ b/android/multithreading/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/android/multithreading/build.bat b/android/multithreading/build.bat new file mode 100644 index 00000000..e16bd574 --- /dev/null +++ b/android/multithreading/build.bat @@ -0,0 +1,21 @@ +cd jni +call ndk-build +if %ERRORLEVEL% EQU 0 ( + echo ndk-build has failed, build cancelled + cd.. + + mkdir "assets\shaders\multithreading" + xcopy "..\..\data\shaders\multithreading\*.spv" "assets\shaders\multithreading" /Y + + mkdir "assets\models" + xcopy "..\..\data\models\retroufo_red.dae" "assets\models" /Y + xcopy "..\..\data\models\sphere.obj" "assets\models" /Y + + mkdir "res\drawable" + xcopy "..\..\android\images\icon.png" "res\drawable" /Y + + call ant debug -Dout.final.file=vulkanMultithreading.apk +) ELSE ( + echo error : ndk-build failed with errors! + cd.. +) diff --git a/android/multithreading/jni/Android.mk b/android/multithreading/jni/Android.mk new file mode 100644 index 00000000..6d11c6d0 --- /dev/null +++ b/android/multithreading/jni/Android.mk @@ -0,0 +1,47 @@ +LOCAL_PATH := $(call my-dir)/../../multithreading + +# 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 := vulkanMultithreading + +PROJECT_FILES := $(wildcard $(LOCAL_PATH)/../../multithreading/*.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_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/multithreading/jni/Application.mk b/android/multithreading/jni/Application.mk new file mode 100644 index 00000000..afb0486a --- /dev/null +++ b/android/multithreading/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.bat b/android/uninstall-all.bat index 8a6cf4e0..47eb6e40 100644 --- a/android/uninstall-all.bat +++ b/android/uninstall-all.bat @@ -34,6 +34,7 @@ adb uninstall de.saschawillems.vulkanRadialblur adb uninstall de.saschawillems.vulkanDisplacement adb uninstall de.saschawillems.vulkanRaytracing adb uninstall de.saschawillems.vulkanMultisampling +adb uninstall de.saschawillems.vulkanMultithreading goto finish :exit