0d3ecec99d471d88685dc42c0f7686de6a784f4e
[reactos.git] / reactos / dll / directx / wine / d3d9 / d3d9_main.c
1 /*
2 * Direct3D 9
3 *
4 * Copyright 2002-2003 Jason Edmeades
5 * Copyright 2002-2003 Raphael Junqueira
6 * Copyright 2005 Oliver Stieber
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 *
22 */
23
24 #include "config.h"
25 #include "initguid.h"
26 #include "d3d9_private.h"
27
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
29
30 static int D3DPERF_event_level = 0;
31
32 void WINAPI DebugSetMute(void) {
33 /* nothing to do */
34 }
35
36 IDirect3D9* WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT SDKVersion) {
37 IDirect3D9Impl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D9Impl));
38
39 object->IDirect3D9Ex_iface.lpVtbl = &Direct3D9_Vtbl;
40 object->ref = 1;
41
42 wined3d_mutex_lock();
43 object->WineD3D = wined3d_create(9, object);
44 wined3d_mutex_unlock();
45
46 TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
47
48 if (!object->WineD3D)
49 {
50 HeapFree( GetProcessHeap(), 0, object );
51 object = NULL;
52 }
53 return (IDirect3D9*) object;
54 }
55
56 HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex **direct3d9ex) {
57 IDirect3D9 *ret;
58 IDirect3D9Impl* object;
59
60 TRACE("Calling Direct3DCreate9\n");
61 ret = Direct3DCreate9(SDKVersion);
62 if(!ret) {
63 *direct3d9ex = NULL;
64 return D3DERR_NOTAVAILABLE;
65 }
66
67 object = (IDirect3D9Impl *) ret;
68 object->extended = TRUE; /* Enables QI for extended interfaces */
69 *direct3d9ex = &object->IDirect3D9Ex_iface;
70 return D3D_OK;
71 }
72
73 /*******************************************************************
74 * Direct3DShaderValidatorCreate9 (D3D9.@)
75 *
76 * No documentation available for this function.
77 * SDK only says it is internal and shouldn't be used.
78 */
79 void* WINAPI Direct3DShaderValidatorCreate9(void)
80 {
81 static int once;
82
83 if (!once++) FIXME("stub\n");
84 return NULL;
85 }
86
87 /*******************************************************************
88 * DllMain
89 */
90 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
91 {
92 /* At process attach */
93 TRACE("fdwReason=%d\n", fdwReason);
94 if (fdwReason == DLL_PROCESS_ATTACH)
95 DisableThreadLibraryCalls(hInstDLL);
96
97 return TRUE;
98 }
99
100 /***********************************************************************
101 * D3DPERF_BeginEvent (D3D9.@)
102 */
103 int WINAPI D3DPERF_BeginEvent(D3DCOLOR color, LPCWSTR name) {
104 TRACE("(color %#x, name %s) : stub\n", color, debugstr_w(name));
105
106 return D3DPERF_event_level++;
107 }
108
109 /***********************************************************************
110 * D3DPERF_EndEvent (D3D9.@)
111 */
112 int WINAPI D3DPERF_EndEvent(void) {
113 TRACE("(void) : stub\n");
114
115 return --D3DPERF_event_level;
116 }
117
118 /***********************************************************************
119 * D3DPERF_GetStatus (D3D9.@)
120 */
121 DWORD WINAPI D3DPERF_GetStatus(void) {
122 FIXME("(void) : stub\n");
123
124 return 0;
125 }
126
127 /***********************************************************************
128 * D3DPERF_SetOptions (D3D9.@)
129 *
130 */
131 void WINAPI D3DPERF_SetOptions(DWORD options)
132 {
133 FIXME("(%#x) : stub\n", options);
134 }
135
136 /***********************************************************************
137 * D3DPERF_QueryRepeatFrame (D3D9.@)
138 */
139 BOOL WINAPI D3DPERF_QueryRepeatFrame(void) {
140 FIXME("(void) : stub\n");
141
142 return FALSE;
143 }
144
145 /***********************************************************************
146 * D3DPERF_SetMarker (D3D9.@)
147 */
148 void WINAPI D3DPERF_SetMarker(D3DCOLOR color, LPCWSTR name) {
149 FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
150 }
151
152 /***********************************************************************
153 * D3DPERF_SetRegion (D3D9.@)
154 */
155 void WINAPI D3DPERF_SetRegion(D3DCOLOR color, LPCWSTR name) {
156 FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
157 }