Jump to content

  • Log In with Google      Sign In   
  • Create Account


Multithread question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 DarkRonin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 26 April 2014 - 04:49 AM

Hi Guys,

 

Just wondering, is it possible to draw to a dynamic texture from within another thread?

 

The reason I ask is that I am doing some intensive calculations on a dynamic texture (per frame) which is eating up my frames per second in a large way.

 

So, I was thining (if possible) to do the calculations in a separate thread and display the texture when the calulations are complete (hopefully bringing up FPS again).

 

I would love to hear your thoughts on this :)



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 29308

Like
0Likes
Like

Posted 26 April 2014 - 05:53 AM

You can map/lock the texture on the main thread, then pass the mapped pointer/size to your 2nd thread, then have the main thread unmap/unlock the texture after the 2nd thread is done writing to it.

So yes - the main thread must do the map/unmap, but in the middle, you can write into the mapped buffer however you like ;)

#3 DarkRonin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 26 April 2014 - 06:08 AM

Thanks Hodgman :)

I think (after all that) that I am barking up the wrong tree.

I think I might be pushing too much onto my dynamic texture each frame. I am sending 1600 x 900 frames to my dynamic texture each frame. At this resolution I only manage around 40 FPS.

Is this typical for this size or would you still expect a higher frame rate?

#4 Tispe   Members   -  Reputation: 1003

Like
1Likes
Like

Posted 26 April 2014 - 06:27 AM

Consider pipelining this, so that you have two identical textures which are updated every other frame for maximum utilization. The other thread is updating one texture while the main thread renders from the other.


Edited by Tispe, 26 April 2014 - 06:28 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS