From 470c9ff08a79514f70666b0077ef5d2bedab8b3c Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 23 Mar 2013 00:18:35 +0100 Subject: check for overflow vertex indices, fixes issue 6135 thx @ JMC47 for identifying the reversion, creating a useful bug report with fifo log :-) --- Source/Core/VideoCommon/Src/VertexManagerBase.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/Src/VertexManagerBase.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp index 9cfc3aa3f4..87856b5aeb 100644 --- a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp @@ -52,16 +52,18 @@ void VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32 strid { u32 const needed_vertex_bytes = count * stride; - if (needed_vertex_bytes > GetRemainingSize() || count > GetRemainingIndices(primitive)) + if (count > IndexGenerator::GetRemainingIndices() || count > GetRemainingIndices(primitive) || needed_vertex_bytes > GetRemainingSize()) { Flush(); - if (needed_vertex_bytes > GetRemainingSize()) - ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all vertices! " - "Increase MAXVBUFFERSIZE or we need primitive breaking afterall."); + if(count > IndexGenerator::GetRemainingIndices()) + ERROR_LOG(VIDEO, "Too less index values. Use 32bit or reset them on flush."); if (count > GetRemainingIndices(primitive)) ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all indices! " "Increase MAXIBUFFERSIZE or we need primitive breaking afterall."); + if (needed_vertex_bytes > GetRemainingSize()) + ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all vertices! " + "Increase MAXVBUFFERSIZE or we need primitive breaking afterall."); } } -- cgit v1.2.3