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 | WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
---|
37 |
|
---|
38 | HRESULT WINAPI D3D8GetSWInfo(void) {
|
---|
39 | FIXME("(void): stub\n");
|
---|
40 | return 0;
|
---|
41 | }
|
---|
42 |
|
---|
43 | void WINAPI DebugSetMute(void) {
|
---|
44 | /* nothing to do */
|
---|
45 | }
|
---|
46 |
|
---|
47 | IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT SDKVersion) {
|
---|
48 | IDirect3D8Impl* object;
|
---|
49 | TRACE("SDKVersion = %x\n", SDKVersion);
|
---|
50 |
|
---|
51 | wined3d_mutex_lock();
|
---|
52 |
|
---|
53 | object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
|
---|
54 |
|
---|
55 | object->lpVtbl = &Direct3D8_Vtbl;
|
---|
56 | object->ref = 1;
|
---|
57 | object->WineD3D = WineDirect3DCreate(8, (IUnknown *)object);
|
---|
58 |
|
---|
59 | TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D);
|
---|
60 |
|
---|
61 | wined3d_mutex_unlock();
|
---|
62 |
|
---|
63 | if (!object->WineD3D)
|
---|
64 | {
|
---|
65 | HeapFree( GetProcessHeap(), 0, object );
|
---|
66 | object = NULL;
|
---|
67 | }
|
---|
68 | return (IDirect3D8*) object;
|
---|
69 | }
|
---|
70 |
|
---|
71 | /* At process attach */
|
---|
72 | BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
---|
73 | {
|
---|
74 | TRACE("fdwReason=%d\n", fdwReason);
|
---|
75 | if (fdwReason == DLL_PROCESS_ATTACH)
|
---|
76 | DisableThreadLibraryCalls(hInstDLL);
|
---|
77 |
|
---|
78 | return TRUE;
|
---|
79 | }
|
---|
80 |
|
---|
81 | /***********************************************************************
|
---|
82 | * ValidateVertexShader (D3D8.@)
|
---|
83 | *
|
---|
84 | * I've seen reserved1 and reserved2 always passed as 0's
|
---|
85 | * bool seems always passed as 0 or 1, but other values work as well...
|
---|
86 | * toto result?
|
---|
87 | */
|
---|
88 | HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
|
---|
89 | {
|
---|
90 | HRESULT ret;
|
---|
91 | static BOOL warned;
|
---|
92 |
|
---|
93 | if (TRACE_ON(d3d8) || !warned) {
|
---|
94 | FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, bool, toto);
|
---|
95 | warned = TRUE;
|
---|
96 | }
|
---|
97 |
|
---|
98 | if (!vertexshader)
|
---|
99 | return E_FAIL;
|
---|
100 |
|
---|
101 | if (reserved1 || reserved2)
|
---|
102 | return E_FAIL;
|
---|
103 |
|
---|
104 | switch(*vertexshader) {
|
---|
105 | case 0xFFFE0101:
|
---|
106 | case 0xFFFE0100:
|
---|
107 | ret=S_OK;
|
---|
108 | break;
|
---|
109 | default:
|
---|
110 | ERR("vertexshader version mismatch\n");
|
---|
111 | ret=E_FAIL;
|
---|
112 | }
|
---|
113 |
|
---|
114 | return ret;
|
---|
115 | }
|
---|
116 |
|
---|
117 | /***********************************************************************
|
---|
118 | * ValidatePixelShader (D3D8.@)
|
---|
119 | *
|
---|
120 | * PARAMS
|
---|
121 | * toto result?
|
---|
122 | */
|
---|
123 | HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
|
---|
124 | {
|
---|
125 | HRESULT ret;
|
---|
126 | static BOOL warned;
|
---|
127 |
|
---|
128 | if (TRACE_ON(d3d8) || !warned) {
|
---|
129 | FIXME("(%p %p %d %p): stub\n", pixelshader, reserved1, bool, toto);
|
---|
130 | warned = TRUE;
|
---|
131 | }
|
---|
132 |
|
---|
133 | if (!pixelshader)
|
---|
134 | return E_FAIL;
|
---|
135 |
|
---|
136 | if (reserved1)
|
---|
137 | return E_FAIL;
|
---|
138 |
|
---|
139 | switch(*pixelshader) {
|
---|
140 | case 0xFFFF0100:
|
---|
141 | case 0xFFFF0101:
|
---|
142 | case 0xFFFF0102:
|
---|
143 | case 0xFFFF0103:
|
---|
144 | case 0xFFFF0104:
|
---|
145 | ret=S_OK;
|
---|
146 | break;
|
---|
147 | default:
|
---|
148 | ERR("pixelshader version mismatch\n");
|
---|
149 | ret=E_FAIL;
|
---|
150 | }
|
---|
151 | return ret;
|
---|
152 | }
|
---|