diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-04-13 14:40:08 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-04-13 14:40:08 +0000 |
| commit | bda7a3d7a68dbbaf4894332e2278c0970a61a74e (patch) | |
| tree | 5bd48e470933ce18f798bf858e0908ed562a2d53 /Graphics/GraphicsEngineVulkan | |
| parent | Updated ALLOCATE macros to make it more convenient (diff) | |
| download | DiligentCore-bda7a3d7a68dbbaf4894332e2278c0970a61a74e.tar.gz DiligentCore-bda7a3d7a68dbbaf4894332e2278c0970a61a74e.zip | |
Improved mipmap generation in D3D12 backend
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp index 3d53a03a..79e60fab 100644 --- a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp +++ b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp @@ -208,13 +208,16 @@ namespace Diligent return; } - DEV_CHECK_ERR(TexView.GetDesc().NumMipLevels > 1, "Number of mip levels in the view must be greater than 1"); - const auto OriginalState = pTexVk->GetState(); const auto OriginalLayout = pTexVk->GetLayout(); const auto& TexDesc = pTexVk->GetDesc(); const auto& ViewDesc = TexView.GetDesc(); + DEV_CHECK_ERR(ViewDesc.NumMipLevels > 1, "Number of mip levels in the view must be greater than 1"); + DEV_CHECK_ERR(OriginalState != RESOURCE_STATE_UNDEFINED, + "Attempting to generate mipmaps for texture '", TexDesc.Name, "' which is in RESOURCE_STATE_UNDEFINED state ." + "This is not expected in Vulkan backend as textures are transition to a defined state when created."); + const auto& FmtAttribs = GetTextureFormatAttribs(ViewDesc.Format); VkImageSubresourceRange SubresRange = {}; if (FmtAttribs.ComponentType == COMPONENT_TYPE_DEPTH) @@ -257,6 +260,7 @@ namespace Diligent } else { + VERIFY(OriginalLayout != VK_IMAGE_LAYOUT_UNDEFINED, "Original layout must not be undefined"); SubresRange.baseMipLevel = ViewDesc.MostDetailedMip; SubresRange.levelCount = ViewDesc.NumMipLevels; // Transition all affected subresources back to original layout @@ -345,7 +349,7 @@ namespace Diligent *MappedData = { - static_cast<Int32>(TopMip), + static_cast<Int32>(TopMip), // Mip levels are relateive to the view's most detailed mip static_cast<Int32>(NumMips), 0, // Array slices are relative to the view's first array slice 0, // Unused |
