Hi,
I'm completely new to DirectX, and just start looking into it using SharpDX, and I have a question regarding the constant buffer.
In most of the material I have been reading I see it is recommended to create multiple smaller constant buffers, e.g. in the example from '3D game programming with DirectX' it show to create a constant buffer for e.g.
cbuffer cbPerObject,
cbuffer cbPerFrame
cbuffer cbRarely
But what I have not been able to find is how to access those individual buffers.
I understand that the entire buffer must be written each time it Is updated (which is why smaller is better), and I understand that the buffer is updated through
context.UpdateSubresource(data, buffer)
But I have not been able to find how to make the link between the buffer defined in the shader file and the buffer used in the C# code.
Is there anyone who can explain how this is done?
And a side question, I tried to use effect instead and access the variables through GetVariableByName() and then do an effect.Apply() which works, and seems straight forward. What is the benefit of one over the other?, does effect.Apply update only the 'cbuffer' in where the modified variables are?. (I know I shouldn't worry about this right now, but I'm just curious)
Thanks