[cl-opengl-devel] slow interpolation issues

cage cage at katamail.com
Mon Mar 11 09:38:14 UTC 2013


On Sun, Mar 10, 2013 at 06:24:34PM -0500, Bart Botta wrote:

Hi,

thank you for your reply!

[...]

> Most of the problem is https://github.com/3b/cl-opengl/issues/27 (glaref
> and (setf glaref) are slow).
> 
> Another problem is that the compiler doesn't know what types the values
> are, so has to call generic math routines instead of using CPU ops directly.
> 
> Storing the source arrays as specialized lisp arrays, and declaring types
> (and/or check-type) would help with both problems, though writing to the
> gl-array would still be slow until that bug is fixed. You could work around
> the bug by using cffi:mem-aref directly instead of glaref, 

I have just replaced all glaref calls with:

(cffi:mem-aref (gl::gl-array-pointer array) :float offset)

and the results are surprisingly good!

  seconds  |     gc     | consed | calls |  sec/call  |  name  
----------------------------------------------------
     3.924 |      0.000 |      0 | 2,500 |   0.001569 | CL-GL-UTILS:LERP-GL-ARRAY
----------------------------------------------------
     3.924 |      0.000 |      0 | 2,500 |            | Total

> or if you are
> using shaders, you could just do the interpolation on the GPU.

That's a good idea indeed! My fault is that i still stick with the old
fixed pipeline opengl paradigm.
 
Thank you for your help!
C.





More information about the cl-opengl-devel mailing list