[Verse-dev] g_vertex_set_real32_xyz bug

Brecht Van Lommel verse-dev@blender.org
30 Jun 2004 12:11:14 +0000


Hi,

On Wed, 2004-06-30 at 06:42, Emil Brink wrote: 
> On Tue, 29 Jun 2004, Brecht Van Lommel wrote:
> 
> > Hi all,
> >
> > I stumbled upon a bug in g_vertex_set_real32_xyz, causing the server to
> > crash when sending back this command.
> >
> > In v_gen_pack_g_node.c, in verse_send_g_vertex_delete_real32 and
> > verse_send_g_vertex_set_real32_xyz, the coords are packed as a real64.
> > This should be changed to real32.
> 
> Confirmed. This is very probably because of a corresponding bug in
> v_cmd_gen.c, in the function v_cg_gen_pack() around line 466 it says
> this:
> 
> if(VCGData.param_type[i] == VCGP_REAL32)
> {
> 	if(no_param)
> 		param = "V_REAL32_MAX";
> 	fprintf(f, "\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], %s);\n", param);
> }
> 
> That should (obviously) be a real32 in the emitted pack function
> name. I changed it in my local tree (not checked in), but I'm not
> sure how we should get the fix out there.
> 
> Eskil: perhaps it's time for a r2p1 patch release?

Maybe wait a bit with that. I found some more issues:

vs_node_geometry, callback_send_g_layer_subscribe:
if(VN_FORMAT_REAL64) is (4 times) supposed to be
if(type == VN_FORMAT_REAL64)

vs_connection.c, vs_get_subscript_count:
This function gets called sometimes from vs_node_geometry with a NULL
subscription list -> crash. Either check for this in
vs_get_subscript_count or before calling it.

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

v_gen_pack_g_node, v_unpack_g_layer_create (and maybe in more
functions):
The callback sometimes gets a negative type number, for example
VN_G_LAYER_POLYGON_CORNER_REAL will give -127. "char enum_temp" is used
to unpack the type of the layer, which leads to an overflow on my
computer (linux x86), since 129 doesn't fit in the char.

With these things fixed, sending a real32 mesh with uv's works :).

> > And some other bug I found while looking for the other one:
> >
> > In vs_node_geometry.c, vs_g_create_node:
> > layer[x].def.real and/or def.integer are not initialized (the ones for
> > the vertex XYZ and Polygon layer).
> 
> Okay, I added some initializers but haven't checked anything into CVS
> yet. We'll see when we do a new (patch) release, should be soon.
> 
> > They are probably not really used, but they cause some "jump based on
> > uninitialized value" warnings, inside printf.
> 
> Where? I didn't see any printf() in that function. Is it from the
> debug trace printouts?

Yes, the debug printouts. I see it when using Valgrind (tool to check
for leaks, uninitialized variables, ..).

> > Didn't mention this earlier: pyverse was updated for r2.
> 
> Excellent!
> 
> Thanks a lot for the updates, it is very much appreciated as always.
> 
> /Emil
> _______________________________________________
> Verse-dev mailing list
> Verse-dev@blender.org
> http://www.blender.org/mailman/listinfo/verse-dev
>