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
March 2020
----- 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
996 discussions
Start a n
N
ew thread
Roman Pišl : wininet: Add stub for INTERNET_OPTION_IGNORE_OFFLINE.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 6fcd1378b2516165468bcbd71263c1b18c6be491 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6fcd1378b2516165468bcbd7…
Author: Roman Pišl <rpisl(a)seznam.cz> Date: Thu Mar 12 12:01:15 2020 +0100 wininet: Add stub for INTERNET_OPTION_IGNORE_OFFLINE. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=48739
Signed-off-by: Roman Pišl <rpisl(a)seznam.cz> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/internet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index aaa8b2a569..cdafbfa139 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -2955,6 +2955,9 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, case INTERNET_OPTION_DISABLE_PASSPORT_AUTH: TRACE("Option INTERNET_OPTION_DISABLE_PASSPORT_AUTH: harmless stub, since not enabled\n"); break; + case INTERNET_OPTION_IGNORE_OFFLINE: + FIXME("Option INTERNET_OPTION_IGNORE_OFFLINE: STUB\n"); + break; case INTERNET_OPTION_SEND_TIMEOUT: case INTERNET_OPTION_RECEIVE_TIMEOUT: case INTERNET_OPTION_DATA_SEND_TIMEOUT:
1
0
0
0
Sven Baars : d3dx9: Handle DT_CALCRECT in ID3DXFont_DrawText.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 143a2a30f89dfc79cc2a49cd34af6fd587ce3f69 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=143a2a30f89dfc79cc2a49cd…
Author: Sven Baars <sbaars(a)codeweavers.com> Date: Tue Mar 10 11:21:39 2020 +0100 d3dx9: Handle DT_CALCRECT in ID3DXFont_DrawText. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/font.c | 24 +++++++++++++++++++----- dlls/d3dx9_36/tests/core.c | 18 ++++++++++++++++-- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c index e27858a2ce..3645903367 100644 --- a/dlls/d3dx9_36/font.c +++ b/dlls/d3dx9_36/font.c @@ -553,12 +553,11 @@ static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, } static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count, - WCHAR *dest, unsigned int *dest_len, int width, DWORD format) + WCHAR *dest, unsigned int *dest_len, int width, DWORD format, SIZE *size) { unsigned int i = 0; int orig_count = *count; int num_fit; - SIZE size; *dest_len = 0; while (*count && (str[i] != '\n' || (format & DT_SINGLELINE))) @@ -570,7 +569,7 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count, } num_fit = 0; - GetTextExtentExPointW(hdc, dest, *dest_len, width, &num_fit, NULL, &size); + GetTextExtentExPointW(hdc, dest, *dest_len, width, &num_fit, NULL, size); if (num_fit < *dest_len) { @@ -578,7 +577,7 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count, { unsigned int chars_used; - word_break(hdc, dest, dest_len, num_fit, &chars_used, format, &size); + word_break(hdc, dest, dest_len, num_fit, &chars_used, format, size); *count = orig_count - chars_used; i = chars_used; } @@ -608,7 +607,9 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, WCHAR *line; RECT textrect = {0}; int lh, x, y, width; + int max_width = 0; int ret = 0; + SIZE size; TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x.\n", iface, sprite, debugstr_wn(string, count), count, wine_dbgstr_rect(rect), format, color); @@ -660,7 +661,7 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, { unsigned int line_len; - string = read_line(font->hdc, string, &count, line, &line_len, width, format); + string = read_line(font->hdc, string, &count, line, &line_len, width, format, &size); if (!(format & DT_CALCRECT)) { @@ -705,11 +706,24 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, heap_free(results.lpCaretPos); heap_free(results.lpGlyphs); } + else if (size.cx > max_width) + { + max_width = size.cx; + } + y += lh; if (!(DT_NOCLIP & format) && (y > textrect.bottom)) break; } + if (format & DT_CALCRECT) + { + *rect = textrect; + + rect->bottom = y; + rect->right = rect->left + max_width; + } + ret = y - textrect.top; cleanup: diff --git a/dlls/d3dx9_36/tests/core.c b/dlls/d3dx9_36/tests/core.c index 2b5a868033..6fae8bf8d5 100644 --- a/dlls/d3dx9_36/tests/core.c +++ b/dlls/d3dx9_36/tests/core.c @@ -64,6 +64,15 @@ static inline void check_mat(D3DXMATRIX got, D3DXMATRIX exp) U(exp).m[3][0],U(exp).m[3][1],U(exp).m[3][2],U(exp).m[3][3]); } +#define check_rect(rect, left, top, right, bottom) _check_rect(__LINE__, rect, left, top, right, bottom) +static inline void _check_rect(unsigned int line, const RECT *rect, int left, int top, int right, int bottom) +{ + ok_(__FILE__, line)(rect->left == left, "Unexpected rect.left %d\n", rect->left); + ok_(__FILE__, line)(rect->top == top, "Unexpected rect.top %d\n", rect->top); + ok_(__FILE__, line)(rect->right == right, "Unexpected rect.right %d\n", rect->right); + ok_(__FILE__, line)(rect->bottom == bottom, "Unexpected rect.bottom %d\n", rect->bottom); +} + static void test_ID3DXBuffer(void) { ID3DXBuffer *buffer; @@ -667,8 +676,8 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) ok(height == tests[i].font_height, "Test %d: got unexpected height %u.\n", i, height); ok(!rect.left, "Test %d: got unexpected rect left %d.\n", i, rect.left); ok(!rect.top, "Test %d: got unexpected rect top %d.\n", i, rect.top); - todo_wine ok(rect.right, "Test %d: got unexpected rect right %d.\n", i, rect.right); - todo_wine ok(rect.bottom == tests[i].font_height, "Test %d: got unexpected rect bottom %d.\n", i, rect.bottom); + ok(rect.right, "Test %d: got unexpected rect right %d.\n", i, rect.right); + ok(rect.bottom == tests[i].font_height, "Test %d: got unexpected rect bottom %d.\n", i, rect.bottom); hr = ID3DXSprite_End(sprite); ok (hr == D3D_OK, "Test %d: got unexpected hr %#x.\n", i, hr); @@ -839,6 +848,11 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER, 0xff00ff); ok(height == 24, "Got unexpected height %d.\n", height); + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 30, 34); + ID3DXFont_Release(font); }
1
0
0
0
Sven Baars : d3dx9: Handle DT_SINGLELINE in ID3DXFont_DrawText.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 333687f522730befb8c64d297dc52f654e53a744 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=333687f522730befb8c64d29…
Author: Sven Baars <sbaars(a)codeweavers.com> Date: Tue Mar 10 11:21:38 2020 +0100 d3dx9: Handle DT_SINGLELINE in ID3DXFont_DrawText. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/font.c | 29 ++++++++++++++++++++--------- dlls/d3dx9_36/tests/core.c | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c index 5d4c0a5786..e27858a2ce 100644 --- a/dlls/d3dx9_36/font.c +++ b/dlls/d3dx9_36/font.c @@ -512,7 +512,7 @@ static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite, } static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, - unsigned int chars_fit, unsigned int *chars_used, SIZE *size) + unsigned int chars_fit, unsigned int *chars_used, DWORD format, SIZE *size) { SCRIPT_LOGATTR *sla; SCRIPT_ANALYSIS sa; @@ -535,7 +535,7 @@ static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, --i; /* If the there is no word that fits put in all characters that do fit */ - if (!sla[i].fSoftBreak) + if (!sla[i].fSoftBreak || (format & DT_SINGLELINE)) i = chars_fit; *chars_used = i; @@ -561,10 +561,10 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count, SIZE size; *dest_len = 0; - while (*count && str[i] != '\n') + while (*count && (str[i] != '\n' || (format & DT_SINGLELINE))) { --(*count); - if (str[i] != '\r') + if (str[i] != '\r' && str[i] != '\n') dest[(*dest_len)++] = str[i]; ++i; } @@ -572,13 +572,21 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count, num_fit = 0; GetTextExtentExPointW(hdc, dest, *dest_len, width, &num_fit, NULL, &size); - if (num_fit < *dest_len && (format & DT_WORDBREAK)) + if (num_fit < *dest_len) { - unsigned int chars_used; + if (format & DT_WORDBREAK) + { + unsigned int chars_used; - word_break(hdc, dest, dest_len, num_fit, &chars_used, &size); - *count = orig_count - chars_used; - i = chars_used; + word_break(hdc, dest, dest_len, num_fit, &chars_used, format, &size); + *count = orig_count - chars_used; + i = chars_used; + } + else if (format & DT_SINGLELINE) + { + *dest_len = num_fit; + *count = 0; + } } if (*count && str[i] == '\n') @@ -617,6 +625,9 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, if (format & DT_CALCRECT) format |= DT_NOCLIP; + if (format & DT_SINGLELINE) + format &= ~DT_WORDBREAK; + if (!rect) { y = ID3DXFont_DrawTextW(iface, NULL, string, count, &textrect, format | DT_CALCRECT, 0); diff --git a/dlls/d3dx9_36/tests/core.c b/dlls/d3dx9_36/tests/core.c index 45cde62b3a..2b5a868033 100644 --- a/dlls/d3dx9_36/tests/core.c +++ b/dlls/d3dx9_36/tests/core.c @@ -771,7 +771,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) ok(height == 12, "Got unexpected height %d.\n", height); height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, DT_SINGLELINE, 0xff00ff); - todo_wine ok(height == 12, "Got unexpected height %d.\n", height); + ok(height == 12, "Got unexpected height %d.\n", height); height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, 0, 0xff00ff); ok(height == 24, "Got unexpected height %d.\n", height);
1
0
0
0
Zebediah Figura : d3dcompiler: Apply type modifiers to the hlsl_type.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 756ed811c72e692e58def76e76ab19e5418e8d5a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=756ed811c72e692e58def76e…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 13 17:34:56 2020 +0100 d3dcompiler: Apply type modifiers to the hlsl_type. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/hlsl.y | 96 ++++++++++++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 59e0df9d8c..6a5dddf5d4 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -168,7 +168,21 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) return TRUE; } -static DWORD add_modifier(DWORD modifiers, DWORD mod, const struct YYLTYPE *loc); +static DWORD add_modifiers(DWORD modifiers, DWORD mod, const struct source_location loc) +{ + if (modifiers & mod) + { + hlsl_report_message(loc, HLSL_LEVEL_ERROR, "modifier '%s' already specified", debug_modifiers(mod)); + return modifiers; + } + if (mod & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR) + && modifiers & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR)) + { + hlsl_report_message(loc, HLSL_LEVEL_ERROR, "more than one matrix majority keyword"); + return modifiers; + } + return modifiers | mod; +} static BOOL add_type_to_scope(struct hlsl_scope *scope, struct hlsl_type *def) { @@ -602,7 +616,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, local = FALSE; } - if (var->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer.args_count) + if (type->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer.args_count) { hlsl_report_message(v->loc, HLSL_LEVEL_ERROR, "const variable without initializer"); free_declaration(var); @@ -703,6 +717,21 @@ static BOOL add_struct_field(struct list *fields, struct hlsl_struct_field *fiel return TRUE; } +static struct hlsl_type *apply_type_modifiers(struct hlsl_type *type, DWORD *modifiers, struct source_location loc) +{ + struct hlsl_type *new_type; + + if (!(*modifiers & HLSL_TYPE_MODIFIERS_MASK)) + return type; + + if (!(new_type = clone_hlsl_type(type))) + return NULL; + + new_type->modifiers = add_modifiers(new_type->modifiers, *modifiers, loc); + *modifiers &= ~HLSL_TYPE_MODIFIERS_MASK; + return new_type; +} + static struct list *gen_struct_fields(struct hlsl_type *type, DWORD modifiers, struct list *fields) { struct parse_variable_def *v, *v_next; @@ -1301,7 +1330,12 @@ fields_list: /* Empty */ field: var_modifiers type variables_def ';' { - $$ = gen_struct_fields($2, $1, $3); + struct hlsl_type *type; + DWORD modifiers = $1; + + if (!(type = apply_type_modifiers($2, &modifiers, get_location(&@1)))) + YYABORT; + $$ = gen_struct_fields(type, modifiers, $3); } | unnamed_struct_spec variables_def ';' { @@ -1449,9 +1483,15 @@ param_list: parameter parameter: input_mods var_modifiers type any_identifier colon_attribute { + struct hlsl_type *type; + DWORD modifiers = $2; + + if (!(type = apply_type_modifiers($3, &modifiers, get_location(&@2)))) + YYABORT; + $$.modifiers = $1 ? $1 : HLSL_MODIFIER_IN; - $$.modifiers |= $2; - $$.type = $3; + $$.modifiers |= modifiers; + $$.type = type; $$.name = $4; $$.semantic = $5.semantic; $$.reg_reservation = $5.reg_reservation; @@ -1639,7 +1679,12 @@ type_spec: any_identifier array declaration: var_modifiers type variables_def ';' { - $$ = declare_vars($2, $1, $3); + struct hlsl_type *type; + DWORD modifiers = $1; + + if (!(type = apply_type_modifiers($2, &modifiers, get_location(&@1)))) + YYABORT; + $$ = declare_vars(type, modifiers, $3); } variables_def_optional: /* Empty */ @@ -1717,47 +1762,47 @@ var_modifiers: /* Empty */ } | KW_EXTERN var_modifiers { - $$ = add_modifier($2, HLSL_STORAGE_EXTERN, &@1); + $$ = add_modifiers($2, HLSL_STORAGE_EXTERN, get_location(&@1)); } | KW_NOINTERPOLATION var_modifiers { - $$ = add_modifier($2, HLSL_STORAGE_NOINTERPOLATION, &@1); + $$ = add_modifiers($2, HLSL_STORAGE_NOINTERPOLATION, get_location(&@1)); } | KW_PRECISE var_modifiers { - $$ = add_modifier($2, HLSL_MODIFIER_PRECISE, &@1); + $$ = add_modifiers($2, HLSL_MODIFIER_PRECISE, get_location(&@1)); } | KW_SHARED var_modifiers { - $$ = add_modifier($2, HLSL_STORAGE_SHARED, &@1); + $$ = add_modifiers($2, HLSL_STORAGE_SHARED, get_location(&@1)); } | KW_GROUPSHARED var_modifiers { - $$ = add_modifier($2, HLSL_STORAGE_GROUPSHARED, &@1); + $$ = add_modifiers($2, HLSL_STORAGE_GROUPSHARED, get_location(&@1)); } | KW_STATIC var_modifiers { - $$ = add_modifier($2, HLSL_STORAGE_STATIC, &@1); + $$ = add_modifiers($2, HLSL_STORAGE_STATIC, get_location(&@1)); } | KW_UNIFORM var_modifiers { - $$ = add_modifier($2, HLSL_STORAGE_UNIFORM, &@1); + $$ = add_modifiers($2, HLSL_STORAGE_UNIFORM, get_location(&@1)); } | KW_VOLATILE var_modifiers { - $$ = add_modifier($2, HLSL_STORAGE_VOLATILE, &@1); + $$ = add_modifiers($2, HLSL_STORAGE_VOLATILE, get_location(&@1)); } | KW_CONST var_modifiers { - $$ = add_modifier($2, HLSL_MODIFIER_CONST, &@1); + $$ = add_modifiers($2, HLSL_MODIFIER_CONST, get_location(&@1)); } | KW_ROW_MAJOR var_modifiers { - $$ = add_modifier($2, HLSL_MODIFIER_ROW_MAJOR, &@1); + $$ = add_modifiers($2, HLSL_MODIFIER_ROW_MAJOR, get_location(&@1)); } | KW_COLUMN_MAJOR var_modifiers { - $$ = add_modifier($2, HLSL_MODIFIER_COLUMN_MAJOR, &@1); + $$ = add_modifiers($2, HLSL_MODIFIER_COLUMN_MAJOR, get_location(&@1)); } complex_initializer: initializer_expr @@ -2486,23 +2531,6 @@ static struct source_location get_location(const struct YYLTYPE *l) return loc; } -static DWORD add_modifier(DWORD modifiers, DWORD mod, const struct YYLTYPE *l) -{ - if (modifiers & mod) - { - hlsl_report_message(get_location(l), HLSL_LEVEL_ERROR, - "modifier '%s' already specified", debug_modifiers(mod)); - return modifiers; - } - if (mod & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR) - && modifiers & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR)) - { - hlsl_report_message(get_location(l), HLSL_LEVEL_ERROR, "more than one matrix majority keyword"); - return modifiers; - } - return modifiers | mod; -} - static void dump_function_decl(struct wine_rb_entry *entry, void *context) { struct hlsl_ir_function_decl *func = WINE_RB_ENTRY_VALUE(entry, struct hlsl_ir_function_decl, entry);
1
0
0
0
Zebediah Figura : d3dcompiler: Fail if modifiers are applied to a function.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: afd3a1e388ab720ae6eadad3ac7591ba9fa1614f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=afd3a1e388ab720ae6eadad3…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 13 17:34:55 2020 +0100 d3dcompiler: Fail if modifiers are applied to a function. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/hlsl.y | 7 +++++++ dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 498ca4bb59..59e0df9d8c 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -1322,8 +1322,15 @@ func_declaration: func_prototype compound_statement pop_scope(&hlsl_ctx); } + /* var_modifiers is necessary to avoid shift/reduce conflicts. */ func_prototype: var_modifiers type var_identifier '(' parameters ')' colon_attribute { + if ($1) + { + hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR, + "unexpected modifiers on a function"); + YYABORT; + } if (get_variable(hlsl_ctx.globals, $3)) { hlsl_report_message(get_location(&@3), diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index b16f6e3454..3edee34d8d 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -925,6 +925,11 @@ static void test_fail(void) " float a[(x = 2)];\n" " return float4(0, 0, 0, 0);\n" "}", + + "uniform float4 test() : SV_TARGET\n" + "{\n" + " return float4(0, 0, 0, 0);\n" + "}", }; static const char *targets[] = {"ps_2_0", "ps_3_0", "ps_4_0"};
1
0
0
0
Zebediah Figura : d3dcompiler: Don't add the default matrix majority attribute to variables.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: eb4fc30463ac248f7b49596403db4f2f267336a2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=eb4fc30463ac248f7b495964…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 13 17:34:54 2020 +0100 d3dcompiler: Don't add the default matrix majority attribute to variables. This is a type modifier, and thus does not make a lot of sense on a variable. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/hlsl.y | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index a24d29e5df..498ca4bb59 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -129,15 +129,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) BOOL ret; TRACE("Declaring variable %s.\n", decl->name); - if (decl->data_type->type == HLSL_CLASS_MATRIX) - { - if (!(decl->modifiers & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR))) - { - decl->modifiers |= hlsl_ctx.matrix_majority == HLSL_ROW_MAJOR - ? HLSL_MODIFIER_ROW_MAJOR : HLSL_MODIFIER_COLUMN_MAJOR; - } - } - else + if (decl->data_type->type != HLSL_CLASS_MATRIX) check_invalid_matrix_modifiers(decl->modifiers, decl->loc); if (local)
1
0
0
0
Zebediah Figura : d3dcompiler/tests: Add a test for SM4 constant buffers.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 7f39f2bae02755224ec647572f43ff2c0ad674ad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7f39f2bae02755224ec64757…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 13 17:34:53 2020 +0100 d3dcompiler/tests: Add a test for SM4 constant buffers. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/tests/hlsl_d3d11.c | 164 +++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c index ed95457f1c..8e37976d5a 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c @@ -523,6 +523,168 @@ static void test_trig(void) release_test_context(&test_context); } +static void check_type_desc(const char *prefix, const D3D11_SHADER_TYPE_DESC *type, + const D3D11_SHADER_TYPE_DESC *expect) +{ + ok(type->Class == expect->Class, "%s: got class %#x.\n", prefix, type->Class); + ok(type->Type == expect->Type, "%s: got type %#x.\n", prefix, type->Type); + ok(type->Rows == expect->Rows, "%s: got %u rows.\n", prefix, type->Rows); + ok(type->Columns == expect->Columns, "%s: got %u columns.\n", prefix, type->Columns); + ok(type->Elements == expect->Elements, "%s: got %u elements.\n", prefix, type->Elements); + ok(type->Members == expect->Members, "%s: got %u members.\n", prefix, type->Members); + ok(type->Offset == expect->Offset, "%s: got %u members.\n", prefix, type->Members); + ok(!strcmp(type->Name, expect->Name), "%s: got name %s.\n", prefix, debugstr_a(type->Name)); +} + +static void test_reflection(void) +{ + ID3D11ShaderReflectionConstantBuffer *cbuffer; + ID3D11ShaderReflectionType *type, *field; + D3D11_SHADER_BUFFER_DESC buffer_desc; + ID3D11ShaderReflectionVariable *var; + D3D11_SHADER_VARIABLE_DESC var_desc; + ID3D11ShaderReflection *reflection; + D3D11_SHADER_TYPE_DESC type_desc; + ID3D10Blob *vs_code = NULL; + unsigned int i, j, k; + ULONG refcount; + HRESULT hr; + + static const char vs_source[] = + "typedef uint uint_t;\n" + "cbuffer b1\n" + "{\n" + " float a;\n" + " float2 b;\n" + " float4 c;\n" + " float d;\n" + " struct\n" + " {\n" + " float4 a;\n" + " float b;\n" + " float c;\n" + " } s;\n" + " float g;\n" + " float h[2];\n" + " int i;\n" + " uint_t j;\n" + " float3x1 k;\n" + " row_major float3x1 l;\n" + "};\n" + "\n" + "float m;\n" + "\n" + "float4 main(uniform float4 n) : SV_POSITION\n" + "{\n" + " return l._31 + m + n;\n" + "}"; + + struct shader_variable + { + D3D11_SHADER_VARIABLE_DESC var_desc; + D3D11_SHADER_TYPE_DESC type_desc; + }; + + static const D3D11_SHADER_TYPE_DESC field_types[] = + { + {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 4, 0, 0, 0, "float4"}, + {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 16, "float"}, + {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 20, "float"}, + }; + + static const struct shader_variable globals_vars = + {{"m", 0, 4, D3D_SVF_USED}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 0, "float"}}; + static const struct shader_variable params_vars = + {{"n", 0, 16, D3D_SVF_USED}, {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 4, 0, 0, 0, "float4"}}; + static const struct shader_variable buffer_vars[] = + { + {{"a", 0, 4}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 0, "float"}}, + {{"b", 4, 8}, {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 2, 0, 0, 0, "float2"}}, + {{"c", 16, 16}, {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 4, 0, 0, 0, "float4"}}, + {{"d", 32, 4}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 0, "float"}}, + {{"s", 48, 24}, {D3D_SVC_STRUCT, D3D_SVT_VOID, 1, 6, 0, 3, 0, "<unnamed>"}}, + {{"g", 72, 4}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 0, "float"}}, + {{"h", 80, 20}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 2, 0, 0, "float"}}, + {{"i", 100, 4}, {D3D_SVC_SCALAR, D3D_SVT_INT, 1, 1, 0, 0, 0, "int"}}, + {{"j", 104, 4}, {D3D_SVC_SCALAR, D3D_SVT_UINT, 1, 1, 0, 0, 0, "uint_t"}}, + {{"k", 112, 12}, {D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 3, 1, 0, 0, 0, "float3x1"}}, + {{"l", 128, 36, D3D_SVF_USED}, {D3D_SVC_MATRIX_ROWS, D3D_SVT_FLOAT, 3, 1, 0, 0, 0, "float3x1"}}, + }; + + static const struct + { + D3D11_SHADER_BUFFER_DESC desc; + const struct shader_variable *vars; + } + vs_buffers[] = + { + {{"$Globals", D3D_CT_CBUFFER, 1, 16}, &globals_vars}, + {{"$Params", D3D_CT_CBUFFER, 1, 16}, ¶ms_vars}, + {{"b1", D3D_CT_CBUFFER, ARRAY_SIZE(buffer_vars), 176}, buffer_vars}, + }; + + todo_wine vs_code = compile_shader(vs_source, "vs_5_0"); + if (!vs_code) + return; + + hr = pD3DReflect(ID3D10Blob_GetBufferPointer(vs_code), ID3D10Blob_GetBufferSize(vs_code), + &IID_ID3D11ShaderReflection, (void **)&reflection); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + for (i = 0; i < ARRAY_SIZE(vs_buffers); ++i) + { + cbuffer = reflection->lpVtbl->GetConstantBufferByIndex(reflection, i); + hr = cbuffer->lpVtbl->GetDesc(cbuffer, &buffer_desc); + ok(hr == S_OK, "Test %u: got hr %#x.\n", i, hr); + ok(!strcmp(buffer_desc.Name, vs_buffers[i].desc.Name), + "Test %u: got name %s.\n", i, debugstr_a(buffer_desc.Name)); + ok(buffer_desc.Type == vs_buffers[i].desc.Type, "Test %u: got type %#x.\n", i, buffer_desc.Type); + ok(buffer_desc.Variables == vs_buffers[i].desc.Variables, + "Test %u: got %u variables.\n", i, buffer_desc.Variables); + ok(buffer_desc.Size == vs_buffers[i].desc.Size, "Test %u: got size %u.\n", i, buffer_desc.Size); + ok(buffer_desc.uFlags == vs_buffers[i].desc.uFlags, "Test %u: got flags %#x.\n", i, buffer_desc.uFlags); + + for (j = 0; j < buffer_desc.Variables; ++j) + { + const struct shader_variable *expect = &vs_buffers[i].vars[j]; + char prefix[40]; + + var = cbuffer->lpVtbl->GetVariableByIndex(cbuffer, j); + hr = var->lpVtbl->GetDesc(var, &var_desc); + ok(hr == S_OK, "Test %u, %u: got hr %#x.\n", i, j, hr); + ok(!strcmp(var_desc.Name, expect->var_desc.Name), + "Test %u, %u: got name %s.\n", i, j, debugstr_a(var_desc.Name)); + ok(var_desc.StartOffset == expect->var_desc.StartOffset, "Test %u, %u: got offset %u.\n", + i, j, var_desc.StartOffset); + ok(var_desc.Size == expect->var_desc.Size, "Test %u, %u: got size %u.\n", i, j, var_desc.Size); + ok(var_desc.uFlags == expect->var_desc.uFlags, "Test %u, %u: got flags %#x.\n", i, j, var_desc.uFlags); + ok(!var_desc.DefaultValue, "Test %u, %u: got default value %p.\n", i, j, var_desc.DefaultValue); + + type = var->lpVtbl->GetType(var); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(hr == S_OK, "Test %u, %u: got hr %#x.\n", i, j, hr); + sprintf(prefix, "Test %u, %u", i, j); + check_type_desc(prefix, &type_desc, &expect->type_desc); + + if (!strcmp(type_desc.Name, "<unnamed>")) + { + for (k = 0; k < ARRAY_SIZE(field_types); ++k) + { + field = type->lpVtbl->GetMemberTypeByIndex(type, k); + hr = field->lpVtbl->GetDesc(field, &type_desc); + ok(hr == S_OK, "Test %u, %u, %u: got hr %#x.\n", i, j, k, hr); + sprintf(prefix, "Test %u, %u, %u", i, j, k); + check_type_desc(prefix, &type_desc, &field_types[k]); + } + } + } + } + + ID3D10Blob_Release(vs_code); + refcount = reflection->lpVtbl->Release(reflection); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); +} + static BOOL load_d3dcompiler(void) { HMODULE module; @@ -548,6 +710,8 @@ START_TEST(hlsl_d3d11) return; } + test_reflection(); + if (!(mod = LoadLibraryA("d3d11.dll"))) { skip("Direct3D 11 is not available.\n");
1
0
0
0
Zebediah Figura : d3dcompiler/tests: Add some tests for d3d9 constant tables.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 150aa985017299778bba606077b72c0d5f2f9bab URL:
https://source.winehq.org/git/wine.git/?a=commit;h=150aa985017299778bba6060…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri Mar 13 17:34:52 2020 +0100 d3dcompiler/tests: Add some tests for d3d9 constant tables. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 113 ++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index 7f391833f3..b16f6e3454 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -730,6 +730,118 @@ static void test_array_dimensions(void) release_test_context(&test_context); } +static void check_constant_desc(const char *prefix, const D3DXCONSTANT_DESC *desc, + const D3DXCONSTANT_DESC *expect, BOOL nonzero_defaultvalue) +{ + ok(!strcmp(desc->Name, expect->Name), "%s: got Name %s.\n", prefix, debugstr_a(desc->Name)); + ok(desc->RegisterSet == expect->RegisterSet, "%s: got RegisterSet %#x.\n", prefix, desc->RegisterSet); + ok(desc->RegisterCount == expect->RegisterCount, "%s: got RegisterCount %u.\n", prefix, desc->RegisterCount); + ok(desc->Class == expect->Class, "%s: got Class %#x.\n", prefix, desc->Class); + ok(desc->Type == expect->Type, "%s: got Type %#x.\n", prefix, desc->Type); + ok(desc->Rows == expect->Rows, "%s: got Rows %u.\n", prefix, desc->Rows); + ok(desc->Columns == expect->Columns, "%s: got Columns %u.\n", prefix, desc->Columns); + ok(desc->Elements == expect->Elements, "%s: got Elements %u.\n", prefix, desc->Elements); + ok(desc->StructMembers == expect->StructMembers, "%s: got StructMembers %u.\n", prefix, desc->StructMembers); + ok(desc->Bytes == expect->Bytes, "%s: got Bytes %u.\n", prefix, desc->Bytes); + ok(!!desc->DefaultValue == nonzero_defaultvalue, "%s: got DefaultValue %p.\n", prefix, desc->DefaultValue); +} + +static void test_constant_table(void) +{ + static const char *source = + "uniform float4 a;\n" + "uniform float b;\n" + "uniform float unused;\n" + "uniform float3x1 c;\n" + "uniform row_major float3x1 d;\n" + "uniform uint e;\n" + "uniform struct\n" + "{\n" + " float2x2 a;\n" + " float b;\n" + " float c;\n" + "} f;\n" + "uniform float g[5];\n" + "float4 main(uniform float4 h) : COLOR\n" + "{\n" + " return a + b + c._31 + d._31 + f.c + g[e] + h;\n" + "}"; + + D3DXCONSTANTTABLE_DESC table_desc; + ID3DXConstantTable *constants; + ID3D10Blob *ps_code = NULL; + D3DXHANDLE handle, field; + D3DXCONSTANT_DESC desc; + unsigned int i, j; + HRESULT hr; + UINT count; + + static const D3DXCONSTANT_DESC expect_constants[] = + { + {"$h", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16}, + {"a", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16}, + {"b", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4}, + {"c", D3DXRS_FLOAT4, 0, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12}, + {"d", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12}, + {"e", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4}, + {"f", D3DXRS_FLOAT4, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24}, + {"g", D3DXRS_FLOAT4, 0, 5, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 5, 0, 20}, + }; + + static const D3DXCONSTANT_DESC expect_fields[] = + { + {"a", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 2, 1, 0, 16}, + {"b", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4}, + {"c", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4}, + }; + + todo_wine ps_code = compile_shader(source, "ps_2_0"); + if (!ps_code) + return; + + hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants); + ok(hr == D3D_OK, "Got hr %#x.\n", hr); + + hr = ID3DXConstantTable_GetDesc(constants, &table_desc); + ok(hr == D3D_OK, "Got hr %#x.\n", hr); + ok(table_desc.Version == D3DPS_VERSION(2, 0), "Got Version %#x.\n", table_desc.Version); + ok(table_desc.Constants == 8, "Got %u constants.\n", table_desc.Constants); + + for (i = 0; i < table_desc.Constants; ++i) + { + char prefix[30]; + + handle = ID3DXConstantTable_GetConstant(constants, NULL, i); + ok(!!handle, "Failed to get constant.\n"); + memset(&desc, 0xcc, sizeof(desc)); + count = 1; + hr = ID3DXConstantTable_GetConstantDesc(constants, handle, &desc, &count); + ok(hr == D3D_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + sprintf(prefix, "Test %u", i); + check_constant_desc(prefix, &desc, &expect_constants[i], FALSE); + + if (!strcmp(desc.Name, "f")) + { + for (j = 0; j < ARRAY_SIZE(expect_fields); ++j) + { + field = ID3DXConstantTable_GetConstant(constants, handle, j); + ok(!!field, "Failed to get constant.\n"); + memset(&desc, 0xcc, sizeof(desc)); + count = 1; + hr = ID3DXConstantTable_GetConstantDesc(constants, field, &desc, &count); + ok(hr == D3D_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + sprintf(prefix, "Test %u, %u", i, j); + check_constant_desc(prefix, &desc, &expect_fields[j], !!j); + } + } + } + + ID3DXConstantTable_Release(constants); + ID3D10Blob_Release(ps_code); +} + static void test_fail(void) { static const char *tests[] = @@ -874,5 +986,6 @@ START_TEST(hlsl_d3d9) test_comma(); test_return(); test_array_dimensions(); + test_constant_table(); test_fail(); }
1
0
0
0
Nikolay Sivov : mf: Implement sample delivering to transform nodes.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 23757ca5139ca1ee2a617d207949edac5beb1e12 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=23757ca5139ca1ee2a617d20…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 13 15:34:38 2020 +0300 mf: Implement sample delivering to transform nodes. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mf/session.c | 107 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 20 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 503948000e..e98be7c95f 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -119,6 +119,7 @@ struct sample struct transform_stream { struct list samples; + unsigned int requests; }; struct topo_node @@ -149,6 +150,7 @@ struct topo_node } sink; struct { + struct transform_stream *inputs; unsigned int *input_map; unsigned int input_count; @@ -659,8 +661,11 @@ static void release_topo_node(struct topo_node *node) IMFMediaSource_Release(node->u.source.source); break; case MF_TOPOLOGY_TRANSFORM_NODE: + for (i = 0; i < node->u.transform.input_count; ++i) + transform_stream_drop_samples(&node->u.transform.inputs[i]); for (i = 0; i < node->u.transform.output_count; ++i) transform_stream_drop_samples(&node->u.transform.outputs[i]); + heap_free(node->u.transform.inputs); heap_free(node->u.transform.outputs); heap_free(node->u.transform.input_map); heap_free(node->u.transform.output_map); @@ -1011,6 +1016,11 @@ static HRESULT session_set_transform_stream_info(struct topo_node *node) if (SUCCEEDED(hr)) { + streams = heap_calloc(input_count, sizeof(*streams)); + for (i = 0; i < input_count; ++i) + list_init(&streams[i].samples); + node->u.transform.inputs = streams; + streams = heap_calloc(output_count, sizeof(*streams)); for (i = 0; i < output_count; ++i) list_init(&streams[i].samples); @@ -2237,14 +2247,31 @@ static HRESULT transform_node_get_sample(struct topo_node *node, DWORD output, I buffers[i].pSample = NULL; buffers[i].dwStatus = 0; buffers[i].pEvents = NULL; + } - /* Buffer requirements. */ - memset(&stream_info, 0, sizeof(stream_info)); - if (FAILED(hr = IMFTransform_GetOutputStreamInfo(node->object.transform, buffers[i].dwStreamID, &stream_info))) - goto exit; + memset(&stream_info, 0, sizeof(stream_info)); + if (FAILED(hr = IMFTransform_GetOutputStreamInfo(node->object.transform, buffers[output].dwStreamID, &stream_info))) + goto exit; + + if (!(stream_info.dwFlags & MFT_OUTPUT_STREAM_PROVIDES_SAMPLES)) + { + IMFMediaBuffer *buffer = NULL; + + if (!stream_info.cbSize) + FIXME("Unhandled buffer size %u.\n", stream_info.cbSize); + + hr = MFCreateAlignedMemoryBuffer(stream_info.cbSize, stream_info.cbAlignment, &buffer); + if (SUCCEEDED(hr)) + hr = MFCreateSample(&buffers[output].pSample); + + if (SUCCEEDED(hr)) + hr = IMFSample_AddBuffer(buffers[output].pSample, buffer); - if (!(stream_info.dwFlags & MFT_OUTPUT_STREAM_PROVIDES_SAMPLES)) - FIXME("Allocate client sample for stream %u.\n", buffers[i].dwStreamID); + if (buffer) + IMFMediaBuffer_Release(buffer); + + if (FAILED(hr)) + goto exit; } hr = IMFTransform_ProcessOutput(node->object.transform, 0, node->u.transform.output_count, buffers, &status); @@ -2278,32 +2305,71 @@ exit: return hr; } -static void session_deliver_sample_to_node(struct media_session *session, IMFTopologyNode *downstream_node, - DWORD downstream_input, IMFSample *sample) +static void session_deliver_sample_to_node(struct media_session *session, IMFTopologyNode *node, DWORD input, + IMFSample *sample) { - MF_TOPOLOGY_TYPE downstream_type; - struct topo_node *node; - TOPOID downstream_id; + DWORD stream_id, downstream_input; + IMFTopologyNode *downstream_node; + struct topo_node *topo_node; + MF_TOPOLOGY_TYPE node_type; + TOPOID node_id; + unsigned int i; HRESULT hr; - IMFTopologyNode_GetNodeType(downstream_node, &downstream_type); - IMFTopologyNode_GetTopoNodeID(downstream_node, &downstream_id); + IMFTopologyNode_GetNodeType(node, &node_type); + IMFTopologyNode_GetTopoNodeID(node, &node_id); - node = session_get_node_by_id(session, downstream_id); + topo_node = session_get_node_by_id(session, node_id); - switch (downstream_type) + switch (node_type) { case MF_TOPOLOGY_OUTPUT_NODE: - if (node->u.sink.requests) + if (topo_node->u.sink.requests) { - if (FAILED(hr = IMFStreamSink_ProcessSample(node->object.sink_stream, sample))) + if (FAILED(hr = IMFStreamSink_ProcessSample(topo_node->object.sink_stream, sample))) WARN("Sample delivery failed, hr %#x.\n", hr); - node->u.sink.requests--; + topo_node->u.sink.requests--; } break; case MF_TOPOLOGY_TRANSFORM_NODE: + + stream_id = transform_node_get_stream_id(topo_node, FALSE, input); + + hr = IMFTransform_ProcessInput(topo_node->object.transform, stream_id, sample, 0); + if (hr == MF_E_NOTACCEPTING) + { + struct sample *sample_entry = heap_alloc(sizeof(*sample_entry)); + sample_entry->sample = sample; + list_add_tail(&topo_node->u.transform.inputs[input].samples, &sample_entry->entry); + } + else if (hr == S_OK) + { + /* Check if we need new output is available, push it down. */ + for (i = 0; i < topo_node->u.transform.output_count; ++i) + { + if (!topo_node->u.transform.outputs[i].requests) + continue; + + sample = NULL; + transform_node_get_sample(topo_node, i, &sample); + if (sample) + { + if (SUCCEEDED(hr = IMFTopologyNode_GetOutput(node, i, &downstream_node, &downstream_input))) + { + session_deliver_sample_to_node(session, downstream_node, downstream_input, sample); + topo_node->u.transform.outputs[i].requests--; + IMFTopologyNode_Release(downstream_node); + } + IMFSample_Release(sample); + } + } + } + else + WARN("Transform failed to process input sample, hr %#x.\n", hr); + + break; case MF_TOPOLOGY_TEE_NODE: - FIXME("Unhandled downstream node type %d.\n", downstream_type); + FIXME("Unhandled downstream node type %d.\n", node_type); break; default: ; @@ -2349,7 +2415,8 @@ static HRESULT session_request_sample_from_node(struct media_session *session, I { if (SUCCEEDED(hr = IMFTopologyNode_GetInput(node, 0 /* FIXME */, &upstream_node, &upstream_output))) { - hr = session_request_sample_from_node(session, upstream_node, upstream_output); + if (SUCCEEDED(hr = session_request_sample_from_node(session, upstream_node, upstream_output))) + topo_node->u.transform.outputs[output].requests++; IMFTopologyNode_Release(upstream_node); } }
1
0
0
0
Nikolay Sivov : mf: Add support for requesting sample from transform nodes.
by Alexandre Julliard
13 Mar '20
13 Mar '20
Module: wine Branch: master Commit: 72d0c7e0a7ce398166bf62928842f9caf94b1745 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=72d0c7e0a7ce398166bf6292…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 13 15:34:37 2020 +0300 mf: Add support for requesting sample from transform nodes. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mf/session.c | 225 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 180 insertions(+), 45 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=72d0c7e0a7ce398166bf…
1
0
0
0
← Newer
1
...
59
60
61
62
63
64
65
...
100
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
97
98
99
100
Results per page:
10
25
50
100
200