Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Constant Buffers in Pixel Shader

4: Adsense

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
2 replies to this topic

#1 DementedCarrot   Members   

1213
Like
0Likes
Like

Posted 29 May 2012 - 11:22 PM

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, 29 May 2012 - 11:25 PM.


#2 MJP   Moderators   

19419
Like
3Likes
Like

Posted 30 May 2012 - 12:56 AM

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.

#3 DementedCarrot   Members   

1213
Like
1Likes
Like

Posted 30 May 2012 - 01:01 AM

'Doh.

I'm still in Effect framework withdrawal.




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.