Subversion Repositories Games.Chess Giants

Rev

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