2 * Copyright 2015 Alistair Leslie-Hughes
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 DEFINE_GUID(IID_ID3DX10Font
, 0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc);
22 DEFINE_GUID(IID_ID3DX10Sprite
, 0xba0b762d, 0x8d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x06, 0x14);
23 DEFINE_GUID(IID_ID3DX10ThreadPump
, 0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb);
25 typedef enum _D3DX10_SPRITE_FLAG
27 D3DX10_SPRITE_SORT_TEXTURE
= 0x01,
28 D3DX10_SPRITE_SORT_DEPTH_BACK_TO_FRONT
= 0x02,
29 D3DX10_SPRITE_SORT_DEPTH_FRONT_TO_BACK
= 0x04,
30 D3DX10_SPRITE_SAVE_STATE
= 0x08,
31 D3DX10_SPRITE_ADDREF_TEXTURES
= 0x10,
34 typedef struct _D3DX10_SPRITE
39 D3DXCOLOR ColorModulate
;
40 ID3D10ShaderResourceView
*pTexture
;
44 typedef struct _D3DX10_FONT_DESCA
55 CHAR FaceName
[LF_FACESIZE
];
56 } D3DX10_FONT_DESCA
, *LPD3DX10_FONT_DESCA
;
58 typedef struct _D3DX10_FONT_DESCW
69 WCHAR FaceName
[LF_FACESIZE
];
70 } D3DX10_FONT_DESCW
, *LPD3DX10_FONT_DESCW
;
72 DECL_WINELIB_TYPE_AW(D3DX10_FONT_DESC
)
73 DECL_WINELIB_TYPE_AW(LPD3DX10_FONT_DESC
)
75 #define INTERFACE ID3DX10DataLoader
76 DECLARE_INTERFACE(ID3DX10DataLoader
)
78 STDMETHOD(Load
)(THIS
) PURE
;
79 STDMETHOD(Decompress
)(THIS_
void **data
, SIZE_T
*bytes
) PURE
;
80 STDMETHOD(Destroy
)(THIS
) PURE
;
84 #if !defined(__cplusplus) || defined(CINTERFACE)
85 /*** ID3DX10DataLoader methods ***/
86 #define ID3DX10DataLoader_Load(p) (p)->lpVtbl->Load(p)
87 #define ID3DX10DataLoader_Decompress(p,a,b) (p)->lpVtbl->Decompress(p,a,b)
88 #define ID3DX10DataLoader_Destroy(p) (p)->lpVtbl->Destroy(p)
90 /*** ID3DX10DataLoader methods ***/
91 #define ID3DX10DataLoader_Load(p) (p)->Load()
92 #define ID3DX10DataLoader_Decompress(p,a,b) (p)->Decompress(a,b)
93 #define ID3DX10DataLoader_Destroy(p) (p)->Destroy()
96 #define INTERFACE ID3DX10DataProcessor
97 DECLARE_INTERFACE(ID3DX10DataProcessor
)
99 STDMETHOD(Process
)(THIS_
void *data
, SIZE_T bytes
) PURE
;
100 STDMETHOD(CreateDeviceObject
)(THIS_
void **dataobject
) PURE
;
101 STDMETHOD(Destroy
)(THIS
) PURE
;
105 #if !defined(__cplusplus) || defined(CINTERFACE)
106 /*** ID3DX10DataProcessor methods ***/
107 #define ID3DX10DataProcessor_Process(p,a,b) (p)->lpVtbl->Process(p,a,b)
108 #define ID3DX10DataProcessor_CreateDeviceObject(p,a) (p)->lpVtbl->CreateDeviceObject(p,a)
109 #define ID3DX10DataProcessor_Destroy(p) (p)->lpVtbl->Destroy(p)
111 /*** ID3DX10DataProcessor methods ***/
112 #define ID3DX10DataProcessor_Process(p,a,b) (p)->Process(a,b)
113 #define ID3DX10DataProcessor_CreateDeviceObject(p,a) (p)->CreateDeviceObject(a)
114 #define ID3DX10DataProcessor_Destroy(p) (p)->Destroy()
117 #define INTERFACE ID3DX10ThreadPump
118 DECLARE_INTERFACE_(ID3DX10ThreadPump
, IUnknown
)
120 /*** IUnknown methods ***/
121 STDMETHOD(QueryInterface
)(THIS_ REFIID riid
, void **out
) PURE
;
122 STDMETHOD_(ULONG
, AddRef
)(THIS
) PURE
;
123 STDMETHOD_(ULONG
, Release
)(THIS
) PURE
;
124 /*** ID3DX10ThreadPump methods ***/
125 STDMETHOD(AddWorkItem
)(THIS_ ID3DX10DataLoader
*loader
, ID3DX10DataProcessor
*processor
,
126 HRESULT
*result
, void **object
) PURE
;
127 STDMETHOD_(UINT
, GetWorkItemCount
)(THIS
) PURE
;
128 STDMETHOD(WaitForAllItems
)(THIS
) PURE
;
129 STDMETHOD(ProcessDeviceWorkItems
)(THIS_ UINT count
) PURE
;
130 STDMETHOD(PurgeAllItems
)(THIS
) PURE
;
131 STDMETHOD(GetQueueStatus
)(THIS_ UINT
*queue
, UINT
*processqueue
, UINT
*devicequeue
) PURE
;
135 #if !defined(__cplusplus) || defined(CINTERFACE)
136 /*** IUnknown methods ***/
137 #define ID3DX10ThreadPump_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
138 #define ID3DX10ThreadPump_AddRef(p) (p)->lpVtbl->AddRef(p)
139 #define ID3DX10ThreadPump_Release(p) (p)->lpVtbl->Release(p)
140 /*** ID3DX10ThreadPump methods ***/
141 #define ID3DX10ThreadPump_AddWorkItem(p,a,b,c,d) (p)->lpVtbl->AddWorkItem(p,a,b,c,d)
142 #define ID3DX10ThreadPump_GetWorkItemCount(p) (p)->lpVtbl->GetWorkItemCount(p)
143 #define ID3DX10ThreadPump_WaitForAllItems(p) (p)->lpVtbl->WaitForAllItems(p)
144 #define ID3DX10ThreadPump_ProcessDeviceWorkItems(p,a) (p)->lpVtbl->ProcessDeviceWorkItems(p,a)
145 #define ID3DX10ThreadPump_PurgeAllItems(p) (p)->lpVtbl->PurgeAllItems(p)
146 #define ID3DX10ThreadPump_GetQueueStatus(p,a,b,c) (p)->lpVtbl->GetQueueStatus(p,a,b,c)
148 /*** IUnknown methods ***/
149 #define ID3DX10ThreadPump_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
150 #define ID3DX10ThreadPump_AddRef(p) (p)->AddRef()
151 #define ID3DX10ThreadPump_Release(p) (p)->Release()
152 /*** ID3DX10ThreadPump methods ***/
153 #define ID3DX10ThreadPump_AddWorkItem(p,a,b,c,d) (p)->AddWorkItem(a,b,c,d)
154 #define ID3DX10ThreadPump_GetWorkItemCount(p) (p)->GetWorkItemCount()
155 #define ID3DX10ThreadPump_WaitForAllItems(p) (p)->WaitForAllItems()
156 #define ID3DX10ThreadPump_ProcessDeviceWorkItems(p,a) (p)->ProcessDeviceWorkItems(a)
157 #define ID3DX10ThreadPump_PurgeAllItems(p) (p)->PurgeAllItems()
158 #define ID3DX10ThreadPump_GetQueueStatus(p,a,b,c) (p)->GetQueueStatus(a,b,c)
161 #define INTERFACE ID3DX10Sprite
162 DECLARE_INTERFACE_(ID3DX10Sprite
, IUnknown
)
164 /*** IUnknown methods ***/
165 STDMETHOD(QueryInterface
)(THIS_ REFIID riid
, void **out
) PURE
;
166 STDMETHOD_(ULONG
, AddRef
)(THIS
) PURE
;
167 STDMETHOD_(ULONG
, Release
)(THIS
) PURE
;
168 /*** ID3DX10Sprite methods ***/
169 STDMETHOD(Begin
)(THIS_ UINT flags
) PURE
;
170 STDMETHOD(DrawSpritesBuffered
)(THIS_ D3DX10_SPRITE
*sprites
, UINT count
) PURE
;
171 STDMETHOD(Flush
)(THIS
) PURE
;
172 STDMETHOD(DrawSpritesImmediate
)(THIS_ D3DX10_SPRITE
*sprites
,
173 UINT count
, UINT size
, UINT flags
) PURE
;
174 STDMETHOD(End
)(THIS
) PURE
;
175 STDMETHOD(GetViewTransform
)(THIS_ D3DXMATRIX
*transform
) PURE
;
176 STDMETHOD(SetViewTransform
)(THIS_ D3DXMATRIX
*transform
) PURE
;
177 STDMETHOD(GetProjectionTransform
)(THIS_ D3DXMATRIX
*transform
) PURE
;
178 STDMETHOD(SetProjectionTransform
)(THIS_ D3DXMATRIX
*transform
) PURE
;
179 STDMETHOD(GetDevice
)(THIS_ ID3D10Device
**device
) PURE
;
183 #if !defined(__cplusplus) || defined(CINTERFACE)
184 /*** IUnknown methods ***/
185 #define ID3DX10Sprite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
186 #define ID3DX10Sprite_AddRef(p) (p)->lpVtbl->AddRef(p)
187 #define ID3DX10Sprite_Release(p) (p)->lpVtbl->Release(p)
188 /*** ID3DX10Sprite methods ***/
189 #define ID3DX10Sprite_Begin(p,a) (p)->lpVtbl->Begin(p,a)
190 #define ID3DX10Sprite_DrawSpritesBuffered(p,a,b) (p)->lpVtbl->DrawSpritesBuffered(p,a,b)
191 #define ID3DX10Sprite_Flush(p) (p)->lpVtbl->Flush(p)
192 #define ID3DX10Sprite_DrawSpritesImmediate(p,a,b,c,d) (p)->lpVtbl->DrawSpritesImmediate(p,a,b,c,d)
193 #define ID3DX10Sprite_End(p) (p)->lpVtbl->End(p)
194 #define ID3DX10Sprite_GetViewTransform(p,a) (p)->lpVtbl->GetViewTransform(p,a)
195 #define ID3DX10Sprite_SetViewTransform(p,a) (p)->lpVtbl->SetViewTransform(p,a)
196 #define ID3DX10Sprite_GetProjectionTransform(p,a) (p)->lpVtbl->GetProjectionTransform(p,a)
197 #define ID3DX10Sprite_SetProjectionTransform(p,a) (p)->lpVtbl->SetProjectionTransform(p,a)
198 #define ID3DX10Sprite_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
200 /*** IUnknown methods ***/
201 #define ID3DX10Sprite_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
202 #define ID3DX10Sprite_AddRef(p) (p)->AddRef()
203 #define ID3DX10Sprite_Release(p) (p)->Release()
204 /*** ID3DX10Sprite methods ***/
205 #define ID3DX10Sprite_Begin(p,a) (p)->Begin(a)
206 #define ID3DX10Sprite_DrawSpritesBuffered(p,a,b) (p)->DrawSpritesBuffered(a,b)
207 #define ID3DX10Sprite_Flush(p) (p)->Flush()
208 #define ID3DX10Sprite_DrawSpritesImmediate(p,a,b,c,d) (p)->DrawSpritesImmediate(a,b,c,d)
209 #define ID3DX10Sprite_End(p) (p)->End()
210 #define ID3DX10Sprite_GetViewTransform(p,a) (p)->GetViewTransform(a)
211 #define ID3DX10Sprite_SetViewTransform(p,a) (p)->SetViewTransform(a)
212 #define ID3DX10Sprite_GetProjectionTransform(p,a) (p)->GetProjectionTransform(a)
213 #define ID3DX10Sprite_SetProjectionTransform(p,a) (p)->SetProjectionTransform(a)
214 #define ID3DX10Sprite_GetDevice(p,a) (p)->GetDevice(a)
217 #define INTERFACE ID3DX10Font
218 DECLARE_INTERFACE_(ID3DX10Font
, IUnknown
)
220 /*** IUnknown methods ***/
221 STDMETHOD(QueryInterface
)(THIS_ REFIID iid
, void **out
) PURE
;
222 STDMETHOD_(ULONG
, AddRef
)(THIS
) PURE
;
223 STDMETHOD_(ULONG
, Release
)(THIS
) PURE
;
224 /*** ID3DX10Font methods ***/
225 STDMETHOD(GetDevice
)(THIS_ ID3D10Device
**device
) PURE
;
226 STDMETHOD(GetDescA
)(THIS_ D3DX10_FONT_DESCA
*desc
) PURE
;
227 STDMETHOD(GetDescW
)(THIS_ D3DX10_FONT_DESCW
*desc
) PURE
;
228 STDMETHOD_(BOOL
, GetTextMetricsA
)(THIS_ TEXTMETRICA
*metrics
) PURE
;
229 STDMETHOD_(BOOL
, GetTextMetricsW
)(THIS_ TEXTMETRICW
*metrics
) PURE
;
230 STDMETHOD_(HDC
, GetDC
)(THIS
) PURE
;
231 STDMETHOD(GetGlyphData
)(THIS_ UINT glyph
, ID3D10ShaderResourceView
**texture
,
232 RECT
*blackbox
, POINT
*cellinc
) PURE
;
233 STDMETHOD(PreloadCharacters
)(THIS_ UINT first
, UINT last
) PURE
;
234 STDMETHOD(PreloadGlyphs
)(THIS_ UINT first
, UINT last
) PURE
;
235 STDMETHOD(PreloadTextA
)(THIS_
const char *text
, INT count
) PURE
;
236 STDMETHOD(PreloadTextW
)(THIS_
const WCHAR
*text
, INT count
) PURE
;
237 STDMETHOD_(INT
, DrawTextA
)(THIS_ ID3DX10Sprite
*sprite
, const char *text
,
238 INT count
, RECT
*rect
, UINT format
, D3DXCOLOR color
) PURE
;
239 STDMETHOD_(INT
, DrawTextW
)(THIS_ ID3DX10Sprite
*sprite
, const WCHAR
*text
,
240 INT count
, RECT
*rect
, UINT format
, D3DXCOLOR color
) PURE
;
244 #if !defined(__cplusplus) || defined(CINTERFACE)
245 /*** IUnknown methods ***/
246 #define ID3DX10Font_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
247 #define ID3DX10Font_AddRef(p) (p)->lpVtbl->AddRef(p)
248 #define ID3DX10Font_Release(p) (p)->lpVtbl->Release(p)
249 /*** ID3DX10Font methods ***/
250 #define ID3DX10Font_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
251 #define ID3DX10Font_GetDescA(p,a) (p)->lpVtbl->GetDescA(p,a)
252 #define ID3DX10Font_GetDescW(p,a) (p)->lpVtbl->GetDescW(p,a)
253 #define ID3DX10Font_GetTextMetricsA(p,a) (p)->lpVtbl->GetTextMetricsA(p,a)
254 #define ID3DX10Font_GetTextMetricsW(p,a) (p)->lpVtbl->GetTextMetricsW(p,a)
255 #define ID3DX10Font_GetDC(p) (p)->lpVtbl->GetDC(p)
256 #define ID3DX10Font_GetGlyphData(p,a,b,c,d) (p)->lpVtbl->GetGlyphData(p,a,b,c,d)
257 #define ID3DX10Font_PreloadCharacters(p,a,b) (p)->lpVtbl->PreloadCharacters(p,a,b)
258 #define ID3DX10Font_PreloadGlyphs(p,a,b) (p)->lpVtbl->PreloadGlyphs(p,a,b)
259 #define ID3DX10Font_PreloadTextA(p,a,b) (p)->lpVtbl->PreloadTextA(p,a,b)
260 #define ID3DX10Font_PreloadTextW(p,a,b) (p)->lpVtbl->PreloadTextW(p,a,b)
261 #define ID3DX10Font_DrawTextA(p,a,b,c,d,e,f) (p)->lpVtbl->DrawTextA(p,a,b,c,d,e,f)
262 #define ID3DX10Font_DrawTextW(p,a,b,c,d,e,f) (p)->lpVtbl->DrawTextW(p,a,b,c,d,e,f)
264 /*** IUnknown methods ***/
265 #define ID3DX10Font_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
266 #define ID3DX10Font_AddRef(p) (p)->AddRef()
267 #define ID3DX10Font_Release(p) (p)->Release()
268 /*** ID3DX10Font methods ***/
269 #define ID3DX10Font_GetDevice(p,a) (p)->GetDevice(a)
270 #define ID3DX10Font_GetDescA(p,a) (p)->GetDescA(a)
271 #define ID3DX10Font_GetDescW(p,a) (p)->GetDescW(a)
272 #define ID3DX10Font_GetTextMetricsA(p,a) (p)->GetTextMetricsA(a)
273 #define ID3DX10Font_GetTextMetricsW(p,a) (p)->GetTextMetricsW(a)
274 #define ID3DX10Font_GetDC(p) (p)->GetDC()
275 #define ID3DX10Font_GetGlyphData(p,a,b,c,d) (p)->GetGlyphData(a,b,c,d)
276 #define ID3DX10Font_PreloadCharacters(p,a,b) (p)->PreloadCharacters(a,b)
277 #define ID3DX10Font_PreloadGlyphs(p,a,b) (p)->PreloadGlyphs(a,b)
278 #define ID3DX10Font_PreloadTextA(p,a,b) (p)->PreloadTextA(a,b)
279 #define ID3DX10Font_PreloadTextW(p,a,b) (p)->PreloadTextW(a,b)
280 #define ID3DX10Font_DrawTextA(p,a,b,c,d,e,f) (p)->DrawTextA(a,b,c,d,e,f)
281 #define ID3DX10Font_DrawTextW(p,a,b,c,d,e,f) (p)->DrawTextW(a,b,c,d,e,f)
284 HRESULT WINAPI
D3DX10UnsetAllDeviceObjects(ID3D10Device
*device
);
285 HRESULT WINAPI
D3DX10CreateDevice(IDXGIAdapter
*adapter
, D3D10_DRIVER_TYPE driver_type
,
286 HMODULE swrast
, unsigned int flags
, ID3D10Device
**device
);
287 HRESULT WINAPI
D3DX10CreateDeviceAndSwapChain(IDXGIAdapter
*adapter
, D3D10_DRIVER_TYPE driver_type
,
288 HMODULE swrast
, unsigned int flags
, DXGI_SWAP_CHAIN_DESC
*desc
, IDXGISwapChain
**swapchain
,
289 ID3D10Device
**device
);
290 interface ID3D10Device1
;
291 HRESULT WINAPI
D3DX10GetFeatureLevel1(ID3D10Device
*device
, interface ID3D10Device1
**device1
);
292 HRESULT WINAPI
D3DX10CreateFontIndirectA(ID3D10Device
*device
, const D3DX10_FONT_DESCA
*desc
, ID3DX10Font
**font
);
293 HRESULT WINAPI
D3DX10CreateFontIndirectW(ID3D10Device
*device
, const D3DX10_FONT_DESCW
*desc
, ID3DX10Font
**font
);
294 HRESULT WINAPI
D3DX10CreateFontA(ID3D10Device
*device
, INT height
, UINT width
, UINT weight
,
295 UINT miplevels
, BOOL italic
, UINT charset
, UINT precision
, UINT quality
,
296 UINT pitchandfamily
, const char *facename
, ID3DX10Font
**font
);
297 HRESULT WINAPI
D3DX10CreateFontW(ID3D10Device
*device
, INT height
, UINT width
, UINT weight
,
298 UINT miplevels
, BOOL italic
, UINT charset
, UINT precision
, UINT quality
,
299 UINT pitchandfamily
, const WCHAR
*facename
, ID3DX10Font
**font
);
300 HRESULT WINAPI
D3DX10CreateSprite(ID3D10Device
*device
, UINT size
, ID3DX10Sprite
**sprite
);
301 HRESULT WINAPI
D3DX10CreateThreadPump(UINT io_threads
, UINT proc_threads
, ID3DX10ThreadPump
**pump
);