ole32: When renaming a storage element, delete from the current iface.
[wine/multimedia.git] / dlls / d3d10core / device.c
blobb0eae7f0728b8530b3a1a07aebffc88c653d0f37
1 /*
2 * Copyright 2008-2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
21 #include "wine/port.h"
23 #include "d3d10core_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
27 /* Inner IUnknown methods */
29 static inline struct d3d10_device *d3d10_device_from_inner_unknown(IUnknown *iface)
31 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, inner_unknown_vtbl));
34 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid, void **object)
36 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
38 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
40 if (IsEqualGUID(riid, &IID_IUnknown)
41 || IsEqualGUID(riid, &IID_ID3D10Device))
43 IUnknown_AddRef((IUnknown *)This);
44 *object = This;
45 return S_OK;
48 if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
50 IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
51 *object = &This->device_parent_vtbl;
52 return S_OK;
55 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
57 *object = NULL;
58 return E_NOINTERFACE;
61 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
63 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
64 ULONG refcount = InterlockedIncrement(&This->refcount);
66 TRACE("%p increasing refcount to %u\n", This, refcount);
68 return refcount;
71 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
73 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
74 ULONG refcount = InterlockedDecrement(&This->refcount);
76 TRACE("%p decreasing refcount to %u\n", This, refcount);
78 if (!refcount)
80 if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
83 return refcount;
86 /* IUnknown methods */
88 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
90 struct d3d10_device *This = (struct d3d10_device *)iface;
91 TRACE("Forwarding to outer IUnknown\n");
92 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
95 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
97 struct d3d10_device *This = (struct d3d10_device *)iface;
98 TRACE("Forwarding to outer IUnknown\n");
99 return IUnknown_AddRef(This->outer_unknown);
102 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
104 struct d3d10_device *This = (struct d3d10_device *)iface;
105 TRACE("Forwarding to outer IUnknown\n");
106 return IUnknown_Release(This->outer_unknown);
109 /* ID3D10Device methods */
111 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
112 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
114 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
115 iface, start_slot, buffer_count, buffers);
118 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
119 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
121 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
122 iface, start_slot, view_count, views);
125 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
127 FIXME("iface %p, shader %p stub!\n", iface, shader);
130 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
131 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
133 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
134 iface, start_slot, sampler_count, samplers);
137 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
139 FIXME("iface %p, shader %p stub!\n", iface, shader);
142 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
143 UINT index_count, UINT start_index_location, INT base_vertex_location)
145 FIXME("iface %p, index_count %u, start_index_location %u, base_vertex_location %d stub!\n",
146 iface, index_count, start_index_location, base_vertex_location);
149 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
150 UINT vertex_count, UINT start_vertex_location)
152 struct d3d10_device *This = (struct d3d10_device *)iface;
154 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
155 iface, vertex_count, start_vertex_location);
157 IWineD3DDevice_DrawPrimitive(This->wined3d_device, start_vertex_location, vertex_count);
160 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
161 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
163 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
164 iface, start_slot, buffer_count, buffers);
167 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
169 struct d3d10_device *This = (struct d3d10_device *)iface;
171 TRACE("iface %p, input_layout %p\n", iface, input_layout);
173 IWineD3DDevice_SetVertexDeclaration(This->wined3d_device,
174 ((struct d3d10_input_layout *)input_layout)->wined3d_decl);
177 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
178 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
179 const UINT *strides, const UINT *offsets)
181 struct d3d10_device *This = (struct d3d10_device *)iface;
182 unsigned int i;
184 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
185 iface, start_slot, buffer_count, buffers, strides, offsets);
187 for (i = 0; i < buffer_count; ++i)
189 IWineD3DDevice_SetStreamSource(This->wined3d_device, start_slot,
190 ((struct d3d10_buffer *)buffers[i])->wined3d_buffer, offsets[i], strides[i]);
194 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
195 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
197 FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
198 iface, buffer, debug_dxgi_format(format), offset);
201 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
202 UINT instance_index_count, UINT instance_count, UINT start_index_location,
203 INT base_vertex_location, UINT start_instance_location)
205 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
206 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
207 iface, instance_index_count, instance_count, start_index_location,
208 base_vertex_location, start_instance_location);
211 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
212 UINT instance_vertex_count, UINT instance_count,
213 UINT start_vertex_location, UINT start_instance_location)
215 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
216 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
217 start_vertex_location, start_instance_location);
220 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
221 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
223 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
224 iface, start_slot, buffer_count, buffers);
227 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
229 FIXME("iface %p, shader %p stub!\n", iface, shader);
232 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
234 struct d3d10_device *This = (struct d3d10_device *)iface;
236 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
238 IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
241 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
242 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
244 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
245 iface, start_slot, view_count, views);
248 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
249 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
251 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
252 iface, start_slot, sampler_count, samplers);
255 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
257 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
260 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
261 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
263 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
264 iface, start_slot, view_count, views);
267 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
268 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
270 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
271 iface, start_slot, sampler_count, samplers);
274 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
275 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
276 ID3D10DepthStencilView *depth_stencil_view)
278 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
279 iface, render_target_view_count, render_target_views, depth_stencil_view);
282 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
283 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
285 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
286 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
289 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
290 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
292 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
293 iface, depth_stencil_state, stencil_ref);
296 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
297 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
299 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
302 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
304 FIXME("iface %p stub!\n", iface);
307 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
309 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
312 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
313 UINT viewport_count, const D3D10_VIEWPORT *viewports)
315 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
318 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
319 UINT rect_count, const D3D10_RECT *rects)
321 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
324 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
325 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
326 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
328 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
329 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
330 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
331 src_resource, src_subresource_idx, src_box);
334 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
335 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
337 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
340 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
341 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
342 const void *data, UINT row_pitch, UINT depth_pitch)
344 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
345 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
348 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
349 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
351 struct d3d10_device *This = (struct d3d10_device *)iface;
352 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
354 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
355 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
357 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
360 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
361 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
363 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
364 iface, depth_stencil_view, flags, depth, stencil);
367 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
369 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
372 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
373 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
374 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
376 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
377 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
378 iface, dst_resource, dst_subresource_idx,
379 src_resource, src_subresource_idx, debug_dxgi_format(format));
382 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
383 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
385 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
386 iface, start_slot, buffer_count, buffers);
389 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
390 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
392 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
393 iface, start_slot, view_count, views);
396 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
398 FIXME("iface %p, shader %p stub!\n", iface, shader);
401 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
402 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
404 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
405 iface, start_slot, sampler_count, samplers);
408 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
410 FIXME("iface %p, shader %p stub!\n", iface, shader);
413 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
414 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
416 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
417 iface, start_slot, buffer_count, buffers);
420 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
422 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
425 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
426 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
428 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
429 iface, start_slot, buffer_count, buffers, strides, offsets);
432 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
433 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
435 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
438 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
439 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
441 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
442 iface, start_slot, buffer_count, buffers);
445 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
447 FIXME("iface %p, shader %p stub!\n", iface, shader);
450 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
452 struct d3d10_device *This = (struct d3d10_device *)iface;
454 TRACE("iface %p, topology %p\n", iface, topology);
456 IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
459 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
460 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
462 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
463 iface, start_slot, view_count, views);
466 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
467 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
469 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
470 iface, start_slot, sampler_count, samplers);
473 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
474 ID3D10Predicate **predicate, BOOL *value)
476 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
479 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
480 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
482 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
483 iface, start_slot, view_count, views);
486 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
487 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
489 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
490 iface, start_slot, sampler_count, samplers);
493 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
494 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
496 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
497 iface, view_count, render_target_views, depth_stencil_view);
500 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
501 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
503 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
504 iface, blend_state, blend_factor, sample_mask);
507 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
508 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
510 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
511 iface, depth_stencil_state, stencil_ref);
514 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
515 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
517 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
518 iface, buffer_count, buffers, offsets);
521 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
523 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
526 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
527 UINT *viewport_count, D3D10_VIEWPORT *viewports)
529 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
532 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
534 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
537 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
539 FIXME("iface %p stub!\n", iface);
541 return E_NOTIMPL;
544 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
546 FIXME("iface %p, flags %#x stub!\n", iface, flags);
548 return E_NOTIMPL;
551 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
553 FIXME("iface %p stub!\n", iface);
555 return 0;
558 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
559 REFGUID guid, UINT *data_size, void *data)
561 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
562 iface, debugstr_guid(guid), data_size, data);
564 return E_NOTIMPL;
567 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
568 REFGUID guid, UINT data_size, const void *data)
570 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
571 iface, debugstr_guid(guid), data_size, data);
573 return E_NOTIMPL;
576 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
577 REFGUID guid, const IUnknown *data)
579 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
581 return E_NOTIMPL;
584 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
586 FIXME("iface %p stub!\n", iface);
589 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
591 FIXME("iface %p stub!\n", iface);
594 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
595 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
597 struct d3d10_device *This = (struct d3d10_device *)iface;
598 struct wined3d_buffer_desc wined3d_desc;
599 struct d3d10_buffer *object;
600 HRESULT hr;
602 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
604 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
605 if (!object)
607 ERR("Failed to allocate D3D10 buffer object memory\n");
608 return E_OUTOFMEMORY;
611 object->vtbl = &d3d10_buffer_vtbl;
612 object->refcount = 1;
614 FIXME("Implement DXGI<->wined3d usage conversion\n");
616 wined3d_desc.byte_width = desc->ByteWidth;
617 wined3d_desc.usage = desc->Usage;
618 wined3d_desc.bind_flags = desc->BindFlags;
619 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
620 wined3d_desc.misc_flags = desc->MiscFlags;
622 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
623 data ? data->pSysMem : NULL, (IUnknown *)object, &object->wined3d_buffer);
624 if (FAILED(hr))
626 ERR("CreateBuffer failed, returning %#x\n", hr);
627 HeapFree(GetProcessHeap(), 0, object);
628 return hr;
631 *buffer = (ID3D10Buffer *)object;
633 TRACE("Created ID3D10Buffer %p\n", object);
635 return S_OK;
638 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
639 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
641 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
643 return E_NOTIMPL;
646 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
647 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
649 struct d3d10_device *This = (struct d3d10_device *)iface;
650 struct d3d10_texture2d *object;
651 HRESULT hr;
653 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
655 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
656 if (!object)
658 ERR("Failed to allocate D3D10 texture2d object memory\n");
659 return E_OUTOFMEMORY;
662 object->vtbl = &d3d10_texture2d_vtbl;
663 object->refcount = 1;
664 object->desc = *desc;
666 if (desc->MipLevels == 1 && desc->ArraySize == 1)
668 IWineDXGIDevice *wine_device;
670 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
671 if (FAILED(hr))
673 ERR("Device should implement IWineDXGIDevice\n");
674 HeapFree(GetProcessHeap(), 0, object);
675 return E_FAIL;
678 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
679 (IUnknown *)object, (void **)&object->dxgi_surface);
680 IWineDXGIDevice_Release(wine_device);
681 if (FAILED(hr))
683 ERR("Failed to create DXGI surface, returning %#x\n", hr);
684 HeapFree(GetProcessHeap(), 0, object);
685 return hr;
688 FIXME("Implement DXGI<->wined3d usage conversion\n");
690 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
691 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
692 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
693 desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
694 desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
695 if (FAILED(hr))
697 ERR("CreateSurface failed, returning %#x\n", hr);
698 IDXGISurface_Release(object->dxgi_surface);
699 HeapFree(GetProcessHeap(), 0, object);
700 return hr;
704 *texture = (ID3D10Texture2D *)object;
706 TRACE("Created ID3D10Texture2D %p\n", object);
708 return S_OK;
711 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
712 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
714 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
716 return E_NOTIMPL;
719 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
720 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
722 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
724 return E_NOTIMPL;
727 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
729 D3D10_RESOURCE_DIMENSION dimension;
731 ID3D10Resource_GetType(resource, &dimension);
733 switch(dimension)
735 case D3D10_RESOURCE_DIMENSION_BUFFER:
736 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
738 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
739 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
741 default:
742 FIXME("Unhandled resource dimension %#x\n", dimension);
743 return NULL;
747 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
749 D3D10_RESOURCE_DIMENSION dimension;
750 HRESULT hr;
752 ID3D10Resource_GetType(resource, &dimension);
754 switch(dimension)
756 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
758 ID3D10Texture1D *texture;
759 D3D10_TEXTURE1D_DESC texture_desc;
761 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
762 if (FAILED(hr))
764 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
765 return E_INVALIDARG;
768 ID3D10Texture1D_GetDesc(texture, &texture_desc);
769 ID3D10Texture1D_Release(texture);
771 desc->Format = texture_desc.Format;
772 if (texture_desc.ArraySize == 1)
774 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
775 desc->Texture1D.MipSlice = 0;
777 else
779 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
780 desc->Texture1DArray.MipSlice = 0;
781 desc->Texture1DArray.FirstArraySlice = 0;
782 desc->Texture1DArray.ArraySize = 1;
785 return S_OK;
788 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
790 ID3D10Texture2D *texture;
791 D3D10_TEXTURE2D_DESC texture_desc;
793 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
794 if (FAILED(hr))
796 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
797 return E_INVALIDARG;
800 ID3D10Texture2D_GetDesc(texture, &texture_desc);
801 ID3D10Texture2D_Release(texture);
803 desc->Format = texture_desc.Format;
804 if (texture_desc.ArraySize == 1)
806 if (texture_desc.SampleDesc.Count == 1)
808 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
809 desc->Texture2D.MipSlice = 0;
811 else
813 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
816 else
818 if (texture_desc.SampleDesc.Count == 1)
820 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
821 desc->Texture2DArray.MipSlice = 0;
822 desc->Texture2DArray.FirstArraySlice = 0;
823 desc->Texture2DArray.ArraySize = 1;
825 else
827 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
828 desc->Texture2DMSArray.FirstArraySlice = 0;
829 desc->Texture2DMSArray.ArraySize = 1;
833 return S_OK;
836 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
838 ID3D10Texture3D *texture;
839 D3D10_TEXTURE3D_DESC texture_desc;
841 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
842 if (FAILED(hr))
844 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
845 return E_INVALIDARG;
848 ID3D10Texture3D_GetDesc(texture, &texture_desc);
849 ID3D10Texture3D_Release(texture);
851 desc->Format = texture_desc.Format;
852 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
853 desc->Texture3D.MipSlice = 0;
854 desc->Texture3D.FirstWSlice = 0;
855 desc->Texture3D.WSize = 1;
857 return S_OK;
860 default:
861 FIXME("Unhandled resource dimension %#x\n", dimension);
862 return E_INVALIDARG;
866 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
867 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
869 struct d3d10_device *This = (struct d3d10_device *)iface;
870 struct d3d10_rendertarget_view *object;
871 IWineD3DResource *wined3d_resource;
873 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
875 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
876 if (!object)
878 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
879 return E_OUTOFMEMORY;
882 object->vtbl = &d3d10_rendertarget_view_vtbl;
883 object->refcount = 1;
885 if (!desc)
887 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
888 if (FAILED(hr))
890 HeapFree(GetProcessHeap(), 0, object);
891 return hr;
894 else
896 object->desc = *desc;
899 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
900 if (!wined3d_resource)
902 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
903 HeapFree(GetProcessHeap(), 0, object);
904 return E_FAIL;
906 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
907 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
909 *view = (ID3D10RenderTargetView *)object;
911 return S_OK;
914 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
915 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
917 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
919 return E_NOTIMPL;
922 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
923 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
924 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
926 struct d3d10_device *This = (struct d3d10_device *)iface;
927 struct d3d10_input_layout *object;
928 WINED3DVERTEXELEMENT *wined3d_elements;
929 UINT wined3d_element_count;
930 HRESULT hr;
932 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
933 "\tshader_byte_code_length %lu, input_layout %p\n",
934 iface, element_descs, element_count, shader_byte_code,
935 shader_byte_code_length, input_layout);
937 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
938 if (!object)
940 ERR("Failed to allocate D3D10 input layout object memory\n");
941 return E_OUTOFMEMORY;
944 object->vtbl = &d3d10_input_layout_vtbl;
945 object->refcount = 1;
947 hr = d3d10_input_layout_to_wined3d_declaration(element_descs, element_count,
948 shader_byte_code, shader_byte_code_length, &wined3d_elements, &wined3d_element_count);
949 if (FAILED(hr))
951 HeapFree(GetProcessHeap(), 0, object);
952 return hr;
955 IWineD3DDevice_CreateVertexDeclaration(This->wined3d_device, &object->wined3d_decl,
956 (IUnknown *)object, wined3d_elements, wined3d_element_count);
958 HeapFree(GetProcessHeap(), 0, wined3d_elements);
960 *input_layout = (ID3D10InputLayout *)object;
962 return S_OK;
965 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
966 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
968 struct d3d10_vertex_shader *object;
970 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
971 iface, byte_code, byte_code_length, shader);
973 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
974 if (!object)
976 ERR("Failed to allocate D3D10 vertex shader object memory\n");
977 return E_OUTOFMEMORY;
980 object->vtbl = &d3d10_vertex_shader_vtbl;
981 object->refcount = 1;
983 *shader = (ID3D10VertexShader *)object;
985 return S_OK;
988 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
989 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
991 struct d3d10_geometry_shader *object;
993 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
994 iface, byte_code, byte_code_length, shader);
996 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
997 if (!object)
999 ERR("Failed to allocate D3D10 geometry shader object memory\n");
1000 return E_OUTOFMEMORY;
1003 object->vtbl = &d3d10_geometry_shader_vtbl;
1004 object->refcount = 1;
1006 *shader = (ID3D10GeometryShader *)object;
1008 return S_OK;
1011 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
1012 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
1013 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
1015 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
1016 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
1017 iface, byte_code, byte_code_length, output_stream_decls,
1018 output_stream_decl_count, output_stream_stride, shader);
1020 return E_NOTIMPL;
1023 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
1024 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
1026 struct d3d10_pixel_shader *object;
1028 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
1029 iface, byte_code, byte_code_length, shader);
1031 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1032 if (!object)
1034 ERR("Failed to allocate D3D10 pixel shader object memory\n");
1035 return E_OUTOFMEMORY;
1038 object->vtbl = &d3d10_pixel_shader_vtbl;
1039 object->refcount = 1;
1041 *shader = (ID3D10PixelShader *)object;
1043 return S_OK;
1046 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
1047 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
1049 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
1051 return E_NOTIMPL;
1054 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
1055 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
1057 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
1059 return E_NOTIMPL;
1062 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1063 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1065 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
1067 return E_NOTIMPL;
1070 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1071 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1073 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
1075 return E_NOTIMPL;
1078 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1079 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1081 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
1083 return E_NOTIMPL;
1086 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1087 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1089 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1091 return E_NOTIMPL;
1094 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1095 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1097 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1099 return E_NOTIMPL;
1102 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1103 DXGI_FORMAT format, UINT *format_support)
1105 FIXME("iface %p, format %s, format_support %p stub!\n",
1106 iface, debug_dxgi_format(format), format_support);
1108 return E_NOTIMPL;
1111 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1112 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1114 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1115 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1117 return E_NOTIMPL;
1120 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1122 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1125 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1126 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1127 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1129 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1130 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1131 iface, desc, type, active_counters, name, name_length,
1132 units, units_length, description, description_length);
1134 return E_NOTIMPL;
1137 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1139 FIXME("iface %p stub!\n", iface);
1141 return 0;
1144 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1145 HANDLE resource_handle, REFIID guid, void **resource)
1147 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1148 iface, resource_handle, debugstr_guid(guid), resource);
1150 return E_NOTIMPL;
1153 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1155 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1158 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1160 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1163 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1165 /* IUnknown methods */
1166 d3d10_device_QueryInterface,
1167 d3d10_device_AddRef,
1168 d3d10_device_Release,
1169 /* ID3D10Device methods */
1170 d3d10_device_VSSetConstantBuffers,
1171 d3d10_device_PSSetShaderResources,
1172 d3d10_device_PSSetShader,
1173 d3d10_device_PSSetSamplers,
1174 d3d10_device_VSSetShader,
1175 d3d10_device_DrawIndexed,
1176 d3d10_device_Draw,
1177 d3d10_device_PSSetConstantBuffers,
1178 d3d10_device_IASetInputLayout,
1179 d3d10_device_IASetVertexBuffers,
1180 d3d10_device_IASetIndexBuffer,
1181 d3d10_device_DrawIndexedInstanced,
1182 d3d10_device_DrawInstanced,
1183 d3d10_device_GSSetConstantBuffers,
1184 d3d10_device_GSSetShader,
1185 d3d10_device_IASetPrimitiveTopology,
1186 d3d10_device_VSSetShaderResources,
1187 d3d10_device_VSSetSamplers,
1188 d3d10_device_SetPredication,
1189 d3d10_device_GSSetShaderResources,
1190 d3d10_device_GSSetSamplers,
1191 d3d10_device_OMSetRenderTargets,
1192 d3d10_device_OMSetBlendState,
1193 d3d10_device_OMSetDepthStencilState,
1194 d3d10_device_SOSetTargets,
1195 d3d10_device_DrawAuto,
1196 d3d10_device_RSSetState,
1197 d3d10_device_RSSetViewports,
1198 d3d10_device_RSSetScissorRects,
1199 d3d10_device_CopySubresourceRegion,
1200 d3d10_device_CopyResource,
1201 d3d10_device_UpdateSubresource,
1202 d3d10_device_ClearRenderTargetView,
1203 d3d10_device_ClearDepthStencilView,
1204 d3d10_device_GenerateMips,
1205 d3d10_device_ResolveSubresource,
1206 d3d10_device_VSGetConstantBuffers,
1207 d3d10_device_PSGetShaderResources,
1208 d3d10_device_PSGetShader,
1209 d3d10_device_PSGetSamplers,
1210 d3d10_device_VSGetShader,
1211 d3d10_device_PSGetConstantBuffers,
1212 d3d10_device_IAGetInputLayout,
1213 d3d10_device_IAGetVertexBuffers,
1214 d3d10_device_IAGetIndexBuffer,
1215 d3d10_device_GSGetConstantBuffers,
1216 d3d10_device_GSGetShader,
1217 d3d10_device_IAGetPrimitiveTopology,
1218 d3d10_device_VSGetShaderResources,
1219 d3d10_device_VSGetSamplers,
1220 d3d10_device_GetPredication,
1221 d3d10_device_GSGetShaderResources,
1222 d3d10_device_GSGetSamplers,
1223 d3d10_device_OMGetRenderTargets,
1224 d3d10_device_OMGetBlendState,
1225 d3d10_device_OMGetDepthStencilState,
1226 d3d10_device_SOGetTargets,
1227 d3d10_device_RSGetState,
1228 d3d10_device_RSGetViewports,
1229 d3d10_device_RSGetScissorRects,
1230 d3d10_device_GetDeviceRemovedReason,
1231 d3d10_device_SetExceptionMode,
1232 d3d10_device_GetExceptionMode,
1233 d3d10_device_GetPrivateData,
1234 d3d10_device_SetPrivateData,
1235 d3d10_device_SetPrivateDataInterface,
1236 d3d10_device_ClearState,
1237 d3d10_device_Flush,
1238 d3d10_device_CreateBuffer,
1239 d3d10_device_CreateTexture1D,
1240 d3d10_device_CreateTexture2D,
1241 d3d10_device_CreateTexture3D,
1242 d3d10_device_CreateShaderResourceView,
1243 d3d10_device_CreateRenderTargetView,
1244 d3d10_device_CreateDepthStencilView,
1245 d3d10_device_CreateInputLayout,
1246 d3d10_device_CreateVertexShader,
1247 d3d10_device_CreateGeometryShader,
1248 d3d10_device_CreateGeometryShaderWithStreamOutput,
1249 d3d10_device_CreatePixelShader,
1250 d3d10_device_CreateBlendState,
1251 d3d10_device_CreateDepthStencilState,
1252 d3d10_device_CreateRasterizerState,
1253 d3d10_device_CreateSamplerState,
1254 d3d10_device_CreateQuery,
1255 d3d10_device_CreatePredicate,
1256 d3d10_device_CreateCounter,
1257 d3d10_device_CheckFormatSupport,
1258 d3d10_device_CheckMultisampleQualityLevels,
1259 d3d10_device_CheckCounterInfo,
1260 d3d10_device_CheckCounter,
1261 d3d10_device_GetCreationFlags,
1262 d3d10_device_OpenSharedResource,
1263 d3d10_device_SetTextFilterSize,
1264 d3d10_device_GetTextFilterSize,
1267 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1269 /* IUnknown methods */
1270 d3d10_device_inner_QueryInterface,
1271 d3d10_device_inner_AddRef,
1272 d3d10_device_inner_Release,
1275 /* IWineD3DDeviceParent IUnknown methods */
1277 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1279 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1282 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1284 struct d3d10_device *This = device_from_device_parent(iface);
1285 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1288 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1290 struct d3d10_device *This = device_from_device_parent(iface);
1291 return d3d10_device_AddRef((ID3D10Device *)This);
1294 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1296 struct d3d10_device *This = device_from_device_parent(iface);
1297 return d3d10_device_Release((ID3D10Device *)This);
1300 /* IWineD3DDeviceParent methods */
1302 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1304 struct d3d10_device *This = device_from_device_parent(iface);
1306 TRACE("iface %p, device %p\n", iface, device);
1308 IWineD3DDevice_AddRef(device);
1309 This->wined3d_device = device;
1312 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1313 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1314 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1316 struct d3d10_device *This = device_from_device_parent(iface);
1317 struct d3d10_texture2d *texture;
1318 D3D10_TEXTURE2D_DESC desc;
1319 HRESULT hr;
1321 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1322 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1323 iface, superior, width, height, format, usage, pool, level, face, surface);
1325 FIXME("Implement DXGI<->wined3d usage conversion\n");
1327 desc.Width = width;
1328 desc.Height = height;
1329 desc.MipLevels = 1;
1330 desc.ArraySize = 1;
1331 desc.Format = dxgi_format_from_wined3dformat(format);
1332 desc.SampleDesc.Count = 1;
1333 desc.SampleDesc.Quality = 0;
1334 desc.Usage = usage;
1335 desc.BindFlags = 0;
1336 desc.CPUAccessFlags = 0;
1337 desc.MiscFlags = 0;
1339 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1340 if (FAILED(hr))
1342 ERR("CreateTexture2D failed, returning %#x\n", hr);
1343 return hr;
1346 *surface = texture->wined3d_surface;
1348 return S_OK;
1351 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1352 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1353 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1355 struct d3d10_device *This = device_from_device_parent(iface);
1356 struct d3d10_texture2d *texture;
1357 D3D10_TEXTURE2D_DESC desc;
1358 HRESULT hr;
1360 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1361 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1362 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1364 FIXME("Implement DXGI<->wined3d usage conversion\n");
1366 desc.Width = width;
1367 desc.Height = height;
1368 desc.MipLevels = 1;
1369 desc.ArraySize = 1;
1370 desc.Format = dxgi_format_from_wined3dformat(format);
1371 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1372 desc.SampleDesc.Quality = multisample_quality;
1373 desc.Usage = D3D10_USAGE_DEFAULT;
1374 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1375 desc.CPUAccessFlags = 0;
1376 desc.MiscFlags = 0;
1378 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1379 if (FAILED(hr))
1381 ERR("CreateTexture2D failed, returning %#x\n", hr);
1382 return hr;
1385 *surface = texture->wined3d_surface;
1387 return S_OK;
1390 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1391 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1392 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1394 struct d3d10_device *This = device_from_device_parent(iface);
1395 struct d3d10_texture2d *texture;
1396 D3D10_TEXTURE2D_DESC desc;
1397 HRESULT hr;
1399 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1400 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1401 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1403 FIXME("Implement DXGI<->wined3d usage conversion\n");
1405 desc.Width = width;
1406 desc.Height = height;
1407 desc.MipLevels = 1;
1408 desc.ArraySize = 1;
1409 desc.Format = dxgi_format_from_wined3dformat(format);
1410 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1411 desc.SampleDesc.Quality = multisample_quality;
1412 desc.Usage = D3D10_USAGE_DEFAULT;
1413 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1414 desc.CPUAccessFlags = 0;
1415 desc.MiscFlags = 0;
1417 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1418 if (FAILED(hr))
1420 ERR("CreateTexture2D failed, returning %#x\n", hr);
1421 return hr;
1424 *surface = texture->wined3d_surface;
1426 return S_OK;
1429 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1430 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1431 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1433 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1434 iface, superior, width, height, depth, format, pool, usage, volume);
1436 return E_NOTIMPL;
1439 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1440 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1442 IWineDXGIDevice *wine_device;
1443 HRESULT hr;
1445 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1447 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1448 if (FAILED(hr))
1450 ERR("Device should implement IWineDXGIDevice\n");
1451 return E_FAIL;
1454 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1455 IWineDXGIDevice_Release(wine_device);
1456 if (FAILED(hr))
1458 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1459 return hr;
1462 return S_OK;
1465 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1467 /* IUnknown methods */
1468 device_parent_QueryInterface,
1469 device_parent_AddRef,
1470 device_parent_Release,
1471 /* IWineD3DDeviceParent methods */
1472 device_parent_WineD3DDeviceCreated,
1473 device_parent_CreateSurface,
1474 device_parent_CreateRenderTarget,
1475 device_parent_CreateDepthStencilSurface,
1476 device_parent_CreateVolume,
1477 device_parent_CreateSwapChain,