Jump to content
  • Advertisement
Sign in to follow this  
jdub

DX11 [SlimDX/Dx11] Vertices not being passed to the pipeline?

This topic is 2274 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm trying to draw an indexed model. Here's the code which loads vertex and index buffers:


public void Load(Vertex[] vertices, Int32[] indices)
{
//Write Vertices
DataStream vStream = new DataStream(vertices, true, true);
BufferDescription vBufferDescription = new BufferDescription()
{
BindFlags = BindFlags.VertexBuffer,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.None,
StructureByteStride = Marshal.SizeOf(typeof(Vertex)),
SizeInBytes = Marshal.SizeOf(typeof(Vertex)) * vertices.Length,
Usage = ResourceUsage.Default
};
this.vBuffer = new Dx11Buffer(this.device, vStream, vBufferDescription);
this.vBufferBinding = new VertexBufferBinding(this.vBuffer, Marshal.SizeOf(typeof(Vertex)), 0);
vStream.Dispose();
//Write Strip Indices
DataStream iStream = new DataStream(indices, true, true);
BufferDescription iBufferDescr = new BufferDescription()
{
BindFlags = BindFlags.IndexBuffer,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.None,
SizeInBytes = Marshal.SizeOf(typeof(Int32)) * indices.Length,
StructureByteStride = Marshal.SizeOf(typeof(Int32)),
Usage = ResourceUsage.Default
};
this.iBuffer = new Dx11Buffer(this.device, iStream, iBufferDescr);
iStream.Dispose();
}


and here's my draw code:


context.ClearRenderTargetView(this.renderTargetView, new Color4(Color.Azure.ToArgb()));
context.InputAssembler.SetIndexBuffer(iBuffer, SlimDX.DXGI.Format.R32_UInt, 0);
context.InputAssembler.SetVertexBuffers(0, vBufferBinding);
context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
context.DrawIndexed(iBuffer.Description.SizeInBytes / Marshal.SizeOf(typeof(Int32)), 0, 0);
swapChain.Present(0, PresentFlags.None);


I've debugged my app in PIX and it appears that the vertex data is not being passed into the vertex shader correctly: the correct number of vertices are loaded however they have all components set to 0.

Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!