d3d10core: Add a stub ID3D10InputLayout implementation.
[wine/multimedia.git] / dlls / d3d10core / device.c
blob1d18c3f9c7246b0daadc985ae9ad9d989f9a00e5
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 struct d3d10_device *This = (struct d3d10_device *)iface;
327 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
329 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
330 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
332 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
335 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
336 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
338 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
339 iface, depth_stencil_view, flags, depth, stencil);
342 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
344 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
347 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
348 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
349 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
351 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
352 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
353 iface, dst_resource, dst_subresource_idx,
354 src_resource, src_subresource_idx, debug_dxgi_format(format));
357 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
358 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
360 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
361 iface, start_slot, buffer_count, buffers);
364 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
365 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
367 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
368 iface, start_slot, view_count, views);
371 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
373 FIXME("iface %p, shader %p stub!\n", iface, shader);
376 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
377 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
379 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
380 iface, start_slot, sampler_count, samplers);
383 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
385 FIXME("iface %p, shader %p stub!\n", iface, shader);
388 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
389 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
391 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
392 iface, start_slot, buffer_count, buffers);
395 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
397 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
400 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
401 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
403 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
404 iface, start_slot, buffer_count, buffers, strides, offsets);
407 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
408 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
410 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
413 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
414 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
416 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
417 iface, start_slot, buffer_count, buffers);
420 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
422 FIXME("iface %p, shader %p stub!\n", iface, shader);
425 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
427 FIXME("iface %p, topology %p stub!\n", iface, topology);
430 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
431 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
433 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
434 iface, start_slot, view_count, views);
437 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
438 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
440 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
441 iface, start_slot, sampler_count, samplers);
444 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
445 ID3D10Predicate **predicate, BOOL *value)
447 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
450 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
451 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
453 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
454 iface, start_slot, view_count, views);
457 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
458 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
460 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
461 iface, start_slot, sampler_count, samplers);
464 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
465 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
467 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
468 iface, view_count, render_target_views, depth_stencil_view);
471 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
472 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
474 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
475 iface, blend_state, blend_factor, sample_mask);
478 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
479 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
481 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
482 iface, depth_stencil_state, stencil_ref);
485 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
486 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
488 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
489 iface, buffer_count, buffers, offsets);
492 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
494 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
497 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
498 UINT *viewport_count, D3D10_VIEWPORT *viewports)
500 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
503 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
505 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
508 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
510 FIXME("iface %p stub!\n", iface);
512 return E_NOTIMPL;
515 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
517 FIXME("iface %p, flags %#x stub!\n", iface, flags);
519 return E_NOTIMPL;
522 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
524 FIXME("iface %p stub!\n", iface);
526 return 0;
529 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
530 REFGUID guid, UINT *data_size, void *data)
532 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
533 iface, debugstr_guid(guid), data_size, data);
535 return E_NOTIMPL;
538 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
539 REFGUID guid, UINT data_size, const void *data)
541 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
542 iface, debugstr_guid(guid), data_size, data);
544 return E_NOTIMPL;
547 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
548 REFGUID guid, const IUnknown *data)
550 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
552 return E_NOTIMPL;
555 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
557 FIXME("iface %p stub!\n", iface);
560 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
562 FIXME("iface %p stub!\n", iface);
565 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
566 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
568 struct d3d10_device *This = (struct d3d10_device *)iface;
569 struct wined3d_buffer_desc wined3d_desc;
570 struct d3d10_buffer *object;
571 HRESULT hr;
573 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
575 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
576 if (!object)
578 ERR("Failed to allocate D3D10 buffer object memory\n");
579 return E_OUTOFMEMORY;
582 object->vtbl = &d3d10_buffer_vtbl;
583 object->refcount = 1;
585 FIXME("Implement DXGI<->wined3d usage conversion\n");
587 wined3d_desc.byte_width = desc->ByteWidth;
588 wined3d_desc.usage = desc->Usage;
589 wined3d_desc.bind_flags = desc->BindFlags;
590 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
591 wined3d_desc.misc_flags = desc->MiscFlags;
593 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
594 (IUnknown *)object, &object->wined3d_buffer);
595 if (FAILED(hr))
597 ERR("CreateBuffer failed, returning %#x\n", hr);
598 HeapFree(GetProcessHeap(), 0, object);
599 return hr;
602 *buffer = (ID3D10Buffer *)object;
604 TRACE("Created ID3D10Buffer %p\n", object);
606 return S_OK;
609 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
610 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
612 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
614 return E_NOTIMPL;
617 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
618 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
620 struct d3d10_device *This = (struct d3d10_device *)iface;
621 struct d3d10_texture2d *object;
622 HRESULT hr;
624 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
626 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
627 if (!object)
629 ERR("Failed to allocate D3D10 texture2d object memory\n");
630 return E_OUTOFMEMORY;
633 object->vtbl = &d3d10_texture2d_vtbl;
634 object->refcount = 1;
635 object->desc = *desc;
637 if (desc->MipLevels == 1 && desc->ArraySize == 1)
639 IWineDXGIDevice *wine_device;
641 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
642 if (FAILED(hr))
644 ERR("Device should implement IWineDXGIDevice\n");
645 HeapFree(GetProcessHeap(), 0, object);
646 return E_FAIL;
649 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
650 (IUnknown *)object, (void **)&object->dxgi_surface);
651 IWineDXGIDevice_Release(wine_device);
652 if (FAILED(hr))
654 ERR("Failed to create DXGI surface, returning %#x\n", hr);
655 HeapFree(GetProcessHeap(), 0, object);
656 return hr;
659 FIXME("Implement DXGI<->wined3d usage conversion\n");
661 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
662 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
663 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
664 desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
665 desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
666 if (FAILED(hr))
668 ERR("CreateSurface failed, returning %#x\n", hr);
669 IDXGISurface_Release(object->dxgi_surface);
670 HeapFree(GetProcessHeap(), 0, object);
671 return hr;
675 *texture = (ID3D10Texture2D *)object;
677 TRACE("Created ID3D10Texture2D %p\n", object);
679 return S_OK;
682 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
683 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
685 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
687 return E_NOTIMPL;
690 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
691 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
693 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
695 return E_NOTIMPL;
698 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
700 D3D10_RESOURCE_DIMENSION dimension;
702 ID3D10Resource_GetType(resource, &dimension);
704 switch(dimension)
706 case D3D10_RESOURCE_DIMENSION_BUFFER:
707 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
709 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
710 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
712 default:
713 FIXME("Unhandled resource dimension %#x\n", dimension);
714 return NULL;
718 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
720 D3D10_RESOURCE_DIMENSION dimension;
721 HRESULT hr;
723 ID3D10Resource_GetType(resource, &dimension);
725 switch(dimension)
727 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
729 ID3D10Texture1D *texture;
730 D3D10_TEXTURE1D_DESC texture_desc;
732 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
733 if (FAILED(hr))
735 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
736 return E_INVALIDARG;
739 ID3D10Texture1D_GetDesc(texture, &texture_desc);
740 ID3D10Texture1D_Release(texture);
742 desc->Format = texture_desc.Format;
743 if (texture_desc.ArraySize == 1)
745 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
746 desc->Texture1D.MipSlice = 0;
748 else
750 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
751 desc->Texture1DArray.MipSlice = 0;
752 desc->Texture1DArray.FirstArraySlice = 0;
753 desc->Texture1DArray.ArraySize = 1;
756 return S_OK;
759 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
761 ID3D10Texture2D *texture;
762 D3D10_TEXTURE2D_DESC texture_desc;
764 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
765 if (FAILED(hr))
767 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
768 return E_INVALIDARG;
771 ID3D10Texture2D_GetDesc(texture, &texture_desc);
772 ID3D10Texture2D_Release(texture);
774 desc->Format = texture_desc.Format;
775 if (texture_desc.ArraySize == 1)
777 if (texture_desc.SampleDesc.Count == 1)
779 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
780 desc->Texture2D.MipSlice = 0;
782 else
784 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
787 else
789 if (texture_desc.SampleDesc.Count == 1)
791 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
792 desc->Texture2DArray.MipSlice = 0;
793 desc->Texture2DArray.FirstArraySlice = 0;
794 desc->Texture2DArray.ArraySize = 1;
796 else
798 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
799 desc->Texture2DMSArray.FirstArraySlice = 0;
800 desc->Texture2DMSArray.ArraySize = 1;
804 return S_OK;
807 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
809 ID3D10Texture3D *texture;
810 D3D10_TEXTURE3D_DESC texture_desc;
812 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
813 if (FAILED(hr))
815 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
816 return E_INVALIDARG;
819 ID3D10Texture3D_GetDesc(texture, &texture_desc);
820 ID3D10Texture3D_Release(texture);
822 desc->Format = texture_desc.Format;
823 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
824 desc->Texture3D.MipSlice = 0;
825 desc->Texture3D.FirstWSlice = 0;
826 desc->Texture3D.WSize = 1;
828 return S_OK;
831 default:
832 FIXME("Unhandled resource dimension %#x\n", dimension);
833 return E_INVALIDARG;
837 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
838 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
840 struct d3d10_device *This = (struct d3d10_device *)iface;
841 struct d3d10_rendertarget_view *object;
842 IWineD3DResource *wined3d_resource;
844 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
846 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
847 if (!object)
849 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
850 return E_OUTOFMEMORY;
853 object->vtbl = &d3d10_rendertarget_view_vtbl;
854 object->refcount = 1;
856 if (!desc)
858 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
859 if (FAILED(hr))
861 HeapFree(GetProcessHeap(), 0, object);
862 return hr;
865 else
867 object->desc = *desc;
870 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
871 if (!wined3d_resource)
873 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
874 HeapFree(GetProcessHeap(), 0, object);
875 return E_FAIL;
877 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
878 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
880 *view = (ID3D10RenderTargetView *)object;
882 return S_OK;
885 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
886 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
888 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
890 return E_NOTIMPL;
893 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
894 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
895 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
897 struct d3d10_input_layout *object;
899 FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
900 "\tshader_byte_code_length %lu, input_layout %p stub!\n",
901 iface, element_descs, element_count, shader_byte_code,
902 shader_byte_code_length, input_layout);
904 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
905 if (!object)
907 ERR("Failed to allocate D3D10 input layout object memory\n");
908 return E_OUTOFMEMORY;
911 object->vtbl = &d3d10_input_layout_vtbl;
912 object->refcount = 1;
914 *input_layout = (ID3D10InputLayout *)object;
916 return S_OK;
919 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
920 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
922 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
923 iface, byte_code, byte_code_length, shader);
925 return E_NOTIMPL;
928 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
929 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
931 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
932 iface, byte_code, byte_code_length, shader);
934 return E_NOTIMPL;
937 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
938 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
939 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
941 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
942 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
943 iface, byte_code, byte_code_length, output_stream_decls,
944 output_stream_decl_count, output_stream_stride, shader);
946 return E_NOTIMPL;
949 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
950 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
952 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
953 iface, byte_code, byte_code_length, shader);
955 return E_NOTIMPL;
958 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
959 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
961 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
963 return E_NOTIMPL;
966 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
967 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
969 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
971 return E_NOTIMPL;
974 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
975 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
977 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
979 return E_NOTIMPL;
982 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
983 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
985 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
987 return E_NOTIMPL;
990 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
991 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
993 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
995 return E_NOTIMPL;
998 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
999 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1001 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1003 return E_NOTIMPL;
1006 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1007 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1009 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1011 return E_NOTIMPL;
1014 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1015 DXGI_FORMAT format, UINT *format_support)
1017 FIXME("iface %p, format %s, format_support %p stub!\n",
1018 iface, debug_dxgi_format(format), format_support);
1020 return E_NOTIMPL;
1023 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1024 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1026 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1027 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1029 return E_NOTIMPL;
1032 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1034 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1037 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1038 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1039 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1041 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1042 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1043 iface, desc, type, active_counters, name, name_length,
1044 units, units_length, description, description_length);
1046 return E_NOTIMPL;
1049 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1051 FIXME("iface %p stub!\n", iface);
1053 return 0;
1056 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1057 HANDLE resource_handle, REFIID guid, void **resource)
1059 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1060 iface, resource_handle, debugstr_guid(guid), resource);
1062 return E_NOTIMPL;
1065 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1067 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1070 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1072 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1075 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1077 /* IUnknown methods */
1078 d3d10_device_QueryInterface,
1079 d3d10_device_AddRef,
1080 d3d10_device_Release,
1081 /* ID3D10Device methods */
1082 d3d10_device_VSSetConstantBuffers,
1083 d3d10_device_PSSetShaderResources,
1084 d3d10_device_PSSetShader,
1085 d3d10_device_PSSetSamplers,
1086 d3d10_device_VSSetShader,
1087 d3d10_device_DrawIndexed,
1088 d3d10_device_Draw,
1089 d3d10_device_PSSetConstantBuffers,
1090 d3d10_device_IASetInputLayout,
1091 d3d10_device_IASetVertexBuffers,
1092 d3d10_device_IASetIndexBuffer,
1093 d3d10_device_DrawIndexedInstanced,
1094 d3d10_device_DrawInstanced,
1095 d3d10_device_GSSetConstantBuffers,
1096 d3d10_device_GSSetShader,
1097 d3d10_device_IASetPrimitiveTopology,
1098 d3d10_device_VSSetShaderResources,
1099 d3d10_device_VSSetSamplers,
1100 d3d10_device_SetPredication,
1101 d3d10_device_GSSetShaderResources,
1102 d3d10_device_GSSetSamplers,
1103 d3d10_device_OMSetRenderTargets,
1104 d3d10_device_OMSetBlendState,
1105 d3d10_device_OMSetDepthStencilState,
1106 d3d10_device_SOSetTargets,
1107 d3d10_device_DrawAuto,
1108 d3d10_device_RSSetState,
1109 d3d10_device_RSSetViewports,
1110 d3d10_device_RSSetScissorRects,
1111 d3d10_device_CopySubresourceRegion,
1112 d3d10_device_CopyResource,
1113 d3d10_device_UpdateSubresource,
1114 d3d10_device_ClearRenderTargetView,
1115 d3d10_device_ClearDepthStencilView,
1116 d3d10_device_GenerateMips,
1117 d3d10_device_ResolveSubresource,
1118 d3d10_device_VSGetConstantBuffers,
1119 d3d10_device_PSGetShaderResources,
1120 d3d10_device_PSGetShader,
1121 d3d10_device_PSGetSamplers,
1122 d3d10_device_VSGetShader,
1123 d3d10_device_PSGetConstantBuffers,
1124 d3d10_device_IAGetInputLayout,
1125 d3d10_device_IAGetVertexBuffers,
1126 d3d10_device_IAGetIndexBuffer,
1127 d3d10_device_GSGetConstantBuffers,
1128 d3d10_device_GSGetShader,
1129 d3d10_device_IAGetPrimitiveTopology,
1130 d3d10_device_VSGetShaderResources,
1131 d3d10_device_VSGetSamplers,
1132 d3d10_device_GetPredication,
1133 d3d10_device_GSGetShaderResources,
1134 d3d10_device_GSGetSamplers,
1135 d3d10_device_OMGetRenderTargets,
1136 d3d10_device_OMGetBlendState,
1137 d3d10_device_OMGetDepthStencilState,
1138 d3d10_device_SOGetTargets,
1139 d3d10_device_RSGetState,
1140 d3d10_device_RSGetViewports,
1141 d3d10_device_RSGetScissorRects,
1142 d3d10_device_GetDeviceRemovedReason,
1143 d3d10_device_SetExceptionMode,
1144 d3d10_device_GetExceptionMode,
1145 d3d10_device_GetPrivateData,
1146 d3d10_device_SetPrivateData,
1147 d3d10_device_SetPrivateDataInterface,
1148 d3d10_device_ClearState,
1149 d3d10_device_Flush,
1150 d3d10_device_CreateBuffer,
1151 d3d10_device_CreateTexture1D,
1152 d3d10_device_CreateTexture2D,
1153 d3d10_device_CreateTexture3D,
1154 d3d10_device_CreateShaderResourceView,
1155 d3d10_device_CreateRenderTargetView,
1156 d3d10_device_CreateDepthStencilView,
1157 d3d10_device_CreateInputLayout,
1158 d3d10_device_CreateVertexShader,
1159 d3d10_device_CreateGeometryShader,
1160 d3d10_device_CreateGeometryShaderWithStreamOutput,
1161 d3d10_device_CreatePixelShader,
1162 d3d10_device_CreateBlendState,
1163 d3d10_device_CreateDepthStencilState,
1164 d3d10_device_CreateRasterizerState,
1165 d3d10_device_CreateSamplerState,
1166 d3d10_device_CreateQuery,
1167 d3d10_device_CreatePredicate,
1168 d3d10_device_CreateCounter,
1169 d3d10_device_CheckFormatSupport,
1170 d3d10_device_CheckMultisampleQualityLevels,
1171 d3d10_device_CheckCounterInfo,
1172 d3d10_device_CheckCounter,
1173 d3d10_device_GetCreationFlags,
1174 d3d10_device_OpenSharedResource,
1175 d3d10_device_SetTextFilterSize,
1176 d3d10_device_GetTextFilterSize,
1179 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1181 /* IUnknown methods */
1182 d3d10_device_inner_QueryInterface,
1183 d3d10_device_inner_AddRef,
1184 d3d10_device_inner_Release,
1187 /* IWineD3DDeviceParent IUnknown methods */
1189 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1191 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1194 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1196 struct d3d10_device *This = device_from_device_parent(iface);
1197 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1200 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1202 struct d3d10_device *This = device_from_device_parent(iface);
1203 return d3d10_device_AddRef((ID3D10Device *)This);
1206 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1208 struct d3d10_device *This = device_from_device_parent(iface);
1209 return d3d10_device_Release((ID3D10Device *)This);
1212 /* IWineD3DDeviceParent methods */
1214 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1216 struct d3d10_device *This = device_from_device_parent(iface);
1218 TRACE("iface %p, device %p\n", iface, device);
1220 IWineD3DDevice_AddRef(device);
1221 This->wined3d_device = device;
1224 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1225 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1226 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1228 struct d3d10_device *This = device_from_device_parent(iface);
1229 struct d3d10_texture2d *texture;
1230 D3D10_TEXTURE2D_DESC desc;
1231 HRESULT hr;
1233 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1234 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1235 iface, superior, width, height, format, usage, pool, level, face, surface);
1237 FIXME("Implement DXGI<->wined3d usage conversion\n");
1239 desc.Width = width;
1240 desc.Height = height;
1241 desc.MipLevels = 1;
1242 desc.ArraySize = 1;
1243 desc.Format = dxgi_format_from_wined3dformat(format);
1244 desc.SampleDesc.Count = 1;
1245 desc.SampleDesc.Quality = 0;
1246 desc.Usage = usage;
1247 desc.BindFlags = 0;
1248 desc.CPUAccessFlags = 0;
1249 desc.MiscFlags = 0;
1251 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1252 if (FAILED(hr))
1254 ERR("CreateTexture2D failed, returning %#x\n", hr);
1255 return hr;
1258 *surface = texture->wined3d_surface;
1260 return S_OK;
1263 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1264 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1265 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1267 struct d3d10_device *This = device_from_device_parent(iface);
1268 struct d3d10_texture2d *texture;
1269 D3D10_TEXTURE2D_DESC desc;
1270 HRESULT hr;
1272 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1273 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1274 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1276 FIXME("Implement DXGI<->wined3d usage conversion\n");
1278 desc.Width = width;
1279 desc.Height = height;
1280 desc.MipLevels = 1;
1281 desc.ArraySize = 1;
1282 desc.Format = dxgi_format_from_wined3dformat(format);
1283 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1284 desc.SampleDesc.Quality = multisample_quality;
1285 desc.Usage = D3D10_USAGE_DEFAULT;
1286 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1287 desc.CPUAccessFlags = 0;
1288 desc.MiscFlags = 0;
1290 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1291 if (FAILED(hr))
1293 ERR("CreateTexture2D failed, returning %#x\n", hr);
1294 return hr;
1297 *surface = texture->wined3d_surface;
1299 return S_OK;
1302 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1303 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1304 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1306 struct d3d10_device *This = device_from_device_parent(iface);
1307 struct d3d10_texture2d *texture;
1308 D3D10_TEXTURE2D_DESC desc;
1309 HRESULT hr;
1311 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1312 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1313 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1315 FIXME("Implement DXGI<->wined3d usage conversion\n");
1317 desc.Width = width;
1318 desc.Height = height;
1319 desc.MipLevels = 1;
1320 desc.ArraySize = 1;
1321 desc.Format = dxgi_format_from_wined3dformat(format);
1322 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1323 desc.SampleDesc.Quality = multisample_quality;
1324 desc.Usage = D3D10_USAGE_DEFAULT;
1325 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1326 desc.CPUAccessFlags = 0;
1327 desc.MiscFlags = 0;
1329 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1330 if (FAILED(hr))
1332 ERR("CreateTexture2D failed, returning %#x\n", hr);
1333 return hr;
1336 *surface = texture->wined3d_surface;
1338 return S_OK;
1341 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1342 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1343 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1345 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1346 iface, superior, width, height, depth, format, pool, usage, volume);
1348 return E_NOTIMPL;
1351 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1352 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1354 IWineDXGIDevice *wine_device;
1355 HRESULT hr;
1357 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1359 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1360 if (FAILED(hr))
1362 ERR("Device should implement IWineDXGIDevice\n");
1363 return E_FAIL;
1366 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1367 IWineDXGIDevice_Release(wine_device);
1368 if (FAILED(hr))
1370 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1371 return hr;
1374 return S_OK;
1377 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1379 /* IUnknown methods */
1380 device_parent_QueryInterface,
1381 device_parent_AddRef,
1382 device_parent_Release,
1383 /* IWineD3DDeviceParent methods */
1384 device_parent_WineD3DDeviceCreated,
1385 device_parent_CreateSurface,
1386 device_parent_CreateRenderTarget,
1387 device_parent_CreateDepthStencilSurface,
1388 device_parent_CreateVolume,
1389 device_parent_CreateSwapChain,