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 | /*
|
---|
25 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
26 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
27 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
28 | * a choice of LGPL license versions is made available with the language indicating
|
---|
29 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
30 | * of the LGPL is applied is otherwise unspecified.
|
---|
31 | */
|
---|
32 |
|
---|
33 | #include "config.h"
|
---|
34 | #include "initguid.h"
|
---|
35 | #include "d3d9_private.h"
|
---|
36 |
|
---|
37 | static CRITICAL_SECTION_DEBUG d3d9_cs_debug =
|
---|
38 | {
|
---|
39 | 0, 0, &d3d9_cs,
|
---|
40 | { &d3d9_cs_debug.ProcessLocksList,
|
---|
41 | &d3d9_cs_debug.ProcessLocksList },
|
---|
42 | 0, 0, { (DWORD_PTR)(__FILE__ ": d3d9_cs") }
|
---|
43 | };
|
---|
44 | CRITICAL_SECTION d3d9_cs = { &d3d9_cs_debug, -1, 0, 0, 0, 0 };
|
---|
45 |
|
---|
46 | WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
---|
47 |
|
---|
48 | static int D3DPERF_event_level = 0;
|
---|
49 |
|
---|
50 | void WINAPI DebugSetMute(void) {
|
---|
51 | /* nothing to do */
|
---|
52 | }
|
---|
53 |
|
---|
54 | IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) {
|
---|
55 | IDirect3D9Impl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D9Impl));
|
---|
56 |
|
---|
57 | object->lpVtbl = &Direct3D9_Vtbl;
|
---|
58 | object->ref = 1;
|
---|
59 | EnterCriticalSection(&d3d9_cs);
|
---|
60 | object->WineD3D = WineDirect3DCreate(9, (IUnknown *)object);
|
---|
61 | LeaveCriticalSection(&d3d9_cs);
|
---|
62 |
|
---|
63 | TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
|
---|
64 |
|
---|
65 | if (!object->WineD3D)
|
---|
66 | {
|
---|
67 | HeapFree( GetProcessHeap(), 0, object );
|
---|
68 | object = NULL;
|
---|
69 | }
|
---|
70 | return (IDirect3D9*) object;
|
---|
71 | }
|
---|
72 |
|
---|
73 | HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex **direct3d9ex) {
|
---|
74 | IDirect3D9 *ret;
|
---|
75 | IDirect3D9Impl* object;
|
---|
76 |
|
---|
77 | TRACE("Calling Direct3DCreate9\n");
|
---|
78 | ret = Direct3DCreate9(SDKVersion);
|
---|
79 | if(!ret) {
|
---|
80 | *direct3d9ex = NULL;
|
---|
81 | return D3DERR_NOTAVAILABLE;
|
---|
82 | }
|
---|
83 |
|
---|
84 | object = (IDirect3D9Impl *) ret;
|
---|
85 | object->extended = TRUE; /* Enables QI for extended interfaces */
|
---|
86 | *direct3d9ex = (IDirect3D9Ex *) object;
|
---|
87 | return D3D_OK;
|
---|
88 | }
|
---|
89 |
|
---|
90 | /*******************************************************************
|
---|
91 | * Direct3DShaderValidatorCreate9 (D3D9.@)
|
---|
92 | *
|
---|
93 | * No documentation available for this function.
|
---|
94 | * SDK only says it is internal and shouldn't be used.
|
---|
95 | */
|
---|
96 | void* WINAPI Direct3DShaderValidatorCreate9(void)
|
---|
97 | {
|
---|
98 | FIXME("stub\n");
|
---|
99 | return NULL;
|
---|
100 | }
|
---|
101 |
|
---|
102 | /*******************************************************************
|
---|
103 | * DllMain
|
---|
104 | */
|
---|
105 | BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
---|
106 | {
|
---|
107 | /* At process attach */
|
---|
108 | TRACE("fdwReason=%d\n", fdwReason);
|
---|
109 | if (fdwReason == DLL_PROCESS_ATTACH)
|
---|
110 | DisableThreadLibraryCalls(hInstDLL);
|
---|
111 |
|
---|
112 | return TRUE;
|
---|
113 | }
|
---|
114 |
|
---|
115 | /***********************************************************************
|
---|
116 | * D3DPERF_BeginEvent (D3D9.@)
|
---|
117 | */
|
---|
118 | int WINAPI D3DPERF_BeginEvent(D3DCOLOR color, LPCWSTR name) {
|
---|
119 | FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
|
---|
120 |
|
---|
121 | return D3DPERF_event_level++;
|
---|
122 | }
|
---|
123 |
|
---|
124 | /***********************************************************************
|
---|
125 | * D3DPERF_EndEvent (D3D9.@)
|
---|
126 | */
|
---|
127 | int WINAPI D3DPERF_EndEvent(void) {
|
---|
128 | FIXME("(void) : stub\n");
|
---|
129 |
|
---|
130 | return --D3DPERF_event_level;
|
---|
131 | }
|
---|
132 |
|
---|
133 | /***********************************************************************
|
---|
134 | * D3DPERF_GetStatus (D3D9.@)
|
---|
135 | */
|
---|
136 | DWORD WINAPI D3DPERF_GetStatus(void) {
|
---|
137 | FIXME("(void) : stub\n");
|
---|
138 |
|
---|
139 | return 0;
|
---|
140 | }
|
---|
141 |
|
---|
142 | /***********************************************************************
|
---|
143 | * D3DPERF_SetOptions (D3D9.@)
|
---|
144 | *
|
---|
145 | */
|
---|
146 | void WINAPI D3DPERF_SetOptions(DWORD options)
|
---|
147 | {
|
---|
148 | FIXME("(%#x) : stub\n", options);
|
---|
149 | }
|
---|
150 |
|
---|
151 | /***********************************************************************
|
---|
152 | * D3DPERF_QueryRepeatFrame (D3D9.@)
|
---|
153 | */
|
---|
154 | BOOL WINAPI D3DPERF_QueryRepeatFrame(void) {
|
---|
155 | FIXME("(void) : stub\n");
|
---|
156 |
|
---|
157 | return FALSE;
|
---|
158 | }
|
---|
159 |
|
---|
160 | /***********************************************************************
|
---|
161 | * D3DPERF_SetMarker (D3D9.@)
|
---|
162 | */
|
---|
163 | void WINAPI D3DPERF_SetMarker(D3DCOLOR color, LPCWSTR name) {
|
---|
164 | FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
|
---|
165 | }
|
---|
166 |
|
---|
167 | /***********************************************************************
|
---|
168 | * D3DPERF_SetRegion (D3D9.@)
|
---|
169 | */
|
---|
170 | void WINAPI D3DPERF_SetRegion(D3DCOLOR color, LPCWSTR name) {
|
---|
171 | FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
|
---|
172 | }
|
---|