Changeset - r25261:3b1b500a06d6
[Not reviewed]
master
0 3 0
Michael Lutz - 3 years ago 2021-04-24 22:43:38
michi@icosahedron.de
Fix: [OpenGL] Main loop expects to start with the video buffer unmapped. (#9100)
3 files changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/video/opengl.cpp
Show inline comments
 
@@ -1151,12 +1151,13 @@ void *OpenGLBackend::GetVideoBuffer()
 
{
 
#ifndef NO_GL_BUFFER_SYNC
 
	if (this->sync_vid_mapping != nullptr) _glClientWaitSync(this->sync_vid_mapping, GL_SYNC_FLUSH_COMMANDS_BIT, 10000000);
 
#endif
 

	
 
	if (!this->persistent_mapping_supported) {
 
		assert(this->vid_buffer == nullptr);
 
		_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->vid_pbo);
 
		this->vid_buffer = _glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_READ_WRITE);
 
	} else if (this->vid_buffer == nullptr) {
 
		_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->vid_pbo);
 
		this->vid_buffer = _glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, _screen.pitch * _screen.height * BlitterFactory::GetCurrentBlitter()->GetScreenDepth() / 8, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
 
	}
src/video/sdl2_opengl_v.cpp
Show inline comments
 
@@ -71,12 +71,14 @@ const char *VideoDriver_SDL_OpenGL::Star
 
	this->ClientSizeChanged(w, h, true);
 
	/* We should have a valid screen buffer now. If not, something went wrong and we should abort. */
 
	if (_screen.dst_ptr == nullptr) {
 
		this->Stop();
 
		return "Can't get pointer to screen buffer";
 
	}
 
	/* Main loop expects to start with the buffer unmapped. */
 
	this->ReleaseVideoPointer();
 

	
 
	return nullptr;
 
}
 

	
 
void VideoDriver_SDL_OpenGL::Stop()
 
{
src/video/win32_v.cpp
Show inline comments
 
@@ -1308,12 +1308,14 @@ const char *VideoDriver_Win32OpenGL::Sta
 
	/* We should have a valid screen buffer now. If not, something went wrong and we should abort. */
 
	if (_screen.dst_ptr == nullptr) {
 
		this->Stop();
 
		_cur_resolution = old_res;
 
		return "Can't get pointer to screen buffer";
 
	}
 
	/* Main loop expects to start with the buffer unmapped. */
 
	this->ReleaseVideoPointer();
 

	
 
	MarkWholeScreenDirty();
 

	
 
	this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread");
 

	
 
	return nullptr;
0 comments (0 inline, 0 general)