2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS ReactX
4 * FILE: dll/directx/d3d9/d3d9.c
5 * PURPOSE: d3d9.dll implementation
6 * PROGRAMERS: Magnus Olsen <greatlrd (at) reactos (dot) org>
7 * Gregor Brunmar <gregor (dot) brunmar (at) home (dot) se>
11 #include "d3d9_private.h"
12 #include "d3d9_helpers.h"
16 #define DEBUG_MESSAGE_BUFFER_SIZE 512
18 static LPCSTR D3dError_WrongSdkVersion
=
19 "D3D ERROR: D3D header version mismatch.\n"
20 "The application was compiled against and will only work with "
21 "D3D_SDK_VERSION (%d), but the currently installed runtime is "
23 "Recompile the application against the appropriate SDK for the installed runtime.\n"
26 HRESULT
Direct3DShaderValidatorCreate9(void)
32 HRESULT
PSGPError(void)
38 HRESULT
PSGPSampleTexture(void)
44 HRESULT
DebugSetLevel(void)
50 HRESULT
DebugSetMute(DWORD dw1
)
56 IDirect3D9
* WINAPI
Direct3DCreate9(UINT SDKVersion
)
60 DWORD LoadDebugDllSize
;
61 LPDIRECT3D9 D3D9Obj
= 0;
62 LPDIRECT3DCREATE9 DebugDirect3DCreate9
= 0;
63 CHAR DebugMessageBuffer
[DEBUG_MESSAGE_BUFFER_SIZE
];
64 UINT NoDebugSDKVersion
= SDKVersion
& 0x7FFFFFFF;
68 LoadDebugDllSize
= sizeof(LoadDebugDll
);
69 if (ReadRegistryValue(REG_DWORD
, "LoadDebugRuntime", (LPBYTE
)&LoadDebugDll
, &LoadDebugDllSize
))
71 if (0 != LoadDebugDll
)
73 hDebugDll
= LoadLibrary("d3d9d.dll");
77 DebugDirect3DCreate9
= (LPDIRECT3DCREATE9
)GetProcAddress(hDebugDll
, "Direct3DCreate9");
79 return DebugDirect3DCreate9(SDKVersion
);
84 if (NoDebugSDKVersion
!= D3D_SDK_VERSION
&& NoDebugSDKVersion
!= D3D9b_SDK_VERSION
)
86 if (SDKVersion
& 0x80000000)
88 FormatDebugString(DebugMessageBuffer
, DEBUG_MESSAGE_BUFFER_SIZE
, D3dError_WrongSdkVersion
, NoDebugSDKVersion
, D3D_SDK_VERSION
);
89 OutputDebugStringA(DebugMessageBuffer
);
100 BOOL APIENTRY
DllMain(HANDLE hModule
, DWORD ul_reason_for_call
, LPVOID lpReserved
)
102 switch (ul_reason_for_call
)
104 case DLL_PROCESS_ATTACH
:
105 case DLL_THREAD_ATTACH
:
106 case DLL_THREAD_DETACH
:
107 case DLL_PROCESS_DETACH
: