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

Storing DEFAULT buffers in MANAGED pool #135

Closed
AlpyneDreams opened this issue Apr 15, 2023 · 15 comments
Closed

Storing DEFAULT buffers in MANAGED pool #135

AlpyneDreams opened this issue Apr 15, 2023 · 15 comments
Labels
bug Something isn't working upstream Related to upstream or D3D9 issues, PRs, and code.
Milestone

Comments

@AlpyneDreams
Copy link
Owner

AlpyneDreams commented Apr 15, 2023

Previous title: [Upstream?] Buffer performance panic in water sample and Motor City Online
image

Edit: See below.
Supposedly the issue is many writes to a non-writeonly buffer.

Is instantly fixed by apiTraceMode. As we did for Motor City Online (which treats d3d8 like it's GL) #125. So We have to just determine if this is an upstream issue or just an inherent setting we're going to have to set per-game if they try to do a lot of buffer writes.

@AlpyneDreams AlpyneDreams added bug Something isn't working upstream Related to upstream or D3D9 issues, PRs, and code. labels Apr 15, 2023
@AlpyneDreams AlpyneDreams changed the title [Upstream?] Buffer performance panic in water sample and Motor City Online Disable direct buffer mapping? Apr 15, 2023
@AlpyneDreams
Copy link
Owner Author

Okay so we have learned that the real fix is disabling direct buffer mapping. We might want to make that the default behavior.

@AlpyneDreams AlpyneDreams added this to the v0.20 milestone Apr 15, 2023
@AlpyneDreams
Copy link
Owner Author

This will also fix new chugging introduced by Commands 3 (+ probably others) that have their perf borked by NOOVERWRITE being disabled.

@AlpyneDreams
Copy link
Owner Author

Josh suggets maybe make vertex and index buffers always be MANAGED if games are gonna do stuff with them like this. Instead of disabling direct buffer mapping. At least maybe only for DYNAMIC buffers...? idk. But we gotta pick something.

@AlpyneDreams
Copy link
Owner Author

AlpyneDreams commented Apr 15, 2023

Winter: Perf is better in MCO with DBM disabled compared to apitracemode, but the quads look like tris again... The NOOVERWRITE bit apparently cancelled out the perf from apitrace mode. There are so many variables here.

@WinterSnowfall
Copy link

WinterSnowfall commented Apr 15, 2023

The NOOVERWRITE bit apparently cancelled out the perf from apitrace mode.

Yes, we should probably remember to enable direct buffer mapping for this game if disabling it becomes the new default. The NOOVERWRITE bit will have to be reverted for this game to be anything other than a slideshow.

P.S.: Turns out a lot of games are now slideshows due to the NOOVERWRITE bit, so it's not really a good option to enable it globally at least.

@AlpyneDreams
Copy link
Owner Author

P.S.: Turns out a lot of games are now slideshows due to the NOOVERWRITE bit, so it's not really a good option to enable it globally at least.

Yep, reverted.

Now the question of whether to do the DEFAULT -> MANAGED thing or just disable DBM. They will have the same effect in preventing DBM but the former might gain some perf? Not clear.

@AlpyneDreams AlpyneDreams changed the title Disable direct buffer mapping? Storing DEFAULT buffers in MANAGED pool Apr 16, 2023
@AlpyneDreams
Copy link
Owner Author

Disabling DBM programmatically would be annoying so I am opting to instead remap DEFAULT to MANAGED in 3b029ec. Hopefully this does not break any games.

@AlpyneDreams
Copy link
Owner Author

The flickering in #130 and the performance of the water sample are seemingly fixed now.

@WinterSnowfall
Copy link

This breaks Motor City Online, which shows half quads again. The game seems to be very picky when it comes to VB/IB use.

@AlpyneDreams
Copy link
Owner Author

This breaks Motor City Online, which shows half quads again. The game seems to be very picky when it comes to VB/IB use.

Of course it does

@WinterSnowfall
Copy link

If we ultimately decide to go down this road, the disable direct buffer mapping workarounds for Commandos 3 and Red Faction are superfluous and can be removed from config.cpp. I've tested both games and they works just fine without the workaround.

I've also done some general regression testing and haven't yet come across any noticeable performance degradation due to remapping DEFAULT to MANAGED.

@WinterSnowfall
Copy link

The performance problems we've had in 3DMark2001 SE with the High Detail Car Chase benchmark are now sorted. I think we're definitely doing something right.

@AlpyneDreams
Copy link
Owner Author

AlpyneDreams commented Apr 20, 2023

Games currently broken by this change:

  • Motor City Online - fixed in c815aa8
  • Brigade E5: New Jagged Union - fixed in 0387038
  • Supreme Ruler 2020 - fixed in cd5b89b
  • Railroad Tycoon 3 - fixed in f6316a7

@WinterSnowfall
Copy link

WinterSnowfall commented Apr 20, 2023

  • Railroad Tycoon 3
  • Incoming Forces (arguably the game is broken in many other ways and will need further looking into anyway)

I'll append here if I notice anything else.

@AlpyneDreams
Copy link
Owner Author

I'll close this issue for now since all games except Incoming Forces (#100) are fixed, and that one needs its own issue. If any other games are broken by this, open a new issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream Related to upstream or D3D9 issues, PRs, and code.
Projects
None yet
Development

No branches or pull requests

2 participants