Wine-devel
Threads by month
- ----- 2026 -----
- 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
March 2020
- 72 participants
- 969 discussions
[PATCH 1/4] comctl32/tests/imagelist: Change create_test_bitmap() to give it the ability to create more kinds of bitmaps.
by Ziqing Hui 06 Mar '20
by Ziqing Hui 06 Mar '20
06 Mar '20
Note: create_test_bitmap() can only create 2x1 32pp bitmap before. This patch changed it so it can create different size and different bpp bitmaps.
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/comctl32/tests/imagelist.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
1
0
Signed-off-by: Sven Baars <sbaars(a)codeweavers.com>
---
v4: Renamed things, used got rid of max_len by using heap_alloc,
used '\n' and '\r' instead of their integer values
dlls/d3dx9_36/font.c | 109 ++++++++++++++++++++++++++-----------
dlls/d3dx9_36/tests/core.c | 14 ++---
2 files changed, 83 insertions(+), 40 deletions(-)
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index 8ca35b8c21..71cfddb0d4 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -509,13 +509,42 @@ static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite,
return ret;
}
+static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count,
+ WCHAR *dest, unsigned int *dest_len, int width)
+{
+ unsigned int i = 0;
+ SIZE size;
+
+ *dest_len = 0;
+ while (*count && str[i] != '\n')
+ {
+ --(*count);
+ if (str[i] != '\r')
+ dest[(*dest_len)++] = str[i];
+ ++i;
+ }
+
+ GetTextExtentExPointW(hdc, dest, *dest_len, width, NULL, NULL, &size);
+
+ if (*count && str[i] == '\n')
+ {
+ --(*count);
+ ++i;
+ }
+
+ if (*count)
+ return str + i;
+ return NULL;
+}
+
static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
{
struct d3dx_font *font = impl_from_ID3DXFont(iface);
ID3DXSprite *target = sprite;
+ WCHAR *line;
RECT textrect = {0};
- int lh, x, y;
+ int lh, x, y, width;
int ret = 0;
TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x.\n",
@@ -544,59 +573,71 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
x = textrect.left;
y = textrect.top;
+ width = textrect.right - textrect.left;
lh = font->metrics.tmHeight;
+ line = heap_alloc(count * sizeof(*line));
+ if (!line)
+ return 0;
+
if (!(format & DT_CALCRECT) && !sprite)
{
D3DXCreateSprite(font->device, &target);
ID3DXSprite_Begin(target, 0);
}
- if (!(format & DT_CALCRECT))
+ while (string)
{
- GCP_RESULTSW results;
- D3DXVECTOR3 pos;
- int i;
-
- memset(&results, 0, sizeof(results));
- results.nGlyphs = count;
+ unsigned int line_len;
- results.lpCaretPos = heap_alloc(count * sizeof(*results.lpCaretPos));
- if (!results.lpCaretPos)
- goto cleanup;
+ string = read_line(font->hdc, string, &count, line, &line_len, width);
- results.lpGlyphs = heap_alloc(count * sizeof(*results.lpGlyphs));
- if (!results.lpGlyphs)
+ if (!(format & DT_CALCRECT))
{
- heap_free(results.lpCaretPos);
- goto cleanup;
- }
+ GCP_RESULTSW results;
+ D3DXVECTOR3 pos;
+ unsigned int i;
- GetCharacterPlacementW(font->hdc, string, count, 0, &results, 0);
+ memset(&results, 0, sizeof(results));
+ results.nGlyphs = line_len;
- for (i = 0; i < results.nGlyphs; ++i)
- {
- IDirect3DTexture9 *texture;
- POINT cell_inc;
- RECT black_box;
+ results.lpCaretPos = heap_alloc(line_len * sizeof(*results.lpCaretPos));
+ if (!results.lpCaretPos)
+ goto cleanup;
- ID3DXFont_GetGlyphData(iface, results.lpGlyphs[i], &texture, &black_box, &cell_inc);
+ results.lpGlyphs = heap_alloc(line_len * sizeof(*results.lpGlyphs));
+ if (!results.lpGlyphs)
+ {
+ heap_free(results.lpCaretPos);
+ goto cleanup;
+ }
- if (!texture)
- continue;
+ GetCharacterPlacementW(font->hdc, line, line_len, 0, &results, 0);
- pos.x = cell_inc.x + x + results.lpCaretPos[i];
- pos.y = cell_inc.y + y;
+ for (i = 0; i < results.nGlyphs; ++i)
+ {
+ IDirect3DTexture9 *texture;
+ POINT cell_inc;
+ RECT black_box;
- ID3DXSprite_Draw(target, texture, &black_box, NULL, &pos, color);
- IDirect3DTexture9_Release(texture);
- }
+ ID3DXFont_GetGlyphData(iface, results.lpGlyphs[i], &texture, &black_box, &cell_inc);
- heap_free(results.lpCaretPos);
- heap_free(results.lpGlyphs);
+ if (!texture)
+ continue;
+
+ pos.x = cell_inc.x + x + results.lpCaretPos[i];
+ pos.y = cell_inc.y + y;
+
+ ID3DXSprite_Draw(target, texture, &black_box, NULL, &pos, color);
+ IDirect3DTexture9_Release(texture);
+ }
+
+ heap_free(results.lpCaretPos);
+ heap_free(results.lpGlyphs);
+ }
+ y += lh;
}
- y += lh;
ret = y - textrect.top;
@@ -607,6 +648,8 @@ cleanup:
ID3DXSprite_Release(target);
}
+ heap_free(line);
+
return ret;
}
diff --git a/dlls/d3dx9_36/tests/core.c b/dlls/d3dx9_36/tests/core.c
index c1e0eac0c8..c6f5beff43 100644
--- a/dlls/d3dx9_36/tests/core.c
+++ b/dlls/d3dx9_36/tests/core.c
@@ -762,19 +762,19 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
todo_wine ok(height == 96, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, 0, 0xff00ff);
- todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
+ ok(height == 24, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"a\r\na", -1, &rect, 0, 0xff00ff);
- todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
+ ok(height == 24, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"a\ra", -1, &rect, 0, 0xff00ff);
ok(height == 12, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, DT_SINGLELINE, 0xff00ff);
- ok(height == 12, "Got unexpected height %d.\n", height);
+ todo_wine ok(height == 12, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, 0, 0xff00ff);
- todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
+ ok(height == 24, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
todo_wine ok(height == 36, "Got unexpected height %d.\n", height);
@@ -783,7 +783,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
todo_wine ok(height == 48, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, DT_NOCLIP, 0xff00ff);
- todo_wine ok(height == 72, "Got unexpected height %d.\n", height);
+ ok(height == 72, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\t", -1, &rect, DT_WORDBREAK, 0xff00ff);
todo_wine ok(height == 0, "Got unexpected height %d.\n", height);
@@ -834,10 +834,10 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
todo_wine ok(height == 32, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT, 0xff00ff);
- todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
+ ok(height == 24, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER, 0xff00ff);
- todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
+ ok(height == 24, "Got unexpected height %d.\n", height);
ID3DXFont_Release(font);
}
--
2.24.0
2
5
[PATCH 1/6] d3dcompiler: Return a struct source_location from set_location().
by Zebediah Figura 06 Mar '20
by Zebediah Figura 06 Mar '20
06 Mar '20
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/d3dcompiler_43/hlsl.y | 153 +++++++++++++++----------------------
1 file changed, 63 insertions(+), 90 deletions(-)
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 3d04677f2ec..e40494ddff8 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -32,7 +32,7 @@ int hlsl_lex(void);
struct hlsl_parse_ctx hlsl_ctx;
struct YYLTYPE;
-static void set_location(struct source_location *loc, const struct YYLTYPE *l);
+static struct source_location get_location(const struct YYLTYPE *l);
void WINAPIV hlsl_message(const char *fmt, ...)
{
@@ -1214,7 +1214,7 @@ struct_declaration: struct_spec variables_def_optional ';'
{
struct source_location loc;
- set_location(&loc, &@3);
+ loc = get_location(&@3);
if (!$2)
{
if (!$1->name)
@@ -1236,7 +1236,7 @@ named_struct_spec: var_modifiers KW_STRUCT any_identifier '{' fields_list
struct source_location loc;
TRACE("Structure %s declaration.\n", debugstr_a($3));
- set_location(&loc, &@1);
+ loc = get_location(&@1);
check_invalid_matrix_modifiers($1, &loc);
$$ = new_struct_type($3, $1, $5);
@@ -1261,7 +1261,7 @@ unnamed_struct_spec: var_modifiers KW_STRUCT '{' fields_list '}'
struct source_location loc;
TRACE("Anonymous structure declaration.\n");
- set_location(&loc, &@1);
+ loc = get_location(&@1);
check_invalid_matrix_modifiers($1, &loc);
$$ = new_struct_type(NULL, $1, $4);
}
@@ -1344,7 +1344,7 @@ func_prototype: var_modifiers type var_identifier '(' parameters ')' c
}
$$.name = $3;
$$.decl->semantic = $7.semantic;
- set_location(&$$.decl->loc, &@3);
+ $$.decl->loc = get_location(&@3);
hlsl_ctx.cur_function = $$.decl;
}
@@ -1419,7 +1419,7 @@ param_list: parameter
$$ = d3dcompiler_alloc(sizeof(*$$));
list_init($$);
- set_location(&loc, &@1);
+ loc = get_location(&@1);
if (!add_func_parameter($$, &$1, &loc))
{
ERR("Error adding function parameter %s.\n", $1.name);
@@ -1432,7 +1432,7 @@ param_list: parameter
struct source_location loc;
$$ = $1;
- set_location(&loc, &@3);
+ loc = get_location(&@3);
if (!add_func_parameter($$, &$3, &loc))
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
@@ -1594,7 +1594,7 @@ typedef: KW_TYPEDEF var_modifiers type type_specs ';'
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
if (!add_typedef($2, $3, $4, &loc))
YYABORT;
}
@@ -1602,7 +1602,7 @@ typedef: KW_TYPEDEF var_modifiers type type_specs ';'
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
if (!add_typedef(0, $2, $3, &loc))
YYABORT;
}
@@ -1622,7 +1622,7 @@ type_specs: type_spec
type_spec: any_identifier array
{
$$ = d3dcompiler_alloc(sizeof(*$$));
- set_location(&$$->loc, &@1);
+ $$->loc = get_location(&@1);
$$->name = $1;
$$->array_size = $2;
}
@@ -1656,7 +1656,7 @@ variables_def: variable_def
variable_def: any_identifier array colon_attribute
{
$$ = d3dcompiler_alloc(sizeof(*$$));
- set_location(&$$->loc, &@1);
+ $$->loc = get_location(&@1);
$$->name = $1;
$$->array_size = $2;
$$->semantic = $3.semantic;
@@ -1666,7 +1666,7 @@ variable_def: any_identifier array colon_attribute
{
TRACE("Declaration with initializer.\n");
$$ = d3dcompiler_alloc(sizeof(*$$));
- set_location(&$$->loc, &@1);
+ $$->loc = get_location(&@1);
$$->name = $1;
$$->array_size = $2;
$$->semantic = $3.semantic;
@@ -1803,11 +1803,8 @@ statement: declaration_statement
jump_statement: KW_RETURN expr ';'
{
- struct source_location loc;
struct hlsl_ir_jump *jump;
-
- set_location(&loc, &@1);
- if (!(jump = new_return(node_from_list($2), loc)))
+ if (!(jump = new_return(node_from_list($2), get_location(&@1))))
YYABORT;
$$ = $2;
@@ -1815,13 +1812,9 @@ jump_statement: KW_RETURN expr ';'
}
| KW_RETURN ';'
{
- struct source_location loc;
struct hlsl_ir_jump *jump;
-
- set_location(&loc, &@1);
- if (!(jump = new_return(NULL, loc)))
+ if (!(jump = new_return(NULL, get_location(&@1))))
YYABORT;
-
$$ = d3dcompiler_alloc(sizeof(*$$));
list_init($$);
list_add_tail($$, &jump->node.entry);
@@ -1836,7 +1829,7 @@ selection_statement: KW_IF '(' expr ')' if_body
YYABORT;
}
instr->node.type = HLSL_IR_IF;
- set_location(&instr->node.loc, &@1);
+ instr->node.loc = get_location(&@1);
instr->condition = node_from_list($3);
instr->then_instrs = $5.then_instrs;
instr->else_instrs = $5.else_instrs;
@@ -1864,20 +1857,20 @@ if_body: statement
loop_statement: KW_WHILE '(' expr ')' statement
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
$$ = create_loop(LOOP_WHILE, NULL, $3, NULL, $5, &loc);
}
| KW_DO statement KW_WHILE '(' expr ')' ';'
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
$$ = create_loop(LOOP_DO_WHILE, NULL, $5, NULL, $2, &loc);
}
| KW_FOR '(' scope_start expr_statement expr_statement expr ')' statement
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
$$ = create_loop(LOOP_FOR, $4, $5, $6, $8, &loc);
pop_scope(&hlsl_ctx);
}
@@ -1885,7 +1878,7 @@ loop_statement: KW_WHILE '(' expr ')' statement
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
if (!$4)
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_WARNING,
"no expressions in for loop initializer");
@@ -1912,7 +1905,7 @@ primary_expr: C_FLOAT
YYABORT;
}
c->node.type = HLSL_IR_CONSTANT;
- set_location(&c->node.loc, &yylloc);
+ c->node.loc = get_location(&yylloc);
c->node.data_type = new_hlsl_type(d3dcompiler_strdup("float"), HLSL_CLASS_SCALAR, HLSL_TYPE_FLOAT, 1, 1);
c->v.value.f[0] = $1;
if (!($$ = make_list(&c->node)))
@@ -1927,7 +1920,7 @@ primary_expr: C_FLOAT
YYABORT;
}
c->node.type = HLSL_IR_CONSTANT;
- set_location(&c->node.loc, &yylloc);
+ c->node.loc = get_location(&yylloc);
c->node.data_type = new_hlsl_type(d3dcompiler_strdup("int"), HLSL_CLASS_SCALAR, HLSL_TYPE_INT, 1, 1);
c->v.value.i[0] = $1;
if (!($$ = make_list(&c->node)))
@@ -1942,7 +1935,7 @@ primary_expr: C_FLOAT
YYABORT;
}
c->node.type = HLSL_IR_CONSTANT;
- set_location(&c->node.loc, &yylloc);
+ c->node.loc = get_location(&yylloc);
c->node.data_type = new_hlsl_type(d3dcompiler_strdup("bool"), HLSL_CLASS_SCALAR, HLSL_TYPE_BOOL, 1, 1);
c->v.value.b[0] = $1;
if (!($$ = make_list(&c->node)))
@@ -1962,7 +1955,7 @@ primary_expr: C_FLOAT
}
if ((deref = new_var_deref(var)))
{
- set_location(&deref->node.loc, &@1);
+ deref->node.loc = get_location(&@1);
if (!($$ = make_list(&deref->node)))
YYABORT;
}
@@ -1983,7 +1976,7 @@ postfix_expr: primary_expr
struct source_location loc;
struct hlsl_ir_node *inc;
- set_location(&loc, &@2);
+ loc = get_location(&@2);
if (node_from_list($1)->data_type->modifiers & HLSL_MODIFIER_CONST)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
@@ -2001,7 +1994,7 @@ postfix_expr: primary_expr
struct source_location loc;
struct hlsl_ir_node *inc;
- set_location(&loc, &@2);
+ loc = get_location(&@2);
if (node_from_list($1)->data_type->modifiers & HLSL_MODIFIER_CONST)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
@@ -2019,7 +2012,7 @@ postfix_expr: primary_expr
struct hlsl_ir_node *node = node_from_list($1);
struct source_location loc;
- set_location(&loc, &@2);
+ loc = get_location(&@2);
if (node->data_type->type == HLSL_CLASS_STRUCT)
{
struct hlsl_type *type = node->data_type;
@@ -2085,7 +2078,7 @@ postfix_expr: primary_expr
YYABORT;
}
deref->node.type = HLSL_IR_DEREF;
- set_location(&loc, &@2);
+ loc = get_location(&@2);
deref->node.loc = loc;
if (expr_type->type == HLSL_CLASS_ARRAY)
{
@@ -2159,7 +2152,7 @@ postfix_expr: primary_expr
constructor = d3dcompiler_alloc(sizeof(*constructor));
constructor->node.type = HLSL_IR_CONSTRUCTOR;
- set_location(&constructor->node.loc, &@3);
+ constructor->node.loc = get_location(&@3);
constructor->node.data_type = $2;
constructor->args_count = $4.args_count;
memcpy(constructor->args, $4.args, $4.args_count * sizeof(*$4.args));
@@ -2175,7 +2168,7 @@ unary_expr: postfix_expr
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
if (node_from_list($2)->data_type->modifiers & HLSL_MODIFIER_CONST)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
@@ -2188,7 +2181,7 @@ unary_expr: postfix_expr
{
struct source_location loc;
- set_location(&loc, &@1);
+ loc = get_location(&@1);
if (node_from_list($2)->data_type->modifiers & HLSL_MODIFIER_CONST)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
@@ -2201,7 +2194,6 @@ unary_expr: postfix_expr
{
enum hlsl_ir_expr_op ops[] = {0, HLSL_IR_UNOP_NEG,
HLSL_IR_UNOP_LOGIC_NOT, HLSL_IR_UNOP_BIT_NOT};
- struct source_location loc;
if ($1 == UNARY_OP_PLUS)
{
@@ -2209,8 +2201,7 @@ unary_expr: postfix_expr
}
else
{
- set_location(&loc, &@1);
- $$ = append_unop($2, new_unary_expr(ops[$1], node_from_list($2), loc));
+ $$ = append_unop($2, new_unary_expr(ops[$1], node_from_list($2), get_location(&@1)));
}
}
/* var_modifiers just to avoid shift/reduce conflicts */
@@ -2220,7 +2211,7 @@ unary_expr: postfix_expr
struct hlsl_type *dst_type;
struct source_location loc;
- set_location(&loc, &@3);
+ loc = get_location(&@3);
if ($2)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
@@ -2267,24 +2258,18 @@ mul_expr: unary_expr
}
| mul_expr '*' unary_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_MUL, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_MUL,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
| mul_expr '/' unary_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_DIV, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_DIV,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
| mul_expr '%' unary_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_MOD, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_MOD,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
add_expr: mul_expr
@@ -2293,17 +2278,13 @@ add_expr: mul_expr
}
| add_expr '+' mul_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_ADD, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_ADD,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
| add_expr '-' mul_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_SUB, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_SUB,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
shift_expr: add_expr
@@ -2325,31 +2306,23 @@ relational_expr: shift_expr
}
| relational_expr '<' shift_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_LESS, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_LESS,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
| relational_expr '>' shift_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_GREATER, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_GREATER,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
| relational_expr OP_LE shift_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_LEQUAL, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_LEQUAL,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
| relational_expr OP_GE shift_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_GEQUAL, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_GEQUAL,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
equality_expr: relational_expr
@@ -2358,17 +2331,13 @@ equality_expr: relational_expr
}
| equality_expr OP_EQ relational_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_EQUAL, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_EQUAL,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
| equality_expr OP_NE relational_expr
{
- struct source_location loc;
-
- set_location(&loc, &@2);
- $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_NEQUAL, node_from_list($1), node_from_list($3), loc));
+ $$ = append_binop($1, $3, new_binary_expr(HLSL_IR_BINOP_NEQUAL,
+ node_from_list($1), node_from_list($3), get_location(&@2)));
}
bitand_expr: equality_expr
@@ -2434,7 +2403,7 @@ assignment_expr: conditional_expr
struct source_location loc;
struct hlsl_ir_node *instr;
- set_location(&loc, &@2);
+ loc = get_location(&@2);
if (node_from_list($1)->data_type->modifiers & HLSL_MODIFIER_CONST)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
@@ -2506,11 +2475,15 @@ expr: assignment_expr
%%
-static void set_location(struct source_location *loc, const struct YYLTYPE *l)
+static struct source_location get_location(const struct YYLTYPE *l)
{
- loc->file = hlsl_ctx.source_file;
- loc->line = l->first_line;
- loc->col = l->first_column;
+ const struct source_location loc =
+ {
+ .file = hlsl_ctx.source_file,
+ .line = l->first_line,
+ .col = l->first_column,
+ };
+ return loc;
}
static DWORD add_modifier(DWORD modifiers, DWORD mod, const struct YYLTYPE *loc)
--
2.25.1
2
11
This patchset eliminates heap allocations in many of the Vulkan commands,
which were happening thousands of times per frame.
It does this by replacing the heap_allocs previously used with alloca,
which will allocate these structures and arrays of structures on the stack.
They are all very small, and the size of the arrays will also be small, so
this is safe for us to do.
There aren't really any x86 Vulkan apps in the wild, so this change
primarily only affects usage with DXVK + D3D9 (and some D3D10/11 apps).
Joshua Ashton (4):
winevulkan: Define alloca and forceinline
winevulkan: Replace temp heap_allocs with alloca
winevulkan: Remove unnecessary checks in wine_vkCmdExecuteCommands
winevulkan: Regenerate thunks
dlls/winevulkan/make_vulkan | 142 +---------
dlls/winevulkan/vulkan.c | 16 +-
dlls/winevulkan/vulkan_private.h | 12 +
dlls/winevulkan/vulkan_thunks.c | 436 +++++++------------------------
4 files changed, 115 insertions(+), 491 deletions(-)
--
2.25.1
4
4
05 Mar '20
It is not interesting to account for IPin::QueryDirection failing.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/qcap/capturegraph.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/dlls/qcap/capturegraph.c b/dlls/qcap/capturegraph.c
index f258ccb6499..8c85f59bb4c 100644
--- a/dlls/qcap/capturegraph.c
+++ b/dlls/qcap/capturegraph.c
@@ -574,25 +574,24 @@ fnCaptureGraphBuilder2_CopyCaptureFile(ICaptureGraphBuilder2 * iface,
return E_NOTIMPL;
}
-static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, const GUID *type, BOOL unconnected)
+static BOOL pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, const GUID *type, BOOL unconnected)
{
IPin *partner;
PIN_DIRECTION pindir;
HRESULT hr;
- hr = IPin_QueryDirection(pin, &pindir);
+ if (FAILED(hr = IPin_QueryDirection(pin, &pindir)))
+ ERR("Failed to query direction, hr %#x.\n", hr);
if (unconnected && IPin_ConnectedTo(pin, &partner) == S_OK && partner!=NULL)
{
IPin_Release(partner);
TRACE("No match, %p already connected to %p\n", pin, partner);
- return FAILED(hr) ? hr : S_FALSE;
+ return FALSE;
}
- if (FAILED(hr))
- return hr;
- if (SUCCEEDED(hr) && pindir != direction)
- return S_FALSE;
+ if (pindir != direction)
+ return FALSE;
if (cat)
{
@@ -602,13 +601,13 @@ static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat,
hr = IPin_QueryInterface(pin, &IID_IKsPropertySet, (void**)&props);
if (FAILED(hr))
- return S_FALSE;
+ return FALSE;
hr = IKsPropertySet_Get(props, &ROPSETID_Pin, 0, NULL,
0, &category, sizeof(category), &fetched);
IKsPropertySet_Release(props);
if (FAILED(hr) || !IsEqualIID(&category, cat))
- return S_FALSE;
+ return FALSE;
}
if (type)
@@ -619,14 +618,14 @@ static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat,
hr = IPin_EnumMediaTypes(pin, &types);
if (FAILED(hr))
- return S_FALSE;
+ return FALSE;
IEnumMediaTypes_Reset(types);
while (1) {
if (IEnumMediaTypes_Next(types, 1, &media_type, &fetched) != S_OK || fetched != 1)
{
IEnumMediaTypes_Release(types);
- return S_FALSE;
+ return FALSE;
}
if (IsEqualIID(&media_type->majortype, type))
@@ -640,7 +639,7 @@ static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat,
}
TRACE("Pin matched\n");
- return S_OK;
+ return TRUE;
}
static HRESULT WINAPI
@@ -706,13 +705,10 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
}
TRACE("Testing match\n");
- hr = pin_matches(pin, pindir, pCategory, pType, fUnconnected);
- if (hr == S_OK && numcurrent++ == num)
+ if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) && numcurrent++ == num)
break;
IPin_Release(pin);
pin = NULL;
- if (FAILED(hr))
- break;
}
IEnumPins_Release(enumpins);
IBaseFilter_Release(filter);
@@ -723,7 +719,7 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
return E_FAIL;
}
}
- else if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) != S_OK)
+ else if (!pin_matches(pin, pindir, pCategory, pType, fUnconnected))
{
IPin_Release(pin);
return E_FAIL;
--
2.25.1
2
5
[PATCH 1/6] include: Use public field names for FILE_RENAME_INFORMATION.
by Zebediah Figura 05 Mar '20
by Zebediah Figura 05 Mar '20
05 Mar '20
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
Perhaps it would also make sense to move this definition to ddk/ntifs.h?
dlls/ntdll/file.c | 4 +--
dlls/ntdll/tests/file.c | 68 ++++++++++++++++++++---------------------
include/winternl.h | 4 +--
3 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index fd83c724421..dc9a67fcffa 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -2798,14 +2798,14 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
attr.Length = sizeof(attr);
attr.ObjectName = &name_str;
- attr.RootDirectory = info->RootDir;
+ attr.RootDirectory = info->RootDirectory;
attr.Attributes = OBJ_CASE_INSENSITIVE;
io->u.Status = nt_to_unix_file_name_attr( &attr, &unix_name, FILE_OPEN_IF );
if (io->u.Status != STATUS_SUCCESS && io->u.Status != STATUS_NO_SUCH_FILE)
break;
- if (!info->Replace && io->u.Status == STATUS_SUCCESS)
+ if (!info->ReplaceIfExists && io->u.Status == STATUS_SUCCESS)
{
RtlFreeAnsiString( &unix_name );
io->u.Status = STATUS_OBJECT_NAME_COLLISION;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index dd188fd9132..561cf800433 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -1502,8 +1502,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1540,8 +1540,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1570,8 +1570,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1603,8 +1603,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1637,8 +1637,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1672,8 +1672,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1719,8 +1719,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1759,8 +1759,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1795,8 +1795,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1829,8 +1829,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1865,8 +1865,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1902,8 +1902,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1938,8 +1938,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1977,8 +1977,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -2011,8 +2011,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -2044,8 +2044,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -2079,8 +2079,8 @@ static void test_file_rename_information(void)
ok( handle2 != INVALID_HANDLE_VALUE, "CreateFileW failed\n" );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + lstrlenW(filename) * sizeof(WCHAR) );
- fri->Replace = FALSE;
- fri->RootDir = handle2;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = handle2;
fri->FileNameLength = lstrlenW(filename) * sizeof(WCHAR);
memcpy( fri->FileName, filename, fri->FileNameLength );
diff --git a/include/winternl.h b/include/winternl.h
index 4c6e063338e..19e8965e99f 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -632,8 +632,8 @@ typedef struct _FILE_NAME_INFORMATION {
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
typedef struct _FILE_RENAME_INFORMATION {
- BOOLEAN Replace;
- HANDLE RootDir;
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
--
2.25.1
2
8
[PATCH 3/4] winevulkan: Remove unnecessary checks in wine_vkCmdExecuteCommands
by Joshua Ashton 05 Mar '20
by Joshua Ashton 05 Mar '20
05 Mar '20
The Vulkan spec states commandBufferCount must be greater than zero and pCommandBuffers must be a valid pointer.
Signed-off-by: Joshua Ashton <joshua(a)froggi.es>
---
dlls/winevulkan/vulkan.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 1cc1b4f61f..f767b86dc4 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -517,9 +517,6 @@ void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer buffer, uint32_t count,
TRACE("%p %u %p\n", buffer, count, buffers);
- if (!buffers || !count)
- return;
-
tmp_buffers = WINEVULKAN_ALLOCA(count * sizeof(*tmp_buffers));
for (i = 0; i < count; i++)
--
2.25.1
3
4
Signed-off-by: Joshua Ashton <joshua(a)froggi.es>
---
dlls/winevulkan/vulkan_thunks.c | 436 +++++++-------------------------
1 file changed, 95 insertions(+), 341 deletions(-)
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c
index fecf9ab502..8953a0f0bd 100644
--- a/dlls/winevulkan/vulkan_thunks.c
+++ b/dlls/winevulkan/vulkan_thunks.c
@@ -43,7 +43,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
#if defined(USE_STRUCT_CONVERSION)
-static inline void convert_VkAcquireNextImageInfoKHR_win_to_host(const VkAcquireNextImageInfoKHR *in, VkAcquireNextImageInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkAcquireNextImageInfoKHR_win_to_host(const VkAcquireNextImageInfoKHR *in, VkAcquireNextImageInfoKHR_host *out)
{
if (!in) return;
@@ -56,7 +56,7 @@ static inline void convert_VkAcquireNextImageInfoKHR_win_to_host(const VkAcquire
out->deviceMask = in->deviceMask;
}
-static inline void convert_VkAcquireProfilingLockInfoKHR_win_to_host(const VkAcquireProfilingLockInfoKHR *in, VkAcquireProfilingLockInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkAcquireProfilingLockInfoKHR_win_to_host(const VkAcquireProfilingLockInfoKHR *in, VkAcquireProfilingLockInfoKHR_host *out)
{
if (!in) return;
@@ -66,7 +66,7 @@ static inline void convert_VkAcquireProfilingLockInfoKHR_win_to_host(const VkAcq
out->timeout = in->timeout;
}
-static inline void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescriptorSetAllocateInfo *in, VkDescriptorSetAllocateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescriptorSetAllocateInfo *in, VkDescriptorSetAllocateInfo_host *out)
{
if (!in) return;
@@ -77,7 +77,7 @@ static inline void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescr
out->pSetLayouts = in->pSetLayouts;
}
-static inline void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAllocateInfo *in, VkMemoryAllocateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAllocateInfo *in, VkMemoryAllocateInfo_host *out)
{
if (!in) return;
@@ -87,14 +87,14 @@ static inline void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAlloca
out->memoryTypeIndex = in->memoryTypeIndex;
}
-static inline VkCommandBufferInheritanceInfo_host *convert_VkCommandBufferInheritanceInfo_array_win_to_host(const VkCommandBufferInheritanceInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkCommandBufferInheritanceInfo_host *convert_VkCommandBufferInheritanceInfo_array_win_to_host(const VkCommandBufferInheritanceInfo *in, uint32_t count)
{
VkCommandBufferInheritanceInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -110,14 +110,7 @@ static inline VkCommandBufferInheritanceInfo_host *convert_VkCommandBufferInheri
return out;
}
-static inline void free_VkCommandBufferInheritanceInfo_array(VkCommandBufferInheritanceInfo_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline void convert_VkCommandBufferBeginInfo_win_to_host(const VkCommandBufferBeginInfo *in, VkCommandBufferBeginInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkCommandBufferBeginInfo_win_to_host(const VkCommandBufferBeginInfo *in, VkCommandBufferBeginInfo_host *out)
{
if (!in) return;
@@ -127,19 +120,14 @@ static inline void convert_VkCommandBufferBeginInfo_win_to_host(const VkCommandB
out->pInheritanceInfo = convert_VkCommandBufferInheritanceInfo_array_win_to_host(in->pInheritanceInfo, 1);
}
-static inline void free_VkCommandBufferBeginInfo(VkCommandBufferBeginInfo_host *in)
-{
- free_VkCommandBufferInheritanceInfo_array((VkCommandBufferInheritanceInfo_host *)in->pInheritanceInfo, 1);
-}
-
-static inline VkBindAccelerationStructureMemoryInfoNV_host *convert_VkBindAccelerationStructureMemoryInfoNV_array_win_to_host(const VkBindAccelerationStructureMemoryInfoNV *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkBindAccelerationStructureMemoryInfoNV_host *convert_VkBindAccelerationStructureMemoryInfoNV_array_win_to_host(const VkBindAccelerationStructureMemoryInfoNV *in, uint32_t count)
{
VkBindAccelerationStructureMemoryInfoNV_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -154,21 +142,14 @@ static inline VkBindAccelerationStructureMemoryInfoNV_host *convert_VkBindAccele
return out;
}
-static inline void free_VkBindAccelerationStructureMemoryInfoNV_array(VkBindAccelerationStructureMemoryInfoNV_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkBindBufferMemoryInfo_host *convert_VkBindBufferMemoryInfo_array_win_to_host(const VkBindBufferMemoryInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkBindBufferMemoryInfo_host *convert_VkBindBufferMemoryInfo_array_win_to_host(const VkBindBufferMemoryInfo *in, uint32_t count)
{
VkBindBufferMemoryInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -181,21 +162,14 @@ static inline VkBindBufferMemoryInfo_host *convert_VkBindBufferMemoryInfo_array_
return out;
}
-static inline void free_VkBindBufferMemoryInfo_array(VkBindBufferMemoryInfo_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkBindImageMemoryInfo_host *convert_VkBindImageMemoryInfo_array_win_to_host(const VkBindImageMemoryInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkBindImageMemoryInfo_host *convert_VkBindImageMemoryInfo_array_win_to_host(const VkBindImageMemoryInfo *in, uint32_t count)
{
VkBindImageMemoryInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -208,14 +182,7 @@ static inline VkBindImageMemoryInfo_host *convert_VkBindImageMemoryInfo_array_wi
return out;
}
-static inline void free_VkBindImageMemoryInfo_array(VkBindImageMemoryInfo_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline void convert_VkConditionalRenderingBeginInfoEXT_win_to_host(const VkConditionalRenderingBeginInfoEXT *in, VkConditionalRenderingBeginInfoEXT_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkConditionalRenderingBeginInfoEXT_win_to_host(const VkConditionalRenderingBeginInfoEXT *in, VkConditionalRenderingBeginInfoEXT_host *out)
{
if (!in) return;
@@ -226,7 +193,7 @@ static inline void convert_VkConditionalRenderingBeginInfoEXT_win_to_host(const
out->flags = in->flags;
}
-static inline void convert_VkRenderPassBeginInfo_win_to_host(const VkRenderPassBeginInfo *in, VkRenderPassBeginInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkRenderPassBeginInfo_win_to_host(const VkRenderPassBeginInfo *in, VkRenderPassBeginInfo_host *out)
{
if (!in) return;
@@ -239,7 +206,7 @@ static inline void convert_VkRenderPassBeginInfo_win_to_host(const VkRenderPassB
out->pClearValues = in->pClearValues;
}
-static inline void convert_VkGeometryTrianglesNV_win_to_host(const VkGeometryTrianglesNV *in, VkGeometryTrianglesNV_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkGeometryTrianglesNV_win_to_host(const VkGeometryTrianglesNV *in, VkGeometryTrianglesNV_host *out)
{
if (!in) return;
@@ -258,7 +225,7 @@ static inline void convert_VkGeometryTrianglesNV_win_to_host(const VkGeometryTri
out->transformOffset = in->transformOffset;
}
-static inline void convert_VkGeometryAABBNV_win_to_host(const VkGeometryAABBNV *in, VkGeometryAABBNV_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkGeometryAABBNV_win_to_host(const VkGeometryAABBNV *in, VkGeometryAABBNV_host *out)
{
if (!in) return;
@@ -270,7 +237,7 @@ static inline void convert_VkGeometryAABBNV_win_to_host(const VkGeometryAABBNV *
out->offset = in->offset;
}
-static inline void convert_VkGeometryDataNV_win_to_host(const VkGeometryDataNV *in, VkGeometryDataNV_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkGeometryDataNV_win_to_host(const VkGeometryDataNV *in, VkGeometryDataNV_host *out)
{
if (!in) return;
@@ -278,14 +245,14 @@ static inline void convert_VkGeometryDataNV_win_to_host(const VkGeometryDataNV *
convert_VkGeometryAABBNV_win_to_host(&in->aabbs, &out->aabbs);
}
-static inline VkGeometryNV_host *convert_VkGeometryNV_array_win_to_host(const VkGeometryNV *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkGeometryNV_host *convert_VkGeometryNV_array_win_to_host(const VkGeometryNV *in, uint32_t count)
{
VkGeometryNV_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -298,14 +265,7 @@ static inline VkGeometryNV_host *convert_VkGeometryNV_array_win_to_host(const Vk
return out;
}
-static inline void free_VkGeometryNV_array(VkGeometryNV_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline void convert_VkAccelerationStructureInfoNV_win_to_host(const VkAccelerationStructureInfoNV *in, VkAccelerationStructureInfoNV_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkAccelerationStructureInfoNV_win_to_host(const VkAccelerationStructureInfoNV *in, VkAccelerationStructureInfoNV_host *out)
{
if (!in) return;
@@ -318,19 +278,14 @@ static inline void convert_VkAccelerationStructureInfoNV_win_to_host(const VkAcc
out->pGeometries = convert_VkGeometryNV_array_win_to_host(in->pGeometries, in->geometryCount);
}
-static inline void free_VkAccelerationStructureInfoNV(VkAccelerationStructureInfoNV_host *in)
-{
- free_VkGeometryNV_array((VkGeometryNV_host *)in->pGeometries, in->geometryCount);
-}
-
-static inline VkBufferCopy_host *convert_VkBufferCopy_array_win_to_host(const VkBufferCopy *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkBufferCopy_host *convert_VkBufferCopy_array_win_to_host(const VkBufferCopy *in, uint32_t count)
{
VkBufferCopy_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].srcOffset = in[i].srcOffset;
@@ -341,21 +296,14 @@ static inline VkBufferCopy_host *convert_VkBufferCopy_array_win_to_host(const Vk
return out;
}
-static inline void free_VkBufferCopy_array(VkBufferCopy_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkBufferImageCopy_host *convert_VkBufferImageCopy_array_win_to_host(const VkBufferImageCopy *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkBufferImageCopy_host *convert_VkBufferImageCopy_array_win_to_host(const VkBufferImageCopy *in, uint32_t count)
{
VkBufferImageCopy_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].bufferOffset = in[i].bufferOffset;
@@ -369,21 +317,14 @@ static inline VkBufferImageCopy_host *convert_VkBufferImageCopy_array_win_to_hos
return out;
}
-static inline void free_VkBufferImageCopy_array(VkBufferImageCopy_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkBufferMemoryBarrier_host *convert_VkBufferMemoryBarrier_array_win_to_host(const VkBufferMemoryBarrier *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkBufferMemoryBarrier_host *convert_VkBufferMemoryBarrier_array_win_to_host(const VkBufferMemoryBarrier *in, uint32_t count)
{
VkBufferMemoryBarrier_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -400,21 +341,14 @@ static inline VkBufferMemoryBarrier_host *convert_VkBufferMemoryBarrier_array_wi
return out;
}
-static inline void free_VkBufferMemoryBarrier_array(VkBufferMemoryBarrier_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkImageMemoryBarrier_host *convert_VkImageMemoryBarrier_array_win_to_host(const VkImageMemoryBarrier *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkImageMemoryBarrier_host *convert_VkImageMemoryBarrier_array_win_to_host(const VkImageMemoryBarrier *in, uint32_t count)
{
VkImageMemoryBarrier_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -432,21 +366,14 @@ static inline VkImageMemoryBarrier_host *convert_VkImageMemoryBarrier_array_win_
return out;
}
-static inline void free_VkImageMemoryBarrier_array(VkImageMemoryBarrier_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkDescriptorImageInfo_host *convert_VkDescriptorImageInfo_array_win_to_host(const VkDescriptorImageInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkDescriptorImageInfo_host *convert_VkDescriptorImageInfo_array_win_to_host(const VkDescriptorImageInfo *in, uint32_t count)
{
VkDescriptorImageInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sampler = in[i].sampler;
@@ -457,21 +384,14 @@ static inline VkDescriptorImageInfo_host *convert_VkDescriptorImageInfo_array_wi
return out;
}
-static inline void free_VkDescriptorImageInfo_array(VkDescriptorImageInfo_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkDescriptorBufferInfo_host *convert_VkDescriptorBufferInfo_array_win_to_host(const VkDescriptorBufferInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkDescriptorBufferInfo_host *convert_VkDescriptorBufferInfo_array_win_to_host(const VkDescriptorBufferInfo *in, uint32_t count)
{
VkDescriptorBufferInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].buffer = in[i].buffer;
@@ -482,21 +402,14 @@ static inline VkDescriptorBufferInfo_host *convert_VkDescriptorBufferInfo_array_
return out;
}
-static inline void free_VkDescriptorBufferInfo_array(VkDescriptorBufferInfo_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkWriteDescriptorSet_host *convert_VkWriteDescriptorSet_array_win_to_host(const VkWriteDescriptorSet *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkWriteDescriptorSet_host *convert_VkWriteDescriptorSet_array_win_to_host(const VkWriteDescriptorSet *in, uint32_t count)
{
VkWriteDescriptorSet_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -514,21 +427,7 @@ static inline VkWriteDescriptorSet_host *convert_VkWriteDescriptorSet_array_win_
return out;
}
-static inline void free_VkWriteDescriptorSet_array(VkWriteDescriptorSet_host *in, uint32_t count)
-{
- unsigned int i;
-
- if (!in) return;
-
- for (i = 0; i < count; i++)
- {
- free_VkDescriptorImageInfo_array((VkDescriptorImageInfo_host *)in[i].pImageInfo, in[i].descriptorCount);
- free_VkDescriptorBufferInfo_array((VkDescriptorBufferInfo_host *)in[i].pBufferInfo, in[i].descriptorCount);
- }
- heap_free(in);
-}
-
-static inline void convert_VkPerformanceMarkerInfoINTEL_win_to_host(const VkPerformanceMarkerInfoINTEL *in, VkPerformanceMarkerInfoINTEL_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPerformanceMarkerInfoINTEL_win_to_host(const VkPerformanceMarkerInfoINTEL *in, VkPerformanceMarkerInfoINTEL_host *out)
{
if (!in) return;
@@ -537,7 +436,7 @@ static inline void convert_VkPerformanceMarkerInfoINTEL_win_to_host(const VkPerf
out->marker = in->marker;
}
-static inline void convert_VkPerformanceOverrideInfoINTEL_win_to_host(const VkPerformanceOverrideInfoINTEL *in, VkPerformanceOverrideInfoINTEL_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPerformanceOverrideInfoINTEL_win_to_host(const VkPerformanceOverrideInfoINTEL *in, VkPerformanceOverrideInfoINTEL_host *out)
{
if (!in) return;
@@ -548,7 +447,7 @@ static inline void convert_VkPerformanceOverrideInfoINTEL_win_to_host(const VkPe
out->parameter = in->parameter;
}
-static inline void convert_VkAccelerationStructureCreateInfoNV_win_to_host(const VkAccelerationStructureCreateInfoNV *in, VkAccelerationStructureCreateInfoNV_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkAccelerationStructureCreateInfoNV_win_to_host(const VkAccelerationStructureCreateInfoNV *in, VkAccelerationStructureCreateInfoNV_host *out)
{
if (!in) return;
@@ -558,7 +457,7 @@ static inline void convert_VkAccelerationStructureCreateInfoNV_win_to_host(const
convert_VkAccelerationStructureInfoNV_win_to_host(&in->info, &out->info);
}
-static inline void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateInfo *in, VkBufferCreateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateInfo *in, VkBufferCreateInfo_host *out)
{
if (!in) return;
@@ -572,7 +471,7 @@ static inline void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateIn
out->pQueueFamilyIndices = in->pQueueFamilyIndices;
}
-static inline void convert_VkBufferViewCreateInfo_win_to_host(const VkBufferViewCreateInfo *in, VkBufferViewCreateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkBufferViewCreateInfo_win_to_host(const VkBufferViewCreateInfo *in, VkBufferViewCreateInfo_host *out)
{
if (!in) return;
@@ -585,7 +484,7 @@ static inline void convert_VkBufferViewCreateInfo_win_to_host(const VkBufferView
out->range = in->range;
}
-static inline void convert_VkPipelineShaderStageCreateInfo_win_to_host(const VkPipelineShaderStageCreateInfo *in, VkPipelineShaderStageCreateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPipelineShaderStageCreateInfo_win_to_host(const VkPipelineShaderStageCreateInfo *in, VkPipelineShaderStageCreateInfo_host *out)
{
if (!in) return;
@@ -598,14 +497,14 @@ static inline void convert_VkPipelineShaderStageCreateInfo_win_to_host(const VkP
out->pSpecializationInfo = in->pSpecializationInfo;
}
-static inline VkComputePipelineCreateInfo_host *convert_VkComputePipelineCreateInfo_array_win_to_host(const VkComputePipelineCreateInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkComputePipelineCreateInfo_host *convert_VkComputePipelineCreateInfo_array_win_to_host(const VkComputePipelineCreateInfo *in, uint32_t count)
{
VkComputePipelineCreateInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -620,14 +519,7 @@ static inline VkComputePipelineCreateInfo_host *convert_VkComputePipelineCreateI
return out;
}
-static inline void free_VkComputePipelineCreateInfo_array(VkComputePipelineCreateInfo_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline void convert_VkDescriptorUpdateTemplateCreateInfo_win_to_host(const VkDescriptorUpdateTemplateCreateInfo *in, VkDescriptorUpdateTemplateCreateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkDescriptorUpdateTemplateCreateInfo_win_to_host(const VkDescriptorUpdateTemplateCreateInfo *in, VkDescriptorUpdateTemplateCreateInfo_host *out)
{
if (!in) return;
@@ -643,7 +535,7 @@ static inline void convert_VkDescriptorUpdateTemplateCreateInfo_win_to_host(cons
out->set = in->set;
}
-static inline void convert_VkFramebufferCreateInfo_win_to_host(const VkFramebufferCreateInfo *in, VkFramebufferCreateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkFramebufferCreateInfo_win_to_host(const VkFramebufferCreateInfo *in, VkFramebufferCreateInfo_host *out)
{
if (!in) return;
@@ -658,14 +550,14 @@ static inline void convert_VkFramebufferCreateInfo_win_to_host(const VkFramebuff
out->layers = in->layers;
}
-static inline VkPipelineShaderStageCreateInfo_host *convert_VkPipelineShaderStageCreateInfo_array_win_to_host(const VkPipelineShaderStageCreateInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkPipelineShaderStageCreateInfo_host *convert_VkPipelineShaderStageCreateInfo_array_win_to_host(const VkPipelineShaderStageCreateInfo *in, uint32_t count)
{
VkPipelineShaderStageCreateInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -680,21 +572,14 @@ static inline VkPipelineShaderStageCreateInfo_host *convert_VkPipelineShaderStag
return out;
}
-static inline void free_VkPipelineShaderStageCreateInfo_array(VkPipelineShaderStageCreateInfo_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkGraphicsPipelineCreateInfo_host *convert_VkGraphicsPipelineCreateInfo_array_win_to_host(const VkGraphicsPipelineCreateInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkGraphicsPipelineCreateInfo_host *convert_VkGraphicsPipelineCreateInfo_array_win_to_host(const VkGraphicsPipelineCreateInfo *in, uint32_t count)
{
VkGraphicsPipelineCreateInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -721,20 +606,7 @@ static inline VkGraphicsPipelineCreateInfo_host *convert_VkGraphicsPipelineCreat
return out;
}
-static inline void free_VkGraphicsPipelineCreateInfo_array(VkGraphicsPipelineCreateInfo_host *in, uint32_t count)
-{
- unsigned int i;
-
- if (!in) return;
-
- for (i = 0; i < count; i++)
- {
- free_VkPipelineShaderStageCreateInfo_array((VkPipelineShaderStageCreateInfo_host *)in[i].pStages, in[i].stageCount);
- }
- heap_free(in);
-}
-
-static inline void convert_VkImageViewCreateInfo_win_to_host(const VkImageViewCreateInfo *in, VkImageViewCreateInfo_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkImageViewCreateInfo_win_to_host(const VkImageViewCreateInfo *in, VkImageViewCreateInfo_host *out)
{
if (!in) return;
@@ -748,14 +620,14 @@ static inline void convert_VkImageViewCreateInfo_win_to_host(const VkImageViewCr
out->subresourceRange = in->subresourceRange;
}
-static inline VkRayTracingPipelineCreateInfoNV_host *convert_VkRayTracingPipelineCreateInfoNV_array_win_to_host(const VkRayTracingPipelineCreateInfoNV *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkRayTracingPipelineCreateInfoNV_host *convert_VkRayTracingPipelineCreateInfoNV_array_win_to_host(const VkRayTracingPipelineCreateInfoNV *in, uint32_t count)
{
VkRayTracingPipelineCreateInfoNV_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -774,20 +646,7 @@ static inline VkRayTracingPipelineCreateInfoNV_host *convert_VkRayTracingPipelin
return out;
}
-static inline void free_VkRayTracingPipelineCreateInfoNV_array(VkRayTracingPipelineCreateInfoNV_host *in, uint32_t count)
-{
- unsigned int i;
-
- if (!in) return;
-
- for (i = 0; i < count; i++)
- {
- free_VkPipelineShaderStageCreateInfo_array((VkPipelineShaderStageCreateInfo_host *)in[i].pStages, in[i].stageCount);
- }
- heap_free(in);
-}
-
-static inline void convert_VkSwapchainCreateInfoKHR_win_to_host(const VkSwapchainCreateInfoKHR *in, VkSwapchainCreateInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkSwapchainCreateInfoKHR_win_to_host(const VkSwapchainCreateInfoKHR *in, VkSwapchainCreateInfoKHR_host *out)
{
if (!in) return;
@@ -811,14 +670,14 @@ static inline void convert_VkSwapchainCreateInfoKHR_win_to_host(const VkSwapchai
out->oldSwapchain = in->oldSwapchain;
}
-static inline VkMappedMemoryRange_host *convert_VkMappedMemoryRange_array_win_to_host(const VkMappedMemoryRange *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkMappedMemoryRange_host *convert_VkMappedMemoryRange_array_win_to_host(const VkMappedMemoryRange *in, uint32_t count)
{
VkMappedMemoryRange_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -831,14 +690,7 @@ static inline VkMappedMemoryRange_host *convert_VkMappedMemoryRange_array_win_to
return out;
}
-static inline void free_VkMappedMemoryRange_array(VkMappedMemoryRange_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline void convert_VkAccelerationStructureMemoryRequirementsInfoNV_win_to_host(const VkAccelerationStructureMemoryRequirementsInfoNV *in, VkAccelerationStructureMemoryRequirementsInfoNV_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkAccelerationStructureMemoryRequirementsInfoNV_win_to_host(const VkAccelerationStructureMemoryRequirementsInfoNV *in, VkAccelerationStructureMemoryRequirementsInfoNV_host *out)
{
if (!in) return;
@@ -848,7 +700,7 @@ static inline void convert_VkAccelerationStructureMemoryRequirementsInfoNV_win_t
out->accelerationStructure = in->accelerationStructure;
}
-static inline void convert_VkMemoryRequirements_host_to_win(const VkMemoryRequirements_host *in, VkMemoryRequirements *out)
+static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements_host_to_win(const VkMemoryRequirements_host *in, VkMemoryRequirements *out)
{
if (!in) return;
@@ -857,7 +709,7 @@ static inline void convert_VkMemoryRequirements_host_to_win(const VkMemoryRequir
out->memoryTypeBits = in->memoryTypeBits;
}
-static inline void convert_VkMemoryRequirements2KHR_win_to_host(const VkMemoryRequirements2KHR *in, VkMemoryRequirements2KHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2KHR_win_to_host(const VkMemoryRequirements2KHR *in, VkMemoryRequirements2KHR_host *out)
{
if (!in) return;
@@ -865,7 +717,7 @@ static inline void convert_VkMemoryRequirements2KHR_win_to_host(const VkMemoryRe
out->sType = in->sType;
}
-static inline void convert_VkMemoryRequirements2KHR_host_to_win(const VkMemoryRequirements2KHR_host *in, VkMemoryRequirements2KHR *out)
+static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2KHR_host_to_win(const VkMemoryRequirements2KHR_host *in, VkMemoryRequirements2KHR *out)
{
if (!in) return;
@@ -874,7 +726,7 @@ static inline void convert_VkMemoryRequirements2KHR_host_to_win(const VkMemoryRe
convert_VkMemoryRequirements_host_to_win(&in->memoryRequirements, &out->memoryRequirements);
}
-static inline void convert_VkBufferDeviceAddressInfoKHR_win_to_host(const VkBufferDeviceAddressInfoKHR *in, VkBufferDeviceAddressInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkBufferDeviceAddressInfoKHR_win_to_host(const VkBufferDeviceAddressInfoKHR *in, VkBufferDeviceAddressInfoKHR_host *out)
{
if (!in) return;
@@ -883,7 +735,7 @@ static inline void convert_VkBufferDeviceAddressInfoKHR_win_to_host(const VkBuff
out->buffer = in->buffer;
}
-static inline void convert_VkBufferMemoryRequirementsInfo2_win_to_host(const VkBufferMemoryRequirementsInfo2 *in, VkBufferMemoryRequirementsInfo2_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkBufferMemoryRequirementsInfo2_win_to_host(const VkBufferMemoryRequirementsInfo2 *in, VkBufferMemoryRequirementsInfo2_host *out)
{
if (!in) return;
@@ -892,7 +744,7 @@ static inline void convert_VkBufferMemoryRequirementsInfo2_win_to_host(const VkB
out->buffer = in->buffer;
}
-static inline void convert_VkMemoryRequirements2_win_to_host(const VkMemoryRequirements2 *in, VkMemoryRequirements2_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2_win_to_host(const VkMemoryRequirements2 *in, VkMemoryRequirements2_host *out)
{
if (!in) return;
@@ -900,7 +752,7 @@ static inline void convert_VkMemoryRequirements2_win_to_host(const VkMemoryRequi
out->sType = in->sType;
}
-static inline void convert_VkMemoryRequirements2_host_to_win(const VkMemoryRequirements2_host *in, VkMemoryRequirements2 *out)
+static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2_host_to_win(const VkMemoryRequirements2_host *in, VkMemoryRequirements2 *out)
{
if (!in) return;
@@ -909,7 +761,7 @@ static inline void convert_VkMemoryRequirements2_host_to_win(const VkMemoryRequi
convert_VkMemoryRequirements_host_to_win(&in->memoryRequirements, &out->memoryRequirements);
}
-static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfoKHR_win_to_host(const VkDeviceMemoryOpaqueCaptureAddressInfoKHR *in, VkDeviceMemoryOpaqueCaptureAddressInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkDeviceMemoryOpaqueCaptureAddressInfoKHR_win_to_host(const VkDeviceMemoryOpaqueCaptureAddressInfoKHR *in, VkDeviceMemoryOpaqueCaptureAddressInfoKHR_host *out)
{
if (!in) return;
@@ -918,7 +770,7 @@ static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfoKHR_win_to_host
out->memory = in->memory;
}
-static inline void convert_VkImageMemoryRequirementsInfo2_win_to_host(const VkImageMemoryRequirementsInfo2 *in, VkImageMemoryRequirementsInfo2_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkImageMemoryRequirementsInfo2_win_to_host(const VkImageMemoryRequirementsInfo2 *in, VkImageMemoryRequirementsInfo2_host *out)
{
if (!in) return;
@@ -927,7 +779,7 @@ static inline void convert_VkImageMemoryRequirementsInfo2_win_to_host(const VkIm
out->image = in->image;
}
-static inline void convert_VkImageSparseMemoryRequirementsInfo2_win_to_host(const VkImageSparseMemoryRequirementsInfo2 *in, VkImageSparseMemoryRequirementsInfo2_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkImageSparseMemoryRequirementsInfo2_win_to_host(const VkImageSparseMemoryRequirementsInfo2 *in, VkImageSparseMemoryRequirementsInfo2_host *out)
{
if (!in) return;
@@ -936,7 +788,7 @@ static inline void convert_VkImageSparseMemoryRequirementsInfo2_win_to_host(cons
out->image = in->image;
}
-static inline void convert_VkSubresourceLayout_host_to_win(const VkSubresourceLayout_host *in, VkSubresourceLayout *out)
+static WINEVULKAN_FORCEINLINE void convert_VkSubresourceLayout_host_to_win(const VkSubresourceLayout_host *in, VkSubresourceLayout *out)
{
if (!in) return;
@@ -947,7 +799,7 @@ static inline void convert_VkSubresourceLayout_host_to_win(const VkSubresourceLa
out->depthPitch = in->depthPitch;
}
-static inline void convert_VkImageFormatProperties_host_to_win(const VkImageFormatProperties_host *in, VkImageFormatProperties *out)
+static WINEVULKAN_FORCEINLINE void convert_VkImageFormatProperties_host_to_win(const VkImageFormatProperties_host *in, VkImageFormatProperties *out)
{
if (!in) return;
@@ -958,7 +810,7 @@ static inline void convert_VkImageFormatProperties_host_to_win(const VkImageForm
out->maxResourceSize = in->maxResourceSize;
}
-static inline void convert_VkImageFormatProperties2_win_to_host(const VkImageFormatProperties2 *in, VkImageFormatProperties2_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkImageFormatProperties2_win_to_host(const VkImageFormatProperties2 *in, VkImageFormatProperties2_host *out)
{
if (!in) return;
@@ -966,7 +818,7 @@ static inline void convert_VkImageFormatProperties2_win_to_host(const VkImageFor
out->sType = in->sType;
}
-static inline void convert_VkImageFormatProperties2_host_to_win(const VkImageFormatProperties2_host *in, VkImageFormatProperties2 *out)
+static WINEVULKAN_FORCEINLINE void convert_VkImageFormatProperties2_host_to_win(const VkImageFormatProperties2_host *in, VkImageFormatProperties2 *out)
{
if (!in) return;
@@ -975,7 +827,7 @@ static inline void convert_VkImageFormatProperties2_host_to_win(const VkImageFor
convert_VkImageFormatProperties_host_to_win(&in->imageFormatProperties, &out->imageFormatProperties);
}
-static inline void convert_VkMemoryHeap_static_array_host_to_win(const VkMemoryHeap_host *in, VkMemoryHeap *out, uint32_t count)
+static WINEVULKAN_FORCEINLINE void convert_VkMemoryHeap_static_array_host_to_win(const VkMemoryHeap_host *in, VkMemoryHeap *out, uint32_t count)
{
unsigned int i;
@@ -988,7 +840,7 @@ static inline void convert_VkMemoryHeap_static_array_host_to_win(const VkMemoryH
}
}
-static inline void convert_VkPhysicalDeviceMemoryProperties_host_to_win(const VkPhysicalDeviceMemoryProperties_host *in, VkPhysicalDeviceMemoryProperties *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceMemoryProperties_host_to_win(const VkPhysicalDeviceMemoryProperties_host *in, VkPhysicalDeviceMemoryProperties *out)
{
if (!in) return;
@@ -998,7 +850,7 @@ static inline void convert_VkPhysicalDeviceMemoryProperties_host_to_win(const Vk
convert_VkMemoryHeap_static_array_host_to_win(in->memoryHeaps, out->memoryHeaps, VK_MAX_MEMORY_HEAPS);
}
-static inline void convert_VkPhysicalDeviceMemoryProperties2_win_to_host(const VkPhysicalDeviceMemoryProperties2 *in, VkPhysicalDeviceMemoryProperties2_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceMemoryProperties2_win_to_host(const VkPhysicalDeviceMemoryProperties2 *in, VkPhysicalDeviceMemoryProperties2_host *out)
{
if (!in) return;
@@ -1006,7 +858,7 @@ static inline void convert_VkPhysicalDeviceMemoryProperties2_win_to_host(const V
out->sType = in->sType;
}
-static inline void convert_VkPhysicalDeviceMemoryProperties2_host_to_win(const VkPhysicalDeviceMemoryProperties2_host *in, VkPhysicalDeviceMemoryProperties2 *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceMemoryProperties2_host_to_win(const VkPhysicalDeviceMemoryProperties2_host *in, VkPhysicalDeviceMemoryProperties2 *out)
{
if (!in) return;
@@ -1015,7 +867,7 @@ static inline void convert_VkPhysicalDeviceMemoryProperties2_host_to_win(const V
convert_VkPhysicalDeviceMemoryProperties_host_to_win(&in->memoryProperties, &out->memoryProperties);
}
-static inline void convert_VkPhysicalDeviceLimits_host_to_win(const VkPhysicalDeviceLimits_host *in, VkPhysicalDeviceLimits *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceLimits_host_to_win(const VkPhysicalDeviceLimits_host *in, VkPhysicalDeviceLimits *out)
{
if (!in) return;
@@ -1127,7 +979,7 @@ static inline void convert_VkPhysicalDeviceLimits_host_to_win(const VkPhysicalDe
out->nonCoherentAtomSize = in->nonCoherentAtomSize;
}
-static inline void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysicalDeviceProperties_host *in, VkPhysicalDeviceProperties *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysicalDeviceProperties_host *in, VkPhysicalDeviceProperties *out)
{
if (!in) return;
@@ -1142,7 +994,7 @@ static inline void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysic
out->sparseProperties = in->sparseProperties;
}
-static inline void convert_VkPhysicalDeviceProperties2_win_to_host(const VkPhysicalDeviceProperties2 *in, VkPhysicalDeviceProperties2_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceProperties2_win_to_host(const VkPhysicalDeviceProperties2 *in, VkPhysicalDeviceProperties2_host *out)
{
if (!in) return;
@@ -1150,7 +1002,7 @@ static inline void convert_VkPhysicalDeviceProperties2_win_to_host(const VkPhysi
out->sType = in->sType;
}
-static inline void convert_VkPhysicalDeviceProperties2_host_to_win(const VkPhysicalDeviceProperties2_host *in, VkPhysicalDeviceProperties2 *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceProperties2_host_to_win(const VkPhysicalDeviceProperties2_host *in, VkPhysicalDeviceProperties2 *out)
{
if (!in) return;
@@ -1159,7 +1011,7 @@ static inline void convert_VkPhysicalDeviceProperties2_host_to_win(const VkPhysi
convert_VkPhysicalDeviceProperties_host_to_win(&in->properties, &out->properties);
}
-static inline void convert_VkPipelineExecutableInfoKHR_win_to_host(const VkPipelineExecutableInfoKHR *in, VkPipelineExecutableInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPipelineExecutableInfoKHR_win_to_host(const VkPipelineExecutableInfoKHR *in, VkPipelineExecutableInfoKHR_host *out)
{
if (!in) return;
@@ -1169,7 +1021,7 @@ static inline void convert_VkPipelineExecutableInfoKHR_win_to_host(const VkPipel
out->executableIndex = in->executableIndex;
}
-static inline void convert_VkPipelineInfoKHR_win_to_host(const VkPipelineInfoKHR *in, VkPipelineInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkPipelineInfoKHR_win_to_host(const VkPipelineInfoKHR *in, VkPipelineInfoKHR_host *out)
{
if (!in) return;
@@ -1178,14 +1030,14 @@ static inline void convert_VkPipelineInfoKHR_win_to_host(const VkPipelineInfoKHR
out->pipeline = in->pipeline;
}
-static inline VkSparseMemoryBind_host *convert_VkSparseMemoryBind_array_win_to_host(const VkSparseMemoryBind *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkSparseMemoryBind_host *convert_VkSparseMemoryBind_array_win_to_host(const VkSparseMemoryBind *in, uint32_t count)
{
VkSparseMemoryBind_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].resourceOffset = in[i].resourceOffset;
@@ -1198,21 +1050,14 @@ static inline VkSparseMemoryBind_host *convert_VkSparseMemoryBind_array_win_to_h
return out;
}
-static inline void free_VkSparseMemoryBind_array(VkSparseMemoryBind_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkSparseBufferMemoryBindInfo_host *convert_VkSparseBufferMemoryBindInfo_array_win_to_host(const VkSparseBufferMemoryBindInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkSparseBufferMemoryBindInfo_host *convert_VkSparseBufferMemoryBindInfo_array_win_to_host(const VkSparseBufferMemoryBindInfo *in, uint32_t count)
{
VkSparseBufferMemoryBindInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].buffer = in[i].buffer;
@@ -1223,27 +1068,14 @@ static inline VkSparseBufferMemoryBindInfo_host *convert_VkSparseBufferMemoryBin
return out;
}
-static inline void free_VkSparseBufferMemoryBindInfo_array(VkSparseBufferMemoryBindInfo_host *in, uint32_t count)
-{
- unsigned int i;
-
- if (!in) return;
-
- for (i = 0; i < count; i++)
- {
- free_VkSparseMemoryBind_array((VkSparseMemoryBind_host *)in[i].pBinds, in[i].bindCount);
- }
- heap_free(in);
-}
-
-static inline VkSparseImageOpaqueMemoryBindInfo_host *convert_VkSparseImageOpaqueMemoryBindInfo_array_win_to_host(const VkSparseImageOpaqueMemoryBindInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkSparseImageOpaqueMemoryBindInfo_host *convert_VkSparseImageOpaqueMemoryBindInfo_array_win_to_host(const VkSparseImageOpaqueMemoryBindInfo *in, uint32_t count)
{
VkSparseImageOpaqueMemoryBindInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].image = in[i].image;
@@ -1254,27 +1086,14 @@ static inline VkSparseImageOpaqueMemoryBindInfo_host *convert_VkSparseImageOpaqu
return out;
}
-static inline void free_VkSparseImageOpaqueMemoryBindInfo_array(VkSparseImageOpaqueMemoryBindInfo_host *in, uint32_t count)
-{
- unsigned int i;
-
- if (!in) return;
-
- for (i = 0; i < count; i++)
- {
- free_VkSparseMemoryBind_array((VkSparseMemoryBind_host *)in[i].pBinds, in[i].bindCount);
- }
- heap_free(in);
-}
-
-static inline VkSparseImageMemoryBind_host *convert_VkSparseImageMemoryBind_array_win_to_host(const VkSparseImageMemoryBind *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkSparseImageMemoryBind_host *convert_VkSparseImageMemoryBind_array_win_to_host(const VkSparseImageMemoryBind *in, uint32_t count)
{
VkSparseImageMemoryBind_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].subresource = in[i].subresource;
@@ -1288,21 +1107,14 @@ static inline VkSparseImageMemoryBind_host *convert_VkSparseImageMemoryBind_arra
return out;
}
-static inline void free_VkSparseImageMemoryBind_array(VkSparseImageMemoryBind_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
-static inline VkSparseImageMemoryBindInfo_host *convert_VkSparseImageMemoryBindInfo_array_win_to_host(const VkSparseImageMemoryBindInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkSparseImageMemoryBindInfo_host *convert_VkSparseImageMemoryBindInfo_array_win_to_host(const VkSparseImageMemoryBindInfo *in, uint32_t count)
{
VkSparseImageMemoryBindInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].image = in[i].image;
@@ -1313,27 +1125,14 @@ static inline VkSparseImageMemoryBindInfo_host *convert_VkSparseImageMemoryBindI
return out;
}
-static inline void free_VkSparseImageMemoryBindInfo_array(VkSparseImageMemoryBindInfo_host *in, uint32_t count)
-{
- unsigned int i;
-
- if (!in) return;
-
- for (i = 0; i < count; i++)
- {
- free_VkSparseImageMemoryBind_array((VkSparseImageMemoryBind_host *)in[i].pBinds, in[i].bindCount);
- }
- heap_free(in);
-}
-
-static inline VkBindSparseInfo_host *convert_VkBindSparseInfo_array_win_to_host(const VkBindSparseInfo *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkBindSparseInfo_host *convert_VkBindSparseInfo_array_win_to_host(const VkBindSparseInfo *in, uint32_t count)
{
VkBindSparseInfo_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -1353,22 +1152,7 @@ static inline VkBindSparseInfo_host *convert_VkBindSparseInfo_array_win_to_host(
return out;
}
-static inline void free_VkBindSparseInfo_array(VkBindSparseInfo_host *in, uint32_t count)
-{
- unsigned int i;
-
- if (!in) return;
-
- for (i = 0; i < count; i++)
- {
- free_VkSparseBufferMemoryBindInfo_array((VkSparseBufferMemoryBindInfo_host *)in[i].pBufferBinds, in[i].bufferBindCount);
- free_VkSparseImageOpaqueMemoryBindInfo_array((VkSparseImageOpaqueMemoryBindInfo_host *)in[i].pImageOpaqueBinds, in[i].imageOpaqueBindCount);
- free_VkSparseImageMemoryBindInfo_array((VkSparseImageMemoryBindInfo_host *)in[i].pImageBinds, in[i].imageBindCount);
- }
- heap_free(in);
-}
-
-static inline void convert_VkSemaphoreSignalInfoKHR_win_to_host(const VkSemaphoreSignalInfoKHR *in, VkSemaphoreSignalInfoKHR_host *out)
+static WINEVULKAN_FORCEINLINE void convert_VkSemaphoreSignalInfoKHR_win_to_host(const VkSemaphoreSignalInfoKHR *in, VkSemaphoreSignalInfoKHR_host *out)
{
if (!in) return;
@@ -1378,14 +1162,14 @@ static inline void convert_VkSemaphoreSignalInfoKHR_win_to_host(const VkSemaphor
out->value = in->value;
}
-static inline VkCopyDescriptorSet_host *convert_VkCopyDescriptorSet_array_win_to_host(const VkCopyDescriptorSet *in, uint32_t count)
+static WINEVULKAN_FORCEINLINE VkCopyDescriptorSet_host *convert_VkCopyDescriptorSet_array_win_to_host(const VkCopyDescriptorSet *in, uint32_t count)
{
VkCopyDescriptorSet_host *out;
unsigned int i;
if (!in) return NULL;
- out = heap_alloc(count * sizeof(*out));
+ out = WINEVULKAN_ALLOCA(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
@@ -1402,13 +1186,6 @@ static inline VkCopyDescriptorSet_host *convert_VkCopyDescriptorSet_array_win_to
return out;
}
-static inline void free_VkCopyDescriptorSet_array(VkCopyDescriptorSet_host *in, uint32_t count)
-{
- if (!in) return;
-
- heap_free(in);
-}
-
#endif /* USE_STRUCT_CONVERSION */
VkResult convert_VkDeviceCreateInfo_struct_chain(const void *pNext, VkDeviceCreateInfo *out_struct)
@@ -2547,7 +2324,6 @@ VkResult WINAPI wine_vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const V
convert_VkCommandBufferBeginInfo_win_to_host(pBeginInfo, &pBeginInfo_host);
result = commandBuffer->device->funcs.p_vkBeginCommandBuffer(commandBuffer->command_buffer, &pBeginInfo_host);
- free_VkCommandBufferBeginInfo(&pBeginInfo_host);
return result;
#else
TRACE("%p, %p\n", commandBuffer, pBeginInfo);
@@ -2565,7 +2341,6 @@ static VkResult WINAPI wine_vkBindAccelerationStructureMemoryNV(VkDevice device,
pBindInfos_host = convert_VkBindAccelerationStructureMemoryInfoNV_array_win_to_host(pBindInfos, bindInfoCount);
result = device->funcs.p_vkBindAccelerationStructureMemoryNV(device->device, bindInfoCount, pBindInfos_host);
- free_VkBindAccelerationStructureMemoryInfoNV_array(pBindInfos_host, bindInfoCount);
return result;
#else
TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos);
@@ -2589,7 +2364,6 @@ VkResult WINAPI wine_vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount
pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount);
result = device->funcs.p_vkBindBufferMemory2(device->device, bindInfoCount, pBindInfos_host);
- free_VkBindBufferMemoryInfo_array(pBindInfos_host, bindInfoCount);
return result;
#else
TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos);
@@ -2607,7 +2381,6 @@ static VkResult WINAPI wine_vkBindBufferMemory2KHR(VkDevice device, uint32_t bin
pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount);
result = device->funcs.p_vkBindBufferMemory2KHR(device->device, bindInfoCount, pBindInfos_host);
- free_VkBindBufferMemoryInfo_array(pBindInfos_host, bindInfoCount);
return result;
#else
TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos);
@@ -2631,7 +2404,6 @@ VkResult WINAPI wine_vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount,
pBindInfos_host = convert_VkBindImageMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount);
result = device->funcs.p_vkBindImageMemory2(device->device, bindInfoCount, pBindInfos_host);
- free_VkBindImageMemoryInfo_array(pBindInfos_host, bindInfoCount);
return result;
#else
TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos);
@@ -2649,7 +2421,6 @@ static VkResult WINAPI wine_vkBindImageMemory2KHR(VkDevice device, uint32_t bind
pBindInfos_host = convert_VkBindImageMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount);
result = device->funcs.p_vkBindImageMemory2KHR(device->device, bindInfoCount, pBindInfos_host);
- free_VkBindImageMemoryInfo_array(pBindInfos_host, bindInfoCount);
return result;
#else
TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos);
@@ -2771,7 +2542,6 @@ static void WINAPI wine_vkCmdBuildAccelerationStructureNV(VkCommandBuffer comman
convert_VkAccelerationStructureInfoNV_win_to_host(pInfo, &pInfo_host);
commandBuffer->device->funcs.p_vkCmdBuildAccelerationStructureNV(commandBuffer->command_buffer, &pInfo_host, instanceData, instanceOffset, update, dst, src, scratch, scratchOffset);
- free_VkAccelerationStructureInfoNV(&pInfo_host);
#else
TRACE("%p, %p, 0x%s, 0x%s, %u, 0x%s, 0x%s, 0x%s, 0x%s\n", commandBuffer, pInfo, wine_dbgstr_longlong(instanceData), wine_dbgstr_longlong(instanceOffset), update, wine_dbgstr_longlong(dst), wine_dbgstr_longlong(src), wine_dbgstr_longlong(scratch), wine_dbgstr_longlong(scratchOffset));
commandBuffer->device->funcs.p_vkCmdBuildAccelerationStructureNV(commandBuffer->command_buffer, pInfo, instanceData, instanceOffset, update, dst, src, scratch, scratchOffset);
@@ -2811,7 +2581,6 @@ void WINAPI wine_vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuff
pRegions_host = convert_VkBufferCopy_array_win_to_host(pRegions, regionCount);
commandBuffer->device->funcs.p_vkCmdCopyBuffer(commandBuffer->command_buffer, srcBuffer, dstBuffer, regionCount, pRegions_host);
- free_VkBufferCopy_array(pRegions_host, regionCount);
#else
TRACE("%p, 0x%s, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstBuffer), regionCount, pRegions);
commandBuffer->device->funcs.p_vkCmdCopyBuffer(commandBuffer->command_buffer, srcBuffer, dstBuffer, regionCount, pRegions);
@@ -2827,7 +2596,6 @@ void WINAPI wine_vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer
pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount);
commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions_host);
- free_VkBufferImageCopy_array(pRegions_host, regionCount);
#else
TRACE("%p, 0x%s, 0x%s, %#x, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions);
commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
@@ -2849,7 +2617,6 @@ void WINAPI wine_vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage s
pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount);
commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions_host);
- free_VkBufferImageCopy_array(pRegions_host, regionCount);
#else
TRACE("%p, 0x%s, %#x, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions);
commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
@@ -3023,8 +2790,6 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineS
pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount);
commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host);
- free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount);
- free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount);
#else
TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
@@ -3046,7 +2811,6 @@ static void WINAPI wine_vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer,
pDescriptorWrites_host = convert_VkWriteDescriptorSet_array_win_to_host(pDescriptorWrites, descriptorWriteCount);
commandBuffer->device->funcs.p_vkCmdPushDescriptorSetKHR(commandBuffer->command_buffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites_host);
- free_VkWriteDescriptorSet_array(pDescriptorWrites_host, descriptorWriteCount);
#else
TRACE("%p, %#x, 0x%s, %u, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), set, descriptorWriteCount, pDescriptorWrites);
commandBuffer->device->funcs.p_vkCmdPushDescriptorSetKHR(commandBuffer->command_buffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites);
@@ -3260,8 +3024,6 @@ void WINAPI wine_vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCo
pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount);
commandBuffer->device->funcs.p_vkCmdWaitEvents(commandBuffer->command_buffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host);
- free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount);
- free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount);
#else
TRACE("%p, %u, %p, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
commandBuffer->device->funcs.p_vkCmdWaitEvents(commandBuffer->command_buffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
@@ -3353,7 +3115,6 @@ VkResult WINAPI wine_vkCreateComputePipelines(VkDevice device, VkPipelineCache p
pCreateInfos_host = convert_VkComputePipelineCreateInfo_array_win_to_host(pCreateInfos, createInfoCount);
result = device->funcs.p_vkCreateComputePipelines(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines);
- free_VkComputePipelineCreateInfo_array(pCreateInfos_host, createInfoCount);
return result;
#else
TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines);
@@ -3446,7 +3207,6 @@ VkResult WINAPI wine_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache
pCreateInfos_host = convert_VkGraphicsPipelineCreateInfo_array_win_to_host(pCreateInfos, createInfoCount);
result = device->funcs.p_vkCreateGraphicsPipelines(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines);
- free_VkGraphicsPipelineCreateInfo_array(pCreateInfos_host, createInfoCount);
return result;
#else
TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines);
@@ -3511,7 +3271,6 @@ static VkResult WINAPI wine_vkCreateRayTracingPipelinesNV(VkDevice device, VkPip
pCreateInfos_host = convert_VkRayTracingPipelineCreateInfoNV_array_win_to_host(pCreateInfos, createInfoCount);
result = device->funcs.p_vkCreateRayTracingPipelinesNV(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines);
- free_VkRayTracingPipelineCreateInfoNV_array(pCreateInfos_host, createInfoCount);
return result;
#else
TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines);
@@ -3774,7 +3533,6 @@ VkResult WINAPI wine_vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryR
pMemoryRanges_host = convert_VkMappedMemoryRange_array_win_to_host(pMemoryRanges, memoryRangeCount);
result = device->funcs.p_vkFlushMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges_host);
- free_VkMappedMemoryRange_array(pMemoryRanges_host, memoryRangeCount);
return result;
#else
TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges);
@@ -4505,7 +4263,6 @@ VkResult WINAPI wine_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t me
pMemoryRanges_host = convert_VkMappedMemoryRange_array_win_to_host(pMemoryRanges, memoryRangeCount);
result = device->funcs.p_vkInvalidateMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges_host);
- free_VkMappedMemoryRange_array(pMemoryRanges_host, memoryRangeCount);
return result;
#else
TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges);
@@ -4541,7 +4298,6 @@ VkResult WINAPI wine_vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, co
pBindInfo_host = convert_VkBindSparseInfo_array_win_to_host(pBindInfo, bindInfoCount);
result = queue->device->funcs.p_vkQueueBindSparse(queue->queue, bindInfoCount, pBindInfo_host, fence);
- free_VkBindSparseInfo_array(pBindInfo_host, bindInfoCount);
return result;
#else
TRACE("%p, %u, %p, 0x%s\n", queue, bindInfoCount, pBindInfo, wine_dbgstr_longlong(fence));
@@ -4685,8 +4441,6 @@ void WINAPI wine_vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWrit
pDescriptorCopies_host = convert_VkCopyDescriptorSet_array_win_to_host(pDescriptorCopies, descriptorCopyCount);
device->funcs.p_vkUpdateDescriptorSets(device->device, descriptorWriteCount, pDescriptorWrites_host, descriptorCopyCount, pDescriptorCopies_host);
- free_VkWriteDescriptorSet_array(pDescriptorWrites_host, descriptorWriteCount);
- free_VkCopyDescriptorSet_array(pDescriptorCopies_host, descriptorCopyCount);
#else
TRACE("%p, %u, %p, %u, %p\n", device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
device->funcs.p_vkUpdateDescriptorSets(device->device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
--
2.25.1
3
2
Sets up these definitions needed for future patches
Signed-off-by: Joshua Ashton <joshua(a)froggi.es>
---
dlls/winevulkan/vulkan_private.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h
index 17072d2341..88233daced 100644
--- a/dlls/winevulkan/vulkan_private.h
+++ b/dlls/winevulkan/vulkan_private.h
@@ -34,6 +34,18 @@
#include "vulkan_thunks.h"
+#if defined(__GNUC__) || defined(__clang__)
+#include <alloca.h>
+#define WINEVULKAN_FORCEINLINE __attribute__((always_inline)) inline
+#define WINEVULKAN_ALLOCA(x) alloca(x)
+#elif defined(_MSC_VER)
+#include <malloc.h>
+#define WINEVULKAN_FORCEINLINE __forceinline
+#define WINEVULKAN_ALLOCA(x) _alloca(x)
+#else
+#error Unsupported platform for forceinline/alloca
+#endif
+
/* Magic value defined by Vulkan ICD / Loader spec */
#define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
--
2.25.1
3
2
05 Mar '20
Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com>
---
dlls/windowscodecs/bmpencode.c | 3 ++-
dlls/windowscodecs/jpegformat.c | 3 ++-
dlls/windowscodecs/main.c | 24 +++++++++++++++++++++++-
dlls/windowscodecs/pngformat.c | 4 +++-
dlls/windowscodecs/tests/bmpformat.c | 2 +-
dlls/windowscodecs/tiffformat.c | 4 +++-
dlls/windowscodecs/wincodecs_private.h | 2 +-
7 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c
index 3b77517a8d9..2f0c05a5df3 100644
--- a/dlls/windowscodecs/bmpencode.c
+++ b/dlls/windowscodecs/bmpencode.c
@@ -316,7 +316,8 @@ static HRESULT WINAPI BmpFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
if (SUCCEEDED(hr))
{
hr = write_source(iface, pIBitmapSource, prc,
- This->format->guid, This->format->bpp, This->width, This->height);
+ This->format->guid, This->format->bpp, !This->colors && This->format->colors,
+ This->width, This->height);
}
return hr;
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index 0ecbbf48fce..9460e6913fd 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -1181,7 +1181,8 @@ static HRESULT WINAPI JpegEncoder_Frame_WriteSource(IWICBitmapFrameEncode *iface
if (SUCCEEDED(hr))
{
hr = write_source(iface, pIBitmapSource, prc,
- This->format->guid, This->format->bpp, This->width, This->height);
+ This->format->guid, This->format->bpp, FALSE,
+ This->width, This->height);
}
return hr;
diff --git a/dlls/windowscodecs/main.c b/dlls/windowscodecs/main.c
index 78281519b81..94d66407820 100644
--- a/dlls/windowscodecs/main.c
+++ b/dlls/windowscodecs/main.c
@@ -154,7 +154,7 @@ HRESULT configure_write_source(IWICBitmapFrameEncode *iface,
HRESULT write_source(IWICBitmapFrameEncode *iface,
IWICBitmapSource *source, const WICRect *prc,
- const WICPixelFormatGUID *format, UINT bpp,
+ const WICPixelFormatGUID *format, UINT bpp, BOOL need_palette,
INT width, INT height)
{
IWICBitmapSource *converted_source;
@@ -185,6 +185,28 @@ HRESULT write_source(IWICBitmapFrameEncode *iface,
return E_NOTIMPL;
}
+ if (need_palette)
+ {
+ IWICPalette *palette;
+
+ hr = PaletteImpl_Create(&palette);
+ if (SUCCEEDED(hr))
+ {
+ hr = IWICBitmapSource_CopyPalette(converted_source, palette);
+
+ if (SUCCEEDED(hr))
+ hr = IWICBitmapFrameEncode_SetPalette(iface, palette);
+
+ IWICPalette_Release(palette);
+ }
+
+ if (FAILED(hr))
+ {
+ IWICBitmapSource_Release(converted_source);
+ return hr;
+ }
+ }
+
stride = (bpp * width + 7)/8;
pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height);
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index a79df632ef1..207a81d4d27 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -1772,7 +1772,9 @@ static HRESULT WINAPI PngFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
if (SUCCEEDED(hr))
{
hr = write_source(iface, pIBitmapSource, prc,
- This->format->guid, This->format->bpp, This->width, This->height);
+ This->format->guid, This->format->bpp,
+ !This->colors && This->format->color_type == PNG_COLOR_TYPE_PALETTE,
+ This->width, This->height);
}
return hr;
diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c
index 9de138130e5..183fc461001 100644
--- a/dlls/windowscodecs/tests/bmpformat.c
+++ b/dlls/windowscodecs/tests/bmpformat.c
@@ -1247,7 +1247,7 @@ static void test_writesource_palette(void)
ok(hr == S_OK, "GetFrame error %#x\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame_decode, palette);
- todo_wine ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
hr = IWICPalette_GetColors(palette, 2, result_palette, &result_colors);
ok(hr == S_OK, "GetColors error %#x\n", hr);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 295330aea2c..60592e0cb8a 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1769,7 +1769,9 @@ static HRESULT WINAPI TiffFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
if (SUCCEEDED(hr))
{
hr = write_source(iface, pIBitmapSource, prc,
- This->format->guid, This->format->bpp, This->width, This->height);
+ This->format->guid, This->format->bpp,
+ !This->colors && This->format->bpp <= 8 && !IsEqualGUID(This->format->guid, &GUID_WICPixelFormatBlackWhite),
+ This->width, This->height);
}
return hr;
diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h
index 2b3b10b7ee8..7686e80715f 100644
--- a/dlls/windowscodecs/wincodecs_private.h
+++ b/dlls/windowscodecs/wincodecs_private.h
@@ -174,7 +174,7 @@ extern HRESULT configure_write_source(IWICBitmapFrameEncode *iface,
extern HRESULT write_source(IWICBitmapFrameEncode *iface,
IWICBitmapSource *source, const WICRect *prc,
- const WICPixelFormatGUID *format, UINT bpp,
+ const WICPixelFormatGUID *format, UINT bpp, BOOL need_palette,
INT width, INT height) DECLSPEC_HIDDEN;
extern void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride) DECLSPEC_HIDDEN;
--
2.17.1
1
0