narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
942 stars 70 forks source link

Experimental DLL very Poor performance in Unreal (1998) compared to non-experimental one #24

Closed donizettilorenzo closed 6 years ago

donizettilorenzo commented 6 years ago

As title says.

"Normal" DLL can run the game faster than MS ddraw. "Experimental" DLL -> 1 FPS

narzoul commented 6 years ago

Hmm, no issues here with either versions. Tested with Unreal Gold (GOG version) on AMD Radeon RX 480 and Intel HD 4600, Windows 10 Creators Update.

What OS and GPU do you use? Does it run slowly during the intro scene before the main menu, or at the beginning of a new game? I don't have any save games so I didn't test further than that.

donizettilorenzo commented 6 years ago

Win 10 x64 Fall Creators GeForce 1050 Ti + 387.92 I'm testing with the classical Nali Castle intro ( :D ) - Unreal 2.27i (patch from OldUnreal)

narzoul commented 6 years ago

Tested with the same patch now, still steady 60 fps even on Intel HD. Although in 16 bit color mode it's noticeably slower and stutters a bit, that's still 30+ average fps.

Could you attach your Unreal.ini file? If that doesn't help me reproduce the problem either, I'll try upgrading to Fall Creators Update.

Also, if you have some time, can you check if you have the same problem without this unofficial patch?

Btw, high res realistic shadows crash the game for me, and medium/low res just produce a black square instead of any realistic shadow. Blob shadow works fine though.

Edit: Whoops, ignore the 16-bit slowdown and the black square shadows. I removed ddraw.dll earlier and forgot to put it back. Now 16-bit is steady 60 fps too, and no more black squares (though I don't notice any shadow under my character in a new game either).

donizettilorenzo commented 6 years ago

The only Unreal.ini part possibly related is this:

[D3DDrv.D3DRenderDevice] Use32BitZBuffer=False UseVertexFog=False UseAGPTextures=False UseVideoMemoryVB=False UsePrecache=False UseVSync=True in Win >= Win 8 this flag works on the contrary UseTripleBuffering=False Use3dfx=False UseGammaCorrection=True UsePalettes=True UseMultiTexture=True UseTrilinear=True UseMipmapping=True DetailTextures=True DescFlags=0 HighDetailActors=True Coronas=True ShinySurfaces=True VolumetricLighting=True

The unofficial patch doesn't touch the ddraw renderer, it's the same of the 226f/Gold Version - 2006 Unreal Anthology :D

donizettilorenzo commented 6 years ago

Found the culprit: the issue is windowed-mode related. In Fullscreen the framerate is high but there's A LOT of stuttering. A LOT.

May 2006 (last "normal") version works perfectly in windowed mode and there's no stuttering at all.

narzoul commented 6 years ago

Well, I successfully upgraded to Fall Creators Update in the meantime. Full screen behavior is unchanged however, still high fps, still no stuttering.

I just checked windowed mode. Interestingly, on Intel HD the performance is the same but it does appear to stutter a bit on screen. On AMD the performance is definitely abysmal at higher resolutions (and pretty poor even at 640x480). I will look into that, maybe fixing the windowed mode performance issues will fix the full screen stuttering for you too.

donizettilorenzo commented 6 years ago

Fall Creators has new strange issues with fullscreen mode: http://www.vogons.org/viewtopic.php?f=59&t=34931&start=3320 (and after)

narzoul commented 6 years ago

Well, I narrowed down the windowed performance issue to this commit: 672b3b640f3429ef8c8e5da46570a8e73b41723e

I made a build from this and its parent commit (5195a5e4b4803f53d5b7ac11421b5d5477b2d9ef) to compare the two. Last good version: 5195a5e.zip First bad version: 672b3b6.zip

Can you compare the two both in full screen and windowed mode? I would expect the windowed mode frame rate to be fine on 5195a5e and bad on 672b3b6. But I don't think the full screen stuttering is related, so either both of them will have it, or neither of them will.

donizettilorenzo commented 6 years ago

Tested. It's exactly as you said, and NO stuttering in any version (in fullscreen mode - and the fullscreen performance is good in both)!

narzoul commented 6 years ago

Ok, so it's definitely two separate issues. At least now we know the stuttering is related to one of the 17 commits after those two. Can you build the project yourself and do a git bisect to find out which one it is?

If not, I can also build and upload all of them, if you're willing to do more testing. Maybe I should just do that with all commits since v0.2.1 to help with debugging regressions?

donizettilorenzo commented 6 years ago

Zip all versions then upload the zip somewhere, link it here and I'll do the testing ;)

narzoul commented 6 years ago

Here you go: 640f746-cff2b7e.zip

Commits are numbered from oldest (01) to newest (16) (excluding the actual newest version, which is the current experimental one). Let me know the id of the last good/first bad commit. Thanks in advance!

donizettilorenzo commented 6 years ago

Re-tested the 05 Nov DLL and now there's no stuttering at all, maybe it was due to the IN-GAME (@runtime) transition from windowed mode to fullscreen mode ("togglefullscreen" command of the Unreal Engine).

donizettilorenzo commented 6 years ago

Still there's a big performance gap (1920x1080 !) between:

-0.2.1 "official" version (May 2016) -> 420 FPS -Lastest "experimental" version (Nov 2017) -> 302 FPS

But hey, the more important thing is to maximize the compatibility with Windows and other games in general, there's no reason to focus on pure perfomance ;)

narzoul commented 6 years ago

I fixed the windowed mode issue and reduced the overall performance gap to around 2-3% compared to v0.2.1, at least on my system. If it's about the same results for you, I think this issue can be closed. Please check the latest experimental release.

donizettilorenzo commented 6 years ago

Perfect! >400 FPS now (more than MS ddraw!)