wined3d: Cap the maximum reported VRAM, not the current reported VRAM.

That is, subtract the currently used memory from the capped maximum, so that
creating textures will report that available VRAM has decreased. Drivers on
Windows seem to match this behaviour (at least NVidia and WARP), although they
vary on where the cap is set.

This fixes test failures in test_vidmem_accounting() for cards with over 4 GiB
of VRAM.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-06-07 16:32:57 -05:00 committed by Alexandre Julliard
parent eae27293ba
commit 8c1c83dfdf

View file

@ -1482,7 +1482,7 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
wine_dbgstr_longlong(device->adapter->vram_bytes_used),
wine_dbgstr_longlong(driver_info->vram_bytes - device->adapter->vram_bytes_used));
return min(UINT_MAX, driver_info->vram_bytes - device->adapter->vram_bytes_used);
return min(UINT_MAX, driver_info->vram_bytes) - device->adapter->vram_bytes_used;
}
struct wined3d_buffer * CDECL wined3d_device_context_get_stream_output(struct wined3d_device_context *context,