![Image](https://love2d.org/imgmirrur/aks1Ujx.png)
![Image](https://love2d.org/imgmirrur/5a2sGsS.png)
What exactly do the seperate threads do?Whatthefuck wrote:Hooray for multithreaded colored lighting!
It computes the lighting on a separate thread, obviously.S0lll0s wrote:What exactly do the seperate threads do?Whatthefuck wrote:Hooray for multithreaded colored lighting!
And how do you serialize the world/map across threads? The "flat" table limitation still keeps me from doing multi-threading.Whatthefuck wrote:It computes the lighting on a separate thread, obviously.S0lll0s wrote:What exactly do the seperate threads do?Whatthefuck wrote:Hooray for multithreaded colored lighting!
Basically the way it works is the main thread sends a request for light computation and then goes on to draw other stuff. Once it's done drawing other stuff, it waits until the other thread is finished, finishes the lighting up and renders it.
This way if the rendering process of other stuff takes longer than the light computation, there is virtually no framerate impact from the light compute, since by the time it's done rendering other stuff, it'll just finalize the lighting (without waiting) and render it.
I write the lighting which I want computed into a ImageData object, since it's userdata, it's shared between threads, and no duplicates are required. So upon initialization I send a reference of the LightData object to a separate thread, read it's size and set up various variables accordingly.S0lll0s wrote:And how do you serialize the world/map across threads? The "flat" table limitation still keeps me from doing multi-threading.
Yeah, whoops, typo, meant ImageData.S0lll0s wrote:Thanks for the insight - I suppose by LightData you mean ImageData for a light image? I can't find anything called LightData.
Users browsing this forum: Bing [Bot], rabbitboots and 3 guests