[Verse-dev] Bitmap layer ids

Emil Brink verse-dev@blender.org
Thu, 12 Aug 2004 19:10:37 +0200


On Thu, 12 Aug 2004 18:29:01 +0200
Thorsten Jordan <Thorsten_Jordan@gmx.de> wrote:

> Hi!
> 
> I'm working with the r3p2 server.
> I noticed that when creating layers with verse_send_b_layer_create and 
> using an layer_id of 0 and waiting for the server to send the layers, 
> nothing happens, it just stops/sleeps after one received layer.

But you do get one layer created, right?

> When i use my own values (1,2,3) all is fine.
> The code:
> verse_send_b_layer_create(node_id, 1, "col_r", VN_B_LAYER_UINT8);
> verse_send_b_layer_create(node_id, 2, "col_g", VN_B_LAYER_UINT8);
> verse_send_b_layer_create(node_id, 3, "col_b", VN_B_LAYER_UINT8);
> 
> if i use 0,0,0 instead of 1,2,3 here, the server seems to lock up.
> The tutorial suggests doing it that way, though.
> Is this a bug? any help?

This is not quite a bug, it is a _very_ unexpected side-effect of a
feature, actually. Heh. Honest!

The Verse protocol has a feature we like to refer to as "event com-
pression", which means (roughly) that two commands that address the
same piece of data are never sent in the same packet. Instead, the
last command passed to Verse replaces any previous ones. This is what
happens here; the "address" part of the b_layer_create command is the
<node_id, layer_id> tuple, so any time you use the same numerical
value for the layer_id in e.g. three subsequent commands, they will
all compress in the outgoing queue and only the last one will actually
reach the host.

<http://www.blender.org/modules/verse/verse-spec/resend.html#AEN2973>
in the spec talks a bit more about this. See any command specification
page, such as <http://www.blender.org/modules/verse/verse-spec/b_layer_create.html>,
too see what part of a command's parameters make up its address.

The workaround is to use a set of different, known-unused, IDs when
sending create commands. I typically use ~0, ~1, ~2, and so on if
in a loop.

I would very much wish for a better solution to this situation, but am
not aware of any easy fix. Perhaps Eskil has some ideas?

Regards,

/Emil