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 2024
----- 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
711 discussions
Start a n
N
ew thread
Giovanni Mascellani : vkd3d-shader/ir: Validate RET instructions.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: 67902d4304dc12cd187b679125efbcd69fcda64a URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/67902d4304dc12cd187b679125efb…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Jan 12 11:10:22 2024 +0100 vkd3d-shader/ir: Validate RET instructions. --- libs/vkd3d-shader/ir.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index c009fd90..14288a38 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -2874,6 +2874,11 @@ static void vsir_validate_instruction(struct validation_context *ctx) --ctx->depth; break; + case VKD3DSIH_RET: + vsir_validate_dst_count(ctx, instruction, 0); + vsir_validate_src_count(ctx, instruction, 0); + break; + case VKD3DSIH_LABEL: vsir_validate_cf_type(ctx, instruction, CF_TYPE_BLOCKS); vsir_validate_dst_count(ctx, instruction, 0);
1
0
0
0
Giovanni Mascellani : vkd3d-shader/ir: Validate SWITCH_MONOLITHIC instructions.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: af967302766b193157843069f566935bb5f27c97 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/af967302766b193157843069f5669…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Jan 12 10:50:30 2024 +0100 vkd3d-shader/ir: Validate SWITCH_MONOLITHIC instructions. --- libs/vkd3d-shader/ir.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index ed53ece2..c009fd90 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -2921,6 +2921,51 @@ static void vsir_validate_instruction(struct validation_context *ctx) } break; + case VKD3DSIH_SWITCH_MONOLITHIC: + { + unsigned int case_count; + + vsir_validate_cf_type(ctx, instruction, CF_TYPE_BLOCKS); + vsir_validate_dst_count(ctx, instruction, 0); + /* Parameters are source, default label, merge label and + * then pairs of constant value and case label. */ + if (!vsir_validate_src_min_count(ctx, instruction, 3)) + break; + if (instruction->src_count % 2 != 1) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SOURCE_COUNT, + "Invalid source count %u for a monolithic SWITCH instruction, it must be an odd number.", + instruction->src_count); + + if (!vsir_register_is_label(&instruction->src[1].reg)) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, + "Invalid default label register of type %#x in monolithic SWITCH instruction, expected LABEL.", + instruction->src[1].reg.type); + + if (!vsir_register_is_label(&instruction->src[2].reg)) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, + "Invalid merge label register of type %#x in monolithic SWITCH instruction, expected LABEL.", + instruction->src[2].reg.type); + + case_count = (instruction->src_count - 3) / 2; + + for (i = 0; i < case_count; ++i) + { + unsigned int value_idx = 3 + 2 * i; + unsigned int label_idx = 3 + 2 * i + 1; + + if (!register_is_constant(&instruction->src[value_idx].reg)) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, + "Invalid value register for case %zu of type %#x in monolithic SWITCH instruction, " + "expected IMMCONST or IMMCONST64.", i, instruction->src[value_idx].reg.type); + + if (!vsir_register_is_label(&instruction->src[label_idx].reg)) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, + "Invalid label register for case %zu of type %#x in monolithic SWITCH instruction, " + "expected LABEL.", i, instruction->src[value_idx].reg.type); + } + break; + } + default: break; }
1
0
0
0
Giovanni Mascellani : vkd3d-shader/ir: Validate BRANCH instructions.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: 46ebb404d76d7c5b314880ede1e8549e70fd20ae URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/46ebb404d76d7c5b314880ede1e85…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Dec 22 17:11:41 2023 +0100 vkd3d-shader/ir: Validate BRANCH instructions. --- libs/vkd3d-shader/ir.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index a4bea461..ed53ece2 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -2650,6 +2650,34 @@ static void vsir_validate_src_count(struct validation_context *ctx, instruction->src_count, instruction->handler_idx, count); } +static bool vsir_validate_src_min_count(struct validation_context *ctx, + const struct vkd3d_shader_instruction *instruction, unsigned int count) +{ + if (instruction->src_count < count) + { + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SOURCE_COUNT, + "Invalid source count %u for an instruction of type %#x, expected at least %u.", + instruction->src_count, instruction->handler_idx, count); + return false; + } + + return true; +} + +static bool vsir_validate_src_max_count(struct validation_context *ctx, + const struct vkd3d_shader_instruction *instruction, unsigned int count) +{ + if (instruction->src_count > count) + { + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SOURCE_COUNT, + "Invalid source count %u for an instruction of type %#x, expected at most %u.", + instruction->src_count, instruction->handler_idx, count); + return false; + } + + return true; +} + static const char *name_from_cf_type(enum cf_type type) { switch (type) @@ -2856,6 +2884,43 @@ static void vsir_validate_instruction(struct validation_context *ctx) instruction->src[0].reg.type); break; + case VKD3DSIH_BRANCH: + vsir_validate_cf_type(ctx, instruction, CF_TYPE_BLOCKS); + vsir_validate_dst_count(ctx, instruction, 0); + if (!vsir_validate_src_min_count(ctx, instruction, 1)) + break; + if (vsir_register_is_label(&instruction->src[0].reg)) + { + /* Unconditional branch: parameters are jump label, + * optional merge label, optional continue label. */ + vsir_validate_src_max_count(ctx, instruction, 3); + + for (i = 0; i < instruction->src_count; ++i) + { + if (!vsir_register_is_label(&instruction->src[i].reg)) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, + "Invalid register of type %#x in unconditional BRANCH instruction, expected LABEL.", + instruction->src[i].reg.type); + } + } + else + { + /* Conditional branch: parameters are condition, true + * jump label, false jump label, optional merge label, + * optional continue label. */ + vsir_validate_src_min_count(ctx, instruction, 3); + vsir_validate_src_max_count(ctx, instruction, 5); + + for (i = 1; i < instruction->src_count; ++i) + { + if (!vsir_register_is_label(&instruction->src[i].reg)) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, + "Invalid register of type %#x in conditional BRANCH instruction, expected LABEL.", + instruction->src[i].reg.type); + } + } + break; + default: break; }
1
0
0
0
Giovanni Mascellani : vkd3d-shader/ir: Validate LABEL instructions.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: bc9db34cdc8708c028062942a67511ee5d337e73 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/bc9db34cdc8708c028062942a6751…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Dec 22 15:58:55 2023 +0100 vkd3d-shader/ir: Validate LABEL instructions. --- libs/vkd3d-shader/ir.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 49d58053..a4bea461 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -2846,6 +2846,16 @@ static void vsir_validate_instruction(struct validation_context *ctx) --ctx->depth; break; + case VKD3DSIH_LABEL: + vsir_validate_cf_type(ctx, instruction, CF_TYPE_BLOCKS); + vsir_validate_dst_count(ctx, instruction, 0); + vsir_validate_src_count(ctx, instruction, 1); + if (instruction->src_count >= 1 && !vsir_register_is_label(&instruction->src[0].reg)) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE, + "Invalid register of type %#x in a LABEL instruction, expected LABEL.", + instruction->src[0].reg.type); + break; + default: break; }
1
0
0
0
Giovanni Mascellani : vkd3d-shader/ir: Validate LABEL registers.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: dd1b2feec09e606c589937494813807440fe49a0 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/dd1b2feec09e606c5899374948138…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Dec 22 14:36:30 2023 +0100 vkd3d-shader/ir: Validate LABEL registers. --- libs/vkd3d-shader/ir.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index c906e027..49d58053 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -2484,6 +2484,37 @@ static void vsir_validate_register(struct validation_context *ctx, break; } + case VKD3DSPR_LABEL: + if (reg->precision != VKD3D_SHADER_REGISTER_PRECISION_DEFAULT) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION, "Invalid precision %#x for a LABEL register.", + reg->precision); + + if (reg->data_type != VKD3D_DATA_UINT) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE, "Invalid data type %#x for a LABEL register.", + reg->data_type); + + if (reg->dimension != VSIR_DIMENSION_NONE) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION, "Invalid dimension %#x for a LABEL register.", + reg->dimension); + + if (reg->idx_count != 1) + { + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a LABEL register.", + reg->idx_count); + break; + } + + if (reg->idx[0].rel_addr) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "Non-NULL relative address for a LABEL register."); + + /* Index == 0 is invalid, but it is temporarily allowed + * for intermediate stages. Once we support validation + * dialects we can selectively check for that. */ + if (reg->idx[0].offset > ctx->parser->shader_desc.block_count) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "LABEL register index %u exceeds the maximum count %u.", + reg->idx[0].offset, ctx->parser->shader_desc.block_count); + break; + case VKD3DSPR_NULL: if (reg->idx_count != 0) validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a NULL register.",
1
0
0
0
Giovanni Mascellani : vkd3d-shader/ir: Validate that structured CF does not appear in block-based shaders.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: 17f4afc2b55b45911005c718068810682dd6908f URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/17f4afc2b55b45911005c71806881…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Jan 12 09:28:14 2024 +0100 vkd3d-shader/ir: Validate that structured CF does not appear in block-based shaders. --- libs/vkd3d-shader/ir.c | 70 ++++++++++++++++++++++++++++---- libs/vkd3d-shader/vkd3d_shader_private.h | 2 +- 2 files changed, 64 insertions(+), 8 deletions(-)
1
0
0
0
Giovanni Mascellani : vkd3d-shader/spirv: Normalise the shader before allocating registers.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: 1d45b7a4220800f1f4ad72096d8dc9a9f20a442a URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/1d45b7a4220800f1f4ad72096d8dc…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Wed Jan 17 14:07:27 2024 +0100 vkd3d-shader/spirv: Normalise the shader before allocating registers. So registers are allocated after normalisation (which could require additional registers). --- libs/vkd3d-shader/spirv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 74db0c45..e8068f3a 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -9680,6 +9680,9 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, enum vkd3d_result result = VKD3D_OK; unsigned int i; + if ((result = vkd3d_shader_normalise(parser, compile_info)) < 0) + return result; + if (parser->shader_desc.temp_count) spirv_compiler_emit_temps(compiler, parser->shader_desc.temp_count); if (parser->shader_desc.ssa_count) @@ -9690,9 +9693,6 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, compiler->location.column = 0; compiler->location.line = 1; - if ((result = vkd3d_shader_normalise(parser, compile_info)) < 0) - return result; - if (parser->shader_desc.block_count && !spirv_compiler_init_blocks(compiler, parser->shader_desc.block_count)) return VKD3D_ERROR_OUT_OF_MEMORY;
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Forbid mismatched argument types in ternaries.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: 9ad48f16ea261792045d16e884eb1f768227d90c URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/9ad48f16ea261792045d16e884eb1…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Jan 16 18:45:29 2024 -0600 vkd3d-shader/hlsl: Forbid mismatched argument types in ternaries. --- libs/vkd3d-shader/hlsl.y | 16 ++++++++++++++++ tests/hlsl/ternary.shader_test | 8 ++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 12c955f2..c308916e 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4120,6 +4120,22 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block, common_type = hlsl_get_numeric_type(ctx, cond_type->class, common_type->base_type, cond_type->dimx, cond_type->dimy); } + else if (cond_type->dimx != common_type->dimx || cond_type->dimy != common_type->dimy) + { + /* This condition looks wrong but is correct. + * floatN is compatible with float1xN, but not with floatNx1. */ + + struct vkd3d_string_buffer *cond_string, *value_string; + + cond_string = hlsl_type_to_string(ctx, cond_type); + value_string = hlsl_type_to_string(ctx, common_type); + if (cond_string && value_string) + hlsl_error(ctx, &first->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, + "Ternary condition type '%s' is not compatible with value type '%s'.", + cond_string->buffer, value_string->buffer); + hlsl_release_string_buffer(ctx, cond_string); + hlsl_release_string_buffer(ctx, value_string); + } if (!(first = add_implicit_conversion(ctx, block, first, common_type, &first->loc))) return false; diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 5f38d896..902d2e11 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -124,7 +124,7 @@ probe all rgba (5.0, 6.0, 7.0, 1.0) % * the result operands are scalar; % * one is a typeN and the other is a type1xN -[pixel shader fail todo] +[pixel shader fail] uniform float4 cond; uniform float2x2 a, b; @@ -135,7 +135,7 @@ float4 main() : sv_target } -[pixel shader fail todo] +[pixel shader fail] uniform float2x2 cond; uniform float4 a, b; @@ -162,7 +162,7 @@ draw quad probe all rgba (1.0, 6.0, 7.0, 4.0) -[pixel shader fail todo] +[pixel shader fail] uniform float3 cond; uniform float4 a, b; @@ -174,7 +174,7 @@ float4 main() : sv_target } -[pixel shader fail todo] +[pixel shader fail] uniform float4 cond; uniform float4x1 a, b;
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Handle scalar values in ternaries.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: 275901557caab05a73f05aad2de4cf9079887f10 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/275901557caab05a73f05aad2de4c…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Jan 16 18:14:30 2024 -0600 vkd3d-shader/hlsl: Handle scalar values in ternaries. --- libs/vkd3d-shader/hlsl.y | 5 +++++ tests/hlsl/ternary.shader_test | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 9ee67914..12c955f2 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4115,6 +4115,11 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block, if (!(cond = add_implicit_conversion(ctx, block, cond, cond_type, &cond->loc))) return false; } + else if (common_type->dimx == 1 && common_type->dimy == 1) + { + common_type = hlsl_get_numeric_type(ctx, cond_type->class, + common_type->base_type, cond_type->dimx, cond_type->dimy); + } if (!(first = add_implicit_conversion(ctx, block, first, common_type, &first->loc))) return false; diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 3b62513d..5f38d896 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -282,7 +282,7 @@ draw quad probe all rgba (5.0, 6.0, 7.0, 8.0) -[pixel shader todo] +[pixel shader] uniform float4 cond; uniform float4 a, b; @@ -296,11 +296,11 @@ float4 main() : sv_target uniform 0 float4 1.0 0.0 1.0 0.0 uniform 4 float4 1.0 2.0 3.0 4.0 uniform 8 float4 5.0 6.0 7.0 8.0 -todo draw quad +draw quad probe all rgba (1.0, 5.0, 1.0, 5.0) -[pixel shader todo] +[pixel shader] // "scalar" can mean any 1-component numeric type. static float4 cond = {1, 0, 0, 1}; @@ -313,7 +313,7 @@ float4 main() : sv_target } [test] -todo draw quad +draw quad probe all rgba (2.0, 3.0, 3.0, 2.0)
1
0
0
0
Zebediah Figura : vkd3d-shader/hlsl: Handle scalar conditions in ternaries.
by Alexandre Julliard
18 Jan '24
18 Jan '24
Module: vkd3d Branch: master Commit: 11112798c8812c507266c2be4d36494e6135ec20 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/11112798c8812c507266c2be4d364…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Jan 16 18:09:43 2024 -0600 vkd3d-shader/hlsl: Handle scalar conditions in ternaries. --- libs/vkd3d-shader/hlsl.y | 13 +++++++++++-- tests/hlsl/ternary.shader_test | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 5552db11..9ee67914 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4089,13 +4089,14 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *cond, struct hlsl_ir_node *first, struct hlsl_ir_node *second) { struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0}; + struct hlsl_type *cond_type = cond->data_type; struct hlsl_type *common_type; - if (cond->data_type->class > HLSL_CLASS_LAST_NUMERIC) + if (cond_type->class > HLSL_CLASS_LAST_NUMERIC) { struct vkd3d_string_buffer *string; - if ((string = hlsl_type_to_string(ctx, cond->data_type))) + if ((string = hlsl_type_to_string(ctx, cond_type))) hlsl_error(ctx, &cond->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Ternary condition type '%s' is not numeric.", string->buffer); hlsl_release_string_buffer(ctx, string); @@ -4107,6 +4108,14 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block, if (!(common_type = get_common_numeric_type(ctx, first, second, &first->loc))) return false; + if (cond_type->dimx == 1 && cond_type->dimy == 1) + { + cond_type = hlsl_get_numeric_type(ctx, common_type->class, + HLSL_TYPE_BOOL, common_type->dimx, common_type->dimy); + if (!(cond = add_implicit_conversion(ctx, block, cond, cond_type, &cond->loc))) + return false; + } + if (!(first = add_implicit_conversion(ctx, block, first, common_type, &first->loc))) return false; diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index f4fffb29..3b62513d 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -114,7 +114,7 @@ float4 main() : sv_target [test] draw quad -todo probe all rgba (5.0, 6.0, 7.0, 1.0) +probe all rgba (5.0, 6.0, 7.0, 1.0) % More restrictions are placed on the type of the first (condition) operand, @@ -265,7 +265,7 @@ draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) -[pixel shader todo] +[pixel shader] // "scalar" can mean any 1-component numeric type. static float1x1 cond = {0}; @@ -278,7 +278,7 @@ float4 main() : sv_target } [test] -todo draw quad +draw quad probe all rgba (5.0, 6.0, 7.0, 8.0)
1
0
0
0
← Newer
1
...
44
45
46
47
48
49
50
...
72
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
72
Results per page:
10
25
50
100
200