regedit: An English (United States) spelling fix.
[wine/multimedia.git] / dlls / d3d10core / device.c
blob7ca440939d1077fe14369840be9b1541e8090af7
1 /*
2 * Copyright 2008-2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
21 #include "wine/port.h"
23 #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 ID3D10Device_AddRef(&This->ID3D10Device_iface);
44 *object = This;
45 return S_OK;
48 if (IsEqualGUID(riid, &IID_IWineDXGIDeviceParent))
50 IWineDXGIDeviceParent_AddRef(&This->IWineDXGIDeviceParent_iface);
51 *object = &This->IWineDXGIDeviceParent_iface;
52 return S_OK;
55 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
57 *object = NULL;
58 return E_NOINTERFACE;
61 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
63 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
64 ULONG refcount = InterlockedIncrement(&This->refcount);
66 TRACE("%p increasing refcount to %u\n", This, refcount);
68 return refcount;
71 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
73 struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
74 ULONG refcount = InterlockedDecrement(&This->refcount);
76 TRACE("%p decreasing refcount to %u\n", This, refcount);
78 if (!refcount)
80 if (This->wined3d_device)
81 wined3d_device_decref(This->wined3d_device);
84 return refcount;
87 /* IUnknown methods */
89 static inline struct d3d10_device *impl_from_ID3D10Device(ID3D10Device *iface)
91 return CONTAINING_RECORD(iface, struct d3d10_device, ID3D10Device_iface);
94 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid,
95 void **object)
97 struct d3d10_device *This = impl_from_ID3D10Device(iface);
98 TRACE("Forwarding to outer IUnknown\n");
99 return IUnknown_QueryInterface(This->outer_unknown, riid, object);
102 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
104 struct d3d10_device *This = impl_from_ID3D10Device(iface);
105 TRACE("Forwarding to outer IUnknown\n");
106 return IUnknown_AddRef(This->outer_unknown);
109 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
111 struct d3d10_device *This = impl_from_ID3D10Device(iface);
112 TRACE("Forwarding to outer IUnknown\n");
113 return IUnknown_Release(This->outer_unknown);
116 /* ID3D10Device methods */
118 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
119 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
121 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
122 iface, start_slot, buffer_count, buffers);
125 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
126 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
128 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
129 iface, start_slot, view_count, views);
132 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface,
133 ID3D10PixelShader *shader)
135 struct d3d10_device *This = impl_from_ID3D10Device(iface);
136 struct d3d10_pixel_shader *ps = unsafe_impl_from_ID3D10PixelShader(shader);
138 TRACE("iface %p, shader %p\n", iface, shader);
140 wined3d_device_set_pixel_shader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
143 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
144 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
146 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
147 iface, start_slot, sampler_count, samplers);
150 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface,
151 ID3D10VertexShader *shader)
153 struct d3d10_device *This = impl_from_ID3D10Device(iface);
154 struct d3d10_vertex_shader *vs = unsafe_impl_from_ID3D10VertexShader(shader);
156 TRACE("iface %p, shader %p\n", iface, shader);
158 wined3d_device_set_vertex_shader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
161 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface, UINT index_count,
162 UINT start_index_location, INT base_vertex_location)
164 struct d3d10_device *This = impl_from_ID3D10Device(iface);
166 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
167 iface, index_count, start_index_location, base_vertex_location);
169 wined3d_device_set_base_vertex_index(This->wined3d_device, base_vertex_location);
170 wined3d_device_draw_indexed_primitive(This->wined3d_device, start_index_location, index_count);
173 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface, UINT vertex_count,
174 UINT start_vertex_location)
176 struct d3d10_device *This = impl_from_ID3D10Device(iface);
178 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
179 iface, vertex_count, start_vertex_location);
181 wined3d_device_draw_primitive(This->wined3d_device, start_vertex_location, vertex_count);
184 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
185 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
187 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
188 iface, start_slot, buffer_count, buffers);
191 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface,
192 ID3D10InputLayout *input_layout)
194 struct d3d10_device *This = impl_from_ID3D10Device(iface);
195 struct d3d10_input_layout *layout = unsafe_impl_from_ID3D10InputLayout(input_layout);
197 TRACE("iface %p, input_layout %p\n", iface, input_layout);
199 wined3d_device_set_vertex_declaration(This->wined3d_device,
200 layout ? layout->wined3d_decl : NULL);
203 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface, UINT start_slot,
204 UINT buffer_count, ID3D10Buffer *const *buffers, const UINT *strides, const UINT *offsets)
206 struct d3d10_device *This = impl_from_ID3D10Device(iface);
207 unsigned int i;
209 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
210 iface, start_slot, buffer_count, buffers, strides, offsets);
212 for (i = 0; i < buffer_count; ++i)
214 wined3d_device_set_stream_source(This->wined3d_device, start_slot,
215 buffers[i] ? ((struct d3d10_buffer *)buffers[i])->wined3d_buffer : NULL,
216 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);
225 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
226 iface, buffer, debug_dxgi_format(format), offset);
228 wined3d_device_set_index_buffer(This->wined3d_device,
229 buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
230 wined3dformat_from_dxgi_format(format));
231 if (offset) FIXME("offset %u not supported.\n", offset);
234 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
235 UINT instance_index_count, UINT instance_count, UINT start_index_location,
236 INT base_vertex_location, UINT start_instance_location)
238 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
239 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
240 iface, instance_index_count, instance_count, start_index_location,
241 base_vertex_location, start_instance_location);
244 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
245 UINT instance_vertex_count, UINT instance_count,
246 UINT start_vertex_location, UINT start_instance_location)
248 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
249 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
250 start_vertex_location, start_instance_location);
253 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
254 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
256 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
257 iface, start_slot, buffer_count, buffers);
260 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
262 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
263 else WARN("iface %p, shader %p stub!\n", iface, shader);
266 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface,
267 D3D10_PRIMITIVE_TOPOLOGY topology)
269 struct d3d10_device *This = impl_from_ID3D10Device(iface);
271 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
273 wined3d_device_set_primitive_type(This->wined3d_device, (enum wined3d_primitive_type)topology);
276 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
277 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
279 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
280 iface, start_slot, view_count, views);
283 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
284 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
286 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
287 iface, start_slot, sampler_count, samplers);
290 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
292 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
295 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
296 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
298 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
299 iface, start_slot, view_count, views);
302 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
303 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
305 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
306 iface, start_slot, sampler_count, samplers);
309 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
310 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
311 ID3D10DepthStencilView *depth_stencil_view)
313 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
314 iface, render_target_view_count, render_target_views, depth_stencil_view);
317 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
318 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
320 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
321 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
324 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
325 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
327 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
328 iface, depth_stencil_state, stencil_ref);
331 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
332 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
334 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
337 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
339 FIXME("iface %p stub!\n", iface);
342 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
344 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
347 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
348 UINT viewport_count, const D3D10_VIEWPORT *viewports)
350 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
353 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
354 UINT rect_count, const D3D10_RECT *rects)
356 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
359 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
360 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
361 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
363 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
364 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
365 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
366 src_resource, src_subresource_idx, src_box);
369 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
370 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
372 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
375 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
376 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
377 const void *data, UINT row_pitch, UINT depth_pitch)
379 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
380 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
383 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
384 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
386 struct d3d10_device *This = impl_from_ID3D10Device(iface);
387 struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
388 const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
390 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
391 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
393 wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color);
396 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
397 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
399 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
400 iface, depth_stencil_view, flags, depth, stencil);
403 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
405 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
408 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
409 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
410 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
412 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
413 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
414 iface, dst_resource, dst_subresource_idx,
415 src_resource, src_subresource_idx, debug_dxgi_format(format));
418 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
419 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
421 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
422 iface, start_slot, buffer_count, buffers);
425 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
426 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
428 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
429 iface, start_slot, view_count, views);
432 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
434 FIXME("iface %p, shader %p stub!\n", iface, shader);
437 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
438 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
440 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
441 iface, start_slot, sampler_count, samplers);
444 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
446 FIXME("iface %p, shader %p stub!\n", iface, shader);
449 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
450 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
452 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
453 iface, start_slot, buffer_count, buffers);
456 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
458 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
461 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
462 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
464 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
465 iface, start_slot, buffer_count, buffers, strides, offsets);
468 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
469 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
471 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
474 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
475 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
477 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
478 iface, start_slot, buffer_count, buffers);
481 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
483 FIXME("iface %p, shader %p stub!\n", iface, shader);
486 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface,
487 D3D10_PRIMITIVE_TOPOLOGY *topology)
489 struct d3d10_device *This = impl_from_ID3D10Device(iface);
491 TRACE("iface %p, topology %p\n", iface, topology);
493 wined3d_device_get_primitive_type(This->wined3d_device, (enum wined3d_primitive_type *)topology);
496 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
497 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
499 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
500 iface, start_slot, view_count, views);
503 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
504 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
506 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
507 iface, start_slot, sampler_count, samplers);
510 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
511 ID3D10Predicate **predicate, BOOL *value)
513 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
516 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
517 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
519 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
520 iface, start_slot, view_count, views);
523 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
524 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
526 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
527 iface, start_slot, sampler_count, samplers);
530 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
531 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
533 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
534 iface, view_count, render_target_views, depth_stencil_view);
537 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
538 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
540 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
541 iface, blend_state, blend_factor, sample_mask);
544 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
545 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
547 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
548 iface, depth_stencil_state, stencil_ref);
551 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
552 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
554 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
555 iface, buffer_count, buffers, offsets);
558 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
560 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
563 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
564 UINT *viewport_count, D3D10_VIEWPORT *viewports)
566 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
569 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
571 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
574 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
576 FIXME("iface %p stub!\n", iface);
578 return E_NOTIMPL;
581 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
583 FIXME("iface %p, flags %#x stub!\n", iface, flags);
585 return E_NOTIMPL;
588 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
590 FIXME("iface %p stub!\n", iface);
592 return 0;
595 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
596 REFGUID guid, UINT *data_size, void *data)
598 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
599 iface, debugstr_guid(guid), data_size, data);
601 return E_NOTIMPL;
604 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
605 REFGUID guid, UINT data_size, const void *data)
607 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
608 iface, debugstr_guid(guid), data_size, data);
610 return E_NOTIMPL;
613 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
614 REFGUID guid, const IUnknown *data)
616 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
618 return E_NOTIMPL;
621 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
623 FIXME("iface %p stub!\n", iface);
626 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
628 FIXME("iface %p stub!\n", iface);
631 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
632 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
634 struct d3d10_device *This = impl_from_ID3D10Device(iface);
635 struct d3d10_buffer *object;
636 HRESULT hr;
638 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
640 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
641 if (!object)
643 ERR("Failed to allocate D3D10 buffer object memory\n");
644 return E_OUTOFMEMORY;
647 hr = d3d10_buffer_init(object, This, desc, data);
648 if (FAILED(hr))
650 WARN("Failed to initialize buffer, hr %#x.\n", hr);
651 HeapFree(GetProcessHeap(), 0, object);
652 return hr;
655 *buffer = (ID3D10Buffer *)object;
657 TRACE("Created ID3D10Buffer %p\n", object);
659 return S_OK;
662 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
663 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
665 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
667 return E_NOTIMPL;
670 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
671 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
672 ID3D10Texture2D **texture)
674 struct d3d10_device *This = impl_from_ID3D10Device(iface);
675 struct d3d10_texture2d *object;
676 HRESULT hr;
678 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
680 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
681 if (!object)
683 ERR("Failed to allocate D3D10 texture2d object memory\n");
684 return E_OUTOFMEMORY;
687 hr = d3d10_texture2d_init(object, This, desc);
688 if (FAILED(hr))
690 WARN("Failed to initialize texture, hr %#x.\n", hr);
691 HeapFree(GetProcessHeap(), 0, object);
692 return hr;
695 *texture = &object->ID3D10Texture2D_iface;
697 TRACE("Created ID3D10Texture2D %p\n", object);
699 return S_OK;
702 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
703 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
704 ID3D10Texture3D **texture)
706 struct d3d10_device *device = impl_from_ID3D10Device(iface);
707 struct d3d10_texture3d *object;
708 HRESULT hr;
710 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
712 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
713 if (!object)
715 ERR("Failed to allocate D3D10 texture3d object memory.\n");
716 return E_OUTOFMEMORY;
719 hr = d3d10_texture3d_init(object, device, desc);
720 if (FAILED(hr))
722 WARN("Failed to initialize texture, hr %#x.\n", hr);
723 HeapFree(GetProcessHeap(), 0, object);
724 return hr;
727 TRACE("Created 3D texture %p.\n", object);
728 *texture = &object->ID3D10Texture3D_iface;
730 return S_OK;
733 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
734 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
736 struct d3d10_shader_resource_view *object;
737 HRESULT hr;
739 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
741 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
742 if (!object)
744 ERR("Failed to allocate D3D10 shader resource view object memory.\n");
745 return E_OUTOFMEMORY;
748 hr = d3d10_shader_resource_view_init(object);
749 if (FAILED(hr))
751 WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
752 HeapFree(GetProcessHeap(), 0, object);
753 return hr;
756 TRACE("Created shader resource view %p.\n", object);
757 *view = &object->ID3D10ShaderResourceView_iface;
759 return S_OK;
762 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
763 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
765 struct d3d10_rendertarget_view *object;
766 HRESULT hr;
768 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
770 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
771 if (!object)
773 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
774 return E_OUTOFMEMORY;
777 hr = d3d10_rendertarget_view_init(object, resource, desc);
778 if (FAILED(hr))
780 WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
781 HeapFree(GetProcessHeap(), 0, object);
782 return hr;
785 TRACE("Created rendertarget view %p.\n", object);
786 *view = &object->ID3D10RenderTargetView_iface;
788 return S_OK;
791 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
792 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
794 struct d3d10_depthstencil_view *object;
795 HRESULT hr;
797 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
799 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
800 if (!object)
802 ERR("Failed to allocate D3D10 depthstencil view object memory.\n");
803 return E_OUTOFMEMORY;
806 hr = d3d10_depthstencil_view_init(object);
807 if (FAILED(hr))
809 WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
810 HeapFree(GetProcessHeap(), 0, object);
811 return hr;
814 TRACE("Created depthstencil view %p.\n", object);
815 *view = &object->ID3D10DepthStencilView_iface;
817 return S_OK;
820 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
821 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
822 const void *shader_byte_code, SIZE_T shader_byte_code_length,
823 ID3D10InputLayout **input_layout)
825 struct d3d10_device *This = impl_from_ID3D10Device(iface);
826 struct d3d10_input_layout *object;
827 HRESULT hr;
829 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
830 "\tshader_byte_code_length %lu, input_layout %p\n",
831 iface, element_descs, element_count, shader_byte_code,
832 shader_byte_code_length, input_layout);
834 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
835 if (!object)
837 ERR("Failed to allocate D3D10 input layout object memory\n");
838 return E_OUTOFMEMORY;
841 hr = d3d10_input_layout_init(object, This, element_descs, element_count,
842 shader_byte_code, shader_byte_code_length);
843 if (FAILED(hr))
845 WARN("Failed to initialize input layout, hr %#x.\n", hr);
846 HeapFree(GetProcessHeap(), 0, object);
847 return hr;
850 TRACE("Created input layout %p.\n", object);
851 *input_layout = &object->ID3D10InputLayout_iface;
853 return S_OK;
856 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
857 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
859 struct d3d10_device *This = impl_from_ID3D10Device(iface);
860 struct d3d10_vertex_shader *object;
861 HRESULT hr;
863 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
864 iface, byte_code, byte_code_length, shader);
866 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
867 if (!object)
869 ERR("Failed to allocate D3D10 vertex shader object memory\n");
870 return E_OUTOFMEMORY;
873 hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
874 if (FAILED(hr))
876 WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
877 HeapFree(GetProcessHeap(), 0, object);
878 return hr;
881 TRACE("Created vertex shader %p.\n", object);
882 *shader = &object->ID3D10VertexShader_iface;
884 return S_OK;
887 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
888 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
890 struct d3d10_device *This = impl_from_ID3D10Device(iface);
891 struct d3d10_geometry_shader *object;
892 HRESULT hr;
894 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
895 iface, byte_code, byte_code_length, shader);
897 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
898 if (!object)
900 ERR("Failed to allocate D3D10 geometry shader object memory\n");
901 return E_OUTOFMEMORY;
904 hr = d3d10_geometry_shader_init(object, This, byte_code, byte_code_length);
905 if (FAILED(hr))
907 WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
908 HeapFree(GetProcessHeap(), 0, object);
911 TRACE("Created geometry shader %p.\n", object);
912 *shader = &object->ID3D10GeometryShader_iface;
914 return S_OK;
917 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
918 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
919 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
921 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
922 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
923 iface, byte_code, byte_code_length, output_stream_decls,
924 output_stream_decl_count, output_stream_stride, shader);
926 return E_NOTIMPL;
929 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
930 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
932 struct d3d10_device *This = impl_from_ID3D10Device(iface);
933 struct d3d10_pixel_shader *object;
934 HRESULT hr;
936 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
937 iface, byte_code, byte_code_length, shader);
939 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
940 if (!object)
942 ERR("Failed to allocate D3D10 pixel shader object memory\n");
943 return E_OUTOFMEMORY;
946 hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
947 if (FAILED(hr))
949 WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
950 HeapFree(GetProcessHeap(), 0, object);
951 return hr;
954 TRACE("Created pixel shader %p.\n", object);
955 *shader = &object->ID3D10PixelShader_iface;
957 return S_OK;
960 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
961 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
963 struct d3d10_blend_state *object;
964 HRESULT hr;
966 TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
968 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
969 if (!object)
971 ERR("Failed to allocate D3D10 blend state object memory.\n");
972 return E_OUTOFMEMORY;
975 hr = d3d10_blend_state_init(object);
976 if (FAILED(hr))
978 WARN("Failed to initialize blend state, hr %#x.\n", hr);
979 HeapFree(GetProcessHeap(), 0, object);
980 return hr;
983 TRACE("Created blend state %p.\n", object);
984 *blend_state = &object->ID3D10BlendState_iface;
986 return S_OK;
989 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
990 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
992 struct d3d10_depthstencil_state *object;
993 HRESULT hr;
995 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface, desc, depth_stencil_state);
997 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
998 if (!object)
1000 ERR("Failed to allocate D3D10 depthstencil state object memory.\n");
1001 return E_OUTOFMEMORY;
1004 hr = d3d10_depthstencil_state_init(object);
1005 if (FAILED(hr))
1007 WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
1008 HeapFree(GetProcessHeap(), 0, object);
1009 return hr;
1012 TRACE("Created depthstencil state %p.\n", object);
1013 *depth_stencil_state = &object->ID3D10DepthStencilState_iface;
1015 return S_OK;
1018 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1019 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1021 struct d3d10_rasterizer_state *object;
1022 HRESULT hr;
1024 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
1026 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1027 if (!object)
1029 ERR("Failed to allocate D3D10 rasterizer state object memory.\n");
1030 return E_OUTOFMEMORY;
1033 hr = d3d10_rasterizer_state_init(object);
1034 if (FAILED(hr))
1036 WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
1037 HeapFree(GetProcessHeap(), 0, object);
1038 return hr;
1041 TRACE("Created rasterizer state %p.\n", object);
1042 *rasterizer_state = &object->ID3D10RasterizerState_iface;
1044 return S_OK;
1047 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1048 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1050 struct d3d10_sampler_state *object;
1051 HRESULT hr;
1053 FIXME("iface %p, desc %p, sampler_state %p.\n", iface, desc, sampler_state);
1055 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1056 if (!object)
1058 ERR("Failed to allocate D3D10 sampler state object memory.\n");
1059 return E_OUTOFMEMORY;
1062 hr = d3d10_sampler_state_init(object);
1063 if (FAILED(hr))
1065 WARN("Failed to initialize sampler state, hr %#x.\n", hr);
1066 HeapFree(GetProcessHeap(), 0, object);
1067 return hr;
1070 TRACE("Created sampler state %p.\n", object);
1071 *sampler_state = &object->ID3D10SamplerState_iface;
1073 return S_OK;
1076 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1077 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1079 struct d3d10_query *object;
1080 HRESULT hr;
1082 TRACE("iface %p, desc %p, query %p.\n", iface, desc, query);
1084 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1085 if (!object)
1087 ERR("Failed to allocate D3D10 query object memory.\n");
1088 return E_OUTOFMEMORY;
1091 hr = d3d10_query_init(object);
1092 if (FAILED(hr))
1094 WARN("Failed to initialize query, hr %#x.\n", hr);
1095 HeapFree(GetProcessHeap(), 0, object);
1096 return hr;
1099 TRACE("Created query %p.\n", object);
1100 *query = &object->ID3D10Query_iface;
1102 return S_OK;
1105 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1106 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1108 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1110 return E_NOTIMPL;
1113 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1114 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1116 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1118 return E_NOTIMPL;
1121 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1122 DXGI_FORMAT format, UINT *format_support)
1124 FIXME("iface %p, format %s, format_support %p stub!\n",
1125 iface, debug_dxgi_format(format), format_support);
1127 return E_NOTIMPL;
1130 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1131 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1133 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1134 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1136 return E_NOTIMPL;
1139 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1141 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1144 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1145 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1146 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1148 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1149 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1150 iface, desc, type, active_counters, name, name_length,
1151 units, units_length, description, description_length);
1153 return E_NOTIMPL;
1156 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1158 FIXME("iface %p stub!\n", iface);
1160 return 0;
1163 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1164 HANDLE resource_handle, REFIID guid, void **resource)
1166 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1167 iface, resource_handle, debugstr_guid(guid), resource);
1169 return E_NOTIMPL;
1172 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1174 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1177 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1179 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1182 static const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1184 /* IUnknown methods */
1185 d3d10_device_QueryInterface,
1186 d3d10_device_AddRef,
1187 d3d10_device_Release,
1188 /* ID3D10Device methods */
1189 d3d10_device_VSSetConstantBuffers,
1190 d3d10_device_PSSetShaderResources,
1191 d3d10_device_PSSetShader,
1192 d3d10_device_PSSetSamplers,
1193 d3d10_device_VSSetShader,
1194 d3d10_device_DrawIndexed,
1195 d3d10_device_Draw,
1196 d3d10_device_PSSetConstantBuffers,
1197 d3d10_device_IASetInputLayout,
1198 d3d10_device_IASetVertexBuffers,
1199 d3d10_device_IASetIndexBuffer,
1200 d3d10_device_DrawIndexedInstanced,
1201 d3d10_device_DrawInstanced,
1202 d3d10_device_GSSetConstantBuffers,
1203 d3d10_device_GSSetShader,
1204 d3d10_device_IASetPrimitiveTopology,
1205 d3d10_device_VSSetShaderResources,
1206 d3d10_device_VSSetSamplers,
1207 d3d10_device_SetPredication,
1208 d3d10_device_GSSetShaderResources,
1209 d3d10_device_GSSetSamplers,
1210 d3d10_device_OMSetRenderTargets,
1211 d3d10_device_OMSetBlendState,
1212 d3d10_device_OMSetDepthStencilState,
1213 d3d10_device_SOSetTargets,
1214 d3d10_device_DrawAuto,
1215 d3d10_device_RSSetState,
1216 d3d10_device_RSSetViewports,
1217 d3d10_device_RSSetScissorRects,
1218 d3d10_device_CopySubresourceRegion,
1219 d3d10_device_CopyResource,
1220 d3d10_device_UpdateSubresource,
1221 d3d10_device_ClearRenderTargetView,
1222 d3d10_device_ClearDepthStencilView,
1223 d3d10_device_GenerateMips,
1224 d3d10_device_ResolveSubresource,
1225 d3d10_device_VSGetConstantBuffers,
1226 d3d10_device_PSGetShaderResources,
1227 d3d10_device_PSGetShader,
1228 d3d10_device_PSGetSamplers,
1229 d3d10_device_VSGetShader,
1230 d3d10_device_PSGetConstantBuffers,
1231 d3d10_device_IAGetInputLayout,
1232 d3d10_device_IAGetVertexBuffers,
1233 d3d10_device_IAGetIndexBuffer,
1234 d3d10_device_GSGetConstantBuffers,
1235 d3d10_device_GSGetShader,
1236 d3d10_device_IAGetPrimitiveTopology,
1237 d3d10_device_VSGetShaderResources,
1238 d3d10_device_VSGetSamplers,
1239 d3d10_device_GetPredication,
1240 d3d10_device_GSGetShaderResources,
1241 d3d10_device_GSGetSamplers,
1242 d3d10_device_OMGetRenderTargets,
1243 d3d10_device_OMGetBlendState,
1244 d3d10_device_OMGetDepthStencilState,
1245 d3d10_device_SOGetTargets,
1246 d3d10_device_RSGetState,
1247 d3d10_device_RSGetViewports,
1248 d3d10_device_RSGetScissorRects,
1249 d3d10_device_GetDeviceRemovedReason,
1250 d3d10_device_SetExceptionMode,
1251 d3d10_device_GetExceptionMode,
1252 d3d10_device_GetPrivateData,
1253 d3d10_device_SetPrivateData,
1254 d3d10_device_SetPrivateDataInterface,
1255 d3d10_device_ClearState,
1256 d3d10_device_Flush,
1257 d3d10_device_CreateBuffer,
1258 d3d10_device_CreateTexture1D,
1259 d3d10_device_CreateTexture2D,
1260 d3d10_device_CreateTexture3D,
1261 d3d10_device_CreateShaderResourceView,
1262 d3d10_device_CreateRenderTargetView,
1263 d3d10_device_CreateDepthStencilView,
1264 d3d10_device_CreateInputLayout,
1265 d3d10_device_CreateVertexShader,
1266 d3d10_device_CreateGeometryShader,
1267 d3d10_device_CreateGeometryShaderWithStreamOutput,
1268 d3d10_device_CreatePixelShader,
1269 d3d10_device_CreateBlendState,
1270 d3d10_device_CreateDepthStencilState,
1271 d3d10_device_CreateRasterizerState,
1272 d3d10_device_CreateSamplerState,
1273 d3d10_device_CreateQuery,
1274 d3d10_device_CreatePredicate,
1275 d3d10_device_CreateCounter,
1276 d3d10_device_CheckFormatSupport,
1277 d3d10_device_CheckMultisampleQualityLevels,
1278 d3d10_device_CheckCounterInfo,
1279 d3d10_device_CheckCounter,
1280 d3d10_device_GetCreationFlags,
1281 d3d10_device_OpenSharedResource,
1282 d3d10_device_SetTextFilterSize,
1283 d3d10_device_GetTextFilterSize,
1286 static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1288 /* IUnknown methods */
1289 d3d10_device_inner_QueryInterface,
1290 d3d10_device_inner_AddRef,
1291 d3d10_device_inner_Release,
1294 static void STDMETHODCALLTYPE d3d10_subresource_destroyed(void *parent) {}
1296 static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
1298 d3d10_subresource_destroyed,
1301 /* IWineDXGIDeviceParent IUnknown methods */
1303 static inline struct d3d10_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
1305 return CONTAINING_RECORD(iface, struct d3d10_device, IWineDXGIDeviceParent_iface);
1308 static HRESULT STDMETHODCALLTYPE dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent *iface,
1309 REFIID riid, void **object)
1311 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1312 return d3d10_device_QueryInterface(&device->ID3D10Device_iface, riid, object);
1315 static ULONG STDMETHODCALLTYPE dxgi_device_parent_AddRef(IWineDXGIDeviceParent *iface)
1317 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1318 return d3d10_device_AddRef(&device->ID3D10Device_iface);
1321 static ULONG STDMETHODCALLTYPE dxgi_device_parent_Release(IWineDXGIDeviceParent *iface)
1323 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1324 return d3d10_device_Release(&device->ID3D10Device_iface);
1327 static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
1328 IWineDXGIDeviceParent *iface)
1330 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1331 return &device->device_parent;
1334 static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl =
1336 /* IUnknown methods */
1337 dxgi_device_parent_QueryInterface,
1338 dxgi_device_parent_AddRef,
1339 dxgi_device_parent_Release,
1340 /* IWineDXGIDeviceParent methods */
1341 dxgi_device_parent_get_wined3d_device_parent,
1344 static inline struct d3d10_device *device_from_wined3d_device_parent(struct wined3d_device_parent *device_parent)
1346 return CONTAINING_RECORD(device_parent, struct d3d10_device, device_parent);
1349 static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
1350 struct wined3d_device *wined3d_device)
1352 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1354 TRACE("device_parent %p, wined3d_device %p.\n", device_parent, wined3d_device);
1356 wined3d_device_incref(wined3d_device);
1357 device->wined3d_device = wined3d_device;
1360 static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
1362 TRACE("device_parent %p.\n", device_parent);
1365 static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
1366 void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
1367 enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
1369 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1370 struct d3d10_texture2d *texture;
1371 D3D10_TEXTURE2D_DESC desc;
1372 HRESULT hr;
1374 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
1375 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1376 device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
1378 FIXME("Implement DXGI<->wined3d usage conversion\n");
1380 desc.Width = width;
1381 desc.Height = height;
1382 desc.MipLevels = 1;
1383 desc.ArraySize = 1;
1384 desc.Format = dxgi_format_from_wined3dformat(format);
1385 desc.SampleDesc.Count = 1;
1386 desc.SampleDesc.Quality = 0;
1387 desc.Usage = usage;
1388 desc.BindFlags = 0;
1389 desc.CPUAccessFlags = 0;
1390 desc.MiscFlags = 0;
1392 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1393 (ID3D10Texture2D **)&texture);
1394 if (FAILED(hr))
1396 ERR("CreateTexture2D failed, returning %#x\n", hr);
1397 return hr;
1400 *surface = texture->wined3d_surface;
1401 wined3d_surface_incref(*surface);
1402 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1404 return S_OK;
1407 static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
1408 void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
1409 enum wined3d_multisample_type multisample_type, DWORD multisample_quality, BOOL lockable,
1410 struct wined3d_surface **surface)
1412 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1413 struct d3d10_texture2d *texture;
1414 D3D10_TEXTURE2D_DESC desc;
1415 HRESULT hr;
1417 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1418 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1419 device_parent, container_parent, width, height, format, multisample_type,
1420 multisample_quality, lockable, surface);
1422 FIXME("Implement DXGI<->wined3d usage conversion\n");
1424 desc.Width = width;
1425 desc.Height = height;
1426 desc.MipLevels = 1;
1427 desc.ArraySize = 1;
1428 desc.Format = dxgi_format_from_wined3dformat(format);
1429 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1430 desc.SampleDesc.Quality = multisample_quality;
1431 desc.Usage = D3D10_USAGE_DEFAULT;
1432 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1433 desc.CPUAccessFlags = 0;
1434 desc.MiscFlags = 0;
1436 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1437 (ID3D10Texture2D **)&texture);
1438 if (FAILED(hr))
1440 ERR("CreateTexture2D failed, returning %#x\n", hr);
1441 return hr;
1444 *surface = texture->wined3d_surface;
1445 wined3d_surface_incref(*surface);
1446 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1448 return S_OK;
1451 static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
1452 UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
1453 DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
1455 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1456 struct d3d10_texture2d *texture;
1457 D3D10_TEXTURE2D_DESC desc;
1458 HRESULT hr;
1460 FIXME("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1461 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1462 device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
1464 FIXME("Implement DXGI<->wined3d usage conversion\n");
1466 desc.Width = width;
1467 desc.Height = height;
1468 desc.MipLevels = 1;
1469 desc.ArraySize = 1;
1470 desc.Format = dxgi_format_from_wined3dformat(format);
1471 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1472 desc.SampleDesc.Quality = multisample_quality;
1473 desc.Usage = D3D10_USAGE_DEFAULT;
1474 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1475 desc.CPUAccessFlags = 0;
1476 desc.MiscFlags = 0;
1478 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1479 (ID3D10Texture2D **)&texture);
1480 if (FAILED(hr))
1482 ERR("CreateTexture2D failed, returning %#x\n", hr);
1483 return hr;
1486 *surface = texture->wined3d_surface;
1487 wined3d_surface_incref(*surface);
1488 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1490 return S_OK;
1493 static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
1494 void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
1495 enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume)
1497 HRESULT hr;
1499 TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
1500 "format %#x, pool %#x, usage %#x, volume %p.\n",
1501 device_parent, container_parent, width, height, depth,
1502 format, pool, usage, volume);
1504 hr = wined3d_volume_create(device_from_wined3d_device_parent(device_parent)->wined3d_device,
1505 width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
1506 if (FAILED(hr))
1508 WARN("Failed to create wined3d volume, hr %#x.\n", hr);
1509 return hr;
1512 return S_OK;
1515 static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
1516 struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
1518 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1519 IWineDXGIDevice *wine_device;
1520 HRESULT hr;
1522 TRACE("device_parent %p, desc %p, swapchain %p\n", device_parent, desc, swapchain);
1524 hr = d3d10_device_QueryInterface(&device->ID3D10Device_iface, &IID_IWineDXGIDevice,
1525 (void **)&wine_device);
1526 if (FAILED(hr))
1528 ERR("Device should implement IWineDXGIDevice\n");
1529 return E_FAIL;
1532 hr = IWineDXGIDevice_create_swapchain(wine_device, desc, swapchain);
1533 IWineDXGIDevice_Release(wine_device);
1534 if (FAILED(hr))
1536 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1537 return hr;
1540 return S_OK;
1543 static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
1545 device_parent_wined3d_device_created,
1546 device_parent_mode_changed,
1547 device_parent_create_surface,
1548 device_parent_create_rendertarget,
1549 device_parent_create_depth_stencil,
1550 device_parent_create_volume,
1551 device_parent_create_swapchain,
1554 void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
1556 device->ID3D10Device_iface.lpVtbl = &d3d10_device_vtbl;
1557 device->inner_unknown_vtbl = &d3d10_device_inner_unknown_vtbl;
1558 device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
1559 device->device_parent.ops = &d3d10_wined3d_device_parent_ops;
1560 device->refcount = 1;
1561 device->outer_unknown = outer_unknown;