mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 07:24:57 +01:00
fix(python): the old texture deleted under the lock the viewers bind under, a fence not made waited for with glFinish
From the review of #411: - finish_upload() deleted the old texture before it took the lock of the render target, and the windows of python.displaywindows read the name under that lock but bound it after letting go of it. A window could bind a name already deleted, or already given to the next upload. In a compatibility context (the legacy renderer) that makes a new empty texture: a black frame and a texture never deleted. The commit and the publishing of the new name now go under the lock, and the viewer binds under it too. A name bound before the deletion stays alive in that window's context while bound. - A glFenceSync that returns no fence was taken for a signalled one: the image went in place at once, with nothing ordering the contexts. The worker now waits for its upload with glFinish then, as without sync objects.
This commit is contained in:
@@ -768,9 +768,9 @@ void opengl_texture::upload_from_thread(size_t width, size_t height, const uint8
|
||||
{
|
||||
upload.fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
}
|
||||
else
|
||||
if (upload.fence == nullptr)
|
||||
{
|
||||
// no sync objects: the drawing context can only be sure of the image once the upload is done
|
||||
// no sync objects, or no fence made: the drawing context can only be sure of the image once the upload is done
|
||||
glFinish();
|
||||
}
|
||||
// the drawing context waits on the fence, which it can do only once the fence is on its way to the gpu
|
||||
|
||||
Reference in New Issue
Block a user