[Verse-dev] g_vertex_set_real32_xyz bug

Emil Brink verse-dev@blender.org
Thu, 1 Jul 2004 09:01:19 +0200 (MEST)


On Wed, 30 Jun 2004, Brecht Van Lommel wrote:

> <snip>
>
> > > vs_node_geometry (line numbers might be a bit off):
> > > line 702: verse_send_g_polygon_set_corner_real64 must be real32
> > > line 772: verse_send_g_polygon_set_face_real64 must be real32
> > > line 779: verse_send_g_polygon_set_face_real64 must be real32
>
> Typo, line 779 should have been 797.
>
> > Are you sure? There was one on line 705 and one on line 711, but the
> > two latter are in callback_send_g_polygon_set_face_real64() so they
> > really should be 64-bit as far as I understand...
>
> As I understand it, the 'subscribers' list is supposed to get real32
> commands and the 'subscribersd' list is supposed to get real64 commands.
> So in each of these callback functions both commands should be used. In
> for example callback_send_g_polygon_set_face_real64, a real32 command
> should be sent.

Oh. Right. That does make sense, and I did the necessary changes in
the two polygon_real64 functions in my local tree. It'd be nice if
Eskil confirmed that this is indeed the right thing to do, just for
extra safety.

> <snip>
>
> > Excellent! Most of these seem to be regressions; things that used to
> > work until Eskil reworked the precision handling for floating point
> > layers.
>
> Found one more code refactoring bug. In the polygon and vertex delete
> unpack functions, the layer_id is passed to the callback function
> instead of the polygon_id/vertex_id. Patch of a fix for v_cmd_gen.c is
> attached.

Hm. The patch didn't apply cleanly in my tree, but I read it and did
the required changes manually. I'm not 100% sure what you're actually
doing (I'm not overly familiar with the internal design of v_cmd_gen)
but the output looks more correct with the changes applied. Here's a
snippet from the v_unpack_g_vertex_set_real64_xyz() function created
by the new generator:

if(x == V_REAL64_MAX || y == V_REAL64_MAX || z == V_REAL64_MAX)
{
        void (* alias_g_vertex_delete_real64)(void *user_data, VNodeID node_id, uint32 vertex_id);
        alias_g_vertex_delete_real64 = v_fs_get_alias_user_func(51);
        if(alias_g_vertex_delete_real64 != NULL)
		alias_g_vertex_delete_real64(v_fs_get_alias_user_data(51), node_id, vertex_id);
        return buffer_pos;
}

When compared to the one in CVS, the last argument to the
alias_g_vertex_delete_real64() function is now vertex_id rather than
layer_id, so I think the fix is correct. Thanks a lot, Brecht!

/Emil