Commit 5d117c76 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Query Vulkan shared system memory.

parent 310638ab
......@@ -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);
......
......@@ -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,
......
......@@ -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));
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment