rasterizer: fix an occasional crash during loadstate

This commit is contained in:
zeromus 2010-04-18 23:10:53 +00:00
parent 80ba44d209
commit e72b321d29
1 changed files with 5 additions and 2 deletions

View File

@ -925,6 +925,7 @@ public:
u32 lastTextureFormat = 0, lastTexturePalette = 0; u32 lastTextureFormat = 0, lastTexturePalette = 0;
//iterate over polys //iterate over polys
bool first=true;
for(int i=0;i<engine->clippedPolyCounter;i++) for(int i=0;i<engine->clippedPolyCounter;i++)
{ {
if(!RENDERER) _debug_thisPoly = (i==engine->_debug_drawClippedUserPoly); if(!RENDERER) _debug_thisPoly = (i==engine->_debug_drawClippedUserPoly);
@ -935,7 +936,7 @@ public:
POLY *poly = clippedPoly.poly; POLY *poly = clippedPoly.poly;
int type = clippedPoly.type; int type = clippedPoly.type;
if(i == 0 || lastPolyAttr != poly->polyAttr) if(first || lastPolyAttr != poly->polyAttr)
{ {
polyAttr.setup(poly->polyAttr); polyAttr.setup(poly->polyAttr);
polyAttr.translucent = poly->isTranslucent(); polyAttr.translucent = poly->isTranslucent();
@ -943,13 +944,15 @@ public:
} }
if(i == 0 || lastTextureFormat != poly->texParam || lastTexturePalette != poly->texPalette) if(first || lastTextureFormat != poly->texParam || lastTexturePalette != poly->texPalette)
{ {
sampler.setup(poly->texParam); sampler.setup(poly->texParam);
lastTextureFormat = poly->texParam; lastTextureFormat = poly->texParam;
lastTexturePalette = poly->texPalette; lastTexturePalette = poly->texPalette;
} }
first = false;
lastTexKey = engine->polyTexKeys[i]; lastTexKey = engine->polyTexKeys[i];
//hmm... shader gets setup every time because it depends on sampler which may have just changed //hmm... shader gets setup every time because it depends on sampler which may have just changed