push 43f03fe87c2254c6df67b2de3c08b5b20fd64327
[wine/hacks.git] / dlls / d3d10core / device.c
blob7eaa659e427ae3fdfa9a268517aaffbe71517a6c
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 return refcount;
81 /* IUnknown methods */
83 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
85 struct d3d10_device *This = (struct d3d10_device *)iface;
86 TRACE("Forwarding to outer IUnknown\n");
87 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
90 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
92 struct d3d10_device *This = (struct d3d10_device *)iface;
93 TRACE("Forwarding to outer IUnknown\n");
94 return IUnknown_AddRef(This->outer_unknown);
97 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
99 struct d3d10_device *This = (struct d3d10_device *)iface;
100 TRACE("Forwarding to outer IUnknown\n");
101 return IUnknown_Release(This->outer_unknown);
104 /* ID3D10Device methods */
106 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
107 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
109 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
110 iface, start_slot, buffer_count, buffers);
113 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
114 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
116 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
117 iface, start_slot, view_count, views);
120 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
122 FIXME("iface %p, shader %p stub!\n", iface, shader);
125 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
126 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
128 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
129 iface, start_slot, sampler_count, samplers);
132 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
134 FIXME("iface %p, shader %p stub!\n", iface, shader);
137 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
138 UINT index_count, UINT start_index_location, INT base_vertex_location)
140 FIXME("iface %p, index_count %u, start_index_location %u, base_vertex_location %d stub!\n",
141 iface, index_count, start_index_location, base_vertex_location);
144 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
145 UINT vertex_count, UINT start_vertex_location)
147 FIXME("iface %p, vertex_count %u, start_vertex_location %u stub!\n",
148 iface, vertex_count, start_vertex_location);
151 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
152 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
154 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
155 iface, start_slot, buffer_count, buffers);
158 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
160 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
163 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
164 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
165 const UINT *strides, const UINT *offsets)
167 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
168 iface, start_slot, buffer_count, buffers, strides, offsets);
171 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
172 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
174 FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
175 iface, buffer, debug_dxgi_format(format), offset);
178 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
179 UINT instance_index_count, UINT instance_count, UINT start_index_location,
180 INT base_vertex_location, UINT start_instance_location)
182 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
183 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
184 iface, instance_index_count, instance_count, start_index_location,
185 base_vertex_location, start_instance_location);
188 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
189 UINT instance_vertex_count, UINT instance_count,
190 UINT start_vertex_location, UINT start_instance_location)
192 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
193 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
194 start_vertex_location, start_instance_location);
197 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
198 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
200 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
201 iface, start_slot, buffer_count, buffers);
204 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
206 FIXME("iface %p, shader %p stub!\n", iface, shader);
209 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
211 FIXME("iface %p, topology %s stub!\n", iface, debug_d3d10_primitive_topology(topology));
214 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
215 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
217 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
218 iface, start_slot, view_count, views);
221 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
222 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
224 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
225 iface, start_slot, sampler_count, samplers);
228 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
230 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
233 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
234 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
236 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
237 iface, start_slot, view_count, views);
240 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
241 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
243 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
244 iface, start_slot, sampler_count, samplers);
247 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
248 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
249 ID3D10DepthStencilView *depth_stencil_view)
251 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
252 iface, render_target_view_count, render_target_views, depth_stencil_view);
255 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
256 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
258 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
259 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
262 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
263 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
265 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
266 iface, depth_stencil_state, stencil_ref);
269 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
270 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
272 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
275 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
277 FIXME("iface %p stub!\n", iface);
280 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
282 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
285 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
286 UINT viewport_count, const D3D10_VIEWPORT *viewports)
288 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
291 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
292 UINT rect_count, const D3D10_RECT *rects)
294 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
297 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
298 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
299 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
301 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
302 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
303 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
304 src_resource, src_subresource_idx, src_box);
307 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
308 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
310 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
313 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
314 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
315 const void *data, UINT row_pitch, UINT depth_pitch)
317 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
318 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
321 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
322 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
324 FIXME("iface %p, render_target_view %p, color_rgba [%f %f %f %f] stub!\n",
325 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
328 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
329 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
331 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
332 iface, depth_stencil_view, flags, depth, stencil);
335 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
337 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
340 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
341 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
342 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
344 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
345 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
346 iface, dst_resource, dst_subresource_idx,
347 src_resource, src_subresource_idx, debug_dxgi_format(format));
350 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
351 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
353 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
354 iface, start_slot, buffer_count, buffers);
357 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
358 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
360 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
361 iface, start_slot, view_count, views);
364 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
366 FIXME("iface %p, shader %p stub!\n", iface, shader);
369 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
370 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
372 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
373 iface, start_slot, sampler_count, samplers);
376 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
378 FIXME("iface %p, shader %p stub!\n", iface, shader);
381 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
382 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
384 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
385 iface, start_slot, buffer_count, buffers);
388 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
390 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
393 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
394 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
396 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
397 iface, start_slot, buffer_count, buffers, strides, offsets);
400 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
401 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
403 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
406 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
407 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
409 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
410 iface, start_slot, buffer_count, buffers);
413 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
415 FIXME("iface %p, shader %p stub!\n", iface, shader);
418 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
420 FIXME("iface %p, topology %p stub!\n", iface, topology);
423 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
424 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
426 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
427 iface, start_slot, view_count, views);
430 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
431 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
433 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
434 iface, start_slot, sampler_count, samplers);
437 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
438 ID3D10Predicate **predicate, BOOL *value)
440 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
443 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
444 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
446 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
447 iface, start_slot, view_count, views);
450 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
451 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
453 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
454 iface, start_slot, sampler_count, samplers);
457 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
458 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
460 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
461 iface, view_count, render_target_views, depth_stencil_view);
464 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
465 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
467 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
468 iface, blend_state, blend_factor, sample_mask);
471 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
472 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
474 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
475 iface, depth_stencil_state, stencil_ref);
478 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
479 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
481 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
482 iface, buffer_count, buffers, offsets);
485 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
487 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
490 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
491 UINT *viewport_count, D3D10_VIEWPORT *viewports)
493 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
496 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
498 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
501 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
503 FIXME("iface %p stub!\n", iface);
505 return E_NOTIMPL;
508 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
510 FIXME("iface %p, flags %#x stub!\n", iface, flags);
512 return E_NOTIMPL;
515 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
517 FIXME("iface %p stub!\n", iface);
519 return 0;
522 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
523 REFGUID guid, UINT *data_size, void *data)
525 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
526 iface, debugstr_guid(guid), data_size, data);
528 return E_NOTIMPL;
531 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
532 REFGUID guid, UINT data_size, const void *data)
534 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
535 iface, debugstr_guid(guid), data_size, data);
537 return E_NOTIMPL;
540 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
541 REFGUID guid, const IUnknown *data)
543 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
545 return E_NOTIMPL;
548 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
550 FIXME("iface %p stub!\n", iface);
553 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
555 FIXME("iface %p stub!\n", iface);
558 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
559 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
561 struct d3d10_buffer *object;
563 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
565 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
566 if (!object)
568 ERR("Failed to allocate D3D10 buffer object memory\n");
569 return E_OUTOFMEMORY;
572 object->vtbl = &d3d10_buffer_vtbl;
573 object->refcount = 1;
575 *buffer = (ID3D10Buffer *)object;
577 TRACE("Created ID3D10Buffer %p\n", object);
579 return S_OK;
582 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
583 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
585 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
587 return E_NOTIMPL;
590 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
591 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
593 struct d3d10_texture2d *object;
594 HRESULT hr;
596 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
598 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
599 if (!object)
601 ERR("Failed to allocate D3D10 texture2d object memory\n");
602 return E_OUTOFMEMORY;
605 object->vtbl = &d3d10_texture2d_vtbl;
606 object->refcount = 1;
607 object->desc = *desc;
609 if (desc->MipLevels == 1 && desc->ArraySize == 1)
611 IWineD3DDevice *wined3d_device;
612 IWineDXGIDevice *wine_device;
614 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
615 if (FAILED(hr))
617 ERR("Device should implement IWineDXGIDevice\n");
618 HeapFree(GetProcessHeap(), 0, object);
619 return E_FAIL;
622 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
623 (IUnknown *)object, (void **)&object->dxgi_surface);
624 if (FAILED(hr))
626 ERR("Failed to create DXGI surface, returning %#x\n", hr);
627 HeapFree(GetProcessHeap(), 0, object);
628 IWineDXGIDevice_Release(wine_device);
629 return hr;
632 wined3d_device = IWineDXGIDevice_get_wined3d_device(wine_device);
633 IWineDXGIDevice_Release(wine_device);
635 FIXME("Implement DXGI<->wined3d usage conversion\n");
637 hr = IWineD3DDevice_CreateSurface(wined3d_device, desc->Width, desc->Height,
638 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
639 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
640 desc->SampleDesc.Count, desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
641 IWineD3DDevice_Release(wined3d_device);
642 if (FAILED(hr))
644 ERR("CreateSurface failed, returning %#x\n", hr);
645 IDXGISurface_Release(object->dxgi_surface);
646 HeapFree(GetProcessHeap(), 0, object);
647 return hr;
651 *texture = (ID3D10Texture2D *)object;
653 TRACE("Created ID3D10Texture2D %p\n", object);
655 return S_OK;
658 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
659 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
661 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
663 return E_NOTIMPL;
666 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
667 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
669 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
671 return E_NOTIMPL;
674 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
676 D3D10_RESOURCE_DIMENSION dimension;
677 HRESULT hr;
679 ID3D10Resource_GetType(resource, &dimension);
681 switch(dimension)
683 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
685 ID3D10Texture1D *texture;
686 D3D10_TEXTURE1D_DESC texture_desc;
688 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
689 if (FAILED(hr))
691 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
692 return E_INVALIDARG;
695 ID3D10Texture1D_GetDesc(texture, &texture_desc);
696 ID3D10Texture1D_Release(texture);
698 desc->Format = texture_desc.Format;
699 if (texture_desc.ArraySize == 1)
701 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
702 desc->Texture1D.MipSlice = 0;
704 else
706 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
707 desc->Texture1DArray.MipSlice = 0;
708 desc->Texture1DArray.FirstArraySlice = 0;
709 desc->Texture1DArray.ArraySize = 1;
712 return S_OK;
715 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
717 ID3D10Texture2D *texture;
718 D3D10_TEXTURE2D_DESC texture_desc;
720 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
721 if (FAILED(hr))
723 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
724 return E_INVALIDARG;
727 ID3D10Texture2D_GetDesc(texture, &texture_desc);
728 ID3D10Texture2D_Release(texture);
730 desc->Format = texture_desc.Format;
731 if (texture_desc.ArraySize == 1)
733 if (texture_desc.SampleDesc.Count == 1)
735 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
736 desc->Texture2D.MipSlice = 0;
738 else
740 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
743 else
745 if (texture_desc.SampleDesc.Count == 1)
747 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
748 desc->Texture2DArray.MipSlice = 0;
749 desc->Texture2DArray.FirstArraySlice = 0;
750 desc->Texture2DArray.ArraySize = 1;
752 else
754 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
755 desc->Texture2DMSArray.FirstArraySlice = 0;
756 desc->Texture2DMSArray.ArraySize = 1;
760 return S_OK;
763 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
765 ID3D10Texture3D *texture;
766 D3D10_TEXTURE3D_DESC texture_desc;
768 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
769 if (FAILED(hr))
771 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
772 return E_INVALIDARG;
775 ID3D10Texture3D_GetDesc(texture, &texture_desc);
776 ID3D10Texture3D_Release(texture);
778 desc->Format = texture_desc.Format;
779 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
780 desc->Texture3D.MipSlice = 0;
781 desc->Texture3D.FirstWSlice = 0;
782 desc->Texture3D.WSize = 1;
784 return S_OK;
787 default:
788 FIXME("Unhandled resource dimension %#x\n", dimension);
789 return E_INVALIDARG;
793 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
794 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
796 struct d3d10_rendertarget_view *object;
798 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
800 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
801 if (!object)
803 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
804 return E_OUTOFMEMORY;
807 object->vtbl = &d3d10_rendertarget_view_vtbl;
808 object->refcount = 1;
810 if (!desc)
812 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
813 if (FAILED(hr))
815 HeapFree(GetProcessHeap(), 0, object);
816 return hr;
819 else
821 object->desc = *desc;
824 object->resource = resource;
825 ID3D10Resource_AddRef(resource);
827 *view = (ID3D10RenderTargetView *)object;
829 return S_OK;
832 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
833 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
835 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
837 return E_NOTIMPL;
840 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
841 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
842 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
844 FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
845 "\tshader_byte_code_length %lu, input_layout %p stub!\n",
846 iface, element_descs, element_count, shader_byte_code,
847 shader_byte_code_length, input_layout);
849 return E_NOTIMPL;
852 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
853 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
855 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
856 iface, byte_code, byte_code_length, shader);
858 return E_NOTIMPL;
861 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
862 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
864 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
865 iface, byte_code, byte_code_length, shader);
867 return E_NOTIMPL;
870 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
871 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
872 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
874 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
875 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
876 iface, byte_code, byte_code_length, output_stream_decls,
877 output_stream_decl_count, output_stream_stride, shader);
879 return E_NOTIMPL;
882 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
883 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
885 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
886 iface, byte_code, byte_code_length, shader);
888 return E_NOTIMPL;
891 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
892 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
894 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
896 return E_NOTIMPL;
899 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
900 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
902 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
904 return E_NOTIMPL;
907 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
908 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
910 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
912 return E_NOTIMPL;
915 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
916 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
918 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
920 return E_NOTIMPL;
923 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
924 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
926 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
928 return E_NOTIMPL;
931 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
932 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
934 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
936 return E_NOTIMPL;
939 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
940 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
942 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
944 return E_NOTIMPL;
947 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
948 DXGI_FORMAT format, UINT *format_support)
950 FIXME("iface %p, format %s, format_support %p stub!\n",
951 iface, debug_dxgi_format(format), format_support);
953 return E_NOTIMPL;
956 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
957 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
959 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
960 iface, debug_dxgi_format(format), sample_count, quality_level_count);
962 return E_NOTIMPL;
965 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
967 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
970 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
971 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
972 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
974 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
975 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
976 iface, desc, type, active_counters, name, name_length,
977 units, units_length, description, description_length);
979 return E_NOTIMPL;
982 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
984 FIXME("iface %p stub!\n", iface);
986 return 0;
989 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
990 HANDLE resource_handle, REFIID guid, void **resource)
992 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
993 iface, resource_handle, debugstr_guid(guid), resource);
995 return E_NOTIMPL;
998 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1000 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1003 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1005 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1008 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1010 /* IUnknown methods */
1011 d3d10_device_QueryInterface,
1012 d3d10_device_AddRef,
1013 d3d10_device_Release,
1014 /* ID3D10Device methods */
1015 d3d10_device_VSSetConstantBuffers,
1016 d3d10_device_PSSetShaderResources,
1017 d3d10_device_PSSetShader,
1018 d3d10_device_PSSetSamplers,
1019 d3d10_device_VSSetShader,
1020 d3d10_device_DrawIndexed,
1021 d3d10_device_Draw,
1022 d3d10_device_PSSetConstantBuffers,
1023 d3d10_device_IASetInputLayout,
1024 d3d10_device_IASetVertexBuffers,
1025 d3d10_device_IASetIndexBuffer,
1026 d3d10_device_DrawIndexedInstanced,
1027 d3d10_device_DrawInstanced,
1028 d3d10_device_GSSetConstantBuffers,
1029 d3d10_device_GSSetShader,
1030 d3d10_device_IASetPrimitiveTopology,
1031 d3d10_device_VSSetShaderResources,
1032 d3d10_device_VSSetSamplers,
1033 d3d10_device_SetPredication,
1034 d3d10_device_GSSetShaderResources,
1035 d3d10_device_GSSetSamplers,
1036 d3d10_device_OMSetRenderTargets,
1037 d3d10_device_OMSetBlendState,
1038 d3d10_device_OMSetDepthStencilState,
1039 d3d10_device_SOSetTargets,
1040 d3d10_device_DrawAuto,
1041 d3d10_device_RSSetState,
1042 d3d10_device_RSSetViewports,
1043 d3d10_device_RSSetScissorRects,
1044 d3d10_device_CopySubresourceRegion,
1045 d3d10_device_CopyResource,
1046 d3d10_device_UpdateSubresource,
1047 d3d10_device_ClearRenderTargetView,
1048 d3d10_device_ClearDepthStencilView,
1049 d3d10_device_GenerateMips,
1050 d3d10_device_ResolveSubresource,
1051 d3d10_device_VSGetConstantBuffers,
1052 d3d10_device_PSGetShaderResources,
1053 d3d10_device_PSGetShader,
1054 d3d10_device_PSGetSamplers,
1055 d3d10_device_VSGetShader,
1056 d3d10_device_PSGetConstantBuffers,
1057 d3d10_device_IAGetInputLayout,
1058 d3d10_device_IAGetVertexBuffers,
1059 d3d10_device_IAGetIndexBuffer,
1060 d3d10_device_GSGetConstantBuffers,
1061 d3d10_device_GSGetShader,
1062 d3d10_device_IAGetPrimitiveTopology,
1063 d3d10_device_VSGetShaderResources,
1064 d3d10_device_VSGetSamplers,
1065 d3d10_device_GetPredication,
1066 d3d10_device_GSGetShaderResources,
1067 d3d10_device_GSGetSamplers,
1068 d3d10_device_OMGetRenderTargets,
1069 d3d10_device_OMGetBlendState,
1070 d3d10_device_OMGetDepthStencilState,
1071 d3d10_device_SOGetTargets,
1072 d3d10_device_RSGetState,
1073 d3d10_device_RSGetViewports,
1074 d3d10_device_RSGetScissorRects,
1075 d3d10_device_GetDeviceRemovedReason,
1076 d3d10_device_SetExceptionMode,
1077 d3d10_device_GetExceptionMode,
1078 d3d10_device_GetPrivateData,
1079 d3d10_device_SetPrivateData,
1080 d3d10_device_SetPrivateDataInterface,
1081 d3d10_device_ClearState,
1082 d3d10_device_Flush,
1083 d3d10_device_CreateBuffer,
1084 d3d10_device_CreateTexture1D,
1085 d3d10_device_CreateTexture2D,
1086 d3d10_device_CreateTexture3D,
1087 d3d10_device_CreateShaderResourceView,
1088 d3d10_device_CreateRenderTargetView,
1089 d3d10_device_CreateDepthStencilView,
1090 d3d10_device_CreateInputLayout,
1091 d3d10_device_CreateVertexShader,
1092 d3d10_device_CreateGeometryShader,
1093 d3d10_device_CreateGeometryShaderWithStreamOutput,
1094 d3d10_device_CreatePixelShader,
1095 d3d10_device_CreateBlendState,
1096 d3d10_device_CreateDepthStencilState,
1097 d3d10_device_CreateRasterizerState,
1098 d3d10_device_CreateSamplerState,
1099 d3d10_device_CreateQuery,
1100 d3d10_device_CreatePredicate,
1101 d3d10_device_CreateCounter,
1102 d3d10_device_CheckFormatSupport,
1103 d3d10_device_CheckMultisampleQualityLevels,
1104 d3d10_device_CheckCounterInfo,
1105 d3d10_device_CheckCounter,
1106 d3d10_device_GetCreationFlags,
1107 d3d10_device_OpenSharedResource,
1108 d3d10_device_SetTextFilterSize,
1109 d3d10_device_GetTextFilterSize,
1112 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1114 /* IUnknown methods */
1115 d3d10_device_inner_QueryInterface,
1116 d3d10_device_inner_AddRef,
1117 d3d10_device_inner_Release,
1120 /* IWineD3DDeviceParent IUnknown methods */
1122 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1124 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1127 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1129 struct d3d10_device *This = device_from_device_parent(iface);
1130 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1133 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1135 struct d3d10_device *This = device_from_device_parent(iface);
1136 return d3d10_device_AddRef((ID3D10Device *)This);
1139 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1141 struct d3d10_device *This = device_from_device_parent(iface);
1142 return d3d10_device_Release((ID3D10Device *)This);
1145 /* IWineD3DDeviceParent methods */
1147 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1148 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1149 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1151 struct d3d10_device *This = device_from_device_parent(iface);
1152 struct d3d10_texture2d *texture;
1153 D3D10_TEXTURE2D_DESC desc;
1154 HRESULT hr;
1156 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1157 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1158 iface, superior, width, height, format, usage, pool, level, face, surface);
1160 FIXME("Implement DXGI<->wined3d usage conversion\n");
1162 desc.Width = width;
1163 desc.Height = height;
1164 desc.MipLevels = 1;
1165 desc.ArraySize = 1;
1166 desc.Format = dxgi_format_from_wined3dformat(format);
1167 desc.SampleDesc.Count = 1;
1168 desc.SampleDesc.Quality = 0;
1169 desc.Usage = usage;
1170 desc.BindFlags = 0;
1171 desc.CPUAccessFlags = 0;
1172 desc.MiscFlags = 0;
1174 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1175 if (FAILED(hr))
1177 ERR("CreateTexture2D failed, returning %#x\n", hr);
1178 return hr;
1181 *surface = texture->wined3d_surface;
1183 return S_OK;
1186 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1187 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1188 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1190 struct d3d10_device *This = device_from_device_parent(iface);
1191 struct d3d10_texture2d *texture;
1192 D3D10_TEXTURE2D_DESC desc;
1193 HRESULT hr;
1195 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1196 "\tmultisample_quality %u, lockable %u, surface %p stub!\n",
1197 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1199 FIXME("Implement DXGI<->wined3d usage conversion\n");
1201 desc.Width = width;
1202 desc.Height = height;
1203 desc.MipLevels = 1;
1204 desc.ArraySize = 1;
1205 desc.Format = dxgi_format_from_wined3dformat(format);
1206 desc.SampleDesc.Count = multisample_type;
1207 desc.SampleDesc.Quality = multisample_quality;
1208 desc.Usage = D3D10_USAGE_DEFAULT;
1209 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1210 desc.CPUAccessFlags = 0;
1211 desc.MiscFlags = 0;
1213 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1214 if (FAILED(hr))
1216 ERR("CreateTexture2D failed, returning %#x\n", hr);
1217 return hr;
1220 *surface = texture->wined3d_surface;
1222 return S_OK;
1225 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1226 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1227 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1229 struct d3d10_device *This = device_from_device_parent(iface);
1230 struct d3d10_texture2d *texture;
1231 D3D10_TEXTURE2D_DESC desc;
1232 HRESULT hr;
1234 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1235 "\tmultisample_quality %u, discard %u, surface %p stub!\n",
1236 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1238 FIXME("Implement DXGI<->wined3d usage conversion\n");
1240 desc.Width = width;
1241 desc.Height = height;
1242 desc.MipLevels = 1;
1243 desc.ArraySize = 1;
1244 desc.Format = dxgi_format_from_wined3dformat(format);
1245 desc.SampleDesc.Count = multisample_type;
1246 desc.SampleDesc.Quality = multisample_quality;
1247 desc.Usage = D3D10_USAGE_DEFAULT;
1248 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1249 desc.CPUAccessFlags = 0;
1250 desc.MiscFlags = 0;
1252 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1253 if (FAILED(hr))
1255 ERR("CreateTexture2D failed, returning %#x\n", hr);
1256 return hr;
1259 *surface = texture->wined3d_surface;
1261 return S_OK;
1264 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1265 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1266 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1268 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1269 iface, superior, width, height, depth, format, pool, usage, volume);
1271 return E_NOTIMPL;
1274 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1275 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1277 FIXME("iface %p, present_parameters %p, swapchain %p stub!\n", iface, present_parameters, swapchain);
1279 return E_NOTIMPL;
1283 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1285 /* IUnknown methods */
1286 device_parent_QueryInterface,
1287 device_parent_AddRef,
1288 device_parent_Release,
1289 /* IWineD3DDeviceParent methods */
1290 device_parent_CreateSurface,
1291 device_parent_CreateRenderTarget,
1292 device_parent_CreateDepthStencilSurface,
1293 device_parent_CreateVolume,
1294 device_parent_CreateSwapChain,