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

The road in the first level of Megamind: The Blue Defender (USA) has broken textures when using Vulkan #13846

Open
ghost opened this issue Dec 31, 2020 · 14 comments
Labels
D3D9 Direct3D 9 D3D11 Direct3D 11 Depth / Z Issue involves depth drawing parameters. GE emulation Backend-independent GPU issues Vulkan
Milestone

Comments

@ghost
Copy link

ghost commented Dec 31, 2020

This is at native resolution. It doesn't happen with OpenGL.

Capture

There's also this upscaling issue that happens with Both Vulkan and OpenGL. Sorry if this is another unfixable problem.

Capture2

@unknownbrackets
Copy link
Collaborator

Could you try exporting a GE frame dump of the first issue? These help a lot. Just make sure to export it when you see the issue - it's almost like a screenshot. If you make it while the issue isn't happening, it won't help.

See here for instructions - it's not hard and works on Android too:
https://github.com/hrydgard/ppsspp/wiki/How-to-create-a-frame-dump

You can zip that and then drag and drop it into a reply here.

The lines in the second are probably the same issue as before unfortunately. You can try enabling hardware texture upscaling and select auto, and see if that helps. See here for an explanation of what's happening:
https://forums.ppsspp.org/showthread.php?tid=13556

-[Unknown]

@ghost
Copy link
Author

ghost commented Dec 31, 2020

Thanks for the explanation. Hope I did it right.

recording.zip

@hrydgard hrydgard added this to the v1.12.0 milestone Jan 1, 2021
@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Jan 1, 2021
@Panderner
Copy link
Contributor

Thanks for the explanation. Hope I did it right.

recording.zip

When I checked this GE dump I can't see the graphical glitches either

@unknownbrackets
Copy link
Collaborator

Interestingly, this is like 3 separate frames being drawn. I wonder if there's a glitch or something causing this to render too much.

The first two renders are good. It's the third one that is problematic.

At 9813/15136 (second render), we look like this:
image

Then it does some color conversation stuff, adds the HUD, etc. New frame starts at 10109/15136. Notably, they are slightly offset from each other (almost like VR... maybe for some sort of motion blur or something?)

The actual draw with the patchy lines is 10990/15136, which is similar to draw 1141/15136 except 1141 looks fine.

All the draw state (blending, depth, etc.) between the draws looks the same. It does however use a >= depth test in both cases, and the depth values are not all that different.

Vertex depth rounding looks even worse. Pixel depth rounding looks good. This seems like a depth issue. Might not be happening in OpenGL just because of the skewed depth range, accidentally working.

-[Unknown]

@unknownbrackets unknownbrackets added the Depth / Z Issue involves depth drawing parameters. label Feb 8, 2021
@Panderner
Copy link
Contributor

Note: this issue also affects Direct3D 9 and Direct3D 11

@hrydgard hrydgard added D3D11 Direct3D 11 D3D9 Direct3D 9 Vulkan labels Aug 3, 2021
@hrydgard hrydgard modified the milestones: v1.12.0, v1.13.0 Aug 3, 2021
@ghost
Copy link

ghost commented Oct 21, 2021

PixelDepthRounding minimize the issue on my phone.
Vulkan backend.

OFF

1Screenrecorder-2021-10-21-17-04-14-171.mp4

ON

2Screenrecorder-2021-10-21-17-04-43-486.mp4

@ghost
Copy link

ghost commented Nov 1, 2021

Using 931f20e the graphics glitch become horrible in Vulkan.
Screenshot_2021-11-01-14-34-59-830_org ppsspp ppsspp
recording.ppdmp.zip

@unknownbrackets
Copy link
Collaborator

Hm, is this only on Mali or some specific device? It still looks the same on Windows.

Note: software transform doesn't seem to have the white dots. Not sure if that's new or was true before.

-[Unknown]

@ghost
Copy link

ghost commented Nov 2, 2021

Before it's just like this #13846 (comment) but now the graphics is really broken in my mali gpu vulkan.

@ghost
Copy link

ghost commented Nov 6, 2021

In software the shadow get extend when walking.

software.mp4

While in Vulkan hardware transform on cause this issue.

hardware.mp4

PPSSPP v1.12.3-155

@Panderner
Copy link
Contributor

I cannot reproduce this when vulkan and hardware transform is enabled for me.

Screenrecorder-2021-11-06-17-17-03-745.mp4

@hrydgard
Copy link
Owner

hrydgard commented Apr 17, 2022

Got around to trying this, looks like there are two parts of this bug.

On older Mali (in my case, Galaxy S8+), there's this big dropout of the road geometry. Looks like a depth/viewport issue. Presumably it's changing the view range and starting to draw more geometry to prepare for the upcoming corner, and that's why there's such a step change, but something goes badly wrong there, the GPU doesn't like what we give it at all.

This does not happen on newer Mali, but there's still something that looks a lot like Z fighting.

Turning on "DisableAccurateDepth" on older Mali seems to fix the first issue, and makes it look similar to the Z fighting problem that we see on newer Mali but a bit worse.

Tried marking gl_Position as invariant (invariant gl_Position;) which can theoretically help against multipass Z fighting, but didn't help.

Needs more investigation.

@hrydgard
Copy link
Owner

hrydgard commented Apr 17, 2022

It is using a weird multipass algorithm for shadows, where it renders the shadow-receiving geometry once in white textured only with the shadow maps, then renders again, blending the actual road surface with this blend mode:

image

It leaves depth test enabled in the same direction as before (greater-equal), so it's very important that the vertices from this pass end up in the exact same locations as the previous pass to avoid Z-fighting. This is what invariant gl_Position should have fixed but didn't..

I don't see any other difference at the "transition" where it breaks in view matrices or similar, weird...

The game also does a mid-frame readback to memory, not sure what that's used for... It's also extremely inefficient in many ways, clearing the screen to a solid color with like 10 draw calls, and then immediately overwriting that with a sky, which then gets overwritten by content.

@hrydgard hrydgard modified the milestones: v1.13.0, Future-Prio Jul 10, 2022
@ghost
Copy link

ghost commented Sep 4, 2022

There's a minor graphic glitch in the latest build.
Happen both opengl and vulkan.
IMG_20220904_202342

Software
Screenshot_2022-09-04-20-22-26-607_org ppsspp ppsspp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D3D9 Direct3D 9 D3D11 Direct3D 11 Depth / Z Issue involves depth drawing parameters. GE emulation Backend-independent GPU issues Vulkan
Projects
None yet
Development

No branches or pull requests

3 participants