SoftRasterizer: Fix a bug where some games would occasionally have unreliable rendering or precipitous performance drops. (Regression from commit e06d11f.)

This commit is contained in:
rogerman 2019-02-04 23:40:15 -08:00
parent 242ccb26cf
commit e433a6d80e
1 changed files with 6 additions and 1 deletions

View File

@ -1724,6 +1724,8 @@ SoftRasterizerRenderer::SoftRasterizerRenderer()
_deviceInfo.maxAnisotropy = 1.0f;
_deviceInfo.maxSamples = 0;
_clippedPolyList = (CPoly *)malloc_alignedCacheLine(POLYLIST_SIZE * 2 * sizeof(CPoly));
_task = NULL;
_debug_drawClippedUserPoly = -1;
@ -1832,6 +1834,9 @@ SoftRasterizerRenderer::~SoftRasterizerRenderer()
delete this->_framebufferAttributes;
this->_framebufferAttributes = NULL;
free_aligned(this->_clippedPolyList);
this->_clippedPolyList = NULL;
}
void SoftRasterizerRenderer::__InitTables()
@ -2011,7 +2016,7 @@ Render3DError SoftRasterizerRenderer::BeginRender(const GFX3D &engine)
this->currentRenderState = (GFX3D_State *)&engine.renderState;
this->_clippedPolyCount = engine.clippedPolyCount;
this->_clippedPolyOpaqueCount = engine.clippedPolyOpaqueCount;
this->_clippedPolyList = engine.clippedPolyList;
memcpy(this->_clippedPolyList, engine.clippedPolyList, this->_clippedPolyCount * sizeof(CPoly));
const bool doMultithreadedStateSetup = (this->_threadCount >= 2);