Sign in to follow this  
dave

I really Dont Undestand These Framerate Drops...

Recommended Posts

So im writing an engioen for a puzzle game im making. below is some code that when it is executed per frame drops the fps from 340fps to 256.
	int vertexIndex = 0;
	D3DXVECTOR3 vec;
	D3DXMATRIXA16 matTot, matTrans, matScale;


	bgNode = &bgStart;
	bgNode = bgNode->next;

	while (bgNode)
	{
		memcpy(&finalBuffer[vertexIndex], &bgNode->pBL->v[0], sizeof(bgNode->pBL->v) );
		vertexIndex += 36;
		bgNode = bgNode->next;
	}


The linked list is 1000 nodes long, the stuff thats being copied using memcpy is 36 of these:
struct GENERICVERTEX3D
{
	float x,  y,  z;
	float tu, tv;
};


Is traversing linked lists this expensive. Also what worries me is that i need to render 36000 vertices after this is per frame and i dont think i can do it without it dropping below 100fps. Without the memcpy line the framrate barely drops. Are multiple calls to memcpy slow? Anyone have any ideas as to why its so slow. ace

Share this post


Link to post
Share on other sites
Quote:
Original post by ace_lovegrove
Thanx for that, i feel silly.

I would have thought i would have worked that out


Similar questions come up quite often, so don't feel bad - a lot of people get caught out by this the first time they start taking note of their framerates.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this