Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
963ea98a
Commit
963ea98a
authored
2 years ago
by
Brendan Shanks
Committed by
Alexandre Julliard
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
vkd3d-common: Add a Windows implementation of vkd3d_set_thread_name().
parent
0ef04659
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!39
vkd3d-common: Add a Windows implementation of vkd3d_set_thread_name().
Pipeline
#3352
skipped
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile.am
+1
-0
1 addition, 0 deletions
Makefile.am
include/private/vkd3d_debug.h
+1
-0
1 addition, 0 deletions
include/private/vkd3d_debug.h
libs/vkd3d-common/debug.c
+55
-0
55 additions, 0 deletions
libs/vkd3d-common/debug.c
libs/vkd3d/vkd3d_private.h
+0
-9
0 additions, 9 deletions
libs/vkd3d/vkd3d_private.h
with
57 additions
and
9 deletions
Makefile.am
+
1
−
0
View file @
963ea98a
...
...
@@ -179,6 +179,7 @@ libvkd3d_common_la_SOURCES = \
libs/vkd3d-common/error.c
\
libs/vkd3d-common/memory.c
\
libs/vkd3d-common/utf8.c
libvkd3d_common_la_LIBADD
=
@PTHREAD_LIBS@
lib_LTLIBRARIES
=
libvkd3d-shader.la libvkd3d.la libvkd3d-utils.la
...
...
This diff is collapsed.
Click to expand it.
include/private/vkd3d_debug.h
+
1
−
0
View file @
963ea98a
...
...
@@ -115,5 +115,6 @@ struct vkd3d_debug_option
bool
vkd3d_debug_list_has_member
(
const
char
*
string
,
const
char
*
member
);
uint64_t
vkd3d_parse_debug_options
(
const
char
*
string
,
const
struct
vkd3d_debug_option
*
options
,
unsigned
int
option_count
);
void
vkd3d_set_thread_name
(
const
char
*
name
);
#endif
/* __VKD3D_DEBUG_H */
This diff is collapsed.
Click to expand it.
libs/vkd3d-common/debug.c
+
55
−
0
View file @
963ea98a
...
...
@@ -16,6 +16,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef _WIN32
# define _WIN32_WINNT 0x0600
/* For InitOnceExecuteOnce(). */
#endif
#include
"vkd3d_debug.h"
#include
<assert.h>
...
...
@@ -27,6 +31,11 @@
#include
<stdlib.h>
#include
<stdbool.h>
#include
<string.h>
#ifdef HAVE_PTHREAD_H
#include
<pthread.h>
#endif
#include
"vkd3d_memory.h"
#define VKD3D_DEBUG_BUFFER_COUNT 64
#define VKD3D_DEBUG_BUFFER_SIZE 512
...
...
@@ -369,3 +378,49 @@ uint64_t vkd3d_parse_debug_options(const char *string,
return
flags
;
}
#ifdef _WIN32
static
HRESULT
(
WINAPI
*
pfn_SetThreadDescription
)(
HANDLE
,
const
WCHAR
*
);
static
BOOL
WINAPI
resolve_SetThreadDescription
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
HMODULE
kernelbase
;
if
(
!
(
kernelbase
=
LoadLibraryA
(
"kernelbase.dll"
)))
return
TRUE
;
if
(
!
(
pfn_SetThreadDescription
=
(
void
*
)
GetProcAddress
(
kernelbase
,
"SetThreadDescription"
)))
FreeLibrary
(
kernelbase
);
return
TRUE
;
}
#endif
void
vkd3d_set_thread_name
(
const
char
*
name
)
{
#ifdef _WIN32
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
WCHAR
*
wname
;
int
ret
;
InitOnceExecuteOnce
(
&
init_once
,
resolve_SetThreadDescription
,
NULL
,
NULL
);
if
(
!
pfn_SetThreadDescription
)
return
;
if
((
ret
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
name
,
-
1
,
NULL
,
0
))
<=
0
)
return
;
if
(
!
(
wname
=
vkd3d_malloc
(
ret
*
sizeof
(
*
wname
))))
return
;
if
((
ret
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
name
,
-
1
,
wname
,
ret
))
>
0
)
pfn_SetThreadDescription
(
GetCurrentThread
(),
wname
);
vkd3d_free
(
wname
);
#elif defined(HAVE_PTHREAD_SETNAME_NP_2)
pthread_setname_np
(
pthread_self
(),
name
);
#elif defined(HAVE_PTHREAD_SETNAME_NP_1)
pthread_setname_np
(
name
);
#endif
}
This diff is collapsed.
Click to expand it.
libs/vkd3d/vkd3d_private.h
+
0
−
9
View file @
963ea98a
...
...
@@ -1685,15 +1685,6 @@ extern const char vkd3d_build[];
bool
vkd3d_get_program_name
(
char
program_name
[
PATH_MAX
]);
static
inline
void
vkd3d_set_thread_name
(
const
char
*
name
)
{
#if defined(HAVE_PTHREAD_SETNAME_NP_2)
pthread_setname_np
(
pthread_self
(),
name
);
#elif defined(HAVE_PTHREAD_SETNAME_NP_1)
pthread_setname_np
(
name
);
#endif
}
VkResult
vkd3d_set_vk_object_name_utf8
(
struct
d3d12_device
*
device
,
uint64_t
vk_object
,
VkDebugReportObjectTypeEXT
vk_object_type
,
const
char
*
name
);
HRESULT
vkd3d_set_vk_object_name
(
struct
d3d12_device
*
device
,
uint64_t
vk_object
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment