Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

772 lines
26 KiB

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