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 "d3d8_private.h"
24 HRESULT WINAPI
D3D8GetSWInfo(void) {
25 FIXME("(void): stub\n");
29 void WINAPI
DebugSetMute(void) {
33 IDirect3D8
* WINAPI DECLSPEC_HOTPATCH
Direct3DCreate8(UINT sdk_version
)
37 TRACE("sdk_version %#x.\n", sdk_version
);
39 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
42 if (!d3d8_init(object
))
44 WARN("Failed to initialize d3d8.\n");
45 HeapFree(GetProcessHeap(), 0, object
);
49 TRACE("Created d3d8 object %p.\n", object
);
51 return &object
->IDirect3D8_iface
;
54 /* At process attach */
55 BOOL WINAPI
DllMain(HINSTANCE inst
, DWORD reason
, void *reserved
)
57 if (reason
== DLL_PROCESS_ATTACH
)
58 DisableThreadLibraryCalls(inst
);
63 /***********************************************************************
64 * ValidateVertexShader (D3D8.@)
66 * I've seen reserved1 and reserved2 always passed as 0's
67 * bool seems always passed as 0 or 1, but other values work as well...
70 HRESULT WINAPI
ValidateVertexShader(DWORD
* vertexshader
, DWORD
* reserved1
, DWORD
* reserved2
, BOOL
bool, DWORD
* toto
)
75 if (TRACE_ON(d3d8
) || !warned
) {
76 FIXME("(%p %p %p %d %p): stub\n", vertexshader
, reserved1
, reserved2
, bool, toto
);
83 if (reserved1
|| reserved2
)
86 switch(*vertexshader
) {
92 WARN("Invalid shader version token %#x.\n", *vertexshader
);
99 /***********************************************************************
100 * ValidatePixelShader (D3D8.@)
105 HRESULT WINAPI
ValidatePixelShader(DWORD
* pixelshader
, DWORD
* reserved1
, BOOL
bool, DWORD
* toto
)
110 if (TRACE_ON(d3d8
) || !warned
) {
111 FIXME("(%p %p %d %p): stub\n", pixelshader
, reserved1
, bool, toto
);
121 switch(*pixelshader
) {
130 WARN("Invalid shader version token %#x.\n", *pixelshader
);
136 void d3d8_resource_cleanup(struct d3d8_resource
*resource
)
138 wined3d_private_store_cleanup(&resource
->private_store
);
141 HRESULT
d3d8_resource_free_private_data(struct d3d8_resource
*resource
, const GUID
*guid
)
143 struct wined3d_private_data
*entry
;
145 wined3d_mutex_lock();
146 entry
= wined3d_private_store_get_private_data(&resource
->private_store
, guid
);
149 wined3d_mutex_unlock();
150 return D3DERR_NOTFOUND
;
153 wined3d_private_store_free_private_data(&resource
->private_store
, entry
);
154 wined3d_mutex_unlock();
159 HRESULT
d3d8_resource_get_private_data(struct d3d8_resource
*resource
, const GUID
*guid
,
160 void *data
, DWORD
*data_size
)
162 const struct wined3d_private_data
*stored_data
;
166 wined3d_mutex_lock();
167 stored_data
= wined3d_private_store_get_private_data(&resource
->private_store
, guid
);
170 hr
= D3DERR_NOTFOUND
;
174 size_in
= *data_size
;
175 *data_size
= stored_data
->size
;
181 if (size_in
< stored_data
->size
)
183 hr
= D3DERR_MOREDATA
;
187 if (stored_data
->flags
& WINED3DSPD_IUNKNOWN
)
188 IUnknown_AddRef(stored_data
->content
.object
);
189 memcpy(data
, stored_data
->content
.data
, stored_data
->size
);
193 wined3d_mutex_unlock();
197 void d3d8_resource_init(struct d3d8_resource
*resource
)
199 resource
->refcount
= 1;
200 wined3d_private_store_init(&resource
->private_store
);
203 HRESULT
d3d8_resource_set_private_data(struct d3d8_resource
*resource
, const GUID
*guid
,
204 const void *data
, DWORD data_size
, DWORD flags
)
208 wined3d_mutex_lock();
209 hr
= wined3d_private_store_set_private_data(&resource
->private_store
, guid
, data
, data_size
, flags
);
210 wined3d_mutex_unlock();