Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan mobile: MSAA 3D causes 3D viewport to render black on phone #67204

Open
PrecisionRender opened this issue Oct 10, 2022 · 13 comments
Open

Comments

@PrecisionRender
Copy link
Contributor

PrecisionRender commented Oct 10, 2022

Godot version

v4.0.beta2.official [f8745f2]

System information

Samsung Galaxy S10, Android 12, Qualcomm Snapdragon 855, Adreno 640, Vulkan mobile

Issue description

When running a game on my phone with the Vulkan mobile renderer, MSAA 3D causes the 3D scene to render black. This does not seem to affect CanvasLayers or MSAA 2D, since text is still rendered on screen. This does not happen with FXAA.

MSAA 3D off:
image

MSAA 3D 2x:
image

Steps to reproduce

Simply enable MSAA 3D in a mobile game and run it on a phone.

Minimal reproduction project

MobileTest.zip

@PrecisionRender PrecisionRender changed the title MSAA 3D causes 3D viewport to render black on phone (Vulkan mobile renderer) Vulkan mobile: MSAA 3D causes 3D viewport to render black on phone Oct 10, 2022
@Calinou Calinou added this to the 4.0 milestone Oct 10, 2022
@clayjohn
Copy link
Member

Have you tested with 4x MSAA? It may be that your phone doesn't support 2x. In which case we should be showing an error, but it would still be helpful to know if the issue is MSAA in general, or just 2X

@clayjohn clayjohn modified the milestones: 4.0, 4.x Jan 12, 2023
@PrecisionRender
Copy link
Contributor Author

@clayjohn I tested with 4x MSAA on the same phone and this is the result:

Screenshot_20230113-121136_MobileTest

@maxiaoxr
Copy link

@Calinou In addition, I would like to ask if there is any plan to fix the MSAA problem in Vulkan in the near future. At present, neither OpenGL nor Vulkan supports the opening of MSAA in XR mode. As a result, it is currently not possible to develop games smoothly under XR with godot.

@Calinou
Copy link
Member

Calinou commented Jul 25, 2023

@Calinou In addition, I would like to ask if there is any plan to fix the MSAA problem in Vulkan in the near future. At present, neither OpenGL nor Vulkan supports the opening of MSAA in XR mode. As a result, it is currently not possible to develop games smoothly under XR with godot.

We don't know why this issue is occurring, so it will take a while to be fixed.

@PrecisionRender
Copy link
Contributor Author

We don't know why this issue is occurring, so it will take a while to be fixed.

Is there anything I can do to help with that?

@Calinou
Copy link
Member

Calinou commented Jul 25, 2023

Is there anything I can do to help with that?

You could try to use Vulkan validation layers on Android, but it's not guaranteed to give meaningful results if this is the result of a driver bug.

@chrisnolet
Copy link

chrisnolet commented Sep 19, 2023

We've been hitting this, (or something like it), in VR on Meta Quest.

tl;dr: The workaround is to put a head-locked PointMesh a few meters in front of the XRCamera3D, and add a transparent material to it. Set the material's albedo to fully transparent black.

TransparentMeshPoint

Paraphrasing from @BastiaanOlij: The MSAA buffer is only resolving when the transparent subpass is included. If there aren't any transparent objects on the screen, the queue goes straight from sky rendering to tonemapping, without a resolve.

@Calinou
Copy link
Member

Calinou commented Sep 19, 2023

Paraphrasing from @BastiaanOlij: The MSAA buffer is only resolving when the transparent subpass is included. If there aren't any transparent objects on the screen, the queue goes straight from sky rendering to tonemapping, without a resolve.

There's a dedicated issue tracking this now: #81910

@BastiaanOlij
Copy link
Contributor

Just a little context to @chrisnolet remark, it's not Godot skipping the transparent subpass and thus triggering the resolve, Godot is doing this. Its seemingly the Vulkan driver that decides to do this.

This is why on PC, it's working fine but on mobile (and possibly only some mobile GPUs), it's failing.

@BastiaanOlij
Copy link
Contributor

Ok, things work fine on a Pixel 6 aswell, this may be an issue on Adreno...

@darksylinc
Copy link
Contributor

darksylinc commented Oct 4, 2023

I noticed I forgot to comment here:

  1. We do know why this problem happens now. I reported this in Lots of Synchronization Validation Errors (specially with MSAA enabled) #81060 and actually affects Desktop as well. You can see that AMD Polaris11 doesn't work well with MSAA enabled either.
  2. Mobile is much more affected by Lots of Synchronization Validation Errors (specially with MSAA enabled) #81060 because of how MSAA works on TBDR GPUs.
  3. This bug won't be fixed until we implement Acyclic Graphs which will overhaul how barriers and transitions are implemented.

@BastiaanOlij
Copy link
Contributor

@darksylinc note that I found a fixed a few errors in MSAA itself here: #83649
They probably do nothing to help with the synchronization errors, but MSAA was definitely broken on Vulkan Mobile due to Godot using the wrong buffers.

It's worth retesting to see if those fixes resolve some of the issues reported here as well.

@BastiaanOlij
Copy link
Contributor

Also the issue @chrisnolet mentioned about is fixed through #84169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants