While using DirectxTK I stumbled upon the problem with PrimitiveBatch class. After series of Begin/DrawIndexed/End class I start to get following warning in the VS output window:
D3D11: WARNING: ID3D11DeviceContext::DrawIndexed: Index buffer has not enough space! [ EXECUTION WARNING #359: DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL ]
After debugging I found that the warning appears after the
mDeviceContext->DrawIndexed((UINT)(mCurrentIndex - mBaseIndex), (UINT)mBaseIndex, (UINT)mBaseVertex);
call inside PrimitiveBatch.cpp line 267.
Here's the stats of the batch class
Next to last call (still no warnings)
Last call before the warning (after executing this call warning appears)
As you can see I'm not at the max bounds, but warning appears. I've tried to make PrimitiveBatch index capacity (parameter to the constructor) less than default, however I just get warning on earlier calls.