Please sign in to comment.
Fix occasional rendering glitch, under immediate mode interface.
We still support our old "immediate-mode"-style rendering interface, where vertex data is embedded directly into the vsDisplayList, even though modern graphic APIs don't support that. We just push the data into a temporary VBO and render from it as the data comes to us. The issue is that we're following a naive streaming strategy for pushing that data to OpenGL; we just keep tacking on new data until the buffer fills up, then we orphan the buffer and keep going. But if that "run out of space" thing happens in the middle of setting up a draw, you wind up orphaning a buffer which contained data needed for the draw, before you actually kicked off a draw that was using the data. This would lead to draws with some invalid vertex attributes. This commit changes things so that we wait until just before issuing a draw call, and then bind all of our vertex attributes all at once, instead of doing it precisely when the display list told us to do it. This means that we can test in advance that *all* our vertex data will fit into the shared VBO at the same time, instead of running out of space partway through and getting a corrupt draw.
- Loading branch information...
Showing with 93 additions and 7 deletions.