wined3d: Pass application info to Vulkan.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-04-03 11:11:34 +02:00 committed by Alexandre Julliard
parent f9cf21512e
commit 46a451f327
3 changed files with 59 additions and 11 deletions

View File

@ -110,11 +110,28 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
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)
{
struct vulkan_ops *vk_ops = &vk_info->vk_ops;
VkInstance instance = VK_NULL_HANDLE;
VkInstanceCreateInfo instance_info;
VkApplicationInfo app_info;
char app_name[MAX_PATH];
VkResult vr;
if (!wined3d_load_vulkan(vk_info))
@ -126,8 +143,17 @@ static BOOL wined3d_init_vulkan(struct wined3d_vk_info *vk_info)
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));
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instance_info.pApplicationInfo = &app_info;
if ((vr = VK_CALL(vkCreateInstance(&instance_info, NULL, &instance))) < 0)
{
WARN("Failed to create Vulkan instance, vr %d.\n", vr);

View File

@ -142,6 +142,30 @@ success:
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)
{
DWORD wined3d_context_tls_idx;
@ -149,7 +173,7 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
DWORD size = sizeof(buffer);
HKEY hkey = 0;
HKEY appkey = 0;
DWORD len, tmpvalue;
DWORD tmpvalue;
WNDCLASSA wc;
wined3d_context_tls_idx = TlsAlloc();
@ -191,20 +215,16 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
/* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
if ( RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", &hkey ) ) hkey = 0;
len = GetModuleFileNameA( 0, buffer, MAX_PATH );
if (len && len < MAX_PATH)
if (wined3d_get_app_name(buffer, ARRAY_SIZE(buffer)))
{
HKEY tmpkey;
/* @@ 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;
if ((p = strrchr( appname, '/' ))) appname = p + 1;
if ((p = strrchr( appname, '\\' ))) appname = p + 1;
strcat( appname, "\\Direct3D" );
TRACE("appname = [%s]\n", appname);
if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
RegCloseKey( tmpkey );
strcat(buffer, "\\Direct3D");
TRACE("Application name %s.\n", buffer);
if (RegOpenKeyA(tmpkey, buffer, &appkey)) appkey = 0;
RegCloseKey(tmpkey);
}
}

View File

@ -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;
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
{
LONG refcount;