2 // Copyright (c) Microsoft. All rights reserved.
3 // This code is licensed under the MIT License (MIT).
4 // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
5 // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
6 // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
7 // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 //--------------------------------------------------------------------------------------
11 // Functions for loading a DDS texture and creating a Direct3D runtime resource for it
13 // Note these functions are useful as a light-weight runtime loader for DDS files. For
14 // a full-featured DDS file reader, writer, and texture processing pipeline see
15 // the 'Texconv' sample and the 'DirectXTex' library.
17 // http://go.microsoft.com/fwlink/?LinkId=248926
18 // http://go.microsoft.com/fwlink/?LinkId=248929
19 //--------------------------------------------------------------------------------------
23 #include <vkd3d_d3d12.h>
26 #pragma warning(disable : 4005)
32 DDS_ALPHA_MODE_UNKNOWN
= 0,
33 DDS_ALPHA_MODE_STRAIGHT
= 1,
34 DDS_ALPHA_MODE_PREMULTIPLIED
= 2,
35 DDS_ALPHA_MODE_OPAQUE
= 3,
36 DDS_ALPHA_MODE_CUSTOM
= 4,
39 HRESULT __cdecl
CreateDDSTextureFromMemory( _In_ ID3D12Device
* d3dDevice
,
40 _In_reads_bytes_(ddsDataSize
) const uint8_t* ddsData
,
41 _In_
size_t ddsDataSize
,
44 _Outptr_opt_ ID3D12Resource
** texture
,
45 _In_ D3D12_CPU_DESCRIPTOR_HANDLE textureView
,
46 _Out_opt_ DDS_ALPHA_MODE
* alphaMode
= nullptr
49 size_t BitsPerPixel(_In_ DXGI_FORMAT fmt
);