2 * Copyright 2008-2012 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/port.h"
23 #include "d3d10core_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core
);
27 static void STDMETHODCALLTYPE
d3d10_null_wined3d_object_destroyed(void *parent
) {}
29 const struct wined3d_parent_ops d3d10_null_wined3d_parent_ops
=
31 d3d10_null_wined3d_object_destroyed
,
34 /* Inner IUnknown methods */
36 static inline struct d3d10_device
*impl_from_IUnknown(IUnknown
*iface
)
38 return CONTAINING_RECORD(iface
, struct d3d10_device
, IUnknown_inner
);
41 static HRESULT STDMETHODCALLTYPE
d3d10_device_inner_QueryInterface(IUnknown
*iface
, REFIID riid
, void **out
)
43 struct d3d10_device
*device
= impl_from_IUnknown(iface
);
45 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
47 if (IsEqualGUID(riid
, &IID_ID3D10Device1
)
48 || IsEqualGUID(riid
, &IID_ID3D10Device
)
49 || IsEqualGUID(riid
, &IID_IUnknown
))
51 *out
= &device
->ID3D10Device1_iface
;
53 else if (IsEqualGUID(riid
, &IID_ID3D10Multithread
))
55 *out
= &device
->ID3D10Multithread_iface
;
57 else if (IsEqualGUID(riid
, &IID_IWineDXGIDeviceParent
))
59 *out
= &device
->IWineDXGIDeviceParent_iface
;
63 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
68 IUnknown_AddRef((IUnknown
*)*out
);
72 static ULONG STDMETHODCALLTYPE
d3d10_device_inner_AddRef(IUnknown
*iface
)
74 struct d3d10_device
*This
= impl_from_IUnknown(iface
);
75 ULONG refcount
= InterlockedIncrement(&This
->refcount
);
77 TRACE("%p increasing refcount to %u\n", This
, refcount
);
82 static ULONG STDMETHODCALLTYPE
d3d10_device_inner_Release(IUnknown
*iface
)
84 struct d3d10_device
*device
= impl_from_IUnknown(iface
);
85 ULONG refcount
= InterlockedDecrement(&device
->refcount
);
87 TRACE("%p decreasing refcount to %u.\n", device
, refcount
);
91 if (device
->wined3d_device
)
92 wined3d_device_decref(device
->wined3d_device
);
93 wine_rb_destroy(&device
->sampler_states
, NULL
, NULL
);
94 wine_rb_destroy(&device
->rasterizer_states
, NULL
, NULL
);
95 wine_rb_destroy(&device
->depthstencil_states
, NULL
, NULL
);
96 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);
102 /* IUnknown methods */
104 static HRESULT STDMETHODCALLTYPE
d3d10_device_QueryInterface(ID3D10Device1
*iface
, REFIID riid
,
107 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
108 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppv
);
111 static ULONG STDMETHODCALLTYPE
d3d10_device_AddRef(ID3D10Device1
*iface
)
113 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
114 return IUnknown_AddRef(This
->outer_unk
);
117 static ULONG STDMETHODCALLTYPE
d3d10_device_Release(ID3D10Device1
*iface
)
119 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
120 return IUnknown_Release(This
->outer_unk
);
123 /* ID3D10Device methods */
125 static void STDMETHODCALLTYPE
d3d10_device_VSSetConstantBuffers(ID3D10Device1
*iface
,
126 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
*const *buffers
)
128 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
131 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
132 iface
, start_slot
, buffer_count
, buffers
);
134 for (i
= 0; i
< buffer_count
; ++i
)
136 struct d3d10_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
138 wined3d_device_set_vs_cb(device
->wined3d_device
, start_slot
+ i
,
139 buffer
? buffer
->wined3d_buffer
: NULL
);
143 static void STDMETHODCALLTYPE
d3d10_device_PSSetShaderResources(ID3D10Device1
*iface
,
144 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
*const *views
)
146 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
149 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
150 iface
, start_slot
, view_count
, views
);
152 for (i
= 0; i
< view_count
; ++i
)
154 struct d3d10_shader_resource_view
*view
= unsafe_impl_from_ID3D10ShaderResourceView(views
[i
]);
156 wined3d_device_set_ps_resource_view(device
->wined3d_device
, start_slot
+ i
,
157 view
? view
->wined3d_view
: NULL
);
161 static void STDMETHODCALLTYPE
d3d10_device_PSSetShader(ID3D10Device1
*iface
,
162 ID3D10PixelShader
*shader
)
164 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
165 struct d3d10_pixel_shader
*ps
= unsafe_impl_from_ID3D10PixelShader(shader
);
167 TRACE("iface %p, shader %p\n", iface
, shader
);
169 wined3d_device_set_pixel_shader(This
->wined3d_device
, ps
? ps
->wined3d_shader
: NULL
);
172 static void STDMETHODCALLTYPE
d3d10_device_PSSetSamplers(ID3D10Device1
*iface
,
173 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
*const *samplers
)
175 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
178 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
179 iface
, start_slot
, sampler_count
, samplers
);
181 for (i
= 0; i
< sampler_count
; ++i
)
183 struct d3d10_sampler_state
*sampler
= unsafe_impl_from_ID3D10SamplerState(samplers
[i
]);
185 wined3d_device_set_ps_sampler(device
->wined3d_device
, start_slot
+ i
,
186 sampler
? sampler
->wined3d_sampler
: NULL
);
190 static void STDMETHODCALLTYPE
d3d10_device_VSSetShader(ID3D10Device1
*iface
,
191 ID3D10VertexShader
*shader
)
193 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
194 struct d3d10_vertex_shader
*vs
= unsafe_impl_from_ID3D10VertexShader(shader
);
196 TRACE("iface %p, shader %p\n", iface
, shader
);
198 wined3d_device_set_vertex_shader(This
->wined3d_device
, vs
? vs
->wined3d_shader
: NULL
);
201 static void STDMETHODCALLTYPE
d3d10_device_DrawIndexed(ID3D10Device1
*iface
, UINT index_count
,
202 UINT start_index_location
, INT base_vertex_location
)
204 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
206 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
207 iface
, index_count
, start_index_location
, base_vertex_location
);
209 wined3d_device_set_base_vertex_index(This
->wined3d_device
, base_vertex_location
);
210 wined3d_device_draw_indexed_primitive(This
->wined3d_device
, start_index_location
, index_count
);
213 static void STDMETHODCALLTYPE
d3d10_device_Draw(ID3D10Device1
*iface
, UINT vertex_count
,
214 UINT start_vertex_location
)
216 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
218 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
219 iface
, vertex_count
, start_vertex_location
);
221 wined3d_device_draw_primitive(This
->wined3d_device
, start_vertex_location
, vertex_count
);
224 static void STDMETHODCALLTYPE
d3d10_device_PSSetConstantBuffers(ID3D10Device1
*iface
,
225 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
*const *buffers
)
227 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
230 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
231 iface
, start_slot
, buffer_count
, buffers
);
233 for (i
= 0; i
< buffer_count
; ++i
)
235 struct d3d10_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
237 wined3d_device_set_ps_cb(device
->wined3d_device
, start_slot
+ i
,
238 buffer
? buffer
->wined3d_buffer
: NULL
);
242 static void STDMETHODCALLTYPE
d3d10_device_IASetInputLayout(ID3D10Device1
*iface
,
243 ID3D10InputLayout
*input_layout
)
245 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
246 struct d3d10_input_layout
*layout
= unsafe_impl_from_ID3D10InputLayout(input_layout
);
248 TRACE("iface %p, input_layout %p\n", iface
, input_layout
);
250 wined3d_device_set_vertex_declaration(This
->wined3d_device
,
251 layout
? layout
->wined3d_decl
: NULL
);
254 static void STDMETHODCALLTYPE
d3d10_device_IASetVertexBuffers(ID3D10Device1
*iface
, UINT start_slot
,
255 UINT buffer_count
, ID3D10Buffer
*const *buffers
, const UINT
*strides
, const UINT
*offsets
)
257 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
260 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
261 iface
, start_slot
, buffer_count
, buffers
, strides
, offsets
);
263 for (i
= 0; i
< buffer_count
; ++i
)
265 struct d3d10_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
267 wined3d_device_set_stream_source(This
->wined3d_device
, start_slot
+ i
,
268 buffer
? buffer
->wined3d_buffer
: NULL
, offsets
[i
], strides
[i
]);
272 static void STDMETHODCALLTYPE
d3d10_device_IASetIndexBuffer(ID3D10Device1
*iface
,
273 ID3D10Buffer
*buffer
, DXGI_FORMAT format
, UINT offset
)
275 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
276 struct d3d10_buffer
*buffer_impl
= unsafe_impl_from_ID3D10Buffer(buffer
);
278 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
279 iface
, buffer
, debug_dxgi_format(format
), offset
);
281 wined3d_device_set_index_buffer(This
->wined3d_device
,
282 buffer_impl
? buffer_impl
->wined3d_buffer
: NULL
,
283 wined3dformat_from_dxgi_format(format
));
284 if (offset
) FIXME("offset %u not supported.\n", offset
);
287 static void STDMETHODCALLTYPE
d3d10_device_DrawIndexedInstanced(ID3D10Device1
*iface
,
288 UINT instance_index_count
, UINT instance_count
, UINT start_index_location
,
289 INT base_vertex_location
, UINT start_instance_location
)
291 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
293 TRACE("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
294 "\tbase_vertex_location %d, start_instance_location %u.\n",
295 iface
, instance_index_count
, instance_count
, start_index_location
,
296 base_vertex_location
, start_instance_location
);
298 wined3d_device_set_base_vertex_index(device
->wined3d_device
, base_vertex_location
);
299 wined3d_device_draw_indexed_primitive_instanced(device
->wined3d_device
, start_index_location
,
300 instance_index_count
, start_instance_location
, instance_count
);
303 static void STDMETHODCALLTYPE
d3d10_device_DrawInstanced(ID3D10Device1
*iface
,
304 UINT instance_vertex_count
, UINT instance_count
,
305 UINT start_vertex_location
, UINT start_instance_location
)
307 FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
308 "\tstart_instance_location %u stub!\n", iface
, instance_vertex_count
, instance_count
,
309 start_vertex_location
, start_instance_location
);
312 static void STDMETHODCALLTYPE
d3d10_device_GSSetConstantBuffers(ID3D10Device1
*iface
,
313 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
*const *buffers
)
315 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
318 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
319 iface
, start_slot
, buffer_count
, buffers
);
321 for (i
= 0; i
< buffer_count
; ++i
)
323 struct d3d10_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
325 wined3d_device_set_gs_cb(device
->wined3d_device
, start_slot
+ i
,
326 buffer
? buffer
->wined3d_buffer
: NULL
);
330 static void STDMETHODCALLTYPE
d3d10_device_GSSetShader(ID3D10Device1
*iface
, ID3D10GeometryShader
*shader
)
332 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
333 struct d3d10_geometry_shader
*gs
= unsafe_impl_from_ID3D10GeometryShader(shader
);
335 TRACE("iface %p, shader %p.\n", iface
, shader
);
337 wined3d_device_set_geometry_shader(device
->wined3d_device
, gs
? gs
->wined3d_shader
: NULL
);
340 static void STDMETHODCALLTYPE
d3d10_device_IASetPrimitiveTopology(ID3D10Device1
*iface
,
341 D3D10_PRIMITIVE_TOPOLOGY topology
)
343 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
345 TRACE("iface %p, topology %s\n", iface
, debug_d3d10_primitive_topology(topology
));
347 wined3d_device_set_primitive_type(This
->wined3d_device
, (enum wined3d_primitive_type
)topology
);
350 static void STDMETHODCALLTYPE
d3d10_device_VSSetShaderResources(ID3D10Device1
*iface
,
351 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
*const *views
)
353 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
356 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
357 iface
, start_slot
, view_count
, views
);
359 for (i
= 0; i
< view_count
; ++i
)
361 struct d3d10_shader_resource_view
*view
= unsafe_impl_from_ID3D10ShaderResourceView(views
[i
]);
363 wined3d_device_set_vs_resource_view(device
->wined3d_device
, start_slot
+ i
,
364 view
? view
->wined3d_view
: NULL
);
368 static void STDMETHODCALLTYPE
d3d10_device_VSSetSamplers(ID3D10Device1
*iface
,
369 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
*const *samplers
)
371 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
374 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
375 iface
, start_slot
, sampler_count
, samplers
);
377 for (i
= 0; i
< sampler_count
; ++i
)
379 struct d3d10_sampler_state
*sampler
= unsafe_impl_from_ID3D10SamplerState(samplers
[i
]);
381 wined3d_device_set_vs_sampler(device
->wined3d_device
, start_slot
+ i
,
382 sampler
? sampler
->wined3d_sampler
: NULL
);
386 static void STDMETHODCALLTYPE
d3d10_device_SetPredication(ID3D10Device1
*iface
, ID3D10Predicate
*predicate
, BOOL value
)
388 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
389 struct d3d10_query
*query
;
391 TRACE("iface %p, predicate %p, value %#x.\n", iface
, predicate
, value
);
393 query
= unsafe_impl_from_ID3D10Query((ID3D10Query
*)predicate
);
394 wined3d_device_set_predication(device
->wined3d_device
, query
? query
->wined3d_query
: NULL
, value
);
397 static void STDMETHODCALLTYPE
d3d10_device_GSSetShaderResources(ID3D10Device1
*iface
,
398 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
*const *views
)
400 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
403 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
404 iface
, start_slot
, view_count
, views
);
406 for (i
= 0; i
< view_count
; ++i
)
408 struct d3d10_shader_resource_view
*view
= unsafe_impl_from_ID3D10ShaderResourceView(views
[i
]);
410 wined3d_device_set_gs_resource_view(device
->wined3d_device
, start_slot
+ i
,
411 view
? view
->wined3d_view
: NULL
);
415 static void STDMETHODCALLTYPE
d3d10_device_GSSetSamplers(ID3D10Device1
*iface
,
416 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
*const *samplers
)
418 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
421 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
422 iface
, start_slot
, sampler_count
, samplers
);
424 for (i
= 0; i
< sampler_count
; ++i
)
426 struct d3d10_sampler_state
*sampler
= unsafe_impl_from_ID3D10SamplerState(samplers
[i
]);
428 wined3d_device_set_gs_sampler(device
->wined3d_device
, start_slot
+ i
,
429 sampler
? sampler
->wined3d_sampler
: NULL
);
433 static void STDMETHODCALLTYPE
d3d10_device_OMSetRenderTargets(ID3D10Device1
*iface
,
434 UINT render_target_view_count
, ID3D10RenderTargetView
*const *render_target_views
,
435 ID3D10DepthStencilView
*depth_stencil_view
)
437 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
438 struct d3d10_depthstencil_view
*dsv
;
441 TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p.\n",
442 iface
, render_target_view_count
, render_target_views
, depth_stencil_view
);
444 for (i
= 0; i
< render_target_view_count
; ++i
)
446 struct d3d10_rendertarget_view
*rtv
= unsafe_impl_from_ID3D10RenderTargetView(render_target_views
[i
]);
448 wined3d_device_set_rendertarget_view(device
->wined3d_device
, i
,
449 rtv
? rtv
->wined3d_view
: NULL
, FALSE
);
451 for (; i
< D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT
; ++i
)
453 wined3d_device_set_rendertarget_view(device
->wined3d_device
, i
, NULL
, FALSE
);
456 dsv
= unsafe_impl_from_ID3D10DepthStencilView(depth_stencil_view
);
457 wined3d_device_set_depth_stencil_view(device
->wined3d_device
,
458 dsv
? dsv
->wined3d_view
: NULL
);
461 static void STDMETHODCALLTYPE
d3d10_device_OMSetBlendState(ID3D10Device1
*iface
,
462 ID3D10BlendState
*blend_state
, const FLOAT blend_factor
[4], UINT sample_mask
)
464 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
466 TRACE("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x.\n",
467 iface
, blend_state
, blend_factor
[0], blend_factor
[1], blend_factor
[2], blend_factor
[3], sample_mask
);
469 device
->blend_state
= unsafe_impl_from_ID3D10BlendState(blend_state
);
470 memcpy(device
->blend_factor
, blend_factor
, 4 * sizeof(*blend_factor
));
471 device
->sample_mask
= sample_mask
;
474 static void STDMETHODCALLTYPE
d3d10_device_OMSetDepthStencilState(ID3D10Device1
*iface
,
475 ID3D10DepthStencilState
*depth_stencil_state
, UINT stencil_ref
)
477 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
479 TRACE("iface %p, depth_stencil_state %p, stencil_ref %u.\n",
480 iface
, depth_stencil_state
, stencil_ref
);
482 device
->depth_stencil_state
= unsafe_impl_from_ID3D10DepthStencilState(depth_stencil_state
);
483 device
->stencil_ref
= stencil_ref
;
486 static void STDMETHODCALLTYPE
d3d10_device_SOSetTargets(ID3D10Device1
*iface
,
487 UINT target_count
, ID3D10Buffer
*const *targets
, const UINT
*offsets
)
489 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
490 unsigned int count
, i
;
492 TRACE("iface %p, target_count %u, targets %p, offsets %p.\n", iface
, target_count
, targets
, offsets
);
494 count
= min(target_count
, 4);
495 for (i
= 0; i
< count
; ++i
)
497 struct d3d10_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(targets
[i
]);
499 wined3d_device_set_stream_output(device
->wined3d_device
, i
,
500 buffer
? buffer
->wined3d_buffer
: NULL
, offsets
[i
]);
503 for (i
= count
; i
< 4; ++i
)
505 wined3d_device_set_stream_output(device
->wined3d_device
, i
, NULL
, 0);
509 static void STDMETHODCALLTYPE
d3d10_device_DrawAuto(ID3D10Device1
*iface
)
511 FIXME("iface %p stub!\n", iface
);
514 static void STDMETHODCALLTYPE
d3d10_device_RSSetState(ID3D10Device1
*iface
, ID3D10RasterizerState
*rasterizer_state
)
516 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
517 const D3D10_RASTERIZER_DESC
*desc
;
519 TRACE("iface %p, rasterizer_state %p.\n", iface
, rasterizer_state
);
521 if (!(device
->rasterizer_state
= unsafe_impl_from_ID3D10RasterizerState(rasterizer_state
)))
523 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_FILLMODE
, WINED3D_FILL_SOLID
);
524 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_CULLMODE
, WINED3D_CULL_CCW
);
525 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_SCISSORTESTENABLE
, FALSE
);
526 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_MULTISAMPLEANTIALIAS
, FALSE
);
527 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ANTIALIASEDLINEENABLE
, FALSE
);
531 desc
= &device
->rasterizer_state
->desc
;
532 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_FILLMODE
, desc
->FillMode
);
533 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_CULLMODE
, desc
->CullMode
);
535 if (desc
->FrontCounterClockwise
)
536 FIXME("Ignoring FrontCounterClockwise %#x.\n", desc
->FrontCounterClockwise
);
537 /* OpenGL style depth bias. */
538 if (desc
->DepthBias
|| desc
->SlopeScaledDepthBias
)
539 FIXME("Ignoring depth bias.\n");
541 if (!desc
->DepthClipEnable
)
542 FIXME("Ignoring DepthClipEnable %#x.\n", desc
->DepthClipEnable
);
543 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_SCISSORTESTENABLE
, desc
->ScissorEnable
);
544 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_MULTISAMPLEANTIALIAS
, desc
->MultisampleEnable
);
545 wined3d_device_set_render_state(device
->wined3d_device
,
546 WINED3D_RS_ANTIALIASEDLINEENABLE
, desc
->AntialiasedLineEnable
);
549 static void STDMETHODCALLTYPE
d3d10_device_RSSetViewports(ID3D10Device1
*iface
,
550 UINT viewport_count
, const D3D10_VIEWPORT
*viewports
)
552 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
553 struct wined3d_viewport wined3d_vp
;
555 TRACE("iface %p, viewport_count %u, viewports %p.\n", iface
, viewport_count
, viewports
);
557 if (viewport_count
> 1)
558 FIXME("Multiple viewports not implemented.\n");
563 wined3d_vp
.x
= viewports
[0].TopLeftX
;
564 wined3d_vp
.y
= viewports
[0].TopLeftY
;
565 wined3d_vp
.width
= viewports
[0].Width
;
566 wined3d_vp
.height
= viewports
[0].Height
;
567 wined3d_vp
.min_z
= viewports
[0].MinDepth
;
568 wined3d_vp
.max_z
= viewports
[0].MaxDepth
;
570 wined3d_device_set_viewport(device
->wined3d_device
, &wined3d_vp
);
573 static void STDMETHODCALLTYPE
d3d10_device_RSSetScissorRects(ID3D10Device1
*iface
,
574 UINT rect_count
, const D3D10_RECT
*rects
)
576 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
578 TRACE("iface %p, rect_count %u, rects %p.\n", iface
, rect_count
, rects
);
581 FIXME("Multiple scissor rects not implemented.\n");
586 wined3d_device_set_scissor_rect(device
->wined3d_device
, rects
);
589 static void STDMETHODCALLTYPE
d3d10_device_CopySubresourceRegion(ID3D10Device1
*iface
,
590 ID3D10Resource
*dst_resource
, UINT dst_subresource_idx
, UINT dst_x
, UINT dst_y
, UINT dst_z
,
591 ID3D10Resource
*src_resource
, UINT src_subresource_idx
, const D3D10_BOX
*src_box
)
593 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
594 "\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
595 iface
, dst_resource
, dst_subresource_idx
, dst_x
, dst_y
, dst_z
,
596 src_resource
, src_subresource_idx
, src_box
);
599 static void STDMETHODCALLTYPE
d3d10_device_CopyResource(ID3D10Device1
*iface
,
600 ID3D10Resource
*dst_resource
, ID3D10Resource
*src_resource
)
602 struct wined3d_resource
*wined3d_dst_resource
, *wined3d_src_resource
;
603 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
605 TRACE("iface %p, dst_resource %p, src_resource %p.\n", iface
, dst_resource
, src_resource
);
607 wined3d_dst_resource
= wined3d_resource_from_resource(dst_resource
);
608 wined3d_src_resource
= wined3d_resource_from_resource(src_resource
);
609 wined3d_device_copy_resource(device
->wined3d_device
, wined3d_dst_resource
, wined3d_src_resource
);
612 static void STDMETHODCALLTYPE
d3d10_device_UpdateSubresource(ID3D10Device1
*iface
,
613 ID3D10Resource
*resource
, UINT subresource_idx
, const D3D10_BOX
*box
,
614 const void *data
, UINT row_pitch
, UINT depth_pitch
)
616 FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
617 iface
, resource
, subresource_idx
, box
, data
, row_pitch
, depth_pitch
);
620 static void STDMETHODCALLTYPE
d3d10_device_ClearRenderTargetView(ID3D10Device1
*iface
,
621 ID3D10RenderTargetView
*render_target_view
, const FLOAT color_rgba
[4])
623 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
624 struct d3d10_rendertarget_view
*view
= unsafe_impl_from_ID3D10RenderTargetView(render_target_view
);
625 const struct wined3d_color color
= {color_rgba
[0], color_rgba
[1], color_rgba
[2], color_rgba
[3]};
628 TRACE("iface %p, render_target_view %p, color_rgba {%.8e, %.8e, %.8e, %.8e}.\n",
629 iface
, render_target_view
, color_rgba
[0], color_rgba
[1], color_rgba
[2], color_rgba
[3]);
631 if (FAILED(hr
= wined3d_device_clear_rendertarget_view(device
->wined3d_device
, view
->wined3d_view
, NULL
, &color
)))
632 ERR("Failed to clear view, hr %#x.\n", hr
);
635 static void STDMETHODCALLTYPE
d3d10_device_ClearDepthStencilView(ID3D10Device1
*iface
,
636 ID3D10DepthStencilView
*depth_stencil_view
, UINT flags
, FLOAT depth
, UINT8 stencil
)
638 FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
639 iface
, depth_stencil_view
, flags
, depth
, stencil
);
642 static void STDMETHODCALLTYPE
d3d10_device_GenerateMips(ID3D10Device1
*iface
,
643 ID3D10ShaderResourceView
*shader_resource_view
)
645 FIXME("iface %p, shader_resource_view %p stub!\n", iface
, shader_resource_view
);
648 static void STDMETHODCALLTYPE
d3d10_device_ResolveSubresource(ID3D10Device1
*iface
,
649 ID3D10Resource
*dst_resource
, UINT dst_subresource_idx
,
650 ID3D10Resource
*src_resource
, UINT src_subresource_idx
, DXGI_FORMAT format
)
652 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
653 "\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
654 iface
, dst_resource
, dst_subresource_idx
,
655 src_resource
, src_subresource_idx
, debug_dxgi_format(format
));
658 static void STDMETHODCALLTYPE
d3d10_device_VSGetConstantBuffers(ID3D10Device1
*iface
,
659 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
)
661 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
664 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
665 iface
, start_slot
, buffer_count
, buffers
);
667 for (i
= 0; i
< buffer_count
; ++i
)
669 struct wined3d_buffer
*wined3d_buffer
;
670 struct d3d10_buffer
*buffer_impl
;
672 if (!(wined3d_buffer
= wined3d_device_get_vs_cb(device
->wined3d_device
, start_slot
+ i
)))
678 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
679 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
680 ID3D10Buffer_AddRef(buffers
[i
]);
684 static void STDMETHODCALLTYPE
d3d10_device_PSGetShaderResources(ID3D10Device1
*iface
,
685 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
**views
)
687 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
690 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
691 iface
, start_slot
, view_count
, views
);
693 for (i
= 0; i
< view_count
; ++i
)
695 struct wined3d_shader_resource_view
*wined3d_view
;
696 struct d3d10_shader_resource_view
*view_impl
;
698 if (!(wined3d_view
= wined3d_device_get_ps_resource_view(device
->wined3d_device
, start_slot
+ i
)))
704 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
705 views
[i
] = &view_impl
->ID3D10ShaderResourceView_iface
;
706 ID3D10ShaderResourceView_AddRef(views
[i
]);
710 static void STDMETHODCALLTYPE
d3d10_device_PSGetShader(ID3D10Device1
*iface
, ID3D10PixelShader
**shader
)
712 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
713 struct d3d10_pixel_shader
*shader_impl
;
714 struct wined3d_shader
*wined3d_shader
;
716 TRACE("iface %p, shader %p.\n", iface
, shader
);
718 if (!(wined3d_shader
= wined3d_device_get_pixel_shader(device
->wined3d_device
)))
724 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
725 *shader
= &shader_impl
->ID3D10PixelShader_iface
;
726 ID3D10PixelShader_AddRef(*shader
);
729 static void STDMETHODCALLTYPE
d3d10_device_PSGetSamplers(ID3D10Device1
*iface
,
730 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
**samplers
)
732 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
735 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
736 iface
, start_slot
, sampler_count
, samplers
);
738 for (i
= 0; i
< sampler_count
; ++i
)
740 struct d3d10_sampler_state
*sampler_impl
;
741 struct wined3d_sampler
*wined3d_sampler
;
743 if (!(wined3d_sampler
= wined3d_device_get_ps_sampler(device
->wined3d_device
, start_slot
+ i
)))
749 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
750 samplers
[i
] = &sampler_impl
->ID3D10SamplerState_iface
;
751 ID3D10SamplerState_AddRef(samplers
[i
]);
755 static void STDMETHODCALLTYPE
d3d10_device_VSGetShader(ID3D10Device1
*iface
, ID3D10VertexShader
**shader
)
757 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
758 struct d3d10_vertex_shader
*shader_impl
;
759 struct wined3d_shader
*wined3d_shader
;
761 TRACE("iface %p, shader %p.\n", iface
, shader
);
763 if (!(wined3d_shader
= wined3d_device_get_vertex_shader(device
->wined3d_device
)))
769 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
770 *shader
= &shader_impl
->ID3D10VertexShader_iface
;
771 ID3D10VertexShader_AddRef(*shader
);
774 static void STDMETHODCALLTYPE
d3d10_device_PSGetConstantBuffers(ID3D10Device1
*iface
,
775 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
)
777 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
780 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
781 iface
, start_slot
, buffer_count
, buffers
);
783 for (i
= 0; i
< buffer_count
; ++i
)
785 struct wined3d_buffer
*wined3d_buffer
;
786 struct d3d10_buffer
*buffer_impl
;
788 if (!(wined3d_buffer
= wined3d_device_get_ps_cb(device
->wined3d_device
, start_slot
+ i
)))
794 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
795 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
796 ID3D10Buffer_AddRef(buffers
[i
]);
800 static void STDMETHODCALLTYPE
d3d10_device_IAGetInputLayout(ID3D10Device1
*iface
, ID3D10InputLayout
**input_layout
)
802 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
803 struct wined3d_vertex_declaration
*wined3d_declaration
;
804 struct d3d10_input_layout
*input_layout_impl
;
806 TRACE("iface %p, input_layout %p.\n", iface
, input_layout
);
808 if (!(wined3d_declaration
= wined3d_device_get_vertex_declaration(device
->wined3d_device
)))
810 *input_layout
= NULL
;
814 input_layout_impl
= wined3d_vertex_declaration_get_parent(wined3d_declaration
);
815 *input_layout
= &input_layout_impl
->ID3D10InputLayout_iface
;
816 ID3D10InputLayout_AddRef(*input_layout
);
819 static void STDMETHODCALLTYPE
d3d10_device_IAGetVertexBuffers(ID3D10Device1
*iface
,
820 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
, UINT
*strides
, UINT
*offsets
)
822 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
825 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p.\n",
826 iface
, start_slot
, buffer_count
, buffers
, strides
, offsets
);
828 for (i
= 0; i
< buffer_count
; ++i
)
830 struct wined3d_buffer
*wined3d_buffer
;
831 struct d3d10_buffer
*buffer_impl
;
833 if (FAILED(wined3d_device_get_stream_source(device
->wined3d_device
, start_slot
+ i
,
834 &wined3d_buffer
, &offsets
[i
], &strides
[i
])))
835 ERR("Failed to get vertex buffer.\n");
843 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
844 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
845 ID3D10Buffer_AddRef(buffers
[i
]);
849 static void STDMETHODCALLTYPE
d3d10_device_IAGetIndexBuffer(ID3D10Device1
*iface
,
850 ID3D10Buffer
**buffer
, DXGI_FORMAT
*format
, UINT
*offset
)
852 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
853 enum wined3d_format_id wined3d_format
;
854 struct wined3d_buffer
*wined3d_buffer
;
855 struct d3d10_buffer
*buffer_impl
;
857 TRACE("iface %p, buffer %p, format %p, offset %p.\n", iface
, buffer
, format
, offset
);
859 wined3d_buffer
= wined3d_device_get_index_buffer(device
->wined3d_device
, &wined3d_format
);
860 *format
= dxgi_format_from_wined3dformat(wined3d_format
);
861 *offset
= 0; /* FIXME */
868 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
869 *buffer
= &buffer_impl
->ID3D10Buffer_iface
;
870 ID3D10Buffer_AddRef(*buffer
);
873 static void STDMETHODCALLTYPE
d3d10_device_GSGetConstantBuffers(ID3D10Device1
*iface
,
874 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
)
876 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
879 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
880 iface
, start_slot
, buffer_count
, buffers
);
882 for (i
= 0; i
< buffer_count
; ++i
)
884 struct wined3d_buffer
*wined3d_buffer
;
885 struct d3d10_buffer
*buffer_impl
;
887 if (!(wined3d_buffer
= wined3d_device_get_gs_cb(device
->wined3d_device
, start_slot
+ i
)))
893 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
894 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
895 ID3D10Buffer_AddRef(buffers
[i
]);
899 static void STDMETHODCALLTYPE
d3d10_device_GSGetShader(ID3D10Device1
*iface
, ID3D10GeometryShader
**shader
)
901 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
902 struct d3d10_geometry_shader
*shader_impl
;
903 struct wined3d_shader
*wined3d_shader
;
905 TRACE("iface %p, shader %p.\n", iface
, shader
);
907 if (!(wined3d_shader
= wined3d_device_get_geometry_shader(device
->wined3d_device
)))
913 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
914 *shader
= &shader_impl
->ID3D10GeometryShader_iface
;
915 ID3D10GeometryShader_AddRef(*shader
);
918 static void STDMETHODCALLTYPE
d3d10_device_IAGetPrimitiveTopology(ID3D10Device1
*iface
,
919 D3D10_PRIMITIVE_TOPOLOGY
*topology
)
921 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
923 TRACE("iface %p, topology %p\n", iface
, topology
);
925 wined3d_device_get_primitive_type(This
->wined3d_device
, (enum wined3d_primitive_type
*)topology
);
928 static void STDMETHODCALLTYPE
d3d10_device_VSGetShaderResources(ID3D10Device1
*iface
,
929 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
**views
)
931 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
934 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
935 iface
, start_slot
, view_count
, views
);
937 for (i
= 0; i
< view_count
; ++i
)
939 struct wined3d_shader_resource_view
*wined3d_view
;
940 struct d3d10_shader_resource_view
*view_impl
;
942 if (!(wined3d_view
= wined3d_device_get_vs_resource_view(device
->wined3d_device
, start_slot
+ i
)))
948 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
949 views
[i
] = &view_impl
->ID3D10ShaderResourceView_iface
;
950 ID3D10ShaderResourceView_AddRef(views
[i
]);
954 static void STDMETHODCALLTYPE
d3d10_device_VSGetSamplers(ID3D10Device1
*iface
,
955 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
**samplers
)
957 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
960 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
961 iface
, start_slot
, sampler_count
, samplers
);
963 for (i
= 0; i
< sampler_count
; ++i
)
965 struct d3d10_sampler_state
*sampler_impl
;
966 struct wined3d_sampler
*wined3d_sampler
;
968 if (!(wined3d_sampler
= wined3d_device_get_vs_sampler(device
->wined3d_device
, start_slot
+ i
)))
974 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
975 samplers
[i
] = &sampler_impl
->ID3D10SamplerState_iface
;
976 ID3D10SamplerState_AddRef(samplers
[i
]);
980 static void STDMETHODCALLTYPE
d3d10_device_GetPredication(ID3D10Device1
*iface
,
981 ID3D10Predicate
**predicate
, BOOL
*value
)
983 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
984 struct wined3d_query
*wined3d_predicate
;
985 struct d3d10_query
*predicate_impl
;
987 TRACE("iface %p, predicate %p, value %p.\n", iface
, predicate
, value
);
989 if (!(wined3d_predicate
= wined3d_device_get_predication(device
->wined3d_device
, value
)))
995 predicate_impl
= wined3d_query_get_parent(wined3d_predicate
);
996 *predicate
= (ID3D10Predicate
*)&predicate_impl
->ID3D10Query_iface
;
997 ID3D10Predicate_AddRef(*predicate
);
1000 static void STDMETHODCALLTYPE
d3d10_device_GSGetShaderResources(ID3D10Device1
*iface
,
1001 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
**views
)
1003 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1006 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
1007 iface
, start_slot
, view_count
, views
);
1009 for (i
= 0; i
< view_count
; ++i
)
1011 struct wined3d_shader_resource_view
*wined3d_view
;
1012 struct d3d10_shader_resource_view
*view_impl
;
1014 if (!(wined3d_view
= wined3d_device_get_gs_resource_view(device
->wined3d_device
, start_slot
+ i
)))
1020 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
1021 views
[i
] = &view_impl
->ID3D10ShaderResourceView_iface
;
1022 ID3D10ShaderResourceView_AddRef(views
[i
]);
1026 static void STDMETHODCALLTYPE
d3d10_device_GSGetSamplers(ID3D10Device1
*iface
,
1027 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
**samplers
)
1029 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1032 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
1033 iface
, start_slot
, sampler_count
, samplers
);
1035 for (i
= 0; i
< sampler_count
; ++i
)
1037 struct d3d10_sampler_state
*sampler_impl
;
1038 struct wined3d_sampler
*wined3d_sampler
;
1040 if (!(wined3d_sampler
= wined3d_device_get_gs_sampler(device
->wined3d_device
, start_slot
+ i
)))
1046 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
1047 samplers
[i
] = &sampler_impl
->ID3D10SamplerState_iface
;
1048 ID3D10SamplerState_AddRef(samplers
[i
]);
1052 static void STDMETHODCALLTYPE
d3d10_device_OMGetRenderTargets(ID3D10Device1
*iface
,
1053 UINT view_count
, ID3D10RenderTargetView
**render_target_views
, ID3D10DepthStencilView
**depth_stencil_view
)
1055 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1056 struct wined3d_rendertarget_view
*wined3d_view
;
1058 TRACE("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p.\n",
1059 iface
, view_count
, render_target_views
, depth_stencil_view
);
1061 if (render_target_views
)
1063 struct d3d10_rendertarget_view
*view_impl
;
1066 for (i
= 0; i
< view_count
; ++i
)
1068 if (!(wined3d_view
= wined3d_device_get_rendertarget_view(device
->wined3d_device
, i
))
1069 || !(view_impl
= wined3d_rendertarget_view_get_parent(wined3d_view
)))
1071 render_target_views
[i
] = NULL
;
1075 render_target_views
[i
] = &view_impl
->ID3D10RenderTargetView_iface
;
1076 ID3D10RenderTargetView_AddRef(render_target_views
[i
]);
1080 if (depth_stencil_view
)
1082 struct d3d10_depthstencil_view
*view_impl
;
1084 if (!(wined3d_view
= wined3d_device_get_depth_stencil_view(device
->wined3d_device
))
1085 || !(view_impl
= wined3d_rendertarget_view_get_parent(wined3d_view
)))
1087 *depth_stencil_view
= NULL
;
1091 *depth_stencil_view
= &view_impl
->ID3D10DepthStencilView_iface
;
1092 ID3D10DepthStencilView_AddRef(*depth_stencil_view
);
1097 static void STDMETHODCALLTYPE
d3d10_device_OMGetBlendState(ID3D10Device1
*iface
,
1098 ID3D10BlendState
**blend_state
, FLOAT blend_factor
[4], UINT
*sample_mask
)
1100 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1102 TRACE("iface %p, blend_state %p, blend_factor %p, sample_mask %p.\n",
1103 iface
, blend_state
, blend_factor
, sample_mask
);
1105 if ((*blend_state
= device
->blend_state
? &device
->blend_state
->ID3D10BlendState_iface
: NULL
))
1106 ID3D10BlendState_AddRef(*blend_state
);
1107 memcpy(blend_factor
, device
->blend_factor
, 4 * sizeof(*blend_factor
));
1108 *sample_mask
= device
->sample_mask
;
1111 static void STDMETHODCALLTYPE
d3d10_device_OMGetDepthStencilState(ID3D10Device1
*iface
,
1112 ID3D10DepthStencilState
**depth_stencil_state
, UINT
*stencil_ref
)
1114 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1116 TRACE("iface %p, depth_stencil_state %p, stencil_ref %p.\n",
1117 iface
, depth_stencil_state
, stencil_ref
);
1119 if ((*depth_stencil_state
= device
->depth_stencil_state
1120 ? &device
->depth_stencil_state
->ID3D10DepthStencilState_iface
: NULL
))
1121 ID3D10DepthStencilState_AddRef(*depth_stencil_state
);
1122 *stencil_ref
= device
->stencil_ref
;
1125 static void STDMETHODCALLTYPE
d3d10_device_SOGetTargets(ID3D10Device1
*iface
,
1126 UINT buffer_count
, ID3D10Buffer
**buffers
, UINT
*offsets
)
1128 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1131 TRACE("iface %p, buffer_count %u, buffers %p, offsets %p.\n",
1132 iface
, buffer_count
, buffers
, offsets
);
1134 for (i
= 0; i
< buffer_count
; ++i
)
1136 struct wined3d_buffer
*wined3d_buffer
;
1137 struct d3d10_buffer
*buffer_impl
;
1139 if (!(wined3d_buffer
= wined3d_device_get_stream_output(device
->wined3d_device
, i
, &offsets
[i
])))
1145 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
1146 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
1147 ID3D10Buffer_AddRef(buffers
[i
]);
1151 static void STDMETHODCALLTYPE
d3d10_device_RSGetState(ID3D10Device1
*iface
, ID3D10RasterizerState
**rasterizer_state
)
1153 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1155 TRACE("iface %p, rasterizer_state %p.\n", iface
, rasterizer_state
);
1157 if ((*rasterizer_state
= device
->rasterizer_state
? &device
->rasterizer_state
->ID3D10RasterizerState_iface
: NULL
))
1158 ID3D10RasterizerState_AddRef(*rasterizer_state
);
1161 static void STDMETHODCALLTYPE
d3d10_device_RSGetViewports(ID3D10Device1
*iface
,
1162 UINT
*viewport_count
, D3D10_VIEWPORT
*viewports
)
1164 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1165 struct wined3d_viewport wined3d_vp
;
1167 TRACE("iface %p, viewport_count %p, viewports %p.\n", iface
, viewport_count
, viewports
);
1171 *viewport_count
= 1;
1175 if (!*viewport_count
)
1178 wined3d_device_get_viewport(device
->wined3d_device
, &wined3d_vp
);
1180 viewports
[0].TopLeftX
= wined3d_vp
.x
;
1181 viewports
[0].TopLeftY
= wined3d_vp
.y
;
1182 viewports
[0].Width
= wined3d_vp
.width
;
1183 viewports
[0].Height
= wined3d_vp
.height
;
1184 viewports
[0].MinDepth
= wined3d_vp
.min_z
;
1185 viewports
[0].MaxDepth
= wined3d_vp
.max_z
;
1187 if (*viewport_count
> 1)
1188 memset(&viewports
[1], 0, (*viewport_count
- 1) * sizeof(*viewports
));
1191 static void STDMETHODCALLTYPE
d3d10_device_RSGetScissorRects(ID3D10Device1
*iface
, UINT
*rect_count
, D3D10_RECT
*rects
)
1193 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1195 TRACE("iface %p, rect_count %p, rects %p.\n", iface
, rect_count
, rects
);
1206 wined3d_device_get_scissor_rect(device
->wined3d_device
, rects
);
1207 if (*rect_count
> 1)
1208 memset(&rects
[1], 0, (*rect_count
- 1) * sizeof(*rects
));
1211 static HRESULT STDMETHODCALLTYPE
d3d10_device_GetDeviceRemovedReason(ID3D10Device1
*iface
)
1213 TRACE("iface %p.\n", iface
);
1215 /* In the current implementation the device is never removed, so we can
1216 * just return S_OK here. */
1221 static HRESULT STDMETHODCALLTYPE
d3d10_device_SetExceptionMode(ID3D10Device1
*iface
, UINT flags
)
1223 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
1228 static UINT STDMETHODCALLTYPE
d3d10_device_GetExceptionMode(ID3D10Device1
*iface
)
1230 FIXME("iface %p stub!\n", iface
);
1235 static HRESULT STDMETHODCALLTYPE
d3d10_device_GetPrivateData(ID3D10Device1
*iface
,
1236 REFGUID guid
, UINT
*data_size
, void *data
)
1238 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
1239 iface
, debugstr_guid(guid
), data_size
, data
);
1244 static HRESULT STDMETHODCALLTYPE
d3d10_device_SetPrivateData(ID3D10Device1
*iface
,
1245 REFGUID guid
, UINT data_size
, const void *data
)
1247 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
1248 iface
, debugstr_guid(guid
), data_size
, data
);
1253 static HRESULT STDMETHODCALLTYPE
d3d10_device_SetPrivateDataInterface(ID3D10Device1
*iface
,
1254 REFGUID guid
, const IUnknown
*data
)
1256 FIXME("iface %p, guid %s, data %p stub!\n", iface
, debugstr_guid(guid
), data
);
1261 static void STDMETHODCALLTYPE
d3d10_device_ClearState(ID3D10Device1
*iface
)
1263 FIXME("iface %p stub!\n", iface
);
1266 static void STDMETHODCALLTYPE
d3d10_device_Flush(ID3D10Device1
*iface
)
1268 FIXME("iface %p stub!\n", iface
);
1271 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateBuffer(ID3D10Device1
*iface
,
1272 const D3D10_BUFFER_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
, ID3D10Buffer
**buffer
)
1274 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
1275 struct d3d10_buffer
*object
;
1278 FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface
, desc
, data
, buffer
);
1280 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1282 return E_OUTOFMEMORY
;
1284 hr
= d3d10_buffer_init(object
, This
, desc
, data
);
1287 WARN("Failed to initialize buffer, hr %#x.\n", hr
);
1288 HeapFree(GetProcessHeap(), 0, object
);
1292 *buffer
= &object
->ID3D10Buffer_iface
;
1294 TRACE("Created ID3D10Buffer %p\n", object
);
1299 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateTexture1D(ID3D10Device1
*iface
,
1300 const D3D10_TEXTURE1D_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
, ID3D10Texture1D
**texture
)
1302 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface
, desc
, data
, texture
);
1307 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateTexture2D(ID3D10Device1
*iface
,
1308 const D3D10_TEXTURE2D_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
,
1309 ID3D10Texture2D
**texture
)
1311 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
1312 struct d3d10_texture2d
*object
;
1315 FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface
, desc
, data
, texture
);
1317 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1319 return E_OUTOFMEMORY
;
1321 hr
= d3d10_texture2d_init(object
, This
, desc
);
1324 WARN("Failed to initialize texture, hr %#x.\n", hr
);
1325 HeapFree(GetProcessHeap(), 0, object
);
1329 *texture
= &object
->ID3D10Texture2D_iface
;
1331 TRACE("Created ID3D10Texture2D %p\n", object
);
1336 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateTexture3D(ID3D10Device1
*iface
,
1337 const D3D10_TEXTURE3D_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
,
1338 ID3D10Texture3D
**texture
)
1340 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1341 struct d3d10_texture3d
*object
;
1344 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface
, desc
, data
, texture
);
1346 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1348 return E_OUTOFMEMORY
;
1350 hr
= d3d10_texture3d_init(object
, device
, desc
);
1353 WARN("Failed to initialize texture, hr %#x.\n", hr
);
1354 HeapFree(GetProcessHeap(), 0, object
);
1358 TRACE("Created 3D texture %p.\n", object
);
1359 *texture
= &object
->ID3D10Texture3D_iface
;
1364 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateShaderResourceView(ID3D10Device1
*iface
,
1365 ID3D10Resource
*resource
, const D3D10_SHADER_RESOURCE_VIEW_DESC
*desc
, ID3D10ShaderResourceView
**view
)
1367 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1368 struct d3d10_shader_resource_view
*object
;
1371 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
1373 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1374 return E_OUTOFMEMORY
;
1376 if (FAILED(hr
= d3d10_shader_resource_view_init(object
, device
, resource
, desc
)))
1378 WARN("Failed to initialize shader resource view, hr %#x.\n", hr
);
1379 HeapFree(GetProcessHeap(), 0, object
);
1383 TRACE("Created shader resource view %p.\n", object
);
1384 *view
= &object
->ID3D10ShaderResourceView_iface
;
1389 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateRenderTargetView(ID3D10Device1
*iface
,
1390 ID3D10Resource
*resource
, const D3D10_RENDER_TARGET_VIEW_DESC
*desc
, ID3D10RenderTargetView
**view
)
1392 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1393 struct d3d10_rendertarget_view
*object
;
1396 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
1398 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1399 return E_OUTOFMEMORY
;
1401 if (FAILED(hr
= d3d10_rendertarget_view_init(object
, device
, resource
, desc
)))
1403 WARN("Failed to initialize rendertarget view, hr %#x.\n", hr
);
1404 HeapFree(GetProcessHeap(), 0, object
);
1408 TRACE("Created rendertarget view %p.\n", object
);
1409 *view
= &object
->ID3D10RenderTargetView_iface
;
1414 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateDepthStencilView(ID3D10Device1
*iface
,
1415 ID3D10Resource
*resource
, const D3D10_DEPTH_STENCIL_VIEW_DESC
*desc
, ID3D10DepthStencilView
**view
)
1417 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1418 struct d3d10_depthstencil_view
*object
;
1421 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
1423 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1424 return E_OUTOFMEMORY
;
1426 if (FAILED(hr
= d3d10_depthstencil_view_init(object
, device
, resource
, desc
)))
1428 WARN("Failed to initialize depthstencil view, hr %#x.\n", hr
);
1429 HeapFree(GetProcessHeap(), 0, object
);
1433 TRACE("Created depthstencil view %p.\n", object
);
1434 *view
= &object
->ID3D10DepthStencilView_iface
;
1439 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateInputLayout(ID3D10Device1
*iface
,
1440 const D3D10_INPUT_ELEMENT_DESC
*element_descs
, UINT element_count
,
1441 const void *shader_byte_code
, SIZE_T shader_byte_code_length
,
1442 ID3D10InputLayout
**input_layout
)
1444 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
1445 struct d3d10_input_layout
*object
;
1448 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
1449 "\tshader_byte_code_length %lu, input_layout %p\n",
1450 iface
, element_descs
, element_count
, shader_byte_code
,
1451 shader_byte_code_length
, input_layout
);
1453 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1455 return E_OUTOFMEMORY
;
1457 hr
= d3d10_input_layout_init(object
, This
, element_descs
, element_count
,
1458 shader_byte_code
, shader_byte_code_length
);
1461 WARN("Failed to initialize input layout, hr %#x.\n", hr
);
1462 HeapFree(GetProcessHeap(), 0, object
);
1466 TRACE("Created input layout %p.\n", object
);
1467 *input_layout
= &object
->ID3D10InputLayout_iface
;
1472 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateVertexShader(ID3D10Device1
*iface
,
1473 const void *byte_code
, SIZE_T byte_code_length
, ID3D10VertexShader
**shader
)
1475 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
1476 struct d3d10_vertex_shader
*object
;
1479 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
1480 iface
, byte_code
, byte_code_length
, shader
);
1482 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1484 return E_OUTOFMEMORY
;
1486 hr
= d3d10_vertex_shader_init(object
, This
, byte_code
, byte_code_length
);
1489 WARN("Failed to initialize vertex shader, hr %#x.\n", hr
);
1490 HeapFree(GetProcessHeap(), 0, object
);
1494 TRACE("Created vertex shader %p.\n", object
);
1495 *shader
= &object
->ID3D10VertexShader_iface
;
1500 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateGeometryShader(ID3D10Device1
*iface
,
1501 const void *byte_code
, SIZE_T byte_code_length
, ID3D10GeometryShader
**shader
)
1503 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
1504 struct d3d10_geometry_shader
*object
;
1507 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p.\n",
1508 iface
, byte_code
, byte_code_length
, shader
);
1510 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1512 return E_OUTOFMEMORY
;
1514 hr
= d3d10_geometry_shader_init(object
, This
, byte_code
, byte_code_length
);
1517 WARN("Failed to initialize geometry shader, hr %#x.\n", hr
);
1518 HeapFree(GetProcessHeap(), 0, object
);
1522 TRACE("Created geometry shader %p.\n", object
);
1523 *shader
= &object
->ID3D10GeometryShader_iface
;
1528 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device1
*iface
,
1529 const void *byte_code
, SIZE_T byte_code_length
, const D3D10_SO_DECLARATION_ENTRY
*output_stream_decls
,
1530 UINT output_stream_decl_count
, UINT output_stream_stride
, ID3D10GeometryShader
**shader
)
1532 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p,\n"
1533 "\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
1534 iface
, byte_code
, byte_code_length
, output_stream_decls
,
1535 output_stream_decl_count
, output_stream_stride
, shader
);
1540 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreatePixelShader(ID3D10Device1
*iface
,
1541 const void *byte_code
, SIZE_T byte_code_length
, ID3D10PixelShader
**shader
)
1543 struct d3d10_device
*This
= impl_from_ID3D10Device(iface
);
1544 struct d3d10_pixel_shader
*object
;
1547 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
1548 iface
, byte_code
, byte_code_length
, shader
);
1550 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1552 return E_OUTOFMEMORY
;
1554 hr
= d3d10_pixel_shader_init(object
, This
, byte_code
, byte_code_length
);
1557 WARN("Failed to initialize pixel shader, hr %#x.\n", hr
);
1558 HeapFree(GetProcessHeap(), 0, object
);
1562 TRACE("Created pixel shader %p.\n", object
);
1563 *shader
= &object
->ID3D10PixelShader_iface
;
1568 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateBlendState(ID3D10Device1
*iface
,
1569 const D3D10_BLEND_DESC
*desc
, ID3D10BlendState
**blend_state
)
1571 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1572 struct d3d10_blend_state
*object
;
1573 struct wine_rb_entry
*entry
;
1576 TRACE("iface %p, desc %p, blend_state %p.\n", iface
, desc
, blend_state
);
1579 return E_INVALIDARG
;
1581 if ((entry
= wine_rb_get(&device
->blend_states
, desc
)))
1583 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d10_blend_state
, entry
);
1585 TRACE("Returning existing blend state %p.\n", object
);
1586 *blend_state
= &object
->ID3D10BlendState_iface
;
1587 ID3D10BlendState_AddRef(*blend_state
);
1592 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1594 return E_OUTOFMEMORY
;
1596 if (FAILED(hr
= d3d10_blend_state_init(object
, device
, desc
)))
1598 WARN("Failed to initialize blend state, hr %#x.\n", hr
);
1599 HeapFree(GetProcessHeap(), 0, object
);
1603 TRACE("Created blend state %p.\n", object
);
1604 *blend_state
= &object
->ID3D10BlendState_iface
;
1609 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateDepthStencilState(ID3D10Device1
*iface
,
1610 const D3D10_DEPTH_STENCIL_DESC
*desc
, ID3D10DepthStencilState
**depth_stencil_state
)
1612 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1613 struct d3d10_depthstencil_state
*object
;
1614 struct wine_rb_entry
*entry
;
1617 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface
, desc
, depth_stencil_state
);
1620 return E_INVALIDARG
;
1622 if ((entry
= wine_rb_get(&device
->depthstencil_states
, desc
)))
1624 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d10_depthstencil_state
, entry
);
1626 TRACE("Returning existing depthstencil state %p.\n", object
);
1627 *depth_stencil_state
= &object
->ID3D10DepthStencilState_iface
;
1628 ID3D10DepthStencilState_AddRef(*depth_stencil_state
);
1633 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1635 return E_OUTOFMEMORY
;
1637 if (FAILED(hr
= d3d10_depthstencil_state_init(object
, device
, desc
)))
1639 WARN("Failed to initialize depthstencil state, hr %#x.\n", hr
);
1640 HeapFree(GetProcessHeap(), 0, object
);
1644 TRACE("Created depthstencil state %p.\n", object
);
1645 *depth_stencil_state
= &object
->ID3D10DepthStencilState_iface
;
1650 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateRasterizerState(ID3D10Device1
*iface
,
1651 const D3D10_RASTERIZER_DESC
*desc
, ID3D10RasterizerState
**rasterizer_state
)
1653 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1654 struct d3d10_rasterizer_state
*object
;
1655 struct wine_rb_entry
*entry
;
1658 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface
, desc
, rasterizer_state
);
1661 return E_INVALIDARG
;
1663 if ((entry
= wine_rb_get(&device
->rasterizer_states
, desc
)))
1665 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d10_rasterizer_state
, entry
);
1667 TRACE("Returning existing rasterizer state %p.\n", object
);
1668 *rasterizer_state
= &object
->ID3D10RasterizerState_iface
;
1669 ID3D10RasterizerState_AddRef(*rasterizer_state
);
1675 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1677 return E_OUTOFMEMORY
;
1679 if (FAILED(hr
= d3d10_rasterizer_state_init(object
, device
, desc
)))
1681 WARN("Failed to initialize rasterizer state, hr %#x.\n", hr
);
1682 HeapFree(GetProcessHeap(), 0, object
);
1686 TRACE("Created rasterizer state %p.\n", object
);
1687 *rasterizer_state
= &object
->ID3D10RasterizerState_iface
;
1692 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateSamplerState(ID3D10Device1
*iface
,
1693 const D3D10_SAMPLER_DESC
*desc
, ID3D10SamplerState
**sampler_state
)
1695 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1696 struct d3d10_sampler_state
*object
;
1697 struct wine_rb_entry
*entry
;
1700 TRACE("iface %p, desc %p, sampler_state %p.\n", iface
, desc
, sampler_state
);
1703 return E_INVALIDARG
;
1705 if ((entry
= wine_rb_get(&device
->sampler_states
, desc
)))
1707 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d10_sampler_state
, entry
);
1709 TRACE("Returning existing sampler state %p.\n", object
);
1710 *sampler_state
= &object
->ID3D10SamplerState_iface
;
1711 ID3D10SamplerState_AddRef(*sampler_state
);
1716 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1718 return E_OUTOFMEMORY
;
1720 if (FAILED(hr
= d3d10_sampler_state_init(object
, device
, desc
)))
1722 WARN("Failed to initialize sampler state, hr %#x.\n", hr
);
1723 HeapFree(GetProcessHeap(), 0, object
);
1727 TRACE("Created sampler state %p.\n", object
);
1728 *sampler_state
= &object
->ID3D10SamplerState_iface
;
1733 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateQuery(ID3D10Device1
*iface
,
1734 const D3D10_QUERY_DESC
*desc
, ID3D10Query
**query
)
1736 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1737 struct d3d10_query
*object
;
1740 TRACE("iface %p, desc %p, query %p.\n", iface
, desc
, query
);
1742 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1743 return E_OUTOFMEMORY
;
1745 if (FAILED(hr
= d3d10_query_init(object
, device
, desc
, FALSE
)))
1747 WARN("Failed to initialize query, hr %#x.\n", hr
);
1748 HeapFree(GetProcessHeap(), 0, object
);
1752 TRACE("Created query %p.\n", object
);
1753 *query
= &object
->ID3D10Query_iface
;
1758 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreatePredicate(ID3D10Device1
*iface
,
1759 const D3D10_QUERY_DESC
*desc
, ID3D10Predicate
**predicate
)
1761 struct d3d10_device
*device
= impl_from_ID3D10Device(iface
);
1762 struct d3d10_query
*object
;
1765 TRACE("iface %p, desc %p, predicate %p.\n", iface
, desc
, predicate
);
1768 return E_INVALIDARG
;
1770 if (desc
->Query
!= D3D10_QUERY_OCCLUSION_PREDICATE
&& desc
->Query
!= D3D10_QUERY_SO_OVERFLOW_PREDICATE
)
1772 WARN("Query type %#x is not a predicate.\n", desc
->Query
);
1773 return E_INVALIDARG
;
1776 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1777 return E_OUTOFMEMORY
;
1779 if (FAILED(hr
= d3d10_query_init(object
, device
, desc
, TRUE
)))
1781 WARN("Failed to initialize predicate, hr %#x.\n", hr
);
1782 HeapFree(GetProcessHeap(), 0, object
);
1786 TRACE("Created predicate %p.\n", object
);
1787 *predicate
= (ID3D10Predicate
*)&object
->ID3D10Query_iface
;
1792 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateCounter(ID3D10Device1
*iface
,
1793 const D3D10_COUNTER_DESC
*desc
, ID3D10Counter
**counter
)
1795 FIXME("iface %p, desc %p, counter %p stub!\n", iface
, desc
, counter
);
1800 static HRESULT STDMETHODCALLTYPE
d3d10_device_CheckFormatSupport(ID3D10Device1
*iface
,
1801 DXGI_FORMAT format
, UINT
*format_support
)
1803 FIXME("iface %p, format %s, format_support %p stub!\n",
1804 iface
, debug_dxgi_format(format
), format_support
);
1809 static HRESULT STDMETHODCALLTYPE
d3d10_device_CheckMultisampleQualityLevels(ID3D10Device1
*iface
,
1810 DXGI_FORMAT format
, UINT sample_count
, UINT
*quality_level_count
)
1812 FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
1813 iface
, debug_dxgi_format(format
), sample_count
, quality_level_count
);
1818 static void STDMETHODCALLTYPE
d3d10_device_CheckCounterInfo(ID3D10Device1
*iface
, D3D10_COUNTER_INFO
*counter_info
)
1820 FIXME("iface %p, counter_info %p stub!\n", iface
, counter_info
);
1823 static HRESULT STDMETHODCALLTYPE
d3d10_device_CheckCounter(ID3D10Device1
*iface
,
1824 const D3D10_COUNTER_DESC
*desc
, D3D10_COUNTER_TYPE
*type
, UINT
*active_counters
, char *name
,
1825 UINT
*name_length
, char *units
, UINT
*units_length
, char *description
, UINT
*description_length
)
1827 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
1828 "\tunits %p, units_length %p, description %p, description_length %p stub!\n",
1829 iface
, desc
, type
, active_counters
, name
, name_length
,
1830 units
, units_length
, description
, description_length
);
1835 static UINT STDMETHODCALLTYPE
d3d10_device_GetCreationFlags(ID3D10Device1
*iface
)
1837 FIXME("iface %p stub!\n", iface
);
1842 static HRESULT STDMETHODCALLTYPE
d3d10_device_OpenSharedResource(ID3D10Device1
*iface
,
1843 HANDLE resource_handle
, REFIID guid
, void **resource
)
1845 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
1846 iface
, resource_handle
, debugstr_guid(guid
), resource
);
1851 static void STDMETHODCALLTYPE
d3d10_device_SetTextFilterSize(ID3D10Device1
*iface
, UINT width
, UINT height
)
1853 FIXME("iface %p, width %u, height %u stub!\n", iface
, width
, height
);
1856 static void STDMETHODCALLTYPE
d3d10_device_GetTextFilterSize(ID3D10Device1
*iface
, UINT
*width
, UINT
*height
)
1858 FIXME("iface %p, width %p, height %p stub!\n", iface
, width
, height
);
1861 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateShaderResourceView1(ID3D10Device1
*iface
,
1862 ID3D10Resource
*resource
, const D3D10_SHADER_RESOURCE_VIEW_DESC1
*desc
, ID3D10ShaderResourceView1
**view
)
1864 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface
, resource
, desc
, view
);
1869 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateBlendState1(ID3D10Device1
*iface
,
1870 const D3D10_BLEND_DESC1
*desc
, ID3D10BlendState1
**blend_state
)
1872 FIXME("iface %p, desc %p, blend_state %p stub!\n", iface
, desc
, blend_state
);
1877 static D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE
d3d10_device_GetFeatureLevel(ID3D10Device1
*iface
)
1879 FIXME("iface %p stub!\n", iface
);
1881 return D3D10_FEATURE_LEVEL_10_1
;
1884 static const struct ID3D10Device1Vtbl d3d10_device1_vtbl
=
1886 /* IUnknown methods */
1887 d3d10_device_QueryInterface
,
1888 d3d10_device_AddRef
,
1889 d3d10_device_Release
,
1890 /* ID3D10Device methods */
1891 d3d10_device_VSSetConstantBuffers
,
1892 d3d10_device_PSSetShaderResources
,
1893 d3d10_device_PSSetShader
,
1894 d3d10_device_PSSetSamplers
,
1895 d3d10_device_VSSetShader
,
1896 d3d10_device_DrawIndexed
,
1898 d3d10_device_PSSetConstantBuffers
,
1899 d3d10_device_IASetInputLayout
,
1900 d3d10_device_IASetVertexBuffers
,
1901 d3d10_device_IASetIndexBuffer
,
1902 d3d10_device_DrawIndexedInstanced
,
1903 d3d10_device_DrawInstanced
,
1904 d3d10_device_GSSetConstantBuffers
,
1905 d3d10_device_GSSetShader
,
1906 d3d10_device_IASetPrimitiveTopology
,
1907 d3d10_device_VSSetShaderResources
,
1908 d3d10_device_VSSetSamplers
,
1909 d3d10_device_SetPredication
,
1910 d3d10_device_GSSetShaderResources
,
1911 d3d10_device_GSSetSamplers
,
1912 d3d10_device_OMSetRenderTargets
,
1913 d3d10_device_OMSetBlendState
,
1914 d3d10_device_OMSetDepthStencilState
,
1915 d3d10_device_SOSetTargets
,
1916 d3d10_device_DrawAuto
,
1917 d3d10_device_RSSetState
,
1918 d3d10_device_RSSetViewports
,
1919 d3d10_device_RSSetScissorRects
,
1920 d3d10_device_CopySubresourceRegion
,
1921 d3d10_device_CopyResource
,
1922 d3d10_device_UpdateSubresource
,
1923 d3d10_device_ClearRenderTargetView
,
1924 d3d10_device_ClearDepthStencilView
,
1925 d3d10_device_GenerateMips
,
1926 d3d10_device_ResolveSubresource
,
1927 d3d10_device_VSGetConstantBuffers
,
1928 d3d10_device_PSGetShaderResources
,
1929 d3d10_device_PSGetShader
,
1930 d3d10_device_PSGetSamplers
,
1931 d3d10_device_VSGetShader
,
1932 d3d10_device_PSGetConstantBuffers
,
1933 d3d10_device_IAGetInputLayout
,
1934 d3d10_device_IAGetVertexBuffers
,
1935 d3d10_device_IAGetIndexBuffer
,
1936 d3d10_device_GSGetConstantBuffers
,
1937 d3d10_device_GSGetShader
,
1938 d3d10_device_IAGetPrimitiveTopology
,
1939 d3d10_device_VSGetShaderResources
,
1940 d3d10_device_VSGetSamplers
,
1941 d3d10_device_GetPredication
,
1942 d3d10_device_GSGetShaderResources
,
1943 d3d10_device_GSGetSamplers
,
1944 d3d10_device_OMGetRenderTargets
,
1945 d3d10_device_OMGetBlendState
,
1946 d3d10_device_OMGetDepthStencilState
,
1947 d3d10_device_SOGetTargets
,
1948 d3d10_device_RSGetState
,
1949 d3d10_device_RSGetViewports
,
1950 d3d10_device_RSGetScissorRects
,
1951 d3d10_device_GetDeviceRemovedReason
,
1952 d3d10_device_SetExceptionMode
,
1953 d3d10_device_GetExceptionMode
,
1954 d3d10_device_GetPrivateData
,
1955 d3d10_device_SetPrivateData
,
1956 d3d10_device_SetPrivateDataInterface
,
1957 d3d10_device_ClearState
,
1959 d3d10_device_CreateBuffer
,
1960 d3d10_device_CreateTexture1D
,
1961 d3d10_device_CreateTexture2D
,
1962 d3d10_device_CreateTexture3D
,
1963 d3d10_device_CreateShaderResourceView
,
1964 d3d10_device_CreateRenderTargetView
,
1965 d3d10_device_CreateDepthStencilView
,
1966 d3d10_device_CreateInputLayout
,
1967 d3d10_device_CreateVertexShader
,
1968 d3d10_device_CreateGeometryShader
,
1969 d3d10_device_CreateGeometryShaderWithStreamOutput
,
1970 d3d10_device_CreatePixelShader
,
1971 d3d10_device_CreateBlendState
,
1972 d3d10_device_CreateDepthStencilState
,
1973 d3d10_device_CreateRasterizerState
,
1974 d3d10_device_CreateSamplerState
,
1975 d3d10_device_CreateQuery
,
1976 d3d10_device_CreatePredicate
,
1977 d3d10_device_CreateCounter
,
1978 d3d10_device_CheckFormatSupport
,
1979 d3d10_device_CheckMultisampleQualityLevels
,
1980 d3d10_device_CheckCounterInfo
,
1981 d3d10_device_CheckCounter
,
1982 d3d10_device_GetCreationFlags
,
1983 d3d10_device_OpenSharedResource
,
1984 d3d10_device_SetTextFilterSize
,
1985 d3d10_device_GetTextFilterSize
,
1986 d3d10_device_CreateShaderResourceView1
,
1987 d3d10_device_CreateBlendState1
,
1988 d3d10_device_GetFeatureLevel
,
1991 static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl
=
1993 /* IUnknown methods */
1994 d3d10_device_inner_QueryInterface
,
1995 d3d10_device_inner_AddRef
,
1996 d3d10_device_inner_Release
,
1999 static inline struct d3d10_device
*impl_from_ID3D10Multithread(ID3D10Multithread
*iface
)
2001 return CONTAINING_RECORD(iface
, struct d3d10_device
, ID3D10Multithread_iface
);
2004 static HRESULT STDMETHODCALLTYPE
d3d10_multithread_QueryInterface(ID3D10Multithread
*iface
, REFIID iid
, void **out
)
2006 struct d3d10_device
*device
= impl_from_ID3D10Multithread(iface
);
2008 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
2010 return IUnknown_QueryInterface(device
->outer_unk
, iid
, out
);
2013 static ULONG STDMETHODCALLTYPE
d3d10_multithread_AddRef(ID3D10Multithread
*iface
)
2015 struct d3d10_device
*device
= impl_from_ID3D10Multithread(iface
);
2017 TRACE("iface %p.\n", iface
);
2019 return IUnknown_AddRef(device
->outer_unk
);
2022 static ULONG STDMETHODCALLTYPE
d3d10_multithread_Release(ID3D10Multithread
*iface
)
2024 struct d3d10_device
*device
= impl_from_ID3D10Multithread(iface
);
2026 TRACE("iface %p.\n", iface
);
2028 return IUnknown_Release(device
->outer_unk
);
2031 static void STDMETHODCALLTYPE
d3d10_multithread_Enter(ID3D10Multithread
*iface
)
2033 TRACE("iface %p.\n", iface
);
2035 wined3d_mutex_lock();
2038 static void STDMETHODCALLTYPE
d3d10_multithread_Leave(ID3D10Multithread
*iface
)
2040 TRACE("iface %p.\n", iface
);
2042 wined3d_mutex_unlock();
2045 static BOOL STDMETHODCALLTYPE
d3d10_multithread_SetMultithreadProtected(ID3D10Multithread
*iface
, BOOL protect
)
2047 FIXME("iface %p, protect %#x stub!\n", iface
, protect
);
2052 static BOOL STDMETHODCALLTYPE
d3d10_multithread_GetMultithreadProtected(ID3D10Multithread
*iface
)
2054 FIXME("iface %p stub!\n", iface
);
2059 static const struct ID3D10MultithreadVtbl d3d10_multithread_vtbl
=
2061 d3d10_multithread_QueryInterface
,
2062 d3d10_multithread_AddRef
,
2063 d3d10_multithread_Release
,
2064 d3d10_multithread_Enter
,
2065 d3d10_multithread_Leave
,
2066 d3d10_multithread_SetMultithreadProtected
,
2067 d3d10_multithread_GetMultithreadProtected
,
2070 static void STDMETHODCALLTYPE
d3d10_subresource_destroyed(void *parent
) {}
2072 static const struct wined3d_parent_ops d3d10_subresource_parent_ops
=
2074 d3d10_subresource_destroyed
,
2077 /* IWineDXGIDeviceParent IUnknown methods */
2079 static inline struct d3d10_device
*device_from_dxgi_device_parent(IWineDXGIDeviceParent
*iface
)
2081 return CONTAINING_RECORD(iface
, struct d3d10_device
, IWineDXGIDeviceParent_iface
);
2084 static HRESULT STDMETHODCALLTYPE
dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent
*iface
,
2085 REFIID riid
, void **ppv
)
2087 struct d3d10_device
*device
= device_from_dxgi_device_parent(iface
);
2088 return IUnknown_QueryInterface(device
->outer_unk
, riid
, ppv
);
2091 static ULONG STDMETHODCALLTYPE
dxgi_device_parent_AddRef(IWineDXGIDeviceParent
*iface
)
2093 struct d3d10_device
*device
= device_from_dxgi_device_parent(iface
);
2094 return IUnknown_AddRef(device
->outer_unk
);
2097 static ULONG STDMETHODCALLTYPE
dxgi_device_parent_Release(IWineDXGIDeviceParent
*iface
)
2099 struct d3d10_device
*device
= device_from_dxgi_device_parent(iface
);
2100 return IUnknown_Release(device
->outer_unk
);
2103 static struct wined3d_device_parent
* STDMETHODCALLTYPE
dxgi_device_parent_get_wined3d_device_parent(
2104 IWineDXGIDeviceParent
*iface
)
2106 struct d3d10_device
*device
= device_from_dxgi_device_parent(iface
);
2107 return &device
->device_parent
;
2110 static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl
=
2112 /* IUnknown methods */
2113 dxgi_device_parent_QueryInterface
,
2114 dxgi_device_parent_AddRef
,
2115 dxgi_device_parent_Release
,
2116 /* IWineDXGIDeviceParent methods */
2117 dxgi_device_parent_get_wined3d_device_parent
,
2120 static inline struct d3d10_device
*device_from_wined3d_device_parent(struct wined3d_device_parent
*device_parent
)
2122 return CONTAINING_RECORD(device_parent
, struct d3d10_device
, device_parent
);
2125 static void CDECL
device_parent_wined3d_device_created(struct wined3d_device_parent
*device_parent
,
2126 struct wined3d_device
*wined3d_device
)
2128 struct d3d10_device
*device
= device_from_wined3d_device_parent(device_parent
);
2130 TRACE("device_parent %p, wined3d_device %p.\n", device_parent
, wined3d_device
);
2132 wined3d_device_incref(wined3d_device
);
2133 device
->wined3d_device
= wined3d_device
;
2136 static void CDECL
device_parent_mode_changed(struct wined3d_device_parent
*device_parent
)
2138 TRACE("device_parent %p.\n", device_parent
);
2141 static void CDECL
device_parent_activate(struct wined3d_device_parent
*device_parent
, BOOL activate
)
2143 TRACE("device_parent %p, activate %#x.\n", device_parent
, activate
);
2146 static HRESULT CDECL
device_parent_surface_created(struct wined3d_device_parent
*device_parent
,
2147 void *container_parent
, struct wined3d_surface
*surface
, void **parent
,
2148 const struct wined3d_parent_ops
**parent_ops
)
2150 TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n",
2151 device_parent
, container_parent
, surface
, parent
, parent_ops
);
2153 *parent
= container_parent
;
2154 *parent_ops
= &d3d10_null_wined3d_parent_ops
;
2159 static HRESULT CDECL
device_parent_volume_created(struct wined3d_device_parent
*device_parent
,
2160 void *container_parent
, struct wined3d_volume
*volume
, void **parent
,
2161 const struct wined3d_parent_ops
**parent_ops
)
2163 TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p.\n",
2164 device_parent
, container_parent
, volume
, parent
, parent_ops
);
2166 *parent
= container_parent
;
2167 *parent_ops
= &d3d10_null_wined3d_parent_ops
;
2172 static HRESULT CDECL
device_parent_create_swapchain_surface(struct wined3d_device_parent
*device_parent
,
2173 void *container_parent
, const struct wined3d_resource_desc
*wined3d_desc
, struct wined3d_surface
**surface
)
2175 struct d3d10_device
*device
= device_from_wined3d_device_parent(device_parent
);
2176 struct wined3d_resource
*sub_resource
;
2177 struct d3d10_texture2d
*texture
;
2178 D3D10_TEXTURE2D_DESC desc
;
2181 FIXME("device_parent %p, container_parent %p, wined3d_desc %p, surface %p partial stub!\n",
2182 device_parent
, container_parent
, wined3d_desc
, surface
);
2184 FIXME("Implement DXGI<->wined3d usage conversion\n");
2186 desc
.Width
= wined3d_desc
->width
;
2187 desc
.Height
= wined3d_desc
->height
;
2190 desc
.Format
= dxgi_format_from_wined3dformat(wined3d_desc
->format
);
2191 desc
.SampleDesc
.Count
= wined3d_desc
->multisample_type
? wined3d_desc
->multisample_type
: 1;
2192 desc
.SampleDesc
.Quality
= wined3d_desc
->multisample_quality
;
2193 desc
.Usage
= D3D10_USAGE_DEFAULT
;
2194 desc
.BindFlags
= D3D10_BIND_RENDER_TARGET
;
2195 desc
.CPUAccessFlags
= 0;
2198 if (FAILED(hr
= d3d10_device_CreateTexture2D(&device
->ID3D10Device1_iface
,
2199 &desc
, NULL
, (ID3D10Texture2D
**)&texture
)))
2201 ERR("CreateTexture2D failed, returning %#x\n", hr
);
2205 sub_resource
= wined3d_texture_get_sub_resource(texture
->wined3d_texture
, 0);
2206 *surface
= wined3d_surface_from_resource(sub_resource
);
2207 wined3d_surface_incref(*surface
);
2208 ID3D10Texture2D_Release(&texture
->ID3D10Texture2D_iface
);
2213 static HRESULT CDECL
device_parent_create_swapchain(struct wined3d_device_parent
*device_parent
,
2214 struct wined3d_swapchain_desc
*desc
, struct wined3d_swapchain
**swapchain
)
2216 struct d3d10_device
*device
= device_from_wined3d_device_parent(device_parent
);
2217 IWineDXGIDevice
*wine_device
;
2220 TRACE("device_parent %p, desc %p, swapchain %p.\n", device_parent
, desc
, swapchain
);
2222 if (FAILED(hr
= d3d10_device_QueryInterface(&device
->ID3D10Device1_iface
,
2223 &IID_IWineDXGIDevice
, (void **)&wine_device
)))
2225 ERR("Device should implement IWineDXGIDevice.\n");
2229 hr
= IWineDXGIDevice_create_swapchain(wine_device
, desc
, swapchain
);
2230 IWineDXGIDevice_Release(wine_device
);
2233 ERR("Failed to create DXGI swapchain, returning %#x\n", hr
);
2240 static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops
=
2242 device_parent_wined3d_device_created
,
2243 device_parent_mode_changed
,
2244 device_parent_activate
,
2245 device_parent_surface_created
,
2246 device_parent_volume_created
,
2247 device_parent_create_swapchain_surface
,
2248 device_parent_create_swapchain
,
2251 static void *d3d10_rb_alloc(size_t size
)
2253 return HeapAlloc(GetProcessHeap(), 0, size
);
2256 static void *d3d10_rb_realloc(void *ptr
, size_t size
)
2258 return HeapReAlloc(GetProcessHeap(), 0, ptr
, size
);
2261 static void d3d10_rb_free(void *ptr
)
2263 HeapFree(GetProcessHeap(), 0, ptr
);
2266 static int d3d10_sampler_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
2268 const D3D10_SAMPLER_DESC
*ka
= key
;
2269 const D3D10_SAMPLER_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
, const struct d3d10_sampler_state
, entry
)->desc
;
2271 return memcmp(ka
, kb
, sizeof(*ka
));
2274 static const struct wine_rb_functions d3d10_sampler_state_rb_ops
=
2279 d3d10_sampler_state_compare
,
2282 static int d3d10_blend_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
2284 const D3D10_BLEND_DESC
*ka
= key
;
2285 const D3D10_BLEND_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
, const struct d3d10_blend_state
, entry
)->desc
;
2287 return memcmp(ka
, kb
, sizeof(*ka
));
2290 static const struct wine_rb_functions d3d10_blend_state_rb_ops
=
2295 d3d10_blend_state_compare
,
2298 static int d3d10_depthstencil_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
2300 const D3D10_DEPTH_STENCIL_DESC
*ka
= key
;
2301 const D3D10_DEPTH_STENCIL_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
,
2302 const struct d3d10_depthstencil_state
, entry
)->desc
;
2304 return memcmp(ka
, kb
, sizeof(*ka
));
2307 static const struct wine_rb_functions d3d10_depthstencil_state_rb_ops
=
2312 d3d10_depthstencil_state_compare
,
2315 static int d3d10_rasterizer_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
2317 const D3D10_RASTERIZER_DESC
*ka
= key
;
2318 const D3D10_RASTERIZER_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
, const struct d3d10_rasterizer_state
, entry
)->desc
;
2320 return memcmp(ka
, kb
, sizeof(*ka
));
2323 static const struct wine_rb_functions d3d10_rasterizer_state_rb_ops
=
2328 d3d10_rasterizer_state_compare
,
2331 HRESULT
d3d10_device_init(struct d3d10_device
*device
, void *outer_unknown
)
2333 device
->IUnknown_inner
.lpVtbl
= &d3d10_device_inner_unknown_vtbl
;
2334 device
->ID3D10Device1_iface
.lpVtbl
= &d3d10_device1_vtbl
;
2335 device
->ID3D10Multithread_iface
.lpVtbl
= &d3d10_multithread_vtbl
;
2336 device
->IWineDXGIDeviceParent_iface
.lpVtbl
= &d3d10_dxgi_device_parent_vtbl
;
2337 device
->device_parent
.ops
= &d3d10_wined3d_device_parent_ops
;
2338 device
->refcount
= 1;
2339 /* COM aggregation always takes place */
2340 device
->outer_unk
= outer_unknown
;
2342 if (wine_rb_init(&device
->blend_states
, &d3d10_blend_state_rb_ops
) == -1)
2344 WARN("Failed to initialize blend state rbtree.\n");
2347 device
->blend_factor
[0] = 1.0f
;
2348 device
->blend_factor
[1] = 1.0f
;
2349 device
->blend_factor
[2] = 1.0f
;
2350 device
->blend_factor
[3] = 1.0f
;
2351 device
->sample_mask
= D3D10_DEFAULT_SAMPLE_MASK
;
2353 if (wine_rb_init(&device
->depthstencil_states
, &d3d10_depthstencil_state_rb_ops
) == -1)
2355 WARN("Failed to initialize depthstencil state rbtree.\n");
2356 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);
2360 if (wine_rb_init(&device
->rasterizer_states
, &d3d10_rasterizer_state_rb_ops
) == -1)
2362 WARN("Failed to initialize rasterizer state rbtree.\n");
2363 wine_rb_destroy(&device
->depthstencil_states
, NULL
, NULL
);
2364 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);
2368 if (wine_rb_init(&device
->sampler_states
, &d3d10_sampler_state_rb_ops
) == -1)
2370 WARN("Failed to initialize sampler state rbtree.\n");
2371 wine_rb_destroy(&device
->rasterizer_states
, NULL
, NULL
);
2372 wine_rb_destroy(&device
->depthstencil_states
, NULL
, NULL
);
2373 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);