Artifact ceb1fd2634da5b6ac27f839f685cc8ebf4c86b12:
- File
src/win32/directx/dxerr9.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /*************** 0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0d 0a 2a 20 20 20 20 ********\..* 0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0060: 20 20 20 20 20 20 20 20 20 20 20 20 64 78 65 72 dxer 0070: 72 39 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 r9.d 0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0090: 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 20 *..* 00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0d *. 00e0: 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .* 00f0: 20 20 20 20 20 20 20 20 20 57 69 6e 64 6f 77 73 Windows 0100: 20 41 50 49 20 68 65 61 64 65 72 20 6d 6f 64 75 API header modu 0110: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 le 0120: 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 20 *..* 0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0170: 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 *..* 0180: 20 20 20 20 20 20 20 20 20 54 72 61 6e 73 6c 61 Transla 0190: 74 65 64 20 66 72 6f 6d 20 4d 69 6e 47 57 20 57 ted from MinGW W 01a0: 69 6e 64 6f 77 73 20 68 65 61 64 65 72 73 20 20 indows headers 01b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a * 01c0: 0d 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 ..* 01d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 01e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0200: 20 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 *..* 0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0220: 20 20 20 20 20 50 6c 61 63 65 64 20 69 6e 74 6f Placed into 0230: 20 70 75 62 6c 69 63 20 64 6f 6d 61 69 6e 20 20 public domain 0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0250: 20 20 20 20 20 2a 0d 0a 5c 2a 2a 2a 2a 2a 2a 2a *..\******* 0260: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0270: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0280: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0290: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 02a0: 2f 0d 0a 6d 6f 64 75 6c 65 20 77 69 6e 33 32 2e /..module win32. 02b0: 64 69 72 65 63 74 78 2e 64 78 65 72 72 39 3b 0d directx.dxerr9;. 02c0: 0a 0d 0a 2f 2a 0d 0a 09 64 78 65 72 72 39 2e 68 .../*...dxerr9.h 02d0: 20 2d 20 48 65 61 64 65 72 20 66 69 6c 65 20 66 - Header file f 02e0: 6f 72 20 74 68 65 20 44 69 72 65 63 74 58 20 39 or the DirectX 9 02f0: 20 45 72 72 6f 72 20 41 50 49 0d 0a 0d 0a 09 57 Error API.....W 0300: 72 69 74 74 65 6e 20 62 79 20 46 69 6c 69 70 20 ritten by Filip 0310: 4e 61 76 61 72 61 20 3c 78 6e 61 76 61 72 61 40 Navara <xnavara@ 0320: 76 6f 6c 6e 79 2e 63 7a 3e 0d 0a 09 50 6f 72 74 volny.cz>...Port 0330: 65 64 20 74 6f 20 44 20 62 79 20 4a 61 6d 65 73 ed to D by James 0340: 20 50 65 6c 63 69 73 20 3c 6a 70 65 6c 63 69 73 Pelcis <jpelcis 0350: 40 67 6d 61 69 6c 2e 63 6f 6d 3e 0d 0a 0d 0a 09 @gmail.com>..... 0360: 54 68 69 73 20 6c 69 62 72 61 72 79 20 69 73 20 This library is 0370: 64 69 73 74 72 69 62 75 74 65 64 20 69 6e 20 74 distributed in t 0380: 68 65 20 68 6f 70 65 20 74 68 61 74 20 69 74 20 he hope that it 0390: 77 69 6c 6c 20 62 65 20 75 73 65 66 75 6c 2c 0d will be useful,. 03a0: 0a 09 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e ..but WITHOUT AN 03b0: 59 20 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 Y WARRANTY; with 03c0: 6f 75 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 out even the imp 03d0: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of 03e0: 0d 0a 09 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 ...MERCHANTABILI 03f0: 54 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f TY or FITNESS FO 0400: 52 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 R A PARTICULAR P 0410: 55 52 50 4f 53 45 2e 0d 0a 0d 0a 2a 2f 0d 0a 0d URPOSE.....*/... 0420: 0a 70 72 69 76 61 74 65 20 69 6d 70 6f 72 74 20 .private import 0430: 77 69 6e 33 32 2e 77 69 6e 64 65 66 3b 0d 0a 0d win32.windef;... 0440: 0a 65 78 74 65 72 6e 20 28 57 69 6e 64 6f 77 73 .extern (Windows 0450: 29 20 7b 0d 0a 09 63 68 61 72 2a 20 44 58 47 65 ) {...char* DXGe 0460: 74 45 72 72 6f 72 53 74 72 69 6e 67 39 41 28 48 tErrorString9A(H 0470: 52 45 53 55 4c 54 29 3b 0d 0a 09 57 43 48 41 52 RESULT);...WCHAR 0480: 2a 20 44 58 47 65 74 45 72 72 6f 72 53 74 72 69 * DXGetErrorStri 0490: 6e 67 39 57 28 48 52 45 53 55 4c 54 29 3b 0d 0a ng9W(HRESULT);.. 04a0: 09 63 68 61 72 2a 20 44 58 47 65 74 45 72 72 6f .char* DXGetErro 04b0: 72 44 65 73 63 72 69 70 74 69 6f 6e 39 41 28 48 rDescription9A(H 04c0: 52 45 53 55 4c 54 29 3b 0d 0a 09 57 43 48 41 52 RESULT);...WCHAR 04d0: 2a 20 44 58 47 65 74 45 72 72 6f 72 44 65 73 63 * DXGetErrorDesc 04e0: 72 69 70 74 69 6f 6e 39 57 28 48 52 45 53 55 4c ription9W(HRESUL 04f0: 54 29 3b 0d 0a 09 48 52 45 53 55 4c 54 20 44 58 T);...HRESULT DX 0500: 54 72 61 63 65 41 28 63 68 61 72 2a 2c 20 44 57 TraceA(char*, DW 0510: 4f 52 44 2c 20 48 52 45 53 55 4c 54 2c 20 63 68 ORD, HRESULT, ch 0520: 61 72 2a 2c 20 42 4f 4f 4c 29 3b 0d 0a 09 48 52 ar*, BOOL);...HR 0530: 45 53 55 4c 54 20 44 58 54 72 61 63 65 57 28 63 ESULT DXTraceW(c 0540: 68 61 72 2a 2c 20 44 57 4f 52 44 2c 20 48 52 45 har*, DWORD, HRE 0550: 53 55 4c 54 2c 20 57 43 48 41 52 2a 2c 20 42 4f SULT, WCHAR*, BO 0560: 4f 4c 29 3b 0d 0a 7d 0d 0a 0d 0a 76 65 72 73 69 OL);..}....versi 0570: 6f 6e 20 28 55 6e 69 63 6f 64 65 29 20 7b 0d 0a on (Unicode) {.. 0580: 09 61 6c 69 61 73 20 44 58 47 65 74 45 72 72 6f .alias DXGetErro 0590: 72 53 74 72 69 6e 67 39 57 20 44 58 47 65 74 45 rString9W DXGetE 05a0: 72 72 6f 72 53 74 72 69 6e 67 39 3b 0d 0a 09 61 rrorString9;...a 05b0: 6c 69 61 73 20 44 58 47 65 74 45 72 72 6f 72 44 lias DXGetErrorD 05c0: 65 73 63 72 69 70 74 69 6f 6e 39 57 20 44 58 47 escription9W DXG 05d0: 65 74 45 72 72 6f 72 44 65 73 63 72 69 70 74 69 etErrorDescripti 05e0: 6f 6e 39 3b 0d 0a 09 61 6c 69 61 73 20 44 58 54 on9;...alias DXT 05f0: 72 61 63 65 57 20 44 58 54 72 61 63 65 3b 0d 0a raceW DXTrace;.. 0600: 7d 20 65 6c 73 65 20 7b 0d 0a 09 61 6c 69 61 73 } else {...alias 0610: 20 44 58 47 65 74 45 72 72 6f 72 53 74 72 69 6e DXGetErrorStrin 0620: 67 39 41 20 44 58 47 65 74 45 72 72 6f 72 53 74 g9A DXGetErrorSt 0630: 72 69 6e 67 39 3b 0d 0a 09 61 6c 69 61 73 20 44 ring9;...alias D 0640: 58 47 65 74 45 72 72 6f 72 44 65 73 63 72 69 70 XGetErrorDescrip 0650: 74 69 6f 6e 39 41 20 44 58 47 65 74 45 72 72 6f tion9A DXGetErro 0660: 72 44 65 73 63 72 69 70 74 69 6f 6e 39 3b 0d 0a rDescription9;.. 0670: 09 61 6c 69 61 73 20 44 58 54 72 61 63 65 41 20 .alias DXTraceA 0680: 44 58 54 72 61 63 65 3b 0d 0a 7d 0d 0a 0d 0a 64 DXTrace;..}....d 0690: 65 62 75 67 20 28 64 78 65 72 72 29 20 7b 0d 0a ebug (dxerr) {.. 06a0: 09 48 52 45 53 55 4c 54 20 44 58 54 52 41 43 45 .HRESULT DXTRACE 06b0: 5f 4d 53 47 28 54 43 48 41 52 2a 20 73 74 72 29 _MSG(TCHAR* str) 06c0: 20 7b 0d 0a 09 09 72 65 74 75 72 6e 20 44 58 54 {....return DXT 06d0: 72 61 63 65 28 5f 5f 46 49 4c 45 5f 5f 2c 20 63 race(__FILE__, c 06e0: 61 73 74 28 44 57 4f 52 44 29 5f 5f 4c 49 4e 45 ast(DWORD)__LINE 06f0: 5f 5f 2c 20 30 2c 20 73 74 72 2c 20 46 41 4c 53 __, 0, str, FALS 0700: 45 29 3b 0d 0a 09 7d 0d 0a 0d 0a 09 48 52 45 53 E);...}.....HRES 0710: 55 4c 54 20 44 58 54 52 41 43 45 5f 45 52 52 28 ULT DXTRACE_ERR( 0720: 54 43 48 41 52 2a 20 73 74 72 2c 20 48 52 45 53 TCHAR* str, HRES 0730: 55 4c 54 20 68 72 29 20 7b 0d 0a 09 09 72 65 74 ULT hr) {....ret 0740: 75 72 6e 20 44 58 54 72 61 63 65 28 5f 5f 46 49 urn DXTrace(__FI 0750: 4c 45 5f 5f 2c 20 63 61 73 74 28 44 57 4f 52 44 LE__, cast(DWORD 0760: 29 5f 5f 4c 49 4e 45 5f 5f 2c 20 68 72 2c 20 73 )__LINE__, hr, s 0770: 74 72 2c 20 46 41 4c 53 45 29 3b 0d 0a 09 7d 0d tr, FALSE);...}. 0780: 0a 0d 0a 09 48 52 45 53 55 4c 54 20 44 58 54 52 ....HRESULT DXTR 0790: 41 43 45 5f 45 52 52 5f 4e 4f 4d 53 47 42 4f 58 ACE_ERR_NOMSGBOX 07a0: 28 54 43 48 41 52 2a 20 73 74 72 2c 20 48 52 45 (TCHAR* str, HRE 07b0: 53 55 4c 54 20 68 72 29 20 7b 0d 0a 09 09 72 65 SULT hr) {....re 07c0: 74 75 72 6e 20 44 58 54 72 61 63 65 28 5f 5f 46 turn DXTrace(__F 07d0: 49 4c 45 5f 5f 2c 20 63 61 73 74 28 44 57 4f 52 ILE__, cast(DWOR 07e0: 44 29 5f 5f 4c 49 4e 45 5f 5f 2c 20 68 72 2c 20 D)__LINE__, hr, 07f0: 73 74 72 2c 20 54 52 55 45 29 3b 0d 0a 09 7d 0d str, TRUE);...}. 0800: 0a 7d 20 65 6c 73 65 20 7b 0d 0a 09 48 52 45 53 .} else {...HRES 0810: 55 4c 54 20 44 58 54 52 41 43 45 5f 4d 53 47 28 ULT DXTRACE_MSG( 0820: 54 43 48 41 52 2a 20 73 74 72 29 20 7b 0d 0a 09 TCHAR* str) {... 0830: 09 72 65 74 75 72 6e 20 30 3b 0d 0a 09 7d 0d 0a .return 0;...}.. 0840: 0d 0a 09 48 52 45 53 55 4c 54 20 44 58 54 52 41 ...HRESULT DXTRA 0850: 43 45 5f 45 52 52 28 54 43 48 41 52 2a 20 73 74 CE_ERR(TCHAR* st 0860: 72 2c 20 48 52 45 53 55 4c 54 20 68 72 29 20 7b r, HRESULT hr) { 0870: 0d 0a 09 09 72 65 74 75 72 6e 20 68 72 3b 0d 0a ....return hr;.. 0880: 09 7d 0d 0a 0d 0a 09 48 52 45 53 55 4c 54 20 44 .}.....HRESULT D 0890: 58 54 52 41 43 45 5f 45 52 52 5f 4e 4f 4d 53 47 XTRACE_ERR_NOMSG 08a0: 42 4f 58 28 54 43 48 41 52 2a 20 73 74 72 2c 20 BOX(TCHAR* str, 08b0: 48 52 45 53 55 4c 54 20 68 72 29 20 7b 0d 0a 09 HRESULT hr) {... 08c0: 09 72 65 74 75 72 6e 20 68 72 3b 0d 0a 09 7d 0d .return hr;...}. 08d0: 0a 7d 0d 0a .}..