1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

Added Ex variants to DX9 DDSTextureLoader, WICTextureLoader (#198)

This commit is contained in:
Chuck Walbourn 2020-09-28 15:05:15 -07:00 committed by GitHub
parent 80f38c3903
commit 61bdcf751c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 430 additions and 46 deletions

View File

@ -733,6 +733,8 @@ namespace
_In_ const DDS_HEADER* header,
_In_reads_bytes_(bitSize) const uint8_t* bitData,
_In_ size_t bitSize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_Outptr_ LPDIRECT3DBASETEXTURE9* texture,
bool generateMipsIfMissing) noexcept
{
@ -776,15 +778,22 @@ namespace
// Create the volume texture (let the runtime do the validation)
ComPtr<IDirect3DVolumeTexture9> pTexture;
hr = device->CreateVolumeTexture(iWidth, iHeight, iDepth, iMipCount,
0, fmt, D3DPOOL_DEFAULT, pTexture.GetAddressOf(), nullptr);
usage, fmt, pool, pTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
ComPtr<IDirect3DVolumeTexture9> pStagingTexture;
hr = device->CreateVolumeTexture(iWidth, iHeight, iDepth, iMipCount,
0, fmt, D3DPOOL_SYSTEMMEM, pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->CreateVolumeTexture(iWidth, iHeight, iDepth, iMipCount,
0u, fmt, D3DPOOL_SYSTEMMEM, pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
}
else
{
pStagingTexture = pTexture;
}
// Lock, fill, unlock
size_t NumBytes = 0;
@ -841,9 +850,12 @@ namespace
iDepth = 1;
}
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
}
*texture = pTexture.Detach();
}
@ -864,15 +876,22 @@ namespace
// Create the cubemap (let the runtime do the validation)
ComPtr<IDirect3DCubeTexture9> pTexture;
hr = device->CreateCubeTexture(iWidth, iMipCount,
0, fmt, D3DPOOL_DEFAULT, pTexture.GetAddressOf(), nullptr);
usage, fmt, pool, pTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
ComPtr<IDirect3DCubeTexture9> pStagingTexture;
hr = device->CreateCubeTexture(iWidth, iMipCount,
0, fmt, D3DPOOL_SYSTEMMEM, pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->CreateCubeTexture(iWidth, iMipCount,
0u, fmt, D3DPOOL_SYSTEMMEM, pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
}
else
{
pStagingTexture = pTexture;
}
// Lock, fill, unlock
size_t NumBytes = 0;
@ -926,9 +945,12 @@ namespace
}
}
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
}
*texture = pTexture.Detach();
}
@ -941,19 +963,28 @@ namespace
}
// Create the texture (let the runtime do the validation)
if (generateMipsIfMissing)
usage |= D3DUSAGE_AUTOGENMIPMAP;
ComPtr<IDirect3DTexture9> pTexture;
hr = device->CreateTexture(iWidth, iHeight, iMipCount,
generateMipsIfMissing ? D3DUSAGE_AUTOGENMIPMAP : 0u,
fmt, D3DPOOL_DEFAULT,
usage, fmt, pool,
pTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
ComPtr<IDirect3DTexture9> pStagingTexture;
hr = device->CreateTexture(iWidth, iHeight, iMipCount,
0u, fmt, D3DPOOL_SYSTEMMEM, pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->CreateTexture(iWidth, iHeight, iMipCount,
0u, fmt, D3DPOOL_SYSTEMMEM, pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
}
else
{
pStagingTexture = pTexture;
}
// Lock, fill, unlock
size_t NumBytes = 0;
@ -998,9 +1029,12 @@ namespace
iHeight = 1;
}
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
}
*texture = pTexture.Detach();
}
@ -1017,6 +1051,19 @@ HRESULT DirectX::CreateDDSTextureFromMemory(
size_t ddsDataSize,
LPDIRECT3DBASETEXTURE9* texture,
bool generateMipsIfMissing) noexcept
{
return CreateDDSTextureFromMemoryEx(d3dDevice, ddsData, ddsDataSize, 0u, D3DPOOL_DEFAULT, generateMipsIfMissing, texture);
}
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromMemoryEx(
LPDIRECT3DDEVICE9 d3dDevice,
const uint8_t* ddsData,
size_t ddsDataSize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
bool generateMipsIfMissing,
LPDIRECT3DBASETEXTURE9* texture) noexcept
{
if (texture)
{
@ -1046,11 +1093,13 @@ HRESULT DirectX::CreateDDSTextureFromMemory(
header,
bitData,
bitSize,
usage,
pool,
texture,
generateMipsIfMissing);
}
// Type-specific versions
// Type-specific standard versions
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromMemory(
LPDIRECT3DDEVICE9 d3dDevice,
@ -1068,7 +1117,7 @@ HRESULT DirectX::CreateDDSTextureFromMemory(
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromMemory(d3dDevice, ddsData, ddsDataSize, tex.GetAddressOf(), generateMipsIfMissing);
HRESULT hr = CreateDDSTextureFromMemoryEx(d3dDevice, ddsData, ddsDataSize, 0u, D3DPOOL_DEFAULT, generateMipsIfMissing, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
@ -1098,7 +1147,7 @@ HRESULT DirectX::CreateDDSTextureFromMemory(
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromMemory(d3dDevice, ddsData, ddsDataSize, tex.GetAddressOf(), false);
HRESULT hr = CreateDDSTextureFromMemoryEx(d3dDevice, ddsData, ddsDataSize, 0u, D3DPOOL_DEFAULT, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
@ -1128,7 +1177,105 @@ HRESULT DirectX::CreateDDSTextureFromMemory(
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromMemory(d3dDevice, ddsData, ddsDataSize, tex.GetAddressOf(), false);
HRESULT hr = CreateDDSTextureFromMemoryEx(d3dDevice, ddsData, ddsDataSize, 0u, D3DPOOL_DEFAULT, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
if (tex->GetType() == D3DRTYPE_VOLUMETEXTURE)
{
*texture = static_cast<LPDIRECT3DVOLUMETEXTURE9>(tex.Detach());
return S_OK;
}
}
return hr;
}
// Type-specific extended versions
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromMemoryEx(
LPDIRECT3DDEVICE9 d3dDevice,
const uint8_t* ddsData,
size_t ddsDataSize,
DWORD usage,
D3DPOOL pool,
bool generateMipsIfMissing,
LPDIRECT3DTEXTURE9* texture) noexcept
{
if (texture)
{
*texture = nullptr;
}
if (!d3dDevice || !ddsData || !ddsDataSize || !texture)
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromMemoryEx(d3dDevice, ddsData, ddsDataSize, usage, pool, generateMipsIfMissing, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
if (tex->GetType() == D3DRTYPE_TEXTURE)
{
*texture = static_cast<LPDIRECT3DTEXTURE9>(tex.Detach());
return S_OK;
}
}
return hr;
}
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromMemoryEx(
LPDIRECT3DDEVICE9 d3dDevice,
const uint8_t* ddsData,
size_t ddsDataSize,
DWORD usage,
D3DPOOL pool,
LPDIRECT3DCUBETEXTURE9* texture) noexcept
{
if (texture)
{
*texture = nullptr;
}
if (!d3dDevice || !ddsData || !ddsDataSize || !texture)
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromMemoryEx(d3dDevice, ddsData, ddsDataSize, usage, pool, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
if (tex->GetType() == D3DRTYPE_CUBETEXTURE)
{
*texture = static_cast<LPDIRECT3DCUBETEXTURE9>(tex.Detach());
return S_OK;
}
}
return hr;
}
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromMemoryEx(
LPDIRECT3DDEVICE9 d3dDevice,
const uint8_t* ddsData,
size_t ddsDataSize,
DWORD usage,
D3DPOOL pool,
LPDIRECT3DVOLUMETEXTURE9* texture) noexcept
{
if (texture)
{
*texture = nullptr;
}
if (!d3dDevice || !ddsData || !ddsDataSize || !texture)
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromMemoryEx(d3dDevice, ddsData, ddsDataSize, usage, pool, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
@ -1150,6 +1297,18 @@ HRESULT DirectX::CreateDDSTextureFromFile(
const wchar_t* fileName,
LPDIRECT3DBASETEXTURE9* texture,
bool generateMipsIfMissing) noexcept
{
return CreateDDSTextureFromFileEx(d3dDevice, fileName, 0u, D3DPOOL_DEFAULT, generateMipsIfMissing, texture);
}
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromFileEx(
LPDIRECT3DDEVICE9 d3dDevice,
const wchar_t* fileName,
_In_ DWORD usage,
_In_ D3DPOOL pool,
bool generateMipsIfMissing,
LPDIRECT3DBASETEXTURE9* texture) noexcept
{
if (texture)
{
@ -1180,11 +1339,13 @@ HRESULT DirectX::CreateDDSTextureFromFile(
header,
bitData,
bitSize,
usage,
pool,
texture,
generateMipsIfMissing);
}
// Type-specific versions
// Type-specific standard versions
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromFile(
LPDIRECT3DDEVICE9 d3dDevice,
@ -1201,7 +1362,7 @@ HRESULT DirectX::CreateDDSTextureFromFile(
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromFile(d3dDevice, fileName, tex.GetAddressOf(), generateMipsIfMissing);
HRESULT hr = CreateDDSTextureFromFileEx(d3dDevice, fileName, 0u, D3DPOOL_DEFAULT, generateMipsIfMissing, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
@ -1230,7 +1391,7 @@ HRESULT DirectX::CreateDDSTextureFromFile(
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromFile(d3dDevice, fileName, tex.GetAddressOf(), false);
HRESULT hr = CreateDDSTextureFromFileEx(d3dDevice, fileName, 0u, D3DPOOL_DEFAULT, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
@ -1259,7 +1420,102 @@ HRESULT DirectX::CreateDDSTextureFromFile(
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromFile(d3dDevice, szFileName, tex.GetAddressOf(), false);
HRESULT hr = CreateDDSTextureFromFileEx(d3dDevice, szFileName, 0u, D3DPOOL_DEFAULT, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
if (tex->GetType() == D3DRTYPE_VOLUMETEXTURE)
{
*texture = static_cast<LPDIRECT3DVOLUMETEXTURE9>(tex.Detach());
return S_OK;
}
}
return hr;
}
// Type-specific extended versions
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromFileEx(
LPDIRECT3DDEVICE9 d3dDevice,
const wchar_t* fileName,
DWORD usage,
D3DPOOL pool,
bool generateMipsIfMissing,
LPDIRECT3DTEXTURE9* texture) noexcept
{
if (texture)
{
*texture = nullptr;
}
if (!d3dDevice || !fileName || !texture)
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromFileEx(d3dDevice, fileName, usage, pool, generateMipsIfMissing, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
if (tex->GetType() == D3DRTYPE_TEXTURE)
{
*texture = static_cast<LPDIRECT3DTEXTURE9>(tex.Detach());
return S_OK;
}
}
return hr;
}
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromFileEx(
LPDIRECT3DDEVICE9 d3dDevice,
const wchar_t* fileName,
DWORD usage,
D3DPOOL pool,
LPDIRECT3DCUBETEXTURE9* texture) noexcept
{
if (texture)
{
*texture = nullptr;
}
if (!d3dDevice || !fileName || !texture)
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromFileEx(d3dDevice, fileName, usage, pool, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;
if (tex->GetType() == D3DRTYPE_CUBETEXTURE)
{
*texture = static_cast<LPDIRECT3DCUBETEXTURE9>(tex.Detach());
return S_OK;
}
}
return hr;
}
_Use_decl_annotations_
HRESULT DirectX::CreateDDSTextureFromFileEx(
LPDIRECT3DDEVICE9 d3dDevice,
const wchar_t* szFileName,
DWORD usage,
D3DPOOL pool,
LPDIRECT3DVOLUMETEXTURE9* texture) noexcept
{
if (texture)
{
*texture = nullptr;
}
if (!d3dDevice || !szFileName || !texture)
return E_INVALIDARG;
ComPtr<IDirect3DBaseTexture9> tex;
HRESULT hr = CreateDDSTextureFromFileEx(d3dDevice, szFileName, usage, pool, false, tex.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = E_FAIL;

View File

@ -40,7 +40,25 @@ namespace DirectX
_Outptr_ LPDIRECT3DBASETEXTURE9* texture,
bool generateMipsIfMissing = false) noexcept;
// Type-specific versions
// Extended version
HRESULT CreateDDSTextureFromMemoryEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
bool generateMipsIfMissing,
_Outptr_ LPDIRECT3DBASETEXTURE9* texture) noexcept;
HRESULT CreateDDSTextureFromFileEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_z_ const wchar_t* fileName,
_In_ DWORD usage,
_In_ D3DPOOL pool,
bool generateMipsIfMissing,
_Outptr_ LPDIRECT3DBASETEXTURE9* texture) noexcept;
// Type-specific standard versions
HRESULT CreateDDSTextureFromMemory(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
@ -75,4 +93,52 @@ namespace DirectX
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_z_ const wchar_t* fileName,
_Outptr_ LPDIRECT3DVOLUMETEXTURE9* texture) noexcept;
// Type-specific extended versions
HRESULT CreateDDSTextureFromMemoryEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
bool generateMipsIfMissing,
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept;
HRESULT CreateDDSTextureFromFileEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_z_ const wchar_t* fileName,
_In_ DWORD usage,
_In_ D3DPOOL pool,
bool generateMipsIfMissing,
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept;
HRESULT CreateDDSTextureFromMemoryEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_Outptr_ LPDIRECT3DCUBETEXTURE9* texture) noexcept;
HRESULT CreateDDSTextureFromFileEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_z_ const wchar_t* fileName,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_Outptr_ LPDIRECT3DCUBETEXTURE9* texture) noexcept;
HRESULT CreateDDSTextureFromMemoryEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_Outptr_ LPDIRECT3DVOLUMETEXTURE9* texture) noexcept;
HRESULT CreateDDSTextureFromFileEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_z_ const wchar_t* fileName,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_Outptr_ LPDIRECT3DVOLUMETEXTURE9* texture) noexcept;
}

View File

@ -261,6 +261,8 @@ namespace
_In_ LPDIRECT3DDEVICE9 device,
_In_ IWICBitmapFrameDecode* frame,
_In_ size_t maxsize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_In_ unsigned int loadFlags,
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept
{
@ -344,21 +346,30 @@ namespace
}
// Create texture
if (loadFlags & WIC_LOADER_MIP_AUTOGEN)
usage |= D3DUSAGE_AUTOGENMIPMAP;
ComPtr<IDirect3DTexture9> pTexture;
hr = device->CreateTexture(twidth, theight, 1u,
(loadFlags & WIC_LOADER_MIP_AUTOGEN) ? D3DUSAGE_AUTOGENMIPMAP : 0u,
format, D3DPOOL_DEFAULT,
usage, format, pool,
pTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
// Create staging texture memory
ComPtr<IDirect3DTexture9> pStagingTexture;
hr = device->CreateTexture(twidth, theight, 1u,
0u, format, D3DPOOL_SYSTEMMEM,
pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->CreateTexture(twidth, theight, 1u,
0u, format, D3DPOOL_SYSTEMMEM,
pStagingTexture.GetAddressOf(), nullptr);
if (FAILED(hr))
return hr;
}
else
{
pStagingTexture = pTexture;
}
D3DLOCKED_RECT LockedRect = {};
hr = pStagingTexture->LockRect(0, &LockedRect, nullptr, 0);
@ -495,9 +506,12 @@ namespace
return hr;
}
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
if (pool == D3DPOOL_DEFAULT)
{
hr = device->UpdateTexture(pStagingTexture.Get(), pTexture.Get());
if (FAILED(hr))
return hr;
}
*texture = pTexture.Detach();
@ -514,6 +528,21 @@ HRESULT DirectX::CreateWICTextureFromMemory(
LPDIRECT3DTEXTURE9* texture,
size_t maxsize,
unsigned int loadFlags) noexcept
{
return CreateWICTextureFromMemoryEx(d3dDevice, wicData, wicDataSize, maxsize, 0u, D3DPOOL_DEFAULT, loadFlags, texture);
}
_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromMemoryEx(
LPDIRECT3DDEVICE9 d3dDevice,
const uint8_t* wicData,
size_t wicDataSize,
_In_ size_t maxsize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_In_ unsigned int loadFlags,
LPDIRECT3DTEXTURE9* texture) noexcept
{
if (texture)
{
@ -554,7 +583,7 @@ HRESULT DirectX::CreateWICTextureFromMemory(
if (FAILED(hr))
return hr;
return CreateTextureFromWIC(d3dDevice, frame.Get(), maxsize, loadFlags, texture);
return CreateTextureFromWIC(d3dDevice, frame.Get(), maxsize, usage, pool, loadFlags, texture);
}
//--------------------------------------------------------------------------------------
@ -565,6 +594,19 @@ HRESULT DirectX::CreateWICTextureFromFile(
LPDIRECT3DTEXTURE9* texture,
size_t maxsize,
unsigned int loadFlags) noexcept
{
return CreateWICTextureFromFileEx(d3dDevice, fileName, maxsize, 0u, D3DPOOL_DEFAULT, loadFlags, texture);
}
_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromFileEx(
LPDIRECT3DDEVICE9 d3dDevice,
const wchar_t* fileName,
size_t maxsize,
DWORD usage,
D3DPOOL pool,
unsigned int loadFlags,
LPDIRECT3DTEXTURE9* texture) noexcept
{
if (texture)
{
@ -593,5 +635,5 @@ HRESULT DirectX::CreateWICTextureFromFile(
if (FAILED(hr))
return hr;
return CreateTextureFromWIC(d3dDevice, frame.Get(), maxsize, loadFlags, texture);
return CreateTextureFromWIC(d3dDevice, frame.Get(), maxsize, usage, pool, loadFlags, texture);
}

View File

@ -55,4 +55,24 @@ namespace DirectX
_Outptr_ LPDIRECT3DTEXTURE9* texture,
_In_ size_t maxsize = 0,
_In_ unsigned int loadFlags = 0) noexcept;
// Extended version
HRESULT CreateWICTextureFromMemoryEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_In_ size_t maxsize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_In_ unsigned int loadFlags,
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept;
HRESULT CreateWICTextureFromFileEx(
_In_ LPDIRECT3DDEVICE9 d3dDevice,
_In_z_ const wchar_t* fileName,
_In_ size_t maxsize,
_In_ DWORD usage,
_In_ D3DPOOL pool,
_In_ unsigned int loadFlags,
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept;
}