[cl-opengl-devel] slow interpolation issues

Bart Botta 00003b at gmail.com
Sun Mar 10 23:24:34 UTC 2013


On Sun, Mar 10, 2013 at 8:35 AM, cage <cage at katamail.com> wrote:

> (defun lerp-gl-array (a b c count interpolation-factor)
>   (dotimes (i count)
>     (setf (gl:glaref c i)
>       (alexandria:lerp interpolation-factor (gl:glaref a i) (gl:glaref b
> i)))))
>
> is this my fault? Any idea how can I improve performance?
>

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, or if you are
using shaders, you could just do the interpolation on the GPU.

-b-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-opengl-devel/attachments/20130310/8a54aaf9/attachment.html>


More information about the cl-opengl-devel mailing list