1 | /*
|
---|
2 | * Direct3D 8
|
---|
3 | *
|
---|
4 | * Copyright 2005 Oliver Stieber
|
---|
5 | *
|
---|
6 | * This library is free software; you can redistribute it and/or
|
---|
7 | * modify it under the terms of the GNU Lesser General Public
|
---|
8 | * License as published by the Free Software Foundation; either
|
---|
9 | * version 2.1 of the License, or (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This library is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | * Lesser General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU Lesser General Public
|
---|
17 | * License along with this library; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
19 | *
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
24 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
25 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
26 | * a choice of LGPL license versions is made available with the language indicating
|
---|
27 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
28 | * of the LGPL is applied is otherwise unspecified.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #include "config.h"
|
---|
32 | #include "initguid.h"
|
---|
33 | #include "d3d8_private.h"
|
---|
34 | #include "wine/debug.h"
|
---|
35 |
|
---|
36 | static CRITICAL_SECTION_DEBUG d3d8_cs_debug =
|
---|
37 | {
|
---|
38 | 0, 0, &d3d8_cs,
|
---|
39 | { &d3d8_cs_debug.ProcessLocksList,
|
---|
40 | &d3d8_cs_debug.ProcessLocksList },
|
---|
41 | 0, 0, { (DWORD_PTR)(__FILE__ ": d3d8_cs") }
|
---|
42 | };
|
---|
43 | CRITICAL_SECTION d3d8_cs = { &d3d8_cs_debug, -1, 0, 0, 0, 0 };
|
---|
44 |
|
---|
45 | WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
---|
46 |
|
---|
47 | HRESULT WINAPI D3D8GetSWInfo(void) {
|
---|
48 | FIXME("(void): stub\n");
|
---|
49 | return 0;
|
---|
50 | }
|
---|
51 |
|
---|
52 | void WINAPI DebugSetMute(void) {
|
---|
53 | /* nothing to do */
|
---|
54 | }
|
---|
55 |
|
---|
56 | IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion) {
|
---|
57 | IDirect3D8Impl* object;
|
---|
58 | TRACE("SDKVersion = %x\n", SDKVersion);
|
---|
59 |
|
---|
60 | EnterCriticalSection(&d3d8_cs);
|
---|
61 | object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
|
---|
62 |
|
---|
63 | object->lpVtbl = &Direct3D8_Vtbl;
|
---|
64 | object->ref = 1;
|
---|
65 | object->WineD3D = WineDirect3DCreate(8, (IUnknown *)object);
|
---|
66 |
|
---|
67 | TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D);
|
---|
68 | LeaveCriticalSection(&d3d8_cs);
|
---|
69 |
|
---|
70 | if (!object->WineD3D)
|
---|
71 | {
|
---|
72 | HeapFree( GetProcessHeap(), 0, object );
|
---|
73 | object = NULL;
|
---|
74 | }
|
---|
75 | return (IDirect3D8*) object;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /* At process attach */
|
---|
79 | BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
---|
80 | {
|
---|
81 | TRACE("fdwReason=%d\n", fdwReason);
|
---|
82 | if (fdwReason == DLL_PROCESS_ATTACH)
|
---|
83 | DisableThreadLibraryCalls(hInstDLL);
|
---|
84 |
|
---|
85 | return TRUE;
|
---|
86 | }
|
---|
87 |
|
---|
88 | /***********************************************************************
|
---|
89 | * ValidateVertexShader (D3D8.@)
|
---|
90 | *
|
---|
91 | * I've seen reserved1 and reserved2 always passed as 0's
|
---|
92 | * bool seems always passed as 0 or 1, but other values work as well....
|
---|
93 | * toto result?
|
---|
94 | */
|
---|
95 | HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
|
---|
96 | {
|
---|
97 | HRESULT ret;
|
---|
98 | FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, bool, toto);
|
---|
99 |
|
---|
100 | if (!vertexshader)
|
---|
101 | return E_FAIL;
|
---|
102 |
|
---|
103 | if (reserved1 || reserved2)
|
---|
104 | return E_FAIL;
|
---|
105 |
|
---|
106 | switch(*vertexshader) {
|
---|
107 | case 0xFFFE0101:
|
---|
108 | case 0xFFFE0100:
|
---|
109 | ret=S_OK;
|
---|
110 | break;
|
---|
111 | default:
|
---|
112 | ERR("vertexshader version mismatch\n");
|
---|
113 | ret=E_FAIL;
|
---|
114 | }
|
---|
115 |
|
---|
116 | return ret;
|
---|
117 | }
|
---|
118 |
|
---|
119 | /***********************************************************************
|
---|
120 | * ValidatePixelShader (D3D8.@)
|
---|
121 | *
|
---|
122 | * PARAMS
|
---|
123 | * toto result?
|
---|
124 | */
|
---|
125 | HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
|
---|
126 | {
|
---|
127 | HRESULT ret;
|
---|
128 | FIXME("(%p %p %d %p): stub\n", pixelshader, reserved1, bool, toto);
|
---|
129 |
|
---|
130 | if (!pixelshader)
|
---|
131 | return E_FAIL;
|
---|
132 |
|
---|
133 | if (reserved1)
|
---|
134 | return E_FAIL;
|
---|
135 |
|
---|
136 | switch(*pixelshader) {
|
---|
137 | case 0xFFFF0100:
|
---|
138 | case 0xFFFF0101:
|
---|
139 | case 0xFFFF0102:
|
---|
140 | case 0xFFFF0103:
|
---|
141 | case 0xFFFF0104:
|
---|
142 | ret=S_OK;
|
---|
143 | break;
|
---|
144 | default:
|
---|
145 | ERR("pixelshader version mismatch\n");
|
---|
146 | ret=E_FAIL;
|
---|
147 | }
|
---|
148 | return ret;
|
---|
149 | }
|
---|