• Zebediah Figura's avatar
    d3d9: Cache the output mode list. · 0ee74e9f
    Zebediah Figura authored
    Garou: Mark of the Wolves calls IDirect3D9::GetAdapterModeCount() on every
    frame. This results in calling EnumDisplaySettingsExW() once per available mode,
    which is a very slow operation, both on Windows and Wine.
    
    Manual testing shows that Windows caches the mode list (as well as the adapter
    list, which is already cached in Wine) in Direct3D 9 and lower. Calls to
    GetAdapterModeCount() and EnumAdapterDisplayModes() are fast, and they also do
    not change if monitors are added or removed.
    
    DXGI behaves differently, however. The list of outputs attached to an adapter is
    cached—that is, calls to IDXGIAdapter::EnumOutputs() are fast, and return stale
    data. However, at least some other calls are slow and do not seem to be cached,
    including IDXGIOutput::GetDisplayModeList() and IDXGIOutput::GetDesc().
    
    ddraw is also slow and uncached. Since all testing was done on Windows 10 (for
    lack of available older hardware to test with) it is not unlikely that ddraw was
    reimplemented over dxgi on newer Windows, and that older Windows versions would
    be fast and cached, but this is speculation. In any case I have not included
    patches to cache ddraw modes.
    
    Tests were done on Windows 10 21H2, both on real hardware with NVidia drivers
    and on software drivers via qemu/KVM. In the latter case only speed could be
    tested, but this was consistent with the results from the NVidia machine.
    0ee74e9f
Name
Last commit
Last update
dlls Loading commit data...
documentation Loading commit data...
fonts Loading commit data...
include Loading commit data...
libs Loading commit data...
loader Loading commit data...
nls Loading commit data...
po Loading commit data...
programs Loading commit data...
server Loading commit data...
tools Loading commit data...
.editorconfig Loading commit data...
.gitlab-ci.yml Loading commit data...
.mailmap Loading commit data...
ANNOUNCE Loading commit data...
AUTHORS Loading commit data...
COPYING.LIB Loading commit data...
LICENSE Loading commit data...
LICENSE.OLD Loading commit data...
MAINTAINERS Loading commit data...
README Loading commit data...
VERSION Loading commit data...
aclocal.m4 Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...