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
10.8k stars 2.12k forks source link

D3D11 makes x64 build crash when exiting #18148

Open A096 opened 9 months ago

A096 commented 9 months ago

Game or games this happens in

None

What area of the game / PPSSPP

Open x64 build of PPSSPP and select D3D11 renderer then exit, the emulator will crash.

What should happen

It shouldn't crash.

Logs

No response

Platform

Windows

Mobile phone model or graphics card

NVIDIA GeForce GTX 1050

PPSSPP version affected

From v1.14 and up to v1.16.1

Last working version

v1.13.2

Graphics backend (3D API)

Direct3D 11

Checklist

anr2me commented 9 months ago

Hmm.. i tried running PPSSPP v1.15.4 (Release x64 and also Win32) directly from VS2022 and switched from Vulkan to D3D11, but both doesn't seems to crash when i exited.

Have you tried to update your Geforce driver?

PS: I 'm using driver v536.99

A096 commented 9 months ago

I always use latest driver(version is now 537.34), and I've tried on Win7 SP1/Win10 22H2/Win11 22H2, all of them were fresh install, but the problem is still there.

anr2me commented 9 months ago

Btw are you using SLI ? If you are, have you try disabling it to see whether this issue related to SLI.

A096 commented 9 months ago

No, I'm not using SLI.

A096 commented 9 months ago

Maybe it's random crash, PPSSPP x64 build is trying to access an address that does not exist in memory sometimes, another method is changing renderer from D3D11 to any other, it'll restart the emulator, but the emulator may also crash at this moment(tested with VS2022).

anr2me commented 9 months ago

Well if you have VS2022 you can try running the Debug x64 from VS, it will shows you the location of the crash in the source code, which will be helpful in figuring out what causing it to crash.

When VS shows you the location, you can screenshot the location in the source code that also shows the call stacks (bottom right) and the auto-watches (bottom left).

A096 commented 9 months ago

Debug build will sometimes make an instance when changing renderer backend(does not crash), only release build will crash(does not make any instance).

A096 commented 9 months ago

Some news here... PPSSPP x64 will crash when changing renderer backend from D3D11 to any other from menu bar, changing from UI will not crash. (Another bug... changing renderer backend from menu bar also makes PPSSPP x64 opening an instance?)

hrydgard commented 9 months ago

Hm, I don't see a crash myself. I do on the other hand also experience the instance thing, need to fix that at a minimum.. Not hard.

A096 commented 9 months ago

When I downgrade my driver version, changing renderer just makes an instance, won't crash! So there should be something wrong with the latest driver. Thanks for your help.

hrydgard commented 9 months ago

In the latest builds now, there should be no "instance" thing happening anymore.

A096 commented 9 months ago

In the latest builds now, there should be no "instance" thing happening anymore.

Thank you! 😊

GamingDucking commented 8 months ago

Is this issue going to close now?

hrydgard commented 8 months ago

I don't know, I don't think I ever got the crash so hard to verify that it's gone..

A096 commented 8 months ago

Still crash with the latest graphic driver, if I use built-in graphic driver on Windows 10, PPSSPP will not crash.

RokkumanX commented 5 months ago

Yes I can confirm this issue 100 percent.

I'm using ppsspp v1.16.6-925-g789c7e503 on my i7 13700K, 64GB Ram and a RTX 4070 machine running Windows 11 Enterprise 23H2 22631.2861 on NVIDIA 546.33 Studio drivers which is a more stable GPU driver branch.

When I open ppsspp for the very first time, Direct3D 11 is set to default and as soon as I close without changing anything it's a crash to desktop.

Once I change Direct3D 11 to OpenGL in the ppsspp.ini ppsspp works perfectly again.

I always use OpenGL anyway because of my shaders.

Maybe OpenGL should be the default renderer because this issue ain't new.

anr2me commented 5 months ago

I just tried v1.16.6-935-g99cf2f88f extracted to a new folder, exiting using the [X] button or [Exit] Button seems to be okay, but when i use File Menu -> Exit (or pressing Alt-F4), it felt different (like a crash occurred), doesn't always happened tho, i think i need to wait for at least 2 seconds after the Games tab appeared before i Exit using Menu to trigger this crash.

