Ignore this: Issue solved. I found the function under device.ImmediateContext.VertexShader.SetConstantBuffer
Apparently VertexShader declared in DeviceContext is actually a VertexWrapperClass.. not a VertexShaderClass which was confusing me.
Just posting the answer in case someone else has the same problem.
Too long didn't read: I'm trying to find the SlimDX version of this line:
deviceContext->VSSetConstantBuffers(0, 1, &m_vertexPerObjectBuffer);
Trying to learn SlimDX and converting a C++ project I built into SlimDX. I'm running into trouble on how to actually set a Constant Buffer. I have managed to Create the Buffers, and update them like so:
vertexPerObject = new Buffer(device, new BufferDescription
{
Usage = ResourceUsage.Default,
SizeInBytes = Utility.SizeOf<VertexPerObject>(),
BindFlags = BindFlags.ConstantBuffer
});
var data = new DataStream(Utility.SizeOf<VertexPerObject>(), true, true);
Matrix worldViewProj = Matrix.Multiply(worldMatrix, viewMatrix);
worldViewProj = Matrix.Multiply(worldViewProj, projectionMatrix);
data.Write(worldViewProj);
data.Position = 0;
device.ImmediateContext.UpdateSubresource(new DataBox(0, 0, data), vertexPerObject, 0);
However, the only source of setting a Constant Buffer I can find in the SlimDX library occurs in the VertexShaderWrapper class. Here is the definition intellisense gives me on a peek:
public class VertexShaderWrapper
{
public VertexShader Get();
public VertexShader Get(ClassInstance[] classInstances);
public Buffer[] GetConstantBuffers(int startSlot, int count);
public SamplerState[] GetSamplers(int startSlot, int count);
public ShaderResourceView[] GetShaderResources(int startSlot, int count);
public void Set(VertexShader shader);
public void Set(VertexShader shader, ClassInstance[] classInstances);
public void SetConstantBuffer(Buffer constantBuffer, int slot);
public void SetConstantBuffers(Buffer[] constantBuffers, int startSlot, int count);
public void SetSampler(SamplerState sampler, int slot);
public void SetSamplers(SamplerState[] samplers, int startSlot, int count);
public void SetShaderResource(ShaderResourceView resourceView, int slot);
public void SetShaderResources(ShaderResourceView[] resourceViews, int startSlot, int count);
}
I assume this means it has an Abstract Contructor that takes 0 arguments since its not static. but trying this:
VertexShaderWrapper vsw = new VertexShaderWrapper();
Just gives me the error: VertexShaderWrapper does not contain a Constructor that takes 0 arguments.