bkaradzic/bgfx

Vulkan on Android: the frame isn't updating (ONLY THE FIRST FRAME IS RENDERED)

MohammedKHC opened this issue · 18 comments

Describe the bug
It seems like that only the first frame is rendered, but the game loop don't stop, please note that when using Opengl es every thing is working fine.
Please note that vulkan on Linux works fine the problem is on Android

To Reproduce
using https://github.com/Nodrev/bgfx-android-activity for android running
modify samples to use Vulkan backend;
choose the cube sample
you should notice that the cubes doesn't move

Expected behavior
Just work like opengl es.

MORE Context*
My device uses adreno and snap dragon and it's arm64
and i think maybe it has something with #2975

using https://github.com/Nodrev/bgfx-android-activity for android running

I'm not going to investigate other repos. Repro has to be inside bgfx repo.

Sorry but I really don't understand how to do that, bgfx repo don't have java files for Android, so I can't made something based 100% on bgfx repo, but you don't need to change the native cpp code,
https://github.com/Nodrev/bgfx-android-activity
Is just building bgfx and then link it with MainActivity please take a look at https://github.com/Nodrev/bgfx-android-activity

@MohammedKHC I'll take a look on my android device. I am curious myself about the platform support. Is there any newer version of this kind of project? It's unfortunate but this particular repo is 8 years old and only a single pull request to fix support for arm64. Since then Android has moved on. I checked the forks and nothing else.

I found this: https://github.com/LightSun/bgfx-android

about four years old.

Will update. Noting to debug, it's worth putting some logs from your application that reflect the state of the bgfx layer or checkpoints in your own render loop. I agree, one would expect spinning cubes to spin.

Also, you are saying GLES works fine on Android?

Hi @truedat101, First sorry for the late response. I wasn't aware of the message..
At the moment I can't send logs, but there wasn't anything special, maybe just try to compile bgfx for Android and use vulkan and tell me if it works?
And yeah GLES works great.

Checking in on this, seems like there is an issue with Vulkan specifically not rendering properly. Using OpenGL ES on Android everything works fine, but the moment that I switch to Vulkan is just stops rendering after the first frame.

@truedat101 have you had time to look into this? You should be able to just load up the examples provided and see it pretty quickly.

Checking in on this, seems like there is an issue with Vulkan specifically not rendering properly. Using OpenGL ES on Android everything works fine, but the moment that I switch to Vulkan is just stops rendering after the first frame.

@truedat101 have you had time to look into this? You should be able to just load up the examples provided and see it pretty quickly.

I lost track of this thread. Let me see, I have a decent device to test test with. WIll kick the tires on this.

Checking in on this, seems like there is an issue with Vulkan specifically not rendering properly. Using OpenGL ES on Android everything works fine, but the moment that I switch to Vulkan is just stops rendering after the first frame.

@truedat101 have you had time to look into this? You should be able to just load up the examples provided and see it pretty quickly.

Is there some different semi-modern supported repository for Android/BGFX activity/example applications? In the repo for bgfx we only have the library builds, but the notion of running the executable doesn't make sense unless this has been converted into a native activity somehow. I tried the other repo I referenced is ancient by 4 years, and doesn't build (not a bgfx issue, purely the always moving target of android/gradle). I'm willing to dig into this further but I'd like to start from a solid reference point. I did my build of the android versions of the bgfx library.

Is there some different semi-modern supported repository for Android/BGFX activity/example applications?

I've been working on my own private repo for this on a VR game engine on Quest I'm building, but let me get a public repo sample you can use for this to make things easier.

@GEMISIS what VK driver version is available in your target environment on Quest?

Not sure, is there an easy way to check? Doesn't seem to be on the debug screen so far as I can tell.

f6531e9c114645bd839a5c2b5b6c229a

(I'm not super familiar with the internals of Vulkan, more OpenGL, so still ramping up on this)

There's an api call you can make to get at the details of the VK driver version. Let me figure out how I would do that on android/quest

The answer isn't obvious. I looked through the MetaSDK stuff for OpenXR (I assume you are using that?) but I only see a reference to khronos/GL. However, we can assume it's possible to get at the regular android APIs and pull this information: https://developer.android.com/ndk/guides/graphics/getting-started

(a bunch of points there if you scroll down to the vulkan api things). I assume one can get the api version, and then dig into whether there are issues in terms of bugs filed in the driver version. I don't know how Quest is handling it's API updates since this is a driver thing in the OS.

I'll get my rig up to date and try to build against the quest xr samples to see if I can figure out the vulkan integration available. But in the meantime @GEMISIS if you have a good bgfx wrapper project you can share for Android, I'd like to start with that and test on some different devices.

unknown_003

@GEMISIS it looks like from your screenshot it's VK driver 1.128.8775 (it's a bit blurry, it actually doesn't make sense ... so I am not sure if that's really the vulkan driver or not). If you can publish some source for your sample I can try it on my Quest and figure out the details and get it to dump some different information).

I think that's the version of BGFX that was built actually, as I noticed that was there in both the OpenGL ES and Vulkan versions.

Working on the Android version, but did not have as much time this past weekend as I thought I would. :/

That's bgfx version... Driver version is in log...