diff --git a/.gitignore b/.gitignore
index 71ea0ed..d8c37d3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,6 @@
build/
third_party/
glm/
+build/
+.qtc_clangd/
+.idea/
diff --git a/Resources.qrc b/Resources.qrc
new file mode 100644
index 0000000..734feb6
--- /dev/null
+++ b/Resources.qrc
@@ -0,0 +1,9 @@
+
+
+ textures/texture.jpg
+ shaders/VulkanTutorial1.0/ComputeAndGraphics/vertComp.spv
+ shaders/VulkanTutorial1.0/ComputeAndGraphics/compComp.spv
+ shaders/VulkanTutorial1.0/ComputeAndGraphics/fragComp.spv
+ misc/TintMap.xml
+
+
diff --git a/VkTest.pro b/VkTest.pro
index df4aea9..db25c67 100644
--- a/VkTest.pro
+++ b/VkTest.pro
@@ -1,6 +1,9 @@
-QT += core xml gui
+QT += core xml gui widgets
-CONFIG += c++17
+CONFIG += c++17 debug
+
+QMAKE_CXXFLAGS += \
+ "-fno-sized-deallocation" \ # this line is here because with c++17 the project won't run.
INCLUDEPATH += \
$$PWD/third_party \
@@ -16,6 +19,10 @@ LIBS += \
# -lSDL2main -lSDL2 -lvk-bootstrap \
# -L$$PWD/third_party/fmt/build -lfmt
+DEFINES += \
+ # STB_IMAGE_IMPLEMENTATION \
+ # TINYOBJLOADER_IMPLEMENTATION \
+
SOURCES += \
VulkanTutorial1.0/ComputeAndGraphics.cpp \
VulkanTutorial1.0/VulkanWindow.cpp \
@@ -45,40 +52,71 @@ DISTFILES += \
android {
QT += \
- ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
- NDK_PATH = /home/ali-mehrabani/host-projects/Android/Sdk/ndk/21.0.6113669
-
- INCLUDEPATH += \
-# /usr/include/vulkan \
- $$NDK_PATH/platforms/android-29/arch-arm64/usr/lib/
-
- LIBS += -landroid -llog \
- -L$$NDK_PATH/platforms/android-29/arch-arm64/usr/lib -lvulkan
-
DEFINES += \
VK_USE_PLATFORM_ANDROID_KHR
-# ANDROID_ABIS = arm64-v8a armeabi-v7a
+ contains(QT_MAJOR_VERSION, 5) {
+ ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-qt5
+ OTHER_FILES += android/src/Vulkan \
+ android-qt5/AndroidManifest.xml \
+ android-qt5/build.gradle \
+ android-qt5/gradle/wrapper/gradle-wrapper.jar \
+ android-qt5/gradle/wrapper/gradle-wrapper.properties \
+ android-qt5/gradlew \
+ android-qt5/gradlew.bat \
+ android-qt5/res/values/libs.xml \
+ android-qt5/src/VkTest/VulkanHelper.java \
+
+ NDK_Version = 23.2.8568313
+ API_Version = 30
+ }
+
+ contains(QT_MAJOR_VERSION, 6) {
+ ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-qt6
+ OTHER_FILES += android/src/Vulkan \
+ android-qt6/AndroidManifest.xml \
+ android-qt6/build.gradle \
+ android-qt6/gradle/wrapper/gradle-wrapper.jar \
+ android-qt6/gradle/wrapper/gradle-wrapper.properties \
+ android-qt6/gradlew \
+ android-qt6/gradlew.bat \
+ android-qt6/res/values/libs.xml \
+ android-qt6/src/VkTest/VulkanHelper.java \
+
+ NDK_Version = 26.1.10909125
+ API_Version = 34
+ }
+
+ NDK_PATH = /home/ali-mehrabani/host-projects/Android/Sdk/ndk/$$NDK_Version
+ LIB_VULKAN_PATH = $$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android
+ INCLUDE_VULKAN_PATH = $$NDK_PATH/sources/third_party/vulkan/src/include/
+
+ # LIB_VULKAN_PATH = $$PWD/third_party/vulkan1.3/x86_64/lib
+ # INCLUDE_VULKAN_PATH = $$PWD/third_party/vulkan1.3/x86_64/include
+
+ INCLUDEPATH += \
+ $$INCLUDE_VULKAN_PATH \
+ # $$NDK_PATH/platforms/android-30/arch-arm64/usr/lib/
- OTHER_FILES += android/src/Vulkan \
- android/AndroidManifest.xml \
- android/build.gradle \
- android/gradle/wrapper/gradle-wrapper.jar \
- android/gradle/wrapper/gradle-wrapper.properties \
- android/gradlew \
- android/gradlew.bat \
- android/res/values/libs.xml
+ LIBS += -llog \
+ -L$$LIB_VULKAN_PATH/$$API_Version -lvulkan \
+ # -L$$NDK_PATH/platforms/android-30/arch-arm64/usr/lib -lvulkan
+ -landroid \
}
linux-g++* {
QT += x11extras
- LIBS += \
- -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -lvulkan \
+ LIBS += -lvulkan \
+ -ldl -lpthread -lX11 \
+ # -lglfw -lXxf86vm -lXrandr -lXi \
DEFINES += \
VK_USE_PLATFORM_XCB_KHR
INCLUDEPATH += \
- /usr/include/vulkan \
+ /usr/include \
}
+RESOURCES += \
+ Resources.qrc
+
diff --git a/VkTest.pro.user b/VkTest.pro.user
index 3bd05a8..01264a5 100644
--- a/VkTest.pro.user
+++ b/VkTest.pro.user
@@ -1,14 +1,14 @@
-
+
EnvironmentId
- {9e9cdaa4-317b-4f62-9b8d-2ca42fb59b56}
+ {3abd2c61-9391-4168-af64-174d10ce774d}
ProjectExplorer.Project.ActiveTarget
- 1
+ 1
ProjectExplorer.Project.EditorSettings
@@ -28,7 +28,7 @@
QmlJSGlobal
- 2
+ 2
UTF-8
false
4
@@ -37,612 +37,677 @@
true
true
1
+ 0
+ false
true
false
- 0
+ 2
true
true
0
8
true
+ false
1
true
true
true
+ *.md, *.MD, Makefile
false
+ true
+ true
ProjectExplorer.Project.PluginSettings
-
- false
- {afe80e93-8983-4e43-ba75-d87634bcd04b}
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+
+ 0
+ true
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 4
+ true
+
+
+
+ true
+
ProjectExplorer.Project.Target.0
- Desktop Qt 5.13.2 GCC 64bit
- Desktop Qt 5.13.2 GCC 64bit
- qt.qt5.5132.gcc_64_kit
- 0
- 0
- 0
+ Android.Device.Type
+ Android Qt 6.8.1 Clang arm64-v8a
+ Android Qt 6.8.1 Clang arm64-v8a
+ {9abb26db-3107-44f8-87d2-bd14f3448a47}
+ 0
+ 0
+ 0
- /home/ali-mehrabani/Qt_projects/build-VkTest-Desktop_Qt_5_13_2_GCC_64bit-Debug
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_8_1_Clang_arm64_v8a-Debug
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_8_1_Clang_arm64_v8a-Debug
true
- qmake
-
QtProjectManager.QMakeBuildStep
- true
-
false
- false
- false
+
true
- Make
-
Qt4ProjectManager.MakeStep
-
- false
-
-
- false
- 2
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-34
+ 34.0.0
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+ true
+
+ 4
Build
-
+ Build
ProjectExplorer.BuildSteps.Build
true
- Make
-
Qt4ProjectManager.MakeStep
-
- true
clean
-
- false
- 1
+ 1
Clean
-
+ Clean
ProjectExplorer.BuildSteps.Clean
2
false
+
+ false
- Debug
Debug
Qt4ProjectManager.Qt4BuildConfiguration
2
- true
- /home/ali-mehrabani/Qt_projects/build-VkTest-Desktop_Qt_5_13_2_GCC_64bit-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_8_1_Clang_arm64_v8a-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_8_1_Clang_arm64_v8a-Release
true
- qmake
-
QtProjectManager.QMakeBuildStep
- false
-
false
- false
- true
+
true
- Make
-
Qt4ProjectManager.MakeStep
-
- false
-
-
- false
- 2
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
Build
-
+ Build
ProjectExplorer.BuildSteps.Build
true
- Make
-
Qt4ProjectManager.MakeStep
-
- true
clean
-
- false
- 1
+ 1
Clean
-
+ Clean
ProjectExplorer.BuildSteps.Clean
2
false
+
+ false
- Release
Release
Qt4ProjectManager.Qt4BuildConfiguration
0
- true
- /home/ali-mehrabani/Qt_projects/build-VkTest-Desktop_Qt_5_13_2_GCC_64bit-Profile
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_8_1_Clang_arm64_v8a-Profile
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_8_1_Clang_arm64_v8a-Profile
true
- qmake
-
QtProjectManager.QMakeBuildStep
- true
-
false
- true
- true
+
true
- Make
-
Qt4ProjectManager.MakeStep
-
- false
-
-
- false
- 2
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
Build
-
+ Build
ProjectExplorer.BuildSteps.Build
true
- Make
-
Qt4ProjectManager.MakeStep
-
- true
clean
-
- false
- 1
+ 1
Clean
-
+ Clean
ProjectExplorer.BuildSteps.Clean
2
false
+
+ false
- Profile
Profile
Qt4ProjectManager.Qt4BuildConfiguration
0
- true
+ 0
- 3
+ 3
- 0
+
+ true
+ Qt4ProjectManager.AndroidDeployQtStep
+ true
+
+ 1
Deploy
-
+ Deploy
ProjectExplorer.BuildSteps.Deploy
1
- Deploy Configuration
-
- ProjectExplorer.DefaultDeployConfiguration
+
+ false
+ Qt4ProjectManager.AndroidDeployConfiguration2
- 1
-
-
- dwarf
-
- cpu-cycles
+ 1
+
+
+ arm64-v8a
+ armeabi-v7a
+ armeabi
-
- 250
- -F
+ 2161d2080d017ece
+ 29
+
+
true
- 4096
- false
- false
- 1000
-
true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
+ 0
true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
+
+
- 2
+
+
+
+
+ 0
- VkTest
-
- Qt4ProjectManager.Qt4RunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
-
- 3768
- false
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
+ VkTest
+ Qt4ProjectManager.AndroidRunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ true
true
- true
- false
- false
true
-
- /home/ali-mehrabani/Qt_projects/build-VkTest-Desktop_Qt_5_13_2_GCC_64bit-Debug
- 1
+ 1
ProjectExplorer.Project.Target.1
- Android for arm64-v8a (Clang Qt 5.13.2 for Android ARM64-v8a)
- Android for arm64-v8a (Clang Qt 5.13.2 for Android ARM64-v8a)
- {81fbc123-4ee0-45a6-968a-bd5314a00c8f}
- 0
- 0
- 0
+ Android.Device.Type
+ Android Qt 5.15.2 Clang Multi-Abi
+ Android Qt 5.15.2 Clang Multi-Abi
+ {e0a7d5e8-aaa5-4254-b48e-a505f97057a1}
+ 0
+ 0
+ 0
- /home/ali-mehrabani/Qt_projects/build-VkTest-Android_for_arm64_v8a_Clang_Qt_5_13_2_for_Android_ARM64_v8a-Debug
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug
true
- qmake
-
QtProjectManager.QMakeBuildStep
- true
-
false
- false
- false
+
+ arm64-v8a
+
true
- Make
-
Qt4ProjectManager.MakeStep
-
- false
-
-
- false
true
- Copy application data
-
+ Copy application data
Qt4ProjectManager.AndroidPackageInstallationStep
- android-29
+ android-30
+ 30.0.3
true
- Build Android APK
-
+ Build Android APK
QmakeProjectManager.AndroidBuildApkStep
- false
- false
- 4
+ 4
Build
-
+ Build
ProjectExplorer.BuildSteps.Build
true
- Make
-
Qt4ProjectManager.MakeStep
-
- true
clean
-
- false
- 1
+ 1
Clean
-
+ Clean
ProjectExplorer.BuildSteps.Clean
2
false
+
+ false
- Debug
Debug
Qt4ProjectManager.Qt4BuildConfiguration
2
- true
- /home/ali-mehrabani/Qt_projects/build-VkTest-Android_for_arm64_v8a_Clang_Qt_5_13_2_for_Android_ARM64_v8a-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Release
true
- qmake
-
QtProjectManager.QMakeBuildStep
- false
-
false
- false
- true
+
true
- Make
-
Qt4ProjectManager.MakeStep
-
- false
-
-
- false
true
- Copy application data
-
+ Copy application data
Qt4ProjectManager.AndroidPackageInstallationStep
- android-30
+ android-35
+
true
- Build Android APK
-
+ Build Android APK
QmakeProjectManager.AndroidBuildApkStep
- false
- false
- 4
+ 4
Build
-
+ Build
ProjectExplorer.BuildSteps.Build
true
- Make
-
Qt4ProjectManager.MakeStep
-
- true
clean
-
- false
- 1
+ 1
Clean
-
+ Clean
ProjectExplorer.BuildSteps.Clean
2
false
+
+ false
- Release
Release
Qt4ProjectManager.Qt4BuildConfiguration
0
- true
+ 0
- /home/ali-mehrabani/Qt_projects/build-VkTest-Android_for_arm64_v8a_Clang_Qt_5_13_2_for_Android_ARM64_v8a-Profile
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Profile
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Profile
true
- qmake
-
QtProjectManager.QMakeBuildStep
- true
-
false
- true
- true
+
true
- Make
-
Qt4ProjectManager.MakeStep
-
- false
-
-
- false
true
- Copy application data
-
+ Copy application data
Qt4ProjectManager.AndroidPackageInstallationStep
- android-30
+ android-35
+
true
- Build Android APK
-
+ Build Android APK
QmakeProjectManager.AndroidBuildApkStep
- false
- false
- 4
+ 4
Build
-
+ Build
ProjectExplorer.BuildSteps.Build
true
- Make
-
Qt4ProjectManager.MakeStep
-
- true
clean
-
- false
- 1
+ 1
Clean
-
+ Clean
ProjectExplorer.BuildSteps.Clean
2
false
+
+ false
- Profile
Profile
Qt4ProjectManager.Qt4BuildConfiguration
0
- true
+ 0
+ 0
- 3
+ 3
true
- Deploy to Android device
-
Qt4ProjectManager.AndroidDeployQtStep
- false
+ true
- 1
+ 1
Deploy
-
+ Deploy
ProjectExplorer.BuildSteps.Deploy
1
- Deploy to Android device
-
+
+ false
Qt4ProjectManager.AndroidDeployConfiguration2
- 1
+ 1
+
+ arm64-v8a
+ armeabi-v7a
+ armeabi
+
2161d2080d017ece
29
- dwarf
-
- cpu-cycles
-
-
- 250
- -F
true
- 4096
- false
- false
- 1000
-
true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
+ 0
true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
+
+
+
+
+
-
-
-
+
0
-
- VkTest
+
+ QT_WAIT_FOR_DEBUGGER=1
+
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
VkTest
Qt4ProjectManager.AndroidRunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
-
- 3768
- false
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ true
true
- false
- false
true
- 1
+ 1
+
+
+
+ ProjectExplorer.Project.Target.2
+
+ Desktop
+ Desktop Qt 5.15.2 GCC 64bit
+ Desktop Qt 5.15.2 GCC 64bit
+ qt.qt5.5152.gcc_64_kit
+ 0
+ 0
+ 0
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Debug
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Profile
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
+
+ Qt4ProjectManager.Qt4RunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ false
+ true
+ true
+ true
+
+ 1
ProjectExplorer.Project.TargetCount
- 2
+ 3
ProjectExplorer.Project.Updater.FileVersion
diff --git a/VkTest.pro.user.9e9cdaa b/VkTest.pro.user.9e9cdaa
new file mode 100644
index 0000000..b4be27e
--- /dev/null
+++ b/VkTest.pro.user.9e9cdaa
@@ -0,0 +1,1175 @@
+
+
+
+
+
+ EnvironmentId
+ {9e9cdaa4-317b-4f62-9b8d-2ca42fb59b56}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 1
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ 0
+ false
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ true
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+ false
+
+
+ 0
+ true
+
+ false
+ {afe80e93-8983-4e43-ba75-d87634bcd04b}
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 4
+ true
+
+
+
+ true
+
+ true
+
+
+
+ true
+
+ true
+
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ Desktop Qt 5.15.2 GCC 64bit
+ Desktop Qt 5.15.2 GCC 64bit
+ qt.qt5.5152.gcc_64_kit
+ 0
+ 0
+ 0
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Debug
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Profile
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+ true
+ true
+ true
+
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
+
+ Qt4ProjectManager.Qt4RunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ false
+ true
+ true
+ true
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Desktop_Qt_5_15_2_GCC_64bit-Debug
+
+ 1
+
+
+
+ ProjectExplorer.Project.Target.1
+
+ Android.Device.Type
+ Android Qt 5.15.2 Clang Multi-Abi
+ Android Qt 5.15.2 Clang Multi-Abi
+ {9430e225-cb25-421e-a2e2-ef38ece80293}
+ 0
+ 0
+ 0
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ arm64-v8a
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-30
+ 30.0.0
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Profile
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+
+ true
+ Qt4ProjectManager.AndroidDeployQtStep
+
+ 1
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ Qt4ProjectManager.AndroidDeployConfiguration2
+
+ 1
+
+ true
+ true
+ 0
+ true
+
+
+
+
+
+
+
+
+ 0
+
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
+ VkTest
+ Qt4ProjectManager.AndroidRunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ false
+ true
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.Target.2
+
+ Android.Device.Type
+ Android Qt 6.7.3 Clang arm64-v8a
+ Android Qt 6.7.3 Clang arm64-v8a
+ {491e9a1a-386d-4b0d-9604-f4e7af37df59}
+ 0
+ 0
+ 0
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_7_3_Clang_arm64_v8a-Debug
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_7_3_Clang_arm64_v8a-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-30
+ 30.0.0
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_7_3_Clang_arm64_v8a-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_7_3_Clang_arm64_v8a-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_7_3_Clang_arm64_v8a-Profile
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_6_7_3_Clang_arm64_v8a-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+ 3
+
+
+
+ true
+ Qt4ProjectManager.AndroidDeployQtStep
+
+ 1
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ Qt4ProjectManager.AndroidDeployConfiguration2
+
+ 1
+
+ true
+ true
+ 0
+ true
+
+
+
+
+
+
+
+
+ 0
+
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
+ VkTest
+ Qt4ProjectManager.AndroidRunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ false
+ true
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.Target.3
+
+ Android.Device.Type
+ Android Qt 5.15.2 Clang Multi-Abi
+ Android Qt 5.15.2 Clang Multi-Abi
+ {5e144ce9-5a1d-4f99-b3b6-a8f842ce5289}
+ 0
+ 0
+ 0
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ arm64-v8a
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-30
+ 30.0.0
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+ true
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Release
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Profile
+ /home/ali-mehrabani/Qt_projects/VkTest/build/Android_Qt_5_15_2_Clang_Multi_Abi-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+
+ true
+ Qt4ProjectManager.AndroidDeployQtStep
+
+ 1
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ Qt4ProjectManager.AndroidDeployConfiguration2
+
+ 1
+
+
+ arm64-v8a
+ armeabi-v7a
+ armeabi
+
+ 2161d2080d017ece
+ 29
+
+
+ true
+ true
+ 0
+ true
+
+
+
+
+
+
+
+
+ 0
+
+ QT_WAIT_FOR_DEBUGGER=1
+
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
+ VkTest
+ Qt4ProjectManager.AndroidRunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ true
+ true
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.Target.4
+
+ Android.Device.Type
+ Android Qt 5.15.2 Clang Multi-Abi
+ Android Qt 5.15.2 Clang Multi-Abi
+ {f426096d-98ef-4da7-904a-d396b43f58cb}
+ 0
+ 0
+ 0
+
+ 0
+ /home/ali-mehrabani/Qt_projects/build-VkTest-Android_Qt_5_15_2_Clang_Multi_Abi-Debug
+ /home/ali-mehrabani/Qt_projects/build-VkTest-Android_Qt_5_15_2_Clang_Multi_Abi-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ arm64-v8a
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-28
+ 29.0.3
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+ true
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/ali-mehrabani/Qt_projects/build-VkTest-Android_Qt_5_15_2_Clang_Multi_Abi-Release
+ /home/ali-mehrabani/Qt_projects/build-VkTest-Android_Qt_5_15_2_Clang_Multi_Abi-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ /home/ali-mehrabani/Qt_projects/build-VkTest-Android_Qt_5_15_2_Clang_Multi_Abi-Profile
+ /home/ali-mehrabani/Qt_projects/build-VkTest-Android_Qt_5_15_2_Clang_Multi_Abi-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+
+ true
+ Copy application data
+ Qt4ProjectManager.AndroidPackageInstallationStep
+
+
+ android-35
+
+
+ true
+ Build Android APK
+ QmakeProjectManager.AndroidBuildApkStep
+
+ 4
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+
+ true
+ Qt4ProjectManager.AndroidDeployQtStep
+ true
+
+ 1
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ Qt4ProjectManager.AndroidDeployConfiguration2
+
+ 1
+
+
+ arm64-v8a
+ armeabi-v7a
+ armeabi
+
+ 2161d2080d017ece
+ 29
+
+
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+ 0
+
+ QT_WAIT_FOR_DEBUGGER=1
+ QT_FORCE_DEBUG=1
+
+ false
+ -e cpu-cycles --call-graph dwarf,4096 -F 250
+ VkTest
+ Qt4ProjectManager.AndroidRunConfiguration:/home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ /home/ali-mehrabani/Qt_projects/VkTest/VkTest.pro
+ true
+ 0
+ false
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 5
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/VulkanTutorial1.0/ComputeAndGraphics.cpp b/VulkanTutorial1.0/ComputeAndGraphics.cpp
index aae9fcd..41c574c 100644
--- a/VulkanTutorial1.0/ComputeAndGraphics.cpp
+++ b/VulkanTutorial1.0/ComputeAndGraphics.cpp
@@ -3,39 +3,77 @@
#include
#include
#include
-
-VkResult CreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo
- , const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pDebugMessenger) {
- auto func = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCreateDebugUtilsMessengerEXT"));
+#include
+#include
+
+#define VKB_VALIDATION_LAYERS
+
+
+// VkResult CreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo
+// , const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pDebugMessenger) {
+// auto func = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCreateDebugUtilsMessengerEXT"));
+// if (func != nullptr) {
+// return func(instance, pCreateInfo, pAllocator, pDebugMessenger);
+// } else {
+// return VK_ERROR_EXTENSION_NOT_PRESENT;
+// }
+// }
+
+// void DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT debugMessenger, const VkAllocationCallbacks* pAllocator) {
+// auto func = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkDestroyDebugUtilsMessengerEXT"));
+// if (func != nullptr) {
+// func(instance, debugMessenger, pAllocator);
+// }
+// }
+
+VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo
+ , const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pDebugReporter) {
+ auto func = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT"));
if (func != nullptr) {
- return func(instance, pCreateInfo, pAllocator, pDebugMessenger);
+ return func(instance, pCreateInfo, pAllocator, pDebugReporter);
} else {
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
}
-void DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT debugMessenger, const VkAllocationCallbacks* pAllocator) {
- auto func = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkDestroyDebugUtilsMessengerEXT"));
+void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT debugReporter, const VkAllocationCallbacks* pAllocator) {
+ auto func = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT"));
if (func != nullptr) {
- func(instance, debugMessenger, pAllocator);
+ func(instance, debugReporter, pAllocator);
}
}
+
std::vector ComputeAndGraphics::readFile(const std::string& filename) {
- const std::string& newFilename = "/home/ali-mehrabani/Qt_projects/VkTest/" + filename;
- std::ifstream file(newFilename, std::ios::ate | std::ios::binary);
+// const std::string& newFilename = "/home/ali-mehrabani/Qt_projects/VkTest/" + filename;
+// std::ifstream file(filename, std::ios::ate | std::ios::binary);
- if (!file.is_open()) {
- throw std::runtime_error("failed to open file!");
- }
+// if (!file.is_open()) {
+// throw std::runtime_error("failed to open file!");
+// }
+
+// size_t fileSize = static_cast(file.tellg());
+// std::vector buffer(fileSize);
+// file.seekg(0);
+// file.read(buffer.data(), static_cast(fileSize));
+
+// file.close();
+
+ const QString filePath = QString::fromUtf8(filename.c_str());
+ QFile file(filePath);
- size_t fileSize = static_cast(file.tellg());
- std::vector buffer(fileSize);
- file.seekg(0);
- file.read(buffer.data(), static_cast(fileSize));
+ if (!file.open(QIODevice::ReadOnly)) {
+ qWarning() << "Failed to open file:" << filePath << file.errorString();
+ return {};
+ }
+ // Read the entire file as binary
+ QByteArray fileData = file.readAll();
file.close();
+ // Convert to std::vector
+ std::vector buffer = std::vector(fileData.begin(), fileData.end());
+
return buffer;
}
@@ -75,15 +113,17 @@ void ComputeAndGraphics::initWindow(VulkanWindow* window)
//}
-
void ComputeAndGraphics::initVulkan()
{
-// if (enableValidationLayers && !checkValidationLayerSupport()) {
-// throw std::runtime_error("validation layers requested, but not available!");
-// }
+ if (enableValidationLayers && !checkValidationLayerSupport()) {
+ throw std::runtime_error("validation layers requested, but not available!");
+ }
createInstance();
- setupDebugMessenger();
+
+// setupDebugMessenger();
+ setupDebugReporter();
+
createSurface();
pickPhysicalDevice();
createLogicalDevice();
@@ -113,6 +153,8 @@ void ComputeAndGraphics::initVulkan()
createCommandBuffer();
createComputeCommandBuffers();
createSyncObjects();
+
+ qDebug() << "vulkan init is done!";
}
bool ComputeAndGraphics::checkValidationLayerSupport()
@@ -146,32 +188,69 @@ VkApplicationInfo ComputeAndGraphics::createInstanceAppInfo()
VkApplicationInfo appInfo{};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.pApplicationName = "Vulkan App";
- appInfo.applicationVersion = VK_MAKE_VERSION(1, 1, 0);
+ appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.pEngineName = "No Engine";
- appInfo.engineVersion = VK_MAKE_VERSION(1, 1, 0);
- appInfo.apiVersion = VK_API_VERSION_1_1;
+ appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
+ appInfo.apiVersion = VK_API_VERSION_1_0;
return appInfo;
}
-VkDebugUtilsMessengerCreateInfoEXT ComputeAndGraphics::createInstanceDebugMessengerInfo()
-{
- VkDebugUtilsMessengerCreateInfoEXT createInfo = {};
- createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
- createInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT
- | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
- | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
- createInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT
- | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
- VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
+// VkDebugUtilsMessengerCreateInfoEXT ComputeAndGraphics::createInstanceDebugMessengerInfo()
+// {
+// VkDebugUtilsMessengerCreateInfoEXT createInfo = {};
+// createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
+// createInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT
+// | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
+// | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
+// createInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT
+// | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT
+// | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
- createInfo.pfnUserCallback = debugCallback;
+// createInfo.pfnUserCallback = debugCallback;
+
+// return createInfo;
+// }
+
+VkDebugReportCallbackCreateInfoEXT ComputeAndGraphics::createInstanceDebugReporterInfo()
+{
+ VkDebugReportCallbackCreateInfoEXT createInfo = {};
+ createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
+ createInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT |
+ VK_DEBUG_REPORT_DEBUG_BIT_EXT |
+ // VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT |
+ VK_DEBUG_REPORT_INFORMATION_BIT_EXT |
+ VK_DEBUG_REPORT_WARNING_BIT_EXT;
+ createInfo.pfnCallback = debugReportCallback;
return createInfo;
}
-VkInstanceCreateInfo ComputeAndGraphics::createInstanceInfo(VkApplicationInfo* appInfo, std::vector& extensions
- , VkDebugUtilsMessengerCreateInfoEXT& debugCreateInfo)
+// VkInstanceCreateInfo ComputeAndGraphics::createInstanceInfo(VkApplicationInfo* appInfo, std::vector& extensions
+// , VkDebugUtilsMessengerCreateInfoEXT& debugCreateInfo)
+// {
+// VkInstanceCreateInfo createInfo = {};
+// createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+// createInfo.pApplicationInfo = appInfo;
+// createInfo.enabledExtensionCount = static_cast(extensions.size());
+// createInfo.ppEnabledExtensionNames = extensions.data();
+
+// if (enableValidationLayers) {
+// createInfo.enabledLayerCount = static_cast(validationLayers.size());
+// createInfo.ppEnabledLayerNames = validationLayers.data();
+
+// debugCreateInfo = createInstanceDebugMessengerInfo();
+// createInfo.pNext = dynamic_cast(&debugCreateInfo);
+// } else {
+// createInfo.enabledLayerCount = 0;
+// createInfo.pNext = nullptr;
+// }
+
+// return createInfo;
+// }
+
+VkInstanceCreateInfo ComputeAndGraphics::createInstanceInfoOld(VkApplicationInfo* appInfo, std::vector& extensions
+ , VkDebugReportCallbackCreateInfoEXT& debugCreateInfo)
{
VkInstanceCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
@@ -183,8 +262,8 @@ VkInstanceCreateInfo ComputeAndGraphics::createInstanceInfo(VkApplicationInfo* a
createInfo.enabledLayerCount = static_cast(validationLayers.size());
createInfo.ppEnabledLayerNames = validationLayers.data();
- debugCreateInfo = createInstanceDebugMessengerInfo();
- createInfo.pNext = dynamic_cast(&debugCreateInfo);
+ debugCreateInfo = createInstanceDebugReporterInfo();
+ createInfo.pNext = dynamic_cast(&debugCreateInfo);
} else {
createInfo.enabledLayerCount = 0;
createInfo.pNext = nullptr;
@@ -198,8 +277,11 @@ void ComputeAndGraphics::createInstance()
VkApplicationInfo appInfo = createInstanceAppInfo();
auto extensions = getRequiredExtensions();
- VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo{};
- VkInstanceCreateInfo createInfo = createInstanceInfo(&appInfo, extensions, debugCreateInfo);
+// VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo{};
+// VkInstanceCreateInfo createInfo = createInstanceInfo(&appInfo, extensions, debugCreateInfo);
+
+ VkDebugReportCallbackCreateInfoEXT debugCreateInfo{};
+ VkInstanceCreateInfo createInfo = createInstanceInfoOld(&appInfo, extensions, debugCreateInfo);
if (vkCreateInstance(&createInfo, nullptr, &_instance) != VK_SUCCESS) {
throw std::runtime_error("failed to create instance!");
@@ -211,6 +293,7 @@ std::vector ComputeAndGraphics::getRequiredExtensions()
std::vector extensions;
extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
+ extensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
#if defined(Q_OS_ANDROID)
extensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
@@ -219,26 +302,41 @@ std::vector ComputeAndGraphics::getRequiredExtensions()
#endif
if (enableValidationLayers) {
- extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
+// extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
+ extensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
}
return extensions;
}
-void ComputeAndGraphics::setupDebugMessenger() {
+void ComputeAndGraphics::setupDebugReporter() {
if (!enableValidationLayers)
{
return;
}
- VkDebugUtilsMessengerCreateInfoEXT createInfo = createInstanceDebugMessengerInfo();
- createInfo.pfnUserCallback = debugCallback;
+ VkDebugReportCallbackCreateInfoEXT createInfo = createInstanceDebugReporterInfo();
+ createInfo.pfnCallback = debugReportCallback;
- if (CreateDebugUtilsMessengerEXT(_instance, &createInfo, nullptr, &_debugMessenger) != VK_SUCCESS) {
- throw std::runtime_error("failed to set up debug messenger!");
+ if (CreateDebugReportCallbackEXT(_instance, &createInfo, nullptr, &_debugReporter) != VK_SUCCESS) {
+ throw std::runtime_error("failed to set up debug reporter!");
}
}
+// void ComputeAndGraphics::setupDebugMessenger() {
+// if (!enableValidationLayers)
+// {
+// return;
+// }
+
+// VkDebugUtilsMessengerCreateInfoEXT createInfo = createInstanceDebugMessengerInfo();
+// createInfo.pfnUserCallback = debugCallback;
+
+// if (CreateDebugUtilsMessengerEXT(_instance, &createInfo, nullptr, &_debugMessenger) != VK_SUCCESS) {
+// throw std::runtime_error("failed to set up debug messenger!");
+// }
+// }
+
void ComputeAndGraphics::createSurface()
{
// if (glfwCreateWindowSurface(_instance, _window, nullptr, &_surface) != VK_SUCCESS) {
@@ -297,8 +395,9 @@ bool ComputeAndGraphics::isDeviceSuitable(VkPhysicalDevice device) {
VkPhysicalDeviceFeatures supportedFeatures;
vkGetPhysicalDeviceFeatures(device, &supportedFeatures);
+// supportedFeatures.samplerAnisotropy not supported on Galaxy S9
- return indices.isComplete() && extensionsSupported && swapChainAdequate && supportedFeatures.samplerAnisotropy;
+ return indices.isComplete() && extensionsSupported && swapChainAdequate;
}
bool ComputeAndGraphics::checkDeviceExtensionSupport(VkPhysicalDevice device) {
@@ -311,7 +410,6 @@ bool ComputeAndGraphics::checkDeviceExtensionSupport(VkPhysicalDevice device) {
std::set requiredExtensions(deviceExtensions.begin(), deviceExtensions.end());
for (const auto& extension : availableExtensions) {
-// qDebug() << extension.extensionName;
requiredExtensions.erase(extension.extensionName);
}
@@ -416,7 +514,7 @@ VkDeviceQueueCreateInfo ComputeAndGraphics::createQueueInfo(uint32_t queueFamily
VkPhysicalDeviceFeatures ComputeAndGraphics::createDeviceCoreFeatures()
{
VkPhysicalDeviceFeatures deviceFeatures{};
- deviceFeatures.samplerAnisotropy = VK_TRUE;
+ deviceFeatures.samplerAnisotropy = VK_FALSE;
return deviceFeatures;
}
@@ -748,8 +846,8 @@ VkDescriptorSetLayoutBinding ComputeAndGraphics::createLayoutBindingInfo(uint32_
void ComputeAndGraphics::createGraphicsPipeline()
{
- auto vertShaderCode = readFile("shaders/VulkanTutorial1.0/ComputeAndGraphics/vertComp.spv");
- auto fragShaderCode = readFile("shaders/VulkanTutorial1.0/ComputeAndGraphics/fragComp.spv");
+ auto vertShaderCode = readFile(":/shaders/VulkanTutorial1.0/ComputeAndGraphics/vertComp.spv");
+ auto fragShaderCode = readFile(":/shaders/VulkanTutorial1.0/ComputeAndGraphics/fragComp.spv");
VkShaderModule vertShaderModule = createShaderModule(vertShaderCode);
VkShaderModule fragShaderModule = createShaderModule(fragShaderCode);
VkPipelineShaderStageCreateInfo vertShaderStageInfo = createPipelineShaderInfo(VK_SHADER_STAGE_VERTEX_BIT, vertShaderModule);
@@ -958,7 +1056,7 @@ VkPipelineColorBlendStateCreateInfo ComputeAndGraphics::colorPipelineBlendStateI
void ComputeAndGraphics::createComputePipeline()
{
- auto computeShaderCode = readFile("shaders/VulkanTutorial1.0/ComputeAndGraphics/compComp.spv");
+ auto computeShaderCode = readFile(":/shaders/VulkanTutorial1.0/ComputeAndGraphics/compComp.spv");
VkShaderModule computeShaderModule = createShaderModule(computeShaderCode);
VkPipelineShaderStageCreateInfo computeShaderStageInfo = createPipelineShaderInfo(VK_SHADER_STAGE_COMPUTE_BIT, computeShaderModule);
@@ -1088,11 +1186,11 @@ bool ComputeAndGraphics::hasStencilComponent(VkFormat format) {
void ComputeAndGraphics::createTextureImage() {
int texWidth, texHeight, texChannels;
- stbi_uc* pixels = stbi_load("/home/ali-mehrabani/Qt_projects/VkTest/textures/texture.jpg", &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
+// stbi_uc* pixels = stbi_load("/home/ali-mehrabani/Qt_projects/VkTest/textures/texture.jpg", &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
+
+ const char* absPath = getResourceAbsolutePath(":/textures/texture.jpg");
+ stbi_uc* pixels = stbi_load(absPath, &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
VkDeviceSize imageSize = texWidth * texHeight * 4;
-// qDebug() << imageSize;
-// qDebug() << texWidth;
-// qDebug() << texHeight;
if (!pixels) {
throw std::runtime_error("failed to load texture image!");
@@ -1117,6 +1215,57 @@ void ComputeAndGraphics::createTextureImage() {
vkFreeMemory(_device, stagingBufferMemory, nullptr);
}
+const char* ComputeAndGraphics::getResourceAbsolutePath(QString resourcePath)
+{
+ const char* absolutePath;
+#if defined(Q_OS_ANDROID)
+
+ QString inTempPath = resourcePath.mid(2);
+
+ absolutePath = copyToTemp(resourcePath, inTempPath).toUtf8().data();
+
+#elif defined(Q_OS_LINUX)
+
+ QString linuxPath = "/home/ali-mehrabani/Qt_projects/VkTest/textures/texture.jpg";
+ absolutePath = linuxPath.toUtf8().data();
+
+#endif
+
+ return absolutePath;
+}
+
+QString ComputeAndGraphics::copyToTemp(QString resourcePath, QString inTempPath)
+{
+ QString writablePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
+ QDir().mkpath(writablePath);
+
+ QString outputPath = writablePath + "/" + inTempPath;
+ if (!QDir().exists(outputPath))
+ {
+ QDir().mkpath(outputPath.left(outputPath.lastIndexOf("/")));
+
+ QFile resourceFile(resourcePath);
+ if (!resourceFile.open(QIODevice::ReadOnly)) {
+ qWarning() << "Failed to open resource file:" << resourcePath << resourceFile.errorString();
+ return "";
+ }
+
+ QFile outFile(outputPath);
+ if (!outFile.open(QIODevice::WriteOnly)) {
+ qWarning() << "Failed to create output file:" << outputPath << outFile.errorString();
+ return "";
+ }
+
+ outFile.write(resourceFile.readAll());
+
+ outFile.flush();
+ outFile.close();
+ resourceFile.close();
+ }
+
+ return outputPath;
+}
+
void ComputeAndGraphics::copyImageToStagingBuffer(VkBuffer& stagingBuffer, VkDeviceMemory& stagingBufferMemory, stbi_uc* pixels, VkDeviceSize imageSize)
{
createBuffer(imageSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
@@ -1329,7 +1478,7 @@ void ComputeAndGraphics::createTextureSampler()
VkPhysicalDeviceProperties properties{};
vkGetPhysicalDeviceProperties(_physicalDevice, &properties);
- samplerInfo.anisotropyEnable = VK_TRUE;
+ samplerInfo.anisotropyEnable = VK_FALSE;
samplerInfo.maxAnisotropy = properties.limits.maxSamplerAnisotropy;
samplerInfo.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK;
@@ -1499,7 +1648,9 @@ uint32_t ComputeAndGraphics::findMemoryType(uint32_t typeFilter, VkMemoryPropert
void ComputeAndGraphics::createShaderStorageBuffers() {
int texWidth, texHeight, texChannels;
- stbi_uc* pixels = stbi_load("/home/ali-mehrabani/Qt_projects/VkTest/textures/texture.jpg", &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
+// stbi_uc* pixels = stbi_load("/home/ali-mehrabani/Qt_projects/VkTest/textures/texture.jpg", &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
+ const char* absPath = getResourceAbsolutePath(":/textures/texture.jpg");
+ stbi_uc* pixels = stbi_load(absPath, &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
_textureImageSize = texWidth * texHeight * 4;
_textureImageWidth = texWidth;
_textureImageHeight = texHeight;
@@ -1538,7 +1689,8 @@ void ComputeAndGraphics::initShaderStorageBuffers(VkBuffer& stagingBuffer, VkDev
void ComputeAndGraphics::createComputeStorageBuffers()
{
- QString filePath = "/home/ali-mehrabani/Qt_projects/VkTest/misc/TintMap.xml";
+// QString filePath = "/home/ali-mehrabani/Qt_projects/VkTest/misc/TintMap.xml";
+ QString filePath = ":/misc/TintMap.xml";
QDomDocument doc = openTintMapXML(filePath);
QVector tintMap = saveTintMapArrays(doc);
@@ -1915,6 +2067,7 @@ void ComputeAndGraphics::copyTransformedBufferToTextureImage()
transitionImageLayout(_textureImage, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1);
copyBufferToImage(_shaderTransformedStorageBuffers[currentFrame], _textureImage, _textureImageWidth, _textureImageHeight);
transitionImageLayout(_textureImage, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 1);
+// transitionImageLayout(_textureImage, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1);
}
void ComputeAndGraphics::computeSubmission()
@@ -2142,10 +2295,10 @@ void ComputeAndGraphics::recordComputeCommandBuffer(VkCommandBuffer commandBuffe
}
void ComputeAndGraphics::updateUniformBuffer(uint32_t currentImage) {
- static auto startTime = std::chrono::high_resolution_clock::now();
+// static auto startTime = std::chrono::high_resolution_clock::now();
- auto currentTime = std::chrono::high_resolution_clock::now();
- float time = std::chrono::duration(currentTime - startTime).count();
+// auto currentTime = std::chrono::high_resolution_clock::now();
+// float time = std::chrono::duration(currentTime - startTime).count();
UniformBufferObject ubo{};
ubo.model = glm::rotate(glm::mat4(1.0f), glm::radians(0.0f), glm::vec3(0.0f, 0.0f, 1.0f));
@@ -2262,7 +2415,8 @@ void ComputeAndGraphics::cleanBase()
vkDestroySurfaceKHR(_instance, _surface, nullptr);
if (enableValidationLayers) {
- DestroyDebugUtilsMessengerEXT(_instance, _debugMessenger, nullptr);
+// DestroyDebugUtilsMessengerEXT(_instance, _debugMessenger, nullptr);
+ DestroyDebugReportCallbackEXT(_instance, _debugReporter, nullptr);
}
vkDestroyInstance(_instance, nullptr);
diff --git a/VulkanTutorial1.0/ComputeAndGraphics.h b/VulkanTutorial1.0/ComputeAndGraphics.h
index 3bd77c0..6774276 100644
--- a/VulkanTutorial1.0/ComputeAndGraphics.h
+++ b/VulkanTutorial1.0/ComputeAndGraphics.h
@@ -15,15 +15,13 @@
#include
#include
#include // Necessary for uint32_t
-#include // Necessary for std::numeric_limits
-#include // Necessary for std::clamp
-#include
#include
#include
#include
#include
+
const int MAX_FRAMES_IN_FLIGHT = 2;
struct QueueFamilyIndices {
@@ -93,17 +91,34 @@ public:
void initWindow(VulkanWindow* window);
// Message Callback
- static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT /*messageSeverity*/,
- VkDebugUtilsMessageTypeFlagsEXT /*messageType*/,const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,void* /*pUserData*/) {
+ // static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT /*messageSeverity*/,
+ // VkDebugUtilsMessageTypeFlagsEXT /*messageType*/,
+ // const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
+ // void* /*pUserData*/) {
+
+ // qDebug() << "validation layer: " << pCallbackData->pMessage;
+
+ // return VK_FALSE;
+ // }
- std::cerr << "validation layer: " << pCallbackData->pMessage << std::endl;
+ static VkBool32 VKAPI_PTR debugReportCallback(
+ VkDebugReportFlagsEXT /*flags*/,
+ VkDebugReportObjectTypeEXT /*objType*/,
+ uint64_t /*obj*/,
+ size_t /*location*/,
+ int32_t /*messageCode*/,
+ const char* /*pLayerPrefix*/,
+ const char* pMessage,
+ void* /*pUserData*/) {
+
+ std::cerr << "Validation Layer: " << pMessage << std::endl;
return VK_FALSE;
}
+
static std::vector readFile(const std::string& filename);
// static void framebufferResizeCallback(GLFWwindow* window, int width, int height);
-// static void framebufferResizeCallback(QQuickWindow* window, int width, int height);
private:
void initVulkan();
@@ -193,10 +208,15 @@ private:
void createComputeUniformBuffers();
void updateComputeUniformBuffer(uint32_t currentImage);
+ void setupDebugReporter();
+
VkApplicationInfo createInstanceAppInfo();
- VkDebugUtilsMessengerCreateInfoEXT createInstanceDebugMessengerInfo();
- VkInstanceCreateInfo createInstanceInfo(VkApplicationInfo* appInfo, std::vector& extensions
- , VkDebugUtilsMessengerCreateInfoEXT& debugCreateInfo);
+ // VkDebugUtilsMessengerCreateInfoEXT createInstanceDebugMessengerInfo();
+ VkDebugReportCallbackCreateInfoEXT createInstanceDebugReporterInfo();
+ // VkInstanceCreateInfo createInstanceInfo(VkApplicationInfo* appInfo, std::vector& extensions
+ // , VkDebugUtilsMessengerCreateInfoEXT& debugCreateInfo);
+ VkInstanceCreateInfo createInstanceInfoOld(VkApplicationInfo* appInfo, std::vector& extensions
+ , VkDebugReportCallbackCreateInfoEXT& debugCreateInfo);
VkDeviceQueueCreateInfo createQueueInfo(uint32_t queueFamily, uint32_t queueCount, float* queuePriority);
VkPhysicalDeviceFeatures createDeviceCoreFeatures();
@@ -285,6 +305,9 @@ private:
QVector extractIntArrayFromString(QString input, QString delimiter);
void copyDataToStagingBuffer(VkBuffer& stagingBuffer, VkDeviceMemory& stagingBufferMemory, uint8_t* dataIn, VkDeviceSize dataSize);
+ const char* getResourceAbsolutePath(QString resourcePath);
+ QString copyToTemp(QString resourcePath, QString inTempPath);
+
const int32_t WIDTH = 800;
const int32_t HEIGHT = 600;
@@ -293,8 +316,10 @@ private:
};
const std::vector deviceExtensions = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
-// VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
-// VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME
+ VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
+ VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME,
+ VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME,
+ VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME,
};
const std::vector _vertices = {
{{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {1.0f, 0.0f}},
@@ -318,7 +343,10 @@ private:
// GLFWwindow *_window;
VulkanWindow* _windowQt;
VkInstance _instance;
- VkDebugUtilsMessengerEXT _debugMessenger;
+
+ // VkDebugUtilsMessengerEXT _debugMessenger;
+ VkDebugReportCallbackEXT _debugReporter;
+
VkPhysicalDevice _physicalDevice;
VkDevice _device;
VkQueue _graphicsQueue;
diff --git a/VulkanTutorial1.0/Types.h b/VulkanTutorial1.0/Types.h
index 7402e77..f6bc786 100644
--- a/VulkanTutorial1.0/Types.h
+++ b/VulkanTutorial1.0/Types.h
@@ -4,12 +4,6 @@
#include
#include
-//#define VK_USE_PLATFORM_
-//#define GLFW_INCLUDE_VULKAN
-//#include
-//#define GLFW_EXPOSE_NATIVE_
-//#include
-
#define GLM_FORCE_RADIANS
//#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
@@ -20,6 +14,7 @@
#include
#include
+#include
struct SwapChainSupportDetails {
VkSurfaceCapabilitiesKHR capabilities;
diff --git a/VulkanTutorial1.0/VulkanWindow.cpp b/VulkanTutorial1.0/VulkanWindow.cpp
index 774d1cb..bedb891 100644
--- a/VulkanTutorial1.0/VulkanWindow.cpp
+++ b/VulkanTutorial1.0/VulkanWindow.cpp
@@ -1,45 +1,64 @@
#include "VulkanWindow.h"
+// #include
VulkanWindow::VulkanWindow()
{
-// setSurfaceType(QWindow::VulkanSurface);
-// if (!initVulkanInstance()) {
-// qCritical() << "Failed to initialize Vulkan instance!";
-// exit(EXIT_FAILURE);
-// }
-// createVulkanSurface();
+ setSurfaceType(QWindow::VulkanSurface);
}
VulkanWindow::~VulkanWindow() {
// cleanup();
}
-VkSurfaceKHR VulkanWindow::createVulkanSurface(VkInstance instance, VkSurfaceKHR& surface) {
-
-
-#if defined(Q_OS_ANDROID)
- VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo = {};
- surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
- surfaceCreateInfo.window = reinterpret_cast(winId());
-
- if (vkCreateAndroidSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface) != VK_SUCCESS) {
- qCritical() << "Failed to create Vulkan surface on Android.";
- exit(EXIT_FAILURE);
- }
-#elif defined(Q_OS_LINUX)
- VkXcbSurfaceCreateInfoKHR surfaceCreateInfo = {};
- surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
- surfaceCreateInfo.connection = QX11Info::connection();
- surfaceCreateInfo.window = static_cast(winId());
-
- if (vkCreateXcbSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface) != VK_SUCCESS) {
- qCritical() << "Failed to create Vulkan surface on Linux.";
- exit(EXIT_FAILURE);
- }
-#endif
- _surface = surface;
+void VulkanWindow::createVulkanSurface(VkInstance instance, VkSurfaceKHR& surface) {
+
+ QVulkanInstance* vkInstance = new QVulkanInstance();
+ vkInstance->setVkInstance(instance);
+ vkInstance->create();
+ setVulkanInstance(vkInstance);
+ VkSurfaceKHR newSurface = QVulkanInstance::surfaceForWindow(this);
+
+ surface = newSurface;
+ qDebug() << "######" << surface << "######";
+ qDebug() << "######" << newSurface << "######";
+ if (!surface) {
+ qDebug() << "############## Failed to retrieve surface using Qt. ##############";
+ exit(EXIT_FAILURE);
+ }
+
+
+// #if defined(Q_OS_ANDROID)
+// VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo = {};
+// surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
+// surfaceCreateInfo.pNext = nullptr;
+// surfaceCreateInfo.flags = 0;
+
+// ANativeWindow* nativeWindow = reinterpret_cast(winId());
+
+// if (!nativeWindow) {
+// qCritical() << "Failed to retrieve ANativeWindow using JNI.";
+// exit(EXIT_FAILURE);
+// }
+
+// surfaceCreateInfo.window = nativeWindow;
+
+// if (vkCreateAndroidSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface) != VK_SUCCESS) {
+// qCritical() << "Failed to create Vulkan surface on Android.";
+// exit(EXIT_FAILURE);
+// }
+// #elif defined(Q_OS_LINUX)
+
+// VkXcbSurfaceCreateInfoKHR surfaceCreateInfo = {};
+// surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
+// surfaceCreateInfo.connection = QX11Info::connection();
+// surfaceCreateInfo.window = static_cast(winId());
+
+// if (vkCreateXcbSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface) != VK_SUCCESS) {
+// qCritical() << "Failed to create Vulkan surface on Linux.";
+// exit(EXIT_FAILURE);
+// }
+// #endif
qDebug() << "Vulkan surface created successfully.";
- return _surface;
}
void VulkanWindow::getWindowSize(int &width, int &height)
@@ -49,7 +68,5 @@ void VulkanWindow::getWindowSize(int &width, int &height)
}
void VulkanWindow::cleanup() {
- if (_surface != VK_NULL_HANDLE) {
- vkDestroySurfaceKHR(_instance, _surface, nullptr);
- }
+
}
diff --git a/VulkanTutorial1.0/VulkanWindow.h b/VulkanTutorial1.0/VulkanWindow.h
index 331b0b9..9d8cc02 100644
--- a/VulkanTutorial1.0/VulkanWindow.h
+++ b/VulkanTutorial1.0/VulkanWindow.h
@@ -1,23 +1,26 @@
#ifndef VULKANWINDOW_H
#define VULKANWINDOW_H
+#include "Types.h"
#include
#include
#include
-#include "Types.h"
+// #include
+#include
+
#if defined(Q_OS_ANDROID)
-//#define VK_USE_PLATFORM_ANDROID_KHR // Enable Vulkan support for Android (added to qmake file)
-#include
+// #define VK_USE_PLATFORM_ANDROID_KHR // Enable Vulkan support for Android (added to qmake file)
+// #include
#elif defined(Q_OS_LINUX)
-#include
+// #include
//#define VK_USE_PLATFORM_XCB_KHR // Enable Vulkan support for Linux (XCB) (added to qmake file)
-#include
+// #include
#include
#endif
-class VulkanWindow : public QWindow
+class VulkanWindow : public QVulkanWindow
{
Q_OBJECT
@@ -25,14 +28,12 @@ public:
VulkanWindow();
virtual ~VulkanWindow();
- VkSurfaceKHR createVulkanSurface(VkInstance instance, VkSurfaceKHR& surface);
+ void createVulkanSurface(VkInstance instance, VkSurfaceKHR& surface);
void getWindowSize(int& width, int& height);
private:
void cleanup();
- VkSurfaceKHR _surface;
- VkInstance _instance;
};
#endif // VULKANWINDOW_H
diff --git a/android/AndroidManifest.xml b/android-qt5/AndroidManifest.xml
similarity index 92%
rename from android/AndroidManifest.xml
rename to android-qt5/AndroidManifest.xml
index 25336e6..af64b81 100644
--- a/android/AndroidManifest.xml
+++ b/android-qt5/AndroidManifest.xml
@@ -1,7 +1,5 @@
-
-
-
+
@@ -11,18 +9,15 @@
-
-
+
-
-
@@ -30,12 +25,10 @@
-
-
-
+
@@ -46,7 +39,6 @@
-
-
-
-
-
+
diff --git a/android/build.gradle b/android-qt5/build.gradle
similarity index 69%
rename from android/build.gradle
rename to android-qt5/build.gradle
index ed704c4..9ecbf22 100644
--- a/android/build.gradle
+++ b/android-qt5/build.gradle
@@ -1,16 +1,18 @@
buildscript {
repositories {
google()
+ mavenCentral()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.0'
+ classpath 'com.android.tools.build:gradle:4.1.3'
}
}
repositories {
google()
+ mavenCentral()
jcenter()
}
@@ -36,7 +38,7 @@ android {
compileSdkVersion androidCompileSdkVersion.toInteger()
- buildToolsVersion '28.0.3'
+ buildToolsVersion '30.0.3'
sourceSets {
main {
@@ -44,14 +46,34 @@ android {
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir + '/res', 'res']
- resources.srcDirs = ['src']
+ resources.srcDirs = ['resources']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
+ tasks.withType(JavaCompile) {
+ options.incremental = true
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
lintOptions {
abortOnError false
}
+
+ // Do not compress Qt binary resources file
+ aaptOptions {
+ noCompress 'rcc'
+ }
+
+ defaultConfig {
+ resConfig "en"
+ minSdkVersion = qtMinSdkVersion
+ targetSdkVersion = qtTargetSdkVersion
+ }
}
diff --git a/android-qt5/gradle.properties b/android-qt5/gradle.properties
new file mode 100644
index 0000000..fded106
--- /dev/null
+++ b/android-qt5/gradle.properties
@@ -0,0 +1,11 @@
+# Project-wide Gradle settings.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m
+
+# Gradle caching allows reusing the build artifacts from a previous
+# build with the same inputs. However, over time, the cache size will
+# grow. Uncomment the following line to enable it.
+#org.gradle.caching=true
diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android-qt5/gradle/wrapper/gradle-wrapper.jar
similarity index 100%
rename from android/gradle/wrapper/gradle-wrapper.jar
rename to android-qt5/gradle/wrapper/gradle-wrapper.jar
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android-qt5/gradle/wrapper/gradle-wrapper.properties
similarity index 93%
rename from android/gradle/wrapper/gradle-wrapper.properties
rename to android-qt5/gradle/wrapper/gradle-wrapper.properties
index bf3de21..549d844 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android-qt5/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/android/gradlew b/android-qt5/gradlew
similarity index 100%
rename from android/gradlew
rename to android-qt5/gradlew
diff --git a/android/gradlew.bat b/android-qt5/gradlew.bat
similarity index 100%
rename from android/gradlew.bat
rename to android-qt5/gradlew.bat
diff --git a/android-qt5/libs/arm64-v8a/libVkLayer_khronos_validation.so b/android-qt5/libs/arm64-v8a/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..68ca586
Binary files /dev/null and b/android-qt5/libs/arm64-v8a/libVkLayer_khronos_validation.so differ
diff --git a/android-qt5/libs/armeabi-v7a/libVkLayer_khronos_validation.so b/android-qt5/libs/armeabi-v7a/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..e798d34
Binary files /dev/null and b/android-qt5/libs/armeabi-v7a/libVkLayer_khronos_validation.so differ
diff --git a/android-qt5/libs/x86/libVkLayer_khronos_validation.so b/android-qt5/libs/x86/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..a6542e9
Binary files /dev/null and b/android-qt5/libs/x86/libVkLayer_khronos_validation.so differ
diff --git a/android-qt5/libs/x86_64/libVkLayer_khronos_validation.so b/android-qt5/libs/x86_64/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..8a4d575
Binary files /dev/null and b/android-qt5/libs/x86_64/libVkLayer_khronos_validation.so differ
diff --git a/android/res/values/libs.xml b/android-qt5/res/values/libs.xml
similarity index 52%
rename from android/res/values/libs.xml
rename to android-qt5/res/values/libs.xml
index 4009a77..6b1a4a2 100644
--- a/android/res/values/libs.xml
+++ b/android-qt5/res/values/libs.xml
@@ -1,7 +1,7 @@
- - https://download.qt.io/ministro/android/qt5/qt-5.9
+ - https://download.qt.io/ministro/android/qt5/qt-5.14
-
-
-
-
-
-
+
+
-
-
+
+
+
diff --git a/android-qt5/res/xml/qtprovider_paths.xml b/android-qt5/res/xml/qtprovider_paths.xml
new file mode 100644
index 0000000..ae5b4b6
--- /dev/null
+++ b/android-qt5/res/xml/qtprovider_paths.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/android-qt5/src/VkTest/VulkanHelper.java b/android-qt5/src/VkTest/VulkanHelper.java
new file mode 100644
index 0000000..d5b06b6
--- /dev/null
+++ b/android-qt5/src/VkTest/VulkanHelper.java
@@ -0,0 +1,45 @@
+package VkTest;
+
+import android.view.Surface;
+import android.content.Context;
+import android.app.Activity;
+import android.view.SurfaceView;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.Window;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.view.ViewGroup;
+
+public class VulkanHelper {
+ public static Surface getSurfaceFromNativeWindow(Activity activity) {
+ Surface surface = null;
+
+ // Context context = activity.getApplicationContext();
+
+ SurfaceView surfaceView = new SurfaceView(activity);
+ Window window = activity.getWindow();
+ View decorView = window.getDecorView();
+
+ // View rootView = activity.findViewById(android.R.id.content).getRootView();
+
+ FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT
+ );
+ activity.setContentView(surfaceView, params);
+ surface = surfaceView.getHolder().getSurface();
+
+ // if (rootView instanceof SurfaceView) {
+ // System.out.println("It is a SurfaceView");
+ // SurfaceHolder holder = ((SurfaceView) rootView).getHolder();
+ // if (holder != null) {
+ // return holder.getSurface();
+ // }
+ // } else {
+ // System.out.println("It is not a SurfaceView");
+ // }
+
+ return surface;
+ }
+}
diff --git a/android-qt6/AndroidManifest.xml b/android-qt6/AndroidManifest.xml
new file mode 100644
index 0000000..18be0e8
--- /dev/null
+++ b/android-qt6/AndroidManifest.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android-qt6/build.gradle b/android-qt6/build.gradle
new file mode 100644
index 0000000..3fb1887
--- /dev/null
+++ b/android-qt6/build.gradle
@@ -0,0 +1,85 @@
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.6.0'
+ }
+}
+
+repositories {
+ google()
+ mavenCentral()
+}
+
+apply plugin: qtGradlePluginType
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+ //noinspection GradleDependency
+ implementation 'androidx.core:core:1.13.1'
+}
+
+android {
+ /*******************************************************
+ * The following variables:
+ * - androidBuildToolsVersion,
+ * - androidCompileSdkVersion
+ * - qtAndroidDir - holds the path to qt android files
+ * needed to build any Qt application
+ * on Android.
+ * - qtGradlePluginType - whether to build an app or a library
+ *
+ * are defined in gradle.properties file. This file is
+ * updated by QtCreator and androiddeployqt tools.
+ * Changing them manually might break the compilation!
+ *******************************************************/
+
+ namespace androidPackageName
+ compileSdkVersion androidCompileSdkVersion
+ buildToolsVersion androidBuildToolsVersion
+ ndkVersion androidNdkVersion
+
+ // Extract native libraries from the APK
+ packagingOptions.jniLibs.useLegacyPackaging true
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = [qtAndroidDir + '/src', 'src', 'java']
+ aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl']
+ res.srcDirs = [qtAndroidDir + '/res', 'res']
+ resources.srcDirs = ['resources']
+ renderscript.srcDirs = ['src']
+ assets.srcDirs = ['assets']
+ jniLibs.srcDirs = ['libs']
+ }
+ }
+
+ tasks.withType(JavaCompile) {
+ options.incremental = true
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+
+ // Do not compress Qt binary resources file
+ aaptOptions {
+ noCompress 'rcc'
+ }
+
+ defaultConfig {
+ resConfig "en"
+ minSdkVersion qtMinSdkVersion
+ targetSdkVersion qtTargetSdkVersion
+ ndk.abiFilters = qtTargetAbiList.split(",")
+ }
+}
diff --git a/android-qt6/gradle.properties b/android-qt6/gradle.properties
new file mode 100644
index 0000000..4fe1674
--- /dev/null
+++ b/android-qt6/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# Enable building projects in parallel
+org.gradle.parallel=true
+
+# Gradle caching allows reusing the build artifacts from a previous
+# build with the same inputs. However, over time, the cache size will
+# grow. Uncomment the following line to enable it.
+#org.gradle.caching=true
+#org.gradle.configuration-cache=true
+
+# Allow AndroidX usage
+android.useAndroidX=true
diff --git a/android-qt6/gradle/wrapper/gradle-wrapper.jar b/android-qt6/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..a4b76b9
Binary files /dev/null and b/android-qt6/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/android-qt6/gradle/wrapper/gradle-wrapper.properties b/android-qt6/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..9355b41
--- /dev/null
+++ b/android-qt6/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/android-qt6/gradlew b/android-qt6/gradlew
new file mode 100755
index 0000000..d95bf61
--- /dev/null
+++ b/android-qt6/gradlew
@@ -0,0 +1,252 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/android-qt6/gradlew.bat b/android-qt6/gradlew.bat
new file mode 100644
index 0000000..6a90cee
--- /dev/null
+++ b/android-qt6/gradlew.bat
@@ -0,0 +1,94 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/android-qt6/libs/arm64-v8a/libVkLayer_khronos_validation.so b/android-qt6/libs/arm64-v8a/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..68ca586
Binary files /dev/null and b/android-qt6/libs/arm64-v8a/libVkLayer_khronos_validation.so differ
diff --git a/android-qt6/libs/armeabi-v7a/libVkLayer_khronos_validation.so b/android-qt6/libs/armeabi-v7a/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..e798d34
Binary files /dev/null and b/android-qt6/libs/armeabi-v7a/libVkLayer_khronos_validation.so differ
diff --git a/android-qt6/libs/x86/libVkLayer_khronos_validation.so b/android-qt6/libs/x86/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..a6542e9
Binary files /dev/null and b/android-qt6/libs/x86/libVkLayer_khronos_validation.so differ
diff --git a/android-qt6/libs/x86_64/libVkLayer_khronos_validation.so b/android-qt6/libs/x86_64/libVkLayer_khronos_validation.so
new file mode 100644
index 0000000..8a4d575
Binary files /dev/null and b/android-qt6/libs/x86_64/libVkLayer_khronos_validation.so differ
diff --git a/android-qt6/res/values/libs.xml b/android-qt6/res/values/libs.xml
new file mode 100644
index 0000000..fe63866
--- /dev/null
+++ b/android-qt6/res/values/libs.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android-qt6/res/xml/qtprovider_paths.xml b/android-qt6/res/xml/qtprovider_paths.xml
new file mode 100644
index 0000000..ae5b4b6
--- /dev/null
+++ b/android-qt6/res/xml/qtprovider_paths.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/android-qt6/src/VkTest/VulkanHelper.java b/android-qt6/src/VkTest/VulkanHelper.java
new file mode 100644
index 0000000..d5b06b6
--- /dev/null
+++ b/android-qt6/src/VkTest/VulkanHelper.java
@@ -0,0 +1,45 @@
+package VkTest;
+
+import android.view.Surface;
+import android.content.Context;
+import android.app.Activity;
+import android.view.SurfaceView;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.Window;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.view.ViewGroup;
+
+public class VulkanHelper {
+ public static Surface getSurfaceFromNativeWindow(Activity activity) {
+ Surface surface = null;
+
+ // Context context = activity.getApplicationContext();
+
+ SurfaceView surfaceView = new SurfaceView(activity);
+ Window window = activity.getWindow();
+ View decorView = window.getDecorView();
+
+ // View rootView = activity.findViewById(android.R.id.content).getRootView();
+
+ FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT
+ );
+ activity.setContentView(surfaceView, params);
+ surface = surfaceView.getHolder().getSurface();
+
+ // if (rootView instanceof SurfaceView) {
+ // System.out.println("It is a SurfaceView");
+ // SurfaceHolder holder = ((SurfaceView) rootView).getHolder();
+ // if (holder != null) {
+ // return holder.getSurface();
+ // }
+ // } else {
+ // System.out.println("It is not a SurfaceView");
+ // }
+
+ return surface;
+ }
+}
diff --git a/main.cpp b/main.cpp
index 3ea6406..f8646ce 100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,13 +6,16 @@
//#include
#include
-#include
#include
-#include
+// #include
int main(int argc, char *argv[]) {
+ // qDebug() << "Waiting for debugger...";
+ // QAndroidJniObject::callStaticMethod("android/os/Debug", "waitForDebugger");
+ // qDebug() << "Debugger attached!";
+
QGuiApplication app(argc, argv);
// HelloTriangleApplication vulkanApp;