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
October 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
702 discussions
Start a n
N
ew thread
Zebediah Figura : vkd3d-shader: Introduce a separate register type for combined samplers.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: 2bcd6ea893f47c8a1ef6d7a86811a1bd9c560c4e URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/2bcd6ea893f47c8a1ef6d7a86811a…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Mar 7 16:45:18 2023 -0600 vkd3d-shader: Introduce a separate register type for combined samplers. --- libs/vkd3d-shader/d3d_asm.c | 3 ++- libs/vkd3d-shader/vkd3d_shader_private.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d-shader/d3d_asm.c index 620a2d22..38a60735 100644 --- a/libs/vkd3d-shader/d3d_asm.c +++ b/libs/vkd3d-shader/d3d_asm.c @@ -637,7 +637,7 @@ static void shader_dump_decl_usage(struct vkd3d_d3d_asm_compiler *compiler, { struct vkd3d_string_buffer *buffer = &compiler->buffer; - if (semantic->resource.reg.reg.type == VKD3DSPR_SAMPLER) + if (semantic->resource.reg.reg.type == VKD3DSPR_COMBINED_SAMPLER) { switch (semantic->resource_type) { @@ -924,6 +924,7 @@ static void shader_dump_register(struct vkd3d_d3d_asm_compiler *compiler, const shader_addline(buffer, "aL"); break; + case VKD3DSPR_COMBINED_SAMPLER: case VKD3DSPR_SAMPLER: shader_addline(buffer, "s"); is_descriptor = true; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index f006d2db..37c96258 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -488,7 +488,7 @@ enum vkd3d_shader_register_type VKD3DSPR_CONSTINT = 7, VKD3DSPR_COLOROUT = 8, VKD3DSPR_DEPTHOUT = 9, - VKD3DSPR_SAMPLER = 10, + VKD3DSPR_COMBINED_SAMPLER = 10, VKD3DSPR_CONST2 = 11, VKD3DSPR_CONST3 = 12, VKD3DSPR_CONST4 = 13, @@ -504,6 +504,7 @@ enum vkd3d_shader_register_type VKD3DSPR_IMMCONSTBUFFER, VKD3DSPR_PRIMID, VKD3DSPR_NULL, + VKD3DSPR_SAMPLER, VKD3DSPR_RESOURCE, VKD3DSPR_UAV, VKD3DSPR_OUTPOINTID,
1
0
0
0
Nikolay Sivov : vkd3d-shader/tpf: Output interpolation modifiers for input declarations.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: 3af629cf8cc697e03ac636e8b954f9cd446a0bbb URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/3af629cf8cc697e03ac636e8b954f…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Sep 21 15:16:58 2023 +0200 vkd3d-shader/tpf: Output interpolation modifiers for input declarations. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/tpf.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index d03b0aca..c471d1c5 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -4174,7 +4174,33 @@ static void write_sm4_dcl_semantic(const struct tpf_writer *tpf, const struct hl enum vkd3d_shader_interpolation_mode mode = VKD3DSIM_LINEAR; if ((var->storage_modifiers & HLSL_STORAGE_NOINTERPOLATION) || type_is_integer(var->data_type)) + { mode = VKD3DSIM_CONSTANT; + } + else + { + static const struct + { + unsigned int modifiers; + enum vkd3d_shader_interpolation_mode mode; + } + modes[] = + { + { HLSL_STORAGE_CENTROID | HLSL_STORAGE_NOPERSPECTIVE, VKD3DSIM_LINEAR_NOPERSPECTIVE_CENTROID }, + { HLSL_STORAGE_NOPERSPECTIVE, VKD3DSIM_LINEAR_NOPERSPECTIVE }, + { HLSL_STORAGE_CENTROID, VKD3DSIM_LINEAR_CENTROID }, + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(modes); ++i) + { + if ((var->storage_modifiers & modes[i].modifiers) == modes[i].modifiers) + { + mode = modes[i].mode; + break; + } + } + } instr.extra_bits |= mode << VKD3D_SM4_INTERPOLATION_MODE_SHIFT; }
1
0
0
0
Nikolay Sivov : vkd3d-shader/hlsl: Propagate structure fields modifiers when copying shader inputs.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: 8479ceedfc80aa88fc6423844a7568fb656ecf13 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/8479ceedfc80aa88fc6423844a756…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Sep 21 15:14:55 2023 +0200 vkd3d-shader/hlsl: Propagate structure fields modifiers when copying shader inputs. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/hlsl_codegen.c | 15 ++++++++++++++- tests/hlsl/nointerpolation.shader_test | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index c0d18a3e..5c816e89 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -377,6 +377,8 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block * for (i = 0; i < hlsl_type_element_count(type); ++i) { + unsigned int element_modifiers = modifiers; + if (type->class == HLSL_CLASS_ARRAY) { elem_semantic_index = semantic_index @@ -391,6 +393,17 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block * semantic = &field->semantic; elem_semantic_index = semantic->index; loc = &field->loc; + element_modifiers |= field->storage_modifiers; + + /* TODO: 'sample' modifier is not supported yet */ + + /* 'nointerpolation' always takes precedence, next the same is done for 'sample', + remaining modifiers are combined. */ + if (element_modifiers & HLSL_STORAGE_NOINTERPOLATION) + { + element_modifiers &= ~HLSL_INTERPOLATION_MODIFIERS_MASK; + element_modifiers |= HLSL_STORAGE_NOINTERPOLATION; + } } if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc))) @@ -402,7 +415,7 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block * return; list_add_after(&c->entry, &element_load->node.entry); - prepend_input_copy_recurse(ctx, block, element_load, modifiers, semantic, elem_semantic_index); + prepend_input_copy_recurse(ctx, block, element_load, element_modifiers, semantic, elem_semantic_index); } } else diff --git a/tests/hlsl/nointerpolation.shader_test b/tests/hlsl/nointerpolation.shader_test index 04f39a8e..6c218be8 100644 --- a/tests/hlsl/nointerpolation.shader_test +++ b/tests/hlsl/nointerpolation.shader_test @@ -51,7 +51,7 @@ float4 main(ps_input input) : sv_target [test] draw triangle list 3 -todo probe all rgba (0.0, 1.0, 0.0, 1.0) +probe all rgba (0.0, 1.0, 0.0, 1.0) [vertex shader] struct ps_input @@ -105,7 +105,7 @@ float4 main(centroid ps_input input) : sv_target [test] draw triangle list 3 -todo probe all rgba (0.0, 1.0, 0.0, 1.0) +probe all rgba (0.0, 1.0, 0.0, 1.0) [vertex shader] struct ps_input
1
0
0
0
Nikolay Sivov : vkd3d-shader/hlsl: Allow interpolation modifiers on structure fields.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: 1930b51d97054b9323fd0940d6981d750e019ba4 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/1930b51d97054b9323fd0940d6981…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Sep 21 15:13:27 2023 +0200 vkd3d-shader/hlsl: Allow interpolation modifiers on structure fields. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/hlsl.h | 3 +++ libs/vkd3d-shader/hlsl.y | 2 +- tests/hlsl/nointerpolation.shader_test | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index cfd78351..59c543c7 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -361,6 +361,9 @@ struct hlsl_attribute HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \ HLSL_MODIFIER_COLUMN_MAJOR) +#define HLSL_INTERPOLATION_MODIFIERS_MASK (HLSL_STORAGE_NOINTERPOLATION | HLSL_STORAGE_CENTROID | \ + HLSL_STORAGE_NOPERSPECTIVE) + #define HLSL_MODIFIERS_MAJORITY_MASK (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR) #define HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT 0 diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 3feb35fb..ba738473 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -5051,7 +5051,7 @@ field: if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1))) YYABORT; - if (modifiers & ~HLSL_STORAGE_NOINTERPOLATION) + if (modifiers & ~HLSL_INTERPOLATION_MODIFIERS_MASK) { struct vkd3d_string_buffer *string; diff --git a/tests/hlsl/nointerpolation.shader_test b/tests/hlsl/nointerpolation.shader_test index 3193b2e6..04f39a8e 100644 --- a/tests/hlsl/nointerpolation.shader_test +++ b/tests/hlsl/nointerpolation.shader_test @@ -119,7 +119,7 @@ void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_posit pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); } -[pixel shader todo] +[pixel shader] struct ps_input { centroid float4 t : texcoord; @@ -131,10 +131,10 @@ float4 main(nointerpolation ps_input input) : sv_target } [test] -todo draw triangle list 3 -todo probe all rgba (0.0, 1.0, 0.0, 1.0) +draw triangle list 3 +probe all rgba (0.0, 1.0, 0.0, 1.0) -[vertex shader fail] +[vertex shader fail todo] struct ps_input { nointerpolation centroid float4 t : texcoord;
1
0
0
0
Nikolay Sivov : vkd3d-shader/hlsl: Parse 'centroid' and 'noperspective' modifiers.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: de860c3cbfd6a16981eea2b6b4ff24e6a5fb551a URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/de860c3cbfd6a16981eea2b6b4ff2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Sep 21 15:11:26 2023 +0200 vkd3d-shader/hlsl: Parse 'centroid' and 'noperspective' modifiers. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/hlsl.c | 4 ++++ libs/vkd3d-shader/hlsl.h | 2 ++ libs/vkd3d-shader/hlsl.l | 2 ++ libs/vkd3d-shader/hlsl.y | 10 ++++++++++ tests/hlsl/nointerpolation.shader_test | 6 +++--- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index f74712a9..b42e3088 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -2211,6 +2211,10 @@ struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsig vkd3d_string_buffer_printf(string, "extern "); if (modifiers & HLSL_STORAGE_NOINTERPOLATION) vkd3d_string_buffer_printf(string, "nointerpolation "); + if (modifiers & HLSL_STORAGE_CENTROID) + vkd3d_string_buffer_printf(string, "centroid "); + if (modifiers & HLSL_STORAGE_NOPERSPECTIVE) + vkd3d_string_buffer_printf(string, "noperspective "); if (modifiers & HLSL_MODIFIER_PRECISE) vkd3d_string_buffer_printf(string, "precise "); if (modifiers & HLSL_STORAGE_SHARED) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index cdcda671..cfd78351 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -354,6 +354,8 @@ struct hlsl_attribute #define HLSL_STORAGE_IN 0x00000800 #define HLSL_STORAGE_OUT 0x00001000 #define HLSL_MODIFIER_INLINE 0x00002000 +#define HLSL_STORAGE_CENTROID 0x00004000 +#define HLSL_STORAGE_NOPERSPECTIVE 0x00008000 #define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \ HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \ diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index e9ae3ccf..90abd64a 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -74,6 +74,7 @@ BlendState {return KW_BLENDSTATE; } break {return KW_BREAK; } Buffer {return KW_BUFFER; } cbuffer {return KW_CBUFFER; } +centroid {return KW_CENTROID; } compile {return KW_COMPILE; } const {return KW_CONST; } continue {return KW_CONTINUE; } @@ -95,6 +96,7 @@ inout {return KW_INOUT; } matrix {return KW_MATRIX; } namespace {return KW_NAMESPACE; } nointerpolation {return KW_NOINTERPOLATION; } +noperspective {return KW_NOPERSPECTIVE; } out {return KW_OUT; } packoffset {return KW_PACKOFFSET; } pass {return KW_PASS; } diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 78691392..3feb35fb 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4685,6 +4685,7 @@ static struct hlsl_scope *get_loop_scope(struct hlsl_scope *scope) %token KW_BREAK %token KW_BUFFER %token KW_CBUFFER +%token KW_CENTROID %token KW_COLUMN_MAJOR %token KW_COMPILE %token KW_CONST @@ -4707,6 +4708,7 @@ static struct hlsl_scope *get_loop_scope(struct hlsl_scope *scope) %token KW_MATRIX %token KW_NAMESPACE %token KW_NOINTERPOLATION +%token KW_NOPERSPECTIVE %token KW_OUT %token KW_PACKOFFSET %token KW_PASS @@ -6005,6 +6007,14 @@ var_modifiers: { $$ = add_modifiers(ctx, $2, HLSL_STORAGE_NOINTERPOLATION, &@1); } + | KW_CENTROID var_modifiers + { + $$ = add_modifiers(ctx, $2, HLSL_STORAGE_CENTROID, &@1); + } + | KW_NOPERSPECTIVE var_modifiers + { + $$ = add_modifiers(ctx, $2, HLSL_STORAGE_NOPERSPECTIVE, &@1); + } | KW_PRECISE var_modifiers { $$ = add_modifiers(ctx, $2, HLSL_MODIFIER_PRECISE, &@1); diff --git a/tests/hlsl/nointerpolation.shader_test b/tests/hlsl/nointerpolation.shader_test index e3152780..3193b2e6 100644 --- a/tests/hlsl/nointerpolation.shader_test +++ b/tests/hlsl/nointerpolation.shader_test @@ -92,7 +92,7 @@ void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_posit pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); } -[pixel shader todo] +[pixel shader] struct ps_input { nointerpolation float4 t : texcoord; @@ -104,7 +104,7 @@ float4 main(centroid ps_input input) : sv_target } [test] -todo draw triangle list 3 +draw triangle list 3 todo probe all rgba (0.0, 1.0, 0.0, 1.0) [vertex shader] @@ -146,7 +146,7 @@ void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_posit pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); } -[vertex shader todo] +[vertex shader] struct ps_input { nointerpolation float4 t : texcoord;
1
0
0
0
Nikolay Sivov : tests: Add a test for interpolation modifiers specified on structure fields.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: 4b8a4809d189959017de1fed5245d6fb52603919 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/4b8a4809d189959017de1fed5245d…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Sep 22 18:23:46 2023 +0200 tests: Add a test for interpolation modifiers specified on structure fields. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- tests/hlsl/nointerpolation.shader_test | 132 +++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/tests/hlsl/nointerpolation.shader_test b/tests/hlsl/nointerpolation.shader_test index 8f15be6e..e3152780 100644 --- a/tests/hlsl/nointerpolation.shader_test +++ b/tests/hlsl/nointerpolation.shader_test @@ -25,3 +25,135 @@ float4 main(nointerpolation float4 t : texcoord) : sv_target [test] draw triangle list 3 probe all rgba (0.0, 1.0, 0.0, 1.0) + +[vertex shader] +struct ps_input +{ + nointerpolation float4 t : texcoord; +}; + +void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_position) +{ + float2 coords = float2((id << 1) & 2, id & 2); + pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); +} + +[pixel shader] +struct ps_input +{ + nointerpolation float4 t : texcoord; +}; + +float4 main(ps_input input) : sv_target +{ + return input.t; +} + +[test] +draw triangle list 3 +todo probe all rgba (0.0, 1.0, 0.0, 1.0) + +[vertex shader] +struct ps_input +{ + nointerpolation float4 t : texcoord; +}; + +void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_position) +{ + float2 coords = float2((id << 1) & 2, id & 2); + pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); +} + +[pixel shader] +struct ps_input +{ + float4 t : texcoord; +}; + +float4 main(nointerpolation ps_input input) : sv_target +{ + return input.t; +} + +[test] +draw triangle list 3 +probe all rgba (0.0, 1.0, 0.0, 1.0) + +[vertex shader] +struct ps_input +{ + nointerpolation float4 t : texcoord; +}; + +void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_position) +{ + float2 coords = float2((id << 1) & 2, id & 2); + pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); +} + +[pixel shader todo] +struct ps_input +{ + nointerpolation float4 t : texcoord; +}; + +float4 main(centroid ps_input input) : sv_target +{ + return input.t; +} + +[test] +todo draw triangle list 3 +todo probe all rgba (0.0, 1.0, 0.0, 1.0) + +[vertex shader] +struct ps_input +{ + nointerpolation float4 t : texcoord; +}; + +void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_position) +{ + float2 coords = float2((id << 1) & 2, id & 2); + pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); +} + +[pixel shader todo] +struct ps_input +{ + centroid float4 t : texcoord; +}; + +float4 main(nointerpolation ps_input input) : sv_target +{ + return input.t; +} + +[test] +todo draw triangle list 3 +todo probe all rgba (0.0, 1.0, 0.0, 1.0) + +[vertex shader fail] +struct ps_input +{ + nointerpolation centroid float4 t : texcoord; +}; + +void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_position) +{ + float2 coords = float2((id << 1) & 2, id & 2); + pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); +} + +[vertex shader todo] +struct ps_input +{ + nointerpolation float4 t : texcoord; +}; + +void main(uint id : sv_vertexid, inout centroid ps_input input, out float4 pos : sv_position) +{ + float2 coords = float2((id << 1) & 2, id & 2); + pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1); +}
1
0
0
0
Nikolay Sivov : vkd3d-shader/tpf: Write 'continue' instruction.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: c5414fa92f8aecdb9b60e6cfe76e29387e00b88d URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/c5414fa92f8aecdb9b60e6cfe76e2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 25 20:44:05 2023 +0200 vkd3d-shader/tpf: Write 'continue' instruction. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/tpf.c | 4 ++++ tests/hlsl/for.shader_test | 4 ++-- tests/hlsl/loop.shader_test | 12 ++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index fb0bbdaa..d03b0aca 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -5200,6 +5200,10 @@ static void write_sm4_jump(const struct tpf_writer *tpf, const struct hlsl_ir_ju instr.opcode = VKD3D_SM4_OP_BREAK; break; + case HLSL_IR_JUMP_CONTINUE: + instr.opcode = VKD3D_SM4_OP_CONTINUE; + break; + case HLSL_IR_JUMP_DISCARD_NZ: { instr.opcode = VKD3D_SM4_OP_DISCARD | VKD3D_SM4_CONDITIONAL_NZ; diff --git a/tests/hlsl/for.shader_test b/tests/hlsl/for.shader_test index beb521e7..e0b0edc1 100644 --- a/tests/hlsl/for.shader_test +++ b/tests/hlsl/for.shader_test @@ -4,7 +4,7 @@ void main(out float tex : texcoord, inout float4 pos : sv_position) tex = pos.x; } -[pixel shader todo] +[pixel shader] float4 main(float tex : texcoord) : sv_target { int i; @@ -22,7 +22,7 @@ float4 main(float tex : texcoord) : sv_target } [test] -todo draw quad +draw quad probe ( 0, 0, 159, 480) rgba (10.0, 35.0, 0.0, 0.0) probe (161, 0, 479, 480) rgba (10.0, 38.0, 0.0, 0.0) probe (481, 0, 640, 480) rgba ( 5.0, 10.0, 0.0, 0.0) diff --git a/tests/hlsl/loop.shader_test b/tests/hlsl/loop.shader_test index 9f8bcb92..bf26b69c 100644 --- a/tests/hlsl/loop.shader_test +++ b/tests/hlsl/loop.shader_test @@ -42,7 +42,7 @@ uniform 0 float 4.0 draw quad probe all rgba (20.0, 20.0, 20.0, 20.0) -[pixel shader todo] +[pixel shader] float a; float4 main() : sv_target @@ -68,10 +68,10 @@ float4 main() : sv_target [test] uniform 0 float 4.0 -todo draw quad -todo probe all rgba (409.1, 409.1, 409.1, 409.1) +draw quad +probe all rgba (409.1, 409.1, 409.1, 409.1) -[pixel shader todo] +[pixel shader] float a; float4 main() : sv_target @@ -98,5 +98,5 @@ float4 main() : sv_target [test] uniform 0 float 4.0 -todo draw quad -todo probe all rgba (410.1, 410.1, 410.1, 410.1) +draw quad +probe all rgba (410.1, 410.1, 410.1, 410.1)
1
0
0
0
Nikolay Sivov : vkd3d-shader/hlsl: Handle 'continue' statements.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: e4b423d6b5ec5c8f8338fa299162392683e3715e URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/e4b423d6b5ec5c8f8338fa2991623…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 25 20:29:54 2023 +0200 vkd3d-shader/hlsl: Handle 'continue' statements. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/hlsl.c | 4 +++ libs/vkd3d-shader/hlsl.h | 4 +++ libs/vkd3d-shader/hlsl.y | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 0bfba35f..f74712a9 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -2558,6 +2558,10 @@ static void dump_ir_jump(struct vkd3d_string_buffer *buffer, const struct hlsl_i case HLSL_IR_JUMP_RETURN: vkd3d_string_buffer_printf(buffer, "return"); break; + + case HLSL_IR_JUMP_UNRESOLVED_CONTINUE: + vkd3d_string_buffer_printf(buffer, "unresolved_continue"); + break; } } diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 25d78417..cdcda671 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -574,6 +574,10 @@ enum hlsl_ir_jump_type HLSL_IR_JUMP_DISCARD_NEG, HLSL_IR_JUMP_DISCARD_NZ, HLSL_IR_JUMP_RETURN, + /* UNRESOLVED_CONTINUE type is used by the parser when 'continue' statement is found, + it never reaches code generation, and is resolved to CONTINUE type once iteration + and loop exit logic was properly applied. */ + HLSL_IR_JUMP_UNRESOLVED_CONTINUE, }; struct hlsl_ir_jump diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 76ce9dc4..78691392 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -464,6 +464,50 @@ static bool attribute_list_has_duplicates(const struct parse_attribute_list *att return false; } +static void resolve_loop_continue(struct hlsl_ctx *ctx, struct hlsl_block *block, enum loop_type type, + struct hlsl_block *cond, struct hlsl_block *iter) +{ + struct hlsl_ir_node *instr, *next; + + LIST_FOR_EACH_ENTRY_SAFE(instr, next, &block->instrs, struct hlsl_ir_node, entry) + { + if (instr->type == HLSL_IR_IF) + { + struct hlsl_ir_if *iff = hlsl_ir_if(instr); + + resolve_loop_continue(ctx, &iff->then_block, type, cond, iter); + resolve_loop_continue(ctx, &iff->else_block, type, cond, iter); + } + else if (instr->type == HLSL_IR_JUMP) + { + struct hlsl_ir_jump *jump = hlsl_ir_jump(instr); + struct hlsl_block block; + + if (jump->type != HLSL_IR_JUMP_UNRESOLVED_CONTINUE) + continue; + + if (type == LOOP_DO_WHILE) + { + if (!hlsl_clone_block(ctx, &block, cond)) + return; + if (!append_conditional_break(ctx, &block)) + { + hlsl_block_cleanup(&block); + return; + } + list_move_before(&instr->entry, &block.instrs); + } + else if (type == LOOP_FOR) + { + if (!hlsl_clone_block(ctx, &block, iter)) + return; + list_move_before(&instr->entry, &block.instrs); + } + jump->type = HLSL_IR_JUMP_CONTINUE; + } + } +} + static struct hlsl_block *create_loop(struct hlsl_ctx *ctx, enum loop_type type, const struct parse_attribute_list *attributes, struct hlsl_block *init, struct hlsl_block *cond, struct hlsl_block *iter, struct hlsl_block *body, const struct vkd3d_shader_location *loc) @@ -501,6 +545,8 @@ static struct hlsl_block *create_loop(struct hlsl_ctx *ctx, enum loop_type type, } } + resolve_loop_continue(ctx, body, type, cond, iter); + if (!init && !(init = make_empty_block(ctx))) goto oom; @@ -6137,6 +6183,24 @@ jump_statement: YYABORT; hlsl_block_add_instr($$, jump); } + | KW_CONTINUE ';' + { + struct hlsl_ir_node *jump; + struct hlsl_scope *scope; + + if (!(scope = get_loop_scope(ctx->cur_scope))) + { + hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, + "The 'continue' statement must be used inside of a loop."); + } + + if (!($$ = make_empty_block(ctx))) + YYABORT; + + if (!(jump = hlsl_new_jump(ctx, HLSL_IR_JUMP_UNRESOLVED_CONTINUE, NULL, &@1))) + YYABORT; + hlsl_block_add_instr($$, jump); + } | KW_RETURN expr ';' { $$ = $2;
1
0
0
0
Nikolay Sivov : vkd3d-shader/hlsl: Allow 'break' instructions in loops.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: 0e5749e78e9523f5f52731b41245dda37a542d29 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/0e5749e78e9523f5f52731b41245d…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 25 16:30:02 2023 +0200 vkd3d-shader/hlsl: Allow 'break' instructions in loops. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/hlsl.h | 2 ++ libs/vkd3d-shader/hlsl.y | 53 ++++++++++++++++++++++++++++++++++++++-------- tests/hlsl/for.shader_test | 7 ++++++ 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 6e6d8227..25d78417 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -699,6 +699,8 @@ struct hlsl_scope struct rb_tree types; /* Scope containing this scope. This value is NULL for the global scope. */ struct hlsl_scope *upper; + /* The scope was created for the loop statement. */ + bool loop; }; struct hlsl_profile_info diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 8c327c79..76ce9dc4 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4587,6 +4587,14 @@ static void validate_texture_format_type(struct hlsl_ctx *ctx, struct hlsl_type } } +static struct hlsl_scope *get_loop_scope(struct hlsl_scope *scope) +{ + if (scope->loop) + return scope; + + return scope->upper ? get_loop_scope(scope->upper) : NULL; +} + } %locations @@ -5292,6 +5300,13 @@ scope_start: hlsl_push_scope(ctx); } +loop_scope_start: + %empty + { + hlsl_push_scope(ctx); + ctx->cur_scope->loop = true; + } + var_identifier: VAR_IDENTIFIER | NEW_IDENTIFIER @@ -6104,7 +6119,25 @@ statement: | loop_statement jump_statement: - KW_RETURN expr ';' + KW_BREAK ';' + { + struct hlsl_ir_node *jump; + + /* TODO: allow 'break' in the 'switch' statements. */ + + if (!get_loop_scope(ctx->cur_scope)) + { + hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, + "The 'break' statement must be used inside of a loop."); + } + + if (!($$ = make_empty_block(ctx))) + YYABORT; + if (!(jump = hlsl_new_jump(ctx, HLSL_IR_JUMP_BREAK, NULL, &@1))) + YYABORT; + hlsl_block_add_instr($$, jump); + } + | KW_RETURN expr ';' { $$ = $2; if (!add_return(ctx, $$, node_from_block($$), &@1)) @@ -6193,22 +6226,24 @@ if_body: } loop_statement: - attribute_list_optional KW_WHILE '(' expr ')' statement + attribute_list_optional loop_scope_start KW_WHILE '(' expr ')' statement { - $$ = create_loop(ctx, LOOP_WHILE, &$1, NULL, $4, NULL, $6, &@2); + $$ = create_loop(ctx, LOOP_WHILE, &$1, NULL, $5, NULL, $7, &@3); + hlsl_pop_scope(ctx); } - | attribute_list_optional KW_DO statement KW_WHILE '(' expr ')' ';' + | attribute_list_optional loop_scope_start KW_DO statement KW_WHILE '(' expr ')' ';' { - $$ = create_loop(ctx, LOOP_DO_WHILE, &$1, NULL, $6, NULL, $3, &@2); + $$ = create_loop(ctx, LOOP_DO_WHILE, &$1, NULL, $7, NULL, $4, &@3); + hlsl_pop_scope(ctx); } - | attribute_list_optional KW_FOR '(' scope_start expr_statement expr_statement expr_optional ')' statement + | attribute_list_optional loop_scope_start KW_FOR '(' expr_statement expr_statement expr_optional ')' statement { - $$ = create_loop(ctx, LOOP_FOR, &$1, $5, $6, $7, $9, &@2); + $$ = create_loop(ctx, LOOP_FOR, &$1, $5, $6, $7, $9, &@3); hlsl_pop_scope(ctx); } - | attribute_list_optional KW_FOR '(' scope_start declaration expr_statement expr_optional ')' statement + | attribute_list_optional loop_scope_start KW_FOR '(' declaration expr_statement expr_optional ')' statement { - $$ = create_loop(ctx, LOOP_FOR, &$1, $5, $6, $7, $9, &@2); + $$ = create_loop(ctx, LOOP_FOR, &$1, $5, $6, $7, $9, &@3); hlsl_pop_scope(ctx); } diff --git a/tests/hlsl/for.shader_test b/tests/hlsl/for.shader_test index b6896981..beb521e7 100644 --- a/tests/hlsl/for.shader_test +++ b/tests/hlsl/for.shader_test @@ -54,3 +54,10 @@ float4 main(float tex : texcoord) : sv_target } return float4(i, x, 0.0, 0.0); } + +[pixel shader fail] +float4 main() : sv_target +{ + break; + return float4(0.0, 0.0, 0.0, 0.0); +}
1
0
0
0
Nikolay Sivov : tests: Add some tests for 'break'/'continue' in loops.
by Alexandre Julliard
10 Oct '23
10 Oct '23
Module: vkd3d Branch: master Commit: 89f493b900197d18ea170a86d66a7369d23edd35 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/89f493b900197d18ea170a86d66a7…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Sep 26 14:49:59 2023 +0200 tests: Add some tests for 'break'/'continue' in loops. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- tests/hlsl/loop.shader_test | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/hlsl/loop.shader_test b/tests/hlsl/loop.shader_test index 75a31f7a..9f8bcb92 100644 --- a/tests/hlsl/loop.shader_test +++ b/tests/hlsl/loop.shader_test @@ -41,3 +41,62 @@ float4 main() : sv_target uniform 0 float 4.0 draw quad probe all rgba (20.0, 20.0, 20.0, 20.0) + +[pixel shader todo] +float a; + +float4 main() : sv_target +{ + int i = 0; + float res = a; + + while (i < 10) + { + if (i == 5) + { + res += 0.1f; + break; + } + res += 1.0f; + i++; + if (i == 2) continue; + res += 100.f; + } + + return res; +} + +[test] +uniform 0 float 4.0 +todo draw quad +todo probe all rgba (409.1, 409.1, 409.1, 409.1) + +[pixel shader todo] +float a; + +float4 main() : sv_target +{ + int i = 0; + float res = a; + + do + { + res += 1.0f; + if (i == 5) + { + res += 0.1f; + break; + } + i++; + if (i == 2) continue; + res += 100.f; + } + while (i < 10); + + return res; +} + +[test] +uniform 0 float 4.0 +todo draw quad +todo probe all rgba (410.1, 410.1, 410.1, 410.1)
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
71
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
61
62
63
64
65
66
67
68
69
70
71
Results per page:
10
25
50
100
200