winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 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
947 discussions
Start a n
N
ew thread
Alexandre Julliard : ntdll: Load the case mapping table in the Unix library.
by Alexandre Julliard
12 Jun '20
12 Jun '20
Module: wine Branch: master Commit: 573be7e6023e73d736c341bdca1ee49594f56ee4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=573be7e6023e73d736c341bd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jun 12 10:55:21 2020 +0200 ntdll: Load the case mapping table in the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/env.c | 103 ++++++++++++++++++++--------------------- dlls/ntdll/unix/unix_private.h | 63 ++++++++++++++++++++++--- 2 files changed, 106 insertions(+), 60 deletions(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index c2674be2c6..8b37d3dcca 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -65,6 +65,8 @@ extern char **__wine_main_argv; extern char **__wine_main_environ; extern WCHAR **__wine_main_wargv; +USHORT *uctable = NULL, *lctable = NULL; + static int main_argc; static char **main_argv; static char **main_envp; @@ -74,6 +76,36 @@ static CPTABLEINFO unix_table; static WCHAR system_locale[LOCALE_NAME_MAX_LENGTH]; static WCHAR user_locale[LOCALE_NAME_MAX_LENGTH]; +static void *read_nls_file( const char *name ) +{ + const char *dir = build_dir ? build_dir : data_dir; + struct stat st; + char *path; + void *data, *ret = NULL; + int fd; + + if (!(path = malloc( strlen(dir) + 22 ))) return NULL; + sprintf( path, "%s/nls/%s.nls", dir, name ); + if ((fd = open( path, O_RDONLY )) != -1) + { + fstat( fd, &st ); + if ((data = malloc( st.st_size )) && st.st_size > 0x1000 && + read( fd, data, st.st_size ) == st.st_size) + { + ret = data; + } + else + { + free( data ); + data = NULL; + } + close( fd ); + } + else ERR( "failed to load %s\n", path ); + free( path ); + return ret; +} + #ifdef __APPLE__ @@ -112,31 +144,7 @@ static struct norm_table *nfc_table; static void init_unix_codepage(void) { - const char *dir = build_dir ? build_dir : data_dir; - struct stat st; - char *name; - void *data; - int fd; - - if (!(name = malloc( strlen(dir) + 17 ))) return; - sprintf( name, "%s/nls/normnfc.nls", dir ); - if ((fd = open( name, O_RDONLY )) != -1) - { - fstat( fd, &st ); - if ((data = malloc( st.st_size )) && - st.st_size > 0x4000 && - read( fd, data, st.st_size ) == st.st_size) - { - nfc_table = data; - } - else - { - free( data ); - } - close( fd ); - } - else ERR( "failed to load %s\n", name ); - free( name ); + nfc_table = read_nls_file( "normnfc" ); } static int get_utf16( const WCHAR *src, unsigned int srclen, unsigned int *ch ) @@ -343,34 +351,6 @@ static const struct { const char *name; UINT cp; } charset_names[] = { "UTF8", CP_UTF8 } }; -static void load_unix_cptable( unsigned int cp ) -{ - const char *dir = build_dir ? build_dir : data_dir; - struct stat st; - char *name; - void *data; - int fd; - - if (!(name = malloc( strlen(dir) + 22 ))) return; - sprintf( name, "%s/nls/c_%03u.nls", dir, cp ); - if ((fd = open( name, O_RDONLY )) != -1) - { - fstat( fd, &st ); - if ((data = malloc( st.st_size )) && st.st_size > 0x10000 && - read( fd, data, st.st_size ) == st.st_size) - { - RtlInitCodePageTable( data, &unix_table ); - } - else - { - free( data ); - } - close( fd ); - } - else ERR( "failed to load %s\n", name ); - free( name ); -} - static void init_unix_codepage(void) { char charset_name[16]; @@ -396,7 +376,14 @@ static void init_unix_codepage(void) int res = strcmp( charset_names[pos].name, charset_name ); if (!res) { - if (charset_names[pos].cp != CP_UTF8) load_unix_cptable( charset_names[pos].cp ); + if (charset_names[pos].cp != CP_UTF8) + { + char name[16]; + void *data; + + sprintf( name, "c_%03u", charset_names[pos].cp ); + if ((data = read_nls_file( name ))) RtlInitCodePageTable( data, &unix_table ); + } return; } if (res > 0) max = pos - 1; @@ -797,9 +784,17 @@ static void init_locale(void) */ void init_environment( int argc, char *argv[], char *envp[] ) { + USHORT *case_table; + init_unix_codepage(); init_locale(); set_process_name( argc, argv ); + + if ((case_table = read_nls_file( "l_intl" ))) + { + uctable = case_table + 2; + lctable = case_table + case_table[1] + 2; + } __wine_main_argc = main_argc = argc; __wine_main_argv = main_argv = argv; __wine_main_wargv = main_wargv = build_wargv( argv ); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 1ef2111da1..b672321440 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -123,6 +123,8 @@ extern NTSTATUS CDECL fork_and_exec( const char *unix_name, const char *unix_dir extern const char *data_dir DECLSPEC_HIDDEN; extern const char *build_dir DECLSPEC_HIDDEN; extern const char *config_dir DECLSPEC_HIDDEN; +extern USHORT *uctable DECLSPEC_HIDDEN; +extern USHORT *lctable DECLSPEC_HIDDEN; extern unsigned int server_cpus DECLSPEC_HIDDEN; extern BOOL is_wow64 DECLSPEC_HIDDEN; extern HANDLE keyed_event DECLSPEC_HIDDEN; @@ -212,6 +214,13 @@ static inline int ntdll_wcscmp( const WCHAR *str1, const WCHAR *str2 ) return *str1 - *str2; } +static inline int ntdll_wcsncmp( const WCHAR *str1, const WCHAR *str2, int n ) +{ + if (n <= 0) return 0; + while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; } + return *str1 - *str2; +} + static inline WCHAR *ntdll_wcschr( const WCHAR *str, WCHAR ch ) { do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++); @@ -224,11 +233,53 @@ static inline WCHAR *ntdll_wcspbrk( const WCHAR *str, const WCHAR *accept ) return NULL; } -#define wcslen(str) ntdll_wcslen(str) -#define wcscpy(dst,src) ntdll_wcscpy(dst,src) -#define wcscat(dst,src) ntdll_wcscat(dst,src) -#define wcscmp(s1,s2) ntdll_wcscmp(s1,s2) -#define wcschr(str,ch) ntdll_wcschr(str,ch) -#define wcspbrk(str,ac) ntdll_wcspbrk(str,ac) +static inline WCHAR ntdll_towupper( WCHAR ch ) +{ + return ch + uctable[uctable[uctable[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0x0f)]; +} + +static inline WCHAR ntdll_towlower( WCHAR ch ) +{ + return ch + lctable[lctable[lctable[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0x0f)]; +} + +static inline WCHAR *ntdll_wcsupr( WCHAR *str ) +{ + WCHAR *ret; + for (ret = str; *str; str++) *str = ntdll_towupper(*str); + return ret; +} + +static inline int ntdll_wcsicmp( const WCHAR *str1, const WCHAR *str2 ) +{ + int ret; + for (;;) + { + if ((ret = ntdll_towupper( *str1 ) - ntdll_towupper( *str2 )) || !*str1) return ret; + str1++; + str2++; + } +} + +static inline int ntdll_wcsnicmp( const WCHAR *str1, const WCHAR *str2, int n ) +{ + int ret; + for (ret = 0; n > 0; n--, str1++, str2++) + if ((ret = ntdll_towupper(*str1) - ntdll_towupper(*str2)) || !*str1) break; + return ret; +} + +#define wcslen(str) ntdll_wcslen(str) +#define wcscpy(dst,src) ntdll_wcscpy(dst,src) +#define wcscat(dst,src) ntdll_wcscat(dst,src) +#define wcscmp(s1,s2) ntdll_wcscmp(s1,s2) +#define wcsncmp(s1,s2,n) ntdll_wcsncmp(s1,s2,n) +#define wcschr(str,ch) ntdll_wcschr(str,ch) +#define wcspbrk(str,ac) ntdll_wcspbrk(str,ac) +#define wcsicmp(s1, s2) ntdll_wcsicmp(s1,s2) +#define wcsnicmp(s1, s2,n) ntdll_wcsnicmp(s1,s2,n) +#define wcsupr(str) ntdll_wcsupr(str) +#define towupper(c) ntdll_towupper(c) +#define towlower(c) ntdll_towlower(c) #endif /* __NTDLL_UNIX_PRIVATE_H */
1
0
0
0
Alexandre Julliard : ntdll: Move fork and exec support to the Unix library.
by Alexandre Julliard
12 Jun '20
12 Jun '20
Module: wine Branch: master Commit: 412555e0cdcd16439db56f6bd6ea56cedcda0883 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=412555e0cdcd16439db56f6b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jun 12 09:26:50 2020 +0200 ntdll: Move fork and exec support to the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 + dlls/ntdll/process.c | 381 +------------------------------------- dlls/ntdll/unix/env.c | 124 +++++++++++++ dlls/ntdll/unix/loader.c | 8 +- dlls/ntdll/unix/process.c | 403 +++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/unix_private.h | 9 + dlls/ntdll/unixlib.h | 12 +- 7 files changed, 553 insertions(+), 385 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=412555e0cdcd16439db5…
1
0
0
0
Jacek Caban : d3dx9: Use BitScanReverse in make_pow2.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: 22970932d014f024fcf7f0f98b1a5384b1b1eb99 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=22970932d014f024fcf7f0f9…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 10 14:21:03 2020 +0200 d3dx9: Use BitScanReverse in make_pow2. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/d3dx9_private.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h index d64b9af30c..c3308b04d4 100644 --- a/dlls/d3dx9_36/d3dx9_private.h +++ b/dlls/d3dx9_36/d3dx9_private.h @@ -229,19 +229,8 @@ static inline BOOL is_param_type_sampler(D3DXPARAMETER_TYPE type) /* Returns the smallest power of 2 which is greater than or equal to num */ static inline uint32_t make_pow2(uint32_t num) { -#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) - return num == 1 ? 1 : 1u << ((__builtin_clz(num - 1) ^ 0x1f) + 1); -#else - num--; - num |= num >> 1; - num |= num >> 2; - num |= num >> 4; - num |= num >> 8; - num |= num >> 16; - num++; - - return num; -#endif + uint32_t index; + return BitScanReverse(&index, num - 1) ? 1u << (index + 1) : 1; } struct d3dx_parameter;
1
0
0
0
Zebediah Figura : d3dcompiler: Return an HRESULT from parse_hlsl().
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: 24c84947c835d42190e61b70ee5be98bdedd1e9b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=24c84947c835d42190e61b70…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Jun 8 16:49:39 2020 -0500 d3dcompiler: Return an HRESULT from parse_hlsl(). 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/compiler.c | 49 ++++++++----------------------- dlls/d3dcompiler_43/d3dcompiler_private.h | 4 +-- dlls/d3dcompiler_43/hlsl.l | 14 ++++----- dlls/d3dcompiler_43/hlsl.y | 10 +++++-- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 2 +- 5 files changed, 29 insertions(+), 50 deletions(-) diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c index 9fc7c1d773..78fb0c46cc 100644 --- a/dlls/d3dcompiler_43/compiler.c +++ b/dlls/d3dcompiler_43/compiler.c @@ -752,12 +752,11 @@ static const struct target_info * get_target_info(const char *target) } static HRESULT compile_shader(const char *preproc_shader, const char *target, const char *entrypoint, - ID3DBlob **shader_blob, ID3DBlob **error_messages) + ID3DBlob **shader, ID3DBlob **error_messages) { - struct bwriter_shader *shader; + DWORD size, major, minor; char *messages = NULL; HRESULT hr; - DWORD *res, size, major, minor; ID3DBlob *buffer; char *pos; enum shader_type shader_type; @@ -787,7 +786,7 @@ static HRESULT compile_shader(const char *preproc_shader, const char *target, co } } - shader = parse_hlsl_shader(preproc_shader, shader_type, major, minor, entrypoint, &messages); + hr = parse_hlsl_shader(preproc_shader, shader_type, major, minor, entrypoint, shader, &messages); if (messages) { @@ -800,14 +799,18 @@ static HRESULT compile_shader(const char *preproc_shader, const char *target, co if (error_messages) { const char *preproc_messages = *error_messages ? ID3D10Blob_GetBufferPointer(*error_messages) : NULL; + HRESULT blob_hr; size = strlen(messages) + (preproc_messages ? strlen(preproc_messages) : 0) + 1; - hr = D3DCreateBlob(size, &buffer); - if (FAILED(hr)) + if (FAILED(blob_hr = D3DCreateBlob(size, &buffer))) { HeapFree(GetProcessHeap(), 0, messages); - if (shader) SlDeleteShader(shader); - return hr; + if (*shader) + { + ID3D10Blob_Release(*shader); + *shader = NULL; + } + return blob_hr; } pos = ID3D10Blob_GetBufferPointer(buffer); if (preproc_messages) @@ -823,35 +826,7 @@ static HRESULT compile_shader(const char *preproc_shader, const char *target, co HeapFree(GetProcessHeap(), 0, messages); } - if (!shader) - { - ERR("HLSL shader parsing failed.\n"); - return D3DXERR_INVALIDDATA; - } - - hr = shader_write_bytecode(shader, &res, &size); - SlDeleteShader(shader); - if (FAILED(hr)) - { - ERR("Failed to write bytecode, hr %#x.\n", hr); - return D3DXERR_INVALIDDATA; - } - - if (shader_blob) - { - hr = D3DCreateBlob(size, &buffer); - if (FAILED(hr)) - { - HeapFree(GetProcessHeap(), 0, res); - return hr; - } - memcpy(ID3D10Blob_GetBufferPointer(buffer), res, size); - *shader_blob = buffer; - } - - HeapFree(GetProcessHeap(), 0, res); - - return S_OK; + return hr; } HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filename, diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 9ac2f14041..9feaee0d8a 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -1081,8 +1081,8 @@ BOOL pop_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN; void init_functions_tree(struct wine_rb_tree *funcs) DECLSPEC_HIDDEN; void add_function_decl(struct wine_rb_tree *funcs, char *name, struct hlsl_ir_function_decl *decl, BOOL intrinsic) DECLSPEC_HIDDEN; -struct bwriter_shader *parse_hlsl_shader(const char *text, enum shader_type type, DWORD major, DWORD minor, - const char *entrypoint, char **messages) DECLSPEC_HIDDEN; +HRESULT parse_hlsl_shader(const char *text, enum shader_type type, DWORD major, DWORD minor, + const char *entrypoint, ID3D10Blob **shader, char **messages) DECLSPEC_HIDDEN; const char *debug_base_type(const struct hlsl_type *type) DECLSPEC_HIDDEN; const char *debug_hlsl_type(const struct hlsl_type *type) DECLSPEC_HIDDEN; diff --git a/dlls/d3dcompiler_43/hlsl.l b/dlls/d3dcompiler_43/hlsl.l index 2994c7dea6..6ffd137597 100644 --- a/dlls/d3dcompiler_43/hlsl.l +++ b/dlls/d3dcompiler_43/hlsl.l @@ -273,20 +273,20 @@ row_major {return KW_ROW_MAJOR; } %% -struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD minor, - const char *entrypoint, char **messages); +HRESULT parse_hlsl(enum shader_type type, DWORD major, DWORD minor, + const char *entrypoint, ID3D10Blob **shader, char **messages); -struct bwriter_shader *parse_hlsl_shader(const char *text, enum shader_type type, DWORD major, DWORD minor, - const char *entrypoint, char **messages) +HRESULT parse_hlsl_shader(const char *text, enum shader_type type, DWORD major, DWORD minor, + const char *entrypoint, ID3D10Blob **shader, char **messages) { - struct bwriter_shader *ret = NULL; YY_BUFFER_STATE buffer; + HRESULT hr; buffer = hlsl__scan_string(text); hlsl__switch_to_buffer(buffer); - ret = parse_hlsl(type, major, minor, entrypoint, messages); + hr = parse_hlsl(type, major, minor, entrypoint, shader, messages); hlsl__delete_buffer(buffer); - return ret; + return hr; } diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index b5057db887..28d4dd7f2c 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -2942,13 +2942,14 @@ static void compute_liveness(struct hlsl_ir_function_decl *entry_func) compute_liveness_recurse(entry_func->body, 0, 0); } -struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD minor, - const char *entrypoint, char **messages) +HRESULT parse_hlsl(enum shader_type type, DWORD major, DWORD minor, + const char *entrypoint, ID3D10Blob **shader_blob, char **messages) { struct hlsl_ir_function_decl *entry_func; struct hlsl_scope *scope, *next_scope; struct hlsl_type *hlsl_type, *next_type; struct hlsl_ir_var *var, *next_var; + HRESULT hr = E_FAIL; unsigned int i; hlsl_ctx.status = PARSE_SUCCESS; @@ -2998,6 +2999,9 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino compute_liveness(entry_func); + if (hlsl_ctx.status != PARSE_ERR) + hr = E_NOTIMPL; + out: if (messages) { @@ -3036,5 +3040,5 @@ out: free_hlsl_type(hlsl_type); } - return NULL; + return hr; } diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index e82b466de2..24829235a5 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -1159,7 +1159,7 @@ static void test_fail(void) { compiled = errors = NULL; hr = ppD3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", targets[j], 0, 0, &compiled, &errors); - todo_wine ok(hr == E_FAIL, "Test %u, target %s, got unexpected hr %#x.\n", i, targets[j], hr); + ok(hr == E_FAIL, "Test %u, target %s, got unexpected hr %#x.\n", i, targets[j], hr); ok(!!errors, "Test %u, target %s, expected non-NULL error blob.\n", i, targets[j]); ok(!compiled, "Test %u, target %s, expected no compiled shader blob.\n", i, targets[j]); ID3D10Blob_Release(errors);
1
0
0
0
Zebediah Figura : d3dcompiler: Check for missing return value semantics on the entry point.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: fdb3db52751ca6f9e9ca5e3ec8606f1727d7ea16 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fdb3db52751ca6f9e9ca5e3e…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Jun 8 16:49:38 2020 -0500 d3dcompiler: Check for missing return value semantics on the entry point. 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 | 42 ++++++++++++++++++++--------------- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 12 ++++++++++ 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 79becca257..b5057db887 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -2971,24 +2971,6 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino hlsl_parse(); - TRACE("Compilation status = %d\n", hlsl_ctx.status); - if (messages) - { - if (hlsl_ctx.messages.size) - *messages = hlsl_ctx.messages.string; - else - *messages = NULL; - } - else - { - if (hlsl_ctx.messages.capacity) - d3dcompiler_free(hlsl_ctx.messages.string); - } - - for (i = 0; i < hlsl_ctx.source_files_count; ++i) - d3dcompiler_free((void *)hlsl_ctx.source_files[i]); - d3dcompiler_free(hlsl_ctx.source_files); - if (hlsl_ctx.status == PARSE_ERR) goto out; @@ -2998,6 +2980,13 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino goto out; } + if (!type_is_void(entry_func->return_type) + && entry_func->return_type->type != HLSL_CLASS_STRUCT && !entry_func->semantic) + { + hlsl_report_message(entry_func->loc, HLSL_LEVEL_ERROR, + "entry point \"%s\" is missing a return value semantic", entry_func->func->name); + } + /* Index 0 means unused; index 1 means function entry, so start at 2. */ index_instructions(entry_func->body, 2); @@ -3010,6 +2999,23 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino compute_liveness(entry_func); out: + if (messages) + { + if (hlsl_ctx.messages.size) + *messages = hlsl_ctx.messages.string; + else + *messages = NULL; + } + else + { + if (hlsl_ctx.messages.capacity) + d3dcompiler_free(hlsl_ctx.messages.string); + } + + for (i = 0; i < hlsl_ctx.source_files_count; ++i) + d3dcompiler_free((void *)hlsl_ctx.source_files[i]); + d3dcompiler_free(hlsl_ctx.source_files); + TRACE("Freeing functions IR.\n"); wine_rb_destroy(&hlsl_ctx.functions, free_function_rb, NULL); diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index fba8a638b5..e82b466de2 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -1133,6 +1133,18 @@ static void test_fail(void) "{\n" " return float4(0, 0, 0, 0);\n" "}", + + /* 15 */ + "float4 test()\n" + "{\n" + " return float4(0, 0, 0, 0);\n" + "}", + + "float4 test(out float4 o : SV_TARGET)\n" + "{\n" + " o = float4(1, 1, 1, 1);\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: Allow hlsl_ir_constant to contain only numeric types.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: d5486b6bb5ac4223318528fb6cc759e404c54e25 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d5486b6bb5ac4223318528fb…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Jun 8 16:49:37 2020 -0500 d3dcompiler: Allow hlsl_ir_constant to contain only numeric types. 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/d3dcompiler_private.h | 17 ++++++----------- dlls/d3dcompiler_43/hlsl.y | 18 +++++++++--------- dlls/d3dcompiler_43/utils.c | 28 +++++----------------------- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 0002a070cc..9ac2f14041 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -866,17 +866,12 @@ struct hlsl_ir_constant struct hlsl_ir_node node; union { - union - { - unsigned u[16]; - int i[16]; - float f[16]; - double d[16]; - BOOL b[16]; - } value; - struct hlsl_ir_constant *array_elements; - struct list *struct_elements; - } v; + unsigned u[16]; + int i[16]; + float f[16]; + double d[16]; + BOOL b[16]; + } value; }; struct hlsl_scope diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index d8e711795e..79becca257 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -590,7 +590,7 @@ static struct hlsl_ir_constant *new_uint_constant(unsigned int n, const struct s if (!(c = d3dcompiler_alloc(sizeof(*c)))) return NULL; init_node(&c->node, HLSL_IR_CONSTANT, hlsl_ctx.builtin_types.scalar[HLSL_TYPE_UINT], loc); - c->v.value.u[0] = n; + c->value.u[0] = n; return c; } @@ -1231,15 +1231,15 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node) switch (constant->node.data_type->base_type) { case HLSL_TYPE_UINT: - return constant->v.value.u[0]; + return constant->value.u[0]; case HLSL_TYPE_INT: - return constant->v.value.i[0]; + return constant->value.i[0]; case HLSL_TYPE_FLOAT: - return constant->v.value.f[0]; + return constant->value.f[0]; case HLSL_TYPE_DOUBLE: - return constant->v.value.d[0]; + return constant->value.d[0]; case HLSL_TYPE_BOOL: - return constant->v.value.b[0]; + return constant->value.b[0]; default: WARN("Invalid type %s.\n", debug_base_type(constant->node.data_type)); return 0; @@ -2252,7 +2252,7 @@ primary_expr: C_FLOAT } init_node(&c->node, HLSL_IR_CONSTANT, hlsl_ctx.builtin_types.scalar[HLSL_TYPE_FLOAT], get_location(&@1)); - c->v.value.f[0] = $1; + c->value.f[0] = $1; if (!($$ = make_list(&c->node))) YYABORT; } @@ -2266,7 +2266,7 @@ primary_expr: C_FLOAT } init_node(&c->node, HLSL_IR_CONSTANT, hlsl_ctx.builtin_types.scalar[HLSL_TYPE_INT], get_location(&@1)); - c->v.value.i[0] = $1; + c->value.i[0] = $1; if (!($$ = make_list(&c->node))) YYABORT; } @@ -2280,7 +2280,7 @@ primary_expr: C_FLOAT } init_node(&c->node, HLSL_IR_CONSTANT, hlsl_ctx.builtin_types.scalar[HLSL_TYPE_BOOL], get_location(&@1)); - c->v.value.b[0] = $1; + c->value.b[0] = $1; if (!($$ = make_list(&c->node))) YYABORT; } diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 81541f3872..4769ebc399 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -1831,19 +1831,19 @@ static void debug_dump_ir_constant(const struct hlsl_ir_constant *constant) switch (type->base_type) { case HLSL_TYPE_FLOAT: - wine_dbg_printf("%g ", (double)constant->v.value.f[y * type->dimx + x]); + wine_dbg_printf("%g ", (double)constant->value.f[y * type->dimx + x]); break; case HLSL_TYPE_DOUBLE: - wine_dbg_printf("%g ", constant->v.value.d[y * type->dimx + x]); + wine_dbg_printf("%g ", constant->value.d[y * type->dimx + x]); break; case HLSL_TYPE_INT: - wine_dbg_printf("%d ", constant->v.value.i[y * type->dimx + x]); + wine_dbg_printf("%d ", constant->value.i[y * type->dimx + x]); break; case HLSL_TYPE_UINT: - wine_dbg_printf("%u ", constant->v.value.u[y * type->dimx + x]); + wine_dbg_printf("%u ", constant->value.u[y * type->dimx + x]); break; case HLSL_TYPE_BOOL: - wine_dbg_printf("%s ", constant->v.value.b[y * type->dimx + x] == FALSE ? "false" : "true"); + wine_dbg_printf("%s ", constant->value.b[y * type->dimx + x] == FALSE ? "false" : "true"); break; default: wine_dbg_printf("Constants of type %s not supported\n", debug_base_type(type)); @@ -2123,24 +2123,6 @@ void free_instr_list(struct list *list) static void free_ir_constant(struct hlsl_ir_constant *constant) { - struct hlsl_type *type = constant->node.data_type; - unsigned int i; - struct hlsl_ir_constant *field, *next_field; - - switch (type->type) - { - case HLSL_CLASS_ARRAY: - for (i = 0; i < type->e.array.elements_count; ++i) - free_ir_constant(&constant->v.array_elements[i]); - d3dcompiler_free(constant->v.array_elements); - break; - case HLSL_CLASS_STRUCT: - LIST_FOR_EACH_ENTRY_SAFE(field, next_field, constant->v.struct_elements, struct hlsl_ir_constant, node.entry) - free_ir_constant(field); - break; - default: - break; - } d3dcompiler_free(constant); }
1
0
0
0
Zebediah Figura : d3dcompiler: Emit constructors as sequences of stores to a synthetic variable.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: d5a4364f445b59fb20b31e96f78f23027b3b2768 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d5a4364f445b59fb20b31e96…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Jun 8 16:49:36 2020 -0500 d3dcompiler: Emit constructors as sequences of stores to a synthetic 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/d3dcompiler_private.h | 14 ---- dlls/d3dcompiler_43/hlsl.y | 112 +++++++++++++++++++----------- dlls/d3dcompiler_43/utils.c | 25 ------- 3 files changed, 70 insertions(+), 81 deletions(-) diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 970150bbc5..0002a070cc 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -648,7 +648,6 @@ enum hlsl_ir_node_type { HLSL_IR_ASSIGNMENT = 0, HLSL_IR_CONSTANT, - HLSL_IR_CONSTRUCTOR, HLSL_IR_EXPR, HLSL_IR_IF, HLSL_IR_LOAD, @@ -880,13 +879,6 @@ struct hlsl_ir_constant } v; }; -struct hlsl_ir_constructor -{ - struct hlsl_ir_node node; - struct hlsl_ir_node *args[16]; - unsigned int args_count; -}; - struct hlsl_scope { struct list entry; @@ -1043,12 +1035,6 @@ static inline struct hlsl_ir_swizzle *swizzle_from_node(const struct hlsl_ir_nod return CONTAINING_RECORD(node, struct hlsl_ir_swizzle, node); } -static inline struct hlsl_ir_constructor *constructor_from_node(const struct hlsl_ir_node *node) -{ - assert(node->type == HLSL_IR_CONSTRUCTOR); - return CONTAINING_RECORD(node, struct hlsl_ir_constructor, node); -} - static inline struct hlsl_ir_if *if_from_node(const struct hlsl_ir_node *node) { assert(node->type == HLSL_IR_IF); diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 83aa95b54f..d8e711795e 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -1245,7 +1245,6 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node) return 0; } } - case HLSL_IR_CONSTRUCTOR: case HLSL_IR_EXPR: case HLSL_IR_LOAD: case HLSL_IR_SWIZZLE: @@ -2416,41 +2415,78 @@ postfix_expr: primary_expr } $$ = append_binop($1, $3, &load->node); } - /* "var_modifiers" doesn't make sense in this case, but it's needed - in the grammar to avoid shift/reduce conflicts. */ - | var_modifiers type '(' initializer_expr_list ')' - { - struct hlsl_ir_constructor *constructor; - TRACE("%s constructor.\n", debug_hlsl_type($2)); - if ($1) - { - hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR, - "unexpected modifier on a constructor\n"); - YYABORT; - } - if ($2->type > HLSL_CLASS_LAST_NUMERIC) - { - hlsl_report_message(get_location(&@2), HLSL_LEVEL_ERROR, - "constructors may only be used with numeric data types\n"); - YYABORT; - } - if ($2->dimx * $2->dimy != initializer_size(&$4)) - { - hlsl_report_message(get_location(&@4), HLSL_LEVEL_ERROR, - "expected %u components in constructor, but got %u\n", - $2->dimx * $2->dimy, initializer_size(&$4)); - YYABORT; - } - assert($4.args_count <= ARRAY_SIZE(constructor->args)); + /* "var_modifiers" doesn't make sense in this case, but it's needed + in the grammar to avoid shift/reduce conflicts. */ + | var_modifiers type '(' initializer_expr_list ')' + { + struct hlsl_ir_assignment *assignment; + unsigned int i, writemask_offset = 0; + static unsigned int counter; + struct hlsl_ir_load *load; + struct hlsl_ir_var *var; + char name[23]; - constructor = d3dcompiler_alloc(sizeof(*constructor)); - init_node(&constructor->node, HLSL_IR_CONSTRUCTOR, $2, get_location(&@3)); - constructor->args_count = $4.args_count; - memcpy(constructor->args, $4.args, $4.args_count * sizeof(*$4.args)); - d3dcompiler_free($4.args); - $$ = append_unop($4.instrs, &constructor->node); - } + if ($1) + { + hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR, + "unexpected modifier on a constructor\n"); + YYABORT; + } + if ($2->type > HLSL_CLASS_LAST_NUMERIC) + { + hlsl_report_message(get_location(&@2), HLSL_LEVEL_ERROR, + "constructors may only be used with numeric data types\n"); + YYABORT; + } + if ($2->dimx * $2->dimy != initializer_size(&$4)) + { + hlsl_report_message(get_location(&@4), HLSL_LEVEL_ERROR, + "expected %u components in constructor, but got %u\n", + $2->dimx * $2->dimy, initializer_size(&$4)); + YYABORT; + } + + if ($2->type == HLSL_CLASS_MATRIX) + FIXME("Matrix constructors are not supported yet.\n"); + + sprintf(name, "<constructor-%x>", counter++); + if (!(var = new_synthetic_var(name, $2, get_location(&@2)))) + YYABORT; + for (i = 0; i < $4.args_count; ++i) + { + struct hlsl_ir_node *arg = $4.args[i]; + unsigned int width; + + if (arg->data_type->type == HLSL_CLASS_OBJECT) + { + hlsl_report_message(arg->loc, HLSL_LEVEL_ERROR, + "invalid constructor argument"); + continue; + } + width = components_count_type(arg->data_type); + + if (width > 4) + { + FIXME("Constructor argument with %u components.\n", width); + continue; + } + + if (!(arg = implicit_conversion(arg, + hlsl_ctx.builtin_types.vector[$2->base_type][width - 1], &arg->loc))) + continue; + + if (!(assignment = new_assignment(var, NULL, arg, + ((1 << width) - 1) << writemask_offset, arg->loc))) + YYABORT; + writemask_offset += width; + list_add_tail($4.instrs, &assignment->node.entry); + } + d3dcompiler_free($4.args); + if (!(load = new_var_load(var, get_location(&@2)))) + YYABORT; + $$ = append_unop($4.instrs, &load->node); + } unary_expr: postfix_expr { @@ -2835,14 +2871,6 @@ static void compute_liveness_recurse(struct list *instrs, unsigned int loop_firs assignment->lhs.offset->last_read = instr->index; break; } - case HLSL_IR_CONSTRUCTOR: - { - struct hlsl_ir_constructor *constructor = constructor_from_node(instr); - unsigned int i; - for (i = 0; i < constructor->args_count; ++i) - constructor->args[i]->last_read = instr->index; - break; - } case HLSL_IR_EXPR: { struct hlsl_ir_expr *expr = expr_from_node(instr); diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index c3dbd505f2..81541f3872 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -1759,7 +1759,6 @@ const char *debug_node_type(enum hlsl_ir_node_type type) { "HLSL_IR_ASSIGNMENT", "HLSL_IR_CONSTANT", - "HLSL_IR_CONSTRUCTOR", "HLSL_IR_EXPR", "HLSL_IR_IF", "HLSL_IR_LOAD", @@ -1947,19 +1946,6 @@ static void debug_dump_ir_expr(const struct hlsl_ir_expr *expr) wine_dbg_printf(")"); } -static void debug_dump_ir_constructor(const struct hlsl_ir_constructor *constructor) -{ - unsigned int i; - - wine_dbg_printf("%s (", debug_hlsl_type(constructor->node.data_type)); - for (i = 0; i < constructor->args_count; ++i) - { - debug_dump_src(constructor->args[i]); - wine_dbg_printf(" "); - } - wine_dbg_printf(")"); -} - static const char *debug_writemask(DWORD writemask) { static const char components[] = {'x', 'y', 'z', 'w'}; @@ -2074,9 +2060,6 @@ static void debug_dump_instr(const struct hlsl_ir_node *instr) case HLSL_IR_SWIZZLE: debug_dump_ir_swizzle(swizzle_from_node(instr)); break; - case HLSL_IR_CONSTRUCTOR: - debug_dump_ir_constructor(constructor_from_node(instr)); - break; case HLSL_IR_JUMP: debug_dump_ir_jump(jump_from_node(instr)); break; @@ -2171,11 +2154,6 @@ static void free_ir_swizzle(struct hlsl_ir_swizzle *swizzle) d3dcompiler_free(swizzle); } -static void free_ir_constructor(struct hlsl_ir_constructor *constructor) -{ - d3dcompiler_free(constructor); -} - static void free_ir_expr(struct hlsl_ir_expr *expr) { d3dcompiler_free(expr); @@ -2217,9 +2195,6 @@ void free_instr(struct hlsl_ir_node *node) case HLSL_IR_SWIZZLE: free_ir_swizzle(swizzle_from_node(node)); break; - case HLSL_IR_CONSTRUCTOR: - free_ir_constructor(constructor_from_node(node)); - break; case HLSL_IR_EXPR: free_ir_expr(expr_from_node(node)); break;
1
0
0
0
Zebediah Figura : d3dcompiler: Cache vector types.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: 10601d9ac5af89d55462a220524afd02d741eae2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=10601d9ac5af89d55462a220…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu Jun 11 21:44:10 2020 +0200 d3dcompiler: Cache vector types. 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/d3dcompiler_private.h | 1 + dlls/d3dcompiler_43/hlsl.y | 1 + dlls/d3dcompiler_43/utils.c | 12 +++--------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index a61b84d6b5..970150bbc5 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -988,6 +988,7 @@ struct hlsl_parse_ctx struct { struct hlsl_type *scalar[HLSL_TYPE_LAST_SCALAR + 1]; + struct hlsl_type *vector[HLSL_TYPE_LAST_SCALAR + 1][4]; struct hlsl_type *sampler[HLSL_SAMPLER_DIM_MAX + 1]; struct hlsl_type *Void; } builtin_types; diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 436b731fd1..83aa95b54f 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -237,6 +237,7 @@ static void declare_predefined_types(struct hlsl_scope *scope) sprintf(name, "%s%u", names[bt], x); type = new_hlsl_type(d3dcompiler_strdup(name), HLSL_CLASS_VECTOR, bt, x, y); add_type_to_scope(scope, type); + hlsl_ctx.builtin_types.vector[bt][x - 1] = type; if (x == 1) { diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 97e3cdf1a3..c3dbd505f2 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -1296,6 +1296,8 @@ static struct hlsl_type *expr_common_type(struct hlsl_type *t1, struct hlsl_type if (type == HLSL_CLASS_SCALAR) return hlsl_ctx.builtin_types.scalar[base]; + if (type == HLSL_CLASS_VECTOR) + return hlsl_ctx.builtin_types.vector[base][dimx - 1]; return new_hlsl_type(NULL, type, base, dimx, dimy); } @@ -1495,15 +1497,7 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *lhs, enum parse_assign } assert(swizzle_type->type == HLSL_CLASS_VECTOR); if (swizzle_type->dimx != width) - { - struct hlsl_type *type; - if (!(type = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, swizzle_type->base_type, width, 1))) - { - d3dcompiler_free(assign); - return NULL; - } - swizzle->node.data_type = type; - } + swizzle->node.data_type = hlsl_ctx.builtin_types.vector[swizzle_type->base_type][width - 1]; rhs = &swizzle->node; } else
1
0
0
0
Zebediah Figura : d3dcompiler: Use the cached scalar type in expr_common_type() where possible.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: 9c985e703b2c4a49b81bb692ac31b6414417a38e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9c985e703b2c4a49b81bb692…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Jun 8 16:49:34 2020 -0500 d3dcompiler: Use the cached scalar type in expr_common_type() where possible. 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/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index ec0da2d403..97e3cdf1a3 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -1294,6 +1294,8 @@ static struct hlsl_type *expr_common_type(struct hlsl_type *t1, struct hlsl_type } } + if (type == HLSL_CLASS_SCALAR) + return hlsl_ctx.builtin_types.scalar[base]; return new_hlsl_type(NULL, type, base, dimx, dimy); }
1
0
0
0
Alexandre Julliard : dmloader: Check for invalid class in EnableCache().
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: 8d12efecc967a1593583713a5adcd593b9e2e299 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8d12efecc967a1593583713a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jun 11 21:56:46 2020 +0200 dmloader: Check for invalid class in EnableCache(). Fixes a test failure with sone Mingw versions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dmloader/loader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c index c5f5094fab..b90584b09a 100644 --- a/dlls/dmloader/loader.c +++ b/dlls/dmloader/loader.c @@ -771,10 +771,12 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_EnableCache(IDirectMusicLoader8 *if if (IsEqualGUID(class, &GUID_DirectMusicAllTypes)) This->cache_class = enable ? ~0 : 0; else { + int idx = index_from_class(class); + if (idx == -1) return S_FALSE; if (enable) - This->cache_class |= 1 << index_from_class(class); + This->cache_class |= 1 << idx; else - This->cache_class &= ~(1 << index_from_class(class)); + This->cache_class &= ~(1 << idx); } if (!enable)
1
0
0
0
← Newer
1
...
46
47
48
49
50
51
52
...
95
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
Results per page:
10
25
50
100
200