2016-08-22 18:26:36 +00:00
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
// File: WICTextureLoader12.h
|
|
|
|
//
|
2016-09-23 05:34:50 +00:00
|
|
|
// Function for loading a WIC image and creating a Direct3D runtime texture for it
|
2016-08-22 18:26:36 +00:00
|
|
|
// (auto-generating mipmaps if possible)
|
|
|
|
//
|
|
|
|
// Note: Assumes application has already called CoInitializeEx
|
|
|
|
//
|
|
|
|
// Note these functions are useful for images created as simple 2D textures. For
|
|
|
|
// more complex resources, DDSTextureLoader is an excellent light-weight runtime loader.
|
|
|
|
// For a full-featured DDS file reader, writer, and texture processing pipeline see
|
|
|
|
// the 'Texconv' sample and the 'DirectXTex' library.
|
|
|
|
//
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
2018-02-24 06:24:46 +00:00
|
|
|
// Licensed under the MIT License.
|
2016-08-22 18:26:36 +00:00
|
|
|
//
|
|
|
|
// http://go.microsoft.com/fwlink/?LinkId=248926
|
|
|
|
// http://go.microsoft.com/fwlink/?LinkID=615561
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <d3d12.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DirectX
|
|
|
|
{
|
2016-09-23 05:34:50 +00:00
|
|
|
enum WIC_LOADER_FLAGS
|
|
|
|
{
|
|
|
|
WIC_LOADER_DEFAULT = 0,
|
|
|
|
WIC_LOADER_FORCE_SRGB = 0x1,
|
|
|
|
WIC_LOADER_IGNORE_SRGB = 0x2,
|
|
|
|
WIC_LOADER_MIP_AUTOGEN = 0x4,
|
|
|
|
WIC_LOADER_MIP_RESERVE = 0x8,
|
|
|
|
};
|
|
|
|
|
2016-08-22 18:26:36 +00:00
|
|
|
// Standard version
|
|
|
|
HRESULT __cdecl LoadWICTextureFromMemory(
|
|
|
|
_In_ ID3D12Device* d3dDevice,
|
|
|
|
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
|
|
|
|
size_t wicDataSize,
|
|
|
|
_Outptr_ ID3D12Resource** texture,
|
|
|
|
std::unique_ptr<uint8_t[]>& decodedData,
|
|
|
|
D3D12_SUBRESOURCE_DATA& subresource,
|
|
|
|
size_t maxsize = 0);
|
|
|
|
|
|
|
|
HRESULT __cdecl LoadWICTextureFromFile(
|
|
|
|
_In_ ID3D12Device* d3dDevice,
|
|
|
|
_In_z_ const wchar_t* szFileName,
|
|
|
|
_Outptr_ ID3D12Resource** texture,
|
|
|
|
std::unique_ptr<uint8_t[]>& decodedData,
|
|
|
|
D3D12_SUBRESOURCE_DATA& subresource,
|
|
|
|
size_t maxsize = 0);
|
|
|
|
|
|
|
|
// Extended version
|
|
|
|
HRESULT __cdecl LoadWICTextureFromMemoryEx(
|
|
|
|
_In_ ID3D12Device* d3dDevice,
|
|
|
|
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
|
|
|
|
size_t wicDataSize,
|
|
|
|
size_t maxsize,
|
2016-09-23 05:34:50 +00:00
|
|
|
D3D12_RESOURCE_FLAGS resFlags,
|
|
|
|
unsigned int loadFlags,
|
2016-08-22 18:26:36 +00:00
|
|
|
_Outptr_ ID3D12Resource** texture,
|
|
|
|
std::unique_ptr<uint8_t[]>& decodedData,
|
|
|
|
D3D12_SUBRESOURCE_DATA& subresource);
|
|
|
|
|
|
|
|
HRESULT __cdecl LoadWICTextureFromFileEx(
|
|
|
|
_In_ ID3D12Device* d3dDevice,
|
|
|
|
_In_z_ const wchar_t* szFileName,
|
|
|
|
size_t maxsize,
|
2016-09-23 05:34:50 +00:00
|
|
|
D3D12_RESOURCE_FLAGS resFlags,
|
|
|
|
unsigned int loadFlags,
|
2016-08-22 18:26:36 +00:00
|
|
|
_Outptr_ ID3D12Resource** texture,
|
|
|
|
std::unique_ptr<uint8_t[]>& decodedData,
|
|
|
|
D3D12_SUBRESOURCE_DATA& subresource);
|
2016-07-08 01:14:10 +00:00
|
|
|
}
|