1 module directx.d3dx11tex;
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
5 //
6 //  File:       d3dx11tex.h
7 //  Content:    D3DX11 texturing APIs
8 //
9 //////////////////////////////////////////////////////////////////////////////
10 
11 import directx.com;
12 import directx.win32;
13 import directx.d3dx11;
14 
15 //----------------------------------------------------------------------------
16 // D3DX11_FILTER flags:
17 // ------------------
18 //
19 // A valid filter must contain one of these values:
20 //
21 //  D3DX11_FILTER_NONE
22 //      No scaling or filtering will take place.  Pixels outside the bounds
23 //      of the source image are assumed to be transparent black.
24 //  D3DX11_FILTER_POINT
25 //      Each destination pixel is computed by sampling the nearest pixel
26 //      from the source image.
27 //  D3DX11_FILTER_LINEAR
28 //      Each destination pixel is computed by linearly interpolating between
29 //      the nearest pixels in the source image.  This filter works best 
30 //      when the scale on each axis is less than 2.
31 //  D3DX11_FILTER_TRIANGLE
32 //      Every pixel in the source image contributes equally to the
33 //      destination image.  This is the slowest of all the filters.
34 //  D3DX11_FILTER_BOX
35 //      Each pixel is computed by averaging a 2x2(x2) box pixels from 
36 //      the source image. Only works when the dimensions of the 
37 //      destination are half those of the source. (as with mip maps)
38 //
39 // And can be OR'd with any of these optional flags:
40 //
41 //  D3DX11_FILTER_MIRROR_U
42 //      Indicates that pixels off the edge of the texture on the U-axis
43 //      should be mirrored, not wraped.
44 //  D3DX11_FILTER_MIRROR_V
45 //      Indicates that pixels off the edge of the texture on the V-axis
46 //      should be mirrored, not wraped.
47 //  D3DX11_FILTER_MIRROR_W
48 //      Indicates that pixels off the edge of the texture on the W-axis
49 //      should be mirrored, not wraped.
50 //  D3DX11_FILTER_MIRROR
51 //      Same as specifying D3DX11_FILTER_MIRROR_U | D3DX11_FILTER_MIRROR_V |
52 //      D3DX11_FILTER_MIRROR_V
53 //  D3DX11_FILTER_DITHER
54 //      Dithers the resulting image using a 4x4 order dither pattern.
55 //  D3DX11_FILTER_SRGB_IN
56 //      Denotes that the input data is in sRGB (gamma 2.2) colorspace.
57 //  D3DX11_FILTER_SRGB_OUT
58 //      Denotes that the output data is in sRGB (gamma 2.2) colorspace.
59 //  D3DX11_FILTER_SRGB
60 //      Same as specifying D3DX11_FILTER_SRGB_IN | D3DX11_FILTER_SRGB_OUT
61 //
62 //----------------------------------------------------------------------------
63 
64 alias D3DX11_FILTER_FLAG = int;
65 enum : D3DX11_FILTER_FLAG
66 {
67     D3DX11_FILTER_NONE            =   (1 << 0),
68     D3DX11_FILTER_POINT           =   (2 << 0),
69     D3DX11_FILTER_LINEAR          =   (3 << 0),
70     D3DX11_FILTER_TRIANGLE        =   (4 << 0),
71     D3DX11_FILTER_BOX             =   (5 << 0),
72 
73     D3DX11_FILTER_MIRROR_U        =   (1 << 16),
74     D3DX11_FILTER_MIRROR_V        =   (2 << 16),
75     D3DX11_FILTER_MIRROR_W        =   (4 << 16),
76     D3DX11_FILTER_MIRROR          =   (7 << 16),
77 
78     D3DX11_FILTER_DITHER          =   (1 << 19),
79     D3DX11_FILTER_DITHER_DIFFUSION=   (2 << 19),
80 
81     D3DX11_FILTER_SRGB_IN         =   (1 << 21),
82     D3DX11_FILTER_SRGB_OUT        =   (2 << 21),
83     D3DX11_FILTER_SRGB            =   (3 << 21),
84 }
85 
86 //----------------------------------------------------------------------------
87 // D3DX11_NORMALMAP flags:
88 // ---------------------
89 // These flags are used to control how D3DX11ComputeNormalMap generates normal
90 // maps.  Any number of these flags may be OR'd together in any combination.
91 //
92 //  D3DX11_NORMALMAP_MIRROR_U
93 //      Indicates that pixels off the edge of the texture on the U-axis
94 //      should be mirrored, not wraped.
95 //  D3DX11_NORMALMAP_MIRROR_V
96 //      Indicates that pixels off the edge of the texture on the V-axis
97 //      should be mirrored, not wraped.
98 //  D3DX11_NORMALMAP_MIRROR
99 //      Same as specifying D3DX11_NORMALMAP_MIRROR_U | D3DX11_NORMALMAP_MIRROR_V
100 //  D3DX11_NORMALMAP_INVERTSIGN
101 //      Inverts the direction of each normal 
102 //  D3DX11_NORMALMAP_COMPUTE_OCCLUSION
103 //      Compute the per pixel Occlusion term and encodes it into the alpha.
104 //      An Alpha of 1 means that the pixel is not obscured in anyway, and
105 //      an alpha of 0 would mean that the pixel is completly obscured.
106 //
107 //----------------------------------------------------------------------------
108 
109 alias D3DX11_NORMALMAP_FLAG = int;
110 enum : D3DX11_NORMALMAP_FLAG
111 {
112     D3DX11_NORMALMAP_MIRROR_U          =   (1 << 16),
113     D3DX11_NORMALMAP_MIRROR_V          =   (2 << 16),
114     D3DX11_NORMALMAP_MIRROR            =   (3 << 16),
115     D3DX11_NORMALMAP_INVERTSIGN        =   (8 << 16),
116     D3DX11_NORMALMAP_COMPUTE_OCCLUSION =   (16 << 16),
117 }
118 
119 //----------------------------------------------------------------------------
120 // D3DX11_CHANNEL flags:
121 // -------------------
122 // These flags are used by functions which operate on or more channels
123 // in a texture.
124 //
125 // D3DX11_CHANNEL_RED
126 //     Indicates the red channel should be used
127 // D3DX11_CHANNEL_BLUE
128 //     Indicates the blue channel should be used
129 // D3DX11_CHANNEL_GREEN
130 //     Indicates the green channel should be used
131 // D3DX11_CHANNEL_ALPHA
132 //     Indicates the alpha channel should be used
133 // D3DX11_CHANNEL_LUMINANCE
134 //     Indicates the luminaces of the red green and blue channels should be 
135 //     used.
136 //
137 //----------------------------------------------------------------------------
138 
139 alias D3DX11_CHANNEL_FLAG = int;
140 enum : D3DX11_CHANNEL_FLAG
141 {
142     D3DX11_CHANNEL_RED           =    (1 << 0),
143     D3DX11_CHANNEL_BLUE          =    (1 << 1),
144     D3DX11_CHANNEL_GREEN         =    (1 << 2),
145     D3DX11_CHANNEL_ALPHA         =    (1 << 3),
146     D3DX11_CHANNEL_LUMINANCE     =    (1 << 4),
147 };
148 
149 
150 
151 //----------------------------------------------------------------------------
152 // D3DX11_IMAGE_FILE_FORMAT:
153 // ---------------------
154 // This enum is used to describe supported image file formats.
155 //
156 //----------------------------------------------------------------------------
157 
158 alias D3DX11_IMAGE_FILE_FORMAT = int;
159 enum : D3DX11_IMAGE_FILE_FORMAT
160 {
161     D3DX11_IFF_BMP         = 0,
162     D3DX11_IFF_JPG         = 1,
163     D3DX11_IFF_PNG         = 3,
164     D3DX11_IFF_DDS         = 4,
165     D3DX11_IFF_TIFF		  = 10,
166     D3DX11_IFF_GIF		  = 11,
167     D3DX11_IFF_WMP		  = 12,
168     D3DX11_IFF_FORCE_DWORD = 0x7fffffff
169 
170 }
171 
172 
173 //----------------------------------------------------------------------------
174 // D3DX11_SAVE_TEXTURE_FLAG:
175 // ---------------------
176 // This enum is used to support texture saving options.
177 //
178 //----------------------------------------------------------------------------
179 
180 alias D3DX11_SAVE_TEXTURE_FLAG = int;
181 enum : D3DX11_SAVE_TEXTURE_FLAG
182 {
183     D3DX11_STF_USEINPUTBLOB      = 0x0001,
184 }
185 
186 
187 //----------------------------------------------------------------------------
188 // D3DX11_IMAGE_INFO:
189 // ---------------
190 // This structure is used to return a rough description of what the
191 // the original contents of an image file looked like.
192 // 
193 //  Width
194 //      Width of original image in pixels
195 //  Height
196 //      Height of original image in pixels
197 //  Depth
198 //      Depth of original image in pixels
199 //  ArraySize
200 //      Array size in textures
201 //  MipLevels
202 //      Number of mip levels in original image
203 //  MiscFlags
204 //      Miscellaneous flags
205 //  Format
206 //      D3D format which most closely describes the data in original image
207 //  ResourceDimension
208 //      D3D11_RESOURCE_DIMENSION representing the dimension of texture stored in the file.
209 //      D3D11_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D
210 //  ImageFileFormat
211 //      D3DX11_IMAGE_FILE_FORMAT representing the format of the image file.
212 //----------------------------------------------------------------------------
213 
214 struct D3DX11_IMAGE_INFO
215 {
216     UINT                        Width;
217     UINT                        Height;
218     UINT                        Depth;
219     UINT                        ArraySize;
220     UINT                        MipLevels;
221     UINT                        MiscFlags;
222     DXGI_FORMAT                 Format;
223     D3D11_RESOURCE_DIMENSION    ResourceDimension;
224     D3DX11_IMAGE_FILE_FORMAT    ImageFileFormat;
225 }
226 
227 
228 
229 
230 //////////////////////////////////////////////////////////////////////////////
231 // Image File APIs ///////////////////////////////////////////////////////////
232 //////////////////////////////////////////////////////////////////////////////
233 
234 //----------------------------------------------------------------------------
235 // D3DX11_IMAGE_LOAD_INFO:
236 // ---------------
237 // This structure can be optionally passed in to texture loader APIs to 
238 // control how textures get loaded. Pass in D3DX11_DEFAULT for any of these
239 // to have D3DX automatically pick defaults based on the source file.
240 // 
241 //  Width
242 //      Rescale texture to Width texels wide
243 //  Height
244 //      Rescale texture to Height texels high
245 //  Depth
246 //      Rescale texture to Depth texels deep
247 //  FirstMipLevel
248 //      First mip level to load
249 //  MipLevels
250 //      Number of mip levels to load after the first level
251 //  Usage
252 //      D3D11_USAGE flag for the new texture
253 //  BindFlags
254 //      D3D11 Bind flags for the new texture
255 //  CpuAccessFlags
256 //      D3D11 CPU Access flags for the new texture
257 //  MiscFlags
258 //      Reserved. Must be 0
259 //  Format
260 //      Resample texture to the specified format
261 //  Filter
262 //      Filter the texture using the specified filter (only when resampling)
263 //  MipFilter
264 //      Filter the texture mip levels using the specified filter (only if 
265 //      generating mips)
266 //  pSrcInfo
267 //      (optional) pointer to a D3DX11_IMAGE_INFO structure that will get 
268 //      populated with source image information
269 //----------------------------------------------------------------------------
270 
271 
272 struct D3DX11_IMAGE_LOAD_INFO
273 {
274     UINT                       Width             = D3DX11_DEFAULT;
275     UINT                       Height            = D3DX11_DEFAULT;
276     UINT                       Depth             = D3DX11_DEFAULT;
277     UINT                       FirstMipLevel     = D3DX11_DEFAULT;
278     UINT                       MipLevels         = D3DX11_DEFAULT;
279     D3D11_USAGE                Usage             = cast(D3D11_USAGE) D3DX11_DEFAULT;
280     UINT                       BindFlags         = D3DX11_DEFAULT;
281     UINT                       CpuAccessFlags    = D3DX11_DEFAULT;
282     UINT                       MiscFlags         = D3DX11_DEFAULT;
283     DXGI_FORMAT                Format            = DXGI_FORMAT_FROM_FILE;
284     UINT                       Filter            = D3DX11_DEFAULT;
285     UINT                       MipFilter         = D3DX11_DEFAULT;
286     D3DX11_IMAGE_INFO*         pSrcInfo;
287 }
288 
289 //-------------------------------------------------------------------------------
290 // GetImageInfoFromFile/Resource/Memory:
291 // ------------------------------
292 // Fills in a D3DX11_IMAGE_INFO struct with information about an image file.
293 //
294 // Parameters:
295 //  pSrcFile
296 //      File name of the source image.
297 //  pSrcModule
298 //      Module where resource is located, or NULL for module associated
299 //      with image the os used to create the current process.
300 //  pSrcResource
301 //      Resource name.
302 //  pSrcData
303 //      Pointer to file in memory.
304 //  SrcDataSize
305 //      Size in bytes of file in memory.
306 //  pPump
307 //      Optional pointer to a thread pump object to use.
308 //  pSrcInfo
309 //      Pointer to a D3DX11_IMAGE_INFO structure to be filled in with the 
310 //      description of the data in the source image file.
311 //  pHResult
312 //      Pointer to a memory location to receive the return value upon completion.
313 //      Maybe NULL if not needed.
314 //      If pPump != NULL, pHResult must be a valid memory location until the
315 //      the asynchronous execution completes.
316 //-------------------------------------------------------------------------------
317 
318 extern(Windows) 
319 HRESULT 
320 	D3DX11GetImageInfoFromFileA(
321         LPCSTR                    pSrcFile,
322         ID3DX11ThreadPump         pPump,
323         D3DX11_IMAGE_INFO*        pSrcInfo,
324         HRESULT*                  pHResult);
325 		
326 extern(Windows)
327 HRESULT 
328 	D3DX11GetImageInfoFromFileW(
329         LPCWSTR                   pSrcFile,
330         ID3DX11ThreadPump         pPump,
331         D3DX11_IMAGE_INFO*        pSrcInfo,
332         HRESULT*                  pHResult);
333 
334 alias D3DX11GetImageInfoFromFileW D3DX11GetImageInfoFromFile;
335 
336 
337 extern(Windows)
338 HRESULT 
339 	D3DX11GetImageInfoFromResourceA(
340         HMODULE                   hSrcModule,
341         LPCSTR                    pSrcResource,
342         ID3DX11ThreadPump         pPump,
343         D3DX11_IMAGE_INFO*        pSrcInfo,
344         HRESULT*                  pHResult);
345 
346 extern(Windows)
347 HRESULT 
348 	D3DX11GetImageInfoFromResourceW(
349         HMODULE                   hSrcModule,
350         LPCWSTR                   pSrcResource,
351         ID3DX11ThreadPump         pPump,
352         D3DX11_IMAGE_INFO*        pSrcInfo,
353         HRESULT*                  pHResult);
354 
355 alias D3DX11GetImageInfoFromResourceW D3DX11GetImageInfoFromResource;
356 
357 
358 extern(Windows)
359 HRESULT 
360 	D3DX11GetImageInfoFromMemory(
361         LPCVOID                   pSrcData,
362         SIZE_T                    SrcDataSize,
363         ID3DX11ThreadPump         pPump,
364         D3DX11_IMAGE_INFO*        pSrcInfo,
365         HRESULT*                  pHResult);
366 
367 
368 //////////////////////////////////////////////////////////////////////////////
369 // Create/Save Texture APIs //////////////////////////////////////////////////
370 //////////////////////////////////////////////////////////////////////////////
371 
372 //----------------------------------------------------------------------------
373 // D3DX11CreateTextureFromFile/Resource/Memory:
374 // D3DX11CreateShaderResourceViewFromFile/Resource/Memory:
375 // -----------------------------------
376 // Create a texture object from a file or resource.
377 //
378 // Parameters:
379 //
380 //  pDevice
381 //      The D3D device with which the texture is going to be used.
382 //  pSrcFile
383 //      File name.
384 //  hSrcModule
385 //      Module handle. if NULL, current module will be used.
386 //  pSrcResource
387 //      Resource name in module
388 //  pvSrcData
389 //      Pointer to file in memory.
390 //  SrcDataSize
391 //      Size in bytes of file in memory.
392 //  pLoadInfo
393 //      Optional pointer to a D3DX11_IMAGE_LOAD_INFO structure that
394 //      contains additional loader parameters.
395 //  pPump
396 //      Optional pointer to a thread pump object to use.
397 //  ppTexture
398 //      [out] Created texture object.
399 //  ppShaderResourceView
400 //      [out] Shader resource view object created.
401 //  pHResult
402 //      Pointer to a memory location to receive the return value upon completion.
403 //      Maybe NULL if not needed.
404 //      If pPump != NULL, pHResult must be a valid memory location until the
405 //      the asynchronous execution completes.
406 //
407 //----------------------------------------------------------------------------
408 
409 
410 // FromFile
411 extern(Windows)
412 HRESULT
413     D3DX11CreateShaderResourceViewFromFileA(
414         ID3D11Device                pDevice,
415         LPCSTR                      pSrcFile,
416         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
417         ID3DX11ThreadPump           pPump,
418         ID3D11ShaderResourceView*   ppShaderResourceView,
419         HRESULT*                    pHResult);
420 
421 extern(Windows)
422 HRESULT
423     D3DX11CreateShaderResourceViewFromFileW(
424         ID3D11Device               pDevice,
425         LPCWSTR                     pSrcFile,
426         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
427         ID3DX11ThreadPump           pPump,
428         ID3D11ShaderResourceView*   ppShaderResourceView,
429         HRESULT*                    pHResult);
430 
431 alias D3DX11CreateShaderResourceViewFromFileW D3DX11CreateShaderResourceViewFromFile;
432 
433 
434 extern(Windows)
435 HRESULT
436     D3DX11CreateTextureFromFileA(
437         ID3D11Device                pDevice,
438         LPCSTR                      pSrcFile,
439         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
440         ID3DX11ThreadPump           pPump,
441         ID3D11Resource*             ppTexture,
442         HRESULT*                    pHResult);
443 		
444 		
445 extern(Windows)
446 HRESULT
447     D3DX11CreateTextureFromFileW(
448         ID3D11Device                pDevice,
449         LPCWSTR                     pSrcFile,
450         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
451         ID3DX11ThreadPump           pPump,
452         ID3D11Resource*             ppTexture,
453         HRESULT*                    pHResult);
454 
455 alias D3DX11CreateTextureFromFileW D3DX11CreateTextureFromFile;
456 
457 
458 // FromResource (resources in dll/exes)
459 extern(Windows)
460 HRESULT
461     D3DX11CreateShaderResourceViewFromResourceA(
462         ID3D11Device               pDevice,
463         HMODULE                    hSrcModule,
464         LPCSTR                     pSrcResource,
465         D3DX11_IMAGE_LOAD_INFO*    pLoadInfo,
466         ID3DX11ThreadPump          pPump,
467         ID3D11ShaderResourceView*  ppShaderResourceView,
468         HRESULT*                   pHResult);
469 		
470 extern(Windows)
471 HRESULT
472     D3DX11CreateShaderResourceViewFromResourceW(
473         ID3D11Device               pDevice,
474         HMODULE                    hSrcModule,
475         LPCWSTR                    pSrcResource,
476         D3DX11_IMAGE_LOAD_INFO*    pLoadInfo,
477         ID3DX11ThreadPump          pPump,
478         ID3D11ShaderResourceView*  ppShaderResourceView,
479         HRESULT*                   pHResult);
480 
481 alias D3DX11CreateShaderResourceViewFromResourceW D3DX11CreateShaderResourceViewFromResource;
482 
483 
484 extern(Windows)
485 HRESULT
486     D3DX11CreateTextureFromResourceA(
487         ID3D11Device             pDevice,
488         HMODULE                  hSrcModule,
489         LPCSTR                   pSrcResource,
490         D3DX11_IMAGE_LOAD_INFO*  pLoadInfo,  
491         ID3DX11ThreadPump        pPump,   
492         ID3D11Resource*          ppTexture,
493         HRESULT*                 pHResult);
494 		
495 extern(Windows)
496 HRESULT
497     D3DX11CreateTextureFromResourceW(
498         ID3D11Device             pDevice,
499         HMODULE                  hSrcModule,
500         LPCWSTR                  pSrcResource,
501         D3DX11_IMAGE_LOAD_INFO*  pLoadInfo,
502         ID3DX11ThreadPump        pPump,
503         ID3D11Resource*          ppTexture,
504         HRESULT*                 pHResult);
505 
506 alias D3DX11CreateTextureFromResourceW D3DX11CreateTextureFromResource;
507 
508 
509 // FromFileInMemory
510 extern(Windows)
511 HRESULT
512     D3DX11CreateShaderResourceViewFromMemory(
513         ID3D11Device               pDevice,
514         LPCVOID                    pSrcData,
515         SIZE_T                     SrcDataSize,
516         D3DX11_IMAGE_LOAD_INFO*    pLoadInfo,
517         ID3DX11ThreadPump          pPump,        
518         ID3D11ShaderResourceView*  ppShaderResourceView,
519         HRESULT*                   pHResult);
520 		
521 extern(Windows)
522 HRESULT
523     D3DX11CreateTextureFromMemory(
524         ID3D11Device              pDevice,
525         LPCVOID                   pSrcData,
526         SIZE_T                    SrcDataSize,
527         D3DX11_IMAGE_LOAD_INFO*   pLoadInfo,    
528         ID3DX11ThreadPump         pPump,    
529         ID3D11Resource*           ppTexture,
530         HRESULT*                  pHResult);
531 
532 
533 //////////////////////////////////////////////////////////////////////////////
534 // Misc Texture APIs /////////////////////////////////////////////////////////
535 //////////////////////////////////////////////////////////////////////////////
536 
537 //----------------------------------------------------------------------------
538 // D3DX11_TEXTURE_LOAD_INFO:
539 // ------------------------
540 //
541 //----------------------------------------------------------------------------
542 
543 struct D3DX11_TEXTURE_LOAD_INFO
544 {
545     D3D11_BOX       *pSrcBox;
546     D3D11_BOX       *pDstBox;
547     UINT            SrcFirstMip;
548     UINT            DstFirstMip;
549     UINT            NumMips               = D3DX11_DEFAULT;
550     UINT            SrcFirstElement;
551     UINT            DstFirstElement;
552     UINT            NumElements           = D3DX11_DEFAULT;
553     UINT            Filter                = D3DX11_DEFAULT;
554     UINT            MipFilter             = D3DX11_DEFAULT;
555 }
556 
557 
558 //----------------------------------------------------------------------------
559 // D3DX11LoadTextureFromTexture:
560 // ----------------------------
561 // Load a texture from a texture.
562 //
563 // Parameters:
564 //
565 //----------------------------------------------------------------------------
566 
567 extern(Windows)
568 HRESULT
569     D3DX11LoadTextureFromTexture(
570 		ID3D11DeviceContext        pContext,
571         ID3D11Resource             pSrcTexture,
572         D3DX11_TEXTURE_LOAD_INFO*  pLoadInfo,
573         ID3D11Resource             pDstTexture);
574 
575 
576 //----------------------------------------------------------------------------
577 // D3DX11FilterTexture:
578 // ------------------
579 // Filters mipmaps levels of a texture.
580 //
581 // Parameters:
582 //  pBaseTexture
583 //      The texture object to be filtered
584 //  SrcLevel
585 //      The level whose image is used to generate the subsequent levels. 
586 //  MipFilter
587 //      D3DX11_FILTER flags controlling how each miplevel is filtered.
588 //      Or D3DX11_DEFAULT for D3DX11_FILTER_BOX,
589 //
590 //----------------------------------------------------------------------------
591 extern(Windows)
592 HRESULT
593     D3DX11FilterTexture(
594 		ID3D11DeviceContext       pContext,
595         ID3D11Resource            pTexture,
596         UINT                      SrcLevel,
597         UINT                      MipFilter);
598 
599 
600 //----------------------------------------------------------------------------
601 // D3DX11SaveTextureToFile:
602 // ----------------------
603 // Save a texture to a file.
604 //
605 // Parameters:
606 //  pDestFile
607 //      File name of the destination file
608 //  DestFormat
609 //      D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
610 //  pSrcTexture
611 //      Source texture, containing the image to be saved
612 //
613 //----------------------------------------------------------------------------
614 extern(Windows)
615 HRESULT
616     D3DX11SaveTextureToFileA(
617 		ID3D11DeviceContext        pContext,
618         ID3D11Resource             pSrcTexture,
619         D3DX11_IMAGE_FILE_FORMAT    DestFormat,
620         LPCSTR                    pDestFile);
621 		
622 extern(Windows)
623 HRESULT
624     D3DX11SaveTextureToFileW(
625 		ID3D11DeviceContext        pContext,
626         ID3D11Resource             pSrcTexture,
627         D3DX11_IMAGE_FILE_FORMAT    DestFormat,
628         LPCWSTR                   pDestFile);
629 		
630 alias D3DX11SaveTextureToFileW D3DX11SaveTextureToFile;
631 
632 
633 //----------------------------------------------------------------------------
634 // D3DX11SaveTextureToMemory:
635 // ----------------------
636 // Save a texture to a blob.
637 //
638 // Parameters:
639 //  pSrcTexture
640 //      Source texture, containing the image to be saved
641 //  DestFormat
642 //      D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
643 //  ppDestBuf
644 //      address of a d3dxbuffer pointer to return the image data
645 //  Flags
646 //      optional flags
647 //----------------------------------------------------------------------------
648 extern(Windows)
649 HRESULT
650     D3DX11SaveTextureToMemory(
651 		ID3D11DeviceContext        pContext,
652         ID3D11Resource             pSrcTexture,
653         D3DX11_IMAGE_FILE_FORMAT   DestFormat,
654         ID3D10Blob*                ppDestBuf,
655         UINT                       Flags);
656 
657 
658 //----------------------------------------------------------------------------
659 // D3DX11ComputeNormalMap:
660 // ---------------------
661 // Converts a height map into a normal map.  The (x,y,z) components of each
662 // normal are mapped to the (r,g,b) channels of the output texture.
663 //
664 // Parameters
665 //  pSrcTexture
666 //      Pointer to the source heightmap texture 
667 //  Flags
668 //      D3DX11_NORMALMAP flags
669 //  Channel
670 //      D3DX11_CHANNEL specifying source of height information
671 //  Amplitude
672 //      The constant value which the height information is multiplied by.
673 //  pDestTexture
674 //      Pointer to the destination texture
675 //---------------------------------------------------------------------------
676 extern(Windows)
677 HRESULT
678     D3DX11ComputeNormalMap(
679         ID3D11DeviceContext       pContext,
680         ID3D11Texture2D		      pSrcTexture,
681         UINT                      Flags,
682         UINT                      Channel,
683         FLOAT                     Amplitude,
684         ID3D11Texture2D		      pDestTexture);
685 
686 
687 //----------------------------------------------------------------------------
688 // D3DX11SHProjectCubeMap:
689 // ----------------------
690 //  Projects a function represented in a cube map into spherical harmonics.
691 //
692 //  Parameters:
693 //   Order
694 //      Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
695 //   pCubeMap
696 //      CubeMap that is going to be projected into spherical harmonics
697 //   pROut
698 //      Output SH vector for Red.
699 //   pGOut
700 //      Output SH vector for Green
701 //   pBOut
702 //      Output SH vector for Blue        
703 //
704 //---------------------------------------------------------------------------
705 extern(Windows)
706 HRESULT
707     D3DX11SHProjectCubeMap(
708         ID3D11DeviceContext                                pContext,
709         UINT                                               Order,
710         ID3D11Texture2D                                    pCubeMap,
711         FLOAT*                                             pROut,
712         FLOAT*                                             pGOut,
713 		FLOAT*                                             pBOut);