Jump to content

  • Log In with Google      Sign In   
  • Create Account

Problem show up when I use debug in DX9 control panel


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 DarkRonin   Members   -  Reputation: 616

Like
0Likes
Like

Posted 02 June 2014 - 12:28 AM

Hi Guys,

I have just noticed that when I run my program with the DX Control Panel set to use the debug mode, I get an error every draw call.

Direct3D9: (ERROR) :Vertex buffer must be unlocked during DrawPrimitive call
Direct3D9: (ERROR) :DrawPrimitive failed.


This is the code I am using to render a single quad. Nothing else is happening in the draw call that reports any errors (i.e. If I comment out this source the program doesnt report any errors)

if(!FAILED(pVertexSpriteObject->Lock(0,(nNumVerts)*sizeof(D3DVERTEX),&pVertexBuffer,D3DLOCK_DISCARD)))
{
	pVertexSpriteObject->Lock(0,(nNumVerts)*sizeof(D3DVERTEX),&pVertexBuffer,D3DLOCK_DISCARD);

	memcpy(pVertexBuffer,vertices,(nNumVerts)*sizeof(D3DVERTEX));
	
	Renderer->DeviceHandle()->SetStreamSource(0,pVertexSpriteObject,0,sizeof(D3DVERTEX));
	Renderer->DeviceHandle()->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);

	pVertexSpriteObject->Unlock();
	Renderer->DeviceHandle()->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,nNumVerts-2);
}
As far as I can see, I am unlocking the vertex buffer with pVertexSpriteObject->Unlock();.

I have tried moving that line below DrawPrimative() but get the same error.

Any chance anyone could advise on what I am doing wrong?

Thanks in advance smile.png

Sponsor:

#2 DarkRonin   Members   -  Reputation: 616

Like
5Likes
Like

Posted 02 June 2014 - 12:30 AM

Damn, what a stupid mistake. I saw what is wrong straight after I posted this (must be the different font - LOL)

I am locking the vertex buffer twice in a row.

Edited by lonewolff, 02 June 2014 - 12:30 AM.


#3 SeanMiddleditch   Members   -  Reputation: 7148

Like
1Likes
Like

Posted 02 June 2014 - 11:21 AM

Damn, what a stupid mistake. I saw what is wrong straight after I posted this (must be the different font - LOL)


It happens. I know a number of developers who keep a stuffed animal or somesuch around just so they can go up to it and explain out loud the problem they're stuck on in detail (without distracting any teammates) and then often figure out the problem as they're explaining it.

#4 cozzie   Members   -  Reputation: 1762

Like
0Likes
Like

Posted 02 June 2014 - 01:59 PM

If you want you can also mark/ enable that the application stops when a d3d error occurs, that way you don't have to constantly check and rely on checking the output debug window always




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS