[PATCH] wined3d: Cap the maximum reported VRAM, not the current reported VRAM.

Zebediah Figura zfigura at codeweavers.com
Tue Jun 7 16:32:57 CDT 2022

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 at codeweavers.com>
 dlls/wined3d/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c6a6de93123..f264494cb5f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1482,7 +1482,7 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
             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,

More information about the wine-devel mailing list