# DirectX10 How to use Constant Buffers

I'm trying to access some variables in my shader, but I think I'm doing this wrong. Say I have a constant buffer that looks like this:

cbuffer perFrame
{
float foo;
float bar;
};


I got an ID3D10EffectConstantBuffer reference to it, and I can get a specific index by calling GetMemberByIndex, but how can I figure out how many members perFrame has so that I can get each member without going out of bounds?

If you have an ID3DX10EffectVariable that represents perFrame, then you should be able to call GetType to get an ID3DX10EffectType for perFrame. Then you can call GetDesc on that type instance to get a D3DX10_EFFECT_TYPE_DESC which has a Members field which should give you want you need.