d3d10core: Keep a reference to the wined3d device in the d3d10 device.
[wine/hacks.git] / dlls / d3d10core / device.c
blob46e57b2acbaf1390d71291b109a726e1a478811b
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 FIXME("iface %p, vertex_count %u, start_vertex_location %u stub!\n",
150 iface, vertex_count, start_vertex_location);
153 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
154 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
156 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
157 iface, start_slot, buffer_count, buffers);
160 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
162 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
165 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
166 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
167 const UINT *strides, const UINT *offsets)
169 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
170 iface, start_slot, buffer_count, buffers, strides, offsets);
173 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
174 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
176 FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
177 iface, buffer, debug_dxgi_format(format), offset);
180 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
181 UINT instance_index_count, UINT instance_count, UINT start_index_location,
182 INT base_vertex_location, UINT start_instance_location)
184 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
185 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
186 iface, instance_index_count, instance_count, start_index_location,
187 base_vertex_location, start_instance_location);
190 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
191 UINT instance_vertex_count, UINT instance_count,
192 UINT start_vertex_location, UINT start_instance_location)
194 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
195 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
196 start_vertex_location, start_instance_location);
199 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
200 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
202 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
203 iface, start_slot, buffer_count, buffers);
206 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
208 FIXME("iface %p, shader %p stub!\n", iface, shader);
211 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
213 FIXME("iface %p, topology %s stub!\n", iface, debug_d3d10_primitive_topology(topology));
216 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
217 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
219 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
220 iface, start_slot, view_count, views);
223 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
224 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
226 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
227 iface, start_slot, sampler_count, samplers);
230 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
232 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
235 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
236 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
238 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
239 iface, start_slot, view_count, views);
242 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
243 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
245 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
246 iface, start_slot, sampler_count, samplers);
249 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
250 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
251 ID3D10DepthStencilView *depth_stencil_view)
253 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
254 iface, render_target_view_count, render_target_views, depth_stencil_view);
257 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
258 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
260 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
261 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
264 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
265 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
267 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
268 iface, depth_stencil_state, stencil_ref);
271 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
272 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
274 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
277 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
279 FIXME("iface %p stub!\n", iface);
282 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
284 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
287 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
288 UINT viewport_count, const D3D10_VIEWPORT *viewports)
290 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
293 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
294 UINT rect_count, const D3D10_RECT *rects)
296 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
299 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
300 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
301 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
303 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
304 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
305 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
306 src_resource, src_subresource_idx, src_box);
309 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
310 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
312 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
315 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
316 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
317 const void *data, UINT row_pitch, UINT depth_pitch)
319 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
320 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
323 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
324 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
326 FIXME("iface %p, render_target_view %p, color_rgba [%f %f %f %f] stub!\n",
327 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
330 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
331 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
333 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
334 iface, depth_stencil_view, flags, depth, stencil);
337 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
339 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
342 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
343 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
344 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
346 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
347 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
348 iface, dst_resource, dst_subresource_idx,
349 src_resource, src_subresource_idx, debug_dxgi_format(format));
352 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
353 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
355 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
356 iface, start_slot, buffer_count, buffers);
359 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
360 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
362 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
363 iface, start_slot, view_count, views);
366 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
368 FIXME("iface %p, shader %p stub!\n", iface, shader);
371 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
372 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
374 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
375 iface, start_slot, sampler_count, samplers);
378 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
380 FIXME("iface %p, shader %p stub!\n", iface, shader);
383 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
384 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
386 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
387 iface, start_slot, buffer_count, buffers);
390 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
392 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
395 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
396 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
398 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
399 iface, start_slot, buffer_count, buffers, strides, offsets);
402 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
403 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
405 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
408 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
409 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
411 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
412 iface, start_slot, buffer_count, buffers);
415 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
417 FIXME("iface %p, shader %p stub!\n", iface, shader);
420 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
422 FIXME("iface %p, topology %p stub!\n", iface, topology);
425 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
426 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
428 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
429 iface, start_slot, view_count, views);
432 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
433 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
435 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
436 iface, start_slot, sampler_count, samplers);
439 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
440 ID3D10Predicate **predicate, BOOL *value)
442 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
445 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
446 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
448 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
449 iface, start_slot, view_count, views);
452 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
453 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
455 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
456 iface, start_slot, sampler_count, samplers);
459 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
460 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
462 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
463 iface, view_count, render_target_views, depth_stencil_view);
466 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
467 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
469 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
470 iface, blend_state, blend_factor, sample_mask);
473 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
474 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
476 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
477 iface, depth_stencil_state, stencil_ref);
480 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
481 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
483 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
484 iface, buffer_count, buffers, offsets);
487 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
489 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
492 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
493 UINT *viewport_count, D3D10_VIEWPORT *viewports)
495 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
498 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
500 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
503 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
505 FIXME("iface %p stub!\n", iface);
507 return E_NOTIMPL;
510 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
512 FIXME("iface %p, flags %#x stub!\n", iface, flags);
514 return E_NOTIMPL;
517 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
519 FIXME("iface %p stub!\n", iface);
521 return 0;
524 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
525 REFGUID guid, UINT *data_size, void *data)
527 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
528 iface, debugstr_guid(guid), data_size, data);
530 return E_NOTIMPL;
533 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
534 REFGUID guid, UINT data_size, const void *data)
536 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
537 iface, debugstr_guid(guid), data_size, data);
539 return E_NOTIMPL;
542 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
543 REFGUID guid, const IUnknown *data)
545 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
547 return E_NOTIMPL;
550 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
552 FIXME("iface %p stub!\n", iface);
555 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
557 FIXME("iface %p stub!\n", iface);
560 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
561 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
563 struct d3d10_buffer *object;
565 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
567 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
568 if (!object)
570 ERR("Failed to allocate D3D10 buffer object memory\n");
571 return E_OUTOFMEMORY;
574 object->vtbl = &d3d10_buffer_vtbl;
575 object->refcount = 1;
577 *buffer = (ID3D10Buffer *)object;
579 TRACE("Created ID3D10Buffer %p\n", object);
581 return S_OK;
584 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
585 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
587 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
589 return E_NOTIMPL;
592 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
593 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
595 struct d3d10_device *This = (struct d3d10_device *)iface;
596 struct d3d10_texture2d *object;
597 HRESULT hr;
599 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
601 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
602 if (!object)
604 ERR("Failed to allocate D3D10 texture2d object memory\n");
605 return E_OUTOFMEMORY;
608 object->vtbl = &d3d10_texture2d_vtbl;
609 object->refcount = 1;
610 object->desc = *desc;
612 if (desc->MipLevels == 1 && desc->ArraySize == 1)
614 IWineDXGIDevice *wine_device;
616 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
617 if (FAILED(hr))
619 ERR("Device should implement IWineDXGIDevice\n");
620 HeapFree(GetProcessHeap(), 0, object);
621 return E_FAIL;
624 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
625 (IUnknown *)object, (void **)&object->dxgi_surface);
626 IWineDXGIDevice_Release(wine_device);
627 if (FAILED(hr))
629 ERR("Failed to create DXGI surface, returning %#x\n", hr);
630 HeapFree(GetProcessHeap(), 0, object);
631 return hr;
634 FIXME("Implement DXGI<->wined3d usage conversion\n");
636 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
637 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
638 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
639 desc->SampleDesc.Count, desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
640 if (FAILED(hr))
642 ERR("CreateSurface failed, returning %#x\n", hr);
643 IDXGISurface_Release(object->dxgi_surface);
644 HeapFree(GetProcessHeap(), 0, object);
645 return hr;
649 *texture = (ID3D10Texture2D *)object;
651 TRACE("Created ID3D10Texture2D %p\n", object);
653 return S_OK;
656 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
657 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
659 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
661 return E_NOTIMPL;
664 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
665 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
667 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
669 return E_NOTIMPL;
672 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
674 D3D10_RESOURCE_DIMENSION dimension;
675 HRESULT hr;
677 ID3D10Resource_GetType(resource, &dimension);
679 switch(dimension)
681 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
683 ID3D10Texture1D *texture;
684 D3D10_TEXTURE1D_DESC texture_desc;
686 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
687 if (FAILED(hr))
689 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
690 return E_INVALIDARG;
693 ID3D10Texture1D_GetDesc(texture, &texture_desc);
694 ID3D10Texture1D_Release(texture);
696 desc->Format = texture_desc.Format;
697 if (texture_desc.ArraySize == 1)
699 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
700 desc->Texture1D.MipSlice = 0;
702 else
704 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
705 desc->Texture1DArray.MipSlice = 0;
706 desc->Texture1DArray.FirstArraySlice = 0;
707 desc->Texture1DArray.ArraySize = 1;
710 return S_OK;
713 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
715 ID3D10Texture2D *texture;
716 D3D10_TEXTURE2D_DESC texture_desc;
718 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
719 if (FAILED(hr))
721 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
722 return E_INVALIDARG;
725 ID3D10Texture2D_GetDesc(texture, &texture_desc);
726 ID3D10Texture2D_Release(texture);
728 desc->Format = texture_desc.Format;
729 if (texture_desc.ArraySize == 1)
731 if (texture_desc.SampleDesc.Count == 1)
733 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
734 desc->Texture2D.MipSlice = 0;
736 else
738 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
741 else
743 if (texture_desc.SampleDesc.Count == 1)
745 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
746 desc->Texture2DArray.MipSlice = 0;
747 desc->Texture2DArray.FirstArraySlice = 0;
748 desc->Texture2DArray.ArraySize = 1;
750 else
752 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
753 desc->Texture2DMSArray.FirstArraySlice = 0;
754 desc->Texture2DMSArray.ArraySize = 1;
758 return S_OK;
761 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
763 ID3D10Texture3D *texture;
764 D3D10_TEXTURE3D_DESC texture_desc;
766 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
767 if (FAILED(hr))
769 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
770 return E_INVALIDARG;
773 ID3D10Texture3D_GetDesc(texture, &texture_desc);
774 ID3D10Texture3D_Release(texture);
776 desc->Format = texture_desc.Format;
777 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
778 desc->Texture3D.MipSlice = 0;
779 desc->Texture3D.FirstWSlice = 0;
780 desc->Texture3D.WSize = 1;
782 return S_OK;
785 default:
786 FIXME("Unhandled resource dimension %#x\n", dimension);
787 return E_INVALIDARG;
791 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
792 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
794 struct d3d10_rendertarget_view *object;
796 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
798 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
799 if (!object)
801 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
802 return E_OUTOFMEMORY;
805 object->vtbl = &d3d10_rendertarget_view_vtbl;
806 object->refcount = 1;
808 if (!desc)
810 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
811 if (FAILED(hr))
813 HeapFree(GetProcessHeap(), 0, object);
814 return hr;
817 else
819 object->desc = *desc;
822 object->resource = resource;
823 ID3D10Resource_AddRef(resource);
825 *view = (ID3D10RenderTargetView *)object;
827 return S_OK;
830 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
831 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
833 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
835 return E_NOTIMPL;
838 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
839 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
840 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
842 FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
843 "\tshader_byte_code_length %lu, input_layout %p stub!\n",
844 iface, element_descs, element_count, shader_byte_code,
845 shader_byte_code_length, input_layout);
847 return E_NOTIMPL;
850 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
851 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
853 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
854 iface, byte_code, byte_code_length, shader);
856 return E_NOTIMPL;
859 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
860 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
862 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
863 iface, byte_code, byte_code_length, shader);
865 return E_NOTIMPL;
868 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
869 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
870 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
872 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
873 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
874 iface, byte_code, byte_code_length, output_stream_decls,
875 output_stream_decl_count, output_stream_stride, shader);
877 return E_NOTIMPL;
880 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
881 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
883 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
884 iface, byte_code, byte_code_length, shader);
886 return E_NOTIMPL;
889 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
890 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
892 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
894 return E_NOTIMPL;
897 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
898 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
900 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
902 return E_NOTIMPL;
905 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
906 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
908 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
910 return E_NOTIMPL;
913 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
914 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
916 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
918 return E_NOTIMPL;
921 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
922 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
924 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
926 return E_NOTIMPL;
929 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
930 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
932 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
934 return E_NOTIMPL;
937 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
938 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
940 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
942 return E_NOTIMPL;
945 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
946 DXGI_FORMAT format, UINT *format_support)
948 FIXME("iface %p, format %s, format_support %p stub!\n",
949 iface, debug_dxgi_format(format), format_support);
951 return E_NOTIMPL;
954 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
955 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
957 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
958 iface, debug_dxgi_format(format), sample_count, quality_level_count);
960 return E_NOTIMPL;
963 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
965 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
968 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
969 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
970 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
972 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
973 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
974 iface, desc, type, active_counters, name, name_length,
975 units, units_length, description, description_length);
977 return E_NOTIMPL;
980 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
982 FIXME("iface %p stub!\n", iface);
984 return 0;
987 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
988 HANDLE resource_handle, REFIID guid, void **resource)
990 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
991 iface, resource_handle, debugstr_guid(guid), resource);
993 return E_NOTIMPL;
996 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
998 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1001 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1003 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1006 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1008 /* IUnknown methods */
1009 d3d10_device_QueryInterface,
1010 d3d10_device_AddRef,
1011 d3d10_device_Release,
1012 /* ID3D10Device methods */
1013 d3d10_device_VSSetConstantBuffers,
1014 d3d10_device_PSSetShaderResources,
1015 d3d10_device_PSSetShader,
1016 d3d10_device_PSSetSamplers,
1017 d3d10_device_VSSetShader,
1018 d3d10_device_DrawIndexed,
1019 d3d10_device_Draw,
1020 d3d10_device_PSSetConstantBuffers,
1021 d3d10_device_IASetInputLayout,
1022 d3d10_device_IASetVertexBuffers,
1023 d3d10_device_IASetIndexBuffer,
1024 d3d10_device_DrawIndexedInstanced,
1025 d3d10_device_DrawInstanced,
1026 d3d10_device_GSSetConstantBuffers,
1027 d3d10_device_GSSetShader,
1028 d3d10_device_IASetPrimitiveTopology,
1029 d3d10_device_VSSetShaderResources,
1030 d3d10_device_VSSetSamplers,
1031 d3d10_device_SetPredication,
1032 d3d10_device_GSSetShaderResources,
1033 d3d10_device_GSSetSamplers,
1034 d3d10_device_OMSetRenderTargets,
1035 d3d10_device_OMSetBlendState,
1036 d3d10_device_OMSetDepthStencilState,
1037 d3d10_device_SOSetTargets,
1038 d3d10_device_DrawAuto,
1039 d3d10_device_RSSetState,
1040 d3d10_device_RSSetViewports,
1041 d3d10_device_RSSetScissorRects,
1042 d3d10_device_CopySubresourceRegion,
1043 d3d10_device_CopyResource,
1044 d3d10_device_UpdateSubresource,
1045 d3d10_device_ClearRenderTargetView,
1046 d3d10_device_ClearDepthStencilView,
1047 d3d10_device_GenerateMips,
1048 d3d10_device_ResolveSubresource,
1049 d3d10_device_VSGetConstantBuffers,
1050 d3d10_device_PSGetShaderResources,
1051 d3d10_device_PSGetShader,
1052 d3d10_device_PSGetSamplers,
1053 d3d10_device_VSGetShader,
1054 d3d10_device_PSGetConstantBuffers,
1055 d3d10_device_IAGetInputLayout,
1056 d3d10_device_IAGetVertexBuffers,
1057 d3d10_device_IAGetIndexBuffer,
1058 d3d10_device_GSGetConstantBuffers,
1059 d3d10_device_GSGetShader,
1060 d3d10_device_IAGetPrimitiveTopology,
1061 d3d10_device_VSGetShaderResources,
1062 d3d10_device_VSGetSamplers,
1063 d3d10_device_GetPredication,
1064 d3d10_device_GSGetShaderResources,
1065 d3d10_device_GSGetSamplers,
1066 d3d10_device_OMGetRenderTargets,
1067 d3d10_device_OMGetBlendState,
1068 d3d10_device_OMGetDepthStencilState,
1069 d3d10_device_SOGetTargets,
1070 d3d10_device_RSGetState,
1071 d3d10_device_RSGetViewports,
1072 d3d10_device_RSGetScissorRects,
1073 d3d10_device_GetDeviceRemovedReason,
1074 d3d10_device_SetExceptionMode,
1075 d3d10_device_GetExceptionMode,
1076 d3d10_device_GetPrivateData,
1077 d3d10_device_SetPrivateData,
1078 d3d10_device_SetPrivateDataInterface,
1079 d3d10_device_ClearState,
1080 d3d10_device_Flush,
1081 d3d10_device_CreateBuffer,
1082 d3d10_device_CreateTexture1D,
1083 d3d10_device_CreateTexture2D,
1084 d3d10_device_CreateTexture3D,
1085 d3d10_device_CreateShaderResourceView,
1086 d3d10_device_CreateRenderTargetView,
1087 d3d10_device_CreateDepthStencilView,
1088 d3d10_device_CreateInputLayout,
1089 d3d10_device_CreateVertexShader,
1090 d3d10_device_CreateGeometryShader,
1091 d3d10_device_CreateGeometryShaderWithStreamOutput,
1092 d3d10_device_CreatePixelShader,
1093 d3d10_device_CreateBlendState,
1094 d3d10_device_CreateDepthStencilState,
1095 d3d10_device_CreateRasterizerState,
1096 d3d10_device_CreateSamplerState,
1097 d3d10_device_CreateQuery,
1098 d3d10_device_CreatePredicate,
1099 d3d10_device_CreateCounter,
1100 d3d10_device_CheckFormatSupport,
1101 d3d10_device_CheckMultisampleQualityLevels,
1102 d3d10_device_CheckCounterInfo,
1103 d3d10_device_CheckCounter,
1104 d3d10_device_GetCreationFlags,
1105 d3d10_device_OpenSharedResource,
1106 d3d10_device_SetTextFilterSize,
1107 d3d10_device_GetTextFilterSize,
1110 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1112 /* IUnknown methods */
1113 d3d10_device_inner_QueryInterface,
1114 d3d10_device_inner_AddRef,
1115 d3d10_device_inner_Release,
1118 /* IWineD3DDeviceParent IUnknown methods */
1120 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1122 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1125 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1127 struct d3d10_device *This = device_from_device_parent(iface);
1128 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1131 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1133 struct d3d10_device *This = device_from_device_parent(iface);
1134 return d3d10_device_AddRef((ID3D10Device *)This);
1137 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1139 struct d3d10_device *This = device_from_device_parent(iface);
1140 return d3d10_device_Release((ID3D10Device *)This);
1143 /* IWineD3DDeviceParent methods */
1145 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1147 struct d3d10_device *This = device_from_device_parent(iface);
1149 TRACE("iface %p, device %p\n", iface, device);
1151 IWineD3DDevice_AddRef(device);
1152 This->wined3d_device = device;
1155 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1156 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1157 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1159 struct d3d10_device *This = device_from_device_parent(iface);
1160 struct d3d10_texture2d *texture;
1161 D3D10_TEXTURE2D_DESC desc;
1162 HRESULT hr;
1164 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1165 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1166 iface, superior, width, height, format, usage, pool, level, face, surface);
1168 FIXME("Implement DXGI<->wined3d usage conversion\n");
1170 desc.Width = width;
1171 desc.Height = height;
1172 desc.MipLevels = 1;
1173 desc.ArraySize = 1;
1174 desc.Format = dxgi_format_from_wined3dformat(format);
1175 desc.SampleDesc.Count = 1;
1176 desc.SampleDesc.Quality = 0;
1177 desc.Usage = usage;
1178 desc.BindFlags = 0;
1179 desc.CPUAccessFlags = 0;
1180 desc.MiscFlags = 0;
1182 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1183 if (FAILED(hr))
1185 ERR("CreateTexture2D failed, returning %#x\n", hr);
1186 return hr;
1189 *surface = texture->wined3d_surface;
1191 return S_OK;
1194 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1195 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1196 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1198 struct d3d10_device *This = device_from_device_parent(iface);
1199 struct d3d10_texture2d *texture;
1200 D3D10_TEXTURE2D_DESC desc;
1201 HRESULT hr;
1203 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1204 "\tmultisample_quality %u, lockable %u, surface %p stub!\n",
1205 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1207 FIXME("Implement DXGI<->wined3d usage conversion\n");
1209 desc.Width = width;
1210 desc.Height = height;
1211 desc.MipLevels = 1;
1212 desc.ArraySize = 1;
1213 desc.Format = dxgi_format_from_wined3dformat(format);
1214 desc.SampleDesc.Count = multisample_type;
1215 desc.SampleDesc.Quality = multisample_quality;
1216 desc.Usage = D3D10_USAGE_DEFAULT;
1217 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1218 desc.CPUAccessFlags = 0;
1219 desc.MiscFlags = 0;
1221 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1222 if (FAILED(hr))
1224 ERR("CreateTexture2D failed, returning %#x\n", hr);
1225 return hr;
1228 *surface = texture->wined3d_surface;
1230 return S_OK;
1233 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1234 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1235 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1237 struct d3d10_device *This = device_from_device_parent(iface);
1238 struct d3d10_texture2d *texture;
1239 D3D10_TEXTURE2D_DESC desc;
1240 HRESULT hr;
1242 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1243 "\tmultisample_quality %u, discard %u, surface %p stub!\n",
1244 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1246 FIXME("Implement DXGI<->wined3d usage conversion\n");
1248 desc.Width = width;
1249 desc.Height = height;
1250 desc.MipLevels = 1;
1251 desc.ArraySize = 1;
1252 desc.Format = dxgi_format_from_wined3dformat(format);
1253 desc.SampleDesc.Count = multisample_type;
1254 desc.SampleDesc.Quality = multisample_quality;
1255 desc.Usage = D3D10_USAGE_DEFAULT;
1256 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1257 desc.CPUAccessFlags = 0;
1258 desc.MiscFlags = 0;
1260 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1261 if (FAILED(hr))
1263 ERR("CreateTexture2D failed, returning %#x\n", hr);
1264 return hr;
1267 *surface = texture->wined3d_surface;
1269 return S_OK;
1272 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1273 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1274 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1276 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1277 iface, superior, width, height, depth, format, pool, usage, volume);
1279 return E_NOTIMPL;
1282 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1283 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1285 FIXME("iface %p, present_parameters %p, swapchain %p stub!\n", iface, present_parameters, swapchain);
1287 return E_NOTIMPL;
1291 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1293 /* IUnknown methods */
1294 device_parent_QueryInterface,
1295 device_parent_AddRef,
1296 device_parent_Release,
1297 /* IWineD3DDeviceParent methods */
1298 device_parent_WineD3DDeviceCreated,
1299 device_parent_CreateSurface,
1300 device_parent_CreateRenderTarget,
1301 device_parent_CreateDepthStencilSurface,
1302 device_parent_CreateVolume,
1303 device_parent_CreateSwapChain,