push 52d6b63ba2f2d4f9b02b6b922d27bff05a60596f
[wine/hacks.git] / dlls / d3d10core / device.c
blobfae1d8f19c4bd4dcf38cc02a8c5b3662954fa0ca
1 /*
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
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 (!refcount)
80 if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
83 return refcount;
86 /* IUnknown methods */
88 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
90 struct d3d10_device *This = (struct d3d10_device *)iface;
91 TRACE("Forwarding to outer IUnknown\n");
92 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
95 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
97 struct d3d10_device *This = (struct d3d10_device *)iface;
98 TRACE("Forwarding to outer IUnknown\n");
99 return IUnknown_AddRef(This->outer_unknown);
102 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
104 struct d3d10_device *This = (struct d3d10_device *)iface;
105 TRACE("Forwarding to outer IUnknown\n");
106 return IUnknown_Release(This->outer_unknown);
109 /* ID3D10Device methods */
111 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
112 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
114 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
115 iface, start_slot, buffer_count, buffers);
118 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
119 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
121 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
122 iface, start_slot, view_count, views);
125 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
127 struct d3d10_device *This = (struct d3d10_device *)iface;
128 struct d3d10_pixel_shader *ps = (struct d3d10_pixel_shader *)shader;
130 TRACE("iface %p, shader %p\n", iface, shader);
132 IWineD3DDevice_SetPixelShader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
135 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
136 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
138 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
139 iface, start_slot, sampler_count, samplers);
142 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
144 struct d3d10_device *This = (struct d3d10_device *)iface;
145 struct d3d10_vertex_shader *vs = (struct d3d10_vertex_shader *)shader;
147 TRACE("iface %p, shader %p\n", iface, shader);
149 IWineD3DDevice_SetVertexShader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
152 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
153 UINT index_count, UINT start_index_location, INT base_vertex_location)
155 struct d3d10_device *This = (struct d3d10_device *)iface;
157 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
158 iface, index_count, start_index_location, base_vertex_location);
160 IWineD3DDevice_SetBaseVertexIndex(This->wined3d_device, base_vertex_location);
161 IWineD3DDevice_DrawIndexedPrimitive(This->wined3d_device, start_index_location, index_count);
164 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
165 UINT vertex_count, UINT start_vertex_location)
167 struct d3d10_device *This = (struct d3d10_device *)iface;
169 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
170 iface, vertex_count, start_vertex_location);
172 IWineD3DDevice_DrawPrimitive(This->wined3d_device, start_vertex_location, vertex_count);
175 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
176 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
178 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
179 iface, start_slot, buffer_count, buffers);
182 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
184 struct d3d10_device *This = (struct d3d10_device *)iface;
186 TRACE("iface %p, input_layout %p\n", iface, input_layout);
188 IWineD3DDevice_SetVertexDeclaration(This->wined3d_device,
189 ((struct d3d10_input_layout *)input_layout)->wined3d_decl);
192 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
193 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
194 const UINT *strides, const UINT *offsets)
196 struct d3d10_device *This = (struct d3d10_device *)iface;
197 unsigned int i;
199 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
200 iface, start_slot, buffer_count, buffers, strides, offsets);
202 for (i = 0; i < buffer_count; ++i)
204 IWineD3DDevice_SetStreamSource(This->wined3d_device, start_slot,
205 ((struct d3d10_buffer *)buffers[i])->wined3d_buffer, offsets[i], strides[i]);
209 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
210 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
212 struct d3d10_device *This = (struct d3d10_device *)iface;
214 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
215 iface, buffer, debug_dxgi_format(format), offset);
217 IWineD3DDevice_SetIndexBuffer(This->wined3d_device, buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
218 wined3dformat_from_dxgi_format(format));
219 if (offset) FIXME("offset %u not supported.\n", offset);
222 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
223 UINT instance_index_count, UINT instance_count, UINT start_index_location,
224 INT base_vertex_location, UINT start_instance_location)
226 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
227 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
228 iface, instance_index_count, instance_count, start_index_location,
229 base_vertex_location, start_instance_location);
232 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
233 UINT instance_vertex_count, UINT instance_count,
234 UINT start_vertex_location, UINT start_instance_location)
236 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
237 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
238 start_vertex_location, start_instance_location);
241 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
242 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
244 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
245 iface, start_slot, buffer_count, buffers);
248 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
250 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
251 else WARN("iface %p, shader %p stub!\n", iface, shader);
254 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
256 struct d3d10_device *This = (struct d3d10_device *)iface;
258 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
260 IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
263 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
264 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
266 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
267 iface, start_slot, view_count, views);
270 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
271 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
273 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
274 iface, start_slot, sampler_count, samplers);
277 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
279 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
282 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
283 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
285 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
286 iface, start_slot, view_count, views);
289 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
290 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
292 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
293 iface, start_slot, sampler_count, samplers);
296 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
297 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
298 ID3D10DepthStencilView *depth_stencil_view)
300 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
301 iface, render_target_view_count, render_target_views, depth_stencil_view);
304 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
305 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
307 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
308 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
311 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
312 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
314 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
315 iface, depth_stencil_state, stencil_ref);
318 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
319 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
321 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
324 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
326 FIXME("iface %p stub!\n", iface);
329 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
331 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
334 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
335 UINT viewport_count, const D3D10_VIEWPORT *viewports)
337 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
340 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
341 UINT rect_count, const D3D10_RECT *rects)
343 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
346 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
347 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
348 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
350 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
351 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
352 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
353 src_resource, src_subresource_idx, src_box);
356 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
357 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
359 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
362 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
363 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
364 const void *data, UINT row_pitch, UINT depth_pitch)
366 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
367 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
370 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
371 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
373 struct d3d10_device *This = (struct d3d10_device *)iface;
374 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
376 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
377 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
379 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
382 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
383 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
385 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
386 iface, depth_stencil_view, flags, depth, stencil);
389 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
391 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
394 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
395 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
396 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
398 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
399 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
400 iface, dst_resource, dst_subresource_idx,
401 src_resource, src_subresource_idx, debug_dxgi_format(format));
404 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
405 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
407 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
408 iface, start_slot, buffer_count, buffers);
411 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
412 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
414 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
415 iface, start_slot, view_count, views);
418 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
420 FIXME("iface %p, shader %p stub!\n", iface, shader);
423 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
424 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
426 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
427 iface, start_slot, sampler_count, samplers);
430 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
432 FIXME("iface %p, shader %p stub!\n", iface, shader);
435 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
436 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
438 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
439 iface, start_slot, buffer_count, buffers);
442 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
444 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
447 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
448 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
450 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
451 iface, start_slot, buffer_count, buffers, strides, offsets);
454 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
455 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
457 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
460 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
461 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
463 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
464 iface, start_slot, buffer_count, buffers);
467 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
469 FIXME("iface %p, shader %p stub!\n", iface, shader);
472 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
474 struct d3d10_device *This = (struct d3d10_device *)iface;
476 TRACE("iface %p, topology %p\n", iface, topology);
478 IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
481 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
482 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
484 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
485 iface, start_slot, view_count, views);
488 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
489 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
491 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
492 iface, start_slot, sampler_count, samplers);
495 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
496 ID3D10Predicate **predicate, BOOL *value)
498 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
501 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
502 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
504 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
505 iface, start_slot, view_count, views);
508 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
509 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
511 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
512 iface, start_slot, sampler_count, samplers);
515 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
516 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
518 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
519 iface, view_count, render_target_views, depth_stencil_view);
522 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
523 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
525 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
526 iface, blend_state, blend_factor, sample_mask);
529 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
530 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
532 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
533 iface, depth_stencil_state, stencil_ref);
536 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
537 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
539 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
540 iface, buffer_count, buffers, offsets);
543 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
545 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
548 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
549 UINT *viewport_count, D3D10_VIEWPORT *viewports)
551 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
554 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
556 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
559 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
561 FIXME("iface %p stub!\n", iface);
563 return E_NOTIMPL;
566 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
568 FIXME("iface %p, flags %#x stub!\n", iface, flags);
570 return E_NOTIMPL;
573 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
575 FIXME("iface %p stub!\n", iface);
577 return 0;
580 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
581 REFGUID guid, UINT *data_size, void *data)
583 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
584 iface, debugstr_guid(guid), data_size, data);
586 return E_NOTIMPL;
589 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
590 REFGUID guid, UINT data_size, const void *data)
592 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
593 iface, debugstr_guid(guid), data_size, data);
595 return E_NOTIMPL;
598 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
599 REFGUID guid, const IUnknown *data)
601 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
603 return E_NOTIMPL;
606 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
608 FIXME("iface %p stub!\n", iface);
611 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
613 FIXME("iface %p stub!\n", iface);
616 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
617 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
619 struct d3d10_device *This = (struct d3d10_device *)iface;
620 struct d3d10_buffer *object;
621 HRESULT hr;
623 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
625 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
626 if (!object)
628 ERR("Failed to allocate D3D10 buffer object memory\n");
629 return E_OUTOFMEMORY;
632 hr = d3d10_buffer_init(object, This, desc, data);
633 if (FAILED(hr))
635 WARN("Failed to initialize buffer, hr %#x.\n", hr);
636 HeapFree(GetProcessHeap(), 0, object);
637 return hr;
640 *buffer = (ID3D10Buffer *)object;
642 TRACE("Created ID3D10Buffer %p\n", object);
644 return S_OK;
647 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
648 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
650 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
652 return E_NOTIMPL;
655 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
656 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
658 struct d3d10_device *This = (struct d3d10_device *)iface;
659 struct d3d10_texture2d *object;
660 HRESULT hr;
662 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
664 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
665 if (!object)
667 ERR("Failed to allocate D3D10 texture2d object memory\n");
668 return E_OUTOFMEMORY;
671 hr = d3d10_texture2d_init(object, This, desc);
672 if (FAILED(hr))
674 WARN("Failed to initialize texture, hr %#x.\n", hr);
675 HeapFree(GetProcessHeap(), 0, object);
676 return hr;
679 *texture = (ID3D10Texture2D *)object;
681 TRACE("Created ID3D10Texture2D %p\n", object);
683 return S_OK;
686 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
687 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
689 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
691 return E_NOTIMPL;
694 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
695 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
697 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
699 return E_NOTIMPL;
702 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
703 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
705 struct d3d10_rendertarget_view *object;
706 HRESULT hr;
708 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
710 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
711 if (!object)
713 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
714 return E_OUTOFMEMORY;
717 hr = d3d10_rendertarget_view_init(object, (struct d3d10_device *)iface, resource, desc);
718 if (FAILED(hr))
720 WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
721 HeapFree(GetProcessHeap(), 0, object);
722 return hr;
725 TRACE("Created rendertarget view %p.\n", object);
726 *view = (ID3D10RenderTargetView *)object;
728 return S_OK;
731 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
732 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
734 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
736 return E_NOTIMPL;
739 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
740 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
741 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
743 struct d3d10_device *This = (struct d3d10_device *)iface;
744 struct d3d10_input_layout *object;
745 HRESULT hr;
747 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
748 "\tshader_byte_code_length %lu, input_layout %p\n",
749 iface, element_descs, element_count, shader_byte_code,
750 shader_byte_code_length, input_layout);
752 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
753 if (!object)
755 ERR("Failed to allocate D3D10 input layout object memory\n");
756 return E_OUTOFMEMORY;
759 hr = d3d10_input_layout_init(object, This, element_descs, element_count,
760 shader_byte_code, shader_byte_code_length);
761 if (FAILED(hr))
763 WARN("Failed to initialize input layout, hr %#x.\n", hr);
764 HeapFree(GetProcessHeap(), 0, object);
765 return hr;
768 TRACE("Created input layout %p.\n", object);
769 *input_layout = (ID3D10InputLayout *)object;
771 return S_OK;
774 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
775 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
777 struct d3d10_device *This = (struct d3d10_device *)iface;
778 struct d3d10_vertex_shader *object;
779 HRESULT hr;
781 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
782 iface, byte_code, byte_code_length, shader);
784 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
785 if (!object)
787 ERR("Failed to allocate D3D10 vertex shader object memory\n");
788 return E_OUTOFMEMORY;
791 hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
792 if (FAILED(hr))
794 WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
795 HeapFree(GetProcessHeap(), 0, object);
796 return hr;
799 TRACE("Created vertex shader %p.\n", object);
800 *shader = (ID3D10VertexShader *)object;
802 return S_OK;
805 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
806 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
808 struct d3d10_geometry_shader *object;
809 HRESULT hr;
811 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
812 iface, byte_code, byte_code_length, shader);
814 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
815 if (!object)
817 ERR("Failed to allocate D3D10 geometry shader object memory\n");
818 return E_OUTOFMEMORY;
821 hr = d3d10_geometry_shader_init(object);
822 if (FAILED(hr))
824 WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
825 HeapFree(GetProcessHeap(), 0, object);
828 TRACE("Created geometry shader %p.\n", object);
829 *shader = (ID3D10GeometryShader *)object;
831 return S_OK;
834 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
835 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
836 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
838 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
839 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
840 iface, byte_code, byte_code_length, output_stream_decls,
841 output_stream_decl_count, output_stream_stride, shader);
843 return E_NOTIMPL;
846 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
847 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
849 struct d3d10_device *This = (struct d3d10_device *)iface;
850 struct d3d10_pixel_shader *object;
851 HRESULT hr;
853 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
854 iface, byte_code, byte_code_length, shader);
856 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
857 if (!object)
859 ERR("Failed to allocate D3D10 pixel shader object memory\n");
860 return E_OUTOFMEMORY;
863 hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
864 if (FAILED(hr))
866 WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
867 HeapFree(GetProcessHeap(), 0, object);
868 return hr;
871 TRACE("Created pixel shader %p.\n", object);
872 *shader = (ID3D10PixelShader *)object;
874 return S_OK;
877 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
878 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
880 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
882 return E_NOTIMPL;
885 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
886 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
888 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
890 return E_NOTIMPL;
893 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
894 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
896 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
898 return E_NOTIMPL;
901 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
902 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
904 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
906 return E_NOTIMPL;
909 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
910 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
912 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
914 return E_NOTIMPL;
917 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
918 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
920 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
922 return E_NOTIMPL;
925 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
926 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
928 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
930 return E_NOTIMPL;
933 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
934 DXGI_FORMAT format, UINT *format_support)
936 FIXME("iface %p, format %s, format_support %p stub!\n",
937 iface, debug_dxgi_format(format), format_support);
939 return E_NOTIMPL;
942 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
943 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
945 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
946 iface, debug_dxgi_format(format), sample_count, quality_level_count);
948 return E_NOTIMPL;
951 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
953 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
956 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
957 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
958 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
960 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
961 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
962 iface, desc, type, active_counters, name, name_length,
963 units, units_length, description, description_length);
965 return E_NOTIMPL;
968 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
970 FIXME("iface %p stub!\n", iface);
972 return 0;
975 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
976 HANDLE resource_handle, REFIID guid, void **resource)
978 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
979 iface, resource_handle, debugstr_guid(guid), resource);
981 return E_NOTIMPL;
984 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
986 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
989 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
991 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
994 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
996 /* IUnknown methods */
997 d3d10_device_QueryInterface,
998 d3d10_device_AddRef,
999 d3d10_device_Release,
1000 /* ID3D10Device methods */
1001 d3d10_device_VSSetConstantBuffers,
1002 d3d10_device_PSSetShaderResources,
1003 d3d10_device_PSSetShader,
1004 d3d10_device_PSSetSamplers,
1005 d3d10_device_VSSetShader,
1006 d3d10_device_DrawIndexed,
1007 d3d10_device_Draw,
1008 d3d10_device_PSSetConstantBuffers,
1009 d3d10_device_IASetInputLayout,
1010 d3d10_device_IASetVertexBuffers,
1011 d3d10_device_IASetIndexBuffer,
1012 d3d10_device_DrawIndexedInstanced,
1013 d3d10_device_DrawInstanced,
1014 d3d10_device_GSSetConstantBuffers,
1015 d3d10_device_GSSetShader,
1016 d3d10_device_IASetPrimitiveTopology,
1017 d3d10_device_VSSetShaderResources,
1018 d3d10_device_VSSetSamplers,
1019 d3d10_device_SetPredication,
1020 d3d10_device_GSSetShaderResources,
1021 d3d10_device_GSSetSamplers,
1022 d3d10_device_OMSetRenderTargets,
1023 d3d10_device_OMSetBlendState,
1024 d3d10_device_OMSetDepthStencilState,
1025 d3d10_device_SOSetTargets,
1026 d3d10_device_DrawAuto,
1027 d3d10_device_RSSetState,
1028 d3d10_device_RSSetViewports,
1029 d3d10_device_RSSetScissorRects,
1030 d3d10_device_CopySubresourceRegion,
1031 d3d10_device_CopyResource,
1032 d3d10_device_UpdateSubresource,
1033 d3d10_device_ClearRenderTargetView,
1034 d3d10_device_ClearDepthStencilView,
1035 d3d10_device_GenerateMips,
1036 d3d10_device_ResolveSubresource,
1037 d3d10_device_VSGetConstantBuffers,
1038 d3d10_device_PSGetShaderResources,
1039 d3d10_device_PSGetShader,
1040 d3d10_device_PSGetSamplers,
1041 d3d10_device_VSGetShader,
1042 d3d10_device_PSGetConstantBuffers,
1043 d3d10_device_IAGetInputLayout,
1044 d3d10_device_IAGetVertexBuffers,
1045 d3d10_device_IAGetIndexBuffer,
1046 d3d10_device_GSGetConstantBuffers,
1047 d3d10_device_GSGetShader,
1048 d3d10_device_IAGetPrimitiveTopology,
1049 d3d10_device_VSGetShaderResources,
1050 d3d10_device_VSGetSamplers,
1051 d3d10_device_GetPredication,
1052 d3d10_device_GSGetShaderResources,
1053 d3d10_device_GSGetSamplers,
1054 d3d10_device_OMGetRenderTargets,
1055 d3d10_device_OMGetBlendState,
1056 d3d10_device_OMGetDepthStencilState,
1057 d3d10_device_SOGetTargets,
1058 d3d10_device_RSGetState,
1059 d3d10_device_RSGetViewports,
1060 d3d10_device_RSGetScissorRects,
1061 d3d10_device_GetDeviceRemovedReason,
1062 d3d10_device_SetExceptionMode,
1063 d3d10_device_GetExceptionMode,
1064 d3d10_device_GetPrivateData,
1065 d3d10_device_SetPrivateData,
1066 d3d10_device_SetPrivateDataInterface,
1067 d3d10_device_ClearState,
1068 d3d10_device_Flush,
1069 d3d10_device_CreateBuffer,
1070 d3d10_device_CreateTexture1D,
1071 d3d10_device_CreateTexture2D,
1072 d3d10_device_CreateTexture3D,
1073 d3d10_device_CreateShaderResourceView,
1074 d3d10_device_CreateRenderTargetView,
1075 d3d10_device_CreateDepthStencilView,
1076 d3d10_device_CreateInputLayout,
1077 d3d10_device_CreateVertexShader,
1078 d3d10_device_CreateGeometryShader,
1079 d3d10_device_CreateGeometryShaderWithStreamOutput,
1080 d3d10_device_CreatePixelShader,
1081 d3d10_device_CreateBlendState,
1082 d3d10_device_CreateDepthStencilState,
1083 d3d10_device_CreateRasterizerState,
1084 d3d10_device_CreateSamplerState,
1085 d3d10_device_CreateQuery,
1086 d3d10_device_CreatePredicate,
1087 d3d10_device_CreateCounter,
1088 d3d10_device_CheckFormatSupport,
1089 d3d10_device_CheckMultisampleQualityLevels,
1090 d3d10_device_CheckCounterInfo,
1091 d3d10_device_CheckCounter,
1092 d3d10_device_GetCreationFlags,
1093 d3d10_device_OpenSharedResource,
1094 d3d10_device_SetTextFilterSize,
1095 d3d10_device_GetTextFilterSize,
1098 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1100 /* IUnknown methods */
1101 d3d10_device_inner_QueryInterface,
1102 d3d10_device_inner_AddRef,
1103 d3d10_device_inner_Release,
1106 /* IWineD3DDeviceParent IUnknown methods */
1108 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1110 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1113 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1115 struct d3d10_device *This = device_from_device_parent(iface);
1116 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1119 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1121 struct d3d10_device *This = device_from_device_parent(iface);
1122 return d3d10_device_AddRef((ID3D10Device *)This);
1125 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1127 struct d3d10_device *This = device_from_device_parent(iface);
1128 return d3d10_device_Release((ID3D10Device *)This);
1131 /* IWineD3DDeviceParent methods */
1133 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1135 struct d3d10_device *This = device_from_device_parent(iface);
1137 TRACE("iface %p, device %p\n", iface, device);
1139 IWineD3DDevice_AddRef(device);
1140 This->wined3d_device = device;
1143 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1144 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1145 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1147 struct d3d10_device *This = device_from_device_parent(iface);
1148 struct d3d10_texture2d *texture;
1149 D3D10_TEXTURE2D_DESC desc;
1150 HRESULT hr;
1152 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1153 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1154 iface, superior, width, height, format, usage, pool, level, face, surface);
1156 FIXME("Implement DXGI<->wined3d usage conversion\n");
1158 desc.Width = width;
1159 desc.Height = height;
1160 desc.MipLevels = 1;
1161 desc.ArraySize = 1;
1162 desc.Format = dxgi_format_from_wined3dformat(format);
1163 desc.SampleDesc.Count = 1;
1164 desc.SampleDesc.Quality = 0;
1165 desc.Usage = usage;
1166 desc.BindFlags = 0;
1167 desc.CPUAccessFlags = 0;
1168 desc.MiscFlags = 0;
1170 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1171 if (FAILED(hr))
1173 ERR("CreateTexture2D failed, returning %#x\n", hr);
1174 return hr;
1177 *surface = texture->wined3d_surface;
1178 IWineD3DSurface_AddRef(*surface);
1179 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1181 return S_OK;
1184 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1185 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1186 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1188 struct d3d10_device *This = device_from_device_parent(iface);
1189 struct d3d10_texture2d *texture;
1190 D3D10_TEXTURE2D_DESC desc;
1191 HRESULT hr;
1193 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1194 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1195 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1197 FIXME("Implement DXGI<->wined3d usage conversion\n");
1199 desc.Width = width;
1200 desc.Height = height;
1201 desc.MipLevels = 1;
1202 desc.ArraySize = 1;
1203 desc.Format = dxgi_format_from_wined3dformat(format);
1204 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1205 desc.SampleDesc.Quality = multisample_quality;
1206 desc.Usage = D3D10_USAGE_DEFAULT;
1207 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1208 desc.CPUAccessFlags = 0;
1209 desc.MiscFlags = 0;
1211 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1212 if (FAILED(hr))
1214 ERR("CreateTexture2D failed, returning %#x\n", hr);
1215 return hr;
1218 *surface = texture->wined3d_surface;
1219 IWineD3DSurface_AddRef(*surface);
1220 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1222 return S_OK;
1225 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1226 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1227 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1229 struct d3d10_device *This = device_from_device_parent(iface);
1230 struct d3d10_texture2d *texture;
1231 D3D10_TEXTURE2D_DESC desc;
1232 HRESULT hr;
1234 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1235 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1236 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1238 FIXME("Implement DXGI<->wined3d usage conversion\n");
1240 desc.Width = width;
1241 desc.Height = height;
1242 desc.MipLevels = 1;
1243 desc.ArraySize = 1;
1244 desc.Format = dxgi_format_from_wined3dformat(format);
1245 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1246 desc.SampleDesc.Quality = multisample_quality;
1247 desc.Usage = D3D10_USAGE_DEFAULT;
1248 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1249 desc.CPUAccessFlags = 0;
1250 desc.MiscFlags = 0;
1252 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1253 if (FAILED(hr))
1255 ERR("CreateTexture2D failed, returning %#x\n", hr);
1256 return hr;
1259 *surface = texture->wined3d_surface;
1260 IWineD3DSurface_AddRef(*surface);
1261 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1263 return S_OK;
1266 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1267 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1268 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1270 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1271 iface, superior, width, height, depth, format, pool, usage, volume);
1273 return E_NOTIMPL;
1276 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1277 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1279 IWineDXGIDevice *wine_device;
1280 HRESULT hr;
1282 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1284 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1285 if (FAILED(hr))
1287 ERR("Device should implement IWineDXGIDevice\n");
1288 return E_FAIL;
1291 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1292 IWineDXGIDevice_Release(wine_device);
1293 if (FAILED(hr))
1295 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1296 return hr;
1299 return S_OK;
1302 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1304 /* IUnknown methods */
1305 device_parent_QueryInterface,
1306 device_parent_AddRef,
1307 device_parent_Release,
1308 /* IWineD3DDeviceParent methods */
1309 device_parent_WineD3DDeviceCreated,
1310 device_parent_CreateSurface,
1311 device_parent_CreateRenderTarget,
1312 device_parent_CreateDepthStencilSurface,
1313 device_parent_CreateVolume,
1314 device_parent_CreateSwapChain,