# retail vs debug version - error appeared

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

## Recommended Posts

When I am running my project in debug version of directX(I have 9.0) I got an exception below that code
 vertexBuffers[attrange] = new VertexBuffer(typeof(CustomVertex.PositionNormalTextured), verCount, modelMesh.Device, Usage.WriteOnly, CustomVertex.PositionNormalTextured.Format, Pool.Default);
vertexBuffers[attrange].SetData(modelVertices, 0, LockFlags.None);
vertexBuffers[attrange].Unlock();//HERE


the exception is InvalidCallException... But when I run my procejt in retail version I don't get error.I did not understand it.Does anyone can help me?

##### Share on other sites
What does the Debug Spew say? Whenever D3D returns an error, it will always output a text string to the debug spew explaining what the problem is. If you're not sure what the Debug Spew is, check out the Forum FAQ.

neneboricua

##### Share on other sites
The retail version doesn't test for nearly as many things as the debug runtime. The Forum FAQ will help you debug it. I'd bet there's a message in the debug spew about unlocking things that were never locked.

##### Share on other sites
I had examined all debug messages. The error string in the debug screen when you run the project is "D3DERR_INVALIDCALL". It says error in Application.
When I comment out the vertexBuffers[attrange].Unlock(); the project is ok.But then it uses %96-97 of CPU.
I can not find a way

##### Share on other sites
Quote:
 Original post by TheMaskedFaceI had examined all debug messages. The error string in the debug screen when you run the project is "D3DERR_INVALIDCALL". It says error in Application.When I comment out the vertexBuffers[attrange].Unlock(); the project is ok.But then it uses %96-97 of CPU.I can not find a way

It is completely normal that the program uses 95-100 % of your CPU, since you never pause the program, I just played CS:S and it uses 98 % so don't worry that is normal for games.

I'm not familar with DX, but you should probably lock the vertex buffer before calling SetData, but maybe it locks internally, in that case you shouldn't unlock it.

EDIT: Just checked MSDN, the SetData function unlocks (and locks) the vertex buffer, so you should just remove the Unlock call.

##### Share on other sites
thanks a lot...Your post really helped me to find the problem.

Modifiyng LockFlags in SetData() had solved my problem...

1. 1
Rutin
26
2. 2
JoeJ
20
3. 3
4. 4
5. 5

• 10
• 10
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
631751
• Total Posts
3002086
×