Commit 28ca5625 authored by Jon Doron's avatar Jon Doron Committed by Alexandre Julliard

win32u: Add registry data for GPU memory size.

Starcraft Remastered is looking up for the GPU physical memory size to check for minimum requirements to enable RealTime Lighting. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46624Signed-off-by: 's avatarJon Doron <arilou@gmail.com>
parent 6b6aff83
...@@ -1206,6 +1206,8 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) ...@@ -1206,6 +1206,8 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param )
unsigned int gpu_index, size; unsigned int gpu_index, size;
HKEY hkey, subkey; HKEY hkey, subkey;
LARGE_INTEGER ft; LARGE_INTEGER ft;
ULONG memory_size;
ULONGLONG qw_memory_size;
static const BOOL present = TRUE; static const BOOL present = TRUE;
static const WCHAR wine_adapterW[] = {'W','i','n','e',' ','A','d','a','p','t','e','r',0}; static const WCHAR wine_adapterW[] = {'W','i','n','e',' ','A','d','a','p','t','e','r',0};
...@@ -1221,6 +1223,12 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) ...@@ -1221,6 +1223,12 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param )
static const WCHAR chip_typeW[] = static const WCHAR chip_typeW[] =
{'H','a','r','d','w','a','r','e','I','n','f','o','r','m','a','t','i','o','n','.', {'H','a','r','d','w','a','r','e','I','n','f','o','r','m','a','t','i','o','n','.',
'C','h','i','p','T','y','p','e',0}; 'C','h','i','p','T','y','p','e',0};
static const WCHAR qw_memory_sizeW[] =
{'H','a','r','d','w','a','r','e','I','n','f','o','r','m','a','t','i','o','n','.',
'q','w','M','e','m','o','r','y','S','i','z','e',0};
static const WCHAR memory_sizeW[] =
{'H','a','r','d','w','a','r','e','I','n','f','o','r','m','a','t','i','o','n','.',
'M','e','m','o','r','y','S','i','z','e',0};
static const WCHAR dac_typeW[] = static const WCHAR dac_typeW[] =
{'H','a','r','d','w','a','r','e','I','n','f','o','r','m','a','t','i','o','n','.', {'H','a','r','d','w','a','r','e','I','n','f','o','r','m','a','t','i','o','n','.',
'D','a','c','T','y','p','e',0}; 'D','a','c','T','y','p','e',0};
...@@ -1373,6 +1381,13 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) ...@@ -1373,6 +1381,13 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param )
set_reg_value( hkey, chip_typeW, REG_BINARY, desc, size ); set_reg_value( hkey, chip_typeW, REG_BINARY, desc, size );
set_reg_value( hkey, dac_typeW, REG_BINARY, ramdacW, sizeof(ramdacW) ); set_reg_value( hkey, dac_typeW, REG_BINARY, ramdacW, sizeof(ramdacW) );
/* If we failed to retrieve the gpu memory size set a default of 1Gb */
qw_memory_size = gpu->memory_size ? gpu->memory_size : 1073741824;
set_reg_value( hkey, qw_memory_sizeW, REG_QWORD, &qw_memory_size, sizeof(qw_memory_size) );
memory_size = (ULONG)min( gpu->memory_size, (ULONGLONG)ULONG_MAX );
set_reg_value( hkey, memory_sizeW, REG_DWORD, &memory_size, sizeof(memory_size) );
if (gpu->vendor_id && gpu->device_id) if (gpu->vendor_id && gpu->device_id)
{ {
/* The last seven digits are the driver number. */ /* The last seven digits are the driver number. */
......
...@@ -643,9 +643,11 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid ...@@ -643,9 +643,11 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
VkResult (*pvkGetRandROutputDisplayEXT)( VkPhysicalDevice, Display *, RROutput, VkDisplayKHR * ); VkResult (*pvkGetRandROutputDisplayEXT)( VkPhysicalDevice, Display *, RROutput, VkDisplayKHR * );
PFN_vkGetPhysicalDeviceProperties2KHR pvkGetPhysicalDeviceProperties2KHR; PFN_vkGetPhysicalDeviceProperties2KHR pvkGetPhysicalDeviceProperties2KHR;
PFN_vkEnumeratePhysicalDevices pvkEnumeratePhysicalDevices; PFN_vkEnumeratePhysicalDevices pvkEnumeratePhysicalDevices;
uint32_t device_count, device_idx, output_idx, i; PFN_vkGetPhysicalDeviceMemoryProperties pvkGetPhysicalDeviceMemoryProperties;
uint32_t device_count, device_idx, output_idx, heap_idx, i;
VkPhysicalDevice *vk_physical_devices = NULL; VkPhysicalDevice *vk_physical_devices = NULL;
VkPhysicalDeviceProperties2 properties2; VkPhysicalDeviceProperties2 properties2;
VkPhysicalDeviceMemoryProperties mem_properties;
VkInstanceCreateInfo create_info; VkInstanceCreateInfo create_info;
VkPhysicalDeviceIDProperties id; VkPhysicalDeviceIDProperties id;
VkInstance vk_instance = NULL; VkInstance vk_instance = NULL;
...@@ -679,6 +681,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid ...@@ -679,6 +681,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
LOAD_VK_FUNC(vkEnumeratePhysicalDevices) LOAD_VK_FUNC(vkEnumeratePhysicalDevices)
LOAD_VK_FUNC(vkGetPhysicalDeviceProperties2KHR) LOAD_VK_FUNC(vkGetPhysicalDeviceProperties2KHR)
LOAD_VK_FUNC(vkGetRandROutputDisplayEXT) LOAD_VK_FUNC(vkGetRandROutputDisplayEXT)
LOAD_VK_FUNC(vkGetPhysicalDeviceMemoryProperties)
#undef LOAD_VK_FUNC #undef LOAD_VK_FUNC
vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, NULL ); vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, NULL );
...@@ -738,6 +741,14 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid ...@@ -738,6 +741,14 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
} }
RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name), &len, properties2.properties.deviceName, RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name), &len, properties2.properties.deviceName,
strlen( properties2.properties.deviceName ) + 1 ); strlen( properties2.properties.deviceName ) + 1 );
pvkGetPhysicalDeviceMemoryProperties( vk_physical_devices[device_idx], &mem_properties );
for (heap_idx = 0; heap_idx < mem_properties.memoryHeapCount; heap_idx++)
{
if (mem_properties.memoryHeaps[heap_idx].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
gpu->memory_size += mem_properties.memoryHeaps[heap_idx].size;
}
ret = TRUE; ret = TRUE;
goto done; goto done;
} }
......
...@@ -251,6 +251,7 @@ struct gdi_gpu ...@@ -251,6 +251,7 @@ struct gdi_gpu
UINT subsys_id; UINT subsys_id;
UINT revision_id; UINT revision_id;
GUID vulkan_uuid; /* Vulkan device UUID */ GUID vulkan_uuid; /* Vulkan device UUID */
ULONGLONG memory_size;
}; };
struct gdi_adapter struct gdi_adapter
......
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