mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-02 22:29:21 +00:00
Vulkan: Fix case where a draw's vertices could be overwritten
This could happen because the vertex memory was already committed, if a uniform buffer allocation failed and caused a command buffer to be executed, it would be associated with the previous command buffer rather than the buffer containing the draw that consumed these vertices.
This commit is contained in:
parent
37550501cc
commit
4c11735bd5
1 changed files with 6 additions and 3 deletions
|
@ -130,9 +130,6 @@ void VertexManager::vFlush(bool use_dst_alpha)
|
||||||
static_cast<VertexFormat*>(VertexLoaderManager::GetCurrentVertexFormat());
|
static_cast<VertexFormat*>(VertexLoaderManager::GetCurrentVertexFormat());
|
||||||
u32 vertex_stride = vertex_format->GetVertexStride();
|
u32 vertex_stride = vertex_format->GetVertexStride();
|
||||||
|
|
||||||
// Commit memory to device
|
|
||||||
PrepareDrawBuffers(vertex_stride);
|
|
||||||
|
|
||||||
// Figure out the number of indices to draw
|
// Figure out the number of indices to draw
|
||||||
u32 index_count = IndexGenerator::GetIndexLen();
|
u32 index_count = IndexGenerator::GetIndexLen();
|
||||||
|
|
||||||
|
@ -169,6 +166,12 @@ void VertexManager::vFlush(bool use_dst_alpha)
|
||||||
StateTracker::GetInstance()->UpdateGeometryShaderConstants();
|
StateTracker::GetInstance()->UpdateGeometryShaderConstants();
|
||||||
StateTracker::GetInstance()->UpdatePixelShaderConstants();
|
StateTracker::GetInstance()->UpdatePixelShaderConstants();
|
||||||
|
|
||||||
|
// Commit memory to device.
|
||||||
|
// NOTE: This must be done after constant upload, as a constant buffer overrun can cause
|
||||||
|
// the current command buffer to be executed, and we want the buffer space to be associated
|
||||||
|
// with the command buffer that has the corresponding draw.
|
||||||
|
PrepareDrawBuffers(vertex_stride);
|
||||||
|
|
||||||
// Flush all EFB pokes and invalidate the peek cache.
|
// Flush all EFB pokes and invalidate the peek cache.
|
||||||
FramebufferManager::GetInstance()->InvalidatePeekCache();
|
FramebufferManager::GetInstance()->InvalidatePeekCache();
|
||||||
FramebufferManager::GetInstance()->FlushEFBPokes();
|
FramebufferManager::GetInstance()->FlushEFBPokes();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue