Android build fixes (#1156)
* Add gradle build scripts to more examples * Fix building graphicspipelinelibrary example on android * Fix tinygltf dependencies hostimagecopy uses tinygltf but didn't depend on it, while meshshader doesn't use it. * Load more Vulkan functions on Android The sparse functions are used by texturesparseresidency, while the begin/end rendering functions are used by trianglevulkan13.
This commit is contained in:
parent
a2d5a1fd44
commit
358babffd8
65 changed files with 2733 additions and 15 deletions
35
android/examples/conditionalrender/CMakeLists.txt
Normal file
35
android/examples/conditionalrender/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME conditionalrender)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
64
android/examples/conditionalrender/build.gradle
Normal file
64
android/examples/conditionalrender/build.gradle
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanConditionalrender"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/conditionalrender'
|
||||
into 'assets/shaders/glsl/conditionalrender'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models/gltf/glTF-Embedded'
|
||||
into 'assets/models/gltf/glTF-Embedded'
|
||||
include 'Buggy.gltf'
|
||||
}
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanConditionalrender">
|
||||
|
||||
<application
|
||||
android:label="Vulkan conditional render"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/debugprintf/CMakeLists.txt
Normal file
35
android/examples/debugprintf/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME debugprintf)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/debugprintf/build.gradle
Normal file
65
android/examples/debugprintf/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanDebugprintf"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/debugprintf'
|
||||
into 'assets/shaders/glsl/debugprintf'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'treasure_smooth.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
24
android/examples/debugprintf/src/main/AndroidManifest.xml
Normal file
24
android/examples/debugprintf/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanDebugprintf">
|
||||
|
||||
<application
|
||||
android:label="Vulkan debug printf"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/descriptorbuffer/CMakeLists.txt
Normal file
35
android/examples/descriptorbuffer/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME descriptorbuffer)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
72
android/examples/descriptorbuffer/build.gradle
Normal file
72
android/examples/descriptorbuffer/build.gradle
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanDescriptorbuffer"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/descriptorbuffer'
|
||||
into 'assets/shaders/glsl/descriptorbuffer'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'cube.gltf'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'textures'
|
||||
into 'assets/textures'
|
||||
include 'crate01_color_height_rgba.gltf'
|
||||
include 'crate02_color_height_rgba.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanDescriptorbuffer">
|
||||
|
||||
<application
|
||||
android:label="Vulkan descriptor buffer"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/dynamicrendering/CMakeLists.txt
Normal file
35
android/examples/dynamicrendering/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME dynamicrendering)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/dynamicrendering/build.gradle
Normal file
65
android/examples/dynamicrendering/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanDynamicrendering"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/dynamicrendering'
|
||||
into 'assets/shaders/glsl/dynamicrendering'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'voyager.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanDynamicrendering">
|
||||
|
||||
<application
|
||||
android:label="Vulkan dynamic rendering"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/dynamicstate/CMakeLists.txt
Normal file
35
android/examples/dynamicstate/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME dynamicstate)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/dynamicstate/build.gradle
Normal file
65
android/examples/dynamicstate/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanDynamicstate"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/pipelines'
|
||||
into 'assets/shaders/glsl/pipelines'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'treasure_smooth.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
24
android/examples/dynamicstate/src/main/AndroidManifest.xml
Normal file
24
android/examples/dynamicstate/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanDynamicstate">
|
||||
|
||||
<application
|
||||
android:label="Vulkan dynamic state"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/graphicspipelinelibrary/CMakeLists.txt
Normal file
35
android/examples/graphicspipelinelibrary/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME graphicspipelinelibrary)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/graphicspipelinelibrary/build.gradle
Normal file
65
android/examples/graphicspipelinelibrary/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanGraphicspipelinelibrary"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/graphicspipelinelibrary'
|
||||
into 'assets/shaders/glsl/graphicspipelinelibrary'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'color_teapot_spheres.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanGraphicspipelinelibrary">
|
||||
|
||||
<application
|
||||
android:label="Vulkan graphics pipeline library"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ include_directories(${BASE_DIR})
|
|||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
|
|
|
|||
34
android/examples/meshshader/CMakeLists.txt
Normal file
34
android/examples/meshshader/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME meshshader)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
59
android/examples/meshshader/build.gradle
Normal file
59
android/examples/meshshader/build.gradle
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanMeshshader"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/meshshader'
|
||||
into 'assets/shaders/glsl/meshshader'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
24
android/examples/meshshader/src/main/AndroidManifest.xml
Normal file
24
android/examples/meshshader/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanMeshshader">
|
||||
|
||||
<application
|
||||
android:label="Vulkan mesh shader"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
34
android/examples/raytracingcallable/CMakeLists.txt
Normal file
34
android/examples/raytracingcallable/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME raytracingcallable)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
59
android/examples/raytracingcallable/build.gradle
Normal file
59
android/examples/raytracingcallable/build.gradle
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanRaytracingcallable"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/raytracingcallable'
|
||||
into 'assets/shaders/glsl/raytracingcallable'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanRaytracingcallable">
|
||||
|
||||
<application
|
||||
android:label="Vulkan ray tracing callable"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
34
android/examples/raytracingintersection/CMakeLists.txt
Normal file
34
android/examples/raytracingintersection/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME raytracingintersection)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
59
android/examples/raytracingintersection/build.gradle
Normal file
59
android/examples/raytracingintersection/build.gradle
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanRaytracingintersection"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/raytracingintersection'
|
||||
into 'assets/shaders/glsl/raytracingintersection'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanRaytracingintersection">
|
||||
|
||||
<application
|
||||
android:label="Vulkan ray tracing intersection"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/raytracingpositionfetch/CMakeLists.txt
Normal file
35
android/examples/raytracingpositionfetch/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME raytracingpositionfetch)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/raytracingpositionfetch/build.gradle
Normal file
65
android/examples/raytracingpositionfetch/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanRaytracingpositionfetch"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/raytracingpositionfetch'
|
||||
into 'assets/shaders/glsl/raytracingpositionfetch'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'treasure_smooth.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanRaytracingpositionfetch">
|
||||
|
||||
<application
|
||||
android:label="Vulkan ray tracing position fetch"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
34
android/examples/raytracingsbtdata/CMakeLists.txt
Normal file
34
android/examples/raytracingsbtdata/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME raytracingsbtdata)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
59
android/examples/raytracingsbtdata/build.gradle
Normal file
59
android/examples/raytracingsbtdata/build.gradle
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanRaytracingsbtdata"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/raytracingsbtdata'
|
||||
into 'assets/shaders/glsl/raytracingsbtdata'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanRaytracingsbtdata">
|
||||
|
||||
<application
|
||||
android:label="Vulkan ray tracing sbt data"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
34
android/examples/raytracingtextures/CMakeLists.txt
Normal file
34
android/examples/raytracingtextures/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME raytracingtextures)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/raytracingtextures/build.gradle
Normal file
65
android/examples/raytracingtextures/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanRaytracingtextures"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/raytracingtextures'
|
||||
into 'assets/shaders/glsl/raytracingtextures'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'textures'
|
||||
into 'assets/textures'
|
||||
include 'gratefloor_rgba.ktx'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanRaytracingtextures">
|
||||
|
||||
<application
|
||||
android:label="Vulkan ray tracing textures"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/shaderobjects/CMakeLists.txt
Normal file
35
android/examples/shaderobjects/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME shaderobjects)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/shaderobjects/build.gradle
Normal file
65
android/examples/shaderobjects/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanShaderobjects"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/shaderobjects'
|
||||
into 'assets/shaders/glsl/shaderobjects'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'treasure_smooth.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
24
android/examples/shaderobjects/src/main/AndroidManifest.xml
Normal file
24
android/examples/shaderobjects/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanShaderobjects">
|
||||
|
||||
<application
|
||||
android:label="Vulkan shader objects"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
35
android/examples/texturesparseresidency/CMakeLists.txt
Normal file
35
android/examples/texturesparseresidency/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME texturesparseresidency)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${EXTERNAL_DIR}/tinygltf)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
65
android/examples/texturesparseresidency/build.gradle
Normal file
65
android/examples/texturesparseresidency/build.gradle
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanTexturesparseresidency"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/texturesparseresidency'
|
||||
into 'assets/shaders/glsl/texturesparseresidency'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.assetPath + 'models'
|
||||
into 'assets/models'
|
||||
include 'plane.gltf'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanTexturesparseresidency">
|
||||
|
||||
<application
|
||||
android:label="Vulkan texture sparse residency"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
34
android/examples/trianglevulkan13/CMakeLists.txt
Normal file
34
android/examples/trianglevulkan13/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR)
|
||||
|
||||
set(NAME trianglevulkan13)
|
||||
|
||||
set(SRC_DIR ../../../examples/${NAME})
|
||||
set(BASE_DIR ../../../base)
|
||||
set(EXTERNAL_DIR ../../../external)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES")
|
||||
|
||||
file(GLOB EXAMPLE_SRC "${SRC_DIR}/*.cpp")
|
||||
|
||||
add_library(native-lib SHARED ${EXAMPLE_SRC})
|
||||
|
||||
add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
|
||||
add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
|
||||
|
||||
include_directories(${BASE_DIR})
|
||||
include_directories(${EXTERNAL_DIR})
|
||||
include_directories(${EXTERNAL_DIR}/glm)
|
||||
include_directories(${EXTERNAL_DIR}/imgui)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
target_link_libraries(
|
||||
native-lib
|
||||
native-app-glue
|
||||
libbase
|
||||
android
|
||||
log
|
||||
z
|
||||
)
|
||||
59
android/examples/trianglevulkan13/build.gradle
Normal file
59
android/examples/trianglevulkan13/build.gradle
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply from: '../gradle/outputfilename.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.saschawillems.vulkanTrianglevulkan13"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters rootProject.ext.abiFilters
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++14"
|
||||
arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang'
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs = ['assets']
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyTask {
|
||||
copy {
|
||||
from '../../common/res/drawable'
|
||||
into "src/main/res/drawable"
|
||||
include 'icon.png'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/base'
|
||||
into 'assets/shaders/glsl/base'
|
||||
include '*.spv'
|
||||
}
|
||||
|
||||
copy {
|
||||
from rootProject.ext.shaderPath + 'glsl/triangle'
|
||||
into 'assets/shaders/glsl/triangle'
|
||||
include '*.*'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
preBuild.dependsOn copyTask
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.saschawillems.vulkanTrianglevulkan13">
|
||||
|
||||
<application
|
||||
android:label="Vulkan triangle Vulkan 1.3"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="native-lib" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
package de.saschawillems.vulkanSample;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class VulkanActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
// Load native library
|
||||
System.loadLibrary("native-lib");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
// Use a semaphore to create a modal dialog
|
||||
|
||||
private final Semaphore semaphore = new Semaphore(0, true);
|
||||
|
||||
public void showAlert(final String message)
|
||||
{
|
||||
final VulkanActivity activity = this;
|
||||
|
||||
ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
final String applicationName = applicationInfo.nonLocalizedLabel.toString();
|
||||
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
|
||||
builder.setTitle(applicationName);
|
||||
builder.setMessage(message);
|
||||
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
semaphore.release();
|
||||
}
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
semaphore.acquire();
|
||||
}
|
||||
catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
|
|
@ -120,6 +120,11 @@ PFN_vkCmdBeginQuery vkCmdBeginQuery;
|
|||
PFN_vkCmdEndQuery vkCmdEndQuery;
|
||||
PFN_vkCmdResetQueryPool vkCmdResetQueryPool;
|
||||
PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults;
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties;
|
||||
PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements;
|
||||
PFN_vkQueueBindSparse vkQueueBindSparse;
|
||||
PFN_vkCmdBeginRendering vkCmdBeginRendering;
|
||||
PFN_vkCmdEndRendering vkCmdEndRendering;
|
||||
|
||||
PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR;
|
||||
PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
|
||||
|
|
@ -204,7 +209,7 @@ namespace vks
|
|||
vkCmdEndRenderPass = reinterpret_cast<PFN_vkCmdEndRenderPass>(vkGetInstanceProcAddr(instance, "vkCmdEndRenderPass"));
|
||||
vkCmdNextSubpass = reinterpret_cast<PFN_vkCmdNextSubpass>(vkGetInstanceProcAddr(instance, "vkCmdNextSubpass"));
|
||||
vkCmdExecuteCommands = reinterpret_cast<PFN_vkCmdExecuteCommands>(vkGetInstanceProcAddr(instance, "vkCmdExecuteCommands"));
|
||||
vkCmdClearColorImage = reinterpret_cast<PFN_vkCmdClearColorImage>(vkGetInstanceProcAddr(instance, "vkCmdClearColorImage"));
|
||||
vkCmdClearColorImage = reinterpret_cast<PFN_vkCmdClearColorImage>(vkGetInstanceProcAddr(instance, "vkCmdClearColorImage"));
|
||||
|
||||
vkCreateImage = reinterpret_cast<PFN_vkCreateImage>(vkGetInstanceProcAddr(instance, "vkCreateImage"));
|
||||
vkGetImageMemoryRequirements = reinterpret_cast<PFN_vkGetImageMemoryRequirements>(vkGetInstanceProcAddr(instance, "vkGetImageMemoryRequirements"));
|
||||
|
|
@ -231,7 +236,7 @@ namespace vks
|
|||
vkDestroyFence = reinterpret_cast<PFN_vkDestroyFence>(vkGetInstanceProcAddr(instance, "vkDestroyFence"));
|
||||
vkWaitForFences = reinterpret_cast<PFN_vkWaitForFences>(vkGetInstanceProcAddr(instance, "vkWaitForFences"));
|
||||
vkResetFences = reinterpret_cast<PFN_vkResetFences>(vkGetInstanceProcAddr(instance, "vkResetFences"));;
|
||||
vkResetDescriptorPool = reinterpret_cast<PFN_vkResetDescriptorPool>(vkGetInstanceProcAddr(instance, "vkResetDescriptorPool"));
|
||||
vkResetDescriptorPool = reinterpret_cast<PFN_vkResetDescriptorPool>(vkGetInstanceProcAddr(instance, "vkResetDescriptorPool"));
|
||||
|
||||
vkCreateCommandPool = reinterpret_cast<PFN_vkCreateCommandPool>(vkGetInstanceProcAddr(instance, "vkCreateCommandPool"));
|
||||
vkDestroyCommandPool = reinterpret_cast<PFN_vkDestroyCommandPool>(vkGetInstanceProcAddr(instance, "vkDestroyCommandPool"));;
|
||||
|
|
@ -297,22 +302,29 @@ namespace vks
|
|||
vkCmdResetQueryPool = reinterpret_cast<PFN_vkCmdResetQueryPool>(vkGetInstanceProcAddr(instance, "vkCmdResetQueryPool"));
|
||||
vkCmdCopyQueryPoolResults = reinterpret_cast<PFN_vkCmdCopyQueryPoolResults>(vkGetInstanceProcAddr(instance, "vkCmdCopyQueryPoolResults"));
|
||||
|
||||
vkGetPhysicalDeviceSparseImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties"));
|
||||
vkGetImageSparseMemoryRequirements = reinterpret_cast<PFN_vkGetImageSparseMemoryRequirements>(vkGetInstanceProcAddr(instance, "vkGetImageSparseMemoryRequirements"));
|
||||
vkQueueBindSparse = reinterpret_cast<PFN_vkQueueBindSparse>(vkGetInstanceProcAddr(instance, "vkQueueBindSparse"));
|
||||
|
||||
vkCmdBeginRendering = reinterpret_cast<PFN_vkCmdBeginRendering>(vkGetInstanceProcAddr(instance, "vkCmdBeginRendering"));
|
||||
vkCmdEndRendering = reinterpret_cast<PFN_vkCmdEndRendering>(vkGetInstanceProcAddr(instance, "vkCmdEndRendering"));
|
||||
|
||||
vkCreateAndroidSurfaceKHR = reinterpret_cast<PFN_vkCreateAndroidSurfaceKHR>(vkGetInstanceProcAddr(instance, "vkCreateAndroidSurfaceKHR"));
|
||||
vkDestroySurfaceKHR = reinterpret_cast<PFN_vkDestroySurfaceKHR>(vkGetInstanceProcAddr(instance, "vkDestroySurfaceKHR"));
|
||||
|
||||
vkCmdFillBuffer = reinterpret_cast<PFN_vkCmdFillBuffer>(vkGetInstanceProcAddr(instance, "vkCmdFillBuffer"));
|
||||
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceSupportKHR"));
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"));
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"));
|
||||
vkCreateSwapchainKHR = reinterpret_cast<PFN_vkCreateSwapchainKHR>(vkGetInstanceProcAddr(instance, "vkCreateSwapchainKHR"));
|
||||
vkDestroySwapchainKHR = reinterpret_cast<PFN_vkDestroySwapchainKHR>(vkGetInstanceProcAddr(instance, "vkDestroySwapchainKHR"));
|
||||
vkGetSwapchainImagesKHR = reinterpret_cast<PFN_vkGetSwapchainImagesKHR>(vkGetInstanceProcAddr(instance, "vkGetSwapchainImagesKHR"));
|
||||
vkAcquireNextImageKHR = reinterpret_cast<PFN_vkAcquireNextImageKHR>(vkGetInstanceProcAddr(instance, "vkAcquireNextImageKHR"));
|
||||
vkQueuePresentKHR = reinterpret_cast<PFN_vkQueuePresentKHR>(vkGetInstanceProcAddr(instance, "vkQueuePresentKHR"));
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceSupportKHR"));
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"));
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"));
|
||||
vkCreateSwapchainKHR = reinterpret_cast<PFN_vkCreateSwapchainKHR>(vkGetInstanceProcAddr(instance, "vkCreateSwapchainKHR"));
|
||||
vkDestroySwapchainKHR = reinterpret_cast<PFN_vkDestroySwapchainKHR>(vkGetInstanceProcAddr(instance, "vkDestroySwapchainKHR"));
|
||||
vkGetSwapchainImagesKHR = reinterpret_cast<PFN_vkGetSwapchainImagesKHR>(vkGetInstanceProcAddr(instance, "vkGetSwapchainImagesKHR"));
|
||||
vkAcquireNextImageKHR = reinterpret_cast<PFN_vkAcquireNextImageKHR>(vkGetInstanceProcAddr(instance, "vkAcquireNextImageKHR"));
|
||||
vkQueuePresentKHR = reinterpret_cast<PFN_vkQueuePresentKHR>(vkGetInstanceProcAddr(instance, "vkQueuePresentKHR"));
|
||||
|
||||
vkResetCommandBuffer = reinterpret_cast<PFN_vkResetCommandBuffer>(vkGetInstanceProcAddr(instance, "vkResetCommandBuffer"));
|
||||
vkResetCommandBuffer = reinterpret_cast<PFN_vkResetCommandBuffer>(vkGetInstanceProcAddr(instance, "vkResetCommandBuffer"));
|
||||
}
|
||||
|
||||
void freeVulkanLibrary()
|
||||
|
|
|
|||
|
|
@ -154,6 +154,11 @@ extern PFN_vkCmdBeginQuery vkCmdBeginQuery;
|
|||
extern PFN_vkCmdEndQuery vkCmdEndQuery;
|
||||
extern PFN_vkCmdResetQueryPool vkCmdResetQueryPool;
|
||||
extern PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults;
|
||||
extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties;
|
||||
extern PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements;
|
||||
extern PFN_vkQueueBindSparse vkQueueBindSparse;
|
||||
extern PFN_vkCmdBeginRendering vkCmdBeginRendering;
|
||||
extern PFN_vkCmdEndRendering vkCmdEndRendering;
|
||||
|
||||
extern PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR;
|
||||
extern PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
|
||||
|
|
|
|||
|
|
@ -199,15 +199,16 @@ public:
|
|||
{
|
||||
#if defined(__ANDROID__)
|
||||
// Load shader from compressed asset
|
||||
AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, fileName, AASSET_MODE_STREAMING);
|
||||
AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, fileName.c_str(), AASSET_MODE_STREAMING);
|
||||
assert(asset);
|
||||
size_t size = AAsset_getLength(asset);
|
||||
assert(size > 0);
|
||||
|
||||
shaderInfo.size = size;
|
||||
shaderInfo.code = new uint32_t[size / 4];
|
||||
AAsset_read(asset, shaderCode, size);
|
||||
AAsset_read(asset, reinterpret_cast<char*>(shaderInfo.code), size);
|
||||
AAsset_close(asset);
|
||||
return true;
|
||||
#else
|
||||
std::ifstream is(fileName, std::ios::binary | std::ios::in | std::ios::ate);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
#include "vulkanexamplebase.h"
|
||||
#include "VulkanglTFModel.h"
|
||||
|
||||
class VulkanExample : public VulkanExampleBase
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue