wined3d: Get rid of the "discard" parameter to device_parent_create_depth_stencil().
[wine/multimedia.git] / dlls / d3d10core / device.c
blob3fd0c490ba4d7fa07bd1d4c6b5c4ec9ba0fef3bd
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 struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
208 wined3d_device_set_stream_source(This->wined3d_device, start_slot,
209 buffer ? buffer->wined3d_buffer : NULL, offsets[i], strides[i]);
213 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
214 ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
216 struct d3d10_device *This = impl_from_ID3D10Device(iface);
217 struct d3d10_buffer *buffer_impl = unsafe_impl_from_ID3D10Buffer(buffer);
219 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
220 iface, buffer, debug_dxgi_format(format), offset);
222 wined3d_device_set_index_buffer(This->wined3d_device,
223 buffer_impl ? buffer_impl->wined3d_buffer : NULL,
224 wined3dformat_from_dxgi_format(format));
225 if (offset) FIXME("offset %u not supported.\n", offset);
228 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
229 UINT instance_index_count, UINT instance_count, UINT start_index_location,
230 INT base_vertex_location, UINT start_instance_location)
232 FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
233 "\tbase_vertex_location %d, start_instance_location %u stub!\n",
234 iface, instance_index_count, instance_count, start_index_location,
235 base_vertex_location, start_instance_location);
238 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
239 UINT instance_vertex_count, UINT instance_count,
240 UINT start_vertex_location, UINT start_instance_location)
242 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
243 "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
244 start_vertex_location, start_instance_location);
247 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
248 UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
250 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
251 iface, start_slot, buffer_count, buffers);
254 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
256 if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
257 else WARN("iface %p, shader %p stub!\n", iface, shader);
260 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface,
261 D3D10_PRIMITIVE_TOPOLOGY topology)
263 struct d3d10_device *This = impl_from_ID3D10Device(iface);
265 TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
267 wined3d_device_set_primitive_type(This->wined3d_device, (enum wined3d_primitive_type)topology);
270 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
271 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
273 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
274 iface, start_slot, view_count, views);
277 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
278 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
280 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
281 iface, start_slot, sampler_count, samplers);
284 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
286 FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
289 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
290 UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
292 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
293 iface, start_slot, view_count, views);
296 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
297 UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
299 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
300 iface, start_slot, sampler_count, samplers);
303 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
304 UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
305 ID3D10DepthStencilView *depth_stencil_view)
307 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
308 iface, render_target_view_count, render_target_views, depth_stencil_view);
311 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
312 ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
314 FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
315 iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
318 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
319 ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
321 FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
322 iface, depth_stencil_state, stencil_ref);
325 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
326 UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
328 FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
331 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
333 FIXME("iface %p stub!\n", iface);
336 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
338 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
341 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
342 UINT viewport_count, const D3D10_VIEWPORT *viewports)
344 FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
347 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
348 UINT rect_count, const D3D10_RECT *rects)
350 FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
353 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
354 ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
355 ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
357 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
358 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
359 iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
360 src_resource, src_subresource_idx, src_box);
363 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
364 ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
366 FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
369 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
370 ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
371 const void *data, UINT row_pitch, UINT depth_pitch)
373 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
374 iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
377 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
378 ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
380 struct d3d10_device *This = impl_from_ID3D10Device(iface);
381 struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
382 const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
384 TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
385 iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
387 wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color);
390 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
391 ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
393 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
394 iface, depth_stencil_view, flags, depth, stencil);
397 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
399 FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
402 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
403 ID3D10Resource *dst_resource, UINT dst_subresource_idx,
404 ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
406 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
407 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
408 iface, dst_resource, dst_subresource_idx,
409 src_resource, src_subresource_idx, debug_dxgi_format(format));
412 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
413 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
415 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
416 iface, start_slot, buffer_count, buffers);
419 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
420 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
422 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
423 iface, start_slot, view_count, views);
426 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
428 FIXME("iface %p, shader %p stub!\n", iface, shader);
431 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
432 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
434 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
435 iface, start_slot, sampler_count, samplers);
438 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
440 FIXME("iface %p, shader %p stub!\n", iface, shader);
443 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
444 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
446 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
447 iface, start_slot, buffer_count, buffers);
450 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
452 FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
455 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
456 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
458 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
459 iface, start_slot, buffer_count, buffers, strides, offsets);
462 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
463 ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
465 FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
468 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
469 UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
471 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
472 iface, start_slot, buffer_count, buffers);
475 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
477 FIXME("iface %p, shader %p stub!\n", iface, shader);
480 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface,
481 D3D10_PRIMITIVE_TOPOLOGY *topology)
483 struct d3d10_device *This = impl_from_ID3D10Device(iface);
485 TRACE("iface %p, topology %p\n", iface, topology);
487 wined3d_device_get_primitive_type(This->wined3d_device, (enum wined3d_primitive_type *)topology);
490 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
491 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
493 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
494 iface, start_slot, view_count, views);
497 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
498 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
500 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
501 iface, start_slot, sampler_count, samplers);
504 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
505 ID3D10Predicate **predicate, BOOL *value)
507 FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
510 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
511 UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
513 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
514 iface, start_slot, view_count, views);
517 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
518 UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
520 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
521 iface, start_slot, sampler_count, samplers);
524 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
525 UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
527 FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
528 iface, view_count, render_target_views, depth_stencil_view);
531 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
532 ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
534 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
535 iface, blend_state, blend_factor, sample_mask);
538 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
539 ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
541 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
542 iface, depth_stencil_state, stencil_ref);
545 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
546 UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
548 FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
549 iface, buffer_count, buffers, offsets);
552 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
554 FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
557 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
558 UINT *viewport_count, D3D10_VIEWPORT *viewports)
560 FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
563 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
565 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
568 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
570 FIXME("iface %p stub!\n", iface);
572 return E_NOTIMPL;
575 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
577 FIXME("iface %p, flags %#x stub!\n", iface, flags);
579 return E_NOTIMPL;
582 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
584 FIXME("iface %p stub!\n", iface);
586 return 0;
589 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
590 REFGUID guid, UINT *data_size, void *data)
592 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
593 iface, debugstr_guid(guid), data_size, data);
595 return E_NOTIMPL;
598 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
599 REFGUID guid, UINT data_size, const void *data)
601 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
602 iface, debugstr_guid(guid), data_size, data);
604 return E_NOTIMPL;
607 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
608 REFGUID guid, const IUnknown *data)
610 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
612 return E_NOTIMPL;
615 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
617 FIXME("iface %p stub!\n", iface);
620 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
622 FIXME("iface %p stub!\n", iface);
625 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
626 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
628 struct d3d10_device *This = impl_from_ID3D10Device(iface);
629 struct d3d10_buffer *object;
630 HRESULT hr;
632 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
634 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
635 if (!object)
637 ERR("Failed to allocate D3D10 buffer object memory\n");
638 return E_OUTOFMEMORY;
641 hr = d3d10_buffer_init(object, This, desc, data);
642 if (FAILED(hr))
644 WARN("Failed to initialize buffer, hr %#x.\n", hr);
645 HeapFree(GetProcessHeap(), 0, object);
646 return hr;
649 *buffer = &object->ID3D10Buffer_iface;
651 TRACE("Created ID3D10Buffer %p\n", object);
653 return S_OK;
656 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
657 const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
659 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
661 return E_NOTIMPL;
664 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
665 const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
666 ID3D10Texture2D **texture)
668 struct d3d10_device *This = impl_from_ID3D10Device(iface);
669 struct d3d10_texture2d *object;
670 HRESULT hr;
672 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
674 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
675 if (!object)
677 ERR("Failed to allocate D3D10 texture2d object memory\n");
678 return E_OUTOFMEMORY;
681 hr = d3d10_texture2d_init(object, This, desc);
682 if (FAILED(hr))
684 WARN("Failed to initialize texture, hr %#x.\n", hr);
685 HeapFree(GetProcessHeap(), 0, object);
686 return hr;
689 *texture = &object->ID3D10Texture2D_iface;
691 TRACE("Created ID3D10Texture2D %p\n", object);
693 return S_OK;
696 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
697 const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
698 ID3D10Texture3D **texture)
700 struct d3d10_device *device = impl_from_ID3D10Device(iface);
701 struct d3d10_texture3d *object;
702 HRESULT hr;
704 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
706 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
707 if (!object)
709 ERR("Failed to allocate D3D10 texture3d object memory.\n");
710 return E_OUTOFMEMORY;
713 hr = d3d10_texture3d_init(object, device, desc);
714 if (FAILED(hr))
716 WARN("Failed to initialize texture, hr %#x.\n", hr);
717 HeapFree(GetProcessHeap(), 0, object);
718 return hr;
721 TRACE("Created 3D texture %p.\n", object);
722 *texture = &object->ID3D10Texture3D_iface;
724 return S_OK;
727 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
728 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
730 struct d3d10_shader_resource_view *object;
731 HRESULT hr;
733 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
735 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
736 if (!object)
738 ERR("Failed to allocate D3D10 shader resource view object memory.\n");
739 return E_OUTOFMEMORY;
742 hr = d3d10_shader_resource_view_init(object);
743 if (FAILED(hr))
745 WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
746 HeapFree(GetProcessHeap(), 0, object);
747 return hr;
750 TRACE("Created shader resource view %p.\n", object);
751 *view = &object->ID3D10ShaderResourceView_iface;
753 return S_OK;
756 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
757 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
759 struct d3d10_rendertarget_view *object;
760 HRESULT hr;
762 TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
764 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
765 if (!object)
767 ERR("Failed to allocate D3D10 rendertarget view object memory\n");
768 return E_OUTOFMEMORY;
771 hr = d3d10_rendertarget_view_init(object, resource, desc);
772 if (FAILED(hr))
774 WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
775 HeapFree(GetProcessHeap(), 0, object);
776 return hr;
779 TRACE("Created rendertarget view %p.\n", object);
780 *view = &object->ID3D10RenderTargetView_iface;
782 return S_OK;
785 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
786 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
788 struct d3d10_depthstencil_view *object;
789 HRESULT hr;
791 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
793 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
794 if (!object)
796 ERR("Failed to allocate D3D10 depthstencil view object memory.\n");
797 return E_OUTOFMEMORY;
800 hr = d3d10_depthstencil_view_init(object);
801 if (FAILED(hr))
803 WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
804 HeapFree(GetProcessHeap(), 0, object);
805 return hr;
808 TRACE("Created depthstencil view %p.\n", object);
809 *view = &object->ID3D10DepthStencilView_iface;
811 return S_OK;
814 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
815 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
816 const void *shader_byte_code, SIZE_T shader_byte_code_length,
817 ID3D10InputLayout **input_layout)
819 struct d3d10_device *This = impl_from_ID3D10Device(iface);
820 struct d3d10_input_layout *object;
821 HRESULT hr;
823 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
824 "\tshader_byte_code_length %lu, input_layout %p\n",
825 iface, element_descs, element_count, shader_byte_code,
826 shader_byte_code_length, input_layout);
828 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
829 if (!object)
831 ERR("Failed to allocate D3D10 input layout object memory\n");
832 return E_OUTOFMEMORY;
835 hr = d3d10_input_layout_init(object, This, element_descs, element_count,
836 shader_byte_code, shader_byte_code_length);
837 if (FAILED(hr))
839 WARN("Failed to initialize input layout, hr %#x.\n", hr);
840 HeapFree(GetProcessHeap(), 0, object);
841 return hr;
844 TRACE("Created input layout %p.\n", object);
845 *input_layout = &object->ID3D10InputLayout_iface;
847 return S_OK;
850 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
851 const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
853 struct d3d10_device *This = impl_from_ID3D10Device(iface);
854 struct d3d10_vertex_shader *object;
855 HRESULT hr;
857 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
858 iface, byte_code, byte_code_length, shader);
860 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
861 if (!object)
863 ERR("Failed to allocate D3D10 vertex shader object memory\n");
864 return E_OUTOFMEMORY;
867 hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
868 if (FAILED(hr))
870 WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
871 HeapFree(GetProcessHeap(), 0, object);
872 return hr;
875 TRACE("Created vertex shader %p.\n", object);
876 *shader = &object->ID3D10VertexShader_iface;
878 return S_OK;
881 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
882 const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
884 struct d3d10_device *This = impl_from_ID3D10Device(iface);
885 struct d3d10_geometry_shader *object;
886 HRESULT hr;
888 FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
889 iface, byte_code, byte_code_length, shader);
891 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
892 if (!object)
894 ERR("Failed to allocate D3D10 geometry shader object memory\n");
895 return E_OUTOFMEMORY;
898 hr = d3d10_geometry_shader_init(object, This, byte_code, byte_code_length);
899 if (FAILED(hr))
901 WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
902 HeapFree(GetProcessHeap(), 0, object);
905 TRACE("Created geometry shader %p.\n", object);
906 *shader = &object->ID3D10GeometryShader_iface;
908 return S_OK;
911 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
912 const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
913 UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
915 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
916 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
917 iface, byte_code, byte_code_length, output_stream_decls,
918 output_stream_decl_count, output_stream_stride, shader);
920 return E_NOTIMPL;
923 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
924 const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
926 struct d3d10_device *This = impl_from_ID3D10Device(iface);
927 struct d3d10_pixel_shader *object;
928 HRESULT hr;
930 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
931 iface, byte_code, byte_code_length, shader);
933 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
934 if (!object)
936 ERR("Failed to allocate D3D10 pixel shader object memory\n");
937 return E_OUTOFMEMORY;
940 hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
941 if (FAILED(hr))
943 WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
944 HeapFree(GetProcessHeap(), 0, object);
945 return hr;
948 TRACE("Created pixel shader %p.\n", object);
949 *shader = &object->ID3D10PixelShader_iface;
951 return S_OK;
954 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
955 const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
957 struct d3d10_blend_state *object;
958 HRESULT hr;
960 TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
962 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
963 if (!object)
965 ERR("Failed to allocate D3D10 blend state object memory.\n");
966 return E_OUTOFMEMORY;
969 hr = d3d10_blend_state_init(object);
970 if (FAILED(hr))
972 WARN("Failed to initialize blend state, hr %#x.\n", hr);
973 HeapFree(GetProcessHeap(), 0, object);
974 return hr;
977 TRACE("Created blend state %p.\n", object);
978 *blend_state = &object->ID3D10BlendState_iface;
980 return S_OK;
983 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
984 const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
986 struct d3d10_depthstencil_state *object;
987 HRESULT hr;
989 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface, desc, depth_stencil_state);
991 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
992 if (!object)
994 ERR("Failed to allocate D3D10 depthstencil state object memory.\n");
995 return E_OUTOFMEMORY;
998 hr = d3d10_depthstencil_state_init(object);
999 if (FAILED(hr))
1001 WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
1002 HeapFree(GetProcessHeap(), 0, object);
1003 return hr;
1006 TRACE("Created depthstencil state %p.\n", object);
1007 *depth_stencil_state = &object->ID3D10DepthStencilState_iface;
1009 return S_OK;
1012 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
1013 const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
1015 struct d3d10_rasterizer_state *object;
1016 HRESULT hr;
1018 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
1020 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1021 if (!object)
1023 ERR("Failed to allocate D3D10 rasterizer state object memory.\n");
1024 return E_OUTOFMEMORY;
1027 hr = d3d10_rasterizer_state_init(object);
1028 if (FAILED(hr))
1030 WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
1031 HeapFree(GetProcessHeap(), 0, object);
1032 return hr;
1035 TRACE("Created rasterizer state %p.\n", object);
1036 *rasterizer_state = &object->ID3D10RasterizerState_iface;
1038 return S_OK;
1041 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1042 const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1044 struct d3d10_sampler_state *object;
1045 HRESULT hr;
1047 FIXME("iface %p, desc %p, sampler_state %p.\n", iface, desc, sampler_state);
1049 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1050 if (!object)
1052 ERR("Failed to allocate D3D10 sampler state object memory.\n");
1053 return E_OUTOFMEMORY;
1056 hr = d3d10_sampler_state_init(object);
1057 if (FAILED(hr))
1059 WARN("Failed to initialize sampler state, hr %#x.\n", hr);
1060 HeapFree(GetProcessHeap(), 0, object);
1061 return hr;
1064 TRACE("Created sampler state %p.\n", object);
1065 *sampler_state = &object->ID3D10SamplerState_iface;
1067 return S_OK;
1070 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1071 const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1073 struct d3d10_query *object;
1074 HRESULT hr;
1076 TRACE("iface %p, desc %p, query %p.\n", iface, desc, query);
1078 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1079 if (!object)
1081 ERR("Failed to allocate D3D10 query object memory.\n");
1082 return E_OUTOFMEMORY;
1085 hr = d3d10_query_init(object);
1086 if (FAILED(hr))
1088 WARN("Failed to initialize query, hr %#x.\n", hr);
1089 HeapFree(GetProcessHeap(), 0, object);
1090 return hr;
1093 TRACE("Created query %p.\n", object);
1094 *query = &object->ID3D10Query_iface;
1096 return S_OK;
1099 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1100 const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1102 FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1104 return E_NOTIMPL;
1107 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1108 const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1110 FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1112 return E_NOTIMPL;
1115 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1116 DXGI_FORMAT format, UINT *format_support)
1118 FIXME("iface %p, format %s, format_support %p stub!\n",
1119 iface, debug_dxgi_format(format), format_support);
1121 return E_NOTIMPL;
1124 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1125 DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1127 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1128 iface, debug_dxgi_format(format), sample_count, quality_level_count);
1130 return E_NOTIMPL;
1133 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1135 FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1138 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1139 const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1140 UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1142 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1143 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1144 iface, desc, type, active_counters, name, name_length,
1145 units, units_length, description, description_length);
1147 return E_NOTIMPL;
1150 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1152 FIXME("iface %p stub!\n", iface);
1154 return 0;
1157 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1158 HANDLE resource_handle, REFIID guid, void **resource)
1160 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1161 iface, resource_handle, debugstr_guid(guid), resource);
1163 return E_NOTIMPL;
1166 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1168 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1171 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1173 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1176 static const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1178 /* IUnknown methods */
1179 d3d10_device_QueryInterface,
1180 d3d10_device_AddRef,
1181 d3d10_device_Release,
1182 /* ID3D10Device methods */
1183 d3d10_device_VSSetConstantBuffers,
1184 d3d10_device_PSSetShaderResources,
1185 d3d10_device_PSSetShader,
1186 d3d10_device_PSSetSamplers,
1187 d3d10_device_VSSetShader,
1188 d3d10_device_DrawIndexed,
1189 d3d10_device_Draw,
1190 d3d10_device_PSSetConstantBuffers,
1191 d3d10_device_IASetInputLayout,
1192 d3d10_device_IASetVertexBuffers,
1193 d3d10_device_IASetIndexBuffer,
1194 d3d10_device_DrawIndexedInstanced,
1195 d3d10_device_DrawInstanced,
1196 d3d10_device_GSSetConstantBuffers,
1197 d3d10_device_GSSetShader,
1198 d3d10_device_IASetPrimitiveTopology,
1199 d3d10_device_VSSetShaderResources,
1200 d3d10_device_VSSetSamplers,
1201 d3d10_device_SetPredication,
1202 d3d10_device_GSSetShaderResources,
1203 d3d10_device_GSSetSamplers,
1204 d3d10_device_OMSetRenderTargets,
1205 d3d10_device_OMSetBlendState,
1206 d3d10_device_OMSetDepthStencilState,
1207 d3d10_device_SOSetTargets,
1208 d3d10_device_DrawAuto,
1209 d3d10_device_RSSetState,
1210 d3d10_device_RSSetViewports,
1211 d3d10_device_RSSetScissorRects,
1212 d3d10_device_CopySubresourceRegion,
1213 d3d10_device_CopyResource,
1214 d3d10_device_UpdateSubresource,
1215 d3d10_device_ClearRenderTargetView,
1216 d3d10_device_ClearDepthStencilView,
1217 d3d10_device_GenerateMips,
1218 d3d10_device_ResolveSubresource,
1219 d3d10_device_VSGetConstantBuffers,
1220 d3d10_device_PSGetShaderResources,
1221 d3d10_device_PSGetShader,
1222 d3d10_device_PSGetSamplers,
1223 d3d10_device_VSGetShader,
1224 d3d10_device_PSGetConstantBuffers,
1225 d3d10_device_IAGetInputLayout,
1226 d3d10_device_IAGetVertexBuffers,
1227 d3d10_device_IAGetIndexBuffer,
1228 d3d10_device_GSGetConstantBuffers,
1229 d3d10_device_GSGetShader,
1230 d3d10_device_IAGetPrimitiveTopology,
1231 d3d10_device_VSGetShaderResources,
1232 d3d10_device_VSGetSamplers,
1233 d3d10_device_GetPredication,
1234 d3d10_device_GSGetShaderResources,
1235 d3d10_device_GSGetSamplers,
1236 d3d10_device_OMGetRenderTargets,
1237 d3d10_device_OMGetBlendState,
1238 d3d10_device_OMGetDepthStencilState,
1239 d3d10_device_SOGetTargets,
1240 d3d10_device_RSGetState,
1241 d3d10_device_RSGetViewports,
1242 d3d10_device_RSGetScissorRects,
1243 d3d10_device_GetDeviceRemovedReason,
1244 d3d10_device_SetExceptionMode,
1245 d3d10_device_GetExceptionMode,
1246 d3d10_device_GetPrivateData,
1247 d3d10_device_SetPrivateData,
1248 d3d10_device_SetPrivateDataInterface,
1249 d3d10_device_ClearState,
1250 d3d10_device_Flush,
1251 d3d10_device_CreateBuffer,
1252 d3d10_device_CreateTexture1D,
1253 d3d10_device_CreateTexture2D,
1254 d3d10_device_CreateTexture3D,
1255 d3d10_device_CreateShaderResourceView,
1256 d3d10_device_CreateRenderTargetView,
1257 d3d10_device_CreateDepthStencilView,
1258 d3d10_device_CreateInputLayout,
1259 d3d10_device_CreateVertexShader,
1260 d3d10_device_CreateGeometryShader,
1261 d3d10_device_CreateGeometryShaderWithStreamOutput,
1262 d3d10_device_CreatePixelShader,
1263 d3d10_device_CreateBlendState,
1264 d3d10_device_CreateDepthStencilState,
1265 d3d10_device_CreateRasterizerState,
1266 d3d10_device_CreateSamplerState,
1267 d3d10_device_CreateQuery,
1268 d3d10_device_CreatePredicate,
1269 d3d10_device_CreateCounter,
1270 d3d10_device_CheckFormatSupport,
1271 d3d10_device_CheckMultisampleQualityLevels,
1272 d3d10_device_CheckCounterInfo,
1273 d3d10_device_CheckCounter,
1274 d3d10_device_GetCreationFlags,
1275 d3d10_device_OpenSharedResource,
1276 d3d10_device_SetTextFilterSize,
1277 d3d10_device_GetTextFilterSize,
1280 static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1282 /* IUnknown methods */
1283 d3d10_device_inner_QueryInterface,
1284 d3d10_device_inner_AddRef,
1285 d3d10_device_inner_Release,
1288 static void STDMETHODCALLTYPE d3d10_subresource_destroyed(void *parent) {}
1290 static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
1292 d3d10_subresource_destroyed,
1295 /* IWineDXGIDeviceParent IUnknown methods */
1297 static inline struct d3d10_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
1299 return CONTAINING_RECORD(iface, struct d3d10_device, IWineDXGIDeviceParent_iface);
1302 static HRESULT STDMETHODCALLTYPE dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent *iface,
1303 REFIID riid, void **ppv)
1305 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1306 return IUnknown_QueryInterface(device->outer_unk, riid, ppv);
1309 static ULONG STDMETHODCALLTYPE dxgi_device_parent_AddRef(IWineDXGIDeviceParent *iface)
1311 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1312 return IUnknown_AddRef(device->outer_unk);
1315 static ULONG STDMETHODCALLTYPE dxgi_device_parent_Release(IWineDXGIDeviceParent *iface)
1317 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1318 return IUnknown_Release(device->outer_unk);
1321 static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
1322 IWineDXGIDeviceParent *iface)
1324 struct d3d10_device *device = device_from_dxgi_device_parent(iface);
1325 return &device->device_parent;
1328 static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl =
1330 /* IUnknown methods */
1331 dxgi_device_parent_QueryInterface,
1332 dxgi_device_parent_AddRef,
1333 dxgi_device_parent_Release,
1334 /* IWineDXGIDeviceParent methods */
1335 dxgi_device_parent_get_wined3d_device_parent,
1338 static inline struct d3d10_device *device_from_wined3d_device_parent(struct wined3d_device_parent *device_parent)
1340 return CONTAINING_RECORD(device_parent, struct d3d10_device, device_parent);
1343 static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
1344 struct wined3d_device *wined3d_device)
1346 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1348 TRACE("device_parent %p, wined3d_device %p.\n", device_parent, wined3d_device);
1350 wined3d_device_incref(wined3d_device);
1351 device->wined3d_device = wined3d_device;
1354 static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
1356 TRACE("device_parent %p.\n", device_parent);
1359 static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
1360 void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
1361 enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
1363 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1364 struct d3d10_texture2d *texture;
1365 D3D10_TEXTURE2D_DESC desc;
1366 HRESULT hr;
1368 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
1369 "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1370 device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
1372 FIXME("Implement DXGI<->wined3d usage conversion\n");
1374 desc.Width = width;
1375 desc.Height = height;
1376 desc.MipLevels = 1;
1377 desc.ArraySize = 1;
1378 desc.Format = dxgi_format_from_wined3dformat(format);
1379 desc.SampleDesc.Count = 1;
1380 desc.SampleDesc.Quality = 0;
1381 desc.Usage = usage;
1382 desc.BindFlags = 0;
1383 desc.CPUAccessFlags = 0;
1384 desc.MiscFlags = 0;
1386 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1387 (ID3D10Texture2D **)&texture);
1388 if (FAILED(hr))
1390 ERR("CreateTexture2D failed, returning %#x\n", hr);
1391 return hr;
1394 *surface = texture->wined3d_surface;
1395 wined3d_surface_incref(*surface);
1396 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1398 return S_OK;
1401 static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
1402 void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
1403 enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
1404 struct wined3d_surface **surface)
1406 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1407 struct d3d10_texture2d *texture;
1408 D3D10_TEXTURE2D_DESC desc;
1409 HRESULT hr;
1411 FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1412 "\tmultisample_quality %u, surface %p partial stub!\n",
1413 device_parent, container_parent, width, height, format, multisample_type,
1414 multisample_quality, surface);
1416 FIXME("Implement DXGI<->wined3d usage conversion\n");
1418 desc.Width = width;
1419 desc.Height = height;
1420 desc.MipLevels = 1;
1421 desc.ArraySize = 1;
1422 desc.Format = dxgi_format_from_wined3dformat(format);
1423 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1424 desc.SampleDesc.Quality = multisample_quality;
1425 desc.Usage = D3D10_USAGE_DEFAULT;
1426 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1427 desc.CPUAccessFlags = 0;
1428 desc.MiscFlags = 0;
1430 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1431 (ID3D10Texture2D **)&texture);
1432 if (FAILED(hr))
1434 ERR("CreateTexture2D failed, returning %#x\n", hr);
1435 return hr;
1438 *surface = texture->wined3d_surface;
1439 wined3d_surface_incref(*surface);
1440 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1442 return S_OK;
1445 static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
1446 UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
1447 DWORD multisample_quality, struct wined3d_surface **surface)
1449 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1450 struct d3d10_texture2d *texture;
1451 D3D10_TEXTURE2D_DESC desc;
1452 HRESULT hr;
1454 FIXME("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1455 "\tmultisample_quality %u, surface %p partial stub!\n",
1456 device_parent, width, height, format, multisample_type, multisample_quality, surface);
1458 FIXME("Implement DXGI<->wined3d usage conversion\n");
1460 desc.Width = width;
1461 desc.Height = height;
1462 desc.MipLevels = 1;
1463 desc.ArraySize = 1;
1464 desc.Format = dxgi_format_from_wined3dformat(format);
1465 desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1466 desc.SampleDesc.Quality = multisample_quality;
1467 desc.Usage = D3D10_USAGE_DEFAULT;
1468 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1469 desc.CPUAccessFlags = 0;
1470 desc.MiscFlags = 0;
1472 hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
1473 (ID3D10Texture2D **)&texture);
1474 if (FAILED(hr))
1476 ERR("CreateTexture2D failed, returning %#x\n", hr);
1477 return hr;
1480 *surface = texture->wined3d_surface;
1481 wined3d_surface_incref(*surface);
1482 ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
1484 return S_OK;
1487 static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
1488 void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
1489 enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume)
1491 HRESULT hr;
1493 TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
1494 "format %#x, pool %#x, usage %#x, volume %p.\n",
1495 device_parent, container_parent, width, height, depth,
1496 format, pool, usage, volume);
1498 hr = wined3d_volume_create(device_from_wined3d_device_parent(device_parent)->wined3d_device,
1499 width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
1500 if (FAILED(hr))
1502 WARN("Failed to create wined3d volume, hr %#x.\n", hr);
1503 return hr;
1506 return S_OK;
1509 static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
1510 struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
1512 struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
1513 IWineDXGIDevice *wine_device;
1514 HRESULT hr;
1516 TRACE("device_parent %p, desc %p, swapchain %p\n", device_parent, desc, swapchain);
1518 hr = d3d10_device_QueryInterface(&device->ID3D10Device_iface, &IID_IWineDXGIDevice,
1519 (void **)&wine_device);
1520 if (FAILED(hr))
1522 ERR("Device should implement IWineDXGIDevice\n");
1523 return E_FAIL;
1526 hr = IWineDXGIDevice_create_swapchain(wine_device, desc, swapchain);
1527 IWineDXGIDevice_Release(wine_device);
1528 if (FAILED(hr))
1530 ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1531 return hr;
1534 return S_OK;
1537 static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
1539 device_parent_wined3d_device_created,
1540 device_parent_mode_changed,
1541 device_parent_create_surface,
1542 device_parent_create_rendertarget,
1543 device_parent_create_depth_stencil,
1544 device_parent_create_volume,
1545 device_parent_create_swapchain,
1548 void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
1550 device->ID3D10Device_iface.lpVtbl = &d3d10_device_vtbl;
1551 device->IUnknown_inner.lpVtbl = &d3d10_device_inner_unknown_vtbl;
1552 device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
1553 device->device_parent.ops = &d3d10_wined3d_device_parent_ops;
1554 device->refcount = 1;
1555 /* COM aggregation always takes place */
1556 device->outer_unk = outer_unknown;