Can you please help me in finding the equivalent DX12 API/sample code by which I could load a bitmap and create a texture ?
For DX11 it is D3DX11CreateShaderResourceViewFromFile
and for DX9 it is D3DXCreateTextureFromFileEx
Can you please help me in finding the equivalent DX12 API/sample code by which I could load a bitmap and create a texture ?
For DX11 it is D3DX11CreateShaderResourceViewFromFile
and for DX9 it is D3DXCreateTextureFromFileEx
You can use the following functions from DirectXTK, as well as many other.
// 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);
Alternatively you can use Windows Imaging Component to write your own implementation, especially if you would like to have more control.