RokkumanX commented 5 months ago

I completely forgot to mention that I'm always use the method File Menu -> Exit to exit ppsspp. Old habit since way back with most of the software I'm using.

Like you say, it felt different (like a crash occurred) and you are exactly right on that because if you check the built in Reliability Monitor tool under Control Panel\System and Security\Security and Maintenance you'll see that ppsspp crashed to desktop.

As I mentioned earlier, once I change from Direct3D 11 to OpenGL there is no more crashing when File Menu -> Exit

hrydgard commented 5 months ago

Thanks, I'll look into it again soon.

Just curious, what's the reason you're not using Vulkan? That'll get you MSAA antialiasing, for example.

If you have custom shaders that work with OpenGL and don't work with Vulkan, I'd like to have a look at them. Can you zip them up and drag into a post here?

anr2me commented 5 months ago

Hmm... strange, when i put PPSSPPDebug64.exe and PPSSPPWindows.pdb on that newly extracted folder, i can't get that "crash" feeling, exiting through File Menu was smooth too.

I also tried to use "Attach to Process" from VS2022 Debug menu and select the PPSSPPWindows64.exe process, but i can no longer feel that "crash" when exiting through File menu, exiting was smooth with debugger attached.

Meanwhile, without debugger i can easily reproduce that "crash" feeling (ie. freezes for a while and the cursor also looks like working on something) by pressing Alt-F4 or going through File -> Exit quickly (holding down the File menu and then too late to click the Exit menu item might not trigger the crash) after waiting for at least 2 seconds since the Games tab appearance (but only happened on Release version)

PS: Not really sure why it's generating (sorted by Date modified in Windows Explorer) PPSSPPWindows.pdb instead of PPSSPPDebug64.pdb after "Rebuild Solution" on Debug x64 configuration, it used to be generating a matching file names in the past (as i remembered)

Edit: i'm not even sure whether it's really a crash or just being slow to exit, since i can't even trigger the Just-in-Time Debugger to shows up even after disabling Windows Error Reporting (based on the Troubleshoot at https://learn.microsoft.com/en-us/visualstudio/debugger/debug-using-the-just-in-time-debugger?view=vs-2022#jit_errors)

anr2me commented 5 months ago

I think it's just being slow to exit sometimes when exiting using Alt-F4. If i set all channel to Debug level, PPSSPP freezes for a few seconds before exiting after the NativeShutdownGraphics shows up in the logs. image

RokkumanX commented 5 months ago

Thanks, I'll look into it again soon.

Just curious, what's the reason you're not using Vulkan? That'll get you MSAA antialiasing, for example.

If you have custom shaders that work with OpenGL and don't work with Vulkan, I'd like to have a look at them. Can you zip them up and drag into a post here?

I'm not really interested of using MSAA antialiasing or any other fancy stuff to enhance the image quality.

I use OpenGL in combination of the Software Renderer because I just like the look of authentic PSP rendering with dithering and I use a PSP color shader to mimic the colors of a PSP Phat screen.

One might think it's stupid that I not use my powerful hardware to it's fullest and crank the image quality up, but I'm dead set about my standards and preferals.

Even PS3 (rpcs3), Wii U (Cemu) and Switch (yuzu and Ruyjinx) get's the same treatment, it must look as authentic as possible.

Accuracy before eye candy at all costs.

LunaMoo commented 5 months ago

Just so you know. The only way to get authentic PSP experience is to play at tiny screen(and it has to be an old LCD with ghosting and other artifacts), the real deal looks nothing like software renderer and especially nothing like software renderer running on full screen of modern display. In PPSSPP software renderer was always just something to test against hardware renderer to figure out bugs of stuff that's hard to do on hardware, never something like in older emulators a choice for accuracy. Also if you use software renderer, your "hardware" backend setting doesn't matter at all.

RokkumanX commented 5 months ago

I'm not saying you are wrong or anything, I must just have been mislead or something when I gathered the information that's all. As long as my games work the way they should and look the way they should, I don't really complain.

hrydgard commented 5 months ago

Yeah let's not judge anyone on what settings they like :) If you're running the software renderr, the backend does indeed not really matter.