Open baehyunsol opened 1 year ago
No, macroquad silently assumes that all its API calls are made from one single thread (like we have on wasm).
Unfortunately macroquad is not yet panicing on incorrent usage :(
In that case, what would be the best way to use a Texture2D
created from another thread? Is there any workaround?
I want them to run on different processes because I don't want the resource loading to block the main game process.
what would be the best way to use a Texture2D created from another thread
Again, macroquad does not allow this :(
But, OpenGl is basically single-threaded, so even if macroquad would allow it, you can't really gain anything from doing texture2d::from_whatever on another thread.
You can parse PNG data on another thread, or do any CPU-heavy computation on another threads.
Okay, I should figure out another way to load resources background
Thanks!
Is it okay to use an image (
Texture2D
) loaded from another thread? I spawned 2 processes, A and B. I calledTexture2D::from_file_with_format
in process A, and sent theTexture2D
from the function to process B usingmpsc::Sender
.My code is working but it's showing an empty image. I suspect something's wrong with the
mpsc
stuff. Is it safe to sendTexture2D
across processes?