summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-19 18:11:08 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-19 18:11:08 +0000
commitc32095993f3e5734b3b6a112aeef0a9536db8f7d (patch)
tree998e0cf73c2417606913152cf53286cc22d4afde /Graphics/GraphicsEngineVulkan
parentAdded CopyTexture tests (diff)
downloadDiligentCore-c32095993f3e5734b3b6a112aeef0a9536db8f7d.tar.gz
DiligentCore-c32095993f3e5734b3b6a112aeef0a9536db8f7d.zip
Added ClearRenderTarget test; fixed issue with bound render targets in D3D12 and Vk backends
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h3
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp12
2 files changed, 12 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
index aa4085f1..7430ee9a 100644
--- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
@@ -295,7 +295,8 @@ public:
VulkanDynamicAllocation AllocateDynamicSpace(Uint32 SizeInBytes, Uint32 Alignment);
- void ResetRenderTargets();
+ virtual void ResetRenderTargets() override final;
+
Int64 GetContextFrameNumber() const { return m_ContextFrameNumber; }
GenerateMipsVkHelper& GetGenerateMipsHelper() { return *m_GenerateMipsHelper; }
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 135b5844..165f3bdd 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -1407,8 +1407,16 @@ void DeviceContextVkImpl::CopyTexture(const CopyTextureAttribs& CopyAttribs)
{
TDeviceContextBase::CopyTexture(CopyAttribs);
- auto* pSrcTexVk = ValidatedCast<TextureVkImpl>(CopyAttribs.pSrcTexture);
- auto* pDstTexVk = ValidatedCast<TextureVkImpl>(CopyAttribs.pDstTexture);
+ auto* pSrcTexVk = ValidatedCast<TextureVkImpl>(CopyAttribs.pSrcTexture);
+ auto* pDstTexVk = ValidatedCast<TextureVkImpl>(CopyAttribs.pDstTexture);
+
+ // We must unbind the textures from framebuffer because
+ // we will transition their states. If we later try to commit
+ // them as render targets (e.g. from SetPipelineState()), a
+ // state mismatch error will occur.
+ UnbindTextureFromFramebuffer(pSrcTexVk, true);
+ UnbindTextureFromFramebuffer(pDstTexVk, true);
+
const auto& SrcTexDesc = pSrcTexVk->GetDesc();
const auto& DstTexDesc = pDstTexVk->GetDesc();
auto* pSrcBox = CopyAttribs.pSrcBox;