Code Monkey home page Code Monkey logo

android-vulkan-tutorials's Introduction

Tutorial Samples

A set of samples to illustrate Vulkan API on Android with Android Studio To build on windows for tutorial02/03, copy/install ndk-r12 ( or better ) to a directory close to root dir ( C: ) to workaround command path 260 character limit issue; see tutorial02/03's build.gradle for details. To Build samples:

  • Inside Andriod, menu File --> New --> Import Project
  • Find your sample's build.gradle and open it This will force andrioid studio to create local.properties file to config your SDK and NDK location; if you see error during importing, open local.properties file and correct the NDK and SDK location, then re-sync.

Other Resources: Additional Android Studio/NDK samples:

Contents

Pre-requisites

  • A device running Android 7.0 (API level 24) or higher
  • Android Studio 3.0 or higher
  • Android NDK
    • NDK
    • SDK with the latest cmake package

Test Matrix

Andrid Studio Version cmake in SDK NDK device
3.0.0 3.6.4111459 NDK-r16 Pixel XL

Known Issue:

Getting Started

  • From the Welcome screen, select "Import Project" (or, if you already have a project open, select File > New > Import Project)
  • Navigate to the sample you downloaded and click OK

License

Copyright 2016 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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

http://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.

android-vulkan-tutorials's People

Contributors

alfoywj avatar cirosantilli avatar ek9852 avatar ggfan avatar hak avatar sistr22 avatar sjfricke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-vulkan-tutorials's Issues

App fails with "FAILED BINDER TRANSACTION" when run in emulator

Moved to: http://stackoverflow.com/questions/42581120/how-to-create-and-run-an-example-vulkan-app-that-on-the-android-emulator

After #12 I have SDK 24 preview 4, NDK 12 and either a Nexus 6P or Nexus One image.

Tutorial 1 builds and installs, but when I try to run it it breaks immediately with:

06-26 23:39:03.583 F/libc    ( 3225): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x2 in tid 3239 (n.tutorials.one)
06-26 23:39:03.639 F/DEBUG   ( 3240): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-26 23:39:03.639 F/DEBUG   ( 3240): Build fingerprint: 'Android/sdk_google_phone_x86/generic_x86:N/NPD56O/2964822:userdebug/test-keys'
06-26 23:39:03.639 F/DEBUG   ( 3240): Revision: '0'
06-26 23:39:03.639 F/DEBUG   ( 3240): ABI: 'x86'
06-26 23:39:03.639 F/DEBUG   ( 3240): pid: 3225, tid: 3239, name: n.tutorials.one  >>> com.google.vulkan.tutorials.one <<<
06-26 23:39:03.639 F/DEBUG   ( 3240): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x2
06-26 23:39:03.639 F/DEBUG   ( 3240):     eax a11ef468  ebx a8a60e94  ecx a11ef2c0  edx a11ef39c
06-26 23:39:03.639 F/DEBUG   ( 3240):     esi a6d34384  edi a8a493d0
06-26 23:39:03.639 F/DEBUG   ( 3240):     xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
06-26 23:39:03.639 F/DEBUG   ( 3240):     eip 00000002  ebp a11ef258  esp a11ef22c  flags 00010292
06-26 23:39:03.639 F/DEBUG   ( 3240): 
06-26 23:39:03.639 F/DEBUG   ( 3240): backtrace:
06-26 23:39:03.639 F/DEBUG   ( 3240):     #00 pc 00000002  <unknown>
06-26 23:39:04.159 E/JavaBinder( 1483): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 104)
06-26 23:39:04.184 E/lowmemorykiller( 1225): Error writing /proc/3225/oom_score_adj; errno=22
06-26 23:39:04.193 E/InputDispatcher( 1483): channel '3c6d05b com.google.vulkan.tutorials.one/android.app.NativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

Programs build but fail to launch

I've just downloaded the Vulkan tutorial and build in AS 3.4

I get this error when trying to run in emulator:

