MAINT-318 prevent crashes from incomplete quads and lines and prevent drivers from crashing to desktop when passed short buffers

master
Graham Linden 2013-06-17 08:03:32 -07:00
parent d75667560c
commit c603eb5ece
1 changed files with 25 additions and 24 deletions

View File

@ -1849,35 +1849,36 @@ void LLRender::flush()
sUIVerts += mCount;
}
if (gDebugGL)
//store mCount in a local variable to avoid re-entrance (drawArrays may call flush)
U32 count = mCount;
if (mMode == LLRender::QUADS && !sGLCoreProfile)
{
if (mMode == LLRender::QUADS && !sGLCoreProfile)
if (mCount%4 != 0)
{
if (mCount%4 != 0)
{
llerrs << "Incomplete quad rendered." << llendl;
}
}
if (mMode == LLRender::TRIANGLES)
{
if (mCount%3 != 0)
{
llerrs << "Incomplete triangle rendered." << llendl;
}
}
if (mMode == LLRender::LINES)
{
if (mCount%2 != 0)
{
llerrs << "Incomplete line rendered." << llendl;
}
count -= (mCount % 4);
llwarns << "Incomplete quad requested." << llendl;
}
}
//store mCount in a local variable to avoid re-entrance (drawArrays may call flush)
U32 count = mCount;
if (mMode == LLRender::TRIANGLES)
{
if (mCount%3 != 0)
{
count -= (mCount % 3);
llwarns << "Incomplete triangle requested." << llendl;
}
}
if (mMode == LLRender::LINES)
{
if (mCount%2 != 0)
{
count -= (mCount % 2);
llwarns << "Incomplete line requested." << llendl;
}
}
mCount = 0;
if (mBuffer->useVBOs() && !mBuffer->isLocked())