I'm getting a stack overflow runtime error when my vertex/index buffers exceed a certain size. What I'm trying to do is to render a huge terrain generated using noise functions.
How can I avoid that problem? I'm using native C++ and DirectX 11.
I doubt it. Even with the big grid he gets only 201*201 = 40401 vertices. Also, if that was really the matter, I rather expect a wrong rendering or a DX API call failure than a stack overflow.
This big array will be created on the stack. Does it exceed your currently set stack size (or the default size which is I think 1 Mb ) ?
Rather create the temp array on the heap with new (don't forget to delete[] afterwards). Edit: Same applies to indices, of course.
It would help to know when the stack overflow is thrown.
I doubt it. Even with the big grid he gets only 201*201 = 40401 vertices. Also, if that was really the matter, I rather expect a wrong rendering or a DX API call failure than a stack overflow.
This big array will be created on the stack. Does it exceed your currently set stack size (or the default size which is I think 1 Mb ) ?
Rather create the temp array on the heap with new (don't forget to delete[] afterwards). Edit: Same applies to indices, of course.
It would help to know when the stack overflow is thrown.
16 bit indices should also have been a problem - he is using 6 indices for each quad. This means that it would be 200*200*6 = 240,000. Although I am sure that the stack overflow is caused by the problem you described...
16 bit indices should also have been a problem - he is using 6 indices for each quad. This means that it would be 200*200*6 = 240,000. Although I am sure that the stack overflow is caused by the problem you described...[/quote]
but the maximum index value would still be 40k-something, since hes only got 40k vertices, and therefore fit into an unsigned short. if he wanted to use WORD for indexing into the index array he would have a problem, but that is only done by the GPU itself...
anyway, if your vertexarray has less than 2^16 entries (65k), WORD is a suitable index size, no matter how many indices are in the index buffer.
sorry for being a smartass
16 bit indices should also have been a problem - he is using 6 indices for each quad. This means that it would be 200*200*6 = 240,000. Although I am sure that the stack overflow is caused by the problem you described...
but the maximum index value would still be 40k-something, since hes only got 40k vertices, and therefore fit into an unsigned short. if he wanted to use WORD for indexing into the index array he would have a problem, but that is only done by the GPU itself...
anyway, if your vertexarray has less than 2^16 entries (65k), WORD is a suitable index size, no matter how many indices are in the index buffer.
sorry for being a smartass
cheers,
tasche
[/quote]That is right I missed the fine point there...