wineps: Simplify the failure path.
[wine/multimedia.git] / dlls / d3d10core / device.c
blobcf21bba834fb195edd8a3e0824d593565b7acb56
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 *impl_from_IUnknown(IUnknown *iface)
31 return CONTAINING_RECORD(iface, struct d3d10_device, IUnknown_inner);
34 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid,
35 void **ppv)
37 struct d3d10_device *This = impl_from_IUnknown(iface);
39 TRACE("iface %p, riid %s, ppv %p\n", iface, debugstr_guid(riid), ppv);
41 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3D10Device))
42 *ppv = &This->ID3D10Device_iface;
43 else if (IsEqualGUID(riid, &IID_IWineDXGIDeviceParent))
44 *ppv = &This->IWineDXGIDeviceParent_iface;
45 else
47 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
48 *ppv = NULL;
49 return E_NOINTERFACE;
52 IUnknown_AddRef((IUnknown*)*ppv);
53 return S_OK;
56 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
58 struct d3d10_device *This = impl_from_IUnknown(iface);
59 ULONG refcount = InterlockedIncrement(&This->refcount);
61 TRACE("%p increasing refcount to %u\n", This, refcount);
63 return refcount;
66 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
68 struct d3d10_device *This = impl_from_IUnknown(iface);
69 ULONG refcount = InterlockedDecrement(&This->refcount);
71 TRACE("%p decreasing refcount to %u\n", This, refcount);
73 if (!refcount)
75 if (This->wined3d_device)
76 wined3d_device_decref(This->wined3d_device);
79 return refcount;
82 /* IUnknown methods */
84 static inline struct d3d10_device *impl_from_ID3D10Device(ID3D10Device *iface)
86 return CONTAINING_RECORD(iface, struct d3d10_device, ID3D10Device_iface);
89 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid,
90 void **ppv)
92 struct d3d10_device *This = impl_from_ID3D10Device(iface);
93 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
96 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
98 struct d3d10_device *This = impl_from_ID3D10Device(iface);
99 return IUnknown_AddRef(This->outer_unk);
102 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
104 struct d3d10_device *This = impl_from_ID3D10Device(iface);
105 return IUnknown_Release(This->outer_unk);
108 /* ID3D10Device methods */
110 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
111 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
113 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
114 iface, start_slot, buffer_count, buffers);
117 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
118 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
120 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
121 iface, start_slot, view_count, views);
124 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface,
125 ID3D10PixelShader *shader)
127 struct d3d10_device *This = impl_from_ID3D10Device(iface);
128 struct d3d10_pixel_shader *ps = unsafe_impl_from_ID3D10PixelShader(shader);
130 TRACE("iface %p, shader %p\n", iface, shader);
132 wined3d_device_set_pixel_shader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
135 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
136 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
138 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
139 iface, start_slot, sampler_count, samplers);
142 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface,
143 ID3D10VertexShader *shader)
145 struct d3d10_device *This = impl_from_ID3D10Device(iface);
146 struct d3d10_vertex_shader *vs = unsafe_impl_from_ID3D10VertexShader(shader);
148 TRACE("iface %p, shader %p\n", iface, shader);
150 wined3d_device_set_vertex_shader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
153 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface, UINT index_count,
154 UINT start_index_location, INT base_vertex_location)
156 struct d3d10_device *This = impl_from_ID3D10Device(iface);
158 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
159 iface, index_count, start_index_location, base_vertex_location);
161 wined3d_device_set_base_vertex_index(This->wined3d_device, base_vertex_location);
162 wined3d_device_draw_indexed_primitive(This->wined3d_device, start_index_location, index_count);
165 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface, UINT vertex_count,
166 UINT start_vertex_location)
168 struct d3d10_device *This = impl_from_ID3D10Device(iface);
170 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
171 iface, vertex_count, start_vertex_location);
173 wined3d_device_draw_primitive(This->wined3d_device, start_vertex_location, vertex_count);
176 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
177 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
179 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
180 iface, start_slot, buffer_count, buffers);
183 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface,
184 ID3D10InputLayout *input_layout)
186 struct d3d10_device *This = impl_from_ID3D10Device(iface);
187 struct d3d10_input_layout *layout = unsafe_impl_from_ID3D10InputLayout(input_layout);
189 TRACE("iface %p, input_layout %p\n", iface, input_layout);
191 wined3d_device_set_vertex_declaration(This->wined3d_device,
192 layout ? layout->wined3d_decl : NULL);
195 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface, UINT start_slot,
196 UINT buffer_count, ID3D10Buffer *const *buffers, const UINT *strides, const UINT *offsets)
198 struct d3d10_device *This = impl_from_ID3D10Device(iface);
199 unsigned int i;
201 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
202 iface, start_slot, buffer_count, buffers, strides, offsets);
204 for (i = 0; i < buffer_count; ++i)
206 wined3d_device_set_stream_source(This->wined3d_device, start_slot,
207 buffers[i] ? ((struct d3d10_buffer *)buffers[i])->wined3d_buffer : NULL,
208 offsets[i], strides[i]);
212 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
213 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
215 struct d3d10_device *This = impl_from_ID3D10Device(iface);
217 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
218 iface, buffer, debug_dxgi_format(format), offset);
220 wined3d_device_set_index_buffer(This->wined3d_device,
221 buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
222 wined3dformat_from_dxgi_format(format));
223 if (offset) FIXME("offset %u not supported.\n", offset);
226 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
227 UINT instance_index_count, UINT instance_count, UINT start_index_location,
228 INT base_vertex_location, UINT start_instance_location)
230 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
231 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
232 iface, instance_index_count, instance_count, start_index_location,
233 base_vertex_location, start_instance_location);
236 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
237 UINT instance_vertex_count, UINT instance_count,
238 UINT start_vertex_location, UINT start_instance_location)
240 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
241 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
242 start_vertex_location, start_instance_location);
245 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
246 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
248 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
249 iface, start_slot, buffer_count, buffers);
252 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
254 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
255 else WARN("iface %p, shader %p stub!\n", iface, shader);
258 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface,
259 D3D10_PRIMITIVE_TOPOLOGY topology)
261 struct d3d10_device *This = impl_from_ID3D10Device(iface);
263 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
265 wined3d_device_set_primitive_type(This->wined3d_device, (enum wined3d_primitive_type)topology);
268 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
269 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
271 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
272 iface, start_slot, view_count, views);
275 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
276 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
278 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
279 iface, start_slot, sampler_count, samplers);
282 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
284 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
287 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
288 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
290 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
291 iface, start_slot, view_count, views);
294 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
295 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
297 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
298 iface, start_slot, sampler_count, samplers);
301 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
302 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
303 ID3D10DepthStencilView *depth_stencil_view)
305 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
306 iface, render_target_view_count, render_target_views, depth_stencil_view);
309 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
310 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
312 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
313 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
316 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
317 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
319 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
320 iface, depth_stencil_state, stencil_ref);
323 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
324 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
326 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
329 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
331 FIXME("iface %p stub!\n", iface);
334 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
336 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
339 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
340 UINT viewport_count, const D3D10_VIEWPORT *viewports)
342 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
345 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
346 UINT rect_count, const D3D10_RECT *rects)
348 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
351 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
352 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
353 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
355 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
356 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
357 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
358 src_resource, src_subresource_idx, src_box);
361 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
362 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
364 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
367 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
368 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
369 const void *data, UINT row_pitch, UINT depth_pitch)
371 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
372 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
375 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
376 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
378 struct d3d10_device *This = impl_from_ID3D10Device(iface);
379 struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
380 const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
382 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
383 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
385 wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color);
388 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
389 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
391 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
392 iface, depth_stencil_view, flags, depth, stencil);
395 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
397 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
400 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
401 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
402 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
404 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
405 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
406 iface, dst_resource, dst_subresource_idx,
407 src_resource, src_subresource_idx, debug_dxgi_format(format));
410 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
411 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
413 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
414 iface, start_slot, buffer_count, buffers);
417 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
418 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
420 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
421 iface, start_slot, view_count, views);
424 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
426 FIXME("iface %p, shader %p stub!\n", iface, shader);
429 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
430 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
432 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
433 iface, start_slot, sampler_count, samplers);
436 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
438 FIXME("iface %p, shader %p stub!\n", iface, shader);
441 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
442 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
444 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
445 iface, start_slot, buffer_count, buffers);
448 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
450 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
453 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
454 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
456 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
457 iface, start_slot, buffer_count, buffers, strides, offsets);
460 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
461 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
463 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
466 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
467 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
469 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
470 iface, start_slot, buffer_count, buffers);
473 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
475 FIXME("iface %p, shader %p stub!\n", iface, shader);
478 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface,
479 D3D10_PRIMITIVE_TOPOLOGY *topology)
481 struct d3d10_device *This = impl_from_ID3D10Device(iface);
483 TRACE("iface %p, topology %p\n", iface, topology);
485 wined3d_device_get_primitive_type(This->wined3d_device, (enum wined3d_primitive_type *)topology);
488 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
489 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
491 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
492 iface, start_slot, view_count, views);
495 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
496 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
498 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
499 iface, start_slot, sampler_count, samplers);
502 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
503 ID3D10Predicate **predicate, BOOL *value)
505 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
508 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
509 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
511 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
512 iface, start_slot, view_count, views);
515 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
516 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
518 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
519 iface, start_slot, sampler_count, samplers);
522 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
523 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
525 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
526 iface, view_count, render_target_views, depth_stencil_view);
529 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
530 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
532 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
533 iface, blend_state, blend_factor, sample_mask);
536 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
537 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
539 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
540 iface, depth_stencil_state, stencil_ref);
543 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
544 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
546 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
547 iface, buffer_count, buffers, offsets);
550 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
552 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
555 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
556 UINT *viewport_count, D3D10_VIEWPORT *viewports)
558 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
561 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
563 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
566 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
568 FIXME("iface %p stub!\n", iface);
570 return E_NOTIMPL;
573 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
575 FIXME("iface %p, flags %#x stub!\n", iface, flags);
577 return E_NOTIMPL;
580 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
582 FIXME("iface %p stub!\n", iface);
584 return 0;
587 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
588 REFGUID guid, UINT *data_size, void *data)
590 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
591 iface, debugstr_guid(guid), data_size, data);
593 return E_NOTIMPL;
596 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
597 REFGUID guid, UINT data_size, const void *data)
599 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
600 iface, debugstr_guid(guid), data_size, data);
602 return E_NOTIMPL;
605 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
606 REFGUID guid, const IUnknown *data)
608 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
610 return E_NOTIMPL;
613 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
615 FIXME("iface %p stub!\n", iface);
618 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
620 FIXME("iface %p stub!\n", iface);
623 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
624 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
626 struct d3d10_device *This = impl_from_ID3D10Device(iface);
627 struct d3d10_buffer *object;
628 HRESULT hr;
630 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
632 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
633 if (!object)
635 ERR("Failed to allocate D3D10 buffer object memory\n");
636 return E_OUTOFMEMORY;
639 hr = d3d10_buffer_init(object, This, desc, data);
640 if (FAILED(hr))
642 WARN("Failed to initialize buffer, hr %#x.\n", hr);
643 HeapFree(GetProcessHeap(), 0, object);
644 return hr;
647 *buffer = (ID3D10Buffer *)object;
649 TRACE("Created ID3D10Buffer %p\n", object);
651 return S_OK;
654 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
655 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
657 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
659 return E_NOTIMPL;
662 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
663 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
664 ID3D10Texture2D **texture)
666 struct d3d10_device *This = impl_from_ID3D10Device(iface);
667 struct d3d10_texture2d *object;
668 HRESULT hr;
670 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
672 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
673 if (!object)
675 ERR("Failed to allocate D3D10 texture2d object memory\n");
676 return E_OUTOFMEMORY;
679 hr = d3d10_texture2d_init(object, This, desc);
680 if (FAILED(hr))
682 WARN("Failed to initialize texture, hr %#x.\n", hr);
683 HeapFree(GetProcessHeap(), 0, object);
684 return hr;
687 *texture = &object->ID3D10Texture2D_iface;
689 TRACE("Created ID3D10Texture2D %p\n", object);
691 return S_OK;
694 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
695 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
696 ID3D10Texture3D **texture)
698 struct d3d10_device *device = impl_from_ID3D10Device(iface);
699 struct d3d10_texture3d *object;
700 HRESULT hr;
702 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
704 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
705 if (!object)
707 ERR("Failed to allocate D3D10 texture3d object memory.\n");
708 return E_OUTOFMEMORY;
711 hr = d3d10_texture3d_init(object, device, desc);
712 if (FAILED(hr))
714 WARN("Failed to initialize texture, hr %#x.\n", hr);
715 HeapFree(GetProcessHeap(), 0, object);
716 return hr;
719 TRACE("Created 3D texture %p.\n", object);
720 *texture = &object->ID3D10Texture3D_iface;
722 return S_OK;
725 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
726 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
728 struct d3d10_shader_resource_view *object;
729 HRESULT hr;
731 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
733 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
734 if (!object)
736 ERR("Failed to allocate D3D10 shader resource view object memory.\n");
737 return E_OUTOFMEMORY;
740 hr = d3d10_shader_resource_view_init(object);
741 if (FAILED(hr))
743 WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
744 HeapFree(GetProcessHeap(), 0, object);
745 return hr;
748 TRACE("Created shader resource view %p.\n", object);
749 *view = &object->ID3D10ShaderResourceView_iface;
751 return S_OK;
754 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
755 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
757 struct d3d10_rendertarget_view *object;
758 HRESULT hr;
760 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
762 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
763 if (!object)
765 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
766 return E_OUTOFMEMORY;
769 hr = d3d10_rendertarget_view_init(object, resource, desc);
770 if (FAILED(hr))
772 WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
773 HeapFree(GetProcessHeap(), 0, object);
774 return hr;
777 TRACE("Created rendertarget view %p.\n", object);
778 *view = &object->ID3D10RenderTargetView_iface;
780 return S_OK;
783 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
784 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
786 struct d3d10_depthstencil_view *object;
787 HRESULT hr;
789 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
791 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
792 if (!object)
794 ERR("Failed to allocate D3D10 depthstencil view object memory.\n");
795 return E_OUTOFMEMORY;
798 hr = d3d10_depthstencil_view_init(object);
799 if (FAILED(hr))
801 WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
802 HeapFree(GetProcessHeap(), 0, object);
803 return hr;
806 TRACE("Created depthstencil view %p.\n", object);
807 *view = &object->ID3D10DepthStencilView_iface;
809 return S_OK;
812 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
813 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
814 const void *shader_byte_code, SIZE_T shader_byte_code_length,
815 ID3D10InputLayout **input_layout)
817 struct d3d10_device *This = impl_from_ID3D10Device(iface);
818 struct d3d10_input_layout *object;
819 HRESULT hr;
821 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
822 "\tshader_byte_code_length %lu, input_layout %p\n",
823 iface, element_descs, element_count, shader_byte_code,
824 shader_byte_code_length, input_layout);
826 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
827 if (!object)
829 ERR("Failed to allocate D3D10 input layout object memory\n");
830 return E_OUTOFMEMORY;
833 hr = d3d10_input_layout_init(object, This, element_descs, element_count,
834 shader_byte_code, shader_byte_code_length);
835 if (FAILED(hr))
837 WARN("Failed to initialize input layout, hr %#x.\n", hr);
838 HeapFree(GetProcessHeap(), 0, object);
839 return hr;
842 TRACE("Created input layout %p.\n", object);
843 *input_layout = &object->ID3D10InputLayout_iface;
845 return S_OK;
848 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
849 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
851 struct d3d10_device *This = impl_from_ID3D10Device(iface);
852 struct d3d10_vertex_shader *object;
853 HRESULT hr;
855 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
856 iface, byte_code, byte_code_length, shader);
858 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
859 if (!object)
861 ERR("Failed to allocate D3D10 vertex shader object memory\n");
862 return E_OUTOFMEMORY;
865 hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
866 if (FAILED(hr))
868 WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
869 HeapFree(GetProcessHeap(), 0, object);
870 return hr;
873 TRACE("Created vertex shader %p.\n", object);
874 *shader = &object->ID3D10VertexShader_iface;
876 return S_OK;
879 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
880 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
882 struct d3d10_device *This = impl_from_ID3D10Device(iface);
883 struct d3d10_geometry_shader *object;
884 HRESULT hr;
886 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
887 iface, byte_code, byte_code_length, shader);
889 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
890 if (!object)
892 ERR("Failed to allocate D3D10 geometry shader object memory\n");
893 return E_OUTOFMEMORY;
896 hr = d3d10_geometry_shader_init(object, This, byte_code, byte_code_length);
897 if (FAILED(hr))
899 WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
900 HeapFree(GetProcessHeap(), 0, object);
903 TRACE("Created geometry shader %p.\n", object);
904 *shader = &object->ID3D10GeometryShader_iface;
906 return S_OK;
909 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
910 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
911 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
913 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
914 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
915 iface, byte_code, byte_code_length, output_stream_decls,
916 output_stream_decl_count, output_stream_stride, shader);
918 return E_NOTIMPL;
921 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
922 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
924 struct d3d10_device *This = impl_from_ID3D10Device(iface);
925 struct d3d10_pixel_shader *object;
926 HRESULT hr;
928 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
929 iface, byte_code, byte_code_length, shader);
931 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
932 if (!object)
934 ERR("Failed to allocate D3D10 pixel shader object memory\n");
935 return E_OUTOFMEMORY;
938 hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
939 if (FAILED(hr))
941 WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
942 HeapFree(GetProcessHeap(), 0, object);
943 return hr;
946 TRACE("Created pixel shader %p.\n", object);
947 *shader = &object->ID3D10PixelShader_iface;
949 return S_OK;
952 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
953 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
955 struct d3d10_blend_state *object;
956 HRESULT hr;
958 TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
960 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
961 if (!object)
963 ERR("Failed to allocate D3D10 blend state object memory.\n");
964 return E_OUTOFMEMORY;
967 hr = d3d10_blend_state_init(object);
968 if (FAILED(hr))
970 WARN("Failed to initialize blend state, hr %#x.\n", hr);
971 HeapFree(GetProcessHeap(), 0, object);
972 return hr;
975 TRACE("Created blend state %p.\n", object);
976 *blend_state = &object->ID3D10BlendState_iface;
978 return S_OK;
981 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
982 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
984 struct d3d10_depthstencil_state *object;
985 HRESULT hr;
987 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface, desc, depth_stencil_state);
989 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
990 if (!object)
992 ERR("Failed to allocate D3D10 depthstencil state object memory.\n");
993 return E_OUTOFMEMORY;
996 hr = d3d10_depthstencil_state_init(object);
997 if (FAILED(hr))
999 WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
1000 HeapFree(GetProcessHeap(), 0, object);
1001 return hr;
1004 TRACE("Created depthstencil state %p.\n", object);
1005 *depth_stencil_state = &object->ID3D10DepthStencilState_iface;
1007 return S_OK;
1010 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1011 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1013 struct d3d10_rasterizer_state *object;
1014 HRESULT hr;
1016 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
1018 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1019 if (!object)
1021 ERR("Failed to allocate D3D10 rasterizer state object memory.\n");
1022 return E_OUTOFMEMORY;
1025 hr = d3d10_rasterizer_state_init(object);
1026 if (FAILED(hr))
1028 WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
1029 HeapFree(GetProcessHeap(), 0, object);
1030 return hr;
1033 TRACE("Created rasterizer state %p.\n", object);
1034 *rasterizer_state = &object->ID3D10RasterizerState_iface;
1036 return S_OK;
1039 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1040 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1042 struct d3d10_sampler_state *object;
1043 HRESULT hr;
1045 FIXME("iface %p, desc %p, sampler_state %p.\n", iface, desc, sampler_state);
1047 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1048 if (!object)
1050 ERR("Failed to allocate D3D10 sampler state object memory.\n");
1051 return E_OUTOFMEMORY;
1054 hr = d3d10_sampler_state_init(object);
1055 if (FAILED(hr))
1057 WARN("Failed to initialize sampler state, hr %#x.\n", hr);
1058 HeapFree(GetProcessHeap(), 0, object);
1059 return hr;
1062 TRACE("Created sampler state %p.\n", object);
1063 *sampler_state = &object->ID3D10SamplerState_iface;
1065 return S_OK;
1068 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1069 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1071 struct d3d10_query *object;
1072 HRESULT hr;
1074 TRACE("iface %p, desc %p, query %p.\n", iface, desc, query);
1076 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1077 if (!object)
1079 ERR("Failed to allocate D3D10 query object memory.\n");
1080 return E_OUTOFMEMORY;
1083 hr = d3d10_query_init(object);
1084 if (FAILED(hr))
1086 WARN("Failed to initialize query, hr %#x.\n", hr);
1087 HeapFree(GetProcessHeap(), 0, object);
1088 return hr;
1091 TRACE("Created query %p.\n", object);
1092 *query = &object->ID3D10Query_iface;
1094 return S_OK;
1097 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1098 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1100 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1102 return E_NOTIMPL;
1105 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1106 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1108 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1110 return E_NOTIMPL;
1113 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1114 DXGI_FORMAT format, UINT *format_support)
1116 FIXME("iface %p, format %s, format_support %p stub!\n",
1117 iface, debug_dxgi_format(format), format_support);
1119 return E_NOTIMPL;
1122 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1123 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1125 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1126 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1128 return E_NOTIMPL;
1131 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1133 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1136 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1137 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1138 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1140 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1141 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1142 iface, desc, type, active_counters, name, name_length,
1143 units, units_length, description, description_length);
1145 return E_NOTIMPL;
1148 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1150 FIXME("iface %p stub!\n", iface);
1152 return 0;
1155 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1156 HANDLE resource_handle, REFIID guid, void **resource)
1158 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1159 iface, resource_handle, debugstr_guid(guid), resource);
1161 return E_NOTIMPL;
1164 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1166 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1169 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1171 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1174 static const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1176 /* IUnknown methods */
1177 d3d10_device_QueryInterface,
1178 d3d10_device_AddRef,
1179 d3d10_device_Release,
1180 /* ID3D10Device methods */
1181 d3d10_device_VSSetConstantBuffers,
1182 d3d10_device_PSSetShaderResources,
1183 d3d10_device_PSSetShader,
1184 d3d10_device_PSSetSamplers,
1185 d3d10_device_VSSetShader,
1186 d3d10_device_DrawIndexed,
1187 d3d10_device_Draw,
1188 d3d10_device_PSSetConstantBuffers,
1189 d3d10_device_IASetInputLayout,
1190 d3d10_device_IASetVertexBuffers,
1191 d3d10_device_IASetIndexBuffer,
1192 d3d10_device_DrawIndexedInstanced,
1193 d3d10_device_DrawInstanced,
1194 d3d10_device_GSSetConstantBuffers,
1195 d3d10_device_GSSetShader,
1196 d3d10_device_IASetPrimitiveTopology,
1197 d3d10_device_VSSetShaderResources,
1198 d3d10_device_VSSetSamplers,
1199 d3d10_device_SetPredication,
1200 d3d10_device_GSSetShaderResources,
1201 d3d10_device_GSSetSamplers,
1202 d3d10_device_OMSetRenderTargets,
1203 d3d10_device_OMSetBlendState,
1204 d3d10_device_OMSetDepthStencilState,
1205 d3d10_device_SOSetTargets,
1206 d3d10_device_DrawAuto,
1207 d3d10_device_RSSetState,
1208 d3d10_device_RSSetViewports,
1209 d3d10_device_RSSetScissorRects,
1210 d3d10_device_CopySubresourceRegion,
1211 d3d10_device_CopyResource,
1212 d3d10_device_UpdateSubresource,
1213 d3d10_device_ClearRenderTargetView,
1214 d3d10_device_ClearDepthStencilView,
1215 d3d10_device_GenerateMips,
1216 d3d10_device_ResolveSubresource,
1217 d3d10_device_VSGetConstantBuffers,
1218 d3d10_device_PSGetShaderResources,
1219 d3d10_device_PSGetShader,
1220 d3d10_device_PSGetSamplers,
1221 d3d10_device_VSGetShader,
1222 d3d10_device_PSGetConstantBuffers,
1223 d3d10_device_IAGetInputLayout,
1224 d3d10_device_IAGetVertexBuffers,
1225 d3d10_device_IAGetIndexBuffer,
1226 d3d10_device_GSGetConstantBuffers,
1227 d3d10_device_GSGetShader,
1228 d3d10_device_IAGetPrimitiveTopology,
1229 d3d10_device_VSGetShaderResources,
1230 d3d10_device_VSGetSamplers,
1231 d3d10_device_GetPredication,
1232 d3d10_device_GSGetShaderResources,
1233 d3d10_device_GSGetSamplers,
1234 d3d10_device_OMGetRenderTargets,
1235 d3d10_device_OMGetBlendState,
1236 d3d10_device_OMGetDepthStencilState,
1237 d3d10_device_SOGetTargets,
1238 d3d10_device_RSGetState,
1239 d3d10_device_RSGetViewports,
1240 d3d10_device_RSGetScissorRects,
1241 d3d10_device_GetDeviceRemovedReason,
1242 d3d10_device_SetExceptionMode,
1243 d3d10_device_GetExceptionMode,
1244 d3d10_device_GetPrivateData,
1245 d3d10_device_SetPrivateData,
1246 d3d10_device_SetPrivateDataInterface,
1247 d3d10_device_ClearState,
1248 d3d10_device_Flush,
1249 d3d10_device_CreateBuffer,
1250 d3d10_device_CreateTexture1D,
1251 d3d10_device_CreateTexture2D,
1252 d3d10_device_CreateTexture3D,
1253 d3d10_device_CreateShaderResourceView,
1254 d3d10_device_CreateRenderTargetView,
1255 d3d10_device_CreateDepthStencilView,
1256 d3d10_device_CreateInputLayout,
1257 d3d10_device_CreateVertexShader,
1258 d3d10_device_CreateGeometryShader,
1259 d3d10_device_CreateGeometryShaderWithStreamOutput,
1260 d3d10_device_CreatePixelShader,
1261 d3d10_device_CreateBlendState,
1262 d3d10_device_CreateDepthStencilState,
1263 d3d10_device_CreateRasterizerState,
1264 d3d10_device_CreateSamplerState,
1265 d3d10_device_CreateQuery,
1266 d3d10_device_CreatePredicate,
1267 d3d10_device_CreateCounter,
1268 d3d10_device_CheckFormatSupport,
1269 d3d10_device_CheckMultisampleQualityLevels,
1270 d3d10_device_CheckCounterInfo,
1271 d3d10_device_CheckCounter,
1272 d3d10_device_GetCreationFlags,
1273 d3d10_device_OpenSharedResource,
1274 d3d10_device_SetTextFilterSize,
1275 d3d10_device_GetTextFilterSize,
1278 static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1280 /* IUnknown methods */
1281 d3d10_device_inner_QueryInterface,
1282 d3d10_device_inner_AddRef,
1283 d3d10_device_inner_Release,
1286 static void STDMETHODCALLTYPE d3d10_subresource_destroyed(void *parent) {}
1288 static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
1290 d3d10_subresource_destroyed,
1293 /* IWineDXGIDeviceParent IUnknown methods */
1295 static inline struct d3d10_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
1297 return CONTAINING_RECORD(iface, struct d3d10_device, IWineDXGIDeviceParent_iface);
1300 static HRESULT STDMETHODCALLTYPE dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent *iface,
1301 REFIID riid, void **ppv)
1303 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1304 return IUnknown_QueryInterface(device->outer_unk, riid, ppv);
1307 static ULONG STDMETHODCALLTYPE dxgi_device_parent_AddRef(IWineDXGIDeviceParent *iface)
1309 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1310 return IUnknown_AddRef(device->outer_unk);
1313 static ULONG STDMETHODCALLTYPE dxgi_device_parent_Release(IWineDXGIDeviceParent *iface)
1315 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1316 return IUnknown_Release(device->outer_unk);
1319 static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
1320 IWineDXGIDeviceParent *iface)
1322 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1323 return &device->device_parent;
1326 static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl =
1328 /* IUnknown methods */
1329 dxgi_device_parent_QueryInterface,
1330 dxgi_device_parent_AddRef,
1331 dxgi_device_parent_Release,
1332 /* IWineDXGIDeviceParent methods */
1333 dxgi_device_parent_get_wined3d_device_parent,
1336 static inline struct d3d10_device *device_from_wined3d_device_parent(struct wined3d_device_parent *device_parent)
1338 return CONTAINING_RECORD(device_parent, struct d3d10_device, device_parent);
1341 static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
1342 struct wined3d_device *wined3d_device)
1344 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1346 TRACE("device_parent %p, wined3d_device %p.\n", device_parent, wined3d_device);
1348 wined3d_device_incref(wined3d_device);
1349 device->wined3d_device = wined3d_device;
1352 static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
1354 TRACE("device_parent %p.\n", device_parent);
1357 static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
1358 void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
1359 enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
1361 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1362 struct d3d10_texture2d *texture;
1363 D3D10_TEXTURE2D_DESC desc;
1364 HRESULT hr;
1366 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
1367 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1368 device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
1370 FIXME("Implement DXGI<->wined3d usage conversion\n");
1372 desc.Width = width;
1373 desc.Height = height;
1374 desc.MipLevels = 1;
1375 desc.ArraySize = 1;
1376 desc.Format = dxgi_format_from_wined3dformat(format);
1377 desc.SampleDesc.Count = 1;
1378 desc.SampleDesc.Quality = 0;
1379 desc.Usage = usage;
1380 desc.BindFlags = 0;
1381 desc.CPUAccessFlags = 0;
1382 desc.MiscFlags = 0;
1384 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1385 (ID3D10Texture2D **)&texture);
1386 if (FAILED(hr))
1388 ERR("CreateTexture2D failed, returning %#x\n", hr);
1389 return hr;
1392 *surface = texture->wined3d_surface;
1393 wined3d_surface_incref(*surface);
1394 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1396 return S_OK;
1399 static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
1400 void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
1401 enum wined3d_multisample_type multisample_type, DWORD multisample_quality, BOOL lockable,
1402 struct wined3d_surface **surface)
1404 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1405 struct d3d10_texture2d *texture;
1406 D3D10_TEXTURE2D_DESC desc;
1407 HRESULT hr;
1409 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1410 "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1411 device_parent, container_parent, width, height, format, multisample_type,
1412 multisample_quality, lockable, surface);
1414 FIXME("Implement DXGI<->wined3d usage conversion\n");
1416 desc.Width = width;
1417 desc.Height = height;
1418 desc.MipLevels = 1;
1419 desc.ArraySize = 1;
1420 desc.Format = dxgi_format_from_wined3dformat(format);
1421 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1422 desc.SampleDesc.Quality = multisample_quality;
1423 desc.Usage = D3D10_USAGE_DEFAULT;
1424 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1425 desc.CPUAccessFlags = 0;
1426 desc.MiscFlags = 0;
1428 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1429 (ID3D10Texture2D **)&texture);
1430 if (FAILED(hr))
1432 ERR("CreateTexture2D failed, returning %#x\n", hr);
1433 return hr;
1436 *surface = texture->wined3d_surface;
1437 wined3d_surface_incref(*surface);
1438 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1440 return S_OK;
1443 static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
1444 UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
1445 DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
1447 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1448 struct d3d10_texture2d *texture;
1449 D3D10_TEXTURE2D_DESC desc;
1450 HRESULT hr;
1452 FIXME("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1453 "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1454 device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
1456 FIXME("Implement DXGI<->wined3d usage conversion\n");
1458 desc.Width = width;
1459 desc.Height = height;
1460 desc.MipLevels = 1;
1461 desc.ArraySize = 1;
1462 desc.Format = dxgi_format_from_wined3dformat(format);
1463 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1464 desc.SampleDesc.Quality = multisample_quality;
1465 desc.Usage = D3D10_USAGE_DEFAULT;
1466 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1467 desc.CPUAccessFlags = 0;
1468 desc.MiscFlags = 0;
1470 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1471 (ID3D10Texture2D **)&texture);
1472 if (FAILED(hr))
1474 ERR("CreateTexture2D failed, returning %#x\n", hr);
1475 return hr;
1478 *surface = texture->wined3d_surface;
1479 wined3d_surface_incref(*surface);
1480 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1482 return S_OK;
1485 static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
1486 void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
1487 enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume)
1489 HRESULT hr;
1491 TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
1492 "format %#x, pool %#x, usage %#x, volume %p.\n",
1493 device_parent, container_parent, width, height, depth,
1494 format, pool, usage, volume);
1496 hr = wined3d_volume_create(device_from_wined3d_device_parent(device_parent)->wined3d_device,
1497 width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
1498 if (FAILED(hr))
1500 WARN("Failed to create wined3d volume, hr %#x.\n", hr);
1501 return hr;
1504 return S_OK;
1507 static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
1508 struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
1510 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1511 IWineDXGIDevice *wine_device;
1512 HRESULT hr;
1514 TRACE("device_parent %p, desc %p, swapchain %p\n", device_parent, desc, swapchain);
1516 hr = d3d10_device_QueryInterface(&device->ID3D10Device_iface, &IID_IWineDXGIDevice,
1517 (void **)&wine_device);
1518 if (FAILED(hr))
1520 ERR("Device should implement IWineDXGIDevice\n");
1521 return E_FAIL;
1524 hr = IWineDXGIDevice_create_swapchain(wine_device, desc, swapchain);
1525 IWineDXGIDevice_Release(wine_device);
1526 if (FAILED(hr))
1528 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1529 return hr;
1532 return S_OK;
1535 static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
1537 device_parent_wined3d_device_created,
1538 device_parent_mode_changed,
1539 device_parent_create_surface,
1540 device_parent_create_rendertarget,
1541 device_parent_create_depth_stencil,
1542 device_parent_create_volume,
1543 device_parent_create_swapchain,
1546 void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
1548 device->ID3D10Device_iface.lpVtbl = &d3d10_device_vtbl;
1549 device->IUnknown_inner.lpVtbl = &d3d10_device_inner_unknown_vtbl;
1550 device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
1551 device->device_parent.ops = &d3d10_wined3d_device_parent_ops;
1552 device->refcount = 1;
1553 /* COM aggregation always takes place */
1554 device->outer_unk = outer_unknown;