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.
@@ Coverage Diff @@ ## master #1624 +/- ## ======================================= Coverage 18.73% 18.73% ======================================= Files 171 171 Lines 17018 17018 ======================================= Hits 3188 3188 Misses 13830 13830
Closing in favor of #1636 which solves these exact same problems in a better way.