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 static void STDMETHODCALLTYPE d3d10_null_wined3d_object_destroyed(void *parent) {}
29 const struct wined3d_parent_ops d3d10_null_wined3d_parent_ops =
31 d3d10_null_wined3d_object_destroyed,
34 /* Inner IUnknown methods */
36 static inline struct d3d10_device *impl_from_IUnknown(IUnknown *iface)
38 return CONTAINING_RECORD(iface, struct d3d10_device, IUnknown_inner);
41 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid,
44 struct d3d10_device *This = impl_from_IUnknown(iface);
46 TRACE("iface %p, riid %s, ppv %p\n", iface, debugstr_guid(riid), ppv);
48 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3D10Device))
49 *ppv = &This->ID3D10Device_iface;
50 else if (IsEqualGUID(riid, &IID_IWineDXGIDeviceParent))
51 *ppv = &This->IWineDXGIDeviceParent_iface;
54 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
59 IUnknown_AddRef((IUnknown*)*ppv);
63 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
65 struct d3d10_device *This = impl_from_IUnknown(iface);
66 ULONG refcount = InterlockedIncrement(&This->refcount);
68 TRACE("%p increasing refcount to %u\n", This, refcount);
73 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
75 struct d3d10_device *This = impl_from_IUnknown(iface);
76 ULONG refcount = InterlockedDecrement(&This->refcount);
78 TRACE("%p decreasing refcount to %u\n", This, refcount);
82 if (This->wined3d_device)
83 wined3d_device_decref(This->wined3d_device);
89 /* IUnknown methods */
91 static inline struct d3d10_device *impl_from_ID3D10Device(ID3D10Device *iface)
93 return CONTAINING_RECORD(iface, struct d3d10_device, ID3D10Device_iface);
96 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid,
99 struct d3d10_device *This = impl_from_ID3D10Device(iface);
100 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
103 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
105 struct d3d10_device *This = impl_from_ID3D10Device(iface);
106 return IUnknown_AddRef(This->outer_unk);
109 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
111 struct d3d10_device *This = impl_from_ID3D10Device(iface);
112 return IUnknown_Release(This->outer_unk);
115 /* ID3D10Device methods */
117 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
118 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
120 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
121 iface, start_slot, buffer_count, buffers);
124 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
125 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
127 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
128 iface, start_slot, view_count, views);
131 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface,
132 ID3D10PixelShader *shader)
134 struct d3d10_device *This = impl_from_ID3D10Device(iface);
135 struct d3d10_pixel_shader *ps = unsafe_impl_from_ID3D10PixelShader(shader);
137 TRACE("iface %p, shader %p\n", iface, shader);
139 wined3d_device_set_pixel_shader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
142 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
143 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
145 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
146 iface, start_slot, sampler_count, samplers);
149 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface,
150 ID3D10VertexShader *shader)
152 struct d3d10_device *This = impl_from_ID3D10Device(iface);
153 struct d3d10_vertex_shader *vs = unsafe_impl_from_ID3D10VertexShader(shader);
155 TRACE("iface %p, shader %p\n", iface, shader);
157 wined3d_device_set_vertex_shader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
160 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface, UINT index_count,
161 UINT start_index_location, INT base_vertex_location)
163 struct d3d10_device *This = impl_from_ID3D10Device(iface);
165 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
166 iface, index_count, start_index_location, base_vertex_location);
168 wined3d_device_set_base_vertex_index(This->wined3d_device, base_vertex_location);
169 wined3d_device_draw_indexed_primitive(This->wined3d_device, start_index_location, index_count);
172 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface, UINT vertex_count,
173 UINT start_vertex_location)
175 struct d3d10_device *This = impl_from_ID3D10Device(iface);
177 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
178 iface, vertex_count, start_vertex_location);
180 wined3d_device_draw_primitive(This->wined3d_device, start_vertex_location, vertex_count);
183 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
184 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
186 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
187 iface, start_slot, buffer_count, buffers);
190 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface,
191 ID3D10InputLayout *input_layout)
193 struct d3d10_device *This = impl_from_ID3D10Device(iface);
194 struct d3d10_input_layout *layout = unsafe_impl_from_ID3D10InputLayout(input_layout);
196 TRACE("iface %p, input_layout %p\n", iface, input_layout);
198 wined3d_device_set_vertex_declaration(This->wined3d_device,
199 layout ? layout->wined3d_decl : NULL);
202 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface, UINT start_slot,
203 UINT buffer_count, ID3D10Buffer *const *buffers, const UINT *strides, const UINT *offsets)
205 struct d3d10_device *This = impl_from_ID3D10Device(iface);
208 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
209 iface, start_slot, buffer_count, buffers, strides, offsets);
211 for (i = 0; i < buffer_count; ++i)
213 struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
215 wined3d_device_set_stream_source(This->wined3d_device, start_slot,
216 buffer ? buffer->wined3d_buffer : NULL, offsets[i], strides[i]);
220 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
221 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
223 struct d3d10_device *This = impl_from_ID3D10Device(iface);
224 struct d3d10_buffer *buffer_impl = unsafe_impl_from_ID3D10Buffer(buffer);
226 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
227 iface, buffer, debug_dxgi_format(format), offset);
229 wined3d_device_set_index_buffer(This->wined3d_device,
230 buffer_impl ? buffer_impl->wined3d_buffer : NULL,
231 wined3dformat_from_dxgi_format(format));
232 if (offset) FIXME("offset %u not supported.\n", offset);
235 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
236 UINT instance_index_count, UINT instance_count, UINT start_index_location,
237 INT base_vertex_location, UINT start_instance_location)
239 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
240 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
241 iface, instance_index_count, instance_count, start_index_location,
242 base_vertex_location, start_instance_location);
245 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
246 UINT instance_vertex_count, UINT instance_count,
247 UINT start_vertex_location, UINT start_instance_location)
249 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
250 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
251 start_vertex_location, start_instance_location);
254 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
255 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
257 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
258 iface, start_slot, buffer_count, buffers);
261 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
263 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
264 else WARN("iface %p, shader %p stub!\n", iface, shader);
267 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface,
268 D3D10_PRIMITIVE_TOPOLOGY topology)
270 struct d3d10_device *This = impl_from_ID3D10Device(iface);
272 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
274 wined3d_device_set_primitive_type(This->wined3d_device, (enum wined3d_primitive_type)topology);
277 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
278 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
280 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
281 iface, start_slot, view_count, views);
284 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
285 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
287 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
288 iface, start_slot, sampler_count, samplers);
291 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
293 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
296 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
297 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
299 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
300 iface, start_slot, view_count, views);
303 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
304 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
306 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
307 iface, start_slot, sampler_count, samplers);
310 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
311 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
312 ID3D10DepthStencilView *depth_stencil_view)
314 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
315 iface, render_target_view_count, render_target_views, depth_stencil_view);
318 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
319 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
321 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
322 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
325 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
326 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
328 struct d3d10_device *device = impl_from_ID3D10Device(iface);
330 TRACE("iface %p, depth_stencil_state %p, stencil_ref %u.\n",
331 iface, depth_stencil_state, stencil_ref);
333 device->depth_stencil_state = unsafe_impl_from_ID3D10DepthStencilState(depth_stencil_state);
334 device->stencil_ref = stencil_ref;
337 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
338 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
340 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
343 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
345 FIXME("iface %p stub!\n", iface);
348 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
350 struct d3d10_device *device = impl_from_ID3D10Device(iface);
352 TRACE("iface %p, rasterizer_state %p.\n", iface, rasterizer_state);
354 device->rasterizer_state = unsafe_impl_from_ID3D10RasterizerState(rasterizer_state);
357 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
358 UINT viewport_count, const D3D10_VIEWPORT *viewports)
360 struct d3d10_device *device = impl_from_ID3D10Device(iface);
361 struct wined3d_viewport wined3d_vp;
363 TRACE("iface %p, viewport_count %u, viewports %p.\n", iface, viewport_count, viewports);
365 if (viewport_count > 1)
366 FIXME("Multiple viewports not implemented.\n");
371 wined3d_vp.x = viewports[0].TopLeftX;
372 wined3d_vp.y = viewports[0].TopLeftY;
373 wined3d_vp.width = viewports[0].Width;
374 wined3d_vp.height = viewports[0].Height;
375 wined3d_vp.min_z = viewports[0].MinDepth;
376 wined3d_vp.max_z = viewports[0].MaxDepth;
378 wined3d_device_set_viewport(device->wined3d_device, &wined3d_vp);
381 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
382 UINT rect_count, const D3D10_RECT *rects)
384 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
387 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
388 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
389 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
391 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
392 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
393 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
394 src_resource, src_subresource_idx, src_box);
397 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
398 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
400 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
403 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
404 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
405 const void *data, UINT row_pitch, UINT depth_pitch)
407 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
408 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
411 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
412 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
414 struct d3d10_device *This = impl_from_ID3D10Device(iface);
415 struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
416 const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
418 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
419 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
421 wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color);
424 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
425 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
427 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
428 iface, depth_stencil_view, flags, depth, stencil);
431 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
433 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
436 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
437 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
438 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
440 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
441 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
442 iface, dst_resource, dst_subresource_idx,
443 src_resource, src_subresource_idx, debug_dxgi_format(format));
446 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
447 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
449 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
450 iface, start_slot, buffer_count, buffers);
453 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
454 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
456 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
457 iface, start_slot, view_count, views);
460 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
462 FIXME("iface %p, shader %p stub!\n", iface, shader);
465 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
466 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
468 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
469 iface, start_slot, sampler_count, samplers);
472 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
474 FIXME("iface %p, shader %p stub!\n", iface, shader);
477 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
478 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
480 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
481 iface, start_slot, buffer_count, buffers);
484 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
486 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
489 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
490 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
492 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
493 iface, start_slot, buffer_count, buffers, strides, offsets);
496 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
497 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
499 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
502 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
503 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
505 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
506 iface, start_slot, buffer_count, buffers);
509 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
511 FIXME("iface %p, shader %p stub!\n", iface, shader);
514 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface,
515 D3D10_PRIMITIVE_TOPOLOGY *topology)
517 struct d3d10_device *This = impl_from_ID3D10Device(iface);
519 TRACE("iface %p, topology %p\n", iface, topology);
521 wined3d_device_get_primitive_type(This->wined3d_device, (enum wined3d_primitive_type *)topology);
524 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
525 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
527 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
528 iface, start_slot, view_count, views);
531 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
532 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
534 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
535 iface, start_slot, sampler_count, samplers);
538 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
539 ID3D10Predicate **predicate, BOOL *value)
541 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
544 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
545 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
547 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
548 iface, start_slot, view_count, views);
551 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
552 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
554 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
555 iface, start_slot, sampler_count, samplers);
558 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
559 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
561 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
562 iface, view_count, render_target_views, depth_stencil_view);
565 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
566 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
568 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
569 iface, blend_state, blend_factor, sample_mask);
572 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
573 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
575 struct d3d10_device *device = impl_from_ID3D10Device(iface);
577 TRACE("iface %p, depth_stencil_state %p, stencil_ref %p.\n",
578 iface, depth_stencil_state, stencil_ref);
580 if ((*depth_stencil_state = device->depth_stencil_state
581 ? &device->depth_stencil_state->ID3D10DepthStencilState_iface : NULL))
582 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
583 *stencil_ref = device->stencil_ref;
586 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
587 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
589 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
590 iface, buffer_count, buffers, offsets);
593 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
595 struct d3d10_device *device = impl_from_ID3D10Device(iface);
597 TRACE("iface %p, rasterizer_state %p.\n", iface, rasterizer_state);
599 if ((*rasterizer_state = device->rasterizer_state ? &device->rasterizer_state->ID3D10RasterizerState_iface : NULL))
600 ID3D10RasterizerState_AddRef(*rasterizer_state);
603 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
604 UINT *viewport_count, D3D10_VIEWPORT *viewports)
606 struct d3d10_device *device = impl_from_ID3D10Device(iface);
607 struct wined3d_viewport wined3d_vp;
609 TRACE("iface %p, viewport_count %p, viewports %p.\n", iface, viewport_count, viewports);
617 if (!*viewport_count)
620 wined3d_device_get_viewport(device->wined3d_device, &wined3d_vp);
622 viewports[0].TopLeftX = wined3d_vp.x;
623 viewports[0].TopLeftY = wined3d_vp.y;
624 viewports[0].Width = wined3d_vp.width;
625 viewports[0].Height = wined3d_vp.height;
626 viewports[0].MinDepth = wined3d_vp.min_z;
627 viewports[0].MaxDepth = wined3d_vp.max_z;
629 if (*viewport_count > 1)
630 memset(&viewports[1], 0, (*viewport_count - 1) * sizeof(*viewports));
633 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
635 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
638 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
640 FIXME("iface %p stub!\n", iface);
645 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
647 FIXME("iface %p, flags %#x stub!\n", iface, flags);
652 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
654 FIXME("iface %p stub!\n", iface);
659 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
660 REFGUID guid, UINT *data_size, void *data)
662 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
663 iface, debugstr_guid(guid), data_size, data);
668 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
669 REFGUID guid, UINT data_size, const void *data)
671 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
672 iface, debugstr_guid(guid), data_size, data);
677 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
678 REFGUID guid, const IUnknown *data)
680 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
685 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
687 FIXME("iface %p stub!\n", iface);
690 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
692 FIXME("iface %p stub!\n", iface);
695 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
696 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
698 struct d3d10_device *This = impl_from_ID3D10Device(iface);
699 struct d3d10_buffer *object;
702 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
704 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
707 ERR("Failed to allocate D3D10 buffer object memory\n");
708 return E_OUTOFMEMORY;
711 hr = d3d10_buffer_init(object, This, desc, data);
714 WARN("Failed to initialize buffer, hr %#x.\n", hr);
715 HeapFree(GetProcessHeap(), 0, object);
719 *buffer = &object->ID3D10Buffer_iface;
721 TRACE("Created ID3D10Buffer %p\n", object);
726 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
727 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
729 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
734 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
735 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
736 ID3D10Texture2D **texture)
738 struct d3d10_device *This = impl_from_ID3D10Device(iface);
739 struct d3d10_texture2d *object;
742 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
744 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
747 ERR("Failed to allocate D3D10 texture2d object memory\n");
748 return E_OUTOFMEMORY;
751 hr = d3d10_texture2d_init(object, This, desc);
754 WARN("Failed to initialize texture, hr %#x.\n", hr);
755 HeapFree(GetProcessHeap(), 0, object);
759 *texture = &object->ID3D10Texture2D_iface;
761 TRACE("Created ID3D10Texture2D %p\n", object);
766 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
767 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
768 ID3D10Texture3D **texture)
770 struct d3d10_device *device = impl_from_ID3D10Device(iface);
771 struct d3d10_texture3d *object;
774 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
776 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
779 ERR("Failed to allocate D3D10 texture3d object memory.\n");
780 return E_OUTOFMEMORY;
783 hr = d3d10_texture3d_init(object, device, desc);
786 WARN("Failed to initialize texture, hr %#x.\n", hr);
787 HeapFree(GetProcessHeap(), 0, object);
791 TRACE("Created 3D texture %p.\n", object);
792 *texture = &object->ID3D10Texture3D_iface;
797 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
798 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
800 struct d3d10_shader_resource_view *object;
803 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
805 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
808 ERR("Failed to allocate D3D10 shader resource view object memory.\n");
809 return E_OUTOFMEMORY;
812 if (FAILED(hr = d3d10_shader_resource_view_init(object, resource, desc)))
814 WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
815 HeapFree(GetProcessHeap(), 0, object);
819 TRACE("Created shader resource view %p.\n", object);
820 *view = &object->ID3D10ShaderResourceView_iface;
825 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
826 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
828 struct d3d10_rendertarget_view *object;
831 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
833 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
836 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
837 return E_OUTOFMEMORY;
840 hr = d3d10_rendertarget_view_init(object, resource, desc);
843 WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
844 HeapFree(GetProcessHeap(), 0, object);
848 TRACE("Created rendertarget view %p.\n", object);
849 *view = &object->ID3D10RenderTargetView_iface;
854 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
855 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
857 struct d3d10_depthstencil_view *object;
860 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
862 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
865 ERR("Failed to allocate D3D10 depthstencil view object memory.\n");
866 return E_OUTOFMEMORY;
869 if (FAILED(hr = d3d10_depthstencil_view_init(object, resource, desc)))
871 WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
872 HeapFree(GetProcessHeap(), 0, object);
876 TRACE("Created depthstencil view %p.\n", object);
877 *view = &object->ID3D10DepthStencilView_iface;
882 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
883 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
884 const void *shader_byte_code, SIZE_T shader_byte_code_length,
885 ID3D10InputLayout **input_layout)
887 struct d3d10_device *This = impl_from_ID3D10Device(iface);
888 struct d3d10_input_layout *object;
891 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
892 "\tshader_byte_code_length %lu, input_layout %p\n",
893 iface, element_descs, element_count, shader_byte_code,
894 shader_byte_code_length, input_layout);
896 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
899 ERR("Failed to allocate D3D10 input layout object memory\n");
900 return E_OUTOFMEMORY;
903 hr = d3d10_input_layout_init(object, This, element_descs, element_count,
904 shader_byte_code, shader_byte_code_length);
907 WARN("Failed to initialize input layout, hr %#x.\n", hr);
908 HeapFree(GetProcessHeap(), 0, object);
912 TRACE("Created input layout %p.\n", object);
913 *input_layout = &object->ID3D10InputLayout_iface;
918 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
919 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
921 struct d3d10_device *This = impl_from_ID3D10Device(iface);
922 struct d3d10_vertex_shader *object;
925 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
926 iface, byte_code, byte_code_length, shader);
928 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
931 ERR("Failed to allocate D3D10 vertex shader object memory\n");
932 return E_OUTOFMEMORY;
935 hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
938 WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
939 HeapFree(GetProcessHeap(), 0, object);
943 TRACE("Created vertex shader %p.\n", object);
944 *shader = &object->ID3D10VertexShader_iface;
949 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
950 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
952 struct d3d10_device *This = impl_from_ID3D10Device(iface);
953 struct d3d10_geometry_shader *object;
956 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
957 iface, byte_code, byte_code_length, shader);
959 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
962 ERR("Failed to allocate D3D10 geometry shader object memory\n");
963 return E_OUTOFMEMORY;
966 hr = d3d10_geometry_shader_init(object, This, byte_code, byte_code_length);
969 WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
970 HeapFree(GetProcessHeap(), 0, object);
974 TRACE("Created geometry shader %p.\n", object);
975 *shader = &object->ID3D10GeometryShader_iface;
980 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
981 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
982 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
984 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
985 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
986 iface, byte_code, byte_code_length, output_stream_decls,
987 output_stream_decl_count, output_stream_stride, shader);
992 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
993 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
995 struct d3d10_device *This = impl_from_ID3D10Device(iface);
996 struct d3d10_pixel_shader *object;
999 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
1000 iface, byte_code, byte_code_length, shader);
1002 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1005 ERR("Failed to allocate D3D10 pixel shader object memory\n");
1006 return E_OUTOFMEMORY;
1009 hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
1012 WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
1013 HeapFree(GetProcessHeap(), 0, object);
1017 TRACE("Created pixel shader %p.\n", object);
1018 *shader = &object->ID3D10PixelShader_iface;
1023 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
1024 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
1026 struct d3d10_blend_state *object;
1029 TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
1031 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1034 ERR("Failed to allocate D3D10 blend state object memory.\n");
1035 return E_OUTOFMEMORY;
1038 hr = d3d10_blend_state_init(object);
1041 WARN("Failed to initialize blend state, hr %#x.\n", hr);
1042 HeapFree(GetProcessHeap(), 0, object);
1046 TRACE("Created blend state %p.\n", object);
1047 *blend_state = &object->ID3D10BlendState_iface;
1052 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
1053 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
1055 struct d3d10_depthstencil_state *object;
1058 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface, desc, depth_stencil_state);
1060 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1063 ERR("Failed to allocate D3D10 depthstencil state object memory.\n");
1064 return E_OUTOFMEMORY;
1067 hr = d3d10_depthstencil_state_init(object);
1070 WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
1071 HeapFree(GetProcessHeap(), 0, object);
1075 TRACE("Created depthstencil state %p.\n", object);
1076 *depth_stencil_state = &object->ID3D10DepthStencilState_iface;
1081 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1082 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1084 struct d3d10_rasterizer_state *object;
1087 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
1089 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1092 ERR("Failed to allocate D3D10 rasterizer state object memory.\n");
1093 return E_OUTOFMEMORY;
1096 hr = d3d10_rasterizer_state_init(object);
1099 WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
1100 HeapFree(GetProcessHeap(), 0, object);
1104 TRACE("Created rasterizer state %p.\n", object);
1105 *rasterizer_state = &object->ID3D10RasterizerState_iface;
1110 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1111 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1113 struct d3d10_sampler_state *object;
1116 TRACE("iface %p, desc %p, sampler_state %p.\n", iface, desc, sampler_state);
1118 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1121 ERR("Failed to allocate D3D10 sampler state object memory.\n");
1122 return E_OUTOFMEMORY;
1125 hr = d3d10_sampler_state_init(object);
1128 WARN("Failed to initialize sampler state, hr %#x.\n", hr);
1129 HeapFree(GetProcessHeap(), 0, object);
1133 TRACE("Created sampler state %p.\n", object);
1134 *sampler_state = &object->ID3D10SamplerState_iface;
1139 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1140 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1142 struct d3d10_query *object;
1145 TRACE("iface %p, desc %p, query %p.\n", iface, desc, query);
1147 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1150 ERR("Failed to allocate D3D10 query object memory.\n");
1151 return E_OUTOFMEMORY;
1154 hr = d3d10_query_init(object);
1157 WARN("Failed to initialize query, hr %#x.\n", hr);
1158 HeapFree(GetProcessHeap(), 0, object);
1162 TRACE("Created query %p.\n", object);
1163 *query = &object->ID3D10Query_iface;
1168 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1169 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1171 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1176 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1177 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1179 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1184 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1185 DXGI_FORMAT format, UINT *format_support)
1187 FIXME("iface %p, format %s, format_support %p stub!\n",
1188 iface, debug_dxgi_format(format), format_support);
1193 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1194 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1196 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1197 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1202 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1204 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1207 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1208 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1209 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1211 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1212 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1213 iface, desc, type, active_counters, name, name_length,
1214 units, units_length, description, description_length);
1219 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1221 FIXME("iface %p stub!\n", iface);
1226 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1227 HANDLE resource_handle, REFIID guid, void **resource)
1229 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1230 iface, resource_handle, debugstr_guid(guid), resource);
1235 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1237 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1240 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1242 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1245 static const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1247 /* IUnknown methods */
1248 d3d10_device_QueryInterface,
1249 d3d10_device_AddRef,
1250 d3d10_device_Release,
1251 /* ID3D10Device methods */
1252 d3d10_device_VSSetConstantBuffers,
1253 d3d10_device_PSSetShaderResources,
1254 d3d10_device_PSSetShader,
1255 d3d10_device_PSSetSamplers,
1256 d3d10_device_VSSetShader,
1257 d3d10_device_DrawIndexed,
1259 d3d10_device_PSSetConstantBuffers,
1260 d3d10_device_IASetInputLayout,
1261 d3d10_device_IASetVertexBuffers,
1262 d3d10_device_IASetIndexBuffer,
1263 d3d10_device_DrawIndexedInstanced,
1264 d3d10_device_DrawInstanced,
1265 d3d10_device_GSSetConstantBuffers,
1266 d3d10_device_GSSetShader,
1267 d3d10_device_IASetPrimitiveTopology,
1268 d3d10_device_VSSetShaderResources,
1269 d3d10_device_VSSetSamplers,
1270 d3d10_device_SetPredication,
1271 d3d10_device_GSSetShaderResources,
1272 d3d10_device_GSSetSamplers,
1273 d3d10_device_OMSetRenderTargets,
1274 d3d10_device_OMSetBlendState,
1275 d3d10_device_OMSetDepthStencilState,
1276 d3d10_device_SOSetTargets,
1277 d3d10_device_DrawAuto,
1278 d3d10_device_RSSetState,
1279 d3d10_device_RSSetViewports,
1280 d3d10_device_RSSetScissorRects,
1281 d3d10_device_CopySubresourceRegion,
1282 d3d10_device_CopyResource,
1283 d3d10_device_UpdateSubresource,
1284 d3d10_device_ClearRenderTargetView,
1285 d3d10_device_ClearDepthStencilView,
1286 d3d10_device_GenerateMips,
1287 d3d10_device_ResolveSubresource,
1288 d3d10_device_VSGetConstantBuffers,
1289 d3d10_device_PSGetShaderResources,
1290 d3d10_device_PSGetShader,
1291 d3d10_device_PSGetSamplers,
1292 d3d10_device_VSGetShader,
1293 d3d10_device_PSGetConstantBuffers,
1294 d3d10_device_IAGetInputLayout,
1295 d3d10_device_IAGetVertexBuffers,
1296 d3d10_device_IAGetIndexBuffer,
1297 d3d10_device_GSGetConstantBuffers,
1298 d3d10_device_GSGetShader,
1299 d3d10_device_IAGetPrimitiveTopology,
1300 d3d10_device_VSGetShaderResources,
1301 d3d10_device_VSGetSamplers,
1302 d3d10_device_GetPredication,
1303 d3d10_device_GSGetShaderResources,
1304 d3d10_device_GSGetSamplers,
1305 d3d10_device_OMGetRenderTargets,
1306 d3d10_device_OMGetBlendState,
1307 d3d10_device_OMGetDepthStencilState,
1308 d3d10_device_SOGetTargets,
1309 d3d10_device_RSGetState,
1310 d3d10_device_RSGetViewports,
1311 d3d10_device_RSGetScissorRects,
1312 d3d10_device_GetDeviceRemovedReason,
1313 d3d10_device_SetExceptionMode,
1314 d3d10_device_GetExceptionMode,
1315 d3d10_device_GetPrivateData,
1316 d3d10_device_SetPrivateData,
1317 d3d10_device_SetPrivateDataInterface,
1318 d3d10_device_ClearState,
1320 d3d10_device_CreateBuffer,
1321 d3d10_device_CreateTexture1D,
1322 d3d10_device_CreateTexture2D,
1323 d3d10_device_CreateTexture3D,
1324 d3d10_device_CreateShaderResourceView,
1325 d3d10_device_CreateRenderTargetView,
1326 d3d10_device_CreateDepthStencilView,
1327 d3d10_device_CreateInputLayout,
1328 d3d10_device_CreateVertexShader,
1329 d3d10_device_CreateGeometryShader,
1330 d3d10_device_CreateGeometryShaderWithStreamOutput,
1331 d3d10_device_CreatePixelShader,
1332 d3d10_device_CreateBlendState,
1333 d3d10_device_CreateDepthStencilState,
1334 d3d10_device_CreateRasterizerState,
1335 d3d10_device_CreateSamplerState,
1336 d3d10_device_CreateQuery,
1337 d3d10_device_CreatePredicate,
1338 d3d10_device_CreateCounter,
1339 d3d10_device_CheckFormatSupport,
1340 d3d10_device_CheckMultisampleQualityLevels,
1341 d3d10_device_CheckCounterInfo,
1342 d3d10_device_CheckCounter,
1343 d3d10_device_GetCreationFlags,
1344 d3d10_device_OpenSharedResource,
1345 d3d10_device_SetTextFilterSize,
1346 d3d10_device_GetTextFilterSize,
1349 static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1351 /* IUnknown methods */
1352 d3d10_device_inner_QueryInterface,
1353 d3d10_device_inner_AddRef,
1354 d3d10_device_inner_Release,
1357 static void STDMETHODCALLTYPE d3d10_subresource_destroyed(void *parent) {}
1359 static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
1361 d3d10_subresource_destroyed,
1364 /* IWineDXGIDeviceParent IUnknown methods */
1366 static inline struct d3d10_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
1368 return CONTAINING_RECORD(iface, struct d3d10_device, IWineDXGIDeviceParent_iface);
1371 static HRESULT STDMETHODCALLTYPE dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent *iface,
1372 REFIID riid, void **ppv)
1374 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1375 return IUnknown_QueryInterface(device->outer_unk, riid, ppv);
1378 static ULONG STDMETHODCALLTYPE dxgi_device_parent_AddRef(IWineDXGIDeviceParent *iface)
1380 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1381 return IUnknown_AddRef(device->outer_unk);
1384 static ULONG STDMETHODCALLTYPE dxgi_device_parent_Release(IWineDXGIDeviceParent *iface)
1386 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1387 return IUnknown_Release(device->outer_unk);
1390 static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
1391 IWineDXGIDeviceParent *iface)
1393 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1394 return &device->device_parent;
1397 static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl =
1399 /* IUnknown methods */
1400 dxgi_device_parent_QueryInterface,
1401 dxgi_device_parent_AddRef,
1402 dxgi_device_parent_Release,
1403 /* IWineDXGIDeviceParent methods */
1404 dxgi_device_parent_get_wined3d_device_parent,
1407 static inline struct d3d10_device *device_from_wined3d_device_parent(struct wined3d_device_parent *device_parent)
1409 return CONTAINING_RECORD(device_parent, struct d3d10_device, device_parent);
1412 static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
1413 struct wined3d_device *wined3d_device)
1415 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1417 TRACE("device_parent %p, wined3d_device %p.\n", device_parent, wined3d_device);
1419 wined3d_device_incref(wined3d_device);
1420 device->wined3d_device = wined3d_device;
1423 static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
1425 TRACE("device_parent %p.\n", device_parent);
1428 static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent,
1429 void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
1430 enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
1432 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1434 TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
1435 "\tpool %#x, level %u, face %u, surface %p.\n",
1436 device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
1438 return wined3d_surface_create(device->wined3d_device, width, height, format, level,
1439 usage, pool, WINED3D_MULTISAMPLE_NONE, 0, WINED3D_SURFACE_TYPE_OPENGL, 0, container_parent,
1440 &d3d10_null_wined3d_parent_ops, surface);
1443 static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
1444 void *container_parent, UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage,
1445 enum wined3d_multisample_type multisample_type, DWORD multisample_quality, struct wined3d_surface **surface)
1447 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1448 struct wined3d_resource *sub_resource;
1449 struct d3d10_texture2d *texture;
1450 D3D10_TEXTURE2D_DESC desc;
1453 FIXME("device_parent %p, container_parent %p, width %u, height %u, format_id %#x, usage %#x,\n"
1454 "\tmultisample_type %#x, multisample_quality %u, surface %p partial stub!\n",
1455 device_parent, container_parent, width, height, format_id, usage,
1456 multisample_type, multisample_quality, surface);
1458 FIXME("Implement DXGI<->wined3d usage conversion\n");
1461 desc.Height = height;
1464 desc.Format = dxgi_format_from_wined3dformat(format_id);
1465 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1466 desc.SampleDesc.Quality = multisample_quality;
1467 desc.Usage = D3D10_USAGE_DEFAULT;
1468 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1469 desc.CPUAccessFlags = 0;
1472 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1473 (ID3D10Texture2D **)&texture);
1476 ERR("CreateTexture2D failed, returning %#x\n", hr);
1480 sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, 0);
1481 *surface = wined3d_surface_from_resource(sub_resource);
1482 wined3d_surface_incref(*surface);
1483 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1488 static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
1489 void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
1490 enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume)
1494 TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
1495 "format %#x, pool %#x, usage %#x, volume %p.\n",
1496 device_parent, container_parent, width, height, depth,
1497 format, pool, usage, volume);
1499 hr = wined3d_volume_create(device_from_wined3d_device_parent(device_parent)->wined3d_device,
1500 width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
1503 WARN("Failed to create wined3d volume, hr %#x.\n", hr);
1510 static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
1511 struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
1513 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1514 IWineDXGIDevice *wine_device;
1517 TRACE("device_parent %p, desc %p, swapchain %p\n", device_parent, desc, swapchain);
1519 hr = d3d10_device_QueryInterface(&device->ID3D10Device_iface, &IID_IWineDXGIDevice,
1520 (void **)&wine_device);
1523 ERR("Device should implement IWineDXGIDevice\n");
1527 hr = IWineDXGIDevice_create_swapchain(wine_device, desc, swapchain);
1528 IWineDXGIDevice_Release(wine_device);
1531 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1538 static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
1540 device_parent_wined3d_device_created,
1541 device_parent_mode_changed,
1542 device_parent_create_swapchain_surface,
1543 device_parent_create_texture_surface,
1544 device_parent_create_volume,
1545 device_parent_create_swapchain,
1548 void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
1550 device->ID3D10Device_iface.lpVtbl = &d3d10_device_vtbl;
1551 device->IUnknown_inner.lpVtbl = &d3d10_device_inner_unknown_vtbl;
1552 device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
1553 device->device_parent.ops = &d3d10_wined3d_device_parent_ops;
1554 device->refcount = 1;
1555 /* COM aggregation always takes place */
1556 device->outer_unk = outer_unknown;