winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
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
List overview
wine-commits
February 2023
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
599 discussions
Start a n
N
ew thread
Zebediah Figura : vkd3d-shader/hlsl: Apply latent majority modifiers to typedefs as well.
by Alexandre Julliard
28 Feb '23
28 Feb '23
Module: vkd3d Branch: master Commit: 5838364886797eb70422501700feb910fb28c68c URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/5838364886797eb70422501700feb…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Mar 29 19:15:40 2022 -0500 vkd3d-shader/hlsl: Apply latent majority modifiers to typedefs as well. --- libs/vkd3d-shader/hlsl.y | 54 +++++++++++++++++----------------- tests/hlsl-majority-pragma.shader_test | 4 +-- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 6162423c..3e6077d9 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -877,7 +877,7 @@ static const struct hlsl_struct_field *get_struct_field(const struct hlsl_struct } static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_type *type, - unsigned int *modifiers, struct vkd3d_shader_location loc) + unsigned int *modifiers, bool force_majority, const struct vkd3d_shader_location *loc) { unsigned int default_majority = 0; struct hlsl_type *new_type; @@ -886,12 +886,12 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_ && !(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK) && type->type == HLSL_CLASS_MATRIX) { - if (!(default_majority = ctx->matrix_majority)) + if (!(default_majority = ctx->matrix_majority) && force_majority) default_majority = HLSL_MODIFIER_COLUMN_MAJOR; } else if (type->type != HLSL_CLASS_MATRIX) { - check_invalid_matrix_modifiers(ctx, *modifiers, loc); + check_invalid_matrix_modifiers(ctx, *modifiers, *loc); } if (!default_majority && !(*modifiers & HLSL_TYPE_MODIFIERS_MASK)) @@ -903,7 +903,7 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_ *modifiers &= ~HLSL_TYPE_MODIFIERS_MASK; if ((new_type->modifiers & HLSL_MODIFIER_ROW_MAJOR) && (new_type->modifiers & HLSL_MODIFIER_COLUMN_MAJOR)) - hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER, + hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER, "'row_major' and 'column_major' modifiers are mutually exclusive."); return new_type; @@ -995,8 +995,7 @@ static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields, return true; } -static bool add_typedef(struct hlsl_ctx *ctx, const unsigned int modifiers, - struct hlsl_type *const orig_type, struct list *list) +static bool add_typedef(struct hlsl_ctx *ctx, struct hlsl_type *const orig_type, struct list *list) { struct parse_variable_def *v, *v_next; struct hlsl_type *type; @@ -1007,22 +1006,17 @@ static bool add_typedef(struct hlsl_ctx *ctx, const unsigned int modifiers, { if (!v->arrays.count) { - /* Do not use apply_type_modifiers() here. We should not apply the - * latent matrix majority to plain matrix types. */ - if (!(type = hlsl_type_clone(ctx, orig_type, 0, modifiers))) + if (!(type = hlsl_type_clone(ctx, orig_type, 0, 0))) { free_parse_variable_def(v); continue; } - - if (type->type != HLSL_CLASS_MATRIX) - check_invalid_matrix_modifiers(ctx, modifiers, v->loc); } else { - unsigned int var_modifiers = modifiers; + unsigned int var_modifiers = 0; - if (!(type = apply_type_modifiers(ctx, orig_type, &var_modifiers, v->loc))) + if (!(type = apply_type_modifiers(ctx, orig_type, &var_modifiers, true, &v->loc))) { free_parse_variable_def(v); continue; @@ -1052,11 +1046,6 @@ static bool add_typedef(struct hlsl_ctx *ctx, const unsigned int modifiers, vkd3d_free((void *)type->name); type->name = v->name; - if ((type->modifiers & HLSL_MODIFIER_COLUMN_MAJOR) - && (type->modifiers & HLSL_MODIFIER_ROW_MAJOR)) - hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER, - "'row_major' and 'column_major' modifiers are mutually exclusive."); - ret = hlsl_scope_add_type(ctx->cur_scope, type); if (!ret) hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_REDEFINED, @@ -4065,7 +4054,7 @@ struct_declaration: "Modifiers are not allowed on struct type declarations."); } - if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1))) + if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1))) YYABORT; $$ = declare_vars(ctx, type, modifiers, &@1, $3); } @@ -4150,7 +4139,7 @@ field: struct hlsl_type *type; unsigned int modifiers = $1; - if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1))) + if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1))) YYABORT; if (modifiers & ~HLSL_STORAGE_NOINTERPOLATION) { @@ -4300,7 +4289,7 @@ func_prototype_no_attrs: if (modifiers & ~HLSL_MODIFIERS_MAJORITY_MASK) hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER, "Only majority modifiers are allowed on functions."); - if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1))) + if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1))) YYABORT; if ((var = hlsl_get_var(ctx->globals, $3))) { @@ -4526,7 +4515,7 @@ parameter: struct hlsl_type *type; unsigned int i; - if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1))) + if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1))) YYABORT; $$.modifiers = modifiers; @@ -4758,9 +4747,20 @@ typedef_type: typedef: KW_TYPEDEF var_modifiers typedef_type type_specs ';' { - if ($2 & ~HLSL_TYPE_MODIFIERS_MASK) + struct parse_variable_def *v, *v_next; + unsigned int modifiers = $2; + struct hlsl_type *type; + + if (!(type = apply_type_modifiers(ctx, $3, &modifiers, false, &@2))) + { + LIST_FOR_EACH_ENTRY_SAFE(v, v_next, $4, struct parse_variable_def, entry) + free_parse_variable_def(v); + vkd3d_free($4); + YYABORT; + } + + if (modifiers) { - struct parse_variable_def *v, *v_next; hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER, "Storage modifiers are not allowed on typedefs."); LIST_FOR_EACH_ENTRY_SAFE(v, v_next, $4, struct parse_variable_def, entry) @@ -4768,7 +4768,7 @@ typedef: vkd3d_free($4); YYABORT; } - if (!add_typedef(ctx, $2, $3, $4)) + if (!add_typedef(ctx, type, $4)) YYABORT; } @@ -4800,7 +4800,7 @@ declaration: struct hlsl_type *type; unsigned int modifiers = $1; - if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1))) + if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1))) YYABORT; $$ = declare_vars(ctx, type, modifiers, &@1, $3); } diff --git a/tests/hlsl-majority-pragma.shader_test b/tests/hlsl-majority-pragma.shader_test index 48915aa7..10778fd0 100644 --- a/tests/hlsl-majority-pragma.shader_test +++ b/tests/hlsl-majority-pragma.shader_test @@ -112,12 +112,12 @@ float4 main() : sv_target uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 draw quad -todo probe all rgba (0.1, 0.2, 0.3, 0.4) +probe all rgba (0.1, 0.2, 0.3, 0.4) % In fact, it's illegal to specify a contradictory majority. -[pixel shader fail todo] +[pixel shader fail] #pragma pack_matrix(row_major) typedef float2x2 mat_t; uniform column_major mat_t m;
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Do not set an initial latent matrix majority.
by Alexandre Julliard
28 Feb '23
28 Feb '23
Module: vkd3d Branch: master Commit: 322963add80271e59e46ac61559d4408c153d4bc URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/322963add80271e59e46ac61559d4…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Mar 29 18:55:42 2022 -0500 vkd3d-shader/hlsl: Do not set an initial latent matrix majority. This change does nothing by itself. --- libs/vkd3d-shader/hlsl.c | 2 -- libs/vkd3d-shader/hlsl.y | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 3cf3e6d0..24822e97 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -2973,8 +2973,6 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const char *source_name, ctx->location.line = ctx->location.column = 1; vkd3d_string_buffer_cache_init(&ctx->string_buffers); - ctx->matrix_majority = HLSL_MODIFIER_COLUMN_MAJOR; - list_init(&ctx->scopes); if (!(ctx->dummy_scope = hlsl_new_scope(ctx, NULL))) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index c072362c..6162423c 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -886,7 +886,8 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_ && !(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK) && type->type == HLSL_CLASS_MATRIX) { - default_majority = ctx->matrix_majority; + if (!(default_majority = ctx->matrix_majority)) + default_majority = HLSL_MODIFIER_COLUMN_MAJOR; } else if (type->type != HLSL_CLASS_MATRIX) {
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Store the matrix majority as a type modifiers bitmask.
by Alexandre Julliard
28 Feb '23
28 Feb '23
Module: vkd3d Branch: master Commit: 75ab9d31efcd06c8f50c4bce2c01331e630d3a49 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/75ab9d31efcd06c8f50c4bce2c013…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Mar 29 18:49:10 2022 -0500 vkd3d-shader/hlsl: Store the matrix majority as a type modifiers bitmask. --- libs/vkd3d-shader/hlsl.c | 2 +- libs/vkd3d-shader/hlsl.h | 8 +------- libs/vkd3d-shader/hlsl.l | 4 ++-- libs/vkd3d-shader/hlsl.y | 5 +---- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index d15abe50..3cf3e6d0 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -2973,7 +2973,7 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const char *source_name, ctx->location.line = ctx->location.column = 1; vkd3d_string_buffer_cache_init(&ctx->string_buffers); - ctx->matrix_majority = HLSL_COLUMN_MAJOR; + ctx->matrix_majority = HLSL_MODIFIER_COLUMN_MAJOR; list_init(&ctx->scopes); diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 62049e8d..24d0f517 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -116,12 +116,6 @@ enum hlsl_sampler_dim HLSL_SAMPLER_DIM_MAX = HLSL_SAMPLER_DIM_CUBEARRAY, }; -enum hlsl_matrix_majority -{ - HLSL_COLUMN_MAJOR, - HLSL_ROW_MAJOR -}; - enum hlsl_regset { HLSL_REGSET_SAMPLERS, @@ -735,7 +729,7 @@ struct hlsl_ctx const struct hlsl_ir_function_decl *cur_function; /* Default matrix majority for matrix types. Can be set by a pragma within the HLSL source. */ - enum hlsl_matrix_majority matrix_majority; + unsigned int matrix_majority; /* Basic data types stored for convenience. */ struct diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index 59f31fcd..adff1da0 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -233,14 +233,14 @@ row_major {return KW_ROW_MAJOR; } struct hlsl_ctx *ctx = yyget_extra(yyscanner); TRACE("#pragma setting row_major mode.\n"); - ctx->matrix_majority = HLSL_ROW_MAJOR; + ctx->matrix_majority = HLSL_MODIFIER_ROW_MAJOR; BEGIN(pp_ignore); } <pp_pragma>pack_matrix{WS}*\({WS}*column_major{WS}*\) { struct hlsl_ctx *ctx = yyget_extra(yyscanner); TRACE("#pragma setting column_major mode.\n"); - ctx->matrix_majority = HLSL_COLUMN_MAJOR; + ctx->matrix_majority = HLSL_MODIFIER_COLUMN_MAJOR; BEGIN(pp_ignore); } <pp_pragma>{NEWLINE} { diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index c187cc47..c072362c 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -886,10 +886,7 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_ && !(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK) && type->type == HLSL_CLASS_MATRIX) { - if (ctx->matrix_majority == HLSL_COLUMN_MAJOR) - default_majority = HLSL_MODIFIER_COLUMN_MAJOR; - else - default_majority = HLSL_MODIFIER_ROW_MAJOR; + default_majority = ctx->matrix_majority; } else if (type->type != HLSL_CLASS_MATRIX) {
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Apply latent type modifiers to matrix array typedefs.
by Alexandre Julliard
28 Feb '23
28 Feb '23
Module: vkd3d Branch: master Commit: b3c620954b2d20411c31f806659bcd7aa842c517 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/b3c620954b2d20411c31f806659bc…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Wed Feb 15 18:07:33 2023 -0600 vkd3d-shader/hlsl: Apply latent type modifiers to matrix array typedefs. --- libs/vkd3d-shader/hlsl.y | 25 ++++++++++--------- tests/hlsl-majority-pragma.shader_test | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 4b26a179..c187cc47 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -882,12 +882,6 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_ unsigned int default_majority = 0; struct hlsl_type *new_type; - /* This function is only used for declarations (i.e. variables and struct - * fields), which should inherit the matrix majority. We only explicitly set - * the default majority for declarations—typedefs depend on this—but we - * want to always set it, so that an hlsl_type object is never used to - * represent two different majorities (and thus can be used to store its - * register size, etc.) */ if (!(*modifiers & HLSL_MODIFIERS_MAJORITY_MASK) && !(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK) && type->type == HLSL_CLASS_MATRIX) @@ -1003,7 +997,8 @@ static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields, return true; } -static bool add_typedef(struct hlsl_ctx *ctx, DWORD modifiers, struct hlsl_type *orig_type, struct list *list) +static bool add_typedef(struct hlsl_ctx *ctx, const unsigned int modifiers, + struct hlsl_type *const orig_type, struct list *list) { struct parse_variable_def *v, *v_next; struct hlsl_type *type; @@ -1014,15 +1009,26 @@ static bool add_typedef(struct hlsl_ctx *ctx, DWORD modifiers, struct hlsl_type { if (!v->arrays.count) { + /* Do not use apply_type_modifiers() here. We should not apply the + * latent matrix majority to plain matrix types. */ if (!(type = hlsl_type_clone(ctx, orig_type, 0, modifiers))) { free_parse_variable_def(v); continue; } + + if (type->type != HLSL_CLASS_MATRIX) + check_invalid_matrix_modifiers(ctx, modifiers, v->loc); } else { - type = orig_type; + unsigned int var_modifiers = modifiers; + + if (!(type = apply_type_modifiers(ctx, orig_type, &var_modifiers, v->loc))) + { + free_parse_variable_def(v); + continue; + } } ret = true; @@ -1048,9 +1054,6 @@ static bool add_typedef(struct hlsl_ctx *ctx, DWORD modifiers, struct hlsl_type vkd3d_free((void *)type->name); type->name = v->name; - if (type->type != HLSL_CLASS_MATRIX) - check_invalid_matrix_modifiers(ctx, type->modifiers, v->loc); - if ((type->modifiers & HLSL_MODIFIER_COLUMN_MAJOR) && (type->modifiers & HLSL_MODIFIER_ROW_MAJOR)) hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER, diff --git a/tests/hlsl-majority-pragma.shader_test b/tests/hlsl-majority-pragma.shader_test index da1b1ff3..48915aa7 100644 --- a/tests/hlsl-majority-pragma.shader_test +++ b/tests/hlsl-majority-pragma.shader_test @@ -128,6 +128,31 @@ float4 main() : sv_target } +% This applies to arrays as well. Note that struct fields already have latent +% majority applied (even if there have been no pragmas, as shown below), so the +% question of typedefs is moot there. + + +[pixel shader] +#pragma pack_matrix(row_major) +typedef float2x2 myarray_t[2]; +#pragma pack_matrix(column_major) +uniform myarray_t a; + +float4 main() : sv_target +{ + return float4(a[0][0], a[1][1]); +} + +[test] +uniform 0 float4 0.3 0.4 0.0 0.0 +uniform 4 float4 0.0 0.0 0.0 0.0 +uniform 8 float4 0.0 0.0 0.0 0.0 +uniform 12 float4 0.5 0.6 0.0 0.0 +draw quad +probe all rgba (0.3, 0.4, 0.5, 0.6) + + % However, if no pack_matrix directive has been used yet, a typedef has no % defined majority, and the majority can be overwritten, including by a % subsequent pragma. @@ -178,3 +203,23 @@ uniform 0 float4 0.2 0.4 0.0 0.0 uniform 4 float4 0.3 0.5 0.0 0.0 draw quad probe all rgba (0.2, 0.3, 0.4, 0.5) + + +[pixel shader] +typedef float2x2 myarray_t[2]; +#pragma pack_matrix(row_major) +typedef myarray_t myarray2_t; +uniform myarray2_t a; + +float4 main() : sv_target +{ + return float4(a[0][0], a[1][1]); +} + +[test] +uniform 0 float4 0.3 0.0 0.0 0.0 +uniform 4 float4 0.4 0.0 0.0 0.0 +uniform 8 float4 0.0 0.5 0.0 0.0 +uniform 12 float4 0.0 0.6 0.0 0.0 +draw quad +probe all rgba (0.3, 0.4, 0.5, 0.6)
1
0
0
0
Zebediah Figura : tests: Add more tests for pack_matrix pragmas.
by Alexandre Julliard
28 Feb '23
28 Feb '23
Module: vkd3d Branch: master Commit: 2a412670eeaa24bb8ed1a7e3ba86bdd8b193de84 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/2a412670eeaa24bb8ed1a7e3ba86b…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Mar 29 17:39:34 2022 -0500 tests: Add more tests for pack_matrix pragmas. --- tests/hlsl-majority-pragma.shader_test | 131 +++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/tests/hlsl-majority-pragma.shader_test b/tests/hlsl-majority-pragma.shader_test index d269e859..da1b1ff3 100644 --- a/tests/hlsl-majority-pragma.shader_test +++ b/tests/hlsl-majority-pragma.shader_test @@ -20,6 +20,51 @@ uniform 12 float4 0.2 0.4 0.0 0.0 draw quad probe all rgba (0.17, 0.39, 0.17, 0.39) 1 + +%% Test with a struct. + +[pixel shader] +#pragma pack_matrix(row_major) +struct apple +{ + float2x2 m; +}; +#pragma pack_matrix(column_major) +uniform struct apple a; + +float4 main() : sv_target +{ + return float4(a.m[0], a.m[1]); +} + +[test] +uniform 0 float4 0.1 0.2 0.0 0.0 +uniform 4 float4 0.3 0.4 0.0 0.0 +draw quad +probe all rgba (0.1, 0.2, 0.3, 0.4) + + +%% Test with an array. + +[pixel shader] +#pragma pack_matrix(row_major) +uniform float2x2 m[2]; +#pragma pack_matrix(column_major) + +float4 main() : sv_target +{ + return float4(m[1][0], m[1][1]); +} + +[test] +uniform 0 float4 0.0 0.0 0.0 0.0 +uniform 4 float4 0.0 0.0 0.0 0.0 +uniform 8 float4 0.5 0.6 0.0 0.0 +uniform 12 float4 0.7 0.8 0.0 0.0 +draw quad +probe all rgba (0.5, 0.6, 0.7, 0.8) + + % The documentation claims these strings are subject to macro expansion. % They are not. @@ -47,3 +92,89 @@ uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 draw quad probe all rgba (0.23, 0.34, 0.5, 0.5) 1 + + +% The majority that applies to a typedef is the latent majority at the time +% that typedef was declared. + +[pixel shader] +#pragma pack_matrix(row_major) +typedef float2x2 mat_t; +#pragma pack_matrix(column_major) +uniform mat_t m; + +float4 main() : sv_target +{ + return float4(m[0], m[1]); +} + +[test] +uniform 0 float4 0.1 0.2 0.0 0.0 +uniform 4 float4 0.3 0.4 0.0 0.0 +draw quad +todo probe all rgba (0.1, 0.2, 0.3, 0.4) + + +% In fact, it's illegal to specify a contradictory majority. + +[pixel shader fail todo] +#pragma pack_matrix(row_major) +typedef float2x2 mat_t; +uniform column_major mat_t m; + +float4 main() : sv_target +{ + return 0; +} + + +% However, if no pack_matrix directive has been used yet, a typedef has no +% defined majority, and the majority can be overwritten, including by a +% subsequent pragma. + +[pixel shader] +typedef float2x2 mat_t; +#pragma pack_matrix(row_major) +uniform mat_t m; + +uniform row_major mat_t r; +uniform column_major mat_t c; + +float4 main() : sv_target +{ + return float4(m[0], m[1]); +} + +[test] +uniform 0 float4 0.1 0.2 0.0 0.0 +uniform 4 float4 0.3 0.4 0.0 0.0 +draw quad +probe all rgba (0.1, 0.2, 0.3, 0.4) + + +% This does not apply recursively to struct or array members, however. Members +% defined while there is no latent majority are always column-major, even if +% the type is later used after a pack_matrix(row_major) directive. + +% Note that the majority of the struct or array type cannot itself be +% overwritten with modifiers; those are only valid on matrix types. + +[pixel shader] +struct apple +{ + float2x2 m; +}; +#pragma pack_matrix(row_major) +typedef struct apple apple_t; +uniform apple_t a; + +float4 main() : sv_target +{ + return float4(a.m[0], a.m[1]); +} + +[test] +uniform 0 float4 0.2 0.4 0.0 0.0 +uniform 4 float4 0.3 0.5 0.0 0.0 +draw quad +probe all rgba (0.2, 0.3, 0.4, 0.5)
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Don't map src swizzles for SM1 dp3 and dp4 ops.
by Alexandre Julliard
27 Feb '23
27 Feb '23
Module: vkd3d Branch: master Commit: af25d5bf9688c8f633456d8709f642c4f3049e64 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/af25d5bf9688c8f633456d8709f64…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Thu Feb 23 10:52:29 2023 -0300 vkd3d-shader/hlsl: Don't map src swizzles for SM1 dp3 and dp4 ops. Without this patch, dp3 and dp4 map src swizzles to the dst writemask, which is not correct. Before b84f560bdf59c35e093e51bfdf9a166c196d3a9b, these ops worked despite this, because the dst register had, incorrectly, the full writemask. To solve this problem, write_sm1_binary_op_dot() is introduced, similarly to write_sm4_binary_op_dot(). --- libs/vkd3d-shader/hlsl_sm1.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_sm1.c b/libs/vkd3d-shader/hlsl_sm1.c index 07f9ceb7..4a62d804 100644 --- a/libs/vkd3d-shader/hlsl_sm1.c +++ b/libs/vkd3d-shader/hlsl_sm1.c @@ -525,6 +525,31 @@ static void write_sm1_binary_op(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buff write_sm1_instruction(ctx, buffer, &instr); } +static void write_sm1_binary_op_dot(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, + D3DSHADER_INSTRUCTION_OPCODE_TYPE opcode, const struct hlsl_reg *dst, + const struct hlsl_reg *src1, const struct hlsl_reg *src2) +{ + struct sm1_instruction instr = + { + .opcode = opcode, + + .dst.type = D3DSPR_TEMP, + .dst.writemask = dst->writemask, + .dst.reg = dst->id, + .has_dst = 1, + + .srcs[0].type = D3DSPR_TEMP, + .srcs[0].swizzle = hlsl_swizzle_from_writemask(src1->writemask), + .srcs[0].reg = src1->id, + .srcs[1].type = D3DSPR_TEMP, + .srcs[1].swizzle = hlsl_swizzle_from_writemask(src2->writemask), + .srcs[1].reg = src2->id, + .src_count = 2, + }; + + write_sm1_instruction(ctx, buffer, &instr); +} + static void write_sm1_unary_op(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, D3DSHADER_INSTRUCTION_OPCODE_TYPE opcode, const struct hlsl_reg *dst, const struct hlsl_reg *src, D3DSHADER_PARAM_SRCMOD_TYPE src_mod, D3DSHADER_PARAM_DSTMOD_TYPE dst_mod) @@ -738,11 +763,11 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b switch (arg1->data_type->dimx) { case 4: - write_sm1_binary_op(ctx, buffer, D3DSIO_DP4, &instr->reg, &arg1->reg, &arg2->reg); + write_sm1_binary_op_dot(ctx, buffer, D3DSIO_DP4, &instr->reg, &arg1->reg, &arg2->reg); break; case 3: - write_sm1_binary_op(ctx, buffer, D3DSIO_DP3, &instr->reg, &arg1->reg, &arg2->reg); + write_sm1_binary_op_dot(ctx, buffer, D3DSIO_DP3, &instr->reg, &arg1->reg, &arg2->reg); break; default:
1
0
0
0
Francois Gouget : ntdll/tests: Minimize the stack size for test_tp_multi_wait().
by Alexandre Julliard
27 Feb '23
27 Feb '23
Module: wine Branch: master Commit: 9e5d54eac4085fa90049a6f52749ae78b86b05b6 URL:
https://gitlab.winehq.org/wine/wine/-/commit/9e5d54eac4085fa90049a6f52749ae…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Wed Feb 8 03:43:27 2023 +0100 ntdll/tests: Minimize the stack size for test_tp_multi_wait(). This test creates 512 threads so the default 2 MB stack size requires 1 GB which can cause out-of-virtual-memory-space issues. So cause threadpool to use the smallest possible stack size, which should be 1 MB, halving the virtual memory usage. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54064
--- dlls/ntdll/tests/threadpool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c index a7457e0a315..d8ca80a99a4 100644 --- a/dlls/ntdll/tests/threadpool.c +++ b/dlls/ntdll/tests/threadpool.c @@ -1898,6 +1898,7 @@ static void CALLBACK multi_wait_cb(TP_CALLBACK_INSTANCE *instance, void *userdat static void test_tp_multi_wait(void) { + TP_POOL_STACK_INFORMATION stack_info; TP_CALLBACK_ENVIRON environment; HANDLE semaphores[512]; TP_WAIT *waits[512]; @@ -1917,6 +1918,11 @@ static void test_tp_multi_wait(void) status = pTpAllocPool(&pool, NULL); ok(!status, "TpAllocPool failed with status %lx\n", status); ok(pool != NULL, "expected pool != NULL\n"); + /* many threads -> use the smallest stack possible */ + stack_info.StackReserve = 256 * 1024; + stack_info.StackCommit = 4 * 1024; + status = pTpSetPoolStackInformation(pool, &stack_info); + ok(!status, "TpQueryPoolStackInformation failed: %lx\n", status); memset(&environment, 0, sizeof(environment)); environment.Version = 1;
1
0
0
0
Connor McAdams : uiautomationcore: Implement IUIAutomation::CheckNotSupported.
by Alexandre Julliard
27 Feb '23
27 Feb '23
Module: wine Branch: master Commit: b3a87694a470cae9ed3e9d52a97c13596ab2b354 URL:
https://gitlab.winehq.org/wine/wine/-/commit/b3a87694a470cae9ed3e9d52a97c13…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Fri Jan 27 16:22:51 2023 -0500 uiautomationcore: Implement IUIAutomation::CheckNotSupported. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/uiautomationcore/tests/uiautomation.c | 17 ++++++++++++++++- dlls/uiautomationcore/uia_com_client.c | 12 ++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index c2982174463..b33a09d4f11 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -10108,10 +10108,11 @@ static const struct uia_com_classes com_classes[] = { static void test_CUIAutomation(void) { + BOOL has_cui8 = TRUE, tmp_b; IUIAutomation *uia_iface; IUnknown *unk1, *unk2; - BOOL has_cui8 = TRUE; HRESULT hr; + VARIANT v; int i; CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -10160,6 +10161,13 @@ static void test_CUIAutomation(void) hr = IUIAutomation_get_ReservedNotSupportedValue(uia_iface, &unk2); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(unk1 == unk2, "unk1 != unk2\n"); + + V_VT(&v) = VT_UNKNOWN; + V_UNKNOWN(&v) = unk1; + hr = IUIAutomation_CheckNotSupported(uia_iface, v, &tmp_b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(tmp_b == TRUE, "tmp_b != TRUE\n"); + IUnknown_Release(unk1); IUnknown_Release(unk2); @@ -10169,6 +10177,13 @@ static void test_CUIAutomation(void) hr = IUIAutomation_get_ReservedMixedAttributeValue(uia_iface, &unk2); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(unk1 == unk2, "unk1 != unk2\n"); + + V_VT(&v) = VT_UNKNOWN; + V_UNKNOWN(&v) = unk1; + hr = IUIAutomation_CheckNotSupported(uia_iface, v, &tmp_b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(tmp_b == FALSE, "tmp_b != FALSE\n"); + IUnknown_Release(unk1); IUnknown_Release(unk2); diff --git a/dlls/uiautomationcore/uia_com_client.c b/dlls/uiautomationcore/uia_com_client.c index 33a1967e489..f8fdfaa6505 100644 --- a/dlls/uiautomationcore/uia_com_client.c +++ b/dlls/uiautomationcore/uia_com_client.c @@ -1503,8 +1503,16 @@ static HRESULT WINAPI uia_iface_PollForPotentialSupportedProperties(IUIAutomatio static HRESULT WINAPI uia_iface_CheckNotSupported(IUIAutomation6 *iface, VARIANT in_val, BOOL *match) { - FIXME("%p, %s, %p: stub\n", iface, debugstr_variant(&in_val), match); - return E_NOTIMPL; + IUnknown *unk; + + TRACE("%p, %s, %p\n", iface, debugstr_variant(&in_val), match); + + *match = FALSE; + UiaGetReservedNotSupportedValue(&unk); + if (V_VT(&in_val) == VT_UNKNOWN && (V_UNKNOWN(&in_val) == unk)) + *match = TRUE; + + return S_OK; } static HRESULT WINAPI uia_iface_get_ReservedNotSupportedValue(IUIAutomation6 *iface, IUnknown **out_unk)
1
0
0
0
Connor McAdams : uiautomationcore: Implement IUIAutomation reserved value retrieval methods.
by Alexandre Julliard
27 Feb '23
27 Feb '23
Module: wine Branch: master Commit: cd6891962b070708228f1c32bf3480c3ae65a9ca URL:
https://gitlab.winehq.org/wine/wine/-/commit/cd6891962b070708228f1c32bf3480…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Thu Jan 12 11:54:28 2023 -0500 uiautomationcore: Implement IUIAutomation reserved value retrieval methods. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/uiautomationcore/tests/uiautomation.c | 20 ++++++++++++++++++++ dlls/uiautomationcore/uia_com_client.c | 10 ++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index 1752682a5a7..c2982174463 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -10109,6 +10109,7 @@ static const struct uia_com_classes com_classes[] = { static void test_CUIAutomation(void) { IUIAutomation *uia_iface; + IUnknown *unk1, *unk2; BOOL has_cui8 = TRUE; HRESULT hr; int i; @@ -10152,6 +10153,25 @@ static void test_CUIAutomation(void) ok(hr == S_OK, "Failed to create IUIAutomation interface, hr %#lx\n", hr); ok(!!uia_iface, "uia_iface == NULL\n"); + /* Reserved value retrieval methods. */ + hr = UiaGetReservedNotSupportedValue(&unk1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IUIAutomation_get_ReservedNotSupportedValue(uia_iface, &unk2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(unk1 == unk2, "unk1 != unk2\n"); + IUnknown_Release(unk1); + IUnknown_Release(unk2); + + hr = UiaGetReservedMixedAttributeValue(&unk1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IUIAutomation_get_ReservedMixedAttributeValue(uia_iface, &unk2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(unk1 == unk2, "unk1 != unk2\n"); + IUnknown_Release(unk1); + IUnknown_Release(unk2); + test_CUIAutomation_value_conversion(uia_iface); test_ElementFromHandle(uia_iface, has_cui8); test_Element_GetPropertyValue(uia_iface); diff --git a/dlls/uiautomationcore/uia_com_client.c b/dlls/uiautomationcore/uia_com_client.c index de01517948a..33a1967e489 100644 --- a/dlls/uiautomationcore/uia_com_client.c +++ b/dlls/uiautomationcore/uia_com_client.c @@ -1509,14 +1509,16 @@ static HRESULT WINAPI uia_iface_CheckNotSupported(IUIAutomation6 *iface, VARIANT static HRESULT WINAPI uia_iface_get_ReservedNotSupportedValue(IUIAutomation6 *iface, IUnknown **out_unk) { - FIXME("%p, %p: stub\n", iface, out_unk); - return E_NOTIMPL; + TRACE("%p, %p\n", iface, out_unk); + + return UiaGetReservedNotSupportedValue(out_unk); } static HRESULT WINAPI uia_iface_get_ReservedMixedAttributeValue(IUIAutomation6 *iface, IUnknown **out_unk) { - FIXME("%p, %p: stub\n", iface, out_unk); - return E_NOTIMPL; + TRACE("%p, %p\n", iface, out_unk); + + return UiaGetReservedMixedAttributeValue(out_unk); } static HRESULT WINAPI uia_iface_ElementFromIAccessible(IUIAutomation6 *iface, IAccessible *acc, int cid,
1
0
0
0
Connor McAdams : uiautomationcore: Implement IUIAutomation::IntNativeArrayToSafeArray.
by Alexandre Julliard
27 Feb '23
27 Feb '23
Module: wine Branch: master Commit: 3bc59a4e9a7d5b76ff533304d4c56bd4e21c6ebd URL:
https://gitlab.winehq.org/wine/wine/-/commit/3bc59a4e9a7d5b76ff533304d4c56b…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Fri Feb 3 14:06:38 2023 -0500 uiautomationcore: Implement IUIAutomation::IntNativeArrayToSafeArray. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/uiautomationcore/tests/uiautomation.c | 40 ++++++++++++++++++++++++++++++ dlls/uiautomationcore/uia_com_client.c | 29 ++++++++++++++++++++-- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index d5cfccf729f..1752682a5a7 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -10017,11 +10017,17 @@ exit: static void test_CUIAutomation_value_conversion(IUIAutomation *uia_iface) { static const VARTYPE invalid_int_vts[] = { VT_I8, VT_INT }; + int in_arr[3] = { 0xdeadbeef, 0xfeedbeef, 0x1337b33f }; int *out_arr, out_arr_count, i; + LONG lbound, ubound; SAFEARRAY *sa; VARTYPE vt; HRESULT hr; + UINT dims; + /* + * Conversion from VT_I4 SAFEARRAY to native int array. + */ for (i = 0; i < ARRAY_SIZE(invalid_int_vts); i++) { vt = invalid_int_vts[i]; @@ -10047,6 +10053,40 @@ static void test_CUIAutomation_value_conversion(IUIAutomation *uia_iface) SafeArrayDestroy(sa); CoTaskMemFree(out_arr); + + /* + * Conversion from native int array to VT_I4 SAFEARRAY. + */ + sa = NULL; + hr = IUIAutomation_IntNativeArrayToSafeArray(uia_iface, in_arr, ARRAY_SIZE(in_arr), &sa); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = SafeArrayGetVartype(sa, &vt); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(vt == VT_I4, "Unexpected vt %d.\n", vt); + + dims = SafeArrayGetDim(sa); + ok(dims == 1, "Unexpected array dims %d\n", dims); + + hr = SafeArrayGetLBound(sa, 1, &lbound); + ok(hr == S_OK, "Failed to get LBound with hr %#lx\n", hr); + ok(lbound == 0, "Unexpected LBound %#lx\n", lbound); + + hr = SafeArrayGetUBound(sa, 1, &ubound); + ok(hr == S_OK, "Failed to get UBound with hr %#lx\n", hr); + ok(((ubound - lbound) + 1) == ARRAY_SIZE(in_arr), "Unexpected array size %#lx\n", ((ubound - lbound) + 1)); + + for (i = 0; i < ARRAY_SIZE(in_arr); i++) + { + LONG idx = lbound + i; + int tmp_val; + + hr = SafeArrayGetElement(sa, &idx, &tmp_val); + ok(hr == S_OK, "Failed to get element at idx %ld, hr %#lx\n", idx, hr); + ok(tmp_val == in_arr[i], "Expected %d at idx %d, got %d\n", in_arr[i], i, tmp_val); + } + + SafeArrayDestroy(sa); } struct uia_com_classes { diff --git a/dlls/uiautomationcore/uia_com_client.c b/dlls/uiautomationcore/uia_com_client.c index e78fc4ee416..de01517948a 100644 --- a/dlls/uiautomationcore/uia_com_client.c +++ b/dlls/uiautomationcore/uia_com_client.c @@ -1366,8 +1366,33 @@ static HRESULT WINAPI uia_iface_RemoveAllEventHandlers(IUIAutomation6 *iface) static HRESULT WINAPI uia_iface_IntNativeArrayToSafeArray(IUIAutomation6 *iface, int *arr, int arr_count, SAFEARRAY **out_sa) { - FIXME("%p, %p, %d, %p: stub\n", iface, arr, arr_count, out_sa); - return E_NOTIMPL; + HRESULT hr = S_OK; + SAFEARRAY *sa; + int *sa_arr; + + TRACE("%p, %p, %d, %p\n", iface, arr, arr_count, out_sa); + + if (!out_sa || !arr || !arr_count) + return E_INVALIDARG; + + *out_sa = NULL; + if (!(sa = SafeArrayCreateVector(VT_I4, 0, arr_count))) + return E_OUTOFMEMORY; + + hr = SafeArrayAccessData(sa, (void **)&sa_arr); + if (FAILED(hr)) + goto exit; + + memcpy(sa_arr, arr, sizeof(*arr) * arr_count); + hr = SafeArrayUnaccessData(sa); + if (SUCCEEDED(hr)) + *out_sa = sa; + +exit: + if (FAILED(hr)) + SafeArrayDestroy(sa); + + return hr; } static HRESULT WINAPI uia_iface_IntSafeArrayToNativeArray(IUIAutomation6 *iface, SAFEARRAY *sa, int **out_arr,
1
0
0
0
← Newer
1
2
3
4
5
6
...
60
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Results per page:
10
25
50
100
200