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 #define NONAMELESSUNION
24 #include "d3d11_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d11
);
28 static void STDMETHODCALLTYPE
d3d_null_wined3d_object_destroyed(void *parent
) {}
30 const struct wined3d_parent_ops d3d_null_wined3d_parent_ops
=
32 d3d_null_wined3d_object_destroyed
,
35 /* ID3D11DeviceContext - immediate context methods */
37 static inline struct d3d11_immediate_context
*impl_from_ID3D11DeviceContext(ID3D11DeviceContext
*iface
)
39 return CONTAINING_RECORD(iface
, struct d3d11_immediate_context
, ID3D11DeviceContext_iface
);
42 static inline struct d3d_device
*device_from_immediate_ID3D11DeviceContext(ID3D11DeviceContext
*iface
)
44 struct d3d11_immediate_context
*context
= impl_from_ID3D11DeviceContext(iface
);
45 return CONTAINING_RECORD(context
, struct d3d_device
, immediate_context
);
48 static HRESULT STDMETHODCALLTYPE
d3d11_immediate_context_QueryInterface(ID3D11DeviceContext
*iface
,
49 REFIID riid
, void **out
)
51 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
53 if (IsEqualGUID(riid
, &IID_ID3D11DeviceContext
)
54 || IsEqualGUID(riid
, &IID_ID3D11DeviceChild
)
55 || IsEqualGUID(riid
, &IID_IUnknown
))
57 ID3D11DeviceContext_AddRef(iface
);
62 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
67 static ULONG STDMETHODCALLTYPE
d3d11_immediate_context_AddRef(ID3D11DeviceContext
*iface
)
69 struct d3d11_immediate_context
*context
= impl_from_ID3D11DeviceContext(iface
);
70 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
71 ULONG refcount
= InterlockedIncrement(&context
->refcount
);
73 TRACE("%p increasing refcount to %u.\n", context
, refcount
);
77 ID3D11Device_AddRef(&device
->ID3D11Device_iface
);
83 static ULONG STDMETHODCALLTYPE
d3d11_immediate_context_Release(ID3D11DeviceContext
*iface
)
85 struct d3d11_immediate_context
*context
= impl_from_ID3D11DeviceContext(iface
);
86 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
87 ULONG refcount
= InterlockedDecrement(&context
->refcount
);
89 TRACE("%p decreasing refcount to %u.\n", context
, refcount
);
93 ID3D11Device_Release(&device
->ID3D11Device_iface
);
99 static void STDMETHODCALLTYPE
d3d11_immediate_context_GetDevice(ID3D11DeviceContext
*iface
, ID3D11Device
**device
)
101 struct d3d_device
*device_object
= device_from_immediate_ID3D11DeviceContext(iface
);
103 TRACE("iface %p, device %p.\n", iface
, device
);
105 *device
= &device_object
->ID3D11Device_iface
;
106 ID3D11Device_AddRef(*device
);
109 static HRESULT STDMETHODCALLTYPE
d3d11_immediate_context_GetPrivateData(ID3D11DeviceContext
*iface
, REFGUID guid
,
110 UINT
*data_size
, void *data
)
112 struct d3d11_immediate_context
*context
= impl_from_ID3D11DeviceContext(iface
);
114 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
116 return d3d_get_private_data(&context
->private_store
, guid
, data_size
, data
);
119 static HRESULT STDMETHODCALLTYPE
d3d11_immediate_context_SetPrivateData(ID3D11DeviceContext
*iface
, REFGUID guid
,
120 UINT data_size
, const void *data
)
122 struct d3d11_immediate_context
*context
= impl_from_ID3D11DeviceContext(iface
);
124 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
126 return d3d_set_private_data(&context
->private_store
, guid
, data_size
, data
);
129 static HRESULT STDMETHODCALLTYPE
d3d11_immediate_context_SetPrivateDataInterface(ID3D11DeviceContext
*iface
,
130 REFGUID guid
, const IUnknown
*data
)
132 struct d3d11_immediate_context
*context
= impl_from_ID3D11DeviceContext(iface
);
134 TRACE("iface %p, guid %s, data %p.\n", iface
, debugstr_guid(guid
), data
);
136 return d3d_set_private_data_interface(&context
->private_store
, guid
, data
);
139 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSSetConstantBuffers(ID3D11DeviceContext
*iface
,
140 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
*const *buffers
)
142 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
145 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
146 iface
, start_slot
, buffer_count
, buffers
);
148 wined3d_mutex_lock();
149 for (i
= 0; i
< buffer_count
; ++i
)
151 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D11Buffer(buffers
[i
]);
153 wined3d_device_set_vs_cb(device
->wined3d_device
, start_slot
+ i
,
154 buffer
? buffer
->wined3d_buffer
: NULL
);
156 wined3d_mutex_unlock();
159 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSSetShaderResources(ID3D11DeviceContext
*iface
,
160 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
*const *views
)
162 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
165 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
166 iface
, start_slot
, view_count
, views
);
168 wined3d_mutex_lock();
169 for (i
= 0; i
< view_count
; ++i
)
171 struct d3d_shader_resource_view
*view
= unsafe_impl_from_ID3D11ShaderResourceView(views
[i
]);
173 wined3d_device_set_ps_resource_view(device
->wined3d_device
, start_slot
+ i
,
174 view
? view
->wined3d_view
: NULL
);
176 wined3d_mutex_unlock();
179 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSSetShader(ID3D11DeviceContext
*iface
,
180 ID3D11PixelShader
*shader
, ID3D11ClassInstance
*const *class_instances
, UINT class_instance_count
)
182 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
183 struct d3d_pixel_shader
*ps
= unsafe_impl_from_ID3D11PixelShader(shader
);
185 TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n",
186 iface
, shader
, class_instances
, class_instance_count
);
189 FIXME("Dynamic linking is not implemented yet.\n");
191 wined3d_mutex_lock();
192 wined3d_device_set_pixel_shader(device
->wined3d_device
, ps
? ps
->wined3d_shader
: NULL
);
193 wined3d_mutex_unlock();
196 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSSetSamplers(ID3D11DeviceContext
*iface
,
197 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
*const *samplers
)
199 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
202 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
203 iface
, start_slot
, sampler_count
, samplers
);
205 wined3d_mutex_lock();
206 for (i
= 0; i
< sampler_count
; ++i
)
208 struct d3d_sampler_state
*sampler
= unsafe_impl_from_ID3D11SamplerState(samplers
[i
]);
210 wined3d_device_set_ps_sampler(device
->wined3d_device
, start_slot
+ i
,
211 sampler
? sampler
->wined3d_sampler
: NULL
);
213 wined3d_mutex_unlock();
216 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSSetShader(ID3D11DeviceContext
*iface
,
217 ID3D11VertexShader
*shader
, ID3D11ClassInstance
*const *class_instances
, UINT class_instance_count
)
219 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
220 struct d3d_vertex_shader
*vs
= unsafe_impl_from_ID3D11VertexShader(shader
);
222 TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n",
223 iface
, shader
, class_instances
, class_instance_count
);
226 FIXME("Dynamic linking is not implemented yet.\n");
228 wined3d_mutex_lock();
229 wined3d_device_set_vertex_shader(device
->wined3d_device
, vs
? vs
->wined3d_shader
: NULL
);
230 wined3d_mutex_unlock();
233 static void STDMETHODCALLTYPE
d3d11_immediate_context_DrawIndexed(ID3D11DeviceContext
*iface
,
234 UINT index_count
, UINT start_index_location
, INT base_vertex_location
)
236 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
238 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
239 iface
, index_count
, start_index_location
, base_vertex_location
);
241 wined3d_mutex_lock();
242 wined3d_device_set_base_vertex_index(device
->wined3d_device
, base_vertex_location
);
243 wined3d_device_draw_indexed_primitive(device
->wined3d_device
, start_index_location
, index_count
);
244 wined3d_mutex_unlock();
247 static void STDMETHODCALLTYPE
d3d11_immediate_context_Draw(ID3D11DeviceContext
*iface
,
248 UINT vertex_count
, UINT start_vertex_location
)
250 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
252 TRACE("iface %p, vertex_count %u, start_vertex_location %u.\n",
253 iface
, vertex_count
, start_vertex_location
);
255 wined3d_mutex_lock();
256 wined3d_device_draw_primitive(device
->wined3d_device
, start_vertex_location
, vertex_count
);
257 wined3d_mutex_unlock();
260 static HRESULT STDMETHODCALLTYPE
d3d11_immediate_context_Map(ID3D11DeviceContext
*iface
, ID3D11Resource
*resource
,
261 UINT subresource_idx
, D3D11_MAP map_type
, UINT map_flags
, D3D11_MAPPED_SUBRESOURCE
*mapped_subresource
)
263 struct wined3d_resource
*wined3d_resource
;
264 struct wined3d_map_desc map_desc
;
267 TRACE("iface %p, resource %p, subresource_idx %u, map_type %u, map_flags %#x, mapped_subresource %p.\n",
268 iface
, resource
, subresource_idx
, map_type
, map_flags
, mapped_subresource
);
271 FIXME("Ignoring map_flags %#x.\n", map_flags
);
273 wined3d_resource
= wined3d_resource_from_d3d11_resource(resource
);
275 wined3d_mutex_lock();
276 hr
= wined3d_resource_map(wined3d_resource
, subresource_idx
,
277 &map_desc
, NULL
, wined3d_map_flags_from_d3d11_map_type(map_type
));
278 wined3d_mutex_unlock();
280 mapped_subresource
->pData
= map_desc
.data
;
281 mapped_subresource
->RowPitch
= map_desc
.row_pitch
;
282 mapped_subresource
->DepthPitch
= map_desc
.slice_pitch
;
287 static void STDMETHODCALLTYPE
d3d11_immediate_context_Unmap(ID3D11DeviceContext
*iface
, ID3D11Resource
*resource
,
288 UINT subresource_idx
)
290 struct wined3d_resource
*wined3d_resource
;
292 TRACE("iface %p, resource %p, subresource_idx %u.\n", iface
, resource
, subresource_idx
);
294 wined3d_resource
= wined3d_resource_from_d3d11_resource(resource
);
296 wined3d_mutex_lock();
297 wined3d_resource_unmap(wined3d_resource
, subresource_idx
);
298 wined3d_mutex_unlock();
301 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSSetConstantBuffers(ID3D11DeviceContext
*iface
,
302 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
*const *buffers
)
304 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
307 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
308 iface
, start_slot
, buffer_count
, buffers
);
310 wined3d_mutex_lock();
311 for (i
= 0; i
< buffer_count
; ++i
)
313 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D11Buffer(buffers
[i
]);
315 wined3d_device_set_ps_cb(device
->wined3d_device
, start_slot
+ i
,
316 buffer
? buffer
->wined3d_buffer
: NULL
);
318 wined3d_mutex_unlock();
321 static void STDMETHODCALLTYPE
d3d11_immediate_context_IASetInputLayout(ID3D11DeviceContext
*iface
,
322 ID3D11InputLayout
*input_layout
)
324 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
325 struct d3d_input_layout
*layout
= unsafe_impl_from_ID3D11InputLayout(input_layout
);
327 TRACE("iface %p, input_layout %p.\n", iface
, input_layout
);
329 wined3d_mutex_lock();
330 wined3d_device_set_vertex_declaration(device
->wined3d_device
, layout
? layout
->wined3d_decl
: NULL
);
331 wined3d_mutex_unlock();
334 static void STDMETHODCALLTYPE
d3d11_immediate_context_IASetVertexBuffers(ID3D11DeviceContext
*iface
,
335 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
*const *buffers
, const UINT
*strides
, const UINT
*offsets
)
337 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
340 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p.\n",
341 iface
, start_slot
, buffer_count
, buffers
, strides
, offsets
);
343 wined3d_mutex_lock();
344 for (i
= 0; i
< buffer_count
; ++i
)
346 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D11Buffer(buffers
[i
]);
348 wined3d_device_set_stream_source(device
->wined3d_device
, start_slot
+ i
,
349 buffer
? buffer
->wined3d_buffer
: NULL
, offsets
[i
], strides
[i
]);
351 wined3d_mutex_unlock();
354 static void STDMETHODCALLTYPE
d3d11_immediate_context_IASetIndexBuffer(ID3D11DeviceContext
*iface
,
355 ID3D11Buffer
*buffer
, DXGI_FORMAT format
, UINT offset
)
357 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
358 struct d3d_buffer
*buffer_impl
= unsafe_impl_from_ID3D11Buffer(buffer
);
360 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
361 iface
, buffer
, debug_dxgi_format(format
), offset
);
363 wined3d_mutex_lock();
364 wined3d_device_set_index_buffer(device
->wined3d_device
,
365 buffer_impl
? buffer_impl
->wined3d_buffer
: NULL
,
366 wined3dformat_from_dxgi_format(format
), offset
);
367 wined3d_mutex_unlock();
370 static void STDMETHODCALLTYPE
d3d11_immediate_context_DrawIndexedInstanced(ID3D11DeviceContext
*iface
,
371 UINT instance_index_count
, UINT instance_count
, UINT start_index_location
, INT base_vertex_location
,
372 UINT start_instance_location
)
374 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
376 TRACE("iface %p, instance_index_count %u, instance_count %u, start_index_location %u, "
377 "base_vertex_location %d, start_instance_location %u.\n",
378 iface
, instance_index_count
, instance_count
, start_index_location
,
379 base_vertex_location
, start_instance_location
);
381 wined3d_mutex_lock();
382 wined3d_device_set_base_vertex_index(device
->wined3d_device
, base_vertex_location
);
383 wined3d_device_draw_indexed_primitive_instanced(device
->wined3d_device
, start_index_location
,
384 instance_index_count
, start_instance_location
, instance_count
);
385 wined3d_mutex_unlock();
388 static void STDMETHODCALLTYPE
d3d11_immediate_context_DrawInstanced(ID3D11DeviceContext
*iface
,
389 UINT instance_vertex_count
, UINT instance_count
, UINT start_vertex_location
, UINT start_instance_location
)
391 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
393 TRACE("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u, "
394 "start_instance_location %u.\n",
395 iface
, instance_vertex_count
, instance_count
, start_vertex_location
,
396 start_instance_location
);
398 wined3d_mutex_lock();
399 wined3d_device_draw_primitive_instanced(device
->wined3d_device
, start_vertex_location
,
400 instance_vertex_count
, start_instance_location
, instance_count
);
401 wined3d_mutex_unlock();
404 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSSetConstantBuffers(ID3D11DeviceContext
*iface
,
405 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
*const *buffers
)
407 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
410 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
411 iface
, start_slot
, buffer_count
, buffers
);
413 wined3d_mutex_lock();
414 for (i
= 0; i
< buffer_count
; ++i
)
416 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D11Buffer(buffers
[i
]);
418 wined3d_device_set_gs_cb(device
->wined3d_device
, start_slot
+ i
,
419 buffer
? buffer
->wined3d_buffer
: NULL
);
421 wined3d_mutex_unlock();
424 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSSetShader(ID3D11DeviceContext
*iface
,
425 ID3D11GeometryShader
*shader
, ID3D11ClassInstance
*const *class_instances
, UINT class_instance_count
)
427 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
428 struct d3d_geometry_shader
*gs
= unsafe_impl_from_ID3D11GeometryShader(shader
);
430 TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n",
431 iface
, shader
, class_instances
, class_instance_count
);
434 FIXME("Dynamic linking is not implemented yet.\n");
436 wined3d_mutex_lock();
437 wined3d_device_set_geometry_shader(device
->wined3d_device
, gs
? gs
->wined3d_shader
: NULL
);
438 wined3d_mutex_unlock();
441 static void STDMETHODCALLTYPE
d3d11_immediate_context_IASetPrimitiveTopology(ID3D11DeviceContext
*iface
,
442 D3D11_PRIMITIVE_TOPOLOGY topology
)
444 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
446 TRACE("iface %p, topology %u.\n", iface
, topology
);
448 wined3d_mutex_lock();
449 wined3d_device_set_primitive_type(device
->wined3d_device
, (enum wined3d_primitive_type
)topology
);
450 wined3d_mutex_unlock();
453 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSSetShaderResources(ID3D11DeviceContext
*iface
,
454 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
*const *views
)
456 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
459 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n", iface
, start_slot
, view_count
, views
);
461 wined3d_mutex_lock();
462 for (i
= 0; i
< view_count
; ++i
)
464 struct d3d_shader_resource_view
*view
= unsafe_impl_from_ID3D11ShaderResourceView(views
[i
]);
466 wined3d_device_set_vs_resource_view(device
->wined3d_device
, start_slot
+ i
,
467 view
? view
->wined3d_view
: NULL
);
469 wined3d_mutex_unlock();
472 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSSetSamplers(ID3D11DeviceContext
*iface
,
473 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
*const *samplers
)
475 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
478 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
479 iface
, start_slot
, sampler_count
, samplers
);
481 wined3d_mutex_lock();
482 for (i
= 0; i
< sampler_count
; ++i
)
484 struct d3d_sampler_state
*sampler
= unsafe_impl_from_ID3D11SamplerState(samplers
[i
]);
486 wined3d_device_set_vs_sampler(device
->wined3d_device
, start_slot
+ i
,
487 sampler
? sampler
->wined3d_sampler
: NULL
);
489 wined3d_mutex_unlock();
492 static void STDMETHODCALLTYPE
d3d11_immediate_context_Begin(ID3D11DeviceContext
*iface
,
493 ID3D11Asynchronous
*asynchronous
)
495 FIXME("iface %p, asynchronous %p stub!\n", iface
, asynchronous
);
498 static void STDMETHODCALLTYPE
d3d11_immediate_context_End(ID3D11DeviceContext
*iface
,
499 ID3D11Asynchronous
*asynchronous
)
501 FIXME("iface %p, asynchronous %p stub!\n", iface
, asynchronous
);
504 static HRESULT STDMETHODCALLTYPE
d3d11_immediate_context_GetData(ID3D11DeviceContext
*iface
,
505 ID3D11Asynchronous
*asynchronous
, void *data
, UINT data_size
, UINT data_flags
)
507 FIXME("iface %p, asynchronous %p, data %p, data_size %u, data_flags %#x stub!\n",
508 iface
, asynchronous
, data
, data_size
, data_flags
);
513 static void STDMETHODCALLTYPE
d3d11_immediate_context_SetPredication(ID3D11DeviceContext
*iface
,
514 ID3D11Predicate
*predicate
, BOOL value
)
516 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
517 struct d3d_query
*query
;
519 TRACE("iface %p, predicate %p, value %#x.\n", iface
, predicate
, value
);
521 query
= unsafe_impl_from_ID3D11Query((ID3D11Query
*)predicate
);
523 wined3d_mutex_lock();
524 wined3d_device_set_predication(device
->wined3d_device
, query
? query
->wined3d_query
: NULL
, value
);
525 wined3d_mutex_unlock();
528 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSSetShaderResources(ID3D11DeviceContext
*iface
,
529 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
*const *views
)
531 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
534 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n", iface
, start_slot
, view_count
, views
);
536 wined3d_mutex_lock();
537 for (i
= 0; i
< view_count
; ++i
)
539 struct d3d_shader_resource_view
*view
= unsafe_impl_from_ID3D11ShaderResourceView(views
[i
]);
541 wined3d_device_set_gs_resource_view(device
->wined3d_device
, start_slot
+ i
,
542 view
? view
->wined3d_view
: NULL
);
544 wined3d_mutex_unlock();
547 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSSetSamplers(ID3D11DeviceContext
*iface
,
548 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
*const *samplers
)
550 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
553 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
554 iface
, start_slot
, sampler_count
, samplers
);
556 wined3d_mutex_lock();
557 for (i
= 0; i
< sampler_count
; ++i
)
559 struct d3d_sampler_state
*sampler
= unsafe_impl_from_ID3D11SamplerState(samplers
[i
]);
561 wined3d_device_set_gs_sampler(device
->wined3d_device
, start_slot
+ i
,
562 sampler
? sampler
->wined3d_sampler
: NULL
);
564 wined3d_mutex_unlock();
567 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMSetRenderTargets(ID3D11DeviceContext
*iface
,
568 UINT render_target_view_count
, ID3D11RenderTargetView
*const *render_target_views
,
569 ID3D11DepthStencilView
*depth_stencil_view
)
571 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
572 struct d3d_depthstencil_view
*dsv
;
575 TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p.\n",
576 iface
, render_target_view_count
, render_target_views
, depth_stencil_view
);
578 wined3d_mutex_lock();
579 for (i
= 0; i
< render_target_view_count
; ++i
)
581 struct d3d_rendertarget_view
*rtv
= unsafe_impl_from_ID3D11RenderTargetView(render_target_views
[i
]);
582 wined3d_device_set_rendertarget_view(device
->wined3d_device
, i
, rtv
? rtv
->wined3d_view
: NULL
, FALSE
);
584 for (; i
< D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT
; ++i
)
586 wined3d_device_set_rendertarget_view(device
->wined3d_device
, i
, NULL
, FALSE
);
589 dsv
= unsafe_impl_from_ID3D11DepthStencilView(depth_stencil_view
);
590 wined3d_device_set_depth_stencil_view(device
->wined3d_device
, dsv
? dsv
->wined3d_view
: NULL
);
591 wined3d_mutex_unlock();
594 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMSetRenderTargetsAndUnorderedAccessViews(
595 ID3D11DeviceContext
*iface
, UINT render_target_view_count
,
596 ID3D11RenderTargetView
*const *render_target_views
, ID3D11DepthStencilView
*depth_stencil_view
,
597 UINT unordered_access_view_start_slot
, UINT unordered_access_view_count
,
598 ID3D11UnorderedAccessView
*const *unordered_access_views
, const UINT
*initial_counts
)
600 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p, "
601 "unordered_access_view_start_slot %u, unordered_access_view_count %u, unordered_access_views %p, "
602 "initial_counts %p partial-stub!\n",
603 iface
, render_target_view_count
, render_target_views
, depth_stencil_view
,
604 unordered_access_view_start_slot
, unordered_access_view_count
, unordered_access_views
,
607 if (render_target_view_count
!= D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL
)
609 d3d11_immediate_context_OMSetRenderTargets(iface
, render_target_view_count
, render_target_views
,
614 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMSetBlendState(ID3D11DeviceContext
*iface
,
615 ID3D11BlendState
*blend_state
, const float blend_factor
[4], UINT sample_mask
)
617 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
618 static const float default_blend_factor
[] = {1.0f
, 1.0f
, 1.0f
, 1.0f
};
619 const D3D11_BLEND_DESC
*desc
;
621 TRACE("iface %p, blend_state %p, blend_factor %s, sample_mask 0x%08x.\n",
622 iface
, blend_state
, debug_float4(blend_factor
), sample_mask
);
625 blend_factor
= default_blend_factor
;
627 if (blend_factor
[0] != 1.0f
|| blend_factor
[1] != 1.0f
|| blend_factor
[2] != 1.0f
|| blend_factor
[3] != 1.0f
)
628 FIXME("Ignoring blend factor %s.\n", debug_float4(blend_factor
));
630 wined3d_mutex_lock();
631 memcpy(device
->blend_factor
, blend_factor
, 4 * sizeof(*blend_factor
));
632 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_MULTISAMPLEMASK
, sample_mask
);
633 if (!(device
->blend_state
= unsafe_impl_from_ID3D11BlendState(blend_state
)))
635 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ALPHABLENDENABLE
, FALSE
);
636 wined3d_device_set_render_state(device
->wined3d_device
,
637 WINED3D_RS_COLORWRITEENABLE
, D3D11_COLOR_WRITE_ENABLE_ALL
);
638 wined3d_device_set_render_state(device
->wined3d_device
,
639 WINED3D_RS_COLORWRITEENABLE1
, D3D11_COLOR_WRITE_ENABLE_ALL
);
640 wined3d_device_set_render_state(device
->wined3d_device
,
641 WINED3D_RS_COLORWRITEENABLE2
, D3D11_COLOR_WRITE_ENABLE_ALL
);
642 wined3d_device_set_render_state(device
->wined3d_device
,
643 WINED3D_RS_COLORWRITEENABLE3
, D3D11_COLOR_WRITE_ENABLE_ALL
);
644 wined3d_mutex_unlock();
648 desc
= &device
->blend_state
->desc
;
649 /* glSampleCoverage() */
650 if (desc
->AlphaToCoverageEnable
)
651 FIXME("Ignoring AlphaToCoverageEnable %#x.\n", desc
->AlphaToCoverageEnable
);
652 /* glEnableIndexedEXT(GL_BLEND, ...) */
653 FIXME("Per-rendertarget blend not implemented.\n");
654 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ALPHABLENDENABLE
,
655 desc
->RenderTarget
[0].BlendEnable
);
656 if (desc
->RenderTarget
[0].BlendEnable
)
658 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_SRCBLEND
,
659 desc
->RenderTarget
[0].SrcBlend
);
660 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_DESTBLEND
,
661 desc
->RenderTarget
[0].DestBlend
);
662 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_BLENDOP
,
663 desc
->RenderTarget
[0].BlendOp
);
664 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_SEPARATEALPHABLENDENABLE
, TRUE
);
665 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_SRCBLENDALPHA
,
666 desc
->RenderTarget
[0].SrcBlendAlpha
);
667 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_DESTBLENDALPHA
,
668 desc
->RenderTarget
[0].DestBlendAlpha
);
669 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_BLENDOPALPHA
,
670 desc
->RenderTarget
[0].BlendOpAlpha
);
672 FIXME("Color mask > 3 not implemented.\n");
673 wined3d_device_set_render_state(device
->wined3d_device
,
674 WINED3D_RS_COLORWRITEENABLE
, desc
->RenderTarget
[0].RenderTargetWriteMask
);
675 wined3d_device_set_render_state(device
->wined3d_device
,
676 WINED3D_RS_COLORWRITEENABLE1
, desc
->RenderTarget
[1].RenderTargetWriteMask
);
677 wined3d_device_set_render_state(device
->wined3d_device
,
678 WINED3D_RS_COLORWRITEENABLE2
, desc
->RenderTarget
[2].RenderTargetWriteMask
);
679 wined3d_device_set_render_state(device
->wined3d_device
,
680 WINED3D_RS_COLORWRITEENABLE3
, desc
->RenderTarget
[3].RenderTargetWriteMask
);
681 wined3d_mutex_unlock();
684 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMSetDepthStencilState(ID3D11DeviceContext
*iface
,
685 ID3D11DepthStencilState
*depth_stencil_state
, UINT stencil_ref
)
687 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
688 const D3D11_DEPTH_STENCILOP_DESC
*stencil_desc
;
689 const D3D11_DEPTH_STENCIL_DESC
*desc
;
691 TRACE("iface %p, depth_stencil_state %p, stencil_ref %u.\n",
692 iface
, depth_stencil_state
, stencil_ref
);
694 wined3d_mutex_lock();
695 device
->stencil_ref
= stencil_ref
;
696 if (!(device
->depth_stencil_state
= unsafe_impl_from_ID3D11DepthStencilState(depth_stencil_state
)))
698 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ZENABLE
, TRUE
);
699 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ZWRITEENABLE
, D3D11_DEPTH_WRITE_MASK_ALL
);
700 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ZFUNC
, D3D11_COMPARISON_LESS
);
701 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILENABLE
, FALSE
);
702 wined3d_mutex_unlock();
706 desc
= &device
->depth_stencil_state
->desc
;
708 if (desc
->FrontFace
.StencilFailOp
!= desc
->BackFace
.StencilFailOp
709 || desc
->FrontFace
.StencilDepthFailOp
!= desc
->BackFace
.StencilDepthFailOp
710 || desc
->FrontFace
.StencilPassOp
!= desc
->BackFace
.StencilPassOp
711 || desc
->FrontFace
.StencilFunc
!= desc
->BackFace
.StencilFunc
)
712 FIXME("Two-sided stencil testing not supported.\n");
714 stencil_desc
= &desc
->FrontFace
;
716 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ZENABLE
, desc
->DepthEnable
);
717 if (desc
->DepthEnable
)
719 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ZWRITEENABLE
, desc
->DepthWriteMask
);
720 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ZFUNC
, desc
->DepthFunc
);
723 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILENABLE
, desc
->StencilEnable
);
724 if (desc
->StencilEnable
)
726 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILMASK
, desc
->StencilReadMask
);
727 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILWRITEMASK
, desc
->StencilWriteMask
);
728 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILFAIL
, stencil_desc
->StencilFailOp
);
729 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILZFAIL
,
730 stencil_desc
->StencilDepthFailOp
);
731 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILPASS
, stencil_desc
->StencilPassOp
);
732 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILFUNC
, stencil_desc
->StencilFunc
);
733 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_STENCILREF
, stencil_ref
);
735 wined3d_mutex_unlock();
738 static void STDMETHODCALLTYPE
d3d11_immediate_context_SOSetTargets(ID3D11DeviceContext
*iface
, UINT buffer_count
,
739 ID3D11Buffer
*const *buffers
, const UINT
*offsets
)
741 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
742 unsigned int count
, i
;
744 TRACE("iface %p, buffer_count %u, buffers %p, offsets %p.\n", iface
, buffer_count
, buffers
, offsets
);
746 count
= min(buffer_count
, D3D11_SO_BUFFER_SLOT_COUNT
);
747 wined3d_mutex_lock();
748 for (i
= 0; i
< count
; ++i
)
750 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D11Buffer(buffers
[i
]);
752 wined3d_device_set_stream_output(device
->wined3d_device
, i
,
753 buffer
? buffer
->wined3d_buffer
: NULL
, offsets
[i
]);
755 for (; i
< D3D11_SO_BUFFER_SLOT_COUNT
; ++i
)
757 wined3d_device_set_stream_output(device
->wined3d_device
, i
, NULL
, 0);
759 wined3d_mutex_unlock();
762 static void STDMETHODCALLTYPE
d3d11_immediate_context_DrawAuto(ID3D11DeviceContext
*iface
)
764 FIXME("iface %p stub!\n", iface
);
767 static void STDMETHODCALLTYPE
d3d11_immediate_context_DrawIndexedInstancedIndirect(ID3D11DeviceContext
*iface
,
768 ID3D11Buffer
*buffer
, UINT offset
)
770 FIXME("iface %p, buffer %p, offset %u stub!\n", iface
, buffer
, offset
);
773 static void STDMETHODCALLTYPE
d3d11_immediate_context_DrawInstancedIndirect(ID3D11DeviceContext
*iface
,
774 ID3D11Buffer
*buffer
, UINT offset
)
776 FIXME("iface %p, buffer %p, offset %u stub!\n", iface
, buffer
, offset
);
779 static void STDMETHODCALLTYPE
d3d11_immediate_context_Dispatch(ID3D11DeviceContext
*iface
,
780 UINT thread_group_count_x
, UINT thread_group_count_y
, UINT thread_group_count_z
)
782 FIXME("iface %p, thread_group_count_x %u, thread_group_count_y %u, thread_group_count_z %u stub!\n",
783 iface
, thread_group_count_x
, thread_group_count_y
, thread_group_count_z
);
786 static void STDMETHODCALLTYPE
d3d11_immediate_context_DispatchIndirect(ID3D11DeviceContext
*iface
,
787 ID3D11Buffer
*buffer
, UINT offset
)
789 FIXME("iface %p, buffer %p, offset %u stub!\n", iface
, buffer
, offset
);
792 static void STDMETHODCALLTYPE
d3d11_immediate_context_RSSetState(ID3D11DeviceContext
*iface
,
793 ID3D11RasterizerState
*rasterizer_state
)
795 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
796 const D3D11_RASTERIZER_DESC
*desc
;
798 TRACE("iface %p, rasterizer_state %p.\n", iface
, rasterizer_state
);
800 wined3d_mutex_lock();
801 if (!(device
->rasterizer_state
= unsafe_impl_from_ID3D11RasterizerState(rasterizer_state
)))
803 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_FILLMODE
, WINED3D_FILL_SOLID
);
804 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_CULLMODE
, WINED3D_CULL_CCW
);
805 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_SCISSORTESTENABLE
, FALSE
);
806 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_MULTISAMPLEANTIALIAS
, FALSE
);
807 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_ANTIALIASEDLINEENABLE
, FALSE
);
808 wined3d_mutex_unlock();
812 desc
= &device
->rasterizer_state
->desc
;
813 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_FILLMODE
, desc
->FillMode
);
814 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_CULLMODE
, desc
->CullMode
);
816 if (desc
->FrontCounterClockwise
)
817 FIXME("Ignoring FrontCounterClockwise %#x.\n", desc
->FrontCounterClockwise
);
818 /* OpenGL style depth bias. */
819 if (desc
->DepthBias
|| desc
->SlopeScaledDepthBias
)
820 FIXME("Ignoring depth bias.\n");
822 if (!desc
->DepthClipEnable
)
823 FIXME("Ignoring DepthClipEnable %#x.\n", desc
->DepthClipEnable
);
824 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_SCISSORTESTENABLE
, desc
->ScissorEnable
);
825 wined3d_device_set_render_state(device
->wined3d_device
, WINED3D_RS_MULTISAMPLEANTIALIAS
, desc
->MultisampleEnable
);
826 wined3d_device_set_render_state(device
->wined3d_device
,
827 WINED3D_RS_ANTIALIASEDLINEENABLE
, desc
->AntialiasedLineEnable
);
828 wined3d_mutex_unlock();
831 static void STDMETHODCALLTYPE
d3d11_immediate_context_RSSetViewports(ID3D11DeviceContext
*iface
,
832 UINT viewport_count
, const D3D11_VIEWPORT
*viewports
)
834 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
835 struct wined3d_viewport wined3d_vp
;
837 TRACE("iface %p, viewport_count %u, viewports %p.\n", iface
, viewport_count
, viewports
);
839 if (viewport_count
> 1)
840 FIXME("Multiple viewports not implemented.\n");
845 if (viewports
[0].TopLeftX
!= (UINT
)viewports
[0].TopLeftX
846 || viewports
[0].TopLeftY
!= (UINT
)viewports
[0].TopLeftY
847 || viewports
[0].Width
!= (UINT
)viewports
[0].Width
848 || viewports
[0].Height
!= (UINT
)viewports
[0].Height
)
849 FIXME("Floating-point viewports not implemented.\n");
851 wined3d_vp
.x
= viewports
[0].TopLeftX
;
852 wined3d_vp
.y
= viewports
[0].TopLeftY
;
853 wined3d_vp
.width
= viewports
[0].Width
;
854 wined3d_vp
.height
= viewports
[0].Height
;
855 wined3d_vp
.min_z
= viewports
[0].MinDepth
;
856 wined3d_vp
.max_z
= viewports
[0].MaxDepth
;
858 wined3d_mutex_lock();
859 wined3d_device_set_viewport(device
->wined3d_device
, &wined3d_vp
);
860 wined3d_mutex_unlock();
863 static void STDMETHODCALLTYPE
d3d11_immediate_context_RSSetScissorRects(ID3D11DeviceContext
*iface
,
864 UINT rect_count
, const D3D11_RECT
*rects
)
866 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
868 TRACE("iface %p, rect_count %u, rects %p.\n", iface
, rect_count
, rects
);
871 FIXME("Multiple scissor rects not implemented.\n");
876 wined3d_mutex_lock();
877 wined3d_device_set_scissor_rect(device
->wined3d_device
, rects
);
878 wined3d_mutex_unlock();
881 static void STDMETHODCALLTYPE
d3d11_immediate_context_CopySubresourceRegion(ID3D11DeviceContext
*iface
,
882 ID3D11Resource
*dst_resource
, UINT dst_subresource_idx
, UINT dst_x
, UINT dst_y
, UINT dst_z
,
883 ID3D11Resource
*src_resource
, UINT src_subresource_idx
, const D3D11_BOX
*src_box
)
885 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
886 struct wined3d_resource
*wined3d_dst_resource
, *wined3d_src_resource
;
887 struct wined3d_box wined3d_src_box
;
889 TRACE("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
890 "src_resource %p, src_subresource_idx %u, src_box %p.\n",
891 iface
, dst_resource
, dst_subresource_idx
, dst_x
, dst_y
, dst_z
,
892 src_resource
, src_subresource_idx
, src_box
);
896 wined3d_src_box
.left
= src_box
->left
;
897 wined3d_src_box
.top
= src_box
->top
;
898 wined3d_src_box
.front
= src_box
->front
;
899 wined3d_src_box
.right
= src_box
->right
;
900 wined3d_src_box
.bottom
= src_box
->bottom
;
901 wined3d_src_box
.back
= src_box
->back
;
904 wined3d_dst_resource
= wined3d_resource_from_d3d11_resource(dst_resource
);
905 wined3d_src_resource
= wined3d_resource_from_d3d11_resource(src_resource
);
906 wined3d_mutex_lock();
907 wined3d_device_copy_sub_resource_region(device
->wined3d_device
, wined3d_dst_resource
, dst_subresource_idx
,
908 dst_x
, dst_y
, dst_z
, wined3d_src_resource
, src_subresource_idx
, src_box
? &wined3d_src_box
: NULL
);
909 wined3d_mutex_unlock();
912 static void STDMETHODCALLTYPE
d3d11_immediate_context_CopyResource(ID3D11DeviceContext
*iface
,
913 ID3D11Resource
*dst_resource
, ID3D11Resource
*src_resource
)
915 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
916 struct wined3d_resource
*wined3d_dst_resource
, *wined3d_src_resource
;
918 TRACE("iface %p, dst_resource %p, src_resource %p.\n", iface
, dst_resource
, src_resource
);
920 wined3d_dst_resource
= wined3d_resource_from_d3d11_resource(dst_resource
);
921 wined3d_src_resource
= wined3d_resource_from_d3d11_resource(src_resource
);
922 wined3d_mutex_lock();
923 wined3d_device_copy_resource(device
->wined3d_device
, wined3d_dst_resource
, wined3d_src_resource
);
924 wined3d_mutex_unlock();
927 static void STDMETHODCALLTYPE
d3d11_immediate_context_UpdateSubresource(ID3D11DeviceContext
*iface
,
928 ID3D11Resource
*resource
, UINT subresource_idx
, const D3D11_BOX
*box
,
929 const void *data
, UINT row_pitch
, UINT depth_pitch
)
931 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
932 struct wined3d_resource
*wined3d_resource
;
933 struct wined3d_box wined3d_box
;
935 TRACE("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u.\n",
936 iface
, resource
, subresource_idx
, box
, data
, row_pitch
, depth_pitch
);
940 wined3d_box
.left
= box
->left
;
941 wined3d_box
.top
= box
->top
;
942 wined3d_box
.front
= box
->front
;
943 wined3d_box
.right
= box
->right
;
944 wined3d_box
.bottom
= box
->bottom
;
945 wined3d_box
.back
= box
->back
;
948 wined3d_resource
= wined3d_resource_from_d3d11_resource(resource
);
949 wined3d_mutex_lock();
950 wined3d_device_update_sub_resource(device
->wined3d_device
, wined3d_resource
,
951 subresource_idx
, box
? &wined3d_box
: NULL
, data
, row_pitch
, depth_pitch
);
952 wined3d_mutex_unlock();
955 static void STDMETHODCALLTYPE
d3d11_immediate_context_CopyStructureCount(ID3D11DeviceContext
*iface
,
956 ID3D11Buffer
*dst_buffer
, UINT dst_offset
, ID3D11UnorderedAccessView
*src_view
)
958 FIXME("iface %p, dst_buffer %p, dst_offset %u, src_view %p stub!\n",
959 iface
, dst_buffer
, dst_offset
, src_view
);
962 static void STDMETHODCALLTYPE
d3d11_immediate_context_ClearRenderTargetView(ID3D11DeviceContext
*iface
,
963 ID3D11RenderTargetView
*render_target_view
, const float color_rgba
[4])
965 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
966 struct d3d_rendertarget_view
*view
= unsafe_impl_from_ID3D11RenderTargetView(render_target_view
);
967 const struct wined3d_color color
= {color_rgba
[0], color_rgba
[1], color_rgba
[2], color_rgba
[3]};
970 TRACE("iface %p, render_target_view %p, color_rgba %s.\n",
971 iface
, render_target_view
, debug_float4(color_rgba
));
976 wined3d_mutex_lock();
977 if (FAILED(hr
= wined3d_device_clear_rendertarget_view(device
->wined3d_device
, view
->wined3d_view
, NULL
,
978 WINED3DCLEAR_TARGET
, &color
, 0.0f
, 0)))
979 ERR("Failed to clear view, hr %#x.\n", hr
);
980 wined3d_mutex_unlock();
983 static void STDMETHODCALLTYPE
d3d11_immediate_context_ClearUnorderedAccessViewUint(ID3D11DeviceContext
*iface
,
984 ID3D11UnorderedAccessView
*unordered_access_view
, const UINT values
[4])
986 FIXME("iface %p, unordered_access_view %p, values {%u %u %u %u} stub!\n",
987 iface
, unordered_access_view
, values
[0], values
[1], values
[2], values
[3]);
990 static void STDMETHODCALLTYPE
d3d11_immediate_context_ClearUnorderedAccessViewFloat(ID3D11DeviceContext
*iface
,
991 ID3D11UnorderedAccessView
*unordered_access_view
, const float values
[4])
993 FIXME("iface %p, unordered_access_view %p, values %s stub!\n",
994 iface
, unordered_access_view
, debug_float4(values
));
997 static void STDMETHODCALLTYPE
d3d11_immediate_context_ClearDepthStencilView(ID3D11DeviceContext
*iface
,
998 ID3D11DepthStencilView
*depth_stencil_view
, UINT flags
, FLOAT depth
, UINT8 stencil
)
1000 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1001 struct d3d_depthstencil_view
*view
= unsafe_impl_from_ID3D11DepthStencilView(depth_stencil_view
);
1002 DWORD wined3d_flags
;
1005 TRACE("iface %p, depth_stencil_view %p, flags %#x, depth %.8e, stencil %u.\n",
1006 iface
, depth_stencil_view
, flags
, depth
, stencil
);
1011 wined3d_flags
= wined3d_clear_flags_from_d3d11_clear_flags(flags
);
1013 wined3d_mutex_lock();
1014 if (FAILED(hr
= wined3d_device_clear_rendertarget_view(device
->wined3d_device
, view
->wined3d_view
, NULL
,
1015 wined3d_flags
, NULL
, depth
, stencil
)))
1016 ERR("Failed to clear view, hr %#x.\n", hr
);
1017 wined3d_mutex_unlock();
1020 static void STDMETHODCALLTYPE
d3d11_immediate_context_GenerateMips(ID3D11DeviceContext
*iface
,
1021 ID3D11ShaderResourceView
*view
)
1023 FIXME("iface %p, view %p stub!\n", iface
, view
);
1026 static void STDMETHODCALLTYPE
d3d11_immediate_context_SetResourceMinLOD(ID3D11DeviceContext
*iface
,
1027 ID3D11Resource
*resource
, FLOAT min_lod
)
1029 FIXME("iface %p, resource %p, min_lod %f stub!\n", iface
, resource
, min_lod
);
1032 static FLOAT STDMETHODCALLTYPE
d3d11_immediate_context_GetResourceMinLOD(ID3D11DeviceContext
*iface
,
1033 ID3D11Resource
*resource
)
1035 FIXME("iface %p, resource %p stub!\n", iface
, resource
);
1040 static void STDMETHODCALLTYPE
d3d11_immediate_context_ResolveSubresource(ID3D11DeviceContext
*iface
,
1041 ID3D11Resource
*dst_resource
, UINT dst_subresource_idx
,
1042 ID3D11Resource
*src_resource
, UINT src_subresource_idx
,
1045 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, src_resource %p, src_subresource_idx %u, "
1046 "format %s stub!\n",
1047 iface
, dst_resource
, dst_subresource_idx
, src_resource
, src_subresource_idx
,
1048 debug_dxgi_format(format
));
1051 static void STDMETHODCALLTYPE
d3d11_immediate_context_ExecuteCommandList(ID3D11DeviceContext
*iface
,
1052 ID3D11CommandList
*command_list
, BOOL restore_state
)
1054 FIXME("iface %p, command_list %p, restore_state %#x stub!\n", iface
, command_list
, restore_state
);
1057 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSSetShaderResources(ID3D11DeviceContext
*iface
,
1058 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
*const *views
)
1060 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
1061 iface
, start_slot
, view_count
, views
);
1064 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSSetShader(ID3D11DeviceContext
*iface
,
1065 ID3D11HullShader
*shader
, ID3D11ClassInstance
*const *class_instances
, UINT class_instance_count
)
1067 FIXME("iface %p, shader %p, class_instances %p, class_instance_count %u stub!\n",
1068 iface
, shader
, class_instances
, class_instance_count
);
1071 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSSetSamplers(ID3D11DeviceContext
*iface
,
1072 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
*const *samplers
)
1074 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
1075 iface
, start_slot
, sampler_count
, samplers
);
1078 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSSetConstantBuffers(ID3D11DeviceContext
*iface
,
1079 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
*const *buffers
)
1081 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
1082 iface
, start_slot
, buffer_count
, buffers
);
1085 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSSetShaderResources(ID3D11DeviceContext
*iface
,
1086 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
*const *views
)
1088 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
1089 iface
, start_slot
, view_count
, views
);
1092 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSSetShader(ID3D11DeviceContext
*iface
,
1093 ID3D11DomainShader
*shader
, ID3D11ClassInstance
*const *class_instances
, UINT class_instance_count
)
1095 FIXME("iface %p, shader %p, class_instances %p, class_instance_count %u stub!\n",
1096 iface
, shader
, class_instances
, class_instance_count
);
1099 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSSetSamplers(ID3D11DeviceContext
*iface
,
1100 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
*const *samplers
)
1102 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
1103 iface
, start_slot
, sampler_count
, samplers
);
1106 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSSetConstantBuffers(ID3D11DeviceContext
*iface
,
1107 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
*const *buffers
)
1109 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
1110 iface
, start_slot
, buffer_count
, buffers
);
1113 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSSetShaderResources(ID3D11DeviceContext
*iface
,
1114 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
*const *views
)
1116 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
1117 iface
, start_slot
, view_count
, views
);
1120 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSSetUnorderedAccessViews(ID3D11DeviceContext
*iface
,
1121 UINT start_slot
, UINT view_count
, ID3D11UnorderedAccessView
*const *views
, const UINT
*initial_counts
)
1123 FIXME("iface %p, start_slot %u, view_count %u, views %p, initial_counts %p stub!\n",
1124 iface
, start_slot
, view_count
, views
, initial_counts
);
1127 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSSetShader(ID3D11DeviceContext
*iface
,
1128 ID3D11ComputeShader
*shader
, ID3D11ClassInstance
*const *class_instances
, UINT class_instance_count
)
1130 FIXME("iface %p, shader %p, class_instances %p, class_instance_count %u stub!\n",
1131 iface
, shader
, class_instances
, class_instance_count
);
1134 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSSetSamplers(ID3D11DeviceContext
*iface
,
1135 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
*const *samplers
)
1137 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
1138 iface
, start_slot
, sampler_count
, samplers
);
1141 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSSetConstantBuffers(ID3D11DeviceContext
*iface
,
1142 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
*const *buffers
)
1144 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
1145 iface
, start_slot
, buffer_count
, buffers
);
1148 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSGetConstantBuffers(ID3D11DeviceContext
*iface
,
1149 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
**buffers
)
1151 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1154 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
1155 iface
, start_slot
, buffer_count
, buffers
);
1157 wined3d_mutex_lock();
1158 for (i
= 0; i
< buffer_count
; ++i
)
1160 struct wined3d_buffer
*wined3d_buffer
;
1161 struct d3d_buffer
*buffer_impl
;
1163 if (!(wined3d_buffer
= wined3d_device_get_vs_cb(device
->wined3d_device
, start_slot
+ i
)))
1169 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
1170 buffers
[i
] = &buffer_impl
->ID3D11Buffer_iface
;
1171 ID3D11Buffer_AddRef(buffers
[i
]);
1173 wined3d_mutex_unlock();
1176 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSGetShaderResources(ID3D11DeviceContext
*iface
,
1177 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
**views
)
1179 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1182 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
1183 iface
, start_slot
, view_count
, views
);
1185 wined3d_mutex_lock();
1186 for (i
= 0; i
< view_count
; ++i
)
1188 struct wined3d_shader_resource_view
*wined3d_view
;
1189 struct d3d_shader_resource_view
*view_impl
;
1191 if (!(wined3d_view
= wined3d_device_get_ps_resource_view(device
->wined3d_device
, start_slot
+ i
)))
1197 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
1198 views
[i
] = &view_impl
->ID3D11ShaderResourceView_iface
;
1199 ID3D11ShaderResourceView_AddRef(views
[i
]);
1201 wined3d_mutex_unlock();
1204 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSGetShader(ID3D11DeviceContext
*iface
,
1205 ID3D11PixelShader
**shader
, ID3D11ClassInstance
**class_instances
, UINT
*class_instance_count
)
1207 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1208 struct wined3d_shader
*wined3d_shader
;
1209 struct d3d_pixel_shader
*shader_impl
;
1211 TRACE("iface %p, shader %p, class_instances %p, class_instance_count %p.\n",
1212 iface
, shader
, class_instances
, class_instance_count
);
1214 if (class_instances
|| class_instance_count
)
1215 FIXME("Dynamic linking not implemented yet.\n");
1217 wined3d_mutex_lock();
1218 if (!(wined3d_shader
= wined3d_device_get_pixel_shader(device
->wined3d_device
)))
1220 wined3d_mutex_unlock();
1225 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
1226 wined3d_mutex_unlock();
1227 *shader
= &shader_impl
->ID3D11PixelShader_iface
;
1228 ID3D11PixelShader_AddRef(*shader
);
1231 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSGetSamplers(ID3D11DeviceContext
*iface
,
1232 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
**samplers
)
1234 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1237 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
1238 iface
, start_slot
, sampler_count
, samplers
);
1240 wined3d_mutex_lock();
1241 for (i
= 0; i
< sampler_count
; ++i
)
1243 struct wined3d_sampler
*wined3d_sampler
;
1244 struct d3d_sampler_state
*sampler_impl
;
1246 if (!(wined3d_sampler
= wined3d_device_get_ps_sampler(device
->wined3d_device
, start_slot
+ i
)))
1252 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
1253 samplers
[i
] = &sampler_impl
->ID3D11SamplerState_iface
;
1254 ID3D11SamplerState_AddRef(samplers
[i
]);
1256 wined3d_mutex_unlock();
1259 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSGetShader(ID3D11DeviceContext
*iface
,
1260 ID3D11VertexShader
**shader
, ID3D11ClassInstance
**class_instances
, UINT
*class_instance_count
)
1262 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1263 struct d3d_vertex_shader
*shader_impl
;
1264 struct wined3d_shader
*wined3d_shader
;
1266 TRACE("iface %p, shader %p, class_instances %p, class_instance_count %p.\n",
1267 iface
, shader
, class_instances
, class_instance_count
);
1269 if (class_instances
|| class_instance_count
)
1270 FIXME("Dynamic linking not implemented yet.\n");
1272 wined3d_mutex_lock();
1273 if (!(wined3d_shader
= wined3d_device_get_vertex_shader(device
->wined3d_device
)))
1275 wined3d_mutex_unlock();
1280 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
1281 wined3d_mutex_unlock();
1282 *shader
= &shader_impl
->ID3D11VertexShader_iface
;
1283 ID3D11VertexShader_AddRef(*shader
);
1286 static void STDMETHODCALLTYPE
d3d11_immediate_context_PSGetConstantBuffers(ID3D11DeviceContext
*iface
,
1287 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
**buffers
)
1289 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1292 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
1293 iface
, start_slot
, buffer_count
, buffers
);
1295 wined3d_mutex_lock();
1296 for (i
= 0; i
< buffer_count
; ++i
)
1298 struct wined3d_buffer
*wined3d_buffer
;
1299 struct d3d_buffer
*buffer_impl
;
1301 if (!(wined3d_buffer
= wined3d_device_get_ps_cb(device
->wined3d_device
, start_slot
+ i
)))
1307 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
1308 buffers
[i
] = &buffer_impl
->ID3D11Buffer_iface
;
1309 ID3D11Buffer_AddRef(buffers
[i
]);
1311 wined3d_mutex_unlock();
1314 static void STDMETHODCALLTYPE
d3d11_immediate_context_IAGetInputLayout(ID3D11DeviceContext
*iface
,
1315 ID3D11InputLayout
**input_layout
)
1317 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1318 struct wined3d_vertex_declaration
*wined3d_declaration
;
1319 struct d3d_input_layout
*input_layout_impl
;
1321 TRACE("iface %p, input_layout %p.\n", iface
, input_layout
);
1323 wined3d_mutex_lock();
1324 if (!(wined3d_declaration
= wined3d_device_get_vertex_declaration(device
->wined3d_device
)))
1326 wined3d_mutex_unlock();
1327 *input_layout
= NULL
;
1331 input_layout_impl
= wined3d_vertex_declaration_get_parent(wined3d_declaration
);
1332 wined3d_mutex_unlock();
1333 *input_layout
= &input_layout_impl
->ID3D11InputLayout_iface
;
1334 ID3D11InputLayout_AddRef(*input_layout
);
1337 static void STDMETHODCALLTYPE
d3d11_immediate_context_IAGetVertexBuffers(ID3D11DeviceContext
*iface
,
1338 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
**buffers
, UINT
*strides
, UINT
*offsets
)
1340 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1343 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p.\n",
1344 iface
, start_slot
, buffer_count
, buffers
, strides
, offsets
);
1346 wined3d_mutex_lock();
1347 for (i
= 0; i
< buffer_count
; ++i
)
1349 struct wined3d_buffer
*wined3d_buffer
;
1350 struct d3d_buffer
*buffer_impl
;
1352 if (FAILED(wined3d_device_get_stream_source(device
->wined3d_device
, start_slot
+ i
,
1353 &wined3d_buffer
, &offsets
[i
], &strides
[i
])))
1354 ERR("Failed to get vertex buffer %u.\n", start_slot
+ i
);
1356 if (!wined3d_buffer
)
1362 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
1363 ID3D11Buffer_AddRef(buffers
[i
] = &buffer_impl
->ID3D11Buffer_iface
);
1365 wined3d_mutex_unlock();
1368 static void STDMETHODCALLTYPE
d3d11_immediate_context_IAGetIndexBuffer(ID3D11DeviceContext
*iface
,
1369 ID3D11Buffer
**buffer
, DXGI_FORMAT
*format
, UINT
*offset
)
1371 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1372 enum wined3d_format_id wined3d_format
;
1373 struct wined3d_buffer
*wined3d_buffer
;
1374 struct d3d_buffer
*buffer_impl
;
1376 TRACE("iface %p, buffer %p, format %p, offset %p.\n", iface
, buffer
, format
, offset
);
1378 wined3d_mutex_lock();
1379 wined3d_buffer
= wined3d_device_get_index_buffer(device
->wined3d_device
, &wined3d_format
, offset
);
1380 *format
= dxgi_format_from_wined3dformat(wined3d_format
);
1381 if (!wined3d_buffer
)
1383 wined3d_mutex_unlock();
1388 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
1389 wined3d_mutex_unlock();
1390 ID3D11Buffer_AddRef(*buffer
= &buffer_impl
->ID3D11Buffer_iface
);
1393 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSGetConstantBuffers(ID3D11DeviceContext
*iface
,
1394 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
**buffers
)
1396 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1399 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
1400 iface
, start_slot
, buffer_count
, buffers
);
1402 wined3d_mutex_lock();
1403 for (i
= 0; i
< buffer_count
; ++i
)
1405 struct wined3d_buffer
*wined3d_buffer
;
1406 struct d3d_buffer
*buffer_impl
;
1408 if (!(wined3d_buffer
= wined3d_device_get_gs_cb(device
->wined3d_device
, start_slot
+ i
)))
1414 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
1415 buffers
[i
] = &buffer_impl
->ID3D11Buffer_iface
;
1416 ID3D11Buffer_AddRef(buffers
[i
]);
1418 wined3d_mutex_unlock();
1421 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSGetShader(ID3D11DeviceContext
*iface
,
1422 ID3D11GeometryShader
**shader
, ID3D11ClassInstance
**class_instances
, UINT
*class_instance_count
)
1424 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1425 struct d3d_geometry_shader
*shader_impl
;
1426 struct wined3d_shader
*wined3d_shader
;
1428 TRACE("iface %p, shader %p, class_instances %p, class_instance_count %p.\n",
1429 iface
, shader
, class_instances
, class_instance_count
);
1431 if (class_instances
|| class_instance_count
)
1432 FIXME("Dynamic linking not implemented yet.\n");
1434 wined3d_mutex_lock();
1435 if (!(wined3d_shader
= wined3d_device_get_geometry_shader(device
->wined3d_device
)))
1437 wined3d_mutex_unlock();
1442 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
1443 wined3d_mutex_unlock();
1444 *shader
= &shader_impl
->ID3D11GeometryShader_iface
;
1445 ID3D11GeometryShader_AddRef(*shader
);
1448 static void STDMETHODCALLTYPE
d3d11_immediate_context_IAGetPrimitiveTopology(ID3D11DeviceContext
*iface
,
1449 D3D11_PRIMITIVE_TOPOLOGY
*topology
)
1451 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1453 TRACE("iface %p, topology %p.\n", iface
, topology
);
1455 wined3d_mutex_lock();
1456 wined3d_device_get_primitive_type(device
->wined3d_device
, (enum wined3d_primitive_type
*)topology
);
1457 wined3d_mutex_unlock();
1460 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSGetShaderResources(ID3D11DeviceContext
*iface
,
1461 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
**views
)
1463 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1466 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n", iface
, start_slot
, view_count
, views
);
1468 wined3d_mutex_lock();
1469 for (i
= 0; i
< view_count
; ++i
)
1471 struct wined3d_shader_resource_view
*wined3d_view
;
1472 struct d3d_shader_resource_view
*view_impl
;
1474 if (!(wined3d_view
= wined3d_device_get_vs_resource_view(device
->wined3d_device
, start_slot
+ i
)))
1480 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
1481 views
[i
] = &view_impl
->ID3D11ShaderResourceView_iface
;
1482 ID3D11ShaderResourceView_AddRef(views
[i
]);
1484 wined3d_mutex_unlock();
1487 static void STDMETHODCALLTYPE
d3d11_immediate_context_VSGetSamplers(ID3D11DeviceContext
*iface
,
1488 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
**samplers
)
1490 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1493 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
1494 iface
, start_slot
, sampler_count
, samplers
);
1496 wined3d_mutex_lock();
1497 for (i
= 0; i
< sampler_count
; ++i
)
1499 struct wined3d_sampler
*wined3d_sampler
;
1500 struct d3d_sampler_state
*sampler_impl
;
1502 if (!(wined3d_sampler
= wined3d_device_get_vs_sampler(device
->wined3d_device
, start_slot
+ i
)))
1508 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
1509 samplers
[i
] = &sampler_impl
->ID3D11SamplerState_iface
;
1510 ID3D11SamplerState_AddRef(samplers
[i
]);
1512 wined3d_mutex_unlock();
1515 static void STDMETHODCALLTYPE
d3d11_immediate_context_GetPredication(ID3D11DeviceContext
*iface
,
1516 ID3D11Predicate
**predicate
, BOOL
*value
)
1518 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1519 struct wined3d_query
*wined3d_predicate
;
1520 struct d3d_query
*predicate_impl
;
1522 TRACE("iface %p, predicate %p, value %p.\n", iface
, predicate
, value
);
1524 wined3d_mutex_lock();
1525 if (!(wined3d_predicate
= wined3d_device_get_predication(device
->wined3d_device
, value
)))
1527 wined3d_mutex_unlock();
1532 predicate_impl
= wined3d_query_get_parent(wined3d_predicate
);
1533 wined3d_mutex_unlock();
1534 *predicate
= (ID3D11Predicate
*)&predicate_impl
->ID3D11Query_iface
;
1535 ID3D11Predicate_AddRef(*predicate
);
1538 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSGetShaderResources(ID3D11DeviceContext
*iface
,
1539 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
**views
)
1541 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1544 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n", iface
, start_slot
, view_count
, views
);
1546 wined3d_mutex_lock();
1547 for (i
= 0; i
< view_count
; ++i
)
1549 struct wined3d_shader_resource_view
*wined3d_view
;
1550 struct d3d_shader_resource_view
*view_impl
;
1552 if (!(wined3d_view
= wined3d_device_get_gs_resource_view(device
->wined3d_device
, start_slot
+ i
)))
1558 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
1559 views
[i
] = &view_impl
->ID3D11ShaderResourceView_iface
;
1560 ID3D11ShaderResourceView_AddRef(views
[i
]);
1562 wined3d_mutex_unlock();
1565 static void STDMETHODCALLTYPE
d3d11_immediate_context_GSGetSamplers(ID3D11DeviceContext
*iface
,
1566 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
**samplers
)
1568 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1571 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
1572 iface
, start_slot
, sampler_count
, samplers
);
1574 wined3d_mutex_lock();
1575 for (i
= 0; i
< sampler_count
; ++i
)
1577 struct d3d_sampler_state
*sampler_impl
;
1578 struct wined3d_sampler
*wined3d_sampler
;
1580 if (!(wined3d_sampler
= wined3d_device_get_gs_sampler(device
->wined3d_device
, start_slot
+ i
)))
1586 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
1587 samplers
[i
] = &sampler_impl
->ID3D11SamplerState_iface
;
1588 ID3D11SamplerState_AddRef(samplers
[i
]);
1590 wined3d_mutex_unlock();
1593 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMGetRenderTargets(ID3D11DeviceContext
*iface
,
1594 UINT render_target_view_count
, ID3D11RenderTargetView
**render_target_views
,
1595 ID3D11DepthStencilView
**depth_stencil_view
)
1597 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1598 struct wined3d_rendertarget_view
*wined3d_view
;
1600 TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p.\n",
1601 iface
, render_target_view_count
, render_target_views
, depth_stencil_view
);
1603 wined3d_mutex_lock();
1604 if (render_target_views
)
1606 struct d3d_rendertarget_view
*view_impl
;
1609 for (i
= 0; i
< render_target_view_count
; ++i
)
1611 if (!(wined3d_view
= wined3d_device_get_rendertarget_view(device
->wined3d_device
, i
))
1612 || !(view_impl
= wined3d_rendertarget_view_get_parent(wined3d_view
)))
1614 render_target_views
[i
] = NULL
;
1618 render_target_views
[i
] = &view_impl
->ID3D11RenderTargetView_iface
;
1619 ID3D11RenderTargetView_AddRef(render_target_views
[i
]);
1623 if (depth_stencil_view
)
1625 struct d3d_depthstencil_view
*view_impl
;
1627 if (!(wined3d_view
= wined3d_device_get_depth_stencil_view(device
->wined3d_device
))
1628 || !(view_impl
= wined3d_rendertarget_view_get_parent(wined3d_view
)))
1630 *depth_stencil_view
= NULL
;
1634 *depth_stencil_view
= &view_impl
->ID3D11DepthStencilView_iface
;
1635 ID3D11DepthStencilView_AddRef(*depth_stencil_view
);
1638 wined3d_mutex_unlock();
1641 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMGetRenderTargetsAndUnorderedAccessViews(
1642 ID3D11DeviceContext
*iface
,
1643 UINT render_target_view_count
, ID3D11RenderTargetView
**render_target_views
,
1644 ID3D11DepthStencilView
**depth_stencil_view
,
1645 UINT unordered_access_view_start_slot
, UINT unordered_access_view_count
,
1646 ID3D11UnorderedAccessView
**unordered_access_views
)
1648 FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p, "
1649 "unordered_access_view_start_slot %u, unordered_access_view_count %u, "
1650 "unordered_access_views %p stub!\n",
1651 iface
, render_target_view_count
, render_target_views
, depth_stencil_view
,
1652 unordered_access_view_start_slot
, unordered_access_view_count
, unordered_access_views
);
1655 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMGetBlendState(ID3D11DeviceContext
*iface
,
1656 ID3D11BlendState
**blend_state
, FLOAT blend_factor
[4], UINT
*sample_mask
)
1658 FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n",
1659 iface
, blend_state
, blend_factor
, sample_mask
);
1662 static void STDMETHODCALLTYPE
d3d11_immediate_context_OMGetDepthStencilState(ID3D11DeviceContext
*iface
,
1663 ID3D11DepthStencilState
**depth_stencil_state
, UINT
*stencil_ref
)
1665 FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n", iface
, depth_stencil_state
, stencil_ref
);
1668 static void STDMETHODCALLTYPE
d3d11_immediate_context_SOGetTargets(ID3D11DeviceContext
*iface
,
1669 UINT buffer_count
, ID3D11Buffer
**buffers
)
1671 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1674 TRACE("iface %p, buffer_count %u, buffers %p.\n", iface
, buffer_count
, buffers
);
1676 wined3d_mutex_lock();
1677 for (i
= 0; i
< buffer_count
; ++i
)
1679 struct wined3d_buffer
*wined3d_buffer
;
1680 struct d3d_buffer
*buffer_impl
;
1682 if (!(wined3d_buffer
= wined3d_device_get_stream_output(device
->wined3d_device
, i
, NULL
)))
1688 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
1689 buffers
[i
] = &buffer_impl
->ID3D11Buffer_iface
;
1690 ID3D11Buffer_AddRef(buffers
[i
]);
1692 wined3d_mutex_unlock();
1695 static void STDMETHODCALLTYPE
d3d11_immediate_context_RSGetState(ID3D11DeviceContext
*iface
,
1696 ID3D11RasterizerState
**rasterizer_state
)
1698 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1700 TRACE("iface %p, rasterizer_state %p.\n", iface
, rasterizer_state
);
1702 if ((*rasterizer_state
= device
->rasterizer_state
? &device
->rasterizer_state
->ID3D11RasterizerState_iface
: NULL
))
1703 ID3D11RasterizerState_AddRef(*rasterizer_state
);
1706 static void STDMETHODCALLTYPE
d3d11_immediate_context_RSGetViewports(ID3D11DeviceContext
*iface
,
1707 UINT
*viewport_count
, D3D11_VIEWPORT
*viewports
)
1709 struct d3d_device
*device
= device_from_immediate_ID3D11DeviceContext(iface
);
1710 struct wined3d_viewport wined3d_vp
;
1712 TRACE("iface %p, viewport_count %p, viewports %p.\n", iface
, viewport_count
, viewports
);
1716 *viewport_count
= 1;
1720 if (!*viewport_count
)
1723 wined3d_mutex_lock();
1724 wined3d_device_get_viewport(device
->wined3d_device
, &wined3d_vp
);
1725 wined3d_mutex_unlock();
1727 viewports
[0].TopLeftX
= wined3d_vp
.x
;
1728 viewports
[0].TopLeftY
= wined3d_vp
.y
;
1729 viewports
[0].Width
= wined3d_vp
.width
;
1730 viewports
[0].Height
= wined3d_vp
.height
;
1731 viewports
[0].MinDepth
= wined3d_vp
.min_z
;
1732 viewports
[0].MaxDepth
= wined3d_vp
.max_z
;
1734 if (*viewport_count
> 1)
1735 memset(&viewports
[1], 0, (*viewport_count
- 1) * sizeof(*viewports
));
1738 static void STDMETHODCALLTYPE
d3d11_immediate_context_RSGetScissorRects(ID3D11DeviceContext
*iface
,
1739 UINT
*rect_count
, D3D11_RECT
*rects
)
1741 FIXME("iface %p, rect_count %p, rects %p stub!\n", iface
, rect_count
, rects
);
1744 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSGetShaderResources(ID3D11DeviceContext
*iface
,
1745 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
**views
)
1747 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n", iface
, start_slot
, view_count
, views
);
1750 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSGetShader(ID3D11DeviceContext
*iface
,
1751 ID3D11HullShader
**shader
, ID3D11ClassInstance
**class_instances
, UINT
*class_instance_count
)
1753 FIXME("iface %p, shader %p, class_instances %p, class_instance_count %p stub!\n",
1754 iface
, shader
, class_instances
, class_instance_count
);
1757 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSGetSamplers(ID3D11DeviceContext
*iface
,
1758 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
**samplers
)
1760 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
1761 iface
, start_slot
, sampler_count
, samplers
);
1764 static void STDMETHODCALLTYPE
d3d11_immediate_context_HSGetConstantBuffers(ID3D11DeviceContext
*iface
,
1765 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
**buffers
)
1767 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
1768 iface
, start_slot
, buffer_count
, buffers
);
1771 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSGetShaderResources(ID3D11DeviceContext
*iface
,
1772 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
**views
)
1774 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
1775 iface
, start_slot
, view_count
, views
);
1778 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSGetShader(ID3D11DeviceContext
*iface
,
1779 ID3D11DomainShader
**shader
, ID3D11ClassInstance
**class_instances
, UINT
*class_instance_count
)
1781 FIXME("iface %p, shader %p, class_instances %p, class_instance_count %p stub!\n",
1782 iface
, shader
, class_instances
, class_instance_count
);
1785 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSGetSamplers(ID3D11DeviceContext
*iface
,
1786 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
**samplers
)
1788 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
1789 iface
, start_slot
, sampler_count
, samplers
);
1792 static void STDMETHODCALLTYPE
d3d11_immediate_context_DSGetConstantBuffers(ID3D11DeviceContext
*iface
,
1793 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
**buffers
)
1795 FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
1796 iface
, start_slot
, buffer_count
, buffers
);
1799 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSGetShaderResources(ID3D11DeviceContext
*iface
,
1800 UINT start_slot
, UINT view_count
, ID3D11ShaderResourceView
**views
)
1802 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n", iface
, start_slot
, view_count
, views
);
1805 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSGetUnorderedAccessViews(ID3D11DeviceContext
*iface
,
1806 UINT start_slot
, UINT view_count
, ID3D11UnorderedAccessView
**views
)
1808 FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n", iface
, start_slot
, view_count
, views
);
1811 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSGetShader(ID3D11DeviceContext
*iface
,
1812 ID3D11ComputeShader
**shader
, ID3D11ClassInstance
**class_instances
, UINT
*class_instance_count
)
1814 FIXME("iface %p, shader %p, class_instances %p, class_instance_count %p stub!\n",
1815 iface
, shader
, class_instances
, class_instance_count
);
1818 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSGetSamplers(ID3D11DeviceContext
*iface
,
1819 UINT start_slot
, UINT sampler_count
, ID3D11SamplerState
**samplers
)
1821 FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
1822 iface
, start_slot
, sampler_count
, samplers
);
1825 static void STDMETHODCALLTYPE
d3d11_immediate_context_CSGetConstantBuffers(ID3D11DeviceContext
*iface
,
1826 UINT start_slot
, UINT buffer_count
, ID3D11Buffer
**buffers
)
1828 FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n",
1829 iface
, start_slot
, buffer_count
, buffers
);
1832 static void STDMETHODCALLTYPE
d3d11_immediate_context_ClearState(ID3D11DeviceContext
*iface
)
1834 FIXME("iface %p stub!\n", iface
);
1837 static void STDMETHODCALLTYPE
d3d11_immediate_context_Flush(ID3D11DeviceContext
*iface
)
1839 FIXME("iface %p stub!\n", iface
);
1842 static D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE
d3d11_immediate_context_GetType(ID3D11DeviceContext
*iface
)
1844 TRACE("iface %p.\n", iface
);
1846 return D3D11_DEVICE_CONTEXT_IMMEDIATE
;
1849 static UINT STDMETHODCALLTYPE
d3d11_immediate_context_GetContextFlags(ID3D11DeviceContext
*iface
)
1851 FIXME("iface %p stub!\n", iface
);
1856 static HRESULT STDMETHODCALLTYPE
d3d11_immediate_context_FinishCommandList(ID3D11DeviceContext
*iface
,
1857 BOOL restore
, ID3D11CommandList
**command_list
)
1859 FIXME("iface %p, restore %#x, command_list %p stub!\n", iface
, restore
, command_list
);
1864 static const struct ID3D11DeviceContextVtbl d3d11_immediate_context_vtbl
=
1866 /* IUnknown methods */
1867 d3d11_immediate_context_QueryInterface
,
1868 d3d11_immediate_context_AddRef
,
1869 d3d11_immediate_context_Release
,
1870 /* ID3D11DeviceChild methods */
1871 d3d11_immediate_context_GetDevice
,
1872 d3d11_immediate_context_GetPrivateData
,
1873 d3d11_immediate_context_SetPrivateData
,
1874 d3d11_immediate_context_SetPrivateDataInterface
,
1875 /* ID3D11DeviceContext methods */
1876 d3d11_immediate_context_VSSetConstantBuffers
,
1877 d3d11_immediate_context_PSSetShaderResources
,
1878 d3d11_immediate_context_PSSetShader
,
1879 d3d11_immediate_context_PSSetSamplers
,
1880 d3d11_immediate_context_VSSetShader
,
1881 d3d11_immediate_context_DrawIndexed
,
1882 d3d11_immediate_context_Draw
,
1883 d3d11_immediate_context_Map
,
1884 d3d11_immediate_context_Unmap
,
1885 d3d11_immediate_context_PSSetConstantBuffers
,
1886 d3d11_immediate_context_IASetInputLayout
,
1887 d3d11_immediate_context_IASetVertexBuffers
,
1888 d3d11_immediate_context_IASetIndexBuffer
,
1889 d3d11_immediate_context_DrawIndexedInstanced
,
1890 d3d11_immediate_context_DrawInstanced
,
1891 d3d11_immediate_context_GSSetConstantBuffers
,
1892 d3d11_immediate_context_GSSetShader
,
1893 d3d11_immediate_context_IASetPrimitiveTopology
,
1894 d3d11_immediate_context_VSSetShaderResources
,
1895 d3d11_immediate_context_VSSetSamplers
,
1896 d3d11_immediate_context_Begin
,
1897 d3d11_immediate_context_End
,
1898 d3d11_immediate_context_GetData
,
1899 d3d11_immediate_context_SetPredication
,
1900 d3d11_immediate_context_GSSetShaderResources
,
1901 d3d11_immediate_context_GSSetSamplers
,
1902 d3d11_immediate_context_OMSetRenderTargets
,
1903 d3d11_immediate_context_OMSetRenderTargetsAndUnorderedAccessViews
,
1904 d3d11_immediate_context_OMSetBlendState
,
1905 d3d11_immediate_context_OMSetDepthStencilState
,
1906 d3d11_immediate_context_SOSetTargets
,
1907 d3d11_immediate_context_DrawAuto
,
1908 d3d11_immediate_context_DrawIndexedInstancedIndirect
,
1909 d3d11_immediate_context_DrawInstancedIndirect
,
1910 d3d11_immediate_context_Dispatch
,
1911 d3d11_immediate_context_DispatchIndirect
,
1912 d3d11_immediate_context_RSSetState
,
1913 d3d11_immediate_context_RSSetViewports
,
1914 d3d11_immediate_context_RSSetScissorRects
,
1915 d3d11_immediate_context_CopySubresourceRegion
,
1916 d3d11_immediate_context_CopyResource
,
1917 d3d11_immediate_context_UpdateSubresource
,
1918 d3d11_immediate_context_CopyStructureCount
,
1919 d3d11_immediate_context_ClearRenderTargetView
,
1920 d3d11_immediate_context_ClearUnorderedAccessViewUint
,
1921 d3d11_immediate_context_ClearUnorderedAccessViewFloat
,
1922 d3d11_immediate_context_ClearDepthStencilView
,
1923 d3d11_immediate_context_GenerateMips
,
1924 d3d11_immediate_context_SetResourceMinLOD
,
1925 d3d11_immediate_context_GetResourceMinLOD
,
1926 d3d11_immediate_context_ResolveSubresource
,
1927 d3d11_immediate_context_ExecuteCommandList
,
1928 d3d11_immediate_context_HSSetShaderResources
,
1929 d3d11_immediate_context_HSSetShader
,
1930 d3d11_immediate_context_HSSetSamplers
,
1931 d3d11_immediate_context_HSSetConstantBuffers
,
1932 d3d11_immediate_context_DSSetShaderResources
,
1933 d3d11_immediate_context_DSSetShader
,
1934 d3d11_immediate_context_DSSetSamplers
,
1935 d3d11_immediate_context_DSSetConstantBuffers
,
1936 d3d11_immediate_context_CSSetShaderResources
,
1937 d3d11_immediate_context_CSSetUnorderedAccessViews
,
1938 d3d11_immediate_context_CSSetShader
,
1939 d3d11_immediate_context_CSSetSamplers
,
1940 d3d11_immediate_context_CSSetConstantBuffers
,
1941 d3d11_immediate_context_VSGetConstantBuffers
,
1942 d3d11_immediate_context_PSGetShaderResources
,
1943 d3d11_immediate_context_PSGetShader
,
1944 d3d11_immediate_context_PSGetSamplers
,
1945 d3d11_immediate_context_VSGetShader
,
1946 d3d11_immediate_context_PSGetConstantBuffers
,
1947 d3d11_immediate_context_IAGetInputLayout
,
1948 d3d11_immediate_context_IAGetVertexBuffers
,
1949 d3d11_immediate_context_IAGetIndexBuffer
,
1950 d3d11_immediate_context_GSGetConstantBuffers
,
1951 d3d11_immediate_context_GSGetShader
,
1952 d3d11_immediate_context_IAGetPrimitiveTopology
,
1953 d3d11_immediate_context_VSGetShaderResources
,
1954 d3d11_immediate_context_VSGetSamplers
,
1955 d3d11_immediate_context_GetPredication
,
1956 d3d11_immediate_context_GSGetShaderResources
,
1957 d3d11_immediate_context_GSGetSamplers
,
1958 d3d11_immediate_context_OMGetRenderTargets
,
1959 d3d11_immediate_context_OMGetRenderTargetsAndUnorderedAccessViews
,
1960 d3d11_immediate_context_OMGetBlendState
,
1961 d3d11_immediate_context_OMGetDepthStencilState
,
1962 d3d11_immediate_context_SOGetTargets
,
1963 d3d11_immediate_context_RSGetState
,
1964 d3d11_immediate_context_RSGetViewports
,
1965 d3d11_immediate_context_RSGetScissorRects
,
1966 d3d11_immediate_context_HSGetShaderResources
,
1967 d3d11_immediate_context_HSGetShader
,
1968 d3d11_immediate_context_HSGetSamplers
,
1969 d3d11_immediate_context_HSGetConstantBuffers
,
1970 d3d11_immediate_context_DSGetShaderResources
,
1971 d3d11_immediate_context_DSGetShader
,
1972 d3d11_immediate_context_DSGetSamplers
,
1973 d3d11_immediate_context_DSGetConstantBuffers
,
1974 d3d11_immediate_context_CSGetShaderResources
,
1975 d3d11_immediate_context_CSGetUnorderedAccessViews
,
1976 d3d11_immediate_context_CSGetShader
,
1977 d3d11_immediate_context_CSGetSamplers
,
1978 d3d11_immediate_context_CSGetConstantBuffers
,
1979 d3d11_immediate_context_ClearState
,
1980 d3d11_immediate_context_Flush
,
1981 d3d11_immediate_context_GetType
,
1982 d3d11_immediate_context_GetContextFlags
,
1983 d3d11_immediate_context_FinishCommandList
,
1986 static void d3d11_immediate_context_init(struct d3d11_immediate_context
*context
, struct d3d_device
*device
)
1988 context
->ID3D11DeviceContext_iface
.lpVtbl
= &d3d11_immediate_context_vtbl
;
1989 context
->refcount
= 1;
1991 ID3D11Device_AddRef(&device
->ID3D11Device_iface
);
1993 wined3d_private_store_init(&context
->private_store
);
1996 static void d3d11_immediate_context_destroy(struct d3d11_immediate_context
*context
)
1998 wined3d_private_store_cleanup(&context
->private_store
);
2001 /* ID3D11Device methods */
2003 static HRESULT STDMETHODCALLTYPE
d3d11_device_QueryInterface(ID3D11Device
*iface
, REFIID riid
, void **out
)
2005 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2006 return IUnknown_QueryInterface(device
->outer_unk
, riid
, out
);
2009 static ULONG STDMETHODCALLTYPE
d3d11_device_AddRef(ID3D11Device
*iface
)
2011 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2012 return IUnknown_AddRef(device
->outer_unk
);
2015 static ULONG STDMETHODCALLTYPE
d3d11_device_Release(ID3D11Device
*iface
)
2017 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2018 return IUnknown_Release(device
->outer_unk
);
2021 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateBuffer(ID3D11Device
*iface
, const D3D11_BUFFER_DESC
*desc
,
2022 const D3D11_SUBRESOURCE_DATA
*data
, ID3D11Buffer
**buffer
)
2024 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2025 struct d3d_buffer
*object
;
2028 TRACE("iface %p, desc %p, data %p, buffer %p.\n", iface
, desc
, data
, buffer
);
2030 if (FAILED(hr
= d3d_buffer_create(device
, desc
, data
, &object
)))
2033 *buffer
= &object
->ID3D11Buffer_iface
;
2038 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateTexture1D(ID3D11Device
*iface
,
2039 const D3D11_TEXTURE1D_DESC
*desc
, const D3D11_SUBRESOURCE_DATA
*data
, ID3D11Texture1D
**texture
)
2041 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface
, desc
, data
, texture
);
2046 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateTexture2D(ID3D11Device
*iface
,
2047 const D3D11_TEXTURE2D_DESC
*desc
, const D3D11_SUBRESOURCE_DATA
*data
, ID3D11Texture2D
**texture
)
2049 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2050 struct d3d_texture2d
*object
;
2053 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface
, desc
, data
, texture
);
2055 if (FAILED(hr
= d3d_texture2d_create(device
, desc
, data
, &object
)))
2058 *texture
= &object
->ID3D11Texture2D_iface
;
2063 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateTexture3D(ID3D11Device
*iface
,
2064 const D3D11_TEXTURE3D_DESC
*desc
, const D3D11_SUBRESOURCE_DATA
*data
, ID3D11Texture3D
**texture
)
2066 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2067 struct d3d_texture3d
*object
;
2070 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface
, desc
, data
, texture
);
2072 if (FAILED(hr
= d3d_texture3d_create(device
, desc
, data
, &object
)))
2075 *texture
= &object
->ID3D11Texture3D_iface
;
2080 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateShaderResourceView(ID3D11Device
*iface
,
2081 ID3D11Resource
*resource
, const D3D11_SHADER_RESOURCE_VIEW_DESC
*desc
, ID3D11ShaderResourceView
**view
)
2083 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2084 struct d3d_shader_resource_view
*object
;
2087 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
2089 if (FAILED(hr
= d3d_shader_resource_view_create(device
, resource
, desc
, &object
)))
2092 *view
= &object
->ID3D11ShaderResourceView_iface
;
2097 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateUnorderedAccessView(ID3D11Device
*iface
,
2098 ID3D11Resource
*resource
, const D3D11_UNORDERED_ACCESS_VIEW_DESC
*desc
, ID3D11UnorderedAccessView
**view
)
2100 FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface
, resource
, desc
, view
);
2105 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateRenderTargetView(ID3D11Device
*iface
,
2106 ID3D11Resource
*resource
, const D3D11_RENDER_TARGET_VIEW_DESC
*desc
, ID3D11RenderTargetView
**view
)
2108 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2109 struct d3d_rendertarget_view
*object
;
2112 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
2114 if (FAILED(hr
= d3d_rendertarget_view_create(device
, resource
, desc
, &object
)))
2117 *view
= &object
->ID3D11RenderTargetView_iface
;
2122 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateDepthStencilView(ID3D11Device
*iface
,
2123 ID3D11Resource
*resource
, const D3D11_DEPTH_STENCIL_VIEW_DESC
*desc
, ID3D11DepthStencilView
**view
)
2125 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2126 struct d3d_depthstencil_view
*object
;
2129 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
2131 if (FAILED(hr
= d3d_depthstencil_view_create(device
, resource
, desc
, &object
)))
2134 *view
= &object
->ID3D11DepthStencilView_iface
;
2139 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateInputLayout(ID3D11Device
*iface
,
2140 const D3D11_INPUT_ELEMENT_DESC
*element_descs
, UINT element_count
, const void *shader_byte_code
,
2141 SIZE_T shader_byte_code_length
, ID3D11InputLayout
**input_layout
)
2143 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2144 struct d3d_input_layout
*object
;
2147 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p, shader_byte_code_length %lu, "
2148 "input_layout %p.\n", iface
, element_descs
, element_count
, shader_byte_code
,
2149 shader_byte_code_length
, input_layout
);
2151 if (FAILED(hr
= d3d_input_layout_create(device
, element_descs
, element_count
,
2152 shader_byte_code
, shader_byte_code_length
, &object
)))
2155 *input_layout
= &object
->ID3D11InputLayout_iface
;
2160 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateVertexShader(ID3D11Device
*iface
, const void *byte_code
,
2161 SIZE_T byte_code_length
, ID3D11ClassLinkage
*class_linkage
, ID3D11VertexShader
**shader
)
2163 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2164 struct d3d_vertex_shader
*object
;
2167 TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
2168 iface
, byte_code
, byte_code_length
, class_linkage
, shader
);
2171 FIXME("Class linkage is not implemented yet.\n");
2173 if (FAILED(hr
= d3d_vertex_shader_create(device
, byte_code
, byte_code_length
, &object
)))
2176 *shader
= &object
->ID3D11VertexShader_iface
;
2181 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateGeometryShader(ID3D11Device
*iface
, const void *byte_code
,
2182 SIZE_T byte_code_length
, ID3D11ClassLinkage
*class_linkage
, ID3D11GeometryShader
**shader
)
2184 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2185 struct d3d_geometry_shader
*object
;
2188 TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
2189 iface
, byte_code
, byte_code_length
, class_linkage
, shader
);
2192 FIXME("Class linkage is not implemented yet.\n");
2194 if (FAILED(hr
= d3d_geometry_shader_create(device
, byte_code
, byte_code_length
, &object
)))
2197 *shader
= &object
->ID3D11GeometryShader_iface
;
2202 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateGeometryShaderWithStreamOutput(ID3D11Device
*iface
,
2203 const void *byte_code
, SIZE_T byte_code_length
, const D3D11_SO_DECLARATION_ENTRY
*so_entries
,
2204 UINT entry_count
, const UINT
*buffer_strides
, UINT strides_count
, UINT rasterized_stream
,
2205 ID3D11ClassLinkage
*class_linkage
, ID3D11GeometryShader
**shader
)
2207 FIXME("iface %p, byte_code %p, byte_code_length %lu, so_entries %p, entry_count %u, "
2208 "buffer_strides %p, strides_count %u, rasterized_stream %u, class_linkage %p, shader %p stub!\n",
2209 iface
, byte_code
, byte_code_length
, so_entries
, entry_count
, buffer_strides
, strides_count
,
2210 rasterized_stream
, class_linkage
, shader
);
2215 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreatePixelShader(ID3D11Device
*iface
, const void *byte_code
,
2216 SIZE_T byte_code_length
, ID3D11ClassLinkage
*class_linkage
, ID3D11PixelShader
**shader
)
2218 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2219 struct d3d_pixel_shader
*object
;
2222 TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
2223 iface
, byte_code
, byte_code_length
, class_linkage
, shader
);
2226 FIXME("Class linkage is not implemented yet.\n");
2228 if (FAILED(hr
= d3d_pixel_shader_create(device
, byte_code
, byte_code_length
, &object
)))
2231 *shader
= &object
->ID3D11PixelShader_iface
;
2236 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateHullShader(ID3D11Device
*iface
, const void *byte_code
,
2237 SIZE_T byte_code_length
, ID3D11ClassLinkage
*class_linkage
, ID3D11HullShader
**shader
)
2239 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2240 struct d3d11_hull_shader
*object
;
2243 TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
2244 iface
, byte_code
, byte_code_length
, class_linkage
, shader
);
2247 FIXME("Class linkage is not implemented yet.\n");
2249 if (FAILED(hr
= d3d11_hull_shader_create(device
, byte_code
, byte_code_length
, &object
)))
2252 *shader
= &object
->ID3D11HullShader_iface
;
2257 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateDomainShader(ID3D11Device
*iface
, const void *byte_code
,
2258 SIZE_T byte_code_length
, ID3D11ClassLinkage
*class_linkage
, ID3D11DomainShader
**shader
)
2260 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2261 struct d3d11_domain_shader
*object
;
2264 TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
2265 iface
, byte_code
, byte_code_length
, class_linkage
, shader
);
2268 FIXME("Class linkage is not implemented yet.\n");
2270 if (FAILED(hr
= d3d11_domain_shader_create(device
, byte_code
, byte_code_length
, &object
)))
2273 *shader
= &object
->ID3D11DomainShader_iface
;
2278 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateComputeShader(ID3D11Device
*iface
, const void *byte_code
,
2279 SIZE_T byte_code_length
, ID3D11ClassLinkage
*class_linkage
, ID3D11ComputeShader
**shader
)
2281 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2282 struct d3d11_compute_shader
*object
;
2285 TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
2286 iface
, byte_code
, byte_code_length
, class_linkage
, shader
);
2289 FIXME("Class linkage is not implemented yet.\n");
2291 if (FAILED(hr
= d3d11_compute_shader_create(device
, byte_code
, byte_code_length
, &object
)))
2294 *shader
= &object
->ID3D11ComputeShader_iface
;
2299 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateClassLinkage(ID3D11Device
*iface
,
2300 ID3D11ClassLinkage
**class_linkage
)
2302 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2303 struct d3d11_class_linkage
*object
;
2306 TRACE("iface %p, class_linkage %p.\n", iface
, class_linkage
);
2308 if (FAILED(hr
= d3d11_class_linkage_create(device
, &object
)))
2311 *class_linkage
= &object
->ID3D11ClassLinkage_iface
;
2316 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateBlendState(ID3D11Device
*iface
,
2317 const D3D11_BLEND_DESC
*desc
, ID3D11BlendState
**blend_state
)
2319 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2320 struct d3d_blend_state
*object
;
2321 struct wine_rb_entry
*entry
;
2322 D3D11_BLEND_DESC tmp_desc
;
2326 TRACE("iface %p, desc %p, blend_state %p.\n", iface
, desc
, blend_state
);
2329 return E_INVALIDARG
;
2331 /* D3D11_RENDER_TARGET_BLEND_DESC has a hole, which is a problem because we use
2332 * D3D11_BLEND_DESC as a key in the rbtree. */
2333 memset(&tmp_desc
, 0, sizeof(tmp_desc
));
2334 tmp_desc
.AlphaToCoverageEnable
= desc
->AlphaToCoverageEnable
;
2335 tmp_desc
.IndependentBlendEnable
= desc
->IndependentBlendEnable
;
2336 for (i
= 0; i
< D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT
; ++i
)
2338 j
= desc
->IndependentBlendEnable
? i
: 0;
2339 tmp_desc
.RenderTarget
[i
].BlendEnable
= desc
->RenderTarget
[j
].BlendEnable
;
2340 tmp_desc
.RenderTarget
[i
].SrcBlend
= desc
->RenderTarget
[j
].SrcBlend
;
2341 tmp_desc
.RenderTarget
[i
].DestBlend
= desc
->RenderTarget
[j
].DestBlend
;
2342 tmp_desc
.RenderTarget
[i
].BlendOp
= desc
->RenderTarget
[j
].BlendOp
;
2343 tmp_desc
.RenderTarget
[i
].SrcBlendAlpha
= desc
->RenderTarget
[j
].SrcBlendAlpha
;
2344 tmp_desc
.RenderTarget
[i
].DestBlendAlpha
= desc
->RenderTarget
[j
].DestBlendAlpha
;
2345 tmp_desc
.RenderTarget
[i
].BlendOpAlpha
= desc
->RenderTarget
[j
].BlendOpAlpha
;
2346 tmp_desc
.RenderTarget
[i
].RenderTargetWriteMask
= desc
->RenderTarget
[j
].RenderTargetWriteMask
;
2349 wined3d_mutex_lock();
2350 if ((entry
= wine_rb_get(&device
->blend_states
, &tmp_desc
)))
2352 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d_blend_state
, entry
);
2354 TRACE("Returning existing blend state %p.\n", object
);
2355 *blend_state
= &object
->ID3D11BlendState_iface
;
2356 ID3D11BlendState_AddRef(*blend_state
);
2357 wined3d_mutex_unlock();
2361 wined3d_mutex_unlock();
2363 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
2364 return E_OUTOFMEMORY
;
2366 if (FAILED(hr
= d3d_blend_state_init(object
, device
, &tmp_desc
)))
2368 WARN("Failed to initialize blend state, hr %#x.\n", hr
);
2369 HeapFree(GetProcessHeap(), 0, object
);
2373 TRACE("Created blend state %p.\n", object
);
2374 *blend_state
= &object
->ID3D11BlendState_iface
;
2379 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateDepthStencilState(ID3D11Device
*iface
,
2380 const D3D11_DEPTH_STENCIL_DESC
*desc
, ID3D11DepthStencilState
**depth_stencil_state
)
2382 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2383 struct d3d_depthstencil_state
*object
;
2384 D3D11_DEPTH_STENCIL_DESC tmp_desc
;
2385 struct wine_rb_entry
*entry
;
2388 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface
, desc
, depth_stencil_state
);
2391 return E_INVALIDARG
;
2393 /* D3D11_DEPTH_STENCIL_DESC has a hole, which is a problem because we use
2394 * it as a key in the rbtree. */
2395 memset(&tmp_desc
, 0, sizeof(tmp_desc
));
2396 tmp_desc
.DepthEnable
= desc
->DepthEnable
;
2397 if (desc
->DepthEnable
)
2399 tmp_desc
.DepthWriteMask
= desc
->DepthWriteMask
;
2400 tmp_desc
.DepthFunc
= desc
->DepthFunc
;
2404 tmp_desc
.DepthWriteMask
= D3D11_DEPTH_WRITE_MASK_ALL
;
2405 tmp_desc
.DepthFunc
= D3D11_COMPARISON_LESS
;
2407 tmp_desc
.StencilEnable
= desc
->StencilEnable
;
2408 if (desc
->StencilEnable
)
2410 tmp_desc
.StencilReadMask
= desc
->StencilReadMask
;
2411 tmp_desc
.StencilWriteMask
= desc
->StencilWriteMask
;
2412 tmp_desc
.FrontFace
= desc
->FrontFace
;
2413 tmp_desc
.BackFace
= desc
->BackFace
;
2417 tmp_desc
.StencilReadMask
= D3D11_DEFAULT_STENCIL_READ_MASK
;
2418 tmp_desc
.StencilWriteMask
= D3D11_DEFAULT_STENCIL_WRITE_MASK
;
2419 tmp_desc
.FrontFace
.StencilFailOp
= D3D11_STENCIL_OP_KEEP
;
2420 tmp_desc
.FrontFace
.StencilDepthFailOp
= D3D11_STENCIL_OP_KEEP
;
2421 tmp_desc
.FrontFace
.StencilPassOp
= D3D11_STENCIL_OP_KEEP
;
2422 tmp_desc
.FrontFace
.StencilFunc
= D3D11_COMPARISON_ALWAYS
;
2423 tmp_desc
.BackFace
.StencilFailOp
= D3D11_STENCIL_OP_KEEP
;
2424 tmp_desc
.BackFace
.StencilDepthFailOp
= D3D11_STENCIL_OP_KEEP
;
2425 tmp_desc
.BackFace
.StencilPassOp
= D3D11_STENCIL_OP_KEEP
;
2426 tmp_desc
.BackFace
.StencilFunc
= D3D11_COMPARISON_ALWAYS
;
2429 wined3d_mutex_lock();
2430 if ((entry
= wine_rb_get(&device
->depthstencil_states
, &tmp_desc
)))
2432 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d_depthstencil_state
, entry
);
2434 TRACE("Returning existing depthstencil state %p.\n", object
);
2435 *depth_stencil_state
= &object
->ID3D11DepthStencilState_iface
;
2436 ID3D11DepthStencilState_AddRef(*depth_stencil_state
);
2437 wined3d_mutex_unlock();
2441 wined3d_mutex_unlock();
2443 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
2444 return E_OUTOFMEMORY
;
2446 if (FAILED(hr
= d3d_depthstencil_state_init(object
, device
, &tmp_desc
)))
2448 WARN("Failed to initialize depthstencil state, hr %#x.\n", hr
);
2449 HeapFree(GetProcessHeap(), 0, object
);
2453 TRACE("Created depthstencil state %p.\n", object
);
2454 *depth_stencil_state
= &object
->ID3D11DepthStencilState_iface
;
2459 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateRasterizerState(ID3D11Device
*iface
,
2460 const D3D11_RASTERIZER_DESC
*desc
, ID3D11RasterizerState
**rasterizer_state
)
2462 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2463 struct d3d_rasterizer_state
*object
;
2464 struct wine_rb_entry
*entry
;
2467 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface
, desc
, rasterizer_state
);
2470 return E_INVALIDARG
;
2472 wined3d_mutex_lock();
2473 if ((entry
= wine_rb_get(&device
->rasterizer_states
, desc
)))
2475 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d_rasterizer_state
, entry
);
2477 TRACE("Returning existing rasterizer state %p.\n", object
);
2478 *rasterizer_state
= &object
->ID3D11RasterizerState_iface
;
2479 ID3D11RasterizerState_AddRef(*rasterizer_state
);
2480 wined3d_mutex_unlock();
2484 wined3d_mutex_unlock();
2486 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
2487 return E_OUTOFMEMORY
;
2489 if (FAILED(hr
= d3d_rasterizer_state_init(object
, device
, desc
)))
2491 WARN("Failed to initialize rasterizer state, hr %#x.\n", hr
);
2492 HeapFree(GetProcessHeap(), 0, object
);
2496 TRACE("Created rasterizer state %p.\n", object
);
2497 *rasterizer_state
= &object
->ID3D11RasterizerState_iface
;
2502 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateSamplerState(ID3D11Device
*iface
,
2503 const D3D11_SAMPLER_DESC
*desc
, ID3D11SamplerState
**sampler_state
)
2505 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2506 D3D11_SAMPLER_DESC normalized_desc
;
2507 struct d3d_sampler_state
*object
;
2508 struct wine_rb_entry
*entry
;
2511 TRACE("iface %p, desc %p, sampler_state %p.\n", iface
, desc
, sampler_state
);
2514 return E_INVALIDARG
;
2516 normalized_desc
= *desc
;
2517 if (!D3D11_DECODE_IS_ANISOTROPIC_FILTER(normalized_desc
.Filter
))
2518 normalized_desc
.MaxAnisotropy
= 0;
2519 if (!D3D11_DECODE_IS_COMPARISON_FILTER(normalized_desc
.Filter
))
2520 normalized_desc
.ComparisonFunc
= D3D11_COMPARISON_NEVER
;
2521 if (normalized_desc
.AddressU
!= D3D11_TEXTURE_ADDRESS_BORDER
2522 && normalized_desc
.AddressV
!= D3D11_TEXTURE_ADDRESS_BORDER
2523 && normalized_desc
.AddressW
!= D3D11_TEXTURE_ADDRESS_BORDER
)
2524 memset(&normalized_desc
.BorderColor
, 0, sizeof(normalized_desc
.BorderColor
));
2526 wined3d_mutex_lock();
2527 if ((entry
= wine_rb_get(&device
->sampler_states
, &normalized_desc
)))
2529 object
= WINE_RB_ENTRY_VALUE(entry
, struct d3d_sampler_state
, entry
);
2531 TRACE("Returning existing sampler state %p.\n", object
);
2532 *sampler_state
= &object
->ID3D11SamplerState_iface
;
2533 ID3D11SamplerState_AddRef(*sampler_state
);
2534 wined3d_mutex_unlock();
2538 wined3d_mutex_unlock();
2540 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
2541 return E_OUTOFMEMORY
;
2543 if (FAILED(hr
= d3d_sampler_state_init(object
, device
, &normalized_desc
)))
2545 WARN("Failed to initialize sampler state, hr %#x.\n", hr
);
2546 HeapFree(GetProcessHeap(), 0, object
);
2550 TRACE("Created sampler state %p.\n", object
);
2551 *sampler_state
= &object
->ID3D11SamplerState_iface
;
2556 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateQuery(ID3D11Device
*iface
,
2557 const D3D11_QUERY_DESC
*desc
, ID3D11Query
**query
)
2559 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2560 struct d3d_query
*object
;
2563 TRACE("iface %p, desc %p, query %p.\n", iface
, desc
, query
);
2565 if (FAILED(hr
= d3d_query_create(device
, desc
, FALSE
, &object
)))
2570 *query
= &object
->ID3D11Query_iface
;
2574 ID3D11Query_Release(&object
->ID3D11Query_iface
);
2578 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreatePredicate(ID3D11Device
*iface
, const D3D11_QUERY_DESC
*desc
,
2579 ID3D11Predicate
**predicate
)
2581 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2582 struct d3d_query
*object
;
2585 TRACE("iface %p, desc %p, predicate %p.\n", iface
, desc
, predicate
);
2587 if (FAILED(hr
= d3d_query_create(device
, desc
, TRUE
, &object
)))
2592 *predicate
= (ID3D11Predicate
*)&object
->ID3D11Query_iface
;
2596 ID3D11Query_Release(&object
->ID3D11Query_iface
);
2600 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateCounter(ID3D11Device
*iface
, const D3D11_COUNTER_DESC
*desc
,
2601 ID3D11Counter
**counter
)
2603 FIXME("iface %p, desc %p, counter %p stub!\n", iface
, desc
, counter
);
2608 static HRESULT STDMETHODCALLTYPE
d3d11_device_CreateDeferredContext(ID3D11Device
*iface
, UINT flags
,
2609 ID3D11DeviceContext
**context
)
2611 FIXME("iface %p, flags %#x, context %p stub!\n", iface
, flags
, context
);
2616 static HRESULT STDMETHODCALLTYPE
d3d11_device_OpenSharedResource(ID3D11Device
*iface
, HANDLE resource
, REFIID riid
,
2619 FIXME("iface %p, resource %p, riid %s, out %p stub!\n", iface
, resource
, debugstr_guid(riid
), out
);
2624 static HRESULT STDMETHODCALLTYPE
d3d11_device_CheckFormatSupport(ID3D11Device
*iface
, DXGI_FORMAT format
,
2625 UINT
*format_support
)
2627 FIXME("iface %p, format %u, format_support %p stub!\n", iface
, format
, format_support
);
2632 static HRESULT STDMETHODCALLTYPE
d3d11_device_CheckMultisampleQualityLevels(ID3D11Device
*iface
,
2633 DXGI_FORMAT format
, UINT sample_count
, UINT
*quality_level_count
)
2635 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2636 struct wined3d_device_creation_parameters params
;
2637 struct wined3d
*wined3d
;
2640 TRACE("iface %p, format %s, sample_count %u, quality_level_count %p.\n",
2641 iface
, debug_dxgi_format(format
), sample_count
, quality_level_count
);
2643 if (!quality_level_count
)
2644 return E_INVALIDARG
;
2646 *quality_level_count
= 0;
2650 if (sample_count
== 1)
2652 *quality_level_count
= 1;
2655 if (sample_count
> D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT
)
2658 wined3d_mutex_lock();
2659 wined3d
= wined3d_device_get_wined3d(device
->wined3d_device
);
2660 wined3d_device_get_creation_parameters(device
->wined3d_device
, ¶ms
);
2661 hr
= wined3d_check_device_multisample_type(wined3d
, params
.adapter_idx
, params
.device_type
,
2662 wined3dformat_from_dxgi_format(format
), TRUE
, sample_count
, quality_level_count
);
2663 wined3d_mutex_unlock();
2665 if (hr
== WINED3DERR_INVALIDCALL
)
2666 return E_INVALIDARG
;
2667 if (hr
== WINED3DERR_NOTAVAILABLE
)
2672 static void STDMETHODCALLTYPE
d3d11_device_CheckCounterInfo(ID3D11Device
*iface
, D3D11_COUNTER_INFO
*info
)
2674 FIXME("iface %p, info %p stub!\n", iface
, info
);
2677 static HRESULT STDMETHODCALLTYPE
d3d11_device_CheckCounter(ID3D11Device
*iface
, const D3D11_COUNTER_DESC
*desc
,
2678 D3D11_COUNTER_TYPE
*type
, UINT
*active_counter_count
, char *name
, UINT
*name_length
,
2679 char *units
, UINT
*units_length
, char *description
, UINT
*description_length
)
2681 FIXME("iface %p, desc %p, type %p, active_counter_count %p, name %p, name_length %p, "
2682 "units %p, units_length %p, description %p, description_length %p stub!\n",
2683 iface
, desc
, type
, active_counter_count
, name
, name_length
,
2684 units
, units_length
, description
, description_length
);
2689 static HRESULT STDMETHODCALLTYPE
d3d11_device_CheckFeatureSupport(ID3D11Device
*iface
, D3D11_FEATURE feature
,
2690 void *feature_support_data
, UINT feature_support_data_size
)
2692 TRACE("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u.\n",
2693 iface
, feature
, feature_support_data
, feature_support_data_size
);
2697 case D3D11_FEATURE_THREADING
:
2699 D3D11_FEATURE_DATA_THREADING
*threading_data
= feature_support_data
;
2700 if (feature_support_data_size
!= sizeof(*threading_data
))
2702 WARN("Invalid data size.\n");
2703 return E_INVALIDARG
;
2706 threading_data
->DriverConcurrentCreates
= FALSE
;
2707 threading_data
->DriverCommandLists
= FALSE
;
2712 FIXME("Unhandled feature %#x.\n", feature
);
2717 static HRESULT STDMETHODCALLTYPE
d3d11_device_GetPrivateData(ID3D11Device
*iface
, REFGUID guid
,
2718 UINT
*data_size
, void *data
)
2720 IDXGIDevice
*dxgi_device
;
2723 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
2725 if (FAILED(hr
= ID3D11Device_QueryInterface(iface
, &IID_IDXGIDevice
, (void **)&dxgi_device
)))
2727 hr
= IDXGIDevice_GetPrivateData(dxgi_device
, guid
, data_size
, data
);
2728 IDXGIDevice_Release(dxgi_device
);
2733 static HRESULT STDMETHODCALLTYPE
d3d11_device_SetPrivateData(ID3D11Device
*iface
, REFGUID guid
,
2734 UINT data_size
, const void *data
)
2736 IDXGIDevice
*dxgi_device
;
2739 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
2741 if (FAILED(hr
= ID3D11Device_QueryInterface(iface
, &IID_IDXGIDevice
, (void **)&dxgi_device
)))
2743 hr
= IDXGIDevice_SetPrivateData(dxgi_device
, guid
, data_size
, data
);
2744 IDXGIDevice_Release(dxgi_device
);
2749 static HRESULT STDMETHODCALLTYPE
d3d11_device_SetPrivateDataInterface(ID3D11Device
*iface
, REFGUID guid
,
2750 const IUnknown
*data
)
2752 IDXGIDevice
*dxgi_device
;
2755 TRACE("iface %p, guid %s, data %p.\n", iface
, debugstr_guid(guid
), data
);
2757 if (FAILED(hr
= ID3D11Device_QueryInterface(iface
, &IID_IDXGIDevice
, (void **)&dxgi_device
)))
2759 hr
= IDXGIDevice_SetPrivateDataInterface(dxgi_device
, guid
, data
);
2760 IDXGIDevice_Release(dxgi_device
);
2765 static D3D_FEATURE_LEVEL STDMETHODCALLTYPE
d3d11_device_GetFeatureLevel(ID3D11Device
*iface
)
2767 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2769 TRACE("iface %p.\n", iface
);
2771 return device
->feature_level
;
2774 static UINT STDMETHODCALLTYPE
d3d11_device_GetCreationFlags(ID3D11Device
*iface
)
2776 FIXME("iface %p stub!\n", iface
);
2781 static HRESULT STDMETHODCALLTYPE
d3d11_device_GetDeviceRemovedReason(ID3D11Device
*iface
)
2783 FIXME("iface %p stub!\n", iface
);
2788 static void STDMETHODCALLTYPE
d3d11_device_GetImmediateContext(ID3D11Device
*iface
,
2789 ID3D11DeviceContext
**immediate_context
)
2791 struct d3d_device
*device
= impl_from_ID3D11Device(iface
);
2793 TRACE("iface %p, immediate_context %p.\n", iface
, immediate_context
);
2795 *immediate_context
= &device
->immediate_context
.ID3D11DeviceContext_iface
;
2796 ID3D11DeviceContext_AddRef(*immediate_context
);
2799 static HRESULT STDMETHODCALLTYPE
d3d11_device_SetExceptionMode(ID3D11Device
*iface
, UINT flags
)
2801 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
2806 static UINT STDMETHODCALLTYPE
d3d11_device_GetExceptionMode(ID3D11Device
*iface
)
2808 FIXME("iface %p stub!\n", iface
);
2813 static const struct ID3D11DeviceVtbl d3d11_device_vtbl
=
2815 /* IUnknown methods */
2816 d3d11_device_QueryInterface
,
2817 d3d11_device_AddRef
,
2818 d3d11_device_Release
,
2819 /* ID3D11Device methods */
2820 d3d11_device_CreateBuffer
,
2821 d3d11_device_CreateTexture1D
,
2822 d3d11_device_CreateTexture2D
,
2823 d3d11_device_CreateTexture3D
,
2824 d3d11_device_CreateShaderResourceView
,
2825 d3d11_device_CreateUnorderedAccessView
,
2826 d3d11_device_CreateRenderTargetView
,
2827 d3d11_device_CreateDepthStencilView
,
2828 d3d11_device_CreateInputLayout
,
2829 d3d11_device_CreateVertexShader
,
2830 d3d11_device_CreateGeometryShader
,
2831 d3d11_device_CreateGeometryShaderWithStreamOutput
,
2832 d3d11_device_CreatePixelShader
,
2833 d3d11_device_CreateHullShader
,
2834 d3d11_device_CreateDomainShader
,
2835 d3d11_device_CreateComputeShader
,
2836 d3d11_device_CreateClassLinkage
,
2837 d3d11_device_CreateBlendState
,
2838 d3d11_device_CreateDepthStencilState
,
2839 d3d11_device_CreateRasterizerState
,
2840 d3d11_device_CreateSamplerState
,
2841 d3d11_device_CreateQuery
,
2842 d3d11_device_CreatePredicate
,
2843 d3d11_device_CreateCounter
,
2844 d3d11_device_CreateDeferredContext
,
2845 d3d11_device_OpenSharedResource
,
2846 d3d11_device_CheckFormatSupport
,
2847 d3d11_device_CheckMultisampleQualityLevels
,
2848 d3d11_device_CheckCounterInfo
,
2849 d3d11_device_CheckCounter
,
2850 d3d11_device_CheckFeatureSupport
,
2851 d3d11_device_GetPrivateData
,
2852 d3d11_device_SetPrivateData
,
2853 d3d11_device_SetPrivateDataInterface
,
2854 d3d11_device_GetFeatureLevel
,
2855 d3d11_device_GetCreationFlags
,
2856 d3d11_device_GetDeviceRemovedReason
,
2857 d3d11_device_GetImmediateContext
,
2858 d3d11_device_SetExceptionMode
,
2859 d3d11_device_GetExceptionMode
,
2862 /* Inner IUnknown methods */
2864 static inline struct d3d_device
*impl_from_IUnknown(IUnknown
*iface
)
2866 return CONTAINING_RECORD(iface
, struct d3d_device
, IUnknown_inner
);
2869 static HRESULT STDMETHODCALLTYPE
d3d_device_inner_QueryInterface(IUnknown
*iface
, REFIID riid
, void **out
)
2871 struct d3d_device
*device
= impl_from_IUnknown(iface
);
2873 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
2875 if (IsEqualGUID(riid
, &IID_ID3D11Device
)
2876 || IsEqualGUID(riid
, &IID_IUnknown
))
2878 *out
= &device
->ID3D11Device_iface
;
2880 else if (IsEqualGUID(riid
, &IID_ID3D10Device1
)
2881 || IsEqualGUID(riid
, &IID_ID3D10Device
))
2883 *out
= &device
->ID3D10Device1_iface
;
2885 else if (IsEqualGUID(riid
, &IID_ID3D10Multithread
))
2887 *out
= &device
->ID3D10Multithread_iface
;
2889 else if (IsEqualGUID(riid
, &IID_IWineDXGIDeviceParent
))
2891 *out
= &device
->IWineDXGIDeviceParent_iface
;
2895 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
2897 return E_NOINTERFACE
;
2900 IUnknown_AddRef((IUnknown
*)*out
);
2904 static ULONG STDMETHODCALLTYPE
d3d_device_inner_AddRef(IUnknown
*iface
)
2906 struct d3d_device
*device
= impl_from_IUnknown(iface
);
2907 ULONG refcount
= InterlockedIncrement(&device
->refcount
);
2909 TRACE("%p increasing refcount to %u.\n", device
, refcount
);
2914 static ULONG STDMETHODCALLTYPE
d3d_device_inner_Release(IUnknown
*iface
)
2916 struct d3d_device
*device
= impl_from_IUnknown(iface
);
2917 ULONG refcount
= InterlockedDecrement(&device
->refcount
);
2919 TRACE("%p decreasing refcount to %u.\n", device
, refcount
);
2923 d3d11_immediate_context_destroy(&device
->immediate_context
);
2924 if (device
->wined3d_device
)
2926 wined3d_mutex_lock();
2927 wined3d_device_decref(device
->wined3d_device
);
2928 wined3d_mutex_unlock();
2930 wine_rb_destroy(&device
->sampler_states
, NULL
, NULL
);
2931 wine_rb_destroy(&device
->rasterizer_states
, NULL
, NULL
);
2932 wine_rb_destroy(&device
->depthstencil_states
, NULL
, NULL
);
2933 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);
2939 /* IUnknown methods */
2941 static HRESULT STDMETHODCALLTYPE
d3d10_device_QueryInterface(ID3D10Device1
*iface
, REFIID riid
,
2944 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
2945 return IUnknown_QueryInterface(device
->outer_unk
, riid
, ppv
);
2948 static ULONG STDMETHODCALLTYPE
d3d10_device_AddRef(ID3D10Device1
*iface
)
2950 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
2951 return IUnknown_AddRef(device
->outer_unk
);
2954 static ULONG STDMETHODCALLTYPE
d3d10_device_Release(ID3D10Device1
*iface
)
2956 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
2957 return IUnknown_Release(device
->outer_unk
);
2960 /* ID3D10Device methods */
2962 static void STDMETHODCALLTYPE
d3d10_device_VSSetConstantBuffers(ID3D10Device1
*iface
,
2963 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
*const *buffers
)
2965 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
2968 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
2969 iface
, start_slot
, buffer_count
, buffers
);
2971 wined3d_mutex_lock();
2972 for (i
= 0; i
< buffer_count
; ++i
)
2974 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
2976 wined3d_device_set_vs_cb(device
->wined3d_device
, start_slot
+ i
,
2977 buffer
? buffer
->wined3d_buffer
: NULL
);
2979 wined3d_mutex_unlock();
2982 static void STDMETHODCALLTYPE
d3d10_device_PSSetShaderResources(ID3D10Device1
*iface
,
2983 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
*const *views
)
2985 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
2988 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
2989 iface
, start_slot
, view_count
, views
);
2991 wined3d_mutex_lock();
2992 for (i
= 0; i
< view_count
; ++i
)
2994 struct d3d_shader_resource_view
*view
= unsafe_impl_from_ID3D10ShaderResourceView(views
[i
]);
2996 wined3d_device_set_ps_resource_view(device
->wined3d_device
, start_slot
+ i
,
2997 view
? view
->wined3d_view
: NULL
);
2999 wined3d_mutex_unlock();
3002 static void STDMETHODCALLTYPE
d3d10_device_PSSetShader(ID3D10Device1
*iface
,
3003 ID3D10PixelShader
*shader
)
3005 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3006 struct d3d_pixel_shader
*ps
= unsafe_impl_from_ID3D10PixelShader(shader
);
3008 TRACE("iface %p, shader %p\n", iface
, shader
);
3010 wined3d_mutex_lock();
3011 wined3d_device_set_pixel_shader(device
->wined3d_device
, ps
? ps
->wined3d_shader
: NULL
);
3012 wined3d_mutex_unlock();
3015 static void STDMETHODCALLTYPE
d3d10_device_PSSetSamplers(ID3D10Device1
*iface
,
3016 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
*const *samplers
)
3018 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3021 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
3022 iface
, start_slot
, sampler_count
, samplers
);
3024 wined3d_mutex_lock();
3025 for (i
= 0; i
< sampler_count
; ++i
)
3027 struct d3d_sampler_state
*sampler
= unsafe_impl_from_ID3D10SamplerState(samplers
[i
]);
3029 wined3d_device_set_ps_sampler(device
->wined3d_device
, start_slot
+ i
,
3030 sampler
? sampler
->wined3d_sampler
: NULL
);
3032 wined3d_mutex_unlock();
3035 static void STDMETHODCALLTYPE
d3d10_device_VSSetShader(ID3D10Device1
*iface
,
3036 ID3D10VertexShader
*shader
)
3038 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3039 struct d3d_vertex_shader
*vs
= unsafe_impl_from_ID3D10VertexShader(shader
);
3041 TRACE("iface %p, shader %p\n", iface
, shader
);
3043 wined3d_mutex_lock();
3044 wined3d_device_set_vertex_shader(device
->wined3d_device
, vs
? vs
->wined3d_shader
: NULL
);
3045 wined3d_mutex_unlock();
3048 static void STDMETHODCALLTYPE
d3d10_device_DrawIndexed(ID3D10Device1
*iface
, UINT index_count
,
3049 UINT start_index_location
, INT base_vertex_location
)
3051 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3053 TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
3054 iface
, index_count
, start_index_location
, base_vertex_location
);
3056 wined3d_mutex_lock();
3057 wined3d_device_set_base_vertex_index(device
->wined3d_device
, base_vertex_location
);
3058 wined3d_device_draw_indexed_primitive(device
->wined3d_device
, start_index_location
, index_count
);
3059 wined3d_mutex_unlock();
3062 static void STDMETHODCALLTYPE
d3d10_device_Draw(ID3D10Device1
*iface
, UINT vertex_count
,
3063 UINT start_vertex_location
)
3065 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3067 TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
3068 iface
, vertex_count
, start_vertex_location
);
3070 wined3d_mutex_lock();
3071 wined3d_device_draw_primitive(device
->wined3d_device
, start_vertex_location
, vertex_count
);
3072 wined3d_mutex_unlock();
3075 static void STDMETHODCALLTYPE
d3d10_device_PSSetConstantBuffers(ID3D10Device1
*iface
,
3076 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
*const *buffers
)
3078 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3081 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
3082 iface
, start_slot
, buffer_count
, buffers
);
3084 wined3d_mutex_lock();
3085 for (i
= 0; i
< buffer_count
; ++i
)
3087 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
3089 wined3d_device_set_ps_cb(device
->wined3d_device
, start_slot
+ i
,
3090 buffer
? buffer
->wined3d_buffer
: NULL
);
3092 wined3d_mutex_unlock();
3095 static void STDMETHODCALLTYPE
d3d10_device_IASetInputLayout(ID3D10Device1
*iface
,
3096 ID3D10InputLayout
*input_layout
)
3098 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3099 struct d3d_input_layout
*layout
= unsafe_impl_from_ID3D10InputLayout(input_layout
);
3101 TRACE("iface %p, input_layout %p\n", iface
, input_layout
);
3103 wined3d_mutex_lock();
3104 wined3d_device_set_vertex_declaration(device
->wined3d_device
,
3105 layout
? layout
->wined3d_decl
: NULL
);
3106 wined3d_mutex_unlock();
3109 static void STDMETHODCALLTYPE
d3d10_device_IASetVertexBuffers(ID3D10Device1
*iface
, UINT start_slot
,
3110 UINT buffer_count
, ID3D10Buffer
*const *buffers
, const UINT
*strides
, const UINT
*offsets
)
3112 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3115 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
3116 iface
, start_slot
, buffer_count
, buffers
, strides
, offsets
);
3118 wined3d_mutex_lock();
3119 for (i
= 0; i
< buffer_count
; ++i
)
3121 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
3123 wined3d_device_set_stream_source(device
->wined3d_device
, start_slot
+ i
,
3124 buffer
? buffer
->wined3d_buffer
: NULL
, offsets
[i
], strides
[i
]);
3126 wined3d_mutex_unlock();
3129 static void STDMETHODCALLTYPE
d3d10_device_IASetIndexBuffer(ID3D10Device1
*iface
,
3130 ID3D10Buffer
*buffer
, DXGI_FORMAT format
, UINT offset
)
3132 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3133 struct d3d_buffer
*buffer_impl
= unsafe_impl_from_ID3D10Buffer(buffer
);
3135 TRACE("iface %p, buffer %p, format %s, offset %u.\n",
3136 iface
, buffer
, debug_dxgi_format(format
), offset
);
3138 wined3d_mutex_lock();
3139 wined3d_device_set_index_buffer(device
->wined3d_device
,
3140 buffer_impl
? buffer_impl
->wined3d_buffer
: NULL
,
3141 wined3dformat_from_dxgi_format(format
), offset
);
3142 wined3d_mutex_unlock();
3145 static void STDMETHODCALLTYPE
d3d10_device_DrawIndexedInstanced(ID3D10Device1
*iface
,
3146 UINT instance_index_count
, UINT instance_count
, UINT start_index_location
,
3147 INT base_vertex_location
, UINT start_instance_location
)
3149 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3151 TRACE("iface %p, instance_index_count %u, instance_count %u, start_index_location %u, "
3152 "base_vertex_location %d, start_instance_location %u.\n",
3153 iface
, instance_index_count
, instance_count
, start_index_location
,
3154 base_vertex_location
, start_instance_location
);
3156 wined3d_mutex_lock();
3157 wined3d_device_set_base_vertex_index(device
->wined3d_device
, base_vertex_location
);
3158 wined3d_device_draw_indexed_primitive_instanced(device
->wined3d_device
, start_index_location
,
3159 instance_index_count
, start_instance_location
, instance_count
);
3160 wined3d_mutex_unlock();
3163 static void STDMETHODCALLTYPE
d3d10_device_DrawInstanced(ID3D10Device1
*iface
,
3164 UINT instance_vertex_count
, UINT instance_count
,
3165 UINT start_vertex_location
, UINT start_instance_location
)
3167 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3169 TRACE("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u, "
3170 "start_instance_location %u.\n", iface
, instance_vertex_count
, instance_count
,
3171 start_vertex_location
, start_instance_location
);
3173 wined3d_mutex_lock();
3174 wined3d_device_draw_primitive_instanced(device
->wined3d_device
, start_vertex_location
,
3175 instance_vertex_count
, start_instance_location
, instance_count
);
3176 wined3d_mutex_unlock();
3179 static void STDMETHODCALLTYPE
d3d10_device_GSSetConstantBuffers(ID3D10Device1
*iface
,
3180 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
*const *buffers
)
3182 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3185 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
3186 iface
, start_slot
, buffer_count
, buffers
);
3188 wined3d_mutex_lock();
3189 for (i
= 0; i
< buffer_count
; ++i
)
3191 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(buffers
[i
]);
3193 wined3d_device_set_gs_cb(device
->wined3d_device
, start_slot
+ i
,
3194 buffer
? buffer
->wined3d_buffer
: NULL
);
3196 wined3d_mutex_unlock();
3199 static void STDMETHODCALLTYPE
d3d10_device_GSSetShader(ID3D10Device1
*iface
, ID3D10GeometryShader
*shader
)
3201 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3202 struct d3d_geometry_shader
*gs
= unsafe_impl_from_ID3D10GeometryShader(shader
);
3204 TRACE("iface %p, shader %p.\n", iface
, shader
);
3206 wined3d_mutex_lock();
3207 wined3d_device_set_geometry_shader(device
->wined3d_device
, gs
? gs
->wined3d_shader
: NULL
);
3208 wined3d_mutex_unlock();
3211 static void STDMETHODCALLTYPE
d3d10_device_IASetPrimitiveTopology(ID3D10Device1
*iface
,
3212 D3D10_PRIMITIVE_TOPOLOGY topology
)
3214 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3216 TRACE("iface %p, topology %s\n", iface
, debug_d3d10_primitive_topology(topology
));
3218 wined3d_mutex_lock();
3219 wined3d_device_set_primitive_type(device
->wined3d_device
, (enum wined3d_primitive_type
)topology
);
3220 wined3d_mutex_unlock();
3223 static void STDMETHODCALLTYPE
d3d10_device_VSSetShaderResources(ID3D10Device1
*iface
,
3224 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
*const *views
)
3226 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3229 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
3230 iface
, start_slot
, view_count
, views
);
3232 wined3d_mutex_lock();
3233 for (i
= 0; i
< view_count
; ++i
)
3235 struct d3d_shader_resource_view
*view
= unsafe_impl_from_ID3D10ShaderResourceView(views
[i
]);
3237 wined3d_device_set_vs_resource_view(device
->wined3d_device
, start_slot
+ i
,
3238 view
? view
->wined3d_view
: NULL
);
3240 wined3d_mutex_unlock();
3243 static void STDMETHODCALLTYPE
d3d10_device_VSSetSamplers(ID3D10Device1
*iface
,
3244 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
*const *samplers
)
3246 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3249 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
3250 iface
, start_slot
, sampler_count
, samplers
);
3252 wined3d_mutex_lock();
3253 for (i
= 0; i
< sampler_count
; ++i
)
3255 struct d3d_sampler_state
*sampler
= unsafe_impl_from_ID3D10SamplerState(samplers
[i
]);
3257 wined3d_device_set_vs_sampler(device
->wined3d_device
, start_slot
+ i
,
3258 sampler
? sampler
->wined3d_sampler
: NULL
);
3260 wined3d_mutex_unlock();
3263 static void STDMETHODCALLTYPE
d3d10_device_SetPredication(ID3D10Device1
*iface
, ID3D10Predicate
*predicate
, BOOL value
)
3265 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3266 struct d3d_query
*query
;
3268 TRACE("iface %p, predicate %p, value %#x.\n", iface
, predicate
, value
);
3270 query
= unsafe_impl_from_ID3D10Query((ID3D10Query
*)predicate
);
3271 wined3d_mutex_lock();
3272 wined3d_device_set_predication(device
->wined3d_device
, query
? query
->wined3d_query
: NULL
, value
);
3273 wined3d_mutex_unlock();
3276 static void STDMETHODCALLTYPE
d3d10_device_GSSetShaderResources(ID3D10Device1
*iface
,
3277 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
*const *views
)
3279 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3282 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
3283 iface
, start_slot
, view_count
, views
);
3285 wined3d_mutex_lock();
3286 for (i
= 0; i
< view_count
; ++i
)
3288 struct d3d_shader_resource_view
*view
= unsafe_impl_from_ID3D10ShaderResourceView(views
[i
]);
3290 wined3d_device_set_gs_resource_view(device
->wined3d_device
, start_slot
+ i
,
3291 view
? view
->wined3d_view
: NULL
);
3293 wined3d_mutex_unlock();
3296 static void STDMETHODCALLTYPE
d3d10_device_GSSetSamplers(ID3D10Device1
*iface
,
3297 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
*const *samplers
)
3299 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3302 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
3303 iface
, start_slot
, sampler_count
, samplers
);
3305 wined3d_mutex_lock();
3306 for (i
= 0; i
< sampler_count
; ++i
)
3308 struct d3d_sampler_state
*sampler
= unsafe_impl_from_ID3D10SamplerState(samplers
[i
]);
3310 wined3d_device_set_gs_sampler(device
->wined3d_device
, start_slot
+ i
,
3311 sampler
? sampler
->wined3d_sampler
: NULL
);
3313 wined3d_mutex_unlock();
3316 static void STDMETHODCALLTYPE
d3d10_device_OMSetRenderTargets(ID3D10Device1
*iface
,
3317 UINT render_target_view_count
, ID3D10RenderTargetView
*const *render_target_views
,
3318 ID3D10DepthStencilView
*depth_stencil_view
)
3320 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3321 struct d3d_depthstencil_view
*dsv
;
3324 TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p.\n",
3325 iface
, render_target_view_count
, render_target_views
, depth_stencil_view
);
3327 wined3d_mutex_lock();
3328 for (i
= 0; i
< render_target_view_count
; ++i
)
3330 struct d3d_rendertarget_view
*rtv
= unsafe_impl_from_ID3D10RenderTargetView(render_target_views
[i
]);
3332 wined3d_device_set_rendertarget_view(device
->wined3d_device
, i
,
3333 rtv
? rtv
->wined3d_view
: NULL
, FALSE
);
3335 for (; i
< D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT
; ++i
)
3337 wined3d_device_set_rendertarget_view(device
->wined3d_device
, i
, NULL
, FALSE
);
3340 dsv
= unsafe_impl_from_ID3D10DepthStencilView(depth_stencil_view
);
3341 wined3d_device_set_depth_stencil_view(device
->wined3d_device
,
3342 dsv
? dsv
->wined3d_view
: NULL
);
3343 wined3d_mutex_unlock();
3346 static void STDMETHODCALLTYPE
d3d10_device_OMSetBlendState(ID3D10Device1
*iface
,
3347 ID3D10BlendState
*blend_state
, const float blend_factor
[4], UINT sample_mask
)
3349 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3350 struct d3d_blend_state
*blend_state_object
;
3352 TRACE("iface %p, blend_state %p, blend_factor %s, sample_mask 0x%08x.\n",
3353 iface
, blend_state
, debug_float4(blend_factor
), sample_mask
);
3355 blend_state_object
= unsafe_impl_from_ID3D10BlendState(blend_state
);
3356 d3d11_immediate_context_OMSetBlendState(&device
->immediate_context
.ID3D11DeviceContext_iface
,
3357 blend_state_object
? &blend_state_object
->ID3D11BlendState_iface
: NULL
, blend_factor
, sample_mask
);
3360 static void STDMETHODCALLTYPE
d3d10_device_OMSetDepthStencilState(ID3D10Device1
*iface
,
3361 ID3D10DepthStencilState
*depth_stencil_state
, UINT stencil_ref
)
3363 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3364 struct d3d_depthstencil_state
*ds_state_object
;
3366 TRACE("iface %p, depth_stencil_state %p, stencil_ref %u.\n",
3367 iface
, depth_stencil_state
, stencil_ref
);
3369 ds_state_object
= unsafe_impl_from_ID3D10DepthStencilState(depth_stencil_state
);
3370 d3d11_immediate_context_OMSetDepthStencilState(&device
->immediate_context
.ID3D11DeviceContext_iface
,
3371 ds_state_object
? &ds_state_object
->ID3D11DepthStencilState_iface
: NULL
, stencil_ref
);
3374 static void STDMETHODCALLTYPE
d3d10_device_SOSetTargets(ID3D10Device1
*iface
,
3375 UINT target_count
, ID3D10Buffer
*const *targets
, const UINT
*offsets
)
3377 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3378 unsigned int count
, i
;
3380 TRACE("iface %p, target_count %u, targets %p, offsets %p.\n", iface
, target_count
, targets
, offsets
);
3382 count
= min(target_count
, 4);
3383 wined3d_mutex_lock();
3384 for (i
= 0; i
< count
; ++i
)
3386 struct d3d_buffer
*buffer
= unsafe_impl_from_ID3D10Buffer(targets
[i
]);
3388 wined3d_device_set_stream_output(device
->wined3d_device
, i
,
3389 buffer
? buffer
->wined3d_buffer
: NULL
, offsets
[i
]);
3392 for (i
= count
; i
< 4; ++i
)
3394 wined3d_device_set_stream_output(device
->wined3d_device
, i
, NULL
, 0);
3396 wined3d_mutex_unlock();
3399 static void STDMETHODCALLTYPE
d3d10_device_DrawAuto(ID3D10Device1
*iface
)
3401 FIXME("iface %p stub!\n", iface
);
3404 static void STDMETHODCALLTYPE
d3d10_device_RSSetState(ID3D10Device1
*iface
, ID3D10RasterizerState
*rasterizer_state
)
3406 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3407 struct d3d_rasterizer_state
*rasterizer_state_object
;
3409 TRACE("iface %p, rasterizer_state %p.\n", iface
, rasterizer_state
);
3411 rasterizer_state_object
= unsafe_impl_from_ID3D10RasterizerState(rasterizer_state
);
3412 d3d11_immediate_context_RSSetState(&device
->immediate_context
.ID3D11DeviceContext_iface
,
3413 rasterizer_state_object
? &rasterizer_state_object
->ID3D11RasterizerState_iface
: NULL
);
3416 static void STDMETHODCALLTYPE
d3d10_device_RSSetViewports(ID3D10Device1
*iface
,
3417 UINT viewport_count
, const D3D10_VIEWPORT
*viewports
)
3419 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3420 struct wined3d_viewport wined3d_vp
;
3422 TRACE("iface %p, viewport_count %u, viewports %p.\n", iface
, viewport_count
, viewports
);
3424 if (viewport_count
> 1)
3425 FIXME("Multiple viewports not implemented.\n");
3427 if (!viewport_count
)
3430 wined3d_vp
.x
= viewports
[0].TopLeftX
;
3431 wined3d_vp
.y
= viewports
[0].TopLeftY
;
3432 wined3d_vp
.width
= viewports
[0].Width
;
3433 wined3d_vp
.height
= viewports
[0].Height
;
3434 wined3d_vp
.min_z
= viewports
[0].MinDepth
;
3435 wined3d_vp
.max_z
= viewports
[0].MaxDepth
;
3437 wined3d_mutex_lock();
3438 wined3d_device_set_viewport(device
->wined3d_device
, &wined3d_vp
);
3439 wined3d_mutex_unlock();
3442 static void STDMETHODCALLTYPE
d3d10_device_RSSetScissorRects(ID3D10Device1
*iface
,
3443 UINT rect_count
, const D3D10_RECT
*rects
)
3445 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3447 TRACE("iface %p, rect_count %u, rects %p.\n", iface
, rect_count
, rects
);
3450 FIXME("Multiple scissor rects not implemented.\n");
3455 wined3d_mutex_lock();
3456 wined3d_device_set_scissor_rect(device
->wined3d_device
, rects
);
3457 wined3d_mutex_unlock();
3460 static void STDMETHODCALLTYPE
d3d10_device_CopySubresourceRegion(ID3D10Device1
*iface
,
3461 ID3D10Resource
*dst_resource
, UINT dst_subresource_idx
, UINT dst_x
, UINT dst_y
, UINT dst_z
,
3462 ID3D10Resource
*src_resource
, UINT src_subresource_idx
, const D3D10_BOX
*src_box
)
3464 struct wined3d_resource
*wined3d_dst_resource
, *wined3d_src_resource
;
3465 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3466 struct wined3d_box wined3d_src_box
;
3468 TRACE("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
3469 "src_resource %p, src_subresource_idx %u, src_box %p.\n",
3470 iface
, dst_resource
, dst_subresource_idx
, dst_x
, dst_y
, dst_z
,
3471 src_resource
, src_subresource_idx
, src_box
);
3475 wined3d_src_box
.left
= src_box
->left
;
3476 wined3d_src_box
.top
= src_box
->top
;
3477 wined3d_src_box
.front
= src_box
->front
;
3478 wined3d_src_box
.right
= src_box
->right
;
3479 wined3d_src_box
.bottom
= src_box
->bottom
;
3480 wined3d_src_box
.back
= src_box
->back
;
3483 wined3d_dst_resource
= wined3d_resource_from_d3d10_resource(dst_resource
);
3484 wined3d_src_resource
= wined3d_resource_from_d3d10_resource(src_resource
);
3485 wined3d_mutex_lock();
3486 wined3d_device_copy_sub_resource_region(device
->wined3d_device
, wined3d_dst_resource
, dst_subresource_idx
,
3487 dst_x
, dst_y
, dst_z
, wined3d_src_resource
, src_subresource_idx
, src_box
? &wined3d_src_box
: NULL
);
3488 wined3d_mutex_unlock();
3491 static void STDMETHODCALLTYPE
d3d10_device_CopyResource(ID3D10Device1
*iface
,
3492 ID3D10Resource
*dst_resource
, ID3D10Resource
*src_resource
)
3494 struct wined3d_resource
*wined3d_dst_resource
, *wined3d_src_resource
;
3495 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3497 TRACE("iface %p, dst_resource %p, src_resource %p.\n", iface
, dst_resource
, src_resource
);
3499 wined3d_dst_resource
= wined3d_resource_from_d3d10_resource(dst_resource
);
3500 wined3d_src_resource
= wined3d_resource_from_d3d10_resource(src_resource
);
3501 wined3d_mutex_lock();
3502 wined3d_device_copy_resource(device
->wined3d_device
, wined3d_dst_resource
, wined3d_src_resource
);
3503 wined3d_mutex_unlock();
3506 static void STDMETHODCALLTYPE
d3d10_device_UpdateSubresource(ID3D10Device1
*iface
,
3507 ID3D10Resource
*resource
, UINT subresource_idx
, const D3D10_BOX
*box
,
3508 const void *data
, UINT row_pitch
, UINT depth_pitch
)
3510 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3511 ID3D11Resource
*d3d11_resource
;
3513 TRACE("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u.\n",
3514 iface
, resource
, subresource_idx
, box
, data
, row_pitch
, depth_pitch
);
3516 ID3D10Resource_QueryInterface(resource
, &IID_ID3D11Resource
, (void **)&d3d11_resource
);
3517 d3d11_immediate_context_UpdateSubresource(&device
->immediate_context
.ID3D11DeviceContext_iface
,
3518 d3d11_resource
, subresource_idx
, (const D3D11_BOX
*)box
, data
, row_pitch
, depth_pitch
);
3519 ID3D11Resource_Release(d3d11_resource
);
3522 static void STDMETHODCALLTYPE
d3d10_device_ClearRenderTargetView(ID3D10Device1
*iface
,
3523 ID3D10RenderTargetView
*render_target_view
, const float color_rgba
[4])
3525 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3526 struct d3d_rendertarget_view
*view
= unsafe_impl_from_ID3D10RenderTargetView(render_target_view
);
3527 const struct wined3d_color color
= {color_rgba
[0], color_rgba
[1], color_rgba
[2], color_rgba
[3]};
3530 TRACE("iface %p, render_target_view %p, color_rgba %s.\n",
3531 iface
, render_target_view
, debug_float4(color_rgba
));
3536 wined3d_mutex_lock();
3537 if (FAILED(hr
= wined3d_device_clear_rendertarget_view(device
->wined3d_device
, view
->wined3d_view
, NULL
,
3538 WINED3DCLEAR_TARGET
, &color
, 0.0f
, 0)))
3539 ERR("Failed to clear view, hr %#x.\n", hr
);
3540 wined3d_mutex_unlock();
3543 static void STDMETHODCALLTYPE
d3d10_device_ClearDepthStencilView(ID3D10Device1
*iface
,
3544 ID3D10DepthStencilView
*depth_stencil_view
, UINT flags
, FLOAT depth
, UINT8 stencil
)
3546 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3547 struct d3d_depthstencil_view
*view
= unsafe_impl_from_ID3D10DepthStencilView(depth_stencil_view
);
3548 DWORD wined3d_flags
;
3551 TRACE("iface %p, depth_stencil_view %p, flags %#x, depth %.8e, stencil %u.\n",
3552 iface
, depth_stencil_view
, flags
, depth
, stencil
);
3557 wined3d_flags
= wined3d_clear_flags_from_d3d11_clear_flags(flags
);
3559 wined3d_mutex_lock();
3560 if (FAILED(hr
= wined3d_device_clear_rendertarget_view(device
->wined3d_device
, view
->wined3d_view
, NULL
,
3561 wined3d_flags
, NULL
, depth
, stencil
)))
3562 ERR("Failed to clear view, hr %#x.\n", hr
);
3563 wined3d_mutex_unlock();
3566 static void STDMETHODCALLTYPE
d3d10_device_GenerateMips(ID3D10Device1
*iface
,
3567 ID3D10ShaderResourceView
*shader_resource_view
)
3569 FIXME("iface %p, shader_resource_view %p stub!\n", iface
, shader_resource_view
);
3572 static void STDMETHODCALLTYPE
d3d10_device_ResolveSubresource(ID3D10Device1
*iface
,
3573 ID3D10Resource
*dst_resource
, UINT dst_subresource_idx
,
3574 ID3D10Resource
*src_resource
, UINT src_subresource_idx
, DXGI_FORMAT format
)
3576 FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, "
3577 "src_resource %p, src_subresource_idx %u, format %s stub!\n",
3578 iface
, dst_resource
, dst_subresource_idx
,
3579 src_resource
, src_subresource_idx
, debug_dxgi_format(format
));
3582 static void STDMETHODCALLTYPE
d3d10_device_VSGetConstantBuffers(ID3D10Device1
*iface
,
3583 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
)
3585 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3588 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
3589 iface
, start_slot
, buffer_count
, buffers
);
3591 wined3d_mutex_lock();
3592 for (i
= 0; i
< buffer_count
; ++i
)
3594 struct wined3d_buffer
*wined3d_buffer
;
3595 struct d3d_buffer
*buffer_impl
;
3597 if (!(wined3d_buffer
= wined3d_device_get_vs_cb(device
->wined3d_device
, start_slot
+ i
)))
3603 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
3604 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
3605 ID3D10Buffer_AddRef(buffers
[i
]);
3607 wined3d_mutex_unlock();
3610 static void STDMETHODCALLTYPE
d3d10_device_PSGetShaderResources(ID3D10Device1
*iface
,
3611 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
**views
)
3613 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3616 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
3617 iface
, start_slot
, view_count
, views
);
3619 wined3d_mutex_lock();
3620 for (i
= 0; i
< view_count
; ++i
)
3622 struct wined3d_shader_resource_view
*wined3d_view
;
3623 struct d3d_shader_resource_view
*view_impl
;
3625 if (!(wined3d_view
= wined3d_device_get_ps_resource_view(device
->wined3d_device
, start_slot
+ i
)))
3631 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
3632 views
[i
] = (ID3D10ShaderResourceView
*)&view_impl
->ID3D10ShaderResourceView1_iface
;
3633 ID3D10ShaderResourceView_AddRef(views
[i
]);
3635 wined3d_mutex_unlock();
3638 static void STDMETHODCALLTYPE
d3d10_device_PSGetShader(ID3D10Device1
*iface
, ID3D10PixelShader
**shader
)
3640 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3641 struct d3d_pixel_shader
*shader_impl
;
3642 struct wined3d_shader
*wined3d_shader
;
3644 TRACE("iface %p, shader %p.\n", iface
, shader
);
3646 wined3d_mutex_lock();
3647 if (!(wined3d_shader
= wined3d_device_get_pixel_shader(device
->wined3d_device
)))
3649 wined3d_mutex_unlock();
3654 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
3655 wined3d_mutex_unlock();
3656 *shader
= &shader_impl
->ID3D10PixelShader_iface
;
3657 ID3D10PixelShader_AddRef(*shader
);
3660 static void STDMETHODCALLTYPE
d3d10_device_PSGetSamplers(ID3D10Device1
*iface
,
3661 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
**samplers
)
3663 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3666 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
3667 iface
, start_slot
, sampler_count
, samplers
);
3669 wined3d_mutex_lock();
3670 for (i
= 0; i
< sampler_count
; ++i
)
3672 struct d3d_sampler_state
*sampler_impl
;
3673 struct wined3d_sampler
*wined3d_sampler
;
3675 if (!(wined3d_sampler
= wined3d_device_get_ps_sampler(device
->wined3d_device
, start_slot
+ i
)))
3681 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
3682 samplers
[i
] = &sampler_impl
->ID3D10SamplerState_iface
;
3683 ID3D10SamplerState_AddRef(samplers
[i
]);
3685 wined3d_mutex_unlock();
3688 static void STDMETHODCALLTYPE
d3d10_device_VSGetShader(ID3D10Device1
*iface
, ID3D10VertexShader
**shader
)
3690 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3691 struct d3d_vertex_shader
*shader_impl
;
3692 struct wined3d_shader
*wined3d_shader
;
3694 TRACE("iface %p, shader %p.\n", iface
, shader
);
3696 wined3d_mutex_lock();
3697 if (!(wined3d_shader
= wined3d_device_get_vertex_shader(device
->wined3d_device
)))
3699 wined3d_mutex_unlock();
3704 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
3705 wined3d_mutex_unlock();
3706 *shader
= &shader_impl
->ID3D10VertexShader_iface
;
3707 ID3D10VertexShader_AddRef(*shader
);
3710 static void STDMETHODCALLTYPE
d3d10_device_PSGetConstantBuffers(ID3D10Device1
*iface
,
3711 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
)
3713 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3716 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
3717 iface
, start_slot
, buffer_count
, buffers
);
3719 wined3d_mutex_lock();
3720 for (i
= 0; i
< buffer_count
; ++i
)
3722 struct wined3d_buffer
*wined3d_buffer
;
3723 struct d3d_buffer
*buffer_impl
;
3725 if (!(wined3d_buffer
= wined3d_device_get_ps_cb(device
->wined3d_device
, start_slot
+ i
)))
3731 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
3732 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
3733 ID3D10Buffer_AddRef(buffers
[i
]);
3735 wined3d_mutex_unlock();
3738 static void STDMETHODCALLTYPE
d3d10_device_IAGetInputLayout(ID3D10Device1
*iface
, ID3D10InputLayout
**input_layout
)
3740 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3741 struct wined3d_vertex_declaration
*wined3d_declaration
;
3742 struct d3d_input_layout
*input_layout_impl
;
3744 TRACE("iface %p, input_layout %p.\n", iface
, input_layout
);
3746 wined3d_mutex_lock();
3747 if (!(wined3d_declaration
= wined3d_device_get_vertex_declaration(device
->wined3d_device
)))
3749 wined3d_mutex_unlock();
3750 *input_layout
= NULL
;
3754 input_layout_impl
= wined3d_vertex_declaration_get_parent(wined3d_declaration
);
3755 wined3d_mutex_unlock();
3756 *input_layout
= &input_layout_impl
->ID3D10InputLayout_iface
;
3757 ID3D10InputLayout_AddRef(*input_layout
);
3760 static void STDMETHODCALLTYPE
d3d10_device_IAGetVertexBuffers(ID3D10Device1
*iface
,
3761 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
, UINT
*strides
, UINT
*offsets
)
3763 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3766 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p.\n",
3767 iface
, start_slot
, buffer_count
, buffers
, strides
, offsets
);
3769 wined3d_mutex_lock();
3770 for (i
= 0; i
< buffer_count
; ++i
)
3772 struct wined3d_buffer
*wined3d_buffer
;
3773 struct d3d_buffer
*buffer_impl
;
3775 if (FAILED(wined3d_device_get_stream_source(device
->wined3d_device
, start_slot
+ i
,
3776 &wined3d_buffer
, &offsets
[i
], &strides
[i
])))
3777 ERR("Failed to get vertex buffer.\n");
3779 if (!wined3d_buffer
)
3785 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
3786 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
3787 ID3D10Buffer_AddRef(buffers
[i
]);
3789 wined3d_mutex_unlock();
3792 static void STDMETHODCALLTYPE
d3d10_device_IAGetIndexBuffer(ID3D10Device1
*iface
,
3793 ID3D10Buffer
**buffer
, DXGI_FORMAT
*format
, UINT
*offset
)
3795 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3796 enum wined3d_format_id wined3d_format
;
3797 struct wined3d_buffer
*wined3d_buffer
;
3798 struct d3d_buffer
*buffer_impl
;
3800 TRACE("iface %p, buffer %p, format %p, offset %p.\n", iface
, buffer
, format
, offset
);
3802 wined3d_mutex_lock();
3803 wined3d_buffer
= wined3d_device_get_index_buffer(device
->wined3d_device
, &wined3d_format
, offset
);
3804 *format
= dxgi_format_from_wined3dformat(wined3d_format
);
3805 if (!wined3d_buffer
)
3807 wined3d_mutex_unlock();
3812 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
3813 wined3d_mutex_unlock();
3814 *buffer
= &buffer_impl
->ID3D10Buffer_iface
;
3815 ID3D10Buffer_AddRef(*buffer
);
3818 static void STDMETHODCALLTYPE
d3d10_device_GSGetConstantBuffers(ID3D10Device1
*iface
,
3819 UINT start_slot
, UINT buffer_count
, ID3D10Buffer
**buffers
)
3821 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3824 TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
3825 iface
, start_slot
, buffer_count
, buffers
);
3827 wined3d_mutex_lock();
3828 for (i
= 0; i
< buffer_count
; ++i
)
3830 struct wined3d_buffer
*wined3d_buffer
;
3831 struct d3d_buffer
*buffer_impl
;
3833 if (!(wined3d_buffer
= wined3d_device_get_gs_cb(device
->wined3d_device
, start_slot
+ i
)))
3839 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
3840 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
3841 ID3D10Buffer_AddRef(buffers
[i
]);
3843 wined3d_mutex_unlock();
3846 static void STDMETHODCALLTYPE
d3d10_device_GSGetShader(ID3D10Device1
*iface
, ID3D10GeometryShader
**shader
)
3848 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3849 struct d3d_geometry_shader
*shader_impl
;
3850 struct wined3d_shader
*wined3d_shader
;
3852 TRACE("iface %p, shader %p.\n", iface
, shader
);
3854 wined3d_mutex_lock();
3855 if (!(wined3d_shader
= wined3d_device_get_geometry_shader(device
->wined3d_device
)))
3857 wined3d_mutex_unlock();
3862 shader_impl
= wined3d_shader_get_parent(wined3d_shader
);
3863 wined3d_mutex_unlock();
3864 *shader
= &shader_impl
->ID3D10GeometryShader_iface
;
3865 ID3D10GeometryShader_AddRef(*shader
);
3868 static void STDMETHODCALLTYPE
d3d10_device_IAGetPrimitiveTopology(ID3D10Device1
*iface
,
3869 D3D10_PRIMITIVE_TOPOLOGY
*topology
)
3871 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3873 TRACE("iface %p, topology %p\n", iface
, topology
);
3875 wined3d_mutex_lock();
3876 wined3d_device_get_primitive_type(device
->wined3d_device
, (enum wined3d_primitive_type
*)topology
);
3877 wined3d_mutex_unlock();
3880 static void STDMETHODCALLTYPE
d3d10_device_VSGetShaderResources(ID3D10Device1
*iface
,
3881 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
**views
)
3883 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3886 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
3887 iface
, start_slot
, view_count
, views
);
3889 wined3d_mutex_lock();
3890 for (i
= 0; i
< view_count
; ++i
)
3892 struct wined3d_shader_resource_view
*wined3d_view
;
3893 struct d3d_shader_resource_view
*view_impl
;
3895 if (!(wined3d_view
= wined3d_device_get_vs_resource_view(device
->wined3d_device
, start_slot
+ i
)))
3901 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
3902 views
[i
] = (ID3D10ShaderResourceView
*)&view_impl
->ID3D10ShaderResourceView1_iface
;
3903 ID3D10ShaderResourceView_AddRef(views
[i
]);
3905 wined3d_mutex_unlock();
3908 static void STDMETHODCALLTYPE
d3d10_device_VSGetSamplers(ID3D10Device1
*iface
,
3909 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
**samplers
)
3911 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3914 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
3915 iface
, start_slot
, sampler_count
, samplers
);
3917 wined3d_mutex_lock();
3918 for (i
= 0; i
< sampler_count
; ++i
)
3920 struct d3d_sampler_state
*sampler_impl
;
3921 struct wined3d_sampler
*wined3d_sampler
;
3923 if (!(wined3d_sampler
= wined3d_device_get_vs_sampler(device
->wined3d_device
, start_slot
+ i
)))
3929 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
3930 samplers
[i
] = &sampler_impl
->ID3D10SamplerState_iface
;
3931 ID3D10SamplerState_AddRef(samplers
[i
]);
3933 wined3d_mutex_unlock();
3936 static void STDMETHODCALLTYPE
d3d10_device_GetPredication(ID3D10Device1
*iface
,
3937 ID3D10Predicate
**predicate
, BOOL
*value
)
3939 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3940 struct wined3d_query
*wined3d_predicate
;
3941 struct d3d_query
*predicate_impl
;
3943 TRACE("iface %p, predicate %p, value %p.\n", iface
, predicate
, value
);
3945 wined3d_mutex_lock();
3946 if (!(wined3d_predicate
= wined3d_device_get_predication(device
->wined3d_device
, value
)))
3948 wined3d_mutex_unlock();
3953 predicate_impl
= wined3d_query_get_parent(wined3d_predicate
);
3954 wined3d_mutex_unlock();
3955 *predicate
= (ID3D10Predicate
*)&predicate_impl
->ID3D10Query_iface
;
3956 ID3D10Predicate_AddRef(*predicate
);
3959 static void STDMETHODCALLTYPE
d3d10_device_GSGetShaderResources(ID3D10Device1
*iface
,
3960 UINT start_slot
, UINT view_count
, ID3D10ShaderResourceView
**views
)
3962 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3965 TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
3966 iface
, start_slot
, view_count
, views
);
3968 wined3d_mutex_lock();
3969 for (i
= 0; i
< view_count
; ++i
)
3971 struct wined3d_shader_resource_view
*wined3d_view
;
3972 struct d3d_shader_resource_view
*view_impl
;
3974 if (!(wined3d_view
= wined3d_device_get_gs_resource_view(device
->wined3d_device
, start_slot
+ i
)))
3980 view_impl
= wined3d_shader_resource_view_get_parent(wined3d_view
);
3981 views
[i
] = (ID3D10ShaderResourceView
*)&view_impl
->ID3D10ShaderResourceView1_iface
;
3982 ID3D10ShaderResourceView_AddRef(views
[i
]);
3984 wined3d_mutex_unlock();
3987 static void STDMETHODCALLTYPE
d3d10_device_GSGetSamplers(ID3D10Device1
*iface
,
3988 UINT start_slot
, UINT sampler_count
, ID3D10SamplerState
**samplers
)
3990 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
3993 TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
3994 iface
, start_slot
, sampler_count
, samplers
);
3996 wined3d_mutex_lock();
3997 for (i
= 0; i
< sampler_count
; ++i
)
3999 struct d3d_sampler_state
*sampler_impl
;
4000 struct wined3d_sampler
*wined3d_sampler
;
4002 if (!(wined3d_sampler
= wined3d_device_get_gs_sampler(device
->wined3d_device
, start_slot
+ i
)))
4008 sampler_impl
= wined3d_sampler_get_parent(wined3d_sampler
);
4009 samplers
[i
] = &sampler_impl
->ID3D10SamplerState_iface
;
4010 ID3D10SamplerState_AddRef(samplers
[i
]);
4012 wined3d_mutex_unlock();
4015 static void STDMETHODCALLTYPE
d3d10_device_OMGetRenderTargets(ID3D10Device1
*iface
,
4016 UINT view_count
, ID3D10RenderTargetView
**render_target_views
, ID3D10DepthStencilView
**depth_stencil_view
)
4018 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4019 struct wined3d_rendertarget_view
*wined3d_view
;
4021 TRACE("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p.\n",
4022 iface
, view_count
, render_target_views
, depth_stencil_view
);
4024 wined3d_mutex_lock();
4025 if (render_target_views
)
4027 struct d3d_rendertarget_view
*view_impl
;
4030 for (i
= 0; i
< view_count
; ++i
)
4032 if (!(wined3d_view
= wined3d_device_get_rendertarget_view(device
->wined3d_device
, i
))
4033 || !(view_impl
= wined3d_rendertarget_view_get_parent(wined3d_view
)))
4035 render_target_views
[i
] = NULL
;
4039 render_target_views
[i
] = &view_impl
->ID3D10RenderTargetView_iface
;
4040 ID3D10RenderTargetView_AddRef(render_target_views
[i
]);
4044 if (depth_stencil_view
)
4046 struct d3d_depthstencil_view
*view_impl
;
4048 if (!(wined3d_view
= wined3d_device_get_depth_stencil_view(device
->wined3d_device
))
4049 || !(view_impl
= wined3d_rendertarget_view_get_parent(wined3d_view
)))
4051 *depth_stencil_view
= NULL
;
4055 *depth_stencil_view
= &view_impl
->ID3D10DepthStencilView_iface
;
4056 ID3D10DepthStencilView_AddRef(*depth_stencil_view
);
4059 wined3d_mutex_unlock();
4062 static void STDMETHODCALLTYPE
d3d10_device_OMGetBlendState(ID3D10Device1
*iface
,
4063 ID3D10BlendState
**blend_state
, FLOAT blend_factor
[4], UINT
*sample_mask
)
4065 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4067 TRACE("iface %p, blend_state %p, blend_factor %p, sample_mask %p.\n",
4068 iface
, blend_state
, blend_factor
, sample_mask
);
4070 if ((*blend_state
= device
->blend_state
? (ID3D10BlendState
*)&device
->blend_state
->ID3D10BlendState1_iface
: NULL
))
4071 ID3D10BlendState_AddRef(*blend_state
);
4072 wined3d_mutex_lock();
4073 memcpy(blend_factor
, device
->blend_factor
, 4 * sizeof(*blend_factor
));
4074 *sample_mask
= wined3d_device_get_render_state(device
->wined3d_device
, WINED3D_RS_MULTISAMPLEMASK
);
4075 wined3d_mutex_unlock();
4078 static void STDMETHODCALLTYPE
d3d10_device_OMGetDepthStencilState(ID3D10Device1
*iface
,
4079 ID3D10DepthStencilState
**depth_stencil_state
, UINT
*stencil_ref
)
4081 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4083 TRACE("iface %p, depth_stencil_state %p, stencil_ref %p.\n",
4084 iface
, depth_stencil_state
, stencil_ref
);
4086 if ((*depth_stencil_state
= device
->depth_stencil_state
4087 ? &device
->depth_stencil_state
->ID3D10DepthStencilState_iface
: NULL
))
4088 ID3D10DepthStencilState_AddRef(*depth_stencil_state
);
4089 *stencil_ref
= device
->stencil_ref
;
4092 static void STDMETHODCALLTYPE
d3d10_device_SOGetTargets(ID3D10Device1
*iface
,
4093 UINT buffer_count
, ID3D10Buffer
**buffers
, UINT
*offsets
)
4095 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4098 TRACE("iface %p, buffer_count %u, buffers %p, offsets %p.\n",
4099 iface
, buffer_count
, buffers
, offsets
);
4101 wined3d_mutex_lock();
4102 for (i
= 0; i
< buffer_count
; ++i
)
4104 struct wined3d_buffer
*wined3d_buffer
;
4105 struct d3d_buffer
*buffer_impl
;
4107 if (!(wined3d_buffer
= wined3d_device_get_stream_output(device
->wined3d_device
, i
, &offsets
[i
])))
4113 buffer_impl
= wined3d_buffer_get_parent(wined3d_buffer
);
4114 buffers
[i
] = &buffer_impl
->ID3D10Buffer_iface
;
4115 ID3D10Buffer_AddRef(buffers
[i
]);
4117 wined3d_mutex_unlock();
4120 static void STDMETHODCALLTYPE
d3d10_device_RSGetState(ID3D10Device1
*iface
, ID3D10RasterizerState
**rasterizer_state
)
4122 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4124 TRACE("iface %p, rasterizer_state %p.\n", iface
, rasterizer_state
);
4126 if ((*rasterizer_state
= device
->rasterizer_state
? &device
->rasterizer_state
->ID3D10RasterizerState_iface
: NULL
))
4127 ID3D10RasterizerState_AddRef(*rasterizer_state
);
4130 static void STDMETHODCALLTYPE
d3d10_device_RSGetViewports(ID3D10Device1
*iface
,
4131 UINT
*viewport_count
, D3D10_VIEWPORT
*viewports
)
4133 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4134 struct wined3d_viewport wined3d_vp
;
4136 TRACE("iface %p, viewport_count %p, viewports %p.\n", iface
, viewport_count
, viewports
);
4140 *viewport_count
= 1;
4144 if (!*viewport_count
)
4147 wined3d_mutex_lock();
4148 wined3d_device_get_viewport(device
->wined3d_device
, &wined3d_vp
);
4149 wined3d_mutex_unlock();
4151 viewports
[0].TopLeftX
= wined3d_vp
.x
;
4152 viewports
[0].TopLeftY
= wined3d_vp
.y
;
4153 viewports
[0].Width
= wined3d_vp
.width
;
4154 viewports
[0].Height
= wined3d_vp
.height
;
4155 viewports
[0].MinDepth
= wined3d_vp
.min_z
;
4156 viewports
[0].MaxDepth
= wined3d_vp
.max_z
;
4158 if (*viewport_count
> 1)
4159 memset(&viewports
[1], 0, (*viewport_count
- 1) * sizeof(*viewports
));
4162 static void STDMETHODCALLTYPE
d3d10_device_RSGetScissorRects(ID3D10Device1
*iface
, UINT
*rect_count
, D3D10_RECT
*rects
)
4164 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4166 TRACE("iface %p, rect_count %p, rects %p.\n", iface
, rect_count
, rects
);
4177 wined3d_mutex_lock();
4178 wined3d_device_get_scissor_rect(device
->wined3d_device
, rects
);
4179 wined3d_mutex_unlock();
4180 if (*rect_count
> 1)
4181 memset(&rects
[1], 0, (*rect_count
- 1) * sizeof(*rects
));
4184 static HRESULT STDMETHODCALLTYPE
d3d10_device_GetDeviceRemovedReason(ID3D10Device1
*iface
)
4186 TRACE("iface %p.\n", iface
);
4188 /* In the current implementation the device is never removed, so we can
4189 * just return S_OK here. */
4194 static HRESULT STDMETHODCALLTYPE
d3d10_device_SetExceptionMode(ID3D10Device1
*iface
, UINT flags
)
4196 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
4201 static UINT STDMETHODCALLTYPE
d3d10_device_GetExceptionMode(ID3D10Device1
*iface
)
4203 FIXME("iface %p stub!\n", iface
);
4208 static HRESULT STDMETHODCALLTYPE
d3d10_device_GetPrivateData(ID3D10Device1
*iface
,
4209 REFGUID guid
, UINT
*data_size
, void *data
)
4211 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4213 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
4215 return d3d11_device_GetPrivateData(&device
->ID3D11Device_iface
, guid
, data_size
, data
);
4218 static HRESULT STDMETHODCALLTYPE
d3d10_device_SetPrivateData(ID3D10Device1
*iface
,
4219 REFGUID guid
, UINT data_size
, const void *data
)
4221 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4223 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
4225 return d3d11_device_SetPrivateData(&device
->ID3D11Device_iface
, guid
, data_size
, data
);
4228 static HRESULT STDMETHODCALLTYPE
d3d10_device_SetPrivateDataInterface(ID3D10Device1
*iface
,
4229 REFGUID guid
, const IUnknown
*data
)
4231 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4233 TRACE("iface %p, guid %s, data %p.\n", iface
, debugstr_guid(guid
), data
);
4235 return d3d11_device_SetPrivateDataInterface(&device
->ID3D11Device_iface
, guid
, data
);
4238 static void STDMETHODCALLTYPE
d3d10_device_ClearState(ID3D10Device1
*iface
)
4240 static const float blend_factor
[] = {1.0f
, 1.0f
, 1.0f
, 1.0f
};
4241 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4244 TRACE("iface %p.\n", iface
);
4246 wined3d_mutex_lock();
4247 wined3d_device_set_vertex_shader(device
->wined3d_device
, NULL
);
4248 for (i
= 0; i
< D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
; ++i
)
4250 wined3d_device_set_vs_sampler(device
->wined3d_device
, i
, NULL
);
4252 for (i
= 0; i
< D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
; ++i
)
4254 wined3d_device_set_vs_resource_view(device
->wined3d_device
, i
, NULL
);
4256 for (i
= 0; i
< D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
; ++i
)
4258 wined3d_device_set_vs_cb(device
->wined3d_device
, i
, NULL
);
4260 wined3d_device_set_geometry_shader(device
->wined3d_device
, NULL
);
4261 for (i
= 0; i
< D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
; ++i
)
4263 wined3d_device_set_gs_sampler(device
->wined3d_device
, i
, NULL
);
4265 for (i
= 0; i
< D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
; ++i
)
4267 wined3d_device_set_gs_resource_view(device
->wined3d_device
, i
, NULL
);
4269 for (i
= 0; i
< D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
; ++i
)
4271 wined3d_device_set_gs_cb(device
->wined3d_device
, i
, NULL
);
4273 wined3d_device_set_pixel_shader(device
->wined3d_device
, NULL
);
4274 for (i
= 0; i
< D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
; ++i
)
4276 wined3d_device_set_ps_sampler(device
->wined3d_device
, i
, NULL
);
4278 for (i
= 0; i
< D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
; ++i
)
4280 wined3d_device_set_ps_resource_view(device
->wined3d_device
, i
, NULL
);
4282 for (i
= 0; i
< D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
; ++i
)
4284 wined3d_device_set_ps_cb(device
->wined3d_device
, i
, NULL
);
4286 for (i
= 0; i
< D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
; ++i
)
4288 wined3d_device_set_stream_source(device
->wined3d_device
, i
, NULL
, 0, 0);
4290 wined3d_device_set_index_buffer(device
->wined3d_device
, NULL
, WINED3DFMT_UNKNOWN
, 0);
4291 wined3d_device_set_vertex_declaration(device
->wined3d_device
, NULL
);
4292 wined3d_device_set_primitive_type(device
->wined3d_device
, WINED3D_PT_UNDEFINED
);
4293 for (i
= 0; i
< D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT
; ++i
)
4295 wined3d_device_set_rendertarget_view(device
->wined3d_device
, i
, NULL
, FALSE
);
4297 wined3d_device_set_depth_stencil_view(device
->wined3d_device
, NULL
);
4298 ID3D10Device1_OMSetDepthStencilState(iface
, NULL
, 0);
4299 ID3D10Device1_OMSetBlendState(iface
, NULL
, blend_factor
, D3D10_DEFAULT_SAMPLE_MASK
);
4300 ID3D10Device1_RSSetViewports(iface
, 0, NULL
);
4301 ID3D10Device1_RSSetScissorRects(iface
, 0, NULL
);
4302 ID3D10Device1_RSSetState(iface
, NULL
);
4303 for (i
= 0; i
< D3D10_SO_BUFFER_SLOT_COUNT
; ++i
)
4305 wined3d_device_set_stream_output(device
->wined3d_device
, i
, NULL
, 0);
4307 wined3d_device_set_predication(device
->wined3d_device
, NULL
, FALSE
);
4308 wined3d_mutex_unlock();
4311 static void STDMETHODCALLTYPE
d3d10_device_Flush(ID3D10Device1
*iface
)
4313 FIXME("iface %p stub!\n", iface
);
4316 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateBuffer(ID3D10Device1
*iface
,
4317 const D3D10_BUFFER_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
, ID3D10Buffer
**buffer
)
4319 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4320 D3D11_BUFFER_DESC d3d11_desc
;
4321 struct d3d_buffer
*object
;
4324 TRACE("iface %p, desc %p, data %p, buffer %p.\n", iface
, desc
, data
, buffer
);
4326 d3d11_desc
.ByteWidth
= desc
->ByteWidth
;
4327 d3d11_desc
.Usage
= d3d11_usage_from_d3d10_usage(desc
->Usage
);
4328 d3d11_desc
.BindFlags
= d3d11_bind_flags_from_d3d10_bind_flags(desc
->BindFlags
);
4329 d3d11_desc
.CPUAccessFlags
= d3d11_cpu_access_flags_from_d3d10_cpu_access_flags(desc
->CPUAccessFlags
);
4330 d3d11_desc
.MiscFlags
= d3d11_resource_misc_flags_from_d3d10_resource_misc_flags(desc
->MiscFlags
);
4331 d3d11_desc
.StructureByteStride
= 0;
4333 if (FAILED(hr
= d3d_buffer_create(device
, &d3d11_desc
, (const D3D11_SUBRESOURCE_DATA
*)data
, &object
)))
4336 *buffer
= &object
->ID3D10Buffer_iface
;
4341 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateTexture1D(ID3D10Device1
*iface
,
4342 const D3D10_TEXTURE1D_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
, ID3D10Texture1D
**texture
)
4344 FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface
, desc
, data
, texture
);
4349 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateTexture2D(ID3D10Device1
*iface
,
4350 const D3D10_TEXTURE2D_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
,
4351 ID3D10Texture2D
**texture
)
4353 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4354 D3D11_TEXTURE2D_DESC d3d11_desc
;
4355 struct d3d_texture2d
*object
;
4358 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface
, desc
, data
, texture
);
4360 d3d11_desc
.Width
= desc
->Width
;
4361 d3d11_desc
.Height
= desc
->Height
;
4362 d3d11_desc
.MipLevels
= desc
->MipLevels
;
4363 d3d11_desc
.ArraySize
= desc
->ArraySize
;
4364 d3d11_desc
.Format
= desc
->Format
;
4365 d3d11_desc
.SampleDesc
= desc
->SampleDesc
;
4366 d3d11_desc
.Usage
= d3d11_usage_from_d3d10_usage(desc
->Usage
);
4367 d3d11_desc
.BindFlags
= d3d11_bind_flags_from_d3d10_bind_flags(desc
->BindFlags
);
4368 d3d11_desc
.CPUAccessFlags
= d3d11_cpu_access_flags_from_d3d10_cpu_access_flags(desc
->CPUAccessFlags
);
4369 d3d11_desc
.MiscFlags
= d3d11_resource_misc_flags_from_d3d10_resource_misc_flags(desc
->MiscFlags
);
4371 if (FAILED(hr
= d3d_texture2d_create(device
, &d3d11_desc
, (const D3D11_SUBRESOURCE_DATA
*)data
, &object
)))
4374 *texture
= &object
->ID3D10Texture2D_iface
;
4379 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateTexture3D(ID3D10Device1
*iface
,
4380 const D3D10_TEXTURE3D_DESC
*desc
, const D3D10_SUBRESOURCE_DATA
*data
,
4381 ID3D10Texture3D
**texture
)
4383 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4384 D3D11_TEXTURE3D_DESC d3d11_desc
;
4385 struct d3d_texture3d
*object
;
4388 TRACE("iface %p, desc %p, data %p, texture %p.\n", iface
, desc
, data
, texture
);
4390 d3d11_desc
.Width
= desc
->Width
;
4391 d3d11_desc
.Height
= desc
->Height
;
4392 d3d11_desc
.Depth
= desc
->Depth
;
4393 d3d11_desc
.MipLevels
= desc
->MipLevels
;
4394 d3d11_desc
.Format
= desc
->Format
;
4395 d3d11_desc
.Usage
= d3d11_usage_from_d3d10_usage(desc
->Usage
);
4396 d3d11_desc
.BindFlags
= d3d11_bind_flags_from_d3d10_bind_flags(desc
->BindFlags
);
4397 d3d11_desc
.CPUAccessFlags
= d3d11_cpu_access_flags_from_d3d10_cpu_access_flags(desc
->CPUAccessFlags
);
4398 d3d11_desc
.MiscFlags
= d3d11_resource_misc_flags_from_d3d10_resource_misc_flags(desc
->MiscFlags
);
4400 if (FAILED(hr
= d3d_texture3d_create(device
, &d3d11_desc
, (const D3D11_SUBRESOURCE_DATA
*)data
, &object
)))
4403 *texture
= &object
->ID3D10Texture3D_iface
;
4408 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateShaderResourceView1(ID3D10Device1
*iface
,
4409 ID3D10Resource
*resource
, const D3D10_SHADER_RESOURCE_VIEW_DESC1
*desc
, ID3D10ShaderResourceView1
**view
)
4411 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4412 struct d3d_shader_resource_view
*object
;
4413 ID3D11Resource
*d3d11_resource
;
4416 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
4418 if (FAILED(hr
= ID3D10Resource_QueryInterface(resource
, &IID_ID3D11Resource
, (void **)&d3d11_resource
)))
4420 ERR("Resource does not implement ID3D11Resource.\n");
4424 hr
= d3d_shader_resource_view_create(device
, d3d11_resource
, (const D3D11_SHADER_RESOURCE_VIEW_DESC
*)desc
,
4426 ID3D11Resource_Release(d3d11_resource
);
4430 *view
= &object
->ID3D10ShaderResourceView1_iface
;
4435 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateShaderResourceView(ID3D10Device1
*iface
,
4436 ID3D10Resource
*resource
, const D3D10_SHADER_RESOURCE_VIEW_DESC
*desc
, ID3D10ShaderResourceView
**view
)
4438 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
4440 return d3d10_device_CreateShaderResourceView1(iface
, resource
,
4441 (const D3D10_SHADER_RESOURCE_VIEW_DESC1
*)desc
, (ID3D10ShaderResourceView1
**)view
);
4444 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateRenderTargetView(ID3D10Device1
*iface
,
4445 ID3D10Resource
*resource
, const D3D10_RENDER_TARGET_VIEW_DESC
*desc
, ID3D10RenderTargetView
**view
)
4447 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4448 struct d3d_rendertarget_view
*object
;
4449 ID3D11Resource
*d3d11_resource
;
4452 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
4454 if (FAILED(hr
= ID3D10Resource_QueryInterface(resource
, &IID_ID3D11Resource
, (void **)&d3d11_resource
)))
4456 ERR("Resource does not implement ID3D11Resource.\n");
4460 hr
= d3d_rendertarget_view_create(device
, d3d11_resource
, (const D3D11_RENDER_TARGET_VIEW_DESC
*)desc
, &object
);
4461 ID3D11Resource_Release(d3d11_resource
);
4465 *view
= &object
->ID3D10RenderTargetView_iface
;
4470 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateDepthStencilView(ID3D10Device1
*iface
,
4471 ID3D10Resource
*resource
, const D3D10_DEPTH_STENCIL_VIEW_DESC
*desc
, ID3D10DepthStencilView
**view
)
4473 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4474 D3D11_DEPTH_STENCIL_VIEW_DESC d3d11_desc
;
4475 struct d3d_depthstencil_view
*object
;
4476 ID3D11Resource
*d3d11_resource
;
4479 TRACE("iface %p, resource %p, desc %p, view %p.\n", iface
, resource
, desc
, view
);
4483 d3d11_desc
.Format
= desc
->Format
;
4484 d3d11_desc
.ViewDimension
= desc
->ViewDimension
;
4485 d3d11_desc
.Flags
= 0;
4486 memcpy(&d3d11_desc
.u
, &desc
->u
, sizeof(d3d11_desc
.u
));
4489 if (FAILED(hr
= ID3D10Resource_QueryInterface(resource
, &IID_ID3D11Resource
, (void **)&d3d11_resource
)))
4491 ERR("Resource does not implement ID3D11Resource.\n");
4495 hr
= d3d_depthstencil_view_create(device
, d3d11_resource
, desc
? &d3d11_desc
: NULL
, &object
);
4496 ID3D11Resource_Release(d3d11_resource
);
4500 *view
= &object
->ID3D10DepthStencilView_iface
;
4505 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateInputLayout(ID3D10Device1
*iface
,
4506 const D3D10_INPUT_ELEMENT_DESC
*element_descs
, UINT element_count
,
4507 const void *shader_byte_code
, SIZE_T shader_byte_code_length
,
4508 ID3D10InputLayout
**input_layout
)
4510 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4511 struct d3d_input_layout
*object
;
4514 TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p, "
4515 "shader_byte_code_length %lu, input_layout %p\n",
4516 iface
, element_descs
, element_count
, shader_byte_code
,
4517 shader_byte_code_length
, input_layout
);
4519 if (FAILED(hr
= d3d_input_layout_create(device
, (const D3D11_INPUT_ELEMENT_DESC
*)element_descs
, element_count
,
4520 shader_byte_code
, shader_byte_code_length
, &object
)))
4523 *input_layout
= &object
->ID3D10InputLayout_iface
;
4528 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateVertexShader(ID3D10Device1
*iface
,
4529 const void *byte_code
, SIZE_T byte_code_length
, ID3D10VertexShader
**shader
)
4531 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4532 struct d3d_vertex_shader
*object
;
4535 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p.\n",
4536 iface
, byte_code
, byte_code_length
, shader
);
4538 if (FAILED(hr
= d3d_vertex_shader_create(device
, byte_code
, byte_code_length
, &object
)))
4541 *shader
= &object
->ID3D10VertexShader_iface
;
4546 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateGeometryShader(ID3D10Device1
*iface
,
4547 const void *byte_code
, SIZE_T byte_code_length
, ID3D10GeometryShader
**shader
)
4549 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4550 struct d3d_geometry_shader
*object
;
4553 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p.\n",
4554 iface
, byte_code
, byte_code_length
, shader
);
4556 if (FAILED(hr
= d3d_geometry_shader_create(device
, byte_code
, byte_code_length
, &object
)))
4559 *shader
= &object
->ID3D10GeometryShader_iface
;
4564 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device1
*iface
,
4565 const void *byte_code
, SIZE_T byte_code_length
, const D3D10_SO_DECLARATION_ENTRY
*output_stream_decls
,
4566 UINT output_stream_decl_count
, UINT output_stream_stride
, ID3D10GeometryShader
**shader
)
4568 FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p, "
4569 "output_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
4570 iface
, byte_code
, byte_code_length
, output_stream_decls
,
4571 output_stream_decl_count
, output_stream_stride
, shader
);
4576 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreatePixelShader(ID3D10Device1
*iface
,
4577 const void *byte_code
, SIZE_T byte_code_length
, ID3D10PixelShader
**shader
)
4579 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4580 struct d3d_pixel_shader
*object
;
4583 TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p.\n",
4584 iface
, byte_code
, byte_code_length
, shader
);
4586 if (FAILED(hr
= d3d_pixel_shader_create(device
, byte_code
, byte_code_length
, &object
)))
4589 *shader
= &object
->ID3D10PixelShader_iface
;
4594 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateBlendState1(ID3D10Device1
*iface
,
4595 const D3D10_BLEND_DESC1
*desc
, ID3D10BlendState1
**blend_state
)
4597 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4598 ID3D11BlendState
*d3d11_blend_state
;
4601 TRACE("iface %p, desc %p, blend_state %p.\n", iface
, desc
, blend_state
);
4603 if (FAILED(hr
= d3d11_device_CreateBlendState(&device
->ID3D11Device_iface
, (D3D11_BLEND_DESC
*)desc
,
4604 &d3d11_blend_state
)))
4607 hr
= ID3D11BlendState_QueryInterface(d3d11_blend_state
, &IID_ID3D10BlendState1
, (void **)blend_state
);
4608 ID3D11BlendState_Release(d3d11_blend_state
);
4612 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateBlendState(ID3D10Device1
*iface
,
4613 const D3D10_BLEND_DESC
*desc
, ID3D10BlendState
**blend_state
)
4615 D3D10_BLEND_DESC1 d3d10_1_desc
;
4618 TRACE("iface %p, desc %p, blend_state %p.\n", iface
, desc
, blend_state
);
4621 return E_INVALIDARG
;
4623 d3d10_1_desc
.AlphaToCoverageEnable
= desc
->AlphaToCoverageEnable
;
4624 d3d10_1_desc
.IndependentBlendEnable
= FALSE
;
4625 for (i
= 0; i
< D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT
- 1; ++i
)
4627 if (desc
->BlendEnable
[i
] != desc
->BlendEnable
[i
+ 1]
4628 || desc
->RenderTargetWriteMask
[i
] != desc
->RenderTargetWriteMask
[i
+ 1])
4629 d3d10_1_desc
.IndependentBlendEnable
= TRUE
;
4632 for (i
= 0; i
< D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT
; ++i
)
4634 d3d10_1_desc
.RenderTarget
[i
].BlendEnable
= desc
->BlendEnable
[i
];
4635 d3d10_1_desc
.RenderTarget
[i
].SrcBlend
= desc
->SrcBlend
;
4636 d3d10_1_desc
.RenderTarget
[i
].DestBlend
= desc
->DestBlend
;
4637 d3d10_1_desc
.RenderTarget
[i
].BlendOp
= desc
->BlendOp
;
4638 d3d10_1_desc
.RenderTarget
[i
].SrcBlendAlpha
= desc
->SrcBlendAlpha
;
4639 d3d10_1_desc
.RenderTarget
[i
].DestBlendAlpha
= desc
->DestBlendAlpha
;
4640 d3d10_1_desc
.RenderTarget
[i
].BlendOpAlpha
= desc
->BlendOpAlpha
;
4641 d3d10_1_desc
.RenderTarget
[i
].RenderTargetWriteMask
= desc
->RenderTargetWriteMask
[i
];
4644 return d3d10_device_CreateBlendState1(iface
, &d3d10_1_desc
, (ID3D10BlendState1
**)blend_state
);
4647 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateDepthStencilState(ID3D10Device1
*iface
,
4648 const D3D10_DEPTH_STENCIL_DESC
*desc
, ID3D10DepthStencilState
**depth_stencil_state
)
4650 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4651 ID3D11DepthStencilState
*d3d11_depth_stencil_state
;
4654 TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface
, desc
, depth_stencil_state
);
4656 if (FAILED(hr
= d3d11_device_CreateDepthStencilState(&device
->ID3D11Device_iface
,
4657 (const D3D11_DEPTH_STENCIL_DESC
*)desc
, &d3d11_depth_stencil_state
)))
4660 hr
= ID3D11DepthStencilState_QueryInterface(d3d11_depth_stencil_state
, &IID_ID3D10DepthStencilState
,
4661 (void **)depth_stencil_state
);
4662 ID3D11DepthStencilState_Release(d3d11_depth_stencil_state
);
4666 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateRasterizerState(ID3D10Device1
*iface
,
4667 const D3D10_RASTERIZER_DESC
*desc
, ID3D10RasterizerState
**rasterizer_state
)
4669 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4670 ID3D11RasterizerState
*d3d11_rasterizer_state
;
4673 TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface
, desc
, rasterizer_state
);
4675 if (FAILED(hr
= d3d11_device_CreateRasterizerState(&device
->ID3D11Device_iface
,
4676 (const D3D11_RASTERIZER_DESC
*)desc
, &d3d11_rasterizer_state
)))
4679 hr
= ID3D11RasterizerState_QueryInterface(d3d11_rasterizer_state
,
4680 &IID_ID3D10RasterizerState
, (void **)rasterizer_state
);
4681 ID3D11RasterizerState_Release(d3d11_rasterizer_state
);
4685 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateSamplerState(ID3D10Device1
*iface
,
4686 const D3D10_SAMPLER_DESC
*desc
, ID3D10SamplerState
**sampler_state
)
4688 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4689 ID3D11SamplerState
*d3d11_sampler_state
;
4692 TRACE("iface %p, desc %p, sampler_state %p.\n", iface
, desc
, sampler_state
);
4694 if (FAILED(hr
= d3d11_device_CreateSamplerState(&device
->ID3D11Device_iface
,
4695 (const D3D11_SAMPLER_DESC
*)desc
, &d3d11_sampler_state
)))
4698 hr
= ID3D11SamplerState_QueryInterface(d3d11_sampler_state
, &IID_ID3D10SamplerState
, (void **)sampler_state
);
4699 ID3D11SamplerState_Release(d3d11_sampler_state
);
4703 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateQuery(ID3D10Device1
*iface
,
4704 const D3D10_QUERY_DESC
*desc
, ID3D10Query
**query
)
4706 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4707 struct d3d_query
*object
;
4710 TRACE("iface %p, desc %p, query %p.\n", iface
, desc
, query
);
4712 if (FAILED(hr
= d3d_query_create(device
, (const D3D11_QUERY_DESC
*)desc
, FALSE
, &object
)))
4717 *query
= &object
->ID3D10Query_iface
;
4721 ID3D10Query_Release(&object
->ID3D10Query_iface
);
4725 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreatePredicate(ID3D10Device1
*iface
,
4726 const D3D10_QUERY_DESC
*desc
, ID3D10Predicate
**predicate
)
4728 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4729 struct d3d_query
*object
;
4732 TRACE("iface %p, desc %p, predicate %p.\n", iface
, desc
, predicate
);
4734 if (FAILED(hr
= d3d_query_create(device
, (const D3D11_QUERY_DESC
*)desc
, TRUE
, &object
)))
4739 *predicate
= (ID3D10Predicate
*)&object
->ID3D10Query_iface
;
4743 ID3D10Query_Release(&object
->ID3D10Query_iface
);
4747 static HRESULT STDMETHODCALLTYPE
d3d10_device_CreateCounter(ID3D10Device1
*iface
,
4748 const D3D10_COUNTER_DESC
*desc
, ID3D10Counter
**counter
)
4750 FIXME("iface %p, desc %p, counter %p stub!\n", iface
, desc
, counter
);
4755 static HRESULT STDMETHODCALLTYPE
d3d10_device_CheckFormatSupport(ID3D10Device1
*iface
,
4756 DXGI_FORMAT format
, UINT
*format_support
)
4758 FIXME("iface %p, format %s, format_support %p stub!\n",
4759 iface
, debug_dxgi_format(format
), format_support
);
4764 static HRESULT STDMETHODCALLTYPE
d3d10_device_CheckMultisampleQualityLevels(ID3D10Device1
*iface
,
4765 DXGI_FORMAT format
, UINT sample_count
, UINT
*quality_level_count
)
4767 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4769 TRACE("iface %p, format %s, sample_count %u, quality_level_count %p.\n",
4770 iface
, debug_dxgi_format(format
), sample_count
, quality_level_count
);
4772 return d3d11_device_CheckMultisampleQualityLevels(&device
->ID3D11Device_iface
, format
,
4773 sample_count
, quality_level_count
);
4776 static void STDMETHODCALLTYPE
d3d10_device_CheckCounterInfo(ID3D10Device1
*iface
, D3D10_COUNTER_INFO
*counter_info
)
4778 FIXME("iface %p, counter_info %p stub!\n", iface
, counter_info
);
4781 static HRESULT STDMETHODCALLTYPE
d3d10_device_CheckCounter(ID3D10Device1
*iface
,
4782 const D3D10_COUNTER_DESC
*desc
, D3D10_COUNTER_TYPE
*type
, UINT
*active_counters
, char *name
,
4783 UINT
*name_length
, char *units
, UINT
*units_length
, char *description
, UINT
*description_length
)
4785 FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p, "
4786 "units %p, units_length %p, description %p, description_length %p stub!\n",
4787 iface
, desc
, type
, active_counters
, name
, name_length
,
4788 units
, units_length
, description
, description_length
);
4793 static UINT STDMETHODCALLTYPE
d3d10_device_GetCreationFlags(ID3D10Device1
*iface
)
4795 FIXME("iface %p stub!\n", iface
);
4800 static HRESULT STDMETHODCALLTYPE
d3d10_device_OpenSharedResource(ID3D10Device1
*iface
,
4801 HANDLE resource_handle
, REFIID guid
, void **resource
)
4803 FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
4804 iface
, resource_handle
, debugstr_guid(guid
), resource
);
4809 static void STDMETHODCALLTYPE
d3d10_device_SetTextFilterSize(ID3D10Device1
*iface
, UINT width
, UINT height
)
4811 FIXME("iface %p, width %u, height %u stub!\n", iface
, width
, height
);
4814 static void STDMETHODCALLTYPE
d3d10_device_GetTextFilterSize(ID3D10Device1
*iface
, UINT
*width
, UINT
*height
)
4816 FIXME("iface %p, width %p, height %p stub!\n", iface
, width
, height
);
4819 static D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE
d3d10_device_GetFeatureLevel(ID3D10Device1
*iface
)
4821 struct d3d_device
*device
= impl_from_ID3D10Device(iface
);
4823 TRACE("iface %p.\n", iface
);
4825 return device
->feature_level
;
4828 static const struct ID3D10Device1Vtbl d3d10_device1_vtbl
=
4830 /* IUnknown methods */
4831 d3d10_device_QueryInterface
,
4832 d3d10_device_AddRef
,
4833 d3d10_device_Release
,
4834 /* ID3D10Device methods */
4835 d3d10_device_VSSetConstantBuffers
,
4836 d3d10_device_PSSetShaderResources
,
4837 d3d10_device_PSSetShader
,
4838 d3d10_device_PSSetSamplers
,
4839 d3d10_device_VSSetShader
,
4840 d3d10_device_DrawIndexed
,
4842 d3d10_device_PSSetConstantBuffers
,
4843 d3d10_device_IASetInputLayout
,
4844 d3d10_device_IASetVertexBuffers
,
4845 d3d10_device_IASetIndexBuffer
,
4846 d3d10_device_DrawIndexedInstanced
,
4847 d3d10_device_DrawInstanced
,
4848 d3d10_device_GSSetConstantBuffers
,
4849 d3d10_device_GSSetShader
,
4850 d3d10_device_IASetPrimitiveTopology
,
4851 d3d10_device_VSSetShaderResources
,
4852 d3d10_device_VSSetSamplers
,
4853 d3d10_device_SetPredication
,
4854 d3d10_device_GSSetShaderResources
,
4855 d3d10_device_GSSetSamplers
,
4856 d3d10_device_OMSetRenderTargets
,
4857 d3d10_device_OMSetBlendState
,
4858 d3d10_device_OMSetDepthStencilState
,
4859 d3d10_device_SOSetTargets
,
4860 d3d10_device_DrawAuto
,
4861 d3d10_device_RSSetState
,
4862 d3d10_device_RSSetViewports
,
4863 d3d10_device_RSSetScissorRects
,
4864 d3d10_device_CopySubresourceRegion
,
4865 d3d10_device_CopyResource
,
4866 d3d10_device_UpdateSubresource
,
4867 d3d10_device_ClearRenderTargetView
,
4868 d3d10_device_ClearDepthStencilView
,
4869 d3d10_device_GenerateMips
,
4870 d3d10_device_ResolveSubresource
,
4871 d3d10_device_VSGetConstantBuffers
,
4872 d3d10_device_PSGetShaderResources
,
4873 d3d10_device_PSGetShader
,
4874 d3d10_device_PSGetSamplers
,
4875 d3d10_device_VSGetShader
,
4876 d3d10_device_PSGetConstantBuffers
,
4877 d3d10_device_IAGetInputLayout
,
4878 d3d10_device_IAGetVertexBuffers
,
4879 d3d10_device_IAGetIndexBuffer
,
4880 d3d10_device_GSGetConstantBuffers
,
4881 d3d10_device_GSGetShader
,
4882 d3d10_device_IAGetPrimitiveTopology
,
4883 d3d10_device_VSGetShaderResources
,
4884 d3d10_device_VSGetSamplers
,
4885 d3d10_device_GetPredication
,
4886 d3d10_device_GSGetShaderResources
,
4887 d3d10_device_GSGetSamplers
,
4888 d3d10_device_OMGetRenderTargets
,
4889 d3d10_device_OMGetBlendState
,
4890 d3d10_device_OMGetDepthStencilState
,
4891 d3d10_device_SOGetTargets
,
4892 d3d10_device_RSGetState
,
4893 d3d10_device_RSGetViewports
,
4894 d3d10_device_RSGetScissorRects
,
4895 d3d10_device_GetDeviceRemovedReason
,
4896 d3d10_device_SetExceptionMode
,
4897 d3d10_device_GetExceptionMode
,
4898 d3d10_device_GetPrivateData
,
4899 d3d10_device_SetPrivateData
,
4900 d3d10_device_SetPrivateDataInterface
,
4901 d3d10_device_ClearState
,
4903 d3d10_device_CreateBuffer
,
4904 d3d10_device_CreateTexture1D
,
4905 d3d10_device_CreateTexture2D
,
4906 d3d10_device_CreateTexture3D
,
4907 d3d10_device_CreateShaderResourceView
,
4908 d3d10_device_CreateRenderTargetView
,
4909 d3d10_device_CreateDepthStencilView
,
4910 d3d10_device_CreateInputLayout
,
4911 d3d10_device_CreateVertexShader
,
4912 d3d10_device_CreateGeometryShader
,
4913 d3d10_device_CreateGeometryShaderWithStreamOutput
,
4914 d3d10_device_CreatePixelShader
,
4915 d3d10_device_CreateBlendState
,
4916 d3d10_device_CreateDepthStencilState
,
4917 d3d10_device_CreateRasterizerState
,
4918 d3d10_device_CreateSamplerState
,
4919 d3d10_device_CreateQuery
,
4920 d3d10_device_CreatePredicate
,
4921 d3d10_device_CreateCounter
,
4922 d3d10_device_CheckFormatSupport
,
4923 d3d10_device_CheckMultisampleQualityLevels
,
4924 d3d10_device_CheckCounterInfo
,
4925 d3d10_device_CheckCounter
,
4926 d3d10_device_GetCreationFlags
,
4927 d3d10_device_OpenSharedResource
,
4928 d3d10_device_SetTextFilterSize
,
4929 d3d10_device_GetTextFilterSize
,
4930 d3d10_device_CreateShaderResourceView1
,
4931 d3d10_device_CreateBlendState1
,
4932 d3d10_device_GetFeatureLevel
,
4935 static const struct IUnknownVtbl d3d_device_inner_unknown_vtbl
=
4937 /* IUnknown methods */
4938 d3d_device_inner_QueryInterface
,
4939 d3d_device_inner_AddRef
,
4940 d3d_device_inner_Release
,
4943 /* ID3D10Multithread methods */
4945 static inline struct d3d_device
*impl_from_ID3D10Multithread(ID3D10Multithread
*iface
)
4947 return CONTAINING_RECORD(iface
, struct d3d_device
, ID3D10Multithread_iface
);
4950 static HRESULT STDMETHODCALLTYPE
d3d10_multithread_QueryInterface(ID3D10Multithread
*iface
, REFIID iid
, void **out
)
4952 struct d3d_device
*device
= impl_from_ID3D10Multithread(iface
);
4954 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
4956 return IUnknown_QueryInterface(device
->outer_unk
, iid
, out
);
4959 static ULONG STDMETHODCALLTYPE
d3d10_multithread_AddRef(ID3D10Multithread
*iface
)
4961 struct d3d_device
*device
= impl_from_ID3D10Multithread(iface
);
4963 TRACE("iface %p.\n", iface
);
4965 return IUnknown_AddRef(device
->outer_unk
);
4968 static ULONG STDMETHODCALLTYPE
d3d10_multithread_Release(ID3D10Multithread
*iface
)
4970 struct d3d_device
*device
= impl_from_ID3D10Multithread(iface
);
4972 TRACE("iface %p.\n", iface
);
4974 return IUnknown_Release(device
->outer_unk
);
4977 static void STDMETHODCALLTYPE
d3d10_multithread_Enter(ID3D10Multithread
*iface
)
4979 TRACE("iface %p.\n", iface
);
4981 wined3d_mutex_lock();
4984 static void STDMETHODCALLTYPE
d3d10_multithread_Leave(ID3D10Multithread
*iface
)
4986 TRACE("iface %p.\n", iface
);
4988 wined3d_mutex_unlock();
4991 static BOOL STDMETHODCALLTYPE
d3d10_multithread_SetMultithreadProtected(ID3D10Multithread
*iface
, BOOL protect
)
4993 FIXME("iface %p, protect %#x stub!\n", iface
, protect
);
4998 static BOOL STDMETHODCALLTYPE
d3d10_multithread_GetMultithreadProtected(ID3D10Multithread
*iface
)
5000 FIXME("iface %p stub!\n", iface
);
5005 static const struct ID3D10MultithreadVtbl d3d10_multithread_vtbl
=
5007 d3d10_multithread_QueryInterface
,
5008 d3d10_multithread_AddRef
,
5009 d3d10_multithread_Release
,
5010 d3d10_multithread_Enter
,
5011 d3d10_multithread_Leave
,
5012 d3d10_multithread_SetMultithreadProtected
,
5013 d3d10_multithread_GetMultithreadProtected
,
5016 /* IWineDXGIDeviceParent IUnknown methods */
5018 static inline struct d3d_device
*device_from_dxgi_device_parent(IWineDXGIDeviceParent
*iface
)
5020 return CONTAINING_RECORD(iface
, struct d3d_device
, IWineDXGIDeviceParent_iface
);
5023 static HRESULT STDMETHODCALLTYPE
dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent
*iface
,
5024 REFIID riid
, void **ppv
)
5026 struct d3d_device
*device
= device_from_dxgi_device_parent(iface
);
5027 return IUnknown_QueryInterface(device
->outer_unk
, riid
, ppv
);
5030 static ULONG STDMETHODCALLTYPE
dxgi_device_parent_AddRef(IWineDXGIDeviceParent
*iface
)
5032 struct d3d_device
*device
= device_from_dxgi_device_parent(iface
);
5033 return IUnknown_AddRef(device
->outer_unk
);
5036 static ULONG STDMETHODCALLTYPE
dxgi_device_parent_Release(IWineDXGIDeviceParent
*iface
)
5038 struct d3d_device
*device
= device_from_dxgi_device_parent(iface
);
5039 return IUnknown_Release(device
->outer_unk
);
5042 static struct wined3d_device_parent
* STDMETHODCALLTYPE
dxgi_device_parent_get_wined3d_device_parent(
5043 IWineDXGIDeviceParent
*iface
)
5045 struct d3d_device
*device
= device_from_dxgi_device_parent(iface
);
5046 return &device
->device_parent
;
5049 static const struct IWineDXGIDeviceParentVtbl d3d_dxgi_device_parent_vtbl
=
5051 /* IUnknown methods */
5052 dxgi_device_parent_QueryInterface
,
5053 dxgi_device_parent_AddRef
,
5054 dxgi_device_parent_Release
,
5055 /* IWineDXGIDeviceParent methods */
5056 dxgi_device_parent_get_wined3d_device_parent
,
5059 static inline struct d3d_device
*device_from_wined3d_device_parent(struct wined3d_device_parent
*device_parent
)
5061 return CONTAINING_RECORD(device_parent
, struct d3d_device
, device_parent
);
5064 static void CDECL
device_parent_wined3d_device_created(struct wined3d_device_parent
*device_parent
,
5065 struct wined3d_device
*wined3d_device
)
5067 struct d3d_device
*device
= device_from_wined3d_device_parent(device_parent
);
5069 TRACE("device_parent %p, wined3d_device %p.\n", device_parent
, wined3d_device
);
5071 wined3d_device_incref(wined3d_device
);
5072 device
->wined3d_device
= wined3d_device
;
5075 static void CDECL
device_parent_mode_changed(struct wined3d_device_parent
*device_parent
)
5077 TRACE("device_parent %p.\n", device_parent
);
5080 static void CDECL
device_parent_activate(struct wined3d_device_parent
*device_parent
, BOOL activate
)
5082 TRACE("device_parent %p, activate %#x.\n", device_parent
, activate
);
5085 static HRESULT CDECL
device_parent_sub_resource_created(struct wined3d_device_parent
*device_parent
,
5086 struct wined3d_texture
*wined3d_texture
, unsigned int sub_resource_idx
, void **parent
,
5087 const struct wined3d_parent_ops
**parent_ops
)
5089 TRACE("device_parent %p, wined3d_texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
5090 device_parent
, wined3d_texture
, sub_resource_idx
, parent
, parent_ops
);
5093 *parent_ops
= &d3d_null_wined3d_parent_ops
;
5098 static HRESULT CDECL
device_parent_create_swapchain_texture(struct wined3d_device_parent
*device_parent
,
5099 void *container_parent
, const struct wined3d_resource_desc
*wined3d_desc
,
5100 struct wined3d_texture
**wined3d_texture
)
5102 struct d3d_device
*device
= device_from_wined3d_device_parent(device_parent
);
5103 struct d3d_texture2d
*texture
;
5104 ID3D10Texture2D
*texture_iface
;
5105 D3D10_TEXTURE2D_DESC desc
;
5108 FIXME("device_parent %p, container_parent %p, wined3d_desc %p, wined3d_texture %p partial stub!\n",
5109 device_parent
, container_parent
, wined3d_desc
, wined3d_texture
);
5111 FIXME("Implement DXGI<->wined3d usage conversion.\n");
5113 desc
.Width
= wined3d_desc
->width
;
5114 desc
.Height
= wined3d_desc
->height
;
5117 desc
.Format
= dxgi_format_from_wined3dformat(wined3d_desc
->format
);
5118 desc
.SampleDesc
.Count
= wined3d_desc
->multisample_type
? wined3d_desc
->multisample_type
: 1;
5119 desc
.SampleDesc
.Quality
= wined3d_desc
->multisample_quality
;
5120 desc
.Usage
= D3D10_USAGE_DEFAULT
;
5121 desc
.BindFlags
= D3D10_BIND_RENDER_TARGET
;
5122 desc
.CPUAccessFlags
= 0;
5125 if (FAILED(hr
= d3d10_device_CreateTexture2D(&device
->ID3D10Device1_iface
,
5126 &desc
, NULL
, &texture_iface
)))
5128 WARN("CreateTexture2D failed, returning %#x.\n", hr
);
5132 texture
= impl_from_ID3D10Texture2D(texture_iface
);
5134 *wined3d_texture
= texture
->wined3d_texture
;
5135 wined3d_texture_incref(*wined3d_texture
);
5136 ID3D10Texture2D_Release(&texture
->ID3D10Texture2D_iface
);
5141 static HRESULT CDECL
device_parent_create_swapchain(struct wined3d_device_parent
*device_parent
,
5142 struct wined3d_swapchain_desc
*desc
, struct wined3d_swapchain
**swapchain
)
5144 struct d3d_device
*device
= device_from_wined3d_device_parent(device_parent
);
5145 IWineDXGIDevice
*wine_device
;
5148 TRACE("device_parent %p, desc %p, swapchain %p.\n", device_parent
, desc
, swapchain
);
5150 if (FAILED(hr
= d3d10_device_QueryInterface(&device
->ID3D10Device1_iface
,
5151 &IID_IWineDXGIDevice
, (void **)&wine_device
)))
5153 ERR("Device should implement IWineDXGIDevice.\n");
5157 hr
= IWineDXGIDevice_create_swapchain(wine_device
, desc
, TRUE
, swapchain
);
5158 IWineDXGIDevice_Release(wine_device
);
5161 ERR("Failed to create DXGI swapchain, returning %#x\n", hr
);
5168 static const struct wined3d_device_parent_ops d3d_wined3d_device_parent_ops
=
5170 device_parent_wined3d_device_created
,
5171 device_parent_mode_changed
,
5172 device_parent_activate
,
5173 device_parent_sub_resource_created
,
5174 device_parent_sub_resource_created
,
5175 device_parent_create_swapchain_texture
,
5176 device_parent_create_swapchain
,
5179 static void *d3d_rb_alloc(size_t size
)
5181 return HeapAlloc(GetProcessHeap(), 0, size
);
5184 static void *d3d_rb_realloc(void *ptr
, size_t size
)
5186 return HeapReAlloc(GetProcessHeap(), 0, ptr
, size
);
5189 static void d3d_rb_free(void *ptr
)
5191 HeapFree(GetProcessHeap(), 0, ptr
);
5194 static int d3d_sampler_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
5196 const D3D11_SAMPLER_DESC
*ka
= key
;
5197 const D3D11_SAMPLER_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
, const struct d3d_sampler_state
, entry
)->desc
;
5199 return memcmp(ka
, kb
, sizeof(*ka
));
5202 static const struct wine_rb_functions d3d_sampler_state_rb_ops
=
5207 d3d_sampler_state_compare
,
5210 static int d3d_blend_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
5212 const D3D11_BLEND_DESC
*ka
= key
;
5213 const D3D11_BLEND_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
, const struct d3d_blend_state
, entry
)->desc
;
5215 return memcmp(ka
, kb
, sizeof(*ka
));
5218 static const struct wine_rb_functions d3d_blend_state_rb_ops
=
5223 d3d_blend_state_compare
,
5226 static int d3d_depthstencil_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
5228 const D3D11_DEPTH_STENCIL_DESC
*ka
= key
;
5229 const D3D11_DEPTH_STENCIL_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
,
5230 const struct d3d_depthstencil_state
, entry
)->desc
;
5232 return memcmp(ka
, kb
, sizeof(*ka
));
5235 static const struct wine_rb_functions d3d_depthstencil_state_rb_ops
=
5240 d3d_depthstencil_state_compare
,
5243 static int d3d_rasterizer_state_compare(const void *key
, const struct wine_rb_entry
*entry
)
5245 const D3D11_RASTERIZER_DESC
*ka
= key
;
5246 const D3D11_RASTERIZER_DESC
*kb
= &WINE_RB_ENTRY_VALUE(entry
, const struct d3d_rasterizer_state
, entry
)->desc
;
5248 return memcmp(ka
, kb
, sizeof(*ka
));
5251 static const struct wine_rb_functions d3d_rasterizer_state_rb_ops
=
5256 d3d_rasterizer_state_compare
,
5259 HRESULT
d3d_device_init(struct d3d_device
*device
, void *outer_unknown
)
5261 device
->IUnknown_inner
.lpVtbl
= &d3d_device_inner_unknown_vtbl
;
5262 device
->ID3D11Device_iface
.lpVtbl
= &d3d11_device_vtbl
;
5263 device
->ID3D10Device1_iface
.lpVtbl
= &d3d10_device1_vtbl
;
5264 device
->ID3D10Multithread_iface
.lpVtbl
= &d3d10_multithread_vtbl
;
5265 device
->IWineDXGIDeviceParent_iface
.lpVtbl
= &d3d_dxgi_device_parent_vtbl
;
5266 device
->device_parent
.ops
= &d3d_wined3d_device_parent_ops
;
5267 device
->refcount
= 1;
5268 /* COM aggregation always takes place */
5269 device
->outer_unk
= outer_unknown
;
5271 d3d11_immediate_context_init(&device
->immediate_context
, device
);
5272 ID3D11DeviceContext_Release(&device
->immediate_context
.ID3D11DeviceContext_iface
);
5274 if (wine_rb_init(&device
->blend_states
, &d3d_blend_state_rb_ops
) == -1)
5276 WARN("Failed to initialize blend state rbtree.\n");
5279 device
->blend_factor
[0] = 1.0f
;
5280 device
->blend_factor
[1] = 1.0f
;
5281 device
->blend_factor
[2] = 1.0f
;
5282 device
->blend_factor
[3] = 1.0f
;
5284 if (wine_rb_init(&device
->depthstencil_states
, &d3d_depthstencil_state_rb_ops
) == -1)
5286 WARN("Failed to initialize depthstencil state rbtree.\n");
5287 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);
5291 if (wine_rb_init(&device
->rasterizer_states
, &d3d_rasterizer_state_rb_ops
) == -1)
5293 WARN("Failed to initialize rasterizer state rbtree.\n");
5294 wine_rb_destroy(&device
->depthstencil_states
, NULL
, NULL
);
5295 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);
5299 if (wine_rb_init(&device
->sampler_states
, &d3d_sampler_state_rb_ops
) == -1)
5301 WARN("Failed to initialize sampler state rbtree.\n");
5302 wine_rb_destroy(&device
->rasterizer_states
, NULL
, NULL
);
5303 wine_rb_destroy(&device
->depthstencil_states
, NULL
, NULL
);
5304 wine_rb_destroy(&device
->blend_states
, NULL
, NULL
);