2 * Copyright 2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/port.h"
23 #include "d3d10core_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
27 static HRESULT shdr_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
29 const DWORD **shader_data = ctx;
35 *shader_data = (const DWORD *)data;
39 memcpy(tag_str, &tag, 4);
41 FIXME("Unhandled chunk %s\n", tag_str);
46 HRESULT shader_extract_from_dxbc(const void *dxbc, SIZE_T dxbc_length, const DWORD **shader_code)
50 hr = parse_dxbc(dxbc, dxbc_length, shdr_handler, shader_code);
51 if (!*shader_code) hr = E_FAIL;
53 if (FAILED(hr)) ERR("Failed to parse shader, hr %#x\n", hr);
58 /* IUnknown methods */
60 static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_QueryInterface(ID3D10VertexShader *iface,
61 REFIID riid, void **object)
63 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
65 if (IsEqualGUID(riid, &IID_ID3D10VertexShader)
66 || IsEqualGUID(riid, &IID_ID3D10DeviceChild)
67 || IsEqualGUID(riid, &IID_IUnknown))
69 IUnknown_AddRef(iface);
74 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
80 static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_AddRef(ID3D10VertexShader *iface)
82 struct d3d10_vertex_shader *This = (struct d3d10_vertex_shader *)iface;
83 ULONG refcount = InterlockedIncrement(&This->refcount);
85 TRACE("%p increasing refcount to %u\n", This, refcount);
90 static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_Release(ID3D10VertexShader *iface)
92 struct d3d10_vertex_shader *This = (struct d3d10_vertex_shader *)iface;
93 ULONG refcount = InterlockedDecrement(&This->refcount);
95 TRACE("%p decreasing refcount to %u\n", This, refcount);
99 HeapFree(GetProcessHeap(), 0, This);
105 /* ID3D10DeviceChild methods */
107 static void STDMETHODCALLTYPE d3d10_vertex_shader_GetDevice(ID3D10VertexShader *iface, ID3D10Device **device)
109 FIXME("iface %p, device %p stub!\n", iface, device);
112 static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_GetPrivateData(ID3D10VertexShader *iface,
113 REFGUID guid, UINT *data_size, void *data)
115 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
116 iface, debugstr_guid(guid), data_size, data);
121 static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_SetPrivateData(ID3D10VertexShader *iface,
122 REFGUID guid, UINT data_size, const void *data)
124 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
125 iface, debugstr_guid(guid), data_size, data);
130 static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_SetPrivateDataInterface(ID3D10VertexShader *iface,
131 REFGUID guid, const IUnknown *data)
133 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
138 const struct ID3D10VertexShaderVtbl d3d10_vertex_shader_vtbl =
140 /* IUnknown methods */
141 d3d10_vertex_shader_QueryInterface,
142 d3d10_vertex_shader_AddRef,
143 d3d10_vertex_shader_Release,
144 /* ID3D10DeviceChild methods */
145 d3d10_vertex_shader_GetDevice,
146 d3d10_vertex_shader_GetPrivateData,
147 d3d10_vertex_shader_SetPrivateData,
148 d3d10_vertex_shader_SetPrivateDataInterface,
151 /* IUnknown methods */
153 static HRESULT STDMETHODCALLTYPE d3d10_geometry_shader_QueryInterface(ID3D10GeometryShader *iface,
154 REFIID riid, void **object)
156 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
158 if (IsEqualGUID(riid, &IID_ID3D10GeometryShader)
159 || IsEqualGUID(riid, &IID_ID3D10DeviceChild)
160 || IsEqualGUID(riid, &IID_IUnknown))
162 IUnknown_AddRef(iface);
167 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
170 return E_NOINTERFACE;
173 static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_AddRef(ID3D10GeometryShader *iface)
175 struct d3d10_geometry_shader *This = (struct d3d10_geometry_shader *)iface;
176 ULONG refcount = InterlockedIncrement(&This->refcount);
178 TRACE("%p increasing refcount to %u\n", This, refcount);
183 static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_Release(ID3D10GeometryShader *iface)
185 struct d3d10_geometry_shader *This = (struct d3d10_geometry_shader *)iface;
186 ULONG refcount = InterlockedDecrement(&This->refcount);
188 TRACE("%p decreasing refcount to %u\n", This, refcount);
192 HeapFree(GetProcessHeap(), 0, This);
198 /* ID3D10DeviceChild methods */
200 static void STDMETHODCALLTYPE d3d10_geometry_shader_GetDevice(ID3D10GeometryShader *iface, ID3D10Device **device)
202 FIXME("iface %p, device %p stub!\n", iface, device);
205 static HRESULT STDMETHODCALLTYPE d3d10_geometry_shader_GetPrivateData(ID3D10GeometryShader *iface,
206 REFGUID guid, UINT *data_size, void *data)
208 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
209 iface, debugstr_guid(guid), data_size, data);
214 static HRESULT STDMETHODCALLTYPE d3d10_geometry_shader_SetPrivateData(ID3D10GeometryShader *iface,
215 REFGUID guid, UINT data_size, const void *data)
217 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
218 iface, debugstr_guid(guid), data_size, data);
223 static HRESULT STDMETHODCALLTYPE d3d10_geometry_shader_SetPrivateDataInterface(ID3D10GeometryShader *iface,
224 REFGUID guid, const IUnknown *data)
226 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
231 const struct ID3D10GeometryShaderVtbl d3d10_geometry_shader_vtbl =
233 /* IUnknown methods */
234 d3d10_geometry_shader_QueryInterface,
235 d3d10_geometry_shader_AddRef,
236 d3d10_geometry_shader_Release,
237 /* ID3D10DeviceChild methods */
238 d3d10_geometry_shader_GetDevice,
239 d3d10_geometry_shader_GetPrivateData,
240 d3d10_geometry_shader_SetPrivateData,
241 d3d10_geometry_shader_SetPrivateDataInterface,
244 /* IUnknown methods */
246 static HRESULT STDMETHODCALLTYPE d3d10_pixel_shader_QueryInterface(ID3D10PixelShader *iface,
247 REFIID riid, void **object)
249 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
251 if (IsEqualGUID(riid, &IID_ID3D10PixelShader)
252 || IsEqualGUID(riid, &IID_ID3D10DeviceChild)
253 || IsEqualGUID(riid, &IID_IUnknown))
255 IUnknown_AddRef(iface);
260 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
263 return E_NOINTERFACE;
266 static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_AddRef(ID3D10PixelShader *iface)
268 struct d3d10_pixel_shader *This = (struct d3d10_pixel_shader *)iface;
269 ULONG refcount = InterlockedIncrement(&This->refcount);
271 TRACE("%p increasing refcount to %u\n", This, refcount);
276 static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_Release(ID3D10PixelShader *iface)
278 struct d3d10_pixel_shader *This = (struct d3d10_pixel_shader *)iface;
279 ULONG refcount = InterlockedDecrement(&This->refcount);
281 TRACE("%p decreasing refcount to %u\n", This, refcount);
285 HeapFree(GetProcessHeap(), 0, This);
291 /* ID3D10DeviceChild methods */
293 static void STDMETHODCALLTYPE d3d10_pixel_shader_GetDevice(ID3D10PixelShader *iface, ID3D10Device **device)
295 FIXME("iface %p, device %p stub!\n", iface, device);
298 static HRESULT STDMETHODCALLTYPE d3d10_pixel_shader_GetPrivateData(ID3D10PixelShader *iface,
299 REFGUID guid, UINT *data_size, void *data)
301 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
302 iface, debugstr_guid(guid), data_size, data);
307 static HRESULT STDMETHODCALLTYPE d3d10_pixel_shader_SetPrivateData(ID3D10PixelShader *iface,
308 REFGUID guid, UINT data_size, const void *data)
310 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
311 iface, debugstr_guid(guid), data_size, data);
316 static HRESULT STDMETHODCALLTYPE d3d10_pixel_shader_SetPrivateDataInterface(ID3D10PixelShader *iface,
317 REFGUID guid, const IUnknown *data)
319 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
324 const struct ID3D10PixelShaderVtbl d3d10_pixel_shader_vtbl =
326 /* IUnknown methods */
327 d3d10_pixel_shader_QueryInterface,
328 d3d10_pixel_shader_AddRef,
329 d3d10_pixel_shader_Release,
330 /* ID3D10DeviceChild methods */
331 d3d10_pixel_shader_GetDevice,
332 d3d10_pixel_shader_GetPrivateData,
333 d3d10_pixel_shader_SetPrivateData,
334 d3d10_pixel_shader_SetPrivateDataInterface,