ReactOS  0.4.14-dev-49-gfb4591c
d3d9.c File Reference
#include <d3d9.h>
#include "d3d9_helpers.h"
#include "d3d9_create.h"
#include <debug.h>
Include dependency graph for d3d9.c:

Go to the source code of this file.

Macros

#define DEBUG_MESSAGE_BUFFER_SIZE   512
 

Typedefs

typedef IDirect3D9 *(WINAPILPDIRECT3DCREATE9) (UINT)
 

Functions

HRESULT WINAPI Direct3DShaderValidatorCreate9 (void)
 
HRESULT WINAPI PSGPError (void)
 
HRESULT WINAPI PSGPSampleTexture (void)
 
HRESULT WINAPI DebugSetLevel (void)
 
HRESULT WINAPI DebugSetMute (DWORD dw1)
 
IDirect3D9 *WINAPI Direct3DCreate9 (UINT SDKVersion)
 
BOOL APIENTRY DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
 

Variables

static LPCSTR D3dError_WrongSdkVersion
 

Macro Definition Documentation

◆ DEBUG_MESSAGE_BUFFER_SIZE

#define DEBUG_MESSAGE_BUFFER_SIZE   512

Definition at line 15 of file d3d9.c.

Typedef Documentation

◆ LPDIRECT3DCREATE9

typedef IDirect3D9*(WINAPI * LPDIRECT3DCREATE9) (UINT)

Definition at line 17 of file d3d9.c.

Function Documentation

◆ DebugSetLevel()

HRESULT WINAPI DebugSetLevel ( void  )

Definition at line 45 of file d3d9.c.

46 {
48  return 0;
49 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ DebugSetMute()

HRESULT WINAPI DebugSetMute ( DWORD  dw1)

Definition at line 51 of file d3d9.c.

52 {
54  return 0;
55 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ Direct3DCreate9()

IDirect3D9* WINAPI Direct3DCreate9 ( UINT  SDKVersion)

Definition at line 57 of file d3d9.c.

58 {
59  HINSTANCE hDebugDll;
60  DWORD LoadDebugDll;
61  DWORD LoadDebugDllSize;
62  LPDIRECT3D9 D3D9Obj = 0;
63  LPDIRECT3DCREATE9 DebugDirect3DCreate9 = 0;
64  CHAR DebugMessageBuffer[DEBUG_MESSAGE_BUFFER_SIZE];
65  UINT NoDebugSDKVersion = SDKVersion & ~DX_D3D9_DEBUG;
66 
67  LoadDebugDllSize = sizeof(LoadDebugDll);
68  if (ReadRegistryValue(REG_DWORD, "LoadDebugRuntime", (LPBYTE)&LoadDebugDll, &LoadDebugDllSize))
69  {
70  if (0 != LoadDebugDll)
71  {
72  hDebugDll = LoadLibraryA("d3d9d.dll");
73 
74  if (0 != hDebugDll)
75  {
76  DebugDirect3DCreate9 = (LPDIRECT3DCREATE9)GetProcAddress(hDebugDll, "Direct3DCreate9");
77 
78  return DebugDirect3DCreate9(SDKVersion);
79  }
80  }
81  }
82 
83  if (NoDebugSDKVersion != D3D_SDK_VERSION && NoDebugSDKVersion != D3D9b_SDK_VERSION)
84  {
85  if (SDKVersion & DX_D3D9_DEBUG)
86  {
87  HRESULT hResult;
88  hResult = SafeFormatString(DebugMessageBuffer, DEBUG_MESSAGE_BUFFER_SIZE, D3dError_WrongSdkVersion, NoDebugSDKVersion, D3D_SDK_VERSION);
89  if (SUCCEEDED(hResult))
90  OutputDebugStringA(DebugMessageBuffer);
91  }
92 
93  return NULL;
94  }
95 
96  CreateD3D9(&D3D9Obj, SDKVersion);
97 
98  return D3D9Obj;
99 }
IDirect3D9 *(WINAPI * LPDIRECT3DCREATE9)(UINT)
Definition: d3d9.c:17
#define DX_D3D9_DEBUG
Definition: d3d9_common.h:15
char CHAR
Definition: xmlstorage.h:175
struct IDirect3D9 * LPDIRECT3D9
Definition: d3d9.h:124
unsigned char * LPBYTE
Definition: typedefs.h:52
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
HRESULT CreateD3D9(OUT LPDIRECT3D9 *ppDirect3D9, UINT SDKVersion)
Definition: d3d9_create.c:237
smooth NULL
Definition: ftsmooth.c:416
#define DEBUG_MESSAGE_BUFFER_SIZE
Definition: d3d9.c:15
#define D3D_SDK_VERSION
Definition: d3d8.h:56
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataBuffer, IN OUT LPDWORD DataBufferSize)
Definition: d3d9_helpers.c:19
HRESULT SafeFormatString(OUT LPSTR Buffer, IN DWORD BufferSize, IN LPCSTR FormatString,...)
Definition: d3d9_helpers.c:41
unsigned int UINT
Definition: ndis.h:50
#define GetProcAddress(x, y)
Definition: compat.h:410
static LPCSTR D3dError_WrongSdkVersion
Definition: d3d9.c:19
#define REG_DWORD
Definition: sdbapi.c:596
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
Definition: ignoredbgout.c:18
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by fill_display_information_d3d().

◆ Direct3DShaderValidatorCreate9()

HRESULT WINAPI Direct3DShaderValidatorCreate9 ( void  )

Definition at line 27 of file d3d9.c.

28 {
30  return 0;
31 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ DllMain()

BOOL APIENTRY DllMain ( HANDLE  hModule,
DWORD  ul_reason_for_call,
LPVOID  lpReserved 
)

Definition at line 101 of file d3d9.c.

102 {
103  switch (ul_reason_for_call)
104  {
105  case DLL_PROCESS_ATTACH:
106  case DLL_THREAD_ATTACH:
107  case DLL_THREAD_DETACH:
108  case DLL_PROCESS_DETACH:
109  break;
110  }
111 
112  return TRUE;
113 }
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_THREAD_DETACH
Definition: compat.h:122
#define DLL_PROCESS_DETACH
Definition: compat.h:119

◆ PSGPError()

HRESULT WINAPI PSGPError ( void  )

Definition at line 33 of file d3d9.c.

34 {
36  return 0;
37 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ PSGPSampleTexture()

HRESULT WINAPI PSGPSampleTexture ( void  )

Definition at line 39 of file d3d9.c.

40 {
42  return 0;
43 }
#define UNIMPLEMENTED
Definition: debug.h:114

Variable Documentation

◆ D3dError_WrongSdkVersion

LPCSTR D3dError_WrongSdkVersion
static
Initial value:
=
"D3D ERROR: D3D header version mismatch.\n"
"The application was compiled against and will only work with "
"D3D_SDK_VERSION (%d), but the currently installed runtime is "
"version (%d).\n"
"Recompile the application against the appropriate SDK for the installed runtime.\n"
"\n"

Definition at line 19 of file d3d9.c.

Referenced by Direct3DCreate9().