Jump to content

  • Log In with Google      Sign In   
  • Create Account

Possible problem with multithreaded shader loading


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 noatom   Members   -  Reputation: 782

Like
0Likes
Like

Posted 03 June 2014 - 12:20 PM

So its apparently believed that loading shaders via multithreading would be better, but I can't grasp how that would be done, since creating a shader requires the dx device.

 

What would happen if 2 threads tried to create a shader at the same time? Wouldn't a thread start writing over the other? And if each thread had to wait for the other to finish wouldn't that defeat the purpose?


Edited by noatom, 03 June 2014 - 12:21 PM.


Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2565

Like
1Likes
Like

Posted 03 June 2014 - 02:35 PM

To create a shader you'll need to use ID3D11Device's Create...Shader commands. AFAIK, ID3D11Device call's should be thread safe. 

 

Cheers!

 

[edit] You didn't specify the D3D you are using. 


Edited by kauna, 03 June 2014 - 02:36 PM.


#3 MJP   Moderators   -  Reputation: 11438

Like
0Likes
Like

Posted 03 June 2014 - 03:08 PM

D3D11 supports multithreaded resource creation, so the driver will be handle creating two shaders simultaneously on the same device. So if you're using D3D11, you're fine. If you're using D3D10 the device will use a mutex to ensure only one thread can access the device at once, so one thread will end up waiting for the other to finish.



#4 noatom   Members   -  Reputation: 782

Like
0Likes
Like

Posted 03 June 2014 - 04:35 PM

thanks, yea I'm using d3d11






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