Introduce .editorconfig
[mesa.git] / include / d3dadapter / present.h
1 /*
2 * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22
23 #ifndef _D3DADAPTER_PRESENT_H_
24 #define _D3DADAPTER_PRESENT_H_
25
26 #include <d3d9.h>
27
28 #ifndef D3DOK_WINDOW_OCCLUDED
29 #define D3DOK_WINDOW_OCCLUDED MAKE_D3DSTATUS(2531)
30 #endif /* D3DOK_WINDOW_OCCLUDED */
31
32 #ifndef __cplusplus
33 typedef struct ID3DPresent ID3DPresent;
34 typedef struct ID3DPresentGroup ID3DPresentGroup;
35 typedef struct ID3DAdapter9 ID3DAdapter9;
36 typedef struct D3DWindowBuffer D3DWindowBuffer;
37
38 /* Presentation backend for drivers to display their brilliant work */
39 typedef struct ID3DPresentVtbl
40 {
41 /* IUnknown */
42 HRESULT (WINAPI *QueryInterface)(ID3DPresent *This, REFIID riid, void **ppvObject);
43 ULONG (WINAPI *AddRef)(ID3DPresent *This);
44 ULONG (WINAPI *Release)(ID3DPresent *This);
45
46 /* ID3DPresent */
47 /* This function initializes the screen and window provided at creation.
48 * Hence why this should always be called as the one of first things a new
49 * swap chain does */
50 HRESULT (WINAPI *SetPresentParameters)(ID3DPresent *This, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode);
51 /* Make a buffer visible to the window system via dma-buf fd.
52 * For better compatibility, it must be 32bpp and format ARGB/XRGB */
53 HRESULT (WINAPI *NewD3DWindowBufferFromDmaBuf)(ID3DPresent *This, int dmaBufFd, int width, int height, int stride, int depth, int bpp, D3DWindowBuffer **out);
54 HRESULT (WINAPI *DestroyD3DWindowBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer);
55 /* After presenting a buffer to the window system, the buffer
56 * may be used as is (no copy of the content) by the window system.
57 * You must not use a non-released buffer, else the user may see undefined content. */
58 HRESULT (WINAPI *WaitBufferReleased)(ID3DPresent *This, D3DWindowBuffer *buffer);
59 HRESULT (WINAPI *FrontBufferCopy)(ID3DPresent *This, D3DWindowBuffer *buffer);
60 /* It is possible to do partial copy, but impossible to do resizing, which must
61 * be done by the client after checking the front buffer size */
62 HRESULT (WINAPI *PresentBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer, HWND hWndOverride, const RECT *pSourceRect, const RECT *pDestRect, const RGNDATA *pDirtyRegion, DWORD Flags);
63 HRESULT (WINAPI *GetRasterStatus)(ID3DPresent *This, D3DRASTER_STATUS *pRasterStatus);
64 HRESULT (WINAPI *GetDisplayMode)(ID3DPresent *This, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation);
65 HRESULT (WINAPI *GetPresentStats)(ID3DPresent *This, D3DPRESENTSTATS *pStats);
66 HRESULT (WINAPI *GetCursorPos)(ID3DPresent *This, POINT *pPoint);
67 HRESULT (WINAPI *SetCursorPos)(ID3DPresent *This, POINT *pPoint);
68 /* Cursor size is always 32x32. pBitmap and pHotspot can be NULL. */
69 HRESULT (WINAPI *SetCursor)(ID3DPresent *This, void *pBitmap, POINT *pHotspot, BOOL bShow);
70 HRESULT (WINAPI *SetGammaRamp)(ID3DPresent *This, const D3DGAMMARAMP *pRamp, HWND hWndOverride);
71 HRESULT (WINAPI *GetWindowInfo)(ID3DPresent *This, HWND hWnd, int *width, int *height, int *depth);
72 /* Available since version 1.1 */
73 BOOL (WINAPI *GetWindowOccluded)(ID3DPresent *This);
74 /* Available since version 1.2 */
75 BOOL (WINAPI *ResolutionMismatch)(ID3DPresent *This);
76 HANDLE (WINAPI *CreateThread)(ID3DPresent *This, void *pThreadfunc, void *pParam);
77 BOOL (WINAPI *WaitForThread)(ID3DPresent *This, HANDLE thread);
78 } ID3DPresentVtbl;
79
80 struct ID3DPresent
81 {
82 ID3DPresentVtbl *lpVtbl;
83 };
84
85 /* IUnknown macros */
86 #define ID3DPresent_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
87 #define ID3DPresent_AddRef(p) (p)->lpVtbl->AddRef(p)
88 #define ID3DPresent_Release(p) (p)->lpVtbl->Release(p)
89 /* ID3DPresent macros */
90 #define ID3DPresent_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a)
91 #define ID3DPresent_SetPresentParameters(p,a,b) (p)->lpVtbl->SetPresentParameters(p,a,b)
92 #define ID3DPresent_NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g) (p)->lpVtbl->NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g)
93 #define ID3DPresent_DestroyD3DWindowBuffer(p,a) (p)->lpVtbl->DestroyD3DWindowBuffer(p,a)
94 #define ID3DPresent_WaitBufferReleased(p,a) (p)->lpVtbl->WaitBufferReleased(p,a)
95 #define ID3DPresent_FrontBufferCopy(p,a) (p)->lpVtbl->FrontBufferCopy(p,a)
96 #define ID3DPresent_PresentBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->PresentBuffer(p,a,b,c,d,e,f)
97 #define ID3DPresent_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a)
98 #define ID3DPresent_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
99 #define ID3DPresent_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a)
100 #define ID3DPresent_GetCursorPos(p,a) (p)->lpVtbl->GetCursorPos(p,a)
101 #define ID3DPresent_SetCursorPos(p,a) (p)->lpVtbl->SetCursorPos(p,a)
102 #define ID3DPresent_SetCursor(p,a,b,c) (p)->lpVtbl->SetCursor(p,a,b,c)
103 #define ID3DPresent_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b)
104 #define ID3DPresent_GetWindowInfo(p,a,b,c,d) (p)->lpVtbl->GetWindowSize(p,a,b,c,d)
105 #define ID3DPresent_GetWindowOccluded(p) (p)->lpVtbl->GetWindowOccluded(p)
106 #define ID3DPresent_ResolutionMismatch(p) (p)->lpVtbl->ResolutionMismatch(p)
107 #define ID3DPresent_CreateThread(p,a,b) (p)->lpVtbl->CreateThread(p,a,b)
108 #define ID3DPresent_WaitForThread(p,a) (p)->lpVtbl->WaitForThread(p,a)
109
110 typedef struct ID3DPresentGroupVtbl
111 {
112 /* IUnknown */
113 HRESULT (WINAPI *QueryInterface)(ID3DPresentGroup *This, REFIID riid, void **ppvObject);
114 ULONG (WINAPI *AddRef)(ID3DPresentGroup *This);
115 ULONG (WINAPI *Release)(ID3DPresentGroup *This);
116
117 /* ID3DPresentGroup */
118 /* When creating a device, it's relevant for the driver to know how many
119 * implicit swap chains to create. It has to create one per monitor in a
120 * multi-monitor setup */
121 UINT (WINAPI *GetMultiheadCount)(ID3DPresentGroup *This);
122 /* returns only the implicit present interfaces */
123 HRESULT (WINAPI *GetPresent)(ID3DPresentGroup *This, UINT Index, ID3DPresent **ppPresent);
124 /* used to create additional presentation interfaces along the way */
125 HRESULT (WINAPI *CreateAdditionalPresent)(ID3DPresentGroup *This, D3DPRESENT_PARAMETERS *pPresentationParameters, ID3DPresent **ppPresent);
126 void (WINAPI *GetVersion) (ID3DPresentGroup *This, int *major, int *minor);
127 } ID3DPresentGroupVtbl;
128
129 struct ID3DPresentGroup
130 {
131 ID3DPresentGroupVtbl *lpVtbl;
132 };
133
134 /* IUnknown macros */
135 #define ID3DPresentGroup_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
136 #define ID3DPresentGroup_AddRef(p) (p)->lpVtbl->AddRef(p)
137 #define ID3DPresentGroup_Release(p) (p)->lpVtbl->Release(p)
138 /* ID3DPresentGroup */
139 #define ID3DPresentGroup_GetMultiheadCount(p) (p)->lpVtbl->GetMultiheadCount(p)
140 #define ID3DPresentGroup_GetPresent(p,a,b) (p)->lpVtbl->GetPresent(p,a,b)
141 #define ID3DPresentGroup_CreateAdditionalPresent(p,a,b) (p)->lpVtbl->CreateAdditionalPresent(p,a,b)
142 #define ID3DPresentGroup_GetVersion(p,a,b) (p)->lpVtbl->GetVersion(p,a,b)
143
144 #endif /* __cplusplus */
145
146 #endif /* _D3DADAPTER_PRESENT_H_ */