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
August 2023
----- 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
667 discussions
Start a n
N
ew thread
Bernhard Kölbl : mfmediaengine/tests: Add tests for RemoveAllEffects().
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: wine Branch: master Commit: ffba650a3311f004976f9e33568f0331759cf509 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ffba650a3311f004976f9e33568f03…
Author: Bernhard Kölbl <bkoelbl(a)codeweavers.com> Date: Tue Jul 18 13:49:18 2023 +0200 mfmediaengine/tests: Add tests for RemoveAllEffects(). Signed-off-by: Bernhard Kölbl <bkoelbl(a)codeweavers.com> --- dlls/mfmediaengine/tests/mfmediaengine.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 4eb04c8e7ef..3fbcd8c4d1d 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -1828,6 +1828,9 @@ static void test_effect(void) hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = passthrough_mft_create(0, &video_effect); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1842,6 +1845,22 @@ static void test_effect(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); EXPECT_REF(&video_effect2->IMFTransform_iface, 2); + hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine EXPECT_REF(&video_effect->IMFTransform_iface, 1); + todo_wine EXPECT_REF(&video_effect2->IMFTransform_iface, 1); + + if (FAILED(hr)) /* Temporary skip */ + goto done; + + hr = IMFMediaEngineEx_InsertVideoEffect(media_engine_ex, (IUnknown *)&video_effect->IMFTransform_iface, FALSE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine EXPECT_REF(&video_effect->IMFTransform_iface, 2); + + hr = IMFMediaEngineEx_InsertVideoEffect(media_engine_ex, (IUnknown *)&video_effect2->IMFTransform_iface, FALSE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine EXPECT_REF(&video_effect2->IMFTransform_iface, 2); + hr = passthrough_mft_create(0, &audio_effect); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1890,6 +1909,10 @@ done: if (media_engine_ex) { IMFMediaEngineEx_Shutdown(media_engine_ex); + + hr = IMFMediaEngineEx_RemoveAllEffects(media_engine_ex); + todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + IMFMediaEngineEx_Release(media_engine_ex); }
1
0
0
0
Bernhard Kölbl : mfmediaengine/tests: Make effect tests more consistent.
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: wine Branch: master Commit: d19af88f59dbd6a7372adf64c2a0410fd8f85a1c URL:
https://gitlab.winehq.org/wine/wine/-/commit/d19af88f59dbd6a7372adf64c2a041…
Author: Bernhard Kölbl <bkoelbl(a)codeweavers.com> Date: Tue Jul 25 23:31:32 2023 +0200 mfmediaengine/tests: Make effect tests more consistent. Do this by waiting for the first available frame with a separate ready event and removing flaky ref checks. Signed-off-by: Bernhard Kölbl <bkoelbl(a)codeweavers.com> --- dlls/mfmediaengine/tests/mfmediaengine.c | 42 +++++++++++--------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index aa9de414fcb..4eb04c8e7ef 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -1139,7 +1139,7 @@ struct test_transfer_notify LONG refcount; IMFMediaEngineEx *media_engine; - HANDLE ready_event; + HANDLE ready_event, frame_ready_event; HRESULT error; }; @@ -1175,6 +1175,7 @@ static ULONG WINAPI test_transfer_notify_Release(IMFMediaEngineNotify *iface) if (!refcount) { + CloseHandle(notify->frame_ready_event); CloseHandle(notify->ready_event); free(notify); } @@ -1211,6 +1212,8 @@ static HRESULT WINAPI test_transfer_notify_EventNotify(IMFMediaEngineNotify *ifa notify->error = param2; /* fallthrough */ case MF_MEDIA_ENGINE_EVENT_FIRSTFRAMEREADY: + SetEvent(notify->frame_ready_event); + break; case MF_MEDIA_ENGINE_EVENT_TIMEUPDATE: SetEvent(notify->ready_event); break; @@ -1237,6 +1240,9 @@ static struct test_transfer_notify *create_transfer_notify(void) object->ready_event = CreateEventW(NULL, FALSE, FALSE, NULL); ok(!!object->ready_event, "Failed to create an event, error %lu.\n", GetLastError()); + object->frame_ready_event = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(!!object->frame_ready_event, "Failed to create an event, error %lu.\n", GetLastError()); + return object; } @@ -1295,7 +1301,7 @@ static void test_TransferVideoFrame(void) SysFreeString(url); IMFByteStream_Release(stream); - res = WaitForSingleObject(notify->ready_event, 5000); + res = WaitForSingleObject(notify->frame_ready_event, 5000); ok(!res, "Unexpected res %#lx.\n", res); if (FAILED(notify->error)) @@ -1787,7 +1793,6 @@ static void test_effect(void) UINT token; HRESULT hr; DWORD res; - ULONG ref; BSTR url; stream = load_resource(L"i420-64x64.avi", L"video/avi"); @@ -1858,14 +1863,9 @@ static void test_effect(void) IMFByteStream_Release(stream); /* Wait for MediaEngine to be ready. */ - res = WaitForSingleObject(notify->ready_event, 5000); + res = WaitForSingleObject(notify->frame_ready_event, 5000); ok(!res, "Unexpected res %#lx.\n", res); - /* Wait for another update. This makes MediaEngine shutdown more consistent on Windows. */ - res = WaitForSingleObject(notify->ready_event, 500); - /* Timeupdates are missing in Wine. */ - todo_wine ok(!res, "Unexpected res %#lx.\n", res); - SetRect(&dst_rect, 0, 0, desc.Width, desc.Height); hr = IMFMediaEngineEx_TransferVideoFrame(notify->media_engine, (IUnknown *)texture, NULL, &dst_rect, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1890,9 +1890,7 @@ done: if (media_engine_ex) { IMFMediaEngineEx_Shutdown(media_engine_ex); - - ref = IMFMediaEngineEx_Release(media_engine_ex); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); + IMFMediaEngineEx_Release(media_engine_ex); } if (texture) @@ -1901,26 +1899,14 @@ done: ID3D11Device_Release(device); if (audio_effect2) - { - ref = IMFTransform_Release(&audio_effect2->IMFTransform_iface); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); - } + IMFTransform_Release(&audio_effect2->IMFTransform_iface); if (audio_effect) - { - ref = IMFTransform_Release(&audio_effect->IMFTransform_iface); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); - } + IMFTransform_Release(&audio_effect->IMFTransform_iface); if (video_effect2) - { - ref = IMFTransform_Release(&video_effect2->IMFTransform_iface); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); - } + IMFTransform_Release(&video_effect2->IMFTransform_iface); if (video_effect) - { - ref = IMFTransform_Release(&video_effect->IMFTransform_iface); - todo_wine ok(!ref, "Unexpected ref %lu.\n", ref); - } + IMFTransform_Release(&video_effect->IMFTransform_iface); IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface); }
1
0
0
0
Ilia Docin : sane.ds: Do the reverse conversion of frame edges before setting.
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: wine Branch: master Commit: 5590294cf3b9c3832abc71d60fe05afa8bd8c4b4 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5590294cf3b9c3832abc71d60fe05a…
Author: Ilia Docin <ilya.docin(a)contentai.ru> Date: Sun Aug 6 12:30:31 2023 +0300 sane.ds: Do the reverse conversion of frame edges before setting. Sane backends must attach a unit of either pixels or millimeters to scan area options. --- dlls/sane.ds/ds_image.c | 8 ++++---- dlls/sane.ds/options.c | 5 +++++ dlls/sane.ds/sane_i.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/sane.ds/ds_image.c b/dlls/sane.ds/ds_image.c index b2fad94c848..93193abc69f 100644 --- a/dlls/sane.ds/ds_image.c +++ b/dlls/sane.ds/ds_image.c @@ -164,10 +164,10 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin, img->Frame.Right.Whole, img->Frame.Right.Frac, img->Frame.Bottom.Whole, img->Frame.Bottom.Frac); - tlx = img->Frame.Left.Whole * 65536 + img->Frame.Left.Frac; - tly = img->Frame.Top.Whole * 65536 + img->Frame.Top.Frac; - brx = img->Frame.Right.Whole * 65536 + img->Frame.Right.Frac; - bry = img->Frame.Bottom.Whole * 65536 + img->Frame.Bottom.Frac; + tlx = convert_twain_res_to_sane( img->Frame.Left ); + tly = convert_twain_res_to_sane( img->Frame.Top ); + brx = convert_twain_res_to_sane( img->Frame.Right ); + bry = convert_twain_res_to_sane( img->Frame.Bottom ); twrc = sane_option_set_scan_area( tlx, tly, brx, bry, &changed ); if (twrc != TWRC_SUCCESS) diff --git a/dlls/sane.ds/options.c b/dlls/sane.ds/options.c index 30ca441fd28..fabbb554744 100644 --- a/dlls/sane.ds/options.c +++ b/dlls/sane.ds/options.c @@ -200,6 +200,11 @@ TW_FIX32 convert_sane_res_to_twain(int res) return value; } +int convert_twain_res_to_sane( TW_FIX32 res ) +{ + return MulDiv( res.Whole * 65536 + res.Frac, 254, 10 ); /* inch -> mm */ +} + TW_UINT16 get_sane_params( struct frame_parameters *params ) { return SANE_CALL( get_params, params ); diff --git a/dlls/sane.ds/sane_i.h b/dlls/sane.ds/sane_i.h index 571917944e1..685ccbe0814 100644 --- a/dlls/sane.ds/sane_i.h +++ b/dlls/sane.ds/sane_i.h @@ -208,6 +208,7 @@ TW_UINT16 sane_option_get_scan_area( int *tlx, int *tly, int *brx, int *bry ) DE TW_UINT16 sane_option_get_max_scan_area( int *tlx, int *tly, int *brx, int *bry ) DECLSPEC_HIDDEN; TW_UINT16 sane_option_set_scan_area( int tlx, int tly, int brx, int bry, BOOL *reload ) DECLSPEC_HIDDEN; TW_FIX32 convert_sane_res_to_twain( int res ) DECLSPEC_HIDDEN; +int convert_twain_res_to_sane( TW_FIX32 res ) DECLSPEC_HIDDEN; TW_UINT16 get_sane_params( struct frame_parameters *params ) DECLSPEC_HIDDEN; #endif
1
0
0
0
Henri Verbeet : vkd3d-dxbc: Implement listing section data.
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: vkd3d Branch: master Commit: 5d75731d9776a58ef1632ac8206abc126dcb1dfb URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/5d75731d9776a58ef1632ac8206ab…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 3 12:00:02 2023 +0200 vkd3d-dxbc: Implement listing section data. --- programs/vkd3d-dxbc/main.c | 72 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/programs/vkd3d-dxbc/main.c b/programs/vkd3d-dxbc/main.c index 6766016d..ea425f09 100644 --- a/programs/vkd3d-dxbc/main.c +++ b/programs/vkd3d-dxbc/main.c @@ -38,6 +38,7 @@ enum OPTION_COLOUR = CHAR_MAX + 1, OPTION_HELP, OPTION_LIST, + OPTION_LIST_DATA, OPTION_NO_COLOUR, OPTION_VERSION, }; @@ -47,12 +48,14 @@ struct options const char *input_filename; bool print_help; bool list; + bool list_data; bool print_version; struct colours { const char *reset; const char *index; + const char *offset; const char *label; } colours; }; @@ -86,6 +89,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options) {"colour", no_argument, NULL, OPTION_COLOUR}, {"help", no_argument, NULL, OPTION_HELP}, {"list", no_argument, NULL, OPTION_LIST}, + {"list-data", no_argument, NULL, OPTION_LIST_DATA}, {"no-colour", no_argument, NULL, OPTION_NO_COLOUR}, {"version", no_argument, NULL, OPTION_VERSION}, {NULL, 0, NULL, 0}, @@ -95,6 +99,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options) { .reset = "\x1b[m", .index = "\x1b[92m", + .offset = "\x1b[36m", .label = "\x1b[93m", }; @@ -102,6 +107,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options) { .reset = "", .index = "", + .offset = "", .label = "", }; @@ -132,6 +138,10 @@ static bool parse_command_line(int argc, char **argv, struct options *options) options->list = true; break; + case OPTION_LIST_DATA: + options->list_data = true; + break; + case OPTION_NO_COLOUR: options->colours = no_colours; break; @@ -160,6 +170,7 @@ static void print_usage(const char *program_name) " --colour Enable colour, even when not supported by the output.\n" " -h, --help Display this information and exit.\n" " -t, --list List the contents of the DXBC blob.\n" + " --list-data List the data contained in the DXBC sections.\n" " --no-colour Disable colour, even when supported by the output.\n" " -V, --version Display version information and exit.\n" " -- Stop option processing. Any subsequent argument is\n" @@ -259,6 +270,59 @@ static const char *dump_tag(char *out, uint32_t tag) return out; } +static void dump_line(const struct colours *colours, const char *prefix, + const uint8_t *data, size_t offset, size_t count) +{ + const uint8_t *ptr = &data[offset]; + size_t i; + + if (!count) + return; + + printf("%s%s%08zx%s ", prefix, colours->offset, offset, colours->reset); + for (i = 0; i < count; ++i) + { + printf("%02x ", ptr[i]); + if (i == 7) + printf(" "); + } + + while (i < 16) + { + printf(" "); + if (i == 7) + printf(" "); + ++i; + } + printf(" %s|%s", colours->offset, colours->reset); + + for (i = 0; i < count; ++i) + { + printf("%c", isprint(ptr[i]) ? ptr[i] : '.'); + } + printf("%s|%s\n", colours->offset, colours->reset); +} + +static void dump_data(const struct colours *colours, const char *prefix, const struct vkd3d_shader_code *data) +{ + size_t line_count, remainder, i; + const uint8_t *ptr; + + ptr = data->code; + line_count = data->size / 16; + remainder = data->size % 16; + + for (i = 0; i < line_count; ++i, ptr += 16) + { + dump_line(colours, prefix, data->code, i * 16, 16); + } + if (remainder) + { + dump_line(colours, prefix, data->code, i * 16, remainder); + } + printf("%s%s%08zx%s\n", prefix, colours->offset, data->size, colours->reset); +} + static void dump_dxbc(const struct vkd3d_shader_dxbc_desc *dxbc_desc, const struct options *options) { const struct colours *colours = &options->colours; @@ -288,6 +352,12 @@ static void dump_dxbc(const struct vkd3d_shader_dxbc_desc *dxbc_desc, const stru colours->index, i, colours->reset, section->tag, dump_tag(tag, section->tag), section->data.size, section->data.size); + + if (!options->list_data) + continue; + printf("\n"); + dump_data(colours, " ", §ion->data); + printf("\n"); } } @@ -338,7 +408,7 @@ int main(int argc, char **argv) if (ret < 0) goto done; - if (options.list) + if (options.list || options.list_data) dump_dxbc(&dxbc_desc, &options); vkd3d_shader_free_dxbc(&dxbc_desc);
1
0
0
0
Henri Verbeet : vkd3d-dxbc: Implement listing DXBC contents.
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: vkd3d Branch: master Commit: fbb5e59a03026696178cc555b0e4158f2e51d184 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/fbb5e59a03026696178cc555b0e41…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 3 12:00:01 2023 +0200 vkd3d-dxbc: Implement listing DXBC contents. --- Makefile.am | 3 +- README | 4 +- programs/vkd3d-dxbc/main.c | 241 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 240 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 45f1dd54..27738f3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -360,7 +360,8 @@ vkd3d_compiler_CFLAGS = $(AM_CFLAGS) @NCURSES_CFLAGS@ vkd3d_compiler_LDADD = libvkd3d-shader.la @NCURSES_LIBS@ vkd3d_dxbc_SOURCES = programs/vkd3d-dxbc/main.c -vkd3d_dxbc_LDADD = libvkd3d-shader.la +vkd3d_dxbc_CFLAGS = $(AM_CFLAGS) @NCURSES_CFLAGS@ +vkd3d_dxbc_LDADD = libvkd3d-shader.la @NCURSES_LIBS@ LDADD = libvkd3d.la libvkd3d-shader.la libvkd3d-utils.la AM_DEFAULT_SOURCE_EXT = .c diff --git a/README b/README index 465d5f91..cac0d6dd 100644 --- a/README +++ b/README @@ -47,8 +47,8 @@ commas or semicolons. * NO_COLOR - this is an alias of NO_COLOUR. - * NO_COLOUR - when set, vkd3d-compiler will default to monochrome output, - even when the output supports colour. + * NO_COLOUR - when set, vkd3d-compiler and vkd3d-dxbc will default to + monochrome output, even when the output supports colour. * VKD3D_CONFIG - a list of options that change the behavior of libvkd3d. * virtual_heaps - Create descriptors for each D3D12 root signature diff --git a/programs/vkd3d-dxbc/main.c b/programs/vkd3d-dxbc/main.c index f75f9542..6766016d 100644 --- a/programs/vkd3d-dxbc/main.c +++ b/programs/vkd3d-dxbc/main.c @@ -25,47 +25,117 @@ #include <stdbool.h> #include <unistd.h> #include <getopt.h> +#include <sys/stat.h> #include "vkd3d_common.h" #include "vkd3d_shader.h" +#ifdef HAVE_NCURSES +#include <term.h> +#endif enum { - OPTION_HELP = CHAR_MAX + 1, + OPTION_COLOUR = CHAR_MAX + 1, + OPTION_HELP, + OPTION_LIST, + OPTION_NO_COLOUR, OPTION_VERSION, }; struct options { + const char *input_filename; bool print_help; + bool list; bool print_version; + + struct colours + { + const char *reset; + const char *index; + const char *label; + } colours; }; +static bool has_colour(void) +{ +#ifdef HAVE_NCURSES + bool supported; + int ret; + + if (!isatty(fileno(stdout))) + return false; + setupterm(NULL, fileno(stdout), &ret); + if (ret != 1) + return false; + supported = !!tigetstr("setaf"); + del_curterm(cur_term); + + return supported; +#else + return false; +#endif +} + static bool parse_command_line(int argc, char **argv, struct options *options) { int option; static struct option long_options[] = { + {"colour", no_argument, NULL, OPTION_COLOUR}, {"help", no_argument, NULL, OPTION_HELP}, + {"list", no_argument, NULL, OPTION_LIST}, + {"no-colour", no_argument, NULL, OPTION_NO_COLOUR}, {"version", no_argument, NULL, OPTION_VERSION}, {NULL, 0, NULL, 0}, }; + static const struct colours colours = + { + .reset = "\x1b[m", + .index = "\x1b[92m", + .label = "\x1b[93m", + }; + + static const struct colours no_colours = + { + .reset = "", + .index = "", + .label = "", + }; + memset(options, 0, sizeof(*options)); + if (!getenv("NO_COLOUR") && !getenv("NO_COLOR") && has_colour()) + options->colours = colours; + else + options->colours = no_colours; for (;;) { - if ((option = getopt_long(argc, argv, "hV", long_options, NULL)) == -1) + if ((option = getopt_long(argc, argv, "htV", long_options, NULL)) == -1) break; switch (option) { + case OPTION_COLOUR: + options->colours = colours; + break; + case 'h': case OPTION_HELP: options->print_help = true; return true; + case 't': + case OPTION_LIST: + options->list = true; + break; + + case OPTION_NO_COLOUR: + options->colours = no_colours; + break; + case 'V': case OPTION_VERSION: options->print_version = true; @@ -76,25 +146,161 @@ static bool parse_command_line(int argc, char **argv, struct options *options) } } + if (optind < argc) + options->input_filename = argv[argc - 1]; + return true; } static void print_usage(const char *program_name) { static const char usage[] = - "[options...]\n" + "[options...] [file]\n" "Options:\n" + " --colour Enable colour, even when not supported by the output.\n" " -h, --help Display this information and exit.\n" + " -t, --list List the contents of the DXBC blob.\n" + " --no-colour Disable colour, even when supported by the output.\n" " -V, --version Display version information and exit.\n" " -- Stop option processing. Any subsequent argument is\n" - " interpreted as a filename.\n"; + " interpreted as a filename.\n" + "\n" + "If the input file is '-' or not specified, input will be read from standard\n" + "input.\n"; fprintf(stderr, "Usage: %s %s", program_name, usage); } +static FILE *open_input(const char *filename, bool *close) +{ + FILE *f; + + *close = false; + + if (!filename || !strcmp(filename, "-")) + return stdin; + + if (!(f = fopen(filename, "rb"))) + { + fprintf(stderr, "Unable to open '%s' for reading.\n", filename); + return NULL; + } + + *close = true; + return f; +} + +static bool read_input(FILE *f, struct vkd3d_shader_code *dxbc) +{ + size_t size = 4096; + struct stat st; + size_t pos = 0; + uint8_t *data; + size_t ret; + + memset(dxbc, 0, sizeof(*dxbc)); + + if (fstat(fileno(f), &st) == -1) + { + fprintf(stderr, "Could not stat input.\n"); + return false; + } + + if (S_ISREG(st.st_mode)) + size = st.st_size; + + if (!(data = malloc(size))) + { + fprintf(stderr, "Out of memory.\n"); + return false; + } + + for (;;) + { + if (pos >= size) + { + if (size > SIZE_MAX / 2 || !(data = realloc(data, size * 2))) + { + fprintf(stderr, "Out of memory.\n"); + free(data); + return false; + } + size *= 2; + } + + if (!(ret = fread(&data[pos], 1, size - pos, f))) + break; + pos += ret; + } + + if (!feof(f)) + { + free(data); + return false; + } + + dxbc->code = data; + dxbc->size = pos; + + return true; +} + +static const char *dump_tag(char *out, uint32_t tag) +{ + unsigned int i; + + memcpy(out, &tag, sizeof(tag)); + for (i = 0; i < sizeof(tag); ++i) + { + if (!isprint(out[i])) + out[i] = '.'; + } + + return out; +} + +static void dump_dxbc(const struct vkd3d_shader_dxbc_desc *dxbc_desc, const struct options *options) +{ + const struct colours *colours = &options->colours; + struct vkd3d_shader_dxbc_section_desc *section; + char tag[4]; + size_t i; + + printf(" %stag%s: %08x (%.4s)\n", + colours->label, colours->reset, + dxbc_desc->tag, dump_tag(tag, dxbc_desc->tag)); + printf(" %schecksum%s: %08x %08x %08x %08x\n", + colours->label, colours->reset, + dxbc_desc->checksum[0], dxbc_desc->checksum[1], + dxbc_desc->checksum[2], dxbc_desc->checksum[3]); + printf(" %sversion%s: %u\n", colours->label, colours->reset, dxbc_desc->version); + printf(" %ssize%s: %#zx (%zu) bytes\n", colours->label, colours->reset, dxbc_desc->size, dxbc_desc->size); + printf(" %ssections%s: %zu\n\n", colours->label, colours->reset, dxbc_desc->section_count); + + printf(" %s#%s %stag%s %ssize%s\n", + colours->label, colours->reset, + colours->label, colours->reset, + colours->label, colours->reset); + for (i = 0; i < dxbc_desc->section_count; ++i) + { + section = &dxbc_desc->sections[i]; + printf("%s%2zu%s %08x (%.4s) 0x%08zx (%zu) bytes\n", + colours->index, i, colours->reset, + section->tag, dump_tag(tag, section->tag), + section->data.size, section->data.size); + } +} + int main(int argc, char **argv) { + struct vkd3d_shader_dxbc_desc dxbc_desc; + struct vkd3d_shader_code dxbc; struct options options; + bool close_input; + char *messages; + int fail = 1; + FILE *input; + int ret; if (!parse_command_line(argc, argv, &options)) { @@ -116,5 +322,30 @@ int main(int argc, char **argv) return 0; } - return 0; + if (!(input = open_input(options.input_filename, &close_input))) + goto done; + + if (!read_input(input, &dxbc)) + { + fprintf(stderr, "Failed to read input blob.\n"); + goto done; + } + + ret = vkd3d_shader_parse_dxbc(&dxbc, 0, &dxbc_desc, &messages); + if (messages) + fputs(messages, stderr); + vkd3d_shader_free_messages(messages); + if (ret < 0) + goto done; + + if (options.list) + dump_dxbc(&dxbc_desc, &options); + + vkd3d_shader_free_dxbc(&dxbc_desc); + vkd3d_shader_free_shader_code(&dxbc); + fail = 0; +done: + if (close_input) + fclose(input); + return fail; }
1
0
0
0
Henri Verbeet : vkd3d-dxbc: Introduce a program to inspect and modify DXBC blobs.
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: vkd3d Branch: master Commit: 6bfb94c440ea6a925c6157b83073855eac061041 URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/6bfb94c440ea6a925c6157b830738…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 3 12:00:00 2023 +0200 vkd3d-dxbc: Introduce a program to inspect and modify DXBC blobs. --- .gitignore | 1 + Makefile.am | 6 ++- programs/vkd3d-dxbc/main.c | 120 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b6d29d19..841220ee 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ Makefile Makefile.in test-suite.log /vkd3d-compiler +/vkd3d-dxbc vkd3d-*.tar.xz diff --git a/Makefile.am b/Makefile.am index ecb7c7e2..45f1dd54 100644 --- a/Makefile.am +++ b/Makefile.am @@ -353,11 +353,15 @@ EXTRA_DIST += \ libs/vkd3d-shader/libvkd3d-shader.pc.in \ libs/vkd3d-utils/libvkd3d-utils.pc.in -bin_PROGRAMS = vkd3d-compiler +bin_PROGRAMS = vkd3d-compiler vkd3d-dxbc + vkd3d_compiler_SOURCES = programs/vkd3d-compiler/main.c vkd3d_compiler_CFLAGS = $(AM_CFLAGS) @NCURSES_CFLAGS@ vkd3d_compiler_LDADD = libvkd3d-shader.la @NCURSES_LIBS@ +vkd3d_dxbc_SOURCES = programs/vkd3d-dxbc/main.c +vkd3d_dxbc_LDADD = libvkd3d-shader.la + LDADD = libvkd3d.la libvkd3d-shader.la libvkd3d-utils.la AM_DEFAULT_SOURCE_EXT = .c diff --git a/programs/vkd3d-dxbc/main.c b/programs/vkd3d-dxbc/main.c new file mode 100644 index 00000000..f75f9542 --- /dev/null +++ b/programs/vkd3d-dxbc/main.c @@ -0,0 +1,120 @@ +/* + * Copyright 2023 Henri Verbeet for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <stdio.h> +#include <string.h> +#include <limits.h> +#include <stdbool.h> +#include <unistd.h> +#include <getopt.h> + +#include "vkd3d_common.h" +#include "vkd3d_shader.h" + +enum +{ + OPTION_HELP = CHAR_MAX + 1, + OPTION_VERSION, +}; + +struct options +{ + bool print_help; + bool print_version; +}; + +static bool parse_command_line(int argc, char **argv, struct options *options) +{ + int option; + + static struct option long_options[] = + { + {"help", no_argument, NULL, OPTION_HELP}, + {"version", no_argument, NULL, OPTION_VERSION}, + {NULL, 0, NULL, 0}, + }; + + memset(options, 0, sizeof(*options)); + + for (;;) + { + if ((option = getopt_long(argc, argv, "hV", long_options, NULL)) == -1) + break; + + switch (option) + { + case 'h': + case OPTION_HELP: + options->print_help = true; + return true; + + case 'V': + case OPTION_VERSION: + options->print_version = true; + return true; + + default: + return false; + } + } + + return true; +} + +static void print_usage(const char *program_name) +{ + static const char usage[] = + "[options...]\n" + "Options:\n" + " -h, --help Display this information and exit.\n" + " -V, --version Display version information and exit.\n" + " -- Stop option processing. Any subsequent argument is\n" + " interpreted as a filename.\n"; + + fprintf(stderr, "Usage: %s %s", program_name, usage); +} + +int main(int argc, char **argv) +{ + struct options options; + + if (!parse_command_line(argc, argv, &options)) + { + print_usage(argv[0]); + return 1; + } + + if (options.print_help || (argc < 2 && isatty(fileno(stdin)))) + { + print_usage(argv[0]); + return 0; + } + + if (options.print_version) + { + const char *version = vkd3d_shader_get_version(NULL, NULL); + + fprintf(stdout, "vkd3d-dxbc version " PACKAGE_VERSION " using %s\n", version); + return 0; + } + + return 0; +}
1
0
0
0
Jeff Smith : msvcp120/tests: Use compare_uint() in compare_float() instead of abs().
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: wine Branch: master Commit: ed29473e60ad4e6601b12bbeb37ad56156fa9e42 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ed29473e60ad4e6601b12bbeb37ad5…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Wed Aug 2 22:19:19 2023 -0500 msvcp120/tests: Use compare_uint() in compare_float() instead of abs(). The result of abs(INT_MIN) is INT_MIN, which breaks the ulps comparison. --- dlls/msvcp120/tests/msvcp120.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 44c0a3f0fe0..060dda5b45f 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -187,6 +187,13 @@ enum file_type { type_unknown }; +static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + unsigned int diff = x > y ? x - y : y - x; + + return diff <= max_diff; +} + static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; @@ -197,10 +204,7 @@ static BOOL compare_float(float f, float g, unsigned int ulps) if (y < 0) y = INT_MIN - y; - if (abs(x - y) > ulps) - return FALSE; - - return TRUE; + return compare_uint(x, y, ulps); } static char* (__cdecl *p_setlocale)(int, const char*);
1
0
0
0
Jeff Smith : d2d1/tests: Use compare_uint() in compare_float() instead of abs().
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: wine Branch: master Commit: 7febd8db5dbcdca8bd172a6cabfbddb32afecf85 URL:
https://gitlab.winehq.org/wine/wine/-/commit/7febd8db5dbcdca8bd172a6cabfbdd…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Wed Aug 2 22:15:28 2023 -0500 d2d1/tests: Use compare_uint() in compare_float() instead of abs(). The result of abs(INT_MIN) is INT_MIN, which breaks the ulps comparison. --- dlls/d2d1/tests/d2d1.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 4f53b4b7142..9480e1fc1a5 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -731,10 +731,7 @@ static BOOL compare_float(float f, float g, unsigned int ulps) if (y < 0) y = INT_MIN - y; - if (abs(x - y) > ulps) - return FALSE; - - return TRUE; + return compare_uint(x, y, ulps); } static BOOL compare_colour_f(const D2D1_COLOR_F *colour, float r, float g, float b, float a, unsigned int ulps)
1
0
0
0
Jeff Smith : d3dcompiler_43/tests: Use compare_uint() in compare_float() instead of abs().
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: wine Branch: master Commit: 0a8610f9ba926977533b2b8f6035689e7430cae5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0a8610f9ba926977533b2b8f603568…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Wed Aug 2 22:39:59 2023 -0500 d3dcompiler_43/tests: Use compare_uint() in compare_float() instead of abs(). The result of abs(INT_MIN) is INT_MIN, which breaks the ulps comparison. --- dlls/d3dcompiler_43/tests/hlsl_d3d11.c | 12 ++++++++---- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c index ac0cf20e5ee..c853b14f13a 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c @@ -57,6 +57,13 @@ static ID3D10Blob *compile_shader_(unsigned int line, const char *source, const return blob; } +static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + unsigned int diff = x > y ? x - y : y - x; + + return diff <= max_diff; +} + static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; @@ -67,10 +74,7 @@ static BOOL compare_float(float f, float g, unsigned int ulps) if (y < 0) y = INT_MIN - y; - if (abs(x - y) > ulps) - return FALSE; - - return TRUE; + return compare_uint(x, y, ulps); } static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, float w, unsigned int ulps) diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index 1ba283f4d99..42fb3b97fc2 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -326,6 +326,13 @@ static struct vec4 get_color_vec4(IDirect3DDevice9 *device, unsigned int x, unsi return ret; } +static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + unsigned int diff = x > y ? x - y : y - x; + + return diff <= max_diff; +} + static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; @@ -336,10 +343,7 @@ static BOOL compare_float(float f, float g, unsigned int ulps) if (y < 0) y = INT_MIN - y; - if (abs(x - y) > ulps) - return FALSE; - - return TRUE; + return compare_uint(x, y, ulps); } static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, float w, unsigned int ulps)
1
0
0
0
Jeff Smith : d3dx10_43/tests: Use compare_uint() in compare_float() instead of abs().
by Alexandre Julliard
08 Aug '23
08 Aug '23
Module: wine Branch: master Commit: 11516e7cee7499b78c6cbc0f008fce095e17d6f9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/11516e7cee7499b78c6cbc0f008fce…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Wed Aug 2 22:39:28 2023 -0500 d3dx10_43/tests: Use compare_uint() in compare_float() instead of abs(). The result of abs(INT_MIN) is INT_MIN, which breaks the ulps comparison. --- dlls/d3dx10_43/tests/d3dx10.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index 8257ab1e919..e9c215d3c45 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -1120,6 +1120,13 @@ static ULONG get_refcount(void *iface) return IUnknown_Release(unknown); } +static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + unsigned int diff = x > y ? x - y : y - x; + + return diff <= max_diff; +} + static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; @@ -1130,10 +1137,7 @@ static BOOL compare_float(float f, float g, unsigned int ulps) if (y < 0) y = INT_MIN - y; - if (abs(x - y) > ulps) - return FALSE; - - return TRUE; + return compare_uint(x, y, ulps); } static char *get_str_a(const WCHAR *wstr)
1
0
0
0
← Newer
1
...
46
47
48
49
50
51
52
...
67
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
Results per page:
10
25
50
100
200