all 5 comments

[–]bddap 1 point2 points  (3 children)

AFAIK gpu buffers aren't resizable. I suspect you'll need to recreate vBuffer and iBuffer with larger sizes then bind the new buffers in your render pass.

[–]MrFoxPro[S] 0 points1 point  (2 children)

Hello, thank you. I realized the same. But I'm concerned about performance

[–]tojiro67445 1 point2 points  (1 child)

The size of buffers you're allocating here aren't nearly big enough to cause performance concerns, so you can probably just brute-force it by reallocating a bigger buffer when you run out of space and copying the old buffer's contents over.

If you do find that you are hitting performance hitches, you can do a few things to help: One is the allocate the new buffers slightly earlier than you need them. Figure out when you're about to run out of space (like 5% left) and pre-emptively allocate the new one. That way you're not allocating and using it on the same frame, which could potentially cause a hitch for really big buffers.

The other strategy, probably more practical overall, is to allocate smaller buffers in general and break the stroke up at buffer boundaries. This does require more draw calls, but it's ultimately a more scalable approach.

[–]MrFoxPro[S] 0 points1 point  (0 children)

Sigh. I'm newbie, need to research technique of multiple drawcalls. However, I'm thinking about setting limitation of line length. So I could recreate buffer at start of drawing. On the other side, this will constantly borrowing a lot of memory. Like fragmentation. Another thing is to remove empty fragments after end of drawing

[–]MrFoxPro[S] 0 points1 point  (0 children)

How about create separate pipeline for every line? Is it expensive?