This is a version of DDSTextureLoader for use by Xbox One XDK developers. This loads pre-tiled texture resources for use with the CreatePlacement APIs available to Xbox One exclusive app developers.
These pre-tiled resources are stored in a variant of the .DDS file format marked with the "XBOX" FourCC pixel format. To generate these .DDS files, see the xtexconv sample on the Microsoft Game Developer Network site https://developer.xboxlive.com/en-us/platform/development/education/Pages/Samples.aspx.
To load traditional or FourCC "DX10" variant DDS files, use DDSTextureLoader
CreateDDSTextureFromMemory
CreateDDSTextureFromFile
These are equivalent to the same functions in DDSTextureLoader, but also require a ID3DXboxPerformanceDevice interface and return a pointer to the video memory via grfxMemory which the caller is responsible for releasing with D3DFreeGraphicsMemory
Other DDS loaders and viewers will fail to recognize this pixel format, and other DDS creation tools do not support creating it. See the xtexconv sample for more information on creating this variant form of DDS files.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb943990.aspx
These pre-tiled resources are stored in a variant of the .DDS file format marked with the "XBOX" FourCC pixel format. To generate these .DDS files, see the xtexconv sample on the Microsoft Game Developer Network site https://developer.xboxlive.com/en-us/platform/development/education/Pages/Samples.aspx.
To load traditional or FourCC "DX10" variant DDS files, use DDSTextureLoader
Header
#include <XboxDDSTextureLoader.h>
Functions
These are in the 'Xbox' namespace rather than 'DirectX'CreateDDSTextureFromMemory
CreateDDSTextureFromFile
These are equivalent to the same functions in DDSTextureLoader, but also require a ID3DXboxPerformanceDevice interface and return a pointer to the video memory via grfxMemory which the caller is responsible for releasing with D3DFreeGraphicsMemory
HRESULT CreateDDSTextureFromMemory( _In_ ID3D11Device1* d3dDevice, _In_ ID3DXboxPerformanceDevice* perfDevice, _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, _In_ size_t ddsDataSize, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, _Outptr_ void** grfxMemory, _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, _In_ bool forceSRGB = false );
HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device1* d3dDevice, _In_ ID3DXboxPerformanceDevice* perfDevice, _In_z_ constwchar_t* szFileName, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, _Outptr_ void** grfxMemory, _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, _In_ bool forceSRGB = false );
Example
usingnamespace Microsoft::WRL; ComPtr<ID3D11ShaderResourceView> srv; void *grfxMemory = nullptr; HRESULT hr = Xbox::CreateDDSTextureFromFile( m_device.Get(), m_xboxDevice.Get(), L"XboxTiledTexturedds", nullptr, srv.GetAddressOf(), &grfxMemory ); DX::ThrowIfFailed( hr );
DDS File Format
This function expects the DDS file to contain a pixel format with FourCC "XBOX" which signifies a specific variant of the file.DWORD dwMagic DDS_HEADER header DDS_HEADER_XBOX { DXGI_FORMAT dxgiFormat; uint32_t resourceDimension; uint32_t miscFlag; // see DDS_RESOURCE_MISC_FLAG uint32_t arraySize; uint32_t miscFlags2; // see DDS_MISC_FLAGS2 uint32_t tileMode; // see XG_TILE_MODE uint32_t baseAlignment; uint32_t dataSize; uint32_t xdkVer; // matching _XDK_VER } headerXbox // Remainder of file is a tiled texture binary layout suitable for use with CreatePlacement APIs
Other DDS loaders and viewers will fail to recognize this pixel format, and other DDS creation tools do not support creating it. See the xtexconv sample for more information on creating this variant form of DDS files.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb943990.aspx