OpenGL Renderer: Fix one more possible crash that may occur if the 3D framebuffer is read before the 3D renderer has a chance to render at least once. (Related to commit f8bbbec.)

This commit is contained in:
rogerman 2018-03-04 17:20:21 -08:00
parent 8d011f8344
commit 42c0379cbb
2 changed files with 2 additions and 1 deletions

View File

@ -2265,6 +2265,7 @@ Render3DError OpenGLRenderer_1_2::CreatePBOs()
glGenBuffersARB(1, &OGLRef.pboRenderDataID);
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, OGLRef.pboRenderDataID);
glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, this->_framebufferColorSizeBytes, NULL, GL_STREAM_READ_ARB);
this->_mappedFramebuffer = (FragmentColor *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
return OGLERROR_NOERR;
}

2
desmume/src/render3D.cpp Normal file → Executable file
View File

@ -209,7 +209,7 @@ Render3D::Render3D()
_framebufferHeight = GPU_FRAMEBUFFER_NATIVE_HEIGHT;
_framebufferPixCount = _framebufferWidth * _framebufferHeight;
_framebufferSIMDPixCount = 0;
_framebufferColorSizeBytes = 0;
_framebufferColorSizeBytes = _framebufferWidth * _framebufferHeight * sizeof(FragmentColor);
_framebufferColor = NULL;
_internalRenderingFormat = NDSColorFormat_BGR666_Rev;