diff options
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/d3d11size.hpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/helpers/d3d11size.hpp b/helpers/d3d11size.hpp index 3a5a6f7d..e3b55eb3 100644 --- a/helpers/d3d11size.hpp +++ b/helpers/d3d11size.hpp @@ -60,11 +60,21 @@ _getNumMipLevels(const D3D11_TEXTURE2D_DESC *pDesc) { } inline UINT +_getNumMipLevels(const D3D11_TEXTURE2D_DESC1 *pDesc) { + return pDesc->MipLevels != 0 ? pDesc->MipLevels : _getNumMipLevels(pDesc->Width, pDesc->Height); +} + +inline UINT _getNumMipLevels(const D3D11_TEXTURE3D_DESC *pDesc) { return pDesc->MipLevels != 0 ? pDesc->MipLevels : _getNumMipLevels(pDesc->Width, pDesc->Height, pDesc->Depth); } inline UINT +_getNumMipLevels(const D3D11_TEXTURE3D_DESC1 *pDesc) { + return pDesc->MipLevels != 0 ? pDesc->MipLevels : _getNumMipLevels(pDesc->Width, pDesc->Height, pDesc->Depth); +} + +inline UINT _getNumSubResources(const D3D11_BUFFER_DESC *pDesc) { return 1; } @@ -80,10 +90,20 @@ _getNumSubResources(const D3D11_TEXTURE2D_DESC *pDesc) { } inline UINT +_getNumSubResources(const D3D11_TEXTURE2D_DESC1 *pDesc) { + return _getNumMipLevels(pDesc) * pDesc->ArraySize; +} + +inline UINT _getNumSubResources(const D3D11_TEXTURE3D_DESC *pDesc) { return _getNumMipLevels(pDesc); } +inline UINT +_getNumSubResources(const D3D11_TEXTURE3D_DESC1 *pDesc) { + return _getNumMipLevels(pDesc); +} + static inline size_t _calcSubresourceSize(const D3D11_BUFFER_DESC *pDesc, UINT Subresource, UINT RowPitch = 0, UINT SlicePitch = 0) { return pDesc->ByteWidth; @@ -102,12 +122,24 @@ _calcSubresourceSize(const D3D11_TEXTURE2D_DESC *pDesc, UINT Subresource, UINT R } static inline size_t +_calcSubresourceSize(const D3D11_TEXTURE2D_DESC1 *pDesc, UINT Subresource, UINT RowPitch, UINT SlicePitch = 0) { + UINT MipLevel = Subresource % _getNumMipLevels(pDesc); + return _calcMipDataSize(MipLevel, pDesc->Format, pDesc->Width, pDesc->Height, RowPitch, 1, SlicePitch); +} + +static inline size_t _calcSubresourceSize(const D3D11_TEXTURE3D_DESC *pDesc, UINT Subresource, UINT RowPitch, UINT SlicePitch) { UINT MipLevel = Subresource; return _calcMipDataSize(MipLevel, pDesc->Format, pDesc->Width, pDesc->Height, RowPitch, pDesc->Depth, SlicePitch); } static inline size_t +_calcSubresourceSize(const D3D11_TEXTURE3D_DESC1 *pDesc, UINT Subresource, UINT RowPitch, UINT SlicePitch) { + UINT MipLevel = Subresource; + return _calcMipDataSize(MipLevel, pDesc->Format, pDesc->Width, pDesc->Height, RowPitch, pDesc->Depth, SlicePitch); +} + +static inline size_t _calcSubresourceSize(ID3D11Resource *pDstResource, UINT DstSubresource, const D3D11_BOX *pDstBox, UINT SrcRowPitch, UINT SrcDepthPitch) { if (pDstBox && (pDstBox->left >= pDstBox->right || |