문제

When I share a per-frame constant buffer in both vertex and pixel shader I call:

VSSetConstantBuffers(0,1,&frameBuffer);
PSSetContantBuffers(0,1,%frameBuffer);

And in both HLSL the cbuffer declaration:

cbuffer PerFrame: register(b0)
{
    float1 g_time;
    ...
}

In this particular case I use slot 0 for both shaders. My question is, are this slots independent from the shader stage or they are shared?

In other words, if in the VertexShader I assign cbuffers with slots 0,1,2,3 then in the PixelShader can I use slots 0,1,2,3 for binding different cbuffers or must be the same cbuffers than in VertexShader?

도움이 되었습니까?

해결책

They can be different constant buffers, hence the separate VSSetConstantBuffers and PSSetConstantBuffers (etc.) methods.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top