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
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);
48 if (IsEqualGUID(riid, &IID_IWineDXGIDeviceParent))
50 IWineDXGIDeviceParent_AddRef(&This->IWineDXGIDeviceParent_iface);
51 *object = &This->IWineDXGIDeviceParent_iface;
55 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
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);
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);
80 if (This->wined3d_device)
81 wined3d_device_decref(This->wined3d_device);
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 wined3d_device_set_pixel_shader(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 wined3d_device_set_vertex_shader(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 struct d3d10_device *This = (struct d3d10_device *)iface;
158 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
159 iface, index_count, start_index_location, base_vertex_location);
161 wined3d_device_set_base_vertex_index(This->wined3d_device, base_vertex_location);
162 wined3d_device_draw_indexed_primitive(This->wined3d_device, start_index_location, index_count);
165 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
166 UINT vertex_count, UINT start_vertex_location)
168 struct d3d10_device *This = (struct d3d10_device *)iface;
170 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
171 iface, vertex_count, start_vertex_location);
173 wined3d_device_draw_primitive(This->wined3d_device, start_vertex_location, vertex_count);
176 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
177 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
179 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
180 iface, start_slot, buffer_count, buffers);
183 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
185 struct d3d10_device *This = (struct d3d10_device *)iface;
187 TRACE("iface %p, input_layout %p\n", iface, input_layout);
189 wined3d_device_set_vertex_declaration(This->wined3d_device,
190 input_layout ? ((struct d3d10_input_layout *)input_layout)->wined3d_decl : NULL);
193 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
194 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
195 const UINT *strides, const UINT *offsets)
197 struct d3d10_device *This = (struct d3d10_device *)iface;
200 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
201 iface, start_slot, buffer_count, buffers, strides, offsets);
203 for (i = 0; i < buffer_count; ++i)
205 wined3d_device_set_stream_source(This->wined3d_device, start_slot,
206 buffers[i] ? ((struct d3d10_buffer *)buffers[i])->wined3d_buffer : NULL,
207 offsets[i], strides[i]);
211 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
212 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
214 struct d3d10_device *This = (struct d3d10_device *)iface;
216 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
217 iface, buffer, debug_dxgi_format(format), offset);
219 wined3d_device_set_index_buffer(This->wined3d_device,
220 buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
221 wined3dformat_from_dxgi_format(format));
222 if (offset) FIXME("offset %u not supported.\n", offset);
225 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
226 UINT instance_index_count, UINT instance_count, UINT start_index_location,
227 INT base_vertex_location, UINT start_instance_location)
229 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
230 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
231 iface, instance_index_count, instance_count, start_index_location,
232 base_vertex_location, start_instance_location);
235 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
236 UINT instance_vertex_count, UINT instance_count,
237 UINT start_vertex_location, UINT start_instance_location)
239 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
240 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
241 start_vertex_location, start_instance_location);
244 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
245 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
247 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
248 iface, start_slot, buffer_count, buffers);
251 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
253 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
254 else WARN("iface %p, shader %p stub!\n", iface, shader);
257 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
259 struct d3d10_device *This = (struct d3d10_device *)iface;
261 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
263 wined3d_device_set_primitive_type(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
266 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
267 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
269 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
270 iface, start_slot, view_count, views);
273 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
274 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
276 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
277 iface, start_slot, sampler_count, samplers);
280 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
282 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
285 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
286 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
288 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
289 iface, start_slot, view_count, views);
292 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
293 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
295 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
296 iface, start_slot, sampler_count, samplers);
299 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
300 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
301 ID3D10DepthStencilView *depth_stencil_view)
303 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
304 iface, render_target_view_count, render_target_views, depth_stencil_view);
307 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
308 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
310 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
311 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
314 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
315 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
317 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
318 iface, depth_stencil_state, stencil_ref);
321 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
322 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
324 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
327 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
329 FIXME("iface %p stub!\n", iface);
332 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
334 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
337 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
338 UINT viewport_count, const D3D10_VIEWPORT *viewports)
340 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
343 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
344 UINT rect_count, const D3D10_RECT *rects)
346 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
349 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
350 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
351 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
353 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
354 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
355 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
356 src_resource, src_subresource_idx, src_box);
359 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
360 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
362 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
365 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
366 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
367 const void *data, UINT row_pitch, UINT depth_pitch)
369 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
370 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
373 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
374 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
376 struct d3d10_device *This = (struct d3d10_device *)iface;
377 struct wined3d_rendertarget_view *wined3d_view;
378 const WINED3DCOLORVALUE color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
380 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
381 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
383 wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
384 wined3d_device_clear_rendertarget_view(This->wined3d_device, wined3d_view, &color);
387 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
388 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
390 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
391 iface, depth_stencil_view, flags, depth, stencil);
394 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
396 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
399 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
400 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
401 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
403 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
404 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
405 iface, dst_resource, dst_subresource_idx,
406 src_resource, src_subresource_idx, debug_dxgi_format(format));
409 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
410 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
412 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
413 iface, start_slot, buffer_count, buffers);
416 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
417 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
419 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
420 iface, start_slot, view_count, views);
423 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
425 FIXME("iface %p, shader %p stub!\n", iface, shader);
428 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
429 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
431 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
432 iface, start_slot, sampler_count, samplers);
435 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
437 FIXME("iface %p, shader %p stub!\n", iface, shader);
440 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
441 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
443 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
444 iface, start_slot, buffer_count, buffers);
447 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
449 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
452 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
453 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
455 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
456 iface, start_slot, buffer_count, buffers, strides, offsets);
459 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
460 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
462 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
465 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
466 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
468 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
469 iface, start_slot, buffer_count, buffers);
472 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
474 FIXME("iface %p, shader %p stub!\n", iface, shader);
477 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
479 struct d3d10_device *This = (struct d3d10_device *)iface;
481 TRACE("iface %p, topology %p\n", iface, topology);
483 wined3d_device_get_primitive_type(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
486 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
487 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
489 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
490 iface, start_slot, view_count, views);
493 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
494 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
496 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
497 iface, start_slot, sampler_count, samplers);
500 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
501 ID3D10Predicate **predicate, BOOL *value)
503 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
506 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
507 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
509 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
510 iface, start_slot, view_count, views);
513 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
514 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
516 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
517 iface, start_slot, sampler_count, samplers);
520 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
521 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
523 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
524 iface, view_count, render_target_views, depth_stencil_view);
527 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
528 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
530 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
531 iface, blend_state, blend_factor, sample_mask);
534 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
535 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
537 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
538 iface, depth_stencil_state, stencil_ref);
541 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
542 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
544 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
545 iface, buffer_count, buffers, offsets);
548 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
550 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
553 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
554 UINT *viewport_count, D3D10_VIEWPORT *viewports)
556 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
559 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
561 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
564 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
566 FIXME("iface %p stub!\n", iface);
571 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
573 FIXME("iface %p, flags %#x stub!\n", iface, flags);
578 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
580 FIXME("iface %p stub!\n", iface);
585 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
586 REFGUID guid, UINT *data_size, void *data)
588 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
589 iface, debugstr_guid(guid), data_size, data);
594 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
595 REFGUID guid, UINT data_size, const void *data)
597 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
598 iface, debugstr_guid(guid), data_size, data);
603 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
604 REFGUID guid, const IUnknown *data)
606 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
611 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
613 FIXME("iface %p stub!\n", iface);
616 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
618 FIXME("iface %p stub!\n", iface);
621 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
622 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
624 struct d3d10_device *This = (struct d3d10_device *)iface;
625 struct d3d10_buffer *object;
628 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
630 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
633 ERR("Failed to allocate D3D10 buffer object memory\n");
634 return E_OUTOFMEMORY;
637 hr = d3d10_buffer_init(object, This, desc, data);
640 WARN("Failed to initialize buffer, hr %#x.\n", hr);
641 HeapFree(GetProcessHeap(), 0, object);
645 *buffer = (ID3D10Buffer *)object;
647 TRACE("Created ID3D10Buffer %p\n", object);
652 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
653 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
655 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
660 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
661 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
663 struct d3d10_device *This = (struct d3d10_device *)iface;
664 struct d3d10_texture2d *object;
667 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
669 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
672 ERR("Failed to allocate D3D10 texture2d object memory\n");
673 return E_OUTOFMEMORY;
676 hr = d3d10_texture2d_init(object, This, desc);
679 WARN("Failed to initialize texture, hr %#x.\n", hr);
680 HeapFree(GetProcessHeap(), 0, object);
684 *texture = (ID3D10Texture2D *)object;
686 TRACE("Created ID3D10Texture2D %p\n", object);
691 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
692 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
694 struct d3d10_device *device = (struct d3d10_device *)iface;
695 struct d3d10_texture3d *object;
698 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
700 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
703 ERR("Failed to allocate D3D10 texture3d object memory.\n");
704 return E_OUTOFMEMORY;
707 hr = d3d10_texture3d_init(object, device, desc);
710 WARN("Failed to initialize texture, hr %#x.\n", hr);
711 HeapFree(GetProcessHeap(), 0, object);
715 TRACE("Created 3D texture %p.\n", object);
716 *texture = (ID3D10Texture3D *)object;
721 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
722 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
724 struct d3d10_shader_resource_view *object;
727 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
729 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
732 ERR("Failed to allocate D3D10 shader resource view object memory.\n");
733 return E_OUTOFMEMORY;
736 hr = d3d10_shader_resource_view_init(object);
739 WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
740 HeapFree(GetProcessHeap(), 0, object);
744 TRACE("Created shader resource view %p.\n", object);
745 *view = (ID3D10ShaderResourceView *)object;
750 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
751 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
753 struct d3d10_rendertarget_view *object;
756 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
758 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
761 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
762 return E_OUTOFMEMORY;
765 hr = d3d10_rendertarget_view_init(object, resource, desc);
768 WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
769 HeapFree(GetProcessHeap(), 0, object);
773 TRACE("Created rendertarget view %p.\n", object);
774 *view = (ID3D10RenderTargetView *)object;
779 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
780 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
782 struct d3d10_depthstencil_view *object;
785 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
787 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
790 ERR("Failed to allocate D3D10 depthstencil view object memory.\n");
791 return E_OUTOFMEMORY;
794 hr = d3d10_depthstencil_view_init(object);
797 WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
798 HeapFree(GetProcessHeap(), 0, object);
802 TRACE("Created depthstencil view %p.\n", object);
803 *view = (ID3D10DepthStencilView *)object;
808 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
809 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
810 SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
812 struct d3d10_device *This = (struct d3d10_device *)iface;
813 struct d3d10_input_layout *object;
816 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
817 "\tshader_byte_code_length %lu, input_layout %p\n",
818 iface, element_descs, element_count, shader_byte_code,
819 shader_byte_code_length, input_layout);
821 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
824 ERR("Failed to allocate D3D10 input layout object memory\n");
825 return E_OUTOFMEMORY;
828 hr = d3d10_input_layout_init(object, This, element_descs, element_count,
829 shader_byte_code, shader_byte_code_length);
832 WARN("Failed to initialize input layout, hr %#x.\n", hr);
833 HeapFree(GetProcessHeap(), 0, object);
837 TRACE("Created input layout %p.\n", object);
838 *input_layout = (ID3D10InputLayout *)object;
843 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
844 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
846 struct d3d10_device *This = (struct d3d10_device *)iface;
847 struct d3d10_vertex_shader *object;
850 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
851 iface, byte_code, byte_code_length, shader);
853 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
856 ERR("Failed to allocate D3D10 vertex shader object memory\n");
857 return E_OUTOFMEMORY;
860 hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
863 WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
864 HeapFree(GetProcessHeap(), 0, object);
868 TRACE("Created vertex shader %p.\n", object);
869 *shader = (ID3D10VertexShader *)object;
874 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
875 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
877 struct d3d10_device *This = (struct d3d10_device *)iface;
878 struct d3d10_geometry_shader *object;
881 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
882 iface, byte_code, byte_code_length, shader);
884 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
887 ERR("Failed to allocate D3D10 geometry shader object memory\n");
888 return E_OUTOFMEMORY;
891 hr = d3d10_geometry_shader_init(object, This, byte_code, byte_code_length);
894 WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
895 HeapFree(GetProcessHeap(), 0, object);
898 TRACE("Created geometry shader %p.\n", object);
899 *shader = (ID3D10GeometryShader *)object;
904 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
905 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
906 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
908 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
909 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
910 iface, byte_code, byte_code_length, output_stream_decls,
911 output_stream_decl_count, output_stream_stride, shader);
916 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
917 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
919 struct d3d10_device *This = (struct d3d10_device *)iface;
920 struct d3d10_pixel_shader *object;
923 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
924 iface, byte_code, byte_code_length, shader);
926 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
929 ERR("Failed to allocate D3D10 pixel shader object memory\n");
930 return E_OUTOFMEMORY;
933 hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
936 WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
937 HeapFree(GetProcessHeap(), 0, object);
941 TRACE("Created pixel shader %p.\n", object);
942 *shader = (ID3D10PixelShader *)object;
947 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
948 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
950 struct d3d10_blend_state *object;
953 TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
955 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
958 ERR("Failed to allocate D3D10 blend state object memory.\n");
959 return E_OUTOFMEMORY;
962 hr = d3d10_blend_state_init(object);
965 WARN("Failed to initialize blend state, hr %#x.\n", hr);
966 HeapFree(GetProcessHeap(), 0, object);
970 TRACE("Created blend state %p.\n", object);
971 *blend_state = (ID3D10BlendState *)object;
976 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
977 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
979 struct d3d10_depthstencil_state *object;
982 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface, desc, depth_stencil_state);
984 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
987 ERR("Failed to allocate D3D10 depthstencil state object memory.\n");
988 return E_OUTOFMEMORY;
991 hr = d3d10_depthstencil_state_init(object);
994 WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
995 HeapFree(GetProcessHeap(), 0, object);
999 TRACE("Created depthstencil state %p.\n", object);
1000 *depth_stencil_state = (ID3D10DepthStencilState *)object;
1005 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1006 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1008 struct d3d10_rasterizer_state *object;
1011 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
1013 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1016 ERR("Failed to allocate D3D10 rasterizer state object memory.\n");
1017 return E_OUTOFMEMORY;
1020 hr = d3d10_rasterizer_state_init(object);
1023 WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
1024 HeapFree(GetProcessHeap(), 0, object);
1028 TRACE("Created rasterizer state %p.\n", object);
1029 *rasterizer_state = (ID3D10RasterizerState *)object;
1034 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1035 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1037 struct d3d10_sampler_state *object;
1040 FIXME("iface %p, desc %p, sampler_state %p.\n", iface, desc, sampler_state);
1042 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1045 ERR("Failed to allocate D3D10 sampler state object memory.\n");
1046 return E_OUTOFMEMORY;
1049 hr = d3d10_sampler_state_init(object);
1052 WARN("Failed to initialize sampler state, hr %#x.\n", hr);
1053 HeapFree(GetProcessHeap(), 0, object);
1057 TRACE("Created sampler state %p.\n", object);
1058 *sampler_state = (ID3D10SamplerState *)object;
1063 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1064 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1066 struct d3d10_query *object;
1069 TRACE("iface %p, desc %p, query %p.\n", iface, desc, query);
1071 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1074 ERR("Failed to allocate D3D10 query object memory.\n");
1075 return E_OUTOFMEMORY;
1078 hr = d3d10_query_init(object);
1081 WARN("Failed to initialize query, hr %#x.\n", hr);
1082 HeapFree(GetProcessHeap(), 0, object);
1086 TRACE("Created query %p.\n", object);
1087 *query = (ID3D10Query *)object;
1092 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1093 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1095 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1100 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1101 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1103 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1108 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1109 DXGI_FORMAT format, UINT *format_support)
1111 FIXME("iface %p, format %s, format_support %p stub!\n",
1112 iface, debug_dxgi_format(format), format_support);
1117 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1118 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1120 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1121 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1126 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1128 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1131 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1132 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1133 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1135 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1136 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1137 iface, desc, type, active_counters, name, name_length,
1138 units, units_length, description, description_length);
1143 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1145 FIXME("iface %p stub!\n", iface);
1150 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1151 HANDLE resource_handle, REFIID guid, void **resource)
1153 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1154 iface, resource_handle, debugstr_guid(guid), resource);
1159 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1161 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1164 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1166 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1169 static const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1171 /* IUnknown methods */
1172 d3d10_device_QueryInterface,
1173 d3d10_device_AddRef,
1174 d3d10_device_Release,
1175 /* ID3D10Device methods */
1176 d3d10_device_VSSetConstantBuffers,
1177 d3d10_device_PSSetShaderResources,
1178 d3d10_device_PSSetShader,
1179 d3d10_device_PSSetSamplers,
1180 d3d10_device_VSSetShader,
1181 d3d10_device_DrawIndexed,
1183 d3d10_device_PSSetConstantBuffers,
1184 d3d10_device_IASetInputLayout,
1185 d3d10_device_IASetVertexBuffers,
1186 d3d10_device_IASetIndexBuffer,
1187 d3d10_device_DrawIndexedInstanced,
1188 d3d10_device_DrawInstanced,
1189 d3d10_device_GSSetConstantBuffers,
1190 d3d10_device_GSSetShader,
1191 d3d10_device_IASetPrimitiveTopology,
1192 d3d10_device_VSSetShaderResources,
1193 d3d10_device_VSSetSamplers,
1194 d3d10_device_SetPredication,
1195 d3d10_device_GSSetShaderResources,
1196 d3d10_device_GSSetSamplers,
1197 d3d10_device_OMSetRenderTargets,
1198 d3d10_device_OMSetBlendState,
1199 d3d10_device_OMSetDepthStencilState,
1200 d3d10_device_SOSetTargets,
1201 d3d10_device_DrawAuto,
1202 d3d10_device_RSSetState,
1203 d3d10_device_RSSetViewports,
1204 d3d10_device_RSSetScissorRects,
1205 d3d10_device_CopySubresourceRegion,
1206 d3d10_device_CopyResource,
1207 d3d10_device_UpdateSubresource,
1208 d3d10_device_ClearRenderTargetView,
1209 d3d10_device_ClearDepthStencilView,
1210 d3d10_device_GenerateMips,
1211 d3d10_device_ResolveSubresource,
1212 d3d10_device_VSGetConstantBuffers,
1213 d3d10_device_PSGetShaderResources,
1214 d3d10_device_PSGetShader,
1215 d3d10_device_PSGetSamplers,
1216 d3d10_device_VSGetShader,
1217 d3d10_device_PSGetConstantBuffers,
1218 d3d10_device_IAGetInputLayout,
1219 d3d10_device_IAGetVertexBuffers,
1220 d3d10_device_IAGetIndexBuffer,
1221 d3d10_device_GSGetConstantBuffers,
1222 d3d10_device_GSGetShader,
1223 d3d10_device_IAGetPrimitiveTopology,
1224 d3d10_device_VSGetShaderResources,
1225 d3d10_device_VSGetSamplers,
1226 d3d10_device_GetPredication,
1227 d3d10_device_GSGetShaderResources,
1228 d3d10_device_GSGetSamplers,
1229 d3d10_device_OMGetRenderTargets,
1230 d3d10_device_OMGetBlendState,
1231 d3d10_device_OMGetDepthStencilState,
1232 d3d10_device_SOGetTargets,
1233 d3d10_device_RSGetState,
1234 d3d10_device_RSGetViewports,
1235 d3d10_device_RSGetScissorRects,
1236 d3d10_device_GetDeviceRemovedReason,
1237 d3d10_device_SetExceptionMode,
1238 d3d10_device_GetExceptionMode,
1239 d3d10_device_GetPrivateData,
1240 d3d10_device_SetPrivateData,
1241 d3d10_device_SetPrivateDataInterface,
1242 d3d10_device_ClearState,
1244 d3d10_device_CreateBuffer,
1245 d3d10_device_CreateTexture1D,
1246 d3d10_device_CreateTexture2D,
1247 d3d10_device_CreateTexture3D,
1248 d3d10_device_CreateShaderResourceView,
1249 d3d10_device_CreateRenderTargetView,
1250 d3d10_device_CreateDepthStencilView,
1251 d3d10_device_CreateInputLayout,
1252 d3d10_device_CreateVertexShader,
1253 d3d10_device_CreateGeometryShader,
1254 d3d10_device_CreateGeometryShaderWithStreamOutput,
1255 d3d10_device_CreatePixelShader,
1256 d3d10_device_CreateBlendState,
1257 d3d10_device_CreateDepthStencilState,
1258 d3d10_device_CreateRasterizerState,
1259 d3d10_device_CreateSamplerState,
1260 d3d10_device_CreateQuery,
1261 d3d10_device_CreatePredicate,
1262 d3d10_device_CreateCounter,
1263 d3d10_device_CheckFormatSupport,
1264 d3d10_device_CheckMultisampleQualityLevels,
1265 d3d10_device_CheckCounterInfo,
1266 d3d10_device_CheckCounter,
1267 d3d10_device_GetCreationFlags,
1268 d3d10_device_OpenSharedResource,
1269 d3d10_device_SetTextFilterSize,
1270 d3d10_device_GetTextFilterSize,
1273 static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1275 /* IUnknown methods */
1276 d3d10_device_inner_QueryInterface,
1277 d3d10_device_inner_AddRef,
1278 d3d10_device_inner_Release,
1281 static void STDMETHODCALLTYPE d3d10_subresource_destroyed(void *parent) {}
1283 static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
1285 d3d10_subresource_destroyed,
1288 /* IWineDXGIDeviceParent IUnknown methods */
1290 static inline struct d3d10_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
1292 return CONTAINING_RECORD(iface, struct d3d10_device, IWineDXGIDeviceParent_iface);
1295 static HRESULT STDMETHODCALLTYPE dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent *iface,
1296 REFIID riid, void **object)
1298 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1299 return d3d10_device_QueryInterface((ID3D10Device *)device, riid, object);
1302 static ULONG STDMETHODCALLTYPE dxgi_device_parent_AddRef(IWineDXGIDeviceParent *iface)
1304 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1305 return d3d10_device_AddRef((ID3D10Device *)device);
1308 static ULONG STDMETHODCALLTYPE dxgi_device_parent_Release(IWineDXGIDeviceParent *iface)
1310 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1311 return d3d10_device_Release((ID3D10Device *)device);
1314 static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
1315 IWineDXGIDeviceParent *iface)
1317 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1318 return &device->device_parent;
1321 static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl =
1323 /* IUnknown methods */
1324 dxgi_device_parent_QueryInterface,
1325 dxgi_device_parent_AddRef,
1326 dxgi_device_parent_Release,
1327 /* IWineDXGIDeviceParent methods */
1328 dxgi_device_parent_get_wined3d_device_parent,
1331 static inline struct d3d10_device *device_from_wined3d_device_parent(struct wined3d_device_parent *device_parent)
1333 return CONTAINING_RECORD(device_parent, struct d3d10_device, device_parent);
1336 static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
1337 struct wined3d_device *wined3d_device)
1339 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1341 TRACE("device_parent %p, wined3d_device %p.\n", device_parent, wined3d_device);
1343 wined3d_device_incref(wined3d_device);
1344 device->wined3d_device = wined3d_device;
1347 static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
1348 void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
1349 WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
1351 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1352 struct d3d10_texture2d *texture;
1353 D3D10_TEXTURE2D_DESC desc;
1356 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
1357 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1358 device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
1360 FIXME("Implement DXGI<->wined3d usage conversion\n");
1363 desc.Height = height;
1366 desc.Format = dxgi_format_from_wined3dformat(format);
1367 desc.SampleDesc.Count = 1;
1368 desc.SampleDesc.Quality = 0;
1371 desc.CPUAccessFlags = 0;
1374 hr = d3d10_device_CreateTexture2D((ID3D10Device *)device, &desc, NULL, (ID3D10Texture2D **)&texture);
1377 ERR("CreateTexture2D failed, returning %#x\n", hr);
1381 *surface = texture->wined3d_surface;
1382 wined3d_surface_incref(*surface);
1383 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1388 static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
1389 void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
1390 WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
1391 struct wined3d_surface **surface)
1393 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1394 struct d3d10_texture2d *texture;
1395 D3D10_TEXTURE2D_DESC desc;
1398 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1399 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1400 device_parent, container_parent, width, height, format, multisample_type,
1401 multisample_quality, lockable, surface);
1403 FIXME("Implement DXGI<->wined3d usage conversion\n");
1406 desc.Height = height;
1409 desc.Format = dxgi_format_from_wined3dformat(format);
1410 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1411 desc.SampleDesc.Quality = multisample_quality;
1412 desc.Usage = D3D10_USAGE_DEFAULT;
1413 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1414 desc.CPUAccessFlags = 0;
1417 hr = d3d10_device_CreateTexture2D((ID3D10Device *)device, &desc, NULL, (ID3D10Texture2D **)&texture);
1420 ERR("CreateTexture2D failed, returning %#x\n", hr);
1424 *surface = texture->wined3d_surface;
1425 wined3d_surface_incref(*surface);
1426 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1431 static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
1432 UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
1433 DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
1435 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1436 struct d3d10_texture2d *texture;
1437 D3D10_TEXTURE2D_DESC desc;
1440 FIXME("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1441 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1442 device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
1444 FIXME("Implement DXGI<->wined3d usage conversion\n");
1447 desc.Height = height;
1450 desc.Format = dxgi_format_from_wined3dformat(format);
1451 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1452 desc.SampleDesc.Quality = multisample_quality;
1453 desc.Usage = D3D10_USAGE_DEFAULT;
1454 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1455 desc.CPUAccessFlags = 0;
1458 hr = d3d10_device_CreateTexture2D((ID3D10Device *)device, &desc, NULL, (ID3D10Texture2D **)&texture);
1461 ERR("CreateTexture2D failed, returning %#x\n", hr);
1465 *surface = texture->wined3d_surface;
1466 wined3d_surface_incref(*surface);
1467 ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1472 static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
1473 void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
1474 WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
1478 TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
1479 "format %#x, pool %#x, usage %#x, volume %p.\n",
1480 device_parent, container_parent, width, height, depth,
1481 format, pool, usage, volume);
1483 hr = wined3d_volume_create(device_from_wined3d_device_parent(device_parent)->wined3d_device,
1484 width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
1487 WARN("Failed to create wined3d volume, hr %#x.\n", hr);
1494 static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
1495 WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
1497 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1498 IWineDXGIDevice *wine_device;
1501 TRACE("device_parent %p, present_parameters %p, swapchain %p\n", device_parent, present_parameters, swapchain);
1503 hr = d3d10_device_QueryInterface((ID3D10Device *)device, &IID_IWineDXGIDevice, (void **)&wine_device);
1506 ERR("Device should implement IWineDXGIDevice\n");
1510 hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1511 IWineDXGIDevice_Release(wine_device);
1514 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1521 static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
1523 device_parent_wined3d_device_created,
1524 device_parent_create_surface,
1525 device_parent_create_rendertarget,
1526 device_parent_create_depth_stencil,
1527 device_parent_create_volume,
1528 device_parent_create_swapchain,
1531 void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
1533 device->vtbl = &d3d10_device_vtbl;
1534 device->inner_unknown_vtbl = &d3d10_device_inner_unknown_vtbl;
1535 device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
1536 device->device_parent.ops = &d3d10_wined3d_device_parent_ops;
1537 device->refcount = 1;
1538 device->outer_unknown = outer_unknown;