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
May 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
705 discussions
Start a n
N
ew thread
Francisco Casas : vkd3d-shader/d3dbc: Write used bind count for numeric uniforms.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: e7450ce539f95cce39d6148f867564e665363191 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/e7450ce539f95cce39d6148f86756…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri May 3 02:51:17 2024 -0400 vkd3d-shader/d3dbc: Write used bind count for numeric uniforms. --- libs/vkd3d-shader/d3dbc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index c7991407..7c7c71e3 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -1758,7 +1758,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe if (r == HLSL_REGSET_NUMERIC) { put_u32(buffer, vkd3d_make_u32(D3DXRS_FLOAT4, var->regs[r].id)); - put_u32(buffer, var->data_type->reg_size[r] / 4); + put_u32(buffer, var->bind_count[r]); } else {
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Only allocate numeric bind count for SM1 numeric uniforms.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: f5486442227c9e2d6ec45fcfd515660f56a1b720 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/f5486442227c9e2d6ec45fcfd5156…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri May 3 02:06:37 2024 -0400 vkd3d-shader/hlsl: Only allocate numeric bind count for SM1 numeric uniforms. Unless they have register reservations, in which case the whole variable is still reserved. --- libs/vkd3d-shader/hlsl_codegen.c | 7 +++---- tests/hlsl/sm1-const-allocation.shader_test | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 25bd5d9c..de778000 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -4593,15 +4593,14 @@ static void allocate_const_registers(struct hlsl_ctx *ctx, struct hlsl_ir_functi LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) { - unsigned int reg_size = var->data_type->reg_size[HLSL_REGSET_NUMERIC]; + unsigned int alloc_size = 4 * var->bind_count[HLSL_REGSET_NUMERIC]; - if (!var->is_uniform || !var->last_read || reg_size == 0) + if (!var->is_uniform || alloc_size == 0) continue; if (!var->regs[HLSL_REGSET_NUMERIC].allocated) { - var->regs[HLSL_REGSET_NUMERIC] = allocate_numeric_registers_for_type(ctx, &allocator, - 1, UINT_MAX, var->data_type); + var->regs[HLSL_REGSET_NUMERIC] = allocate_range(ctx, &allocator, 1, UINT_MAX, alloc_size); TRACE("Allocated %s to %s.\n", var->name, debug_register('c', var->regs[HLSL_REGSET_NUMERIC], var->data_type)); } diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test index 0a4340ea..e8a60255 100644 --- a/tests/hlsl/sm1-const-allocation.shader_test +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -26,7 +26,7 @@ float4 main() : sv_target uniform 0 float4 1 2 3 4 uniform 4 float4 100 200 300 400 draw quad -todo probe all rgba (101, 202, 303, 404) +probe all rgba (101, 202, 303, 404) [pixel shader] @@ -188,7 +188,7 @@ uniform 16 float4 41 42 43 44 uniform 20 float4 51 52 53 54 uniform 24 float4 61 62 63 64 draw quad -todo probe all rgba (31, 52, 61, 62) +probe all rgba (31, 52, 61, 62) [pixel shader]
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Track bind count according to usage for uniforms.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: 573d5113440d992d4838e70bcffb75a62a6ddc4a URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/573d5113440d992d4838e70bcffb7…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Tue May 7 02:45:14 2024 -0400 vkd3d-shader/hlsl: Track bind count according to usage for uniforms. Where bind count means the number of registers required to include all dereferences to the variable within the shader as in hlsl_ir_var.bind_count[]. --- libs/vkd3d-shader/hlsl.h | 7 +-- libs/vkd3d-shader/hlsl_codegen.c | 101 ++++++++++++++++++++++++++++++--------- 2 files changed, 82 insertions(+), 26 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 209d59e1..0210cf9d 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -447,9 +447,10 @@ struct hlsl_ir_var enum hlsl_sampler_dim sampler_dim; struct vkd3d_shader_location first_sampler_dim_loc; } *objects_usage[HLSL_REGSET_LAST_OBJECT + 1]; - /* Minimum number of binds required to include all object components actually used in the shader. - * It may be less than the allocation size, e.g. for texture arrays. */ - unsigned int bind_count[HLSL_REGSET_LAST_OBJECT + 1]; + /* Minimum number of binds required to include all components actually used in the shader. + * It may be less than the allocation size, e.g. for texture arrays. + * The bind_count for HLSL_REGSET_NUMERIC is only used in uniforms for now. */ + unsigned int bind_count[HLSL_REGSET_LAST + 1]; /* Whether the shader performs dereferences with non-constant offsets in the variable. */ bool indexable; diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index a05b8e3f..25bd5d9c 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -4252,6 +4252,8 @@ static void register_deref_usage(struct hlsl_ctx *ctx, struct hlsl_deref *deref) { struct hlsl_ir_var *var = deref->var; enum hlsl_regset regset = hlsl_deref_get_regset(ctx, deref); + uint32_t required_bind_count; + struct hlsl_type *type; unsigned int index; if (!hlsl_regset_index_from_deref(ctx, deref, regset, &index)) @@ -4262,12 +4264,39 @@ static void register_deref_usage(struct hlsl_ctx *ctx, struct hlsl_deref *deref) var->objects_usage[regset][index].used = true; var->bind_count[regset] = max(var->bind_count[regset], index + 1); } + else if (regset == HLSL_REGSET_NUMERIC) + { + type = hlsl_deref_get_type(ctx, deref); + + hlsl_regset_index_from_deref(ctx, deref, regset, &index); + required_bind_count = align(index + type->reg_size[regset], 4) / 4; + var->bind_count[regset] = max(var->bind_count[regset], required_bind_count); + } + else + { + vkd3d_unreachable(); + } } -static bool track_object_components_usage(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) +static bool track_components_usage(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { switch (instr->type) { + case HLSL_IR_LOAD: + { + struct hlsl_ir_load *load = hlsl_ir_load(instr); + + if (!load->src.var->is_uniform) + return false; + + /* These will are handled by validate_static_object_references(). */ + if (hlsl_deref_get_regset(ctx, &load->src) != HLSL_REGSET_NUMERIC) + return false; + + register_deref_usage(ctx, &load->src); + break; + } + case HLSL_IR_RESOURCE_LOAD: register_deref_usage(ctx, &hlsl_ir_resource_load(instr)->resource); if (hlsl_ir_resource_load(instr)->sampler.var) @@ -5106,14 +5135,15 @@ bool hlsl_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hl return true; } +/* Retrieves true if the index is constant, and false otherwise. In the latter case, the maximum + * possible index is retrieved, assuming there is not out-of-bounds access. */ bool hlsl_regset_index_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, enum hlsl_regset regset, unsigned int *index) { struct hlsl_type *type = deref->var->data_type; + bool index_is_constant = true; unsigned int i; - assert(regset <= HLSL_REGSET_LAST_OBJECT); - *index = 0; for (i = 0; i < deref->path_len; ++i) @@ -5122,37 +5152,62 @@ bool hlsl_regset_index_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref unsigned int idx = 0; assert(path_node); - if (path_node->type != HLSL_IR_CONSTANT) - return false; + if (path_node->type == HLSL_IR_CONSTANT) + { + /* We should always have generated a cast to UINT. */ + assert(path_node->data_type->class == HLSL_CLASS_SCALAR + && path_node->data_type->e.numeric.type == HLSL_TYPE_UINT); - /* We should always have generated a cast to UINT. */ - assert(path_node->data_type->class == HLSL_CLASS_SCALAR - && path_node->data_type->e.numeric.type == HLSL_TYPE_UINT); + idx = hlsl_ir_constant(path_node)->value.u[0].u; - idx = hlsl_ir_constant(path_node)->value.u[0].u; + switch (type->class) + { + case HLSL_CLASS_ARRAY: + if (idx >= type->e.array.elements_count) + return false; - switch (type->class) + *index += idx * type->e.array.type->reg_size[regset]; + break; + + case HLSL_CLASS_STRUCT: + *index += type->e.record.fields[idx].reg_offset[regset]; + break; + + case HLSL_CLASS_MATRIX: + *index += 4 * idx; + break; + + default: + vkd3d_unreachable(); + } + } + else { - case HLSL_CLASS_ARRAY: - if (idx >= type->e.array.elements_count) - return false; + index_is_constant = false; - *index += idx * type->e.array.type->reg_size[regset]; - break; + switch (type->class) + { + case HLSL_CLASS_ARRAY: + idx = type->e.array.elements_count - 1; + *index += idx * type->e.array.type->reg_size[regset]; + break; - case HLSL_CLASS_STRUCT: - *index += type->e.record.fields[idx].reg_offset[regset]; - break; + case HLSL_CLASS_MATRIX: + idx = hlsl_type_major_size(type) - 1; + *index += idx * 4; + break; - default: - vkd3d_unreachable(); + default: + vkd3d_unreachable(); + } } type = hlsl_get_element_type_from_path_index(ctx, type, path_node); } - assert(type->reg_size[regset] == 1); - return true; + assert(!(regset <= HLSL_REGSET_LAST_OBJECT) || (type->reg_size[regset] == 1)); + assert(!(regset == HLSL_REGSET_NUMERIC) || type->reg_size[regset] <= 4); + return index_is_constant; } bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *offset) @@ -5449,7 +5504,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry compute_liveness(ctx, entry_func); while (hlsl_transform_ir(ctx, dce, body, NULL)); - hlsl_transform_ir(ctx, track_object_components_usage, body, NULL); + hlsl_transform_ir(ctx, track_components_usage, body, NULL); sort_synthetic_separated_samplers_first(ctx); if (profile->major_version < 4)
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Improve tracking of used components running DCE before.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: e0a801e796c8c524890795dbebf804df3318e382 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/e0a801e796c8c524890795dbebf80…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Mon May 6 23:37:31 2024 -0400 vkd3d-shader/hlsl: Improve tracking of used components running DCE before. track_object_components_usage() had to be improved to also register derefs on resource stores. It was not doing it because it assumed that for every resource store there was a resource load already, which was true, before calling DCE. --- libs/vkd3d-shader/hlsl_codegen.c | 51 +++++++++++++++++++++++----------------- tests/hlsl/ternary.shader_test | 2 +- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 4af55293..a05b8e3f 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -4248,34 +4248,38 @@ static bool track_object_components_sampler_dim(struct hlsl_ctx *ctx, struct hls return false; } -static bool track_object_components_usage(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) +static void register_deref_usage(struct hlsl_ctx *ctx, struct hlsl_deref *deref) { - struct hlsl_ir_resource_load *load; - struct hlsl_ir_var *var; - enum hlsl_regset regset; + struct hlsl_ir_var *var = deref->var; + enum hlsl_regset regset = hlsl_deref_get_regset(ctx, deref); unsigned int index; - if (instr->type != HLSL_IR_RESOURCE_LOAD) - return false; - - load = hlsl_ir_resource_load(instr); - var = load->resource.var; - - regset = hlsl_deref_get_regset(ctx, &load->resource); + if (!hlsl_regset_index_from_deref(ctx, deref, regset, &index)) + return; - if (!hlsl_regset_index_from_deref(ctx, &load->resource, regset, &index)) - return false; + if (regset <= HLSL_REGSET_LAST_OBJECT) + { + var->objects_usage[regset][index].used = true; + var->bind_count[regset] = max(var->bind_count[regset], index + 1); + } +} - var->objects_usage[regset][index].used = true; - var->bind_count[regset] = max(var->bind_count[regset], index + 1); - if (load->sampler.var) +static bool track_object_components_usage(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) +{ + switch (instr->type) { - var = load->sampler.var; - if (!hlsl_regset_index_from_deref(ctx, &load->sampler, HLSL_REGSET_SAMPLERS, &index)) - return false; + case HLSL_IR_RESOURCE_LOAD: + register_deref_usage(ctx, &hlsl_ir_resource_load(instr)->resource); + if (hlsl_ir_resource_load(instr)->sampler.var) + register_deref_usage(ctx, &hlsl_ir_resource_load(instr)->sampler); + break; + + case HLSL_IR_RESOURCE_STORE: + register_deref_usage(ctx, &hlsl_ir_resource_store(instr)->resource); + break; - var->objects_usage[HLSL_REGSET_SAMPLERS][index].used = true; - var->bind_count[HLSL_REGSET_SAMPLERS] = max(var->bind_count[HLSL_REGSET_SAMPLERS], index + 1); + default: + break; } return false; @@ -5440,6 +5444,11 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry hlsl_transform_ir(ctx, track_object_components_sampler_dim, body, NULL); if (profile->major_version >= 4) hlsl_transform_ir(ctx, lower_combined_samples, body, NULL); + + do + compute_liveness(ctx, entry_func); + while (hlsl_transform_ir(ctx, dce, body, NULL)); + hlsl_transform_ir(ctx, track_object_components_usage, body, NULL); sort_synthetic_separated_samplers_first(ctx); diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 0ac78914..bd68dbc3 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -318,7 +318,7 @@ probe all rgba (2.0, 3.0, 3.0, 2.0) % Objects can be used, but their types have to be identical. -[pixel shader todo(sm<4)] +[pixel shader] Texture2D t; float4 main() : sv_target
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Allocate unused variables with register reservations on SM1.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: 657e460d11a08fabce2b412de0f88a4c34a201f8 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/657e460d11a08fabce2b412de0f88…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri May 3 19:32:52 2024 -0400 vkd3d-shader/hlsl: Allocate unused variables with register reservations on SM1. --- libs/vkd3d-shader/d3dbc.c | 6 +++--- libs/vkd3d-shader/hlsl_codegen.c | 2 +- tests/hlsl/sm1-const-allocation.shader_test | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 24a95224..c7991407 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -1713,7 +1713,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe for (r = 0; r <= HLSL_REGSET_LAST; ++r) { - if (var->semantic.name || !var->regs[r].allocated) + if (var->semantic.name || !var->regs[r].allocated || !var->last_read) continue; ++uniform_count; @@ -1751,7 +1751,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe for (r = 0; r <= HLSL_REGSET_LAST; ++r) { - if (var->semantic.name || !var->regs[r].allocated) + if (var->semantic.name || !var->regs[r].allocated || !var->last_read) continue; put_u32(buffer, 0); /* name */ @@ -1780,7 +1780,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe { size_t var_offset, name_offset; - if (var->semantic.name || !var->regs[r].allocated) + if (var->semantic.name || !var->regs[r].allocated || !var->last_read) continue; var_offset = vars_start + (uniform_count * 5 * sizeof(uint32_t)); diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 8882deaf..4af55293 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -4529,7 +4529,7 @@ static void allocate_const_registers(struct hlsl_ctx *ctx, struct hlsl_ir_functi { unsigned int reg_size = var->data_type->reg_size[HLSL_REGSET_NUMERIC]; - if (!var->is_uniform || !var->last_read || reg_size == 0) + if (!var->is_uniform || reg_size == 0) continue; if (var->reg_reservation.reg_type == 'c') diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test index ca641b14..0a4340ea 100644 --- a/tests/hlsl/sm1-const-allocation.shader_test +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -339,7 +339,7 @@ uniform 16 float 4 uniform 20 float 5 uniform 24 float 6 draw quad -todo probe all rgba (0, 6, 0, 0) +probe all rgba (0, 6, 0, 0) [pixel shader] @@ -372,7 +372,7 @@ uniform 16 float 4 uniform 20 float 5 uniform 24 float 6 draw quad -todo probe all rgba (6, 1, 0, 0) +probe all rgba (6, 1, 0, 0) [pixel shader todo]
1
0
0
0
Francisco Casas : tests: Test SM1 const register allocation with relative addressing.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: 7b3644d9f28a9e25016a4fa8deb5df4162630d56 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/7b3644d9f28a9e25016a4fa8deb5d…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri May 3 04:15:09 2024 -0400 tests: Test SM1 const register allocation with relative addressing. --- tests/hlsl/sm1-const-allocation.shader_test | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test index 3f4da40a..ca641b14 100644 --- a/tests/hlsl/sm1-const-allocation.shader_test +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -373,3 +373,40 @@ uniform 20 float 5 uniform 24 float 6 draw quad todo probe all rgba (6, 1, 0, 0) + + +[pixel shader todo] +// Relative addressing extends the allocation size only up to the array's size. +float idx; + +struct +{ + float dyn[5]; + float unused; +} a; + + +float4 main() : sv_target +{ + return a.dyn[idx]; +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// a c0 5 +// idx c5 1 +// + +[test] +uniform 0 float 0 +uniform 4 float 1 +uniform 8 float 2 +uniform 12 float 3 +uniform 16 float 4 +uniform 20 float 3 +todo draw quad +probe all rgba (3, 3, 3, 3) +uniform 20 float 1 +todo draw quad +probe all rgba (1, 1, 1, 1)
1
0
0
0
Francisco Casas : tests: Test SM1 constant register allocation with reservations.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: b56ae0f1c85bd9bb0ac2591f4122049fe53420c1 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/b56ae0f1c85bd9bb0ac2591f41220…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Fri May 3 04:11:58 2024 -0400 tests: Test SM1 constant register allocation with reservations. --- tests/hlsl/sm1-const-allocation.shader_test | 119 ++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test index 741545b1..3f4da40a 100644 --- a/tests/hlsl/sm1-const-allocation.shader_test +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -254,3 +254,122 @@ uniform 4 float4 11 12 13 14 uniform 8 float4 21 22 23 24 draw quad todo probe all rgba (21, 22, 1, 11) + + +[pixel shader] +// If there is a register reservation, the whole variable size is reserved. +float a[4] : register(c1); +float b[4]; + +float4 main() : sv_target +{ + return float4(a[0], b[1], 0, 0); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// a c1 1 +// b c5 2 +// + +[test] +uniform 0 float 0 +uniform 4 float 1 +uniform 8 float 2 +uniform 12 float 3 +uniform 16 float 4 +uniform 20 float 5 +uniform 24 float 6 +draw quad +probe all rgba (1, 6, 0, 0) + + +[pixel shader] +// If there is a register reservation, the whole variable size is reserved. +float4x4 a : register(c1); +float b[4]; + +float4 main() : sv_target +{ + return float4(a[0].x, b[1], 0, 0); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// a c1 1 +// b c5 2 +// + +[test] +uniform 0 float 0 +uniform 4 float 1 +uniform 8 float 2 +uniform 12 float 3 +uniform 16 float 4 +uniform 20 float 5 +uniform 24 float 6 +draw quad +probe all rgba (1, 6, 0, 0) + + +[pixel shader] +// If there is a register reservation, the whole variable size is reserved, even if unused. +float4x4 unused : register(c1); +float b[4]; + +float4 main() : sv_target +{ + return float4(0, b[1], 0, 0); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// b c5 2 +// + +[test] +uniform 0 float 0 +uniform 4 float 1 +uniform 8 float 2 +uniform 12 float 3 +uniform 16 float 4 +uniform 20 float 5 +uniform 24 float 6 +draw quad +todo probe all rgba (0, 6, 0, 0) + + +[pixel shader] +float unused[2] : register(c2); // will create a gap in c0. +float size3[3]; // cannot be placed in c0. +float size2[2]; // can be placed in c0. + +float4 main() : sv_target +{ + float4 res; + + res.x = size3[2]; + res.y = size2[1]; + res.z = 0; + res.w = 0; + return res; +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// size2 c0 2 +// size3 c4 3 +[test] +uniform 0 float 0 +uniform 4 float 1 +uniform 8 float 2 +uniform 12 float 3 +uniform 16 float 4 +uniform 20 float 5 +uniform 24 float 6 +draw quad +todo probe all rgba (6, 1, 0, 0)
1
0
0
0
Nikolay Sivov : tests: Test SM1 constant register allocation with a row_major matrix.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: 9dcb74341f0cffb2dafcba0fd189c03c7b83ca7b URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/9dcb74341f0cffb2dafcba0fd189c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu May 2 20:01:19 2024 -0400 tests: Test SM1 constant register allocation with a row_major matrix. Co-authored-by: Francisco Casas <fcasas(a)codeweavers.com> --- tests/hlsl/sm1-const-allocation.shader_test | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test index 29625fa5..741545b1 100644 --- a/tests/hlsl/sm1-const-allocation.shader_test +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -225,3 +225,32 @@ uniform 24 float4 61 62 63 64 uniform 28 float4 71 72 73 74 draw quad todo probe all rgba (74, 31, 63, 0) + + +[pixel shader] +typedef float2x2 matrix_t; +typedef row_major matrix_t row_matrix_t; +typedef column_major matrix_t col_matrix_t; +uniform row_matrix_t m1; +uniform col_matrix_t m2; +float4 main() : COLOR +{ + float4 ret; + ret.xy = m1[0]; + ret.zw = m2[0]; + return ret; +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// m2 c0 2 +// m1 c2 1 +// + +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +draw quad +todo probe all rgba (21, 22, 1, 11)
1
0
0
0
Francisco Casas : tests: Test SM1 constant register allocation.
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: 7debe25a8b70e01caa249a1139b3d1be96ad7275 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/7debe25a8b70e01caa249a1139b3d…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Thu May 2 19:51:36 2024 -0400 tests: Test SM1 constant register allocation. --- Makefile.am | 1 + tests/hlsl/sm1-const-allocation.shader_test | 227 ++++++++++++++++++++++++++++ 2 files changed, 228 insertions(+) diff --git a/Makefile.am b/Makefile.am index 558938c5..b4f863fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -193,6 +193,7 @@ vkd3d_shader_tests = \ tests/hlsl/sign.shader_test \ tests/hlsl/single-numeric-initializer.shader_test \ tests/hlsl/sm1-const-folding.shader_test \ + tests/hlsl/sm1-const-allocation.shader_test \ tests/hlsl/sm6-ternary.shader_test \ tests/hlsl/sm6-uav-rwtexture.shader_test \ tests/hlsl/smoothstep.shader_test \ diff --git a/tests/hlsl/sm1-const-allocation.shader_test b/tests/hlsl/sm1-const-allocation.shader_test new file mode 100644 index 00000000..29625fa5 --- /dev/null +++ b/tests/hlsl/sm1-const-allocation.shader_test @@ -0,0 +1,227 @@ +[require] +shader model < 4.0 + + +[pixel shader] +// Only the used size is reserved. +// Note that these matrices are column-major. +float4x2 a; +float4x2 b; + +float4 main() : sv_target +{ + float4x2 c = a; + float4x2 d = c + b; + + return float4(d[0].x, d[1].x, d[2].x, d[3].x); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// a c0 1 +// b c1 1 +// +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 100 200 300 400 +draw quad +todo probe all rgba (101, 202, 303, 404) + + +[pixel shader] +// Size 2 always are allocated before size 1 +float4x2 a; +float4x2 b; + +float4 main() : sv_target +{ + return float4(a[0].x, a[1].x, a[2].x, b[0].y); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// b c0 2 +// a c2 1 +// +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +draw quad +todo probe all rgba (21, 22, 23, 11) + + +[pixel shader] +// Size 3 always allocated before size 2, probably means that they are allocated in decreasing used size. +float4x3 a; +float4x3 b; + +float4 main() : sv_target +{ + return float4(a[0].y, b[0].z, 0, 0); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// b c0 3 +// a c3 2 +// +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +uniform 12 float4 31 32 33 34 +uniform 16 float4 41 42 43 44 +draw quad +todo probe all rgba (41, 21, 0, 0) + + +[pixel shader] +// Test same used size, how a comes before b. +float4x3 a; +float4x3 b; + +float4 main() : sv_target +{ + return float4(a[0].z, b[0].z, 0, 0); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// a c0 3 +// b c3 3 +// +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +uniform 12 float4 31 32 33 34 +uniform 16 float4 41 42 43 44 +uniform 20 float4 51 52 53 54 +draw quad +probe all rgba (21, 51, 0, 0) + + +[pixel shader] +// Declaration order is more important than instruction order to break ties. +float4x3 zzz; +float4x3 aaa; + +float4 main() : sv_target +{ + return float4(aaa[0].z, zzz[0].z, 0, 0); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// zzz c0 3 +// aaa c3 3 +// +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +uniform 12 float4 31 32 33 34 +uniform 16 float4 41 42 43 44 +uniform 20 float4 51 52 53 54 +draw quad +probe all rgba (51, 21, 0, 0) + + +[pixel shader] +// Arrays follow the same rules +float2 zzz[2], aaa[4]; + +float4 main() : sv_target +{ + return float4(aaa[1], zzz[1]); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// zzz c0 2 +// aaa c2 2 +// +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +uniform 12 float4 31 32 33 34 +draw quad +probe all rgba (31, 32, 11, 12) + + +[pixel shader] +struct apple +{ + float2 a; + float3x2 b; + float4 c[2]; +}; + +struct apple zzz, hhh, aaa; + +float4 main() : sv_target +{ + return float4(zzz.c[0].x, hhh.b[1].x, aaa.a); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// zzz c0 4 +// hhh c4 2 +// aaa c6 1 +// +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +uniform 12 float4 31 32 33 34 +uniform 16 float4 41 42 43 44 +uniform 20 float4 51 52 53 54 +uniform 24 float4 61 62 63 64 +draw quad +todo probe all rgba (31, 52, 61, 62) + + +[pixel shader] +// Constant buffer variables are treated indistinctively. +float4x4 size3; +float4x4 unused; + +cbuffer buff +{ + float4x4 size1; + float4x4 size4; +}; + +float4 main() : sv_target +{ + return float4(size1[3].x, size4[0].w, size3[2].z, 0); +} +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// size4 c0 4 +// size3 c4 3 +// size1 c7 1 + +[test] +uniform 0 float4 1 2 3 4 +uniform 4 float4 11 12 13 14 +uniform 8 float4 21 22 23 24 +uniform 12 float4 31 32 33 34 +uniform 16 float4 41 42 43 44 +uniform 20 float4 51 52 53 54 +uniform 24 float4 61 62 63 64 +uniform 28 float4 71 72 73 74 +draw quad +todo probe all rgba (74, 31, 63, 0)
1
0
0
0
Giovanni Mascellani : vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS18 in CheckFeatureSupport().
by Alexandre Julliard
13 May '24
13 May '24
Module: vkd3d Branch: master Commit: 05394b624a7921b451a906bc68a95c25a8a92ad8 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/05394b624a7921b451a906bc68a95…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Wed May 8 11:26:44 2024 +0200 vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS18 in CheckFeatureSupport(). --- include/vkd3d_d3d12.idl | 6 ++++++ libs/vkd3d/device.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/vkd3d_d3d12.idl b/include/vkd3d_d3d12.idl index 30776092..a72732e4 100644 --- a/include/vkd3d_d3d12.idl +++ b/include/vkd3d_d3d12.idl @@ -2472,6 +2472,11 @@ typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS17 BOOL ManualWriteTrackingResourceSupported; } D3D12_FEATURE_DATA_D3D12_OPTIONS17; +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS18 +{ + BOOL RenderPassesValid; +} D3D12_FEATURE_DATA_D3D12_OPTIONS18; + typedef enum D3D12_FEATURE { D3D12_FEATURE_D3D12_OPTIONS = 0, @@ -2511,6 +2516,7 @@ typedef enum D3D12_FEATURE D3D12_FEATURE_D3D12_OPTIONS15 = 44, D3D12_FEATURE_D3D12_OPTIONS16 = 45, D3D12_FEATURE_D3D12_OPTIONS17 = 46, + D3D12_FEATURE_D3D12_OPTIONS18 = 47, } D3D12_FEATURE; typedef struct D3D12_MEMCPY_DEST diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 4c2e9d4a..8b817264 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -3989,6 +3989,21 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device9 return S_OK; } + case D3D12_FEATURE_D3D12_OPTIONS18: + { + D3D12_FEATURE_DATA_D3D12_OPTIONS18 *data = feature_data; + + if (feature_data_size != sizeof(*data)) + { + WARN("Invalid size %u.\n", feature_data_size); + } + + data->RenderPassesValid = FALSE; + + TRACE("Render passes valid %#x.\n", data->RenderPassesValid); + return S_OK; + } + default: FIXME("Unhandled feature %#x.\n", feature); return E_NOTIMPL;
1
0
0
0
← Newer
1
...
43
44
45
46
47
48
49
...
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