Commit 46a451f3 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Pass application info to Vulkan.

parent f9cf2151
...@@ -110,11 +110,28 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops = ...@@ -110,11 +110,28 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
adapter_vk_check_format, adapter_vk_check_format,
}; };
static unsigned int wined3d_get_wine_vk_version(void)
{
const char *ptr = PACKAGE_VERSION;
int major, minor;
major = atoi(ptr);
while (isdigit(*ptr) || *ptr == '.')
++ptr;
minor = atoi(ptr);
return VK_MAKE_VERSION(major, minor, 0);
}
static BOOL wined3d_init_vulkan(struct wined3d_vk_info *vk_info) static BOOL wined3d_init_vulkan(struct wined3d_vk_info *vk_info)
{ {
struct vulkan_ops *vk_ops = &vk_info->vk_ops; struct vulkan_ops *vk_ops = &vk_info->vk_ops;
VkInstance instance = VK_NULL_HANDLE; VkInstance instance = VK_NULL_HANDLE;
VkInstanceCreateInfo instance_info; VkInstanceCreateInfo instance_info;
VkApplicationInfo app_info;
char app_name[MAX_PATH];
VkResult vr; VkResult vr;
if (!wined3d_load_vulkan(vk_info)) if (!wined3d_load_vulkan(vk_info))
...@@ -126,8 +143,17 @@ static BOOL wined3d_init_vulkan(struct wined3d_vk_info *vk_info) ...@@ -126,8 +143,17 @@ static BOOL wined3d_init_vulkan(struct wined3d_vk_info *vk_info)
goto fail; goto fail;
} }
memset(&app_info, 0, sizeof(app_info));
app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
if (wined3d_get_app_name(app_name, ARRAY_SIZE(app_name)))
app_info.pApplicationName = app_name;
app_info.pEngineName = "Damavand";
app_info.engineVersion = wined3d_get_wine_vk_version();
app_info.apiVersion = VK_API_VERSION_1_0;
memset(&instance_info, 0, sizeof(instance_info)); memset(&instance_info, 0, sizeof(instance_info));
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instance_info.pApplicationInfo = &app_info;
if ((vr = VK_CALL(vkCreateInstance(&instance_info, NULL, &instance))) < 0) if ((vr = VK_CALL(vkCreateInstance(&instance_info, NULL, &instance))) < 0)
{ {
WARN("Failed to create Vulkan instance, vr %d.\n", vr); WARN("Failed to create Vulkan instance, vr %d.\n", vr);
......
...@@ -142,6 +142,30 @@ success: ...@@ -142,6 +142,30 @@ success:
return 0; return 0;
} }
BOOL wined3d_get_app_name(char *app_name, unsigned int app_name_size)
{
char buffer[MAX_PATH];
unsigned int len;
char *p, *name;
len = GetModuleFileNameA(0, buffer, ARRAY_SIZE(buffer));
if (!(len && len < MAX_PATH))
return FALSE;
name = buffer;
if ((p = strrchr(name, '/' )))
name = p + 1;
if ((p = strrchr(name, '\\')))
name = p + 1;
len = strlen(name) + 1;
if (app_name_size < len)
return FALSE;
memcpy(app_name, name, len);
return TRUE;
}
static BOOL wined3d_dll_init(HINSTANCE hInstDLL) static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
{ {
DWORD wined3d_context_tls_idx; DWORD wined3d_context_tls_idx;
...@@ -149,7 +173,7 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) ...@@ -149,7 +173,7 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
DWORD size = sizeof(buffer); DWORD size = sizeof(buffer);
HKEY hkey = 0; HKEY hkey = 0;
HKEY appkey = 0; HKEY appkey = 0;
DWORD len, tmpvalue; DWORD tmpvalue;
WNDCLASSA wc; WNDCLASSA wc;
wined3d_context_tls_idx = TlsAlloc(); wined3d_context_tls_idx = TlsAlloc();
...@@ -191,20 +215,16 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) ...@@ -191,20 +215,16 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
/* @@ Wine registry key: HKCU\Software\Wine\Direct3D */ /* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
if ( RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", &hkey ) ) hkey = 0; if ( RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", &hkey ) ) hkey = 0;
len = GetModuleFileNameA( 0, buffer, MAX_PATH ); if (wined3d_get_app_name(buffer, ARRAY_SIZE(buffer)))
if (len && len < MAX_PATH)
{ {
HKEY tmpkey; HKEY tmpkey;
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\Direct3D */ /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\Direct3D */
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey )) if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey))
{ {
char *p, *appname = buffer; strcat(buffer, "\\Direct3D");
if ((p = strrchr( appname, '/' ))) appname = p + 1; TRACE("Application name %s.\n", buffer);
if ((p = strrchr( appname, '\\' ))) appname = p + 1; if (RegOpenKeyA(tmpkey, buffer, &appkey)) appkey = 0;
strcat( appname, "\\Direct3D" ); RegCloseKey(tmpkey);
TRACE("appname = [%s]\n", appname);
if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
RegCloseKey( tmpkey );
} }
} }
......
...@@ -2919,6 +2919,8 @@ HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) DECLSPEC_HIDDEN; ...@@ -2919,6 +2919,8 @@ HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) DECLSPEC_HIDDEN;
BOOL wined3d_register_window(HWND window, struct wined3d_device *device) DECLSPEC_HIDDEN; BOOL wined3d_register_window(HWND window, struct wined3d_device *device) DECLSPEC_HIDDEN;
void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN;
BOOL wined3d_get_app_name(char *app_name, unsigned int app_name_size) DECLSPEC_HIDDEN;
struct wined3d_blend_state struct wined3d_blend_state
{ {
LONG refcount; LONG refcount;
......
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