Original Post
Hey.
I am investigating the use of constant buffers in effect files. Say, my effect file had buffer declarations like this:
When initializing my shader, i would get a pointer to this effect variable by name, and store it in my object:
On rendering, I do
There is no buffer mapping or else involved. So my question is, is this even using the advantages of constant buffers, or is this an absurdely abuse of mentioned features?
Should I instead create a custom buffer type, create a buffer of this type, bind it as dynamic to the effect, and use map on each render call?
Can the view buffer even be updated, I have seen no flag specifying it as DYNAMIC?
Thanks for your help.
I am investigating the use of constant buffers in effect files. Say, my effect file had buffer declarations like this:
cbuffer cbPerViewBuffer
{
matrix viewMatrix;
};
When initializing my shader, i would get a pointer to this effect variable by name, and store it in my object:
ID3DX11EffectMatrixVariable *p_view;
ID3DX11Effect* p_effect;
//... Compiling effect ...//
p_view = p_effect->GetVariableByName("viewMatrix")->AsMatrix();
On rendering, I do
D3DXMATRIX v;
//... doing the math on v ...//
p_view->SetMatrix( v);
There is no buffer mapping or else involved. So my question is, is this even using the advantages of constant buffers, or is this an absurdely abuse of mentioned features?
Should I instead create a custom buffer type, create a buffer of this type, bind it as dynamic to the effect, and use map on each render call?
Can the view buffer even be updated, I have seen no flag specifying it as DYNAMIC?
Thanks for your help.