Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/adapter_gl.c | 2 +- dlls/wined3d/adapter_vk.c | 9 ++++++--- dlls/wined3d/directx.c | 19 +++++++++++-------- dlls/wined3d/wined3d_private.h | 3 ++- 4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index cedd012c89d1..866cfecbe1f2 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3855,7 +3855,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, } fixup_extensions(gl_info, caps_gl_ctx, gl_renderer_str, gl_vendor, gpu_description->vendor, gpu_description->device); - wined3d_driver_info_init(driver_info, gpu_description, vram_bytes); + wined3d_driver_info_init(driver_info, gpu_description, vram_bytes, 0); TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n", driver_info->version_high, driver_info->version_low);
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 8fd9adf31909..0d5e2f59348c 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -635,8 +635,8 @@ static void adapter_vk_init_driver_info(struct wined3d_adapter *adapter, { const struct wined3d_gpu_description *gpu_description; struct wined3d_gpu_description description; + UINT64 vram_bytes, sysmem_bytes; const VkMemoryHeap *heap; - UINT64 vram_bytes; unsigned int i;
TRACE("Device name: %s.\n", debugstr_a(properties->deviceName)); @@ -644,15 +644,18 @@ static void adapter_vk_init_driver_info(struct wined3d_adapter *adapter, TRACE("Driver version: %#x.\n", properties->driverVersion); TRACE("API version: %s.\n", debug_vk_version(properties->apiVersion));
- for (i = 0, vram_bytes = 0; i < memory_properties->memoryHeapCount; ++i) + for (i = 0, vram_bytes = 0, sysmem_bytes = 0; i < memory_properties->memoryHeapCount; ++i) { heap = &memory_properties->memoryHeaps[i]; TRACE("Memory heap [%u]: flags %#x, size 0x%s.\n", i, heap->flags, wine_dbgstr_longlong(heap->size)); if (heap->flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) vram_bytes += heap->size; + else + sysmem_bytes += heap->size; } TRACE("Total device memory: 0x%s.\n", wine_dbgstr_longlong(vram_bytes)); + TRACE("Total shared system memory: 0x%s.\n", wine_dbgstr_longlong(sysmem_bytes));
if (!(gpu_description = wined3d_get_user_override_gpu_description(properties->vendorID, properties->deviceID))) gpu_description = wined3d_get_gpu_description(properties->vendorID, properties->deviceID); @@ -671,7 +674,7 @@ static void adapter_vk_init_driver_info(struct wined3d_adapter *adapter, gpu_description = &description; }
- wined3d_driver_info_init(&adapter->driver_info, gpu_description, vram_bytes); + wined3d_driver_info_init(&adapter->driver_info, gpu_description, vram_bytes, sysmem_bytes); }
static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk, diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index c909e5185a1d..be7e8182ec2a 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -541,7 +541,7 @@ static void wined3d_copy_name(char *dst, const char *src, unsigned int dst_size) }
void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, - const struct wined3d_gpu_description *gpu_desc, UINT64 vram_bytes) + const struct wined3d_gpu_description *gpu_desc, UINT64 vram_bytes, UINT64 sysmem_bytes) { const struct driver_version_information *version_info; enum wined3d_driver_model driver_model; @@ -637,12 +637,15 @@ void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, driver_info->vram_bytes = LONG_MAX; }
- driver_info->sysmem_bytes = 64 * 1024 * 1024; - memory_status.dwLength = sizeof(memory_status); - if (GlobalMemoryStatusEx(&memory_status)) - driver_info->sysmem_bytes = max(memory_status.ullTotalPhys / 2, driver_info->sysmem_bytes); - else - ERR("Failed to get global memory status.\n"); + if (!(driver_info->sysmem_bytes = sysmem_bytes)) + { + driver_info->sysmem_bytes = 64 * 1024 * 1024; + memory_status.dwLength = sizeof(memory_status); + if (GlobalMemoryStatusEx(&memory_status)) + driver_info->sysmem_bytes = max(memory_status.ullTotalPhys / 2, driver_info->sysmem_bytes); + else + ERR("Failed to get global memory status.\n"); + }
/* Try to obtain driver version information for the current Windows version. This fails in * some cases: @@ -2305,7 +2308,7 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal, if (!(adapter = heap_alloc_zero(sizeof(*adapter)))) return NULL;
- wined3d_driver_info_init(&adapter->driver_info, &gpu_description, 0); + wined3d_driver_info_init(&adapter->driver_info, &gpu_description, 0, 0); adapter->vram_bytes_used = 0; TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->driver_info.vram_bytes));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index fbcda94537e6..221ca6e04f46 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2701,7 +2701,8 @@ struct wined3d_driver_info };
void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, - const struct wined3d_gpu_description *gpu_description, UINT64 vram_bytes) DECLSPEC_HIDDEN; + const struct wined3d_gpu_description *gpu_description, + UINT64 vram_bytes, UINT64 sysmem_bytes) DECLSPEC_HIDDEN;
struct wined3d_adapter_ops {