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 #define NONAMELESSUNION
24 #include "d3d10core_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
28 /* Inner IUnknown methods */
30 static inline struct d3d10_device *d3d10_device_from_inner_unknown(IUnknown *iface)
32 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, inner_unknown_vtbl));
35 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid, void **object)
37 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
39 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
41 if (IsEqualGUID(riid, &IID_IUnknown)
42 || IsEqualGUID(riid, &IID_ID3D10Device))
44 IUnknown_AddRef((IUnknown *)This);
49 if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
51 IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
52 *object = &This->device_parent_vtbl;
56 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
62 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
64 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
65 ULONG refcount = InterlockedIncrement(&This->refcount);
67 TRACE("%p increasing refcount to %u\n", This, refcount);
72 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
74 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
75 ULONG refcount = InterlockedDecrement(&This->refcount);
77 TRACE("%p decreasing refcount to %u\n", This, refcount);
81 if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
87 /* IUnknown methods */
89 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
91 struct d3d10_device *This = (struct d3d10_device *)iface;
92 TRACE("Forwarding to outer IUnknown\n");
93 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
96 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
98 struct d3d10_device *This = (struct d3d10_device *)iface;
99 TRACE("Forwarding to outer IUnknown\n");
100 return IUnknown_AddRef(This->outer_unknown);
103 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
105 struct d3d10_device *This = (struct d3d10_device *)iface;
106 TRACE("Forwarding to outer IUnknown\n");
107 return IUnknown_Release(This->outer_unknown);
110 /* ID3D10Device methods */
112 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
113 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
115 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
116 iface, start_slot, buffer_count, buffers);
119 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
120 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
122 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
123 iface, start_slot, view_count, views);
126 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
128 struct d3d10_device *This = (struct d3d10_device *)iface;
129 struct d3d10_pixel_shader *ps = (struct d3d10_pixel_shader *)shader;
131 TRACE("iface %p, shader %p\n", iface, shader);
133 IWineD3DDevice_SetPixelShader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
136 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
137 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
139 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
140 iface, start_slot, sampler_count, samplers);
143 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
145 struct d3d10_device *This = (struct d3d10_device *)iface;
146 struct d3d10_vertex_shader *vs = (struct d3d10_vertex_shader *)shader;
148 TRACE("iface %p, shader %p\n", iface, shader);
150 IWineD3DDevice_SetVertexShader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
153 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
154 UINT index_count, UINT start_index_location, INT base_vertex_location)
156 struct d3d10_device *This = (struct d3d10_device *)iface;
158 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
159 iface, index_count, start_index_location, base_vertex_location);
161 IWineD3DDevice_SetBaseVertexIndex(This->wined3d_device, base_vertex_location);
162 IWineD3DDevice_DrawIndexedPrimitive(This->wined3d_device, start_index_location, index_count);
165 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
166 UINT vertex_count, UINT start_vertex_location)
168 struct d3d10_device *This = (struct d3d10_device *)iface;
170 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
171 iface, vertex_count, start_vertex_location);
173 IWineD3DDevice_DrawPrimitive(This->wined3d_device, start_vertex_location, vertex_count);
176 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
177 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
179 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
180 iface, start_slot, buffer_count, buffers);
183 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
185 struct d3d10_device *This = (struct d3d10_device *)iface;
187 TRACE("iface %p, input_layout %p\n", iface, input_layout);
189 IWineD3DDevice_SetVertexDeclaration(This->wined3d_device,
190 ((struct d3d10_input_layout *)input_layout)->wined3d_decl);
193 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
194 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
195 const UINT *strides, const UINT *offsets)
197 struct d3d10_device *This = (struct d3d10_device *)iface;
200 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
201 iface, start_slot, buffer_count, buffers, strides, offsets);
203 for (i = 0; i < buffer_count; ++i)
205 IWineD3DDevice_SetStreamSource(This->wined3d_device, start_slot,
206 ((struct d3d10_buffer *)buffers[i])->wined3d_buffer, offsets[i], strides[i]);
210 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
211 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
213 struct d3d10_device *This = (struct d3d10_device *)iface;
215 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
216 iface, buffer, debug_dxgi_format(format), offset);
218 IWineD3DDevice_SetIndices(This->wined3d_device, buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
219 wined3dformat_from_dxgi_format(format));
220 if (offset) FIXME("offset %u not supported.\n", offset);
223 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
224 UINT instance_index_count, UINT instance_count, UINT start_index_location,
225 INT base_vertex_location, UINT start_instance_location)
227 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
228 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
229 iface, instance_index_count, instance_count, start_index_location,
230 base_vertex_location, start_instance_location);
233 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
234 UINT instance_vertex_count, UINT instance_count,
235 UINT start_vertex_location, UINT start_instance_location)
237 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
238 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
239 start_vertex_location, start_instance_location);
242 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
243 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
245 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
246 iface, start_slot, buffer_count, buffers);
249 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
251 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
252 else WARN("iface %p, shader %p stub!\n", iface, shader);
255 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
257 struct d3d10_device *This = (struct d3d10_device *)iface;
259 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
261 IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
264 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
265 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
267 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
268 iface, start_slot, view_count, views);
271 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
272 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
274 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
275 iface, start_slot, sampler_count, samplers);
278 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
280 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
283 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
284 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
286 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
287 iface, start_slot, view_count, views);
290 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
291 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
293 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
294 iface, start_slot, sampler_count, samplers);
297 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
298 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
299 ID3D10DepthStencilView *depth_stencil_view)
301 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
302 iface, render_target_view_count, render_target_views, depth_stencil_view);
305 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
306 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
308 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
309 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
312 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
313 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
315 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
316 iface, depth_stencil_state, stencil_ref);
319 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
320 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
322 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
325 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
327 FIXME("iface %p stub!\n", iface);
330 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
332 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
335 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
336 UINT viewport_count, const D3D10_VIEWPORT *viewports)
338 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
341 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
342 UINT rect_count, const D3D10_RECT *rects)
344 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
347 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
348 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
349 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
351 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
352 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
353 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
354 src_resource, src_subresource_idx, src_box);
357 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
358 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
360 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
363 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
364 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
365 const void *data, UINT row_pitch, UINT depth_pitch)
367 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
368 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
371 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
372 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
374 struct d3d10_device *This = (struct d3d10_device *)iface;
375 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
377 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
378 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
380 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
383 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
384 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
386 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
387 iface, depth_stencil_view, flags, depth, stencil);
390 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
392 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
395 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
396 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
397 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
399 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
400 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
401 iface, dst_resource, dst_subresource_idx,
402 src_resource, src_subresource_idx, debug_dxgi_format(format));
405 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
406 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
408 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
409 iface, start_slot, buffer_count, buffers);
412 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
413 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
415 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
416 iface, start_slot, view_count, views);
419 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
421 FIXME("iface %p, shader %p stub!\n", iface, shader);
424 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
425 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
427 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
428 iface, start_slot, sampler_count, samplers);
431 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
433 FIXME("iface %p, shader %p stub!\n", iface, shader);
436 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
437 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
439 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
440 iface, start_slot, buffer_count, buffers);
443 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
445 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
448 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
449 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
451 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
452 iface, start_slot, buffer_count, buffers, strides, offsets);
455 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
456 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
458 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
461 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
462 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
464 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
465 iface, start_slot, buffer_count, buffers);
468 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
470 FIXME("iface %p, shader %p stub!\n", iface, shader);
473 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
475 struct d3d10_device *This = (struct d3d10_device *)iface;
477 TRACE("iface %p, topology %p\n", iface, topology);
479 IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
482 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
483 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
485 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
486 iface, start_slot, view_count, views);
489 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
490 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
492 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
493 iface, start_slot, sampler_count, samplers);
496 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
497 ID3D10Predicate **predicate, BOOL *value)
499 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
502 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
503 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
505 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
506 iface, start_slot, view_count, views);
509 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
510 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
512 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
513 iface, start_slot, sampler_count, samplers);
516 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
517 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
519 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
520 iface, view_count, render_target_views, depth_stencil_view);
523 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
524 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
526 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
527 iface, blend_state, blend_factor, sample_mask);
530 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
531 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
533 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
534 iface, depth_stencil_state, stencil_ref);
537 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
538 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
540 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
541 iface, buffer_count, buffers, offsets);
544 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
546 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
549 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
550 UINT *viewport_count, D3D10_VIEWPORT *viewports)
552 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
555 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
557 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
560 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
562 FIXME("iface %p stub!\n", iface);
567 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
569 FIXME("iface %p, flags %#x stub!\n", iface, flags);
574 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
576 FIXME("iface %p stub!\n", iface);
581 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
582 REFGUID guid, UINT *data_size, void *data)
584 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
585 iface, debugstr_guid(guid), data_size, data);
590 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
591 REFGUID guid, UINT data_size, const void *data)
593 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
594 iface, debugstr_guid(guid), data_size, data);
599 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
600 REFGUID guid, const IUnknown *data)
602 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
607 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
609 FIXME("iface %p stub!\n", iface);
612 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
614 FIXME("iface %p stub!\n", iface);
617 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
618 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
620 struct d3d10_device *This = (struct d3d10_device *)iface;
621 struct wined3d_buffer_desc wined3d_desc;
622 struct d3d10_buffer *object;
625 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
627 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
630 ERR("Failed to allocate D3D10 buffer object memory\n");
631 return E_OUTOFMEMORY;
634 object->vtbl = &d3d10_buffer_vtbl;
635 object->refcount = 1;
637 FIXME("Implement DXGI<->wined3d usage conversion\n");
639 wined3d_desc.byte_width = desc->ByteWidth;
640 wined3d_desc.usage = desc->Usage;
641 wined3d_desc.bind_flags = desc->BindFlags;
642 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
643 wined3d_desc.misc_flags = desc->MiscFlags;
645 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
646 data ? data->pSysMem : NULL, (IUnknown *)object, &object->wined3d_buffer);
649 ERR("CreateBuffer failed, returning %#x\n", hr);
650 HeapFree(GetProcessHeap(), 0, object);
654 *buffer = (ID3D10Buffer *)object;
656 TRACE("Created ID3D10Buffer %p\n", object);
661 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
662 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
664 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
669 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
670 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
672 struct d3d10_device *This = (struct d3d10_device *)iface;
673 struct d3d10_texture2d *object;
676 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
678 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
681 ERR("Failed to allocate D3D10 texture2d object memory\n");
682 return E_OUTOFMEMORY;
685 hr = d3d10_texture2d_init(object, This, desc);
688 WARN("Failed to initialize texture, hr %#x.\n", hr);
689 HeapFree(GetProcessHeap(), 0, object);
693 *texture = (ID3D10Texture2D *)object;
695 TRACE("Created ID3D10Texture2D %p\n", object);
700 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
701 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
703 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
708 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
709 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
711 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
716 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
718 D3D10_RESOURCE_DIMENSION dimension;
720 ID3D10Resource_GetType(resource, &dimension);
724 case D3D10_RESOURCE_DIMENSION_BUFFER:
725 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
727 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
728 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
731 FIXME("Unhandled resource dimension %#x\n", dimension);
736 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
738 D3D10_RESOURCE_DIMENSION dimension;
741 ID3D10Resource_GetType(resource, &dimension);
745 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
747 ID3D10Texture1D *texture;
748 D3D10_TEXTURE1D_DESC texture_desc;
750 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
753 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
757 ID3D10Texture1D_GetDesc(texture, &texture_desc);
758 ID3D10Texture1D_Release(texture);
760 desc->Format = texture_desc.Format;
761 if (texture_desc.ArraySize == 1)
763 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
764 desc->u.Texture1D.MipSlice = 0;
768 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
769 desc->u.Texture1DArray.MipSlice = 0;
770 desc->u.Texture1DArray.FirstArraySlice = 0;
771 desc->u.Texture1DArray.ArraySize = 1;
777 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
779 ID3D10Texture2D *texture;
780 D3D10_TEXTURE2D_DESC texture_desc;
782 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
785 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
789 ID3D10Texture2D_GetDesc(texture, &texture_desc);
790 ID3D10Texture2D_Release(texture);
792 desc->Format = texture_desc.Format;
793 if (texture_desc.ArraySize == 1)
795 if (texture_desc.SampleDesc.Count == 1)
797 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
798 desc->u.Texture2D.MipSlice = 0;
802 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
807 if (texture_desc.SampleDesc.Count == 1)
809 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
810 desc->u.Texture2DArray.MipSlice = 0;
811 desc->u.Texture2DArray.FirstArraySlice = 0;
812 desc->u.Texture2DArray.ArraySize = 1;
816 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
817 desc->u.Texture2DMSArray.FirstArraySlice = 0;
818 desc->u.Texture2DMSArray.ArraySize = 1;
825 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
827 ID3D10Texture3D *texture;
828 D3D10_TEXTURE3D_DESC texture_desc;
830 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
833 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
837 ID3D10Texture3D_GetDesc(texture, &texture_desc);
838 ID3D10Texture3D_Release(texture);
840 desc->Format = texture_desc.Format;
841 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
842 desc->u.Texture3D.MipSlice = 0;
843 desc->u.Texture3D.FirstWSlice = 0;
844 desc->u.Texture3D.WSize = 1;
850 FIXME("Unhandled resource dimension %#x\n", dimension);
855 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
856 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
858 struct d3d10_device *This = (struct d3d10_device *)iface;
859 struct d3d10_rendertarget_view *object;
860 IWineD3DResource *wined3d_resource;
862 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
864 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
867 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
868 return E_OUTOFMEMORY;
871 object->vtbl = &d3d10_rendertarget_view_vtbl;
872 object->refcount = 1;
876 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
879 HeapFree(GetProcessHeap(), 0, object);
885 object->desc = *desc;
888 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
889 if (!wined3d_resource)
891 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
892 HeapFree(GetProcessHeap(), 0, object);
895 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
896 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
898 *view = (ID3D10RenderTargetView *)object;
903 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
904 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
906 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
911 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
912 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
913 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
915 struct d3d10_device *This = (struct d3d10_device *)iface;
916 struct d3d10_input_layout *object;
917 WINED3DVERTEXELEMENT *wined3d_elements;
918 UINT wined3d_element_count;
921 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
922 "\tshader_byte_code_length %lu, input_layout %p\n",
923 iface, element_descs, element_count, shader_byte_code,
924 shader_byte_code_length, input_layout);
926 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
929 ERR("Failed to allocate D3D10 input layout object memory\n");
930 return E_OUTOFMEMORY;
933 object->vtbl = &d3d10_input_layout_vtbl;
934 object->refcount = 1;
936 hr = d3d10_input_layout_to_wined3d_declaration(element_descs, element_count,
937 shader_byte_code, shader_byte_code_length, &wined3d_elements, &wined3d_element_count);
940 HeapFree(GetProcessHeap(), 0, object);
944 IWineD3DDevice_CreateVertexDeclaration(This->wined3d_device, &object->wined3d_decl,
945 (IUnknown *)object, wined3d_elements, wined3d_element_count);
947 HeapFree(GetProcessHeap(), 0, wined3d_elements);
949 *input_layout = (ID3D10InputLayout *)object;
954 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
955 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
957 struct d3d10_device *This = (struct d3d10_device *)iface;
958 struct d3d10_vertex_shader *object;
959 struct d3d10_shader_info shader_info;
962 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
963 iface, byte_code, byte_code_length, shader);
965 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
968 ERR("Failed to allocate D3D10 vertex shader object memory\n");
969 return E_OUTOFMEMORY;
972 object->vtbl = &d3d10_vertex_shader_vtbl;
973 object->refcount = 1;
975 shader_info.output_signature = &object->output_signature;
976 hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
979 ERR("Failed to extract shader, hr %#x\n", hr);
980 HeapFree(GetProcessHeap(), 0, object);
984 hr = IWineD3DDevice_CreateVertexShader(This->wined3d_device,
985 shader_info.shader_code, &object->output_signature,
986 &object->wined3d_shader, (IUnknown *)object);
989 ERR("CreateVertexShader failed, hr %#x\n", hr);
990 shader_free_signature(&object->output_signature);
991 HeapFree(GetProcessHeap(), 0, object);
995 *shader = (ID3D10VertexShader *)object;
1000 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
1001 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
1003 struct d3d10_geometry_shader *object;
1005 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
1006 iface, byte_code, byte_code_length, shader);
1008 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1011 ERR("Failed to allocate D3D10 geometry shader object memory\n");
1012 return E_OUTOFMEMORY;
1015 object->vtbl = &d3d10_geometry_shader_vtbl;
1016 object->refcount = 1;
1018 *shader = (ID3D10GeometryShader *)object;
1023 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
1024 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
1025 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
1027 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
1028 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
1029 iface, byte_code, byte_code_length, output_stream_decls,
1030 output_stream_decl_count, output_stream_stride, shader);
1035 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
1036 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
1038 struct d3d10_device *This = (struct d3d10_device *)iface;
1039 struct d3d10_pixel_shader *object;
1040 struct d3d10_shader_info shader_info;
1043 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
1044 iface, byte_code, byte_code_length, shader);
1046 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1049 ERR("Failed to allocate D3D10 pixel shader object memory\n");
1050 return E_OUTOFMEMORY;
1053 object->vtbl = &d3d10_pixel_shader_vtbl;
1054 object->refcount = 1;
1056 shader_info.output_signature = &object->output_signature;
1057 hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
1060 ERR("Failed to extract shader, hr %#x\n", hr);
1061 HeapFree(GetProcessHeap(), 0, object);
1065 hr = IWineD3DDevice_CreatePixelShader(This->wined3d_device,
1066 shader_info.shader_code, &object->output_signature,
1067 &object->wined3d_shader, (IUnknown *)object);
1070 ERR("CreatePixelShader failed, hr %#x\n", hr);
1071 shader_free_signature(&object->output_signature);
1072 HeapFree(GetProcessHeap(), 0, object);
1076 *shader = (ID3D10PixelShader *)object;
1081 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
1082 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
1084 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
1089 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
1090 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
1092 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
1097 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1098 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1100 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
1105 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1106 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1108 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
1113 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1114 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1116 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
1121 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1122 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1124 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1129 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1130 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1132 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1137 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1138 DXGI_FORMAT format, UINT *format_support)
1140 FIXME("iface %p, format %s, format_support %p stub!\n",
1141 iface, debug_dxgi_format(format), format_support);
1146 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1147 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1149 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1150 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1155 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1157 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1160 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1161 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1162 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1164 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1165 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1166 iface, desc, type, active_counters, name, name_length,
1167 units, units_length, description, description_length);
1172 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1174 FIXME("iface %p stub!\n", iface);
1179 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1180 HANDLE resource_handle, REFIID guid, void **resource)
1182 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1183 iface, resource_handle, debugstr_guid(guid), resource);
1188 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1190 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1193 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1195 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1198 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1200 /* IUnknown methods */
1201 d3d10_device_QueryInterface,
1202 d3d10_device_AddRef,
1203 d3d10_device_Release,
1204 /* ID3D10Device methods */
1205 d3d10_device_VSSetConstantBuffers,
1206 d3d10_device_PSSetShaderResources,
1207 d3d10_device_PSSetShader,
1208 d3d10_device_PSSetSamplers,
1209 d3d10_device_VSSetShader,
1210 d3d10_device_DrawIndexed,
1212 d3d10_device_PSSetConstantBuffers,
1213 d3d10_device_IASetInputLayout,
1214 d3d10_device_IASetVertexBuffers,
1215 d3d10_device_IASetIndexBuffer,
1216 d3d10_device_DrawIndexedInstanced,
1217 d3d10_device_DrawInstanced,
1218 d3d10_device_GSSetConstantBuffers,
1219 d3d10_device_GSSetShader,
1220 d3d10_device_IASetPrimitiveTopology,
1221 d3d10_device_VSSetShaderResources,
1222 d3d10_device_VSSetSamplers,
1223 d3d10_device_SetPredication,
1224 d3d10_device_GSSetShaderResources,
1225 d3d10_device_GSSetSamplers,
1226 d3d10_device_OMSetRenderTargets,
1227 d3d10_device_OMSetBlendState,
1228 d3d10_device_OMSetDepthStencilState,
1229 d3d10_device_SOSetTargets,
1230 d3d10_device_DrawAuto,
1231 d3d10_device_RSSetState,
1232 d3d10_device_RSSetViewports,
1233 d3d10_device_RSSetScissorRects,
1234 d3d10_device_CopySubresourceRegion,
1235 d3d10_device_CopyResource,
1236 d3d10_device_UpdateSubresource,
1237 d3d10_device_ClearRenderTargetView,
1238 d3d10_device_ClearDepthStencilView,
1239 d3d10_device_GenerateMips,
1240 d3d10_device_ResolveSubresource,
1241 d3d10_device_VSGetConstantBuffers,
1242 d3d10_device_PSGetShaderResources,
1243 d3d10_device_PSGetShader,
1244 d3d10_device_PSGetSamplers,
1245 d3d10_device_VSGetShader,
1246 d3d10_device_PSGetConstantBuffers,
1247 d3d10_device_IAGetInputLayout,
1248 d3d10_device_IAGetVertexBuffers,
1249 d3d10_device_IAGetIndexBuffer,
1250 d3d10_device_GSGetConstantBuffers,
1251 d3d10_device_GSGetShader,
1252 d3d10_device_IAGetPrimitiveTopology,
1253 d3d10_device_VSGetShaderResources,
1254 d3d10_device_VSGetSamplers,
1255 d3d10_device_GetPredication,
1256 d3d10_device_GSGetShaderResources,
1257 d3d10_device_GSGetSamplers,
1258 d3d10_device_OMGetRenderTargets,
1259 d3d10_device_OMGetBlendState,
1260 d3d10_device_OMGetDepthStencilState,
1261 d3d10_device_SOGetTargets,
1262 d3d10_device_RSGetState,
1263 d3d10_device_RSGetViewports,
1264 d3d10_device_RSGetScissorRects,
1265 d3d10_device_GetDeviceRemovedReason,
1266 d3d10_device_SetExceptionMode,
1267 d3d10_device_GetExceptionMode,
1268 d3d10_device_GetPrivateData,
1269 d3d10_device_SetPrivateData,
1270 d3d10_device_SetPrivateDataInterface,
1271 d3d10_device_ClearState,
1273 d3d10_device_CreateBuffer,
1274 d3d10_device_CreateTexture1D,
1275 d3d10_device_CreateTexture2D,
1276 d3d10_device_CreateTexture3D,
1277 d3d10_device_CreateShaderResourceView,
1278 d3d10_device_CreateRenderTargetView,
1279 d3d10_device_CreateDepthStencilView,
1280 d3d10_device_CreateInputLayout,
1281 d3d10_device_CreateVertexShader,
1282 d3d10_device_CreateGeometryShader,
1283 d3d10_device_CreateGeometryShaderWithStreamOutput,
1284 d3d10_device_CreatePixelShader,
1285 d3d10_device_CreateBlendState,
1286 d3d10_device_CreateDepthStencilState,
1287 d3d10_device_CreateRasterizerState,
1288 d3d10_device_CreateSamplerState,
1289 d3d10_device_CreateQuery,
1290 d3d10_device_CreatePredicate,
1291 d3d10_device_CreateCounter,
1292 d3d10_device_CheckFormatSupport,
1293 d3d10_device_CheckMultisampleQualityLevels,
1294 d3d10_device_CheckCounterInfo,
1295 d3d10_device_CheckCounter,
1296 d3d10_device_GetCreationFlags,
1297 d3d10_device_OpenSharedResource,
1298 d3d10_device_SetTextFilterSize,
1299 d3d10_device_GetTextFilterSize,
1302 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1304 /* IUnknown methods */
1305 d3d10_device_inner_QueryInterface,
1306 d3d10_device_inner_AddRef,
1307 d3d10_device_inner_Release,
1310 /* IWineD3DDeviceParent IUnknown methods */
1312 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1314 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1317 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1319 struct d3d10_device *This = device_from_device_parent(iface);
1320 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1323 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1325 struct d3d10_device *This = device_from_device_parent(iface);
1326 return d3d10_device_AddRef((ID3D10Device *)This);
1329 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1331 struct d3d10_device *This = device_from_device_parent(iface);
1332 return d3d10_device_Release((ID3D10Device *)This);
1335 /* IWineD3DDeviceParent methods */
1337 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1339 struct d3d10_device *This = device_from_device_parent(iface);
1341 TRACE("iface %p, device %p\n", iface, device);
1343 IWineD3DDevice_AddRef(device);
1344 This->wined3d_device = device;
1347 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1348 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1349 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1351 struct d3d10_device *This = device_from_device_parent(iface);
1352 struct d3d10_texture2d *texture;
1353 D3D10_TEXTURE2D_DESC desc;
1356 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1357 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1358 iface, superior, width, height, format, usage, pool, level, face, surface);
1360 FIXME("Implement DXGI<->wined3d usage conversion\n");
1363 desc.Height = height;
1366 desc.Format = dxgi_format_from_wined3dformat(format);
1367 desc.SampleDesc.Count = 1;
1368 desc.SampleDesc.Quality = 0;
1371 desc.CPUAccessFlags = 0;
1374 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1377 ERR("CreateTexture2D failed, returning %#x\n", hr);
1381 *surface = texture->wined3d_surface;
1382 IWineD3DSurface_AddRef(*surface);
1383 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1388 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1389 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1390 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1392 struct d3d10_device *This = device_from_device_parent(iface);
1393 struct d3d10_texture2d *texture;
1394 D3D10_TEXTURE2D_DESC desc;
1397 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1398 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1399 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1401 FIXME("Implement DXGI<->wined3d usage conversion\n");
1404 desc.Height = height;
1407 desc.Format = dxgi_format_from_wined3dformat(format);
1408 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1409 desc.SampleDesc.Quality = multisample_quality;
1410 desc.Usage = D3D10_USAGE_DEFAULT;
1411 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1412 desc.CPUAccessFlags = 0;
1415 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1418 ERR("CreateTexture2D failed, returning %#x\n", hr);
1422 *surface = texture->wined3d_surface;
1423 IWineD3DSurface_AddRef(*surface);
1424 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1429 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1430 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1431 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1433 struct d3d10_device *This = device_from_device_parent(iface);
1434 struct d3d10_texture2d *texture;
1435 D3D10_TEXTURE2D_DESC desc;
1438 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1439 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1440 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1442 FIXME("Implement DXGI<->wined3d usage conversion\n");
1445 desc.Height = height;
1448 desc.Format = dxgi_format_from_wined3dformat(format);
1449 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1450 desc.SampleDesc.Quality = multisample_quality;
1451 desc.Usage = D3D10_USAGE_DEFAULT;
1452 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1453 desc.CPUAccessFlags = 0;
1456 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1459 ERR("CreateTexture2D failed, returning %#x\n", hr);
1463 *surface = texture->wined3d_surface;
1464 IWineD3DSurface_AddRef(*surface);
1465 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1470 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1471 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1472 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1474 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1475 iface, superior, width, height, depth, format, pool, usage, volume);
1480 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1481 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1483 IWineDXGIDevice *wine_device;
1486 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1488 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1491 ERR("Device should implement IWineDXGIDevice\n");
1495 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1496 IWineDXGIDevice_Release(wine_device);
1499 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1506 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1508 /* IUnknown methods */
1509 device_parent_QueryInterface,
1510 device_parent_AddRef,
1511 device_parent_Release,
1512 /* IWineD3DDeviceParent methods */
1513 device_parent_WineD3DDeviceCreated,
1514 device_parent_CreateSurface,
1515 device_parent_CreateRenderTarget,
1516 device_parent_CreateDepthStencilSurface,
1517 device_parent_CreateVolume,
1518 device_parent_CreateSwapChain,