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

Occasional start-up crash when using DirectDraw on Windows 11 #545

Open
MJohnson20 opened this issue Jul 18, 2023 · 4 comments
Open

Occasional start-up crash when using DirectDraw on Windows 11 #545

MJohnson20 opened this issue Jul 18, 2023 · 4 comments

Comments

@MJohnson20
Copy link

MJohnson20 commented Jul 18, 2023

I'm running VizDoom on Windows 11, Nvidia 3070Ti and I'm seeing an occasional crash when attempting to blt the backbuffer using the directdraw renderer, which obviously can be a bit annoying when training. This generally happens just after initialization.

The crash is specifically here in fb_ddraw.cpp

if (FAILED (hr = PrimarySurf->Blt (&rect, BackSurf, NULL, DDBLT_WAIT|DDBLT_ASYNC, NULL))) // Crash is here. {

In the DDrawFB::PaintToWindow function. It looks like some kind of internal crash in directdraw so It might be down to how it's being emulated on Windows 11.

Crash is:
Exception thrown at 0x00007FFB19AE1F30 (ddraw.dll) in vizdoomrd.exe: 0xC0000005: Access violation reading location 0x0000000000000014.

@mwydmuch
Copy link
Member

Hi @MJohnson20, thank you very much for reporting the problem! We probably won't investigate it in the near future as the Windows version is not a priority for us. If you have an idea how to fix it, we will gladly accept a PR.

If you plan on running some serious experiments on your machine, I highly recommend using Windows Subsystem for Linux and installing ViZDoom on it, or using Linux-based docker, as there is another issue with slowdowns on Windows 11 (#504).

@MJohnson20
Copy link
Author

I've spent some time investigating and I'm pretty sure it's something in the internals of DirectDraw which is causing the exception, which I'm not surprised by given how the API has been deprecated for quite some time now. The solution would be replacing the DirectDraw code with something else on Windows, but I understand that's not likely at this point.

I'll investigate using WSL or Docker, thanks.

@mwydmuch
Copy link
Member

Thank you for your investigation @MJohnson20. It works perfectly fine on my Windows 10 machine, so I was not able to investigate on my own so far, but I'm not surprised that some issue is present on the next iteration of the OS. The best solution would be to drop the DirectDraw backend and just replace it with SDL2 backend that is used on Linux and Mac. Unfortunately, it is also intertwined with some posix-specific code, so it isn't a drop-in replacement for Windows and would require some more work. I have plans (for a few years now...) to do it but so far no luck with finding enough time. Maybe someday it will happen, but it is unlikely in the near future.

@MJohnson20
Copy link
Author

MJohnson20 commented Jul 25, 2023

As a follow-up, I've gone ahead and ported the Win32 version to using SDL. It's a bit of a mess at the moment but it's functional. I'll get it cleaned up and submit a PR if you're interested.

It should be noted that it's probably got a few issues as there's quite a lot of code that's been ripped out, so it'll take some time to get into a mergable state but we could get that ball rolling.

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

2 participants