Hi there.
As you probably now - there is one entry among DeviceCaps called MaxVertexIndex. As the name implies, it is supposed to indicate the maximum possible INDEX of a vertex in a vertex buffer. Since in C++/C# we index arrays starting with 0, one can guess that maximum index being (x) means the maximal size is (x + 1).
Now, I am testing my MDX application on a a 945GM chipset, and MaxVertexIndex is 65534, so I guess that the maximal size is 65535, which seems perfectly ok, since this is all one can get from a 16-bit register (2^16 - 1). [edit: actually: MaxVertexIndex = 65535 and therefore maximal buffer size = 65536 would be all one can get from a 16-bit reg.]
I need to
create a mesh out of vertex and index buffer, simple. Having loaded
these two appropriately, I call mesh constructor. The thing is that when
I try to construct the mesh specifying vertex number of 65535, the constructor throws the almighty "Error in the application"; specifying vertex number 65534 goes without any problems.
The question is - why? I could just hard-code it to work, but the twisted logic is quite irritating and I cannot be guaranteed that some other chipset will demand vertex number of (MaxVertexIndex - 3) or so in the mesh ctor. How can one create anything usable on many machines :/.
Any ideas? Is mesh constructor subject to some additional limitations apart from the MaxVertexIndex or am I missing something?