How does it perform? I have not profiled the allocator. Being able to used numpy or numba vectorized operations to transform verticies was a massive performance improvement. Being able to have the rendering and game logic happen in separate processes (with multiprocessing) what use shared memory was a significant performance improvement. (for example, a 50 FPS physics simulation went to 600 FPS rendering and 180 physics time steps per second). Actually adding and deleting "vertex lists" from a Domain is likely very slow because much of the data gets shuffled around. IE: adding three elements that won't be next to each other involves reassigning six slices as it moves the data out of the way to make room and then inserts the new data. It would be an improvement if deleted areas just had null values assigned (ie, empty triangles), since if only some percentage of the buffer is "dead", it doesn't take much time to render empty triangles compared to shuffling data around.
The fragmentation is only important because it simplifies and improves the performance of the numpy operations (they operate on contiguous arrays rather than indexing over arrays with dead values). I'll poke around your branch and see what your sorting/data shuffling code looks like. -Elliot On Sat, Dec 10, 2016 at 7:36 PM, Benjamin Moran <[email protected]> wrote: > Hey Elliot, > > The defragmenting buffer sounds interesting. How does it perform? > > My solution to sorting was to keep a list of associated VertexLists in the > OrderedDomain. The VertexLists themselves all have a reference to their > parent domain (even if it's the default pyglet domain). Whenever any > VertexList's depth attribute was changed, the parent domain is marked as > dirty and gets sorted at the next draw call. It works fairly well, but I > didn't have time to figure out the glMultiDrawElements stuff. > > For an experiment I rebasing off of the IndexedVertexLists, but I > discovered that those seem to be broken. I don't know if this is just my > machine, but it seems like any batch/domain that contains indexed vertex > lists will fail to draw correctly if you delete any of the lists in the > middle of the order. Indexed vertex lists are not really necessary for the > sorting stuff, so I reverted back to plain vertex lists in my branch. > > > > > On Saturday, December 10, 2016 at 9:22:52 AM UTC+9, elliot wrote: >> >> Sounds like y'all are tackling the same issue I did when I wanted to do >> vectorized translations on vertex lists. I tried to use pyglets >> architecture but it was so tied to domains being dumb and not keeping track >> of what was in what they had allocated. This is for obvious performance >> reasons, but my idea didn't mesh at all. >> >> I made a defragmenting buffer that keeps track of each allocated entity, >> and an allocator that places new entities accordingly, rearranging the >> buffer as necessary. Everything (with a common gl state) is rendered with >> one glDrawArrays call. >> >> Sorry for the terse description. I'm on my phone. Let me know if I can >> help. I'd love if pyglet had native support for ordered, contiguous buffers >> that could interface with my entity component system. Maybe you can use >> some code from the allocator. Here's the project: >> >> https://github.com/Permafacture/data-oriented-pyglet >> >> Elliot >> > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/pyglet-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
