summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-08-12 11:06:34 +0100
committerJose Fonseca <jfonseca@vmware.com>2015-08-12 11:18:06 +0100
commit4713c3b346985f56c515909cd68dcc50597b1c51 (patch)
tree72a234a5e11d673300588c28cef2da45317e5213 /helpers
parent971c951dea4bcaf53fa231716644a423465e0c36 (diff)
specs: Support D3D11.3.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/d3d11size.hpp32
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 ||