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 | WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
---|
38 |
|
---|
39 | static int D3DPERF_event_level = 0;
|
---|
40 |
|
---|
41 | void WINAPI DebugSetMute(void) {
|
---|
42 | /* nothing to do */
|
---|
43 | }
|
---|
44 |
|
---|
45 | IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) {
|
---|
46 | IDirect3D9Impl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D9Impl));
|
---|
47 |
|
---|
48 | object->lpVtbl = &Direct3D9_Vtbl;
|
---|
49 | object->ref = 1;
|
---|
50 |
|
---|
51 | wined3d_mutex_lock();
|
---|
52 | object->WineD3D = WineDirect3DCreate(9, (IUnknown *)object);
|
---|
53 | wined3d_mutex_unlock();
|
---|
54 |
|
---|
55 | TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
|
---|
56 |
|
---|
57 | if (!object->WineD3D)
|
---|
58 | {
|
---|
59 | HeapFree( GetProcessHeap(), 0, object );
|
---|
60 | object = NULL;
|
---|
61 | }
|
---|
62 | return (IDirect3D9*) object;
|
---|
63 | }
|
---|
64 |
|
---|
65 | HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex **direct3d9ex) {
|
---|
66 | IDirect3D9 *ret;
|
---|
67 | IDirect3D9Impl* object;
|
---|
68 |
|
---|
69 | TRACE("Calling Direct3DCreate9\n");
|
---|
70 | ret = Direct3DCreate9(SDKVersion);
|
---|
71 | if(!ret) {
|
---|
72 | *direct3d9ex = NULL;
|
---|
73 | return D3DERR_NOTAVAILABLE;
|
---|
74 | }
|
---|
75 |
|
---|
76 | object = (IDirect3D9Impl *) ret;
|
---|
77 | object->extended = TRUE; /* Enables QI for extended interfaces */
|
---|
78 | *direct3d9ex = (IDirect3D9Ex *) object;
|
---|
79 | return D3D_OK;
|
---|
80 | }
|
---|
81 |
|
---|
82 | /*******************************************************************
|
---|
83 | * Direct3DShaderValidatorCreate9 (D3D9.@)
|
---|
84 | *
|
---|
85 | * No documentation available for this function.
|
---|
86 | * SDK only says it is internal and shouldn't be used.
|
---|
87 | */
|
---|
88 | void* WINAPI Direct3DShaderValidatorCreate9(void)
|
---|
89 | {
|
---|
90 | FIXME("stub\n");
|
---|
91 | return NULL;
|
---|
92 | }
|
---|
93 |
|
---|
94 | /*******************************************************************
|
---|
95 | * DllMain
|
---|
96 | */
|
---|
97 | BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
---|
98 | {
|
---|
99 | /* At process attach */
|
---|
100 | TRACE("fdwReason=%d\n", fdwReason);
|
---|
101 | if (fdwReason == DLL_PROCESS_ATTACH)
|
---|
102 | DisableThreadLibraryCalls(hInstDLL);
|
---|
103 |
|
---|
104 | return TRUE;
|
---|
105 | }
|
---|
106 |
|
---|
107 | /***********************************************************************
|
---|
108 | * D3DPERF_BeginEvent (D3D9.@)
|
---|
109 | */
|
---|
110 | int WINAPI D3DPERF_BeginEvent(D3DCOLOR color, LPCWSTR name) {
|
---|
111 | FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
|
---|
112 |
|
---|
113 | return D3DPERF_event_level++;
|
---|
114 | }
|
---|
115 |
|
---|
116 | /***********************************************************************
|
---|
117 | * D3DPERF_EndEvent (D3D9.@)
|
---|
118 | */
|
---|
119 | int WINAPI D3DPERF_EndEvent(void) {
|
---|
120 | FIXME("(void) : stub\n");
|
---|
121 |
|
---|
122 | return --D3DPERF_event_level;
|
---|
123 | }
|
---|
124 |
|
---|
125 | /***********************************************************************
|
---|
126 | * D3DPERF_GetStatus (D3D9.@)
|
---|
127 | */
|
---|
128 | DWORD WINAPI D3DPERF_GetStatus(void) {
|
---|
129 | FIXME("(void) : stub\n");
|
---|
130 |
|
---|
131 | return 0;
|
---|
132 | }
|
---|
133 |
|
---|
134 | /***********************************************************************
|
---|
135 | * D3DPERF_SetOptions (D3D9.@)
|
---|
136 | *
|
---|
137 | */
|
---|
138 | void WINAPI D3DPERF_SetOptions(DWORD options)
|
---|
139 | {
|
---|
140 | FIXME("(%#x) : stub\n", options);
|
---|
141 | }
|
---|
142 |
|
---|
143 | /***********************************************************************
|
---|
144 | * D3DPERF_QueryRepeatFrame (D3D9.@)
|
---|
145 | */
|
---|
146 | BOOL WINAPI D3DPERF_QueryRepeatFrame(void) {
|
---|
147 | FIXME("(void) : stub\n");
|
---|
148 |
|
---|
149 | return FALSE;
|
---|
150 | }
|
---|
151 |
|
---|
152 | /***********************************************************************
|
---|
153 | * D3DPERF_SetMarker (D3D9.@)
|
---|
154 | */
|
---|
155 | void WINAPI D3DPERF_SetMarker(D3DCOLOR color, LPCWSTR name) {
|
---|
156 | FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
|
---|
157 | }
|
---|
158 |
|
---|
159 | /***********************************************************************
|
---|
160 | * D3DPERF_SetRegion (D3D9.@)
|
---|
161 | */
|
---|
162 | void WINAPI D3DPERF_SetRegion(D3DCOLOR color, LPCWSTR name) {
|
---|
163 | FIXME("(color %#x, name %s) : stub\n", color, debugstr_w(name));
|
---|
164 | }
|
---|