C++ Game Framework  2013-06-04
CGF is a DirectX 11 game framework, built in C++ and DirectX 11. This is used to contain many to the DirectX functionality and wrap them into a framework to make game development easier.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DDSTextureLoader.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------
2 // File: DDSTextureLoader.h
3 //
4 // Functions for loading a DDS texture and creating a Direct3D 11 runtime resource for it
5 //
6 // Note these functions are useful as a light-weight runtime loader for DDS files. For
7 // a full-featured DDS file reader, writer, and texture processing pipeline see
8 // the 'Texconv' sample and the 'DirectXTex' library.
9 //
10 // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
11 // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
12 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
13 // PARTICULAR PURPOSE.
14 //
15 // Copyright (c) Microsoft Corporation. All rights reserved.
16 //
17 // http://go.microsoft.com/fwlink/?LinkId=248926
18 // http://go.microsoft.com/fwlink/?LinkId=248929
19 //--------------------------------------------------------------------------------------
20 
21 #ifdef _MSC_VER
22 #pragma once
23 #endif
24 
25 #include <d3d11.h>
26 
27 #pragma warning(push)
28 #pragma warning(disable : 4005)
29 #include <stdint.h>
30 #pragma warning(pop)
31 
32 #if defined(_MSC_VER) && (_MSC_VER<1610) && !defined(_In_reads_)
33 #define _In_reads_(exp)
34 #define _Out_writes_(exp)
35 #define _In_reads_bytes_(exp)
36 #define _Outptr_opt_
37 #endif
38 
39 #ifndef _Use_decl_annotations_
40 #define _Use_decl_annotations_
41 #endif
42 
43 namespace DirectX
44 {
46  {
52  };
53 
54  HRESULT CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice,
55  _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
56  _In_ size_t ddsDataSize,
57  _Outptr_opt_ ID3D11Resource** texture,
58  _Outptr_opt_ ID3D11ShaderResourceView** textureView,
59  _In_ size_t maxsize = 0,
60  _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
61  );
62 
63  HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice,
64  _In_z_ const wchar_t* szFileName,
65  _Outptr_opt_ ID3D11Resource** texture,
66  _Outptr_opt_ ID3D11ShaderResourceView** textureView,
67  _In_ size_t maxsize = 0,
68  _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
69  );
70 
71  HRESULT CreateDDSTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
72  _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
73  _In_ size_t ddsDataSize,
74  _In_ size_t maxsize,
75  _In_ D3D11_USAGE usage,
76  _In_ unsigned int bindFlags,
77  _In_ unsigned int cpuAccessFlags,
78  _In_ unsigned int miscFlags,
79  _In_ bool forceSRGB,
80  _Outptr_opt_ ID3D11Resource** texture,
81  _Outptr_opt_ ID3D11ShaderResourceView** textureView,
82  _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
83  );
84 
85  HRESULT CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
86  _In_z_ const wchar_t* szFileName,
87  _In_ size_t maxsize,
88  _In_ D3D11_USAGE usage,
89  _In_ unsigned int bindFlags,
90  _In_ unsigned int cpuAccessFlags,
91  _In_ unsigned int miscFlags,
92  _In_ bool forceSRGB,
93  _Outptr_opt_ ID3D11Resource** texture,
94  _Outptr_opt_ ID3D11ShaderResourceView** textureView,
95  _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr
96  );
97 }