04/20 11:39:09: Launching app
$ adb push /home/klejs/AndroidStudioProjects/android-vulkan-tutorials-master/tutorial05_triangle/app/build/outputs/apk/debug/app-debug.apk /data/local/tmp/com.google.vulkan.tutorials.five
$ adb shell pm install -t -r "/data/local/tmp/com.google.vulkan.tutorials.five"
Success
APK installed in 286 ms
$ adb shell am start -n "com.google.vulkan.tutorials.five/android.app.NativeActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 6446 on device emulator-5554
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/zygote: Unexpected CPU variant for X86 using defaults: x86
W/System: ClassLoader referenced unknown path:
V/threaded_app: Creating: 0xa47be980
V/threaded_app: Config: mcc=310 mnc=260 lang=en cnt=US orien=1 touch=3 dens=420 keys=2 nav=1 keysHid=1 navHid=0 sdk=26 size=2 long=1 modetype=1 modenight=1
V/threaded_app: Start: 0xa47be980
V/threaded_app: activityState=10
I/Vulkan Tutorials: event not handled: 10
V/threaded_app: Resume: 0xa47be980
V/threaded_app: activityState=11
I/Vulkan Tutorials: event not handled: 11
V/threaded_app: InputQueueCreated: 0xa47be980 -- 0xa47beac0
V/threaded_app: APP_CMD_INPUT_CHANGED
V/threaded_app: Attaching input queue to looper
I/Vulkan Tutorials: event not handled: 0
V/threaded_app: NativeWindowCreated: 0xa47be980 -- 0xa22d6008
V/threaded_app: APP_CMD_INIT_WINDOW
V/threaded_app: WindowFocusChanged: 0xa47be980 -- 1
D/vulkan: searching for layers in '/data/app/com.google.vulkan.tutorials.five-q8wlURwyAqruqeZxkPEOQg==/lib/x86'
D/vulkan: searching for layers in '/data/app/com.google.vulkan.tutorials.five-q8wlURwyAqruqeZxkPEOQg==/base.apk!/lib/x86'
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 6461 (.tutorials.five)
Application terminated.

tutorial06 shaderc ndk build error

I was building shaderc with ndk r23 with command line given in tutorial 06 readme, it gives error when doing combine:

"[arm64-v8a] Combine: libshaderc_combined.a <= libglslang.a libOGLCompiler.a libOSDependent.a libshaderc.a libshaderc_util.a libSPIRV.a libHLSL.a libSPIRV-Tools.a libSPIRV-Tools-opt.a"
'D:/ProgramFiles/android-ndk-r23b/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android-ar' is not recognized as an internal or external command,
operable program or batch file.
make: *** [D:/ProgramFiles/android-ndk-r23b/sources/third_party/shaderc/Android.mk:77: obj/local/arm64-v8a/libshaderc_combined.a] Error 1

I have checked there is no file named "aarch64-linux-android-ar" with any extension but only "aarch64-linux-android-as.exe" presents, is there any version mismatch problem I'm possibly encountering? Thanks in advance.

gradlew commands fail with: "failed to find target with hash string 'android-N'"

I have already installed SDK 23 and 24 through Studio, created a working API 24 emulator, and have NDK 12.

Whenever I run a gradlew command, e.g.:

cd tutorial01_load_vulkan
./gradlew clean

it fails with:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Exception thrown while executing model rule: NdkComponentModelPlugin.Rules#createNativeLibrary > create(vktuts) > components.vktuts.getBinaries() > withType()
   > Exception thrown while executing model rule: BaseComponentModelPlugin.Rules#createAndroidComponents
      > failed to find target with hash string 'android-N' in: /home/ciro/android-sdk

Same error message on SO: http://stackoverflow.com/questions/35937530/android-studio-2-1-preview-failing-to-find-target-with-hash-string-android-n

App crashes when switching on and off the screen

Tutorial04 First Window, built on Android 10 and run in Pixel 3a.
Gradle version 3.5.1

