Jump to content
  • Advertisement
Sign in to follow this  
BrentMorris

Constant Buffers in Pixel Shader

This topic is 2211 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

This is something that I cant find a direct answer to.

I've got a constant buffer with world/view/projection matrices that I'm using in the vertex shader, and then another float I need to use in the pixel shader. The matrices read fine, and the float works perfectly if it's read in the vertex shader, but when it is read in the pixel shader it always returns 0.

Can you use constant buffers in pixel shaders? Or is there some special syntax you have to use to share constant buffers between vertex/pixel shaders?

Edit: Or do you have to use a couple constant buffers such that you keep vertex shader cb's and pixel shader cb's separate? Edited by DementedCarrot

Share this post


Link to post
Share on other sites
Advertisement
You can share constant buffers between stages. You just need to bind that constant buffer to all stages that you want to use it from, so in this case you'll have to call PSSetConstantBuffers to do that.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!