# GPU Crashes with DrawIndexedPrimitives

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

## Recommended Posts

Hello,

I'm drawing a terrain in my game using DrawIndexedPrimitives with 262144 (512*512) vertices.

Here's the line:

GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, nVertices, 0, nIndices / 3);

The terrain draws well, but I tried to change the startIndex parameter, but my GPU starts to have problem at the rank 6139:

GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, nVertices, 6139, nIndices / 3);

Under 6139, everything is fine. At 6139 and above, I got some weird problems, I got messages saying the kernel of my GPU has crashed, etc.

I have an nVidia 9800GTX+.

I can't find a link between 6139 and any other variables in my code. Where could be the problem from?

Thank you!

Edited by LemonBiscuit

##### Share on other sites
You can't use a startIndex > 0 and use the same primitiveCount. If the index buffer isn't big enough I'm not surprised you get a crash (the driver probably now tries to read beyond allocated memory). This MSDN entry explains the underlying D3D9 logic for DrawIndexedPrimitive, especially have a look at scenario 3. So you need to decrease primitiveCount accordingly.