hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.43k stars 2.19k forks source link

GTA 3 LCS: Minor rendering glitch when in-game popup shows #19323

Closed hrydgard closed 4 months ago

hrydgard commented 4 months ago

Reported by scorpio on Discord. Happening on iOS with Vulkan.

image image

NABN00B commented 4 months ago

This is definitely an old issue, though I previously, and erroneously, attributed it to the Z/depth clamping problems. I can't reproduce it with OpenGL, at least not on purpose, but takes a minute to do so with Vulkan.

image

Here's a Vulkan frame dump with and without the glitched HUD numbers. DUMP.zip

hrydgard commented 4 months ago

Thanks for the frame dump!

hrydgard commented 4 months ago

Had a quick look, this is really strange. It has nothing to do with iOS indeed, the same happens on PC.

The bad dump has the draw at step 2056 in PPSSPP's GE debugger.

The mesh data looks ok in RenderDoc - except that some vertex colors are black instead of white. The glitch looks very odd at first glance, I thought it was a texture coordinate problem, but it's simply that a few of triangles output black color!

image

D3D9 and D3D11 are also affected, in addition to Vulkan. Only OpenGL renders this correctly..

In OpenGL, the mesh color data is correct even in the first dump. No clue why it would be different!

In the frame dump, when it renders correctly, it's the very last draw call in the render pass. It renders wrong when the "Mission Failed" marker follows it. Which really is very strange!

It's a simple triangle draw, not even a RECT draw, so it's not some bug in RECT expansion either.

EDIT: It gets weirder, looking at the vertex data in the GE debugger makes it look correct... The draw is from VADDR: 08bb9c20

Alright, I've narrowed it down to the "provoking vertex" processing in software transform (which vertex of the three in a triangle decides the triangle color when flat shading is enabled). Something is wrong there.