Jump to content

  • Log In with Google      Sign In   
  • Create Account

DrawIndexed : StartIndexLocation / IASetVertexBuffers : Offset


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
4 replies to this topic

#1 eppo   Crossbones+   -  Reputation: 2621

Like
0Likes
Like

Posted 01 January 2013 - 01:43 PM

Hi,

 

My renderer has this issue where I get an DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL warning when using DrawIndexed(Instanced)().

 

I use 16 bit index buffers that refer to max 2^16 vertices chunks in a vertex buffer. Whenever I pass a BaseVertexLocation > 0 to DrawIndexed(), this warning is output. However, if I set StartIndexLocation to zero and instead pass an index buffer offset to IASetIndexBuffer(), the warning disappears. For both cases the rendered scene looks fine.

 

Any ideas what could be causing this?

 



Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2852

Like
2Likes
Like

Posted 02 January 2013 - 05:11 AM

As far as I know, StartIndexLocation and Index Buffer Offset is almost the same thing. The difference is that the offset is in bytes so you have to take the index size (16 bit vs 32 bit) into account. They both accomplish the same thing, ie. defining where to start reading the indices. Both can be used in the same time or just one of them. Typically I define the location of the indices only with the byte offset.

The BaseVertexLocation however is another kind of offset. The MSDN says that "BaseVertexLocation is a value added to each index before reading a vertex from the vertex buffer." So this offset is changing the index which is used to access the vertex buffer.

The error message you get is related to the situation where your drawing call is "out of bounds" ie. trying to read indices outside of the index buffer.

Changing just BaseVertexLocation shouldn't give this error since it doesn't affect the starting point of reading or the amount of reading from the index buffer. However, messing with all the three values (BaseVertexLocation, StartIndexLocation, Index Buffer Offset) are a good source of errors and incorrect output.

You should look into the the program logic again and verify that you are reading the index buffer from desired location with the amount of indices that resides inside the buffer.

Enable Direct3d debugging and enable the break points so that you can halt the program at the point which creates the error.

Cheers!

Edited by kauna, 02 January 2013 - 05:42 AM.


#3 eppo   Crossbones+   -  Reputation: 2621

Like
1Likes
Like

Posted 02 January 2013 - 06:39 AM

You're right. I was led off course by the fact that using an offset in IASetIndexBuffer() doesn't generate an error, making me think it was something API related. It turns out there was a bug in my offset calculations.

 

I prefer to pass the offsets to DrawIndexed() as it involves less state changes when using the same index buffer.



#4 kauna   Crossbones+   -  Reputation: 2852

Like
0Likes
Like

Posted 02 January 2013 - 07:10 AM

I prefer to pass the offsets to DrawIndexed() as it involves less state changes when using the same index buffer.

 

Putting it that way, I guess you are right. 

 

Cheers!



#5 eppo   Crossbones+   -  Reputation: 2621

Like
1Likes
Like

Posted 11 January 2013 - 08:57 AM

Update: my offsets were correct after all.

 

There is a known bug in the D3D11 debug layer that generates the "Index buffer has not enough space!" warning when both the StartIndexLocation and BaseVertexLocation arguments to DrawIndexed() are non-zero.






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