winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2022
----- 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
537 discussions
Start a n
N
ew thread
Michael Stefaniuc : loader: Use ARRAY_SIZE instead of open coding it.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: wine Branch: master Commit: af996344a815baa1278d32181ddfda5e889a16d9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/af996344a815baa1278d32181ddfda…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Tue Oct 18 19:02:59 2022 +0200 loader: Use ARRAY_SIZE instead of open coding it. --- loader/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/main.c b/loader/main.c index 242ff15accd..36e1f5f0967 100644 --- a/loader/main.c +++ b/loader/main.c @@ -90,7 +90,7 @@ static const char *get_self_exe( char *argv0 ) static int pathname[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; size_t path_size = PATH_MAX; char *path = malloc( path_size ); - if (path && !sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), path, &path_size, NULL, 0 )) + if (path && !sysctl( pathname, ARRAY_SIZE( pathname ), path, &path_size, NULL, 0 )) return path; free( path ); #endif
1
0
0
0
Michael Stefaniuc : server: Use ARRAY_SIZE instead of open coding it.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: wine Branch: master Commit: c2d800f1dbf83c8f0599db6d831e3246eb89fee3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/c2d800f1dbf83c8f0599db6d831e32…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Tue Oct 18 19:01:11 2022 +0200 server: Use ARRAY_SIZE instead of open coding it. --- server/unicode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/unicode.c b/server/unicode.c index 86a1217b01f..edb296be0c8 100644 --- a/server/unicode.c +++ b/server/unicode.c @@ -249,7 +249,7 @@ static char *get_nls_dir(void) dir = malloc( dir_size ); if (dir) { - if (sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), dir, &dir_size, NULL, 0 )) + if (sysctl( pathname, ARRAY_SIZE( pathname ), dir, &dir_size, NULL, 0 )) { free( dir ); dir = NULL;
1
0
0
0
Michael Stefaniuc : kernel32/tests: Use ARRAY_SIZE instead of open coding it.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: wine Branch: master Commit: 03edb068deb46b7ec3825c4f01ba5b49fb7ce391 URL:
https://gitlab.winehq.org/wine/wine/-/commit/03edb068deb46b7ec3825c4f01ba5b…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Tue Oct 18 18:58:18 2022 +0200 kernel32/tests: Use ARRAY_SIZE instead of open coding it. --- dlls/kernel32/tests/drive.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/drive.c b/dlls/kernel32/tests/drive.c index db9f626aaab..253638cd321 100644 --- a/dlls/kernel32/tests/drive.c +++ b/dlls/kernel32/tests/drive.c @@ -159,8 +159,7 @@ static void test_GetDiskFreeSpaceA(void) ret = GetDiskFreeSpaceA("C:\\", §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); ok(ret, "GetDiskFreeSpaceA error %ld\n", GetLastError()); - ret = GetVolumeNameForVolumeMountPointA("C:\\", volume_guid_path, - sizeof(volume_guid_path) / sizeof(volume_guid_path[0])); + ret = GetVolumeNameForVolumeMountPointA("C:\\", volume_guid_path, ARRAY_SIZE(volume_guid_path)); ok(ret, "GetVolumeNameForVolumeMountPointA error %ld\n", GetLastError()); ret = GetDiskFreeSpaceA(volume_guid_path, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); @@ -251,8 +250,7 @@ static void test_GetDiskFreeSpaceW(void) ret = GetDiskFreeSpaceW(c_drive_pathW, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); ok(ret, "GetDiskFreeSpaceW error %ld\n", GetLastError()); - ret = GetVolumeNameForVolumeMountPointW(c_drive_pathW, volume_guid_path, - sizeof(volume_guid_path) / sizeof(volume_guid_path[0])); + ret = GetVolumeNameForVolumeMountPointW(c_drive_pathW, volume_guid_path, ARRAY_SIZE(volume_guid_path)); ok(ret, "GetVolumeNameForVolumeMountPointW error %ld\n", GetLastError()); ret = GetDiskFreeSpaceW(volume_guid_path, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
1
0
0
0
Michael Stefaniuc : riched20/tests: Use ARRAY_SIZE instead of open coding it.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: wine Branch: master Commit: 90b6288f54afdc4430dac146779a92b89f4d1219 URL:
https://gitlab.winehq.org/wine/wine/-/commit/90b6288f54afdc4430dac146779a92…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Fri Jul 1 19:58:42 2022 +0200 riched20/tests: Use ARRAY_SIZE instead of open coding it. --- dlls/riched20/tests/editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 1661654aa11..9551f490a2d 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -9030,7 +9030,7 @@ static void test_window_classes(void) int i; HWND hwnd; - for (i = 0; i < sizeof(test)/sizeof(test[0]); i++) + for (i = 0; i < ARRAY_SIZE(test); i++) { SetLastError(0xdeadbeef); hwnd = CreateWindowExA(0, test[i].class, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, NULL);
1
0
0
0
Michael Stefaniuc : ntdll: Use ARRAY_SIZE instead of open coding it.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: wine Branch: master Commit: f5c573b199f3a6dfa57c59393fd7bf940774cf15 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f5c573b199f3a6dfa57c59393fd7bf…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Fri Jul 1 19:56:55 2022 +0200 ntdll: Use ARRAY_SIZE instead of open coding it. --- dlls/ntdll/unix/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index c21d32ea811..0ed7a524db6 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -635,7 +635,7 @@ static void init_paths( char *argv[] ) static int pathname[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; size_t path_size = PATH_MAX; char *path = malloc( path_size ); - if (path && !sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), path, &path_size, NULL, 0 )) + if (path && !sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 )) bin_dir = realpath_dirname( path ); free( path ); }
1
0
0
0
Nikolay Sivov : d2d1: Test device context type in BindDC().
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: wine Branch: master Commit: e6069c253063d54bb31401ffff5c93b6e6c024c5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/e6069c253063d54bb31401ffff5c93…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 25 10:21:02 2022 +0300 d2d1: Test device context type in BindDC(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/dc_render_target.c | 4 +++- dlls/d2d1/tests/d2d1.c | 45 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/dlls/d2d1/dc_render_target.c b/dlls/d2d1/dc_render_target.c index 01e1c348746..30eafe361d1 100644 --- a/dlls/d2d1/dc_render_target.c +++ b/dlls/d2d1/dc_render_target.c @@ -689,11 +689,13 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_BindDC(ID2D1DCRenderTarget ID2D1DeviceContext *context; D2D1_SIZE_U bitmap_size; ID2D1Bitmap *bitmap; + DWORD obj_type; HRESULT hr; TRACE("iface %p, hdc %p, rect %s.\n", iface, hdc, wine_dbgstr_rect(rect)); - if (!hdc) + obj_type = GetObjectType(hdc); + if (obj_type != OBJ_DC && obj_type != OBJ_ENHMETADC && obj_type != OBJ_MEMDC) return E_INVALIDARG; /* Switch dxgi target to new surface. */ diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 08c7bc05224..3bfc8973c31 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -5825,15 +5825,18 @@ static void test_dc_target(BOOL d3d11) ID2D1Factory *factory; FLOAT dpi_x, dpi_y; D2D1_COLOR_F color; + HENHMETAFILE hemf; D2D1_SIZE_U sizeu; D2D1_SIZE_F size; D2D1_TAG t1, t2; unsigned int i; HDC hdc, hdc2; + HMETAFILE hmf; D2D_RECT_F r; COLORREF clr; HRESULT hr; RECT rect; + HWND hwnd; if (!init_test_context(&ctx, d3d11)) return; @@ -5997,7 +6000,7 @@ static void test_dc_target(BOOL d3d11) /* Invalid DC. */ hr = ID2D1DCRenderTarget_BindDC(rt, (HDC)0xdeadbeef, &rect); - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); ID2D1DCRenderTarget_BeginDraw(rt); @@ -6008,7 +6011,7 @@ static void test_dc_target(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); clr = GetPixel(hdc2, 0, 0); - todo_wine ok(clr == RGB(255, 0, 0), "Got unexpected colour 0x%08lx.\n", clr); + ok(clr == RGB(255, 0, 0), "Got unexpected colour 0x%08lx.\n", clr); hr = ID2D1DCRenderTarget_BindDC(rt, NULL, &rect); ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); @@ -6022,10 +6025,46 @@ static void test_dc_target(BOOL d3d11) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); clr = GetPixel(hdc2, 0, 0); - todo_wine ok(clr == RGB(0, 0, 255), "Got unexpected colour 0x%08lx.\n", clr); + ok(clr == RGB(0, 0, 255), "Got unexpected colour 0x%08lx.\n", clr); DeleteDC(hdc); DeleteDC(hdc2); + + /* Metafile context. */ + hdc = CreateMetaFileA(NULL); + ok(!!hdc, "Failed to create a device context.\n"); + + hr = ID2D1DCRenderTarget_BindDC(rt, hdc, &rect); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + hmf = CloseMetaFile(hdc); + ok(!!hmf, "Failed to close a metafile, error %ld.\n", GetLastError()); + DeleteMetaFile(hmf); + + /* Enhanced metafile context. */ + hdc = CreateEnhMetaFileA(NULL, NULL, NULL, NULL); + ok(!!hdc, "Failed to create a device context.\n"); + + hr = ID2D1DCRenderTarget_BindDC(rt, hdc, &rect); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hemf = CloseEnhMetaFile(hdc); + ok(!!hemf, "Failed to close a metafile, error %ld.\n", GetLastError()); + DeleteEnhMetaFile(hemf); + + /* Window context. */ + hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, NULL); + ok(!!hwnd, "Failed to create a test window.\n"); + + hdc = GetDC(hwnd); + ok(!!hdc, "Failed to get a context.\n"); + + hr = ID2D1DCRenderTarget_BindDC(rt, hdc, &rect); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + ReleaseDC(hwnd, hdc); + DestroyWindow(hwnd); + ID2D1DCRenderTarget_Release(rt); ID2D1Factory_Release(factory); }
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Support explicit cast between component-wise compatible types.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: vkd3d Branch: master Commit: 5af7316a1251d0310dcfc8f225f695539b3eab8b URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/5af7316a1251d0310dcfc8f225f69…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Wed Oct 19 19:29:22 2022 -0300 vkd3d-shader/hlsl: Support explicit cast between component-wise compatible types. --- libs/vkd3d-shader/hlsl.y | 89 +++++++++++++------------ tests/cast-componentwise-compatible.shader_test | 8 +-- 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 3cc00f95..7ada218c 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -148,9 +148,26 @@ static void check_invalid_matrix_modifiers(struct hlsl_ctx *ctx, DWORD modifiers "'row_major' and 'column_major' modifiers are only allowed for matrices."); } -static bool convertible_data_type(struct hlsl_type *type) +static bool hlsl_types_are_componentwise_compatible(struct hlsl_ctx *ctx, struct hlsl_type *src, + struct hlsl_type *dst) { - return type->type != HLSL_CLASS_OBJECT; + unsigned int k, count = hlsl_type_component_count(dst); + + if (count > hlsl_type_component_count(src)) + return false; + + for (k = 0; k < count; ++k) + { + struct hlsl_type *src_comp_type, *dst_comp_type; + + src_comp_type = hlsl_type_get_component_type(ctx, src, k); + dst_comp_type = hlsl_type_get_component_type(ctx, dst, k); + + if ((src_comp_type->type != HLSL_CLASS_SCALAR || dst_comp_type->type != HLSL_CLASS_SCALAR) + && !hlsl_types_are_equal(src_comp_type, dst_comp_type)) + return false; + } + return true; } static bool hlsl_types_are_componentwise_equal(struct hlsl_ctx *ctx, struct hlsl_type *src, @@ -174,58 +191,42 @@ static bool hlsl_types_are_componentwise_equal(struct hlsl_ctx *ctx, struct hlsl return true; } -static bool compatible_data_types(struct hlsl_type *src, struct hlsl_type *dst) +static bool type_contains_only_numerics(struct hlsl_type *type) { - if (!convertible_data_type(src) || !convertible_data_type(dst)) - return false; + unsigned int i; - if (src->type <= HLSL_CLASS_LAST_NUMERIC) + if (type->type == HLSL_CLASS_ARRAY) + return type_contains_only_numerics(type->e.array.type); + if (type->type == HLSL_CLASS_STRUCT) { - /* Scalar vars can be cast to pretty much everything */ - if (src->dimx == 1 && src->dimy == 1) - return true; - - if (src->type == HLSL_CLASS_VECTOR && dst->type == HLSL_CLASS_VECTOR) - return src->dimx >= dst->dimx; - } - - /* The other way around is true too i.e. whatever to scalar */ - if (dst->type <= HLSL_CLASS_LAST_NUMERIC && dst->dimx == 1 && dst->dimy == 1) + for (i = 0; i < type->e.record.field_count; ++i) + { + if (!type_contains_only_numerics(type->e.record.fields[i].type)) + return false; + } return true; - - if (src->type == HLSL_CLASS_ARRAY) - { - if (hlsl_types_are_equal(src->e.array.type, dst)) - /* e.g. float4[3] to float4 is allowed */ - return true; - - if (dst->type == HLSL_CLASS_ARRAY || dst->type == HLSL_CLASS_STRUCT) - return hlsl_type_component_count(src) >= hlsl_type_component_count(dst); - else - return hlsl_type_component_count(src) == hlsl_type_component_count(dst); } + return type->type <= HLSL_CLASS_LAST_NUMERIC; +} - if (src->type == HLSL_CLASS_STRUCT) - return hlsl_type_component_count(src) >= hlsl_type_component_count(dst); +static bool compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_type *src, struct hlsl_type *dst) +{ + if (src->type <= HLSL_CLASS_LAST_NUMERIC && src->dimx == 1 && src->dimy == 1 && type_contains_only_numerics(dst)) + return true; - if (dst->type == HLSL_CLASS_ARRAY || dst->type == HLSL_CLASS_STRUCT) - return hlsl_type_component_count(src) == hlsl_type_component_count(dst); + if (src->type == HLSL_CLASS_MATRIX && dst->type == HLSL_CLASS_MATRIX + && src->dimx >= dst->dimx && src->dimy >= dst->dimy) + return true; - if (src->type == HLSL_CLASS_MATRIX || dst->type == HLSL_CLASS_MATRIX) - { - if (src->type == HLSL_CLASS_MATRIX && dst->type == HLSL_CLASS_MATRIX && src->dimx >= dst->dimx && src->dimy >= dst->dimy) - return true; + if ((src->type == HLSL_CLASS_MATRIX && src->dimx > 1 && src->dimy > 1) + && hlsl_type_component_count(src) != hlsl_type_component_count(dst)) + return false; - /* Matrix-vector conversion is apparently allowed if they have the same components count */ - if ((src->type == HLSL_CLASS_VECTOR || dst->type == HLSL_CLASS_VECTOR) - && hlsl_type_component_count(src) == hlsl_type_component_count(dst)) - return true; + if ((dst->type == HLSL_CLASS_MATRIX && dst->dimy > 1) + && hlsl_type_component_count(src) != hlsl_type_component_count(dst)) return false; - } - if (hlsl_type_component_count(src) >= hlsl_type_component_count(dst)) - return true; - return false; + return hlsl_types_are_componentwise_compatible(ctx, src, dst); } static bool implicit_compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_type *src, struct hlsl_type *dst) @@ -4450,7 +4451,7 @@ unary_expr: dst_type = hlsl_new_array_type(ctx, dst_type, $4.sizes[i]); } - if (!compatible_data_types(src_type, dst_type)) + if (!compatible_data_types(ctx, src_type, dst_type)) { struct vkd3d_string_buffer *src_string, *dst_string; diff --git a/tests/cast-componentwise-compatible.shader_test b/tests/cast-componentwise-compatible.shader_test index 286c180b..4b342efb 100644 --- a/tests/cast-componentwise-compatible.shader_test +++ b/tests/cast-componentwise-compatible.shader_test @@ -159,8 +159,8 @@ float4 main() : sv_target [test] -todo draw quad -todo probe all rgba (10.0, 20.0, 30.0, 30.0) +draw quad +probe all rgba (10.0, 20.0, 30.0, 30.0) [pixel shader] @@ -181,5 +181,5 @@ float4 main() : sv_target [test] -todo draw quad -todo probe all rgba (10.0, 10.0, 11.4, 12.4) +draw quad +probe all rgba (10.0, 10.0, 11.4, 12.4)
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Support implicit casts between component-wise equal types.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: vkd3d Branch: master Commit: d21fd584b1e68dee8ab2c543ae0178a6857e86a0 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/d21fd584b1e68dee8ab2c543ae017…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Wed Oct 19 13:14:51 2022 -0300 vkd3d-shader/hlsl: Support implicit casts between component-wise equal types. --- libs/vkd3d-shader/hlsl.y | 79 ++++++++++++++++++------------ tests/cast-componentwise-equal.shader_test | 16 +++--- 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index d0bbee9e..3cc00f95 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -153,6 +153,27 @@ static bool convertible_data_type(struct hlsl_type *type) return type->type != HLSL_CLASS_OBJECT; } +static bool hlsl_types_are_componentwise_equal(struct hlsl_ctx *ctx, struct hlsl_type *src, + struct hlsl_type *dst) +{ + unsigned int k, count = hlsl_type_component_count(src); + + if (count != hlsl_type_component_count(dst)) + return false; + + for (k = 0; k < count; ++k) + { + struct hlsl_type *src_comp_type, *dst_comp_type; + + src_comp_type = hlsl_type_get_component_type(ctx, src, k); + dst_comp_type = hlsl_type_get_component_type(ctx, dst, k); + + if (!hlsl_types_are_equal(src_comp_type, dst_comp_type)) + return false; + } + return true; +} + static bool compatible_data_types(struct hlsl_type *src, struct hlsl_type *dst) { if (!convertible_data_type(src) || !convertible_data_type(dst)) @@ -207,53 +228,47 @@ static bool compatible_data_types(struct hlsl_type *src, struct hlsl_type *dst) return false; } -static bool implicit_compatible_data_types(struct hlsl_type *src, struct hlsl_type *dst) +static bool implicit_compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_type *src, struct hlsl_type *dst) { - if (!convertible_data_type(src) || !convertible_data_type(dst)) + if ((src->type <= HLSL_CLASS_LAST_NUMERIC) != (dst->type <= HLSL_CLASS_LAST_NUMERIC)) return false; if (src->type <= HLSL_CLASS_LAST_NUMERIC) { /* Scalar vars can be converted to any other numeric data type */ - if (src->dimx == 1 && src->dimy == 1 && dst->type <= HLSL_CLASS_LAST_NUMERIC) + if (src->dimx == 1 && src->dimy == 1) return true; /* The other way around is true too */ - if (dst->dimx == 1 && dst->dimy == 1 && dst->type <= HLSL_CLASS_LAST_NUMERIC) + if (dst->dimx == 1 && dst->dimy == 1) return true; - } - if (src->type <= HLSL_CLASS_VECTOR && dst->type <= HLSL_CLASS_VECTOR) - { - if (src->dimx >= dst->dimx) - return true; - return false; - } + if (src->type == HLSL_CLASS_MATRIX || dst->type == HLSL_CLASS_MATRIX) + { + if (src->type == HLSL_CLASS_MATRIX && dst->type == HLSL_CLASS_MATRIX) + return src->dimx >= dst->dimx && src->dimy >= dst->dimy; - if (src->type == HLSL_CLASS_MATRIX || dst->type == HLSL_CLASS_MATRIX) - { - if (src->type == HLSL_CLASS_MATRIX && dst->type == HLSL_CLASS_MATRIX) - return src->dimx >= dst->dimx && src->dimy >= dst->dimy; + /* Matrix-vector conversion is apparently allowed if they have + * the same components count, or if the matrix is 1xN or Nx1 + * and we are reducing the component count */ + if (src->type == HLSL_CLASS_VECTOR || dst->type == HLSL_CLASS_VECTOR) + { + if (hlsl_type_component_count(src) == hlsl_type_component_count(dst)) + return true; - /* Matrix-vector conversion is apparently allowed if they have - * the same components count, or if the matrix is 1xN or Nx1 - * and we are reducing the component count */ - if (src->type == HLSL_CLASS_VECTOR || dst->type == HLSL_CLASS_VECTOR) - { - if (hlsl_type_component_count(src) == hlsl_type_component_count(dst)) - return true; + if ((src->type == HLSL_CLASS_VECTOR || src->dimx == 1 || src->dimy == 1) && + (dst->type == HLSL_CLASS_VECTOR || dst->dimx == 1 || dst->dimy == 1)) + return hlsl_type_component_count(src) >= hlsl_type_component_count(dst); + } - if ((src->type == HLSL_CLASS_VECTOR || src->dimx == 1 || src->dimy == 1) && - (dst->type == HLSL_CLASS_VECTOR || dst->dimx == 1 || dst->dimy == 1)) - return hlsl_type_component_count(src) >= hlsl_type_component_count(dst); + return false; + } + else + { + return src->dimx >= dst->dimx; } - - return false; } - if (src->type == HLSL_CLASS_STRUCT && dst->type == HLSL_CLASS_STRUCT) - return hlsl_types_are_equal(src, dst); - - return false; + return hlsl_types_are_componentwise_equal(ctx, src, dst); } static struct hlsl_ir_load *add_load_component(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *var_instr, @@ -351,7 +366,7 @@ static struct hlsl_ir_node *add_implicit_conversion(struct hlsl_ctx *ctx, struct if (hlsl_types_are_equal(src_type, dst_type)) return node; - if (!implicit_compatible_data_types(src_type, dst_type)) + if (!implicit_compatible_data_types(ctx, src_type, dst_type)) { struct vkd3d_string_buffer *src_string, *dst_string; diff --git a/tests/cast-componentwise-equal.shader_test b/tests/cast-componentwise-equal.shader_test index 30c26c63..4c85b9ed 100644 --- a/tests/cast-componentwise-equal.shader_test +++ b/tests/cast-componentwise-equal.shader_test @@ -50,8 +50,8 @@ float4 main() : sv_target [test] -todo draw quad -todo probe all rgba (1.0, 2.0, 3.0, 1.0) +draw quad +probe all rgba (1.0, 2.0, 3.0, 1.0) [pixel shader fail] @@ -89,8 +89,8 @@ float4 main() : sv_target [test] -todo draw quad -todo probe all rgba (5.0, 6.0, 7.0, 8.0) +draw quad +probe all rgba (5.0, 6.0, 7.0, 8.0) [pixel shader] @@ -120,8 +120,8 @@ float4 main() : sv_target } [test] -todo draw quad -todo probe all rgba (4.0, 4.0, 4.0, 4.0) +draw quad +probe all rgba (4.0, 4.0, 4.0, 4.0) [pixel shader] @@ -199,8 +199,8 @@ float4 main() : sv_target } [test] -todo draw quad -todo probe all rgba (71.0, 73.0, 73.0, 74.0) +draw quad +probe all rgba (71.0, 73.0, 73.0, 74.0) [pixel shader fail]
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Remove incorrect criteria for accepting implicit casts.
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: vkd3d Branch: master Commit: 1c778116484d22b57b34fd8baac10e5238a11294 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/1c778116484d22b57b34fd8baac10…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Thu Oct 20 10:42:31 2022 -0300 vkd3d-shader/hlsl: Remove incorrect criteria for accepting implicit casts. --- libs/vkd3d-shader/hlsl.y | 16 ---------------- tests/cast-componentwise-equal.shader_test | 10 +++++----- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 184a8613..d0bbee9e 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -222,22 +222,6 @@ static bool implicit_compatible_data_types(struct hlsl_type *src, struct hlsl_ty return true; } - if (src->type == HLSL_CLASS_ARRAY && dst->type == HLSL_CLASS_ARRAY) - { - return hlsl_type_component_count(src) == hlsl_type_component_count(dst); - } - - if ((src->type == HLSL_CLASS_ARRAY && dst->type <= HLSL_CLASS_LAST_NUMERIC) - || (src->type <= HLSL_CLASS_LAST_NUMERIC && dst->type == HLSL_CLASS_ARRAY)) - { - /* e.g. float4[3] to float4 is allowed */ - if (src->type == HLSL_CLASS_ARRAY && hlsl_types_are_equal(src->e.array.type, dst)) - return true; - if (hlsl_type_component_count(src) == hlsl_type_component_count(dst)) - return true; - return false; - } - if (src->type <= HLSL_CLASS_VECTOR && dst->type <= HLSL_CLASS_VECTOR) { if (src->dimx >= dst->dimx) diff --git a/tests/cast-componentwise-equal.shader_test b/tests/cast-componentwise-equal.shader_test index 8a98b45c..30c26c63 100644 --- a/tests/cast-componentwise-equal.shader_test +++ b/tests/cast-componentwise-equal.shader_test @@ -226,7 +226,7 @@ float4 main() : sv_target } -[pixel shader fail todo] +[pixel shader fail] float main() : SV_TARGET { float arr[3] = {1, 2, 3}; @@ -237,7 +237,7 @@ float main() : SV_TARGET } -[pixel shader fail todo] +[pixel shader fail] float main() : SV_TARGET { float2 arr[3] = {1, 2, 3, 4, 5, 6}; @@ -248,7 +248,7 @@ float main() : SV_TARGET } -[pixel shader fail todo] +[pixel shader fail] float4 main() : SV_TARGET { int arr1[4] = {1, 2, 3, 4}; @@ -270,7 +270,7 @@ float4 main() : SV_TARGET } -[pixel shader fail todo] +[pixel shader fail] float4 main() : SV_TARGET { float4 f = {1, 2, 3, 4}; @@ -281,7 +281,7 @@ float4 main() : SV_TARGET } -[pixel shader fail todo] +[pixel shader fail] float4 main() : SV_TARGET { float arr[4] = {1, 2, 3, 4};
1
0
0
0
Francisco Casas : vkd3d-shader/hlsl: Handle complex types in add_cast().
by Alexandre Julliard
25 Oct '22
25 Oct '22
Module: vkd3d Branch: master Commit: d93ce28995c149faab90b2930679fa9ccb0347b4 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/d93ce28995c149faab90b2930679f…
Author: Francisco Casas <fcasas(a)codeweavers.com> Date: Wed Oct 19 13:50:50 2022 -0300 vkd3d-shader/hlsl: Handle complex types in add_cast(). This extends the support of this function, whether doing broadcasts or component-wise casts, to struct and array types. --- libs/vkd3d-shader/hlsl.y | 40 ++++++++++++------------- tests/cast-broadcast.shader_test | 4 +-- tests/cast-componentwise-compatible.shader_test | 20 ++++++------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index cc0a40ff..184a8613 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -284,18 +284,21 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs, if (hlsl_types_are_equal(src_type, dst_type)) return node; - if ((src_type->type == HLSL_CLASS_MATRIX || dst_type->type == HLSL_CLASS_MATRIX) - && src_type->type <= HLSL_CLASS_LAST_NUMERIC && dst_type->type <= HLSL_CLASS_LAST_NUMERIC) + if (src_type->type > HLSL_CLASS_VECTOR || dst_type->type > HLSL_CLASS_VECTOR) { + unsigned int src_comp_count = hlsl_type_component_count(src_type); + unsigned int dst_comp_count = hlsl_type_component_count(dst_type); struct hlsl_deref var_deref; + bool broadcast, matrix_cast; struct hlsl_ir_load *load; struct hlsl_ir_var *var; unsigned int dst_idx; - bool broadcast; - broadcast = src_type->dimx == 1 && src_type->dimy == 1; - assert(dst_type->dimx * dst_type->dimy <= src_type->dimx * src_type->dimy || broadcast); - if (src_type->type == HLSL_CLASS_MATRIX && dst_type->type == HLSL_CLASS_MATRIX && !broadcast) + broadcast = src_type->type <= HLSL_CLASS_LAST_NUMERIC && src_type->dimx == 1 && src_type->dimy == 1; + matrix_cast = !broadcast && dst_comp_count != src_comp_count + && src_type->type == HLSL_CLASS_MATRIX && dst_type->type == HLSL_CLASS_MATRIX; + assert(src_comp_count >= dst_comp_count || broadcast); + if (matrix_cast) { assert(dst_type->dimx <= src_type->dimx); assert(dst_type->dimy <= src_type->dimy); @@ -305,9 +308,9 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs, return NULL; hlsl_init_simple_deref_from_var(&var_deref, var); - for (dst_idx = 0; dst_idx < dst_type->dimx * dst_type->dimy; ++dst_idx) + for (dst_idx = 0; dst_idx < dst_comp_count; ++dst_idx) { - struct hlsl_type *dst_scalar_type; + struct hlsl_type *dst_comp_type; struct hlsl_ir_store *store; struct hlsl_block block; unsigned int src_idx; @@ -316,26 +319,23 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs, { src_idx = 0; } - else + else if (matrix_cast) { - if (src_type->type == HLSL_CLASS_MATRIX && dst_type->type == HLSL_CLASS_MATRIX) - { - unsigned int x = dst_idx % dst_type->dimx, y = dst_idx / dst_type->dimx; + unsigned int x = dst_idx % dst_type->dimx, y = dst_idx / dst_type->dimx; - src_idx = y * src_type->dimx + x; - } - else - { - src_idx = dst_idx; - } + src_idx = y * src_type->dimx + x; + } + else + { + src_idx = dst_idx; } - dst_scalar_type = hlsl_type_get_component_type(ctx, dst_type, dst_idx); + dst_comp_type = hlsl_type_get_component_type(ctx, dst_type, dst_idx); if (!(load = add_load_component(ctx, instrs, node, src_idx, loc))) return NULL; - if (!(cast = hlsl_new_cast(ctx, &load->node, dst_scalar_type, loc))) + if (!(cast = hlsl_new_cast(ctx, &load->node, dst_comp_type, loc))) return NULL; list_add_tail(instrs, &cast->node.entry); diff --git a/tests/cast-broadcast.shader_test b/tests/cast-broadcast.shader_test index e21e65b0..d8571fc8 100644 --- a/tests/cast-broadcast.shader_test +++ b/tests/cast-broadcast.shader_test @@ -19,8 +19,8 @@ float4 main() : SV_TARGET } [test] -todo draw quad -todo probe all rgba (84.0, 84.0, 84.0, 84.0) +draw quad +probe all rgba (84.0, 84.0, 84.0, 84.0) [pixel shader fail] diff --git a/tests/cast-componentwise-compatible.shader_test b/tests/cast-componentwise-compatible.shader_test index c6402cf5..286c180b 100644 --- a/tests/cast-componentwise-compatible.shader_test +++ b/tests/cast-componentwise-compatible.shader_test @@ -16,8 +16,8 @@ float4 main() : sv_target [test] -todo draw quad -todo probe all rgba (1.0, 2.0, 3.0, 1.0) +draw quad +probe all rgba (1.0, 2.0, 3.0, 1.0) [pixel shader] @@ -39,8 +39,8 @@ float4 main() : sv_target [test] -todo draw quad -todo probe all rgba (5.0, 6.0, 7.0, 8.0) +draw quad +probe all rgba (5.0, 6.0, 7.0, 8.0) [pixel shader] @@ -55,8 +55,8 @@ float4 main() : sv_target [test] -todo draw quad -todo probe all rgba (1.0, 2.0, 3.0, 4.0) +draw quad +probe all rgba (1.0, 2.0, 3.0, 4.0) [pixel shader] @@ -86,8 +86,8 @@ float4 main() : sv_target } [test] -todo draw quad -todo probe all rgba (7.0, 7.0, 7.0, 7.0) +draw quad +probe all rgba (7.0, 7.0, 7.0, 7.0) [pixel shader] @@ -119,8 +119,8 @@ float4 main() : sv_target } [test] -todo draw quad -todo probe all rgba (3.0, 3.0, 3.0, 3.0) +draw quad +probe all rgba (3.0, 3.0, 3.0, 3.0) [pixel shader fail]
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
54
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
Results per page:
10
25
50
100
200