From: Cody Northrop Date: Wed, 27 Apr 2016 01:59:19 +0000 (-0600) Subject: android: Start using vulkan_wrapper in cube and tri X-Git-Tag: upstream/1.1.92~3231 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8707a6e63c14786a005e4a3c612fa5f941020ffa;p=platform%2Fupstream%2FVulkan-Tools.git android: Start using vulkan_wrapper in cube and tri --- diff --git a/demos/android/jni/Android.mk b/demos/android/jni/Android.mk index 2f82dd4..d852176 100644 --- a/demos/android/jni/Android.mk +++ b/demos/android/jni/Android.mk @@ -14,29 +14,31 @@ # limitations under the License. LOCAL_PATH := $(abspath $(call my-dir)) -SRC_DIR := $(LOCAL_PATH)/../../../ +SRC_DIR := $(LOCAL_PATH)/../../.. DEMO_DIR := $(SRC_DIR)/demos include $(CLEAR_VARS) LOCAL_MODULE := Tri -LOCAL_SRC_FILES += $(DEMO_DIR)/tri.c +LOCAL_SRC_FILES += $(DEMO_DIR)/tri.c \ + $(SRC_DIR)/common/vulkan_wrapper.cpp LOCAL_C_INCLUDES += $(SRC_DIR)/include \ $(DEMO_DIR)/android/include \ $(SRC_DIR)/libs -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR +LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR --include=$(SRC_DIR)/common/vulkan_wrapper.h LOCAL_WHOLE_STATIC_LIBRARIES += android_native_app_glue -LOCAL_LDLIBS := -llog -landroid -lvulkan +LOCAL_LDLIBS := -llog -landroid include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := Cube -LOCAL_SRC_FILES += $(DEMO_DIR)/cube.c +LOCAL_SRC_FILES += $(DEMO_DIR)/cube.c \ + $(SRC_DIR)/common/vulkan_wrapper.cpp LOCAL_C_INCLUDES += $(SRC_DIR)/include \ $(DEMO_DIR)/android/include \ $(SRC_DIR)/libs -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR +LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR --include=$(SRC_DIR)/common/vulkan_wrapper.h LOCAL_WHOLE_STATIC_LIBRARIES += android_native_app_glue -LOCAL_LDLIBS := -llog -landroid -lvulkan +LOCAL_LDLIBS := -llog -landroid include $(BUILD_SHARED_LIBRARY) $(call import-module,android/native_app_glue) diff --git a/demos/cube.c b/demos/cube.c index 8fbcf9b..e8da31e 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -37,7 +37,11 @@ #define APP_NAME_STR_LEN 80 #endif // _WIN32 +#ifdef ANDROID +#include "vulkan_wrapper.h" +#else #include +#endif #include #include "linmath.h" @@ -3104,6 +3108,12 @@ void android_main(struct android_app *app) { app_dummy(); +#ifdef ANDROID + int vulkanSupport = InitVulkan(); + if (vulkanSupport == 0) + return; +#endif + app->onAppCmd = processCommand; app->onInputEvent = processInput; diff --git a/demos/tri.c b/demos/tri.c index f7916fc..288e72c 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -44,7 +44,11 @@ #define APP_NAME_STR_LEN 80 #endif // _WIN32 +#ifdef ANDROID +#include "vulkan_wrapper.h" +#else #include +#endif #define DEMO_TEXTURE_COUNT 1 #define VERTEX_BUFFER_BIND_ID 0 @@ -2621,10 +2625,18 @@ static void processCommand(struct android_app* app, int32_t cmd) { } } + + void android_main(struct android_app *app) { app_dummy(); +#ifdef ANDROID + int vulkanSupport = InitVulkan(); + if (vulkanSupport == 0) + return; +#endif + app->onAppCmd = processCommand; app->onInputEvent = processInput;