Constant Buffers in Pixel Shader

Started by
1 comment, last by BrentMorris 11 years, 11 months ago
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?
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.
'Doh.

I'm still in Effect framework withdrawal.

This topic is closed to new replies.

Advertisement