winejoystick.drv: Use CP_UNIXCP instead of CP_ACP when converting a string that comes...
[wine] / dlls / d3d10core / device.c
1 /*
2  * Copyright 2008 Henri Verbeet for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  *
18  */
19
20 #include "config.h"
21 #include "wine/port.h"
22
23 #include "d3d10core_private.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
26
27 /* Inner IUnknown methods */
28
29 static inline struct d3d10_device *d3d10_device_from_inner_unknown(IUnknown *iface)
30 {
31     return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, inner_unknown_vtbl));
32 }
33
34 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid, void **object)
35 {
36     struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
37
38     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
39
40     if (IsEqualGUID(riid, &IID_IUnknown)
41             || IsEqualGUID(riid, &IID_ID3D10Device))
42     {
43         IUnknown_AddRef((IUnknown *)This);
44         *object = This;
45         return S_OK;
46     }
47
48     if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
49     {
50         IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
51         *object = &This->device_parent_vtbl;
52         return S_OK;
53     }
54
55     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
56
57     *object = NULL;
58     return E_NOINTERFACE;
59 }
60
61 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
62 {
63     struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
64     ULONG refcount = InterlockedIncrement(&This->refcount);
65
66     TRACE("%p increasing refcount to %u\n", This, refcount);
67
68     return refcount;
69 }
70
71 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
72 {
73     struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
74     ULONG refcount = InterlockedDecrement(&This->refcount);
75
76     TRACE("%p decreasing refcount to %u\n", This, refcount);
77
78     return refcount;
79 }
80
81 /* IUnknown methods */
82
83 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
84 {
85     struct d3d10_device *This = (struct d3d10_device *)iface;
86     TRACE("Forwarding to outer IUnknown\n");
87     return IUnknown_QueryInterface(This->outer_unknown, riid, object);
88 }
89
90 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
91 {
92     struct d3d10_device *This = (struct d3d10_device *)iface;
93     TRACE("Forwarding to outer IUnknown\n");
94     return IUnknown_AddRef(This->outer_unknown);
95 }
96
97 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
98 {
99     struct d3d10_device *This = (struct d3d10_device *)iface;
100     TRACE("Forwarding to outer IUnknown\n");
101     return IUnknown_Release(This->outer_unknown);
102 }
103
104 /* ID3D10Device methods */
105
106 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
107         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
108 {
109     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
110             iface, start_slot, buffer_count, buffers);
111 }
112
113 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
114         UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
115 {
116     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
117             iface, start_slot, view_count, views);
118 }
119
120 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
121 {
122     FIXME("iface %p, shader %p stub!\n", iface, shader);
123 }
124
125 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
126         UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
127 {
128     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
129             iface, start_slot, sampler_count, samplers);
130 }
131
132 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
133 {
134     FIXME("iface %p, shader %p stub!\n", iface, shader);
135 }
136
137 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
138         UINT index_count, UINT start_index_location, INT base_vertex_location)
139 {
140     FIXME("iface %p, index_count %u, start_index_location %u, base_vertex_location %d stub!\n",
141             iface, index_count, start_index_location, base_vertex_location);
142 }
143
144 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
145         UINT vertex_count, UINT start_vertex_location)
146 {
147     FIXME("iface %p, vertex_count %u, start_vertex_location %u stub!\n",
148             iface, vertex_count, start_vertex_location);
149 }
150
151 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
152         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
153 {
154     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
155             iface, start_slot, buffer_count, buffers);
156 }
157
158 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
159 {
160     FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
161 }
162
163 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
164         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
165         const UINT *strides, const UINT *offsets)
166 {
167     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
168             iface, start_slot, buffer_count, buffers, strides, offsets);
169 }
170
171 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
172         ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
173 {
174     FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
175             iface, buffer, debug_dxgi_format(format), offset);
176 }
177
178 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
179         UINT instance_index_count, UINT instance_count, UINT start_index_location,
180         INT base_vertex_location, UINT start_instance_location)
181 {
182     FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
183             "\tbase_vertex_location %d, start_instance_location %u stub!\n",
184             iface, instance_index_count, instance_count, start_index_location,
185             base_vertex_location, start_instance_location);
186 }
187
188 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
189         UINT instance_vertex_count, UINT instance_count,
190         UINT start_vertex_location, UINT start_instance_location)
191 {
192     FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
193             "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
194             start_vertex_location, start_instance_location);
195 }
196
197 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
198         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
199 {
200     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
201             iface, start_slot, buffer_count, buffers);
202 }
203
204 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
205 {
206     FIXME("iface %p, shader %p stub!\n", iface, shader);
207 }
208
209 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
210 {
211     FIXME("iface %p, topology %s stub!\n", iface, debug_d3d10_primitive_topology(topology));
212 }
213
214 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
215         UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
216 {
217     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
218             iface, start_slot, view_count, views);
219 }
220
221 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
222         UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
223 {
224     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
225             iface, start_slot, sampler_count, samplers);
226 }
227
228 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
229 {
230     FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
231 }
232
233 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
234         UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
235 {
236     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
237             iface, start_slot, view_count, views);
238 }
239
240 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
241         UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
242 {
243     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
244             iface, start_slot, sampler_count, samplers);
245 }
246
247 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
248         UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
249         ID3D10DepthStencilView *depth_stencil_view)
250 {
251     FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
252             iface, render_target_view_count, render_target_views, depth_stencil_view);
253 }
254
255 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
256         ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
257 {
258     FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
259             iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
260 }
261
262 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
263         ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
264 {
265     FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
266             iface, depth_stencil_state, stencil_ref);
267 }
268
269 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
270         UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
271 {
272     FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
273 }
274
275 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
276 {
277     FIXME("iface %p stub!\n", iface);
278 }
279
280 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
281 {
282     FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
283 }
284
285 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
286         UINT viewport_count, const D3D10_VIEWPORT *viewports)
287 {
288     FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
289 }
290
291 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
292         UINT rect_count, const D3D10_RECT *rects)
293 {
294     FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
295 }
296
297 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
298         ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
299         ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
300 {
301     FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
302             "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
303             iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
304             src_resource, src_subresource_idx, src_box);
305 }
306
307 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
308         ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
309 {
310     FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
311 }
312
313 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
314         ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
315         const void *data, UINT row_pitch, UINT depth_pitch)
316 {
317     FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
318             iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
319 }
320
321 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
322         ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
323 {
324     FIXME("iface %p, render_target_view %p, color_rgba [%f %f %f %f] stub!\n",
325             iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
326 }
327
328 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
329         ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
330 {
331     FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
332             iface, depth_stencil_view, flags, depth, stencil);
333 }
334
335 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
336 {
337     FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
338 }
339
340 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
341         ID3D10Resource *dst_resource, UINT dst_subresource_idx,
342         ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
343 {
344     FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
345             "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
346             iface, dst_resource, dst_subresource_idx,
347             src_resource, src_subresource_idx, debug_dxgi_format(format));
348 }
349
350 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
351         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
352 {
353     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
354             iface, start_slot, buffer_count, buffers);
355 }
356
357 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
358         UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
359 {
360     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
361             iface, start_slot, view_count, views);
362 }
363
364 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
365 {
366     FIXME("iface %p, shader %p stub!\n", iface, shader);
367 }
368
369 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
370         UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
371 {
372     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
373             iface, start_slot, sampler_count, samplers);
374 }
375
376 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
377 {
378     FIXME("iface %p, shader %p stub!\n", iface, shader);
379 }
380
381 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
382         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
383 {
384     FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
385             iface, start_slot, buffer_count, buffers);
386 }
387
388 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
389 {
390     FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
391 }
392
393 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
394         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
395 {
396     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
397             iface, start_slot, buffer_count, buffers, strides, offsets);
398 }
399
400 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
401         ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
402 {
403     FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
404 }
405
406 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
407         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
408 {
409     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
410             iface, start_slot, buffer_count, buffers);
411 }
412
413 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
414 {
415     FIXME("iface %p, shader %p stub!\n", iface, shader);
416 }
417
418 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
419 {
420     FIXME("iface %p, topology %p stub!\n", iface, topology);
421 }
422
423 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
424         UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
425 {
426     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
427             iface, start_slot, view_count, views);
428 }
429
430 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
431         UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
432 {
433     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
434             iface, start_slot, sampler_count, samplers);
435 }
436
437 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
438         ID3D10Predicate **predicate, BOOL *value)
439 {
440     FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
441 }
442
443 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
444         UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
445 {
446     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
447             iface, start_slot, view_count, views);
448 }
449
450 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
451         UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
452 {
453     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
454             iface, start_slot, sampler_count, samplers);
455 }
456
457 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
458         UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
459 {
460     FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
461             iface, view_count, render_target_views, depth_stencil_view);
462 }
463
464 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
465         ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
466 {
467     FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
468             iface, blend_state, blend_factor, sample_mask);
469 }
470
471 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
472         ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
473 {
474     FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
475             iface, depth_stencil_state, stencil_ref);
476 }
477
478 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
479         UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
480 {
481     FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
482             iface, buffer_count, buffers, offsets);
483 }
484
485 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
486 {
487     FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
488 }
489
490 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
491         UINT *viewport_count, D3D10_VIEWPORT *viewports)
492 {
493     FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
494 }
495
496 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
497 {
498     FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
499 }
500
501 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
502 {
503     FIXME("iface %p stub!\n", iface);
504
505     return E_NOTIMPL;
506 }
507
508 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
509 {
510     FIXME("iface %p, flags %#x stub!\n", iface, flags);
511
512     return E_NOTIMPL;
513 }
514
515 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
516 {
517     FIXME("iface %p stub!\n", iface);
518
519     return 0;
520 }
521
522 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
523         REFGUID guid, UINT *data_size, void *data)
524 {
525     FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
526             iface, debugstr_guid(guid), data_size, data);
527
528     return E_NOTIMPL;
529 }
530
531 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
532         REFGUID guid, UINT data_size, const void *data)
533 {
534     FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
535             iface, debugstr_guid(guid), data_size, data);
536
537     return E_NOTIMPL;
538 }
539
540 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
541         REFGUID guid, const IUnknown *data)
542 {
543     FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
544
545     return E_NOTIMPL;
546 }
547
548 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
549 {
550     FIXME("iface %p stub!\n", iface);
551 }
552
553 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
554 {
555     FIXME("iface %p stub!\n", iface);
556 }
557
558 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
559         const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
560 {
561     struct d3d10_buffer *object;
562
563     FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
564
565     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
566     if (!object)
567     {
568         ERR("Failed to allocate D3D10 buffer object memory\n");
569         return E_OUTOFMEMORY;
570     }
571
572     object->vtbl = &d3d10_buffer_vtbl;
573     object->refcount = 1;
574
575     *buffer = (ID3D10Buffer *)object;
576
577     TRACE("Created ID3D10Buffer %p\n", object);
578
579     return S_OK;
580 }
581
582 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
583         const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
584 {
585     FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
586
587     return E_NOTIMPL;
588 }
589
590 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
591         const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
592 {
593     struct d3d10_texture2d *object;
594     HRESULT hr;
595
596     FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
597
598     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
599     if (!object)
600     {
601         ERR("Failed to allocate D3D10 texture2d object memory\n");
602         return E_OUTOFMEMORY;
603     }
604
605     object->vtbl = &d3d10_texture2d_vtbl;
606     object->refcount = 1;
607     object->desc = *desc;
608
609     if (desc->MipLevels == 1 && desc->ArraySize == 1)
610     {
611         IWineD3DDevice *wined3d_device;
612         IWineDXGIDevice *wine_device;
613
614         hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
615         if (FAILED(hr))
616         {
617             ERR("Device should implement IWineDXGIDevice\n");
618             HeapFree(GetProcessHeap(), 0, object);
619             return E_FAIL;
620         }
621
622         hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
623                 (IUnknown *)object, (void **)&object->dxgi_surface);
624         if (FAILED(hr))
625         {
626             ERR("Failed to create DXGI surface, returning %#x\n", hr);
627             HeapFree(GetProcessHeap(), 0, object);
628             IWineDXGIDevice_Release(wine_device);
629             return hr;
630         }
631
632         wined3d_device = IWineDXGIDevice_get_wined3d_device(wine_device);
633         IWineDXGIDevice_Release(wine_device);
634
635         FIXME("Implement DXGI<->wined3d format and usage conversion\n");
636
637         hr = IWineD3DDevice_CreateSurface(wined3d_device, desc->Width, desc->Height, desc->Format, FALSE,
638                 FALSE, 0, &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
639                 desc->SampleDesc.Count, desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
640         IWineD3DDevice_Release(wined3d_device);
641         if (FAILED(hr))
642         {
643             ERR("CreateSurface failed, returning %#x\n", hr);
644             IDXGISurface_Release(object->dxgi_surface);
645             HeapFree(GetProcessHeap(), 0, object);
646             return hr;
647         }
648     }
649
650     *texture = (ID3D10Texture2D *)object;
651
652     TRACE("Created ID3D10Texture2D %p\n", object);
653
654     return S_OK;
655 }
656
657 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
658         const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
659 {
660     FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
661
662     return E_NOTIMPL;
663 }
664
665 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
666         ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
667 {
668     FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
669
670     return E_NOTIMPL;
671 }
672
673 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
674 {
675     D3D10_RESOURCE_DIMENSION dimension;
676     HRESULT hr;
677
678     ID3D10Resource_GetType(resource, &dimension);
679
680     switch(dimension)
681     {
682         case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
683         {
684             ID3D10Texture1D *texture;
685             D3D10_TEXTURE1D_DESC texture_desc;
686
687             hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
688             if (FAILED(hr))
689             {
690                 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
691                 return E_INVALIDARG;
692             }
693
694             ID3D10Texture1D_GetDesc(texture, &texture_desc);
695             ID3D10Texture1D_Release(texture);
696
697             desc->Format = texture_desc.Format;
698             if (texture_desc.ArraySize == 1)
699             {
700                 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
701                 desc->Texture1D.MipSlice = 0;
702             }
703             else
704             {
705                 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
706                 desc->Texture1DArray.MipSlice = 0;
707                 desc->Texture1DArray.FirstArraySlice = 0;
708                 desc->Texture1DArray.ArraySize = 1;
709             }
710
711             return S_OK;
712         }
713
714         case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
715         {
716             ID3D10Texture2D *texture;
717             D3D10_TEXTURE2D_DESC texture_desc;
718
719             hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
720             if (FAILED(hr))
721             {
722                 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
723                 return E_INVALIDARG;
724             }
725
726             ID3D10Texture2D_GetDesc(texture, &texture_desc);
727             ID3D10Texture2D_Release(texture);
728
729             desc->Format = texture_desc.Format;
730             if (texture_desc.ArraySize == 1)
731             {
732                 if (texture_desc.SampleDesc.Count == 1)
733                 {
734                     desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
735                     desc->Texture2D.MipSlice = 0;
736                 }
737                 else
738                 {
739                     desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
740                 }
741             }
742             else
743             {
744                 if (texture_desc.SampleDesc.Count == 1)
745                 {
746                     desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
747                     desc->Texture2DArray.MipSlice = 0;
748                     desc->Texture2DArray.FirstArraySlice = 0;
749                     desc->Texture2DArray.ArraySize = 1;
750                 }
751                 else
752                 {
753                     desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
754                     desc->Texture2DMSArray.FirstArraySlice = 0;
755                     desc->Texture2DMSArray.ArraySize = 1;
756                 }
757             }
758
759             return S_OK;
760         }
761
762         case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
763         {
764             ID3D10Texture3D *texture;
765             D3D10_TEXTURE3D_DESC texture_desc;
766
767             hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
768             if (FAILED(hr))
769             {
770                 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
771                 return E_INVALIDARG;
772             }
773
774             ID3D10Texture3D_GetDesc(texture, &texture_desc);
775             ID3D10Texture3D_Release(texture);
776
777             desc->Format = texture_desc.Format;
778             desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
779             desc->Texture3D.MipSlice = 0;
780             desc->Texture3D.FirstWSlice = 0;
781             desc->Texture3D.WSize = 1;
782
783             return S_OK;
784         }
785
786         default:
787             FIXME("Unhandled resource dimension %#x\n", dimension);
788             return E_INVALIDARG;
789     }
790 }
791
792 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
793         ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
794 {
795     struct d3d10_rendertarget_view *object;
796
797     TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
798
799     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
800     if (!object)
801     {
802         ERR("Failed to allocate D3D10 rendertarget view object memory\n");
803         return E_OUTOFMEMORY;
804     }
805
806     object->vtbl = &d3d10_rendertarget_view_vtbl;
807     object->refcount = 1;
808
809     if (!desc)
810     {
811         HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
812         if (FAILED(hr))
813         {
814             HeapFree(GetProcessHeap(), 0, object);
815             return hr;
816         }
817     }
818     else
819     {
820         object->desc = *desc;
821     }
822
823     object->resource = resource;
824     ID3D10Resource_AddRef(resource);
825
826     *view = (ID3D10RenderTargetView *)object;
827
828     return S_OK;
829 }
830
831 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
832         ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
833 {
834     FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
835
836     return E_NOTIMPL;
837 }
838
839 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
840         const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
841         SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
842 {
843     FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
844             "\tshader_byte_code_length %lu, input_layout %p stub!\n",
845             iface, element_descs, element_count, shader_byte_code,
846             shader_byte_code_length, input_layout);
847
848     return E_NOTIMPL;
849 }
850
851 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
852         const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
853 {
854     FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
855             iface, byte_code, byte_code_length, shader);
856
857     return E_NOTIMPL;
858 }
859
860 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
861         const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
862 {
863     FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
864             iface, byte_code, byte_code_length, shader);
865
866     return E_NOTIMPL;
867 }
868
869 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
870         const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
871         UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
872 {
873     FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
874             "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
875             iface, byte_code, byte_code_length, output_stream_decls,
876             output_stream_decl_count, output_stream_stride, shader);
877
878     return E_NOTIMPL;
879 }
880
881 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
882         const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
883 {
884     FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
885             iface, byte_code, byte_code_length, shader);
886
887     return E_NOTIMPL;
888 }
889
890 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
891         const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
892 {
893     FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
894
895     return E_NOTIMPL;
896 }
897
898 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
899         const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
900 {
901     FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
902
903     return E_NOTIMPL;
904 }
905
906 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
907         const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
908 {
909     FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
910
911     return E_NOTIMPL;
912 }
913
914 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
915         const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
916 {
917     FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
918
919     return E_NOTIMPL;
920 }
921
922 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
923         const D3D10_QUERY_DESC *desc, ID3D10Query **query)
924 {
925     FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
926
927     return E_NOTIMPL;
928 }
929
930 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
931         const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
932 {
933     FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
934
935     return E_NOTIMPL;
936 }
937
938 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
939         const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
940 {
941     FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
942
943     return E_NOTIMPL;
944 }
945
946 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
947         DXGI_FORMAT format, UINT *format_support)
948 {
949     FIXME("iface %p, format %s, format_support %p stub!\n",
950             iface, debug_dxgi_format(format), format_support);
951
952     return E_NOTIMPL;
953 }
954
955 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
956         DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
957 {
958     FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
959             iface, debug_dxgi_format(format), sample_count, quality_level_count);
960
961     return E_NOTIMPL;
962 }
963
964 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
965 {
966     FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
967 }
968
969 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
970         const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
971         UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
972 {
973     FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
974             "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
975             iface, desc, type, active_counters, name, name_length,
976             units, units_length, description, description_length);
977
978     return E_NOTIMPL;
979 }
980
981 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
982 {
983     FIXME("iface %p stub!\n", iface);
984
985     return 0;
986 }
987
988 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
989         HANDLE resource_handle, REFIID guid, void **resource)
990 {
991     FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
992             iface, resource_handle, debugstr_guid(guid), resource);
993
994     return E_NOTIMPL;
995 }
996
997 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
998 {
999     FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1000 }
1001
1002 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1003 {
1004     FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1005 }
1006
1007 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1008 {
1009     /* IUnknown methods */
1010     d3d10_device_QueryInterface,
1011     d3d10_device_AddRef,
1012     d3d10_device_Release,
1013     /* ID3D10Device methods */
1014     d3d10_device_VSSetConstantBuffers,
1015     d3d10_device_PSSetShaderResources,
1016     d3d10_device_PSSetShader,
1017     d3d10_device_PSSetSamplers,
1018     d3d10_device_VSSetShader,
1019     d3d10_device_DrawIndexed,
1020     d3d10_device_Draw,
1021     d3d10_device_PSSetConstantBuffers,
1022     d3d10_device_IASetInputLayout,
1023     d3d10_device_IASetVertexBuffers,
1024     d3d10_device_IASetIndexBuffer,
1025     d3d10_device_DrawIndexedInstanced,
1026     d3d10_device_DrawInstanced,
1027     d3d10_device_GSSetConstantBuffers,
1028     d3d10_device_GSSetShader,
1029     d3d10_device_IASetPrimitiveTopology,
1030     d3d10_device_VSSetShaderResources,
1031     d3d10_device_VSSetSamplers,
1032     d3d10_device_SetPredication,
1033     d3d10_device_GSSetShaderResources,
1034     d3d10_device_GSSetSamplers,
1035     d3d10_device_OMSetRenderTargets,
1036     d3d10_device_OMSetBlendState,
1037     d3d10_device_OMSetDepthStencilState,
1038     d3d10_device_SOSetTargets,
1039     d3d10_device_DrawAuto,
1040     d3d10_device_RSSetState,
1041     d3d10_device_RSSetViewports,
1042     d3d10_device_RSSetScissorRects,
1043     d3d10_device_CopySubresourceRegion,
1044     d3d10_device_CopyResource,
1045     d3d10_device_UpdateSubresource,
1046     d3d10_device_ClearRenderTargetView,
1047     d3d10_device_ClearDepthStencilView,
1048     d3d10_device_GenerateMips,
1049     d3d10_device_ResolveSubresource,
1050     d3d10_device_VSGetConstantBuffers,
1051     d3d10_device_PSGetShaderResources,
1052     d3d10_device_PSGetShader,
1053     d3d10_device_PSGetSamplers,
1054     d3d10_device_VSGetShader,
1055     d3d10_device_PSGetConstantBuffers,
1056     d3d10_device_IAGetInputLayout,
1057     d3d10_device_IAGetVertexBuffers,
1058     d3d10_device_IAGetIndexBuffer,
1059     d3d10_device_GSGetConstantBuffers,
1060     d3d10_device_GSGetShader,
1061     d3d10_device_IAGetPrimitiveTopology,
1062     d3d10_device_VSGetShaderResources,
1063     d3d10_device_VSGetSamplers,
1064     d3d10_device_GetPredication,
1065     d3d10_device_GSGetShaderResources,
1066     d3d10_device_GSGetSamplers,
1067     d3d10_device_OMGetRenderTargets,
1068     d3d10_device_OMGetBlendState,
1069     d3d10_device_OMGetDepthStencilState,
1070     d3d10_device_SOGetTargets,
1071     d3d10_device_RSGetState,
1072     d3d10_device_RSGetViewports,
1073     d3d10_device_RSGetScissorRects,
1074     d3d10_device_GetDeviceRemovedReason,
1075     d3d10_device_SetExceptionMode,
1076     d3d10_device_GetExceptionMode,
1077     d3d10_device_GetPrivateData,
1078     d3d10_device_SetPrivateData,
1079     d3d10_device_SetPrivateDataInterface,
1080     d3d10_device_ClearState,
1081     d3d10_device_Flush,
1082     d3d10_device_CreateBuffer,
1083     d3d10_device_CreateTexture1D,
1084     d3d10_device_CreateTexture2D,
1085     d3d10_device_CreateTexture3D,
1086     d3d10_device_CreateShaderResourceView,
1087     d3d10_device_CreateRenderTargetView,
1088     d3d10_device_CreateDepthStencilView,
1089     d3d10_device_CreateInputLayout,
1090     d3d10_device_CreateVertexShader,
1091     d3d10_device_CreateGeometryShader,
1092     d3d10_device_CreateGeometryShaderWithStreamOutput,
1093     d3d10_device_CreatePixelShader,
1094     d3d10_device_CreateBlendState,
1095     d3d10_device_CreateDepthStencilState,
1096     d3d10_device_CreateRasterizerState,
1097     d3d10_device_CreateSamplerState,
1098     d3d10_device_CreateQuery,
1099     d3d10_device_CreatePredicate,
1100     d3d10_device_CreateCounter,
1101     d3d10_device_CheckFormatSupport,
1102     d3d10_device_CheckMultisampleQualityLevels,
1103     d3d10_device_CheckCounterInfo,
1104     d3d10_device_CheckCounter,
1105     d3d10_device_GetCreationFlags,
1106     d3d10_device_OpenSharedResource,
1107     d3d10_device_SetTextFilterSize,
1108     d3d10_device_GetTextFilterSize,
1109 };
1110
1111 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1112 {
1113     /* IUnknown methods */
1114     d3d10_device_inner_QueryInterface,
1115     d3d10_device_inner_AddRef,
1116     d3d10_device_inner_Release,
1117 };
1118
1119 /* IWineD3DDeviceParent IUnknown methods */
1120
1121 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1122 {
1123     return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1124 }
1125
1126 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1127 {
1128     struct d3d10_device *This = device_from_device_parent(iface);
1129     return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1130 }
1131
1132 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1133 {
1134     struct d3d10_device *This = device_from_device_parent(iface);
1135     return d3d10_device_AddRef((ID3D10Device *)This);
1136 }
1137
1138 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1139 {
1140     struct d3d10_device *This = device_from_device_parent(iface);
1141     return d3d10_device_Release((ID3D10Device *)This);
1142 }
1143
1144 /* IWineD3DDeviceParent methods */
1145
1146 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1147         IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1148         WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1149 {
1150     struct d3d10_device *This = device_from_device_parent(iface);
1151     struct d3d10_texture2d *texture;
1152     D3D10_TEXTURE2D_DESC desc;
1153     HRESULT hr;
1154
1155     FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1156             "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1157             iface, superior, width, height, format, usage, pool, level, face, surface);
1158
1159     FIXME("Implement DXGI<->wined3d format and usage conversion\n");
1160
1161     desc.Width = width;
1162     desc.Height = height;
1163     desc.MipLevels = 1;
1164     desc.ArraySize = 1;
1165     desc.Format = format;
1166     desc.SampleDesc.Count = 1;
1167     desc.SampleDesc.Quality = 0;
1168     desc.Usage = usage;
1169     desc.BindFlags = 0;
1170     desc.CPUAccessFlags = 0;
1171     desc.MiscFlags = 0;
1172
1173     hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1174     if (FAILED(hr))
1175     {
1176         ERR("CreateTexture2D failed, returning %#x\n", hr);
1177         return hr;
1178     }
1179
1180     *surface = texture->wined3d_surface;
1181
1182     return S_OK;
1183 }
1184
1185 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1186         IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1187         DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1188 {
1189     struct d3d10_device *This = device_from_device_parent(iface);
1190     struct d3d10_texture2d *texture;
1191     D3D10_TEXTURE2D_DESC desc;
1192     HRESULT hr;
1193
1194     FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1195             "\tmultisample_quality %u, lockable %u, surface %p stub!\n",
1196             iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1197
1198     FIXME("Implement DXGI<->wined3d format and usage conversion\n");
1199
1200     desc.Width = width;
1201     desc.Height = height;
1202     desc.MipLevels = 1;
1203     desc.ArraySize = 1;
1204     desc.Format = format;
1205     desc.SampleDesc.Count = multisample_type;
1206     desc.SampleDesc.Quality = multisample_quality;
1207     desc.Usage = D3D10_USAGE_DEFAULT;
1208     desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1209     desc.CPUAccessFlags = 0;
1210     desc.MiscFlags = 0;
1211
1212     hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1213     if (FAILED(hr))
1214     {
1215         ERR("CreateTexture2D failed, returning %#x\n", hr);
1216         return hr;
1217     }
1218
1219     *surface = texture->wined3d_surface;
1220
1221     return S_OK;
1222 }
1223
1224 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1225         IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1226         DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1227 {
1228     struct d3d10_device *This = device_from_device_parent(iface);
1229     struct d3d10_texture2d *texture;
1230     D3D10_TEXTURE2D_DESC desc;
1231     HRESULT hr;
1232
1233     FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1234             "\tmultisample_quality %u, discard %u, surface %p stub!\n",
1235             iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1236
1237     FIXME("Implement DXGI<->wined3d format and usage conversion\n");
1238
1239     desc.Width = width;
1240     desc.Height = height;
1241     desc.MipLevels = 1;
1242     desc.ArraySize = 1;
1243     desc.Format = format;
1244     desc.SampleDesc.Count = multisample_type;
1245     desc.SampleDesc.Quality = multisample_quality;
1246     desc.Usage = D3D10_USAGE_DEFAULT;
1247     desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1248     desc.CPUAccessFlags = 0;
1249     desc.MiscFlags = 0;
1250
1251     hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1252     if (FAILED(hr))
1253     {
1254         ERR("CreateTexture2D failed, returning %#x\n", hr);
1255         return hr;
1256     }
1257
1258     *surface = texture->wined3d_surface;
1259
1260     return S_OK;
1261 }
1262
1263 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1264         IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1265         WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1266 {
1267     FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1268             iface, superior, width, height, depth, format, pool, usage, volume);
1269
1270     return E_NOTIMPL;
1271 }
1272
1273 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1274         WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1275 {
1276     FIXME("iface %p, present_parameters %p, swapchain %p stub!\n", iface, present_parameters, swapchain);
1277
1278     return E_NOTIMPL;
1279 }
1280
1281
1282 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1283 {
1284     /* IUnknown methods */
1285     device_parent_QueryInterface,
1286     device_parent_AddRef,
1287     device_parent_Release,
1288     /* IWineD3DDeviceParent methods */
1289     device_parent_CreateSurface,
1290     device_parent_CreateRenderTarget,
1291     device_parent_CreateDepthStencilSurface,
1292     device_parent_CreateVolume,
1293     device_parent_CreateSwapChain,
1294 };