Reproduce step:

  1. Run on debug mode
  2. See the empty blue screen to confirm running.
  3. Start turning on and off the screen by pressing the power button frequently.
  4. Observe the crash via Logcat

The error logs I have:

2019-10-21 09:35:02.466 623-659/? E/BufferQueueProducer: [com.google.vulkan.tutorials.four/android.app.NativeActivity#0] connect: already connected (cur=1 req=1)
2019-10-21 09:35:02.466 17972-18010/com.google.vulkan.tutorials.four E/vulkan: native_window_api_connect() failed: Invalid argument (-22)
2019-10-21 09:35:02.466 17972-18010/com.google.vulkan.tutorials.four E/Tutorial: Vulkan error. File[D:\src\android-vulkan-tutorials\tutorial04_first_window\app\src\main\jni\VulkanMain.cpp], line[122]
2019-10-21 09:35:02.466 17972-18010/com.google.vulkan.tutorials.four A/libc: D:\src\android-vulkan-tutorials\tutorial04_first_window\app\src\main\jni\VulkanMain.cpp:122: void CreateVulkanDevice(ANativeWindow *, VkApplicationInfo *): assertion "false" failed
2019-10-21 09:35:02.466 17972-18010/com.google.vulkan.tutorials.four A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 18010 (.tutorials.four), pid 17972 (.tutorials.four)
2019-10-21 09:35:02.526 18094-18094/? A/DEBUG: pid: 17972, tid: 18010, name: .tutorials.four  >>> com.google.vulkan.tutorials.four <<<
2019-10-21 09:35:02.527 18094-18094/? A/DEBUG:       #02 pc 0000000000016aa0  /data/app/com.google.vulkan.tutorials.four-pVeIq2_gA8kagBYut9cR7w==/lib/arm64/libvktuts.so (CreateVulkanDevice(ANativeWindow*, VkApplicationInfo*)+580) (BuildId: 274dff12cbe8832a3422a72fceede0307a5aab49)
2019-10-21 09:35:02.527 18094-18094/? A/DEBUG:       #03 pc 00000000000180ac  /data/app/com.google.vulkan.tutorials.four-pVeIq2_gA8kagBYut9cR7w==/lib/arm64/libvktuts.so (InitVulkan(android_app*)+180) (BuildId: 274dff12cbe8832a3422a72fceede0307a5aab49)
2019-10-21 09:35:02.527 18094-18094/? A/DEBUG:       #04 pc 000000000001f528  /data/app/com.google.vulkan.tutorials.four-pVeIq2_gA8kagBYut9cR7w==/lib/arm64/libvktuts.so (handle_cmd(android_app*, int)+140) (BuildId: 274dff12cbe8832a3422a72fceede0307a5aab49)
2019-10-21 09:35:02.527 18094-18094/? A/DEBUG:       #05 pc 0000000000022ac8  /data/app/com.google.vulkan.tutorials.four-pVeIq2_gA8kagBYut9cR7w==/lib/arm64/libvktuts.so (BuildId: 274dff12cbe8832a3422a72fceede0307a5aab49)
2019-10-21 09:35:02.527 18094-18094/? A/DEBUG:       #06 pc 000000000001f5e0  /data/app/com.google.vulkan.tutorials.four-pVeIq2_gA8kagBYut9cR7w==/lib/arm64/libvktuts.so (android_main+112) (BuildId: 274dff12cbe8832a3422a72fceede0307a5aab49)
2019-10-21 09:35:02.527 18094-18094/? A/DEBUG:       #07 pc 0000000000022a4c  /data/app/com.google.vulkan.tutorials.four-pVeIq2_gA8kagBYut9cR7w==/lib/arm64/libvktuts.so (BuildId: 274dff12cbe8832a3422a72fceede0307a5aab49

Thanks!
app-debug.zip

How to use dlopen() on Android 8?

In my test ndk app, dlopen() reutrn nullptr.

Java_com_github_rpg3d_sword2android_MainActivity_runGame(JNIEnv* env, jobject /* this */)
{

    void* handle = dlopen("libvulkan.so", RTLD_NOW|RTLD_LOCAL);
    char* loaderror = (char *) dlerror();
    Game game;
    game.run();

}

Validation layers give some messages

I ran tutorial05 while turned on the following layers:

07-10 11:07:46.493 5944 5959 I Vulkan-Tutorial05: 5 layers exists
07-10 11:07:46.494 5944 5959 I Vulkan-Tutorial05: VK_LAYER_LUNARG_parameter_validation
07-10 11:07:46.494 5944 5959 I Vulkan-Tutorial05: VK_LAYER_GOOGLE_unique_objects
07-10 11:07:46.494 5944 5959 I Vulkan-Tutorial05: VK_LAYER_LUNARG_core_validation
07-10 11:07:46.494 5944 5959 I Vulkan-Tutorial05: VK_LAYER_GOOGLE_threading
07-10 11:07:46.494 5944 5959 I Vulkan-Tutorial05: VK_LAYER_LUNARG_object_tracker

They gave the following messages:

07-10 11:57:05.732 10192 10208 E Vulkan-Tutorial05: validation layer (DS): vkCreateSwapChainKHR() called with a non-supported pCreateInfo->compositeAlpha (i.e. Unhandled VkCompositeAlphaFlagBitsKHR). Supported values are:
07-10 11:57:05.732 10192 10208 E Vulkan-Tutorial05: VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
07-10 11:57:05.732 10192 10208 E Vulkan-Tutorial05: . The spec valid usage text states 'compositeAlpha must be one of the bits present in the supportedCompositeAlpha member of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-compositeAlpha-01280)
07-10 11:57:05.738 10192 10208 I Vulkan-Tutorial05: <-createSwapChain
07-10 11:57:05.745 10192 10208 E Vulkan-Tutorial05: validation layer (DS): For image 0x731a276b00 you cannot transition the layout of aspect 1 from VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when current layout is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
07-10 11:57:05.745 10192 10208 E Vulkan-Tutorial05: validation layer (DS): For image 0x731a276e00 you cannot transition the layout of aspect 1 from VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when current layout is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
07-10 11:57:05.746 10192 10208 E Vulkan-Tutorial05: validation layer (DS): Cannot submit cmd buffer using image (0x731a276b00) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
07-10 11:57:05.746 10192 10208 I Vulkan-Tutorial05: Drawing frames......
07-10 11:57:05.747 10192 10208 E Vulkan-Tutorial05: validation layer (DS): Cannot submit cmd buffer using image (0x731a276e00) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
07-10 11:57:05.747 10192 10208 I Vulkan-Tutorial05: Drawing frames......
07-10 11:57:05.773 10192 10208 I Vulkan-Tutorial05: Drawing frames......

I just put the code how I turned on the validation layer:
https://github.com/jaebaek/android-vulkan-tutorials/tree/validation

VulkanLayerValidationTestsa.apk crashing in vkCreateGraphicsPipelines

Build fingerprint: 'samsung/heroltexx/herolte:7.0/NRD90M/G930FXXU1DQE7:user/release-keys'
07-06 14:13:27.906 29474 29474 F DEBUG : Revision: '8'
07-06 14:13:27.906 29474 29474 F DEBUG : ABI: 'arm64'
07-06 14:13:27.906 29474 29474 F DEBUG : pid: 28517, tid: 28530, name: Thread-5 >>> com.example.VulkanLayerValidationTests <<<
07-06 14:13:27.906 29474 29474 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x14
07-06 14:13:27.906 29474 29474 F DEBUG : x0 00000071addcee88 x1 0000000000000003 x2 0000000000000000 x3 0000000000000001
07-06 14:13:27.906 29474 29474 F DEBUG : x4 00000071addceedc x5 000000719b388e00 x6 000000719b388000 x7 0000000000000000
07-06 14:13:27.906 29474 29474 F DEBUG : x8 00000071a38b9700 x9 0000000000000001 x10 000000719b388000 x11 00000071a38b9700
07-06 14:13:27.906 29474 29474 F DEBUG : x12 00000071a38b9700 x13 0000000000000000 x14 0000000000000000 x15 00000071addcee88
07-06 14:13:27.906 29474 29474 F DEBUG : x16 00000071a38b9700 x17 00000071a38b9700 x18 0000000000000000 x19 00000071a36ab508
07-06 14:13:27.906 29474 29474 F DEBUG : x20 000000718c2791d0 x21 0000000000000000 x22 0000000000000000 x23 0000000000000000
07-06 14:13:27.906 29474 29474 F DEBUG : x24 00000071a38b9700 x25 00000071addcee88 x26 00000071addceeb0 x27 00000071a38b9700
07-06 14:13:27.906 29474 29474 F DEBUG : x28 0000000000000000 x29 00000071addcf7d0 x30 000000719a1fb5e0
07-06 14:13:27.906 29474 29474 F DEBUG : sp 00000071addceda0 pc 000000719a1fb5e8 pstate 0000000080000000
07-06 14:13:27.921 29474 29474 F DEBUG :
07-06 14:13:27.921 29474 29474 F DEBUG : backtrace:
07-06 14:13:27.921 29474 29474 F DEBUG : #00 pc 00000000004715e8 /system/vendor/lib64/egl/libGLES_mali.so
07-06 14:13:27.921 29474 29474 F DEBUG : #1 pc 0000000000471ffc /system/vendor/lib64/egl/libGLES_mali.so (vkCreateGraphicsPipelines+496)

Validation Layer source code changes in NDK, tutorial3 needs to be updated

Some layers are deprecated ( like VKLayer_image ), the source code is not there anymore in the latest NDK, tutorial 3 will not build. Things to be done:

  • Find out from which NDK version the source is removed and update the layerlib build script
  • Update the layer and extension enabling code as current Vulkan already deprecated the device layers ( install for instance only, automatically apply to devices )

Cannot build using NDK 21.4

Using tutorial03_traceable_layers requires the following file to exist inside $NDK/sources/third_party/ but that file (and possibly more files) no longer exist in NDK 21.4: vk_layer_table.cpp

Replace `ALooper_pollAll` with `ALooper_pollOnce`

ALooper_pollAll has been (soft) removed from the NDK because the implementation has a race so it can't be used safely. ALooper_pollOnce should be used instead. I'll be updating the main ndk-samples repo soon with examples of how to do that.

CMake Error

CMake can not determine linker language for target: vktuts
Studio 2.3.1
NDK 14.1.3816874
Cmake 3.6.3155560

Segmentation fault when Tutorial 05 is closed

Hi!!

I found that when the app of the tutorial 5 is closed, I get a segmentation fault.

I think that this line is causing it. Because it is cleaning the memory allocate by the vkImages that will also be cleaned when destroying the swapchain.

If you take a look at the Vulkan toturial, you will see this:
Screen Shot 2021-10-25 at 15 02 20

"The images were created by the implementation for the swap chain and they will be automatically cleaned up once the swap chain has been destroyed, therefore we don't need to add any cleanup code."

Lint error when building triangle example

org.gradle.api.GradleException: Lint found fatal errors while assembling a release target.

To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
...
	at com.android.tools.lint.gradle.LintGradleExecution.abort(LintGradleExecution.java:206)
	at com.android.tools.lint.gradle.LintGradleExecution.runLint(LintGradleExecution.java:307)
	at com.android.tools.lint.gradle.LintGradleExecution.lintSingleVariant(LintGradleExecution.java:385)
	at com.android.tools.lint.gradle.LintGradleExecution.analyze(LintGradleExecution.java:91)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.android.tools.lint.gradle.api.ReflectiveLintRunner.runLint(ReflectiveLintRunner.kt:38)
	at com.android.build.gradle.tasks.LintBaseTask.runLint(LintBaseTask.java:100)
	at com.android.build.gradle.tasks.LintPerVariantTask.lint(LintPerVariantTask.java:60)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:702)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:669)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
	at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
	at java.util.Optional.orElseGet(Optional.java:267)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
	at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
	at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
	at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
	at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
	at java.util.Optional.map(Optional.java:215)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)

