PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.64k stars 1.61k forks source link

[BUG]: Gradius V stage 1 boss graphical regression #8074

Closed pjagiello closed 1 year ago

pjagiello commented 1 year ago

Describe the Bug

In Gradius V, there is an interesting graphical glitch happening now when the boss in stage 1 does its "teleporting in" effect. I did a quick bisect and it seems that the bug was introduced in release 3932 (so I think it's PR #7919 ?)

This only happens on the hardware renderer (I tested OpenGL specifically), software mode looks fine.

Reproduction Steps

Play the game until the first stage boss to see it teleporting in. Alternatively go to stage select, and pick stage 1 section 3 if you have a savefile.

Expected Behavior

I expect the graphics not to look like that.

PCSX2 Revision

v1.7.4017

Operating System

Linux (64bit) - Specify distro below

If Linux - Specify Distro

Arch

CPU

Intel i5-4200M

GPU

Intel(R) HD Graphics 4600

GS Settings

No response

Emulation Settings

No response

GS Window Screenshots

Gradius V_SLUS-20712_20230207015623

Logs & Dumps

GSdump attached. (By the way, Github doesn't seem to let me upload a .zst file which was automatically generated so I recompressed it as a .gz file...) Gradius V_SLUS-20712_20230207015623.gs.gz

refractionpcsx2 commented 1 year ago

The GS dump looks fine? Can you run the GS dump on your computer and see if it looks broken for you? you can just go to "Start File" and open it (not gz compressed though)

image

refractionpcsx2 commented 1 year ago

ah! Thanks to our testers, it looks like it's an OpenGL only bug :)

pjagiello commented 1 year ago

Thanks for fixing that so quickly!

As a side note and probably a separate issue (if you even consider that an issue) is that the part when this effect is active is now noticeably slower than it used to be - pre 3932 I had smooth 60 FPS through that whole thing, now it dips to like 40-50 until the effect is over, although my graphics card obviously isn't the best. (Interestingly, PCSX2 wiki actually mentions this slowdown as an issue but it wasn't happening for me).

RedDevilus commented 1 year ago

If it's just more accuracy which can happen to lower FPS then that's normal, however if there is a reproducable issue by multiple people then that's a valid issue.

pjagiello commented 1 year ago

Well, it looks the same to me pre-3932 and post-4027 so maybe it's not exactly more accuracy looking at it that way, it's simply slower after 3932 (which I didn't mention because the actual graphical glitch seemed like the more obvious issue).

I tried it out on a slightly beefier GPU (GeForce GT 740M instead of Intel HD 4600) and it still lags in OpenGL, but on this card I can also try Vulkan renderer which seems much better to me. Could be something there, not sure.

stenzek commented 1 year ago

It's doing 30+ readbacks per frame, of course it's slow :P

I moved readbacks over to using PBOs instead of copying directly to client memory, since that was necessary for asynchronous frame dumping. In theory it shouldn't be any slower than the latter, but maybe on older GPUs/drivers it is. I could add an optional path, it's just... not that clean.

The actual issue which causes the readbacks is it moving a bunch of rectangles back and forth, which also breaks upscaling. I have a fix for that pending too (which also gets rid of the readbacks), just a little concerned it failing in some complex scenarios.

stenzek commented 1 year ago

So, on Mesa on my A750, I get the same performance with PBOs on and off. On Windows, the new method (PBOs) is almost 50% faster in this GS dump. Unless the older hardware performs much worse for some reason, I don't think this change is responsible for any performance difference.

I PR'ed a hidden option to restore synchronous readbacks anyway (#8098). But keep in mind this will tank video dumping performance.

pjagiello commented 1 year ago

I commented under the PR but the hidden option does restore performance for me. But I think I have to retract my statement about GeForce GT 740M - this a NVIDIA Optimus hybrid configuration and I was running PCSX2 through "prime-run" utility, but verbose logs clearly show that even in this case the Intel card was used:

[   18,2020] GL_VENDOR: Intel
[   18,2020] GL_RENDERER: Mesa Intel(R) HD Graphics 4600 (HSW GT2)
[   18,2020] GL_VERSION: 4.6 (Core Profile) Mesa 22.3.4
[   18,2020] GL_SHADING_LANGUAGE_VERSION: 4.60

Hybrid graphics on Linux is such a dumpster fire in my experience that I'm not sure if this is a PCSX2 bug or drivers bug or whatever in between, but now I would guess this slowdown is specific to my Intel card... maybe if I test it out on Windows it's going to be more conclusive. EDIT: yes, on WIndows, NVIDIA gives me full speed no matter the option.