[compiz] [PATCH]Make wobbly's bezier patch to work with grids that aren't 4x4.

Kristian Høgsberg krh at bitplanet.net
Wed May 2 22:51:52 EEST 2007


On 5/2/07, David Reveman <davidr at novell.com> wrote:
> On Wed, 2007-05-02 at 01:02 +0300, Roi Cohen wrote:
> > This patch is not supposed to make bezierPatchEvaluate any slower than
> > it is right now for 4x4 grids.
> > 4x4 grid is hard-coded anyway (but inside a define), and this patch
> > will just make it possible to people who want to hack this plugin to
> > make bigger grids (of course, bigger grids will affect performance).
> > So this patch actually doesn't change anything, but the "correctness"
> > of this function, and also shouldn't have any performance affect.
>
> You're adding branching, two loops, calls to 'pow' function and a bunch
> of divisions to a function that is often executed many thousand times
> per second. It's not obvious to me that this wont have a performance
> impact.
>
> I understand that it's a correction fix but removing those GRID defines
> and making it obvious that the code is hard-coded to 4x4 and not
> allowing it to be changed is just as correct. As your testing proved
> that changing it to anything but 4x4 doesn't make much sense, I find
> this more appropriate as we don't have to worry about the possible
> performance impact those changes might have to bezierPatchEvaluate.

And it's less correct not more correct.  A bezier curve has 4 control
points, a bezier patch has 4x4 control points.  If you want to hack
something up to allow more control points, fine, but it's no longer a
*bezier*  patch.  And the main reason for using the bezier patch
instead of just using enough model object and controlling the grid
using their positions was to *cut down* on the number of control
points to reduce the ripple propagation time through the grid.

Just because something can be made configurable doesn't mean it's a good idea.

Kristian


More information about the compiz mailing list