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
April 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
590 discussions
Start a n
N
ew thread
Conor McCarthy : vkd3d-shader/dxil: Emit an error if a CMPXCHG instruction uses a forward-referenced pointer.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: 05510c118ab07c323307b9bde886c8c65f586b73 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/05510c118ab07c323307b9bde886c…
Author: Conor McCarthy <cmccarthy(a)codeweavers.com> Date: Sat Apr 27 00:13:10 2024 +1000 vkd3d-shader/dxil: Emit an error if a CMPXCHG instruction uses a forward-referenced pointer. --- libs/vkd3d-shader/dxil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 5bb05058..556902c2 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -6462,7 +6462,8 @@ static void sm6_parser_emit_cmpxchg(struct sm6_parser *sm6, const struct dxil_re uint64_t code; if (!(ptr = sm6_parser_get_value_by_ref(sm6, record, NULL, &i)) - || !sm6_value_validate_is_pointer_to_i32(ptr, sm6)) + || !sm6_value_validate_is_pointer_to_i32(ptr, sm6) + || !sm6_value_validate_is_backward_ref(ptr, sm6)) return; if (ptr->u.reg.type != VKD3DSPR_GROUPSHAREDMEM)
1
0
0
0
Conor McCarthy : vkd3d-shader/dxil: Emit an error if a ATOMICRMW instruction uses a forward-referenced pointer.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: b67a68b486fc47cff3fb11a634fbb67da1ffab0b URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/b67a68b486fc47cff3fb11a634fbb…
Author: Conor McCarthy <cmccarthy(a)codeweavers.com> Date: Sat Apr 27 00:12:54 2024 +1000 vkd3d-shader/dxil: Emit an error if a ATOMICRMW instruction uses a forward-referenced pointer. --- libs/vkd3d-shader/dxil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 99227d80..5bb05058 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -3961,7 +3961,8 @@ static void sm6_parser_emit_atomicrmw(struct sm6_parser *sm6, const struct dxil_ uint64_t code; if (!(ptr = sm6_parser_get_value_by_ref(sm6, record, NULL, &i)) - || !sm6_value_validate_is_pointer_to_i32(ptr, sm6)) + || !sm6_value_validate_is_pointer_to_i32(ptr, sm6) + || !sm6_value_validate_is_backward_ref(ptr, sm6)) return; if (ptr->u.reg.type != VKD3DSPR_GROUPSHAREDMEM)
1
0
0
0
Conor McCarthy : vkd3d-shader/dxil: Emit an error if a STORE instruction uses a forward-referenced pointer.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: 9615c38968aee04dcec4df42c9fbf2a986655ef6 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/9615c38968aee04dcec4df42c9fbf…
Author: Conor McCarthy <cmccarthy(a)codeweavers.com> Date: Sat Apr 27 00:12:35 2024 +1000 vkd3d-shader/dxil: Emit an error if a STORE instruction uses a forward-referenced pointer. --- libs/vkd3d-shader/dxil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index ce6d869d..99227d80 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -6886,7 +6886,8 @@ static void sm6_parser_emit_store(struct sm6_parser *sm6, const struct dxil_reco if (!(ptr = sm6_parser_get_value_by_ref(sm6, record, NULL, &i)) || !sm6_value_validate_is_register(ptr, sm6) - || !sm6_value_validate_is_pointer(ptr, sm6)) + || !sm6_value_validate_is_pointer(ptr, sm6) + || !sm6_value_validate_is_backward_ref(ptr, sm6)) { return; }
1
0
0
0
Conor McCarthy : vkd3d-shader/dxil: Emit an error if a LOAD instruction uses a forward-referenced pointer.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: b4b5af66ef05c1eeea741e25332abd3352c56e03 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/b4b5af66ef05c1eeea741e25332ab…
Author: Conor McCarthy <cmccarthy(a)codeweavers.com> Date: Sat Apr 27 00:11:29 2024 +1000 vkd3d-shader/dxil: Emit an error if a LOAD instruction uses a forward-referenced pointer. --- libs/vkd3d-shader/dxil.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 1bc389ca..ce6d869d 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -606,6 +606,7 @@ struct sm6_value enum sm6_value_type value_type; unsigned int structure_stride; bool is_undefined; + bool is_back_ref; union { struct sm6_function_data function; @@ -2658,6 +2659,18 @@ static bool sm6_value_validate_is_pointer(const struct sm6_value *value, struct return true; } +static bool sm6_value_validate_is_backward_ref(const struct sm6_value *value, struct sm6_parser *sm6) +{ + if (!value->is_back_ref) + { + FIXME("Forward-referenced pointers are not supported.\n"); + vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND, + "Forward-referenced pointer declarations are not supported."); + return false; + } + return true; +} + static bool sm6_value_validate_is_numeric(const struct sm6_value *value, struct sm6_parser *sm6) { if (!sm6_type_is_numeric(value->type)) @@ -3135,6 +3148,7 @@ static enum vkd3d_result sm6_parser_constants_init(struct sm6_parser *sm6, const dst = sm6_parser_get_current_value(sm6); dst->type = type; dst->value_type = VALUE_TYPE_REG; + dst->is_back_ref = true; vsir_register_init(&dst->u.reg, reg_type, reg_data_type, 0); switch (record->code) @@ -3462,6 +3476,7 @@ static bool sm6_parser_declare_global(struct sm6_parser *sm6, const struct dxil_ dst = sm6_parser_get_current_value(sm6); dst->type = type; dst->value_type = VALUE_TYPE_REG; + dst->is_back_ref = true; if (is_constant && !init) { @@ -6687,6 +6702,7 @@ static void sm6_parser_emit_load(struct sm6_parser *sm6, const struct dxil_recor return; if (!sm6_value_validate_is_register(ptr, sm6) || !sm6_value_validate_is_pointer(ptr, sm6) + || !sm6_value_validate_is_backward_ref(ptr, sm6) || !dxil_record_validate_operand_count(record, i + 2, i + 3, sm6)) return; @@ -7478,6 +7494,7 @@ static enum vkd3d_result sm6_parser_function_init(struct sm6_parser *sm6, const fwd_type = dst->type; dst->type = NULL; dst->value_type = VALUE_TYPE_REG; + dst->is_back_ref = true; is_terminator = false; record = block->records[i];
1
0
0
0
Alexandre Julliard : vkd3d-shader: Avoid non-constant initializer.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: 91762a62c6a3fbc8ab4692119bf431a9324b11d9 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/91762a62c6a3fbc8ab4692119bf43…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Apr 30 09:46:04 2024 +0200 vkd3d-shader: Avoid non-constant initializer. Fixes "initializer element is not constant" error with gcc < 8. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56508
--- libs/vkd3d-shader/dxil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 6a1fb6bd..1bc389ca 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -31,7 +31,7 @@ static const uint64_t GLOBALVAR_FLAG_EXPLICIT_TYPE = 2; static const unsigned int GLOBALVAR_ADDRESS_SPACE_SHIFT = 2; static const uint64_t ALLOCA_FLAG_IN_ALLOCA = 0x20; static const uint64_t ALLOCA_FLAG_EXPLICIT_TYPE = 0x40; -static const uint64_t ALLOCA_ALIGNMENT_MASK = ALLOCA_FLAG_IN_ALLOCA - 1; +static const uint64_t ALLOCA_ALIGNMENT_MASK = 0x1f; static const unsigned int SHADER_DESCRIPTOR_TYPE_COUNT = 4; static const size_t MAX_IR_INSTRUCTIONS_PER_DXIL_INSTRUCTION = 11;
1
0
0
0
Henri Verbeet : vkd3d-shader: Get rid of struct vkd3d_shader_desc.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: 87c83e2ae296e88999cc90046913f9a7f6c1c45e URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/87c83e2ae296e88999cc90046913f…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Apr 18 23:29:18 2024 +0200 vkd3d-shader: Get rid of struct vkd3d_shader_desc. --- libs/vkd3d-shader/d3dbc.c | 22 ++++++++++++---------- libs/vkd3d-shader/vkd3d_shader_main.c | 21 +++++++++++---------- libs/vkd3d-shader/vkd3d_shader_private.h | 10 +--------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 09e4f596..aa235844 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -215,8 +215,12 @@ struct vkd3d_shader_sm1_parser struct vkd3d_shader_parser p; + struct + { #define MAX_CONSTANT_COUNT 8192 - uint32_t constant_def_mask[3][VKD3D_BITMAP_SIZE(MAX_CONSTANT_COUNT)]; + uint32_t def_mask[VKD3D_BITMAP_SIZE(MAX_CONSTANT_COUNT)]; + uint32_t count; + } constants[3]; }; /* This table is not order or position dependent. */ @@ -750,15 +754,13 @@ static bool add_signature_element_from_semantic(struct vkd3d_shader_sm1_parser * static void record_constant_register(struct vkd3d_shader_sm1_parser *sm1, enum vkd3d_shader_d3dbc_constant_register set, uint32_t index, bool from_def) { - struct vkd3d_shader_desc *desc = &sm1->p.shader_desc; - - desc->flat_constant_count[set].used = max(desc->flat_constant_count[set].used, index + 1); + sm1->constants[set].count = max(sm1->constants[set].count, index + 1); if (from_def) { /* d3d shaders have a maximum of 8192 constants; we should not overrun * this array. */ - assert((index / 32) <= ARRAY_SIZE(sm1->constant_def_mask[set])); - bitmap_set(sm1->constant_def_mask[set], index); + assert((index / 32) <= ARRAY_SIZE(sm1->constants[set].def_mask)); + bitmap_set(sm1->constants[set].def_mask, index); } } @@ -1301,9 +1303,9 @@ static uint32_t get_external_constant_count(struct vkd3d_shader_sm1_parser *sm1, /* Find the highest constant index which is not written by a DEF * instruction. We can't (easily) use an FFZ function for this since it * needs to be limited by the highest used register index. */ - for (j = sm1->p.shader_desc.flat_constant_count[set].used; j > 0; --j) + for (j = sm1->constants[set].count; j > 0; --j) { - if (!bitmap_is_set(sm1->constant_def_mask[set], j - 1)) + if (!bitmap_is_set(sm1->constants[set].def_mask, j - 1)) return j; } @@ -1354,8 +1356,8 @@ int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compi ++instructions->count; } - for (i = 0; i < ARRAY_SIZE(sm1->p.shader_desc.flat_constant_count); ++i) - sm1->p.shader_desc.flat_constant_count[i].external = get_external_constant_count(sm1, i); + for (i = 0; i < ARRAY_SIZE(sm1->p.program.flat_constant_count); ++i) + sm1->p.program.flat_constant_count[i] = get_external_constant_count(sm1, i); if (!sm1->p.failed) ret = vkd3d_shader_parser_validate(&sm1->p); diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 4342a176..0d3bf891 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -1403,6 +1403,7 @@ static int scan_with_parser(const struct vkd3d_shader_compile_info *compile_info struct vkd3d_shader_scan_descriptor_info1 local_descriptor_info1 = {0}; struct vkd3d_shader_scan_descriptor_info *descriptor_info; struct vkd3d_shader_scan_signature_info *signature_info; + struct vsir_program *program = &parser->program; struct vkd3d_shader_instruction *instruction; struct vkd3d_shader_scan_context context; int ret = VKD3D_OK; @@ -1428,27 +1429,27 @@ static int scan_with_parser(const struct vkd3d_shader_compile_info *compile_info descriptor_info1 = &local_descriptor_info1; } - vkd3d_shader_scan_context_init(&context, &parser->program.shader_version, compile_info, + vkd3d_shader_scan_context_init(&context, &program->shader_version, compile_info, descriptor_info1, combined_sampler_info, message_context); if (TRACE_ON()) - vkd3d_shader_trace(&parser->program); + vkd3d_shader_trace(program); - for (i = 0; i < parser->program.instructions.count; ++i) + for (i = 0; i < program->instructions.count; ++i) { - instruction = &parser->program.instructions.elements[i]; + instruction = &program->instructions.elements[i]; if ((ret = vkd3d_shader_scan_instruction(&context, instruction)) < 0) break; } - for (i = 0; i < ARRAY_SIZE(parser->shader_desc.flat_constant_count); ++i) + for (i = 0; i < ARRAY_SIZE(program->flat_constant_count); ++i) { - unsigned int size = parser->shader_desc.flat_constant_count[i].external; struct vkd3d_shader_register_range range = {.space = 0, .first = i, .last = i}; struct vkd3d_shader_register reg = {.idx[0].offset = i, .idx_count = 1}; + unsigned int size = program->flat_constant_count[i]; struct vkd3d_shader_descriptor_info1 *d; - if (parser->shader_desc.flat_constant_count[i].external) + if (size) { if ((d = vkd3d_shader_scan_add_descriptor(&context, VKD3D_SHADER_DESCRIPTOR_TYPE_CBV, ®, &range, VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT))) @@ -1458,11 +1459,11 @@ static int scan_with_parser(const struct vkd3d_shader_compile_info *compile_info if (!ret && signature_info) { - if (!vkd3d_shader_signature_from_shader_signature(&signature_info->input, &parser->program.input_signature) + if (!vkd3d_shader_signature_from_shader_signature(&signature_info->input, &program->input_signature) || !vkd3d_shader_signature_from_shader_signature(&signature_info->output, - &parser->program.output_signature) + &program->output_signature) || !vkd3d_shader_signature_from_shader_signature(&signature_info->patch_constant, - &parser->program.patch_constant_signature)) + &program->patch_constant_signature)) { ret = VKD3D_ERROR_OUT_OF_MEMORY; } diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 1b60d96e..4bb99efe 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1061,14 +1061,6 @@ struct dxbc_shader_desc struct shader_signature patch_constant_signature; }; -struct vkd3d_shader_desc -{ - struct - { - uint32_t used, external; - } flat_constant_count[3]; -}; - struct vkd3d_shader_register_semantic { struct vkd3d_shader_dst_param reg; @@ -1332,6 +1324,7 @@ struct vsir_program struct shader_signature patch_constant_signature; unsigned int input_control_point_count, output_control_point_count; + unsigned int flat_constant_count[3]; unsigned int block_count; unsigned int temp_count; unsigned int ssa_count; @@ -1366,7 +1359,6 @@ struct vkd3d_shader_parser struct vkd3d_shader_location location; bool failed; - struct vkd3d_shader_desc shader_desc; const struct vkd3d_shader_parser_ops *ops; struct vsir_program program;
1
0
0
0
Henri Verbeet : vkd3d-shader/spirv: Use location information from the current instruction.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: b761f1a2639e4d471df2bdd0b203adcf7d464427 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/b761f1a2639e4d471df2bdd0b203a…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Apr 18 22:03:57 2024 +0200 vkd3d-shader/spirv: Use location information from the current instruction. --- libs/vkd3d-shader/spirv.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index f833a473..cb1f5ded 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2453,8 +2453,7 @@ static void spirv_compiler_destroy(struct spirv_compiler *compiler) static struct spirv_compiler *spirv_compiler_create(const struct vsir_program *program, const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info, - struct vkd3d_shader_message_context *message_context, const struct vkd3d_shader_location *location, - uint64_t config_flags) + struct vkd3d_shader_message_context *message_context, uint64_t config_flags) { const struct shader_signature *patch_constant_signature = &program->patch_constant_signature; const struct shader_signature *output_signature = &program->output_signature; @@ -2470,7 +2469,7 @@ static struct spirv_compiler *spirv_compiler_create(const struct vsir_program *p memset(compiler, 0, sizeof(*compiler)); compiler->message_context = message_context; - compiler->location = *location; + compiler->location.source_name = compile_info->source_name; compiler->config_flags = config_flags; if ((target_info = vkd3d_find_struct(compile_info->next, SPIRV_TARGET_INFO))) @@ -9732,6 +9731,8 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler, { int ret = VKD3D_OK; + compiler->location = instruction->location; + switch (instruction->handler_idx) { case VKD3DSIH_DCL_GLOBAL_FLAGS: @@ -10175,9 +10176,6 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, spirv_compiler_emit_descriptor_declarations(compiler); - compiler->location.column = 0; - compiler->location.line = 1; - if (program->block_count && !spirv_compiler_init_blocks(compiler, program->block_count)) return VKD3D_ERROR_OUT_OF_MEMORY; @@ -10202,7 +10200,6 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, for (i = 0; i < instructions.count && result >= 0; ++i) { - compiler->location.line = i + 1; result = spirv_compiler_handle_instruction(compiler, &instructions.elements[i]); } @@ -10296,7 +10293,7 @@ int spirv_compile(struct vkd3d_shader_parser *parser, int ret; if (!(spirv_compiler = spirv_compiler_create(&parser->program, compile_info, - scan_descriptor_info, message_context, &parser->location, parser->config_flags))) + scan_descriptor_info, message_context, parser->config_flags))) { ERR("Failed to create SPIR-V compiler.\n"); return VKD3D_ERROR;
1
0
0
0
Henri Verbeet : vkd3d-shader/hlsl: Use vkd3d_string_buffer_printf() in declare_predefined_types().
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: 8b8ad07057ff52c269900753e0c001816dac52ad URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/8b8ad07057ff52c269900753e0c00…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Apr 18 17:08:03 2024 +0200 vkd3d-shader/hlsl: Use vkd3d_string_buffer_printf() in declare_predefined_types(). --- libs/vkd3d-shader/hlsl.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 4fc1493b..5edebb60 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -3517,6 +3517,7 @@ static int compare_function_rb(const void *key, const struct rb_entry *entry) static void declare_predefined_types(struct hlsl_ctx *ctx) { + struct vkd3d_string_buffer *name; unsigned int x, y, bt, i, v; struct hlsl_type *type; @@ -3529,7 +3530,6 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) "uint", "bool", }; - char name[15]; static const char *const variants_float[] = {"min10float", "min16float"}; static const char *const variants_int[] = {"min12int", "min16int"}; @@ -3573,28 +3573,34 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) {"technique11", 11}, }; + if (!(name = hlsl_get_string_buffer(ctx))) + return; + for (bt = 0; bt <= HLSL_TYPE_LAST_SCALAR; ++bt) { for (y = 1; y <= 4; ++y) { for (x = 1; x <= 4; ++x) { - sprintf(name, "%s%ux%u", names[bt], y, x); - type = hlsl_new_type(ctx, name, HLSL_CLASS_MATRIX, bt, x, y); + vkd3d_string_buffer_clear(name); + vkd3d_string_buffer_printf(name, "%s%ux%u", names[bt], y, x); + type = hlsl_new_type(ctx, name->buffer, HLSL_CLASS_MATRIX, bt, x, y); hlsl_scope_add_type(ctx->globals, type); ctx->builtin_types.matrix[bt][x - 1][y - 1] = type; if (y == 1) { - sprintf(name, "%s%u", names[bt], x); - type = hlsl_new_type(ctx, name, HLSL_CLASS_VECTOR, bt, x, y); + vkd3d_string_buffer_clear(name); + vkd3d_string_buffer_printf(name, "%s%u", names[bt], x); + type = hlsl_new_type(ctx, name->buffer, HLSL_CLASS_VECTOR, bt, x, y); hlsl_scope_add_type(ctx->globals, type); ctx->builtin_types.vector[bt][x - 1] = type; if (x == 1) { - sprintf(name, "%s", names[bt]); - type = hlsl_new_type(ctx, name, HLSL_CLASS_SCALAR, bt, x, y); + vkd3d_string_buffer_clear(name); + vkd3d_string_buffer_printf(name, "%s", names[bt]); + type = hlsl_new_type(ctx, name->buffer, HLSL_CLASS_SCALAR, bt, x, y); hlsl_scope_add_type(ctx->globals, type); ctx->builtin_types.scalar[bt] = type; } @@ -3637,22 +3643,25 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) { for (x = 1; x <= 4; ++x) { - sprintf(name, "%s%ux%u", variants[v], y, x); - type = hlsl_new_type(ctx, name, HLSL_CLASS_MATRIX, bt, x, y); + vkd3d_string_buffer_clear(name); + vkd3d_string_buffer_printf(name, "%s%ux%u", variants[v], y, x); + type = hlsl_new_type(ctx, name->buffer, HLSL_CLASS_MATRIX, bt, x, y); type->is_minimum_precision = 1; hlsl_scope_add_type(ctx->globals, type); if (y == 1) { - sprintf(name, "%s%u", variants[v], x); - type = hlsl_new_type(ctx, name, HLSL_CLASS_VECTOR, bt, x, y); + vkd3d_string_buffer_clear(name); + vkd3d_string_buffer_printf(name, "%s%u", variants[v], x); + type = hlsl_new_type(ctx, name->buffer, HLSL_CLASS_VECTOR, bt, x, y); type->is_minimum_precision = 1; hlsl_scope_add_type(ctx->globals, type); if (x == 1) { - sprintf(name, "%s", variants[v]); - type = hlsl_new_type(ctx, name, HLSL_CLASS_SCALAR, bt, x, y); + vkd3d_string_buffer_clear(name); + vkd3d_string_buffer_printf(name, "%s", variants[v]); + type = hlsl_new_type(ctx, name->buffer, HLSL_CLASS_SCALAR, bt, x, y); type->is_minimum_precision = 1; hlsl_scope_add_type(ctx->globals, type); } @@ -3690,6 +3699,8 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) type->e.version = technique_types[i].version; hlsl_scope_add_type(ctx->globals, type); } + + hlsl_release_string_buffer(ctx, name); } static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct vkd3d_shader_compile_info *compile_info,
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Fold x * 1 identities.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: ee735e8eed2a24751b9cedbf1dc159399353acd2 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/ee735e8eed2a24751b9cedbf1dc15…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri Apr 19 13:02:37 2024 -0400 vkd3d-shader/hlsl: Fold x * 1 identities. --- libs/vkd3d-shader/hlsl_constant_ops.c | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 526ce88b..51f2f9cc 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -1430,6 +1430,40 @@ static bool constant_is_zero(struct hlsl_ir_constant *const_arg) return true; } +static bool constant_is_one(struct hlsl_ir_constant *const_arg) +{ + struct hlsl_type *data_type = const_arg->node.data_type; + unsigned int k; + + for (k = 0; k < data_type->dimx; ++k) + { + switch (data_type->base_type) + { + case HLSL_TYPE_FLOAT: + case HLSL_TYPE_HALF: + if (const_arg->value.u[k].f != 1.0f) + return false; + break; + + case HLSL_TYPE_DOUBLE: + if (const_arg->value.u[k].d != 1.0) + return false; + break; + + case HLSL_TYPE_UINT: + case HLSL_TYPE_INT: + case HLSL_TYPE_BOOL: + if (const_arg->value.u[k].u != 1) + return false; + break; + + default: + return false; + } + } + return true; +} + bool hlsl_fold_constant_identities(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { struct hlsl_ir_constant *const_arg = NULL; @@ -1475,6 +1509,11 @@ bool hlsl_fold_constant_identities(struct hlsl_ctx *ctx, struct hlsl_ir_node *in res_node = mut_arg; break; + case HLSL_OP2_MUL: + if (constant_is_one(const_arg)) + res_node = mut_arg; + break; + default: break; }
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Fold x + 0 identities.
by Alexandre Julliard
30 Apr '24
30 Apr '24
Module: vkd3d Branch: master Commit: b14f935d0fbefb708a2f32b3be6c4099f28e2eee URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/b14f935d0fbefb708a2f32b3be6c4…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri Apr 19 12:57:38 2024 -0400 vkd3d-shader/hlsl: Fold x + 0 identities. --- libs/vkd3d-shader/hlsl.h | 1 + libs/vkd3d-shader/hlsl_codegen.c | 1 + libs/vkd3d-shader/hlsl_constant_ops.c | 91 +++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index a1e3aacd..ec3f5826 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1422,6 +1422,7 @@ struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_dere bool hlsl_copy_propagation_execute(struct hlsl_ctx *ctx, struct hlsl_block *block); bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context); +bool hlsl_fold_constant_identities(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context); bool hlsl_fold_constant_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context); bool hlsl_transform_ir(struct hlsl_ctx *ctx, bool (*func)(struct hlsl_ctx *ctx, struct hlsl_ir_node *, void *), struct hlsl_block *block, void *context); diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index a6d6b336..94acb70f 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -5427,6 +5427,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry do { progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, body, NULL); + progress |= hlsl_transform_ir(ctx, hlsl_fold_constant_identities, body, NULL); progress |= hlsl_transform_ir(ctx, hlsl_fold_constant_swizzles, body, NULL); progress |= hlsl_copy_propagation_execute(ctx, body); progress |= hlsl_transform_ir(ctx, fold_swizzle_chains, body, NULL); diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 4cea98e9..526ce88b 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -1396,6 +1396,97 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, return success; } +static bool constant_is_zero(struct hlsl_ir_constant *const_arg) +{ + struct hlsl_type *data_type = const_arg->node.data_type; + unsigned int k; + + for (k = 0; k < data_type->dimx; ++k) + { + switch (data_type->base_type) + { + case HLSL_TYPE_FLOAT: + case HLSL_TYPE_HALF: + if (const_arg->value.u[k].f != 0.0f) + return false; + break; + + case HLSL_TYPE_DOUBLE: + if (const_arg->value.u[k].d != 0.0) + return false; + break; + + case HLSL_TYPE_UINT: + case HLSL_TYPE_INT: + case HLSL_TYPE_BOOL: + if (const_arg->value.u[k].u != 0) + return false; + break; + + default: + return false; + } + } + return true; +} + +bool hlsl_fold_constant_identities(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) +{ + struct hlsl_ir_constant *const_arg = NULL; + struct hlsl_ir_node *mut_arg = NULL; + struct hlsl_ir_node *res_node; + struct hlsl_ir_expr *expr; + unsigned int i; + + if (instr->type != HLSL_IR_EXPR) + return false; + expr = hlsl_ir_expr(instr); + + if (instr->data_type->class > HLSL_CLASS_VECTOR) + return false; + + /* Verify that the expression has two operands. */ + for (i = 0; i < ARRAY_SIZE(expr->operands); ++i) + { + if (!!expr->operands[i].node != (i < 2)) + return false; + } + + if (expr->operands[0].node->type == HLSL_IR_CONSTANT) + { + const_arg = hlsl_ir_constant(expr->operands[0].node); + mut_arg = expr->operands[1].node; + } + else if (expr->operands[1].node->type == HLSL_IR_CONSTANT) + { + mut_arg = expr->operands[0].node; + const_arg = hlsl_ir_constant(expr->operands[1].node); + } + else + { + return false; + } + + res_node = NULL; + switch (expr->op) + { + case HLSL_OP2_ADD: + if (constant_is_zero(const_arg)) + res_node = mut_arg; + break; + + default: + break; + } + + if (res_node) + { + hlsl_replace_node(&expr->node, res_node); + return true; + } + return false; +} + bool hlsl_fold_constant_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { struct hlsl_constant_value value;
1
0
0
0
← Newer
1
2
3
4
5
...
59
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
Results per page:
10
25
50
100
200