Render 3D: Handle RenderFinish() more consistently. Fixes 3D flushing issues when running single-threaded SoftRasterizer.

This commit is contained in:
rogerman 2017-11-20 10:58:27 -08:00
parent e5694abd63
commit 6680577146
2 changed files with 58 additions and 47 deletions

View File

@ -4717,11 +4717,15 @@ Render3DError OpenGLRenderer_1_2::Reset()
Render3DError OpenGLRenderer_1_2::RenderFinish() Render3DError OpenGLRenderer_1_2::RenderFinish()
{ {
if (!this->_renderNeedsFinish || !this->_pixelReadNeedsFinish) if (!this->_renderNeedsFinish)
{ {
return OGLERROR_NOERR; return OGLERROR_NOERR;
} }
if (this->_pixelReadNeedsFinish)
{
this->_pixelReadNeedsFinish = false;
if(!BEGINGL()) if(!BEGINGL())
{ {
return OGLERROR_BEGINGL_FAILED; return OGLERROR_BEGINGL_FAILED;
@ -4737,8 +4741,8 @@ Render3DError OpenGLRenderer_1_2::RenderFinish()
} }
ENDGL(); ENDGL();
}
this->_pixelReadNeedsFinish = false;
this->_renderNeedsFlushMain = true; this->_renderNeedsFlushMain = true;
this->_renderNeedsFlush16 = true; this->_renderNeedsFlush16 = true;
@ -5036,11 +5040,15 @@ Render3DError OpenGLRenderer_2_0::SetupTexture(const POLY &thePoly, size_t polyR
Render3DError OpenGLRenderer_2_1::RenderFinish() Render3DError OpenGLRenderer_2_1::RenderFinish()
{ {
if (!this->_renderNeedsFinish || !this->_pixelReadNeedsFinish) if (!this->_renderNeedsFinish)
{ {
return OGLERROR_NOERR; return OGLERROR_NOERR;
} }
if (this->_pixelReadNeedsFinish)
{
this->_pixelReadNeedsFinish = false;
if(!BEGINGL()) if(!BEGINGL())
{ {
return OGLERROR_BEGINGL_FAILED; return OGLERROR_BEGINGL_FAILED;
@ -5049,8 +5057,8 @@ Render3DError OpenGLRenderer_2_1::RenderFinish()
this->_mappedFramebuffer = (FragmentColor *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); this->_mappedFramebuffer = (FragmentColor *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
ENDGL(); ENDGL();
}
this->_pixelReadNeedsFinish = false;
this->_renderNeedsFlushMain = true; this->_renderNeedsFlushMain = true;
this->_renderNeedsFlush16 = true; this->_renderNeedsFlush16 = true;

View File

@ -2226,11 +2226,13 @@ Render3DError SoftRasterizerRenderer::EndRender(const u64 frameCount)
Render3DError SoftRasterizerRenderer::RenderFinish() Render3DError SoftRasterizerRenderer::RenderFinish()
{ {
if (!this->_renderNeedsFinish || !this->_renderGeometryNeedsFinish) if (!this->_renderNeedsFinish)
{ {
return RENDER3DERROR_NOERR; return RENDER3DERROR_NOERR;
} }
if (this->_renderGeometryNeedsFinish)
{
// Allow for the geometry rendering to finish. // Allow for the geometry rendering to finish.
this->_renderGeometryNeedsFinish = false; this->_renderGeometryNeedsFinish = false;
for (size_t i = 0; i < rasterizerCores; i++) for (size_t i = 0; i < rasterizerCores; i++)
@ -2260,6 +2262,7 @@ Render3DError SoftRasterizerRenderer::RenderFinish()
rasterizerUnitTask[i].finish(); rasterizerUnitTask[i].finish();
} }
} }
}
this->_renderNeedsFlushMain = true; this->_renderNeedsFlushMain = true;
this->_renderNeedsFlush16 = true; this->_renderNeedsFlush16 = true;