GuardianX
GuardianX

Reputation: 513

Dynamic buffers behaviour

I have a question regards dynamic vertex and index buffers. Can I change their topology completely? For example, having one set of vertices in one frame, throw them away and recreate vertices with their own properties and count not equal to previous count of vertices. Also I want to know the same about index buffer, can I change the number of indices in dynamic index buffer?

So far in my application I have a warning when trying to update index buffer with larger size: D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: Index buffer has not enough space! [ EXECUTION WARNING #359: DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL]

Upvotes: 2

Views: 1260

Answers (1)

Lucius
Lucius

Reputation: 3745

Changing the size of a buffer after creation is not possible.

A dynamic buffer allows you to update the data. You can write new data to it as long as it does not exceed the buffer's size.

But buffers don't care about data layout. A buffer with a size of 200 bytes can hold 100 shorts or 50 floats or mixed data; anything less or equal to 200 bytes.

Upvotes: 2

Related Questions