Ask about programming in threads

BlitzMax Forums/BlitzMax Programming/Ask about programming in threads

Yue(Posted 2016) [#1]
I would like to know if it is advisable to have a thread that does a renderWord and another thread that does an UpdateWorld?

Is this possible? Will the performance improve?


grable(Posted 2016) [#2]
Probably not, since UpdateWorld has to finish before RenderWorld can be performed.
And as far as i remember, rendering contexts are bound to a specific thread anyway, at least for DX<12 and OGL.
Now, UpdateWorld probably doesnt touch all that much of the rendering APIs, so it could probably be threaded, but since the RenderWorld thread now has to wait for it, it wont be any faster.
Unless perhaps UpdateWorld was split into more threads, parallelizing all its work, youd still have to wait for them to finish though, but if their works is easily parallelized it might be faster.


Derron(Posted 2016) [#3]
If you do UpdateWorld in another thread then RenderWorld might still need to wait for it but that time should be shorter (updating while rendering) than before (update after rendering)..


But splitting updateWorld in threads might help already.


Bye
Ron


Yue(Posted 2016) [#4]
Thanks for the comments, is that I have a drastic drop in performance, and I guess my computer does not give for more. At present I have 200,000 triangles rendering the scene, where only 5000 are from the explorer. I think I'll have to lower the detail of the terrain, and although I do not like the idea, I think it's the best thing I can do.




Derron(Posted 2016) [#5]
Just comment out all the calculations and draw it "statically". If performance is already down then...it is not your updateworld (i assume you do not do collisions or so then). Camera control could stay enabled.


Bye
Ron