summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/StateTracker.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2016-12-20 11:11:54 +0100
committerGitHub <noreply@github.com>2016-12-20 11:11:54 +0100
commitb5fe0b5b831c0d4fc898ab6ef4a60f65ff65a87b (patch)
tree882949c0c911cd761e4f9c6b951ce481c2b7e13a /Source/Core/VideoBackends/Vulkan/StateTracker.cpp
parentcee1f8b6e76c90841777ae6a48b3f14d0e28eaf5 (diff)
parent9290bf5844def612bddd3c01248576d171983b54 (diff)
Merge pull request #4528 from stenzek/vulkan-descriptor-crash
Vulkan: Fix crash where a potentially deleted buffer is referenced
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/StateTracker.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/StateTracker.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp
index e9bbb980b0..d374ec5f1d 100644
--- a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp
+++ b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp
@@ -384,12 +384,22 @@ void StateTracker::UpdateVertexShaderConstants()
void StateTracker::UpdateGeometryShaderConstants()
{
// Skip updating geometry shader constants if it's not in use.
- if (m_pipeline_state.gs == VK_NULL_HANDLE || !GeometryShaderManager::dirty ||
- !ReserveConstantStorage())
+ if (m_pipeline_state.gs == VK_NULL_HANDLE)
{
- return;
+ // However, if the buffer has changed, we can't skip the update, because then we'll
+ // try to include the now non-existant buffer in the descriptor set.
+ if (m_uniform_stream_buffer->GetBuffer() ==
+ m_bindings.uniform_buffer_bindings[UBO_DESCRIPTOR_SET_BINDING_GS].buffer)
+ {
+ return;
+ }
+
+ GeometryShaderManager::dirty = true;
}
+ if (!GeometryShaderManager::dirty || !ReserveConstantStorage())
+ return;
+
// Buffer allocation changed?
if (m_uniform_stream_buffer->GetBuffer() !=
m_bindings.uniform_buffer_bindings[UBO_DESCRIPTOR_SET_BINDING_GS].buffer)