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
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");
34 void WINAPI
DebugSetMute(void) {
38 IDirect3D8
* WINAPI DECLSPEC_HOTPATCH
Direct3DCreate8(UINT sdk_version
)
42 TRACE("sdk_version %#x.\n", sdk_version
);
44 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
47 if (!d3d8_init(object
))
49 WARN("Failed to initialize d3d8.\n");
50 HeapFree(GetProcessHeap(), 0, object
);
54 TRACE("Created d3d8 object %p.\n", object
);
56 return &object
->IDirect3D8_iface
;
59 /***********************************************************************
60 * ValidateVertexShader (D3D8.@)
62 * I've seen reserved1 and reserved2 always passed as 0's
63 * bool seems always passed as 0 or 1, but other values work as well...
66 HRESULT WINAPI
ValidateVertexShader(DWORD
* vertexshader
, DWORD
* reserved1
, DWORD
* reserved2
, BOOL
bool, DWORD
* toto
)
71 if (TRACE_ON(d3d8
) || !warned
) {
72 FIXME("(%p %p %p %d %p): stub\n", vertexshader
, reserved1
, reserved2
, bool, toto
);
79 if (reserved1
|| reserved2
)
82 switch(*vertexshader
) {
88 WARN("Invalid shader version token %#x.\n", *vertexshader
);
95 /***********************************************************************
96 * ValidatePixelShader (D3D8.@)
101 HRESULT WINAPI
ValidatePixelShader(DWORD
* pixelshader
, DWORD
* reserved1
, BOOL
bool, DWORD
* toto
)
106 if (TRACE_ON(d3d8
) || !warned
) {
107 FIXME("(%p %p %d %p): stub\n", pixelshader
, reserved1
, bool, toto
);
117 switch(*pixelshader
) {
126 WARN("Invalid shader version token %#x.\n", *pixelshader
);
132 void d3d8_resource_cleanup(struct d3d8_resource
*resource
)
134 wined3d_private_store_cleanup(&resource
->private_store
);
137 HRESULT
d3d8_resource_free_private_data(struct d3d8_resource
*resource
, const GUID
*guid
)
139 struct wined3d_private_data
*entry
;
141 wined3d_mutex_lock();
142 entry
= wined3d_private_store_get_private_data(&resource
->private_store
, guid
);
145 wined3d_mutex_unlock();
146 return D3DERR_NOTFOUND
;
149 wined3d_private_store_free_private_data(&resource
->private_store
, entry
);
150 wined3d_mutex_unlock();
155 HRESULT
d3d8_resource_get_private_data(struct d3d8_resource
*resource
, const GUID
*guid
,
156 void *data
, DWORD
*data_size
)
158 const struct wined3d_private_data
*stored_data
;
162 wined3d_mutex_lock();
163 stored_data
= wined3d_private_store_get_private_data(&resource
->private_store
, guid
);
166 hr
= D3DERR_NOTFOUND
;
170 size_in
= *data_size
;
171 *data_size
= stored_data
->size
;
177 if (size_in
< stored_data
->size
)
179 hr
= D3DERR_MOREDATA
;
183 if (stored_data
->flags
& WINED3DSPD_IUNKNOWN
)
184 IUnknown_AddRef(stored_data
->content
.object
);
185 memcpy(data
, stored_data
->content
.data
, stored_data
->size
);
189 wined3d_mutex_unlock();
193 void d3d8_resource_init(struct d3d8_resource
*resource
)
195 resource
->refcount
= 1;
196 wined3d_private_store_init(&resource
->private_store
);
199 HRESULT
d3d8_resource_set_private_data(struct d3d8_resource
*resource
, const GUID
*guid
,
200 const void *data
, DWORD data_size
, DWORD flags
)
204 wined3d_mutex_lock();
205 hr
= wined3d_private_store_set_private_data(&resource
->private_store
, guid
, data
, data_size
, flags
);
206 wined3d_mutex_unlock();