crosire / d3d8to9

A D3D8 pseudo-driver which converts API calls and bytecode shaders to equivalent D3D9 ones.
BSD 2-Clause "Simplified" License
880 stars 78 forks source link

Cache AdapterModes to reduce number of Direct3D9 API calls #33

Closed elishacloud closed 7 years ago

elishacloud commented 7 years ago

This update will cache AdapterModes to reduce number of Direct3D9 API calls. This solves major performance issue on startup when using WineD3D. See issue #24.

The issue was that for each call to EnumAdapterModes d3d8to9 would make multiple calls to GetAdapterModeCount. This would multiply the number of API calls significantly. Furthermore, it seems there is a slight delay for each of these API calls when using WineD3D. Calling them only once and caching the results significantly improves the performance.

This update will make is to that when a Direct3D8 device is created it will enum all adapter modes and store them in a vector. Then when the game calls EnumAdapterModes it will retrieve them from the vector.