d3d10core: Add a stub ID3D10PixelShader implementation.
[wine.git] / dlls / d3d10core / device.c
blob689de3e7a2789e8a0dcfdc95913b6ceb233f2e1d
1 /*
2 * Copyright 2008 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
21 #include "wine/port.h"
23 #include "d3d10core_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
27 /* Inner IUnknown methods */
29 static inline struct d3d10_device *d3d10_device_from_inner_unknown(IUnknown *iface)
31 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, inner_unknown_vtbl));
34 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid, void **object)
36 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
38 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
40 if (IsEqualGUID(riid, &IID_IUnknown)
41 || IsEqualGUID(riid, &IID_ID3D10Device))
43 IUnknown_AddRef((IUnknown *)This);
44 *object = This;
45 return S_OK;
48 if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
50 IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
51 *object = &This->device_parent_vtbl;
52 return S_OK;
55 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
57 *object = NULL;
58 return E_NOINTERFACE;
61 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
63 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
64 ULONG refcount = InterlockedIncrement(&This->refcount);
66 TRACE("%p increasing refcount to %u\n", This, refcount);
68 return refcount;
71 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
73 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
74 ULONG refcount = InterlockedDecrement(&This->refcount);
76 TRACE("%p decreasing refcount to %u\n", This, refcount);
78 if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
80 return refcount;
83 /* IUnknown methods */
85 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
87 struct d3d10_device *This = (struct d3d10_device *)iface;
88 TRACE("Forwarding to outer IUnknown\n");
89 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
92 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
94 struct d3d10_device *This = (struct d3d10_device *)iface;
95 TRACE("Forwarding to outer IUnknown\n");
96 return IUnknown_AddRef(This->outer_unknown);
99 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
101 struct d3d10_device *This = (struct d3d10_device *)iface;
102 TRACE("Forwarding to outer IUnknown\n");
103 return IUnknown_Release(This->outer_unknown);
106 /* ID3D10Device methods */
108 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
109 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
111 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
112 iface, start_slot, buffer_count, buffers);
115 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
116 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
118 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
119 iface, start_slot, view_count, views);
122 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
124 FIXME("iface %p, shader %p stub!\n", iface, shader);
127 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
128 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
130 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
131 iface, start_slot, sampler_count, samplers);
134 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
136 FIXME("iface %p, shader %p stub!\n", iface, shader);
139 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
140 UINT index_count, UINT start_index_location, INT base_vertex_location)
142 FIXME("iface %p, index_count %u, start_index_location %u, base_vertex_location %d stub!\n",
143 iface, index_count, start_index_location, base_vertex_location);
146 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
147 UINT vertex_count, UINT start_vertex_location)
149 FIXME("iface %p, vertex_count %u, start_vertex_location %u stub!\n",
150 iface, vertex_count, start_vertex_location);
153 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
154 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
156 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
157 iface, start_slot, buffer_count, buffers);
160 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
162 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
165 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
166 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
167 const UINT *strides, const UINT *offsets)
169 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
170 iface, start_slot, buffer_count, buffers, strides, offsets);
173 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
174 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
176 FIXME("iface %p, buffer %p, format %s, offset %u stub!\n",
177 iface, buffer, debug_dxgi_format(format), offset);
180 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
181 UINT instance_index_count, UINT instance_count, UINT start_index_location,
182 INT base_vertex_location, UINT start_instance_location)
184 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
185 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
186 iface, instance_index_count, instance_count, start_index_location,
187 base_vertex_location, start_instance_location);
190 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
191 UINT instance_vertex_count, UINT instance_count,
192 UINT start_vertex_location, UINT start_instance_location)
194 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
195 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
196 start_vertex_location, start_instance_location);
199 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
200 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
202 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
203 iface, start_slot, buffer_count, buffers);
206 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
208 FIXME("iface %p, shader %p stub!\n", iface, shader);
211 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
213 FIXME("iface %p, topology %s stub!\n", iface, debug_d3d10_primitive_topology(topology));
216 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
217 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
219 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
220 iface, start_slot, view_count, views);
223 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
224 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
226 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
227 iface, start_slot, sampler_count, samplers);
230 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
232 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
235 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
236 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
238 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
239 iface, start_slot, view_count, views);
242 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
243 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
245 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
246 iface, start_slot, sampler_count, samplers);
249 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
250 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
251 ID3D10DepthStencilView *depth_stencil_view)
253 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
254 iface, render_target_view_count, render_target_views, depth_stencil_view);
257 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
258 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
260 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
261 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
264 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
265 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
267 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
268 iface, depth_stencil_state, stencil_ref);
271 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
272 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
274 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
277 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
279 FIXME("iface %p stub!\n", iface);
282 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
284 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
287 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
288 UINT viewport_count, const D3D10_VIEWPORT *viewports)
290 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
293 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
294 UINT rect_count, const D3D10_RECT *rects)
296 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
299 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
300 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
301 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
303 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
304 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
305 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
306 src_resource, src_subresource_idx, src_box);
309 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
310 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
312 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
315 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
316 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
317 const void *data, UINT row_pitch, UINT depth_pitch)
319 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
320 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
323 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
324 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
326 struct d3d10_device *This = (struct d3d10_device *)iface;
327 IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
329 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
330 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
332 IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
335 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
336 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
338 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
339 iface, depth_stencil_view, flags, depth, stencil);
342 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
344 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
347 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
348 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
349 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
351 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
352 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
353 iface, dst_resource, dst_subresource_idx,
354 src_resource, src_subresource_idx, debug_dxgi_format(format));
357 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
358 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
360 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
361 iface, start_slot, buffer_count, buffers);
364 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
365 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
367 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
368 iface, start_slot, view_count, views);
371 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
373 FIXME("iface %p, shader %p stub!\n", iface, shader);
376 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
377 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
379 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
380 iface, start_slot, sampler_count, samplers);
383 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
385 FIXME("iface %p, shader %p stub!\n", iface, shader);
388 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
389 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
391 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
392 iface, start_slot, buffer_count, buffers);
395 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
397 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
400 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
401 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
403 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
404 iface, start_slot, buffer_count, buffers, strides, offsets);
407 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
408 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
410 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
413 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
414 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
416 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
417 iface, start_slot, buffer_count, buffers);
420 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
422 FIXME("iface %p, shader %p stub!\n", iface, shader);
425 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
427 FIXME("iface %p, topology %p stub!\n", iface, topology);
430 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
431 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
433 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
434 iface, start_slot, view_count, views);
437 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
438 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
440 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
441 iface, start_slot, sampler_count, samplers);
444 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
445 ID3D10Predicate **predicate, BOOL *value)
447 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
450 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
451 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
453 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
454 iface, start_slot, view_count, views);
457 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
458 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
460 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
461 iface, start_slot, sampler_count, samplers);
464 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
465 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
467 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
468 iface, view_count, render_target_views, depth_stencil_view);
471 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
472 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
474 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
475 iface, blend_state, blend_factor, sample_mask);
478 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
479 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
481 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
482 iface, depth_stencil_state, stencil_ref);
485 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
486 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
488 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
489 iface, buffer_count, buffers, offsets);
492 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
494 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
497 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
498 UINT *viewport_count, D3D10_VIEWPORT *viewports)
500 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
503 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
505 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
508 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
510 FIXME("iface %p stub!\n", iface);
512 return E_NOTIMPL;
515 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
517 FIXME("iface %p, flags %#x stub!\n", iface, flags);
519 return E_NOTIMPL;
522 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
524 FIXME("iface %p stub!\n", iface);
526 return 0;
529 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
530 REFGUID guid, UINT *data_size, void *data)
532 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
533 iface, debugstr_guid(guid), data_size, data);
535 return E_NOTIMPL;
538 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
539 REFGUID guid, UINT data_size, const void *data)
541 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
542 iface, debugstr_guid(guid), data_size, data);
544 return E_NOTIMPL;
547 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
548 REFGUID guid, const IUnknown *data)
550 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
552 return E_NOTIMPL;
555 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
557 FIXME("iface %p stub!\n", iface);
560 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
562 FIXME("iface %p stub!\n", iface);
565 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
566 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
568 struct d3d10_device *This = (struct d3d10_device *)iface;
569 struct wined3d_buffer_desc wined3d_desc;
570 struct d3d10_buffer *object;
571 HRESULT hr;
573 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
575 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
576 if (!object)
578 ERR("Failed to allocate D3D10 buffer object memory\n");
579 return E_OUTOFMEMORY;
582 object->vtbl = &d3d10_buffer_vtbl;
583 object->refcount = 1;
585 FIXME("Implement DXGI<->wined3d usage conversion\n");
587 wined3d_desc.byte_width = desc->ByteWidth;
588 wined3d_desc.usage = desc->Usage;
589 wined3d_desc.bind_flags = desc->BindFlags;
590 wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
591 wined3d_desc.misc_flags = desc->MiscFlags;
593 hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
594 (IUnknown *)object, &object->wined3d_buffer);
595 if (FAILED(hr))
597 ERR("CreateBuffer failed, returning %#x\n", hr);
598 HeapFree(GetProcessHeap(), 0, object);
599 return hr;
602 *buffer = (ID3D10Buffer *)object;
604 TRACE("Created ID3D10Buffer %p\n", object);
606 return S_OK;
609 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
610 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
612 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
614 return E_NOTIMPL;
617 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
618 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
620 struct d3d10_device *This = (struct d3d10_device *)iface;
621 struct d3d10_texture2d *object;
622 HRESULT hr;
624 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
626 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
627 if (!object)
629 ERR("Failed to allocate D3D10 texture2d object memory\n");
630 return E_OUTOFMEMORY;
633 object->vtbl = &d3d10_texture2d_vtbl;
634 object->refcount = 1;
635 object->desc = *desc;
637 if (desc->MipLevels == 1 && desc->ArraySize == 1)
639 IWineDXGIDevice *wine_device;
641 hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
642 if (FAILED(hr))
644 ERR("Device should implement IWineDXGIDevice\n");
645 HeapFree(GetProcessHeap(), 0, object);
646 return E_FAIL;
649 hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
650 (IUnknown *)object, (void **)&object->dxgi_surface);
651 IWineDXGIDevice_Release(wine_device);
652 if (FAILED(hr))
654 ERR("Failed to create DXGI surface, returning %#x\n", hr);
655 HeapFree(GetProcessHeap(), 0, object);
656 return hr;
659 FIXME("Implement DXGI<->wined3d usage conversion\n");
661 hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
662 wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
663 &object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
664 desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
665 desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
666 if (FAILED(hr))
668 ERR("CreateSurface failed, returning %#x\n", hr);
669 IDXGISurface_Release(object->dxgi_surface);
670 HeapFree(GetProcessHeap(), 0, object);
671 return hr;
675 *texture = (ID3D10Texture2D *)object;
677 TRACE("Created ID3D10Texture2D %p\n", object);
679 return S_OK;
682 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
683 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
685 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
687 return E_NOTIMPL;
690 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
691 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
693 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
695 return E_NOTIMPL;
698 static IWineD3DResource *d3d10_device_wined3d_resource_from_resource(ID3D10Resource *resource)
700 D3D10_RESOURCE_DIMENSION dimension;
702 ID3D10Resource_GetType(resource, &dimension);
704 switch(dimension)
706 case D3D10_RESOURCE_DIMENSION_BUFFER:
707 return (IWineD3DResource *)((struct d3d10_buffer *)resource)->wined3d_buffer;
709 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
710 return (IWineD3DResource *)((struct d3d10_texture2d *)resource)->wined3d_surface;
712 default:
713 FIXME("Unhandled resource dimension %#x\n", dimension);
714 return NULL;
718 static HRESULT d3d10_device_set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10Resource *resource)
720 D3D10_RESOURCE_DIMENSION dimension;
721 HRESULT hr;
723 ID3D10Resource_GetType(resource, &dimension);
725 switch(dimension)
727 case D3D10_RESOURCE_DIMENSION_TEXTURE1D:
729 ID3D10Texture1D *texture;
730 D3D10_TEXTURE1D_DESC texture_desc;
732 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
733 if (FAILED(hr))
735 ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
736 return E_INVALIDARG;
739 ID3D10Texture1D_GetDesc(texture, &texture_desc);
740 ID3D10Texture1D_Release(texture);
742 desc->Format = texture_desc.Format;
743 if (texture_desc.ArraySize == 1)
745 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
746 desc->Texture1D.MipSlice = 0;
748 else
750 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
751 desc->Texture1DArray.MipSlice = 0;
752 desc->Texture1DArray.FirstArraySlice = 0;
753 desc->Texture1DArray.ArraySize = 1;
756 return S_OK;
759 case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
761 ID3D10Texture2D *texture;
762 D3D10_TEXTURE2D_DESC texture_desc;
764 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
765 if (FAILED(hr))
767 ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
768 return E_INVALIDARG;
771 ID3D10Texture2D_GetDesc(texture, &texture_desc);
772 ID3D10Texture2D_Release(texture);
774 desc->Format = texture_desc.Format;
775 if (texture_desc.ArraySize == 1)
777 if (texture_desc.SampleDesc.Count == 1)
779 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
780 desc->Texture2D.MipSlice = 0;
782 else
784 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
787 else
789 if (texture_desc.SampleDesc.Count == 1)
791 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
792 desc->Texture2DArray.MipSlice = 0;
793 desc->Texture2DArray.FirstArraySlice = 0;
794 desc->Texture2DArray.ArraySize = 1;
796 else
798 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
799 desc->Texture2DMSArray.FirstArraySlice = 0;
800 desc->Texture2DMSArray.ArraySize = 1;
804 return S_OK;
807 case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
809 ID3D10Texture3D *texture;
810 D3D10_TEXTURE3D_DESC texture_desc;
812 hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
813 if (FAILED(hr))
815 ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
816 return E_INVALIDARG;
819 ID3D10Texture3D_GetDesc(texture, &texture_desc);
820 ID3D10Texture3D_Release(texture);
822 desc->Format = texture_desc.Format;
823 desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
824 desc->Texture3D.MipSlice = 0;
825 desc->Texture3D.FirstWSlice = 0;
826 desc->Texture3D.WSize = 1;
828 return S_OK;
831 default:
832 FIXME("Unhandled resource dimension %#x\n", dimension);
833 return E_INVALIDARG;
837 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
838 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
840 struct d3d10_device *This = (struct d3d10_device *)iface;
841 struct d3d10_rendertarget_view *object;
842 IWineD3DResource *wined3d_resource;
844 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
846 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
847 if (!object)
849 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
850 return E_OUTOFMEMORY;
853 object->vtbl = &d3d10_rendertarget_view_vtbl;
854 object->refcount = 1;
856 if (!desc)
858 HRESULT hr = d3d10_device_set_rtdesc_from_resource(&object->desc, resource);
859 if (FAILED(hr))
861 HeapFree(GetProcessHeap(), 0, object);
862 return hr;
865 else
867 object->desc = *desc;
870 wined3d_resource = d3d10_device_wined3d_resource_from_resource(resource);
871 if (!wined3d_resource)
873 FIXME("Failed to get wined3d resource for d3d10 resource %p\n", resource);
874 HeapFree(GetProcessHeap(), 0, object);
875 return E_FAIL;
877 IWineD3DDevice_CreateRendertargetView(This->wined3d_device,
878 wined3d_resource, (IUnknown *)object, &object->wined3d_view);
880 *view = (ID3D10RenderTargetView *)object;
882 return S_OK;
885 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
886 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
888 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
890 return E_NOTIMPL;
893 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
894 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
895 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
897 struct d3d10_input_layout *object;
899 FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
900 "\tshader_byte_code_length %lu, input_layout %p stub!\n",
901 iface, element_descs, element_count, shader_byte_code,
902 shader_byte_code_length, input_layout);
904 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
905 if (!object)
907 ERR("Failed to allocate D3D10 input layout object memory\n");
908 return E_OUTOFMEMORY;
911 object->vtbl = &d3d10_input_layout_vtbl;
912 object->refcount = 1;
914 *input_layout = (ID3D10InputLayout *)object;
916 return S_OK;
919 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
920 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
922 struct d3d10_vertex_shader *object;
924 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
925 iface, byte_code, byte_code_length, shader);
927 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
928 if (!object)
930 ERR("Failed to allocate D3D10 vertex shader object memory\n");
931 return E_OUTOFMEMORY;
934 object->vtbl = &d3d10_vertex_shader_vtbl;
935 object->refcount = 1;
937 *shader = (ID3D10VertexShader *)object;
939 return S_OK;
942 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
943 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
945 struct d3d10_geometry_shader *object;
947 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
948 iface, byte_code, byte_code_length, shader);
950 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
951 if (!object)
953 ERR("Failed to allocate D3D10 geometry shader object memory\n");
954 return E_OUTOFMEMORY;
957 object->vtbl = &d3d10_geometry_shader_vtbl;
958 object->refcount = 1;
960 *shader = (ID3D10GeometryShader *)object;
962 return S_OK;
965 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
966 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
967 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
969 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
970 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
971 iface, byte_code, byte_code_length, output_stream_decls,
972 output_stream_decl_count, output_stream_stride, shader);
974 return E_NOTIMPL;
977 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
978 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
980 struct d3d10_pixel_shader *object;
982 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
983 iface, byte_code, byte_code_length, shader);
985 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
986 if (!object)
988 ERR("Failed to allocate D3D10 pixel shader object memory\n");
989 return E_OUTOFMEMORY;
992 object->vtbl = &d3d10_pixel_shader_vtbl;
993 object->refcount = 1;
995 *shader = (ID3D10PixelShader *)object;
997 return S_OK;
1000 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
1001 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
1003 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
1005 return E_NOTIMPL;
1008 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
1009 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
1011 FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
1013 return E_NOTIMPL;
1016 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1017 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1019 FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
1021 return E_NOTIMPL;
1024 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1025 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1027 FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
1029 return E_NOTIMPL;
1032 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1033 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1035 FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
1037 return E_NOTIMPL;
1040 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1041 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1043 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1045 return E_NOTIMPL;
1048 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1049 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1051 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1053 return E_NOTIMPL;
1056 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1057 DXGI_FORMAT format, UINT *format_support)
1059 FIXME("iface %p, format %s, format_support %p stub!\n",
1060 iface, debug_dxgi_format(format), format_support);
1062 return E_NOTIMPL;
1065 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1066 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1068 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1069 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1071 return E_NOTIMPL;
1074 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1076 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1079 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1080 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1081 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1083 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1084 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1085 iface, desc, type, active_counters, name, name_length,
1086 units, units_length, description, description_length);
1088 return E_NOTIMPL;
1091 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1093 FIXME("iface %p stub!\n", iface);
1095 return 0;
1098 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1099 HANDLE resource_handle, REFIID guid, void **resource)
1101 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1102 iface, resource_handle, debugstr_guid(guid), resource);
1104 return E_NOTIMPL;
1107 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1109 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1112 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1114 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1117 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1119 /* IUnknown methods */
1120 d3d10_device_QueryInterface,
1121 d3d10_device_AddRef,
1122 d3d10_device_Release,
1123 /* ID3D10Device methods */
1124 d3d10_device_VSSetConstantBuffers,
1125 d3d10_device_PSSetShaderResources,
1126 d3d10_device_PSSetShader,
1127 d3d10_device_PSSetSamplers,
1128 d3d10_device_VSSetShader,
1129 d3d10_device_DrawIndexed,
1130 d3d10_device_Draw,
1131 d3d10_device_PSSetConstantBuffers,
1132 d3d10_device_IASetInputLayout,
1133 d3d10_device_IASetVertexBuffers,
1134 d3d10_device_IASetIndexBuffer,
1135 d3d10_device_DrawIndexedInstanced,
1136 d3d10_device_DrawInstanced,
1137 d3d10_device_GSSetConstantBuffers,
1138 d3d10_device_GSSetShader,
1139 d3d10_device_IASetPrimitiveTopology,
1140 d3d10_device_VSSetShaderResources,
1141 d3d10_device_VSSetSamplers,
1142 d3d10_device_SetPredication,
1143 d3d10_device_GSSetShaderResources,
1144 d3d10_device_GSSetSamplers,
1145 d3d10_device_OMSetRenderTargets,
1146 d3d10_device_OMSetBlendState,
1147 d3d10_device_OMSetDepthStencilState,
1148 d3d10_device_SOSetTargets,
1149 d3d10_device_DrawAuto,
1150 d3d10_device_RSSetState,
1151 d3d10_device_RSSetViewports,
1152 d3d10_device_RSSetScissorRects,
1153 d3d10_device_CopySubresourceRegion,
1154 d3d10_device_CopyResource,
1155 d3d10_device_UpdateSubresource,
1156 d3d10_device_ClearRenderTargetView,
1157 d3d10_device_ClearDepthStencilView,
1158 d3d10_device_GenerateMips,
1159 d3d10_device_ResolveSubresource,
1160 d3d10_device_VSGetConstantBuffers,
1161 d3d10_device_PSGetShaderResources,
1162 d3d10_device_PSGetShader,
1163 d3d10_device_PSGetSamplers,
1164 d3d10_device_VSGetShader,
1165 d3d10_device_PSGetConstantBuffers,
1166 d3d10_device_IAGetInputLayout,
1167 d3d10_device_IAGetVertexBuffers,
1168 d3d10_device_IAGetIndexBuffer,
1169 d3d10_device_GSGetConstantBuffers,
1170 d3d10_device_GSGetShader,
1171 d3d10_device_IAGetPrimitiveTopology,
1172 d3d10_device_VSGetShaderResources,
1173 d3d10_device_VSGetSamplers,
1174 d3d10_device_GetPredication,
1175 d3d10_device_GSGetShaderResources,
1176 d3d10_device_GSGetSamplers,
1177 d3d10_device_OMGetRenderTargets,
1178 d3d10_device_OMGetBlendState,
1179 d3d10_device_OMGetDepthStencilState,
1180 d3d10_device_SOGetTargets,
1181 d3d10_device_RSGetState,
1182 d3d10_device_RSGetViewports,
1183 d3d10_device_RSGetScissorRects,
1184 d3d10_device_GetDeviceRemovedReason,
1185 d3d10_device_SetExceptionMode,
1186 d3d10_device_GetExceptionMode,
1187 d3d10_device_GetPrivateData,
1188 d3d10_device_SetPrivateData,
1189 d3d10_device_SetPrivateDataInterface,
1190 d3d10_device_ClearState,
1191 d3d10_device_Flush,
1192 d3d10_device_CreateBuffer,
1193 d3d10_device_CreateTexture1D,
1194 d3d10_device_CreateTexture2D,
1195 d3d10_device_CreateTexture3D,
1196 d3d10_device_CreateShaderResourceView,
1197 d3d10_device_CreateRenderTargetView,
1198 d3d10_device_CreateDepthStencilView,
1199 d3d10_device_CreateInputLayout,
1200 d3d10_device_CreateVertexShader,
1201 d3d10_device_CreateGeometryShader,
1202 d3d10_device_CreateGeometryShaderWithStreamOutput,
1203 d3d10_device_CreatePixelShader,
1204 d3d10_device_CreateBlendState,
1205 d3d10_device_CreateDepthStencilState,
1206 d3d10_device_CreateRasterizerState,
1207 d3d10_device_CreateSamplerState,
1208 d3d10_device_CreateQuery,
1209 d3d10_device_CreatePredicate,
1210 d3d10_device_CreateCounter,
1211 d3d10_device_CheckFormatSupport,
1212 d3d10_device_CheckMultisampleQualityLevels,
1213 d3d10_device_CheckCounterInfo,
1214 d3d10_device_CheckCounter,
1215 d3d10_device_GetCreationFlags,
1216 d3d10_device_OpenSharedResource,
1217 d3d10_device_SetTextFilterSize,
1218 d3d10_device_GetTextFilterSize,
1221 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1223 /* IUnknown methods */
1224 d3d10_device_inner_QueryInterface,
1225 d3d10_device_inner_AddRef,
1226 d3d10_device_inner_Release,
1229 /* IWineD3DDeviceParent IUnknown methods */
1231 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1233 return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1236 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1238 struct d3d10_device *This = device_from_device_parent(iface);
1239 return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1242 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1244 struct d3d10_device *This = device_from_device_parent(iface);
1245 return d3d10_device_AddRef((ID3D10Device *)This);
1248 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1250 struct d3d10_device *This = device_from_device_parent(iface);
1251 return d3d10_device_Release((ID3D10Device *)This);
1254 /* IWineD3DDeviceParent methods */
1256 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1258 struct d3d10_device *This = device_from_device_parent(iface);
1260 TRACE("iface %p, device %p\n", iface, device);
1262 IWineD3DDevice_AddRef(device);
1263 This->wined3d_device = device;
1266 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1267 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1268 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1270 struct d3d10_device *This = device_from_device_parent(iface);
1271 struct d3d10_texture2d *texture;
1272 D3D10_TEXTURE2D_DESC desc;
1273 HRESULT hr;
1275 FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1276 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1277 iface, superior, width, height, format, usage, pool, level, face, surface);
1279 FIXME("Implement DXGI<->wined3d usage conversion\n");
1281 desc.Width = width;
1282 desc.Height = height;
1283 desc.MipLevels = 1;
1284 desc.ArraySize = 1;
1285 desc.Format = dxgi_format_from_wined3dformat(format);
1286 desc.SampleDesc.Count = 1;
1287 desc.SampleDesc.Quality = 0;
1288 desc.Usage = usage;
1289 desc.BindFlags = 0;
1290 desc.CPUAccessFlags = 0;
1291 desc.MiscFlags = 0;
1293 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1294 if (FAILED(hr))
1296 ERR("CreateTexture2D failed, returning %#x\n", hr);
1297 return hr;
1300 *surface = texture->wined3d_surface;
1302 return S_OK;
1305 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1306 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1307 DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1309 struct d3d10_device *This = device_from_device_parent(iface);
1310 struct d3d10_texture2d *texture;
1311 D3D10_TEXTURE2D_DESC desc;
1312 HRESULT hr;
1314 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1315 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1316 iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1318 FIXME("Implement DXGI<->wined3d usage conversion\n");
1320 desc.Width = width;
1321 desc.Height = height;
1322 desc.MipLevels = 1;
1323 desc.ArraySize = 1;
1324 desc.Format = dxgi_format_from_wined3dformat(format);
1325 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1326 desc.SampleDesc.Quality = multisample_quality;
1327 desc.Usage = D3D10_USAGE_DEFAULT;
1328 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1329 desc.CPUAccessFlags = 0;
1330 desc.MiscFlags = 0;
1332 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1333 if (FAILED(hr))
1335 ERR("CreateTexture2D failed, returning %#x\n", hr);
1336 return hr;
1339 *surface = texture->wined3d_surface;
1341 return S_OK;
1344 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1345 IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1346 DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1348 struct d3d10_device *This = device_from_device_parent(iface);
1349 struct d3d10_texture2d *texture;
1350 D3D10_TEXTURE2D_DESC desc;
1351 HRESULT hr;
1353 FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1354 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1355 iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1357 FIXME("Implement DXGI<->wined3d usage conversion\n");
1359 desc.Width = width;
1360 desc.Height = height;
1361 desc.MipLevels = 1;
1362 desc.ArraySize = 1;
1363 desc.Format = dxgi_format_from_wined3dformat(format);
1364 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1365 desc.SampleDesc.Quality = multisample_quality;
1366 desc.Usage = D3D10_USAGE_DEFAULT;
1367 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1368 desc.CPUAccessFlags = 0;
1369 desc.MiscFlags = 0;
1371 hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1372 if (FAILED(hr))
1374 ERR("CreateTexture2D failed, returning %#x\n", hr);
1375 return hr;
1378 *surface = texture->wined3d_surface;
1380 return S_OK;
1383 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1384 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1385 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1387 FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1388 iface, superior, width, height, depth, format, pool, usage, volume);
1390 return E_NOTIMPL;
1393 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1394 WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1396 IWineDXGIDevice *wine_device;
1397 HRESULT hr;
1399 TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1401 hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1402 if (FAILED(hr))
1404 ERR("Device should implement IWineDXGIDevice\n");
1405 return E_FAIL;
1408 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1409 IWineDXGIDevice_Release(wine_device);
1410 if (FAILED(hr))
1412 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1413 return hr;
1416 return S_OK;
1419 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1421 /* IUnknown methods */
1422 device_parent_QueryInterface,
1423 device_parent_AddRef,
1424 device_parent_Release,
1425 /* IWineD3DDeviceParent methods */
1426 device_parent_WineD3DDeviceCreated,
1427 device_parent_CreateSurface,
1428 device_parent_CreateRenderTarget,
1429 device_parent_CreateDepthStencilSurface,
1430 device_parent_CreateVolume,
1431 device_parent_CreateSwapChain,