Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- dlls/wined3d/adapter_gl.c | 4 +++- dlls/wined3d/adapter_vk.c | 4 +++- dlls/wined3d/device.c | 6 +++--- dlls/wined3d/directx.c | 11 +++++++---- dlls/wined3d/wined3d_private.h | 10 +++++++++- 5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 52f0fd7a..a8dca54c 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3879,7 +3879,9 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n", driver_info->version_high, driver_info->version_low);
- adapter->vram_bytes_used = 0; + memset(&adapter->memory_usage, 0, sizeof(adapter->memory_usage)); + adapter->memory_events = NULL; + adapter->event_count = 0; TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(driver_info->vram_bytes));
if (gl_info->supported[EXT_MEMORY_OBJECT]) diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 21163a20..81526ade 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -1180,7 +1180,9 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk, VK_CALL(vkGetPhysicalDeviceMemoryProperties(adapter_vk->physical_device, &memory_properties));
adapter_vk_init_driver_info(adapter, &properties2.properties, &memory_properties); - adapter->vram_bytes_used = 0; + memset(&adapter->memory_usage, 0, sizeof(adapter->memory_usage)); + adapter->memory_events = NULL; + adapter->event_count = 0; TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->driver_info.vram_bytes));
memcpy(&adapter->driver_uuid, id_properties.driverUUID, sizeof(adapter->driver_uuid)); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 2a4d3778..3f525e8e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1202,10 +1202,10 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
TRACE("Emulating 0x%s bytes. 0x%s used, returning 0x%s left.\n", wine_dbgstr_longlong(driver_info->vram_bytes), - wine_dbgstr_longlong(device->adapter->vram_bytes_used), - wine_dbgstr_longlong(driver_info->vram_bytes - device->adapter->vram_bytes_used)); + wine_dbgstr_longlong(device->adapter->memory_usage[0].bytes_used), + wine_dbgstr_longlong(driver_info->vram_bytes - device->adapter->memory_usage[0].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->memory_usage[0].bytes_used); }
void CDECL wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx, diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 0688e49c..bf4fad31 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -146,16 +146,17 @@ static HRESULT wined3d_output_init(struct wined3d_output *output, const WCHAR *d /* Adjust the amount of used texture memory */ UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) { - adapter->vram_bytes_used += amount; + adapter->memory_usage[0].bytes_used += amount; TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n", wine_dbgstr_longlong(amount), - wine_dbgstr_longlong(adapter->vram_bytes_used)); - return adapter->vram_bytes_used; + wine_dbgstr_longlong(adapter->memory_usage[0].bytes_used)); + return adapter->memory_usage[0].bytes_used; }
void wined3d_adapter_cleanup(struct wined3d_adapter *adapter) { wined3d_output_cleanup(&adapter->output); + heap_free(adapter->memory_events); heap_free(adapter->formats); }
@@ -2777,7 +2778,9 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal, return NULL;
wined3d_driver_info_init(&adapter->driver_info, &gpu_description, 0, 0); - adapter->vram_bytes_used = 0; + memset(&adapter->memory_usage, 0, sizeof(adapter->memory_usage)); + adapter->memory_events = NULL; + adapter->event_count = 0; TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->driver_info.vram_bytes));
if (!wined3d_adapter_init(adapter, ordinal, &wined3d_adapter_no3d_ops)) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 61096a03..f2eab0aa 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2867,6 +2867,12 @@ struct wined3d_output D3DDDI_VIDEO_PRESENT_SOURCE_ID vidpn_source_id; };
+struct wined3d_adapter_memory_usage +{ + UINT64 bytes_used; + UINT64 bytes_reserved; +}; + /* The adapter structure */ struct wined3d_adapter { @@ -2878,7 +2884,9 @@ struct wined3d_adapter struct wined3d_d3d_info d3d_info; struct wined3d_driver_info driver_info; struct wined3d_output output; - UINT64 vram_bytes_used; + struct wined3d_adapter_memory_usage memory_usage[2]; + HANDLE *memory_events; + DWORD event_count; GUID driver_uuid; GUID device_uuid; LUID luid;