From 3f81d1daa7b13e935cf43a6af30367f2b39c09bf Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 19 Apr 2019 08:11:58 -0700 Subject: Fixed issues with multi-mip level staging resource in Vk and D3D12 back-ends --- Graphics/GraphicsEngine/src/Texture.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/src/Texture.cpp b/Graphics/GraphicsEngine/src/Texture.cpp index d33701ea..57b58279 100644 --- a/Graphics/GraphicsEngine/src/Texture.cpp +++ b/Graphics/GraphicsEngine/src/Texture.cpp @@ -238,18 +238,10 @@ void ValidateCopyTextureParams(const CopyTextureAttribs& CopyAttribs ) auto pSrcBox = CopyAttribs.pSrcBox; if( pSrcBox == nullptr ) { - SrcBox.MaxX = std::max( SrcTexDesc.Width >> CopyAttribs.SrcMipLevel, 1u ); - if( SrcTexDesc.Type == RESOURCE_DIM_TEX_1D || - SrcTexDesc.Type == RESOURCE_DIM_TEX_1D_ARRAY ) - SrcBox.MaxY = 1; - else - SrcBox.MaxY = std::max( SrcTexDesc.Height >> CopyAttribs.SrcMipLevel, 1u ); - - if( SrcTexDesc.Type == RESOURCE_DIM_TEX_3D ) - SrcBox.MaxZ = std::max( SrcTexDesc.Depth >> CopyAttribs.SrcMipLevel, 1u ); - else - SrcBox.MaxZ = 1; - + auto MipLevelAttribs = GetMipLevelProperties(SrcTexDesc, CopyAttribs.SrcMipLevel); + SrcBox.MaxX = MipLevelAttribs.Width; + SrcBox.MaxY = MipLevelAttribs.Height; + SrcBox.MaxZ = MipLevelAttribs.Depth; pSrcBox = &SrcBox; } ValidateTextureRegion(SrcTexDesc, CopyAttribs.SrcMipLevel, CopyAttribs.SrcSlice, *pSrcBox); -- cgit v1.2.3