oleaut32: Use WIC to decode PNG images.
[wine/multimedia.git] / dlls / d3d10core / device.c
blobd51e30235adb3f99a5c3b1a8d520cf1324570721
1 /*
2 * Copyright 2008-2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
21 #include "wine/port.h"
23 #define NONAMELESSUNION
24 #include "d3d10core_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
28 /* Inner IUnknown methods */
30 static inline struct d3d10_device *d3d10_device_from_inner_unknown(IUnknown *iface)
32 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, inner_unknown_vtbl));
35 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid, void **object)
37 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
39 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
41 if (IsEqualGUID(riid, &IID_IUnknown)
42 || IsEqualGUID(riid, &IID_ID3D10Device))
44 IUnknown_AddRef((IUnknown *)This);
45 *object = This;
46 return S_OK;
49 if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
51 IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
52 *object = &This->device_parent_vtbl;
53 return S_OK;
56 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
58 *object = NULL;
59 return E_NOINTERFACE;
62 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
64 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
65 ULONG refcount = InterlockedIncrement(&This->refcount);
67 TRACE("%p increasing refcount to %u\n", This, refcount);
69 return refcount;
72 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
74 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
75 ULONG refcount = InterlockedDecrement(&This->refcount);
77 TRACE("%p decreasing refcount to %u\n", This, refcount);
79 if (!refcount)
81 if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
84 return refcount;
87 /* IUnknown methods */
89 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
91 struct d3d10_device *This = (struct d3d10_device *)iface;
92 TRACE("Forwarding to outer IUnknown\n");
93 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
96 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
98 struct d3d10_device *This = (struct d3d10_device *)iface;
99 TRACE("Forwarding to outer IUnknown\n");
100 return IUnknown_AddRef(This->outer_unknown);
103 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
105 struct d3d10_device *This = (struct d3d10_device *)iface;
106 TRACE("Forwarding to outer IUnknown\n");
107 return IUnknown_Release(This->outer_unknown);
110 /* ID3D10Device methods */
112 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
113 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
115 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
116 iface, start_slot, buffer_count, buffers);
119 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
120 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
122 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
123 iface, start_slot, view_count, views);
126 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
128 struct d3d10_device *This = (struct d3d10_device *)iface;
129 struct d3d10_pixel_shader *ps = (struct d3d10_pixel_shader *)shader;
131 TRACE("iface %p, shader %p\n", iface, shader);
133 IWineD3DDevice_SetPixelShader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
136 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
137 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
139 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
140 iface, start_slot, sampler_count, samplers);
143 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
145 struct d3d10_device *This = (struct d3d10_device *)iface;
146 struct d3d10_vertex_shader *vs = (struct d3d10_vertex_shader *)shader;
148 TRACE("iface %p, shader %p\n", iface, shader);
150 IWineD3DDevice_SetVertexShader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
153 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
154 UINT index_count, UINT start_index_location, INT base_vertex_location)
156 FIXME("iface %p, index_count %u, start_index_location %u, base_vertex_location %d stub!\n",
157 iface, index_count, start_index_location, base_vertex_location);
160 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
161 UINT vertex_count, UINT start_vertex_location)
163 struct d3d10_device *This = (struct d3d10_device *)iface;
165 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
166 iface, vertex_count, start_vertex_location);
168 IWineD3DDevice_DrawPrimitive(This->wined3d_device, start_vertex_location, vertex_count);
171 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
172 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
174 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
175 iface, start_slot, buffer_count, buffers);
178 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
180 struct d3d10_device *This = (struct d3d10_device *)iface;
182 TRACE("iface %p, input_layout %p\n", iface, input_layout);
184 IWineD3DDevice_SetVertexDeclaration(This->wined3d_device,
185 ((struct d3d10_input_layout *)input_layout)->wined3d_decl);
188 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
189 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
190 const UINT *strides, const UINT *offsets)
192 struct d3d10_device *This = (struct d3d10_device *)iface;
193 unsigned int i;
195 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
196 iface, start_slot, buffer_count, buffers, strides, offsets);
198 for (i = 0; i < buffer_count; ++i)
200 IWineD3DDevice_SetStreamSource(This->wined3d_device, start_slot,
201 ((struct d3d10_buffer *)buffers[i])->wined3d_buffer, offsets[i], strides[i]);
205 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
206 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
208 FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
209 iface, buffer, debug_dxgi_format(format), offset);
212 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
213 UINT instance_index_count, UINT instance_count, UINT start_index_location,
214 INT base_vertex_location, UINT start_instance_location)
216 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
217 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
218 iface, instance_index_count, instance_count, start_index_location,
219 base_vertex_location, start_instance_location);
222 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
223 UINT instance_vertex_count, UINT instance_count,
224 UINT start_vertex_location, UINT start_instance_location)
226 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
227 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
228 start_vertex_location, start_instance_location);
231 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
232 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
234 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
235 iface, start_slot, buffer_count, buffers);
238 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
240 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
241 else WARN("iface %p, shader %p stub!\n", iface, shader);
244 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
246 struct d3d10_device *This = (struct d3d10_device *)iface;
248 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
250 IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
253 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
254 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
256 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
257 iface, start_slot, view_count, views);
260 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
261 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
263 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
264 iface, start_slot, sampler_count, samplers);
267 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
269 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
272 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
273 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
275 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
276 iface, start_slot, view_count, views);
279 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
280 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
282 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
283 iface, start_slot, sampler_count, samplers);
286 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
287 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
288 ID3D10DepthStencilView *depth_stencil_view)
290 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
291 iface, render_target_view_count, render_target_views, depth_stencil_view);
294 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
295 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
297 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
298 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
301 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
302 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
304 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
305 iface, depth_stencil_state, stencil_ref);
308 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
309 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
311 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
314 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
316 FIXME("iface %p stub!\n", iface);
319 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
321 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
324 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
325 UINT viewport_count, const D3D10_VIEWPORT *viewports)
327 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
330 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
331 UINT rect_count, const D3D10_RECT *rects)
333 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
336 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
337 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
338 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
340 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
341 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
342 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
343 src_resource, src_subresource_idx, src_box);
346 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
347 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
349 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
352 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
353 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
354 const void *data, UINT row_pitch, UINT depth_pitch)
356 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
357 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
360 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
361 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
363 struct d3d10_device *This = (struct d3d10_device *)iface;
364 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
366 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
367 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
369 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
372 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
373 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
375 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
376 iface, depth_stencil_view, flags, depth, stencil);
379 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
381 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
384 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
385 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
386 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
388 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
389 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
390 iface, dst_resource, dst_subresource_idx,
391 src_resource, src_subresource_idx, debug_dxgi_format(format));
394 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
395 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
397 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
398 iface, start_slot, buffer_count, buffers);
401 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
402 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
404 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
405 iface, start_slot, view_count, views);
408 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
410 FIXME("iface %p, shader %p stub!\n", iface, shader);
413 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
414 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
416 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
417 iface, start_slot, sampler_count, samplers);
420 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
422 FIXME("iface %p, shader %p stub!\n", iface, shader);
425 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
426 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
428 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
429 iface, start_slot, buffer_count, buffers);
432 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
434 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
437 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
438 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
440 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
441 iface, start_slot, buffer_count, buffers, strides, offsets);
444 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
445 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
447 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
450 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
451 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
453 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
454 iface, start_slot, buffer_count, buffers);
457 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
459 FIXME("iface %p, shader %p stub!\n", iface, shader);
462 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
464 struct d3d10_device *This = (struct d3d10_device *)iface;
466 TRACE("iface %p, topology %p\n", iface, topology);
468 IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
471 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
472 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
474 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
475 iface, start_slot, view_count, views);
478 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
479 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
481 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
482 iface, start_slot, sampler_count, samplers);
485 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
486 ID3D10Predicate **predicate, BOOL *value)
488 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
491 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
492 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
494 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
495 iface, start_slot, view_count, views);
498 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
499 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
501 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
502 iface, start_slot, sampler_count, samplers);
505 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
506 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
508 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
509 iface, view_count, render_target_views, depth_stencil_view);
512 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
513 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
515 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
516 iface, blend_state, blend_factor, sample_mask);
519 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
520 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
522 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
523 iface, depth_stencil_state, stencil_ref);
526 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
527 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
529 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
530 iface, buffer_count, buffers, offsets);
533 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
535 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
538 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
539 UINT *viewport_count, D3D10_VIEWPORT *viewports)
541 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
544 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
546 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
549 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
551 FIXME("iface %p stub!\n", iface);
553 return E_NOTIMPL;
556 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
558 FIXME("iface %p, flags %#x stub!\n", iface, flags);
560 return E_NOTIMPL;
563 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
565 FIXME("iface %p stub!\n", iface);
567 return 0;
570 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
571 REFGUID guid, UINT *data_size, void *data)
573 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
574 iface, debugstr_guid(guid), data_size, data);
576 return E_NOTIMPL;
579 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
580 REFGUID guid, UINT data_size, const void *data)
582 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
583 iface, debugstr_guid(guid), data_size, data);
585 return E_NOTIMPL;
588 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
589 REFGUID guid, const IUnknown *data)
591 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
593 return E_NOTIMPL;
596 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
598 FIXME("iface %p stub!\n", iface);
601 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
603 FIXME("iface %p stub!\n", iface);
606 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
607 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
609 struct d3d10_device *This = (struct d3d10_device *)iface;
610 struct wined3d_buffer_desc wined3d_desc;
611 struct d3d10_buffer *object;
612 HRESULT hr;
614 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
616 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
617 if (!object)
619 ERR("Failed to allocate D3D10 buffer object memory\n");
620 return E_OUTOFMEMORY;
623 object->vtbl = &d3d10_buffer_vtbl;
624 object->refcount = 1;
626 FIXME("Implement DXGI<->wined3d usage conversion\n");
628 wined3d_desc.byte_width = desc->ByteWidth;
629 wined3d_desc.usage = desc->Usage;
630 wined3d_desc.bind_flags = desc->BindFlags;
631 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
632 wined3d_desc.misc_flags = desc->MiscFlags;
634 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
635 data ? data->pSysMem : NULL, (IUnknown *)object, &object->wined3d_buffer);
636 if (FAILED(hr))
638 ERR("CreateBuffer failed, returning %#x\n", hr);
639 HeapFree(GetProcessHeap(), 0, object);
640 return hr;
643 *buffer = (ID3D10Buffer *)object;
645 TRACE("Created ID3D10Buffer %p\n", object);
647 return S_OK;
650 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
651 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
653 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
655 return E_NOTIMPL;
658 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
659 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
661 struct d3d10_device *This = (struct d3d10_device *)iface;
662 struct d3d10_texture2d *object;
663 HRESULT hr;
665 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
667 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
668 if (!object)
670 ERR("Failed to allocate D3D10 texture2d object memory\n");
671 return E_OUTOFMEMORY;
674 object->vtbl = &d3d10_texture2d_vtbl;
675 object->refcount = 1;
676 object->desc = *desc;
678 if (desc->MipLevels == 1 && desc->ArraySize == 1)
680 IWineDXGIDevice *wine_device;
682 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
683 if (FAILED(hr))
685 ERR("Device should implement IWineDXGIDevice\n");
686 HeapFree(GetProcessHeap(), 0, object);
687 return E_FAIL;
690 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
691 (IUnknown *)object, (void **)&object->dxgi_surface);
692 IWineDXGIDevice_Release(wine_device);
693 if (FAILED(hr))
695 ERR("Failed to create DXGI surface, returning %#x\n", hr);
696 HeapFree(GetProcessHeap(), 0, object);
697 return hr;
700 FIXME("Implement DXGI<->wined3d usage conversion\n");
702 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
703 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
704 &object->wined3d_surface, desc->Usage, WINED3DPOOL_DEFAULT,
705 desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
706 desc->SampleDesc.Quality, SURFACE_OPENGL, (IUnknown *)object);
707 if (FAILED(hr))
709 ERR("CreateSurface failed, returning %#x\n", hr);
710 IDXGISurface_Release(object->dxgi_surface);
711 HeapFree(GetProcessHeap(), 0, object);
712 return hr;
716 *texture = (ID3D10Texture2D *)object;
718 TRACE("Created ID3D10Texture2D %p\n", object);
720 return S_OK;
723 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
724 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
726 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
728 return E_NOTIMPL;
731 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
732 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
734 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
736 return E_NOTIMPL;
739 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
741 D3D10_RESOURCE_DIMENSION dimension;
743 ID3D10Resource_GetType(resource, &dimension);
745 switch(dimension)
747 case D3D10_RESOURCE_DIMENSION_BUFFER:
748 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
750 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
751 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
753 default:
754 FIXME("Unhandled resource dimension %#x\n", dimension);
755 return NULL;
759 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
761 D3D10_RESOURCE_DIMENSION dimension;
762 HRESULT hr;
764 ID3D10Resource_GetType(resource, &dimension);
766 switch(dimension)
768 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
770 ID3D10Texture1D *texture;
771 D3D10_TEXTURE1D_DESC texture_desc;
773 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
774 if (FAILED(hr))
776 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
777 return E_INVALIDARG;
780 ID3D10Texture1D_GetDesc(texture, &texture_desc);
781 ID3D10Texture1D_Release(texture);
783 desc->Format = texture_desc.Format;
784 if (texture_desc.ArraySize == 1)
786 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
787 desc->u.Texture1D.MipSlice = 0;
789 else
791 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
792 desc->u.Texture1DArray.MipSlice = 0;
793 desc->u.Texture1DArray.FirstArraySlice = 0;
794 desc->u.Texture1DArray.ArraySize = 1;
797 return S_OK;
800 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
802 ID3D10Texture2D *texture;
803 D3D10_TEXTURE2D_DESC texture_desc;
805 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
806 if (FAILED(hr))
808 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
809 return E_INVALIDARG;
812 ID3D10Texture2D_GetDesc(texture, &texture_desc);
813 ID3D10Texture2D_Release(texture);
815 desc->Format = texture_desc.Format;
816 if (texture_desc.ArraySize == 1)
818 if (texture_desc.SampleDesc.Count == 1)
820 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
821 desc->u.Texture2D.MipSlice = 0;
823 else
825 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
828 else
830 if (texture_desc.SampleDesc.Count == 1)
832 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
833 desc->u.Texture2DArray.MipSlice = 0;
834 desc->u.Texture2DArray.FirstArraySlice = 0;
835 desc->u.Texture2DArray.ArraySize = 1;
837 else
839 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
840 desc->u.Texture2DMSArray.FirstArraySlice = 0;
841 desc->u.Texture2DMSArray.ArraySize = 1;
845 return S_OK;
848 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
850 ID3D10Texture3D *texture;
851 D3D10_TEXTURE3D_DESC texture_desc;
853 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
854 if (FAILED(hr))
856 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
857 return E_INVALIDARG;
860 ID3D10Texture3D_GetDesc(texture, &texture_desc);
861 ID3D10Texture3D_Release(texture);
863 desc->Format = texture_desc.Format;
864 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
865 desc->u.Texture3D.MipSlice = 0;
866 desc->u.Texture3D.FirstWSlice = 0;
867 desc->u.Texture3D.WSize = 1;
869 return S_OK;
872 default:
873 FIXME("Unhandled resource dimension %#x\n", dimension);
874 return E_INVALIDARG;
878 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
879 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
881 struct d3d10_device *This = (struct d3d10_device *)iface;
882 struct d3d10_rendertarget_view *object;
883 IWineD3DResource *wined3d_resource;
885 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
887 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
888 if (!object)
890 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
891 return E_OUTOFMEMORY;
894 object->vtbl = &d3d10_rendertarget_view_vtbl;
895 object->refcount = 1;
897 if (!desc)
899 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
900 if (FAILED(hr))
902 HeapFree(GetProcessHeap(), 0, object);
903 return hr;
906 else
908 object->desc = *desc;
911 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
912 if (!wined3d_resource)
914 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
915 HeapFree(GetProcessHeap(), 0, object);
916 return E_FAIL;
918 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
919 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
921 *view = (ID3D10RenderTargetView *)object;
923 return S_OK;
926 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
927 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
929 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
931 return E_NOTIMPL;
934 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
935 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
936 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
938 struct d3d10_device *This = (struct d3d10_device *)iface;
939 struct d3d10_input_layout *object;
940 WINED3DVERTEXELEMENT *wined3d_elements;
941 UINT wined3d_element_count;
942 HRESULT hr;
944 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
945 "\tshader_byte_code_length %lu, input_layout %p\n",
946 iface, element_descs, element_count, shader_byte_code,
947 shader_byte_code_length, input_layout);
949 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
950 if (!object)
952 ERR("Failed to allocate D3D10 input layout object memory\n");
953 return E_OUTOFMEMORY;
956 object->vtbl = &d3d10_input_layout_vtbl;
957 object->refcount = 1;
959 hr = d3d10_input_layout_to_wined3d_declaration(element_descs, element_count,
960 shader_byte_code, shader_byte_code_length, &wined3d_elements, &wined3d_element_count);
961 if (FAILED(hr))
963 HeapFree(GetProcessHeap(), 0, object);
964 return hr;
967 IWineD3DDevice_CreateVertexDeclaration(This->wined3d_device, &object->wined3d_decl,
968 (IUnknown *)object, wined3d_elements, wined3d_element_count);
970 HeapFree(GetProcessHeap(), 0, wined3d_elements);
972 *input_layout = (ID3D10InputLayout *)object;
974 return S_OK;
977 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
978 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
980 struct d3d10_device *This = (struct d3d10_device *)iface;
981 struct d3d10_vertex_shader *object;
982 struct d3d10_shader_info shader_info;
983 HRESULT hr;
985 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
986 iface, byte_code, byte_code_length, shader);
988 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
989 if (!object)
991 ERR("Failed to allocate D3D10 vertex shader object memory\n");
992 return E_OUTOFMEMORY;
995 object->vtbl = &d3d10_vertex_shader_vtbl;
996 object->refcount = 1;
998 shader_info.output_signature = &object->output_signature;
999 hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
1000 if (FAILED(hr))
1002 ERR("Failed to extract shader, hr %#x\n", hr);
1003 HeapFree(GetProcessHeap(), 0, object);
1004 return hr;
1007 hr = IWineD3DDevice_CreateVertexShader(This->wined3d_device,
1008 shader_info.shader_code, &object->output_signature,
1009 &object->wined3d_shader, (IUnknown *)object);
1010 if (FAILED(hr))
1012 ERR("CreateVertexShader failed, hr %#x\n", hr);
1013 shader_free_signature(&object->output_signature);
1014 HeapFree(GetProcessHeap(), 0, object);
1015 return hr;
1018 *shader = (ID3D10VertexShader *)object;
1020 return S_OK;
1023 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
1024 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
1026 struct d3d10_geometry_shader *object;
1028 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
1029 iface, byte_code, byte_code_length, shader);
1031 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1032 if (!object)
1034 ERR("Failed to allocate D3D10 geometry shader object memory\n");
1035 return E_OUTOFMEMORY;
1038 object->vtbl = &d3d10_geometry_shader_vtbl;
1039 object->refcount = 1;
1041 *shader = (ID3D10GeometryShader *)object;
1043 return S_OK;
1046 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
1047 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
1048 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
1050 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
1051 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
1052 iface, byte_code, byte_code_length, output_stream_decls,
1053 output_stream_decl_count, output_stream_stride, shader);
1055 return E_NOTIMPL;
1058 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
1059 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
1061 struct d3d10_device *This = (struct d3d10_device *)iface;
1062 struct d3d10_pixel_shader *object;
1063 struct d3d10_shader_info shader_info;
1064 HRESULT hr;
1066 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
1067 iface, byte_code, byte_code_length, shader);
1069 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1070 if (!object)
1072 ERR("Failed to allocate D3D10 pixel shader object memory\n");
1073 return E_OUTOFMEMORY;
1076 object->vtbl = &d3d10_pixel_shader_vtbl;
1077 object->refcount = 1;
1079 shader_info.output_signature = &object->output_signature;
1080 hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
1081 if (FAILED(hr))
1083 ERR("Failed to extract shader, hr %#x\n", hr);
1084 HeapFree(GetProcessHeap(), 0, object);
1085 return hr;
1088 hr = IWineD3DDevice_CreatePixelShader(This->wined3d_device,
1089 shader_info.shader_code, &object->output_signature,
1090 &object->wined3d_shader, (IUnknown *)object);
1091 if (FAILED(hr))
1093 ERR("CreatePixelShader failed, hr %#x\n", hr);
1094 shader_free_signature(&object->output_signature);
1095 HeapFree(GetProcessHeap(), 0, object);
1096 return hr;
1099 *shader = (ID3D10PixelShader *)object;
1101 return S_OK;
1104 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
1105 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
1107 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
1109 return E_NOTIMPL;
1112 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
1113 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
1115 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
1117 return E_NOTIMPL;
1120 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1121 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1123 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
1125 return E_NOTIMPL;
1128 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1129 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1131 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
1133 return E_NOTIMPL;
1136 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1137 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1139 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
1141 return E_NOTIMPL;
1144 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1145 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1147 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1149 return E_NOTIMPL;
1152 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1153 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1155 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1157 return E_NOTIMPL;
1160 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1161 DXGI_FORMAT format, UINT *format_support)
1163 FIXME("iface %p, format %s, format_support %p stub!\n",
1164 iface, debug_dxgi_format(format), format_support);
1166 return E_NOTIMPL;
1169 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1170 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1172 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1173 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1175 return E_NOTIMPL;
1178 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1180 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1183 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1184 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1185 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1187 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1188 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1189 iface, desc, type, active_counters, name, name_length,
1190 units, units_length, description, description_length);
1192 return E_NOTIMPL;
1195 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1197 FIXME("iface %p stub!\n", iface);
1199 return 0;
1202 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1203 HANDLE resource_handle, REFIID guid, void **resource)
1205 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1206 iface, resource_handle, debugstr_guid(guid), resource);
1208 return E_NOTIMPL;
1211 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1213 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1216 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1218 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1221 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1223 /* IUnknown methods */
1224 d3d10_device_QueryInterface,
1225 d3d10_device_AddRef,
1226 d3d10_device_Release,
1227 /* ID3D10Device methods */
1228 d3d10_device_VSSetConstantBuffers,
1229 d3d10_device_PSSetShaderResources,
1230 d3d10_device_PSSetShader,
1231 d3d10_device_PSSetSamplers,
1232 d3d10_device_VSSetShader,
1233 d3d10_device_DrawIndexed,
1234 d3d10_device_Draw,
1235 d3d10_device_PSSetConstantBuffers,
1236 d3d10_device_IASetInputLayout,
1237 d3d10_device_IASetVertexBuffers,
1238 d3d10_device_IASetIndexBuffer,
1239 d3d10_device_DrawIndexedInstanced,
1240 d3d10_device_DrawInstanced,
1241 d3d10_device_GSSetConstantBuffers,
1242 d3d10_device_GSSetShader,
1243 d3d10_device_IASetPrimitiveTopology,
1244 d3d10_device_VSSetShaderResources,
1245 d3d10_device_VSSetSamplers,
1246 d3d10_device_SetPredication,
1247 d3d10_device_GSSetShaderResources,
1248 d3d10_device_GSSetSamplers,
1249 d3d10_device_OMSetRenderTargets,
1250 d3d10_device_OMSetBlendState,
1251 d3d10_device_OMSetDepthStencilState,
1252 d3d10_device_SOSetTargets,
1253 d3d10_device_DrawAuto,
1254 d3d10_device_RSSetState,
1255 d3d10_device_RSSetViewports,
1256 d3d10_device_RSSetScissorRects,
1257 d3d10_device_CopySubresourceRegion,
1258 d3d10_device_CopyResource,
1259 d3d10_device_UpdateSubresource,
1260 d3d10_device_ClearRenderTargetView,
1261 d3d10_device_ClearDepthStencilView,
1262 d3d10_device_GenerateMips,
1263 d3d10_device_ResolveSubresource,
1264 d3d10_device_VSGetConstantBuffers,
1265 d3d10_device_PSGetShaderResources,
1266 d3d10_device_PSGetShader,
1267 d3d10_device_PSGetSamplers,
1268 d3d10_device_VSGetShader,
1269 d3d10_device_PSGetConstantBuffers,
1270 d3d10_device_IAGetInputLayout,
1271 d3d10_device_IAGetVertexBuffers,
1272 d3d10_device_IAGetIndexBuffer,
1273 d3d10_device_GSGetConstantBuffers,
1274 d3d10_device_GSGetShader,
1275 d3d10_device_IAGetPrimitiveTopology,
1276 d3d10_device_VSGetShaderResources,
1277 d3d10_device_VSGetSamplers,
1278 d3d10_device_GetPredication,
1279 d3d10_device_GSGetShaderResources,
1280 d3d10_device_GSGetSamplers,
1281 d3d10_device_OMGetRenderTargets,
1282 d3d10_device_OMGetBlendState,
1283 d3d10_device_OMGetDepthStencilState,
1284 d3d10_device_SOGetTargets,
1285 d3d10_device_RSGetState,
1286 d3d10_device_RSGetViewports,
1287 d3d10_device_RSGetScissorRects,
1288 d3d10_device_GetDeviceRemovedReason,
1289 d3d10_device_SetExceptionMode,
1290 d3d10_device_GetExceptionMode,
1291 d3d10_device_GetPrivateData,
1292 d3d10_device_SetPrivateData,
1293 d3d10_device_SetPrivateDataInterface,
1294 d3d10_device_ClearState,
1295 d3d10_device_Flush,
1296 d3d10_device_CreateBuffer,
1297 d3d10_device_CreateTexture1D,
1298 d3d10_device_CreateTexture2D,
1299 d3d10_device_CreateTexture3D,
1300 d3d10_device_CreateShaderResourceView,
1301 d3d10_device_CreateRenderTargetView,
1302 d3d10_device_CreateDepthStencilView,
1303 d3d10_device_CreateInputLayout,
1304 d3d10_device_CreateVertexShader,
1305 d3d10_device_CreateGeometryShader,
1306 d3d10_device_CreateGeometryShaderWithStreamOutput,
1307 d3d10_device_CreatePixelShader,
1308 d3d10_device_CreateBlendState,
1309 d3d10_device_CreateDepthStencilState,
1310 d3d10_device_CreateRasterizerState,
1311 d3d10_device_CreateSamplerState,
1312 d3d10_device_CreateQuery,
1313 d3d10_device_CreatePredicate,
1314 d3d10_device_CreateCounter,
1315 d3d10_device_CheckFormatSupport,
1316 d3d10_device_CheckMultisampleQualityLevels,
1317 d3d10_device_CheckCounterInfo,
1318 d3d10_device_CheckCounter,
1319 d3d10_device_GetCreationFlags,
1320 d3d10_device_OpenSharedResource,
1321 d3d10_device_SetTextFilterSize,
1322 d3d10_device_GetTextFilterSize,
1325 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1327 /* IUnknown methods */
1328 d3d10_device_inner_QueryInterface,
1329 d3d10_device_inner_AddRef,
1330 d3d10_device_inner_Release,
1333 /* IWineD3DDeviceParent IUnknown methods */
1335 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1337 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1340 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1342 struct d3d10_device *This = device_from_device_parent(iface);
1343 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1346 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1348 struct d3d10_device *This = device_from_device_parent(iface);
1349 return d3d10_device_AddRef((ID3D10Device *)This);
1352 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1354 struct d3d10_device *This = device_from_device_parent(iface);
1355 return d3d10_device_Release((ID3D10Device *)This);
1358 /* IWineD3DDeviceParent methods */
1360 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1362 struct d3d10_device *This = device_from_device_parent(iface);
1364 TRACE("iface %p, device %p\n", iface, device);
1366 IWineD3DDevice_AddRef(device);
1367 This->wined3d_device = device;
1370 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1371 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1372 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1374 struct d3d10_device *This = device_from_device_parent(iface);
1375 struct d3d10_texture2d *texture;
1376 D3D10_TEXTURE2D_DESC desc;
1377 HRESULT hr;
1379 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1380 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1381 iface, superior, width, height, format, usage, pool, level, face, surface);
1383 FIXME("Implement DXGI<->wined3d usage conversion\n");
1385 desc.Width = width;
1386 desc.Height = height;
1387 desc.MipLevels = 1;
1388 desc.ArraySize = 1;
1389 desc.Format = dxgi_format_from_wined3dformat(format);
1390 desc.SampleDesc.Count = 1;
1391 desc.SampleDesc.Quality = 0;
1392 desc.Usage = usage;
1393 desc.BindFlags = 0;
1394 desc.CPUAccessFlags = 0;
1395 desc.MiscFlags = 0;
1397 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1398 if (FAILED(hr))
1400 ERR("CreateTexture2D failed, returning %#x\n", hr);
1401 return hr;
1404 *surface = texture->wined3d_surface;
1406 return S_OK;
1409 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1410 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1411 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1413 struct d3d10_device *This = device_from_device_parent(iface);
1414 struct d3d10_texture2d *texture;
1415 D3D10_TEXTURE2D_DESC desc;
1416 HRESULT hr;
1418 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1419 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1420 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1422 FIXME("Implement DXGI<->wined3d usage conversion\n");
1424 desc.Width = width;
1425 desc.Height = height;
1426 desc.MipLevels = 1;
1427 desc.ArraySize = 1;
1428 desc.Format = dxgi_format_from_wined3dformat(format);
1429 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1430 desc.SampleDesc.Quality = multisample_quality;
1431 desc.Usage = D3D10_USAGE_DEFAULT;
1432 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1433 desc.CPUAccessFlags = 0;
1434 desc.MiscFlags = 0;
1436 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1437 if (FAILED(hr))
1439 ERR("CreateTexture2D failed, returning %#x\n", hr);
1440 return hr;
1443 *surface = texture->wined3d_surface;
1445 return S_OK;
1448 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1449 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1450 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1452 struct d3d10_device *This = device_from_device_parent(iface);
1453 struct d3d10_texture2d *texture;
1454 D3D10_TEXTURE2D_DESC desc;
1455 HRESULT hr;
1457 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1458 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1459 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1461 FIXME("Implement DXGI<->wined3d usage conversion\n");
1463 desc.Width = width;
1464 desc.Height = height;
1465 desc.MipLevels = 1;
1466 desc.ArraySize = 1;
1467 desc.Format = dxgi_format_from_wined3dformat(format);
1468 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1469 desc.SampleDesc.Quality = multisample_quality;
1470 desc.Usage = D3D10_USAGE_DEFAULT;
1471 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1472 desc.CPUAccessFlags = 0;
1473 desc.MiscFlags = 0;
1475 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1476 if (FAILED(hr))
1478 ERR("CreateTexture2D failed, returning %#x\n", hr);
1479 return hr;
1482 *surface = texture->wined3d_surface;
1484 return S_OK;
1487 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1488 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1489 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1491 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1492 iface, superior, width, height, depth, format, pool, usage, volume);
1494 return E_NOTIMPL;
1497 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1498 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1500 IWineDXGIDevice *wine_device;
1501 HRESULT hr;
1503 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1505 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1506 if (FAILED(hr))
1508 ERR("Device should implement IWineDXGIDevice\n");
1509 return E_FAIL;
1512 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1513 IWineDXGIDevice_Release(wine_device);
1514 if (FAILED(hr))
1516 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1517 return hr;
1520 return S_OK;
1523 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1525 /* IUnknown methods */
1526 device_parent_QueryInterface,
1527 device_parent_AddRef,
1528 device_parent_Release,
1529 /* IWineD3DDeviceParent methods */
1530 device_parent_WineD3DDeviceCreated,
1531 device_parent_CreateSurface,
1532 device_parent_CreateRenderTarget,
1533 device_parent_CreateDepthStencilSurface,
1534 device_parent_CreateVolume,
1535 device_parent_CreateSwapChain,