2 * Copyright 2008-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 /* Inner IUnknown methods */
29 static inline struct d3d10_device *d3d10_device_from_inner_unknown(IUnknown *iface)
31 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, inner_unknown_vtbl));
34 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid, void **object)
36 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
38 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
40 if (IsEqualGUID(riid, &IID_IUnknown)
41 || IsEqualGUID(riid, &IID_ID3D10Device))
43 IUnknown_AddRef((IUnknown *)This);
48 if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
50 IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
51 *object = &This->device_parent_vtbl;
55 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
61 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
63 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
64 ULONG refcount = InterlockedIncrement(&This->refcount);
66 TRACE("%p increasing refcount to %u\n", This, refcount);
71 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
73 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
74 ULONG refcount = InterlockedDecrement(&This->refcount);
76 TRACE("%p decreasing refcount to %u\n", This, refcount);
80 if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
86 /* IUnknown methods */
88 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
90 struct d3d10_device *This = (struct d3d10_device *)iface;
91 TRACE("Forwarding to outer IUnknown\n");
92 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
95 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
97 struct d3d10_device *This = (struct d3d10_device *)iface;
98 TRACE("Forwarding to outer IUnknown\n");
99 return IUnknown_AddRef(This->outer_unknown);
102 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
104 struct d3d10_device *This = (struct d3d10_device *)iface;
105 TRACE("Forwarding to outer IUnknown\n");
106 return IUnknown_Release(This->outer_unknown);
109 /* ID3D10Device methods */
111 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
112 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
114 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
115 iface, start_slot, buffer_count, buffers);
118 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
119 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
121 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
122 iface, start_slot, view_count, views);
125 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
127 struct d3d10_device *This = (struct d3d10_device *)iface;
128 struct d3d10_pixel_shader *ps = (struct d3d10_pixel_shader *)shader;
130 TRACE("iface %p, shader %p\n", iface, shader);
132 IWineD3DDevice_SetPixelShader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
135 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
136 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
138 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
139 iface, start_slot, sampler_count, samplers);
142 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
144 FIXME("iface %p, shader %p stub!\n", iface, shader);
147 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
148 UINT index_count, UINT start_index_location, INT base_vertex_location)
150 FIXME("iface %p, index_count %u, start_index_location %u, base_vertex_location %d stub!\n",
151 iface, index_count, start_index_location, base_vertex_location);
154 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
155 UINT vertex_count, UINT start_vertex_location)
157 struct d3d10_device *This = (struct d3d10_device *)iface;
159 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
160 iface, vertex_count, start_vertex_location);
162 IWineD3DDevice_DrawPrimitive(This->wined3d_device, start_vertex_location, vertex_count);
165 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
166 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
168 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
169 iface, start_slot, buffer_count, buffers);
172 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
174 struct d3d10_device *This = (struct d3d10_device *)iface;
176 TRACE("iface %p, input_layout %p\n", iface, input_layout);
178 IWineD3DDevice_SetVertexDeclaration(This->wined3d_device,
179 ((struct d3d10_input_layout *)input_layout)->wined3d_decl);
182 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
183 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
184 const UINT *strides, const UINT *offsets)
186 struct d3d10_device *This = (struct d3d10_device *)iface;
189 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
190 iface, start_slot, buffer_count, buffers, strides, offsets);
192 for (i = 0; i < buffer_count; ++i)
194 IWineD3DDevice_SetStreamSource(This->wined3d_device, start_slot,
195 ((struct d3d10_buffer *)buffers[i])->wined3d_buffer, offsets[i], strides[i]);
199 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
200 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
202 FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
203 iface, buffer, debug_dxgi_format(format), offset);
206 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
207 UINT instance_index_count, UINT instance_count, UINT start_index_location,
208 INT base_vertex_location, UINT start_instance_location)
210 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
211 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
212 iface, instance_index_count, instance_count, start_index_location,
213 base_vertex_location, start_instance_location);
216 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
217 UINT instance_vertex_count, UINT instance_count,
218 UINT start_vertex_location, UINT start_instance_location)
220 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
221 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
222 start_vertex_location, start_instance_location);
225 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
226 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
228 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
229 iface, start_slot, buffer_count, buffers);
232 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
234 FIXME("iface %p, shader %p stub!\n", iface, shader);
237 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
239 struct d3d10_device *This = (struct d3d10_device *)iface;
241 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
243 IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
246 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
247 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
249 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
250 iface, start_slot, view_count, views);
253 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
254 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
256 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
257 iface, start_slot, sampler_count, samplers);
260 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
262 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
265 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
266 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
268 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
269 iface, start_slot, view_count, views);
272 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
273 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
275 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
276 iface, start_slot, sampler_count, samplers);
279 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
280 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
281 ID3D10DepthStencilView *depth_stencil_view)
283 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
284 iface, render_target_view_count, render_target_views, depth_stencil_view);
287 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
288 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
290 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
291 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
294 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
295 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
297 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
298 iface, depth_stencil_state, stencil_ref);
301 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
302 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
304 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
307 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
309 FIXME("iface %p stub!\n", iface);
312 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
314 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
317 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
318 UINT viewport_count, const D3D10_VIEWPORT *viewports)
320 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
323 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
324 UINT rect_count, const D3D10_RECT *rects)
326 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
329 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
330 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
331 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
333 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
334 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
335 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
336 src_resource, src_subresource_idx, src_box);
339 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
340 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
342 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
345 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
346 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
347 const void *data, UINT row_pitch, UINT depth_pitch)
349 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
350 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
353 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
354 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
356 struct d3d10_device *This = (struct d3d10_device *)iface;
357 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
359 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
360 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
362 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
365 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
366 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
368 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
369 iface, depth_stencil_view, flags, depth, stencil);
372 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
374 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
377 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
378 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
379 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
381 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
382 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
383 iface, dst_resource, dst_subresource_idx,
384 src_resource, src_subresource_idx, debug_dxgi_format(format));
387 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
388 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
390 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
391 iface, start_slot, buffer_count, buffers);
394 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
395 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
397 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
398 iface, start_slot, view_count, views);
401 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
403 FIXME("iface %p, shader %p stub!\n", iface, shader);
406 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
407 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
409 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
410 iface, start_slot, sampler_count, samplers);
413 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
415 FIXME("iface %p, shader %p stub!\n", iface, shader);
418 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
419 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
421 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
422 iface, start_slot, buffer_count, buffers);
425 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
427 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
430 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
431 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
433 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
434 iface, start_slot, buffer_count, buffers, strides, offsets);
437 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
438 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
440 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
443 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
444 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
446 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
447 iface, start_slot, buffer_count, buffers);
450 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
452 FIXME("iface %p, shader %p stub!\n", iface, shader);
455 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
457 struct d3d10_device *This = (struct d3d10_device *)iface;
459 TRACE("iface %p, topology %p\n", iface, topology);
461 IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
464 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
465 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
467 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
468 iface, start_slot, view_count, views);
471 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
472 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
474 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
475 iface, start_slot, sampler_count, samplers);
478 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
479 ID3D10Predicate **predicate, BOOL *value)
481 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
484 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
485 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
487 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
488 iface, start_slot, view_count, views);
491 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
492 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
494 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
495 iface, start_slot, sampler_count, samplers);
498 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
499 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
501 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
502 iface, view_count, render_target_views, depth_stencil_view);
505 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
506 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
508 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
509 iface, blend_state, blend_factor, sample_mask);
512 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
513 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
515 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
516 iface, depth_stencil_state, stencil_ref);
519 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
520 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
522 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
523 iface, buffer_count, buffers, offsets);
526 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
528 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
531 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
532 UINT *viewport_count, D3D10_VIEWPORT *viewports)
534 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
537 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
539 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
542 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
544 FIXME("iface %p stub!\n", iface);
549 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
551 FIXME("iface %p, flags %#x stub!\n", iface, flags);
556 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
558 FIXME("iface %p stub!\n", iface);
563 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
564 REFGUID guid, UINT *data_size, void *data)
566 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
567 iface, debugstr_guid(guid), data_size, data);
572 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
573 REFGUID guid, UINT data_size, const void *data)
575 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
576 iface, debugstr_guid(guid), data_size, data);
581 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
582 REFGUID guid, const IUnknown *data)
584 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
589 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
591 FIXME("iface %p stub!\n", iface);
594 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
596 FIXME("iface %p stub!\n", iface);
599 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
600 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
602 struct d3d10_device *This = (struct d3d10_device *)iface;
603 struct wined3d_buffer_desc wined3d_desc;
604 struct d3d10_buffer *object;
607 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
609 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
612 ERR("Failed to allocate D3D10 buffer object memory\n");
613 return E_OUTOFMEMORY;
616 object->vtbl = &d3d10_buffer_vtbl;
617 object->refcount = 1;
619 FIXME("Implement DXGI<->wined3d usage conversion\n");
621 wined3d_desc.byte_width = desc->ByteWidth;
622 wined3d_desc.usage = desc->Usage;
623 wined3d_desc.bind_flags = desc->BindFlags;
624 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
625 wined3d_desc.misc_flags = desc->MiscFlags;
627 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
628 data ? data->pSysMem : NULL, (IUnknown *)object, &object->wined3d_buffer);
631 ERR("CreateBuffer failed, returning %#x\n", hr);
632 HeapFree(GetProcessHeap(), 0, object);
636 *buffer = (ID3D10Buffer *)object;
638 TRACE("Created ID3D10Buffer %p\n", object);
643 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
644 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
646 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
651 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
652 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
654 struct d3d10_device *This = (struct d3d10_device *)iface;
655 struct d3d10_texture2d *object;
658 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
660 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
663 ERR("Failed to allocate D3D10 texture2d object memory\n");
664 return E_OUTOFMEMORY;
667 object->vtbl = &d3d10_texture2d_vtbl;
668 object->refcount = 1;
669 object->desc = *desc;
671 if (desc->MipLevels == 1 && desc->ArraySize == 1)
673 IWineDXGIDevice *wine_device;
675 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
678 ERR("Device should implement IWineDXGIDevice\n");
679 HeapFree(GetProcessHeap(), 0, object);
683 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
684 (IUnknown *)object, (void **)&object->dxgi_surface);
685 IWineDXGIDevice_Release(wine_device);
688 ERR("Failed to create DXGI surface, returning %#x\n", hr);
689 HeapFree(GetProcessHeap(), 0, object);
693 FIXME("Implement DXGI<->wined3d usage conversion\n");
695 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
696 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
697 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
698 desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
699 desc->SampleDesc.Quality, SURFACE_OPENGL, (IUnknown *)object);
702 ERR("CreateSurface failed, returning %#x\n", hr);
703 IDXGISurface_Release(object->dxgi_surface);
704 HeapFree(GetProcessHeap(), 0, object);
709 *texture = (ID3D10Texture2D *)object;
711 TRACE("Created ID3D10Texture2D %p\n", object);
716 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
717 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
719 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
724 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
725 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
727 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
732 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
734 D3D10_RESOURCE_DIMENSION dimension;
736 ID3D10Resource_GetType(resource, &dimension);
740 case D3D10_RESOURCE_DIMENSION_BUFFER:
741 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
743 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
744 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
747 FIXME("Unhandled resource dimension %#x\n", dimension);
752 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
754 D3D10_RESOURCE_DIMENSION dimension;
757 ID3D10Resource_GetType(resource, &dimension);
761 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
763 ID3D10Texture1D *texture;
764 D3D10_TEXTURE1D_DESC texture_desc;
766 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
769 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
773 ID3D10Texture1D_GetDesc(texture, &texture_desc);
774 ID3D10Texture1D_Release(texture);
776 desc->Format = texture_desc.Format;
777 if (texture_desc.ArraySize == 1)
779 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
780 desc->Texture1D.MipSlice = 0;
784 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
785 desc->Texture1DArray.MipSlice = 0;
786 desc->Texture1DArray.FirstArraySlice = 0;
787 desc->Texture1DArray.ArraySize = 1;
793 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
795 ID3D10Texture2D *texture;
796 D3D10_TEXTURE2D_DESC texture_desc;
798 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
801 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
805 ID3D10Texture2D_GetDesc(texture, &texture_desc);
806 ID3D10Texture2D_Release(texture);
808 desc->Format = texture_desc.Format;
809 if (texture_desc.ArraySize == 1)
811 if (texture_desc.SampleDesc.Count == 1)
813 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
814 desc->Texture2D.MipSlice = 0;
818 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
823 if (texture_desc.SampleDesc.Count == 1)
825 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
826 desc->Texture2DArray.MipSlice = 0;
827 desc->Texture2DArray.FirstArraySlice = 0;
828 desc->Texture2DArray.ArraySize = 1;
832 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
833 desc->Texture2DMSArray.FirstArraySlice = 0;
834 desc->Texture2DMSArray.ArraySize = 1;
841 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
843 ID3D10Texture3D *texture;
844 D3D10_TEXTURE3D_DESC texture_desc;
846 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
849 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
853 ID3D10Texture3D_GetDesc(texture, &texture_desc);
854 ID3D10Texture3D_Release(texture);
856 desc->Format = texture_desc.Format;
857 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
858 desc->Texture3D.MipSlice = 0;
859 desc->Texture3D.FirstWSlice = 0;
860 desc->Texture3D.WSize = 1;
866 FIXME("Unhandled resource dimension %#x\n", dimension);
871 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
872 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
874 struct d3d10_device *This = (struct d3d10_device *)iface;
875 struct d3d10_rendertarget_view *object;
876 IWineD3DResource *wined3d_resource;
878 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
880 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
883 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
884 return E_OUTOFMEMORY;
887 object->vtbl = &d3d10_rendertarget_view_vtbl;
888 object->refcount = 1;
892 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
895 HeapFree(GetProcessHeap(), 0, object);
901 object->desc = *desc;
904 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
905 if (!wined3d_resource)
907 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
908 HeapFree(GetProcessHeap(), 0, object);
911 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
912 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
914 *view = (ID3D10RenderTargetView *)object;
919 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
920 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
922 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
927 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
928 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
929 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
931 struct d3d10_device *This = (struct d3d10_device *)iface;
932 struct d3d10_input_layout *object;
933 WINED3DVERTEXELEMENT *wined3d_elements;
934 UINT wined3d_element_count;
937 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
938 "\tshader_byte_code_length %lu, input_layout %p\n",
939 iface, element_descs, element_count, shader_byte_code,
940 shader_byte_code_length, input_layout);
942 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
945 ERR("Failed to allocate D3D10 input layout object memory\n");
946 return E_OUTOFMEMORY;
949 object->vtbl = &d3d10_input_layout_vtbl;
950 object->refcount = 1;
952 hr = d3d10_input_layout_to_wined3d_declaration(element_descs, element_count,
953 shader_byte_code, shader_byte_code_length, &wined3d_elements, &wined3d_element_count);
956 HeapFree(GetProcessHeap(), 0, object);
960 IWineD3DDevice_CreateVertexDeclaration(This->wined3d_device, &object->wined3d_decl,
961 (IUnknown *)object, wined3d_elements, wined3d_element_count);
963 HeapFree(GetProcessHeap(), 0, wined3d_elements);
965 *input_layout = (ID3D10InputLayout *)object;
970 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
971 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
973 struct d3d10_vertex_shader *object;
975 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
976 iface, byte_code, byte_code_length, shader);
978 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
981 ERR("Failed to allocate D3D10 vertex shader object memory\n");
982 return E_OUTOFMEMORY;
985 object->vtbl = &d3d10_vertex_shader_vtbl;
986 object->refcount = 1;
988 *shader = (ID3D10VertexShader *)object;
993 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
994 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
996 struct d3d10_geometry_shader *object;
998 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
999 iface, byte_code, byte_code_length, shader);
1001 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1004 ERR("Failed to allocate D3D10 geometry shader object memory\n");
1005 return E_OUTOFMEMORY;
1008 object->vtbl = &d3d10_geometry_shader_vtbl;
1009 object->refcount = 1;
1011 *shader = (ID3D10GeometryShader *)object;
1016 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
1017 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
1018 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
1020 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
1021 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
1022 iface, byte_code, byte_code_length, output_stream_decls,
1023 output_stream_decl_count, output_stream_stride, shader);
1028 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
1029 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
1031 struct d3d10_device *This = (struct d3d10_device *)iface;
1032 struct d3d10_pixel_shader *object;
1033 struct d3d10_shader_info shader_info;
1036 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
1037 iface, byte_code, byte_code_length, shader);
1039 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1042 ERR("Failed to allocate D3D10 pixel shader object memory\n");
1043 return E_OUTOFMEMORY;
1046 object->vtbl = &d3d10_pixel_shader_vtbl;
1047 object->refcount = 1;
1049 shader_info.output_signature = &object->output_signature;
1050 hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
1053 ERR("Failed to extract shader, hr %#x\n", hr);
1054 HeapFree(GetProcessHeap(), 0, object);
1058 hr = IWineD3DDevice_CreatePixelShader(This->wined3d_device,
1059 shader_info.shader_code, &object->output_signature,
1060 &object->wined3d_shader, (IUnknown *)object);
1063 ERR("CreatePixelShader failed, hr %#x\n", hr);
1064 shader_free_signature(&object->output_signature);
1065 HeapFree(GetProcessHeap(), 0, object);
1069 *shader = (ID3D10PixelShader *)object;
1074 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
1075 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
1077 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
1082 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
1083 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
1085 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
1090 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1091 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1093 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
1098 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1099 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1101 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
1106 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1107 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1109 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
1114 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1115 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1117 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1122 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1123 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1125 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1130 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1131 DXGI_FORMAT format, UINT *format_support)
1133 FIXME("iface %p, format %s, format_support %p stub!\n",
1134 iface, debug_dxgi_format(format), format_support);
1139 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1140 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1142 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1143 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1148 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1150 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1153 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1154 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1155 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1157 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1158 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1159 iface, desc, type, active_counters, name, name_length,
1160 units, units_length, description, description_length);
1165 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1167 FIXME("iface %p stub!\n", iface);
1172 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1173 HANDLE resource_handle, REFIID guid, void **resource)
1175 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1176 iface, resource_handle, debugstr_guid(guid), resource);
1181 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1183 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1186 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1188 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1191 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1193 /* IUnknown methods */
1194 d3d10_device_QueryInterface,
1195 d3d10_device_AddRef,
1196 d3d10_device_Release,
1197 /* ID3D10Device methods */
1198 d3d10_device_VSSetConstantBuffers,
1199 d3d10_device_PSSetShaderResources,
1200 d3d10_device_PSSetShader,
1201 d3d10_device_PSSetSamplers,
1202 d3d10_device_VSSetShader,
1203 d3d10_device_DrawIndexed,
1205 d3d10_device_PSSetConstantBuffers,
1206 d3d10_device_IASetInputLayout,
1207 d3d10_device_IASetVertexBuffers,
1208 d3d10_device_IASetIndexBuffer,
1209 d3d10_device_DrawIndexedInstanced,
1210 d3d10_device_DrawInstanced,
1211 d3d10_device_GSSetConstantBuffers,
1212 d3d10_device_GSSetShader,
1213 d3d10_device_IASetPrimitiveTopology,
1214 d3d10_device_VSSetShaderResources,
1215 d3d10_device_VSSetSamplers,
1216 d3d10_device_SetPredication,
1217 d3d10_device_GSSetShaderResources,
1218 d3d10_device_GSSetSamplers,
1219 d3d10_device_OMSetRenderTargets,
1220 d3d10_device_OMSetBlendState,
1221 d3d10_device_OMSetDepthStencilState,
1222 d3d10_device_SOSetTargets,
1223 d3d10_device_DrawAuto,
1224 d3d10_device_RSSetState,
1225 d3d10_device_RSSetViewports,
1226 d3d10_device_RSSetScissorRects,
1227 d3d10_device_CopySubresourceRegion,
1228 d3d10_device_CopyResource,
1229 d3d10_device_UpdateSubresource,
1230 d3d10_device_ClearRenderTargetView,
1231 d3d10_device_ClearDepthStencilView,
1232 d3d10_device_GenerateMips,
1233 d3d10_device_ResolveSubresource,
1234 d3d10_device_VSGetConstantBuffers,
1235 d3d10_device_PSGetShaderResources,
1236 d3d10_device_PSGetShader,
1237 d3d10_device_PSGetSamplers,
1238 d3d10_device_VSGetShader,
1239 d3d10_device_PSGetConstantBuffers,
1240 d3d10_device_IAGetInputLayout,
1241 d3d10_device_IAGetVertexBuffers,
1242 d3d10_device_IAGetIndexBuffer,
1243 d3d10_device_GSGetConstantBuffers,
1244 d3d10_device_GSGetShader,
1245 d3d10_device_IAGetPrimitiveTopology,
1246 d3d10_device_VSGetShaderResources,
1247 d3d10_device_VSGetSamplers,
1248 d3d10_device_GetPredication,
1249 d3d10_device_GSGetShaderResources,
1250 d3d10_device_GSGetSamplers,
1251 d3d10_device_OMGetRenderTargets,
1252 d3d10_device_OMGetBlendState,
1253 d3d10_device_OMGetDepthStencilState,
1254 d3d10_device_SOGetTargets,
1255 d3d10_device_RSGetState,
1256 d3d10_device_RSGetViewports,
1257 d3d10_device_RSGetScissorRects,
1258 d3d10_device_GetDeviceRemovedReason,
1259 d3d10_device_SetExceptionMode,
1260 d3d10_device_GetExceptionMode,
1261 d3d10_device_GetPrivateData,
1262 d3d10_device_SetPrivateData,
1263 d3d10_device_SetPrivateDataInterface,
1264 d3d10_device_ClearState,
1266 d3d10_device_CreateBuffer,
1267 d3d10_device_CreateTexture1D,
1268 d3d10_device_CreateTexture2D,
1269 d3d10_device_CreateTexture3D,
1270 d3d10_device_CreateShaderResourceView,
1271 d3d10_device_CreateRenderTargetView,
1272 d3d10_device_CreateDepthStencilView,
1273 d3d10_device_CreateInputLayout,
1274 d3d10_device_CreateVertexShader,
1275 d3d10_device_CreateGeometryShader,
1276 d3d10_device_CreateGeometryShaderWithStreamOutput,
1277 d3d10_device_CreatePixelShader,
1278 d3d10_device_CreateBlendState,
1279 d3d10_device_CreateDepthStencilState,
1280 d3d10_device_CreateRasterizerState,
1281 d3d10_device_CreateSamplerState,
1282 d3d10_device_CreateQuery,
1283 d3d10_device_CreatePredicate,
1284 d3d10_device_CreateCounter,
1285 d3d10_device_CheckFormatSupport,
1286 d3d10_device_CheckMultisampleQualityLevels,
1287 d3d10_device_CheckCounterInfo,
1288 d3d10_device_CheckCounter,
1289 d3d10_device_GetCreationFlags,
1290 d3d10_device_OpenSharedResource,
1291 d3d10_device_SetTextFilterSize,
1292 d3d10_device_GetTextFilterSize,
1295 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1297 /* IUnknown methods */
1298 d3d10_device_inner_QueryInterface,
1299 d3d10_device_inner_AddRef,
1300 d3d10_device_inner_Release,
1303 /* IWineD3DDeviceParent IUnknown methods */
1305 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1307 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1310 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1312 struct d3d10_device *This = device_from_device_parent(iface);
1313 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1316 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1318 struct d3d10_device *This = device_from_device_parent(iface);
1319 return d3d10_device_AddRef((ID3D10Device *)This);
1322 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1324 struct d3d10_device *This = device_from_device_parent(iface);
1325 return d3d10_device_Release((ID3D10Device *)This);
1328 /* IWineD3DDeviceParent methods */
1330 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1332 struct d3d10_device *This = device_from_device_parent(iface);
1334 TRACE("iface %p, device %p\n", iface, device);
1336 IWineD3DDevice_AddRef(device);
1337 This->wined3d_device = device;
1340 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1341 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1342 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1344 struct d3d10_device *This = device_from_device_parent(iface);
1345 struct d3d10_texture2d *texture;
1346 D3D10_TEXTURE2D_DESC desc;
1349 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1350 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1351 iface, superior, width, height, format, usage, pool, level, face, surface);
1353 FIXME("Implement DXGI<->wined3d usage conversion\n");
1356 desc.Height = height;
1359 desc.Format = dxgi_format_from_wined3dformat(format);
1360 desc.SampleDesc.Count = 1;
1361 desc.SampleDesc.Quality = 0;
1364 desc.CPUAccessFlags = 0;
1367 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1370 ERR("CreateTexture2D failed, returning %#x\n", hr);
1374 *surface = texture->wined3d_surface;
1379 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1380 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1381 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1383 struct d3d10_device *This = device_from_device_parent(iface);
1384 struct d3d10_texture2d *texture;
1385 D3D10_TEXTURE2D_DESC desc;
1388 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1389 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1390 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1392 FIXME("Implement DXGI<->wined3d usage conversion\n");
1395 desc.Height = height;
1398 desc.Format = dxgi_format_from_wined3dformat(format);
1399 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1400 desc.SampleDesc.Quality = multisample_quality;
1401 desc.Usage = D3D10_USAGE_DEFAULT;
1402 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1403 desc.CPUAccessFlags = 0;
1406 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1409 ERR("CreateTexture2D failed, returning %#x\n", hr);
1413 *surface = texture->wined3d_surface;
1418 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1419 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1420 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1422 struct d3d10_device *This = device_from_device_parent(iface);
1423 struct d3d10_texture2d *texture;
1424 D3D10_TEXTURE2D_DESC desc;
1427 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1428 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1429 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1431 FIXME("Implement DXGI<->wined3d usage conversion\n");
1434 desc.Height = height;
1437 desc.Format = dxgi_format_from_wined3dformat(format);
1438 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1439 desc.SampleDesc.Quality = multisample_quality;
1440 desc.Usage = D3D10_USAGE_DEFAULT;
1441 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1442 desc.CPUAccessFlags = 0;
1445 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1448 ERR("CreateTexture2D failed, returning %#x\n", hr);
1452 *surface = texture->wined3d_surface;
1457 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1458 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1459 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1461 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1462 iface, superior, width, height, depth, format, pool, usage, volume);
1467 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1468 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1470 IWineDXGIDevice *wine_device;
1473 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1475 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1478 ERR("Device should implement IWineDXGIDevice\n");
1482 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1483 IWineDXGIDevice_Release(wine_device);
1486 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1493 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1495 /* IUnknown methods */
1496 device_parent_QueryInterface,
1497 device_parent_AddRef,
1498 device_parent_Release,
1499 /* IWineD3DDeviceParent methods */
1500 device_parent_WineD3DDeviceCreated,
1501 device_parent_CreateSurface,
1502 device_parent_CreateRenderTarget,
1503 device_parent_CreateDepthStencilSurface,
1504 device_parent_CreateVolume,
1505 device_parent_CreateSwapChain,