tI'm struggling to understand constant buffers in DirectX. I've seen two syntaxes
float4 myVar;
declared at top level of the shader file and
cbuffer myBuffer
{
float4 myVar;
}
as detailed on http://msdn.microsoft.com/en-gb/library/windows/desktop/bb509581(v=vs.85).aspx
I understand that constant buffers need to be assigned to slots (zero-based indexing) and can be set in code.
The two frameworks I've looked at (SlimDX vs SharpDX) seem to use different conventions for setting them - SlimDX by string name (via shader reflection?) and SharpDX by slot number - although its not clear where the slot number is obtained from?
Can anyone shed light on the difference between the two syntaxes, if they are actually different, how slot numbers are assigned to declarations in the .fx file and how the slot numbers are shared between shaders?
Any help appreciated