get gpuCount is 0

If I get gpuCount = 0, this could be seen that My Android device is not support vulkan, right?

My Android device is Nexus 6(Android 7.0, API 24)

NativeActivity does not exist

I am trying to run this tutorial app on my Android 11. Installs successfully, I can start it from the home screen, but not from the IDE

05/18 13:05:51: Launching 'app' on samsung SM-A405FM.
Install successfully finished in 8 s 358 ms.
$ adb shell am start -n "com.google.vulkan.tutorial.two/android.app.NativeActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.google.vulkan.tutorial.two/android.app.NativeActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.google.vulkan.tutorial.two/android.app.NativeActivity }
Error type 3
Error: Activity class {com.google.vulkan.tutorial.two/android.app.NativeActivity} does not exist.

Error while Launching activity

vertex shader can't get all input data

I have my Vertex data defined like this:
struct Vertex{
glm::vec4 pos;
glm::vec2 texcoord;
glm::vec2 texcoordex;
float alpha;
float idx;
};

my problem is: vertex buffer has read all data, but vertex shader only gets the first one pos as input, others are 0.0f

vertex shader input
layout (location = 0) in vec4 pos;
layout (location = 1) in vec2 attr;
layout (location = 2) in vec2 attrex;
layout (location = 3) in float alph;
layout (location = 4) in float id;

