Sign in to follow this  
damsku

DrawIndexedPrimitive error

Recommended Posts

Hi, What are the possible causes for directx to say: "D3D9 Helper: IDirect3DDevice9::DrawIndexedPrimitive failed: D3DERR_INVALIDCALL Direct3D9: (ERROR) :Index stream does not have required number of indices. DrawIndexedPrimitive failed." If d3d is in retail mode then it will complain about a viewport problem which i assume is caused by the primitive trashing somehow the video memory.. in d3d debug mode, i get the message above and i don't get what could be the cause. Obviously, the data passed to the DrawIndexedPrimitive call is valid and the rendering works properly if used from a different location in the code (I m trying to do some kind of offline rendering right now). So I suspect I did not enable or initialize something i should have. Any suggestions? Thanks in advance.

Share this post


Link to post
Share on other sites
The solution is in your question..[smile]
"Index stream does not have required number of indices"
So you need x amount of vertices, and y amount of indices.
Possible errors:
1. You are passing wrong number of indices.
2. You may have to many indices, that will cause buffer overflow (check out your MaxVertexIndex value in the capabilities struct (65534 is max???) )
3. You are using 32Bit indices and your graphic card doesn't support them

Share this post


Link to post
Share on other sites
And i also say "the data passed to the DrawIndexedPrimitive call is valid and the rendering works properly if used from a different location in the code" :)
1. the number of indices is right
2. i dont have too many indices
3. it works on that card

Basically, i m just calling a Draw() method which renders everything i want but from a different "begin/endscene" than the one where it renders on screen.
I do that cause i want the scene to be renderer offline to a rendertarget.
So the only difference comes only from the previous d3d calls..
And the release version showing a different error makes me not to rely TOO much on the accuracy of the error report.

Share this post


Link to post
Share on other sites
Quote:
Original post by damsku
And the release version showing a different error makes me not to rely TOO much on the accuracy of the error report.

The retail version of the library has no obligation to report errors correctly, so I would disregard what it says.

Quote:
Original post by damsku
And i also say "the data passed to the DrawIndexedPrimitive call is valid and the rendering works properly if used from a different location in the code" :)

Then the data passed to DIP is invalid at the point from which it is being called. I take it you've checked all the obvious stuff - making sure that the buffers have been created, that any dynamic operations have completed, and that all Lock calls have reached their corresponding Unlock. If so, I recommend you create a frame capture in PIX and locate the offending DIP call. PIX will allow you to inspect the state of all the input data at this point of execution, and so it should be clear if any of the buffers are out of state.

Share this post


Link to post
Share on other sites
I did check all of those, and I have tried to do a capture in PIX, however, I haven't been able to get a capture yet... For some reasons, even though the user event which triggers the capture is at the right location and is triggered at the time it should, the capture shows a frame for another viewport and I'm still trying to figure out why... It would help if i could do a proper capture indeed :)

Share this post


Link to post
Share on other sites
Thank you for helping :)
Stupid me didn't notice the viewport family was treating BSP as dynamic mesh. So the rendering had indeed the exact same data than the offline rendering which was faulty.. Just that the meshes weren't exctly in the same list. NASTY !!..

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