diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-04-13 22:57:55 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-04-13 22:57:55 +0000 |
| commit | cbd1888d53ac6bafb94816d7eecf70a3bc24ecb0 (patch) | |
| tree | d99feacfdc675d487144a673f4bcc88899a9bc8c /Graphics/GraphicsEngineVulkan | |
| parent | Improved names of default texture views (diff) | |
| download | DiligentCore-cbd1888d53ac6bafb94816d7eecf70a3bc24ecb0.tar.gz DiligentCore-cbd1888d53ac6bafb94816d7eecf70a3bc24ecb0.zip | |
Fixed issues with D3D12 staging resources and mipmap generation in Vulkan
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp | 6 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp | 10 |
2 files changed, 5 insertions, 11 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp index 79e60fab..4546ddac 100644 --- a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp +++ b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp @@ -304,9 +304,11 @@ namespace Diligent auto BottomMip = ViewDesc.NumMipLevels - 1; for (uint32_t TopMip = 0; TopMip < BottomMip; ) { - // In Vulkan all subresources of a view must be transitioned to the same layout, so + // In Vulkan, all subresources of a view must be transitioned to the same layout, so // we can't bind the entire texture and have to bind single mip level at a time - pSrcMipVar->Set(TexView.GetMipLevelSRV(TopMip)); + auto SrcMipLevelSRV = TexView.GetMipLevelSRV(TopMip); + VERIFY_EXPR(SrcMipLevelSRV != nullptr); + pSrcMipVar->Set(SrcMipLevelSRV); uint32_t SrcWidth = std::max(TexDesc.Width >> (TopMip + ViewDesc.MostDetailedMip), 1u); uint32_t SrcHeight = std::max(TexDesc.Height >> (TopMip + ViewDesc.MostDetailedMip), 1u); diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp index eaf88459..e99e45f1 100644 --- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp @@ -573,15 +573,7 @@ void TextureVkImpl::CreateViewInternal(const TextureViewDesc& ViewDesc, ITexture new (ppMipLevelView) TextureViewVkImpl::MipLevelViewAutoPtrType(pMipLevelViewVk, STDDeleter<TextureViewVkImpl, FixedBlockMemoryAllocator>(TexViewAllocator)); }; - if ((MipLevel % 4) == 0) - { - // Mip levles are generated 4 at a time, so we only need SRV for every 4-th level - CreateMipLevelView(TEXTURE_VIEW_SHADER_RESOURCE, MipLevel, &pMipLevelViews[MipLevel * 2]); - } - else - { - new (&pMipLevelViews[MipLevel * 2]) TextureViewVkImpl::MipLevelViewAutoPtrType{}; - } + CreateMipLevelView(TEXTURE_VIEW_SHADER_RESOURCE, MipLevel, &pMipLevelViews[MipLevel * 2]); CreateMipLevelView(TEXTURE_VIEW_UNORDERED_ACCESS, MipLevel, &pMipLevelViews[MipLevel * 2 + 1]); } pViewVk->AssignMipLevelViews(pMipLevelViews); |
