~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/d3d10core/device.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Copyright 2008-2009 Henri Verbeet for CodeWeavers
  3  *
  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.
  8  *
  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.
 13  *
 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
 17  *
 18  */
 19 
 20 #include "config.h"
 21 #include "wine/port.h"
 22 
 23 #include "d3d10core_private.h"
 24 
 25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
 26 
 27 /* Inner IUnknown methods */
 28 
 29 static inline struct d3d10_device *d3d10_device_from_inner_unknown(IUnknown *iface)
 30 {
 31     return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, inner_unknown_vtbl));
 32 }
 33 
 34 static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid, void **object)
 35 {
 36     struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
 37 
 38     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
 39 
 40     if (IsEqualGUID(riid, &IID_IUnknown)
 41             || IsEqualGUID(riid, &IID_ID3D10Device))
 42     {
 43         IUnknown_AddRef((IUnknown *)This);
 44         *object = This;
 45         return S_OK;
 46     }
 47 
 48     if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
 49     {
 50         IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
 51         *object = &This->device_parent_vtbl;
 52         return S_OK;
 53     }
 54 
 55     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
 56 
 57     *object = NULL;
 58     return E_NOINTERFACE;
 59 }
 60 
 61 static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
 62 {
 63     struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
 64     ULONG refcount = InterlockedIncrement(&This->refcount);
 65 
 66     TRACE("%p increasing refcount to %u\n", This, refcount);
 67 
 68     return refcount;
 69 }
 70 
 71 static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
 72 {
 73     struct d3d10_device *This = d3d10_device_from_inner_unknown(iface);
 74     ULONG refcount = InterlockedDecrement(&This->refcount);
 75 
 76     TRACE("%p decreasing refcount to %u\n", This, refcount);
 77 
 78     if (!refcount)
 79     {
 80         if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
 81     }
 82 
 83     return refcount;
 84 }
 85 
 86 /* IUnknown methods */
 87 
 88 static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid, void **object)
 89 {
 90     struct d3d10_device *This = (struct d3d10_device *)iface;
 91     TRACE("Forwarding to outer IUnknown\n");
 92     return IUnknown_QueryInterface(This->outer_unknown, riid, object);
 93 }
 94 
 95 static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
 96 {
 97     struct d3d10_device *This = (struct d3d10_device *)iface;
 98     TRACE("Forwarding to outer IUnknown\n");
 99     return IUnknown_AddRef(This->outer_unknown);
100 }
101 
102 static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
103 {
104     struct d3d10_device *This = (struct d3d10_device *)iface;
105     TRACE("Forwarding to outer IUnknown\n");
106     return IUnknown_Release(This->outer_unknown);
107 }
108 
109 /* ID3D10Device methods */
110 
111 static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
112         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
113 {
114     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
115             iface, start_slot, buffer_count, buffers);
116 }
117 
118 static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
119         UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
120 {
121     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
122             iface, start_slot, view_count, views);
123 }
124 
125 static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D10PixelShader *shader)
126 {
127     struct d3d10_device *This = (struct d3d10_device *)iface;
128     struct d3d10_pixel_shader *ps = (struct d3d10_pixel_shader *)shader;
129 
130     TRACE("iface %p, shader %p\n", iface, shader);
131 
132     IWineD3DDevice_SetPixelShader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
133 }
134 
135 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
136         UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
137 {
138     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
139             iface, start_slot, sampler_count, samplers);
140 }
141 
142 static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D10VertexShader *shader)
143 {
144     struct d3d10_device *This = (struct d3d10_device *)iface;
145     struct d3d10_vertex_shader *vs = (struct d3d10_vertex_shader *)shader;
146 
147     TRACE("iface %p, shader %p\n", iface, shader);
148 
149     IWineD3DDevice_SetVertexShader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
150 }
151 
152 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
153         UINT index_count, UINT start_index_location, INT base_vertex_location)
154 {
155     struct d3d10_device *This = (struct d3d10_device *)iface;
156 
157     TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
158             iface, index_count, start_index_location, base_vertex_location);
159 
160     IWineD3DDevice_SetBaseVertexIndex(This->wined3d_device, base_vertex_location);
161     IWineD3DDevice_DrawIndexedPrimitive(This->wined3d_device, start_index_location, index_count);
162 }
163 
164 static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface,
165         UINT vertex_count, UINT start_vertex_location)
166 {
167     struct d3d10_device *This = (struct d3d10_device *)iface;
168 
169     TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
170             iface, vertex_count, start_vertex_location);
171 
172     IWineD3DDevice_DrawPrimitive(This->wined3d_device, start_vertex_location, vertex_count);
173 }
174 
175 static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
176         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
177 {
178     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
179             iface, start_slot, buffer_count, buffers);
180 }
181 
182 static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface, ID3D10InputLayout *input_layout)
183 {
184     struct d3d10_device *This = (struct d3d10_device *)iface;
185 
186     TRACE("iface %p, input_layout %p\n", iface, input_layout);
187 
188     IWineD3DDevice_SetVertexDeclaration(This->wined3d_device,
189             ((struct d3d10_input_layout *)input_layout)->wined3d_decl);
190 }
191 
192 static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface,
193         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers,
194         const UINT *strides, const UINT *offsets)
195 {
196     struct d3d10_device *This = (struct d3d10_device *)iface;
197     unsigned int i;
198 
199     TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
200             iface, start_slot, buffer_count, buffers, strides, offsets);
201 
202     for (i = 0; i < buffer_count; ++i)
203     {
204         IWineD3DDevice_SetStreamSource(This->wined3d_device, start_slot,
205                 ((struct d3d10_buffer *)buffers[i])->wined3d_buffer, offsets[i], strides[i]);
206     }
207 }
208 
209 static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
210         ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
211 {
212     struct d3d10_device *This = (struct d3d10_device *)iface;
213 
214     TRACE("iface %p, buffer %p, format %s, offset %u.\n",
215             iface, buffer, debug_dxgi_format(format), offset);
216 
217     IWineD3DDevice_SetIndexBuffer(This->wined3d_device, buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
218             wined3dformat_from_dxgi_format(format));
219     if (offset) FIXME("offset %u not supported.\n", offset);
220 }
221 
222 static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
223         UINT instance_index_count, UINT instance_count, UINT start_index_location,
224         INT base_vertex_location, UINT start_instance_location)
225 {
226     FIXME("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
227             "\tbase_vertex_location %d, start_instance_location %u stub!\n",
228             iface, instance_index_count, instance_count, start_index_location,
229             base_vertex_location, start_instance_location);
230 }
231 
232 static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
233         UINT instance_vertex_count, UINT instance_count,
234         UINT start_vertex_location, UINT start_instance_location)
235 {
236     FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
237             "\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
238             start_vertex_location, start_instance_location);
239 }
240 
241 static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
242         UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
243 {
244     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
245             iface, start_slot, buffer_count, buffers);
246 }
247 
248 static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
249 {
250     if (shader) FIXME("iface %p, shader %p stub!\n", iface, shader);
251     else WARN("iface %p, shader %p stub!\n", iface, shader);
252 }
253 
254 static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY topology)
255 {
256     struct d3d10_device *This = (struct d3d10_device *)iface;
257 
258     TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
259 
260     IWineD3DDevice_SetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE)topology);
261 }
262 
263 static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
264         UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
265 {
266     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
267             iface, start_slot, view_count, views);
268 }
269 
270 static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
271         UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
272 {
273     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
274             iface, start_slot, sampler_count, samplers);
275 }
276 
277 static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
278 {
279     FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
280 }
281 
282 static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
283         UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
284 {
285     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
286             iface, start_slot, view_count, views);
287 }
288 
289 static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
290         UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
291 {
292     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
293             iface, start_slot, sampler_count, samplers);
294 }
295 
296 static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
297         UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
298         ID3D10DepthStencilView *depth_stencil_view)
299 {
300     FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
301             iface, render_target_view_count, render_target_views, depth_stencil_view);
302 }
303 
304 static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
305         ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
306 {
307     FIXME("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x stub!\n",
308             iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
309 }
310 
311 static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
312         ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
313 {
314     FIXME("iface %p, depth_stencil_state %p, stencil_ref %u stub!\n",
315             iface, depth_stencil_state, stencil_ref);
316 }
317 
318 static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
319         UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
320 {
321     FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
322 }
323 
324 static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
325 {
326     FIXME("iface %p stub!\n", iface);
327 }
328 
329 static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
330 {
331     FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
332 }
333 
334 static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
335         UINT viewport_count, const D3D10_VIEWPORT *viewports)
336 {
337     FIXME("iface %p, viewport_count %u, viewports %p stub!\n", iface, viewport_count, viewports);
338 }
339 
340 static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
341         UINT rect_count, const D3D10_RECT *rects)
342 {
343     FIXME("iface %p, rect_count %u, rects %p\n", iface, rect_count, rects);
344 }
345 
346 static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
347         ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
348         ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
349 {
350     FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
351             "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
352             iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
353             src_resource, src_subresource_idx, src_box);
354 }
355 
356 static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
357         ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
358 {
359     FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
360 }
361 
362 static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
363         ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
364         const void *data, UINT row_pitch, UINT depth_pitch)
365 {
366     FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
367             iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
368 }
369 
370 static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
371         ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
372 {
373     struct d3d10_device *This = (struct d3d10_device *)iface;
374     IWineD3DRendertargetView *wined3d_view = ((struct d3d10_rendertarget_view *)render_target_view)->wined3d_view;
375 
376     TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
377             iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
378 
379     IWineD3DDevice_ClearRendertargetView(This->wined3d_device, wined3d_view, color_rgba);
380 }
381 
382 static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
383         ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
384 {
385     FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
386             iface, depth_stencil_view, flags, depth, stencil);
387 }
388 
389 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
390 {
391     FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
392 }
393 
394 static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
395         ID3D10Resource *dst_resource, UINT dst_subresource_idx,
396         ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
397 {
398     FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
399             "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
400             iface, dst_resource, dst_subresource_idx,
401             src_resource, src_subresource_idx, debug_dxgi_format(format));
402 }
403 
404 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
405         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
406 {
407     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
408             iface, start_slot, buffer_count, buffers);
409 }
410 
411 static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
412         UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
413 {
414     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
415             iface, start_slot, view_count, views);
416 }
417 
418 static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
419 {
420     FIXME("iface %p, shader %p stub!\n", iface, shader);
421 }
422 
423 static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
424         UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
425 {
426     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
427             iface, start_slot, sampler_count, samplers);
428 }
429 
430 static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
431 {
432     FIXME("iface %p, shader %p stub!\n", iface, shader);
433 }
434 
435 static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
436         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
437 {
438     FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
439             iface, start_slot, buffer_count, buffers);
440 }
441 
442 static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
443 {
444     FIXME("iface %p, input_layout %p stub!\n", iface, input_layout);
445 }
446 
447 static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
448         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
449 {
450     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p stub!\n",
451             iface, start_slot, buffer_count, buffers, strides, offsets);
452 }
453 
454 static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
455         ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
456 {
457     FIXME("iface %p, buffer %p, format %p, offset %p stub!\n", iface, buffer, format, offset);
458 }
459 
460 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
461         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
462 {
463     FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
464             iface, start_slot, buffer_count, buffers);
465 }
466 
467 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
468 {
469     FIXME("iface %p, shader %p stub!\n", iface, shader);
470 }
471 
472 static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface, D3D10_PRIMITIVE_TOPOLOGY *topology)
473 {
474     struct d3d10_device *This = (struct d3d10_device *)iface;
475 
476     TRACE("iface %p, topology %p\n", iface, topology);
477 
478     IWineD3DDevice_GetPrimitiveType(This->wined3d_device, (WINED3DPRIMITIVETYPE *)topology);
479 }
480 
481 static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
482         UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
483 {
484     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
485             iface, start_slot, view_count, views);
486 }
487 
488 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
489         UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
490 {
491     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
492             iface, start_slot, sampler_count, samplers);
493 }
494 
495 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
496         ID3D10Predicate **predicate, BOOL *value)
497 {
498     FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
499 }
500 
501 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
502         UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
503 {
504     FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
505             iface, start_slot, view_count, views);
506 }
507 
508 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
509         UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
510 {
511     FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
512             iface, start_slot, sampler_count, samplers);
513 }
514 
515 static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
516         UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
517 {
518     FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
519             iface, view_count, render_target_views, depth_stencil_view);
520 }
521 
522 static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
523         ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
524 {
525     FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
526             iface, blend_state, blend_factor, sample_mask);
527 }
528 
529 static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
530         ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
531 {
532     FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n",
533             iface, depth_stencil_state, stencil_ref);
534 }
535 
536 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
537         UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
538 {
539     FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n",
540             iface, buffer_count, buffers, offsets);
541 }
542 
543 static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
544 {
545     FIXME("iface %p, rasterizer_state %p stub!\n", iface, rasterizer_state);
546 }
547 
548 static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
549         UINT *viewport_count, D3D10_VIEWPORT *viewports)
550 {
551     FIXME("iface %p, viewport_count %p, viewports %p stub!\n", iface, viewport_count, viewports);
552 }
553 
554 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
555 {
556     FIXME("iface %p, rect_count %p, rects %p stub!\n", iface, rect_count, rects);
557 }
558 
559 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
560 {
561     FIXME("iface %p stub!\n", iface);
562 
563     return E_NOTIMPL;
564 }
565 
566 static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
567 {
568     FIXME("iface %p, flags %#x stub!\n", iface, flags);
569 
570     return E_NOTIMPL;
571 }
572 
573 static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
574 {
575     FIXME("iface %p stub!\n", iface);
576 
577     return 0;
578 }
579 
580 static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
581         REFGUID guid, UINT *data_size, void *data)
582 {
583     FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
584             iface, debugstr_guid(guid), data_size, data);
585 
586     return E_NOTIMPL;
587 }
588 
589 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
590         REFGUID guid, UINT data_size, const void *data)
591 {
592     FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
593             iface, debugstr_guid(guid), data_size, data);
594 
595     return E_NOTIMPL;
596 }
597 
598 static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
599         REFGUID guid, const IUnknown *data)
600 {
601     FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
602 
603     return E_NOTIMPL;
604 }
605 
606 static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
607 {
608     FIXME("iface %p stub!\n", iface);
609 }
610 
611 static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
612 {
613     FIXME("iface %p stub!\n", iface);
614 }
615 
616 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
617         const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
618 {
619     struct d3d10_device *This = (struct d3d10_device *)iface;
620     struct d3d10_buffer *object;
621     HRESULT hr;
622 
623     FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
624 
625     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
626     if (!object)
627     {
628         ERR("Failed to allocate D3D10 buffer object memory\n");
629         return E_OUTOFMEMORY;
630     }
631 
632     hr = d3d10_buffer_init(object, This, desc, data);
633     if (FAILED(hr))
634     {
635         WARN("Failed to initialize buffer, hr %#x.\n", hr);
636         HeapFree(GetProcessHeap(), 0, object);
637         return hr;
638     }
639 
640     *buffer = (ID3D10Buffer *)object;
641 
642     TRACE("Created ID3D10Buffer %p\n", object);
643 
644     return S_OK;
645 }
646 
647 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
648         const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
649 {
650     FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
651 
652     return E_NOTIMPL;
653 }
654 
655 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
656         const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
657 {
658     struct d3d10_device *This = (struct d3d10_device *)iface;
659     struct d3d10_texture2d *object;
660     HRESULT hr;
661 
662     FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
663 
664     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
665     if (!object)
666     {
667         ERR("Failed to allocate D3D10 texture2d object memory\n");
668         return E_OUTOFMEMORY;
669     }
670 
671     hr = d3d10_texture2d_init(object, This, desc);
672     if (FAILED(hr))
673     {
674         WARN("Failed to initialize texture, hr %#x.\n", hr);
675         HeapFree(GetProcessHeap(), 0, object);
676         return hr;
677     }
678 
679     *texture = (ID3D10Texture2D *)object;
680 
681     TRACE("Created ID3D10Texture2D %p\n", object);
682 
683     return S_OK;
684 }
685 
686 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
687         const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture3D **texture)
688 {
689     FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
690 
691     return E_NOTIMPL;
692 }
693 
694 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
695         ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
696 {
697     struct d3d10_shader_resource_view *object;
698     HRESULT hr;
699 
700     TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
701 
702     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
703     if (!object)
704     {
705         ERR("Failed to allocate D3D10 shader resource view object memory.\n");
706         return E_OUTOFMEMORY;
707     }
708 
709     hr = d3d10_shader_resource_view_init(object);
710     if (FAILED(hr))
711     {
712         WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
713         HeapFree(GetProcessHeap(), 0, object);
714         return hr;
715     }
716 
717     TRACE("Created shader resource view %p.\n", object);
718     *view = (ID3D10ShaderResourceView *)object;
719 
720     return S_OK;
721 }
722 
723 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
724         ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
725 {
726     struct d3d10_rendertarget_view *object;
727     HRESULT hr;
728 
729     TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
730 
731     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
732     if (!object)
733     {
734         ERR("Failed to allocate D3D10 rendertarget view object memory\n");
735         return E_OUTOFMEMORY;
736     }
737 
738     hr = d3d10_rendertarget_view_init(object, (struct d3d10_device *)iface, resource, desc);
739     if (FAILED(hr))
740     {
741         WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
742         HeapFree(GetProcessHeap(), 0, object);
743         return hr;
744     }
745 
746     TRACE("Created rendertarget view %p.\n", object);
747     *view = (ID3D10RenderTargetView *)object;
748 
749     return S_OK;
750 }
751 
752 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
753         ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
754 {
755     struct d3d10_depthstencil_view *object;
756     HRESULT hr;
757 
758     TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
759 
760     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
761     if (!object)
762     {
763         ERR("Failed to allocate D3D10 depthstencil view object memory.\n");
764         return E_OUTOFMEMORY;
765     }
766 
767     hr = d3d10_depthstencil_view_init(object);
768     if (FAILED(hr))
769     {
770         WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
771         HeapFree(GetProcessHeap(), 0, object);
772         return hr;
773     }
774 
775     TRACE("Created depthstencil view %p.\n", object);
776     *view = (ID3D10DepthStencilView *)object;
777 
778     return S_OK;
779 }
780 
781 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
782         const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
783         SIZE_T shader_byte_code_length, ID3D10InputLayout **input_layout)
784 {
785     struct d3d10_device *This = (struct d3d10_device *)iface;
786     struct d3d10_input_layout *object;
787     HRESULT hr;
788 
789     TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
790             "\tshader_byte_code_length %lu, input_layout %p\n",
791             iface, element_descs, element_count, shader_byte_code,
792             shader_byte_code_length, input_layout);
793 
794     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
795     if (!object)
796     {
797         ERR("Failed to allocate D3D10 input layout object memory\n");
798         return E_OUTOFMEMORY;
799     }
800 
801     hr = d3d10_input_layout_init(object, This, element_descs, element_count,
802             shader_byte_code, shader_byte_code_length);
803     if (FAILED(hr))
804     {
805         WARN("Failed to initialize input layout, hr %#x.\n", hr);
806         HeapFree(GetProcessHeap(), 0, object);
807         return hr;
808     }
809 
810     TRACE("Created input layout %p.\n", object);
811     *input_layout = (ID3D10InputLayout *)object;
812 
813     return S_OK;
814 }
815 
816 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
817         const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
818 {
819     struct d3d10_device *This = (struct d3d10_device *)iface;
820     struct d3d10_vertex_shader *object;
821     HRESULT hr;
822 
823     TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
824             iface, byte_code, byte_code_length, shader);
825 
826     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
827     if (!object)
828     {
829         ERR("Failed to allocate D3D10 vertex shader object memory\n");
830         return E_OUTOFMEMORY;
831     }
832 
833     hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
834     if (FAILED(hr))
835     {
836         WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
837         HeapFree(GetProcessHeap(), 0, object);
838         return hr;
839     }
840 
841     TRACE("Created vertex shader %p.\n", object);
842     *shader = (ID3D10VertexShader *)object;
843 
844     return S_OK;
845 }
846 
847 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
848         const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
849 {
850     struct d3d10_geometry_shader *object;
851     HRESULT hr;
852 
853     FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\n",
854             iface, byte_code, byte_code_length, shader);
855 
856     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
857     if (!object)
858     {
859         ERR("Failed to allocate D3D10 geometry shader object memory\n");
860         return E_OUTOFMEMORY;
861     }
862 
863     hr = d3d10_geometry_shader_init(object);
864     if (FAILED(hr))
865     {
866         WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
867         HeapFree(GetProcessHeap(), 0, object);
868     }
869 
870     TRACE("Created geometry shader %p.\n", object);
871     *shader = (ID3D10GeometryShader *)object;
872 
873     return S_OK;
874 }
875 
876 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
877         const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
878         UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
879 {
880     FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
881             "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
882             iface, byte_code, byte_code_length, output_stream_decls,
883             output_stream_decl_count, output_stream_stride, shader);
884 
885     return E_NOTIMPL;
886 }
887 
888 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
889         const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
890 {
891     struct d3d10_device *This = (struct d3d10_device *)iface;
892     struct d3d10_pixel_shader *object;
893     HRESULT hr;
894 
895     TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
896             iface, byte_code, byte_code_length, shader);
897 
898     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
899     if (!object)
900     {
901         ERR("Failed to allocate D3D10 pixel shader object memory\n");
902         return E_OUTOFMEMORY;
903     }
904 
905     hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
906     if (FAILED(hr))
907     {
908         WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
909         HeapFree(GetProcessHeap(), 0, object);
910         return hr;
911     }
912 
913     TRACE("Created pixel shader %p.\n", object);
914     *shader = (ID3D10PixelShader *)object;
915 
916     return S_OK;
917 }
918 
919 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
920         const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
921 {
922     struct d3d10_blend_state *object;
923     HRESULT hr;
924 
925     TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
926 
927     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
928     if (!object)
929     {
930         ERR("Failed to allocate D3D10 blend state object memory.\n");
931         return E_OUTOFMEMORY;
932     }
933 
934     hr = d3d10_blend_state_init(object);
935     if (FAILED(hr))
936     {
937         WARN("Failed to initialize blend state, hr %#x.\n", hr);
938         HeapFree(GetProcessHeap(), 0, object);
939         return hr;
940     }
941 
942     TRACE("Created blend state %p.\n", object);
943     *blend_state = (ID3D10BlendState *)object;
944 
945     return S_OK;
946 }
947 
948 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
949         const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
950 {
951     struct d3d10_depthstencil_state *object;
952     HRESULT hr;
953 
954     TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface, desc, depth_stencil_state);
955 
956     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
957     if (!object)
958     {
959         ERR("Failed to allocate D3D10 depthstencil state object memory.\n");
960         return E_OUTOFMEMORY;
961     }
962 
963     hr = d3d10_depthstencil_state_init(object);
964     if (FAILED(hr))
965     {
966         WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
967         HeapFree(GetProcessHeap(), 0, object);
968         return hr;
969     }
970 
971     TRACE("Created depthstencil state %p.\n", object);
972     *depth_stencil_state = (ID3D10DepthStencilState *)object;
973 
974     return S_OK;
975 }
976 
977 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
978         const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
979 {
980     struct d3d10_rasterizer_state *object;
981     HRESULT hr;
982 
983     TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
984 
985     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
986     if (!object)
987     {
988         ERR("Failed to allocate D3D10 rasterizer state object memory.\n");
989         return E_OUTOFMEMORY;
990     }
991 
992     hr = d3d10_rasterizer_state_init(object);
993     if (FAILED(hr))
994     {
995         WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
996         HeapFree(GetProcessHeap(), 0, object);
997         return hr;
998     }
999 
1000     TRACE("Created rasterizer state %p.\n", object);
1001     *rasterizer_state = (ID3D10RasterizerState *)object;
1002 
1003     return S_OK;
1004 }
1005 
1006 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
1007         const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
1008 {
1009     struct d3d10_sampler_state *object;
1010     HRESULT hr;
1011 
1012     FIXME("iface %p, desc %p, sampler_state %p.\n", iface, desc, sampler_state);
1013 
1014     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1015     if (!object)
1016     {
1017         ERR("Failed to allocate D3D10 sampler state object memory.\n");
1018         return E_OUTOFMEMORY;
1019     }
1020 
1021     hr = d3d10_sampler_state_init(object);
1022     if (FAILED(hr))
1023     {
1024         WARN("Failed to initialize sampler state, hr %#x.\n", hr);
1025         HeapFree(GetProcessHeap(), 0, object);
1026         return hr;
1027     }
1028 
1029     TRACE("Created sampler state %p.\n", object);
1030     *sampler_state = (ID3D10SamplerState *)object;
1031 
1032     return S_OK;
1033 }
1034 
1035 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
1036         const D3D10_QUERY_DESC *desc, ID3D10Query **query)
1037 {
1038     FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
1039 
1040     return E_NOTIMPL;
1041 }
1042 
1043 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
1044         const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
1045 {
1046     FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
1047 
1048     return E_NOTIMPL;
1049 }
1050 
1051 static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
1052         const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
1053 {
1054     FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
1055 
1056     return E_NOTIMPL;
1057 }
1058 
1059 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
1060         DXGI_FORMAT format, UINT *format_support)
1061 {
1062     FIXME("iface %p, format %s, format_support %p stub!\n",
1063             iface, debug_dxgi_format(format), format_support);
1064 
1065     return E_NOTIMPL;
1066 }
1067 
1068 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
1069         DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
1070 {
1071     FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1072             iface, debug_dxgi_format(format), sample_count, quality_level_count);
1073 
1074     return E_NOTIMPL;
1075 }
1076 
1077 static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
1078 {
1079     FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
1080 }
1081 
1082 static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
1083         const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
1084         UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
1085 {
1086     FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1087             "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1088             iface, desc, type, active_counters, name, name_length,
1089             units, units_length, description, description_length);
1090 
1091     return E_NOTIMPL;
1092 }
1093 
1094 static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
1095 {
1096     FIXME("iface %p stub!\n", iface);
1097 
1098     return 0;
1099 }
1100 
1101 static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
1102         HANDLE resource_handle, REFIID guid, void **resource)
1103 {
1104     FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1105             iface, resource_handle, debugstr_guid(guid), resource);
1106 
1107     return E_NOTIMPL;
1108 }
1109 
1110 static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
1111 {
1112     FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
1113 }
1114 
1115 static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
1116 {
1117     FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
1118 }
1119 
1120 const struct ID3D10DeviceVtbl d3d10_device_vtbl =
1121 {
1122     /* IUnknown methods */
1123     d3d10_device_QueryInterface,
1124     d3d10_device_AddRef,
1125     d3d10_device_Release,
1126     /* ID3D10Device methods */
1127     d3d10_device_VSSetConstantBuffers,
1128     d3d10_device_PSSetShaderResources,
1129     d3d10_device_PSSetShader,
1130     d3d10_device_PSSetSamplers,
1131     d3d10_device_VSSetShader,
1132     d3d10_device_DrawIndexed,
1133     d3d10_device_Draw,
1134     d3d10_device_PSSetConstantBuffers,
1135     d3d10_device_IASetInputLayout,
1136     d3d10_device_IASetVertexBuffers,
1137     d3d10_device_IASetIndexBuffer,
1138     d3d10_device_DrawIndexedInstanced,
1139     d3d10_device_DrawInstanced,
1140     d3d10_device_GSSetConstantBuffers,
1141     d3d10_device_GSSetShader,
1142     d3d10_device_IASetPrimitiveTopology,
1143     d3d10_device_VSSetShaderResources,
1144     d3d10_device_VSSetSamplers,
1145     d3d10_device_SetPredication,
1146     d3d10_device_GSSetShaderResources,
1147     d3d10_device_GSSetSamplers,
1148     d3d10_device_OMSetRenderTargets,
1149     d3d10_device_OMSetBlendState,
1150     d3d10_device_OMSetDepthStencilState,
1151     d3d10_device_SOSetTargets,
1152     d3d10_device_DrawAuto,
1153     d3d10_device_RSSetState,
1154     d3d10_device_RSSetViewports,
1155     d3d10_device_RSSetScissorRects,
1156     d3d10_device_CopySubresourceRegion,
1157     d3d10_device_CopyResource,
1158     d3d10_device_UpdateSubresource,
1159     d3d10_device_ClearRenderTargetView,
1160     d3d10_device_ClearDepthStencilView,
1161     d3d10_device_GenerateMips,
1162     d3d10_device_ResolveSubresource,
1163     d3d10_device_VSGetConstantBuffers,
1164     d3d10_device_PSGetShaderResources,
1165     d3d10_device_PSGetShader,
1166     d3d10_device_PSGetSamplers,
1167     d3d10_device_VSGetShader,
1168     d3d10_device_PSGetConstantBuffers,
1169     d3d10_device_IAGetInputLayout,
1170     d3d10_device_IAGetVertexBuffers,
1171     d3d10_device_IAGetIndexBuffer,
1172     d3d10_device_GSGetConstantBuffers,
1173     d3d10_device_GSGetShader,
1174     d3d10_device_IAGetPrimitiveTopology,
1175     d3d10_device_VSGetShaderResources,
1176     d3d10_device_VSGetSamplers,
1177     d3d10_device_GetPredication,
1178     d3d10_device_GSGetShaderResources,
1179     d3d10_device_GSGetSamplers,
1180     d3d10_device_OMGetRenderTargets,
1181     d3d10_device_OMGetBlendState,
1182     d3d10_device_OMGetDepthStencilState,
1183     d3d10_device_SOGetTargets,
1184     d3d10_device_RSGetState,
1185     d3d10_device_RSGetViewports,
1186     d3d10_device_RSGetScissorRects,
1187     d3d10_device_GetDeviceRemovedReason,
1188     d3d10_device_SetExceptionMode,
1189     d3d10_device_GetExceptionMode,
1190     d3d10_device_GetPrivateData,
1191     d3d10_device_SetPrivateData,
1192     d3d10_device_SetPrivateDataInterface,
1193     d3d10_device_ClearState,
1194     d3d10_device_Flush,
1195     d3d10_device_CreateBuffer,
1196     d3d10_device_CreateTexture1D,
1197     d3d10_device_CreateTexture2D,
1198     d3d10_device_CreateTexture3D,
1199     d3d10_device_CreateShaderResourceView,
1200     d3d10_device_CreateRenderTargetView,
1201     d3d10_device_CreateDepthStencilView,
1202     d3d10_device_CreateInputLayout,
1203     d3d10_device_CreateVertexShader,
1204     d3d10_device_CreateGeometryShader,
1205     d3d10_device_CreateGeometryShaderWithStreamOutput,
1206     d3d10_device_CreatePixelShader,
1207     d3d10_device_CreateBlendState,
1208     d3d10_device_CreateDepthStencilState,
1209     d3d10_device_CreateRasterizerState,
1210     d3d10_device_CreateSamplerState,
1211     d3d10_device_CreateQuery,
1212     d3d10_device_CreatePredicate,
1213     d3d10_device_CreateCounter,
1214     d3d10_device_CheckFormatSupport,
1215     d3d10_device_CheckMultisampleQualityLevels,
1216     d3d10_device_CheckCounterInfo,
1217     d3d10_device_CheckCounter,
1218     d3d10_device_GetCreationFlags,
1219     d3d10_device_OpenSharedResource,
1220     d3d10_device_SetTextFilterSize,
1221     d3d10_device_GetTextFilterSize,
1222 };
1223 
1224 const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
1225 {
1226     /* IUnknown methods */
1227     d3d10_device_inner_QueryInterface,
1228     d3d10_device_inner_AddRef,
1229     d3d10_device_inner_Release,
1230 };
1231 
1232 /* IWineD3DDeviceParent IUnknown methods */
1233 
1234 static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
1235 {
1236     return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
1237 }
1238 
1239 static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
1240 {
1241     struct d3d10_device *This = device_from_device_parent(iface);
1242     return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
1243 }
1244 
1245 static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
1246 {
1247     struct d3d10_device *This = device_from_device_parent(iface);
1248     return d3d10_device_AddRef((ID3D10Device *)This);
1249 }
1250 
1251 static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
1252 {
1253     struct d3d10_device *This = device_from_device_parent(iface);
1254     return d3d10_device_Release((ID3D10Device *)This);
1255 }
1256 
1257 /* IWineD3DDeviceParent methods */
1258 
1259 static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
1260 {
1261     struct d3d10_device *This = device_from_device_parent(iface);
1262 
1263     TRACE("iface %p, device %p\n", iface, device);
1264 
1265     IWineD3DDevice_AddRef(device);
1266     This->wined3d_device = device;
1267 }
1268 
1269 static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
1270         IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
1271         WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
1272 {
1273     struct d3d10_device *This = device_from_device_parent(iface);
1274     struct d3d10_texture2d *texture;
1275     D3D10_TEXTURE2D_DESC desc;
1276     HRESULT hr;
1277 
1278     FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
1279             "\tpool %#x, level %u, face %u, surface %p partial stub!\n",
1280             iface, superior, width, height, format, usage, pool, level, face, surface);
1281 
1282     FIXME("Implement DXGI<->wined3d usage conversion\n");
1283 
1284     desc.Width = width;
1285     desc.Height = height;
1286     desc.MipLevels = 1;
1287     desc.ArraySize = 1;
1288     desc.Format = dxgi_format_from_wined3dformat(format);
1289     desc.SampleDesc.Count = 1;
1290     desc.SampleDesc.Quality = 0;
1291     desc.Usage = usage;
1292     desc.BindFlags = 0;
1293     desc.CPUAccessFlags = 0;
1294     desc.MiscFlags = 0;
1295 
1296     hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1297     if (FAILED(hr))
1298     {
1299         ERR("CreateTexture2D failed, returning %#x\n", hr);
1300         return hr;
1301     }
1302 
1303     *surface = texture->wined3d_surface;
1304     IWineD3DSurface_AddRef(*surface);
1305     ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1306 
1307     return S_OK;
1308 }
1309 
1310 static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
1311         IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1312         DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
1313 {
1314     struct d3d10_device *This = device_from_device_parent(iface);
1315     struct d3d10_texture2d *texture;
1316     D3D10_TEXTURE2D_DESC desc;
1317     HRESULT hr;
1318 
1319     FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1320             "\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
1321             iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
1322 
1323     FIXME("Implement DXGI<->wined3d usage conversion\n");
1324 
1325     desc.Width = width;
1326     desc.Height = height;
1327     desc.MipLevels = 1;
1328     desc.ArraySize = 1;
1329     desc.Format = dxgi_format_from_wined3dformat(format);
1330     desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1331     desc.SampleDesc.Quality = multisample_quality;
1332     desc.Usage = D3D10_USAGE_DEFAULT;
1333     desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1334     desc.CPUAccessFlags = 0;
1335     desc.MiscFlags = 0;
1336 
1337     hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1338     if (FAILED(hr))
1339     {
1340         ERR("CreateTexture2D failed, returning %#x\n", hr);
1341         return hr;
1342     }
1343 
1344     *surface = texture->wined3d_surface;
1345     IWineD3DSurface_AddRef(*surface);
1346     ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1347 
1348     return S_OK;
1349 }
1350 
1351 static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
1352         IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
1353         DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
1354 {
1355     struct d3d10_device *This = device_from_device_parent(iface);
1356     struct d3d10_texture2d *texture;
1357     D3D10_TEXTURE2D_DESC desc;
1358     HRESULT hr;
1359 
1360     FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
1361             "\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
1362             iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
1363 
1364     FIXME("Implement DXGI<->wined3d usage conversion\n");
1365 
1366     desc.Width = width;
1367     desc.Height = height;
1368     desc.MipLevels = 1;
1369     desc.ArraySize = 1;
1370     desc.Format = dxgi_format_from_wined3dformat(format);
1371     desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
1372     desc.SampleDesc.Quality = multisample_quality;
1373     desc.Usage = D3D10_USAGE_DEFAULT;
1374     desc.BindFlags = D3D10_BIND_RENDER_TARGET;
1375     desc.CPUAccessFlags = 0;
1376     desc.MiscFlags = 0;
1377 
1378     hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
1379     if (FAILED(hr))
1380     {
1381         ERR("CreateTexture2D failed, returning %#x\n", hr);
1382         return hr;
1383     }
1384 
1385     *surface = texture->wined3d_surface;
1386     IWineD3DSurface_AddRef(*surface);
1387     ID3D10Texture2D_Release((ID3D10Texture2D *)texture);
1388 
1389     return S_OK;
1390 }
1391 
1392 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
1393         IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
1394         WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
1395 {
1396     FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
1397             iface, superior, width, height, depth, format, pool, usage, volume);
1398 
1399     return E_NOTIMPL;
1400 }
1401 
1402 static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
1403         WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
1404 {
1405     IWineDXGIDevice *wine_device;
1406     HRESULT hr;
1407 
1408     TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
1409 
1410     hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
1411     if (FAILED(hr))
1412     {
1413         ERR("Device should implement IWineDXGIDevice\n");
1414         return E_FAIL;
1415     }
1416 
1417     hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
1418     IWineDXGIDevice_Release(wine_device);
1419     if (FAILED(hr))
1420     {
1421         ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
1422         return hr;
1423     }
1424 
1425     return S_OK;
1426 }
1427 
1428 const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
1429 {
1430     /* IUnknown methods */
1431     device_parent_QueryInterface,
1432     device_parent_AddRef,
1433     device_parent_Release,
1434     /* IWineD3DDeviceParent methods */
1435     device_parent_WineD3DDeviceCreated,
1436     device_parent_CreateSurface,
1437     device_parent_CreateRenderTarget,
1438     device_parent_CreateDepthStencilSurface,
1439     device_parent_CreateVolume,
1440     device_parent_CreateSwapChain,
1441 };
1442 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.