The new OverrideStencilFormat
and DdrawOverrideStencilFormat
settings help reduce GPU power usage and fix games!
#439
Replies: 22 comments 7 replies
-
I just added a feature in the unreleased dev builds you can download from the Actions tab called
Thanks for the kind words.
There is not really much I can do about this without using a shader for AA. Currently, I am just enabling the Direct3D9 AA. However, if you set
Yeah, I haven't done a lot of testing at 4k. There is definitely more I can do to improve the performance here. However, I have been trying to focus on compatibility first. |
Beta Was this translation helpful? Give feedback.
-
I'll give I didn't know that Thanks for making dxwrapper! It's honestly shaping up to be an amazing tool to get old games working again on newer OSes and even works great on Linux with Wine and DXVK/WineD3D. |
Beta Was this translation helpful? Give feedback.
-
Have you tried with the Or, instead of using Direct3D9On12, in the latest dev builds you can try enabling
This makes sense because with There are other options here. I could render to a texture and then draw the texture to the screen rather than copying it. Not sure if that would speed things up. I can try that at some point, but it would break AA since you cannot do AA on a texture.
Yes, I am trying to convert the games to native Direct3D9. I'm not using any special or fancy Direct3D9 features that may not work on all cards. In other words, I am trying to make it as compatible as possible. |
Beta Was this translation helpful? Give feedback.
-
Ok, try with this build. It should be a bit faster with AA disabled and might be a little better even with AA enabled: dxwrapper.zip |
Beta Was this translation helpful? Give feedback.
-
Wow! That is a night-and-day difference! With 4x AA turned on I actually get better performance than with it off now! And frametimes have dropped quite a bit too. dxwrapper is now on par with dgvoodoo with this game. Wild! |
Beta Was this translation helpful? Give feedback.
-
Correction! dxwrapper is actually faster than dgvoodoo with this game! I get lower peak frametimes and slightly higher FPS at 4k resolution on my laptop. These recent changes are honestly amazing! It's crazy that it runs better with AA turned on than off. Amazing work man. |
Beta Was this translation helpful? Give feedback.
-
Wow. I am glad it is working so well for you. My last build had a minor bug. Here is the fixed one. I hope this one works as well for you: dxwrapper.zip |
Beta Was this translation helpful? Give feedback.
-
So I tried enabling
Thanks, I'll give it a try. Update: |
Beta Was this translation helpful? Give feedback.
-
Ok. It's best to keep them disabled if they don't help. Best to enable as few options as you actually need.
Looks like my change to render to a texture isn't what helped the performance. I think I had a bug where dxwrapper was doing a lot of unnecessary work and that is what made the performance faster. Rendering to a texture is actually slower, in some cases. Here is an update. I hope this makes it run as fast without AA as it does with AA: dxwrapper.zip |
Beta Was this translation helpful? Give feedback.
-
Strange, I still get way better performance with AA enabled (higher FPS and much lower peak frametimes). Here are some screen shots of the difference (this is where the AA helps as the ship has bad aliasing artifacts when moving). My laptop is using Linux with Wine 10.15, DXVK 2.7.1 and Mesa 25.2.3. |
Beta Was this translation helpful? Give feedback.
-
At 4k resolution I also see the same behavior (worse performance with AA off). |
Beta Was this translation helpful? Give feedback.
-
Uh, this is very weird. There are only two things I can think of that may be different between the AA and non-AA modes. Can you try these two builds and let me know if either of them speed up the non-AA mode? dxwrapper_discard.zip - With this build I set the dxwrapper_shadow.zip - With this build force shadow surfaces to be enabled. Normally they are only enabled when AA is enabled. |
Beta Was this translation helpful? Give feedback.
-
Nice! Setting |
Beta Was this translation helpful? Give feedback.
-
Ok, I added an option called Here is the updated build with this new option: dxwrapper.zip Note: |
Beta Was this translation helpful? Give feedback.
-
Oops! I was double checking the .ini before testing the new builds and thought I needed to enable that. Thanks for the clarification. The new build seems to work great. For whatever reason, using |
Beta Was this translation helpful? Give feedback.
-
I guess that for some reason it is slower to Lock a render target than it is to copy the render target to a system memory surface. System memory surfaces can be locked instantly, with virtually no overhead.
You're welcome. Glad I was able to help. |
Beta Was this translation helpful? Give feedback.
-
I remembered why shadow surfaces are faster. Shadow surfaces are used with Blt, Lock and GetDC. Sometimes a game will Blt multiple times in a row. When not using a shadow surface (because of the way dxwrapper handles Blt) it causes Direct3D9 to Lock the video memory surface. This activity is very slow, almost as slow as copying the the whole surface. With shadow surfaces dxwrapper can copy the surface once to the shadow and then do all the Blt's quickly on this shadow and then copy it back. This makes it much faster than trying to Lock a video memory surface multiple times each frame. In the latest build I changed it so that Blt and GetDC always uses shadow surface, even if DdrawUseShadowSurface is disabled. This should allow you to get the faster performance even with both AA and Here is the latest build: dxwrapper.zip Note: Later I want to use Draw rather than a shadow surface when the game calls Blt. This should be much faster than using a shadow surface and make both AA and non-AA faster for games like this. |
Beta Was this translation helpful? Give feedback.
-
It's possible that this game locks the surface. Also, when |
Beta Was this translation helpful? Give feedback.
-
Ok, I found the issue. MultiplyTransform() was broken. Here is the fixed build: dxwrapper.zip
I am not seeing this issue. However, it could be because your computer is too fast. You could try setting |
Beta Was this translation helpful? Give feedback.
-
That fixed it! The cursor movement is fixed too. (I have a Logitech MX Master 2 set to 3000 DPI so I think that made the original issue worse.) Amazing work as usual, thanks! |
Beta Was this translation helpful? Give feedback.
-
On a high note, dxwrapper makes Total Annihilation work perfectly and draw very little power when playing on my laptop. For comparison, when using cncddraw, the CPU core is pegged at 100% load (even with vsync enabled) and the intro video exhibits scanlines. With dxwrapper I can fix the intro video scanlines and with forced vsync the game draws very little power / load on the CPU. Overall massive improvement. I do find it odd that older Win9x era DDraw games have a tendency to cause really high CPU usage on modern computers. |
Beta Was this translation helpful? Give feedback.
-
Weird. I am not see any issues here. How are you enabling AA? This is the latest build, in case there was an issue with your last build: dxwrapper.zip
That's good to hear.
I think it always caused that. One trick you can do to dxwrapper to reduce CPU usage in some cases is to enable both
Yes, cncddraw uses a separate thread for presenting. This allows it to have consistent present calls per second, but can cause more CPU time. dxwrapper only presents when the primary surface gets changed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So I was playing the Might & Magic 6, 7, 8 merge mod and ran into an annoying issue with 2D assets like trees flickering while moving due to clipping on 3D objects. Using dxwrapper, I managed to fix the clipping issue by forcing the game to use D3DFMT_D24S8 with
DdrawOverrideStencilFormat = 75
(but 77 for D3DFMT_D24X8 also works). The game defaults to D3DFMT_D16 (80) and I think this is why the 2D assets run into clipping issues with the surrounding 3D environment.With that success, I also tried this with Warcraft III The Frozen Throne (classic game from 2003, not the remake) using
OverrideStencilFormat = 75
. And I saw a decent drop of 2 to 3 watts of GPU power (14 to 15 watts reduced to 11 to 12 watts) on my laptop iGPU when playing at 60fps with 3840x2160 resolution. This game also uses D3DFMT_D16 by default but works fine with D3DFMT_D24S8. I think modern GPUs and drivers prefer 32bit surface formats for performance, so forcing the game to use one can actually result in better performance.For anyone who want's to look into this more, here's a link to the various D3D9 surface formats:
https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dformat
And this page is a good read too:
https://aras-p.info/texts/D3D9GPUHacks.html
Anyways, dxwrapper keeps getting better and better from my testing. And now has features that even dgvoodoo doesn't have.
My only issues with dxwrapper is that, on a few 3D DDraw games, the antialiasing setting tanks performance and some games exhibit erratic spikes in frametimes at high (3840x2160) resolutions when compared to dgvoodoo. I haven't noticed any issues when using it with D3D8 or D3D9 games. Otherwise dxwrapper's performance is awesome!
Beta Was this translation helpful? Give feedback.
All reactions