2 * Copyright 2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/port.h"
23 #include "d3d10core_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core
);
27 #define D3D10_FILTER_MIP_MASK 0x01
28 #define D3D10_FILTER_MAG_MASK 0x04
29 #define D3D10_FILTER_MIN_MASK 0x10
30 #define D3D10_FILTER_ANISO_MASK 0x40
31 #define D3D10_FILTER_COMPARE_MASK 0x80
33 static inline struct d3d10_blend_state
*impl_from_ID3D10BlendState(ID3D10BlendState
*iface
)
35 return CONTAINING_RECORD(iface
, struct d3d10_blend_state
, ID3D10BlendState_iface
);
38 /* IUnknown methods */
40 static HRESULT STDMETHODCALLTYPE
d3d10_blend_state_QueryInterface(ID3D10BlendState
*iface
,
41 REFIID riid
, void **object
)
43 TRACE("iface %p, riid %s, object %p.\n", iface
, debugstr_guid(riid
), object
);
45 if (IsEqualGUID(riid
, &IID_ID3D10BlendState
)
46 || IsEqualGUID(riid
, &IID_ID3D10DeviceChild
)
47 || IsEqualGUID(riid
, &IID_IUnknown
))
49 IUnknown_AddRef(iface
);
54 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
60 static ULONG STDMETHODCALLTYPE
d3d10_blend_state_AddRef(ID3D10BlendState
*iface
)
62 struct d3d10_blend_state
*This
= impl_from_ID3D10BlendState(iface
);
63 ULONG refcount
= InterlockedIncrement(&This
->refcount
);
65 TRACE("%p increasing refcount to %u.\n", This
, refcount
);
70 static ULONG STDMETHODCALLTYPE
d3d10_blend_state_Release(ID3D10BlendState
*iface
)
72 struct d3d10_blend_state
*state
= impl_from_ID3D10BlendState(iface
);
73 ULONG refcount
= InterlockedDecrement(&state
->refcount
);
75 TRACE("%p decreasing refcount to %u.\n", state
, refcount
);
79 struct d3d10_device
*device
= impl_from_ID3D10Device(state
->device
);
80 wine_rb_remove(&device
->blend_states
, &state
->desc
);
81 ID3D10Device1_Release(state
->device
);
82 wined3d_private_store_cleanup(&state
->private_store
);
83 HeapFree(GetProcessHeap(), 0, state
);
89 /* ID3D10DeviceChild methods */
91 static void STDMETHODCALLTYPE
d3d10_blend_state_GetDevice(ID3D10BlendState
*iface
, ID3D10Device
**device
)
93 struct d3d10_blend_state
*state
= impl_from_ID3D10BlendState(iface
);
95 TRACE("iface %p, device %p.\n", iface
, device
);
97 *device
= (ID3D10Device
*)state
->device
;
98 ID3D10Device_AddRef(*device
);
101 static HRESULT STDMETHODCALLTYPE
d3d10_blend_state_GetPrivateData(ID3D10BlendState
*iface
,
102 REFGUID guid
, UINT
*data_size
, void *data
)
104 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
105 iface
, debugstr_guid(guid
), data_size
, data
);
110 static HRESULT STDMETHODCALLTYPE
d3d10_blend_state_SetPrivateData(ID3D10BlendState
*iface
,
111 REFGUID guid
, UINT data_size
, const void *data
)
113 struct d3d10_blend_state
*state
= impl_from_ID3D10BlendState(iface
);
115 TRACE("iface %p, guid %s, data_size %u, data %p.\n",
116 iface
, debugstr_guid(guid
), data_size
, data
);
118 return d3d10_set_private_data(&state
->private_store
, guid
, data_size
, data
);
121 static HRESULT STDMETHODCALLTYPE
d3d10_blend_state_SetPrivateDataInterface(ID3D10BlendState
*iface
,
122 REFGUID guid
, const IUnknown
*data
)
124 struct d3d10_blend_state
*state
= impl_from_ID3D10BlendState(iface
);
126 TRACE("iface %p, guid %s, data %p.\n", iface
, debugstr_guid(guid
), data
);
128 return d3d10_set_private_data_interface(&state
->private_store
, guid
, data
);
131 /* ID3D10BlendState methods */
133 static void STDMETHODCALLTYPE
d3d10_blend_state_GetDesc(ID3D10BlendState
*iface
,
134 D3D10_BLEND_DESC
*desc
)
136 struct d3d10_blend_state
*state
= impl_from_ID3D10BlendState(iface
);
138 TRACE("iface %p, desc %p.\n", iface
, desc
);
143 static const struct ID3D10BlendStateVtbl d3d10_blend_state_vtbl
=
145 /* IUnknown methods */
146 d3d10_blend_state_QueryInterface
,
147 d3d10_blend_state_AddRef
,
148 d3d10_blend_state_Release
,
149 /* ID3D10DeviceChild methods */
150 d3d10_blend_state_GetDevice
,
151 d3d10_blend_state_GetPrivateData
,
152 d3d10_blend_state_SetPrivateData
,
153 d3d10_blend_state_SetPrivateDataInterface
,
154 /* ID3D10BlendState methods */
155 d3d10_blend_state_GetDesc
,
158 HRESULT
d3d10_blend_state_init(struct d3d10_blend_state
*state
, struct d3d10_device
*device
,
159 const D3D10_BLEND_DESC
*desc
)
161 state
->ID3D10BlendState_iface
.lpVtbl
= &d3d10_blend_state_vtbl
;
163 wined3d_private_store_init(&state
->private_store
);
166 if (wine_rb_put(&device
->blend_states
, desc
, &state
->entry
) == -1)
168 ERR("Failed to insert blend state entry.\n");
169 wined3d_private_store_cleanup(&state
->private_store
);
173 state
->device
= &device
->ID3D10Device1_iface
;
174 ID3D10Device1_AddRef(state
->device
);
179 struct d3d10_blend_state
*unsafe_impl_from_ID3D10BlendState(ID3D10BlendState
*iface
)
183 assert(iface
->lpVtbl
== &d3d10_blend_state_vtbl
);
185 return impl_from_ID3D10BlendState(iface
);
188 static inline struct d3d10_depthstencil_state
*impl_from_ID3D10DepthStencilState(ID3D10DepthStencilState
*iface
)
190 return CONTAINING_RECORD(iface
, struct d3d10_depthstencil_state
, ID3D10DepthStencilState_iface
);
193 /* IUnknown methods */
195 static HRESULT STDMETHODCALLTYPE
d3d10_depthstencil_state_QueryInterface(ID3D10DepthStencilState
*iface
,
196 REFIID riid
, void **object
)
198 TRACE("iface %p, riid %s, object %p.\n", iface
, debugstr_guid(riid
), object
);
200 if (IsEqualGUID(riid
, &IID_ID3D10DepthStencilState
)
201 || IsEqualGUID(riid
, &IID_ID3D10DeviceChild
)
202 || IsEqualGUID(riid
, &IID_IUnknown
))
204 IUnknown_AddRef(iface
);
209 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
212 return E_NOINTERFACE
;
215 static ULONG STDMETHODCALLTYPE
d3d10_depthstencil_state_AddRef(ID3D10DepthStencilState
*iface
)
217 struct d3d10_depthstencil_state
*This
= impl_from_ID3D10DepthStencilState(iface
);
218 ULONG refcount
= InterlockedIncrement(&This
->refcount
);
220 TRACE("%p increasing refcount to %u.\n", This
, refcount
);
225 static ULONG STDMETHODCALLTYPE
d3d10_depthstencil_state_Release(ID3D10DepthStencilState
*iface
)
227 struct d3d10_depthstencil_state
*state
= impl_from_ID3D10DepthStencilState(iface
);
228 ULONG refcount
= InterlockedDecrement(&state
->refcount
);
230 TRACE("%p decreasing refcount to %u.\n", state
, refcount
);
234 struct d3d10_device
*device
= impl_from_ID3D10Device(state
->device
);
235 wine_rb_remove(&device
->depthstencil_states
, &state
->desc
);
236 ID3D10Device1_Release(state
->device
);
237 HeapFree(GetProcessHeap(), 0, state
);
243 /* ID3D10DeviceChild methods */
245 static void STDMETHODCALLTYPE
d3d10_depthstencil_state_GetDevice(ID3D10DepthStencilState
*iface
, ID3D10Device
**device
)
247 struct d3d10_depthstencil_state
*state
= impl_from_ID3D10DepthStencilState(iface
);
249 TRACE("iface %p, device %p.\n", iface
, device
);
251 *device
= (ID3D10Device
*)state
->device
;
252 ID3D10Device_AddRef(*device
);
255 static HRESULT STDMETHODCALLTYPE
d3d10_depthstencil_state_GetPrivateData(ID3D10DepthStencilState
*iface
,
256 REFGUID guid
, UINT
*data_size
, void *data
)
258 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
259 iface
, debugstr_guid(guid
), data_size
, data
);
264 static HRESULT STDMETHODCALLTYPE
d3d10_depthstencil_state_SetPrivateData(ID3D10DepthStencilState
*iface
,
265 REFGUID guid
, UINT data_size
, const void *data
)
267 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
268 iface
, debugstr_guid(guid
), data_size
, data
);
273 static HRESULT STDMETHODCALLTYPE
d3d10_depthstencil_state_SetPrivateDataInterface(ID3D10DepthStencilState
*iface
,
274 REFGUID guid
, const IUnknown
*data
)
276 FIXME("iface %p, guid %s, data %p stub!\n", iface
, debugstr_guid(guid
), data
);
281 /* ID3D10DepthStencilState methods */
283 static void STDMETHODCALLTYPE
d3d10_depthstencil_state_GetDesc(ID3D10DepthStencilState
*iface
,
284 D3D10_DEPTH_STENCIL_DESC
*desc
)
286 struct d3d10_depthstencil_state
*state
= impl_from_ID3D10DepthStencilState(iface
);
288 TRACE("iface %p, desc %p.\n", iface
, desc
);
293 static const struct ID3D10DepthStencilStateVtbl d3d10_depthstencil_state_vtbl
=
295 /* IUnknown methods */
296 d3d10_depthstencil_state_QueryInterface
,
297 d3d10_depthstencil_state_AddRef
,
298 d3d10_depthstencil_state_Release
,
299 /* ID3D10DeviceChild methods */
300 d3d10_depthstencil_state_GetDevice
,
301 d3d10_depthstencil_state_GetPrivateData
,
302 d3d10_depthstencil_state_SetPrivateData
,
303 d3d10_depthstencil_state_SetPrivateDataInterface
,
304 /* ID3D10DepthStencilState methods */
305 d3d10_depthstencil_state_GetDesc
,
308 HRESULT
d3d10_depthstencil_state_init(struct d3d10_depthstencil_state
*state
, struct d3d10_device
*device
,
309 const D3D10_DEPTH_STENCIL_DESC
*desc
)
311 state
->ID3D10DepthStencilState_iface
.lpVtbl
= &d3d10_depthstencil_state_vtbl
;
315 if (wine_rb_put(&device
->depthstencil_states
, desc
, &state
->entry
) == -1)
317 ERR("Failed to insert depthstencil state entry.\n");
321 state
->device
= &device
->ID3D10Device1_iface
;
322 ID3D10Device1_AddRef(state
->device
);
327 struct d3d10_depthstencil_state
*unsafe_impl_from_ID3D10DepthStencilState(ID3D10DepthStencilState
*iface
)
331 assert(iface
->lpVtbl
== &d3d10_depthstencil_state_vtbl
);
333 return impl_from_ID3D10DepthStencilState(iface
);
336 static inline struct d3d10_rasterizer_state
*impl_from_ID3D10RasterizerState(ID3D10RasterizerState
*iface
)
338 return CONTAINING_RECORD(iface
, struct d3d10_rasterizer_state
, ID3D10RasterizerState_iface
);
341 /* IUnknown methods */
343 static HRESULT STDMETHODCALLTYPE
d3d10_rasterizer_state_QueryInterface(ID3D10RasterizerState
*iface
,
344 REFIID riid
, void **object
)
346 TRACE("iface %p, riid %s, object %p.\n", iface
, debugstr_guid(riid
), object
);
348 if (IsEqualGUID(riid
, &IID_ID3D10RasterizerState
)
349 || IsEqualGUID(riid
, &IID_ID3D10DeviceChild
)
350 || IsEqualGUID(riid
, &IID_IUnknown
))
352 IUnknown_AddRef(iface
);
357 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
360 return E_NOINTERFACE
;
363 static ULONG STDMETHODCALLTYPE
d3d10_rasterizer_state_AddRef(ID3D10RasterizerState
*iface
)
365 struct d3d10_rasterizer_state
*This
= impl_from_ID3D10RasterizerState(iface
);
366 ULONG refcount
= InterlockedIncrement(&This
->refcount
);
368 TRACE("%p increasing refcount to %u.\n", This
, refcount
);
373 static ULONG STDMETHODCALLTYPE
d3d10_rasterizer_state_Release(ID3D10RasterizerState
*iface
)
375 struct d3d10_rasterizer_state
*state
= impl_from_ID3D10RasterizerState(iface
);
376 ULONG refcount
= InterlockedDecrement(&state
->refcount
);
378 TRACE("%p decreasing refcount to %u.\n", state
, refcount
);
382 struct d3d10_device
*device
= impl_from_ID3D10Device(state
->device
);
383 wine_rb_remove(&device
->rasterizer_states
, &state
->desc
);
384 ID3D10Device1_Release(state
->device
);
385 HeapFree(GetProcessHeap(), 0, state
);
391 /* ID3D10DeviceChild methods */
393 static void STDMETHODCALLTYPE
d3d10_rasterizer_state_GetDevice(ID3D10RasterizerState
*iface
, ID3D10Device
**device
)
395 struct d3d10_rasterizer_state
*state
= impl_from_ID3D10RasterizerState(iface
);
397 TRACE("iface %p, device %p.\n", iface
, device
);
399 *device
= (ID3D10Device
*)state
->device
;
400 ID3D10Device_AddRef(*device
);
403 static HRESULT STDMETHODCALLTYPE
d3d10_rasterizer_state_GetPrivateData(ID3D10RasterizerState
*iface
,
404 REFGUID guid
, UINT
*data_size
, void *data
)
406 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
407 iface
, debugstr_guid(guid
), data_size
, data
);
412 static HRESULT STDMETHODCALLTYPE
d3d10_rasterizer_state_SetPrivateData(ID3D10RasterizerState
*iface
,
413 REFGUID guid
, UINT data_size
, const void *data
)
415 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
416 iface
, debugstr_guid(guid
), data_size
, data
);
421 static HRESULT STDMETHODCALLTYPE
d3d10_rasterizer_state_SetPrivateDataInterface(ID3D10RasterizerState
*iface
,
422 REFGUID guid
, const IUnknown
*data
)
424 FIXME("iface %p, guid %s, data %p stub!\n", iface
, debugstr_guid(guid
), data
);
429 /* ID3D10RasterizerState methods */
431 static void STDMETHODCALLTYPE
d3d10_rasterizer_state_GetDesc(ID3D10RasterizerState
*iface
,
432 D3D10_RASTERIZER_DESC
*desc
)
434 struct d3d10_rasterizer_state
*state
= impl_from_ID3D10RasterizerState(iface
);
436 TRACE("iface %p, desc %p.\n", iface
, desc
);
441 static const struct ID3D10RasterizerStateVtbl d3d10_rasterizer_state_vtbl
=
443 /* IUnknown methods */
444 d3d10_rasterizer_state_QueryInterface
,
445 d3d10_rasterizer_state_AddRef
,
446 d3d10_rasterizer_state_Release
,
447 /* ID3D10DeviceChild methods */
448 d3d10_rasterizer_state_GetDevice
,
449 d3d10_rasterizer_state_GetPrivateData
,
450 d3d10_rasterizer_state_SetPrivateData
,
451 d3d10_rasterizer_state_SetPrivateDataInterface
,
452 /* ID3D10RasterizerState methods */
453 d3d10_rasterizer_state_GetDesc
,
456 HRESULT
d3d10_rasterizer_state_init(struct d3d10_rasterizer_state
*state
, struct d3d10_device
*device
,
457 const D3D10_RASTERIZER_DESC
*desc
)
459 state
->ID3D10RasterizerState_iface
.lpVtbl
= &d3d10_rasterizer_state_vtbl
;
463 if (wine_rb_put(&device
->rasterizer_states
, desc
, &state
->entry
) == -1)
465 ERR("Failed to insert rasterizer state entry.\n");
469 state
->device
= &device
->ID3D10Device1_iface
;
470 ID3D10Device1_AddRef(state
->device
);
475 struct d3d10_rasterizer_state
*unsafe_impl_from_ID3D10RasterizerState(ID3D10RasterizerState
*iface
)
479 assert(iface
->lpVtbl
== &d3d10_rasterizer_state_vtbl
);
481 return impl_from_ID3D10RasterizerState(iface
);
484 static inline struct d3d10_sampler_state
*impl_from_ID3D10SamplerState(ID3D10SamplerState
*iface
)
486 return CONTAINING_RECORD(iface
, struct d3d10_sampler_state
, ID3D10SamplerState_iface
);
489 /* IUnknown methods */
491 static HRESULT STDMETHODCALLTYPE
d3d10_sampler_state_QueryInterface(ID3D10SamplerState
*iface
,
492 REFIID riid
, void **object
)
494 TRACE("iface %p, riid %s, object %p.\n", iface
, debugstr_guid(riid
), object
);
496 if (IsEqualGUID(riid
, &IID_ID3D10SamplerState
)
497 || IsEqualGUID(riid
, &IID_ID3D10DeviceChild
)
498 || IsEqualGUID(riid
, &IID_IUnknown
))
500 IUnknown_AddRef(iface
);
505 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
508 return E_NOINTERFACE
;
511 static ULONG STDMETHODCALLTYPE
d3d10_sampler_state_AddRef(ID3D10SamplerState
*iface
)
513 struct d3d10_sampler_state
*This
= impl_from_ID3D10SamplerState(iface
);
514 ULONG refcount
= InterlockedIncrement(&This
->refcount
);
516 TRACE("%p increasing refcount to %u.\n", This
, refcount
);
521 static ULONG STDMETHODCALLTYPE
d3d10_sampler_state_Release(ID3D10SamplerState
*iface
)
523 struct d3d10_sampler_state
*state
= impl_from_ID3D10SamplerState(iface
);
524 ULONG refcount
= InterlockedDecrement(&state
->refcount
);
526 TRACE("%p decreasing refcount to %u.\n", state
, refcount
);
530 struct d3d10_device
*device
= impl_from_ID3D10Device(state
->device
);
532 wined3d_sampler_decref(state
->wined3d_sampler
);
533 wine_rb_remove(&device
->sampler_states
, &state
->desc
);
534 ID3D10Device1_Release(state
->device
);
535 HeapFree(GetProcessHeap(), 0, state
);
541 /* ID3D10DeviceChild methods */
543 static void STDMETHODCALLTYPE
d3d10_sampler_state_GetDevice(ID3D10SamplerState
*iface
, ID3D10Device
**device
)
545 struct d3d10_sampler_state
*state
= impl_from_ID3D10SamplerState(iface
);
547 TRACE("iface %p, device %p.\n", iface
, device
);
549 *device
= (ID3D10Device
*)state
->device
;
550 ID3D10Device_AddRef(*device
);
553 static HRESULT STDMETHODCALLTYPE
d3d10_sampler_state_GetPrivateData(ID3D10SamplerState
*iface
,
554 REFGUID guid
, UINT
*data_size
, void *data
)
556 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
557 iface
, debugstr_guid(guid
), data_size
, data
);
562 static HRESULT STDMETHODCALLTYPE
d3d10_sampler_state_SetPrivateData(ID3D10SamplerState
*iface
,
563 REFGUID guid
, UINT data_size
, const void *data
)
565 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
566 iface
, debugstr_guid(guid
), data_size
, data
);
571 static HRESULT STDMETHODCALLTYPE
d3d10_sampler_state_SetPrivateDataInterface(ID3D10SamplerState
*iface
,
572 REFGUID guid
, const IUnknown
*data
)
574 FIXME("iface %p, guid %s, data %p stub!\n", iface
, debugstr_guid(guid
), data
);
579 /* ID3D10SamplerState methods */
581 static void STDMETHODCALLTYPE
d3d10_sampler_state_GetDesc(ID3D10SamplerState
*iface
,
582 D3D10_SAMPLER_DESC
*desc
)
584 struct d3d10_sampler_state
*state
= impl_from_ID3D10SamplerState(iface
);
586 TRACE("iface %p, desc %p.\n", iface
, desc
);
591 static const struct ID3D10SamplerStateVtbl d3d10_sampler_state_vtbl
=
593 /* IUnknown methods */
594 d3d10_sampler_state_QueryInterface
,
595 d3d10_sampler_state_AddRef
,
596 d3d10_sampler_state_Release
,
597 /* ID3D10DeviceChild methods */
598 d3d10_sampler_state_GetDevice
,
599 d3d10_sampler_state_GetPrivateData
,
600 d3d10_sampler_state_SetPrivateData
,
601 d3d10_sampler_state_SetPrivateDataInterface
,
602 /* ID3D10SamplerState methods */
603 d3d10_sampler_state_GetDesc
,
606 static enum wined3d_texture_address
wined3d_texture_address_from_d3d10core(enum D3D10_TEXTURE_ADDRESS_MODE t
)
608 return (enum wined3d_texture_address
)t
;
611 static enum wined3d_texture_filter_type
wined3d_texture_filter_mip_from_d3d10core(enum D3D10_FILTER f
)
613 if (f
& D3D10_FILTER_MIP_MASK
)
614 return WINED3D_TEXF_LINEAR
;
615 return WINED3D_TEXF_POINT
;
618 static enum wined3d_texture_filter_type
wined3d_texture_filter_mag_from_d3d10core(enum D3D10_FILTER f
)
620 if (f
& D3D10_FILTER_MAG_MASK
)
621 return WINED3D_TEXF_LINEAR
;
622 return WINED3D_TEXF_POINT
;
625 static enum wined3d_texture_filter_type
wined3d_texture_filter_min_from_d3d10core(enum D3D10_FILTER f
)
627 if (f
& D3D10_FILTER_MIN_MASK
)
628 return WINED3D_TEXF_LINEAR
;
629 return WINED3D_TEXF_POINT
;
632 static BOOL
wined3d_texture_compare_from_d3d10core(enum D3D10_FILTER f
)
634 return f
& D3D10_FILTER_COMPARE_MASK
;
637 static enum wined3d_cmp_func
wined3d_cmp_func_from_d3d10core(D3D10_COMPARISON_FUNC f
)
639 return (enum wined3d_cmp_func
)f
;
642 HRESULT
d3d10_sampler_state_init(struct d3d10_sampler_state
*state
, struct d3d10_device
*device
,
643 const D3D10_SAMPLER_DESC
*desc
)
645 struct wined3d_sampler_desc wined3d_desc
;
648 state
->ID3D10SamplerState_iface
.lpVtbl
= &d3d10_sampler_state_vtbl
;
652 wined3d_desc
.address_u
= wined3d_texture_address_from_d3d10core(desc
->AddressU
);
653 wined3d_desc
.address_v
= wined3d_texture_address_from_d3d10core(desc
->AddressV
);
654 wined3d_desc
.address_w
= wined3d_texture_address_from_d3d10core(desc
->AddressW
);
655 memcpy(wined3d_desc
.border_color
, desc
->BorderColor
, sizeof(wined3d_desc
.border_color
));
656 wined3d_desc
.mag_filter
= wined3d_texture_filter_mag_from_d3d10core(desc
->Filter
);
657 wined3d_desc
.min_filter
= wined3d_texture_filter_min_from_d3d10core(desc
->Filter
);
658 wined3d_desc
.mip_filter
= wined3d_texture_filter_mip_from_d3d10core(desc
->Filter
);
659 wined3d_desc
.lod_bias
= desc
->MipLODBias
;
660 wined3d_desc
.min_lod
= desc
->MinLOD
;
661 wined3d_desc
.max_lod
= desc
->MaxLOD
;
662 wined3d_desc
.max_anisotropy
= desc
->Filter
& D3D10_FILTER_ANISO_MASK
? desc
->MaxAnisotropy
: 1;
663 wined3d_desc
.compare
= wined3d_texture_compare_from_d3d10core(desc
->Filter
);
664 wined3d_desc
.comparison_func
= wined3d_cmp_func_from_d3d10core(desc
->ComparisonFunc
);
665 wined3d_desc
.srgb_decode
= FALSE
;
667 if (FAILED(hr
= wined3d_sampler_create(device
->wined3d_device
, &wined3d_desc
, state
, &state
->wined3d_sampler
)))
669 WARN("Failed to create wined3d sampler, hr %#x.\n", hr
);
673 if (wine_rb_put(&device
->sampler_states
, desc
, &state
->entry
) == -1)
675 ERR("Failed to insert sampler state entry.\n");
676 wined3d_sampler_decref(state
->wined3d_sampler
);
680 state
->device
= &device
->ID3D10Device1_iface
;
681 ID3D10Device1_AddRef(state
->device
);
686 struct d3d10_sampler_state
*unsafe_impl_from_ID3D10SamplerState(ID3D10SamplerState
*iface
)
690 assert(iface
->lpVtbl
== &d3d10_sampler_state_vtbl
);
692 return impl_from_ID3D10SamplerState(iface
);