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
November 2021
----- 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
2 participants
951 discussions
Start a n
N
ew thread
Jinoh Kang : winedbg: Use exponential growth in gdbproxy reply_buffer_grow.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: 16df7786279ca081558fabee962c1cc950656a34 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=16df7786279ca081558fabee…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Wed Nov 24 00:09:53 2021 +0900 winedbg: Use exponential growth in gdbproxy reply_buffer_grow. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/gdbproxy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 07a45cd1b15..120cc84e008 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -236,9 +236,14 @@ static void reply_buffer_clear(struct reply_buffer* reply) static void reply_buffer_grow(struct reply_buffer* reply, size_t size) { - if (reply->alloc < reply->len + size) + size_t required_alloc = reply->len + size; + + if (reply->alloc < required_alloc) { - reply->alloc = ((reply->len + size) / 32 + 1) * 32; + reply->alloc = reply->alloc * 3 / 2; + if (reply->alloc < required_alloc) + reply->alloc = required_alloc; + reply->base = realloc(reply->base, reply->alloc); } }
1
0
0
0
Jinoh Kang : winedbg: Refactor gdb_context::out_{buf*,len} into reply_buffer.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: 9b29182ca7c39f3c3e965101a11dfccd0efd66f1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9b29182ca7c39f3c3e965101…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Wed Nov 24 00:09:48 2021 +0900 winedbg: Refactor gdb_context::out_{buf*,len} into reply_buffer. This is required for a subsequent patch that adds buffering for GDB qXfer reply data. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/gdbproxy.c | 134 ++++++++++++++++++++++++++------------------ 1 file changed, 80 insertions(+), 54 deletions(-) diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index c1d0bda1a41..07a45cd1b15 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -54,6 +54,13 @@ struct gdb_xpoint unsigned int value; }; +struct reply_buffer +{ + unsigned char* base; + size_t len; + size_t alloc; +}; + struct gdb_context { /* gdb information */ @@ -66,9 +73,7 @@ struct gdb_context char* in_packet; int in_packet_len; /* outgoing buffer */ - char* out_buf; - int out_buf_alloc; - int out_len; + struct reply_buffer out_buf; int out_curr_packet; /* generic GDB thread information */ int exec_tid; /* tid used in step & continue */ @@ -224,12 +229,57 @@ static void hex_to(char* dst, const void* src, size_t len) } } -static unsigned char checksum(const char* ptr, int len) +static void reply_buffer_clear(struct reply_buffer* reply) +{ + reply->len = 0; +} + +static void reply_buffer_grow(struct reply_buffer* reply, size_t size) +{ + if (reply->alloc < reply->len + size) + { + reply->alloc = ((reply->len + size) / 32 + 1) * 32; + reply->base = realloc(reply->base, reply->alloc); + } +} + +static void reply_buffer_append(struct reply_buffer* reply, const void* data, size_t size) +{ + reply_buffer_grow(reply, size); + memcpy(reply->base + reply->len, data, size); + reply->len += size; +} + +static inline void reply_buffer_append_hex(struct reply_buffer* reply, const void* src, size_t len) +{ + reply_buffer_grow(reply, len * 2); + hex_to((char *)reply->base + reply->len, src, len); + reply->len += len * 2; +} + +static inline void reply_buffer_append_uinthex(struct reply_buffer* reply, ULONG_PTR val, int len) +{ + char buf[sizeof(ULONG_PTR) * 2], *ptr; + + assert(len <= sizeof(ULONG_PTR)); + + ptr = buf + len * 2; + while (ptr != buf) + { + *--ptr = hex_to0(val & 0x0F); + val >>= 4; + } + + reply_buffer_append(reply, ptr, len * 2); +} + +static unsigned char checksum(const void* data, int len) { unsigned cksum = 0; + const unsigned char* ptr = data; while (len-- > 0) - cksum += (unsigned char)*ptr++; + cksum += *ptr++; return cksum; } @@ -705,20 +755,9 @@ static int addr_width(struct gdb_context* gdbctx) enum packet_return {packet_error = 0x00, packet_ok = 0x01, packet_done = 0x02, packet_last_f = 0x80}; -static void packet_reply_grow(struct gdb_context* gdbctx, size_t size) -{ - if (gdbctx->out_buf_alloc < gdbctx->out_len + size) - { - gdbctx->out_buf_alloc = ((gdbctx->out_len + size) / 32 + 1) * 32; - gdbctx->out_buf = realloc(gdbctx->out_buf, gdbctx->out_buf_alloc); - } -} - static void packet_reply_hex_to(struct gdb_context* gdbctx, const void* src, int len) { - packet_reply_grow(gdbctx, len * 2); - hex_to(&gdbctx->out_buf[gdbctx->out_len], src, len); - gdbctx->out_len += len * 2; + reply_buffer_append_hex(&gdbctx->out_buf, src, len); } static inline void packet_reply_hex_to_str(struct gdb_context* gdbctx, const char* src) @@ -728,15 +767,7 @@ static inline void packet_reply_hex_to_str(struct gdb_context* gdbctx, const cha static void packet_reply_val(struct gdb_context* gdbctx, ULONG_PTR val, int len) { - int i, shift; - - shift = (len - 1) * 8; - packet_reply_grow(gdbctx, len * 2); - for (i = 0; i < len; i++, shift -= 8) - { - gdbctx->out_buf[gdbctx->out_len++] = hex_to0((val >> (shift + 4)) & 0x0F); - gdbctx->out_buf[gdbctx->out_len++] = hex_to0((val >> shift ) & 0x0F); - } + reply_buffer_append_uinthex(&gdbctx->out_buf, val, len); } static const unsigned char gdb_special_chars_lookup_table[4] = { @@ -764,6 +795,7 @@ static inline BOOL is_gdb_special_char(unsigned char val) static void packet_reply_add(struct gdb_context* gdbctx, const char* str) { const unsigned char *ptr = (unsigned char *)str, *curr; + unsigned char esc_seq[2]; while (*ptr) { @@ -772,23 +804,20 @@ static void packet_reply_add(struct gdb_context* gdbctx, const char* str) while (*ptr && !is_gdb_special_char(*ptr)) ptr++; - packet_reply_grow(gdbctx, ptr - curr); - memcpy(&gdbctx->out_buf[gdbctx->out_len], curr, ptr - curr); - gdbctx->out_len += ptr - curr; + reply_buffer_append(&gdbctx->out_buf, curr, ptr - curr); if (!*ptr) break; - packet_reply_grow(gdbctx, 2); - gdbctx->out_buf[gdbctx->out_len++] = 0x7D; - gdbctx->out_buf[gdbctx->out_len++] = 0x20 ^ *ptr++; + esc_seq[0] = 0x7D; + esc_seq[1] = 0x20 ^ *ptr++; + reply_buffer_append(&gdbctx->out_buf, esc_seq, 2); } } static void packet_reply_open(struct gdb_context* gdbctx) { assert(gdbctx->out_curr_packet == -1); - packet_reply_grow(gdbctx, 1); - gdbctx->out_buf[gdbctx->out_len++] = '$'; - gdbctx->out_curr_packet = gdbctx->out_len; + reply_buffer_append(&gdbctx->out_buf, "$", 1); + gdbctx->out_curr_packet = gdbctx->out_buf.len; } static void packet_reply_close(struct gdb_context* gdbctx) @@ -796,10 +825,9 @@ static void packet_reply_close(struct gdb_context* gdbctx) unsigned char cksum; int plen; - plen = gdbctx->out_len - gdbctx->out_curr_packet; - packet_reply_grow(gdbctx, 1); - gdbctx->out_buf[gdbctx->out_len++] = '#'; - cksum = checksum(&gdbctx->out_buf[gdbctx->out_curr_packet], plen); + plen = gdbctx->out_buf.len - gdbctx->out_curr_packet; + reply_buffer_append(&gdbctx->out_buf, "#", 1); + cksum = checksum(gdbctx->out_buf.base + gdbctx->out_curr_packet, plen); packet_reply_hex_to(gdbctx, &cksum, 1); gdbctx->out_curr_packet = -1; } @@ -815,20 +843,20 @@ static void packet_reply_close_xfer(struct gdb_context* gdbctx, unsigned int off int begin = gdbctx->out_curr_packet + 1; int plen; - if (begin + off < gdbctx->out_len) + if (begin + off < gdbctx->out_buf.len) { - gdbctx->out_len -= off; - memmove(gdbctx->out_buf + begin, gdbctx->out_buf + begin + off, gdbctx->out_len); + gdbctx->out_buf.len -= off; + memmove(gdbctx->out_buf.base + begin, gdbctx->out_buf.base + begin + off, gdbctx->out_buf.len); } else { - gdbctx->out_buf[gdbctx->out_curr_packet] = 'l'; - gdbctx->out_len = gdbctx->out_curr_packet + 1; + gdbctx->out_buf.base[gdbctx->out_curr_packet] = 'l'; + gdbctx->out_buf.len = gdbctx->out_curr_packet + 1; } - plen = gdbctx->out_len - begin; - if (plen > len) gdbctx->out_len -= (plen - len); - else gdbctx->out_buf[gdbctx->out_curr_packet] = 'l'; + plen = gdbctx->out_buf.len - begin; + if (plen > len) gdbctx->out_buf.len -= (plen - len); + else gdbctx->out_buf.base[gdbctx->out_curr_packet] = 'l'; packet_reply_close(gdbctx); } @@ -2098,10 +2126,10 @@ static BOOL extract_packets(struct gdb_context* gdbctx) case packet_done: break; } - TRACE("Reply: %s\n", debugstr_an(gdbctx->out_buf, gdbctx->out_len)); - i = send(gdbctx->sock, gdbctx->out_buf, gdbctx->out_len, 0); - assert(i == gdbctx->out_len); - gdbctx->out_len = 0; + TRACE("Reply: %s\n", debugstr_an((char *)gdbctx->out_buf.base, gdbctx->out_buf.len)); + i = send(gdbctx->sock, (char *)gdbctx->out_buf.base, gdbctx->out_buf.len, 0); + assert(i == gdbctx->out_buf.len); + reply_buffer_clear(&gdbctx->out_buf); } else WARN("Ignoring: %s (checksum: %d != %d)\n", debugstr_an(ptr, sum - ptr), @@ -2255,9 +2283,7 @@ static BOOL gdb_init_context(struct gdb_context* gdbctx, unsigned flags, unsigne gdbctx->in_buf = NULL; gdbctx->in_buf_alloc = 0; gdbctx->in_len = 0; - gdbctx->out_buf = NULL; - gdbctx->out_buf_alloc = 0; - gdbctx->out_len = 0; + memset(&gdbctx->out_buf, 0, sizeof(gdbctx->out_buf)); gdbctx->out_curr_packet = -1; gdbctx->exec_tid = -1;
1
0
0
0
Byeongsik Jeon : po: Update Korean translation.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: 9082518465267ddda933988ae016850c202bd152 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9082518465267ddda933988a…
Author: Byeongsik Jeon <bsjeon(a)hanmail.net> Date: Wed Nov 24 00:24:38 2021 +0900 po: Update Korean translation. Signed-off-by: Byeongsik Jeon <bsjeon(a)hanmail.net> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- po/ko.po | 1585 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 751 insertions(+), 834 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=9082518465267ddda933…
1
0
0
0
Chilung Chan : po: Update Traditional Chinese translation.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: ba7cb5cd700b727e822b57c37d496901f7df953d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ba7cb5cd700b727e822b57c3…
Author: Chilung Chan <eason066(a)gmail.com> Date: Tue Nov 23 15:17:57 2021 +0800 po: Update Traditional Chinese translation. Signed-off-by: Chilung Chan <eason066(a)gmail.com> Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- po/zh_TW.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/po/zh_TW.po b/po/zh_TW.po index 3371b0a1267..67c973cb091 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -5,7 +5,7 @@ msgstr "" "Project-Id-Version: Wine\n" "Report-Msgid-Bugs-To:
https://bugs.winehq.org\n
" "POT-Creation-Date: N/A\n" -"PO-Revision-Date: 2021-11-20 21:33+0800\n" +"PO-Revision-Date: 2021-11-23 14:40+0800\n" "Last-Translator: Chilung Chan <eason066(a)gmail.com>\n" "Language-Team: Chinese (Taiwan)\n" "Language: zh_TW\n" @@ -17352,7 +17352,7 @@ msgid "" "WARNING: Debugging this process may result in loss of data.\n" "Are you sure you wish to attach the debugger?" msgstr "" -"警告:對這個處理程序進行除錯可能會導致資料遺失。\n" +"警告: 對這個處理程序進行除錯可能會導致資料遺失。\n" "您確定要附加除錯程式嗎?" #: programs/taskmgr/taskmgr.rc:314 @@ -17440,8 +17440,8 @@ msgid "" msgstr "" "用法:\n" " uninstaller [選項]\n" -"選項:\n" "\n" +"選項:\n" " --help\t 顯示這個資訊。\n" " --list\t 列出安裝在這個 Wine prefix 中的所有應用程式。\n" " --remove {GUID} 解除安裝指定的應用程式。\n"
1
0
0
0
Nikolay Sivov : d3d10/effect: Handle vector arguments in expression instructions.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: 16e6be0047e2b74020d3c7a1c05d90b6896c0e47 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=16e6be0047e2b74020d3c7a1…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Nov 19 17:52:46 2021 +0300 d3d10/effect: Handle vector arguments in expression instructions. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/effect.c | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index d6e3e095b54..cd6a3cfb238 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -191,17 +191,27 @@ struct preshader_instr unsigned int scalar : 1; }; -typedef float (*pres_op_func)(float **args, unsigned int n); +typedef void (*pres_op_func)(float **args, unsigned int n, const struct preshader_instr *instr); -static float pres_ftou(float **args, unsigned int n) +static void pres_ftou(float **args, unsigned int n, const struct preshader_instr *instr) { - unsigned int u = *args[0]; - return *(float *)&u; + float *retval = args[1]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + { + unsigned int u = args[0][i]; + retval[i] = *(float *)&u; + } } -static float pres_add(float **args, unsigned int n) +static void pres_add(float **args, unsigned int n, const struct preshader_instr *instr) { - return *args[0] + *args[1]; + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + retval[i] = args[0][instr->scalar ? 0 : i] + args[1][i]; } struct preshader_op_info @@ -333,10 +343,10 @@ static float * d3d10_effect_preshader_get_reg_ptr(const struct d3d10_effect_pres static HRESULT d3d10_effect_preshader_eval(struct d3d10_effect_preshader *p) { - unsigned int i, j, regt, offset, instr_count, input_count; + unsigned int i, j, regt, offset, instr_count, arg_count; const DWORD *ip = ID3D10Blob_GetBufferPointer(p->code); - float *dst, *args[4], *retval; struct preshader_instr ins; + float *dst, *args[4]; dst = d3d10_effect_preshader_get_reg_ptr(p, D3D10_REG_TABLE_RESULT, 0); memset(dst, 0, sizeof(float) * p->reg_tables[D3D10_REG_TABLE_RESULT].count); @@ -355,16 +365,16 @@ static HRESULT d3d10_effect_preshader_eval(struct d3d10_effect_preshader *p) for (i = 0; i < instr_count; ++i) { *(DWORD *)&ins = *ip++; - input_count = *ip++; + arg_count = 1 + *ip++; - if (input_count > ARRAY_SIZE(args)) + if (arg_count > ARRAY_SIZE(args)) { - FIXME("Unexpected argument count %u.\n", input_count); + FIXME("Unexpected argument count %u.\n", arg_count); return E_FAIL; } - /* Arguments */ - for (j = 0; j < input_count; ++j) + /* Arguments are followed by the return value. */ + for (j = 0; j < arg_count; ++j) { ip++; /* TODO: argument register flags are currently ignored */ regt = *ip++; @@ -373,12 +383,7 @@ static HRESULT d3d10_effect_preshader_eval(struct d3d10_effect_preshader *p) args[j] = d3d10_effect_preshader_get_reg_ptr(p, regt, offset); } - ip++; /* TODO: result register flags are currently ignored */ - regt = *ip++; - offset = *ip++; - retval = d3d10_effect_preshader_get_reg_ptr(p, regt, offset); - - *retval = d3d10_effect_get_op_info(ins.opcode)->func(args, input_count); + d3d10_effect_get_op_info(ins.opcode)->func(args, arg_count, &ins); } return S_OK; @@ -2100,7 +2105,7 @@ static HRESULT parse_fx10_preshader_instr(struct d3d10_preshader_parse_context * unsigned int *offset, const char **ptr, unsigned int data_size) { const struct preshader_op_info *op_info; - unsigned int i, param_count; + unsigned int i, param_count, size; struct preshader_instr ins; uint32_t input_count; @@ -2152,7 +2157,8 @@ static HRESULT parse_fx10_preshader_instr(struct d3d10_preshader_parse_context * case D3D10_REG_TABLE_CB: case D3D10_REG_TABLE_RESULT: case D3D10_REG_TABLE_TEMP: - context->table_sizes[regt] = max(context->table_sizes[regt], param_offset + 1); + size = param_offset + (ins.scalar && i == 0 ? 1 : ins.comp_count); + context->table_sizes[regt] = max(context->table_sizes[regt], size); break; default: FIXME("Unexpected register table index %u.\n", regt);
1
0
0
0
Nikolay Sivov : d3d10/effect: Parse through value expressions.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: 0f952630867b0f251d74adf45796c097d622dfa4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0f952630867b0f251d74adf4…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Nov 19 17:52:45 2021 +0300 d3d10/effect: Parse through value expressions. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/d3d10_private.h | 1 + dlls/d3d10/effect.c | 35 +++++++++++++++++++++ dlls/d3d10/tests/effect.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 7f83fb1182a..b35711b55e5 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -52,6 +52,7 @@ enum d3d10_effect_object_operation D3D10_EOO_CONST_INDEX = 3, D3D10_EOO_VAR_INDEX = 4, D3D10_EOO_INDEX_EXPRESSION = 5, + D3D10_EOO_VALUE_EXPRESSION = 6, D3D10_EOO_ANONYMOUS_SHADER = 7, }; diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index b9992f84a8b..d6e3e095b54 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -289,6 +289,10 @@ struct d3d10_effect_prop_dependency struct d3d10_effect_variable *v; struct d3d10_effect_preshader index; } index_expr; + struct + { + struct d3d10_effect_preshader value; + } value_expr; }; }; @@ -392,6 +396,9 @@ static void d3d10_effect_clear_prop_dependencies(struct d3d10_effect_prop_depend case D3D10_EOO_INDEX_EXPRESSION: d3d10_effect_preshader_clear(&dep->index_expr.index); break; + case D3D10_EOO_VALUE_EXPRESSION: + d3d10_effect_preshader_clear(&dep->value_expr.value); + break; } } heap_free(d->entries); @@ -2632,6 +2639,34 @@ static HRESULT parse_fx10_property_assignment(const char *data, size_t data_size return d3d10_effect_add_prop_dependency(d, &dep); + case D3D10_EOO_VALUE_EXPRESSION: + + if (value_offset >= data_size || !require_space(value_offset, 1, sizeof(uint32_t), data_size)) + { + WARN("Invalid offset %#x (data size %#lx).\n", value_offset, (long)data_size); + return E_FAIL; + } + + data_ptr = data + value_offset; + read_dword(&data_ptr, &blob_size); + + if (!require_space(value_offset, 1, sizeof(uint32_t) + blob_size, data_size)) + { + WARN("Invalid offset %#x (data size %#lx).\n", value_offset, (long)data_size); + return E_FAIL; + } + + dep.id = id; + dep.idx = idx; + dep.operation = operation; + if (FAILED(hr = parse_fx10_preshader(data_ptr, blob_size, effect, &dep.value_expr.value))) + { + WARN("Failed to parse preshader, hr %#x.\n", hr); + return hr; + } + + return d3d10_effect_add_prop_dependency(d, &dep); + case D3D10_EOO_ANONYMOUS_SHADER: /* Anonymous shader */ diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 7c2bba6d818..eae0036c0b6 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -7947,6 +7947,83 @@ static void test_effect_index_expression(void) ok(!refcount, "Device has %u references left.\n", refcount); } +#if 0 +float4 g_var; +float4 g_var2; +technique10 tech +{ + pass p0 + { + SetBlendState( NULL, g_var + 0.1f + g_var2, 0 ); + } + pass p1 + { + SetBlendState( NULL, g_var.x + g_var2 + g_var.y, 0 ); + } +} +#endif +static DWORD fx_test_value_expression[] = +{ + 0x43425844, 0xe517f17c, 0xe44eaede, 0xe4fd1240, 0xc67d5084, 0x00000001, 0x0000047c, 0x00000001, + 0x00000024, 0x30315846, 0x00000450, 0xfeff1001, 0x00000001, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x00000330, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724, + 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010, + 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x63657400, 0x30700068, 0x00016000, + 0x42584400, 0x312ce543, 0xc3ebc897, 0xea47c0a2, 0x8a710323, 0x000001d2, 0x00016000, 0x00000300, + 0x00002c00, 0x0000d400, 0x0000f000, 0x41544300, 0x0000a042, 0x00001c00, 0x00007700, 0x58040000, + 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200, 0x00000100, 0x00004c00, + 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000, 0x765f6700, 0xab007261, + 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261, 0x030001ab, 0x04000100, + 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00001434, 0x00000400, + 0xcccccd00, 0x0000003d, 0x00000000, 0x00000000, 0x4c584600, 0x00006843, 0x00000200, 0x40000400, + 0x00000220, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000200, 0x00000400, 0x00000000, + 0x00000700, 0x00000000, 0x40000400, 0x000002a0, 0x00000000, 0x00000100, 0x00000000, 0x00000000, + 0x00000700, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0xf0f0f000, 0x0f0f0ff0, 0x00ffff0f, + 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00317000, 0x00000150, + 0x43425844, 0xc6a29e4c, 0x6292ed35, 0xd90bb8cb, 0x50dcd25f, 0x00000001, 0x00000150, 0x00000003, + 0x0000002c, 0x000000d4, 0x000000e0, 0x42415443, 0x000000a0, 0x0000001c, 0x00000077, 0x46580400, + 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, + 0x00000000, 0x0000005c, 0x00010002, 0x00000001, 0x00000064, 0x00000000, 0x61765f67, 0xabab0072, + 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x61765f67, 0xab003272, 0x00030001, 0x00040001, + 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, + 0x434c5846, 0x00000068, 0x00000002, 0xa0400004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0xa0400004, 0x00000002, + 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001, + 0x00000002, 0x00000000, 0x00000004, 0x00000020, 0x00000000, 0x00000002, 0xffffffff, 0x00000000, + 0x00000030, 0x00000014, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036, + 0x00000014, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000003d, 0x00000002, + 0x00000000, 0x00000042, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000045, + 0x0000000b, 0x00000000, 0x00000001, 0x000001a9, 0x00000002, 0x00000000, 0x00000001, 0x000001b5, + 0x000001c1, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000001c4, 0x0000000b, + 0x00000000, 0x00000001, 0x00000318, 0x00000002, 0x00000000, 0x00000001, 0x00000324, +}; + +static void test_effect_value_expression(void) +{ + ID3D10Effect *effect; + ID3D10Device *device; + ULONG refcount; + HRESULT hr; + + if (!(device = create_device())) + { + skip("Failed to create device, skipping tests.\n"); + return; + } + + hr = create_effect(fx_test_value_expression, 0, device, NULL, &effect); + ok(SUCCEEDED(hr), "Failed to create an effect, hr %#x.\n", hr); + + effect->lpVtbl->Release(effect); + + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + START_TEST(effect) { test_effect_constant_buffer_type(); @@ -7972,4 +8049,5 @@ START_TEST(effect) test_effect_raw_value(); test_effect_dynamic_numeric_field(); test_effect_index_expression(); + test_effect_value_expression(); }
1
0
0
0
Huw Davies : winecoreaudio: Move release_capture_buffer to the unixlib.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: 58c8cafb10305aa220080482728a3d7ca5cbf847 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=58c8cafb10305aa220080482…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Nov 23 07:55:09 2021 +0000 winecoreaudio: Move release_capture_buffer to the unixlib. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coreaudio.c | 29 +++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 32 +++++--------------------------- dlls/winecoreaudio.drv/unixlib.h | 8 ++++++++ 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index ae44b562c22..d723291bb24 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1457,6 +1457,34 @@ end: return STATUS_SUCCESS; } +static NTSTATUS release_capture_buffer(void *args) +{ + struct release_capture_buffer_params *params = args; + struct coreaudio_stream *stream = params->stream; + + OSSpinLockLock(&stream->lock); + + if(!params->done){ + stream->getbuf_last = 0; + params->result = S_OK; + }else if(!stream->getbuf_last) + params->result = AUDCLNT_E_OUT_OF_ORDER; + else if(stream->getbuf_last != params->done) + params->result = AUDCLNT_E_INVALID_SIZE; + else{ + stream->written_frames += params->done; + stream->held_frames -= params->done; + stream->lcl_offs_frames += params->done; + stream->lcl_offs_frames %= stream->bufsize_frames; + stream->getbuf_last = 0; + params->result = S_OK; + } + + OSSpinLockUnlock(&stream->lock); + + return STATUS_SUCCESS; +} + unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1468,6 +1496,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_render_buffer, release_render_buffer, get_capture_buffer, + release_capture_buffer, get_mix_format, is_format_supported, get_buffer_size, diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 84525ac8a53..717e64b2283 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1386,36 +1386,14 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer( IAudioCaptureClient *iface, UINT32 done) { ACImpl *This = impl_from_IAudioCaptureClient(iface); + struct release_capture_buffer_params params; TRACE("(%p)->(%u)\n", This, done); - OSSpinLockLock(&This->stream->lock); - - if(!done){ - This->stream->getbuf_last = 0; - OSSpinLockUnlock(&This->stream->lock); - return S_OK; - } - - if(!This->stream->getbuf_last){ - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_E_OUT_OF_ORDER; - } - - if(This->stream->getbuf_last != done){ - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_E_INVALID_SIZE; - } - - This->stream->written_frames += done; - This->stream->held_frames -= done; - This->stream->lcl_offs_frames += done; - This->stream->lcl_offs_frames %= This->stream->bufsize_frames; - This->stream->getbuf_last = 0; - - OSSpinLockUnlock(&This->stream->lock); - - return S_OK; + params.stream = This->stream; + params.done = done; + UNIX_CALL(release_capture_buffer, ¶ms); + return params.result; } static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize( diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index 2211f1048a3..9bb636fd625 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -120,6 +120,13 @@ struct get_capture_buffer_params UINT64 *qpcpos; }; +struct release_capture_buffer_params +{ + struct coreaudio_stream *stream; + UINT32 done; + HRESULT result; +}; + struct get_mix_format_params { EDataFlow flow; @@ -170,6 +177,7 @@ enum unix_funcs unix_get_render_buffer, unix_release_render_buffer, unix_get_capture_buffer, + unix_release_capture_buffer, unix_get_mix_format, unix_is_format_supported, unix_get_buffer_size,
1
0
0
0
Huw Davies : winecoreaudio: Move get_capture_buffer to the unixlib.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: d9a2ae562c8bebfe738319d278ae91e4544652bd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d9a2ae562c8bebfe738319d2…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Nov 23 07:55:08 2021 +0000 winecoreaudio: Move get_capture_buffer to the unixlib. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coreaudio.c | 56 ++++++++++++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 55 ++++++------------------------------- dlls/winecoreaudio.drv/unixlib.h | 12 ++++++++ 3 files changed, 77 insertions(+), 46 deletions(-) diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index 2519a6bcfaa..ae44b562c22 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1402,6 +1402,61 @@ static NTSTATUS release_render_buffer(void *args) return STATUS_SUCCESS; } +static NTSTATUS get_capture_buffer(void *args) +{ + struct get_capture_buffer_params *params = args; + struct coreaudio_stream *stream = params->stream; + UINT32 chunk_bytes, chunk_frames; + LARGE_INTEGER stamp, freq; + + OSSpinLockLock(&stream->lock); + + if(stream->getbuf_last){ + params->result = AUDCLNT_E_OUT_OF_ORDER; + goto end; + } + + capture_resample(stream); + + *params->frames = 0; + + if(stream->held_frames < stream->period_frames){ + params->result = AUDCLNT_S_BUFFER_EMPTY; + goto end; + } + + *params->flags = 0; + chunk_frames = stream->bufsize_frames - stream->lcl_offs_frames; + if(chunk_frames < stream->period_frames){ + chunk_bytes = chunk_frames * stream->fmt->nBlockAlign; + if(!stream->tmp_buffer){ + stream->tmp_buffer_size = stream->period_frames * stream->fmt->nBlockAlign; + NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, 0, + &stream->tmp_buffer_size, MEM_COMMIT, PAGE_READWRITE); + } + *params->data = stream->tmp_buffer; + memcpy(*params->data, stream->local_buffer + stream->lcl_offs_frames * stream->fmt->nBlockAlign, + chunk_bytes); + memcpy(*params->data + chunk_bytes, stream->local_buffer, + stream->period_frames * stream->fmt->nBlockAlign - chunk_bytes); + }else + *params->data = stream->local_buffer + stream->lcl_offs_frames * stream->fmt->nBlockAlign; + + stream->getbuf_last = *params->frames = stream->period_frames; + + if(params->devpos) + *params->devpos = stream->written_frames; + if(params->qpcpos){ /* fixme: qpc of recording time */ + NtQueryPerformanceCounter(&stamp, &freq); + *params->qpcpos = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart; + } + params->result = S_OK; + +end: + OSSpinLockUnlock(&stream->lock); + return STATUS_SUCCESS; +} + unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1412,6 +1467,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = reset, get_render_buffer, release_render_buffer, + get_capture_buffer, get_mix_format, is_format_supported, get_buffer_size, diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 1874382304b..84525ac8a53 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1359,7 +1359,7 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface, UINT64 *qpcpos) { ACImpl *This = impl_from_IAudioCaptureClient(iface); - UINT32 chunk_bytes, chunk_frames; + struct get_capture_buffer_params params; TRACE("(%p)->(%p, %p, %p, %p, %p)\n", This, data, frames, flags, devpos, qpcpos); @@ -1372,51 +1372,14 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface, if(!frames || !flags) return E_POINTER; - OSSpinLockLock(&This->stream->lock); - - if(This->stream->getbuf_last){ - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_E_OUT_OF_ORDER; - } - - capture_resample(This); - - if(This->stream->held_frames < This->stream->period_frames){ - *frames = 0; - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_S_BUFFER_EMPTY; - } - - *flags = 0; - - chunk_frames = This->stream->bufsize_frames - This->stream->lcl_offs_frames; - if(chunk_frames < This->stream->period_frames){ - chunk_bytes = chunk_frames * This->stream->fmt->nBlockAlign; - if(!This->stream->tmp_buffer){ - This->stream->tmp_buffer_size = This->stream->period_frames * This->stream->fmt->nBlockAlign; - NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&This->stream->tmp_buffer, 0, - &This->stream->tmp_buffer_size, MEM_COMMIT, PAGE_READWRITE); - } - *data = This->stream->tmp_buffer; - memcpy(*data, This->stream->local_buffer + This->stream->lcl_offs_frames * This->stream->fmt->nBlockAlign, chunk_bytes); - memcpy((*data) + chunk_bytes, This->stream->local_buffer, This->stream->period_frames * This->stream->fmt->nBlockAlign - chunk_bytes); - }else - *data = This->stream->local_buffer + This->stream->lcl_offs_frames * This->stream->fmt->nBlockAlign; - - This->stream->getbuf_last = *frames = This->stream->period_frames; - - if(devpos) - *devpos = This->stream->written_frames; - if(qpcpos){ /* fixme: qpc of recording time */ - LARGE_INTEGER stamp, freq; - QueryPerformanceCounter(&stamp); - QueryPerformanceFrequency(&freq); - *qpcpos = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart; - } - - OSSpinLockUnlock(&This->stream->lock); - - return S_OK; + params.stream = This->stream; + params.data = data; + params.frames = frames; + params.flags = flags; + params.devpos = devpos; + params.qpcpos = qpcpos; + UNIX_CALL(get_capture_buffer, ¶ms); + return params.result; } static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer( diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index 80f42741e34..2211f1048a3 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -109,6 +109,17 @@ struct release_render_buffer_params HRESULT result; }; +struct get_capture_buffer_params +{ + struct coreaudio_stream *stream; + HRESULT result; + BYTE **data; + UINT32 *frames; + DWORD *flags; + UINT64 *devpos; + UINT64 *qpcpos; +}; + struct get_mix_format_params { EDataFlow flow; @@ -158,6 +169,7 @@ enum unix_funcs unix_reset, unix_get_render_buffer, unix_release_render_buffer, + unix_get_capture_buffer, unix_get_mix_format, unix_is_format_supported, unix_get_buffer_size,
1
0
0
0
Huw Davies : winecoreaudio: Move release_render_buffer to the unixlib.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: e9b92297540415d15e5ecaaec111d81ffd0f2803 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e9b92297540415d15e5ecaae…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Nov 23 07:55:07 2021 +0000 winecoreaudio: Move release_render_buffer to the unixlib. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coreaudio.c | 45 +++++++++++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 73 ++++---------------------------------- dlls/winecoreaudio.drv/unixlib.h | 9 +++++ 3 files changed, 60 insertions(+), 67 deletions(-) diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index 0bf21cd6c7d..2519a6bcfaa 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1358,6 +1358,50 @@ end: return STATUS_SUCCESS; } +static NTSTATUS release_render_buffer(void *args) +{ + struct release_render_buffer_params *params = args; + struct coreaudio_stream *stream = params->stream; + BYTE *buffer; + + OSSpinLockLock(&stream->lock); + + if(!params->frames){ + stream->getbuf_last = 0; + params->result = S_OK; + }else if(!stream->getbuf_last) + params->result = AUDCLNT_E_OUT_OF_ORDER; + else if(params->frames > (stream->getbuf_last >= 0 ? stream->getbuf_last : -stream->getbuf_last)) + params->result = AUDCLNT_E_INVALID_SIZE; + else{ + if(stream->getbuf_last >= 0) + buffer = stream->local_buffer + stream->wri_offs_frames * stream->fmt->nBlockAlign; + else + buffer = stream->tmp_buffer; + + if(params->flags & AUDCLNT_BUFFERFLAGS_SILENT) + silence_buffer(stream, buffer, params->frames); + + if(stream->getbuf_last < 0) + ca_wrap_buffer(stream->local_buffer, + stream->wri_offs_frames * stream->fmt->nBlockAlign, + stream->bufsize_frames * stream->fmt->nBlockAlign, + buffer, params->frames * stream->fmt->nBlockAlign); + + stream->wri_offs_frames += params->frames; + stream->wri_offs_frames %= stream->bufsize_frames; + stream->held_frames += params->frames; + stream->written_frames += params->frames; + stream->getbuf_last = 0; + + params->result = S_OK; + } + + OSSpinLockUnlock(&stream->lock); + + return STATUS_SUCCESS; +} + unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1367,6 +1411,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = stop, reset, get_render_buffer, + release_render_buffer, get_mix_format, is_format_supported, get_buffer_size, diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 5dca497594a..1874382304b 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -683,30 +683,6 @@ static HRESULT get_audio_session(const GUID *sessionguid, return S_OK; } -static void ca_wrap_buffer(BYTE *dst, UINT32 dst_offs, UINT32 dst_bytes, - BYTE *src, UINT32 src_bytes) -{ - UINT32 chunk_bytes = dst_bytes - dst_offs; - - if(chunk_bytes < src_bytes){ - memcpy(dst + dst_offs, src, chunk_bytes); - memcpy(dst, src + chunk_bytes, src_bytes - chunk_bytes); - }else - memcpy(dst + dst_offs, src, src_bytes); -} - -static void silence_buffer(struct coreaudio_stream *stream, BYTE *buffer, UINT32 frames) -{ - WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)stream->fmt; - if((stream->fmt->wFormatTag == WAVE_FORMAT_PCM || - (stream->fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE && - IsEqualGUID(&fmtex->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))) && - stream->fmt->wBitsPerSample == 8) - memset(buffer, 128, frames * stream->fmt->nBlockAlign); - else - memset(buffer, 0, frames * stream->fmt->nBlockAlign); -} - static void capture_resample(ACImpl *This) { UNIX_CALL(capture_resample, This->stream); @@ -1322,52 +1298,15 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer( IAudioRenderClient *iface, UINT32 frames, DWORD flags) { ACImpl *This = impl_from_IAudioRenderClient(iface); - BYTE *buffer; + struct release_render_buffer_params params; TRACE("(%p)->(%u, %x)\n", This, frames, flags); - OSSpinLockLock(&This->stream->lock); - - if(!frames){ - This->stream->getbuf_last = 0; - OSSpinLockUnlock(&This->stream->lock); - return S_OK; - } - - if(!This->stream->getbuf_last){ - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_E_OUT_OF_ORDER; - } - - if(frames > (This->stream->getbuf_last >= 0 ? This->stream->getbuf_last : -This->stream->getbuf_last)){ - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_E_INVALID_SIZE; - } - - if(This->stream->getbuf_last >= 0) - buffer = This->stream->local_buffer + This->stream->wri_offs_frames * This->stream->fmt->nBlockAlign; - else - buffer = This->stream->tmp_buffer; - - if(flags & AUDCLNT_BUFFERFLAGS_SILENT) - silence_buffer(This->stream, buffer, frames); - - if(This->stream->getbuf_last < 0) - ca_wrap_buffer(This->stream->local_buffer, - This->stream->wri_offs_frames * This->stream->fmt->nBlockAlign, - This->stream->bufsize_frames * This->stream->fmt->nBlockAlign, - buffer, frames * This->stream->fmt->nBlockAlign); - - - This->stream->wri_offs_frames += frames; - This->stream->wri_offs_frames %= This->stream->bufsize_frames; - This->stream->held_frames += frames; - This->stream->written_frames += frames; - This->stream->getbuf_last = 0; - - OSSpinLockUnlock(&This->stream->lock); - - return S_OK; + params.stream = This->stream; + params.frames = frames; + params.flags = flags; + UNIX_CALL(release_render_buffer, ¶ms); + return params.result; } static const IAudioRenderClientVtbl AudioRenderClient_Vtbl = { diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index e2ae457e705..80f42741e34 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -101,6 +101,14 @@ struct get_render_buffer_params BYTE **data; }; +struct release_render_buffer_params +{ + struct coreaudio_stream *stream; + UINT32 frames; + DWORD flags; + HRESULT result; +}; + struct get_mix_format_params { EDataFlow flow; @@ -149,6 +157,7 @@ enum unix_funcs unix_stop, unix_reset, unix_get_render_buffer, + unix_release_render_buffer, unix_get_mix_format, unix_is_format_supported, unix_get_buffer_size,
1
0
0
0
Huw Davies : winecoreaudio: Move get_render_buffer to the unixlib.
by Alexandre Julliard
23 Nov '21
23 Nov '21
Module: wine Branch: master Commit: c45df2763cb4a7897cb899fd086ee874e8fa2433 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c45df2763cb4a7897cb899fd…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Nov 23 07:55:06 2021 +0000 winecoreaudio: Move get_render_buffer to the unixlib. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coreaudio.c | 60 +++++++++++++++++++++++++++++- dlls/winecoreaudio.drv/mmdevdrv.c | 75 +++----------------------------------- dlls/winecoreaudio.drv/unixlib.h | 10 ++++- 3 files changed, 73 insertions(+), 72 deletions(-) diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index ee34cd29de1..0bf21cd6c7d 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -699,6 +699,9 @@ static NTSTATUS release_stream( void *args ) if(stream->local_buffer) NtFreeVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, &stream->local_buffer_size, MEM_RELEASE); + if(stream->tmp_buffer) + NtFreeVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, + &stream->tmp_buffer_size, MEM_RELEASE); free(stream->fmt); params->result = S_OK; return STATUS_SUCCESS; @@ -1230,9 +1233,9 @@ static NTSTATUS get_current_padding(void *args) struct get_current_padding_params *params = args; struct coreaudio_stream *stream = params->stream; - if(params->lock) OSSpinLockLock(&stream->lock); + OSSpinLockLock(&stream->lock); *params->padding = get_current_padding_nolock(stream); - if(params->lock) OSSpinLockUnlock(&stream->lock); + OSSpinLockUnlock(&stream->lock); params->result = S_OK; return STATUS_SUCCESS; } @@ -1303,6 +1306,58 @@ static NTSTATUS reset(void *args) return STATUS_SUCCESS; } +static NTSTATUS get_render_buffer(void *args) +{ + struct get_render_buffer_params *params = args; + struct coreaudio_stream *stream = params->stream; + UINT32 pad; + + OSSpinLockLock(&stream->lock); + + pad = get_current_padding_nolock(stream); + + if(stream->getbuf_last){ + params->result = AUDCLNT_E_OUT_OF_ORDER; + goto end; + } + if(!params->frames){ + params->result = S_OK; + goto end; + } + if(pad + params->frames > stream->bufsize_frames){ + params->result = AUDCLNT_E_BUFFER_TOO_LARGE; + goto end; + } + + if(stream->wri_offs_frames + params->frames > stream->bufsize_frames){ + if(stream->tmp_buffer_frames < params->frames){ + NtFreeVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, + &stream->tmp_buffer_size, MEM_RELEASE); + stream->tmp_buffer_size = params->frames * stream->fmt->nBlockAlign; + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, 0, + &stream->tmp_buffer_size, MEM_COMMIT, PAGE_READWRITE)){ + stream->tmp_buffer_frames = 0; + params->result = E_OUTOFMEMORY; + goto end; + } + stream->tmp_buffer_frames = params->frames; + } + *params->data = stream->tmp_buffer; + stream->getbuf_last = -params->frames; + }else{ + *params->data = stream->local_buffer + stream->wri_offs_frames * stream->fmt->nBlockAlign; + stream->getbuf_last = params->frames; + } + + silence_buffer(stream, *params->data, params->frames); + params->result = S_OK; + +end: + OSSpinLockUnlock(&stream->lock); + + return STATUS_SUCCESS; +} + unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1311,6 +1366,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = start, stop, reset, + get_render_buffer, get_mix_format, is_format_supported, get_buffer_size, diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index cf2c23a0f40..5dca497594a 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -554,9 +554,6 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) CloseHandle(event); } if(This->stream){ - if(This->stream->tmp_buffer) - NtFreeVirtualMemory(GetCurrentProcess(), (void **)&This->stream->tmp_buffer, - &This->stream->tmp_buffer_size, MEM_RELEASE); params.stream = This->stream; UNIX_CALL(release_stream, ¶ms); } @@ -871,21 +868,6 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface, return params.result; } -static HRESULT AudioClient_GetCurrentPadding_nolock(ACImpl *This, - UINT32 *numpad) -{ - struct get_current_padding_params params; - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - params.padding = numpad; - params.lock = FALSE; - UNIX_CALL(get_current_padding, ¶ms); - return params.result; -} - static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, UINT32 *numpad) { @@ -902,7 +884,6 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, params.stream = This->stream; params.padding = numpad; - params.lock = TRUE; UNIX_CALL(get_current_padding, ¶ms); return params.result; } @@ -1322,8 +1303,7 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface, UINT32 frames, BYTE **data) { ACImpl *This = impl_from_IAudioRenderClient(iface); - UINT32 pad; - HRESULT hr; + struct get_render_buffer_params params; TRACE("(%p)->(%u, %p)\n", This, frames, data); @@ -1331,54 +1311,11 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface, return E_POINTER; *data = NULL; - OSSpinLockLock(&This->stream->lock); - - if(This->stream->getbuf_last){ - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_E_OUT_OF_ORDER; - } - - if(!frames){ - OSSpinLockUnlock(&This->stream->lock); - return S_OK; - } - - hr = AudioClient_GetCurrentPadding_nolock(This, &pad); - if(FAILED(hr)){ - OSSpinLockUnlock(&This->stream->lock); - return hr; - } - - if(pad + frames > This->stream->bufsize_frames){ - OSSpinLockUnlock(&This->stream->lock); - return AUDCLNT_E_BUFFER_TOO_LARGE; - } - - if(This->stream->wri_offs_frames + frames > This->stream->bufsize_frames){ - if(This->stream->tmp_buffer_frames < frames){ - NtFreeVirtualMemory(GetCurrentProcess(), (void **)&This->stream->tmp_buffer, - &This->stream->tmp_buffer_size, MEM_RELEASE); - This->stream->tmp_buffer_size = frames * This->stream->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&This->stream->tmp_buffer, 0, - &This->stream->tmp_buffer_size, MEM_COMMIT, PAGE_READWRITE)){ - This->stream->tmp_buffer_frames = 0; - OSSpinLockUnlock(&This->stream->lock); - return E_OUTOFMEMORY; - } - This->stream->tmp_buffer_frames = frames; - } - *data = This->stream->tmp_buffer; - This->stream->getbuf_last = -frames; - }else{ - *data = This->stream->local_buffer + This->stream->wri_offs_frames * This->stream->fmt->nBlockAlign; - This->stream->getbuf_last = frames; - } - - silence_buffer(This->stream, *data, frames); - - OSSpinLockUnlock(&This->stream->lock); - - return S_OK; + params.stream = This->stream; + params.frames = frames; + params.data = data; + UNIX_CALL(get_render_buffer, ¶ms); + return params.result; } static HRESULT WINAPI AudioRenderClient_ReleaseBuffer( diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index 450293052c7..e2ae457e705 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -93,6 +93,14 @@ struct reset_params HRESULT result; }; +struct get_render_buffer_params +{ + struct coreaudio_stream *stream; + UINT32 frames; + HRESULT result; + BYTE **data; +}; + struct get_mix_format_params { EDataFlow flow; @@ -128,7 +136,6 @@ struct get_latency_params struct get_current_padding_params { struct coreaudio_stream *stream; - BOOL lock; /* temporary */ HRESULT result; UINT32 *padding; }; @@ -141,6 +148,7 @@ enum unix_funcs unix_start, unix_stop, unix_reset, + unix_get_render_buffer, unix_get_mix_format, unix_is_format_supported, unix_get_buffer_size,
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
96
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Results per page:
10
25
50
100
200