From 3bd9ffe1357d2eed7455b704788d4ec6605a26cc Mon Sep 17 00:00:00 2001 From: Shyotl Date: Fri, 13 Apr 2012 22:17:19 -0500 Subject: [PATCH] Fixed an annoying snapshot assertion (would buffer overrun if assertions are disabled) --- indra/newview/llviewerdisplay.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index a7dea4d74..7e6a76cbd 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -969,12 +969,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo stop_glerror(); } - for (U32 i = 0; i < (U32)gGLManager.mNumTextureImageUnits; i++) + //Reversed this. disabling a texunit sets its index as current.. randomly breaking LLRender::matrixMode(U32 mode). Make sure unit0 is the 'current' unit. + for (S32 i = gGLManager.mNumTextureImageUnits-1; i >= 0; --i) { //dummy cleanup of any currently bound textures - if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) + if (gGL.getTexUnit((U32)i)->getCurrType() != LLTexUnit::TT_NONE) { - gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); - gGL.getTexUnit(i)->disable(); + gGL.getTexUnit((U32)i)->unbind(gGL.getTexUnit((U32)i)->getCurrType()); + gGL.getTexUnit((U32)i)->disable(); } } LLAppViewer::instance()->pingMainloopTimeout("Display:RenderFlush");