0
votes

I have 2 constans buffers for my shaders, one for each frame and one for each object (let call them cbPerFrame and cbPerObj). It seems like the data from the cbPerFrame buffer isn't getting through to the pixel shader. I recently changed the slot numbers when setting the constant buffers (with PSSetConstantBuffers/ VSSetConstantBuffers). Now my question is:

When changing the slot numbers for the constant buffers, do i have to change something in the shader file? I read something about the keyword "Register" when declaring the constant buffers in the shader file, but i never really got it. The data should still be in the second slot until i overwrite it, rigth ?

Sorry if it is a basic question but the slot numbers and allocation of constant buffers confuses me abit

1

1 Answers

2
votes

Yes, you need to specify in your shader what cbuffer is in what slot. To do this use:

cbuffer cbPerFrame : register(b0)
{
     // insert guts here
};

This will register cbPerFrame into slot 0.