some code snippets

VkVertexInputBindingDescription vertex_input_bindings{
.binding = 0,
.stride = sizeof(Vertex),
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX,
};
VkVertexInputAttributeDescription vertex_input_attributes[5]{
{
.binding = 0,
.location = 0,
.format = VK_FORMAT_R32G32B32A32_SFLOAT,
.offset = offsetof(Vertex, pos),
},
{
.binding = 0,
.location = 1,
.format = VK_FORMAT_R32G32_SFLOAT,
.offset = offsetof(Vertex, texcoord),
},
{
.binding = 0,
.location = 2,
.format = VK_FORMAT_R32G32_SFLOAT,
.offset = offsetof(Vertex, texcoordex),
},
{
.binding = 0,
.location = 3,
.format = VK_FORMAT_R32_SFLOAT,
.offset = offsetof(Vertex, alpha),
},
{
.binding = 0,
.location = 4,
.format = VK_FORMAT_R32_SFLOAT,
.offset = offsetof(Vertex, idx),
}};

VkPipelineVertexInputStateCreateInfo vertexInputInfo{
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
.pNext = nullptr,
.vertexBindingDescriptionCount = 1,
.pVertexBindingDescriptions = &vertex_input_bindings,
.vertexAttributeDescriptionCount = 5,
.pVertexAttributeDescriptions = vertex_input_attributes,
};

