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