push eb25bf65c4616aa55a810ed5c29198b1a080b208
[wine/hacks.git] / dlls / d3d10core / device.c
blob1406c38ddf692500c24cf3a85235391d472da04e
1 /*
2 * Copyright 2008 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
20 #include "config.h"
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);
44 *object = This;
45 return S_OK;
48 if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
50 IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
51 *object = &This->device_parent_vtbl;
52 return S_OK;
55 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
57 *object = NULL;
58 return E_NOINTERFACE;
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);
68 return 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);
78 if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
80 return refcount;
83 /* IUnknown methods */
85 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
87 struct d3d10_device *This = (struct d3d10_device *)iface;
88 TRACE("Forwarding to outer IUnknown\n");
89 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
92 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
94 struct d3d10_device *This = (struct d3d10_device *)iface;
95 TRACE("Forwarding to outer IUnknown\n");
96 return IUnknown_AddRef(This->outer_unknown);
99 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
101 struct d3d10_device *This = (struct d3d10_device *)iface;
102 TRACE("Forwarding to outer IUnknown\n");
103 return IUnknown_Release(This->outer_unknown);
106 /* ID3D10Device methods */
108 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
109 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
111 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
112 iface, start_slot, buffer_count, buffers);
115 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
116 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
118 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
119 iface, start_slot, view_count, views);
122 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
124 FIXME("iface %p, shader %p stub!\n", iface, shader);
127 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
128 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
130 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
131 iface, start_slot, sampler_count, samplers);
134 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
136 FIXME("iface %p, shader %p stub!\n", iface, shader);
139 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
140 UINT index_count, UINT start_index_location, INT base_vertex_location)
142 FIXME("iface %p, index_count %u, start_index_location %u, base_vertex_location %d stub!\n",
143 iface, index_count, start_index_location, base_vertex_location);
146 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
147 UINT vertex_count, UINT start_vertex_location)
149 struct d3d10_device *This = (struct d3d10_device *)iface;
151 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
152 iface, vertex_count, start_vertex_location);
154 IWineD3DDevice_DrawPrimitive(This->wined3d_device, start_vertex_location, vertex_count);
157 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
158 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
160 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
161 iface, start_slot, buffer_count, buffers);
164 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
166 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
169 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
170 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
171 const UINT *strides, const UINT *offsets)
173 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
174 iface, start_slot, buffer_count, buffers, strides, offsets);
177 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
178 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
180 FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
181 iface, buffer, debug_dxgi_format(format), offset);
184 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
185 UINT instance_index_count, UINT instance_count, UINT start_index_location,
186 INT base_vertex_location, UINT start_instance_location)
188 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
189 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
190 iface, instance_index_count, instance_count, start_index_location,
191 base_vertex_location, start_instance_location);
194 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
195 UINT instance_vertex_count, UINT instance_count,
196 UINT start_vertex_location, UINT start_instance_location)
198 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
199 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
200 start_vertex_location, start_instance_location);
203 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
204 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
206 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
207 iface, start_slot, buffer_count, buffers);
210 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
212 FIXME("iface %p, shader %p stub!\n", iface, shader);
215 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
217 struct d3d10_device *This = (struct d3d10_device *)iface;
219 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
221 IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
224 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
225 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
227 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
228 iface, start_slot, view_count, views);
231 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
232 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
234 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
235 iface, start_slot, sampler_count, samplers);
238 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
240 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
243 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
244 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
246 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
247 iface, start_slot, view_count, views);
250 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
251 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
253 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
254 iface, start_slot, sampler_count, samplers);
257 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
258 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
259 ID3D10DepthStencilView *depth_stencil_view)
261 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
262 iface, render_target_view_count, render_target_views, depth_stencil_view);
265 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
266 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
268 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
269 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
272 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
273 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
275 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
276 iface, depth_stencil_state, stencil_ref);
279 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
280 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
282 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
285 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
287 FIXME("iface %p stub!\n", iface);
290 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
292 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
295 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
296 UINT viewport_count, const D3D10_VIEWPORT *viewports)
298 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
301 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
302 UINT rect_count, const D3D10_RECT *rects)
304 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
307 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
308 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
309 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
311 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
312 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
313 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
314 src_resource, src_subresource_idx, src_box);
317 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
318 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
320 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
323 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
324 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
325 const void *data, UINT row_pitch, UINT depth_pitch)
327 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
328 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
331 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
332 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
334 struct d3d10_device *This = (struct d3d10_device *)iface;
335 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
337 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
338 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
340 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
343 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
344 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
346 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
347 iface, depth_stencil_view, flags, depth, stencil);
350 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
352 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
355 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
356 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
357 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
359 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
360 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
361 iface, dst_resource, dst_subresource_idx,
362 src_resource, src_subresource_idx, debug_dxgi_format(format));
365 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
366 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
368 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
369 iface, start_slot, buffer_count, buffers);
372 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
373 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
375 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
376 iface, start_slot, view_count, views);
379 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
381 FIXME("iface %p, shader %p stub!\n", iface, shader);
384 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
385 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
387 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
388 iface, start_slot, sampler_count, samplers);
391 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
393 FIXME("iface %p, shader %p stub!\n", iface, shader);
396 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
397 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
399 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
400 iface, start_slot, buffer_count, buffers);
403 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
405 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
408 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
409 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
411 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
412 iface, start_slot, buffer_count, buffers, strides, offsets);
415 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
416 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
418 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
421 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
422 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
424 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
425 iface, start_slot, buffer_count, buffers);
428 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
430 FIXME("iface %p, shader %p stub!\n", iface, shader);
433 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
435 struct d3d10_device *This = (struct d3d10_device *)iface;
437 TRACE("iface %p, topology %p\n", iface, topology);
439 IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
442 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
443 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
445 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
446 iface, start_slot, view_count, views);
449 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
450 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
452 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
453 iface, start_slot, sampler_count, samplers);
456 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
457 ID3D10Predicate **predicate, BOOL *value)
459 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
462 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
463 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
465 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
466 iface, start_slot, view_count, views);
469 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
470 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
472 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
473 iface, start_slot, sampler_count, samplers);
476 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
477 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
479 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
480 iface, view_count, render_target_views, depth_stencil_view);
483 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
484 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
486 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
487 iface, blend_state, blend_factor, sample_mask);
490 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
491 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
493 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
494 iface, depth_stencil_state, stencil_ref);
497 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
498 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
500 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
501 iface, buffer_count, buffers, offsets);
504 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
506 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
509 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
510 UINT *viewport_count, D3D10_VIEWPORT *viewports)
512 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
515 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
517 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
520 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
522 FIXME("iface %p stub!\n", iface);
524 return E_NOTIMPL;
527 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
529 FIXME("iface %p, flags %#x stub!\n", iface, flags);
531 return E_NOTIMPL;
534 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
536 FIXME("iface %p stub!\n", iface);
538 return 0;
541 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
542 REFGUID guid, UINT *data_size, void *data)
544 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
545 iface, debugstr_guid(guid), data_size, data);
547 return E_NOTIMPL;
550 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
551 REFGUID guid, UINT data_size, const void *data)
553 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
554 iface, debugstr_guid(guid), data_size, data);
556 return E_NOTIMPL;
559 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
560 REFGUID guid, const IUnknown *data)
562 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
564 return E_NOTIMPL;
567 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
569 FIXME("iface %p stub!\n", iface);
572 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
574 FIXME("iface %p stub!\n", iface);
577 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
578 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
580 struct d3d10_device *This = (struct d3d10_device *)iface;
581 struct wined3d_buffer_desc wined3d_desc;
582 struct d3d10_buffer *object;
583 HRESULT hr;
585 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
587 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
588 if (!object)
590 ERR("Failed to allocate D3D10 buffer object memory\n");
591 return E_OUTOFMEMORY;
594 object->vtbl = &d3d10_buffer_vtbl;
595 object->refcount = 1;
597 FIXME("Implement DXGI<->wined3d usage conversion\n");
599 wined3d_desc.byte_width = desc->ByteWidth;
600 wined3d_desc.usage = desc->Usage;
601 wined3d_desc.bind_flags = desc->BindFlags;
602 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
603 wined3d_desc.misc_flags = desc->MiscFlags;
605 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
606 (IUnknown *)object, &object->wined3d_buffer);
607 if (FAILED(hr))
609 ERR("CreateBuffer failed, returning %#x\n", hr);
610 HeapFree(GetProcessHeap(), 0, object);
611 return hr;
614 *buffer = (ID3D10Buffer *)object;
616 TRACE("Created ID3D10Buffer %p\n", object);
618 return S_OK;
621 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
622 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
624 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
626 return E_NOTIMPL;
629 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
630 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
632 struct d3d10_device *This = (struct d3d10_device *)iface;
633 struct d3d10_texture2d *object;
634 HRESULT hr;
636 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
638 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
639 if (!object)
641 ERR("Failed to allocate D3D10 texture2d object memory\n");
642 return E_OUTOFMEMORY;
645 object->vtbl = &d3d10_texture2d_vtbl;
646 object->refcount = 1;
647 object->desc = *desc;
649 if (desc->MipLevels == 1 && desc->ArraySize == 1)
651 IWineDXGIDevice *wine_device;
653 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
654 if (FAILED(hr))
656 ERR("Device should implement IWineDXGIDevice\n");
657 HeapFree(GetProcessHeap(), 0, object);
658 return E_FAIL;
661 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
662 (IUnknown *)object, (void **)&object->dxgi_surface);
663 IWineDXGIDevice_Release(wine_device);
664 if (FAILED(hr))
666 ERR("Failed to create DXGI surface, returning %#x\n", hr);
667 HeapFree(GetProcessHeap(), 0, object);
668 return hr;
671 FIXME("Implement DXGI<->wined3d usage conversion\n");
673 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
674 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
675 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
676 desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
677 desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
678 if (FAILED(hr))
680 ERR("CreateSurface failed, returning %#x\n", hr);
681 IDXGISurface_Release(object->dxgi_surface);
682 HeapFree(GetProcessHeap(), 0, object);
683 return hr;
687 *texture = (ID3D10Texture2D *)object;
689 TRACE("Created ID3D10Texture2D %p\n", object);
691 return S_OK;
694 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
695 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
697 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
699 return E_NOTIMPL;
702 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
703 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
705 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
707 return E_NOTIMPL;
710 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
712 D3D10_RESOURCE_DIMENSION dimension;
714 ID3D10Resource_GetType(resource, &dimension);
716 switch(dimension)
718 case D3D10_RESOURCE_DIMENSION_BUFFER:
719 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
721 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
722 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
724 default:
725 FIXME("Unhandled resource dimension %#x\n", dimension);
726 return NULL;
730 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
732 D3D10_RESOURCE_DIMENSION dimension;
733 HRESULT hr;
735 ID3D10Resource_GetType(resource, &dimension);
737 switch(dimension)
739 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
741 ID3D10Texture1D *texture;
742 D3D10_TEXTURE1D_DESC texture_desc;
744 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
745 if (FAILED(hr))
747 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
748 return E_INVALIDARG;
751 ID3D10Texture1D_GetDesc(texture, &texture_desc);
752 ID3D10Texture1D_Release(texture);
754 desc->Format = texture_desc.Format;
755 if (texture_desc.ArraySize == 1)
757 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
758 desc->Texture1D.MipSlice = 0;
760 else
762 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
763 desc->Texture1DArray.MipSlice = 0;
764 desc->Texture1DArray.FirstArraySlice = 0;
765 desc->Texture1DArray.ArraySize = 1;
768 return S_OK;
771 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
773 ID3D10Texture2D *texture;
774 D3D10_TEXTURE2D_DESC texture_desc;
776 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
777 if (FAILED(hr))
779 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
780 return E_INVALIDARG;
783 ID3D10Texture2D_GetDesc(texture, &texture_desc);
784 ID3D10Texture2D_Release(texture);
786 desc->Format = texture_desc.Format;
787 if (texture_desc.ArraySize == 1)
789 if (texture_desc.SampleDesc.Count == 1)
791 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
792 desc->Texture2D.MipSlice = 0;
794 else
796 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
799 else
801 if (texture_desc.SampleDesc.Count == 1)
803 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
804 desc->Texture2DArray.MipSlice = 0;
805 desc->Texture2DArray.FirstArraySlice = 0;
806 desc->Texture2DArray.ArraySize = 1;
808 else
810 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
811 desc->Texture2DMSArray.FirstArraySlice = 0;
812 desc->Texture2DMSArray.ArraySize = 1;
816 return S_OK;
819 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
821 ID3D10Texture3D *texture;
822 D3D10_TEXTURE3D_DESC texture_desc;
824 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
825 if (FAILED(hr))
827 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
828 return E_INVALIDARG;
831 ID3D10Texture3D_GetDesc(texture, &texture_desc);
832 ID3D10Texture3D_Release(texture);
834 desc->Format = texture_desc.Format;
835 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
836 desc->Texture3D.MipSlice = 0;
837 desc->Texture3D.FirstWSlice = 0;
838 desc->Texture3D.WSize = 1;
840 return S_OK;
843 default:
844 FIXME("Unhandled resource dimension %#x\n", dimension);
845 return E_INVALIDARG;
849 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
850 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
852 struct d3d10_device *This = (struct d3d10_device *)iface;
853 struct d3d10_rendertarget_view *object;
854 IWineD3DResource *wined3d_resource;
856 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
858 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
859 if (!object)
861 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
862 return E_OUTOFMEMORY;
865 object->vtbl = &d3d10_rendertarget_view_vtbl;
866 object->refcount = 1;
868 if (!desc)
870 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
871 if (FAILED(hr))
873 HeapFree(GetProcessHeap(), 0, object);
874 return hr;
877 else
879 object->desc = *desc;
882 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
883 if (!wined3d_resource)
885 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
886 HeapFree(GetProcessHeap(), 0, object);
887 return E_FAIL;
889 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
890 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
892 *view = (ID3D10RenderTargetView *)object;
894 return S_OK;
897 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
898 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
900 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
902 return E_NOTIMPL;
905 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
906 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
907 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
909 struct d3d10_input_layout *object;
911 FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
912 "\tshader_byte_code_length %lu, input_layout %p stub!\n",
913 iface, element_descs, element_count, shader_byte_code,
914 shader_byte_code_length, input_layout);
916 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
917 if (!object)
919 ERR("Failed to allocate D3D10 input layout object memory\n");
920 return E_OUTOFMEMORY;
923 object->vtbl = &d3d10_input_layout_vtbl;
924 object->refcount = 1;
926 *input_layout = (ID3D10InputLayout *)object;
928 return S_OK;
931 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
932 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
934 struct d3d10_vertex_shader *object;
936 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
937 iface, byte_code, byte_code_length, shader);
939 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
940 if (!object)
942 ERR("Failed to allocate D3D10 vertex shader object memory\n");
943 return E_OUTOFMEMORY;
946 object->vtbl = &d3d10_vertex_shader_vtbl;
947 object->refcount = 1;
949 *shader = (ID3D10VertexShader *)object;
951 return S_OK;
954 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
955 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
957 struct d3d10_geometry_shader *object;
959 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
960 iface, byte_code, byte_code_length, shader);
962 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
963 if (!object)
965 ERR("Failed to allocate D3D10 geometry shader object memory\n");
966 return E_OUTOFMEMORY;
969 object->vtbl = &d3d10_geometry_shader_vtbl;
970 object->refcount = 1;
972 *shader = (ID3D10GeometryShader *)object;
974 return S_OK;
977 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
978 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
979 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
981 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
982 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
983 iface, byte_code, byte_code_length, output_stream_decls,
984 output_stream_decl_count, output_stream_stride, shader);
986 return E_NOTIMPL;
989 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
990 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
992 struct d3d10_pixel_shader *object;
994 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
995 iface, byte_code, byte_code_length, shader);
997 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
998 if (!object)
1000 ERR("Failed to allocate D3D10 pixel shader object memory\n");
1001 return E_OUTOFMEMORY;
1004 object->vtbl = &d3d10_pixel_shader_vtbl;
1005 object->refcount = 1;
1007 *shader = (ID3D10PixelShader *)object;
1009 return S_OK;
1012 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
1013 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
1015 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
1017 return E_NOTIMPL;
1020 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
1021 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
1023 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
1025 return E_NOTIMPL;
1028 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1029 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1031 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
1033 return E_NOTIMPL;
1036 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1037 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1039 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
1041 return E_NOTIMPL;
1044 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1045 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1047 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
1049 return E_NOTIMPL;
1052 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1053 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1055 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1057 return E_NOTIMPL;
1060 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1061 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1063 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1065 return E_NOTIMPL;
1068 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1069 DXGI_FORMAT format, UINT *format_support)
1071 FIXME("iface %p, format %s, format_support %p stub!\n",
1072 iface, debug_dxgi_format(format), format_support);
1074 return E_NOTIMPL;
1077 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1078 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1080 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1081 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1083 return E_NOTIMPL;
1086 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1088 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1091 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1092 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1093 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1095 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1096 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1097 iface, desc, type, active_counters, name, name_length,
1098 units, units_length, description, description_length);
1100 return E_NOTIMPL;
1103 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1105 FIXME("iface %p stub!\n", iface);
1107 return 0;
1110 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1111 HANDLE resource_handle, REFIID guid, void **resource)
1113 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1114 iface, resource_handle, debugstr_guid(guid), resource);
1116 return E_NOTIMPL;
1119 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1121 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1124 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1126 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1129 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1131 /* IUnknown methods */
1132 d3d10_device_QueryInterface,
1133 d3d10_device_AddRef,
1134 d3d10_device_Release,
1135 /* ID3D10Device methods */
1136 d3d10_device_VSSetConstantBuffers,
1137 d3d10_device_PSSetShaderResources,
1138 d3d10_device_PSSetShader,
1139 d3d10_device_PSSetSamplers,
1140 d3d10_device_VSSetShader,
1141 d3d10_device_DrawIndexed,
1142 d3d10_device_Draw,
1143 d3d10_device_PSSetConstantBuffers,
1144 d3d10_device_IASetInputLayout,
1145 d3d10_device_IASetVertexBuffers,
1146 d3d10_device_IASetIndexBuffer,
1147 d3d10_device_DrawIndexedInstanced,
1148 d3d10_device_DrawInstanced,
1149 d3d10_device_GSSetConstantBuffers,
1150 d3d10_device_GSSetShader,
1151 d3d10_device_IASetPrimitiveTopology,
1152 d3d10_device_VSSetShaderResources,
1153 d3d10_device_VSSetSamplers,
1154 d3d10_device_SetPredication,
1155 d3d10_device_GSSetShaderResources,
1156 d3d10_device_GSSetSamplers,
1157 d3d10_device_OMSetRenderTargets,
1158 d3d10_device_OMSetBlendState,
1159 d3d10_device_OMSetDepthStencilState,
1160 d3d10_device_SOSetTargets,
1161 d3d10_device_DrawAuto,
1162 d3d10_device_RSSetState,
1163 d3d10_device_RSSetViewports,
1164 d3d10_device_RSSetScissorRects,
1165 d3d10_device_CopySubresourceRegion,
1166 d3d10_device_CopyResource,
1167 d3d10_device_UpdateSubresource,
1168 d3d10_device_ClearRenderTargetView,
1169 d3d10_device_ClearDepthStencilView,
1170 d3d10_device_GenerateMips,
1171 d3d10_device_ResolveSubresource,
1172 d3d10_device_VSGetConstantBuffers,
1173 d3d10_device_PSGetShaderResources,
1174 d3d10_device_PSGetShader,
1175 d3d10_device_PSGetSamplers,
1176 d3d10_device_VSGetShader,
1177 d3d10_device_PSGetConstantBuffers,
1178 d3d10_device_IAGetInputLayout,
1179 d3d10_device_IAGetVertexBuffers,
1180 d3d10_device_IAGetIndexBuffer,
1181 d3d10_device_GSGetConstantBuffers,
1182 d3d10_device_GSGetShader,
1183 d3d10_device_IAGetPrimitiveTopology,
1184 d3d10_device_VSGetShaderResources,
1185 d3d10_device_VSGetSamplers,
1186 d3d10_device_GetPredication,
1187 d3d10_device_GSGetShaderResources,
1188 d3d10_device_GSGetSamplers,
1189 d3d10_device_OMGetRenderTargets,
1190 d3d10_device_OMGetBlendState,
1191 d3d10_device_OMGetDepthStencilState,
1192 d3d10_device_SOGetTargets,
1193 d3d10_device_RSGetState,
1194 d3d10_device_RSGetViewports,
1195 d3d10_device_RSGetScissorRects,
1196 d3d10_device_GetDeviceRemovedReason,
1197 d3d10_device_SetExceptionMode,
1198 d3d10_device_GetExceptionMode,
1199 d3d10_device_GetPrivateData,
1200 d3d10_device_SetPrivateData,
1201 d3d10_device_SetPrivateDataInterface,
1202 d3d10_device_ClearState,
1203 d3d10_device_Flush,
1204 d3d10_device_CreateBuffer,
1205 d3d10_device_CreateTexture1D,
1206 d3d10_device_CreateTexture2D,
1207 d3d10_device_CreateTexture3D,
1208 d3d10_device_CreateShaderResourceView,
1209 d3d10_device_CreateRenderTargetView,
1210 d3d10_device_CreateDepthStencilView,
1211 d3d10_device_CreateInputLayout,
1212 d3d10_device_CreateVertexShader,
1213 d3d10_device_CreateGeometryShader,
1214 d3d10_device_CreateGeometryShaderWithStreamOutput,
1215 d3d10_device_CreatePixelShader,
1216 d3d10_device_CreateBlendState,
1217 d3d10_device_CreateDepthStencilState,
1218 d3d10_device_CreateRasterizerState,
1219 d3d10_device_CreateSamplerState,
1220 d3d10_device_CreateQuery,
1221 d3d10_device_CreatePredicate,
1222 d3d10_device_CreateCounter,
1223 d3d10_device_CheckFormatSupport,
1224 d3d10_device_CheckMultisampleQualityLevels,
1225 d3d10_device_CheckCounterInfo,
1226 d3d10_device_CheckCounter,
1227 d3d10_device_GetCreationFlags,
1228 d3d10_device_OpenSharedResource,
1229 d3d10_device_SetTextFilterSize,
1230 d3d10_device_GetTextFilterSize,
1233 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1235 /* IUnknown methods */
1236 d3d10_device_inner_QueryInterface,
1237 d3d10_device_inner_AddRef,
1238 d3d10_device_inner_Release,
1241 /* IWineD3DDeviceParent IUnknown methods */
1243 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1245 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1248 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1250 struct d3d10_device *This = device_from_device_parent(iface);
1251 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1254 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1256 struct d3d10_device *This = device_from_device_parent(iface);
1257 return d3d10_device_AddRef((ID3D10Device *)This);
1260 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1262 struct d3d10_device *This = device_from_device_parent(iface);
1263 return d3d10_device_Release((ID3D10Device *)This);
1266 /* IWineD3DDeviceParent methods */
1268 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1270 struct d3d10_device *This = device_from_device_parent(iface);
1272 TRACE("iface %p, device %p\n", iface, device);
1274 IWineD3DDevice_AddRef(device);
1275 This->wined3d_device = device;
1278 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1279 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1280 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1282 struct d3d10_device *This = device_from_device_parent(iface);
1283 struct d3d10_texture2d *texture;
1284 D3D10_TEXTURE2D_DESC desc;
1285 HRESULT hr;
1287 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1288 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1289 iface, superior, width, height, format, usage, pool, level, face, surface);
1291 FIXME("Implement DXGI<->wined3d usage conversion\n");
1293 desc.Width = width;
1294 desc.Height = height;
1295 desc.MipLevels = 1;
1296 desc.ArraySize = 1;
1297 desc.Format = dxgi_format_from_wined3dformat(format);
1298 desc.SampleDesc.Count = 1;
1299 desc.SampleDesc.Quality = 0;
1300 desc.Usage = usage;
1301 desc.BindFlags = 0;
1302 desc.CPUAccessFlags = 0;
1303 desc.MiscFlags = 0;
1305 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1306 if (FAILED(hr))
1308 ERR("CreateTexture2D failed, returning %#x\n", hr);
1309 return hr;
1312 *surface = texture->wined3d_surface;
1314 return S_OK;
1317 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1318 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1319 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1321 struct d3d10_device *This = device_from_device_parent(iface);
1322 struct d3d10_texture2d *texture;
1323 D3D10_TEXTURE2D_DESC desc;
1324 HRESULT hr;
1326 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1327 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1328 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1330 FIXME("Implement DXGI<->wined3d usage conversion\n");
1332 desc.Width = width;
1333 desc.Height = height;
1334 desc.MipLevels = 1;
1335 desc.ArraySize = 1;
1336 desc.Format = dxgi_format_from_wined3dformat(format);
1337 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1338 desc.SampleDesc.Quality = multisample_quality;
1339 desc.Usage = D3D10_USAGE_DEFAULT;
1340 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1341 desc.CPUAccessFlags = 0;
1342 desc.MiscFlags = 0;
1344 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1345 if (FAILED(hr))
1347 ERR("CreateTexture2D failed, returning %#x\n", hr);
1348 return hr;
1351 *surface = texture->wined3d_surface;
1353 return S_OK;
1356 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1357 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1358 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1360 struct d3d10_device *This = device_from_device_parent(iface);
1361 struct d3d10_texture2d *texture;
1362 D3D10_TEXTURE2D_DESC desc;
1363 HRESULT hr;
1365 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1366 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1367 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1369 FIXME("Implement DXGI<->wined3d usage conversion\n");
1371 desc.Width = width;
1372 desc.Height = height;
1373 desc.MipLevels = 1;
1374 desc.ArraySize = 1;
1375 desc.Format = dxgi_format_from_wined3dformat(format);
1376 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1377 desc.SampleDesc.Quality = multisample_quality;
1378 desc.Usage = D3D10_USAGE_DEFAULT;
1379 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1380 desc.CPUAccessFlags = 0;
1381 desc.MiscFlags = 0;
1383 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1384 if (FAILED(hr))
1386 ERR("CreateTexture2D failed, returning %#x\n", hr);
1387 return hr;
1390 *surface = texture->wined3d_surface;
1392 return S_OK;
1395 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1396 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1397 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1399 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1400 iface, superior, width, height, depth, format, pool, usage, volume);
1402 return E_NOTIMPL;
1405 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1406 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1408 IWineDXGIDevice *wine_device;
1409 HRESULT hr;
1411 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1413 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1414 if (FAILED(hr))
1416 ERR("Device should implement IWineDXGIDevice\n");
1417 return E_FAIL;
1420 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1421 IWineDXGIDevice_Release(wine_device);
1422 if (FAILED(hr))
1424 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1425 return hr;
1428 return S_OK;
1431 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1433 /* IUnknown methods */
1434 device_parent_QueryInterface,
1435 device_parent_AddRef,
1436 device_parent_Release,
1437 /* IWineD3DDeviceParent methods */
1438 device_parent_WineD3DDeviceCreated,
1439 device_parent_CreateSurface,
1440 device_parent_CreateRenderTarget,
1441 device_parent_CreateDepthStencilSurface,
1442 device_parent_CreateVolume,
1443 device_parent_CreateSwapChain,