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
20 #include "wine/port.h"
22 #include "dxgi_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(dxgi
);
26 static inline DXGI_MODE_SCANLINE_ORDER
dxgi_mode_scanline_order_from_wined3d(enum wined3d_scanline_ordering ordering
)
28 return (DXGI_MODE_SCANLINE_ORDER
)ordering
;
31 static void dxgi_mode_from_wined3d(DXGI_MODE_DESC
*mode
, const struct wined3d_display_mode
*wined3d_mode
)
33 mode
->Width
= wined3d_mode
->width
;
34 mode
->Height
= wined3d_mode
->height
;
35 mode
->RefreshRate
.Numerator
= wined3d_mode
->refresh_rate
;
36 mode
->RefreshRate
.Denominator
= 1;
37 mode
->Format
= dxgi_format_from_wined3dformat(wined3d_mode
->format_id
);
38 mode
->ScanlineOrdering
= dxgi_mode_scanline_order_from_wined3d(wined3d_mode
->scanline_ordering
);
39 mode
->Scaling
= DXGI_MODE_SCALING_UNSPECIFIED
; /* FIXME */
42 static void dxgi_mode1_from_wined3d(DXGI_MODE_DESC1
*mode
, const struct wined3d_display_mode
*wined3d_mode
)
44 mode
->Width
= wined3d_mode
->width
;
45 mode
->Height
= wined3d_mode
->height
;
46 mode
->RefreshRate
.Numerator
= wined3d_mode
->refresh_rate
;
47 mode
->RefreshRate
.Denominator
= 1;
48 mode
->Format
= dxgi_format_from_wined3dformat(wined3d_mode
->format_id
);
49 mode
->ScanlineOrdering
= dxgi_mode_scanline_order_from_wined3d(wined3d_mode
->scanline_ordering
);
50 mode
->Scaling
= DXGI_MODE_SCALING_UNSPECIFIED
; /* FIXME */
51 mode
->Stereo
= FALSE
; /* FIXME */
54 static HRESULT
dxgi_output_find_closest_matching_mode(struct dxgi_output
*output
,
55 struct wined3d_display_mode
*mode
, IUnknown
*device
)
59 if (!mode
->width
!= !mode
->height
)
60 return DXGI_ERROR_INVALID_CALL
;
62 if (mode
->format_id
== WINED3DFMT_UNKNOWN
&& !device
)
63 return DXGI_ERROR_INVALID_CALL
;
65 if (mode
->format_id
== WINED3DFMT_UNKNOWN
)
67 FIXME("Matching formats to device not implemented.\n");
72 hr
= wined3d_output_find_closest_matching_mode(output
->wined3d_output
, mode
);
73 wined3d_mutex_unlock();
78 static int dxgi_mode_desc_compare(const void *l
, const void *r
)
80 const DXGI_MODE_DESC
*left
= l
, *right
= r
;
83 if (left
->Width
!= right
->Width
)
84 return left
->Width
- right
->Width
;
86 if (left
->Height
!= right
->Height
)
87 return left
->Height
- right
->Height
;
89 a
= left
->RefreshRate
.Numerator
* right
->RefreshRate
.Denominator
;
90 b
= right
->RefreshRate
.Numerator
* left
->RefreshRate
.Denominator
;
97 enum dxgi_mode_struct_version
99 DXGI_MODE_STRUCT_VERSION_0
,
100 DXGI_MODE_STRUCT_VERSION_1
,
103 static HRESULT
dxgi_output_get_display_mode_list(struct dxgi_output
*output
,
104 DXGI_FORMAT format
, unsigned int *mode_count
, void *modes
,
105 enum dxgi_mode_struct_version struct_version
)
107 enum wined3d_format_id wined3d_format
;
108 struct wined3d_display_mode mode
;
109 unsigned int i
, max_count
;
113 return DXGI_ERROR_INVALID_CALL
;
115 if (format
== DXGI_FORMAT_UNKNOWN
)
121 wined3d_format
= wined3dformat_from_dxgi_format(format
);
123 wined3d_mutex_lock();
124 max_count
= wined3d_output_get_mode_count(output
->wined3d_output
,
125 wined3d_format
, WINED3D_SCANLINE_ORDERING_UNKNOWN
);
129 wined3d_mutex_unlock();
130 *mode_count
= max_count
;
134 if (max_count
> *mode_count
)
136 wined3d_mutex_unlock();
137 return DXGI_ERROR_MORE_DATA
;
140 *mode_count
= max_count
;
142 for (i
= 0; i
< *mode_count
; ++i
)
144 if (FAILED(hr
= wined3d_output_get_mode(output
->wined3d_output
, wined3d_format
,
145 WINED3D_SCANLINE_ORDERING_UNKNOWN
, i
, &mode
)))
147 WARN("Failed to get output mode %u, hr %#x.\n", i
, hr
);
148 wined3d_mutex_unlock();
152 switch (struct_version
)
154 case DXGI_MODE_STRUCT_VERSION_0
:
156 DXGI_MODE_DESC
*desc
= modes
;
157 dxgi_mode_from_wined3d(&desc
[i
], &mode
);
161 case DXGI_MODE_STRUCT_VERSION_1
:
163 DXGI_MODE_DESC1
*desc
= modes
;
164 dxgi_mode1_from_wined3d(&desc
[i
], &mode
);
169 wined3d_mutex_unlock();
171 switch (struct_version
)
173 case DXGI_MODE_STRUCT_VERSION_0
:
174 qsort(modes
, *mode_count
, sizeof(DXGI_MODE_DESC
), dxgi_mode_desc_compare
);
176 case DXGI_MODE_STRUCT_VERSION_1
:
177 qsort(modes
, *mode_count
, sizeof(DXGI_MODE_DESC1
), dxgi_mode_desc_compare
);
184 static inline struct dxgi_output
*impl_from_IDXGIOutput6(IDXGIOutput6
*iface
)
186 return CONTAINING_RECORD(iface
, struct dxgi_output
, IDXGIOutput6_iface
);
189 /* IUnknown methods */
191 static HRESULT STDMETHODCALLTYPE
dxgi_output_QueryInterface(IDXGIOutput6
*iface
, REFIID iid
, void **object
)
193 TRACE("iface %p, iid %s, object %p.\n", iface
, debugstr_guid(iid
), object
);
195 if (IsEqualGUID(iid
, &IID_IDXGIOutput6
)
196 || IsEqualGUID(iid
, &IID_IDXGIOutput5
)
197 || IsEqualGUID(iid
, &IID_IDXGIOutput4
)
198 || IsEqualGUID(iid
, &IID_IDXGIOutput3
)
199 || IsEqualGUID(iid
, &IID_IDXGIOutput2
)
200 || IsEqualGUID(iid
, &IID_IDXGIOutput1
)
201 || IsEqualGUID(iid
, &IID_IDXGIOutput
)
202 || IsEqualGUID(iid
, &IID_IDXGIObject
)
203 || IsEqualGUID(iid
, &IID_IUnknown
))
205 IUnknown_AddRef(iface
);
210 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
213 return E_NOINTERFACE
;
216 static ULONG STDMETHODCALLTYPE
dxgi_output_AddRef(IDXGIOutput6
*iface
)
218 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
219 ULONG refcount
= InterlockedIncrement(&output
->refcount
);
221 TRACE("%p increasing refcount to %u.\n", output
, refcount
);
226 static ULONG STDMETHODCALLTYPE
dxgi_output_Release(IDXGIOutput6
*iface
)
228 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
229 ULONG refcount
= InterlockedDecrement(&output
->refcount
);
231 TRACE("%p decreasing refcount to %u.\n", output
, refcount
);
235 wined3d_private_store_cleanup(&output
->private_store
);
236 IWineDXGIAdapter_Release(&output
->adapter
->IWineDXGIAdapter_iface
);
243 /* IDXGIObject methods */
245 static HRESULT STDMETHODCALLTYPE
dxgi_output_SetPrivateData(IDXGIOutput6
*iface
,
246 REFGUID guid
, UINT data_size
, const void *data
)
248 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
250 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
252 return dxgi_set_private_data(&output
->private_store
, guid
, data_size
, data
);
255 static HRESULT STDMETHODCALLTYPE
dxgi_output_SetPrivateDataInterface(IDXGIOutput6
*iface
,
256 REFGUID guid
, const IUnknown
*object
)
258 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
260 TRACE("iface %p, guid %s, object %p.\n", iface
, debugstr_guid(guid
), object
);
262 return dxgi_set_private_data_interface(&output
->private_store
, guid
, object
);
265 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetPrivateData(IDXGIOutput6
*iface
,
266 REFGUID guid
, UINT
*data_size
, void *data
)
268 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
270 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface
, debugstr_guid(guid
), data_size
, data
);
272 return dxgi_get_private_data(&output
->private_store
, guid
, data_size
, data
);
275 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetParent(IDXGIOutput6
*iface
,
276 REFIID riid
, void **parent
)
278 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
280 TRACE("iface %p, riid %s, parent %p.\n", iface
, debugstr_guid(riid
), parent
);
282 return IWineDXGIAdapter_QueryInterface(&output
->adapter
->IWineDXGIAdapter_iface
, riid
, parent
);
285 /* IDXGIOutput methods */
287 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetDesc(IDXGIOutput6
*iface
, DXGI_OUTPUT_DESC
*desc
)
289 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
290 struct wined3d_output_desc wined3d_desc
;
293 TRACE("iface %p, desc %p.\n", iface
, desc
);
298 wined3d_mutex_lock();
299 hr
= wined3d_output_get_desc(output
->wined3d_output
, &wined3d_desc
);
300 wined3d_mutex_unlock();
304 WARN("Failed to get output desc, hr %#x.\n", hr
);
308 memcpy(desc
->DeviceName
, wined3d_desc
.device_name
, sizeof(desc
->DeviceName
));
309 desc
->DesktopCoordinates
= wined3d_desc
.desktop_rect
;
310 desc
->AttachedToDesktop
= wined3d_desc
.attached_to_desktop
;
311 desc
->Rotation
= wined3d_desc
.rotation
;
312 desc
->Monitor
= wined3d_desc
.monitor
;
317 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetDisplayModeList(IDXGIOutput6
*iface
,
318 DXGI_FORMAT format
, UINT flags
, UINT
*mode_count
, DXGI_MODE_DESC
*modes
)
320 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
322 FIXME("iface %p, format %s, flags %#x, mode_count %p, modes %p partial stub!\n",
323 iface
, debug_dxgi_format(format
), flags
, mode_count
, modes
);
325 return dxgi_output_get_display_mode_list(output
,
326 format
, mode_count
, modes
, DXGI_MODE_STRUCT_VERSION_0
);
329 static HRESULT STDMETHODCALLTYPE
dxgi_output_FindClosestMatchingMode(IDXGIOutput6
*iface
,
330 const DXGI_MODE_DESC
*mode
, DXGI_MODE_DESC
*closest_match
, IUnknown
*device
)
332 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
333 struct wined3d_display_mode wined3d_mode
;
336 TRACE("iface %p, mode %p, closest_match %p, device %p.\n",
337 iface
, mode
, closest_match
, device
);
339 TRACE("Mode: %s.\n", debug_dxgi_mode(mode
));
341 wined3d_display_mode_from_dxgi(&wined3d_mode
, mode
);
342 hr
= dxgi_output_find_closest_matching_mode(output
, &wined3d_mode
, device
);
345 dxgi_mode_from_wined3d(closest_match
, &wined3d_mode
);
346 TRACE("Returning %s.\n", debug_dxgi_mode(closest_match
));
352 static HRESULT STDMETHODCALLTYPE
dxgi_output_WaitForVBlank(IDXGIOutput6
*iface
)
354 static BOOL once
= FALSE
;
357 FIXME("iface %p stub!\n", iface
);
359 TRACE("iface %p stub!\n", iface
);
364 static HRESULT STDMETHODCALLTYPE
dxgi_output_TakeOwnership(IDXGIOutput6
*iface
, IUnknown
*device
, BOOL exclusive
)
366 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
369 TRACE("iface %p, device %p, exclusive %d.\n", iface
, device
, exclusive
);
372 return DXGI_ERROR_INVALID_CALL
;
374 wined3d_mutex_lock();
375 hr
= wined3d_output_take_ownership(output
->wined3d_output
, exclusive
);
376 wined3d_mutex_unlock();
381 static void STDMETHODCALLTYPE
dxgi_output_ReleaseOwnership(IDXGIOutput6
*iface
)
383 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
385 TRACE("iface %p.\n", iface
);
387 wined3d_mutex_lock();
388 wined3d_output_release_ownership(output
->wined3d_output
);
389 wined3d_mutex_unlock();
392 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetGammaControlCapabilities(IDXGIOutput6
*iface
,
393 DXGI_GAMMA_CONTROL_CAPABILITIES
*gamma_caps
)
397 TRACE("iface %p, gamma_caps %p.\n", iface
, gamma_caps
);
402 gamma_caps
->ScaleAndOffsetSupported
= FALSE
;
403 gamma_caps
->MaxConvertedValue
= 1.0f
;
404 gamma_caps
->MinConvertedValue
= 0.0f
;
405 gamma_caps
->NumGammaControlPoints
= 256;
407 for (i
= 0; i
< gamma_caps
->NumGammaControlPoints
; ++i
)
408 gamma_caps
->ControlPointPositions
[i
] = i
/ 255.0f
;
413 static HRESULT STDMETHODCALLTYPE
dxgi_output_SetGammaControl(IDXGIOutput6
*iface
,
414 const DXGI_GAMMA_CONTROL
*gamma_control
)
416 FIXME("iface %p, gamma_control %p stub!\n", iface
, gamma_control
);
421 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetGammaControl(IDXGIOutput6
*iface
,
422 DXGI_GAMMA_CONTROL
*gamma_control
)
424 FIXME("iface %p, gamma_control %p stub!\n", iface
, gamma_control
);
429 static HRESULT STDMETHODCALLTYPE
dxgi_output_SetDisplaySurface(IDXGIOutput6
*iface
, IDXGISurface
*surface
)
431 FIXME("iface %p, surface %p stub!\n", iface
, surface
);
436 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetDisplaySurfaceData(IDXGIOutput6
*iface
, IDXGISurface
*surface
)
438 FIXME("iface %p, surface %p stub!\n", iface
, surface
);
443 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetFrameStatistics(IDXGIOutput6
*iface
, DXGI_FRAME_STATISTICS
*stats
)
445 FIXME("iface %p, stats %p stub!\n", iface
, stats
);
450 /* IDXGIOutput1 methods */
452 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetDisplayModeList1(IDXGIOutput6
*iface
,
453 DXGI_FORMAT format
, UINT flags
, UINT
*mode_count
, DXGI_MODE_DESC1
*modes
)
455 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
457 FIXME("iface %p, format %s, flags %#x, mode_count %p, modes %p partial stub!\n",
458 iface
, debug_dxgi_format(format
), flags
, mode_count
, modes
);
460 return dxgi_output_get_display_mode_list(output
,
461 format
, mode_count
, modes
, DXGI_MODE_STRUCT_VERSION_1
);
464 static HRESULT STDMETHODCALLTYPE
dxgi_output_FindClosestMatchingMode1(IDXGIOutput6
*iface
,
465 const DXGI_MODE_DESC1
*mode
, DXGI_MODE_DESC1
*closest_match
, IUnknown
*device
)
467 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
468 struct wined3d_display_mode wined3d_mode
;
471 TRACE("iface %p, mode %p, closest_match %p, device %p.\n",
472 iface
, mode
, closest_match
, device
);
474 TRACE("Mode: %s.\n", debug_dxgi_mode1(mode
));
476 wined3d_display_mode_from_dxgi1(&wined3d_mode
, mode
);
477 hr
= dxgi_output_find_closest_matching_mode(output
, &wined3d_mode
, device
);
480 dxgi_mode1_from_wined3d(closest_match
, &wined3d_mode
);
481 TRACE("Returning %s.\n", debug_dxgi_mode1(closest_match
));
487 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetDisplaySurfaceData1(IDXGIOutput6
*iface
,
488 IDXGIResource
*resource
)
490 FIXME("iface %p, resource %p stub!\n", iface
, resource
);
495 static HRESULT STDMETHODCALLTYPE
dxgi_output_DuplicateOutput(IDXGIOutput6
*iface
,
496 IUnknown
*device
, IDXGIOutputDuplication
**output_duplication
)
498 FIXME("iface %p, device %p, output_duplication %p stub!\n", iface
, device
, output_duplication
);
503 /* IDXGIOutput2 methods */
505 static BOOL STDMETHODCALLTYPE
dxgi_output_SupportsOverlays(IDXGIOutput6
*iface
)
507 FIXME("iface %p stub!\n", iface
);
512 /* IDXGIOutput3 methods */
514 static HRESULT STDMETHODCALLTYPE
dxgi_output_CheckOverlaySupport(IDXGIOutput6
*iface
,
515 DXGI_FORMAT format
, IUnknown
*device
, UINT
*flags
)
517 FIXME("iface %p, format %#x, device %p, flags %p stub!\n", iface
, format
, device
, flags
);
522 /* IDXGIOutput4 methods */
524 static HRESULT STDMETHODCALLTYPE
dxgi_output_CheckOverlayColorSpaceSupport(IDXGIOutput6
*iface
,
525 DXGI_FORMAT format
, DXGI_COLOR_SPACE_TYPE color_space
, IUnknown
*device
, UINT
*flags
)
527 FIXME("iface %p, format %#x, color_space %#x, device %p, flags %p stub!\n",
528 iface
, format
, color_space
, device
, flags
);
533 /* IDXGIOutput5 methods */
535 static HRESULT STDMETHODCALLTYPE
dxgi_output_DuplicateOutput1(IDXGIOutput6
*iface
,
536 IUnknown
*device
, UINT flags
, UINT format_count
, const DXGI_FORMAT
*formats
,
537 IDXGIOutputDuplication
**output_duplication
)
539 FIXME("iface %p, device %p, flags %#x, format_count %u, formats %p, "
540 "output_duplication %p stub!\n", iface
, device
, flags
, format_count
,
541 formats
, output_duplication
);
546 /* IDXGIOutput6 methods */
548 static HRESULT STDMETHODCALLTYPE
dxgi_output_GetDesc1(IDXGIOutput6
*iface
,
549 DXGI_OUTPUT_DESC1
*desc
)
551 struct dxgi_output
*output
= impl_from_IDXGIOutput6(iface
);
552 struct wined3d_output_desc wined3d_desc
;
555 FIXME("iface %p, desc %p semi-stub!\n", iface
, desc
);
560 wined3d_mutex_lock();
561 hr
= wined3d_output_get_desc(output
->wined3d_output
, &wined3d_desc
);
562 wined3d_mutex_unlock();
566 WARN("Failed to get output desc, hr %#x.\n", hr
);
570 memcpy(desc
->DeviceName
, wined3d_desc
.device_name
, sizeof(desc
->DeviceName
));
571 desc
->DesktopCoordinates
= wined3d_desc
.desktop_rect
;
572 desc
->AttachedToDesktop
= wined3d_desc
.attached_to_desktop
;
573 desc
->Rotation
= wined3d_desc
.rotation
;
574 desc
->Monitor
= wined3d_desc
.monitor
;
576 /* FIXME: fill this from monitor EDID */
577 desc
->BitsPerColor
= 0;
578 desc
->ColorSpace
= DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
;
579 desc
->RedPrimary
[0] = 0.f
;
580 desc
->RedPrimary
[1] = 0.f
;
581 desc
->GreenPrimary
[0] = 0.f
;
582 desc
->GreenPrimary
[1] = 0.f
;
583 desc
->BluePrimary
[0] = 0.f
;
584 desc
->BluePrimary
[1] = 0.f
;
585 desc
->WhitePoint
[0] = 0.f
;
586 desc
->WhitePoint
[1] = 0.f
;
587 desc
->MinLuminance
= 0.f
;
588 desc
->MaxLuminance
= 0.f
;
589 desc
->MaxFullFrameLuminance
= 0.f
;
594 static HRESULT STDMETHODCALLTYPE
dxgi_output_CheckHardwareCompositionSupport(IDXGIOutput6
*iface
,
597 FIXME("iface %p, flags %p stub!\n", iface
, flags
);
602 static const struct IDXGIOutput6Vtbl dxgi_output_vtbl
=
604 dxgi_output_QueryInterface
,
607 /* IDXGIObject methods */
608 dxgi_output_SetPrivateData
,
609 dxgi_output_SetPrivateDataInterface
,
610 dxgi_output_GetPrivateData
,
611 dxgi_output_GetParent
,
612 /* IDXGIOutput methods */
614 dxgi_output_GetDisplayModeList
,
615 dxgi_output_FindClosestMatchingMode
,
616 dxgi_output_WaitForVBlank
,
617 dxgi_output_TakeOwnership
,
618 dxgi_output_ReleaseOwnership
,
619 dxgi_output_GetGammaControlCapabilities
,
620 dxgi_output_SetGammaControl
,
621 dxgi_output_GetGammaControl
,
622 dxgi_output_SetDisplaySurface
,
623 dxgi_output_GetDisplaySurfaceData
,
624 dxgi_output_GetFrameStatistics
,
625 /* IDXGIOutput1 methods */
626 dxgi_output_GetDisplayModeList1
,
627 dxgi_output_FindClosestMatchingMode1
,
628 dxgi_output_GetDisplaySurfaceData1
,
629 dxgi_output_DuplicateOutput
,
630 /* IDXGIOutput2 methods */
631 dxgi_output_SupportsOverlays
,
632 /* IDXGIOutput3 methods */
633 dxgi_output_CheckOverlaySupport
,
634 /* IDXGIOutput4 methods */
635 dxgi_output_CheckOverlayColorSpaceSupport
,
636 /* IDXGIOutput5 methods */
637 dxgi_output_DuplicateOutput1
,
638 /* IDXGIOutput6 methods */
639 dxgi_output_GetDesc1
,
640 dxgi_output_CheckHardwareCompositionSupport
,
643 struct dxgi_output
*unsafe_impl_from_IDXGIOutput(IDXGIOutput
*iface
)
647 assert(iface
->lpVtbl
== (IDXGIOutputVtbl
*)&dxgi_output_vtbl
);
648 return CONTAINING_RECORD(iface
, struct dxgi_output
, IDXGIOutput6_iface
);
651 static void dxgi_output_init(struct dxgi_output
*output
, unsigned int output_idx
,
652 struct dxgi_adapter
*adapter
)
654 output
->IDXGIOutput6_iface
.lpVtbl
= &dxgi_output_vtbl
;
655 output
->refcount
= 1;
656 output
->wined3d_output
= wined3d_adapter_get_output(adapter
->wined3d_adapter
, output_idx
);
657 wined3d_private_store_init(&output
->private_store
);
658 output
->adapter
= adapter
;
659 IWineDXGIAdapter_AddRef(&output
->adapter
->IWineDXGIAdapter_iface
);
662 HRESULT
dxgi_output_create(struct dxgi_adapter
*adapter
, unsigned int output_idx
,
663 struct dxgi_output
**output
)
665 if (!(*output
= heap_alloc_zero(sizeof(**output
))))
666 return E_OUTOFMEMORY
;
668 dxgi_output_init(*output
, output_idx
, adapter
);