godot
godot copied to clipboard
Black screen on Android 10 Vulkan
Godot version
4.0-rc2
System information
Android 10 armeabi-v7a, Samsung SM-M105M, GPU Mali-T830 MP1, Vulkan
Issue description
I get a black screen for anything 3D in the scene in the given device.
This is how it's supposed to look (screenshot from another device)
This is how it looks in the device
Notice the 2D elements rendering fine, it's only the 3D stuff missing.
Using gl_compatibility
as a renderer works, it's just an issue with Vulkan.
I understand the GPU should support vulkan just fine.
Relevant logcat: render-test-logcat.txt
Steps to reproduce
Exporting and installing the reproduction project in a device with this characteristics is enough.
Minimal reproduction project
The project comes with what logcat had for a simple run.
This is very interesting. I am looking at the Vulkan capabilities of another similar device (also with a Mali - T830) and it appears it should have everything you need to run the Vulkan renderer (including 3D). https://vulkan.gpuinfo.org/displayreport.php?id=16133#device. So there must be a feature or extension that we are relying on without realizing it.
How comfortable are you with debugging? Would you be comfortable using a tool like Renderdoc or the Android GPU Inspector to take a deeper look?
CC @BastiaanOlij
Never done that before, but sure, let's take a look. I'll try with Android GPU Inspector. What should I look for?
Nevermind, I'll try renderdoc, AGI says it's incompatible with the device.
Never done that before, but sure, let's take a look. I'll try with Android GPU Inspector. What should I look for?
You'll want to use the tool to capture a frame (one of two options when you open the tool if i remember correctly). This will bring you to the frame profiler https://developer.android.com/agi/frame-trace/frame-profiler
In the frame profiler there is a commands pane which lists all the Vulkan commands that have been sent to the GPU. Basically I want to see if there are Vulkan commands issued for the cube and sky
A command will looks something like this: (taken from the AGI website)
This will help us narrow down whether the issue is with our use of Vulkan (the command doesn't get sent). Or if something is going wrong during rendering (the command is sent, but it results in nothing being drawn).
Well, I tried with Android GPU Inspector, the device isn't supported. Also tried with RenderDoc, looks like I've run into a bug. I can capture a frame, but can't open it to examine the commands. Works as expected with my other device, so I'm filing a bug report to RenderDoc itself 🙃
Any other tool I can use to get the commands?
Well, I tried with Android GPU Inspector, the device isn't supported. Also tried with RenderDoc, looks like I've run into a bug. I can capture a frame, but can't open it to examine the commands. Works as expected with my other device, so I'm filing a bug report to RenderDoc itself upside_down_face
Any other tool I can use to get the commands?
There is also ARM Graphics Analyzer, which may be better support as you have a Mali device but I have no experience with it https://developer.arm.com/Tools%20and%20Software/Graphics%20Analyzer
Meanwhile, the mantainer of RenderDoc dropped me something interesting about the failure to open the capture.
This capture contains invalid use of Vulkan. There is a renderpass being created with one color attachment where the VkAttachmentReference contains a value of attachment = 3806161832 which is not a valid value. This causes an invalid index and then a crash while loading which leads to the disconnect. I would recommend running your program with the validation layers (I'm not sure how/if that's possible on android but I assume so) to catch errors like this, as RenderDoc does not handle invalid API use.
I will update if I have any luck with Graphics Analyzer.
@josefalanga No need to investigate further. That information is enough to tell me where the issue is coming from. From Baldurk's response it sounds like something is broken either in creating the RenderPass attachment or perhaps even in creating the Framebuffer.
At any rate, it gives us a direction to look. I don't think Graphics Analyzer will help us narrow things down any further.
CC @BastiaanOlij
@clayjohn Interesting, to me my immediate thought goes to the work we did to add backwards compatibility support if RenderPass2 isn't available. Maybe there is something wrong in that code path when it sets up the alternative structure?
I'm not sure how best we can test that
I'm available to test/debug any build you send. It will kinda suck for you because the black box nature of that method, but I'm ready to help however I can.
Found another device that reproduces the issue. Samsung SM-A045M with GPU PowerVR GE8320 MP2, that also supposedly supports vulkan.
I think i already posted the same issue in this thread
https://github.com/godotengine/godot/issues/72443
This device also have same problem
Adreno 505 looks like has problems too. Another Samsung, this time the Galaxy A01 runs into the same issue. I'm editing the original post to include a list of GPUs to test this.
Same problems found on Adreno 660; T_T
I also have this issue on the Leia Lume Pad 2 (Adreno 660)
https://support.leiainc.com/lume-pad-2/device/technical-specs
Also having this issue on Samsung Galaxy Tab A7 Lite.
This one really threw me for a loop.
It's now working for me fine on the Godot 4.1 dev 2 build. Adreno 660.
Same issue here on Samsung Galaxy A03s (Samsung SM-A037F, PowerVR Rogue GE8320), Godot 4.0.2. Not working with Godot 4.1 dev 2 as well, just to confirm.
I found something interesting. The rendering works if you disable anti-aliasing. At least on the Adreno 660.
Maybe related? #77451
Hmm - if the finding above turns out to be the key, then mobile Godot should disable antialiasing by default.
This is also true on my Zenfone 8 (Adreno 660 as well), rendering works again after disabling MSAA. Activating FXAA or TAA doesn't break rendering, although I believe they might not be properly supported on mobile.
This is also true on my Zenfone 8 (Adreno 660 as well), rendering works again after disabling MSAA. Activating FXAA or TAA doesn't break rendering, although I believe they might not be properly supported on mobile.
If this only occurs with MSAA enabled, this is a separate issue: https://github.com/godotengine/godot/issues/67204
The original happens with MSAA disabled. I haven't tried any 4.1 builds, there should be a fix there?
The original happens with MSAA disabled. I haven't tried any 4.1 builds, there should be a fix there?
Its doubtful that this will be fixed in 4.1. On a related note, Bastiaan and I are still working on getting phones with these specs to test on which will allow us to debug further in case no one else steps up to do it.
I just tested 3 Android tablets, the Samsung Tab S8+ (Adreno 730), Samsung Tab A8 (Mali G52 MP2), and the Leia Lume Pad 2 (Adreno 660) and I was not able to reproduce the issue with the project in the OP. However, I have seen this bug before on two of the tablets (probably about a month ago), so perhaps something changed (OS update, etc.).
I'm up to help with the debugging. I can clone your forks, compile the engine, build locally and test/run renderdoc until we hit the nail. I lack the technical knowledge to actually code the solution, I don't have any rendering experience and looks like a very hard topic, I don't even know where to begin to look at to start a PR for this 😅
I know it's a bummer not having the devices yourselves, slows down the process a lot, but that's something I can help on.
@clayjohn Interesting, to me my immediate thought goes to the work we did to add backwards compatibility support if RenderPass2 isn't available. Maybe there is something wrong in that code path when it sets up the alternative structure?
I'm not sure how best we can test that
@BastiaanOlij are you talking about this section of rendering_device_vulkan.cpp
?
if ((p_view_count > 1) && !context->supports_renderpass2()) {
// This is only required when using vkCreateRenderPass, we add it if vkCreateRenderPass2KHR is not supported
// resulting this in being passed to our vkCreateRenderPass fallback.
// Set view masks for each subpass.
for (uint32_t i = 0; i < subpasses.size(); i++) {
view_masks.push_back(view_mask);
}
render_pass_multiview_create_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO;
render_pass_multiview_create_info.pNext = nullptr;
render_pass_multiview_create_info.subpassCount = subpasses.size();
render_pass_multiview_create_info.pViewMasks = view_masks.ptr();
render_pass_multiview_create_info.dependencyCount = 0;
render_pass_multiview_create_info.pViewOffsets = nullptr;
render_pass_multiview_create_info.correlationMaskCount = 1;
render_pass_multiview_create_info.pCorrelationMasks = &correlation_mask;
render_pass_create_info.pNext = &render_pass_multiview_create_info;
}
If so, I might try (and probably fail) to fix this issue :D
I can do some trial & error pretty fast with the device in hand, point me to any relevant section where I should try stuff.
This section contains the fallback for vkCreateRenderpass: https://github.com/godotengine/godot/blob/0c2144da908a8223e188d27ed1d31d8248056c78/drivers/vulkan/vulkan_context.cpp#L81-L168
Ok. picture me very confused and surprised, but this now works just fine in the original device I reported (GPU Mali-T830 MP1) with Vulkan. Without any changes to my project.
I tested new builds with 4.1, 4.0, and the old build I did with 4.0 that led to this report, and it.. just works?.
As said in the above comments, something with the device itself changed, but I also haven't updated it in any form or way. It was powered off in a drawer all this time.
I might run RenderDoc again later, to see if I can open the capture now, and will further comment this issue if I find anything worthy of mention. Also I'll try to get the other two devices I tested this to run again.
My issue looks like is now solved, but I'm now wondering WHY this happened in the first place, and how I can prevent it from happening again.