Skip to main content
GameDev.net gamedev.net
🔒 Locked

Hardware Instancing

Started by NewtonsBit Feb 10, 2012 at 8:13 PM 1 replies 1.2k views
Original Post
NewtonsBit
NewtonsBit
Hi all,

I'm currently losing my mind. I'm trying to render 65536 cubes using a single DrawInstancedPrimitives call. I've set up the excellent example at float4x4 to render 65536 cubes and it does so in about 0.3ms on my machine. Doing the 65,536 cubes in my project, however, currently takes 60.0ms.

As far as I can tell, I'm only doing one thing differently: I'm changing the instance VertexBuffer in the VertexBufferBinding each frame. If I comment out the Draw call, drawing only takes about 4ms. At first I thought it the speed problems were due to changing the buffers, but that's not it. I can draw just the first 256 cubes in the buffer without any performance problems.

Any help? I'm about to start ripping my hair out.
NewtonsBit
NewtonsBit
To add to the above, my shader is also very simple. The vertex shader multiplies the position and normal by the worldviewprojection matrix and the pixel shader just returns an input color (no calculations).
NewtonsBit
NewtonsBit
Oh nevermind. I was using shader model 2 instead of 3.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.