about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBeaR <cinaera@web.de>2012-11-13 15:39:23 +0100
committeroy <Tom_Adams@web.de>2013-02-24 18:29:27 +0100
commit68390fe04afce9767b152eadaefd9a3bc8462854 (patch)
treecc928d0b99534a194f6d312415755146f88a44f8 /src
parent8b4026cbbfb2cf04da8ee47f0b6b30d228cfebaf (diff)
downloadzcatch-68390fe04afce9767b152eadaefd9a3bc8462854.tar.gz
zcatch-68390fe04afce9767b152eadaefd9a3bc8462854.zip
Bug: Losing render-commands if commandbuffer is full(gfx)
Problem:
If there is a new draw call, it is checked if there is enough free memory for the vertices in the databuffer but not if we have enough free space in the commandbuffer to add the command
So we lose some commands during a frame cuz the commandbuffer is full

This fixes the 2nd part of issue 1004
Diffstat (limited to 'src')
-rw-r--r--src/engine/client/graphics_threaded.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp
index 8a3e4f50..50a116b4 100644
--- a/src/engine/client/graphics_threaded.cpp
+++ b/src/engine/client/graphics_threaded.cpp
@@ -81,7 +81,19 @@ void CGraphics_Threaded::FlushVertices()
 	}
 
 	mem_copy(Cmd.m_pVertices, m_aVertices, sizeof(CCommandBuffer::SVertex)*NumVerts);
-	m_pCommandBuffer->AddCommand(Cmd);
+
+	// check if we have enough free memory in the commandbuffer
+	if(!m_pCommandBuffer->AddCommand(Cmd))
+	{
+		// kick command buffer and try again
+		KickCommandBuffer();
+
+		if(!m_pCommandBuffer->AddCommand(Cmd))
+		{
+			dbg_msg("graphics", "failed to allocate memory for render command");
+			return;
+		}
+	}
 }
 
 void CGraphics_Threaded::AddVertices(int Count)