#include "vkd3d_common.h"
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include "vkd3d_memory.h"
Go to the source code of this file.
|
| enum vkd3d_dbg_level | vkd3d_dbg_get_level (void) |
| |
| static void | vkd3d_dbg_voutput (const char *fmt, va_list args) |
| |
| static void | vkd3d_dbg_output (const char *fmt,...) |
| |
| void | vkd3d_dbg_printf (enum vkd3d_dbg_level level, const char *function, const char *fmt,...) |
| |
| void | vkd3d_dbg_set_log_callback (PFN_vkd3d_log callback) |
| |
| static char * | get_buffer (void) |
| |
| const char * | vkd3d_dbg_vsprintf (const char *fmt, va_list args) |
| |
| const char * | vkd3d_dbg_sprintf (const char *fmt,...) |
| |
| static int | get_escape_char (int c) |
| |
| const char * | debugstr_an (const char *str, size_t n) |
| |
| const char * | debugstr_a (const char *str) |
| |
| static const char * | debugstr_w16 (const uint16_t *wstr) |
| |
| static const char * | debugstr_w32 (const uint32_t *wstr) |
| |
| const char * | debugstr_w (const WCHAR *wstr, size_t wchar_size) |
| |
| unsigned int | vkd3d_env_var_as_uint (const char *name, unsigned int default_value) |
| |
| static bool | is_option_separator (char c) |
| |
| 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) |
| |
◆ VKD3D_DEBUG_BUFFER_COUNT
| #define VKD3D_DEBUG_BUFFER_COUNT 64 |
◆ VKD3D_DEBUG_BUFFER_SIZE
| #define VKD3D_DEBUG_BUFFER_SIZE 512 |
◆ debugstr_a()
Definition at line 222 of file debug.c.
223{
225}
const char * debugstr_an(const char *str, size_t n)
◆ debugstr_an()
Definition at line 173 of file debug.c.
174{
176 int escape_char;
178
180 return "(null)";
183
185
188 {
190
192 {
194 *
ptr++ = escape_char;
195 continue;
196 }
197
199 {
201 }
202 else
203 {
207 }
208 }
210
212 {
216 }
218
220}
_ACRTIMP size_t __cdecl strlen(const char *)
#define VKD3D_DEBUG_BUFFER_SIZE
static char * get_buffer(void)
static int get_escape_char(int c)
Referenced by debugstr_a().
◆ debugstr_w()
Definition at line 319 of file debug.c.
320{
321 if (wchar_size == 2)
324}
static const char * debugstr_w32(const uint32_t *wstr)
static const char * debugstr_w16(const uint16_t *wstr)
◆ debugstr_w16()
Definition at line 227 of file debug.c.
228{
231
232 if (!wstr)
233 return "(null)";
234
236
239 {
241
242 if (escape_char)
243 {
245 *
ptr++ = escape_char;
246 continue;
247 }
248
250 {
252 }
253 else
254 {
258 }
259 }
261
263 {
267 }
269
271}
Referenced by debugstr_w().
◆ debugstr_w32()
Definition at line 273 of file debug.c.
274{
277
278 if (!wstr)
279 return "(null)";
280
282
285 {
287
288 if (escape_char)
289 {
291 *
ptr++ = escape_char;
292 continue;
293 }
294
296 {
298 }
299 else
300 {
304 }
305 }
307
309 {
313 }
315
317}
Referenced by debugstr_w().
◆ get_buffer()
◆ get_escape_char()
| static int get_escape_char |
( |
int |
c | ) |
|
|
static |
Definition at line 155 of file debug.c.
156{
158 {
159 case '"':
160 case '\\':
162 case '\t':
163 return 't';
164 case '\n':
165 return 'n';
166 case '\r':
167 return 'r';
168 default:
169 return 0;
170 }
171}
Referenced by debugstr_an(), debugstr_w16(), and debugstr_w32().
◆ is_option_separator()
| static bool is_option_separator |
( |
char |
c | ) |
|
|
static |
◆ vkd3d_dbg_get_level()
Definition at line 55 of file debug.c.
56{
57 static unsigned int level = ~0
u;
58 const char *vkd3d_debug;
60
63
65 vkd3d_debug = "";
66
68 {
70 {
73 }
74 }
75
76
79}
char *CDECL getenv(const char *name)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
static const char *const debug_level_names[]
const char *const vkd3d_dbg_env_name
Referenced by vkd3d_dbg_printf().
◆ vkd3d_dbg_output()
Definition at line 91 of file debug.c.
92{
94
98}
static void vkd3d_dbg_voutput(const char *fmt, va_list args)
Referenced by vkd3d_dbg_printf().
◆ vkd3d_dbg_printf()
Definition at line 100 of file debug.c.
101{
103
105 return;
106
107#ifdef _WIN32
109#elif HAVE_GETTID
111#else
113#endif
117}
enum vkd3d_dbg_level vkd3d_dbg_get_level(void)
static void vkd3d_dbg_output(const char *fmt,...)
DWORD WINAPI GetCurrentThreadId(void)
◆ vkd3d_dbg_set_log_callback()
◆ vkd3d_dbg_sprintf()
Definition at line 144 of file debug.c.
145{
148
153}
const char * vkd3d_dbg_vsprintf(const char *fmt, va_list args)
◆ vkd3d_dbg_voutput()
◆ vkd3d_dbg_vsprintf()
◆ vkd3d_debug_list_has_member()
Definition at line 348 of file debug.c.
349{
350 char prev_char, next_char;
352
355 {
357 {
358 prev_char =
p >
string ?
p[-1] : 0;
361
363 return true;
364 }
365 }
366
367 return false;
368}
_ACRTIMP char *__cdecl strstr(const char *, const char *)
static bool is_option_separator(char c)
Referenced by is_extension_disabled(), and vkd3d_parse_debug_options().
◆ vkd3d_env_var_as_uint()
Definition at line 326 of file debug.c.
327{
330 char *end_ptr;
331
333 {
338 }
339
340 return default_value;
341}
_ACRTIMP __msvcrt_ulong __cdecl strtoul(const char *, char **, int)
GLdouble GLdouble GLdouble r
Referenced by vkd3d_create_vk_device().
◆ vkd3d_parse_debug_options()
◆ vkd3d_set_thread_name()
Definition at line 405 of file debug.c.
406{
407#ifdef _WIN32
411
413 if (!pfn_SetThreadDescription)
414 return;
415
417 return;
418
420 return;
421
424
426#elif defined(HAVE_PTHREAD_SETNAME_NP_2)
427 pthread_setname_np(pthread_self(),
name);
428#elif defined(HAVE_PTHREAD_SETNAME_NP_1)
429 pthread_setname_np(
name);
430#endif
431}
#define MultiByteToWideChar
BOOL WINAPI InitOnceExecuteOnce(_Inout_ PINIT_ONCE InitOnce, _In_ __callback PINIT_ONCE_FN InitFn, _Inout_opt_ PVOID Parameter, _Outptr_opt_result_maybenull_ LPVOID *Context)
static INIT_ONCE init_once
static void vkd3d_free(void *ptr)
static void * vkd3d_malloc(size_t size)
HANDLE WINAPI GetCurrentThread(void)
#define INIT_ONCE_STATIC_INIT
Referenced by device_worker_main(), and vkd3d_fence_worker_main().
◆ debug_level_names
◆ log_callback
◆ vkd3d_dbg_env_name