Merge pull request #4528 from stenzek/vulkan-descriptor-crash
Vulkan: Fix crash where a potentially deleted buffer is referenced
This commit is contained in:
commit
b5fe0b5b83
|
@ -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)
|
||||
{
|
||||
// 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)
|
||||
|
|
Loading…
Reference in New Issue