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
Cleanup Direct3D State #1624
Cleanup Direct3D State #1624
Conversation
map< DWORD, map< D3DSAMPLERSTATETYPE, DWORD > > cacheSamplerStates; /// cached sampler states | ||
map< DWORD, D3DLIGHT9 > cacheLightStates; /// cached light states | ||
map< DWORD, BOOL > cacheLightEnable; /// cached light enable states | ||
D3DMATERIAL9 cacheMaterial; /// cached lighting material |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We forgot to cache the lighting material for the managed D3D9 device before.
// ***** LIGHTS BEGIN ***** | ||
#include <map> | ||
#include <list> | ||
#include "Universal_System/fileio.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this garbage wasn't even being used!
Codecov Report
@@ Coverage Diff @@
## master #1624 +/- ##
=======================================
Coverage 18.73% 18.73%
=======================================
Files 171 171
Lines 17018 17018
=======================================
Hits 3188 3188
Misses 13830 13830 Continue to review full report at Codecov.
|
…o cleanup-direct3d-state
…o cleanup-direct3d-state
…o cleanup-direct3d-state
…o cleanup-direct3d-state
…o cleanup-direct3d-state
…o cleanup-direct3d-state
…o cleanup-direct3d-state
Closing in favor of #1636 which solves these exact same problems in a better way. |
This pull request cleans up so much garbage I hardly know where to begin. The first thing I was looking at was the Direct3D9 and Direct3D11 light handling. For some reason, I copied over the garbage from the OpenGL1 system when adding lights to D3D. Since GM's lighting was originally based on Direct3D's, there was no need for any of this. The GL1 system was concerned with reapplying the lights when the projection matrix is changed due to lighting being computed in eyespace. I believe the origin of the GL1 stuff I copied was polygonz. Regardless, I started by dumping it from D3D9 and D3D11.
We were also missing a cache of the device lighting material that I added in #1530. So the bug was still occurring with the managed device since Project Mario resizing a window provokes a device reset. While I was in here, I decided to clean up a bunch of the cache code too and use simpler repetitions for restoring the cached device state.