Began working on more flags to peel back some of the ease-of-use layers in PyOpenGL to recoup performance. List/tuple array-types now respect the ERROR_ON_COPY flag (effectively disabling list/tuple support when the flag is activated) and there is a STORE_POINTERS flag, which when False (with ERROR_ON_COPY True) will disable wrapper operations storePointer mechanism. That's one stage of 5 wrapper stages. There are three stages that can't be eliminated without overtly changing APIs (the "interpret Python arguments", "expand Python arguments to C-compatible arguments" and "return the correct value" stages).
I worked on eliminating the "convert C-compatible to Ctypes-compatible" stage this morning, and with the two previous optimizations it seems to be a no-brainer (array types have from_param properties, so ctypes will automatically do the operations if the types are already in C-compatible format and aren't temporary objects).
The wrapper code is already Cython-accelerated, so there's no huge need to eliminate the remaining three flags. Still, want to add some code to the wrapper to allow wrappers to drop out of the picture entirely if after all the optimizations are taken into account there's no wrapping left to do.
I'm discovering a small set of cases in OpenGLContext where I was using temporary list/tuple objects as vectors. There is also a case where gluTess* requires doubles, while OpenGLContext now uses floats by default, so a copy was introduced. I'm considering just writing my own tesselation code there.
I'm also beginning to flesh out how I want to do a "Longs Peak-like" rework of the rendering engine, I enabled observation of structural changes yesterday. With that node-paths will be able to watch for changes and the rendering loop can be reduced to a set of rendering tokens which will be fed from the scenegraph, but will be a simple linear loop rather than a complex scenegraph traversal on each frame.
Also fixed a bug with PyOpenGL's Numpy+NURBs introduced by the NURBs error-checking "fix" from the weekend.
Pingbacks are closed.