Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // |
||
3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. |
||
4 | // |
||
5 | // File: d3dx10core.h |
||
6 | // Content: D3DX10 core types and functions |
||
7 | // |
||
8 | /////////////////////////////////////////////////////////////////////////// |
||
9 | |||
10 | #include "d3dx10.h" |
||
11 | |||
12 | #ifndef __D3DX10CORE_H__ |
||
13 | #define __D3DX10CORE_H__ |
||
14 | |||
15 | // Current name of the DLL shipped in the same SDK as this header. |
||
16 | |||
17 | |||
18 | #define D3DX10_DLL_W L"d3dx10_42.dll" |
||
19 | #define D3DX10_DLL_A "d3dx10_42.dll" |
||
20 | |||
21 | #ifdef UNICODE |
||
22 | #define D3DX10_DLL D3DX10_DLL_W |
||
23 | #else |
||
24 | #define D3DX10_DLL D3DX10_DLL_A |
||
25 | #endif |
||
26 | |||
27 | #ifdef __cplusplus |
||
28 | extern "C" { |
||
29 | #endif //__cplusplus |
||
30 | |||
31 | /////////////////////////////////////////////////////////////////////////// |
||
32 | // D3DX10_SDK_VERSION: |
||
33 | // ----------------- |
||
34 | // This identifier is passed to D3DX10CheckVersion in order to ensure that an |
||
35 | // application was built against the correct header files and lib files. |
||
36 | // This number is incremented whenever a header (or other) change would |
||
37 | // require applications to be rebuilt. If the version doesn't match, |
||
38 | // D3DX10CreateVersion will return FALSE. (The number itself has no meaning.) |
||
39 | /////////////////////////////////////////////////////////////////////////// |
||
40 | |||
41 | |||
42 | #define D3DX10_SDK_VERSION 42 |
||
43 | |||
44 | |||
45 | /////////////////////////////////////////////////////////////////////////// |
||
46 | // D3DX10CreateDevice |
||
47 | // D3DX10CreateDeviceAndSwapChain |
||
48 | // D3DX10GetFeatureLevel1 |
||
49 | /////////////////////////////////////////////////////////////////////////// |
||
50 | HRESULT WINAPI D3DX10CreateDevice(IDXGIAdapter *pAdapter, |
||
51 | D3D10_DRIVER_TYPE DriverType, |
||
52 | HMODULE Software, |
||
53 | UINT Flags, |
||
54 | ID3D10Device **ppDevice); |
||
55 | |||
56 | HRESULT WINAPI D3DX10CreateDeviceAndSwapChain(IDXGIAdapter *pAdapter, |
||
57 | D3D10_DRIVER_TYPE DriverType, |
||
58 | HMODULE Software, |
||
59 | UINT Flags, |
||
60 | DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, |
||
61 | IDXGISwapChain **ppSwapChain, |
||
62 | ID3D10Device **ppDevice); |
||
63 | |||
64 | typedef interface ID3D10Device1 ID3D10Device1; |
||
65 | HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *pDevice, ID3D10Device1 **ppDevice1); |
||
66 | |||
67 | |||
68 | #ifdef D3D_DIAG_DLL |
||
69 | BOOL WINAPI D3DX10DebugMute(BOOL Mute); |
||
70 | #endif |
||
71 | HRESULT WINAPI D3DX10CheckVersion(UINT D3DSdkVersion, UINT D3DX10SdkVersion); |
||
72 | |||
73 | #ifdef __cplusplus |
||
74 | } |
||
75 | #endif //__cplusplus |
||
76 | |||
77 | |||
78 | ////////////////////////////////////////////////////////////////////////////// |
||
79 | // D3DX10_SPRITE flags: |
||
80 | // ----------------- |
||
81 | // D3DX10_SPRITE_SAVE_STATE |
||
82 | // Specifies device state should be saved and restored in Begin/End. |
||
83 | // D3DX10SPRITE_SORT_TEXTURE |
||
84 | // Sprites are sorted by texture prior to drawing. This is recommended when |
||
85 | // drawing non-overlapping sprites of uniform depth. For example, drawing |
||
86 | // screen-aligned text with ID3DX10Font. |
||
87 | // D3DX10SPRITE_SORT_DEPTH_FRONT_TO_BACK |
||
88 | // Sprites are sorted by depth front-to-back prior to drawing. This is |
||
89 | // recommended when drawing opaque sprites of varying depths. |
||
90 | // D3DX10SPRITE_SORT_DEPTH_BACK_TO_FRONT |
||
91 | // Sprites are sorted by depth back-to-front prior to drawing. This is |
||
92 | // recommended when drawing transparent sprites of varying depths. |
||
93 | // D3DX10SPRITE_ADDREF_TEXTURES |
||
94 | // AddRef/Release all textures passed in to DrawSpritesBuffered |
||
95 | ////////////////////////////////////////////////////////////////////////////// |
||
96 | |||
97 | typedef enum _D3DX10_SPRITE_FLAG |
||
98 | { |
||
99 | D3DX10_SPRITE_SORT_TEXTURE = 0x01, |
||
100 | D3DX10_SPRITE_SORT_DEPTH_BACK_TO_FRONT = 0x02, |
||
101 | D3DX10_SPRITE_SORT_DEPTH_FRONT_TO_BACK = 0x04, |
||
102 | D3DX10_SPRITE_SAVE_STATE = 0x08, |
||
103 | D3DX10_SPRITE_ADDREF_TEXTURES = 0x10, |
||
104 | } D3DX10_SPRITE_FLAG; |
||
105 | |||
106 | typedef struct _D3DX10_SPRITE |
||
107 | { |
||
108 | D3DXMATRIX matWorld; |
||
109 | |||
110 | D3DXVECTOR2 TexCoord; |
||
111 | D3DXVECTOR2 TexSize; |
||
112 | |||
113 | D3DXCOLOR ColorModulate; |
||
114 | |||
115 | ID3D10ShaderResourceView *pTexture; |
||
116 | UINT TextureIndex; |
||
117 | } D3DX10_SPRITE; |
||
118 | |||
119 | |||
120 | ////////////////////////////////////////////////////////////////////////////// |
||
121 | // ID3DX10Sprite: |
||
122 | // ------------ |
||
123 | // This object intends to provide an easy way to drawing sprites using D3D. |
||
124 | // |
||
125 | // Begin - |
||
126 | // Prepares device for drawing sprites. |
||
127 | // |
||
128 | // Draw - |
||
129 | // Draws a sprite |
||
130 | // |
||
131 | // Flush - |
||
132 | // Forces all batched sprites to submitted to the device. |
||
133 | // |
||
134 | // End - |
||
135 | // Restores device state to how it was when Begin was called. |
||
136 | // |
||
137 | ////////////////////////////////////////////////////////////////////////////// |
||
138 | |||
139 | typedef interface ID3DX10Sprite ID3DX10Sprite; |
||
140 | typedef interface ID3DX10Sprite *LPD3DX10SPRITE; |
||
141 | |||
142 | |||
143 | // {BA0B762D-8D28-43ec-B9DC-2F84443B0614} |
||
144 | DEFINE_GUID(IID_ID3DX10Sprite, |
||
145 | 0xba0b762d, 0x8d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); |
||
146 | |||
147 | |||
148 | #undef INTERFACE |
||
149 | #define INTERFACE ID3DX10Sprite |
||
150 | |||
151 | DECLARE_INTERFACE_(ID3DX10Sprite, IUnknown) |
||
152 | { |
||
153 | // IUnknown |
||
154 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; |
||
155 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
||
156 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
||
157 | |||
158 | // ID3DX10Sprite |
||
159 | STDMETHOD(Begin)(THIS_ UINT flags) PURE; |
||
160 | |||
161 | STDMETHOD(DrawSpritesBuffered)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites) PURE; |
||
162 | STDMETHOD(Flush)(THIS) PURE; |
||
163 | |||
164 | STDMETHOD(DrawSpritesImmediate)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites, UINT cbSprite, UINT flags) PURE; |
||
165 | STDMETHOD(End)(THIS) PURE; |
||
166 | |||
167 | STDMETHOD(GetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; |
||
168 | STDMETHOD(SetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; |
||
169 | STDMETHOD(GetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; |
||
170 | STDMETHOD(SetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; |
||
171 | |||
172 | STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; |
||
173 | }; |
||
174 | |||
175 | |||
176 | #ifdef __cplusplus |
||
177 | extern "C" { |
||
178 | #endif //__cplusplus |
||
179 | |||
180 | HRESULT WINAPI |
||
181 | D3DX10CreateSprite( |
||
182 | ID3D10Device* pDevice, |
||
183 | UINT cDeviceBufferSize, |
||
184 | LPD3DX10SPRITE* ppSprite); |
||
185 | |||
186 | #ifdef __cplusplus |
||
187 | } |
||
188 | #endif //__cplusplus |
||
189 | |||
190 | |||
191 | ////////////////////////////////////////////////////////////////////////////// |
||
192 | // ID3DX10ThreadPump: |
||
193 | ////////////////////////////////////////////////////////////////////////////// |
||
194 | |||
195 | #undef INTERFACE |
||
196 | #define INTERFACE ID3DX10DataLoader |
||
197 | |||
198 | DECLARE_INTERFACE(ID3DX10DataLoader) |
||
199 | { |
||
200 | STDMETHOD(Load)(THIS) PURE; |
||
201 | STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE; |
||
202 | STDMETHOD(Destroy)(THIS) PURE; |
||
203 | }; |
||
204 | |||
205 | #undef INTERFACE |
||
206 | #define INTERFACE ID3DX10DataProcessor |
||
207 | |||
208 | DECLARE_INTERFACE(ID3DX10DataProcessor) |
||
209 | { |
||
210 | STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE; |
||
211 | STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE; |
||
212 | STDMETHOD(Destroy)(THIS) PURE; |
||
213 | }; |
||
214 | |||
215 | // {C93FECFA-6967-478a-ABBC-402D90621FCB} |
||
216 | DEFINE_GUID(IID_ID3DX10ThreadPump, |
||
217 | 0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb); |
||
218 | |||
219 | #undef INTERFACE |
||
220 | #define INTERFACE ID3DX10ThreadPump |
||
221 | |||
222 | DECLARE_INTERFACE_(ID3DX10ThreadPump, IUnknown) |
||
223 | { |
||
224 | // IUnknown |
||
225 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; |
||
226 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
||
227 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
||
228 | |||
229 | // ID3DX10ThreadPump |
||
230 | STDMETHOD(AddWorkItem)(THIS_ ID3DX10DataLoader *pDataLoader, ID3DX10DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE; |
||
231 | STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE; |
||
232 | |||
233 | STDMETHOD(WaitForAllItems)(THIS) PURE; |
||
234 | STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount); |
||
235 | |||
236 | STDMETHOD(PurgeAllItems)(THIS) PURE; |
||
237 | STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE; |
||
238 | |||
239 | }; |
||
240 | |||
241 | HRESULT WINAPI D3DX10CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX10ThreadPump **ppThreadPump); |
||
242 | |||
243 | |||
244 | ////////////////////////////////////////////////////////////////////////////// |
||
245 | // ID3DX10Font: |
||
246 | // ---------- |
||
247 | // Font objects contain the textures and resources needed to render a specific |
||
248 | // font on a specific device. |
||
249 | // |
||
250 | // GetGlyphData - |
||
251 | // Returns glyph cache data, for a given glyph. |
||
252 | // |
||
253 | // PreloadCharacters/PreloadGlyphs/PreloadText - |
||
254 | // Preloads glyphs into the glyph cache textures. |
||
255 | // |
||
256 | // DrawText - |
||
257 | // Draws formatted text on a D3D device. Some parameters are |
||
258 | // surprisingly similar to those of GDI's DrawText function. See GDI |
||
259 | // documentation for a detailed description of these parameters. |
||
260 | // If pSprite is NULL, an internal sprite object will be used. |
||
261 | // |
||
262 | ////////////////////////////////////////////////////////////////////////////// |
||
263 | |||
264 | typedef struct _D3DX10_FONT_DESCA |
||
265 | { |
||
266 | INT Height; |
||
267 | UINT Width; |
||
268 | UINT Weight; |
||
269 | UINT MipLevels; |
||
270 | BOOL Italic; |
||
271 | BYTE CharSet; |
||
272 | BYTE OutputPrecision; |
||
273 | BYTE Quality; |
||
274 | BYTE PitchAndFamily; |
||
275 | CHAR FaceName[LF_FACESIZE]; |
||
276 | |||
277 | } D3DX10_FONT_DESCA, *LPD3DX10_FONT_DESCA; |
||
278 | |||
279 | typedef struct _D3DX10_FONT_DESCW |
||
280 | { |
||
281 | INT Height; |
||
282 | UINT Width; |
||
283 | UINT Weight; |
||
284 | UINT MipLevels; |
||
285 | BOOL Italic; |
||
286 | BYTE CharSet; |
||
287 | BYTE OutputPrecision; |
||
288 | BYTE Quality; |
||
289 | BYTE PitchAndFamily; |
||
290 | WCHAR FaceName[LF_FACESIZE]; |
||
291 | |||
292 | } D3DX10_FONT_DESCW, *LPD3DX10_FONT_DESCW; |
||
293 | |||
294 | #ifdef UNICODE |
||
295 | typedef D3DX10_FONT_DESCW D3DX10_FONT_DESC; |
||
296 | typedef LPD3DX10_FONT_DESCW LPD3DX10_FONT_DESC; |
||
297 | #else |
||
298 | typedef D3DX10_FONT_DESCA D3DX10_FONT_DESC; |
||
299 | typedef LPD3DX10_FONT_DESCA LPD3DX10_FONT_DESC; |
||
300 | #endif |
||
301 | |||
302 | |||
303 | typedef interface ID3DX10Font ID3DX10Font; |
||
304 | typedef interface ID3DX10Font *LPD3DX10FONT; |
||
305 | |||
306 | |||
307 | // {D79DBB70-5F21-4d36-BBC2-FF525C213CDC} |
||
308 | DEFINE_GUID(IID_ID3DX10Font, |
||
309 | 0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); |
||
310 | |||
311 | |||
312 | #undef INTERFACE |
||
313 | #define INTERFACE ID3DX10Font |
||
314 | |||
315 | DECLARE_INTERFACE_(ID3DX10Font, IUnknown) |
||
316 | { |
||
317 | // IUnknown |
||
318 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; |
||
319 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
||
320 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
||
321 | |||
322 | // ID3DX10Font |
||
323 | STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; |
||
324 | STDMETHOD(GetDescA)(THIS_ D3DX10_FONT_DESCA *pDesc) PURE; |
||
325 | STDMETHOD(GetDescW)(THIS_ D3DX10_FONT_DESCW *pDesc) PURE; |
||
326 | STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; |
||
327 | STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; |
||
328 | |||
329 | STDMETHOD_(HDC, GetDC)(THIS) PURE; |
||
330 | STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, ID3D10ShaderResourceView** ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; |
||
331 | |||
332 | STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; |
||
333 | STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; |
||
334 | STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; |
||
335 | STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; |
||
336 | |||
337 | STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DX10SPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; |
||
338 | STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DX10SPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; |
||
339 | |||
340 | #ifdef __cplusplus |
||
341 | #ifdef UNICODE |
||
342 | HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCW *pDesc) { return GetDescW(pDesc); } |
||
343 | HRESULT WINAPI_INLINE PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } |
||
344 | #else |
||
345 | HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCA *pDesc) { return GetDescA(pDesc); } |
||
346 | HRESULT WINAPI_INLINE PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } |
||
347 | #endif |
||
348 | #endif //__cplusplus |
||
349 | }; |
||
350 | |||
351 | #ifndef GetTextMetrics |
||
352 | #ifdef UNICODE |
||
353 | #define GetTextMetrics GetTextMetricsW |
||
354 | #else |
||
355 | #define GetTextMetrics GetTextMetricsA |
||
356 | #endif |
||
357 | #endif |
||
358 | |||
359 | #ifndef DrawText |
||
360 | #ifdef UNICODE |
||
361 | #define DrawText DrawTextW |
||
362 | #else |
||
363 | #define DrawText DrawTextA |
||
364 | #endif |
||
365 | #endif |
||
366 | |||
367 | |||
368 | #ifdef __cplusplus |
||
369 | extern "C" { |
||
370 | #endif //__cplusplus |
||
371 | |||
372 | |||
373 | HRESULT WINAPI |
||
374 | D3DX10CreateFontA( |
||
375 | ID3D10Device* pDevice, |
||
376 | INT Height, |
||
377 | UINT Width, |
||
378 | UINT Weight, |
||
379 | UINT MipLevels, |
||
380 | BOOL Italic, |
||
381 | UINT CharSet, |
||
382 | UINT OutputPrecision, |
||
383 | UINT Quality, |
||
384 | UINT PitchAndFamily, |
||
385 | LPCSTR pFaceName, |
||
386 | LPD3DX10FONT* ppFont); |
||
387 | |||
388 | HRESULT WINAPI |
||
389 | D3DX10CreateFontW( |
||
390 | ID3D10Device* pDevice, |
||
391 | INT Height, |
||
392 | UINT Width, |
||
393 | UINT Weight, |
||
394 | UINT MipLevels, |
||
395 | BOOL Italic, |
||
396 | UINT CharSet, |
||
397 | UINT OutputPrecision, |
||
398 | UINT Quality, |
||
399 | UINT PitchAndFamily, |
||
400 | LPCWSTR pFaceName, |
||
401 | LPD3DX10FONT* ppFont); |
||
402 | |||
403 | #ifdef UNICODE |
||
404 | #define D3DX10CreateFont D3DX10CreateFontW |
||
405 | #else |
||
406 | #define D3DX10CreateFont D3DX10CreateFontA |
||
407 | #endif |
||
408 | |||
409 | |||
410 | HRESULT WINAPI |
||
411 | D3DX10CreateFontIndirectA( |
||
412 | ID3D10Device* pDevice, |
||
413 | CONST D3DX10_FONT_DESCA* pDesc, |
||
414 | LPD3DX10FONT* ppFont); |
||
415 | |||
416 | HRESULT WINAPI |
||
417 | D3DX10CreateFontIndirectW( |
||
418 | ID3D10Device* pDevice, |
||
419 | CONST D3DX10_FONT_DESCW* pDesc, |
||
420 | LPD3DX10FONT* ppFont); |
||
421 | |||
422 | #ifdef UNICODE |
||
423 | #define D3DX10CreateFontIndirect D3DX10CreateFontIndirectW |
||
424 | #else |
||
425 | #define D3DX10CreateFontIndirect D3DX10CreateFontIndirectA |
||
426 | #endif |
||
427 | |||
428 | HRESULT WINAPI D3DX10UnsetAllDeviceObjects(ID3D10Device *pDevice); |
||
429 | |||
430 | #ifdef __cplusplus |
||
431 | } |
||
432 | #endif //__cplusplus |
||
433 | |||
434 | /////////////////////////////////////////////////////////////////////////// |
||
435 | |||
436 | #define _FACD3D 0x876 |
||
437 | #define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) |
||
438 | #define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) |
||
439 | |||
440 | #define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) |
||
441 | #define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) |
||
442 | |||
443 | #endif //__D3DX10CORE_H__ |
||
444 |