18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 09:44:59 +01:00

fix(python): the image of the worker goes in place once its fence is signalled, the viewer binds it each frame

From the review of 8811ee5a:

- glWaitSync ordered only the context of the main window. The extra viewports and the windows of
  python.displaywindows draw in contexts of their own and could bind the new texture before the upload
  was done. commit_thread_upload() now asks the fence without waiting (glClientWaitSync, timeout 0) and
  puts the image in place only once it is signalled, so every context binding it afterwards has it whole.
  Until then the task stays in the upload queue and is asked again the next frame.
- The drawing thread chose between upload and commit by python.threadedupload, the worker by whether it
  got a context. With python.threadedupload on and no context made for the worker, the screens were no
  longer updated. The task now records that a worker uploaded it.
- The viewer of python.displaywindows told a new image by its texture name, but a deleted name comes back
  for a later texture. It binds the name of the last image each frame, read under the lock of the render
  target, and the name it starts with is read on the drawing thread when it is made.
This commit is contained in:
maj00r
2026-11-18 17:08:37 +01:00
parent 8811ee5a76
commit 61d195d9fc
7 changed files with 61 additions and 48 deletions

View File

@@ -27,8 +27,13 @@ struct ITexture
{
update_from_memory(width, height, data);
}
// puts in place the image of the last upload_from_thread(), once the gpu has it. called on the drawing thread
virtual void commit_thread_upload() { /* the image went in place right away */ }
// puts in place the image of the last upload_from_thread() once the gpu has it, without waiting for it. called on the
// drawing thread; false while the upload isn't done yet, to be asked again later
virtual bool commit_thread_upload()
{
// the image went in place right away
return true;
}
static ITexture *null_texture()
{
struct NullTexture : public ITexture