mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 08:35:01 +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:
@@ -85,10 +85,11 @@ class render_task
|
||||
void run();
|
||||
// uploads the image on the drawing thread
|
||||
void upload() const;
|
||||
// uploads the image on a worker with a gl context of its own (python.threadedupload); commit_upload() puts it in place
|
||||
void upload_from_thread() const;
|
||||
// puts the image of upload_from_thread() in place, on the drawing thread
|
||||
void commit_upload() const;
|
||||
// uploads the image on a worker with a gl context of its own (python.threadedupload); finish_upload() puts it in place
|
||||
void upload_from_thread();
|
||||
// on the drawing thread: uploads the image, or puts in place the one a worker uploaded. false while the gpu hasn't got
|
||||
// the latter yet, to be called again
|
||||
bool finish_upload() const;
|
||||
void cancel() const;
|
||||
auto target() const -> std::shared_ptr<python_rt>
|
||||
{
|
||||
@@ -100,6 +101,8 @@ class render_task
|
||||
PyObject *m_renderer{nullptr};
|
||||
std::shared_ptr<dictionary_source> m_input{nullptr};
|
||||
std::shared_ptr<python_rt> m_target{nullptr};
|
||||
// set by upload_from_thread(); read by the drawing thread after the task was handed over under the lock of the queue
|
||||
bool m_uploadedbyworker{false};
|
||||
};
|
||||
|
||||
class python_taskqueue
|
||||
|
||||
Reference in New Issue
Block a user