wined3d: Implement IWineD3DDeviceImpl_ClearRendertargetView().
[wine/multimedia.git] / dlls / d3d10core / device.c
blob8d2b7e3bd7ec32ec0f8d231d399eff896731a37b
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, desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
665 if (FAILED(hr))
667 ERR("CreateSurface failed, returning %#x\n", hr);
668 IDXGISurface_Release(object->dxgi_surface);
669 HeapFree(GetProcessHeap(), 0, object);
670 return hr;
674 *texture = (ID3D10Texture2D *)object;
676 TRACE("Created ID3D10Texture2D %p\n", object);
678 return S_OK;
681 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
682 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
684 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
686 return E_NOTIMPL;
689 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
690 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
692 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
694 return E_NOTIMPL;
697 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
699 D3D10_RESOURCE_DIMENSION dimension;
701 ID3D10Resource_GetType(resource, &dimension);
703 switch(dimension)
705 case D3D10_RESOURCE_DIMENSION_BUFFER:
706 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
708 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
709 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
711 default:
712 FIXME("Unhandled resource dimension %#x\n", dimension);
713 return NULL;
717 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
719 D3D10_RESOURCE_DIMENSION dimension;
720 HRESULT hr;
722 ID3D10Resource_GetType(resource, &dimension);
724 switch(dimension)
726 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
728 ID3D10Texture1D *texture;
729 D3D10_TEXTURE1D_DESC texture_desc;
731 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
732 if (FAILED(hr))
734 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
735 return E_INVALIDARG;
738 ID3D10Texture1D_GetDesc(texture, &texture_desc);
739 ID3D10Texture1D_Release(texture);
741 desc->Format = texture_desc.Format;
742 if (texture_desc.ArraySize == 1)
744 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
745 desc->Texture1D.MipSlice = 0;
747 else
749 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
750 desc->Texture1DArray.MipSlice = 0;
751 desc->Texture1DArray.FirstArraySlice = 0;
752 desc->Texture1DArray.ArraySize = 1;
755 return S_OK;
758 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
760 ID3D10Texture2D *texture;
761 D3D10_TEXTURE2D_DESC texture_desc;
763 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
764 if (FAILED(hr))
766 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
767 return E_INVALIDARG;
770 ID3D10Texture2D_GetDesc(texture, &texture_desc);
771 ID3D10Texture2D_Release(texture);
773 desc->Format = texture_desc.Format;
774 if (texture_desc.ArraySize == 1)
776 if (texture_desc.SampleDesc.Count == 1)
778 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
779 desc->Texture2D.MipSlice = 0;
781 else
783 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
786 else
788 if (texture_desc.SampleDesc.Count == 1)
790 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
791 desc->Texture2DArray.MipSlice = 0;
792 desc->Texture2DArray.FirstArraySlice = 0;
793 desc->Texture2DArray.ArraySize = 1;
795 else
797 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
798 desc->Texture2DMSArray.FirstArraySlice = 0;
799 desc->Texture2DMSArray.ArraySize = 1;
803 return S_OK;
806 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
808 ID3D10Texture3D *texture;
809 D3D10_TEXTURE3D_DESC texture_desc;
811 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
812 if (FAILED(hr))
814 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
815 return E_INVALIDARG;
818 ID3D10Texture3D_GetDesc(texture, &texture_desc);
819 ID3D10Texture3D_Release(texture);
821 desc->Format = texture_desc.Format;
822 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
823 desc->Texture3D.MipSlice = 0;
824 desc->Texture3D.FirstWSlice = 0;
825 desc->Texture3D.WSize = 1;
827 return S_OK;
830 default:
831 FIXME("Unhandled resource dimension %#x\n", dimension);
832 return E_INVALIDARG;
836 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
837 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
839 struct d3d10_device *This = (struct d3d10_device *)iface;
840 struct d3d10_rendertarget_view *object;
841 IWineD3DResource *wined3d_resource;
843 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
845 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
846 if (!object)
848 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
849 return E_OUTOFMEMORY;
852 object->vtbl = &d3d10_rendertarget_view_vtbl;
853 object->refcount = 1;
855 if (!desc)
857 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
858 if (FAILED(hr))
860 HeapFree(GetProcessHeap(), 0, object);
861 return hr;
864 else
866 object->desc = *desc;
869 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
870 if (!wined3d_resource)
872 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
873 HeapFree(GetProcessHeap(), 0, object);
874 return E_FAIL;
876 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
877 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
879 *view = (ID3D10RenderTargetView *)object;
881 return S_OK;
884 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
885 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
887 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
889 return E_NOTIMPL;
892 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
893 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
894 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
896 FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
897 "\tshader_byte_code_length %lu, input_layout %p stub!\n",
898 iface, element_descs, element_count, shader_byte_code,
899 shader_byte_code_length, input_layout);
901 return E_NOTIMPL;
904 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
905 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
907 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
908 iface, byte_code, byte_code_length, shader);
910 return E_NOTIMPL;
913 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
914 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
916 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
917 iface, byte_code, byte_code_length, shader);
919 return E_NOTIMPL;
922 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
923 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
924 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
926 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
927 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
928 iface, byte_code, byte_code_length, output_stream_decls,
929 output_stream_decl_count, output_stream_stride, shader);
931 return E_NOTIMPL;
934 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
935 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
937 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
938 iface, byte_code, byte_code_length, shader);
940 return E_NOTIMPL;
943 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
944 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
946 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
948 return E_NOTIMPL;
951 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
952 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
954 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
956 return E_NOTIMPL;
959 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
960 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
962 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
964 return E_NOTIMPL;
967 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
968 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
970 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
972 return E_NOTIMPL;
975 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
976 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
978 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
980 return E_NOTIMPL;
983 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
984 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
986 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
988 return E_NOTIMPL;
991 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
992 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
994 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
996 return E_NOTIMPL;
999 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1000 DXGI_FORMAT format, UINT *format_support)
1002 FIXME("iface %p, format %s, format_support %p stub!\n",
1003 iface, debug_dxgi_format(format), format_support);
1005 return E_NOTIMPL;
1008 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1009 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1011 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1012 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1014 return E_NOTIMPL;
1017 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1019 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1022 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1023 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1024 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1026 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1027 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1028 iface, desc, type, active_counters, name, name_length,
1029 units, units_length, description, description_length);
1031 return E_NOTIMPL;
1034 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1036 FIXME("iface %p stub!\n", iface);
1038 return 0;
1041 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1042 HANDLE resource_handle, REFIID guid, void **resource)
1044 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1045 iface, resource_handle, debugstr_guid(guid), resource);
1047 return E_NOTIMPL;
1050 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1052 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1055 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1057 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1060 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1062 /* IUnknown methods */
1063 d3d10_device_QueryInterface,
1064 d3d10_device_AddRef,
1065 d3d10_device_Release,
1066 /* ID3D10Device methods */
1067 d3d10_device_VSSetConstantBuffers,
1068 d3d10_device_PSSetShaderResources,
1069 d3d10_device_PSSetShader,
1070 d3d10_device_PSSetSamplers,
1071 d3d10_device_VSSetShader,
1072 d3d10_device_DrawIndexed,
1073 d3d10_device_Draw,
1074 d3d10_device_PSSetConstantBuffers,
1075 d3d10_device_IASetInputLayout,
1076 d3d10_device_IASetVertexBuffers,
1077 d3d10_device_IASetIndexBuffer,
1078 d3d10_device_DrawIndexedInstanced,
1079 d3d10_device_DrawInstanced,
1080 d3d10_device_GSSetConstantBuffers,
1081 d3d10_device_GSSetShader,
1082 d3d10_device_IASetPrimitiveTopology,
1083 d3d10_device_VSSetShaderResources,
1084 d3d10_device_VSSetSamplers,
1085 d3d10_device_SetPredication,
1086 d3d10_device_GSSetShaderResources,
1087 d3d10_device_GSSetSamplers,
1088 d3d10_device_OMSetRenderTargets,
1089 d3d10_device_OMSetBlendState,
1090 d3d10_device_OMSetDepthStencilState,
1091 d3d10_device_SOSetTargets,
1092 d3d10_device_DrawAuto,
1093 d3d10_device_RSSetState,
1094 d3d10_device_RSSetViewports,
1095 d3d10_device_RSSetScissorRects,
1096 d3d10_device_CopySubresourceRegion,
1097 d3d10_device_CopyResource,
1098 d3d10_device_UpdateSubresource,
1099 d3d10_device_ClearRenderTargetView,
1100 d3d10_device_ClearDepthStencilView,
1101 d3d10_device_GenerateMips,
1102 d3d10_device_ResolveSubresource,
1103 d3d10_device_VSGetConstantBuffers,
1104 d3d10_device_PSGetShaderResources,
1105 d3d10_device_PSGetShader,
1106 d3d10_device_PSGetSamplers,
1107 d3d10_device_VSGetShader,
1108 d3d10_device_PSGetConstantBuffers,
1109 d3d10_device_IAGetInputLayout,
1110 d3d10_device_IAGetVertexBuffers,
1111 d3d10_device_IAGetIndexBuffer,
1112 d3d10_device_GSGetConstantBuffers,
1113 d3d10_device_GSGetShader,
1114 d3d10_device_IAGetPrimitiveTopology,
1115 d3d10_device_VSGetShaderResources,
1116 d3d10_device_VSGetSamplers,
1117 d3d10_device_GetPredication,
1118 d3d10_device_GSGetShaderResources,
1119 d3d10_device_GSGetSamplers,
1120 d3d10_device_OMGetRenderTargets,
1121 d3d10_device_OMGetBlendState,
1122 d3d10_device_OMGetDepthStencilState,
1123 d3d10_device_SOGetTargets,
1124 d3d10_device_RSGetState,
1125 d3d10_device_RSGetViewports,
1126 d3d10_device_RSGetScissorRects,
1127 d3d10_device_GetDeviceRemovedReason,
1128 d3d10_device_SetExceptionMode,
1129 d3d10_device_GetExceptionMode,
1130 d3d10_device_GetPrivateData,
1131 d3d10_device_SetPrivateData,
1132 d3d10_device_SetPrivateDataInterface,
1133 d3d10_device_ClearState,
1134 d3d10_device_Flush,
1135 d3d10_device_CreateBuffer,
1136 d3d10_device_CreateTexture1D,
1137 d3d10_device_CreateTexture2D,
1138 d3d10_device_CreateTexture3D,
1139 d3d10_device_CreateShaderResourceView,
1140 d3d10_device_CreateRenderTargetView,
1141 d3d10_device_CreateDepthStencilView,
1142 d3d10_device_CreateInputLayout,
1143 d3d10_device_CreateVertexShader,
1144 d3d10_device_CreateGeometryShader,
1145 d3d10_device_CreateGeometryShaderWithStreamOutput,
1146 d3d10_device_CreatePixelShader,
1147 d3d10_device_CreateBlendState,
1148 d3d10_device_CreateDepthStencilState,
1149 d3d10_device_CreateRasterizerState,
1150 d3d10_device_CreateSamplerState,
1151 d3d10_device_CreateQuery,
1152 d3d10_device_CreatePredicate,
1153 d3d10_device_CreateCounter,
1154 d3d10_device_CheckFormatSupport,
1155 d3d10_device_CheckMultisampleQualityLevels,
1156 d3d10_device_CheckCounterInfo,
1157 d3d10_device_CheckCounter,
1158 d3d10_device_GetCreationFlags,
1159 d3d10_device_OpenSharedResource,
1160 d3d10_device_SetTextFilterSize,
1161 d3d10_device_GetTextFilterSize,
1164 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1166 /* IUnknown methods */
1167 d3d10_device_inner_QueryInterface,
1168 d3d10_device_inner_AddRef,
1169 d3d10_device_inner_Release,
1172 /* IWineD3DDeviceParent IUnknown methods */
1174 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1176 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1179 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1181 struct d3d10_device *This = device_from_device_parent(iface);
1182 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1185 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1187 struct d3d10_device *This = device_from_device_parent(iface);
1188 return d3d10_device_AddRef((ID3D10Device *)This);
1191 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1193 struct d3d10_device *This = device_from_device_parent(iface);
1194 return d3d10_device_Release((ID3D10Device *)This);
1197 /* IWineD3DDeviceParent methods */
1199 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1201 struct d3d10_device *This = device_from_device_parent(iface);
1203 TRACE("iface %p, device %p\n", iface, device);
1205 IWineD3DDevice_AddRef(device);
1206 This->wined3d_device = device;
1209 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1210 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1211 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1213 struct d3d10_device *This = device_from_device_parent(iface);
1214 struct d3d10_texture2d *texture;
1215 D3D10_TEXTURE2D_DESC desc;
1216 HRESULT hr;
1218 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1219 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1220 iface, superior, width, height, format, usage, pool, level, face, surface);
1222 FIXME("Implement DXGI<->wined3d usage conversion\n");
1224 desc.Width = width;
1225 desc.Height = height;
1226 desc.MipLevels = 1;
1227 desc.ArraySize = 1;
1228 desc.Format = dxgi_format_from_wined3dformat(format);
1229 desc.SampleDesc.Count = 1;
1230 desc.SampleDesc.Quality = 0;
1231 desc.Usage = usage;
1232 desc.BindFlags = 0;
1233 desc.CPUAccessFlags = 0;
1234 desc.MiscFlags = 0;
1236 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1237 if (FAILED(hr))
1239 ERR("CreateTexture2D failed, returning %#x\n", hr);
1240 return hr;
1243 *surface = texture->wined3d_surface;
1245 return S_OK;
1248 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1249 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1250 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1252 struct d3d10_device *This = device_from_device_parent(iface);
1253 struct d3d10_texture2d *texture;
1254 D3D10_TEXTURE2D_DESC desc;
1255 HRESULT hr;
1257 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1258 "\tmultisample_quality %u, lockable %u, surface %p stub!\n",
1259 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1261 FIXME("Implement DXGI<->wined3d usage conversion\n");
1263 desc.Width = width;
1264 desc.Height = height;
1265 desc.MipLevels = 1;
1266 desc.ArraySize = 1;
1267 desc.Format = dxgi_format_from_wined3dformat(format);
1268 desc.SampleDesc.Count = multisample_type;
1269 desc.SampleDesc.Quality = multisample_quality;
1270 desc.Usage = D3D10_USAGE_DEFAULT;
1271 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1272 desc.CPUAccessFlags = 0;
1273 desc.MiscFlags = 0;
1275 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1276 if (FAILED(hr))
1278 ERR("CreateTexture2D failed, returning %#x\n", hr);
1279 return hr;
1282 *surface = texture->wined3d_surface;
1284 return S_OK;
1287 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1288 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1289 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1291 struct d3d10_device *This = device_from_device_parent(iface);
1292 struct d3d10_texture2d *texture;
1293 D3D10_TEXTURE2D_DESC desc;
1294 HRESULT hr;
1296 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1297 "\tmultisample_quality %u, discard %u, surface %p stub!\n",
1298 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1300 FIXME("Implement DXGI<->wined3d usage conversion\n");
1302 desc.Width = width;
1303 desc.Height = height;
1304 desc.MipLevels = 1;
1305 desc.ArraySize = 1;
1306 desc.Format = dxgi_format_from_wined3dformat(format);
1307 desc.SampleDesc.Count = multisample_type;
1308 desc.SampleDesc.Quality = multisample_quality;
1309 desc.Usage = D3D10_USAGE_DEFAULT;
1310 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1311 desc.CPUAccessFlags = 0;
1312 desc.MiscFlags = 0;
1314 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1315 if (FAILED(hr))
1317 ERR("CreateTexture2D failed, returning %#x\n", hr);
1318 return hr;
1321 *surface = texture->wined3d_surface;
1323 return S_OK;
1326 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1327 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1328 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1330 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1331 iface, superior, width, height, depth, format, pool, usage, volume);
1333 return E_NOTIMPL;
1336 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1337 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1339 IWineDXGIDevice *wine_device;
1340 HRESULT hr;
1342 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1344 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1345 if (FAILED(hr))
1347 ERR("Device should implement IWineDXGIDevice\n");
1348 return E_FAIL;
1351 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1352 IWineDXGIDevice_Release(wine_device);
1353 if (FAILED(hr))
1355 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1356 return hr;
1359 return S_OK;
1362 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1364 /* IUnknown methods */
1365 device_parent_QueryInterface,
1366 device_parent_AddRef,
1367 device_parent_Release,
1368 /* IWineD3DDeviceParent methods */
1369 device_parent_WineD3DDeviceCreated,
1370 device_parent_CreateSurface,
1371 device_parent_CreateRenderTarget,
1372 device_parent_CreateDepthStencilSurface,
1373 device_parent_CreateVolume,
1374 device_parent_CreateSwapChain,