jscript: Mark free memory if heap warnings are turned on.
[wine/multimedia.git] / dlls / d3d10core / device.c
blob0d798085e602257ae183b97143d2eceefc72b433
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_device *This = (struct d3d10_device *)iface;
564 struct wined3d_buffer_desc wined3d_desc;
565 struct d3d10_buffer *object;
566 HRESULT hr;
568 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
570 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
571 if (!object)
573 ERR("Failed to allocate D3D10 buffer object memory\n");
574 return E_OUTOFMEMORY;
577 object->vtbl = &d3d10_buffer_vtbl;
578 object->refcount = 1;
580 FIXME("Implement DXGI<->wined3d usage conversion\n");
582 wined3d_desc.byte_width = desc->ByteWidth;
583 wined3d_desc.usage = desc->Usage;
584 wined3d_desc.bind_flags = desc->BindFlags;
585 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
586 wined3d_desc.misc_flags = desc->MiscFlags;
588 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
589 (IUnknown *)object, &object->wined3d_buffer);
590 if (FAILED(hr))
592 ERR("CreateBuffer failed, returning %#x\n", hr);
593 HeapFree(GetProcessHeap(), 0, object);
594 return hr;
597 *buffer = (ID3D10Buffer *)object;
599 TRACE("Created ID3D10Buffer %p\n", object);
601 return S_OK;
604 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
605 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
607 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
609 return E_NOTIMPL;
612 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
613 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
615 struct d3d10_device *This = (struct d3d10_device *)iface;
616 struct d3d10_texture2d *object;
617 HRESULT hr;
619 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
621 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
622 if (!object)
624 ERR("Failed to allocate D3D10 texture2d object memory\n");
625 return E_OUTOFMEMORY;
628 object->vtbl = &d3d10_texture2d_vtbl;
629 object->refcount = 1;
630 object->desc = *desc;
632 if (desc->MipLevels == 1 && desc->ArraySize == 1)
634 IWineDXGIDevice *wine_device;
636 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
637 if (FAILED(hr))
639 ERR("Device should implement IWineDXGIDevice\n");
640 HeapFree(GetProcessHeap(), 0, object);
641 return E_FAIL;
644 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
645 (IUnknown *)object, (void **)&object->dxgi_surface);
646 IWineDXGIDevice_Release(wine_device);
647 if (FAILED(hr))
649 ERR("Failed to create DXGI surface, returning %#x\n", hr);
650 HeapFree(GetProcessHeap(), 0, object);
651 return hr;
654 FIXME("Implement DXGI<->wined3d usage conversion\n");
656 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
657 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
658 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
659 desc->SampleDesc.Count, desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
660 if (FAILED(hr))
662 ERR("CreateSurface failed, returning %#x\n", hr);
663 IDXGISurface_Release(object->dxgi_surface);
664 HeapFree(GetProcessHeap(), 0, object);
665 return hr;
669 *texture = (ID3D10Texture2D *)object;
671 TRACE("Created ID3D10Texture2D %p\n", object);
673 return S_OK;
676 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
677 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
679 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
681 return E_NOTIMPL;
684 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
685 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
687 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
689 return E_NOTIMPL;
692 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
694 D3D10_RESOURCE_DIMENSION dimension;
696 ID3D10Resource_GetType(resource, &dimension);
698 switch(dimension)
700 case D3D10_RESOURCE_DIMENSION_BUFFER:
701 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
703 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
704 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
706 default:
707 FIXME("Unhandled resource dimension %#x\n", dimension);
708 return NULL;
712 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
714 D3D10_RESOURCE_DIMENSION dimension;
715 HRESULT hr;
717 ID3D10Resource_GetType(resource, &dimension);
719 switch(dimension)
721 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
723 ID3D10Texture1D *texture;
724 D3D10_TEXTURE1D_DESC texture_desc;
726 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
727 if (FAILED(hr))
729 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
730 return E_INVALIDARG;
733 ID3D10Texture1D_GetDesc(texture, &texture_desc);
734 ID3D10Texture1D_Release(texture);
736 desc->Format = texture_desc.Format;
737 if (texture_desc.ArraySize == 1)
739 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
740 desc->Texture1D.MipSlice = 0;
742 else
744 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
745 desc->Texture1DArray.MipSlice = 0;
746 desc->Texture1DArray.FirstArraySlice = 0;
747 desc->Texture1DArray.ArraySize = 1;
750 return S_OK;
753 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
755 ID3D10Texture2D *texture;
756 D3D10_TEXTURE2D_DESC texture_desc;
758 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
759 if (FAILED(hr))
761 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
762 return E_INVALIDARG;
765 ID3D10Texture2D_GetDesc(texture, &texture_desc);
766 ID3D10Texture2D_Release(texture);
768 desc->Format = texture_desc.Format;
769 if (texture_desc.ArraySize == 1)
771 if (texture_desc.SampleDesc.Count == 1)
773 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
774 desc->Texture2D.MipSlice = 0;
776 else
778 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
781 else
783 if (texture_desc.SampleDesc.Count == 1)
785 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
786 desc->Texture2DArray.MipSlice = 0;
787 desc->Texture2DArray.FirstArraySlice = 0;
788 desc->Texture2DArray.ArraySize = 1;
790 else
792 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
793 desc->Texture2DMSArray.FirstArraySlice = 0;
794 desc->Texture2DMSArray.ArraySize = 1;
798 return S_OK;
801 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
803 ID3D10Texture3D *texture;
804 D3D10_TEXTURE3D_DESC texture_desc;
806 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
807 if (FAILED(hr))
809 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
810 return E_INVALIDARG;
813 ID3D10Texture3D_GetDesc(texture, &texture_desc);
814 ID3D10Texture3D_Release(texture);
816 desc->Format = texture_desc.Format;
817 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
818 desc->Texture3D.MipSlice = 0;
819 desc->Texture3D.FirstWSlice = 0;
820 desc->Texture3D.WSize = 1;
822 return S_OK;
825 default:
826 FIXME("Unhandled resource dimension %#x\n", dimension);
827 return E_INVALIDARG;
831 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
832 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
834 struct d3d10_device *This = (struct d3d10_device *)iface;
835 struct d3d10_rendertarget_view *object;
836 IWineD3DResource *wined3d_resource;
838 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
840 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
841 if (!object)
843 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
844 return E_OUTOFMEMORY;
847 object->vtbl = &d3d10_rendertarget_view_vtbl;
848 object->refcount = 1;
850 if (!desc)
852 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
853 if (FAILED(hr))
855 HeapFree(GetProcessHeap(), 0, object);
856 return hr;
859 else
861 object->desc = *desc;
864 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
865 if (!wined3d_resource)
867 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
868 HeapFree(GetProcessHeap(), 0, object);
869 return E_FAIL;
871 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
872 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
874 *view = (ID3D10RenderTargetView *)object;
876 return S_OK;
879 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
880 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
882 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
884 return E_NOTIMPL;
887 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
888 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
889 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
891 FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
892 "\tshader_byte_code_length %lu, input_layout %p stub!\n",
893 iface, element_descs, element_count, shader_byte_code,
894 shader_byte_code_length, input_layout);
896 return E_NOTIMPL;
899 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
900 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
902 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
903 iface, byte_code, byte_code_length, shader);
905 return E_NOTIMPL;
908 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
909 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
911 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
912 iface, byte_code, byte_code_length, shader);
914 return E_NOTIMPL;
917 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
918 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
919 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
921 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
922 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
923 iface, byte_code, byte_code_length, output_stream_decls,
924 output_stream_decl_count, output_stream_stride, shader);
926 return E_NOTIMPL;
929 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
930 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
932 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
933 iface, byte_code, byte_code_length, shader);
935 return E_NOTIMPL;
938 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
939 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
941 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
943 return E_NOTIMPL;
946 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
947 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
949 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
951 return E_NOTIMPL;
954 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
955 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
957 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
959 return E_NOTIMPL;
962 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
963 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
965 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
967 return E_NOTIMPL;
970 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
971 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
973 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
975 return E_NOTIMPL;
978 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
979 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
981 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
983 return E_NOTIMPL;
986 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
987 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
989 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
991 return E_NOTIMPL;
994 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
995 DXGI_FORMAT format, UINT *format_support)
997 FIXME("iface %p, format %s, format_support %p stub!\n",
998 iface, debug_dxgi_format(format), format_support);
1000 return E_NOTIMPL;
1003 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1004 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1006 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1007 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1009 return E_NOTIMPL;
1012 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1014 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1017 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1018 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1019 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1021 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1022 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1023 iface, desc, type, active_counters, name, name_length,
1024 units, units_length, description, description_length);
1026 return E_NOTIMPL;
1029 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1031 FIXME("iface %p stub!\n", iface);
1033 return 0;
1036 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1037 HANDLE resource_handle, REFIID guid, void **resource)
1039 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1040 iface, resource_handle, debugstr_guid(guid), resource);
1042 return E_NOTIMPL;
1045 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1047 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1050 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1052 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1055 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1057 /* IUnknown methods */
1058 d3d10_device_QueryInterface,
1059 d3d10_device_AddRef,
1060 d3d10_device_Release,
1061 /* ID3D10Device methods */
1062 d3d10_device_VSSetConstantBuffers,
1063 d3d10_device_PSSetShaderResources,
1064 d3d10_device_PSSetShader,
1065 d3d10_device_PSSetSamplers,
1066 d3d10_device_VSSetShader,
1067 d3d10_device_DrawIndexed,
1068 d3d10_device_Draw,
1069 d3d10_device_PSSetConstantBuffers,
1070 d3d10_device_IASetInputLayout,
1071 d3d10_device_IASetVertexBuffers,
1072 d3d10_device_IASetIndexBuffer,
1073 d3d10_device_DrawIndexedInstanced,
1074 d3d10_device_DrawInstanced,
1075 d3d10_device_GSSetConstantBuffers,
1076 d3d10_device_GSSetShader,
1077 d3d10_device_IASetPrimitiveTopology,
1078 d3d10_device_VSSetShaderResources,
1079 d3d10_device_VSSetSamplers,
1080 d3d10_device_SetPredication,
1081 d3d10_device_GSSetShaderResources,
1082 d3d10_device_GSSetSamplers,
1083 d3d10_device_OMSetRenderTargets,
1084 d3d10_device_OMSetBlendState,
1085 d3d10_device_OMSetDepthStencilState,
1086 d3d10_device_SOSetTargets,
1087 d3d10_device_DrawAuto,
1088 d3d10_device_RSSetState,
1089 d3d10_device_RSSetViewports,
1090 d3d10_device_RSSetScissorRects,
1091 d3d10_device_CopySubresourceRegion,
1092 d3d10_device_CopyResource,
1093 d3d10_device_UpdateSubresource,
1094 d3d10_device_ClearRenderTargetView,
1095 d3d10_device_ClearDepthStencilView,
1096 d3d10_device_GenerateMips,
1097 d3d10_device_ResolveSubresource,
1098 d3d10_device_VSGetConstantBuffers,
1099 d3d10_device_PSGetShaderResources,
1100 d3d10_device_PSGetShader,
1101 d3d10_device_PSGetSamplers,
1102 d3d10_device_VSGetShader,
1103 d3d10_device_PSGetConstantBuffers,
1104 d3d10_device_IAGetInputLayout,
1105 d3d10_device_IAGetVertexBuffers,
1106 d3d10_device_IAGetIndexBuffer,
1107 d3d10_device_GSGetConstantBuffers,
1108 d3d10_device_GSGetShader,
1109 d3d10_device_IAGetPrimitiveTopology,
1110 d3d10_device_VSGetShaderResources,
1111 d3d10_device_VSGetSamplers,
1112 d3d10_device_GetPredication,
1113 d3d10_device_GSGetShaderResources,
1114 d3d10_device_GSGetSamplers,
1115 d3d10_device_OMGetRenderTargets,
1116 d3d10_device_OMGetBlendState,
1117 d3d10_device_OMGetDepthStencilState,
1118 d3d10_device_SOGetTargets,
1119 d3d10_device_RSGetState,
1120 d3d10_device_RSGetViewports,
1121 d3d10_device_RSGetScissorRects,
1122 d3d10_device_GetDeviceRemovedReason,
1123 d3d10_device_SetExceptionMode,
1124 d3d10_device_GetExceptionMode,
1125 d3d10_device_GetPrivateData,
1126 d3d10_device_SetPrivateData,
1127 d3d10_device_SetPrivateDataInterface,
1128 d3d10_device_ClearState,
1129 d3d10_device_Flush,
1130 d3d10_device_CreateBuffer,
1131 d3d10_device_CreateTexture1D,
1132 d3d10_device_CreateTexture2D,
1133 d3d10_device_CreateTexture3D,
1134 d3d10_device_CreateShaderResourceView,
1135 d3d10_device_CreateRenderTargetView,
1136 d3d10_device_CreateDepthStencilView,
1137 d3d10_device_CreateInputLayout,
1138 d3d10_device_CreateVertexShader,
1139 d3d10_device_CreateGeometryShader,
1140 d3d10_device_CreateGeometryShaderWithStreamOutput,
1141 d3d10_device_CreatePixelShader,
1142 d3d10_device_CreateBlendState,
1143 d3d10_device_CreateDepthStencilState,
1144 d3d10_device_CreateRasterizerState,
1145 d3d10_device_CreateSamplerState,
1146 d3d10_device_CreateQuery,
1147 d3d10_device_CreatePredicate,
1148 d3d10_device_CreateCounter,
1149 d3d10_device_CheckFormatSupport,
1150 d3d10_device_CheckMultisampleQualityLevels,
1151 d3d10_device_CheckCounterInfo,
1152 d3d10_device_CheckCounter,
1153 d3d10_device_GetCreationFlags,
1154 d3d10_device_OpenSharedResource,
1155 d3d10_device_SetTextFilterSize,
1156 d3d10_device_GetTextFilterSize,
1159 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1161 /* IUnknown methods */
1162 d3d10_device_inner_QueryInterface,
1163 d3d10_device_inner_AddRef,
1164 d3d10_device_inner_Release,
1167 /* IWineD3DDeviceParent IUnknown methods */
1169 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1171 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1174 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1176 struct d3d10_device *This = device_from_device_parent(iface);
1177 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1180 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1182 struct d3d10_device *This = device_from_device_parent(iface);
1183 return d3d10_device_AddRef((ID3D10Device *)This);
1186 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1188 struct d3d10_device *This = device_from_device_parent(iface);
1189 return d3d10_device_Release((ID3D10Device *)This);
1192 /* IWineD3DDeviceParent methods */
1194 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1196 struct d3d10_device *This = device_from_device_parent(iface);
1198 TRACE("iface %p, device %p\n", iface, device);
1200 IWineD3DDevice_AddRef(device);
1201 This->wined3d_device = device;
1204 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1205 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1206 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1208 struct d3d10_device *This = device_from_device_parent(iface);
1209 struct d3d10_texture2d *texture;
1210 D3D10_TEXTURE2D_DESC desc;
1211 HRESULT hr;
1213 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1214 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1215 iface, superior, width, height, format, usage, pool, level, face, surface);
1217 FIXME("Implement DXGI<->wined3d usage conversion\n");
1219 desc.Width = width;
1220 desc.Height = height;
1221 desc.MipLevels = 1;
1222 desc.ArraySize = 1;
1223 desc.Format = dxgi_format_from_wined3dformat(format);
1224 desc.SampleDesc.Count = 1;
1225 desc.SampleDesc.Quality = 0;
1226 desc.Usage = usage;
1227 desc.BindFlags = 0;
1228 desc.CPUAccessFlags = 0;
1229 desc.MiscFlags = 0;
1231 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1232 if (FAILED(hr))
1234 ERR("CreateTexture2D failed, returning %#x\n", hr);
1235 return hr;
1238 *surface = texture->wined3d_surface;
1240 return S_OK;
1243 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1244 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1245 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1247 struct d3d10_device *This = device_from_device_parent(iface);
1248 struct d3d10_texture2d *texture;
1249 D3D10_TEXTURE2D_DESC desc;
1250 HRESULT hr;
1252 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1253 "\tmultisample_quality %u, lockable %u, surface %p stub!\n",
1254 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1256 FIXME("Implement DXGI<->wined3d usage conversion\n");
1258 desc.Width = width;
1259 desc.Height = height;
1260 desc.MipLevels = 1;
1261 desc.ArraySize = 1;
1262 desc.Format = dxgi_format_from_wined3dformat(format);
1263 desc.SampleDesc.Count = multisample_type;
1264 desc.SampleDesc.Quality = multisample_quality;
1265 desc.Usage = D3D10_USAGE_DEFAULT;
1266 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1267 desc.CPUAccessFlags = 0;
1268 desc.MiscFlags = 0;
1270 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1271 if (FAILED(hr))
1273 ERR("CreateTexture2D failed, returning %#x\n", hr);
1274 return hr;
1277 *surface = texture->wined3d_surface;
1279 return S_OK;
1282 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1283 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1284 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1286 struct d3d10_device *This = device_from_device_parent(iface);
1287 struct d3d10_texture2d *texture;
1288 D3D10_TEXTURE2D_DESC desc;
1289 HRESULT hr;
1291 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1292 "\tmultisample_quality %u, discard %u, surface %p stub!\n",
1293 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1295 FIXME("Implement DXGI<->wined3d usage conversion\n");
1297 desc.Width = width;
1298 desc.Height = height;
1299 desc.MipLevels = 1;
1300 desc.ArraySize = 1;
1301 desc.Format = dxgi_format_from_wined3dformat(format);
1302 desc.SampleDesc.Count = multisample_type;
1303 desc.SampleDesc.Quality = multisample_quality;
1304 desc.Usage = D3D10_USAGE_DEFAULT;
1305 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1306 desc.CPUAccessFlags = 0;
1307 desc.MiscFlags = 0;
1309 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1310 if (FAILED(hr))
1312 ERR("CreateTexture2D failed, returning %#x\n", hr);
1313 return hr;
1316 *surface = texture->wined3d_surface;
1318 return S_OK;
1321 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1322 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1323 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1325 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1326 iface, superior, width, height, depth, format, pool, usage, volume);
1328 return E_NOTIMPL;
1331 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1332 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1334 IWineDXGIDevice *wine_device;
1335 HRESULT hr;
1337 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1339 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1340 if (FAILED(hr))
1342 ERR("Device should implement IWineDXGIDevice\n");
1343 return E_FAIL;
1346 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1347 IWineDXGIDevice_Release(wine_device);
1348 if (FAILED(hr))
1350 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1351 return hr;
1354 return S_OK;
1357 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1359 /* IUnknown methods */
1360 device_parent_QueryInterface,
1361 device_parent_AddRef,
1362 device_parent_Release,
1363 /* IWineD3DDeviceParent methods */
1364 device_parent_WineD3DDeviceCreated,
1365 device_parent_CreateSurface,
1366 device_parent_CreateRenderTarget,
1367 device_parent_CreateDepthStencilSurface,
1368 device_parent_CreateVolume,
1369 device_parent_CreateSwapChain,