VkDeviceSize offset = 0;
vkCmdBindVertexBuffers(render.cmdBuffer_[bufferIndex], 0, 1, &buffers.vertexBuf_, &offset);

How can I solve the problem? Thanks for any help.

tutorial05_triangle ./gradlew assembleDebug build fails with "unknown type name 'android_app'"

/data/git/android-vulkan-tutorials/tutorial05_triangle/app/src/main/jni/VulkanMain.hpp:19:17: error: unknown type name 'android_app'
bool InitVulkan(android_app* app);
                ^
1 error generated.
ninja: build stopped: subcommand failed.
:app:externalNativeBuildDebug FAILED

Android Studio 2.3.3, SDK 26, NDK 15.2.

I can successfully build and run NDK GLES examples.

Up to tutorial 4 build, but fail to run on HiKey960 with SIGSEGV for me as in: SaschaWillems/Vulkan#389

can't find mathfu on gradle

Hi,
I'm try to run tutorial04_first_window but when I expand "Gradle" panel inside Android Studio( right hand edge of IDE) I can see only "tutorial04_first_window" and ":app". How can I solve this?

Security Policy violation Binary Artifacts

This issue was automatically created by Allstar.

Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code

Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

Remediation Steps
To remediate, remove the generated executable artifacts from the repository.

