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
June 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
613 discussions
Start a n
N
ew thread
Nikolay Sivov : vkd3d-shader/asm: Output 'bias' flag for 'texld'.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: a289393fe727e7d241e066ef6b16727a7094fcbb URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/a289393fe727e7d241e066ef6b167…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue May 21 21:38:44 2024 +0200 vkd3d-shader/asm: Output 'bias' flag for 'texld'. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/d3d_asm.c | 9 +++++++-- libs/vkd3d-shader/vkd3d_shader_private.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d-shader/d3d_asm.c index e784e42c..8a3eb5a3 100644 --- a/libs/vkd3d-shader/d3d_asm.c +++ b/libs/vkd3d-shader/d3d_asm.c @@ -1857,8 +1857,13 @@ static void shader_dump_instruction_flags(struct vkd3d_d3d_asm_compiler *compile break; case VKD3DSIH_TEX: - if (vkd3d_shader_ver_ge(&compiler->shader_version, 2, 0) && (ins->flags & VKD3DSI_TEXLD_PROJECT)) - vkd3d_string_buffer_printf(buffer, "p"); + if (vkd3d_shader_ver_ge(&compiler->shader_version, 2, 0)) + { + if (ins->flags & VKD3DSI_TEXLD_PROJECT) + vkd3d_string_buffer_printf(buffer, "p"); + else if (ins->flags & VKD3DSI_TEXLD_BIAS) + vkd3d_string_buffer_printf(buffer, "b"); + } break; case VKD3DSIH_WAVE_OP_ADD: diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 79cc6faa..7d1f4942 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -809,6 +809,7 @@ enum vkd3d_tessellator_domain #define VKD3DSI_NONE 0x0 #define VKD3DSI_TEXLD_PROJECT 0x1 +#define VKD3DSI_TEXLD_BIAS 0x2 #define VKD3DSI_INDEXED_DYNAMIC 0x4 #define VKD3DSI_RESINFO_RCP_FLOAT 0x1 #define VKD3DSI_RESINFO_UINT 0x2
1
0
0
0
Nikolay Sivov : vkd3d-shader/hlsl: Implement tex2Dbias().
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: ccbe36fb8d01cbbb8b1b88a6d9f89eb45a616db6 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/ccbe36fb8d01cbbb8b1b88a6d9f89…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue May 21 18:18:11 2024 +0200 vkd3d-shader/hlsl: Implement tex2Dbias(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56701
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- libs/vkd3d-shader/hlsl.y | 15 +++++++++++++-- tests/hlsl/sample-bias.shader_test | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 4f9d2dff..052573a2 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4168,11 +4168,15 @@ static bool intrinsic_tex(struct hlsl_ctx *ctx, const struct parse_initializer * hlsl_release_string_buffer(ctx, string); } - if (!strcmp(name, "tex2Dlod")) + if (!strcmp(name, "tex2Dbias") + || !strcmp(name, "tex2Dlod")) { struct hlsl_ir_node *lod, *c; - load_params.type = HLSL_RESOURCE_SAMPLE_LOD; + if (!strcmp(name, "tex2Dlod")) + load_params.type = HLSL_RESOURCE_SAMPLE_LOD; + else + load_params.type = HLSL_RESOURCE_SAMPLE_LOD_BIAS; if (!(c = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(X, Y, Z, W), hlsl_sampler_dim_count(dim), params->args[1], loc))) return false; @@ -4294,6 +4298,12 @@ static bool intrinsic_tex2D(struct hlsl_ctx *ctx, return intrinsic_tex(ctx, params, loc, "tex2D", HLSL_SAMPLER_DIM_2D); } +static bool intrinsic_tex2Dbias(struct hlsl_ctx *ctx, + const struct parse_initializer *params, const struct vkd3d_shader_location *loc) +{ + return intrinsic_tex(ctx, params, loc, "tex2Dbias", HLSL_SAMPLER_DIM_2D); +} + static bool intrinsic_tex2Dlod(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { @@ -4514,6 +4524,7 @@ intrinsic_functions[] = {"tanh", 1, true, intrinsic_tanh}, {"tex1D", -1, false, intrinsic_tex1D}, {"tex2D", -1, false, intrinsic_tex2D}, + {"tex2Dbias", 2, false, intrinsic_tex2Dbias}, {"tex2Dlod", 2, false, intrinsic_tex2Dlod}, {"tex2Dproj", 2, false, intrinsic_tex2Dproj}, {"tex3D", -1, false, intrinsic_tex3D}, diff --git a/tests/hlsl/sample-bias.shader_test b/tests/hlsl/sample-bias.shader_test index 16761452..8385a85b 100644 --- a/tests/hlsl/sample-bias.shader_test +++ b/tests/hlsl/sample-bias.shader_test @@ -42,3 +42,31 @@ probe all rgba (4.0, 0.0, 10.0, 0.0) uniform 0 float4 8.5 0.0 0.0 0.0 todo(sm<4 | glsl) draw quad probe all rgba (0.0, 0.0, 10.0, 0.0) + +[require] +shader model >= 3.0 +options: backcompat + +[pixel shader todo(sm<4) fail(sm>=6)] +sampler s; +float bias; + +float4 main(float2 coord : texcoord) : sv_target +{ + /* Choice of initial mipmap level is hardware-dependent, and in practice + * varies too much to be reasonably covered by ULPS. Quantize instead. */ + return floor(tex2Dbias(s, float4(coord, 0, bias)) * 10); +} + +[test] +uniform 0 float4 6.5 0.0 0.0 0.0 +todo(sm<4 | glsl) draw quad +probe all rgba (10.0, 0.0, 10.0, 0.0) + +uniform 0 float4 7.5 0.0 0.0 0.0 +todo(sm<4 | glsl) draw quad +probe all rgba (4.0, 0.0, 10.0, 0.0) + +uniform 0 float4 8.5 0.0 0.0 0.0 +todo(sm<4 | glsl) draw quad +probe all rgba (0.0, 0.0, 10.0, 0.0)
1
0
0
0
Elizabeth Figura : tests: Add reflection tests for register space.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: f0cd35b40d9b6ede18b1f79fdb94f40faade1642 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/f0cd35b40d9b6ede18b1f79fdb94f…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Thu May 2 19:52:38 2024 -0500 tests: Add reflection tests for register space. --- tests/hlsl_d3d12.c | 79 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c index b579f305..a38c4870 100644 --- a/tests/hlsl_d3d12.c +++ b/tests/hlsl_d3d12.c @@ -1458,10 +1458,10 @@ static void test_reflection(void) static const D3D12_SHADER_INPUT_BIND_DESC vs_bindings[] = { - {"$Globals", D3D_SIT_CBUFFER, 0, 1}, - {"$Params", D3D_SIT_CBUFFER, 1, 1}, - {"b1", D3D_SIT_CBUFFER, 2, 1}, - {"b5", D3D_SIT_CBUFFER, 5, 1, D3D_SIF_USERPACKED}, + {"$Globals", D3D_SIT_CBUFFER, 0, 1, .uID = 0}, + {"$Params", D3D_SIT_CBUFFER, 1, 1, .uID = 1}, + {"b1", D3D_SIT_CBUFFER, 2, 1, .uID = 2}, + {"b5", D3D_SIT_CBUFFER, 5, 1, D3D_SIF_USERPACKED, .uID = 5}, }; static const char ps_source[] = @@ -1512,19 +1512,19 @@ static void test_reflection(void) static const D3D12_SHADER_INPUT_BIND_DESC ps_bindings[] = { - {"c", D3D_SIT_SAMPLER, 0, 1}, - {"d", D3D_SIT_SAMPLER, 1, 1}, - {"e", D3D_SIT_SAMPLER, 2, 1}, - {"f", D3D_SIT_SAMPLER, 3, 1}, - {"g", D3D_SIT_SAMPLER, 4, 1}, - {"k.c.a", D3D_SIT_SAMPLER, 5, 1}, - {"b", D3D_SIT_SAMPLER, 7, 1, D3D_SIF_USERPACKED}, - {"f", D3D_SIT_TEXTURE, 0, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u}, - {"e", D3D_SIT_TEXTURE, 1, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u}, - {"g", D3D_SIT_TEXTURE, 2, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u}, - {"a", D3D_SIT_TEXTURE, 3, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u}, - {"k.b", D3D_SIT_TEXTURE, 5, 1, 0, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE1DARRAY, ~0u}, - {"h.b", D3D_SIT_TEXTURE, 7, 1, D3D_SIF_USERPACKED | D3D_SIF_TEXTURE_COMPONENT_0, D3D_RETURN_TYPE_SINT, D3D_SRV_DIMENSION_TEXTURE1D, ~0u}, + {"c", D3D_SIT_SAMPLER, 0, 1, .uID = 0}, + {"d", D3D_SIT_SAMPLER, 1, 1, .uID = 1}, + {"e", D3D_SIT_SAMPLER, 2, 1, .uID = 2}, + {"f", D3D_SIT_SAMPLER, 3, 1, .uID = 3}, + {"g", D3D_SIT_SAMPLER, 4, 1, .uID = 4}, + {"k.c.a", D3D_SIT_SAMPLER, 5, 1, .uID = 5}, + {"b", D3D_SIT_SAMPLER, 7, 1, D3D_SIF_USERPACKED, .uID = 7}, + {"f", D3D_SIT_TEXTURE, 0, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u, 0, 0}, + {"e", D3D_SIT_TEXTURE, 1, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u, 0, 1}, + {"g", D3D_SIT_TEXTURE, 2, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u, 0, 2}, + {"a", D3D_SIT_TEXTURE, 3, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u, 0, 3}, + {"k.b", D3D_SIT_TEXTURE, 5, 1, 0, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE1DARRAY, ~0u, 0, 5}, + {"h.b", D3D_SIT_TEXTURE, 7, 1, D3D_SIF_USERPACKED | D3D_SIF_TEXTURE_COMPONENT_0, D3D_RETURN_TYPE_SINT, D3D_SRV_DIMENSION_TEXTURE1D, ~0u, 0, 7}, {"$Globals", D3D_SIT_CBUFFER, 0, 1}, }; @@ -1549,6 +1549,47 @@ static void test_reflection(void) {{"$Globals", D3D_CT_CBUFFER, ARRAY_SIZE(ps_globals_vars), 32}, ps_globals_vars}, }; + static const char ps51_source[] = + "cbuffer x : register(b0, space1) { float4 a; };\n" + "cbuffer y : register(b0, space1) { float4 b; };\n" + "cbuffer z : register(b0, space0) { float4 c; };\n" + "float4 d;\n" + "Texture2D e : register(t1, space1);\n" + "Texture2D f : register(t1, space2);\n" + "RWBuffer<float> g : register(u1, space1);\n" + "SamplerState h : register(s1, space2147483647);\n" + "SamplerState i : register(s2147483647, space1);\n" + "float4 main(void) : SV_TARGET\n" + "{\n" + " g[0] = 0;\n" + " return a + c + d + e.Sample(h, 0) + f.Sample(i, 0);\n" + "}"; + + static const struct shader_variable ps51_x_vars = + {{"a", 0, 16, D3D_SVF_USED, NULL, ~0u, 0, ~0u, 0}, {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 4, 0, 0, 0, "float4"}}; + static const struct shader_variable ps51_z_vars = + {{"c", 0, 16, D3D_SVF_USED, NULL, ~0u, 0, ~0u, 0}, {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 4, 0, 0, 0, "float4"}}; + static const struct shader_variable ps51_globals_vars = + {{"d", 0, 16, D3D_SVF_USED, NULL, ~0u, 0, ~0u, 0}, {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 4, 0, 0, 0, "float4"}}; + static const struct shader_buffer ps51_buffers[] = + { + {{"$Globals", D3D_CT_CBUFFER, 1, 16}, &ps51_globals_vars}, + {{"x", D3D_CT_CBUFFER, 1, 16}, &ps51_x_vars}, + {{"z", D3D_CT_CBUFFER, 1, 16}, &ps51_z_vars}, + }; + + static const D3D12_SHADER_INPUT_BIND_DESC ps51_bindings[] = + { + {"i", D3D_SIT_SAMPLER, 2147483647, 1, .Space = 1, .uID = 0}, + {"h", D3D_SIT_SAMPLER, 1, 1, .Space = 2147483647, .uID = 1}, + {"e", D3D_SIT_TEXTURE, 1, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u, 1, 0}, + {"f", D3D_SIT_TEXTURE, 1, 1, D3D_SIF_TEXTURE_COMPONENTS, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, ~0u, 2, 1}, + {"g", D3D_SIT_UAV_RWTYPED, 1, 1, 0, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_BUFFER, ~0u, 1, 0}, + {"z", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, .Space = 0, .uID = 0}, + {"$Globals", D3D_SIT_CBUFFER, 1, 1, .uID = 1}, + {"x", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, .Space = 1, .uID = 2}, + }; + static const struct { const char *source; @@ -1562,6 +1603,7 @@ static void test_reflection(void) { {vs_source, "vs_5_0", vs_bindings, ARRAY_SIZE(vs_bindings), vs_buffers, ARRAY_SIZE(vs_buffers)}, {ps_source, "ps_5_0", ps_bindings, ARRAY_SIZE(ps_bindings), ps_buffers, ARRAY_SIZE(ps_buffers)}, + {ps51_source, "ps_5_1", ps51_bindings, ARRAY_SIZE(ps51_bindings), ps51_buffers, ARRAY_SIZE(ps51_buffers)}, }; for (unsigned int t = 0; t < ARRAY_SIZE(tests); ++t) @@ -1685,6 +1727,9 @@ static void test_reflection(void) ok(binding_desc.ReturnType == expect->ReturnType, "Got return type %#x.\n", binding_desc.ReturnType); ok(binding_desc.Dimension == expect->Dimension, "Got dimension %#x.\n", binding_desc.Dimension); ok(binding_desc.NumSamples == expect->NumSamples, "Got multisample count %u.\n", binding_desc.NumSamples); + ok(binding_desc.Space == expect->Space, "Got space %u.\n", binding_desc.Space); + todo_if (binding_desc.uID != expect->uID) + ok(binding_desc.uID == expect->uID, "Got ID %u.\n", binding_desc.uID); vkd3d_test_pop_context(); }
1
0
0
0
Elizabeth Figura : vkd3d-shader/hlsl: Write SM5.1 binding reflection data.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: 33e5553158e176c93524dc3d3cba818ea6aeb8fb URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/33e5553158e176c93524dc3d3cba8…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Thu May 2 23:42:49 2024 -0500 vkd3d-shader/hlsl: Write SM5.1 binding reflection data. --- libs/vkd3d-shader/tpf.c | 23 +++++++++++++++------- tests/hlsl/register-reservations-space.shader_test | 8 ++++---- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index c387c814..24206ae9 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3197,6 +3197,9 @@ static int sm4_compare_extern_resources(const void *a, const void *b) if ((r = vkd3d_u32_compare(aa->regset, bb->regset))) return r; + if ((r = vkd3d_u32_compare(aa->space, bb->space))) + return r; + return vkd3d_u32_compare(aa->index, bb->index); } @@ -3322,7 +3325,10 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un extern_resources[*count].name = name; extern_resources[*count].data_type = var->data_type; - extern_resources[*count].is_user_packed = !!var->reg_reservation.reg_type; + /* For some reason 5.1 resources aren't marked as + * user-packed, but cbuffers still are. */ + extern_resources[*count].is_user_packed = hlsl_version_lt(ctx, 5, 1) + && !!var->reg_reservation.reg_type; extern_resources[*count].regset = r; extern_resources[*count].id = var->regs[r].id; @@ -3377,6 +3383,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) { + uint32_t binding_desc_size = (hlsl_version_ge(ctx, 5, 1) ? 10 : 8) * sizeof(uint32_t); size_t cbuffers_offset, resources_offset, creator_offset, string_offset; unsigned int cbuffer_count = 0, extern_resources_count, i, j; size_t cbuffer_position, resource_position, creator_position; @@ -3418,7 +3425,7 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) put_u32(&buffer, hlsl_version_ge(ctx, 5, 1) ? TAG_RD11_REVERSE : TAG_RD11); put_u32(&buffer, 15 * sizeof(uint32_t)); /* size of RDEF header including this header */ put_u32(&buffer, 6 * sizeof(uint32_t)); /* size of buffer desc */ - put_u32(&buffer, (hlsl_version_ge(ctx, 5, 1) ? 10 : 8) * sizeof(uint32_t)); /* size of binding desc */ + put_u32(&buffer, binding_desc_size); /* size of binding desc */ put_u32(&buffer, 10 * sizeof(uint32_t)); /* size of variable desc */ put_u32(&buffer, 9 * sizeof(uint32_t)); /* size of type desc */ put_u32(&buffer, 3 * sizeof(uint32_t)); /* size of member desc */ @@ -3435,10 +3442,6 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) const struct extern_resource *resource = &extern_resources[i]; uint32_t flags = 0; - if (hlsl_version_ge(ctx, 5, 1)) - hlsl_fixme(ctx, resource->buffer ? &resource->buffer->loc : &resource->var->loc, - "Shader model 5.1 resource reflection."); - if (resource->is_user_packed) flags |= D3D_SIF_USERPACKED; @@ -3465,6 +3468,12 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) put_u32(&buffer, resource->index); put_u32(&buffer, resource->bind_count); put_u32(&buffer, flags); + + if (hlsl_version_ge(ctx, 5, 1)) + { + put_u32(&buffer, resource->space); + put_u32(&buffer, resource->id); + } } for (i = 0; i < extern_resources_count; ++i) @@ -3472,7 +3481,7 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) const struct extern_resource *resource = &extern_resources[i]; string_offset = put_string(&buffer, resource->name); - set_u32(&buffer, resources_offset + i * 8 * sizeof(uint32_t), string_offset); + set_u32(&buffer, resources_offset + i * binding_desc_size, string_offset); } /* Buffers. */ diff --git a/tests/hlsl/register-reservations-space.shader_test b/tests/hlsl/register-reservations-space.shader_test index c1dc75d0..bc5aef1b 100644 --- a/tests/hlsl/register-reservations-space.shader_test +++ b/tests/hlsl/register-reservations-space.shader_test @@ -17,7 +17,7 @@ size (2d, 1, 1) size (2d, 1, 1) 2.0 2.0 2.0 99.0 -[pixel shader todo] +[pixel shader] Texture2D tex1 : register(t1, space0); float4 main() : sv_target @@ -26,11 +26,11 @@ float4 main() : sv_target } [test] -todo(sm<6) draw quad +todo(glsl) draw quad probe all rgba (1, 1, 1, 99) -[pixel shader todo fail(sm>=6)] +[pixel shader fail(sm>=6)] Texture2D tex1 : register(t1, sPaCe0); float4 main() : sv_target @@ -39,7 +39,7 @@ float4 main() : sv_target } [test] -todo(sm<6) draw quad +todo(glsl) draw quad probe all rgba (1, 1, 1, 99)
1
0
0
0
Elizabeth Figura : vkd3d-shader: Write SM5.1 register spaces.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: bb41947fc64b237995c275e614ba7b24227182bd URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/bb41947fc64b237995c275e614ba7…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Tue Aug 29 12:47:03 2023 -0500 vkd3d-shader: Write SM5.1 register spaces. --- libs/vkd3d-shader/tpf.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index c839f26e..c387c814 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3185,7 +3185,7 @@ struct extern_resource bool is_user_packed; enum hlsl_regset regset; - unsigned int id, index, bind_count; + unsigned int id, space, index, bind_count; }; static int sm4_compare_extern_resources(const void *a, const void *b) @@ -3282,6 +3282,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un extern_resources[*count].regset = regset; extern_resources[*count].id = var->regs[regset].id; + extern_resources[*count].space = var->regs[regset].space; extern_resources[*count].index = var->regs[regset].index + regset_offset; extern_resources[*count].bind_count = 1; @@ -3325,6 +3326,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un extern_resources[*count].regset = r; extern_resources[*count].id = var->regs[r].id; + extern_resources[*count].space = var->regs[r].space; extern_resources[*count].index = var->regs[r].index; extern_resources[*count].bind_count = var->bind_count[r]; @@ -3362,6 +3364,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un extern_resources[*count].regset = HLSL_REGSET_NUMERIC; extern_resources[*count].id = buffer->reg.id; + extern_resources[*count].space = buffer->reg.space; extern_resources[*count].index = buffer->reg.index; extern_resources[*count].bind_count = 1; @@ -4233,7 +4236,8 @@ static void write_sm4_dcl_constant_buffer(const struct tpf_writer *tpf, const st instr.srcs[0].reg.idx_count = 3; instr.idx[0] = size; - instr.idx_count = 1; + instr.idx[1] = cbuffer->reg.space; + instr.idx_count = 2; } else { @@ -4276,6 +4280,9 @@ static void write_sm4_dcl_samplers(const struct tpf_writer *tpf, const struct ex instr.dsts[0].reg.idx[1].offset = resource->index; instr.dsts[0].reg.idx[2].offset = resource->index; /* FIXME: array end */ instr.dsts[0].reg.idx_count = 3; + + instr.idx[0] = resource->space; + instr.idx_count = 1; } else { @@ -4321,6 +4328,9 @@ static void write_sm4_dcl_textures(const struct tpf_writer *tpf, const struct ex instr.dsts[0].reg.idx[1].offset = resource->index; instr.dsts[0].reg.idx[2].offset = resource->index; /* FIXME: array end */ instr.dsts[0].reg.idx_count = 3; + + instr.idx[1] = resource->space; + instr.idx_count = 2; } else { @@ -5915,22 +5925,13 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx, LIST_FOR_EACH_ENTRY(cbuffer, &ctx->buffers, struct hlsl_buffer, entry) { if (cbuffer->reg.allocated) - { - if (hlsl_version_ge(ctx, 5, 1)) - hlsl_fixme(ctx, &cbuffer->loc, "Shader model 5.1 resource definition."); - write_sm4_dcl_constant_buffer(&tpf, cbuffer); - } } for (i = 0; i < extern_resources_count; ++i) { const struct extern_resource *resource = &extern_resources[i]; - if (hlsl_version_ge(ctx, 5, 1)) - hlsl_fixme(ctx, resource->buffer ? &resource->buffer->loc : &resource->var->loc, - "Shader model 5.1 resource declaration."); - if (resource->regset == HLSL_REGSET_SAMPLERS) write_sm4_dcl_samplers(&tpf, resource); else if (resource->regset == HLSL_REGSET_TEXTURES)
1
0
0
0
Elizabeth Figura : vkd3d-shader/hlsl: Allocate register spaces for objects.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: 4355e6ca69fd264a0b1740332cb99f8c055d727f URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/4355e6ca69fd264a0b1740332cb99…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Tue Aug 29 12:40:38 2023 -0500 vkd3d-shader/hlsl: Allocate register spaces for objects. --- libs/vkd3d-shader/hlsl_codegen.c | 38 ++++++++++++++-------- tests/hlsl/register-reservations-space.shader_test | 29 +++++++++++++++++ 2 files changed, 53 insertions(+), 14 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index a9a370d1..5420d529 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -3823,15 +3823,16 @@ static void allocate_register_reservations(struct hlsl_ctx *ctx) LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry) { + const struct hlsl_reg_reservation *reservation = &var->reg_reservation; unsigned int r; - if (var->reg_reservation.reg_type) + if (reservation->reg_type) { for (r = 0; r <= HLSL_REGSET_LAST_OBJECT; ++r) { if (var->regs[r].allocation_size > 0) { - if (var->reg_reservation.reg_type != get_regset_name(r)) + if (reservation->reg_type != get_regset_name(r)) { struct vkd3d_string_buffer *type_string; @@ -3847,7 +3848,8 @@ static void allocate_register_reservations(struct hlsl_ctx *ctx) else { var->regs[r].allocated = true; - var->regs[r].index = var->reg_reservation.reg_index; + var->regs[r].space = reservation->reg_space; + var->regs[r].index = reservation->reg_index; } } } @@ -5002,7 +5004,7 @@ static void allocate_buffers(struct hlsl_ctx *ctx) } static const struct hlsl_ir_var *get_allocated_object(struct hlsl_ctx *ctx, enum hlsl_regset regset, - uint32_t index, bool allocated_only) + uint32_t space, uint32_t index, bool allocated_only) { const struct hlsl_ir_var *var; unsigned int start, count; @@ -5017,11 +5019,17 @@ static const struct hlsl_ir_var *get_allocated_object(struct hlsl_ctx *ctx, enum start = var->reg_reservation.reg_index; count = var->data_type->reg_size[regset]; + if (var->reg_reservation.reg_space != space) + continue; + if (!var->regs[regset].allocated && allocated_only) continue; } else if (var->regs[regset].allocated) { + if (var->regs[regset].space != space) + continue; + start = var->regs[regset].index; count = var->regs[regset].allocation_size; } @@ -5063,7 +5071,7 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset) if (var->regs[regset].allocated) { const struct hlsl_ir_var *reserved_object, *last_reported = NULL; - unsigned int index, i; + unsigned int i; if (var->regs[regset].index < min_index) { @@ -5076,19 +5084,20 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset) for (i = 0; i < count; ++i) { - index = var->regs[regset].index + i; + unsigned int space = var->regs[regset].space; + unsigned int index = var->regs[regset].index + i; /* get_allocated_object() may return "var" itself, but we * actually want that, otherwise we'll end up reporting the * same conflict between the same two variables twice. */ - reserved_object = get_allocated_object(ctx, regset, index, true); + reserved_object = get_allocated_object(ctx, regset, space, index, true); if (reserved_object && reserved_object != var && reserved_object != last_reported) { hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_OVERLAPPING_RESERVATIONS, - "Multiple variables bound to %c%u.", regset_name, index); + "Multiple variables bound to space %u, %c%u.", regset_name, space, index); hlsl_note(ctx, &reserved_object->loc, VKD3D_SHADER_LOG_ERROR, - "Variable '%s' is already bound to %c%u.", reserved_object->name, - regset_name, index); + "Variable '%s' is already bound to space %u, %c%u.", + reserved_object->name, regset_name, space, index); last_reported = reserved_object; } } @@ -5097,8 +5106,8 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset) var->regs[regset].id = id++; else var->regs[regset].id = var->regs[regset].index; - TRACE("Allocated reserved variable %s to indices %c%u-%c%u, id %u.\n", - var->name, regset_name, var->regs[regset].index, + TRACE("Allocated reserved variable %s to space %u, indices %c%u-%c%u, id %u.\n", + var->name, var->regs[regset].space, regset_name, var->regs[regset].index, regset_name, var->regs[regset].index + count, var->regs[regset].id); } else @@ -5108,7 +5117,7 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset) while (available < count) { - if (get_allocated_object(ctx, regset, index, false)) + if (get_allocated_object(ctx, regset, 0, index, false)) available = 0; else ++available; @@ -5116,13 +5125,14 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_regset regset) } index -= count; + var->regs[regset].space = 0; var->regs[regset].index = index; if (hlsl_version_ge(ctx, 5, 1)) var->regs[regset].id = id++; else var->regs[regset].id = var->regs[regset].index; var->regs[regset].allocated = true; - TRACE("Allocated variable %s to indices %c%u-%c%u, id %u.\n", var->name, + TRACE("Allocated variable %s to space 0, indices %c%u-%c%u, id %u.\n", var->name, regset_name, index, regset_name, index + count, var->regs[regset].id); ++index; } diff --git a/tests/hlsl/register-reservations-space.shader_test b/tests/hlsl/register-reservations-space.shader_test index 96ff140a..c1dc75d0 100644 --- a/tests/hlsl/register-reservations-space.shader_test +++ b/tests/hlsl/register-reservations-space.shader_test @@ -137,3 +137,32 @@ float4 main() : sv_target todo(sm<6) draw quad if(sm>=6) probe all rgba (2, 2, 2, 99) if(sm<6) probe all rgba (1, 1, 1, 99) + + +% Test conflicts. + +[pixel shader fail] +Texture2D t : register(t1, space1); +Texture2D t2 : register(t1, space1); + +float4 main() : sv_target +{ + return t.Load(0) + t2.Load(0); +} + +[pixel shader fail] + +cbuffer a : register(b1, space1) +{ + float4 f; +} + +cbuffer a : register(b1, space1) +{ + float4 g; +} + +float4 main() : sv_target +{ + return f + g; +}
1
0
0
0
Elizabeth Figura : vkd3d-shader/hlsl: Allocate register spaces for constant buffers.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: 7b61b0219e9f2593b1e9bce92dd204a8a4d6b029 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/7b61b0219e9f2593b1e9bce92dd20…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Tue Aug 29 12:30:00 2023 -0500 vkd3d-shader/hlsl: Allocate register spaces for constant buffers. --- libs/vkd3d-shader/hlsl.h | 2 ++ libs/vkd3d-shader/hlsl_codegen.c | 32 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 34462316..1db83243 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -271,6 +271,8 @@ struct hlsl_reg * ignored. * For numeric registers "index" is not used. */ uint32_t index; + /* Register space of a descriptor. Not used for numeric registers. */ + uint32_t space; /* Number of registers to be allocated. * Unlike the variable's type's regsize, it is not expressed in register components, but rather * in whole registers, and may depend on which components are used within the shader. */ diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 2e7ca531..a9a370d1 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -4767,13 +4767,14 @@ static void allocate_semantic_registers(struct hlsl_ctx *ctx) } } -static const struct hlsl_buffer *get_reserved_buffer(struct hlsl_ctx *ctx, uint32_t index) +static const struct hlsl_buffer *get_reserved_buffer(struct hlsl_ctx *ctx, uint32_t space, uint32_t index) { const struct hlsl_buffer *buffer; LIST_FOR_EACH_ENTRY(buffer, &ctx->buffers, const struct hlsl_buffer, entry) { - if (buffer->used_size && buffer->reservation.reg_type == 'b' && buffer->reservation.reg_index == index) + if (buffer->used_size && buffer->reservation.reg_type == 'b' + && buffer->reservation.reg_space == space && buffer->reservation.reg_index == index) return buffer; } return NULL; @@ -4943,33 +4944,40 @@ static void allocate_buffers(struct hlsl_ctx *ctx) if (buffer->type == HLSL_BUFFER_CONSTANT) { - if (buffer->reservation.reg_type == 'b') + const struct hlsl_reg_reservation *reservation = &buffer->reservation; + + if (reservation->reg_type == 'b') { - const struct hlsl_buffer *reserved_buffer = get_reserved_buffer(ctx, buffer->reservation.reg_index); + const struct hlsl_buffer *reserved_buffer = get_reserved_buffer(ctx, + reservation->reg_space, reservation->reg_index); if (reserved_buffer && reserved_buffer != buffer) { hlsl_error(ctx, &buffer->loc, VKD3D_SHADER_ERROR_HLSL_OVERLAPPING_RESERVATIONS, - "Multiple buffers bound to index %u.", buffer->reservation.reg_index); + "Multiple buffers bound to space %u, index %u.", + reservation->reg_space, reservation->reg_index); hlsl_note(ctx, &reserved_buffer->loc, VKD3D_SHADER_LOG_ERROR, - "Buffer %s is already bound to index %u.", - reserved_buffer->name, buffer->reservation.reg_index); + "Buffer %s is already bound to space %u, index %u.", + reserved_buffer->name, reservation->reg_space, reservation->reg_index); } - buffer->reg.index = buffer->reservation.reg_index; + buffer->reg.space = reservation->reg_space; + buffer->reg.index = reservation->reg_index; if (hlsl_version_ge(ctx, 5, 1)) buffer->reg.id = id++; else buffer->reg.id = buffer->reg.index; buffer->reg.allocation_size = 1; buffer->reg.allocated = true; - TRACE("Allocated reserved %s to index %u, id %u.\n", buffer->name, buffer->reg.index, buffer->reg.id); + TRACE("Allocated reserved %s to space %u, index %u, id %u.\n", + buffer->name, buffer->reg.space, buffer->reg.index, buffer->reg.id); } - else if (!buffer->reservation.reg_type) + else if (!reservation->reg_type) { - while (get_reserved_buffer(ctx, index)) + while (get_reserved_buffer(ctx, 0, index)) ++index; + buffer->reg.space = 0; buffer->reg.index = index; if (hlsl_version_ge(ctx, 5, 1)) buffer->reg.id = id++; @@ -4977,7 +4985,7 @@ static void allocate_buffers(struct hlsl_ctx *ctx) buffer->reg.id = buffer->reg.index; buffer->reg.allocation_size = 1; buffer->reg.allocated = true; - TRACE("Allocated %s to index %u, id %u.\n", buffer->name, buffer->reg.index, buffer->reg.id); + TRACE("Allocated %s to space 0, index %u, id %u.\n", buffer->name, buffer->reg.index, buffer->reg.id); ++index; } else
1
0
0
0
Elizabeth Figura : vkd3d-shader: Write SM5.1 register indices.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: 28a5e238142dacb232a4138de189aa51e26a2dd1 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/28a5e238142dacb232a4138de189a…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Tue Aug 29 12:13:35 2023 -0500 vkd3d-shader: Write SM5.1 register indices. Separate ID and index. Allocate IDs for all external resources (but ignore them for shader models other than 5). --- libs/vkd3d-shader/d3dbc.c | 6 +- libs/vkd3d-shader/hlsl.h | 12 +++- libs/vkd3d-shader/hlsl_codegen.c | 57 ++++++++++++------ libs/vkd3d-shader/tpf.c | 126 ++++++++++++++++++++++++++++++++------- 4 files changed, 156 insertions(+), 45 deletions(-)
1
0
0
0
Elizabeth Figura : vkd3d-shader/hlsl: Put constant buffers into the extern_resources struct.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: 19a13740dedcf0a7472b69e45e385a55ddefc57b URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/19a13740dedcf0a7472b69e45e385…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Fri May 3 00:23:38 2024 -0500 vkd3d-shader/hlsl: Put constant buffers into the extern_resources struct. Mostly to get the same sorting logic. --- libs/vkd3d-shader/tpf.c | 103 ++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 0340091d..60f80175 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3178,6 +3178,7 @@ struct extern_resource /* var is only not NULL if this resource is a whole variable, so it may be responsible for more * than one component. */ const struct hlsl_ir_var *var; + const struct hlsl_buffer *buffer; char *name; struct hlsl_type *data_type; @@ -3220,6 +3221,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un bool separate_components = ctx->profile->major_version == 5 && ctx->profile->minor_version == 0; struct extern_resource *extern_resources = NULL; const struct hlsl_ir_var *var; + struct hlsl_buffer *buffer; enum hlsl_regset regset; size_t capacity = 0; char *name; @@ -3272,6 +3274,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un hlsl_release_string_buffer(ctx, name_buffer); extern_resources[*count].var = NULL; + extern_resources[*count].buffer = NULL; extern_resources[*count].name = name; extern_resources[*count].data_type = component_type; @@ -3313,6 +3316,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un } extern_resources[*count].var = var; + extern_resources[*count].buffer = NULL; extern_resources[*count].name = name; extern_resources[*count].data_type = var->data_type; @@ -3327,14 +3331,48 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un } } + LIST_FOR_EACH_ENTRY(buffer, &ctx->buffers, struct hlsl_buffer, entry) + { + if (!buffer->reg.allocated) + continue; + + if (!(hlsl_array_reserve(ctx, (void **)&extern_resources, &capacity, *count + 1, + sizeof(*extern_resources)))) + { + sm4_free_extern_resources(extern_resources, *count); + *count = 0; + return NULL; + } + + if (!(name = hlsl_strdup(ctx, buffer->name))) + { + sm4_free_extern_resources(extern_resources, *count); + *count = 0; + return NULL; + } + + extern_resources[*count].var = NULL; + extern_resources[*count].buffer = buffer; + + extern_resources[*count].name = name; + extern_resources[*count].data_type = NULL; + extern_resources[*count].is_user_packed = !!buffer->reservation.reg_type; + + extern_resources[*count].regset = HLSL_REGSET_NUMERIC; + extern_resources[*count].id = buffer->reg.id; + extern_resources[*count].bind_count = 1; + + ++*count; + } + qsort(extern_resources, *count, sizeof(*extern_resources), sm4_compare_extern_resources); return extern_resources; } static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) { - unsigned int cbuffer_count = 0, resource_count = 0, extern_resources_count, i, j; size_t cbuffers_offset, resources_offset, creator_offset, string_offset; + unsigned int cbuffer_count = 0, extern_resources_count, i, j; size_t cbuffer_position, resource_position, creator_position; const struct hlsl_profile_info *profile = ctx->profile; struct vkd3d_bytecode_buffer buffer = {0}; @@ -3354,19 +3392,15 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) extern_resources = sm4_get_extern_resources(ctx, &extern_resources_count); - resource_count += extern_resources_count; LIST_FOR_EACH_ENTRY(cbuffer, &ctx->buffers, struct hlsl_buffer, entry) { if (cbuffer->reg.allocated) - { ++cbuffer_count; - ++resource_count; - } } put_u32(&buffer, cbuffer_count); cbuffer_position = put_u32(&buffer, 0); - put_u32(&buffer, resource_count); + put_u32(&buffer, extern_resources_count); resource_position = put_u32(&buffer, 0); put_u32(&buffer, vkd3d_make_u32(vkd3d_make_u16(profile->minor_version, profile->major_version), target_types[profile->type])); @@ -3396,20 +3430,18 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) uint32_t flags = 0; if (hlsl_version_ge(ctx, 5, 1)) - hlsl_fixme(ctx, &resource->var->loc, "Shader model 5.1 resource reflection."); + hlsl_fixme(ctx, resource->buffer ? &resource->buffer->loc : &resource->var->loc, + "Shader model 5.1 resource reflection."); if (resource->is_user_packed) flags |= D3D_SIF_USERPACKED; put_u32(&buffer, 0); /* name */ - put_u32(&buffer, sm4_resource_type(resource->data_type)); - if (resource->regset == HLSL_REGSET_SAMPLERS) - { - put_u32(&buffer, 0); - put_u32(&buffer, 0); - put_u32(&buffer, 0); - } + if (resource->buffer) + put_u32(&buffer, resource->buffer->type == HLSL_BUFFER_CONSTANT ? D3D_SIT_CBUFFER : D3D_SIT_TBUFFER); else + put_u32(&buffer, sm4_resource_type(resource->data_type)); + if (resource->regset == HLSL_REGSET_TEXTURES || resource->regset == HLSL_REGSET_UAVS) { unsigned int dimx = hlsl_type_get_component_type(ctx, resource->data_type, 0)->e.resource.format->dimx; @@ -3418,34 +3450,17 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) put_u32(&buffer, ~0u); /* FIXME: multisample count */ flags |= (dimx - 1) << VKD3D_SM4_SIF_TEXTURE_COMPONENTS_SHIFT; } + else + { + put_u32(&buffer, 0); + put_u32(&buffer, 0); + put_u32(&buffer, 0); + } put_u32(&buffer, resource->id); put_u32(&buffer, resource->bind_count); put_u32(&buffer, flags); } - LIST_FOR_EACH_ENTRY(cbuffer, &ctx->buffers, struct hlsl_buffer, entry) - { - uint32_t flags = 0; - - if (!cbuffer->reg.allocated) - continue; - - if (hlsl_version_ge(ctx, 5, 1)) - hlsl_fixme(ctx, &cbuffer->loc, "Shader model 5.1 resource reflection."); - - if (cbuffer->reservation.reg_type) - flags |= D3D_SIF_USERPACKED; - - put_u32(&buffer, 0); /* name */ - put_u32(&buffer, cbuffer->type == HLSL_BUFFER_CONSTANT ? D3D_SIT_CBUFFER : D3D_SIT_TBUFFER); - put_u32(&buffer, 0); /* return type */ - put_u32(&buffer, 0); /* dimension */ - put_u32(&buffer, 0); /* multisample count */ - put_u32(&buffer, cbuffer->reg.id); /* bind point */ - put_u32(&buffer, 1); /* bind count */ - put_u32(&buffer, flags); /* flags */ - } - for (i = 0; i < extern_resources_count; ++i) { const struct extern_resource *resource = &extern_resources[i]; @@ -3454,15 +3469,6 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) set_u32(&buffer, resources_offset + i * 8 * sizeof(uint32_t), string_offset); } - LIST_FOR_EACH_ENTRY(cbuffer, &ctx->buffers, struct hlsl_buffer, entry) - { - if (!cbuffer->reg.allocated) - continue; - - string_offset = put_string(&buffer, cbuffer->name); - set_u32(&buffer, resources_offset + i++ * 8 * sizeof(uint32_t), string_offset); - } - /* Buffers. */ cbuffers_offset = bytecode_align(&buffer); @@ -5840,7 +5846,8 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx, const struct extern_resource *resource = &extern_resources[i]; if (hlsl_version_ge(ctx, 5, 1)) - hlsl_fixme(ctx, &resource->var->loc, "Shader model 5.1 resource declaration."); + hlsl_fixme(ctx, resource->buffer ? &resource->buffer->loc : &resource->var->loc, + "Shader model 5.1 resource declaration."); if (resource->regset == HLSL_REGSET_SAMPLERS) write_sm4_dcl_samplers(&tpf, resource); @@ -5903,7 +5910,7 @@ static void write_sm4_sfi0(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) extern_resources = sm4_get_extern_resources(ctx, &extern_resources_count); for (unsigned int i = 0; i < extern_resources_count; ++i) { - if (extern_resources[i].data_type->e.resource.rasteriser_ordered) + if (extern_resources[i].data_type && extern_resources[i].data_type->e.resource.rasteriser_ordered) *flags |= VKD3D_SM4_REQUIRES_ROVS; } sm4_free_extern_resources(extern_resources, extern_resources_count);
1
0
0
0
Elizabeth Figura : vkd3d-shader/hlsl: Add a hlsl_fixme() for 5.1 resource arrays.
by Alexandre Julliard
11 Jun '24
11 Jun '24
Module: vkd3d Branch: master Commit: 558320b52ff30468092c47d0b335cb2b42fe9270 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/558320b52ff30468092c47d0b335c…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Mon May 13 23:55:38 2024 -0500 vkd3d-shader/hlsl: Add a hlsl_fixme() for 5.1 resource arrays. These are a bit trickier to handle, and need more tests. --- libs/vkd3d-shader/hlsl.y | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index d2fc43b6..4f9d2dff 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1013,6 +1013,10 @@ static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields, field->type = hlsl_new_array_type(ctx, field->type, v->arrays.sizes[k]); } } + + if (hlsl_version_ge(ctx, 5, 1) && field->type->class == HLSL_CLASS_ARRAY && hlsl_type_is_resource(field->type)) + hlsl_fixme(ctx, &v->loc, "Shader model 5.1+ resource array."); + vkd3d_free(v->arrays.sizes); field->loc = v->loc; field->name = v->name; @@ -2319,6 +2323,15 @@ static void declare_var(struct hlsl_ctx *ctx, struct parse_variable_def *v) } } + if (hlsl_version_ge(ctx, 5, 1) && type->class == HLSL_CLASS_ARRAY && hlsl_type_is_resource(type)) + { + /* SM 5.1/6.x descriptor arrays act differently from previous versions. + * Not only are they treated as a single object in reflection, but they + * act as a single component for the purposes of assignment and + * initialization. */ + hlsl_fixme(ctx, &v->loc, "Shader model 5.1+ resource array."); + } + if (!(var_name = vkd3d_strdup(v->name))) return; @@ -6545,6 +6558,9 @@ parameter: } $$.type = type; + if (hlsl_version_ge(ctx, 5, 1) && type->class == HLSL_CLASS_ARRAY && hlsl_type_is_resource(type)) + hlsl_fixme(ctx, &@2, "Shader model 5.1+ resource array."); + $$.name = $3; $$.semantic = $5.semantic; $$.reg_reservation = $5.reg_reservation;
1
0
0
0
← Newer
1
...
40
41
42
43
44
45
46
...
62
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
Results per page:
10
25
50
100
200