Instead of using wined3d_texture_update_desc(). This is safe, because:
* ddraw never exposes wined3d textures directly, and always retrieves them
directly from wined3d when rendering.
* d3d8 and d3d9 (non-extended) will only resize buffers during a reset, and
resetting is forbidden if the application holds any references to the
backbuffers. RTVs are also replaced during a reset, so there is no concern
about retrieving the old RTVs from the device state.
* d3d9ex allows resetting while holding references to the backbuffers, but tests
(fixed by this patch) show that the backbuffers should in fact be recreated.
* dxgi forbids holding references to back buffers during ResizeBuffers(),
including indirect references via command lists or device contexts.
To match d3d8.
The original patch [1] claims
"WM_SIZE(SIZE_MAXIMIZED) is reliable here. The unreliable behavior
occured only with NOWINDOWCHANGES."
but this doesn't match my testing. Probably when that patch was submitted, this
very fix was applied to the d3d8 tests but forgotten for the d3d9 tests, and
then the wrong conclusions were drawn.
[1] https://www.winehq.org/pipermail/wine-patches/2014-December/135964.html
Instead of uploading all currently bound textures. Besides being redundant, this
would generate mipmaps for an uninitialized texture, and subsequently trying to
render from nonzero mipmap levels would yield uninitialized data.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54170
We would like to use two different textures for the CPU and GPU parts of managed
textures, which means that wined3d_resource_access_is_managed() as such will no
longer be useful.
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.