Artifacts Found

  • tutorial06_texture/bootstrap/wrapper/bootstrap.jar

Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

tutorial06_texture build error

gradle builds four different abi libs: armeabi-v7a, arm64-v8a, x86, x86-64, but only armeabi-v7a type libshaderc.a is downloaded. Then there's the link error:

Error:error: 'C:/Users/linuxaged/.cdep/exploded/com.github.ggfan/shaderc/0.0.1/shaderc-arm64-v8a-cxx_static.zip/lib/arm64-v8a/libshaderc.a', needed by 'D:/workspace/android-vulkan-tutorials/tutorial06_texture/app/build/intermediates/cmake/debug/obj/arm64-v8a/libvktuts.so', missing and no known rule to make it

How to tell the cdep to download all libs we need? Change the cdep.sha256 to something like this?

exportSyncFdForQSRILocked: Failed to dup() QSRI sync fd : sterror: Bad file descriptor errno: 9

When I run on android emulator(not real device), It will show these error every frame.

exportSyncFdForQSRILocked: Failed to dup() QSRI sync fd : sterror: Bad file descriptor errno: 9
2023-08-23 08:52:39.821 13389-13416 Vulkan Tutorials        com...example.vulkan.tutorials.five  I  event not handled: 3
2023-08-23 08:52:39.822 13389-13416 Vulkan-Tutorial05       com...example.vulkan.tutorials.five  I  Drawing frames......
2023-08-23 08:52:39.822 13389-13416 goldfish_vulkan         com...example.vulkan.tutorials.five  E  exportSyncFdForQSRILocked: Failed to dup() QSRI sync fd : sterror: Bad file descriptor errno: 9
2023-08-23 08:52:39.823 13389-13416 Vulkan Tutorials        com...example.vulkan.tutorials.five  I  event not handled: 4
2023-08-23 08:52:39.844 13389-13416 Vulkan-Tutorial05       com...example.vulkan.tutorials.five  I  Drawing frames......
2023-08-23 08:52:39.844 13389-13416 goldfish_vulkan         com...example.vulkan.tutorials.five  E  exportSyncFdForQSRILocked: Failed to dup() QSRI sync fd : sterror: Bad file descriptor errno: 9

Texture2D & Sampler instead of Sampler2D crashing while creating Pipeline

I had the HLSL source with Texture2D and Sampler separately (not using Sampler2D basically)... SPIRV generated through that works fine on Windows but it fails on Android while creatingGraphicsPipeline. Is it a known issue ?
If not, can u please share a tutorial/sample where instead of using Sampler2D you have used Texture2D and Sampler separately. I see this crashing on Samsung S7 as well as Pixel XL

`tutorial06_texture` missing `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT` when allocate `vkAllocateMemory`

The validation layer report the error :

05-25 16:48:42.953 31225 31225 I VALIDATION: VUID-vkBindImageMemory-memory-01047(ERROR / SPEC): msgNum: -1558817633 - Validation Error: [ VUID-vkBindImageMemory-memory-01047 ] Object 0: handle = 0x59ffe0000000003d, type = VK_OBJECT_TYPE_DEVICE_MEMORY; | MessageID = 0xa316549f | vkBindImageMemory()(): MemoryRequirements->memoryTypeBits (0x5) for this object type are not compatible with the memory type (0x1) of VkDeviceMemory 0x59ffe0000000003d[]. The Vulkan spec states: memory must have been allocated using one of the memory types allowed in the memoryTypeBits member of the VkMemoryRequirements structure returned from a call to vkGetImageMemoryRequirements with image (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkBindImageMemory-memory-01047)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.