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
January 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
467 discussions
Start a n
N
ew thread
Francisco Casas : vkd3d-shader/hlsl: Replace loads with constants in copy prop.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: c2a7a40d3a3b16d8ac37ecb40db260a4f092f7f8 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/c2a7a40d3a3b16d8ac37ecb40db26…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Thu Nov 17 17:49:28 2022 -0300 vkd3d-shader/hlsl: Replace loads with constants in copy prop. If a hlsl_ir_load loads a variable whose components are stored from different instructions, copy propagation doesn't replace it. But if all these instructions are constants (which currently is the case for value constructors), the load could be replaced with a constant value. Which is expected in some other instructions, e.g. texel_offsets when using aoffimmi modifiers. For instance, this shader: ``` sampler s; Texture2D t; float4 main() : sv_target { return t.Gather(s, float2(0.6, 0.6), int2(0, 0)); } ``` results in the following IR before applying the patch: ``` float | 6.00000024e-01 float | 6.00000024e-01 uint | 0 | = (<constructor-2>[@4].x @2) uint | 1 | = (<constructor-2>[@6].x @3) float2 | <constructor-2> int | 0 int | 0 uint | 0 | = (<constructor-5>[@11].x @9) uint | 1 | = (<constructor-5>[@13].x @10) int2 | <constructor-5> float4 | gather_red(resource = t, sampler = s, coords = @8, offset = @15) | return | = (<output-sv_target0> @16) ``` and this IR afterwards: ``` float2 | {6.00000024e-01 6.00000024e-01 } int2 | {0 0 } float4 | gather_red(resource = t, sampler = s, coords = @2, offset = @3) | return | = (<output-sv_target0> @4) ``` --- libs/vkd3d-shader/hlsl_codegen.c | 85 ++++++++++++++++++++++++++++++ tests/hlsl-initializer-objects.shader_test | 8 +-- tests/object-references.shader_test | 6 +-- tests/sampler-offset.shader_test | 12 ++--- tests/texture-load-offset.shader_test | 24 ++++----- 5 files changed, 110 insertions(+), 25 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index dcb945e7..da5b4264 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -543,6 +543,52 @@ static bool lower_broadcasts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, v return false; } +/* + * Copy propagation. The basic idea is to recognize instruction sequences of the + * form: + * + * 2: <any instruction> + * 3: v = @2 + * 4: load(v) + * + * and replace the load (@4) with the original instruction (@2). + * This works for multiple components, even if they're written using separate + * store instructions, as long as the rhs is the same in every case. This basic + * detection is implemented by copy_propagation_replace_with_single_instr(). + * + * We use the same infrastructure to implement a more specialized + * transformation. We recognize sequences of the form: + * + * 2: 123 + * 3: var.x = @2 + * 4: 345 + * 5: var.y = @4 + * 6: load(var.xy) + * + * where the load (@6) originates from different sources but that are constant, + * and transform it into a single constant vector. This latter pass is done + * by copy_propagation_replace_with_constant_vector(). + * + * This is a specialized form of vectorization, and begs the question: why does + * the load need to be involved? Can we just vectorize the stores into a single + * instruction, and then use "normal" copy-prop to convert that into a single + * vector? + * + * In general, the answer is yes, but there is a special case which necessitates + * the use of this transformation: non-uniform control flow. Copy-prop can act + * across some control flow, and in cases like the following: + * + * 2: 123 + * 3: var.x = @2 + * 4: if (...) + * 5: 456 + * 6: var.y = @5 + * 7: load(var.xy) + * + * we can copy-prop the load (@7) into a constant vector {123, 456}, but we + * cannot easily vectorize the stores @3 and @6. + */ + enum copy_propagation_value_state { VALUE_STATE_NOT_WRITTEN = 0, @@ -772,6 +818,42 @@ static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx, return true; } +static bool copy_propagation_replace_with_constant_vector(struct hlsl_ctx *ctx, + const struct copy_propagation_state *state, struct hlsl_ir_load *load) +{ + const struct hlsl_ir_var *var = load->src.var; + union hlsl_constant_value values[4] = {0}; + struct hlsl_ir_node *instr = &load->node; + struct hlsl_ir_constant *cons; + unsigned int start, count, i; + + if (!hlsl_component_index_range_from_deref(ctx, &load->src, &start, &count)) + return false; + + for (i = 0; i < count; ++i) + { + struct copy_propagation_value *value = copy_propagation_get_value(state, var, start + i); + + if (!value || value->node->type != HLSL_IR_CONSTANT) + return false; + + values[i] = hlsl_ir_constant(value->node)->value[value->component]; + } + + if (!(cons = hlsl_new_constant(ctx, instr->data_type, &instr->loc))) + return false; + cons->value[0] = values[0]; + cons->value[1] = values[1]; + cons->value[2] = values[2]; + cons->value[3] = values[3]; + list_add_before(&instr->entry, &cons->node.entry); + + TRACE("Load from %s[%u-%u] turned into a constant %p.\n", var->name, start, start + count, cons); + + hlsl_replace_node(instr, &cons->node); + return true; +} + static bool copy_propagation_transform_load(struct hlsl_ctx *ctx, struct hlsl_ir_load *load, struct copy_propagation_state *state) { @@ -792,6 +874,9 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx, return false; } + if (copy_propagation_replace_with_constant_vector(ctx, state, load)) + return true; + if (copy_propagation_replace_with_single_instr(ctx, state, load)) return true; diff --git a/tests/hlsl-initializer-objects.shader_test b/tests/hlsl-initializer-objects.shader_test index d40ede46..d9c0bc91 100644 --- a/tests/hlsl-initializer-objects.shader_test +++ b/tests/hlsl-initializer-objects.shader_test @@ -29,7 +29,7 @@ draw quad probe all rgba (0.2, 0.2, 0.2, 0.1) -[pixel shader todo] +[pixel shader] Texture2D tex; struct foo @@ -48,11 +48,11 @@ float4 main() : sv_target } [test] -todo draw quad -todo probe all rgba (31.1, 41.1, 51.1, 61.1) 1 +draw quad +probe all rgba (31.1, 41.1, 51.1, 61.1) 1 -[pixel shader todo] +[pixel shader] Texture2D tex1; Texture2D tex2; diff --git a/tests/object-references.shader_test b/tests/object-references.shader_test index 67f86bc6..5e8e2641 100644 --- a/tests/object-references.shader_test +++ b/tests/object-references.shader_test @@ -132,7 +132,7 @@ float4 main() : sv_target } -[pixel shader todo] +[pixel shader] Texture2D tex; uniform float f; @@ -153,8 +153,8 @@ float4 main() : sv_target [test] uniform 0 float 10.0 -todo draw quad -todo probe (0, 0) rgba (11.0, 12.0, 13.0, 11.0) +draw quad +probe (0, 0) rgba (11.0, 12.0, 13.0, 11.0) [pixel shader fail] diff --git a/tests/sampler-offset.shader_test b/tests/sampler-offset.shader_test index 2aa8f9b3..6f8357df 100644 --- a/tests/sampler-offset.shader_test +++ b/tests/sampler-offset.shader_test @@ -12,7 +12,7 @@ size (3, 3) 0.0 0.2 0.0 0.4 0.1 0.2 0.5 0.0 0.2 0.2 0.0 0.4 -[pixel shader todo] +[pixel shader] sampler s; Texture2D t; @@ -22,11 +22,11 @@ float4 main() : sv_target } [test] -todo draw quad +draw quad probe all rgba (0.1, 0.2, 0.5, 0.0) -[pixel shader todo] +[pixel shader] sampler s; Texture2D t; @@ -36,11 +36,11 @@ float4 main() : sv_target } [test] -todo draw quad +draw quad probe all rgba (0.2, 0.2, 0.0, 0.4) -[pixel shader todo] +[pixel shader] sampler s; Texture2D t; @@ -50,5 +50,5 @@ float4 main() : sv_target } [test] -todo draw quad +draw quad probe all rgba (0.0, 0.2, 0.0, 0.4) diff --git a/tests/texture-load-offset.shader_test b/tests/texture-load-offset.shader_test index 6d732190..52b6a5f9 100644 --- a/tests/texture-load-offset.shader_test +++ b/tests/texture-load-offset.shader_test @@ -8,7 +8,7 @@ size (3, 3) 0 2 0 1 1 2 0 1 2 2 0 1 -[pixel shader todo] +[pixel shader] Texture2D t; float4 main(float4 pos : sv_position) : sv_target @@ -18,14 +18,14 @@ float4 main(float4 pos : sv_position) : sv_target [test] -todo draw quad -todo probe (0, 0) rgba (0, 1, 0, 1) -todo probe (1, 0) rgba (1, 1, 0, 1) -todo probe (0, 1) rgba (0, 2, 0, 1) -todo probe (1, 1) rgba (1, 2, 0, 1) +draw quad +probe (0, 0) rgba (0, 1, 0, 1) +probe (1, 0) rgba (1, 1, 0, 1) +probe (0, 1) rgba (0, 2, 0, 1) +probe (1, 1) rgba (1, 2, 0, 1) -[pixel shader todo] +[pixel shader] Texture2D t; float4 main(float4 pos : sv_position) : sv_target @@ -35,11 +35,11 @@ float4 main(float4 pos : sv_position) : sv_target [test] -todo draw quad -todo probe (3, 0) rgba (1, 0, 0, 1) -todo probe (4, 0) rgba (2, 0, 0, 1) -todo probe (3, 1) rgba (1, 1, 0, 1) -todo probe (4, 1) rgba (2, 1, 0, 1) +draw quad +probe (3, 0) rgba (1, 0, 0, 1) +probe (4, 0) rgba (2, 0, 0, 1) +probe (3, 1) rgba (1, 1, 0, 1) +probe (4, 1) rgba (2, 1, 0, 1) [pixel shader fail]
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Synthesize the swizzle and replace the instruction inside of copy_propagation_compute_replacement().
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 8c2b8ff24506809b68c4691a749899361a9a9823 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/8c2b8ff24506809b68c4691a74989…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jan 12 16:28:44 2023 -0600 vkd3d-shader/hlsl: Synthesize the swizzle and replace the instruction inside of copy_propagation_compute_replacement(). Rename it to copy_propagation_replace_with_single_instr() accordingly. The idea is to introduce a constant vector replacement pass which will do the same thing. --- libs/vkd3d-shader/hlsl_codegen.c | 66 +++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 710cdc84..dcb945e7 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -723,61 +723,65 @@ static void copy_propagation_set_value(struct copy_propagation_var_def *var_def, } } -static struct hlsl_ir_node *copy_propagation_compute_replacement(struct hlsl_ctx *ctx, - const struct copy_propagation_state *state, const struct hlsl_deref *deref, - unsigned int *swizzle) +static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx, + const struct copy_propagation_state *state, struct hlsl_ir_load *load) { + const struct hlsl_deref *deref = &load->src; const struct hlsl_ir_var *var = deref->var; - struct hlsl_ir_node *instr = NULL; + struct hlsl_ir_node *instr = &load->node; + struct hlsl_ir_node *new_instr = NULL; unsigned int start, count, i; + unsigned int ret_swizzle = 0; if (!hlsl_component_index_range_from_deref(ctx, deref, &start, &count)) - return NULL; - - *swizzle = 0; + return false; for (i = 0; i < count; ++i) { struct copy_propagation_value *value = copy_propagation_get_value(state, var, start + i); if (!value) - return NULL; + return false; - if (!instr) + if (!new_instr) { - instr = value->node; + new_instr = value->node; } - else if (instr != value->node) + else if (new_instr != value->node) { TRACE("No single source for propagating load from %s[%u-%u].\n", var->name, start, start + count); - return NULL; + return false; } - *swizzle |= value->component << HLSL_SWIZZLE_SHIFT(i); + ret_swizzle |= value->component << HLSL_SWIZZLE_SHIFT(i); } TRACE("Load from %s[%u-%u] propagated as instruction %p%s.\n", - var->name, start, start + count, instr, debug_hlsl_swizzle(*swizzle, count)); - return instr; + var->name, start, start + count, new_instr, debug_hlsl_swizzle(ret_swizzle, count)); + + if (instr->data_type->type != HLSL_CLASS_OBJECT) + { + struct hlsl_ir_swizzle *swizzle_node; + + if (!(swizzle_node = hlsl_new_swizzle(ctx, ret_swizzle, count, new_instr, &instr->loc))) + return false; + list_add_before(&instr->entry, &swizzle_node->node.entry); + new_instr = &swizzle_node->node; + } + + hlsl_replace_node(instr, new_instr); + return true; } static bool copy_propagation_transform_load(struct hlsl_ctx *ctx, struct hlsl_ir_load *load, struct copy_propagation_state *state) { - struct hlsl_ir_node *instr = &load->node, *new_instr; - struct hlsl_type *type = instr->data_type; - struct hlsl_ir_swizzle *swizzle_node; - unsigned int dimx = 0; - unsigned int swizzle; + struct hlsl_type *type = load->node.data_type; switch (type->type) { case HLSL_CLASS_SCALAR: case HLSL_CLASS_VECTOR: - dimx = type->dimx; - break; - case HLSL_CLASS_OBJECT: - dimx = 1; break; case HLSL_CLASS_MATRIX: @@ -788,18 +792,10 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx, return false; } - if (!(new_instr = copy_propagation_compute_replacement(ctx, state, &load->src, &swizzle))) - return false; + if (copy_propagation_replace_with_single_instr(ctx, state, load)) + return true; - if (type->type != HLSL_CLASS_OBJECT) - { - if (!(swizzle_node = hlsl_new_swizzle(ctx, swizzle, dimx, new_instr, &instr->loc))) - return false; - list_add_before(&instr->entry, &swizzle_node->node.entry); - new_instr = &swizzle_node->node; - } - hlsl_replace_node(instr, new_instr); - return true; + return false; } static bool copy_propagation_transform_object_load(struct hlsl_ctx *ctx,
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Call copy_propagation_get_value() directly in copy_propagation_transform_object_load().
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 5d34790402530116672014ca5bea3a06d91f20df URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/5d34790402530116672014ca5bea3…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jan 12 17:28:44 2023 -0600 vkd3d-shader/hlsl: Call copy_propagation_get_value() directly in copy_propagation_transform_object_load(). copy_propagation_compute_replacement() is not doing very much for us, and conceptually is a bit of an odd fit anyway, since it's meant to deal with multi-component types. --- libs/vkd3d-shader/hlsl_codegen.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index fefb8406..710cdc84 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -805,15 +805,20 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx, static bool copy_propagation_transform_object_load(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct copy_propagation_state *state) { + struct copy_propagation_value *value; struct hlsl_ir_load *load; - struct hlsl_ir_node *instr; - unsigned int swizzle; + unsigned int start, count; + + if (!hlsl_component_index_range_from_deref(ctx, deref, &start, &count)) + return false; + assert(count == 1); - if (!(instr = copy_propagation_compute_replacement(ctx, state, deref, &swizzle))) + if (!(value = copy_propagation_get_value(state, deref->var, start))) return false; + assert(value->component == 0); /* Only HLSL_IR_LOAD can produce an object. */ - load = hlsl_ir_load(instr); + load = hlsl_ir_load(value->node); hlsl_cleanup_deref(deref); hlsl_copy_deref(ctx, deref, &load->src);
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Add some swizzle manipulation definitions.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 8fd30aa87d3363cc6f75dfae6feb28d84f7d957f URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/8fd30aa87d3363cc6f75dfae6feb2…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jan 12 15:52:49 2023 -0600 vkd3d-shader/hlsl: Add some swizzle manipulation definitions. --- libs/vkd3d-shader/hlsl.c | 6 +++--- libs/vkd3d-shader/hlsl.h | 8 ++++++++ libs/vkd3d-shader/hlsl_codegen.c | 4 ++-- libs/vkd3d-shader/hlsl_constant_ops.c | 8 ++------ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 13aac3d4..2b41d4d1 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1641,7 +1641,7 @@ const char *debug_hlsl_swizzle(unsigned int swizzle, unsigned int size) assert(size <= ARRAY_SIZE(components)); for (i = 0; i < size; ++i) - string[i] = components[(swizzle >> i * 2) & 3]; + string[i] = components[hlsl_swizzle_get_component(swizzle, i)]; string[size] = 0; return vkd3d_dbg_sprintf(".%s", string); } @@ -2299,8 +2299,8 @@ unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsi unsigned int ret = 0, i; for (i = 0; i < dim; ++i) { - unsigned int s = (second >> (i * 2)) & 3; - ret |= ((first >> (s * 2)) & 3) << (i * 2); + unsigned int s = hlsl_swizzle_get_component(second, i); + ret |= hlsl_swizzle_get_component(first, s) << HLSL_SWIZZLE_SHIFT(i); } return ret; } diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 059abe18..f9526d9f 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -63,6 +63,14 @@ | ((HLSL_SWIZZLE_ ## z) << 4) \ | ((HLSL_SWIZZLE_ ## w) << 6)) +#define HLSL_SWIZZLE_MASK (0x3u) +#define HLSL_SWIZZLE_SHIFT(idx) (2u * (idx)) + +static inline unsigned int hlsl_swizzle_get_component(unsigned int swizzle, unsigned int idx) +{ + return (swizzle >> HLSL_SWIZZLE_SHIFT(idx)) & HLSL_SWIZZLE_MASK; +} + enum hlsl_type_class { HLSL_CLASS_SCALAR, diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 9b644d1b..fefb8406 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -752,7 +752,7 @@ static struct hlsl_ir_node *copy_propagation_compute_replacement(struct hlsl_ctx TRACE("No single source for propagating load from %s[%u-%u].\n", var->name, start, start + count); return NULL; } - *swizzle |= value->component << i * 2; + *swizzle |= value->component << HLSL_SWIZZLE_SHIFT(i); } TRACE("Load from %s[%u-%u] propagated as instruction %p%s.\n", @@ -1316,7 +1316,7 @@ static bool remove_trivial_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *i return false; for (i = 0; i < instr->data_type->dimx; ++i) - if (((swizzle->swizzle >> (2 * i)) & 3) != i) + if (hlsl_swizzle_get_component(swizzle->swizzle, i) != i) return false; hlsl_replace_node(instr, swizzle->val.node); diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index ea59fb86..3210bbd5 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -603,7 +603,7 @@ bool hlsl_fold_constant_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst { struct hlsl_ir_constant *value, *res; struct hlsl_ir_swizzle *swizzle; - unsigned int i, swizzle_bits; + unsigned int i; if (instr->type != HLSL_IR_SWIZZLE) return false; @@ -615,12 +615,8 @@ bool hlsl_fold_constant_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst if (!(res = hlsl_new_constant(ctx, instr->data_type, &instr->loc))) return false; - swizzle_bits = swizzle->swizzle; for (i = 0; i < swizzle->node.data_type->dimx; ++i) - { - res->value[i] = value->value[swizzle_bits & 3]; - swizzle_bits >>= 2; - } + res->value[i] = value->value[hlsl_swizzle_get_component(swizzle->swizzle, i)]; list_add_before(&swizzle->node.entry, &res->node.entry); hlsl_replace_node(&swizzle->node, &res->node);
1
0
0
0
Francisco Casas : tests: Test constant propagation through swizzles.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 337b4c5db05d3920159e469d969258b0c9684014 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/337b4c5db05d3920159e469d96925…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri Dec 9 20:02:03 2022 -0300 tests: Test constant propagation through swizzles. The Load() method offsets are used for these tests since these must solve to constants in order to pass. --- Makefile.am | 1 + tests/swizzle-constant-prop.shader_test | 63 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/Makefile.am b/Makefile.am index 092223ee..0536c53b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -141,6 +141,7 @@ vkd3d_shader_tests = \ tests/swizzle-5.shader_test \ tests/swizzle-6.shader_test \ tests/swizzle-7.shader_test \ + tests/swizzle-constant-prop.shader_test \ tests/texture-load.shader_test \ tests/texture-load-offset.shader_test \ tests/texture-load-typed.shader_test \ diff --git a/tests/swizzle-constant-prop.shader_test b/tests/swizzle-constant-prop.shader_test new file mode 100644 index 00000000..2599983b --- /dev/null +++ b/tests/swizzle-constant-prop.shader_test @@ -0,0 +1,63 @@ +% The texel offset argument to Load() must resolve to a constant integer; +% make sure that we can do so. + +[require] +shader model >= 4.0 + + +[texture 0] +size (4, 4) + 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 + 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 + 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 12 +13 13 13 13 14 14 14 14 14 15 15 15 16 16 16 16 + + +[pixel shader todo] +Texture2D tex; +uniform int i; + +float4 main() : sv_target +{ + int4 a = {1, 2, i, i}; + return 100 * a + tex.Load(int3(0, 0, 0), a.xy); +} + +[test] +uniform 0 int 4 +todo draw quad +todo probe all rgba (110, 210, 410, 410) + + +[pixel shader todo] +Texture2D tex; +uniform int i; + +float4 main() : sv_target +{ + int4 a = {0, 1, 2, i}; + int4 b = a.yxww; + int3 c = b.wyx; + return 100 * b + tex.Load(int3(0, 0, 0), c.yz); +} + +[test] +uniform 0 int 3 +todo draw quad +todo probe all rgba (105, 5, 305, 305) + + +[pixel shader todo] +Texture2D tex; +uniform int i; + +float4 main() : sv_target +{ + int4 a = {1, 2, 3, i}; + return tex.Load(int3(0, 0, 0), a.wzxx.yxw.zx); +} + +[test] +uniform 0 int 1 +todo draw quad +todo probe all rgba (14.0, 14.0, 14.0, 14.0)
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Support offset argument for the texture Load() method.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: cf17882189e77f86042daf78968bb3d54dce2d74 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/cf17882189e77f86042daf78968bb…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri Nov 18 11:38:33 2022 -0300 vkd3d-shader/hlsl: Support offset argument for the texture Load() method. --- libs/vkd3d-shader/hlsl_sm4.c | 16 ++++++++++++++-- tests/texture-load-offset.shader_test | 10 +++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c index e06f4b15..06035a63 100644 --- a/libs/vkd3d-shader/hlsl_sm4.c +++ b/libs/vkd3d-shader/hlsl_sm4.c @@ -1441,7 +1441,8 @@ static void write_sm4_constant(struct hlsl_ctx *ctx, static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, const struct hlsl_type *resource_type, const struct hlsl_ir_node *dst, - const struct hlsl_deref *resource, const struct hlsl_ir_node *coords) + const struct hlsl_deref *resource, const struct hlsl_ir_node *coords, + const struct hlsl_ir_node *texel_offset) { bool uav = (resource_type->base_type == HLSL_TYPE_UAV); struct sm4_instruction instr; @@ -1450,6 +1451,16 @@ static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf memset(&instr, 0, sizeof(instr)); instr.opcode = uav ? VKD3D_SM5_OP_LD_UAV_TYPED : VKD3D_SM4_OP_LD; + if (texel_offset) + { + if (!encode_texel_offset_as_aoffimmi(&instr, texel_offset)) + { + hlsl_error(ctx, &texel_offset->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TEXEL_OFFSET, + "Offset must resolve to integer literal in the range -8 to 7."); + return; + } + } + sm4_dst_from_node(&instr.dsts[0], dst); instr.dst_count = 1; @@ -2204,7 +2215,8 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx, switch (load->load_type) { case HLSL_RESOURCE_LOAD: - write_sm4_ld(ctx, buffer, resource_type, &load->node, &load->resource, coords); + write_sm4_ld(ctx, buffer, resource_type, &load->node, &load->resource, + coords, texel_offset); break; case HLSL_RESOURCE_SAMPLE: diff --git a/tests/texture-load-offset.shader_test b/tests/texture-load-offset.shader_test index ab233c58..6d732190 100644 --- a/tests/texture-load-offset.shader_test +++ b/tests/texture-load-offset.shader_test @@ -8,7 +8,7 @@ size (3, 3) 0 2 0 1 1 2 0 1 2 2 0 1 -[pixel shader] +[pixel shader todo] Texture2D t; float4 main(float4 pos : sv_position) : sv_target @@ -18,14 +18,14 @@ float4 main(float4 pos : sv_position) : sv_target [test] -draw quad +todo draw quad todo probe (0, 0) rgba (0, 1, 0, 1) todo probe (1, 0) rgba (1, 1, 0, 1) todo probe (0, 1) rgba (0, 2, 0, 1) todo probe (1, 1) rgba (1, 2, 0, 1) -[pixel shader] +[pixel shader todo] Texture2D t; float4 main(float4 pos : sv_position) : sv_target @@ -35,14 +35,14 @@ float4 main(float4 pos : sv_position) : sv_target [test] -draw quad +todo draw quad todo probe (3, 0) rgba (1, 0, 0, 1) todo probe (4, 0) rgba (2, 0, 0, 1) todo probe (3, 1) rgba (1, 1, 0, 1) todo probe (4, 1) rgba (2, 1, 0, 1) -[pixel shader fail todo] +[pixel shader fail] Texture2D t; float4 main(float4 pos : sv_position) : sv_target
1
0
0
0
Francisco Casas : tests: Test offset argument for the texture Load() method.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 7a7b17d0e1ae2d0c9f600b4a064cb2e561c56c5c URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/7a7b17d0e1ae2d0c9f600b4a064cb…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri Nov 18 11:37:24 2022 -0300 tests: Test offset argument for the texture Load() method. --- Makefile.am | 1 + tests/texture-load-offset.shader_test | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/Makefile.am b/Makefile.am index 22b516b2..092223ee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -142,6 +142,7 @@ vkd3d_shader_tests = \ tests/swizzle-6.shader_test \ tests/swizzle-7.shader_test \ tests/texture-load.shader_test \ + tests/texture-load-offset.shader_test \ tests/texture-load-typed.shader_test \ tests/trigonometry.shader_test \ tests/uav.shader_test \ diff --git a/tests/texture-load-offset.shader_test b/tests/texture-load-offset.shader_test new file mode 100644 index 00000000..ab233c58 --- /dev/null +++ b/tests/texture-load-offset.shader_test @@ -0,0 +1,51 @@ +[require] +shader model >= 4.0 + +[texture 0] +size (3, 3) +0 0 0 1 1 0 0 1 2 0 0 1 +0 1 0 1 1 1 0 1 2 1 0 1 +0 2 0 1 1 2 0 1 2 2 0 1 + + +[pixel shader] +Texture2D t; + +float4 main(float4 pos : sv_position) : sv_target +{ + return t.Load(int3(pos.xy, 0), int2(0, 1)); +} + + +[test] +draw quad +todo probe (0, 0) rgba (0, 1, 0, 1) +todo probe (1, 0) rgba (1, 1, 0, 1) +todo probe (0, 1) rgba (0, 2, 0, 1) +todo probe (1, 1) rgba (1, 2, 0, 1) + + +[pixel shader] +Texture2D t; + +float4 main(float4 pos : sv_position) : sv_target +{ + return t.Load(int3(pos.xy, 0), int2(-2, 0)); +} + + +[test] +draw quad +todo probe (3, 0) rgba (1, 0, 0, 1) +todo probe (4, 0) rgba (2, 0, 0, 1) +todo probe (3, 1) rgba (1, 1, 0, 1) +todo probe (4, 1) rgba (2, 1, 0, 1) + + +[pixel shader fail todo] +Texture2D t; + +float4 main(float4 pos : sv_position) : sv_target +{ + return t.Load(int3(pos.xy, 0), int2(8, 1)); +}
1
0
0
0
Giovanni Mascellani : tests: Print DLL versions when running tests on Windows.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 1717dc0516de2e3536e7278c1df46734892260e3 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/1717dc0516de2e3536e7278c1df46…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Wed Jan 18 14:30:47 2023 +0100 tests: Print DLL versions when running tests on Windows. --- tests/shader_runner.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 0f205bfe..507fbdaf 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1058,13 +1058,101 @@ out: vkd3d_test_set_context(NULL); } +#ifdef _WIN32 +static void print_dll_version(const char *file_name) +{ + BOOL (WINAPI *GetFileVersionInfoA)(const char *, DWORD, DWORD, void *); + BOOL (WINAPI *VerQueryValueA)(void *, char *, void **, UINT*); + DWORD (WINAPI *GetFileVersionInfoSizeA)(const char *, DWORD *); + HMODULE version_module; + DWORD size, handle; + bool done = false; + + version_module = LoadLibraryA("version.dll"); + if (!version_module) + goto out; + +#define X(name) name = (void *)GetProcAddress(version_module, #name); + X(GetFileVersionInfoSizeA); + X(GetFileVersionInfoA); + X(VerQueryValueA); +#undef X + + if (!GetFileVersionInfoSizeA || !GetFileVersionInfoA || !VerQueryValueA) + { + FreeLibrary(version_module); + goto out; + } + + size = GetFileVersionInfoSizeA(file_name, &handle); + if (size) + { + char *data = malloc(size); + + if (GetFileVersionInfoA(file_name, handle, size, data)) + { + VS_FIXEDFILEINFO *info; + UINT len; + + if (VerQueryValueA(data, "\\", (void **)&info, &len)) + { + trace("%s version: %lu.%lu.%lu.%lu\n", file_name, + info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff, + info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff); + done = true; + } + } + free(data); + } + + FreeLibrary(version_module); + +out: + if (!done) + trace("%s version: unknown\n", file_name); +} +#endif + START_TEST(shader_runner) { -#ifdef _WIN32 +#if defined(VKD3D_CROSSTEST) + trace("Running tests from a Windows cross build\n"); + + trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d9.dll\n"); + run_shader_tests_d3d9(argc, argv); + + trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d11.dll\n"); + run_shader_tests_d3d11(argc, argv); + + trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d12.dll\n"); + run_shader_tests_d3d12(argc, argv); + + print_dll_version("d3dcompiler_47.dll"); + print_dll_version("dxgi.dll"); + print_dll_version("d3d9.dll"); + print_dll_version("d3d11.dll"); + print_dll_version("d3d12.dll"); +#elif defined(_WIN32) + trace("Running tests from a Windows non-cross build\n"); + + trace("Compiling shaders with vkd3d-shader and executing with d3d9.dll\n"); run_shader_tests_d3d9(argc, argv); + + trace("Compiling shaders with vkd3d-shader and executing with d3d11.dll\n"); run_shader_tests_d3d11(argc, argv); + + trace("Compiling shaders with vkd3d-shader and executing with vkd3d\n"); + run_shader_tests_d3d12(argc, argv); + + print_dll_version("d3d9.dll"); + print_dll_version("d3d11.dll"); #else + trace("Running tests from a Unix build\n"); + + trace("Compiling shaders with vkd3d-shader and executing with Vulkan\n"); run_shader_tests_vulkan(argc, argv); -#endif + + trace("Compiling shaders with vkd3d-shader and executing with vkd3d\n"); run_shader_tests_d3d12(argc, argv); +#endif }
1
0
0
0
Giovanni Mascellani : tests: Run d3d9 and d3d12 tests on non-cross builds too.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 2445743002fa3d207692613cf09113e2f667a41a URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/2445743002fa3d207692613cf0911…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Wed Jan 18 13:53:51 2023 +0100 tests: Run d3d9 and d3d12 tests on non-cross builds too. On cross builds, shaders are compiled with d3dcompiler_47.dll and run with d3dN.dll. On non-cross builds, shaders are compiled with vkd3d-shader and run with d3dN.dll (on Windows) or Vulkan and vkd3d (on Linux). --- Makefile.am | 2 ++ tests/shader_runner.c | 2 +- tests/shader_runner_d3d11.c | 7 +++++-- tests/shader_runner_d3d9.c | 4 ++++ tests/shader_runner_vulkan.c | 4 ++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index e248ae54..22b516b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -333,6 +333,8 @@ tests_hlsl_d3d12_LDADD = $(LDADD) @DL_LIBS@ tests_shader_runner_LDADD = $(LDADD) @DL_LIBS@ tests_shader_runner_SOURCES = \ tests/shader_runner.c \ + tests/shader_runner_d3d9.c \ + tests/shader_runner_d3d11.c \ tests/shader_runner_d3d12.c \ tests/shader_runner_vulkan.c tests_vkd3d_api_LDADD = libvkd3d.la @DL_LIBS@ diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 8e0ecc1a..0f205bfe 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1060,7 +1060,7 @@ out: START_TEST(shader_runner) { -#ifdef VKD3D_CROSSTEST +#ifdef _WIN32 run_shader_tests_d3d9(argc, argv); run_shader_tests_d3d11(argc, argv); #else diff --git a/tests/shader_runner_d3d11.c b/tests/shader_runner_d3d11.c index d2b4807c..ba9e3179 100644 --- a/tests/shader_runner_d3d11.c +++ b/tests/shader_runner_d3d11.c @@ -18,8 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifdef _WIN32 + #define COBJMACROS #define CONST_VTABLE +#define INITGUID #define VKD3D_TEST_NO_DEFS #include <d3d11_4.h> #define __vkd3d_d3dcommon_h__ @@ -29,8 +32,6 @@ #include "shader_runner.h" #include "vkd3d_test.h" -const GUID IID_IDXGIDevice = {0x54ec77fa, 0x1377, 0x44e6, {0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c}}; - static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory); static HRESULT (WINAPI *pD3D11CreateDevice)(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, @@ -711,3 +712,5 @@ void run_shader_tests_d3d11(int argc, char **argv) FreeLibrary(d3d11_module); FreeLibrary(dxgi_module); } + +#endif diff --git a/tests/shader_runner_d3d9.c b/tests/shader_runner_d3d9.c index e425da1b..fbeee8f9 100644 --- a/tests/shader_runner_d3d9.c +++ b/tests/shader_runner_d3d9.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifdef _WIN32 + #define COBJMACROS #define CONST_VTABLE #define VKD3D_TEST_NO_DEFS @@ -533,3 +535,5 @@ void run_shader_tests_d3d9(int argc, char **argv) } FreeLibrary(d3d9_module); } + +#endif diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index 39dbd787..74d3f09a 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef _WIN32 + #define VK_NO_PROTOTYPES #define VKD3D_TEST_NO_DEFS #include "config.h" @@ -1285,3 +1287,5 @@ void run_shader_tests_vulkan(int argc, char **argv) cleanup_vulkan_runner(&runner); } + +#endif
1
0
0
0
Giovanni Mascellani : tests: Distinguish between cross and non-cross Win32 builds.
by Alexandre Julliard
24 Jan '23
24 Jan '23
Module: vkd3d Branch: master Commit: 44d9e2d72836bd50495a9cc8ee9c6d15ff836aba URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/44d9e2d72836bd50495a9cc8ee9c6…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Wed Jan 18 14:31:07 2023 +0100 tests: Distinguish between cross and non-cross Win32 builds. Now the tests compile correctly on non-cross Win32 builds. --- Makefile.am | 2 +- tests/d3d12_crosstest.h | 4 ++-- tests/shader_runner.c | 2 +- tests/vkd3d_api.c | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 051d34ba..e248ae54 100644 --- a/Makefile.am +++ b/Makefile.am @@ -414,7 +414,7 @@ dummy-vkd3d-version: ## Cross-compile tests cross_implibs = crosslibs/d3d12 CROSS_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/include/private -I$(builddir)/include -CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=0 +CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=0 -DVKD3D_CROSSTEST=1 EXTRA_DIST += $(cross_implibs:=.cross32.def) $(cross_implibs:=.cross64.def) EXTRA_DIST += tests/shader_runner_d3d11.c tests/shader_runner_d3d9.c diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index e6dc7a6c..26f70018 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -56,7 +56,7 @@ typedef int HRESULT; #include <stddef.h> #include <time.h> -#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST # include "vkd3d_dxgi1_4.h" #else # define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_2 @@ -261,7 +261,7 @@ static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12Comm static bool use_warp_device; static unsigned int use_adapter_idx; -#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST static IUnknown *create_warp_adapter(IDXGIFactory4 *factory) { IUnknown *adapter; diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 0f205bfe..8e0ecc1a 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1060,7 +1060,7 @@ out: START_TEST(shader_runner) { -#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST run_shader_tests_d3d9(argc, argv); run_shader_tests_d3d11(argc, argv); #else diff --git a/tests/vkd3d_api.c b/tests/vkd3d_api.c index ab266c4b..5a585fec 100644 --- a/tests/vkd3d_api.c +++ b/tests/vkd3d_api.c @@ -16,6 +16,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +/* Hack for MinGW-w64 headers. + * + * We want to use WIDL C inline wrappers because some methods + * in D3D12 interfaces return aggregate objects. Unfortunately, + * WIDL C inline wrappers are broken when used with MinGW-w64 + * headers because FORCEINLINE expands to extern inline + * which leads to the "multiple storage classes in declaration + * specifiers" compiler error. + */ +#ifdef __MINGW32__ +# include <_mingw.h> +# ifdef __MINGW64_VERSION_MAJOR +# undef __forceinline +# define __forceinline __inline__ __attribute__((__always_inline__,__gnu_inline__)) +# endif +#endif + #define VK_NO_PROTOTYPES #define COBJMACROS #define INITGUID
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
47
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
Results per page:
10
25
50
100
200