Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
February 2021
- 81 participants
- 1707 messages
[PATCH vkd3d v2 4/6] vkd3d-shader: Factor out make_empty_list().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.y | 55 +++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index dd15f627..5ad50b0c 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -121,6 +121,15 @@ static struct hlsl_ir_node *node_from_list(struct list *list)
return LIST_ENTRY(list_tail(list), struct hlsl_ir_node, entry);
}
+static struct list *make_empty_list(void)
+{
+ struct list *list;
+
+ if ((list = vkd3d_malloc(sizeof(*list))))
+ list_init(list);
+ return list;
+}
+
static void check_invalid_matrix_modifiers(struct hlsl_ctx *ctx, DWORD modifiers, struct vkd3d_shader_location loc)
{
if (modifiers & HLSL_MODIFIERS_MAJORITY_MASK)
@@ -390,9 +399,8 @@ static struct list *create_loop(enum loop_type type, struct list *init, struct l
struct hlsl_ir_loop *loop = NULL;
struct hlsl_ir_if *cond_jump = NULL;
- if (!(list = vkd3d_malloc(sizeof(*list))))
+ if (!(list = make_empty_list()))
goto oom;
- list_init(list);
if (init)
list_move_head(list, init);
@@ -724,9 +732,8 @@ static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *ty
if (type->type == HLSL_CLASS_MATRIX)
assert(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
- if (!(list = vkd3d_malloc(sizeof(*list))))
+ if (!(list = make_empty_list()))
return NULL;
- list_init(list);
LIST_FOR_EACH_ENTRY_SAFE(v, v_next, fields, struct parse_variable_def, entry)
{
if (!(field = vkd3d_calloc(1, sizeof(*field))))
@@ -892,12 +899,11 @@ static struct list *make_list(struct hlsl_ir_node *node)
{
struct list *list;
- if (!(list = vkd3d_malloc(sizeof(*list))))
+ if (!(list = make_empty_list()))
{
hlsl_free_instr(node);
return NULL;
}
- list_init(list);
list_add_tail(list, &node->entry);
return list;
}
@@ -1377,14 +1383,13 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
if (basic_type->type == HLSL_CLASS_MATRIX)
assert(basic_type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
- if (!(statements_list = vkd3d_malloc(sizeof(*statements_list))))
+ if (!(statements_list = make_empty_list()))
{
LIST_FOR_EACH_ENTRY_SAFE(v, v_next, var_list, struct parse_variable_def, entry)
free_parse_variable_def(v);
vkd3d_free(var_list);
return NULL;
}
- list_init(statements_list);
if (!var_list)
return statements_list;
@@ -1836,8 +1841,8 @@ any_identifier:
fields_list:
/* empty */
{
- $$ = vkd3d_malloc(sizeof(*$$));
- list_init($$);
+ if (!($$ = make_empty_list()))
+ YYABORT;
}
| fields_list field
{
@@ -1921,8 +1926,8 @@ func_prototype:
compound_statement:
'{' '}'
{
- $$ = vkd3d_malloc(sizeof(*$$));
- list_init($$);
+ if (!($$ = make_empty_list()))
+ YYABORT;
}
| '{' scope_start statement_list '}'
{
@@ -1982,8 +1987,8 @@ register_opt:
parameters:
scope_start
{
- $$ = vkd3d_malloc(sizeof(*$$));
- list_init($$);
+ if (!($$ = make_empty_list()))
+ YYABORT;
}
| scope_start param_list
{
@@ -1993,8 +1998,8 @@ parameters:
param_list:
parameter
{
- $$ = vkd3d_malloc(sizeof(*$$));
- list_init($$);
+ if (!($$ = make_empty_list()))
+ YYABORT;
if (!add_func_parameter(ctx, $$, &$1, @1))
{
ERR("Error adding function parameter %s.\n", $1.name);
@@ -2148,9 +2153,8 @@ declaration_statement:
| struct_declaration
| typedef
{
- if (!($$ = vkd3d_malloc(sizeof(*$$))))
+ if (!($$ = make_empty_list()))
YYABORT;
- list_init($$);
}
typedef_type:
@@ -2177,8 +2181,8 @@ typedef:
type_specs:
type_spec
{
- $$ = vkd3d_malloc(sizeof(*$$));
- list_init($$);
+ if (!($$ = make_empty_list()))
+ YYABORT;
list_add_head($$, &$1->entry);
}
| type_specs ',' type_spec
@@ -2217,8 +2221,8 @@ variables_def_optional:
variables_def:
variable_def
{
- $$ = vkd3d_malloc(sizeof(*$$));
- list_init($$);
+ if (!($$ = make_empty_list()))
+ YYABORT;
list_add_head($$, &$1->entry);
}
| variables_def ',' variable_def
@@ -2401,9 +2405,8 @@ jump_statement:
}
| KW_RETURN ';'
{
- if (!($$ = vkd3d_malloc(sizeof(*$$))))
+ if (!($$ = make_empty_list()))
YYABORT;
- list_init($$);
if (!add_return(ctx, $$, NULL, @1))
YYABORT;
}
@@ -2462,8 +2465,8 @@ loop_statement:
expr_statement:
';'
{
- $$ = vkd3d_malloc(sizeof(*$$));
- list_init($$);
+ if (!($$ = make_empty_list()))
+ YYABORT;
}
| expr ';'
{
--
2.30.1
Feb. 26, 2021
[PATCH vkd3d v2 3/6] vkd3d-shader: Assert that we don't read out of bounds of the base_types array.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index dbc03a80..ceeec334 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -675,14 +675,17 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct vkd3d_string_buffer_cache
switch (type->type)
{
case HLSL_CLASS_SCALAR:
+ assert(type->base_type < ARRAY_SIZE(base_types));
vkd3d_string_buffer_printf(string, "%s", base_types[type->base_type]);
return string;
case HLSL_CLASS_VECTOR:
+ assert(type->base_type < ARRAY_SIZE(base_types));
vkd3d_string_buffer_printf(string, "%s%u", base_types[type->base_type], type->dimx);
return string;
case HLSL_CLASS_MATRIX:
+ assert(type->base_type < ARRAY_SIZE(base_types));
vkd3d_string_buffer_printf(string, "%s%ux%u", base_types[type->base_type], type->dimx, type->dimy);
return string;
--
2.30.1
Feb. 26, 2021
[PATCH vkd3d v2 2/6] vkd3d-shader: Return a vkd3d_string_buffer from hlsl_modifiers_to_string().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.c | 54 +++++++++++++++++++++-------------------
libs/vkd3d-shader/hlsl.h | 3 ++-
libs/vkd3d-shader/hlsl.y | 16 ++++++------
3 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index e2a77707..dbc03a80 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -730,46 +730,45 @@ const char *debug_hlsl_type(const struct hlsl_type *type)
return ret;
}
-char *hlsl_modifiers_to_string(unsigned int modifiers)
+struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct vkd3d_string_buffer_list *string_buffers,
+ unsigned int modifiers)
{
- char *string;
- size_t len;
+ struct vkd3d_string_buffer *string;
- if (!(string = vkd3d_malloc(110)))
+ if (!(string = vkd3d_string_buffer_get(string_buffers)))
return NULL;
- string[0] = 0;
if (modifiers & HLSL_STORAGE_EXTERN)
- strcat(string, "extern "); /* 7 */
+ vkd3d_string_buffer_printf(string, "extern ");
if (modifiers & HLSL_STORAGE_NOINTERPOLATION)
- strcat(string, "nointerpolation "); /* 16 */
+ vkd3d_string_buffer_printf(string, "nointerpolation ");
if (modifiers & HLSL_MODIFIER_PRECISE)
- strcat(string, "precise "); /* 8 */
+ vkd3d_string_buffer_printf(string, "precise ");
if (modifiers & HLSL_STORAGE_SHARED)
- strcat(string, "shared "); /* 7 */
+ vkd3d_string_buffer_printf(string, "shared ");
if (modifiers & HLSL_STORAGE_GROUPSHARED)
- strcat(string, "groupshared "); /* 12 */
+ vkd3d_string_buffer_printf(string, "groupshared ");
if (modifiers & HLSL_STORAGE_STATIC)
- strcat(string, "static "); /* 7 */
+ vkd3d_string_buffer_printf(string, "static ");
if (modifiers & HLSL_STORAGE_UNIFORM)
- strcat(string, "uniform "); /* 8 */
+ vkd3d_string_buffer_printf(string, "uniform ");
if (modifiers & HLSL_STORAGE_VOLATILE)
- strcat(string, "volatile "); /* 9 */
+ vkd3d_string_buffer_printf(string, "volatile ");
if (modifiers & HLSL_MODIFIER_CONST)
- strcat(string, "const "); /* 6 */
+ vkd3d_string_buffer_printf(string, "const ");
if (modifiers & HLSL_MODIFIER_ROW_MAJOR)
- strcat(string, "row_major "); /* 10 */
+ vkd3d_string_buffer_printf(string, "row_major ");
if (modifiers & HLSL_MODIFIER_COLUMN_MAJOR)
- strcat(string, "column_major "); /* 13 */
+ vkd3d_string_buffer_printf(string, "column_major ");
if ((modifiers & (HLSL_STORAGE_IN | HLSL_STORAGE_OUT)) == (HLSL_STORAGE_IN | HLSL_STORAGE_OUT))
- strcat(string, "inout "); /* 6 */
+ vkd3d_string_buffer_printf(string, "inout ");
else if (modifiers & HLSL_STORAGE_IN)
- strcat(string, "in "); /* 3 */
+ vkd3d_string_buffer_printf(string, "in ");
else if (modifiers & HLSL_STORAGE_OUT)
- strcat(string, "out "); /* 4 */
+ vkd3d_string_buffer_printf(string, "out ");
- if ((len = strlen(string)))
- string[len - 1] = 0;
+ if (string->content_size)
+ string->buffer[--string->content_size] = 0;
return string;
}
@@ -818,11 +817,14 @@ static void dump_ir_var(struct vkd3d_string_buffer *buffer, const struct hlsl_ir
{
if (var->modifiers)
{
- char *string;
-
- if ((string = hlsl_modifiers_to_string(var->modifiers)))
- vkd3d_string_buffer_printf(buffer, "%s ", string);
- vkd3d_free(string);
+ struct vkd3d_string_buffer_list string_buffers;
+ struct vkd3d_string_buffer *string;
+
+ vkd3d_string_buffer_list_init(&string_buffers);
+ if ((string = hlsl_modifiers_to_string(&string_buffers, var->modifiers)))
+ vkd3d_string_buffer_printf(buffer, "%s ", string->buffer);
+ vkd3d_string_buffer_release(&string_buffers, string);
+ vkd3d_string_buffer_list_cleanup(&string_buffers);
}
vkd3d_string_buffer_printf(buffer, "%s %s", debug_hlsl_type(var->data_type), var->name);
if (var->semantic)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 5a0470b9..2b0b8a97 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -499,7 +499,8 @@ const char *debug_hlsl_type(const struct hlsl_type *type) DECLSPEC_HIDDEN;
struct vkd3d_string_buffer *hlsl_type_to_string(struct vkd3d_string_buffer_cache *string_buffers,
const struct hlsl_type *type) DECLSPEC_HIDDEN;
-char *hlsl_modifiers_to_string(unsigned int modifiers) DECLSPEC_HIDDEN;
+struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct vkd3d_string_buffer_list *string_buffers,
+ unsigned int modifiers) DECLSPEC_HIDDEN;
const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type) DECLSPEC_HIDDEN;
void hlsl_add_function(struct rb_tree *funcs, char *name, struct hlsl_ir_function_decl *decl,
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 1fb1b7f3..dd15f627 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -291,12 +291,12 @@ static bool declare_variable(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl, boo
if (invalid)
{
- char *string;
+ struct vkd3d_string_buffer *string;
- if ((string = hlsl_modifiers_to_string(invalid)))
+ if ((string = hlsl_modifiers_to_string(&ctx->string_buffers, invalid)))
hlsl_error(ctx, decl->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
- "Modifiers '%s' are not allowed on local variables.", string);
- vkd3d_free(string);
+ "Modifiers '%s' are not allowed on local variables.", string->buffer);
+ vkd3d_string_buffer_release(&ctx->string_buffers, string);
}
if (decl->semantic)
@@ -332,12 +332,12 @@ static DWORD add_modifiers(struct hlsl_ctx *ctx, DWORD modifiers, DWORD mod, con
{
if (modifiers & mod)
{
- char *string;
+ struct vkd3d_string_buffer *string;
- if ((string = hlsl_modifiers_to_string(mod)))
+ if ((string = hlsl_modifiers_to_string(&ctx->string_buffers, mod)))
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
- "Modifier '%s' was already specified.", string);
- vkd3d_free(string);
+ "Modifier '%s' was already specified.", string->buffer);
+ vkd3d_string_buffer_release(&ctx->string_buffers, string);
return modifiers;
}
if ((mod & HLSL_MODIFIERS_MAJORITY_MASK) && (modifiers & HLSL_MODIFIERS_MAJORITY_MASK))
--
2.30.1
Feb. 26, 2021
[PATCH vkd3d v2 1/6] vkd3d-shader: Return a vkd3d_string_buffer from hlsl_type_to_string().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.c | 62 +++++++++++++-----------
libs/vkd3d-shader/hlsl.h | 4 +-
libs/vkd3d-shader/hlsl.y | 20 +++++---
libs/vkd3d-shader/vkd3d_shader_main.c | 60 +++++++++++++++++++++++
libs/vkd3d-shader/vkd3d_shader_private.h | 11 +++++
5 files changed, 120 insertions(+), 37 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index 52b3dd10..e2a77707 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -648,10 +648,10 @@ static int compare_function_decl_rb(const void *key, const struct rb_entry *entr
return 0;
}
-char *hlsl_type_to_string(const struct hlsl_type *type)
+struct vkd3d_string_buffer *hlsl_type_to_string(struct vkd3d_string_buffer_cache *string_buffers,
+ const struct hlsl_type *type)
{
- const char *name;
- char *string;
+ struct vkd3d_string_buffer *string;
static const char base_types[HLSL_TYPE_LAST_SCALAR + 1][7] =
{
@@ -663,66 +663,70 @@ char *hlsl_type_to_string(const struct hlsl_type *type)
"bool",
};
+ if (!(string = vkd3d_string_buffer_get(string_buffers)))
+ return NULL;
+
if (type->name)
- return vkd3d_strdup(type->name);
+ {
+ vkd3d_string_buffer_printf(string, "%s", type->name);
+ return string;
+ }
switch (type->type)
{
case HLSL_CLASS_SCALAR:
- return vkd3d_strdup(base_types[type->base_type]);
+ vkd3d_string_buffer_printf(string, "%s", base_types[type->base_type]);
+ return string;
case HLSL_CLASS_VECTOR:
- name = base_types[type->base_type];
- if ((string = malloc(strlen(name) + 2)))
- sprintf(string, "%s%u", name, type->dimx);
+ vkd3d_string_buffer_printf(string, "%s%u", base_types[type->base_type], type->dimx);
return string;
case HLSL_CLASS_MATRIX:
- name = base_types[type->base_type];
- if ((string = malloc(strlen(name) + 4)))
- sprintf(string, "%s%ux%u", name, type->dimx, type->dimy);
+ vkd3d_string_buffer_printf(string, "%s%ux%u", base_types[type->base_type], type->dimx, type->dimy);
return string;
case HLSL_CLASS_ARRAY:
{
+ struct vkd3d_string_buffer *inner_string;
const struct hlsl_type *t;
- char *inner_string;
- size_t len = 1;
for (t = type; t->type == HLSL_CLASS_ARRAY; t = t->e.array.type)
- len += 14;
- if (!(inner_string = hlsl_type_to_string(t)))
- return NULL;
- len += strlen(inner_string);
+ ;
- if ((string = malloc(len)))
+ if ((inner_string = hlsl_type_to_string(string_buffers, t)))
{
- strcpy(string, inner_string);
- for (t = type; t->type == HLSL_CLASS_ARRAY; t = t->e.array.type)
- sprintf(string + strlen(string), "[%u]", t->e.array.elements_count);
+ vkd3d_string_buffer_printf(string, "%s", inner_string->buffer);
+ vkd3d_string_buffer_release(string_buffers, inner_string);
}
- vkd3d_free(inner_string);
+ for (t = type; t->type == HLSL_CLASS_ARRAY; t = t->e.array.type)
+ vkd3d_string_buffer_printf(string, "[%u]", t->e.array.elements_count);
return string;
}
case HLSL_CLASS_STRUCT:
- return vkd3d_strdup("<anonymous struct>");
+ vkd3d_string_buffer_printf(string, "<anonymous struct>");
+ return string;
default:
- return vkd3d_strdup("<unexpected type>");
+ vkd3d_string_buffer_printf(string, "<unexpected type>");
+ return string;
}
}
const char *debug_hlsl_type(const struct hlsl_type *type)
{
+ struct vkd3d_string_buffer_cache string_buffers;
+ struct vkd3d_string_buffer *string;
const char *ret;
- char *string;
- if (!(string = hlsl_type_to_string(type)))
+ vkd3d_string_buffer_cache_init(&string_buffers);
+ if (!(string = hlsl_type_to_string(&string_buffers, type)))
return NULL;
- ret = vkd3d_dbg_sprintf("%s", string);
- vkd3d_free(string);
+ ret = vkd3d_dbg_sprintf("%s", string->buffer);
+ vkd3d_string_buffer_release(&string_buffers, string);
+ vkd3d_string_buffer_cache_cleanup(&string_buffers);
return ret;
}
@@ -1526,6 +1530,7 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, struct vkd3d_shader_message_cont
ctx->source_files_count = 1;
ctx->location.source_name = ctx->source_files[0];
ctx->location.line = ctx->location.column = 1;
+ vkd3d_string_buffer_cache_init(&ctx->string_buffers);
ctx->matrix_majority = HLSL_COLUMN_MAJOR;
@@ -1553,6 +1558,7 @@ static void hlsl_ctx_cleanup(struct hlsl_ctx *ctx)
for (i = 0; i < ctx->source_files_count; ++i)
vkd3d_free((void *)ctx->source_files[i]);
vkd3d_free(ctx->source_files);
+ vkd3d_string_buffer_cache_cleanup(&ctx->string_buffers);
rb_destroy(&ctx->functions, free_function_rb, NULL);
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index a374f54a..5a0470b9 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -390,6 +390,7 @@ struct hlsl_ctx
unsigned int source_files_count;
struct vkd3d_shader_location location;
struct vkd3d_shader_message_context *message_context;
+ struct vkd3d_string_buffer_cache string_buffers;
bool failed;
void *scanner;
@@ -496,7 +497,8 @@ static inline void hlsl_src_remove(struct hlsl_src *src)
const char *debug_hlsl_type(const struct hlsl_type *type) DECLSPEC_HIDDEN;
-char *hlsl_type_to_string(const struct hlsl_type *type) DECLSPEC_HIDDEN;
+struct vkd3d_string_buffer *hlsl_type_to_string(struct vkd3d_string_buffer_cache *string_buffers,
+ const struct hlsl_type *type) DECLSPEC_HIDDEN;
char *hlsl_modifiers_to_string(unsigned int modifiers) DECLSPEC_HIDDEN;
const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type) DECLSPEC_HIDDEN;
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index ea640b94..1fb1b7f3 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -255,13 +255,15 @@ static struct hlsl_ir_node *add_implicit_conversion(struct hlsl_ctx *ctx, struct
if (!implicit_compatible_data_types(src_type, dst_type))
{
- char *src_string = hlsl_type_to_string(src_type), *dst_string = hlsl_type_to_string(dst_type);
+ struct vkd3d_string_buffer *src_string, *dst_string;
+ src_string = hlsl_type_to_string(&ctx->string_buffers, src_type);
+ dst_string = hlsl_type_to_string(&ctx->string_buffers, dst_type);
if (src_string && dst_string)
hlsl_error(ctx, *loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
- "Can't implicitly convert from %s to %s.", src_string, dst_string);
- vkd3d_free(src_string);
- vkd3d_free(dst_string);
+ "Can't implicitly convert from %s to %s.", src_string->buffer, dst_string->buffer);
+ vkd3d_string_buffer_release(&ctx->string_buffers, src_string);
+ vkd3d_string_buffer_release(&ctx->string_buffers, dst_string);
return NULL;
}
@@ -2744,13 +2746,15 @@ unary_expr:
if (!compatible_data_types(src_type, dst_type))
{
- char *src_string = hlsl_type_to_string(src_type), *dst_string = hlsl_type_to_string(dst_type);
+ struct vkd3d_string_buffer *src_string, *dst_string;
+ src_string = hlsl_type_to_string(&ctx->string_buffers, src_type);
+ dst_string = hlsl_type_to_string(&ctx->string_buffers, dst_type);
if (src_string && dst_string)
hlsl_error(ctx, @3, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Can't cast from %s to %s.",
- src_string, dst_string);
- vkd3d_free(src_string);
- vkd3d_free(dst_string);
+ src_string->buffer, dst_string->buffer);
+ vkd3d_string_buffer_release(&ctx->string_buffers, src_string);
+ vkd3d_string_buffer_release(&ctx->string_buffers, dst_string);
YYABORT;
}
diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c
index bae2852a..51136243 100644
--- a/libs/vkd3d-shader/vkd3d_shader_main.c
+++ b/libs/vkd3d-shader/vkd3d_shader_main.c
@@ -33,6 +33,12 @@ void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer)
vkd3d_free(buffer->buffer);
}
+static void vkd3d_string_buffer_clear(struct vkd3d_string_buffer *buffer)
+{
+ buffer->buffer[0] = '\0';
+ buffer->content_size = 0;
+}
+
static bool vkd3d_string_buffer_resize(struct vkd3d_string_buffer *buffer, int rc)
{
unsigned int new_buffer_size = buffer->buffer_size * 2;
@@ -107,6 +113,60 @@ void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const
}
}
+void vkd3d_string_buffer_cache_init(struct vkd3d_string_buffer_cache *cache)
+{
+ memset(cache, 0, sizeof(*cache));
+}
+
+void vkd3d_string_buffer_cache_cleanup(struct vkd3d_string_buffer_cache *cache)
+{
+ unsigned int i;
+
+ for (i = 0; i < cache->count; ++i)
+ {
+ vkd3d_string_buffer_cleanup(cache->buffers[i]);
+ vkd3d_free(cache->buffers[i]);
+ }
+ vkd3d_free(cache->buffers);
+ vkd3d_string_buffer_cache_init(cache);
+}
+
+struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_cache *cache)
+{
+ struct vkd3d_string_buffer *buffer;
+
+ if (!cache->count)
+ {
+ if (!vkd3d_array_reserve((void **)&cache->buffers, &cache->capacity,
+ cache->max_count + 1, sizeof(*cache->buffers)))
+ return NULL;
+ ++cache->max_count;
+
+ if (!(buffer = vkd3d_malloc(sizeof(*buffer))))
+ return NULL;
+ vkd3d_string_buffer_init(buffer);
+ if (!vkd3d_string_buffer_resize(buffer, 1))
+ {
+ vkd3d_free(buffer);
+ return NULL;
+ }
+ }
+ else
+ {
+ buffer = cache->buffers[--cache->count];
+ }
+ vkd3d_string_buffer_clear(buffer);
+ return buffer;
+}
+
+void vkd3d_string_buffer_release(struct vkd3d_string_buffer_cache *cache, struct vkd3d_string_buffer *buffer)
+{
+ if (!buffer)
+ return;
+ assert(cache->count + 1 <= cache->max_count);
+ cache->buffers[cache->count++] = buffer;
+}
+
void vkd3d_shader_message_context_init(struct vkd3d_shader_message_context *context,
enum vkd3d_shader_log_level log_level)
{
diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h
index e837dbcd..cf66c67a 100644
--- a/libs/vkd3d-shader/vkd3d_shader_private.h
+++ b/libs/vkd3d-shader/vkd3d_shader_private.h
@@ -870,12 +870,23 @@ struct vkd3d_string_buffer
unsigned int content_size;
};
+struct vkd3d_string_buffer_cache
+{
+ struct vkd3d_string_buffer **buffers;
+ size_t count, max_count, capacity;
+};
+
enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out) DECLSPEC_HIDDEN;
void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer) DECLSPEC_HIDDEN;
+struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_cache *list) DECLSPEC_HIDDEN;
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer) DECLSPEC_HIDDEN;
+void vkd3d_string_buffer_cache_cleanup(struct vkd3d_string_buffer_cache *list) DECLSPEC_HIDDEN;
+void vkd3d_string_buffer_cache_init(struct vkd3d_string_buffer_cache *list) DECLSPEC_HIDDEN;
int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer,
const char *format, ...) VKD3D_PRINTF_FUNC(2, 3) DECLSPEC_HIDDEN;
+void vkd3d_string_buffer_release(struct vkd3d_string_buffer_cache *list,
+ struct vkd3d_string_buffer *buffer) DECLSPEC_HIDDEN;
#define vkd3d_string_buffer_trace(buffer) \
vkd3d_string_buffer_trace_(buffer, __FUNCTION__)
void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function) DECLSPEC_HIDDEN;
--
2.30.1
Feb. 26, 2021
[PATCH 2/2] oleaut32: Fix VariantChangeType()/VariantChangeTypeEx() prototypes.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/oleaut32/variant.c | 4 ++--
include/oleauto.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index b20ddffab5f..ace33a006f4 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -960,7 +960,7 @@ VariantCopyInd_Return:
* The LCID used for the conversion is LOCALE_USER_DEFAULT.
* See VariantChangeTypeEx.
*/
-HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG* pvargDest, VARIANTARG* pvargSrc,
+HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG* pvargDest, const VARIANTARG* pvargSrc,
USHORT wFlags, VARTYPE vt)
{
return VariantChangeTypeEx( pvargDest, pvargSrc, LOCALE_USER_DEFAULT, wFlags, vt );
@@ -986,7 +986,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG* pvargDest, VARIAN
* pvargDest and pvargSrc can point to the same variant to perform an in-place
* conversion. If the conversion is successful, pvargSrc will be freed.
*/
-HRESULT WINAPI VariantChangeTypeEx(VARIANTARG* pvargDest, VARIANTARG* pvargSrc,
+HRESULT WINAPI VariantChangeTypeEx(VARIANTARG* pvargDest, const VARIANTARG* pvargSrc,
LCID lcid, USHORT wFlags, VARTYPE vt)
{
HRESULT res = S_OK;
diff --git a/include/oleauto.h b/include/oleauto.h
index 8528b74c02f..45edfbb84af 100644
--- a/include/oleauto.h
+++ b/include/oleauto.h
@@ -188,8 +188,8 @@ void WINAPI VariantInit(VARIANT*);
HRESULT WINAPI VariantClear(VARIANT*);
HRESULT WINAPI VariantCopy(VARIANTARG *dst, const VARIANTARG *src);
HRESULT WINAPI VariantCopyInd(VARIANT *dst, const VARIANTARG *src);
-HRESULT WINAPI VariantChangeType(VARIANT*,VARIANT*,USHORT,VARTYPE);
-HRESULT WINAPI VariantChangeTypeEx(VARIANT*,VARIANT*,LCID,USHORT,VARTYPE);
+HRESULT WINAPI VariantChangeType(VARIANTARG *dst, const VARIANTARG *src, USHORT flags, VARTYPE vt);
+HRESULT WINAPI VariantChangeTypeEx(VARIANTARG *dst, const VARIANTARG *src, LCID lcid, USHORT flags, VARTYPE vt);
/* VariantChangeType/VariantChangeTypeEx flags */
#define VARIANT_NOVALUEPROP 0x01 /* Don't get the default value property from IDispatch */
--
2.30.0
Feb. 26, 2021
[PATCH 1/2] oleaut32: Fix VariantCopy()/VariantCopyInd() prototypes.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/oleaut32/variant.c | 13 +++++++------
include/oleauto.h | 4 ++--
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index 36191b6b424..b20ddffab5f 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -689,10 +689,10 @@ HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG* pVarg)
/******************************************************************************
* Copy an IRecordInfo object contained in a variant.
*/
-static HRESULT VARIANT_CopyIRecordInfo(VARIANT *dest, VARIANT *src)
+static HRESULT VARIANT_CopyIRecordInfo(VARIANT *dest, const VARIANT *src)
{
struct __tagBRECORD *dest_rec = &V_UNION(dest, brecVal);
- struct __tagBRECORD *src_rec = &V_UNION(src, brecVal);
+ const struct __tagBRECORD *src_rec = &V_UNION(src, brecVal);
HRESULT hr = S_OK;
ULONG size;
@@ -745,7 +745,7 @@ static HRESULT VARIANT_CopyIRecordInfo(VARIANT *dest, VARIANT *src)
* reference count increased using IUnknown_AddRef().
* - For all by-reference types, only the referencing pointer is copied.
*/
-HRESULT WINAPI VariantCopy(VARIANTARG* pvargDest, VARIANTARG* pvargSrc)
+HRESULT WINAPI VariantCopy(VARIANTARG* pvargDest, const VARIANTARG* pvargSrc)
{
HRESULT hres = S_OK;
@@ -844,9 +844,10 @@ static inline size_t VARIANT_DataSize(const VARIANT* pv)
* pvargDest is always cleared using VariantClear() before pvargSrc is copied
* to it. If clearing pvargDest fails, so does this function.
*/
-HRESULT WINAPI VariantCopyInd(VARIANT* pvargDest, VARIANTARG* pvargSrc)
+HRESULT WINAPI VariantCopyInd(VARIANT* pvargDest, const VARIANTARG* pvargSrc)
{
- VARIANTARG vTmp, *pSrc = pvargSrc;
+ const VARIANTARG *pSrc = pvargSrc;
+ VARIANTARG vTmp;
VARTYPE vt;
HRESULT hres = S_OK;
@@ -934,7 +935,7 @@ HRESULT WINAPI VariantCopyInd(VARIANT* pvargDest, VARIANTARG* pvargSrc)
VariantCopyInd_Return:
if (pSrc != pvargSrc)
- VariantClear(pSrc);
+ VariantClear(&vTmp);
TRACE("returning 0x%08x, %s\n", hres, debugstr_variant(pvargDest));
return hres;
diff --git a/include/oleauto.h b/include/oleauto.h
index cc50f189475..8528b74c02f 100644
--- a/include/oleauto.h
+++ b/include/oleauto.h
@@ -186,8 +186,8 @@ HRESULT WINAPI GetRecordInfoFromGuids(REFGUID,ULONG,ULONG,LCID,REFGUID,IRecordIn
void WINAPI VariantInit(VARIANT*);
HRESULT WINAPI VariantClear(VARIANT*);
-HRESULT WINAPI VariantCopy(VARIANT*,VARIANT*);
-HRESULT WINAPI VariantCopyInd(VARIANT*,VARIANT*);
+HRESULT WINAPI VariantCopy(VARIANTARG *dst, const VARIANTARG *src);
+HRESULT WINAPI VariantCopyInd(VARIANT *dst, const VARIANTARG *src);
HRESULT WINAPI VariantChangeType(VARIANT*,VARIANT*,USHORT,VARTYPE);
HRESULT WINAPI VariantChangeTypeEx(VARIANT*,VARIANT*,LCID,USHORT,VARTYPE);
--
2.30.0
Feb. 26, 2021
Re: [PATCH vkd3d 1/6] vkd3d-shader: Return a vkd3d_string_buffer from hlsl_type_to_string().
by Matteo Bruni
On Fri, Feb 26, 2021 at 7:13 PM Zebediah Figura (she/her)
<zfigura(a)codeweavers.com> wrote:
>
> On 2/26/21 12:08 PM, Matteo Bruni wrote:
> > On Tue, Feb 23, 2021 at 10:57 PM Zebediah Figura
> > <zfigura(a)codeweavers.com> wrote:
> >>
> >> Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
> >> ---
> >> libs/vkd3d-shader/hlsl.c | 62 +++++++++++++-----------
> >> libs/vkd3d-shader/hlsl.h | 4 +-
> >> libs/vkd3d-shader/hlsl.y | 20 +++++---
> >> libs/vkd3d-shader/vkd3d_shader_main.c | 54 +++++++++++++++++++++
> >> libs/vkd3d-shader/vkd3d_shader_private.h | 11 +++++
> >> 5 files changed, 114 insertions(+), 37 deletions(-)
> >>
> >> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
> >> index 52b3dd10..78eacf28 100644
> >> --- a/libs/vkd3d-shader/hlsl.c
> >> +++ b/libs/vkd3d-shader/hlsl.c
> >
> >> const char *debug_hlsl_type(const struct hlsl_type *type)
> >> {
> >> + struct vkd3d_string_buffer_list string_buffers;
> >> + struct vkd3d_string_buffer *string;
> >> const char *ret;
> >> - char *string;
> >>
> >> - if (!(string = hlsl_type_to_string(type)))
> >> + vkd3d_string_buffer_list_init(&string_buffers);
> >> + if (!(string = hlsl_type_to_string(&string_buffers, type)))
> >> return NULL;
> >> - ret = vkd3d_dbg_sprintf("%s", string);
> >> - vkd3d_free(string);
> >> + ret = vkd3d_dbg_sprintf("%s", string->buffer);
> >> + vkd3d_string_buffer_release(&string_buffers, string);
> >> + vkd3d_string_buffer_list_cleanup(&string_buffers);
> >> return ret;
> >> }
> >
> > How painful would it be to pass the context (and thus string_buffers)
> > through to this function?
> >
>
> Not great—I do end up using it in more places—but not awful.
Okay, your call whether to do the change or not.
> >> diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h
> >> index e837dbcd..2ef3d5da 100644
> >> --- a/libs/vkd3d-shader/vkd3d_shader_private.h
> >> +++ b/libs/vkd3d-shader/vkd3d_shader_private.h
> >> @@ -865,17 +865,28 @@ bool shader_sm4_is_end(void *data, const DWORD **ptr) DECLSPEC_HIDDEN;
> >>
> >> struct vkd3d_string_buffer
> >> {
> >> + struct list entry;
> >> char *buffer;
> >> unsigned int buffer_size;
> >> unsigned int content_size;
> >> };
> >>
> >> +struct vkd3d_string_buffer_list
> >> +{
> >> + struct list list;
> >> +};
> >
> > Since this is the second time we implement it and hindsight is usually
> > very good, I'd prefer it if we used an array + vkd3d_array_reserve()
> > to store the stack of available vkd3d_string_buffer structs.
>
> Sure, will do.
>
> > Also it would be nice to rename struct vkd3d_string_buffer_list to
> > something that explains its function rather than what it is, but as
> > usual I don't have any good suggestions...
> >
>
> I'm not sure what's a more functionally descriptive name, other than
> maybe vkd3d_string_buffer_cache?
Nice, works for me.
Feb. 26, 2021
Re: [PATCH vkd3d 1/6] vkd3d-shader: Return a vkd3d_string_buffer from hlsl_type_to_string().
by Zebediah Figura (she/her)
On 2/26/21 12:08 PM, Matteo Bruni wrote:
> On Tue, Feb 23, 2021 at 10:57 PM Zebediah Figura
> <zfigura(a)codeweavers.com> wrote:
>>
>> Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
>> ---
>> libs/vkd3d-shader/hlsl.c | 62 +++++++++++++-----------
>> libs/vkd3d-shader/hlsl.h | 4 +-
>> libs/vkd3d-shader/hlsl.y | 20 +++++---
>> libs/vkd3d-shader/vkd3d_shader_main.c | 54 +++++++++++++++++++++
>> libs/vkd3d-shader/vkd3d_shader_private.h | 11 +++++
>> 5 files changed, 114 insertions(+), 37 deletions(-)
>>
>> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
>> index 52b3dd10..78eacf28 100644
>> --- a/libs/vkd3d-shader/hlsl.c
>> +++ b/libs/vkd3d-shader/hlsl.c
>
>> const char *debug_hlsl_type(const struct hlsl_type *type)
>> {
>> + struct vkd3d_string_buffer_list string_buffers;
>> + struct vkd3d_string_buffer *string;
>> const char *ret;
>> - char *string;
>>
>> - if (!(string = hlsl_type_to_string(type)))
>> + vkd3d_string_buffer_list_init(&string_buffers);
>> + if (!(string = hlsl_type_to_string(&string_buffers, type)))
>> return NULL;
>> - ret = vkd3d_dbg_sprintf("%s", string);
>> - vkd3d_free(string);
>> + ret = vkd3d_dbg_sprintf("%s", string->buffer);
>> + vkd3d_string_buffer_release(&string_buffers, string);
>> + vkd3d_string_buffer_list_cleanup(&string_buffers);
>> return ret;
>> }
>
> How painful would it be to pass the context (and thus string_buffers)
> through to this function?
>
Not great—I do end up using it in more places—but not awful.
>> diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h
>> index e837dbcd..2ef3d5da 100644
>> --- a/libs/vkd3d-shader/vkd3d_shader_private.h
>> +++ b/libs/vkd3d-shader/vkd3d_shader_private.h
>> @@ -865,17 +865,28 @@ bool shader_sm4_is_end(void *data, const DWORD **ptr) DECLSPEC_HIDDEN;
>>
>> struct vkd3d_string_buffer
>> {
>> + struct list entry;
>> char *buffer;
>> unsigned int buffer_size;
>> unsigned int content_size;
>> };
>>
>> +struct vkd3d_string_buffer_list
>> +{
>> + struct list list;
>> +};
>
> Since this is the second time we implement it and hindsight is usually
> very good, I'd prefer it if we used an array + vkd3d_array_reserve()
> to store the stack of available vkd3d_string_buffer structs.
Sure, will do.
> Also it would be nice to rename struct vkd3d_string_buffer_list to
> something that explains its function rather than what it is, but as
> usual I don't have any good suggestions...
>
I'm not sure what's a more functionally descriptive name, other than
maybe vkd3d_string_buffer_cache?
Feb. 26, 2021
Re: [PATCH vkd3d 1/6] vkd3d-shader: Return a vkd3d_string_buffer from hlsl_type_to_string().
by Matteo Bruni
On Tue, Feb 23, 2021 at 10:57 PM Zebediah Figura
<zfigura(a)codeweavers.com> wrote:
>
> Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl.c | 62 +++++++++++++-----------
> libs/vkd3d-shader/hlsl.h | 4 +-
> libs/vkd3d-shader/hlsl.y | 20 +++++---
> libs/vkd3d-shader/vkd3d_shader_main.c | 54 +++++++++++++++++++++
> libs/vkd3d-shader/vkd3d_shader_private.h | 11 +++++
> 5 files changed, 114 insertions(+), 37 deletions(-)
>
> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
> index 52b3dd10..78eacf28 100644
> --- a/libs/vkd3d-shader/hlsl.c
> +++ b/libs/vkd3d-shader/hlsl.c
> const char *debug_hlsl_type(const struct hlsl_type *type)
> {
> + struct vkd3d_string_buffer_list string_buffers;
> + struct vkd3d_string_buffer *string;
> const char *ret;
> - char *string;
>
> - if (!(string = hlsl_type_to_string(type)))
> + vkd3d_string_buffer_list_init(&string_buffers);
> + if (!(string = hlsl_type_to_string(&string_buffers, type)))
> return NULL;
> - ret = vkd3d_dbg_sprintf("%s", string);
> - vkd3d_free(string);
> + ret = vkd3d_dbg_sprintf("%s", string->buffer);
> + vkd3d_string_buffer_release(&string_buffers, string);
> + vkd3d_string_buffer_list_cleanup(&string_buffers);
> return ret;
> }
How painful would it be to pass the context (and thus string_buffers)
through to this function?
> diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h
> index e837dbcd..2ef3d5da 100644
> --- a/libs/vkd3d-shader/vkd3d_shader_private.h
> +++ b/libs/vkd3d-shader/vkd3d_shader_private.h
> @@ -865,17 +865,28 @@ bool shader_sm4_is_end(void *data, const DWORD **ptr) DECLSPEC_HIDDEN;
>
> struct vkd3d_string_buffer
> {
> + struct list entry;
> char *buffer;
> unsigned int buffer_size;
> unsigned int content_size;
> };
>
> +struct vkd3d_string_buffer_list
> +{
> + struct list list;
> +};
Since this is the second time we implement it and hindsight is usually
very good, I'd prefer it if we used an array + vkd3d_array_reserve()
to store the stack of available vkd3d_string_buffer structs.
Also it would be nice to rename struct vkd3d_string_buffer_list to
something that explains its function rather than what it is, but as
usual I don't have any good suggestions...
Feb. 26, 2021
Re: [RFC] Wayland driver development update
by Giovanni Mascellani
Hi,
Il 24/02/21 09:34, Alexandre Julliard ha scritto:
> I'm not opposed in principle to having a Wayland driver upstream. In
> fact I started writing one myself many years ago... It got stalled when
> I realized there was essentially no way to do decent window management,
> and that the best we could do would be the equivalent of X11 desktop
> mode, where we manage the windows ourselves. I don't have the impression
> that the situation has improved in the meantime, or that there is any
> interest in improving it.
I have very little knowledge of how Wayland compares with X11 from the
protocol point of view. Could you please elaborate a little bit on what
is missing in Wayland? The only thing I've heard about so far is
changing a window's absolute position. Can be annoying, but it's not a
terrible issue...
My understanding is that X11 is basically in maintenance mode ad
libitum, so as time passes it will lack new features that will get added
only to Wayland. Eventually people might find that using
Wine-with-Wayland, while having problems because Wayland is not perfect,
is still better than Wine-with-Xorg or Wine-with-XWayland, because the
latter do not support the features they like. So I think that having a
Wayland driver would be a good service to at least some users.
On the other hand I don't think, as Zeb was suggesting, that if there is
a Wayland driver, then it should have higher priority than X11. It's
totally sensible to ship it, but require the user to set it as preferred
in winecfg or some other way if they want to use it. Users who believe
that direct Wayland's advantages outweigh its disadvantages will use it,
and the others will not.
My 2 cents, Giovanni.
Feb. 26, 2021