wined3d: Don't call directly into the state table.
[wine.git] / dlls / d3d8 / d3d8_main.c
blobc471049714bf26bf76c77fe730c8417109cfb135
1 /*
2 * Direct3D 8
4 * Copyright 2005 Oliver Stieber
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.
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.
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
22 #include "config.h"
23 #include "initguid.h"
24 #include "d3d8_private.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
29 HRESULT WINAPI D3D8GetSWInfo(void) {
30 FIXME("(void): stub\n");
31 return 0;
34 void WINAPI DebugSetMute(void) {
35 /* nothing to do */
38 IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT SDKVersion) {
39 IDirect3D8Impl* object;
40 TRACE("SDKVersion = %x\n", SDKVersion);
42 wined3d_mutex_lock();
44 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
46 object->lpVtbl = &Direct3D8_Vtbl;
47 object->ref = 1;
48 object->WineD3D = WineDirect3DCreate(8, (IUnknown *)object);
50 TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D);
52 wined3d_mutex_unlock();
54 if (!object->WineD3D)
56 HeapFree( GetProcessHeap(), 0, object );
57 object = NULL;
59 return (IDirect3D8*) object;
62 /* At process attach */
63 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
65 TRACE("fdwReason=%d\n", fdwReason);
66 if (fdwReason == DLL_PROCESS_ATTACH)
67 DisableThreadLibraryCalls(hInstDLL);
69 return TRUE;
72 /***********************************************************************
73 * ValidateVertexShader (D3D8.@)
75 * I've seen reserved1 and reserved2 always passed as 0's
76 * bool seems always passed as 0 or 1, but other values work as well...
77 * toto result?
79 HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
81 HRESULT ret;
82 static BOOL warned;
84 if (TRACE_ON(d3d8) || !warned) {
85 FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, bool, toto);
86 warned = TRUE;
89 if (!vertexshader)
90 return E_FAIL;
92 if (reserved1 || reserved2)
93 return E_FAIL;
95 switch(*vertexshader) {
96 case 0xFFFE0101:
97 case 0xFFFE0100:
98 ret=S_OK;
99 break;
100 default:
101 ERR("vertexshader version mismatch\n");
102 ret=E_FAIL;
105 return ret;
108 /***********************************************************************
109 * ValidatePixelShader (D3D8.@)
111 * PARAMS
112 * toto result?
114 HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
116 HRESULT ret;
117 static BOOL warned;
119 if (TRACE_ON(d3d8) || !warned) {
120 FIXME("(%p %p %d %p): stub\n", pixelshader, reserved1, bool, toto);
121 warned = TRUE;
124 if (!pixelshader)
125 return E_FAIL;
127 if (reserved1)
128 return E_FAIL;
130 switch(*pixelshader) {
131 case 0xFFFF0100:
132 case 0xFFFF0101:
133 case 0xFFFF0102:
134 case 0xFFFF0103:
135 case 0xFFFF0104:
136 ret=S_OK;
137 break;
138 default:
139 ERR("pixelshader version mismatch\n");
140 ret=E_FAIL;
142 return ret;