Skip to content

Commit

Permalink
WICTextureLoader: Added overloads that do not take a D3D11DeviceConte…
Browse files Browse the repository at this point in the history
…xt (i.e. no autogen mips) to be consistent with DDSTextureLoader
  • Loading branch information
walbourn_cp authored and walbourn_cp committed Feb 25, 2014
1 parent cff826a commit b22fa64
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
60 changes: 60 additions & 0 deletions WICTextureLoader/WICTextureLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,19 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
}

//--------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromMemory( ID3D11Device* d3dDevice,
const uint8_t* wicData,
size_t wicDataSize,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView,
size_t maxsize )
{
return CreateWICTextureFromMemoryEx( d3dDevice, nullptr, wicData, wicDataSize, maxsize,
D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false,
texture, textureView );
}

_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromMemory( ID3D11Device* d3dDevice,
ID3D11DeviceContext* d3dContext,
Expand All @@ -682,6 +695,24 @@ HRESULT DirectX::CreateWICTextureFromMemory( ID3D11Device* d3dDevice,
texture, textureView );
}

_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromMemoryEx( ID3D11Device* d3dDevice,
const uint8_t* wicData,
size_t wicDataSize,
size_t maxsize,
D3D11_USAGE usage,
unsigned int bindFlags,
unsigned int cpuAccessFlags,
unsigned int miscFlags,
bool forceSRGB,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView )
{
return CreateWICTextureFromMemoryEx( d3dDevice, nullptr, wicData, wicDataSize, maxsize,
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
texture, textureView );
}

_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromMemoryEx( ID3D11Device* d3dDevice,
ID3D11DeviceContext* d3dContext,
Expand Down Expand Up @@ -761,6 +792,18 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx( ID3D11Device* d3dDevice,
}

//--------------------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromFile( ID3D11Device* d3dDevice,
const wchar_t* fileName,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView,
size_t maxsize )
{
return CreateWICTextureFromFileEx( d3dDevice, nullptr, fileName, maxsize,
D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false,
texture, textureView );
}

_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromFile( ID3D11Device* d3dDevice,
ID3D11DeviceContext* d3dContext,
Expand All @@ -774,6 +817,23 @@ HRESULT DirectX::CreateWICTextureFromFile( ID3D11Device* d3dDevice,
texture, textureView );
}

_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromFileEx( ID3D11Device* d3dDevice,
const wchar_t* fileName,
size_t maxsize,
D3D11_USAGE usage,
unsigned int bindFlags,
unsigned int cpuAccessFlags,
unsigned int miscFlags,
bool forceSRGB,
ID3D11Resource** texture,
ID3D11ShaderResourceView** textureView )
{
return CreateWICTextureFromFileEx( d3dDevice, nullptr, fileName, maxsize,
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
texture, textureView );
}

_Use_decl_annotations_
HRESULT DirectX::CreateWICTextureFromFileEx( ID3D11Device* d3dDevice,
ID3D11DeviceContext* d3dContext,
Expand Down
44 changes: 44 additions & 0 deletions WICTextureLoader/WICTextureLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@

namespace DirectX
{
// Standard version
HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_Out_opt_ ID3D11Resource** texture,
_Out_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0
);

HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice,
_In_z_ const wchar_t* szFileName,
_Out_opt_ ID3D11Resource** texture,
_Out_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0
);

// Standard version with optional auto-gen mipmap support
HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
Expand All @@ -69,6 +86,33 @@ namespace DirectX
_In_ size_t maxsize = 0
);

// Extended version
HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ bool forceSRGB,
_Out_opt_ ID3D11Resource** texture,
_Out_opt_ ID3D11ShaderResourceView** textureView
);

HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice,
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ bool forceSRGB,
_Out_opt_ ID3D11Resource** texture,
_Out_opt_ ID3D11ShaderResourceView** textureView
);

// Extended version with optional auto-gen mipmap support
HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
Expand Down

0 comments on commit b22fa64

Please sign in to comment.