mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Handle lists in debug env vars consistently.
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
ee1b8cc511
commit
51b930192a
@ -22,6 +22,7 @@
|
|||||||
#include "vkd3d_common.h"
|
#include "vkd3d_common.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef VKD3D_NO_TRACE_MESSAGES
|
#ifdef VKD3D_NO_TRACE_MESSAGES
|
||||||
@ -100,6 +101,7 @@ struct vkd3d_debug_option
|
|||||||
uint64_t flag;
|
uint64_t flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool vkd3d_debug_list_has_member(const char *string, const char *member) DECLSPEC_HIDDEN;
|
||||||
uint64_t vkd3d_parse_debug_options(const char *string,
|
uint64_t vkd3d_parse_debug_options(const char *string,
|
||||||
const struct vkd3d_debug_option *options, unsigned int option_count) DECLSPEC_HIDDEN;
|
const struct vkd3d_debug_option *options, unsigned int option_count) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
@ -323,34 +323,40 @@ static bool is_option_separator(char c)
|
|||||||
return c == ',' || c == ';' || c == '\0';
|
return c == ',' || c == ';' || c == '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool vkd3d_debug_list_has_member(const char *string, const char *member)
|
||||||
|
{
|
||||||
|
char prev_char, next_char;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
p = string;
|
||||||
|
while (p)
|
||||||
|
{
|
||||||
|
if ((p = strstr(p, member)))
|
||||||
|
{
|
||||||
|
prev_char = p > string ? p[-1] : 0;
|
||||||
|
p += strlen(member);
|
||||||
|
next_char = *p;
|
||||||
|
|
||||||
|
if (is_option_separator(prev_char) && is_option_separator(next_char))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t vkd3d_parse_debug_options(const char *string,
|
uint64_t vkd3d_parse_debug_options(const char *string,
|
||||||
const struct vkd3d_debug_option *options, unsigned int option_count)
|
const struct vkd3d_debug_option *options, unsigned int option_count)
|
||||||
{
|
{
|
||||||
char prev_char, next_char;
|
|
||||||
uint64_t flags = 0;
|
uint64_t flags = 0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
const char *p;
|
|
||||||
|
|
||||||
for (i = 0; i < option_count; ++i)
|
for (i = 0; i < option_count; ++i)
|
||||||
{
|
{
|
||||||
const struct vkd3d_debug_option *opt = &options[i];
|
const struct vkd3d_debug_option *opt = &options[i];
|
||||||
|
|
||||||
p = string;
|
if (vkd3d_debug_list_has_member(string, opt->name))
|
||||||
while (p)
|
flags |= opt->flag;
|
||||||
{
|
|
||||||
if ((p = strstr(p, opt->name)))
|
|
||||||
{
|
|
||||||
prev_char = p > string ? p[-1] : 0;
|
|
||||||
p += strlen(opt->name);
|
|
||||||
next_char = *p;
|
|
||||||
|
|
||||||
if (is_option_separator(prev_char) && is_option_separator(next_char))
|
|
||||||
{
|
|
||||||
flags |= opt->flag;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
|
@ -180,16 +180,11 @@ static unsigned int get_spec_version(const VkExtensionProperties *extensions,
|
|||||||
static bool is_extension_disabled(const char *extension_name)
|
static bool is_extension_disabled(const char *extension_name)
|
||||||
{
|
{
|
||||||
const char *disabled_extensions;
|
const char *disabled_extensions;
|
||||||
const char *s;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if (!(disabled_extensions = getenv("VKD3D_DISABLE_EXTENSIONS")))
|
if (!(disabled_extensions = getenv("VKD3D_DISABLE_EXTENSIONS")))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(s = strstr(disabled_extensions, extension_name)))
|
return vkd3d_debug_list_has_member(disabled_extensions, extension_name);
|
||||||
return false;
|
|
||||||
len = strlen(extension_name);
|
|
||||||
return s[len] == ';' || s[len] == '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool has_extension(const VkExtensionProperties *extensions,
|
static bool has_extension(const VkExtensionProperties *extensions,
|
||||||
|
Loading…
Reference in New Issue
Block a user