Jump to content
  • Advertisement
Sign in to follow this  
DividedByZero

DX11 Basic constant buffer question

This topic is 1164 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys,

 

Currently I am just using a single shader in my DX11 based project. But, it got me wondering - When using PSSetConstantBuffers() and VSSetConstantBuffers(), how does DX know what shader it is working with? Or is it just assumed by the last SetShader() call?

 

I am guessing that this must be the case. But, I'd rather know for sure than to continue guessing. smile.png

 

Thanks in advance.

 

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

Yes, the last SetShader call will determine what shader will run. Methods like SetConstantBuffer bind things to the pipeline (device context), not a specific shader.

 

You can do this for example and both draw calls will use the same constant buffer:

SetConstantBuffer(0, B1)
SetShader(S1)
Draw()
SetShader(S2)
Draw()
Edited by lwm

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!