mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d: Try to guess application name.
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:
parent
0bde4c7dca
commit
3d681737c9
@ -467,6 +467,7 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance,
|
|||||||
bool *user_extension_supported = NULL;
|
bool *user_extension_supported = NULL;
|
||||||
VkApplicationInfo application_info;
|
VkApplicationInfo application_info;
|
||||||
VkInstanceCreateInfo instance_info;
|
VkInstanceCreateInfo instance_info;
|
||||||
|
char application_name[PATH_MAX];
|
||||||
uint32_t extension_count;
|
uint32_t extension_count;
|
||||||
const char **extensions;
|
const char **extensions;
|
||||||
VkInstance vk_instance;
|
VkInstance vk_instance;
|
||||||
@ -530,6 +531,12 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance,
|
|||||||
application_info.engineVersion = vkd3d_application_info->engine_version;
|
application_info.engineVersion = vkd3d_application_info->engine_version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (vkd3d_get_program_name(application_name))
|
||||||
|
{
|
||||||
|
application_info.pApplicationName = application_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("Application: %s.\n", debugstr_a(application_info.pApplicationName));
|
||||||
|
|
||||||
if (!(extensions = vkd3d_calloc(extension_count, sizeof(*extensions))))
|
if (!(extensions = vkd3d_calloc(extension_count, sizeof(*extensions))))
|
||||||
{
|
{
|
||||||
|
@ -602,6 +602,50 @@ HRESULT vkd3d_load_vk_device_procs(struct vkd3d_vk_device_procs *procs,
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
|
|
||||||
|
bool vkd3d_get_program_name(char program_name[PATH_MAX])
|
||||||
|
{
|
||||||
|
char *name, *p, *real_path = NULL;
|
||||||
|
|
||||||
|
if ((name = strrchr(program_invocation_name, '/')))
|
||||||
|
{
|
||||||
|
real_path = realpath("/proc/self/exe", NULL);
|
||||||
|
|
||||||
|
/* Try to strip command line arguments. */
|
||||||
|
if (real_path && (p = strrchr(real_path, '/'))
|
||||||
|
&& !strncmp(real_path, program_invocation_name, strlen(real_path)))
|
||||||
|
{
|
||||||
|
name = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
++name;
|
||||||
|
}
|
||||||
|
else if ((name = strrchr(program_invocation_name, '\\')))
|
||||||
|
{
|
||||||
|
++name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name = program_invocation_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(program_name, name, PATH_MAX);
|
||||||
|
program_name[PATH_MAX - 1] = '\0';
|
||||||
|
free(real_path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
bool vkd3d_get_program_name(char program_name[PATH_MAX])
|
||||||
|
{
|
||||||
|
*program_name = '\0';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _GNU_SOURCE */
|
||||||
|
|
||||||
static struct vkd3d_private_data *vkd3d_private_store_get_private_data(
|
static struct vkd3d_private_data *vkd3d_private_store_get_private_data(
|
||||||
const struct vkd3d_private_store *store, const GUID *tag)
|
const struct vkd3d_private_store *store, const GUID *tag)
|
||||||
{
|
{
|
||||||
|
@ -1203,6 +1203,8 @@ HRESULT vkd3d_load_vk_device_procs(struct vkd3d_vk_device_procs *procs,
|
|||||||
|
|
||||||
extern const char vkd3d_build[];
|
extern const char vkd3d_build[];
|
||||||
|
|
||||||
|
bool vkd3d_get_program_name(char program_name[PATH_MAX]) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
static inline void vkd3d_set_thread_name(const char *name)
|
static inline void vkd3d_set_thread_name(const char *name)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_PTHREAD_SETNAME_NP_2)
|
#if defined(HAVE_PTHREAD_SETNAME_NP_2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user